Upgrade to Avalonia 11.0.0-preview6
This commit is contained in:
Родитель
d9469b653c
Коммит
a4e751a118
|
@ -2,7 +2,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
<AvaloniaVersion>11.0.999-cibuild0031007-beta</AvaloniaVersion>
|
<AvaloniaVersion>11.0.0-preview6</AvaloniaVersion>
|
||||||
<TextMateSharpVersion>1.0.50</TextMateSharpVersion>
|
<TextMateSharpVersion>1.0.50</TextMateSharpVersion>
|
||||||
<NewtonsoftJsonVersion>13.0.1</NewtonsoftJsonVersion>
|
<NewtonsoftJsonVersion>13.0.1</NewtonsoftJsonVersion>
|
||||||
<VersionSuffix>beta</VersionSuffix>
|
<VersionSuffix>beta</VersionSuffix>
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace AvaloniaEdit.Demo
|
||||||
_textEditor.ShowLineNumbers = true;
|
_textEditor.ShowLineNumbers = true;
|
||||||
_textEditor.ContextMenu = new ContextMenu
|
_textEditor.ContextMenu = new ContextMenu
|
||||||
{
|
{
|
||||||
Items = new List<MenuItem>
|
ItemsSource = new List<MenuItem>
|
||||||
{
|
{
|
||||||
new MenuItem { Header = "Copy", InputGesture = new KeyGesture(Key.C, KeyModifiers.Control) },
|
new MenuItem { Header = "Copy", InputGesture = new KeyGesture(Key.C, KeyModifiers.Control) },
|
||||||
new MenuItem { Header = "Paste", InputGesture = new KeyGesture(Key.V, KeyModifiers.Control) },
|
new MenuItem { Header = "Paste", InputGesture = new KeyGesture(Key.V, KeyModifiers.Control) },
|
||||||
|
@ -84,7 +84,7 @@ namespace AvaloniaEdit.Demo
|
||||||
Language csharpLanguage = _registryOptions.GetLanguageByExtension(".cs");
|
Language csharpLanguage = _registryOptions.GetLanguageByExtension(".cs");
|
||||||
|
|
||||||
_syntaxModeCombo = this.FindControl<ComboBox>("syntaxModeCombo");
|
_syntaxModeCombo = this.FindControl<ComboBox>("syntaxModeCombo");
|
||||||
_syntaxModeCombo.Items = _registryOptions.GetAvailableLanguages();
|
_syntaxModeCombo.ItemsSource = _registryOptions.GetAvailableLanguages();
|
||||||
_syntaxModeCombo.SelectedItem = csharpLanguage;
|
_syntaxModeCombo.SelectedItem = csharpLanguage;
|
||||||
_syntaxModeCombo.SelectionChanged += SyntaxModeCombo_SelectionChanged;
|
_syntaxModeCombo.SelectionChanged += SyntaxModeCombo_SelectionChanged;
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace AvaloniaEdit.CodeCompletion
|
||||||
_listBox = e.NameScope.Find("PART_ListBox") as CompletionListBox;
|
_listBox = e.NameScope.Find("PART_ListBox") as CompletionListBox;
|
||||||
if (_listBox != null)
|
if (_listBox != null)
|
||||||
{
|
{
|
||||||
_listBox.Items = _completionData;
|
_listBox.ItemsSource = _completionData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@ namespace AvaloniaEdit.CodeCompletion
|
||||||
|
|
||||||
_currentList = listBoxItems;
|
_currentList = listBoxItems;
|
||||||
//_listBox.Items = null; Makes no sense? Tooltip disappeared because of this
|
//_listBox.Items = null; Makes no sense? Tooltip disappeared because of this
|
||||||
_listBox.Items = listBoxItems;
|
_listBox.ItemsSource = listBoxItems;
|
||||||
SelectIndexCentered(bestIndex);
|
SelectIndexCentered(bestIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace AvaloniaEdit.CodeCompletion
|
||||||
{
|
{
|
||||||
IsLightDismissEnabled = true,
|
IsLightDismissEnabled = true,
|
||||||
PlacementTarget = this,
|
PlacementTarget = this,
|
||||||
PlacementMode = PlacementMode.Right,
|
Placement = PlacementMode.Right,
|
||||||
Child = _toolTipContent,
|
Child = _toolTipContent,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace AvaloniaEdit.CodeCompletion
|
||||||
StartOffset = EndOffset = TextArea.Caret.Offset;
|
StartOffset = EndOffset = TextArea.Caret.Offset;
|
||||||
|
|
||||||
PlacementTarget = TextArea.TextView;
|
PlacementTarget = TextArea.TextView;
|
||||||
PlacementMode = PlacementMode.AnchorAndGravity;
|
Placement = PlacementMode.AnchorAndGravity;
|
||||||
PlacementAnchor = Avalonia.Controls.Primitives.PopupPositioning.PopupAnchor.TopLeft;
|
PlacementAnchor = Avalonia.Controls.Primitives.PopupPositioning.PopupAnchor.TopLeft;
|
||||||
PlacementGravity = Avalonia.Controls.Primitives.PopupPositioning.PopupGravity.BottomRight;
|
PlacementGravity = Avalonia.Controls.Primitives.PopupPositioning.PopupGravity.BottomRight;
|
||||||
|
|
||||||
|
|
|
@ -446,7 +446,7 @@ namespace AvaloniaEdit.Editing
|
||||||
var visualLine = _textView.GetOrConstructVisualLine(_textView.Document.GetLineByNumber(_position.Line));
|
var visualLine = _textView.GetOrConstructVisualLine(_textView.Document.GetLineByNumber(_position.Line));
|
||||||
return _textArea.OverstrikeMode ? CalcCaretOverstrikeRectangle(visualLine) : CalcCaretRectangle(visualLine);
|
return _textArea.OverstrikeMode ? CalcCaretOverstrikeRectangle(visualLine) : CalcCaretRectangle(visualLine);
|
||||||
}
|
}
|
||||||
return Rect.Empty;
|
return default;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -465,7 +465,7 @@ namespace AvaloniaEdit.Editing
|
||||||
public void BringCaretToView(double border)
|
public void BringCaretToView(double border)
|
||||||
{
|
{
|
||||||
var caretRectangle = CalculateCaretRectangle();
|
var caretRectangle = CalculateCaretRectangle();
|
||||||
if (!caretRectangle.IsEmpty)
|
if (caretRectangle != default)
|
||||||
{
|
{
|
||||||
caretRectangle = caretRectangle.Inflate(border);
|
caretRectangle = caretRectangle.Inflate(border);
|
||||||
_textView.MakeVisible(caretRectangle);
|
_textView.MakeVisible(caretRectangle);
|
||||||
|
|
|
@ -1154,7 +1154,7 @@ namespace AvaloniaEdit.Editing
|
||||||
{
|
{
|
||||||
if(_textArea == null)
|
if(_textArea == null)
|
||||||
{
|
{
|
||||||
return Rect.Empty;
|
return default;
|
||||||
}
|
}
|
||||||
|
|
||||||
var transform = _textArea.TextView.TransformToVisual(_textArea);
|
var transform = _textArea.TextView.TransformToVisual(_textArea);
|
||||||
|
|
|
@ -210,7 +210,7 @@ namespace AvaloniaEdit.Rendering
|
||||||
int segmentStartVcInLine = Math.Max(segmentStartVc, visualStartCol);
|
int segmentStartVcInLine = Math.Max(segmentStartVc, visualStartCol);
|
||||||
int segmentEndVcInLine = Math.Min(segmentEndVc, visualEndCol);
|
int segmentEndVcInLine = Math.Min(segmentEndVc, visualEndCol);
|
||||||
y -= scrollOffset.Y;
|
y -= scrollOffset.Y;
|
||||||
Rect lastRect = Rect.Empty;
|
Rect lastRect = default;
|
||||||
if (segmentStartVcInLine == segmentEndVcInLine) {
|
if (segmentStartVcInLine == segmentEndVcInLine) {
|
||||||
// GetTextBounds crashes for length=0, so we'll handle this case with GetDistanceFromCharacterHit
|
// GetTextBounds crashes for length=0, so we'll handle this case with GetDistanceFromCharacterHit
|
||||||
// We need to return a rectangle to ensure empty lines are still visible
|
// We need to return a rectangle to ensure empty lines are still visible
|
||||||
|
@ -229,7 +229,7 @@ namespace AvaloniaEdit.Rendering
|
||||||
foreach (var b in line.GetTextBounds(segmentStartVcInLine, segmentEndVcInLine - segmentStartVcInLine)) {
|
foreach (var b in line.GetTextBounds(segmentStartVcInLine, segmentEndVcInLine - segmentStartVcInLine)) {
|
||||||
double left = b.Rectangle.Left - scrollOffset.X;
|
double left = b.Rectangle.Left - scrollOffset.X;
|
||||||
double right = b.Rectangle.Right - scrollOffset.X;
|
double right = b.Rectangle.Right - scrollOffset.X;
|
||||||
if (!lastRect.IsEmpty)
|
if (lastRect != default)
|
||||||
yield return lastRect;
|
yield return lastRect;
|
||||||
// left>right is possible in RTL languages
|
// left>right is possible in RTL languages
|
||||||
lastRect = new Rect(Math.Min(left, right), y, Math.Abs(right - left), line.Height);
|
lastRect = new Rect(Math.Min(left, right), y, Math.Abs(right - left), line.Height);
|
||||||
|
@ -261,7 +261,7 @@ namespace AvaloniaEdit.Rendering
|
||||||
right = visualLine.GetTextLineVisualXPosition(lastTextLine, segmentEndVc);
|
right = visualLine.GetTextLineVisualXPosition(lastTextLine, segmentEndVc);
|
||||||
}
|
}
|
||||||
Rect extendSelection = new Rect(Math.Min(left, right), y, Math.Abs(right - left), line.Height);
|
Rect extendSelection = new Rect(Math.Min(left, right), y, Math.Abs(right - left), line.Height);
|
||||||
if (!lastRect.IsEmpty) {
|
if (lastRect != default) {
|
||||||
if (extendSelection.Intersects(lastRect)) {
|
if (extendSelection.Intersects(lastRect)) {
|
||||||
lastRect.Union(extendSelection);
|
lastRect.Union(extendSelection);
|
||||||
yield return lastRect;
|
yield return lastRect;
|
||||||
|
|
|
@ -202,7 +202,7 @@ namespace AvaloniaEdit.Rendering
|
||||||
|
|
||||||
public override double Baseline => _element.Text.Baseline;
|
public override double Baseline => _element.Text.Baseline;
|
||||||
|
|
||||||
public override Size Size => Size.Empty;
|
public override Size Size => default;
|
||||||
|
|
||||||
public override void Draw(DrawingContext drawingContext, Point origin)
|
public override void Draw(DrawingContext drawingContext, Point origin)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1952,7 +1952,7 @@ namespace AvaloniaEdit.Rendering
|
||||||
|
|
||||||
bool ILogicalScrollable.BringIntoView(Control target, Rect rectangle)
|
bool ILogicalScrollable.BringIntoView(Control target, Rect rectangle)
|
||||||
{
|
{
|
||||||
if (rectangle.IsEmpty || target == null || target == this || !this.IsVisualAncestorOf(target))
|
if (rectangle == default || target == null || target == this || !this.IsVisualAncestorOf(target))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ using Moq;
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ namespace AvaloniaEdit.AvaloniaMocks
|
||||||
return _defaultFamilyName;
|
return _defaultFamilyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<string> GetInstalledFontFamilyNames(bool checkForUpdates = false)
|
public string[] GetInstalledFontFamilyNames(bool checkForUpdates = false)
|
||||||
{
|
{
|
||||||
return new[] { _defaultFamilyName };
|
return new[] { _defaultFamilyName };
|
||||||
}
|
}
|
||||||
|
@ -37,9 +38,17 @@ namespace AvaloniaEdit.AvaloniaMocks
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IGlyphTypeface CreateGlyphTypeface(Typeface typeface)
|
public bool TryCreateGlyphTypeface(string familyName, FontStyle style, FontWeight weight,
|
||||||
|
FontStretch stretch, out IGlyphTypeface glyphTypeface)
|
||||||
{
|
{
|
||||||
return new MockGlyphTypeface();
|
glyphTypeface = new MockGlyphTypeface();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TryCreateGlyphTypeface(Stream stream, out IGlyphTypeface glyphTypeface)
|
||||||
|
{
|
||||||
|
glyphTypeface = new MockGlyphTypeface();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,10 @@ namespace AvaloniaEdit.AvaloniaMocks
|
||||||
width += glyphInfos[i].GlyphAdvance;
|
width += glyphInfos[i].GlyphAdvance;
|
||||||
}
|
}
|
||||||
|
|
||||||
Size = new Size(width, 10);
|
Bounds = new Rect(new Size(width, 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Size Size { get; }
|
public Rect Bounds { get; }
|
||||||
|
|
||||||
public Point BaselineOrigin => new Point(0, 8);
|
public Point BaselineOrigin => new Point(0, 8);
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace AvaloniaEdit.AvaloniaMocks
|
||||||
IsFixedPitch = true
|
IsFixedPitch = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public FontStretch Stretch { get; }
|
||||||
public int GlyphCount => 1337;
|
public int GlyphCount => 1337;
|
||||||
|
|
||||||
public FontSimulations FontSimulations => throw new NotImplementedException();
|
public FontSimulations FontSimulations => throw new NotImplementedException();
|
||||||
|
@ -62,6 +63,10 @@ namespace AvaloniaEdit.AvaloniaMocks
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string FamilyName => "";
|
||||||
|
public FontWeight Weight => FontWeight.Normal;
|
||||||
|
public FontStyle Style => FontStyle.Normal;
|
||||||
|
|
||||||
public bool TryGetGlyphMetrics(ushort glyph, out GlyphMetrics metrics)
|
public bool TryGetGlyphMetrics(ushort glyph, out GlyphMetrics metrics)
|
||||||
{
|
{
|
||||||
metrics = new GlyphMetrics
|
metrics = new GlyphMetrics
|
||||||
|
|
Загрузка…
Ссылка в новой задаче