Search is not available for this dataset
id
stringlengths
1
8
text
stringlengths
72
9.81M
addition_count
int64
0
10k
commit_subject
stringlengths
0
3.7k
deletion_count
int64
0
8.43k
file_extension
stringlengths
0
32
lang
stringlengths
1
94
license
stringclasses
10 values
repo_name
stringlengths
9
59
10058150
<NME> FoldingMargin.cs <BEF> // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.Linq; using Avalonia; using AvaloniaEdit.Editing; using AvaloniaEdit.Rendering; using AvaloniaEdit.Utils; using Avalonia.Controls; using Avalonia.Media; using Avalonia.Media.TextFormatting; namespace AvaloniaEdit.Folding { /// <summary> /// A margin that shows markers for foldings and allows to expand/collapse the foldings. /// </summary> public class FoldingMargin : AbstractMargin { /// <summary> /// Gets/Sets the folding manager from which the foldings should be shown. /// </summary> public FoldingManager FoldingManager { get; set; } internal const double SizeFactor = Constants.PixelPerPoint; static FoldingMargin() { FoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); FoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); } #region Brushes /// <summary> /// FoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBrush", Brushes.Gray, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of folding markers. /// </summary> public IBrush FoldingMarkerBrush { get => GetValue(FoldingMarkerBrushProperty); set => SetValue(FoldingMarkerBrushProperty, value); } /// <summary> /// FoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of folding markers. /// </summary> public IBrush FoldingMarkerBackgroundBrush { get => GetValue(FoldingMarkerBackgroundBrushProperty); set => SetValue(FoldingMarkerBackgroundBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBrush", Brushes.Black, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBrush { get => GetValue(SelectedFoldingMarkerBrushProperty); set => SetValue(SelectedFoldingMarkerBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBackgroundBrush { get => GetValue(SelectedFoldingMarkerBackgroundBrushProperty); set => SetValue(SelectedFoldingMarkerBackgroundBrushProperty, value); } private static void OnUpdateBrushes(AvaloniaPropertyChangedEventArgs e) { FoldingMargin m = null; if (e.Sender is FoldingMargin margin) m = margin; else if (e.Sender is TextEditor editor) m = editor.TextArea.LeftMargins.FirstOrDefault(c => c is FoldingMargin) as FoldingMargin; if (m == null) return; if (e.Property.Name == FoldingMarkerBrushProperty.Name) { m._foldingControlPen = new Pen((IBrush)e.NewValue); } if (e.Property.Name == SelectedFoldingMarkerBrushProperty.Name) { m._selectedFoldingControlPen = new Pen((IBrush)e.NewValue); } } #endregion /// <inheritdoc/> protected override Size MeasureOverride(Size availableSize) { foreach (var m in _markers) { m.Measure(availableSize); } var width = SizeFactor * GetValue(TextBlock.FontSizeProperty); return new Size(PixelSnapHelpers.RoundToOdd(width, PixelSnapHelpers.GetPixelSize(this).Width), 0); } /// <inheritdoc/> protected override Size ArrangeOverride(Size finalSize) { var pixelSize = PixelSnapHelpers.GetPixelSize(this); foreach (var m in _markers) { var visualColumn = m.VisualLine.GetVisualColumn(m.FoldingSection.StartOffset - m.VisualLine.FirstDocumentLine.Offset); var textLine = m.VisualLine.GetTextLine(visualColumn); var yPos = m.VisualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextMiddle) - TextView.VerticalOffset; yPos -= m.DesiredSize.Height / 2; var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } return base.ArrangeOverride(finalSize); } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); protected override void OnTextViewVisualLinesChanged() { foreach (var m in _markers) { VisualChildren.Remove(m); } _markers.Clear(); InvalidateVisual(); if (TextView != null && FoldingManager != null && TextView.VisualLinesValid) { foreach (var line in TextView.VisualLines) { var fs = FoldingManager.GetNextFolding(line.FirstDocumentLine.Offset); if (fs?.StartOffset <= line.LastDocumentLine.Offset + line.LastDocumentLine.Length) { var m = new FoldingMarginMarker { IsExpanded = !fs.IsFolded, VisualLine = line, FoldingSection = fs }; _markers.Add(m); VisualChildren.Add(m); m.PropertyChanged += (o, args) => { if (args.Property == IsPointerOverProperty) { InvalidateVisual(); } }; InvalidateMeasure(); } } } } private Pen _foldingControlPen = new Pen(FoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); private Pen _selectedFoldingControlPen = new Pen(SelectedFoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); /// <inheritdoc/> public override void Render(DrawingContext drawingContext) { if (TextView == null || !TextView.VisualLinesValid) return; if (TextView.VisualLines.Count == 0 || FoldingManager == null) return; var allTextLines = TextView.VisualLines.SelectMany(vl => vl.TextLines).ToList(); var colors = new Pen[allTextLines.Count + 1]; var endMarker = new Pen[allTextLines.Count]; CalculateFoldLinesForFoldingsActiveAtStart(allTextLines, colors, endMarker); CalculateFoldLinesForMarkers(allTextLines, colors, endMarker); DrawFoldLines(drawingContext, colors, endMarker); } /// <summary> /// Calculates fold lines for all folding sections that start in front of the current view /// and run into the current view. /// </summary> private void CalculateFoldLinesForFoldingsActiveAtStart(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { var viewStartOffset = TextView.VisualLines[0].FirstDocumentLine.Offset; var viewEndOffset = TextView.VisualLines.Last().LastDocumentLine.EndOffset; var foldings = FoldingManager.GetFoldingsContaining(viewStartOffset); var maxEndOffset = 0; foreach (var fs in foldings) { var end = fs.EndOffset; if (end <= viewEndOffset && !fs.IsFolded) { var textLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (textLineNr >= 0) { endMarker[textLineNr] = _foldingControlPen; } } if (end > maxEndOffset && fs.StartOffset < viewStartOffset) { maxEndOffset = end; } } if (maxEndOffset > 0) { if (maxEndOffset > viewEndOffset) { for (var i = 0; i < colors.Length; i++) { colors[i] = _foldingControlPen; } } else { var maxTextLine = GetTextLineIndexFromOffset(allTextLines, maxEndOffset); for (var i = 0; i <= maxTextLine; i++) { colors[i] = _foldingControlPen; } } } } /// <summary> /// Calculates fold lines for all folding sections that start inside the current view /// </summary> private void CalculateFoldLinesForMarkers(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { foreach (var marker in _markers) { var end = marker.FoldingSection.EndOffset; var endTextLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (!marker.FoldingSection.IsFolded && endTextLineNr >= 0) { if (marker.IsPointerOver) endMarker[endTextLineNr] = _selectedFoldingControlPen; else if (endMarker[endTextLineNr] == null) endMarker[endTextLineNr] = _foldingControlPen; } var startTextLineNr = GetTextLineIndexFromOffset(allTextLines, marker.FoldingSection.StartOffset); if (startTextLineNr >= 0) { for (var i = startTextLineNr + 1; i < colors.Length && i - 1 != endTextLineNr; i++) { if (marker.IsPointerOver) colors[i] = _selectedFoldingControlPen; else if (colors[i] == null) colors[i] = _foldingControlPen; } } } } /// <summary> /// Draws the lines for the folding sections (vertical line with 'color', horizontal lines with 'endMarker') /// Each entry in the input arrays corresponds to one TextLine. /// </summary> private void DrawFoldLines(DrawingContext drawingContext, Pen[] colors, Pen[] endMarker) { // Because we are using PenLineCap.Flat (the default), for vertical lines, // Y coordinates must be on pixel boundaries, whereas the X coordinate must be in the // middle of a pixel. (and the other way round for horizontal lines) var pixelSize = PixelSnapHelpers.GetPixelSize(this); var markerXPos = PixelSnapHelpers.PixelAlign(Bounds.Width / 2, pixelSize.Width); double startY = 0; var currentPen = colors[0]; var tlNumber = 0; foreach (var vl in TextView.VisualLines) { foreach (var tl in vl.TextLines) { if (endMarker[tlNumber] != null) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); drawingContext.DrawLine(endMarker[tlNumber], new Point(markerXPos - pixelSize.Width / 2, visualPos), new Point(Bounds.Width, visualPos)); } if (colors[tlNumber + 1] != currentPen) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, visualPos - pixelSize.Height / 2)); } currentPen = colors[tlNumber + 1]; startY = visualPos; } tlNumber++; } } if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, Bounds.Height)); } } private double GetVisualPos(VisualLine vl, TextLine tl, double pixelHeight) { var pos = vl.GetTextLineVisualYPosition(tl, VisualYPosition.TextMiddle) - TextView.VerticalOffset; return PixelSnapHelpers.PixelAlign(pos, pixelHeight); } private int GetTextLineIndexFromOffset(List<TextLine> textLines, int offset) { var lineNumber = TextView.Document.GetLineByOffset(offset).LineNumber; var vl = TextView.GetVisualLine(lineNumber); if (vl != null) { var relOffset = offset - vl.FirstDocumentLine.Offset; var line = vl.GetTextLine(vl.GetVisualColumn(relOffset)); return textLines.IndexOf(line); } return -1; } } } <MSG> Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style <DFF> @@ -157,7 +157,7 @@ namespace AvaloniaEdit.Folding var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } - return base.ArrangeOverride(finalSize); + return finalSize; } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); @@ -184,6 +184,7 @@ namespace AvaloniaEdit.Folding VisualLine = line, FoldingSection = fs }; + ((ISetLogicalParent)m).SetParent(this); _markers.Add(m); VisualChildren.Add(m);
2
Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style
1
.cs
cs
mit
AvaloniaUI/AvaloniaEdit
10058151
<NME> FoldingMargin.cs <BEF> // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.Linq; using Avalonia; using AvaloniaEdit.Editing; using AvaloniaEdit.Rendering; using AvaloniaEdit.Utils; using Avalonia.Controls; using Avalonia.Media; using Avalonia.Media.TextFormatting; namespace AvaloniaEdit.Folding { /// <summary> /// A margin that shows markers for foldings and allows to expand/collapse the foldings. /// </summary> public class FoldingMargin : AbstractMargin { /// <summary> /// Gets/Sets the folding manager from which the foldings should be shown. /// </summary> public FoldingManager FoldingManager { get; set; } internal const double SizeFactor = Constants.PixelPerPoint; static FoldingMargin() { FoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); FoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); } #region Brushes /// <summary> /// FoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBrush", Brushes.Gray, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of folding markers. /// </summary> public IBrush FoldingMarkerBrush { get => GetValue(FoldingMarkerBrushProperty); set => SetValue(FoldingMarkerBrushProperty, value); } /// <summary> /// FoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of folding markers. /// </summary> public IBrush FoldingMarkerBackgroundBrush { get => GetValue(FoldingMarkerBackgroundBrushProperty); set => SetValue(FoldingMarkerBackgroundBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBrush", Brushes.Black, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBrush { get => GetValue(SelectedFoldingMarkerBrushProperty); set => SetValue(SelectedFoldingMarkerBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBackgroundBrush { get => GetValue(SelectedFoldingMarkerBackgroundBrushProperty); set => SetValue(SelectedFoldingMarkerBackgroundBrushProperty, value); } private static void OnUpdateBrushes(AvaloniaPropertyChangedEventArgs e) { FoldingMargin m = null; if (e.Sender is FoldingMargin margin) m = margin; else if (e.Sender is TextEditor editor) m = editor.TextArea.LeftMargins.FirstOrDefault(c => c is FoldingMargin) as FoldingMargin; if (m == null) return; if (e.Property.Name == FoldingMarkerBrushProperty.Name) { m._foldingControlPen = new Pen((IBrush)e.NewValue); } if (e.Property.Name == SelectedFoldingMarkerBrushProperty.Name) { m._selectedFoldingControlPen = new Pen((IBrush)e.NewValue); } } #endregion /// <inheritdoc/> protected override Size MeasureOverride(Size availableSize) { foreach (var m in _markers) { m.Measure(availableSize); } var width = SizeFactor * GetValue(TextBlock.FontSizeProperty); return new Size(PixelSnapHelpers.RoundToOdd(width, PixelSnapHelpers.GetPixelSize(this).Width), 0); } /// <inheritdoc/> protected override Size ArrangeOverride(Size finalSize) { var pixelSize = PixelSnapHelpers.GetPixelSize(this); foreach (var m in _markers) { var visualColumn = m.VisualLine.GetVisualColumn(m.FoldingSection.StartOffset - m.VisualLine.FirstDocumentLine.Offset); var textLine = m.VisualLine.GetTextLine(visualColumn); var yPos = m.VisualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextMiddle) - TextView.VerticalOffset; yPos -= m.DesiredSize.Height / 2; var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } return base.ArrangeOverride(finalSize); } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); protected override void OnTextViewVisualLinesChanged() { foreach (var m in _markers) { VisualChildren.Remove(m); } _markers.Clear(); InvalidateVisual(); if (TextView != null && FoldingManager != null && TextView.VisualLinesValid) { foreach (var line in TextView.VisualLines) { var fs = FoldingManager.GetNextFolding(line.FirstDocumentLine.Offset); if (fs?.StartOffset <= line.LastDocumentLine.Offset + line.LastDocumentLine.Length) { var m = new FoldingMarginMarker { IsExpanded = !fs.IsFolded, VisualLine = line, FoldingSection = fs }; _markers.Add(m); VisualChildren.Add(m); m.PropertyChanged += (o, args) => { if (args.Property == IsPointerOverProperty) { InvalidateVisual(); } }; InvalidateMeasure(); } } } } private Pen _foldingControlPen = new Pen(FoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); private Pen _selectedFoldingControlPen = new Pen(SelectedFoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); /// <inheritdoc/> public override void Render(DrawingContext drawingContext) { if (TextView == null || !TextView.VisualLinesValid) return; if (TextView.VisualLines.Count == 0 || FoldingManager == null) return; var allTextLines = TextView.VisualLines.SelectMany(vl => vl.TextLines).ToList(); var colors = new Pen[allTextLines.Count + 1]; var endMarker = new Pen[allTextLines.Count]; CalculateFoldLinesForFoldingsActiveAtStart(allTextLines, colors, endMarker); CalculateFoldLinesForMarkers(allTextLines, colors, endMarker); DrawFoldLines(drawingContext, colors, endMarker); } /// <summary> /// Calculates fold lines for all folding sections that start in front of the current view /// and run into the current view. /// </summary> private void CalculateFoldLinesForFoldingsActiveAtStart(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { var viewStartOffset = TextView.VisualLines[0].FirstDocumentLine.Offset; var viewEndOffset = TextView.VisualLines.Last().LastDocumentLine.EndOffset; var foldings = FoldingManager.GetFoldingsContaining(viewStartOffset); var maxEndOffset = 0; foreach (var fs in foldings) { var end = fs.EndOffset; if (end <= viewEndOffset && !fs.IsFolded) { var textLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (textLineNr >= 0) { endMarker[textLineNr] = _foldingControlPen; } } if (end > maxEndOffset && fs.StartOffset < viewStartOffset) { maxEndOffset = end; } } if (maxEndOffset > 0) { if (maxEndOffset > viewEndOffset) { for (var i = 0; i < colors.Length; i++) { colors[i] = _foldingControlPen; } } else { var maxTextLine = GetTextLineIndexFromOffset(allTextLines, maxEndOffset); for (var i = 0; i <= maxTextLine; i++) { colors[i] = _foldingControlPen; } } } } /// <summary> /// Calculates fold lines for all folding sections that start inside the current view /// </summary> private void CalculateFoldLinesForMarkers(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { foreach (var marker in _markers) { var end = marker.FoldingSection.EndOffset; var endTextLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (!marker.FoldingSection.IsFolded && endTextLineNr >= 0) { if (marker.IsPointerOver) endMarker[endTextLineNr] = _selectedFoldingControlPen; else if (endMarker[endTextLineNr] == null) endMarker[endTextLineNr] = _foldingControlPen; } var startTextLineNr = GetTextLineIndexFromOffset(allTextLines, marker.FoldingSection.StartOffset); if (startTextLineNr >= 0) { for (var i = startTextLineNr + 1; i < colors.Length && i - 1 != endTextLineNr; i++) { if (marker.IsPointerOver) colors[i] = _selectedFoldingControlPen; else if (colors[i] == null) colors[i] = _foldingControlPen; } } } } /// <summary> /// Draws the lines for the folding sections (vertical line with 'color', horizontal lines with 'endMarker') /// Each entry in the input arrays corresponds to one TextLine. /// </summary> private void DrawFoldLines(DrawingContext drawingContext, Pen[] colors, Pen[] endMarker) { // Because we are using PenLineCap.Flat (the default), for vertical lines, // Y coordinates must be on pixel boundaries, whereas the X coordinate must be in the // middle of a pixel. (and the other way round for horizontal lines) var pixelSize = PixelSnapHelpers.GetPixelSize(this); var markerXPos = PixelSnapHelpers.PixelAlign(Bounds.Width / 2, pixelSize.Width); double startY = 0; var currentPen = colors[0]; var tlNumber = 0; foreach (var vl in TextView.VisualLines) { foreach (var tl in vl.TextLines) { if (endMarker[tlNumber] != null) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); drawingContext.DrawLine(endMarker[tlNumber], new Point(markerXPos - pixelSize.Width / 2, visualPos), new Point(Bounds.Width, visualPos)); } if (colors[tlNumber + 1] != currentPen) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, visualPos - pixelSize.Height / 2)); } currentPen = colors[tlNumber + 1]; startY = visualPos; } tlNumber++; } } if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, Bounds.Height)); } } private double GetVisualPos(VisualLine vl, TextLine tl, double pixelHeight) { var pos = vl.GetTextLineVisualYPosition(tl, VisualYPosition.TextMiddle) - TextView.VerticalOffset; return PixelSnapHelpers.PixelAlign(pos, pixelHeight); } private int GetTextLineIndexFromOffset(List<TextLine> textLines, int offset) { var lineNumber = TextView.Document.GetLineByOffset(offset).LineNumber; var vl = TextView.GetVisualLine(lineNumber); if (vl != null) { var relOffset = offset - vl.FirstDocumentLine.Offset; var line = vl.GetTextLine(vl.GetVisualColumn(relOffset)); return textLines.IndexOf(line); } return -1; } } } <MSG> Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style <DFF> @@ -157,7 +157,7 @@ namespace AvaloniaEdit.Folding var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } - return base.ArrangeOverride(finalSize); + return finalSize; } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); @@ -184,6 +184,7 @@ namespace AvaloniaEdit.Folding VisualLine = line, FoldingSection = fs }; + ((ISetLogicalParent)m).SetParent(this); _markers.Add(m); VisualChildren.Add(m);
2
Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style
1
.cs
cs
mit
AvaloniaUI/AvaloniaEdit
10058152
<NME> FoldingMargin.cs <BEF> // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.Linq; using Avalonia; using AvaloniaEdit.Editing; using AvaloniaEdit.Rendering; using AvaloniaEdit.Utils; using Avalonia.Controls; using Avalonia.Media; using Avalonia.Media.TextFormatting; namespace AvaloniaEdit.Folding { /// <summary> /// A margin that shows markers for foldings and allows to expand/collapse the foldings. /// </summary> public class FoldingMargin : AbstractMargin { /// <summary> /// Gets/Sets the folding manager from which the foldings should be shown. /// </summary> public FoldingManager FoldingManager { get; set; } internal const double SizeFactor = Constants.PixelPerPoint; static FoldingMargin() { FoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); FoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); } #region Brushes /// <summary> /// FoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBrush", Brushes.Gray, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of folding markers. /// </summary> public IBrush FoldingMarkerBrush { get => GetValue(FoldingMarkerBrushProperty); set => SetValue(FoldingMarkerBrushProperty, value); } /// <summary> /// FoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of folding markers. /// </summary> public IBrush FoldingMarkerBackgroundBrush { get => GetValue(FoldingMarkerBackgroundBrushProperty); set => SetValue(FoldingMarkerBackgroundBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBrush", Brushes.Black, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBrush { get => GetValue(SelectedFoldingMarkerBrushProperty); set => SetValue(SelectedFoldingMarkerBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBackgroundBrush { get => GetValue(SelectedFoldingMarkerBackgroundBrushProperty); set => SetValue(SelectedFoldingMarkerBackgroundBrushProperty, value); } private static void OnUpdateBrushes(AvaloniaPropertyChangedEventArgs e) { FoldingMargin m = null; if (e.Sender is FoldingMargin margin) m = margin; else if (e.Sender is TextEditor editor) m = editor.TextArea.LeftMargins.FirstOrDefault(c => c is FoldingMargin) as FoldingMargin; if (m == null) return; if (e.Property.Name == FoldingMarkerBrushProperty.Name) { m._foldingControlPen = new Pen((IBrush)e.NewValue); } if (e.Property.Name == SelectedFoldingMarkerBrushProperty.Name) { m._selectedFoldingControlPen = new Pen((IBrush)e.NewValue); } } #endregion /// <inheritdoc/> protected override Size MeasureOverride(Size availableSize) { foreach (var m in _markers) { m.Measure(availableSize); } var width = SizeFactor * GetValue(TextBlock.FontSizeProperty); return new Size(PixelSnapHelpers.RoundToOdd(width, PixelSnapHelpers.GetPixelSize(this).Width), 0); } /// <inheritdoc/> protected override Size ArrangeOverride(Size finalSize) { var pixelSize = PixelSnapHelpers.GetPixelSize(this); foreach (var m in _markers) { var visualColumn = m.VisualLine.GetVisualColumn(m.FoldingSection.StartOffset - m.VisualLine.FirstDocumentLine.Offset); var textLine = m.VisualLine.GetTextLine(visualColumn); var yPos = m.VisualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextMiddle) - TextView.VerticalOffset; yPos -= m.DesiredSize.Height / 2; var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } return base.ArrangeOverride(finalSize); } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); protected override void OnTextViewVisualLinesChanged() { foreach (var m in _markers) { VisualChildren.Remove(m); } _markers.Clear(); InvalidateVisual(); if (TextView != null && FoldingManager != null && TextView.VisualLinesValid) { foreach (var line in TextView.VisualLines) { var fs = FoldingManager.GetNextFolding(line.FirstDocumentLine.Offset); if (fs?.StartOffset <= line.LastDocumentLine.Offset + line.LastDocumentLine.Length) { var m = new FoldingMarginMarker { IsExpanded = !fs.IsFolded, VisualLine = line, FoldingSection = fs }; _markers.Add(m); VisualChildren.Add(m); m.PropertyChanged += (o, args) => { if (args.Property == IsPointerOverProperty) { InvalidateVisual(); } }; InvalidateMeasure(); } } } } private Pen _foldingControlPen = new Pen(FoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); private Pen _selectedFoldingControlPen = new Pen(SelectedFoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); /// <inheritdoc/> public override void Render(DrawingContext drawingContext) { if (TextView == null || !TextView.VisualLinesValid) return; if (TextView.VisualLines.Count == 0 || FoldingManager == null) return; var allTextLines = TextView.VisualLines.SelectMany(vl => vl.TextLines).ToList(); var colors = new Pen[allTextLines.Count + 1]; var endMarker = new Pen[allTextLines.Count]; CalculateFoldLinesForFoldingsActiveAtStart(allTextLines, colors, endMarker); CalculateFoldLinesForMarkers(allTextLines, colors, endMarker); DrawFoldLines(drawingContext, colors, endMarker); } /// <summary> /// Calculates fold lines for all folding sections that start in front of the current view /// and run into the current view. /// </summary> private void CalculateFoldLinesForFoldingsActiveAtStart(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { var viewStartOffset = TextView.VisualLines[0].FirstDocumentLine.Offset; var viewEndOffset = TextView.VisualLines.Last().LastDocumentLine.EndOffset; var foldings = FoldingManager.GetFoldingsContaining(viewStartOffset); var maxEndOffset = 0; foreach (var fs in foldings) { var end = fs.EndOffset; if (end <= viewEndOffset && !fs.IsFolded) { var textLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (textLineNr >= 0) { endMarker[textLineNr] = _foldingControlPen; } } if (end > maxEndOffset && fs.StartOffset < viewStartOffset) { maxEndOffset = end; } } if (maxEndOffset > 0) { if (maxEndOffset > viewEndOffset) { for (var i = 0; i < colors.Length; i++) { colors[i] = _foldingControlPen; } } else { var maxTextLine = GetTextLineIndexFromOffset(allTextLines, maxEndOffset); for (var i = 0; i <= maxTextLine; i++) { colors[i] = _foldingControlPen; } } } } /// <summary> /// Calculates fold lines for all folding sections that start inside the current view /// </summary> private void CalculateFoldLinesForMarkers(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { foreach (var marker in _markers) { var end = marker.FoldingSection.EndOffset; var endTextLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (!marker.FoldingSection.IsFolded && endTextLineNr >= 0) { if (marker.IsPointerOver) endMarker[endTextLineNr] = _selectedFoldingControlPen; else if (endMarker[endTextLineNr] == null) endMarker[endTextLineNr] = _foldingControlPen; } var startTextLineNr = GetTextLineIndexFromOffset(allTextLines, marker.FoldingSection.StartOffset); if (startTextLineNr >= 0) { for (var i = startTextLineNr + 1; i < colors.Length && i - 1 != endTextLineNr; i++) { if (marker.IsPointerOver) colors[i] = _selectedFoldingControlPen; else if (colors[i] == null) colors[i] = _foldingControlPen; } } } } /// <summary> /// Draws the lines for the folding sections (vertical line with 'color', horizontal lines with 'endMarker') /// Each entry in the input arrays corresponds to one TextLine. /// </summary> private void DrawFoldLines(DrawingContext drawingContext, Pen[] colors, Pen[] endMarker) { // Because we are using PenLineCap.Flat (the default), for vertical lines, // Y coordinates must be on pixel boundaries, whereas the X coordinate must be in the // middle of a pixel. (and the other way round for horizontal lines) var pixelSize = PixelSnapHelpers.GetPixelSize(this); var markerXPos = PixelSnapHelpers.PixelAlign(Bounds.Width / 2, pixelSize.Width); double startY = 0; var currentPen = colors[0]; var tlNumber = 0; foreach (var vl in TextView.VisualLines) { foreach (var tl in vl.TextLines) { if (endMarker[tlNumber] != null) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); drawingContext.DrawLine(endMarker[tlNumber], new Point(markerXPos - pixelSize.Width / 2, visualPos), new Point(Bounds.Width, visualPos)); } if (colors[tlNumber + 1] != currentPen) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, visualPos - pixelSize.Height / 2)); } currentPen = colors[tlNumber + 1]; startY = visualPos; } tlNumber++; } } if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, Bounds.Height)); } } private double GetVisualPos(VisualLine vl, TextLine tl, double pixelHeight) { var pos = vl.GetTextLineVisualYPosition(tl, VisualYPosition.TextMiddle) - TextView.VerticalOffset; return PixelSnapHelpers.PixelAlign(pos, pixelHeight); } private int GetTextLineIndexFromOffset(List<TextLine> textLines, int offset) { var lineNumber = TextView.Document.GetLineByOffset(offset).LineNumber; var vl = TextView.GetVisualLine(lineNumber); if (vl != null) { var relOffset = offset - vl.FirstDocumentLine.Offset; var line = vl.GetTextLine(vl.GetVisualColumn(relOffset)); return textLines.IndexOf(line); } return -1; } } } <MSG> Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style <DFF> @@ -157,7 +157,7 @@ namespace AvaloniaEdit.Folding var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } - return base.ArrangeOverride(finalSize); + return finalSize; } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); @@ -184,6 +184,7 @@ namespace AvaloniaEdit.Folding VisualLine = line, FoldingSection = fs }; + ((ISetLogicalParent)m).SetParent(this); _markers.Add(m); VisualChildren.Add(m);
2
Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style
1
.cs
cs
mit
AvaloniaUI/AvaloniaEdit
10058153
<NME> FoldingMargin.cs <BEF> // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.Linq; using Avalonia; using AvaloniaEdit.Editing; using AvaloniaEdit.Rendering; using AvaloniaEdit.Utils; using Avalonia.Controls; using Avalonia.Media; using Avalonia.Media.TextFormatting; namespace AvaloniaEdit.Folding { /// <summary> /// A margin that shows markers for foldings and allows to expand/collapse the foldings. /// </summary> public class FoldingMargin : AbstractMargin { /// <summary> /// Gets/Sets the folding manager from which the foldings should be shown. /// </summary> public FoldingManager FoldingManager { get; set; } internal const double SizeFactor = Constants.PixelPerPoint; static FoldingMargin() { FoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); FoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); } #region Brushes /// <summary> /// FoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBrush", Brushes.Gray, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of folding markers. /// </summary> public IBrush FoldingMarkerBrush { get => GetValue(FoldingMarkerBrushProperty); set => SetValue(FoldingMarkerBrushProperty, value); } /// <summary> /// FoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of folding markers. /// </summary> public IBrush FoldingMarkerBackgroundBrush { get => GetValue(FoldingMarkerBackgroundBrushProperty); set => SetValue(FoldingMarkerBackgroundBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBrush", Brushes.Black, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBrush { get => GetValue(SelectedFoldingMarkerBrushProperty); set => SetValue(SelectedFoldingMarkerBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBackgroundBrush { get => GetValue(SelectedFoldingMarkerBackgroundBrushProperty); set => SetValue(SelectedFoldingMarkerBackgroundBrushProperty, value); } private static void OnUpdateBrushes(AvaloniaPropertyChangedEventArgs e) { FoldingMargin m = null; if (e.Sender is FoldingMargin margin) m = margin; else if (e.Sender is TextEditor editor) m = editor.TextArea.LeftMargins.FirstOrDefault(c => c is FoldingMargin) as FoldingMargin; if (m == null) return; if (e.Property.Name == FoldingMarkerBrushProperty.Name) { m._foldingControlPen = new Pen((IBrush)e.NewValue); } if (e.Property.Name == SelectedFoldingMarkerBrushProperty.Name) { m._selectedFoldingControlPen = new Pen((IBrush)e.NewValue); } } #endregion /// <inheritdoc/> protected override Size MeasureOverride(Size availableSize) { foreach (var m in _markers) { m.Measure(availableSize); } var width = SizeFactor * GetValue(TextBlock.FontSizeProperty); return new Size(PixelSnapHelpers.RoundToOdd(width, PixelSnapHelpers.GetPixelSize(this).Width), 0); } /// <inheritdoc/> protected override Size ArrangeOverride(Size finalSize) { var pixelSize = PixelSnapHelpers.GetPixelSize(this); foreach (var m in _markers) { var visualColumn = m.VisualLine.GetVisualColumn(m.FoldingSection.StartOffset - m.VisualLine.FirstDocumentLine.Offset); var textLine = m.VisualLine.GetTextLine(visualColumn); var yPos = m.VisualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextMiddle) - TextView.VerticalOffset; yPos -= m.DesiredSize.Height / 2; var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } return base.ArrangeOverride(finalSize); } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); protected override void OnTextViewVisualLinesChanged() { foreach (var m in _markers) { VisualChildren.Remove(m); } _markers.Clear(); InvalidateVisual(); if (TextView != null && FoldingManager != null && TextView.VisualLinesValid) { foreach (var line in TextView.VisualLines) { var fs = FoldingManager.GetNextFolding(line.FirstDocumentLine.Offset); if (fs?.StartOffset <= line.LastDocumentLine.Offset + line.LastDocumentLine.Length) { var m = new FoldingMarginMarker { IsExpanded = !fs.IsFolded, VisualLine = line, FoldingSection = fs }; _markers.Add(m); VisualChildren.Add(m); m.PropertyChanged += (o, args) => { if (args.Property == IsPointerOverProperty) { InvalidateVisual(); } }; InvalidateMeasure(); } } } } private Pen _foldingControlPen = new Pen(FoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); private Pen _selectedFoldingControlPen = new Pen(SelectedFoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); /// <inheritdoc/> public override void Render(DrawingContext drawingContext) { if (TextView == null || !TextView.VisualLinesValid) return; if (TextView.VisualLines.Count == 0 || FoldingManager == null) return; var allTextLines = TextView.VisualLines.SelectMany(vl => vl.TextLines).ToList(); var colors = new Pen[allTextLines.Count + 1]; var endMarker = new Pen[allTextLines.Count]; CalculateFoldLinesForFoldingsActiveAtStart(allTextLines, colors, endMarker); CalculateFoldLinesForMarkers(allTextLines, colors, endMarker); DrawFoldLines(drawingContext, colors, endMarker); } /// <summary> /// Calculates fold lines for all folding sections that start in front of the current view /// and run into the current view. /// </summary> private void CalculateFoldLinesForFoldingsActiveAtStart(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { var viewStartOffset = TextView.VisualLines[0].FirstDocumentLine.Offset; var viewEndOffset = TextView.VisualLines.Last().LastDocumentLine.EndOffset; var foldings = FoldingManager.GetFoldingsContaining(viewStartOffset); var maxEndOffset = 0; foreach (var fs in foldings) { var end = fs.EndOffset; if (end <= viewEndOffset && !fs.IsFolded) { var textLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (textLineNr >= 0) { endMarker[textLineNr] = _foldingControlPen; } } if (end > maxEndOffset && fs.StartOffset < viewStartOffset) { maxEndOffset = end; } } if (maxEndOffset > 0) { if (maxEndOffset > viewEndOffset) { for (var i = 0; i < colors.Length; i++) { colors[i] = _foldingControlPen; } } else { var maxTextLine = GetTextLineIndexFromOffset(allTextLines, maxEndOffset); for (var i = 0; i <= maxTextLine; i++) { colors[i] = _foldingControlPen; } } } } /// <summary> /// Calculates fold lines for all folding sections that start inside the current view /// </summary> private void CalculateFoldLinesForMarkers(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { foreach (var marker in _markers) { var end = marker.FoldingSection.EndOffset; var endTextLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (!marker.FoldingSection.IsFolded && endTextLineNr >= 0) { if (marker.IsPointerOver) endMarker[endTextLineNr] = _selectedFoldingControlPen; else if (endMarker[endTextLineNr] == null) endMarker[endTextLineNr] = _foldingControlPen; } var startTextLineNr = GetTextLineIndexFromOffset(allTextLines, marker.FoldingSection.StartOffset); if (startTextLineNr >= 0) { for (var i = startTextLineNr + 1; i < colors.Length && i - 1 != endTextLineNr; i++) { if (marker.IsPointerOver) colors[i] = _selectedFoldingControlPen; else if (colors[i] == null) colors[i] = _foldingControlPen; } } } } /// <summary> /// Draws the lines for the folding sections (vertical line with 'color', horizontal lines with 'endMarker') /// Each entry in the input arrays corresponds to one TextLine. /// </summary> private void DrawFoldLines(DrawingContext drawingContext, Pen[] colors, Pen[] endMarker) { // Because we are using PenLineCap.Flat (the default), for vertical lines, // Y coordinates must be on pixel boundaries, whereas the X coordinate must be in the // middle of a pixel. (and the other way round for horizontal lines) var pixelSize = PixelSnapHelpers.GetPixelSize(this); var markerXPos = PixelSnapHelpers.PixelAlign(Bounds.Width / 2, pixelSize.Width); double startY = 0; var currentPen = colors[0]; var tlNumber = 0; foreach (var vl in TextView.VisualLines) { foreach (var tl in vl.TextLines) { if (endMarker[tlNumber] != null) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); drawingContext.DrawLine(endMarker[tlNumber], new Point(markerXPos - pixelSize.Width / 2, visualPos), new Point(Bounds.Width, visualPos)); } if (colors[tlNumber + 1] != currentPen) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, visualPos - pixelSize.Height / 2)); } currentPen = colors[tlNumber + 1]; startY = visualPos; } tlNumber++; } } if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, Bounds.Height)); } } private double GetVisualPos(VisualLine vl, TextLine tl, double pixelHeight) { var pos = vl.GetTextLineVisualYPosition(tl, VisualYPosition.TextMiddle) - TextView.VerticalOffset; return PixelSnapHelpers.PixelAlign(pos, pixelHeight); } private int GetTextLineIndexFromOffset(List<TextLine> textLines, int offset) { var lineNumber = TextView.Document.GetLineByOffset(offset).LineNumber; var vl = TextView.GetVisualLine(lineNumber); if (vl != null) { var relOffset = offset - vl.FirstDocumentLine.Offset; var line = vl.GetTextLine(vl.GetVisualColumn(relOffset)); return textLines.IndexOf(line); } return -1; } } } <MSG> Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style <DFF> @@ -157,7 +157,7 @@ namespace AvaloniaEdit.Folding var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } - return base.ArrangeOverride(finalSize); + return finalSize; } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); @@ -184,6 +184,7 @@ namespace AvaloniaEdit.Folding VisualLine = line, FoldingSection = fs }; + ((ISetLogicalParent)m).SetParent(this); _markers.Add(m); VisualChildren.Add(m);
2
Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style
1
.cs
cs
mit
AvaloniaUI/AvaloniaEdit
10058154
<NME> FoldingMargin.cs <BEF> // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.Linq; using Avalonia; using AvaloniaEdit.Editing; using AvaloniaEdit.Rendering; using AvaloniaEdit.Utils; using Avalonia.Controls; using Avalonia.Media; using Avalonia.Media.TextFormatting; namespace AvaloniaEdit.Folding { /// <summary> /// A margin that shows markers for foldings and allows to expand/collapse the foldings. /// </summary> public class FoldingMargin : AbstractMargin { /// <summary> /// Gets/Sets the folding manager from which the foldings should be shown. /// </summary> public FoldingManager FoldingManager { get; set; } internal const double SizeFactor = Constants.PixelPerPoint; static FoldingMargin() { FoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); FoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); } #region Brushes /// <summary> /// FoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBrush", Brushes.Gray, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of folding markers. /// </summary> public IBrush FoldingMarkerBrush { get => GetValue(FoldingMarkerBrushProperty); set => SetValue(FoldingMarkerBrushProperty, value); } /// <summary> /// FoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of folding markers. /// </summary> public IBrush FoldingMarkerBackgroundBrush { get => GetValue(FoldingMarkerBackgroundBrushProperty); set => SetValue(FoldingMarkerBackgroundBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBrush", Brushes.Black, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBrush { get => GetValue(SelectedFoldingMarkerBrushProperty); set => SetValue(SelectedFoldingMarkerBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBackgroundBrush { get => GetValue(SelectedFoldingMarkerBackgroundBrushProperty); set => SetValue(SelectedFoldingMarkerBackgroundBrushProperty, value); } private static void OnUpdateBrushes(AvaloniaPropertyChangedEventArgs e) { FoldingMargin m = null; if (e.Sender is FoldingMargin margin) m = margin; else if (e.Sender is TextEditor editor) m = editor.TextArea.LeftMargins.FirstOrDefault(c => c is FoldingMargin) as FoldingMargin; if (m == null) return; if (e.Property.Name == FoldingMarkerBrushProperty.Name) { m._foldingControlPen = new Pen((IBrush)e.NewValue); } if (e.Property.Name == SelectedFoldingMarkerBrushProperty.Name) { m._selectedFoldingControlPen = new Pen((IBrush)e.NewValue); } } #endregion /// <inheritdoc/> protected override Size MeasureOverride(Size availableSize) { foreach (var m in _markers) { m.Measure(availableSize); } var width = SizeFactor * GetValue(TextBlock.FontSizeProperty); return new Size(PixelSnapHelpers.RoundToOdd(width, PixelSnapHelpers.GetPixelSize(this).Width), 0); } /// <inheritdoc/> protected override Size ArrangeOverride(Size finalSize) { var pixelSize = PixelSnapHelpers.GetPixelSize(this); foreach (var m in _markers) { var visualColumn = m.VisualLine.GetVisualColumn(m.FoldingSection.StartOffset - m.VisualLine.FirstDocumentLine.Offset); var textLine = m.VisualLine.GetTextLine(visualColumn); var yPos = m.VisualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextMiddle) - TextView.VerticalOffset; yPos -= m.DesiredSize.Height / 2; var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } return base.ArrangeOverride(finalSize); } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); protected override void OnTextViewVisualLinesChanged() { foreach (var m in _markers) { VisualChildren.Remove(m); } _markers.Clear(); InvalidateVisual(); if (TextView != null && FoldingManager != null && TextView.VisualLinesValid) { foreach (var line in TextView.VisualLines) { var fs = FoldingManager.GetNextFolding(line.FirstDocumentLine.Offset); if (fs?.StartOffset <= line.LastDocumentLine.Offset + line.LastDocumentLine.Length) { var m = new FoldingMarginMarker { IsExpanded = !fs.IsFolded, VisualLine = line, FoldingSection = fs }; _markers.Add(m); VisualChildren.Add(m); m.PropertyChanged += (o, args) => { if (args.Property == IsPointerOverProperty) { InvalidateVisual(); } }; InvalidateMeasure(); } } } } private Pen _foldingControlPen = new Pen(FoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); private Pen _selectedFoldingControlPen = new Pen(SelectedFoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); /// <inheritdoc/> public override void Render(DrawingContext drawingContext) { if (TextView == null || !TextView.VisualLinesValid) return; if (TextView.VisualLines.Count == 0 || FoldingManager == null) return; var allTextLines = TextView.VisualLines.SelectMany(vl => vl.TextLines).ToList(); var colors = new Pen[allTextLines.Count + 1]; var endMarker = new Pen[allTextLines.Count]; CalculateFoldLinesForFoldingsActiveAtStart(allTextLines, colors, endMarker); CalculateFoldLinesForMarkers(allTextLines, colors, endMarker); DrawFoldLines(drawingContext, colors, endMarker); } /// <summary> /// Calculates fold lines for all folding sections that start in front of the current view /// and run into the current view. /// </summary> private void CalculateFoldLinesForFoldingsActiveAtStart(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { var viewStartOffset = TextView.VisualLines[0].FirstDocumentLine.Offset; var viewEndOffset = TextView.VisualLines.Last().LastDocumentLine.EndOffset; var foldings = FoldingManager.GetFoldingsContaining(viewStartOffset); var maxEndOffset = 0; foreach (var fs in foldings) { var end = fs.EndOffset; if (end <= viewEndOffset && !fs.IsFolded) { var textLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (textLineNr >= 0) { endMarker[textLineNr] = _foldingControlPen; } } if (end > maxEndOffset && fs.StartOffset < viewStartOffset) { maxEndOffset = end; } } if (maxEndOffset > 0) { if (maxEndOffset > viewEndOffset) { for (var i = 0; i < colors.Length; i++) { colors[i] = _foldingControlPen; } } else { var maxTextLine = GetTextLineIndexFromOffset(allTextLines, maxEndOffset); for (var i = 0; i <= maxTextLine; i++) { colors[i] = _foldingControlPen; } } } } /// <summary> /// Calculates fold lines for all folding sections that start inside the current view /// </summary> private void CalculateFoldLinesForMarkers(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { foreach (var marker in _markers) { var end = marker.FoldingSection.EndOffset; var endTextLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (!marker.FoldingSection.IsFolded && endTextLineNr >= 0) { if (marker.IsPointerOver) endMarker[endTextLineNr] = _selectedFoldingControlPen; else if (endMarker[endTextLineNr] == null) endMarker[endTextLineNr] = _foldingControlPen; } var startTextLineNr = GetTextLineIndexFromOffset(allTextLines, marker.FoldingSection.StartOffset); if (startTextLineNr >= 0) { for (var i = startTextLineNr + 1; i < colors.Length && i - 1 != endTextLineNr; i++) { if (marker.IsPointerOver) colors[i] = _selectedFoldingControlPen; else if (colors[i] == null) colors[i] = _foldingControlPen; } } } } /// <summary> /// Draws the lines for the folding sections (vertical line with 'color', horizontal lines with 'endMarker') /// Each entry in the input arrays corresponds to one TextLine. /// </summary> private void DrawFoldLines(DrawingContext drawingContext, Pen[] colors, Pen[] endMarker) { // Because we are using PenLineCap.Flat (the default), for vertical lines, // Y coordinates must be on pixel boundaries, whereas the X coordinate must be in the // middle of a pixel. (and the other way round for horizontal lines) var pixelSize = PixelSnapHelpers.GetPixelSize(this); var markerXPos = PixelSnapHelpers.PixelAlign(Bounds.Width / 2, pixelSize.Width); double startY = 0; var currentPen = colors[0]; var tlNumber = 0; foreach (var vl in TextView.VisualLines) { foreach (var tl in vl.TextLines) { if (endMarker[tlNumber] != null) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); drawingContext.DrawLine(endMarker[tlNumber], new Point(markerXPos - pixelSize.Width / 2, visualPos), new Point(Bounds.Width, visualPos)); } if (colors[tlNumber + 1] != currentPen) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, visualPos - pixelSize.Height / 2)); } currentPen = colors[tlNumber + 1]; startY = visualPos; } tlNumber++; } } if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, Bounds.Height)); } } private double GetVisualPos(VisualLine vl, TextLine tl, double pixelHeight) { var pos = vl.GetTextLineVisualYPosition(tl, VisualYPosition.TextMiddle) - TextView.VerticalOffset; return PixelSnapHelpers.PixelAlign(pos, pixelHeight); } private int GetTextLineIndexFromOffset(List<TextLine> textLines, int offset) { var lineNumber = TextView.Document.GetLineByOffset(offset).LineNumber; var vl = TextView.GetVisualLine(lineNumber); if (vl != null) { var relOffset = offset - vl.FirstDocumentLine.Offset; var line = vl.GetTextLine(vl.GetVisualColumn(relOffset)); return textLines.IndexOf(line); } return -1; } } } <MSG> Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style <DFF> @@ -157,7 +157,7 @@ namespace AvaloniaEdit.Folding var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } - return base.ArrangeOverride(finalSize); + return finalSize; } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); @@ -184,6 +184,7 @@ namespace AvaloniaEdit.Folding VisualLine = line, FoldingSection = fs }; + ((ISetLogicalParent)m).SetParent(this); _markers.Add(m); VisualChildren.Add(m);
2
Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style
1
.cs
cs
mit
AvaloniaUI/AvaloniaEdit
10058155
<NME> FoldingMargin.cs <BEF> // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.Linq; using Avalonia; using AvaloniaEdit.Editing; using AvaloniaEdit.Rendering; using AvaloniaEdit.Utils; using Avalonia.Controls; using Avalonia.Media; using Avalonia.Media.TextFormatting; namespace AvaloniaEdit.Folding { /// <summary> /// A margin that shows markers for foldings and allows to expand/collapse the foldings. /// </summary> public class FoldingMargin : AbstractMargin { /// <summary> /// Gets/Sets the folding manager from which the foldings should be shown. /// </summary> public FoldingManager FoldingManager { get; set; } internal const double SizeFactor = Constants.PixelPerPoint; static FoldingMargin() { FoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); FoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); } #region Brushes /// <summary> /// FoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBrush", Brushes.Gray, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of folding markers. /// </summary> public IBrush FoldingMarkerBrush { get => GetValue(FoldingMarkerBrushProperty); set => SetValue(FoldingMarkerBrushProperty, value); } /// <summary> /// FoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of folding markers. /// </summary> public IBrush FoldingMarkerBackgroundBrush { get => GetValue(FoldingMarkerBackgroundBrushProperty); set => SetValue(FoldingMarkerBackgroundBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBrush", Brushes.Black, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBrush { get => GetValue(SelectedFoldingMarkerBrushProperty); set => SetValue(SelectedFoldingMarkerBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBackgroundBrush { get => GetValue(SelectedFoldingMarkerBackgroundBrushProperty); set => SetValue(SelectedFoldingMarkerBackgroundBrushProperty, value); } private static void OnUpdateBrushes(AvaloniaPropertyChangedEventArgs e) { FoldingMargin m = null; if (e.Sender is FoldingMargin margin) m = margin; else if (e.Sender is TextEditor editor) m = editor.TextArea.LeftMargins.FirstOrDefault(c => c is FoldingMargin) as FoldingMargin; if (m == null) return; if (e.Property.Name == FoldingMarkerBrushProperty.Name) { m._foldingControlPen = new Pen((IBrush)e.NewValue); } if (e.Property.Name == SelectedFoldingMarkerBrushProperty.Name) { m._selectedFoldingControlPen = new Pen((IBrush)e.NewValue); } } #endregion /// <inheritdoc/> protected override Size MeasureOverride(Size availableSize) { foreach (var m in _markers) { m.Measure(availableSize); } var width = SizeFactor * GetValue(TextBlock.FontSizeProperty); return new Size(PixelSnapHelpers.RoundToOdd(width, PixelSnapHelpers.GetPixelSize(this).Width), 0); } /// <inheritdoc/> protected override Size ArrangeOverride(Size finalSize) { var pixelSize = PixelSnapHelpers.GetPixelSize(this); foreach (var m in _markers) { var visualColumn = m.VisualLine.GetVisualColumn(m.FoldingSection.StartOffset - m.VisualLine.FirstDocumentLine.Offset); var textLine = m.VisualLine.GetTextLine(visualColumn); var yPos = m.VisualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextMiddle) - TextView.VerticalOffset; yPos -= m.DesiredSize.Height / 2; var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } return base.ArrangeOverride(finalSize); } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); protected override void OnTextViewVisualLinesChanged() { foreach (var m in _markers) { VisualChildren.Remove(m); } _markers.Clear(); InvalidateVisual(); if (TextView != null && FoldingManager != null && TextView.VisualLinesValid) { foreach (var line in TextView.VisualLines) { var fs = FoldingManager.GetNextFolding(line.FirstDocumentLine.Offset); if (fs?.StartOffset <= line.LastDocumentLine.Offset + line.LastDocumentLine.Length) { var m = new FoldingMarginMarker { IsExpanded = !fs.IsFolded, VisualLine = line, FoldingSection = fs }; _markers.Add(m); VisualChildren.Add(m); m.PropertyChanged += (o, args) => { if (args.Property == IsPointerOverProperty) { InvalidateVisual(); } }; InvalidateMeasure(); } } } } private Pen _foldingControlPen = new Pen(FoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); private Pen _selectedFoldingControlPen = new Pen(SelectedFoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); /// <inheritdoc/> public override void Render(DrawingContext drawingContext) { if (TextView == null || !TextView.VisualLinesValid) return; if (TextView.VisualLines.Count == 0 || FoldingManager == null) return; var allTextLines = TextView.VisualLines.SelectMany(vl => vl.TextLines).ToList(); var colors = new Pen[allTextLines.Count + 1]; var endMarker = new Pen[allTextLines.Count]; CalculateFoldLinesForFoldingsActiveAtStart(allTextLines, colors, endMarker); CalculateFoldLinesForMarkers(allTextLines, colors, endMarker); DrawFoldLines(drawingContext, colors, endMarker); } /// <summary> /// Calculates fold lines for all folding sections that start in front of the current view /// and run into the current view. /// </summary> private void CalculateFoldLinesForFoldingsActiveAtStart(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { var viewStartOffset = TextView.VisualLines[0].FirstDocumentLine.Offset; var viewEndOffset = TextView.VisualLines.Last().LastDocumentLine.EndOffset; var foldings = FoldingManager.GetFoldingsContaining(viewStartOffset); var maxEndOffset = 0; foreach (var fs in foldings) { var end = fs.EndOffset; if (end <= viewEndOffset && !fs.IsFolded) { var textLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (textLineNr >= 0) { endMarker[textLineNr] = _foldingControlPen; } } if (end > maxEndOffset && fs.StartOffset < viewStartOffset) { maxEndOffset = end; } } if (maxEndOffset > 0) { if (maxEndOffset > viewEndOffset) { for (var i = 0; i < colors.Length; i++) { colors[i] = _foldingControlPen; } } else { var maxTextLine = GetTextLineIndexFromOffset(allTextLines, maxEndOffset); for (var i = 0; i <= maxTextLine; i++) { colors[i] = _foldingControlPen; } } } } /// <summary> /// Calculates fold lines for all folding sections that start inside the current view /// </summary> private void CalculateFoldLinesForMarkers(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { foreach (var marker in _markers) { var end = marker.FoldingSection.EndOffset; var endTextLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (!marker.FoldingSection.IsFolded && endTextLineNr >= 0) { if (marker.IsPointerOver) endMarker[endTextLineNr] = _selectedFoldingControlPen; else if (endMarker[endTextLineNr] == null) endMarker[endTextLineNr] = _foldingControlPen; } var startTextLineNr = GetTextLineIndexFromOffset(allTextLines, marker.FoldingSection.StartOffset); if (startTextLineNr >= 0) { for (var i = startTextLineNr + 1; i < colors.Length && i - 1 != endTextLineNr; i++) { if (marker.IsPointerOver) colors[i] = _selectedFoldingControlPen; else if (colors[i] == null) colors[i] = _foldingControlPen; } } } } /// <summary> /// Draws the lines for the folding sections (vertical line with 'color', horizontal lines with 'endMarker') /// Each entry in the input arrays corresponds to one TextLine. /// </summary> private void DrawFoldLines(DrawingContext drawingContext, Pen[] colors, Pen[] endMarker) { // Because we are using PenLineCap.Flat (the default), for vertical lines, // Y coordinates must be on pixel boundaries, whereas the X coordinate must be in the // middle of a pixel. (and the other way round for horizontal lines) var pixelSize = PixelSnapHelpers.GetPixelSize(this); var markerXPos = PixelSnapHelpers.PixelAlign(Bounds.Width / 2, pixelSize.Width); double startY = 0; var currentPen = colors[0]; var tlNumber = 0; foreach (var vl in TextView.VisualLines) { foreach (var tl in vl.TextLines) { if (endMarker[tlNumber] != null) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); drawingContext.DrawLine(endMarker[tlNumber], new Point(markerXPos - pixelSize.Width / 2, visualPos), new Point(Bounds.Width, visualPos)); } if (colors[tlNumber + 1] != currentPen) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, visualPos - pixelSize.Height / 2)); } currentPen = colors[tlNumber + 1]; startY = visualPos; } tlNumber++; } } if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, Bounds.Height)); } } private double GetVisualPos(VisualLine vl, TextLine tl, double pixelHeight) { var pos = vl.GetTextLineVisualYPosition(tl, VisualYPosition.TextMiddle) - TextView.VerticalOffset; return PixelSnapHelpers.PixelAlign(pos, pixelHeight); } private int GetTextLineIndexFromOffset(List<TextLine> textLines, int offset) { var lineNumber = TextView.Document.GetLineByOffset(offset).LineNumber; var vl = TextView.GetVisualLine(lineNumber); if (vl != null) { var relOffset = offset - vl.FirstDocumentLine.Offset; var line = vl.GetTextLine(vl.GetVisualColumn(relOffset)); return textLines.IndexOf(line); } return -1; } } } <MSG> Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style <DFF> @@ -157,7 +157,7 @@ namespace AvaloniaEdit.Folding var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } - return base.ArrangeOverride(finalSize); + return finalSize; } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); @@ -184,6 +184,7 @@ namespace AvaloniaEdit.Folding VisualLine = line, FoldingSection = fs }; + ((ISetLogicalParent)m).SetParent(this); _markers.Add(m); VisualChildren.Add(m);
2
Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style
1
.cs
cs
mit
AvaloniaUI/AvaloniaEdit
10058156
<NME> FoldingMargin.cs <BEF> // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.Linq; using Avalonia; using AvaloniaEdit.Editing; using AvaloniaEdit.Rendering; using AvaloniaEdit.Utils; using Avalonia.Controls; using Avalonia.Media; using Avalonia.Media.TextFormatting; namespace AvaloniaEdit.Folding { /// <summary> /// A margin that shows markers for foldings and allows to expand/collapse the foldings. /// </summary> public class FoldingMargin : AbstractMargin { /// <summary> /// Gets/Sets the folding manager from which the foldings should be shown. /// </summary> public FoldingManager FoldingManager { get; set; } internal const double SizeFactor = Constants.PixelPerPoint; static FoldingMargin() { FoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); FoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); } #region Brushes /// <summary> /// FoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBrush", Brushes.Gray, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of folding markers. /// </summary> public IBrush FoldingMarkerBrush { get => GetValue(FoldingMarkerBrushProperty); set => SetValue(FoldingMarkerBrushProperty, value); } /// <summary> /// FoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of folding markers. /// </summary> public IBrush FoldingMarkerBackgroundBrush { get => GetValue(FoldingMarkerBackgroundBrushProperty); set => SetValue(FoldingMarkerBackgroundBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBrush", Brushes.Black, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBrush { get => GetValue(SelectedFoldingMarkerBrushProperty); set => SetValue(SelectedFoldingMarkerBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBackgroundBrush { get => GetValue(SelectedFoldingMarkerBackgroundBrushProperty); set => SetValue(SelectedFoldingMarkerBackgroundBrushProperty, value); } private static void OnUpdateBrushes(AvaloniaPropertyChangedEventArgs e) { FoldingMargin m = null; if (e.Sender is FoldingMargin margin) m = margin; else if (e.Sender is TextEditor editor) m = editor.TextArea.LeftMargins.FirstOrDefault(c => c is FoldingMargin) as FoldingMargin; if (m == null) return; if (e.Property.Name == FoldingMarkerBrushProperty.Name) { m._foldingControlPen = new Pen((IBrush)e.NewValue); } if (e.Property.Name == SelectedFoldingMarkerBrushProperty.Name) { m._selectedFoldingControlPen = new Pen((IBrush)e.NewValue); } } #endregion /// <inheritdoc/> protected override Size MeasureOverride(Size availableSize) { foreach (var m in _markers) { m.Measure(availableSize); } var width = SizeFactor * GetValue(TextBlock.FontSizeProperty); return new Size(PixelSnapHelpers.RoundToOdd(width, PixelSnapHelpers.GetPixelSize(this).Width), 0); } /// <inheritdoc/> protected override Size ArrangeOverride(Size finalSize) { var pixelSize = PixelSnapHelpers.GetPixelSize(this); foreach (var m in _markers) { var visualColumn = m.VisualLine.GetVisualColumn(m.FoldingSection.StartOffset - m.VisualLine.FirstDocumentLine.Offset); var textLine = m.VisualLine.GetTextLine(visualColumn); var yPos = m.VisualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextMiddle) - TextView.VerticalOffset; yPos -= m.DesiredSize.Height / 2; var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } return base.ArrangeOverride(finalSize); } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); protected override void OnTextViewVisualLinesChanged() { foreach (var m in _markers) { VisualChildren.Remove(m); } _markers.Clear(); InvalidateVisual(); if (TextView != null && FoldingManager != null && TextView.VisualLinesValid) { foreach (var line in TextView.VisualLines) { var fs = FoldingManager.GetNextFolding(line.FirstDocumentLine.Offset); if (fs?.StartOffset <= line.LastDocumentLine.Offset + line.LastDocumentLine.Length) { var m = new FoldingMarginMarker { IsExpanded = !fs.IsFolded, VisualLine = line, FoldingSection = fs }; _markers.Add(m); VisualChildren.Add(m); m.PropertyChanged += (o, args) => { if (args.Property == IsPointerOverProperty) { InvalidateVisual(); } }; InvalidateMeasure(); } } } } private Pen _foldingControlPen = new Pen(FoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); private Pen _selectedFoldingControlPen = new Pen(SelectedFoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); /// <inheritdoc/> public override void Render(DrawingContext drawingContext) { if (TextView == null || !TextView.VisualLinesValid) return; if (TextView.VisualLines.Count == 0 || FoldingManager == null) return; var allTextLines = TextView.VisualLines.SelectMany(vl => vl.TextLines).ToList(); var colors = new Pen[allTextLines.Count + 1]; var endMarker = new Pen[allTextLines.Count]; CalculateFoldLinesForFoldingsActiveAtStart(allTextLines, colors, endMarker); CalculateFoldLinesForMarkers(allTextLines, colors, endMarker); DrawFoldLines(drawingContext, colors, endMarker); } /// <summary> /// Calculates fold lines for all folding sections that start in front of the current view /// and run into the current view. /// </summary> private void CalculateFoldLinesForFoldingsActiveAtStart(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { var viewStartOffset = TextView.VisualLines[0].FirstDocumentLine.Offset; var viewEndOffset = TextView.VisualLines.Last().LastDocumentLine.EndOffset; var foldings = FoldingManager.GetFoldingsContaining(viewStartOffset); var maxEndOffset = 0; foreach (var fs in foldings) { var end = fs.EndOffset; if (end <= viewEndOffset && !fs.IsFolded) { var textLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (textLineNr >= 0) { endMarker[textLineNr] = _foldingControlPen; } } if (end > maxEndOffset && fs.StartOffset < viewStartOffset) { maxEndOffset = end; } } if (maxEndOffset > 0) { if (maxEndOffset > viewEndOffset) { for (var i = 0; i < colors.Length; i++) { colors[i] = _foldingControlPen; } } else { var maxTextLine = GetTextLineIndexFromOffset(allTextLines, maxEndOffset); for (var i = 0; i <= maxTextLine; i++) { colors[i] = _foldingControlPen; } } } } /// <summary> /// Calculates fold lines for all folding sections that start inside the current view /// </summary> private void CalculateFoldLinesForMarkers(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { foreach (var marker in _markers) { var end = marker.FoldingSection.EndOffset; var endTextLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (!marker.FoldingSection.IsFolded && endTextLineNr >= 0) { if (marker.IsPointerOver) endMarker[endTextLineNr] = _selectedFoldingControlPen; else if (endMarker[endTextLineNr] == null) endMarker[endTextLineNr] = _foldingControlPen; } var startTextLineNr = GetTextLineIndexFromOffset(allTextLines, marker.FoldingSection.StartOffset); if (startTextLineNr >= 0) { for (var i = startTextLineNr + 1; i < colors.Length && i - 1 != endTextLineNr; i++) { if (marker.IsPointerOver) colors[i] = _selectedFoldingControlPen; else if (colors[i] == null) colors[i] = _foldingControlPen; } } } } /// <summary> /// Draws the lines for the folding sections (vertical line with 'color', horizontal lines with 'endMarker') /// Each entry in the input arrays corresponds to one TextLine. /// </summary> private void DrawFoldLines(DrawingContext drawingContext, Pen[] colors, Pen[] endMarker) { // Because we are using PenLineCap.Flat (the default), for vertical lines, // Y coordinates must be on pixel boundaries, whereas the X coordinate must be in the // middle of a pixel. (and the other way round for horizontal lines) var pixelSize = PixelSnapHelpers.GetPixelSize(this); var markerXPos = PixelSnapHelpers.PixelAlign(Bounds.Width / 2, pixelSize.Width); double startY = 0; var currentPen = colors[0]; var tlNumber = 0; foreach (var vl in TextView.VisualLines) { foreach (var tl in vl.TextLines) { if (endMarker[tlNumber] != null) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); drawingContext.DrawLine(endMarker[tlNumber], new Point(markerXPos - pixelSize.Width / 2, visualPos), new Point(Bounds.Width, visualPos)); } if (colors[tlNumber + 1] != currentPen) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, visualPos - pixelSize.Height / 2)); } currentPen = colors[tlNumber + 1]; startY = visualPos; } tlNumber++; } } if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, Bounds.Height)); } } private double GetVisualPos(VisualLine vl, TextLine tl, double pixelHeight) { var pos = vl.GetTextLineVisualYPosition(tl, VisualYPosition.TextMiddle) - TextView.VerticalOffset; return PixelSnapHelpers.PixelAlign(pos, pixelHeight); } private int GetTextLineIndexFromOffset(List<TextLine> textLines, int offset) { var lineNumber = TextView.Document.GetLineByOffset(offset).LineNumber; var vl = TextView.GetVisualLine(lineNumber); if (vl != null) { var relOffset = offset - vl.FirstDocumentLine.Offset; var line = vl.GetTextLine(vl.GetVisualColumn(relOffset)); return textLines.IndexOf(line); } return -1; } } } <MSG> Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style <DFF> @@ -157,7 +157,7 @@ namespace AvaloniaEdit.Folding var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } - return base.ArrangeOverride(finalSize); + return finalSize; } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); @@ -184,6 +184,7 @@ namespace AvaloniaEdit.Folding VisualLine = line, FoldingSection = fs }; + ((ISetLogicalParent)m).SetParent(this); _markers.Add(m); VisualChildren.Add(m);
2
Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style
1
.cs
cs
mit
AvaloniaUI/AvaloniaEdit
10058157
<NME> FoldingMargin.cs <BEF> // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.Linq; using Avalonia; using AvaloniaEdit.Editing; using AvaloniaEdit.Rendering; using AvaloniaEdit.Utils; using Avalonia.Controls; using Avalonia.Media; using Avalonia.Media.TextFormatting; namespace AvaloniaEdit.Folding { /// <summary> /// A margin that shows markers for foldings and allows to expand/collapse the foldings. /// </summary> public class FoldingMargin : AbstractMargin { /// <summary> /// Gets/Sets the folding manager from which the foldings should be shown. /// </summary> public FoldingManager FoldingManager { get; set; } internal const double SizeFactor = Constants.PixelPerPoint; static FoldingMargin() { FoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); FoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); } #region Brushes /// <summary> /// FoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBrush", Brushes.Gray, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of folding markers. /// </summary> public IBrush FoldingMarkerBrush { get => GetValue(FoldingMarkerBrushProperty); set => SetValue(FoldingMarkerBrushProperty, value); } /// <summary> /// FoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of folding markers. /// </summary> public IBrush FoldingMarkerBackgroundBrush { get => GetValue(FoldingMarkerBackgroundBrushProperty); set => SetValue(FoldingMarkerBackgroundBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBrush", Brushes.Black, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBrush { get => GetValue(SelectedFoldingMarkerBrushProperty); set => SetValue(SelectedFoldingMarkerBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBackgroundBrush { get => GetValue(SelectedFoldingMarkerBackgroundBrushProperty); set => SetValue(SelectedFoldingMarkerBackgroundBrushProperty, value); } private static void OnUpdateBrushes(AvaloniaPropertyChangedEventArgs e) { FoldingMargin m = null; if (e.Sender is FoldingMargin margin) m = margin; else if (e.Sender is TextEditor editor) m = editor.TextArea.LeftMargins.FirstOrDefault(c => c is FoldingMargin) as FoldingMargin; if (m == null) return; if (e.Property.Name == FoldingMarkerBrushProperty.Name) { m._foldingControlPen = new Pen((IBrush)e.NewValue); } if (e.Property.Name == SelectedFoldingMarkerBrushProperty.Name) { m._selectedFoldingControlPen = new Pen((IBrush)e.NewValue); } } #endregion /// <inheritdoc/> protected override Size MeasureOverride(Size availableSize) { foreach (var m in _markers) { m.Measure(availableSize); } var width = SizeFactor * GetValue(TextBlock.FontSizeProperty); return new Size(PixelSnapHelpers.RoundToOdd(width, PixelSnapHelpers.GetPixelSize(this).Width), 0); } /// <inheritdoc/> protected override Size ArrangeOverride(Size finalSize) { var pixelSize = PixelSnapHelpers.GetPixelSize(this); foreach (var m in _markers) { var visualColumn = m.VisualLine.GetVisualColumn(m.FoldingSection.StartOffset - m.VisualLine.FirstDocumentLine.Offset); var textLine = m.VisualLine.GetTextLine(visualColumn); var yPos = m.VisualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextMiddle) - TextView.VerticalOffset; yPos -= m.DesiredSize.Height / 2; var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } return base.ArrangeOverride(finalSize); } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); protected override void OnTextViewVisualLinesChanged() { foreach (var m in _markers) { VisualChildren.Remove(m); } _markers.Clear(); InvalidateVisual(); if (TextView != null && FoldingManager != null && TextView.VisualLinesValid) { foreach (var line in TextView.VisualLines) { var fs = FoldingManager.GetNextFolding(line.FirstDocumentLine.Offset); if (fs?.StartOffset <= line.LastDocumentLine.Offset + line.LastDocumentLine.Length) { var m = new FoldingMarginMarker { IsExpanded = !fs.IsFolded, VisualLine = line, FoldingSection = fs }; _markers.Add(m); VisualChildren.Add(m); m.PropertyChanged += (o, args) => { if (args.Property == IsPointerOverProperty) { InvalidateVisual(); } }; InvalidateMeasure(); } } } } private Pen _foldingControlPen = new Pen(FoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); private Pen _selectedFoldingControlPen = new Pen(SelectedFoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); /// <inheritdoc/> public override void Render(DrawingContext drawingContext) { if (TextView == null || !TextView.VisualLinesValid) return; if (TextView.VisualLines.Count == 0 || FoldingManager == null) return; var allTextLines = TextView.VisualLines.SelectMany(vl => vl.TextLines).ToList(); var colors = new Pen[allTextLines.Count + 1]; var endMarker = new Pen[allTextLines.Count]; CalculateFoldLinesForFoldingsActiveAtStart(allTextLines, colors, endMarker); CalculateFoldLinesForMarkers(allTextLines, colors, endMarker); DrawFoldLines(drawingContext, colors, endMarker); } /// <summary> /// Calculates fold lines for all folding sections that start in front of the current view /// and run into the current view. /// </summary> private void CalculateFoldLinesForFoldingsActiveAtStart(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { var viewStartOffset = TextView.VisualLines[0].FirstDocumentLine.Offset; var viewEndOffset = TextView.VisualLines.Last().LastDocumentLine.EndOffset; var foldings = FoldingManager.GetFoldingsContaining(viewStartOffset); var maxEndOffset = 0; foreach (var fs in foldings) { var end = fs.EndOffset; if (end <= viewEndOffset && !fs.IsFolded) { var textLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (textLineNr >= 0) { endMarker[textLineNr] = _foldingControlPen; } } if (end > maxEndOffset && fs.StartOffset < viewStartOffset) { maxEndOffset = end; } } if (maxEndOffset > 0) { if (maxEndOffset > viewEndOffset) { for (var i = 0; i < colors.Length; i++) { colors[i] = _foldingControlPen; } } else { var maxTextLine = GetTextLineIndexFromOffset(allTextLines, maxEndOffset); for (var i = 0; i <= maxTextLine; i++) { colors[i] = _foldingControlPen; } } } } /// <summary> /// Calculates fold lines for all folding sections that start inside the current view /// </summary> private void CalculateFoldLinesForMarkers(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { foreach (var marker in _markers) { var end = marker.FoldingSection.EndOffset; var endTextLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (!marker.FoldingSection.IsFolded && endTextLineNr >= 0) { if (marker.IsPointerOver) endMarker[endTextLineNr] = _selectedFoldingControlPen; else if (endMarker[endTextLineNr] == null) endMarker[endTextLineNr] = _foldingControlPen; } var startTextLineNr = GetTextLineIndexFromOffset(allTextLines, marker.FoldingSection.StartOffset); if (startTextLineNr >= 0) { for (var i = startTextLineNr + 1; i < colors.Length && i - 1 != endTextLineNr; i++) { if (marker.IsPointerOver) colors[i] = _selectedFoldingControlPen; else if (colors[i] == null) colors[i] = _foldingControlPen; } } } } /// <summary> /// Draws the lines for the folding sections (vertical line with 'color', horizontal lines with 'endMarker') /// Each entry in the input arrays corresponds to one TextLine. /// </summary> private void DrawFoldLines(DrawingContext drawingContext, Pen[] colors, Pen[] endMarker) { // Because we are using PenLineCap.Flat (the default), for vertical lines, // Y coordinates must be on pixel boundaries, whereas the X coordinate must be in the // middle of a pixel. (and the other way round for horizontal lines) var pixelSize = PixelSnapHelpers.GetPixelSize(this); var markerXPos = PixelSnapHelpers.PixelAlign(Bounds.Width / 2, pixelSize.Width); double startY = 0; var currentPen = colors[0]; var tlNumber = 0; foreach (var vl in TextView.VisualLines) { foreach (var tl in vl.TextLines) { if (endMarker[tlNumber] != null) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); drawingContext.DrawLine(endMarker[tlNumber], new Point(markerXPos - pixelSize.Width / 2, visualPos), new Point(Bounds.Width, visualPos)); } if (colors[tlNumber + 1] != currentPen) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, visualPos - pixelSize.Height / 2)); } currentPen = colors[tlNumber + 1]; startY = visualPos; } tlNumber++; } } if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, Bounds.Height)); } } private double GetVisualPos(VisualLine vl, TextLine tl, double pixelHeight) { var pos = vl.GetTextLineVisualYPosition(tl, VisualYPosition.TextMiddle) - TextView.VerticalOffset; return PixelSnapHelpers.PixelAlign(pos, pixelHeight); } private int GetTextLineIndexFromOffset(List<TextLine> textLines, int offset) { var lineNumber = TextView.Document.GetLineByOffset(offset).LineNumber; var vl = TextView.GetVisualLine(lineNumber); if (vl != null) { var relOffset = offset - vl.FirstDocumentLine.Offset; var line = vl.GetTextLine(vl.GetVisualColumn(relOffset)); return textLines.IndexOf(line); } return -1; } } } <MSG> Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style <DFF> @@ -157,7 +157,7 @@ namespace AvaloniaEdit.Folding var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } - return base.ArrangeOverride(finalSize); + return finalSize; } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); @@ -184,6 +184,7 @@ namespace AvaloniaEdit.Folding VisualLine = line, FoldingSection = fs }; + ((ISetLogicalParent)m).SetParent(this); _markers.Add(m); VisualChildren.Add(m);
2
Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style
1
.cs
cs
mit
AvaloniaUI/AvaloniaEdit
10058158
<NME> FoldingMargin.cs <BEF> // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.Linq; using Avalonia; using AvaloniaEdit.Editing; using AvaloniaEdit.Rendering; using AvaloniaEdit.Utils; using Avalonia.Controls; using Avalonia.Media; using Avalonia.Media.TextFormatting; namespace AvaloniaEdit.Folding { /// <summary> /// A margin that shows markers for foldings and allows to expand/collapse the foldings. /// </summary> public class FoldingMargin : AbstractMargin { /// <summary> /// Gets/Sets the folding manager from which the foldings should be shown. /// </summary> public FoldingManager FoldingManager { get; set; } internal const double SizeFactor = Constants.PixelPerPoint; static FoldingMargin() { FoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); FoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); } #region Brushes /// <summary> /// FoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBrush", Brushes.Gray, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of folding markers. /// </summary> public IBrush FoldingMarkerBrush { get => GetValue(FoldingMarkerBrushProperty); set => SetValue(FoldingMarkerBrushProperty, value); } /// <summary> /// FoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of folding markers. /// </summary> public IBrush FoldingMarkerBackgroundBrush { get => GetValue(FoldingMarkerBackgroundBrushProperty); set => SetValue(FoldingMarkerBackgroundBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBrush", Brushes.Black, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBrush { get => GetValue(SelectedFoldingMarkerBrushProperty); set => SetValue(SelectedFoldingMarkerBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBackgroundBrush { get => GetValue(SelectedFoldingMarkerBackgroundBrushProperty); set => SetValue(SelectedFoldingMarkerBackgroundBrushProperty, value); } private static void OnUpdateBrushes(AvaloniaPropertyChangedEventArgs e) { FoldingMargin m = null; if (e.Sender is FoldingMargin margin) m = margin; else if (e.Sender is TextEditor editor) m = editor.TextArea.LeftMargins.FirstOrDefault(c => c is FoldingMargin) as FoldingMargin; if (m == null) return; if (e.Property.Name == FoldingMarkerBrushProperty.Name) { m._foldingControlPen = new Pen((IBrush)e.NewValue); } if (e.Property.Name == SelectedFoldingMarkerBrushProperty.Name) { m._selectedFoldingControlPen = new Pen((IBrush)e.NewValue); } } #endregion /// <inheritdoc/> protected override Size MeasureOverride(Size availableSize) { foreach (var m in _markers) { m.Measure(availableSize); } var width = SizeFactor * GetValue(TextBlock.FontSizeProperty); return new Size(PixelSnapHelpers.RoundToOdd(width, PixelSnapHelpers.GetPixelSize(this).Width), 0); } /// <inheritdoc/> protected override Size ArrangeOverride(Size finalSize) { var pixelSize = PixelSnapHelpers.GetPixelSize(this); foreach (var m in _markers) { var visualColumn = m.VisualLine.GetVisualColumn(m.FoldingSection.StartOffset - m.VisualLine.FirstDocumentLine.Offset); var textLine = m.VisualLine.GetTextLine(visualColumn); var yPos = m.VisualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextMiddle) - TextView.VerticalOffset; yPos -= m.DesiredSize.Height / 2; var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } return base.ArrangeOverride(finalSize); } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); protected override void OnTextViewVisualLinesChanged() { foreach (var m in _markers) { VisualChildren.Remove(m); } _markers.Clear(); InvalidateVisual(); if (TextView != null && FoldingManager != null && TextView.VisualLinesValid) { foreach (var line in TextView.VisualLines) { var fs = FoldingManager.GetNextFolding(line.FirstDocumentLine.Offset); if (fs?.StartOffset <= line.LastDocumentLine.Offset + line.LastDocumentLine.Length) { var m = new FoldingMarginMarker { IsExpanded = !fs.IsFolded, VisualLine = line, FoldingSection = fs }; _markers.Add(m); VisualChildren.Add(m); m.PropertyChanged += (o, args) => { if (args.Property == IsPointerOverProperty) { InvalidateVisual(); } }; InvalidateMeasure(); } } } } private Pen _foldingControlPen = new Pen(FoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); private Pen _selectedFoldingControlPen = new Pen(SelectedFoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); /// <inheritdoc/> public override void Render(DrawingContext drawingContext) { if (TextView == null || !TextView.VisualLinesValid) return; if (TextView.VisualLines.Count == 0 || FoldingManager == null) return; var allTextLines = TextView.VisualLines.SelectMany(vl => vl.TextLines).ToList(); var colors = new Pen[allTextLines.Count + 1]; var endMarker = new Pen[allTextLines.Count]; CalculateFoldLinesForFoldingsActiveAtStart(allTextLines, colors, endMarker); CalculateFoldLinesForMarkers(allTextLines, colors, endMarker); DrawFoldLines(drawingContext, colors, endMarker); } /// <summary> /// Calculates fold lines for all folding sections that start in front of the current view /// and run into the current view. /// </summary> private void CalculateFoldLinesForFoldingsActiveAtStart(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { var viewStartOffset = TextView.VisualLines[0].FirstDocumentLine.Offset; var viewEndOffset = TextView.VisualLines.Last().LastDocumentLine.EndOffset; var foldings = FoldingManager.GetFoldingsContaining(viewStartOffset); var maxEndOffset = 0; foreach (var fs in foldings) { var end = fs.EndOffset; if (end <= viewEndOffset && !fs.IsFolded) { var textLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (textLineNr >= 0) { endMarker[textLineNr] = _foldingControlPen; } } if (end > maxEndOffset && fs.StartOffset < viewStartOffset) { maxEndOffset = end; } } if (maxEndOffset > 0) { if (maxEndOffset > viewEndOffset) { for (var i = 0; i < colors.Length; i++) { colors[i] = _foldingControlPen; } } else { var maxTextLine = GetTextLineIndexFromOffset(allTextLines, maxEndOffset); for (var i = 0; i <= maxTextLine; i++) { colors[i] = _foldingControlPen; } } } } /// <summary> /// Calculates fold lines for all folding sections that start inside the current view /// </summary> private void CalculateFoldLinesForMarkers(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { foreach (var marker in _markers) { var end = marker.FoldingSection.EndOffset; var endTextLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (!marker.FoldingSection.IsFolded && endTextLineNr >= 0) { if (marker.IsPointerOver) endMarker[endTextLineNr] = _selectedFoldingControlPen; else if (endMarker[endTextLineNr] == null) endMarker[endTextLineNr] = _foldingControlPen; } var startTextLineNr = GetTextLineIndexFromOffset(allTextLines, marker.FoldingSection.StartOffset); if (startTextLineNr >= 0) { for (var i = startTextLineNr + 1; i < colors.Length && i - 1 != endTextLineNr; i++) { if (marker.IsPointerOver) colors[i] = _selectedFoldingControlPen; else if (colors[i] == null) colors[i] = _foldingControlPen; } } } } /// <summary> /// Draws the lines for the folding sections (vertical line with 'color', horizontal lines with 'endMarker') /// Each entry in the input arrays corresponds to one TextLine. /// </summary> private void DrawFoldLines(DrawingContext drawingContext, Pen[] colors, Pen[] endMarker) { // Because we are using PenLineCap.Flat (the default), for vertical lines, // Y coordinates must be on pixel boundaries, whereas the X coordinate must be in the // middle of a pixel. (and the other way round for horizontal lines) var pixelSize = PixelSnapHelpers.GetPixelSize(this); var markerXPos = PixelSnapHelpers.PixelAlign(Bounds.Width / 2, pixelSize.Width); double startY = 0; var currentPen = colors[0]; var tlNumber = 0; foreach (var vl in TextView.VisualLines) { foreach (var tl in vl.TextLines) { if (endMarker[tlNumber] != null) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); drawingContext.DrawLine(endMarker[tlNumber], new Point(markerXPos - pixelSize.Width / 2, visualPos), new Point(Bounds.Width, visualPos)); } if (colors[tlNumber + 1] != currentPen) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, visualPos - pixelSize.Height / 2)); } currentPen = colors[tlNumber + 1]; startY = visualPos; } tlNumber++; } } if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, Bounds.Height)); } } private double GetVisualPos(VisualLine vl, TextLine tl, double pixelHeight) { var pos = vl.GetTextLineVisualYPosition(tl, VisualYPosition.TextMiddle) - TextView.VerticalOffset; return PixelSnapHelpers.PixelAlign(pos, pixelHeight); } private int GetTextLineIndexFromOffset(List<TextLine> textLines, int offset) { var lineNumber = TextView.Document.GetLineByOffset(offset).LineNumber; var vl = TextView.GetVisualLine(lineNumber); if (vl != null) { var relOffset = offset - vl.FirstDocumentLine.Offset; var line = vl.GetTextLine(vl.GetVisualColumn(relOffset)); return textLines.IndexOf(line); } return -1; } } } <MSG> Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style <DFF> @@ -157,7 +157,7 @@ namespace AvaloniaEdit.Folding var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } - return base.ArrangeOverride(finalSize); + return finalSize; } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); @@ -184,6 +184,7 @@ namespace AvaloniaEdit.Folding VisualLine = line, FoldingSection = fs }; + ((ISetLogicalParent)m).SetParent(this); _markers.Add(m); VisualChildren.Add(m);
2
Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style
1
.cs
cs
mit
AvaloniaUI/AvaloniaEdit
10058159
<NME> FoldingMargin.cs <BEF> // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.Linq; using Avalonia; using AvaloniaEdit.Editing; using AvaloniaEdit.Rendering; using AvaloniaEdit.Utils; using Avalonia.Controls; using Avalonia.Media; using Avalonia.Media.TextFormatting; namespace AvaloniaEdit.Folding { /// <summary> /// A margin that shows markers for foldings and allows to expand/collapse the foldings. /// </summary> public class FoldingMargin : AbstractMargin { /// <summary> /// Gets/Sets the folding manager from which the foldings should be shown. /// </summary> public FoldingManager FoldingManager { get; set; } internal const double SizeFactor = Constants.PixelPerPoint; static FoldingMargin() { FoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); FoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); } #region Brushes /// <summary> /// FoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBrush", Brushes.Gray, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of folding markers. /// </summary> public IBrush FoldingMarkerBrush { get => GetValue(FoldingMarkerBrushProperty); set => SetValue(FoldingMarkerBrushProperty, value); } /// <summary> /// FoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of folding markers. /// </summary> public IBrush FoldingMarkerBackgroundBrush { get => GetValue(FoldingMarkerBackgroundBrushProperty); set => SetValue(FoldingMarkerBackgroundBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBrush", Brushes.Black, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBrush { get => GetValue(SelectedFoldingMarkerBrushProperty); set => SetValue(SelectedFoldingMarkerBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBackgroundBrush { get => GetValue(SelectedFoldingMarkerBackgroundBrushProperty); set => SetValue(SelectedFoldingMarkerBackgroundBrushProperty, value); } private static void OnUpdateBrushes(AvaloniaPropertyChangedEventArgs e) { FoldingMargin m = null; if (e.Sender is FoldingMargin margin) m = margin; else if (e.Sender is TextEditor editor) m = editor.TextArea.LeftMargins.FirstOrDefault(c => c is FoldingMargin) as FoldingMargin; if (m == null) return; if (e.Property.Name == FoldingMarkerBrushProperty.Name) { m._foldingControlPen = new Pen((IBrush)e.NewValue); } if (e.Property.Name == SelectedFoldingMarkerBrushProperty.Name) { m._selectedFoldingControlPen = new Pen((IBrush)e.NewValue); } } #endregion /// <inheritdoc/> protected override Size MeasureOverride(Size availableSize) { foreach (var m in _markers) { m.Measure(availableSize); } var width = SizeFactor * GetValue(TextBlock.FontSizeProperty); return new Size(PixelSnapHelpers.RoundToOdd(width, PixelSnapHelpers.GetPixelSize(this).Width), 0); } /// <inheritdoc/> protected override Size ArrangeOverride(Size finalSize) { var pixelSize = PixelSnapHelpers.GetPixelSize(this); foreach (var m in _markers) { var visualColumn = m.VisualLine.GetVisualColumn(m.FoldingSection.StartOffset - m.VisualLine.FirstDocumentLine.Offset); var textLine = m.VisualLine.GetTextLine(visualColumn); var yPos = m.VisualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextMiddle) - TextView.VerticalOffset; yPos -= m.DesiredSize.Height / 2; var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } return base.ArrangeOverride(finalSize); } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); protected override void OnTextViewVisualLinesChanged() { foreach (var m in _markers) { VisualChildren.Remove(m); } _markers.Clear(); InvalidateVisual(); if (TextView != null && FoldingManager != null && TextView.VisualLinesValid) { foreach (var line in TextView.VisualLines) { var fs = FoldingManager.GetNextFolding(line.FirstDocumentLine.Offset); if (fs?.StartOffset <= line.LastDocumentLine.Offset + line.LastDocumentLine.Length) { var m = new FoldingMarginMarker { IsExpanded = !fs.IsFolded, VisualLine = line, FoldingSection = fs }; _markers.Add(m); VisualChildren.Add(m); m.PropertyChanged += (o, args) => { if (args.Property == IsPointerOverProperty) { InvalidateVisual(); } }; InvalidateMeasure(); } } } } private Pen _foldingControlPen = new Pen(FoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); private Pen _selectedFoldingControlPen = new Pen(SelectedFoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); /// <inheritdoc/> public override void Render(DrawingContext drawingContext) { if (TextView == null || !TextView.VisualLinesValid) return; if (TextView.VisualLines.Count == 0 || FoldingManager == null) return; var allTextLines = TextView.VisualLines.SelectMany(vl => vl.TextLines).ToList(); var colors = new Pen[allTextLines.Count + 1]; var endMarker = new Pen[allTextLines.Count]; CalculateFoldLinesForFoldingsActiveAtStart(allTextLines, colors, endMarker); CalculateFoldLinesForMarkers(allTextLines, colors, endMarker); DrawFoldLines(drawingContext, colors, endMarker); } /// <summary> /// Calculates fold lines for all folding sections that start in front of the current view /// and run into the current view. /// </summary> private void CalculateFoldLinesForFoldingsActiveAtStart(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { var viewStartOffset = TextView.VisualLines[0].FirstDocumentLine.Offset; var viewEndOffset = TextView.VisualLines.Last().LastDocumentLine.EndOffset; var foldings = FoldingManager.GetFoldingsContaining(viewStartOffset); var maxEndOffset = 0; foreach (var fs in foldings) { var end = fs.EndOffset; if (end <= viewEndOffset && !fs.IsFolded) { var textLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (textLineNr >= 0) { endMarker[textLineNr] = _foldingControlPen; } } if (end > maxEndOffset && fs.StartOffset < viewStartOffset) { maxEndOffset = end; } } if (maxEndOffset > 0) { if (maxEndOffset > viewEndOffset) { for (var i = 0; i < colors.Length; i++) { colors[i] = _foldingControlPen; } } else { var maxTextLine = GetTextLineIndexFromOffset(allTextLines, maxEndOffset); for (var i = 0; i <= maxTextLine; i++) { colors[i] = _foldingControlPen; } } } } /// <summary> /// Calculates fold lines for all folding sections that start inside the current view /// </summary> private void CalculateFoldLinesForMarkers(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { foreach (var marker in _markers) { var end = marker.FoldingSection.EndOffset; var endTextLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (!marker.FoldingSection.IsFolded && endTextLineNr >= 0) { if (marker.IsPointerOver) endMarker[endTextLineNr] = _selectedFoldingControlPen; else if (endMarker[endTextLineNr] == null) endMarker[endTextLineNr] = _foldingControlPen; } var startTextLineNr = GetTextLineIndexFromOffset(allTextLines, marker.FoldingSection.StartOffset); if (startTextLineNr >= 0) { for (var i = startTextLineNr + 1; i < colors.Length && i - 1 != endTextLineNr; i++) { if (marker.IsPointerOver) colors[i] = _selectedFoldingControlPen; else if (colors[i] == null) colors[i] = _foldingControlPen; } } } } /// <summary> /// Draws the lines for the folding sections (vertical line with 'color', horizontal lines with 'endMarker') /// Each entry in the input arrays corresponds to one TextLine. /// </summary> private void DrawFoldLines(DrawingContext drawingContext, Pen[] colors, Pen[] endMarker) { // Because we are using PenLineCap.Flat (the default), for vertical lines, // Y coordinates must be on pixel boundaries, whereas the X coordinate must be in the // middle of a pixel. (and the other way round for horizontal lines) var pixelSize = PixelSnapHelpers.GetPixelSize(this); var markerXPos = PixelSnapHelpers.PixelAlign(Bounds.Width / 2, pixelSize.Width); double startY = 0; var currentPen = colors[0]; var tlNumber = 0; foreach (var vl in TextView.VisualLines) { foreach (var tl in vl.TextLines) { if (endMarker[tlNumber] != null) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); drawingContext.DrawLine(endMarker[tlNumber], new Point(markerXPos - pixelSize.Width / 2, visualPos), new Point(Bounds.Width, visualPos)); } if (colors[tlNumber + 1] != currentPen) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, visualPos - pixelSize.Height / 2)); } currentPen = colors[tlNumber + 1]; startY = visualPos; } tlNumber++; } } if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, Bounds.Height)); } } private double GetVisualPos(VisualLine vl, TextLine tl, double pixelHeight) { var pos = vl.GetTextLineVisualYPosition(tl, VisualYPosition.TextMiddle) - TextView.VerticalOffset; return PixelSnapHelpers.PixelAlign(pos, pixelHeight); } private int GetTextLineIndexFromOffset(List<TextLine> textLines, int offset) { var lineNumber = TextView.Document.GetLineByOffset(offset).LineNumber; var vl = TextView.GetVisualLine(lineNumber); if (vl != null) { var relOffset = offset - vl.FirstDocumentLine.Offset; var line = vl.GetTextLine(vl.GetVisualColumn(relOffset)); return textLines.IndexOf(line); } return -1; } } } <MSG> Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style <DFF> @@ -157,7 +157,7 @@ namespace AvaloniaEdit.Folding var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } - return base.ArrangeOverride(finalSize); + return finalSize; } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); @@ -184,6 +184,7 @@ namespace AvaloniaEdit.Folding VisualLine = line, FoldingSection = fs }; + ((ISetLogicalParent)m).SetParent(this); _markers.Add(m); VisualChildren.Add(m);
2
Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style
1
.cs
cs
mit
AvaloniaUI/AvaloniaEdit
10058160
<NME> FoldingMargin.cs <BEF> // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.Linq; using Avalonia; using AvaloniaEdit.Editing; using AvaloniaEdit.Rendering; using AvaloniaEdit.Utils; using Avalonia.Controls; using Avalonia.Media; using Avalonia.Media.TextFormatting; namespace AvaloniaEdit.Folding { /// <summary> /// A margin that shows markers for foldings and allows to expand/collapse the foldings. /// </summary> public class FoldingMargin : AbstractMargin { /// <summary> /// Gets/Sets the folding manager from which the foldings should be shown. /// </summary> public FoldingManager FoldingManager { get; set; } internal const double SizeFactor = Constants.PixelPerPoint; static FoldingMargin() { FoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); FoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); } #region Brushes /// <summary> /// FoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBrush", Brushes.Gray, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of folding markers. /// </summary> public IBrush FoldingMarkerBrush { get => GetValue(FoldingMarkerBrushProperty); set => SetValue(FoldingMarkerBrushProperty, value); } /// <summary> /// FoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of folding markers. /// </summary> public IBrush FoldingMarkerBackgroundBrush { get => GetValue(FoldingMarkerBackgroundBrushProperty); set => SetValue(FoldingMarkerBackgroundBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBrush", Brushes.Black, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBrush { get => GetValue(SelectedFoldingMarkerBrushProperty); set => SetValue(SelectedFoldingMarkerBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBackgroundBrush { get => GetValue(SelectedFoldingMarkerBackgroundBrushProperty); set => SetValue(SelectedFoldingMarkerBackgroundBrushProperty, value); } private static void OnUpdateBrushes(AvaloniaPropertyChangedEventArgs e) { FoldingMargin m = null; if (e.Sender is FoldingMargin margin) m = margin; else if (e.Sender is TextEditor editor) m = editor.TextArea.LeftMargins.FirstOrDefault(c => c is FoldingMargin) as FoldingMargin; if (m == null) return; if (e.Property.Name == FoldingMarkerBrushProperty.Name) { m._foldingControlPen = new Pen((IBrush)e.NewValue); } if (e.Property.Name == SelectedFoldingMarkerBrushProperty.Name) { m._selectedFoldingControlPen = new Pen((IBrush)e.NewValue); } } #endregion /// <inheritdoc/> protected override Size MeasureOverride(Size availableSize) { foreach (var m in _markers) { m.Measure(availableSize); } var width = SizeFactor * GetValue(TextBlock.FontSizeProperty); return new Size(PixelSnapHelpers.RoundToOdd(width, PixelSnapHelpers.GetPixelSize(this).Width), 0); } /// <inheritdoc/> protected override Size ArrangeOverride(Size finalSize) { var pixelSize = PixelSnapHelpers.GetPixelSize(this); foreach (var m in _markers) { var visualColumn = m.VisualLine.GetVisualColumn(m.FoldingSection.StartOffset - m.VisualLine.FirstDocumentLine.Offset); var textLine = m.VisualLine.GetTextLine(visualColumn); var yPos = m.VisualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextMiddle) - TextView.VerticalOffset; yPos -= m.DesiredSize.Height / 2; var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } return base.ArrangeOverride(finalSize); } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); protected override void OnTextViewVisualLinesChanged() { foreach (var m in _markers) { VisualChildren.Remove(m); } _markers.Clear(); InvalidateVisual(); if (TextView != null && FoldingManager != null && TextView.VisualLinesValid) { foreach (var line in TextView.VisualLines) { var fs = FoldingManager.GetNextFolding(line.FirstDocumentLine.Offset); if (fs?.StartOffset <= line.LastDocumentLine.Offset + line.LastDocumentLine.Length) { var m = new FoldingMarginMarker { IsExpanded = !fs.IsFolded, VisualLine = line, FoldingSection = fs }; _markers.Add(m); VisualChildren.Add(m); m.PropertyChanged += (o, args) => { if (args.Property == IsPointerOverProperty) { InvalidateVisual(); } }; InvalidateMeasure(); } } } } private Pen _foldingControlPen = new Pen(FoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); private Pen _selectedFoldingControlPen = new Pen(SelectedFoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); /// <inheritdoc/> public override void Render(DrawingContext drawingContext) { if (TextView == null || !TextView.VisualLinesValid) return; if (TextView.VisualLines.Count == 0 || FoldingManager == null) return; var allTextLines = TextView.VisualLines.SelectMany(vl => vl.TextLines).ToList(); var colors = new Pen[allTextLines.Count + 1]; var endMarker = new Pen[allTextLines.Count]; CalculateFoldLinesForFoldingsActiveAtStart(allTextLines, colors, endMarker); CalculateFoldLinesForMarkers(allTextLines, colors, endMarker); DrawFoldLines(drawingContext, colors, endMarker); } /// <summary> /// Calculates fold lines for all folding sections that start in front of the current view /// and run into the current view. /// </summary> private void CalculateFoldLinesForFoldingsActiveAtStart(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { var viewStartOffset = TextView.VisualLines[0].FirstDocumentLine.Offset; var viewEndOffset = TextView.VisualLines.Last().LastDocumentLine.EndOffset; var foldings = FoldingManager.GetFoldingsContaining(viewStartOffset); var maxEndOffset = 0; foreach (var fs in foldings) { var end = fs.EndOffset; if (end <= viewEndOffset && !fs.IsFolded) { var textLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (textLineNr >= 0) { endMarker[textLineNr] = _foldingControlPen; } } if (end > maxEndOffset && fs.StartOffset < viewStartOffset) { maxEndOffset = end; } } if (maxEndOffset > 0) { if (maxEndOffset > viewEndOffset) { for (var i = 0; i < colors.Length; i++) { colors[i] = _foldingControlPen; } } else { var maxTextLine = GetTextLineIndexFromOffset(allTextLines, maxEndOffset); for (var i = 0; i <= maxTextLine; i++) { colors[i] = _foldingControlPen; } } } } /// <summary> /// Calculates fold lines for all folding sections that start inside the current view /// </summary> private void CalculateFoldLinesForMarkers(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { foreach (var marker in _markers) { var end = marker.FoldingSection.EndOffset; var endTextLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (!marker.FoldingSection.IsFolded && endTextLineNr >= 0) { if (marker.IsPointerOver) endMarker[endTextLineNr] = _selectedFoldingControlPen; else if (endMarker[endTextLineNr] == null) endMarker[endTextLineNr] = _foldingControlPen; } var startTextLineNr = GetTextLineIndexFromOffset(allTextLines, marker.FoldingSection.StartOffset); if (startTextLineNr >= 0) { for (var i = startTextLineNr + 1; i < colors.Length && i - 1 != endTextLineNr; i++) { if (marker.IsPointerOver) colors[i] = _selectedFoldingControlPen; else if (colors[i] == null) colors[i] = _foldingControlPen; } } } } /// <summary> /// Draws the lines for the folding sections (vertical line with 'color', horizontal lines with 'endMarker') /// Each entry in the input arrays corresponds to one TextLine. /// </summary> private void DrawFoldLines(DrawingContext drawingContext, Pen[] colors, Pen[] endMarker) { // Because we are using PenLineCap.Flat (the default), for vertical lines, // Y coordinates must be on pixel boundaries, whereas the X coordinate must be in the // middle of a pixel. (and the other way round for horizontal lines) var pixelSize = PixelSnapHelpers.GetPixelSize(this); var markerXPos = PixelSnapHelpers.PixelAlign(Bounds.Width / 2, pixelSize.Width); double startY = 0; var currentPen = colors[0]; var tlNumber = 0; foreach (var vl in TextView.VisualLines) { foreach (var tl in vl.TextLines) { if (endMarker[tlNumber] != null) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); drawingContext.DrawLine(endMarker[tlNumber], new Point(markerXPos - pixelSize.Width / 2, visualPos), new Point(Bounds.Width, visualPos)); } if (colors[tlNumber + 1] != currentPen) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, visualPos - pixelSize.Height / 2)); } currentPen = colors[tlNumber + 1]; startY = visualPos; } tlNumber++; } } if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, Bounds.Height)); } } private double GetVisualPos(VisualLine vl, TextLine tl, double pixelHeight) { var pos = vl.GetTextLineVisualYPosition(tl, VisualYPosition.TextMiddle) - TextView.VerticalOffset; return PixelSnapHelpers.PixelAlign(pos, pixelHeight); } private int GetTextLineIndexFromOffset(List<TextLine> textLines, int offset) { var lineNumber = TextView.Document.GetLineByOffset(offset).LineNumber; var vl = TextView.GetVisualLine(lineNumber); if (vl != null) { var relOffset = offset - vl.FirstDocumentLine.Offset; var line = vl.GetTextLine(vl.GetVisualColumn(relOffset)); return textLines.IndexOf(line); } return -1; } } } <MSG> Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style <DFF> @@ -157,7 +157,7 @@ namespace AvaloniaEdit.Folding var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } - return base.ArrangeOverride(finalSize); + return finalSize; } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); @@ -184,6 +184,7 @@ namespace AvaloniaEdit.Folding VisualLine = line, FoldingSection = fs }; + ((ISetLogicalParent)m).SetParent(this); _markers.Add(m); VisualChildren.Add(m);
2
Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style
1
.cs
cs
mit
AvaloniaUI/AvaloniaEdit
10058161
<NME> FoldingMargin.cs <BEF> // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.Linq; using Avalonia; using AvaloniaEdit.Editing; using AvaloniaEdit.Rendering; using AvaloniaEdit.Utils; using Avalonia.Controls; using Avalonia.Media; using Avalonia.Media.TextFormatting; namespace AvaloniaEdit.Folding { /// <summary> /// A margin that shows markers for foldings and allows to expand/collapse the foldings. /// </summary> public class FoldingMargin : AbstractMargin { /// <summary> /// Gets/Sets the folding manager from which the foldings should be shown. /// </summary> public FoldingManager FoldingManager { get; set; } internal const double SizeFactor = Constants.PixelPerPoint; static FoldingMargin() { FoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); FoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); } #region Brushes /// <summary> /// FoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBrush", Brushes.Gray, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of folding markers. /// </summary> public IBrush FoldingMarkerBrush { get => GetValue(FoldingMarkerBrushProperty); set => SetValue(FoldingMarkerBrushProperty, value); } /// <summary> /// FoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of folding markers. /// </summary> public IBrush FoldingMarkerBackgroundBrush { get => GetValue(FoldingMarkerBackgroundBrushProperty); set => SetValue(FoldingMarkerBackgroundBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBrush", Brushes.Black, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBrush { get => GetValue(SelectedFoldingMarkerBrushProperty); set => SetValue(SelectedFoldingMarkerBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBackgroundBrush { get => GetValue(SelectedFoldingMarkerBackgroundBrushProperty); set => SetValue(SelectedFoldingMarkerBackgroundBrushProperty, value); } private static void OnUpdateBrushes(AvaloniaPropertyChangedEventArgs e) { FoldingMargin m = null; if (e.Sender is FoldingMargin margin) m = margin; else if (e.Sender is TextEditor editor) m = editor.TextArea.LeftMargins.FirstOrDefault(c => c is FoldingMargin) as FoldingMargin; if (m == null) return; if (e.Property.Name == FoldingMarkerBrushProperty.Name) { m._foldingControlPen = new Pen((IBrush)e.NewValue); } if (e.Property.Name == SelectedFoldingMarkerBrushProperty.Name) { m._selectedFoldingControlPen = new Pen((IBrush)e.NewValue); } } #endregion /// <inheritdoc/> protected override Size MeasureOverride(Size availableSize) { foreach (var m in _markers) { m.Measure(availableSize); } var width = SizeFactor * GetValue(TextBlock.FontSizeProperty); return new Size(PixelSnapHelpers.RoundToOdd(width, PixelSnapHelpers.GetPixelSize(this).Width), 0); } /// <inheritdoc/> protected override Size ArrangeOverride(Size finalSize) { var pixelSize = PixelSnapHelpers.GetPixelSize(this); foreach (var m in _markers) { var visualColumn = m.VisualLine.GetVisualColumn(m.FoldingSection.StartOffset - m.VisualLine.FirstDocumentLine.Offset); var textLine = m.VisualLine.GetTextLine(visualColumn); var yPos = m.VisualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextMiddle) - TextView.VerticalOffset; yPos -= m.DesiredSize.Height / 2; var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } return base.ArrangeOverride(finalSize); } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); protected override void OnTextViewVisualLinesChanged() { foreach (var m in _markers) { VisualChildren.Remove(m); } _markers.Clear(); InvalidateVisual(); if (TextView != null && FoldingManager != null && TextView.VisualLinesValid) { foreach (var line in TextView.VisualLines) { var fs = FoldingManager.GetNextFolding(line.FirstDocumentLine.Offset); if (fs?.StartOffset <= line.LastDocumentLine.Offset + line.LastDocumentLine.Length) { var m = new FoldingMarginMarker { IsExpanded = !fs.IsFolded, VisualLine = line, FoldingSection = fs }; _markers.Add(m); VisualChildren.Add(m); m.PropertyChanged += (o, args) => { if (args.Property == IsPointerOverProperty) { InvalidateVisual(); } }; InvalidateMeasure(); } } } } private Pen _foldingControlPen = new Pen(FoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); private Pen _selectedFoldingControlPen = new Pen(SelectedFoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); /// <inheritdoc/> public override void Render(DrawingContext drawingContext) { if (TextView == null || !TextView.VisualLinesValid) return; if (TextView.VisualLines.Count == 0 || FoldingManager == null) return; var allTextLines = TextView.VisualLines.SelectMany(vl => vl.TextLines).ToList(); var colors = new Pen[allTextLines.Count + 1]; var endMarker = new Pen[allTextLines.Count]; CalculateFoldLinesForFoldingsActiveAtStart(allTextLines, colors, endMarker); CalculateFoldLinesForMarkers(allTextLines, colors, endMarker); DrawFoldLines(drawingContext, colors, endMarker); } /// <summary> /// Calculates fold lines for all folding sections that start in front of the current view /// and run into the current view. /// </summary> private void CalculateFoldLinesForFoldingsActiveAtStart(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { var viewStartOffset = TextView.VisualLines[0].FirstDocumentLine.Offset; var viewEndOffset = TextView.VisualLines.Last().LastDocumentLine.EndOffset; var foldings = FoldingManager.GetFoldingsContaining(viewStartOffset); var maxEndOffset = 0; foreach (var fs in foldings) { var end = fs.EndOffset; if (end <= viewEndOffset && !fs.IsFolded) { var textLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (textLineNr >= 0) { endMarker[textLineNr] = _foldingControlPen; } } if (end > maxEndOffset && fs.StartOffset < viewStartOffset) { maxEndOffset = end; } } if (maxEndOffset > 0) { if (maxEndOffset > viewEndOffset) { for (var i = 0; i < colors.Length; i++) { colors[i] = _foldingControlPen; } } else { var maxTextLine = GetTextLineIndexFromOffset(allTextLines, maxEndOffset); for (var i = 0; i <= maxTextLine; i++) { colors[i] = _foldingControlPen; } } } } /// <summary> /// Calculates fold lines for all folding sections that start inside the current view /// </summary> private void CalculateFoldLinesForMarkers(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { foreach (var marker in _markers) { var end = marker.FoldingSection.EndOffset; var endTextLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (!marker.FoldingSection.IsFolded && endTextLineNr >= 0) { if (marker.IsPointerOver) endMarker[endTextLineNr] = _selectedFoldingControlPen; else if (endMarker[endTextLineNr] == null) endMarker[endTextLineNr] = _foldingControlPen; } var startTextLineNr = GetTextLineIndexFromOffset(allTextLines, marker.FoldingSection.StartOffset); if (startTextLineNr >= 0) { for (var i = startTextLineNr + 1; i < colors.Length && i - 1 != endTextLineNr; i++) { if (marker.IsPointerOver) colors[i] = _selectedFoldingControlPen; else if (colors[i] == null) colors[i] = _foldingControlPen; } } } } /// <summary> /// Draws the lines for the folding sections (vertical line with 'color', horizontal lines with 'endMarker') /// Each entry in the input arrays corresponds to one TextLine. /// </summary> private void DrawFoldLines(DrawingContext drawingContext, Pen[] colors, Pen[] endMarker) { // Because we are using PenLineCap.Flat (the default), for vertical lines, // Y coordinates must be on pixel boundaries, whereas the X coordinate must be in the // middle of a pixel. (and the other way round for horizontal lines) var pixelSize = PixelSnapHelpers.GetPixelSize(this); var markerXPos = PixelSnapHelpers.PixelAlign(Bounds.Width / 2, pixelSize.Width); double startY = 0; var currentPen = colors[0]; var tlNumber = 0; foreach (var vl in TextView.VisualLines) { foreach (var tl in vl.TextLines) { if (endMarker[tlNumber] != null) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); drawingContext.DrawLine(endMarker[tlNumber], new Point(markerXPos - pixelSize.Width / 2, visualPos), new Point(Bounds.Width, visualPos)); } if (colors[tlNumber + 1] != currentPen) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, visualPos - pixelSize.Height / 2)); } currentPen = colors[tlNumber + 1]; startY = visualPos; } tlNumber++; } } if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, Bounds.Height)); } } private double GetVisualPos(VisualLine vl, TextLine tl, double pixelHeight) { var pos = vl.GetTextLineVisualYPosition(tl, VisualYPosition.TextMiddle) - TextView.VerticalOffset; return PixelSnapHelpers.PixelAlign(pos, pixelHeight); } private int GetTextLineIndexFromOffset(List<TextLine> textLines, int offset) { var lineNumber = TextView.Document.GetLineByOffset(offset).LineNumber; var vl = TextView.GetVisualLine(lineNumber); if (vl != null) { var relOffset = offset - vl.FirstDocumentLine.Offset; var line = vl.GetTextLine(vl.GetVisualColumn(relOffset)); return textLines.IndexOf(line); } return -1; } } } <MSG> Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style <DFF> @@ -157,7 +157,7 @@ namespace AvaloniaEdit.Folding var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } - return base.ArrangeOverride(finalSize); + return finalSize; } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); @@ -184,6 +184,7 @@ namespace AvaloniaEdit.Folding VisualLine = line, FoldingSection = fs }; + ((ISetLogicalParent)m).SetParent(this); _markers.Add(m); VisualChildren.Add(m);
2
Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style
1
.cs
cs
mit
AvaloniaUI/AvaloniaEdit
10058162
<NME> FoldingMargin.cs <BEF> // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.Linq; using Avalonia; using AvaloniaEdit.Editing; using AvaloniaEdit.Rendering; using AvaloniaEdit.Utils; using Avalonia.Controls; using Avalonia.Media; using Avalonia.Media.TextFormatting; namespace AvaloniaEdit.Folding { /// <summary> /// A margin that shows markers for foldings and allows to expand/collapse the foldings. /// </summary> public class FoldingMargin : AbstractMargin { /// <summary> /// Gets/Sets the folding manager from which the foldings should be shown. /// </summary> public FoldingManager FoldingManager { get; set; } internal const double SizeFactor = Constants.PixelPerPoint; static FoldingMargin() { FoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); FoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); } #region Brushes /// <summary> /// FoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBrush", Brushes.Gray, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of folding markers. /// </summary> public IBrush FoldingMarkerBrush { get => GetValue(FoldingMarkerBrushProperty); set => SetValue(FoldingMarkerBrushProperty, value); } /// <summary> /// FoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of folding markers. /// </summary> public IBrush FoldingMarkerBackgroundBrush { get => GetValue(FoldingMarkerBackgroundBrushProperty); set => SetValue(FoldingMarkerBackgroundBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBrush", Brushes.Black, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBrush { get => GetValue(SelectedFoldingMarkerBrushProperty); set => SetValue(SelectedFoldingMarkerBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBackgroundBrush { get => GetValue(SelectedFoldingMarkerBackgroundBrushProperty); set => SetValue(SelectedFoldingMarkerBackgroundBrushProperty, value); } private static void OnUpdateBrushes(AvaloniaPropertyChangedEventArgs e) { FoldingMargin m = null; if (e.Sender is FoldingMargin margin) m = margin; else if (e.Sender is TextEditor editor) m = editor.TextArea.LeftMargins.FirstOrDefault(c => c is FoldingMargin) as FoldingMargin; if (m == null) return; if (e.Property.Name == FoldingMarkerBrushProperty.Name) { m._foldingControlPen = new Pen((IBrush)e.NewValue); } if (e.Property.Name == SelectedFoldingMarkerBrushProperty.Name) { m._selectedFoldingControlPen = new Pen((IBrush)e.NewValue); } } #endregion /// <inheritdoc/> protected override Size MeasureOverride(Size availableSize) { foreach (var m in _markers) { m.Measure(availableSize); } var width = SizeFactor * GetValue(TextBlock.FontSizeProperty); return new Size(PixelSnapHelpers.RoundToOdd(width, PixelSnapHelpers.GetPixelSize(this).Width), 0); } /// <inheritdoc/> protected override Size ArrangeOverride(Size finalSize) { var pixelSize = PixelSnapHelpers.GetPixelSize(this); foreach (var m in _markers) { var visualColumn = m.VisualLine.GetVisualColumn(m.FoldingSection.StartOffset - m.VisualLine.FirstDocumentLine.Offset); var textLine = m.VisualLine.GetTextLine(visualColumn); var yPos = m.VisualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextMiddle) - TextView.VerticalOffset; yPos -= m.DesiredSize.Height / 2; var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } return base.ArrangeOverride(finalSize); } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); protected override void OnTextViewVisualLinesChanged() { foreach (var m in _markers) { VisualChildren.Remove(m); } _markers.Clear(); InvalidateVisual(); if (TextView != null && FoldingManager != null && TextView.VisualLinesValid) { foreach (var line in TextView.VisualLines) { var fs = FoldingManager.GetNextFolding(line.FirstDocumentLine.Offset); if (fs?.StartOffset <= line.LastDocumentLine.Offset + line.LastDocumentLine.Length) { var m = new FoldingMarginMarker { IsExpanded = !fs.IsFolded, VisualLine = line, FoldingSection = fs }; _markers.Add(m); VisualChildren.Add(m); m.PropertyChanged += (o, args) => { if (args.Property == IsPointerOverProperty) { InvalidateVisual(); } }; InvalidateMeasure(); } } } } private Pen _foldingControlPen = new Pen(FoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); private Pen _selectedFoldingControlPen = new Pen(SelectedFoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); /// <inheritdoc/> public override void Render(DrawingContext drawingContext) { if (TextView == null || !TextView.VisualLinesValid) return; if (TextView.VisualLines.Count == 0 || FoldingManager == null) return; var allTextLines = TextView.VisualLines.SelectMany(vl => vl.TextLines).ToList(); var colors = new Pen[allTextLines.Count + 1]; var endMarker = new Pen[allTextLines.Count]; CalculateFoldLinesForFoldingsActiveAtStart(allTextLines, colors, endMarker); CalculateFoldLinesForMarkers(allTextLines, colors, endMarker); DrawFoldLines(drawingContext, colors, endMarker); } /// <summary> /// Calculates fold lines for all folding sections that start in front of the current view /// and run into the current view. /// </summary> private void CalculateFoldLinesForFoldingsActiveAtStart(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { var viewStartOffset = TextView.VisualLines[0].FirstDocumentLine.Offset; var viewEndOffset = TextView.VisualLines.Last().LastDocumentLine.EndOffset; var foldings = FoldingManager.GetFoldingsContaining(viewStartOffset); var maxEndOffset = 0; foreach (var fs in foldings) { var end = fs.EndOffset; if (end <= viewEndOffset && !fs.IsFolded) { var textLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (textLineNr >= 0) { endMarker[textLineNr] = _foldingControlPen; } } if (end > maxEndOffset && fs.StartOffset < viewStartOffset) { maxEndOffset = end; } } if (maxEndOffset > 0) { if (maxEndOffset > viewEndOffset) { for (var i = 0; i < colors.Length; i++) { colors[i] = _foldingControlPen; } } else { var maxTextLine = GetTextLineIndexFromOffset(allTextLines, maxEndOffset); for (var i = 0; i <= maxTextLine; i++) { colors[i] = _foldingControlPen; } } } } /// <summary> /// Calculates fold lines for all folding sections that start inside the current view /// </summary> private void CalculateFoldLinesForMarkers(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { foreach (var marker in _markers) { var end = marker.FoldingSection.EndOffset; var endTextLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (!marker.FoldingSection.IsFolded && endTextLineNr >= 0) { if (marker.IsPointerOver) endMarker[endTextLineNr] = _selectedFoldingControlPen; else if (endMarker[endTextLineNr] == null) endMarker[endTextLineNr] = _foldingControlPen; } var startTextLineNr = GetTextLineIndexFromOffset(allTextLines, marker.FoldingSection.StartOffset); if (startTextLineNr >= 0) { for (var i = startTextLineNr + 1; i < colors.Length && i - 1 != endTextLineNr; i++) { if (marker.IsPointerOver) colors[i] = _selectedFoldingControlPen; else if (colors[i] == null) colors[i] = _foldingControlPen; } } } } /// <summary> /// Draws the lines for the folding sections (vertical line with 'color', horizontal lines with 'endMarker') /// Each entry in the input arrays corresponds to one TextLine. /// </summary> private void DrawFoldLines(DrawingContext drawingContext, Pen[] colors, Pen[] endMarker) { // Because we are using PenLineCap.Flat (the default), for vertical lines, // Y coordinates must be on pixel boundaries, whereas the X coordinate must be in the // middle of a pixel. (and the other way round for horizontal lines) var pixelSize = PixelSnapHelpers.GetPixelSize(this); var markerXPos = PixelSnapHelpers.PixelAlign(Bounds.Width / 2, pixelSize.Width); double startY = 0; var currentPen = colors[0]; var tlNumber = 0; foreach (var vl in TextView.VisualLines) { foreach (var tl in vl.TextLines) { if (endMarker[tlNumber] != null) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); drawingContext.DrawLine(endMarker[tlNumber], new Point(markerXPos - pixelSize.Width / 2, visualPos), new Point(Bounds.Width, visualPos)); } if (colors[tlNumber + 1] != currentPen) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, visualPos - pixelSize.Height / 2)); } currentPen = colors[tlNumber + 1]; startY = visualPos; } tlNumber++; } } if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, Bounds.Height)); } } private double GetVisualPos(VisualLine vl, TextLine tl, double pixelHeight) { var pos = vl.GetTextLineVisualYPosition(tl, VisualYPosition.TextMiddle) - TextView.VerticalOffset; return PixelSnapHelpers.PixelAlign(pos, pixelHeight); } private int GetTextLineIndexFromOffset(List<TextLine> textLines, int offset) { var lineNumber = TextView.Document.GetLineByOffset(offset).LineNumber; var vl = TextView.GetVisualLine(lineNumber); if (vl != null) { var relOffset = offset - vl.FirstDocumentLine.Offset; var line = vl.GetTextLine(vl.GetVisualColumn(relOffset)); return textLines.IndexOf(line); } return -1; } } } <MSG> Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style <DFF> @@ -157,7 +157,7 @@ namespace AvaloniaEdit.Folding var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } - return base.ArrangeOverride(finalSize); + return finalSize; } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); @@ -184,6 +184,7 @@ namespace AvaloniaEdit.Folding VisualLine = line, FoldingSection = fs }; + ((ISetLogicalParent)m).SetParent(this); _markers.Add(m); VisualChildren.Add(m);
2
Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style
1
.cs
cs
mit
AvaloniaUI/AvaloniaEdit
10058163
<NME> FoldingMargin.cs <BEF> // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.Linq; using Avalonia; using AvaloniaEdit.Editing; using AvaloniaEdit.Rendering; using AvaloniaEdit.Utils; using Avalonia.Controls; using Avalonia.Media; using Avalonia.Media.TextFormatting; namespace AvaloniaEdit.Folding { /// <summary> /// A margin that shows markers for foldings and allows to expand/collapse the foldings. /// </summary> public class FoldingMargin : AbstractMargin { /// <summary> /// Gets/Sets the folding manager from which the foldings should be shown. /// </summary> public FoldingManager FoldingManager { get; set; } internal const double SizeFactor = Constants.PixelPerPoint; static FoldingMargin() { FoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); FoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); } #region Brushes /// <summary> /// FoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBrush", Brushes.Gray, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of folding markers. /// </summary> public IBrush FoldingMarkerBrush { get => GetValue(FoldingMarkerBrushProperty); set => SetValue(FoldingMarkerBrushProperty, value); } /// <summary> /// FoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of folding markers. /// </summary> public IBrush FoldingMarkerBackgroundBrush { get => GetValue(FoldingMarkerBackgroundBrushProperty); set => SetValue(FoldingMarkerBackgroundBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBrush", Brushes.Black, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBrush { get => GetValue(SelectedFoldingMarkerBrushProperty); set => SetValue(SelectedFoldingMarkerBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBackgroundBrush { get => GetValue(SelectedFoldingMarkerBackgroundBrushProperty); set => SetValue(SelectedFoldingMarkerBackgroundBrushProperty, value); } private static void OnUpdateBrushes(AvaloniaPropertyChangedEventArgs e) { FoldingMargin m = null; if (e.Sender is FoldingMargin margin) m = margin; else if (e.Sender is TextEditor editor) m = editor.TextArea.LeftMargins.FirstOrDefault(c => c is FoldingMargin) as FoldingMargin; if (m == null) return; if (e.Property.Name == FoldingMarkerBrushProperty.Name) { m._foldingControlPen = new Pen((IBrush)e.NewValue); } if (e.Property.Name == SelectedFoldingMarkerBrushProperty.Name) { m._selectedFoldingControlPen = new Pen((IBrush)e.NewValue); } } #endregion /// <inheritdoc/> protected override Size MeasureOverride(Size availableSize) { foreach (var m in _markers) { m.Measure(availableSize); } var width = SizeFactor * GetValue(TextBlock.FontSizeProperty); return new Size(PixelSnapHelpers.RoundToOdd(width, PixelSnapHelpers.GetPixelSize(this).Width), 0); } /// <inheritdoc/> protected override Size ArrangeOverride(Size finalSize) { var pixelSize = PixelSnapHelpers.GetPixelSize(this); foreach (var m in _markers) { var visualColumn = m.VisualLine.GetVisualColumn(m.FoldingSection.StartOffset - m.VisualLine.FirstDocumentLine.Offset); var textLine = m.VisualLine.GetTextLine(visualColumn); var yPos = m.VisualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextMiddle) - TextView.VerticalOffset; yPos -= m.DesiredSize.Height / 2; var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } return base.ArrangeOverride(finalSize); } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); protected override void OnTextViewVisualLinesChanged() { foreach (var m in _markers) { VisualChildren.Remove(m); } _markers.Clear(); InvalidateVisual(); if (TextView != null && FoldingManager != null && TextView.VisualLinesValid) { foreach (var line in TextView.VisualLines) { var fs = FoldingManager.GetNextFolding(line.FirstDocumentLine.Offset); if (fs?.StartOffset <= line.LastDocumentLine.Offset + line.LastDocumentLine.Length) { var m = new FoldingMarginMarker { IsExpanded = !fs.IsFolded, VisualLine = line, FoldingSection = fs }; _markers.Add(m); VisualChildren.Add(m); m.PropertyChanged += (o, args) => { if (args.Property == IsPointerOverProperty) { InvalidateVisual(); } }; InvalidateMeasure(); } } } } private Pen _foldingControlPen = new Pen(FoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); private Pen _selectedFoldingControlPen = new Pen(SelectedFoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); /// <inheritdoc/> public override void Render(DrawingContext drawingContext) { if (TextView == null || !TextView.VisualLinesValid) return; if (TextView.VisualLines.Count == 0 || FoldingManager == null) return; var allTextLines = TextView.VisualLines.SelectMany(vl => vl.TextLines).ToList(); var colors = new Pen[allTextLines.Count + 1]; var endMarker = new Pen[allTextLines.Count]; CalculateFoldLinesForFoldingsActiveAtStart(allTextLines, colors, endMarker); CalculateFoldLinesForMarkers(allTextLines, colors, endMarker); DrawFoldLines(drawingContext, colors, endMarker); } /// <summary> /// Calculates fold lines for all folding sections that start in front of the current view /// and run into the current view. /// </summary> private void CalculateFoldLinesForFoldingsActiveAtStart(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { var viewStartOffset = TextView.VisualLines[0].FirstDocumentLine.Offset; var viewEndOffset = TextView.VisualLines.Last().LastDocumentLine.EndOffset; var foldings = FoldingManager.GetFoldingsContaining(viewStartOffset); var maxEndOffset = 0; foreach (var fs in foldings) { var end = fs.EndOffset; if (end <= viewEndOffset && !fs.IsFolded) { var textLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (textLineNr >= 0) { endMarker[textLineNr] = _foldingControlPen; } } if (end > maxEndOffset && fs.StartOffset < viewStartOffset) { maxEndOffset = end; } } if (maxEndOffset > 0) { if (maxEndOffset > viewEndOffset) { for (var i = 0; i < colors.Length; i++) { colors[i] = _foldingControlPen; } } else { var maxTextLine = GetTextLineIndexFromOffset(allTextLines, maxEndOffset); for (var i = 0; i <= maxTextLine; i++) { colors[i] = _foldingControlPen; } } } } /// <summary> /// Calculates fold lines for all folding sections that start inside the current view /// </summary> private void CalculateFoldLinesForMarkers(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { foreach (var marker in _markers) { var end = marker.FoldingSection.EndOffset; var endTextLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (!marker.FoldingSection.IsFolded && endTextLineNr >= 0) { if (marker.IsPointerOver) endMarker[endTextLineNr] = _selectedFoldingControlPen; else if (endMarker[endTextLineNr] == null) endMarker[endTextLineNr] = _foldingControlPen; } var startTextLineNr = GetTextLineIndexFromOffset(allTextLines, marker.FoldingSection.StartOffset); if (startTextLineNr >= 0) { for (var i = startTextLineNr + 1; i < colors.Length && i - 1 != endTextLineNr; i++) { if (marker.IsPointerOver) colors[i] = _selectedFoldingControlPen; else if (colors[i] == null) colors[i] = _foldingControlPen; } } } } /// <summary> /// Draws the lines for the folding sections (vertical line with 'color', horizontal lines with 'endMarker') /// Each entry in the input arrays corresponds to one TextLine. /// </summary> private void DrawFoldLines(DrawingContext drawingContext, Pen[] colors, Pen[] endMarker) { // Because we are using PenLineCap.Flat (the default), for vertical lines, // Y coordinates must be on pixel boundaries, whereas the X coordinate must be in the // middle of a pixel. (and the other way round for horizontal lines) var pixelSize = PixelSnapHelpers.GetPixelSize(this); var markerXPos = PixelSnapHelpers.PixelAlign(Bounds.Width / 2, pixelSize.Width); double startY = 0; var currentPen = colors[0]; var tlNumber = 0; foreach (var vl in TextView.VisualLines) { foreach (var tl in vl.TextLines) { if (endMarker[tlNumber] != null) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); drawingContext.DrawLine(endMarker[tlNumber], new Point(markerXPos - pixelSize.Width / 2, visualPos), new Point(Bounds.Width, visualPos)); } if (colors[tlNumber + 1] != currentPen) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, visualPos - pixelSize.Height / 2)); } currentPen = colors[tlNumber + 1]; startY = visualPos; } tlNumber++; } } if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, Bounds.Height)); } } private double GetVisualPos(VisualLine vl, TextLine tl, double pixelHeight) { var pos = vl.GetTextLineVisualYPosition(tl, VisualYPosition.TextMiddle) - TextView.VerticalOffset; return PixelSnapHelpers.PixelAlign(pos, pixelHeight); } private int GetTextLineIndexFromOffset(List<TextLine> textLines, int offset) { var lineNumber = TextView.Document.GetLineByOffset(offset).LineNumber; var vl = TextView.GetVisualLine(lineNumber); if (vl != null) { var relOffset = offset - vl.FirstDocumentLine.Offset; var line = vl.GetTextLine(vl.GetVisualColumn(relOffset)); return textLines.IndexOf(line); } return -1; } } } <MSG> Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style <DFF> @@ -157,7 +157,7 @@ namespace AvaloniaEdit.Folding var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } - return base.ArrangeOverride(finalSize); + return finalSize; } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); @@ -184,6 +184,7 @@ namespace AvaloniaEdit.Folding VisualLine = line, FoldingSection = fs }; + ((ISetLogicalParent)m).SetParent(this); _markers.Add(m); VisualChildren.Add(m);
2
Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style
1
.cs
cs
mit
AvaloniaUI/AvaloniaEdit
10058164
<NME> FoldingMargin.cs <BEF> // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.Linq; using Avalonia; using AvaloniaEdit.Editing; using AvaloniaEdit.Rendering; using AvaloniaEdit.Utils; using Avalonia.Controls; using Avalonia.Media; using Avalonia.Media.TextFormatting; namespace AvaloniaEdit.Folding { /// <summary> /// A margin that shows markers for foldings and allows to expand/collapse the foldings. /// </summary> public class FoldingMargin : AbstractMargin { /// <summary> /// Gets/Sets the folding manager from which the foldings should be shown. /// </summary> public FoldingManager FoldingManager { get; set; } internal const double SizeFactor = Constants.PixelPerPoint; static FoldingMargin() { FoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); FoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBrushProperty.Changed.Subscribe(OnUpdateBrushes); SelectedFoldingMarkerBackgroundBrushProperty.Changed.Subscribe(OnUpdateBrushes); } #region Brushes /// <summary> /// FoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBrush", Brushes.Gray, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of folding markers. /// </summary> public IBrush FoldingMarkerBrush { get => GetValue(FoldingMarkerBrushProperty); set => SetValue(FoldingMarkerBrushProperty, value); } /// <summary> /// FoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> FoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("FoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of folding markers. /// </summary> public IBrush FoldingMarkerBackgroundBrush { get => GetValue(FoldingMarkerBackgroundBrushProperty); set => SetValue(FoldingMarkerBackgroundBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBrush", Brushes.Black, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the lines of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBrush { get => GetValue(SelectedFoldingMarkerBrushProperty); set => SetValue(SelectedFoldingMarkerBrushProperty, value); } /// <summary> /// SelectedFoldingMarkerBackgroundBrush dependency property. /// </summary> public static readonly AttachedProperty<IBrush> SelectedFoldingMarkerBackgroundBrushProperty = AvaloniaProperty.RegisterAttached<FoldingMargin, Control, IBrush>("SelectedFoldingMarkerBackgroundBrush", Brushes.White, inherits: true); /// <summary> /// Gets/sets the Brush used for displaying the background of selected folding markers. /// </summary> public IBrush SelectedFoldingMarkerBackgroundBrush { get => GetValue(SelectedFoldingMarkerBackgroundBrushProperty); set => SetValue(SelectedFoldingMarkerBackgroundBrushProperty, value); } private static void OnUpdateBrushes(AvaloniaPropertyChangedEventArgs e) { FoldingMargin m = null; if (e.Sender is FoldingMargin margin) m = margin; else if (e.Sender is TextEditor editor) m = editor.TextArea.LeftMargins.FirstOrDefault(c => c is FoldingMargin) as FoldingMargin; if (m == null) return; if (e.Property.Name == FoldingMarkerBrushProperty.Name) { m._foldingControlPen = new Pen((IBrush)e.NewValue); } if (e.Property.Name == SelectedFoldingMarkerBrushProperty.Name) { m._selectedFoldingControlPen = new Pen((IBrush)e.NewValue); } } #endregion /// <inheritdoc/> protected override Size MeasureOverride(Size availableSize) { foreach (var m in _markers) { m.Measure(availableSize); } var width = SizeFactor * GetValue(TextBlock.FontSizeProperty); return new Size(PixelSnapHelpers.RoundToOdd(width, PixelSnapHelpers.GetPixelSize(this).Width), 0); } /// <inheritdoc/> protected override Size ArrangeOverride(Size finalSize) { var pixelSize = PixelSnapHelpers.GetPixelSize(this); foreach (var m in _markers) { var visualColumn = m.VisualLine.GetVisualColumn(m.FoldingSection.StartOffset - m.VisualLine.FirstDocumentLine.Offset); var textLine = m.VisualLine.GetTextLine(visualColumn); var yPos = m.VisualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextMiddle) - TextView.VerticalOffset; yPos -= m.DesiredSize.Height / 2; var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } return base.ArrangeOverride(finalSize); } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); protected override void OnTextViewVisualLinesChanged() { foreach (var m in _markers) { VisualChildren.Remove(m); } _markers.Clear(); InvalidateVisual(); if (TextView != null && FoldingManager != null && TextView.VisualLinesValid) { foreach (var line in TextView.VisualLines) { var fs = FoldingManager.GetNextFolding(line.FirstDocumentLine.Offset); if (fs?.StartOffset <= line.LastDocumentLine.Offset + line.LastDocumentLine.Length) { var m = new FoldingMarginMarker { IsExpanded = !fs.IsFolded, VisualLine = line, FoldingSection = fs }; _markers.Add(m); VisualChildren.Add(m); m.PropertyChanged += (o, args) => { if (args.Property == IsPointerOverProperty) { InvalidateVisual(); } }; InvalidateMeasure(); } } } } private Pen _foldingControlPen = new Pen(FoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); private Pen _selectedFoldingControlPen = new Pen(SelectedFoldingMarkerBrushProperty.GetDefaultValue(typeof(FoldingMargin))); /// <inheritdoc/> public override void Render(DrawingContext drawingContext) { if (TextView == null || !TextView.VisualLinesValid) return; if (TextView.VisualLines.Count == 0 || FoldingManager == null) return; var allTextLines = TextView.VisualLines.SelectMany(vl => vl.TextLines).ToList(); var colors = new Pen[allTextLines.Count + 1]; var endMarker = new Pen[allTextLines.Count]; CalculateFoldLinesForFoldingsActiveAtStart(allTextLines, colors, endMarker); CalculateFoldLinesForMarkers(allTextLines, colors, endMarker); DrawFoldLines(drawingContext, colors, endMarker); } /// <summary> /// Calculates fold lines for all folding sections that start in front of the current view /// and run into the current view. /// </summary> private void CalculateFoldLinesForFoldingsActiveAtStart(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { var viewStartOffset = TextView.VisualLines[0].FirstDocumentLine.Offset; var viewEndOffset = TextView.VisualLines.Last().LastDocumentLine.EndOffset; var foldings = FoldingManager.GetFoldingsContaining(viewStartOffset); var maxEndOffset = 0; foreach (var fs in foldings) { var end = fs.EndOffset; if (end <= viewEndOffset && !fs.IsFolded) { var textLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (textLineNr >= 0) { endMarker[textLineNr] = _foldingControlPen; } } if (end > maxEndOffset && fs.StartOffset < viewStartOffset) { maxEndOffset = end; } } if (maxEndOffset > 0) { if (maxEndOffset > viewEndOffset) { for (var i = 0; i < colors.Length; i++) { colors[i] = _foldingControlPen; } } else { var maxTextLine = GetTextLineIndexFromOffset(allTextLines, maxEndOffset); for (var i = 0; i <= maxTextLine; i++) { colors[i] = _foldingControlPen; } } } } /// <summary> /// Calculates fold lines for all folding sections that start inside the current view /// </summary> private void CalculateFoldLinesForMarkers(List<TextLine> allTextLines, Pen[] colors, Pen[] endMarker) { foreach (var marker in _markers) { var end = marker.FoldingSection.EndOffset; var endTextLineNr = GetTextLineIndexFromOffset(allTextLines, end); if (!marker.FoldingSection.IsFolded && endTextLineNr >= 0) { if (marker.IsPointerOver) endMarker[endTextLineNr] = _selectedFoldingControlPen; else if (endMarker[endTextLineNr] == null) endMarker[endTextLineNr] = _foldingControlPen; } var startTextLineNr = GetTextLineIndexFromOffset(allTextLines, marker.FoldingSection.StartOffset); if (startTextLineNr >= 0) { for (var i = startTextLineNr + 1; i < colors.Length && i - 1 != endTextLineNr; i++) { if (marker.IsPointerOver) colors[i] = _selectedFoldingControlPen; else if (colors[i] == null) colors[i] = _foldingControlPen; } } } } /// <summary> /// Draws the lines for the folding sections (vertical line with 'color', horizontal lines with 'endMarker') /// Each entry in the input arrays corresponds to one TextLine. /// </summary> private void DrawFoldLines(DrawingContext drawingContext, Pen[] colors, Pen[] endMarker) { // Because we are using PenLineCap.Flat (the default), for vertical lines, // Y coordinates must be on pixel boundaries, whereas the X coordinate must be in the // middle of a pixel. (and the other way round for horizontal lines) var pixelSize = PixelSnapHelpers.GetPixelSize(this); var markerXPos = PixelSnapHelpers.PixelAlign(Bounds.Width / 2, pixelSize.Width); double startY = 0; var currentPen = colors[0]; var tlNumber = 0; foreach (var vl in TextView.VisualLines) { foreach (var tl in vl.TextLines) { if (endMarker[tlNumber] != null) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); drawingContext.DrawLine(endMarker[tlNumber], new Point(markerXPos - pixelSize.Width / 2, visualPos), new Point(Bounds.Width, visualPos)); } if (colors[tlNumber + 1] != currentPen) { var visualPos = GetVisualPos(vl, tl, pixelSize.Height); if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, visualPos - pixelSize.Height / 2)); } currentPen = colors[tlNumber + 1]; startY = visualPos; } tlNumber++; } } if (currentPen != null) { drawingContext.DrawLine(currentPen, new Point(markerXPos, startY + pixelSize.Height / 2), new Point(markerXPos, Bounds.Height)); } } private double GetVisualPos(VisualLine vl, TextLine tl, double pixelHeight) { var pos = vl.GetTextLineVisualYPosition(tl, VisualYPosition.TextMiddle) - TextView.VerticalOffset; return PixelSnapHelpers.PixelAlign(pos, pixelHeight); } private int GetTextLineIndexFromOffset(List<TextLine> textLines, int offset) { var lineNumber = TextView.Document.GetLineByOffset(offset).LineNumber; var vl = TextView.GetVisualLine(lineNumber); if (vl != null) { var relOffset = offset - vl.FirstDocumentLine.Offset; var line = vl.GetTextLine(vl.GetVisualColumn(relOffset)); return textLines.IndexOf(line); } return -1; } } } <MSG> Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style <DFF> @@ -157,7 +157,7 @@ namespace AvaloniaEdit.Folding var xPos = (finalSize.Width - m.DesiredSize.Width) / 2; m.Arrange(new Rect(PixelSnapHelpers.Round(new Point(xPos, yPos), pixelSize), m.DesiredSize)); } - return base.ArrangeOverride(finalSize); + return finalSize; } private readonly List<FoldingMarginMarker> _markers = new List<FoldingMarginMarker>(); @@ -184,6 +184,7 @@ namespace AvaloniaEdit.Folding VisualLine = line, FoldingSection = fs }; + ((ISetLogicalParent)m).SetParent(this); _markers.Add(m); VisualChildren.Add(m);
2
Merge branch 'master' into dev/siegfriedpammer/font-weight-and-style
1
.cs
cs
mit
AvaloniaUI/AvaloniaEdit
10058165
<NME> InsightWindow.xaml <BEF> <Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cc="clr-namespace:AvaloniaEdit.CodeCompletion;assembly=AvaloniaEdit"> <Style Selector="cc|OverloadViewer"> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush" Value="Black" /> <Setter Property="Background" Value="#eeeeee" /> <Setter Property="Padding" Value="2" /> <Setter Property="Template"> <ControlTemplate> <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"> <Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,*"> <StackPanel Grid.Row="0" Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black" Data="M 0,0.866 L 1,0.866 L 0.5,0 Z" Stretch="UniformToFill" /> </Button> <TextBlock Margin="2,0,2,0" Text="{Binding Provider.CurrentIndexText, RelativeSource={RelativeSource TemplatedParent}}" /> <Button Name="PART_DOWN"> <Path Stroke="Black" Fill="Black" Data="M 0,0 L 1,0 L 0.5,0.866 Z" Stretch="UniformToFill" /> </Button> </StackPanel> <ContentPresenter Grid.Row="0" Grid.Column="1" Content="{Binding Provider.CurrentHeader, RelativeSource={RelativeSource TemplatedParent}}" /> <ContentPresenter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{Binding Provider.CurrentContent, RelativeSource={RelativeSource TemplatedParent}}" /> </Grid> </Border> </ControlTemplate> </Setter> </Style> <Style Selector="cc|OverloadViewer /template/ Button"> <Setter Property="Background" Value="LightGray" /> <Setter Property="Padding" Value="2,2,2,2" /> <Setter Property="Width" Value="9" /> <Setter Property="Height" Value="9" /> <Setter Property="Template"> <ControlTemplate> <Border Name="bd" Background="{TemplateBinding Background}" CornerRadius="2"> <ContentPresenter Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" /> </Border> </ControlTemplate> </Setter> </Style> </Styles> <MSG> compatibility with latest avalonia. <DFF> @@ -24,7 +24,7 @@ Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" - IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> + IsVisible="{TemplateBinding Path=Provider.Count, Converter={x:Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black"
1
compatibility with latest avalonia.
1
.xaml
xaml
mit
AvaloniaUI/AvaloniaEdit
10058166
<NME> InsightWindow.xaml <BEF> <Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cc="clr-namespace:AvaloniaEdit.CodeCompletion;assembly=AvaloniaEdit"> <Style Selector="cc|OverloadViewer"> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush" Value="Black" /> <Setter Property="Background" Value="#eeeeee" /> <Setter Property="Padding" Value="2" /> <Setter Property="Template"> <ControlTemplate> <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"> <Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,*"> <StackPanel Grid.Row="0" Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black" Data="M 0,0.866 L 1,0.866 L 0.5,0 Z" Stretch="UniformToFill" /> </Button> <TextBlock Margin="2,0,2,0" Text="{Binding Provider.CurrentIndexText, RelativeSource={RelativeSource TemplatedParent}}" /> <Button Name="PART_DOWN"> <Path Stroke="Black" Fill="Black" Data="M 0,0 L 1,0 L 0.5,0.866 Z" Stretch="UniformToFill" /> </Button> </StackPanel> <ContentPresenter Grid.Row="0" Grid.Column="1" Content="{Binding Provider.CurrentHeader, RelativeSource={RelativeSource TemplatedParent}}" /> <ContentPresenter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{Binding Provider.CurrentContent, RelativeSource={RelativeSource TemplatedParent}}" /> </Grid> </Border> </ControlTemplate> </Setter> </Style> <Style Selector="cc|OverloadViewer /template/ Button"> <Setter Property="Background" Value="LightGray" /> <Setter Property="Padding" Value="2,2,2,2" /> <Setter Property="Width" Value="9" /> <Setter Property="Height" Value="9" /> <Setter Property="Template"> <ControlTemplate> <Border Name="bd" Background="{TemplateBinding Background}" CornerRadius="2"> <ContentPresenter Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" /> </Border> </ControlTemplate> </Setter> </Style> </Styles> <MSG> compatibility with latest avalonia. <DFF> @@ -24,7 +24,7 @@ Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" - IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> + IsVisible="{TemplateBinding Path=Provider.Count, Converter={x:Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black"
1
compatibility with latest avalonia.
1
.xaml
xaml
mit
AvaloniaUI/AvaloniaEdit
10058167
<NME> InsightWindow.xaml <BEF> <Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cc="clr-namespace:AvaloniaEdit.CodeCompletion;assembly=AvaloniaEdit"> <Style Selector="cc|OverloadViewer"> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush" Value="Black" /> <Setter Property="Background" Value="#eeeeee" /> <Setter Property="Padding" Value="2" /> <Setter Property="Template"> <ControlTemplate> <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"> <Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,*"> <StackPanel Grid.Row="0" Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black" Data="M 0,0.866 L 1,0.866 L 0.5,0 Z" Stretch="UniformToFill" /> </Button> <TextBlock Margin="2,0,2,0" Text="{Binding Provider.CurrentIndexText, RelativeSource={RelativeSource TemplatedParent}}" /> <Button Name="PART_DOWN"> <Path Stroke="Black" Fill="Black" Data="M 0,0 L 1,0 L 0.5,0.866 Z" Stretch="UniformToFill" /> </Button> </StackPanel> <ContentPresenter Grid.Row="0" Grid.Column="1" Content="{Binding Provider.CurrentHeader, RelativeSource={RelativeSource TemplatedParent}}" /> <ContentPresenter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{Binding Provider.CurrentContent, RelativeSource={RelativeSource TemplatedParent}}" /> </Grid> </Border> </ControlTemplate> </Setter> </Style> <Style Selector="cc|OverloadViewer /template/ Button"> <Setter Property="Background" Value="LightGray" /> <Setter Property="Padding" Value="2,2,2,2" /> <Setter Property="Width" Value="9" /> <Setter Property="Height" Value="9" /> <Setter Property="Template"> <ControlTemplate> <Border Name="bd" Background="{TemplateBinding Background}" CornerRadius="2"> <ContentPresenter Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" /> </Border> </ControlTemplate> </Setter> </Style> </Styles> <MSG> compatibility with latest avalonia. <DFF> @@ -24,7 +24,7 @@ Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" - IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> + IsVisible="{TemplateBinding Path=Provider.Count, Converter={x:Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black"
1
compatibility with latest avalonia.
1
.xaml
xaml
mit
AvaloniaUI/AvaloniaEdit
10058168
<NME> InsightWindow.xaml <BEF> <Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cc="clr-namespace:AvaloniaEdit.CodeCompletion;assembly=AvaloniaEdit"> <Style Selector="cc|OverloadViewer"> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush" Value="Black" /> <Setter Property="Background" Value="#eeeeee" /> <Setter Property="Padding" Value="2" /> <Setter Property="Template"> <ControlTemplate> <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"> <Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,*"> <StackPanel Grid.Row="0" Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black" Data="M 0,0.866 L 1,0.866 L 0.5,0 Z" Stretch="UniformToFill" /> </Button> <TextBlock Margin="2,0,2,0" Text="{Binding Provider.CurrentIndexText, RelativeSource={RelativeSource TemplatedParent}}" /> <Button Name="PART_DOWN"> <Path Stroke="Black" Fill="Black" Data="M 0,0 L 1,0 L 0.5,0.866 Z" Stretch="UniformToFill" /> </Button> </StackPanel> <ContentPresenter Grid.Row="0" Grid.Column="1" Content="{Binding Provider.CurrentHeader, RelativeSource={RelativeSource TemplatedParent}}" /> <ContentPresenter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{Binding Provider.CurrentContent, RelativeSource={RelativeSource TemplatedParent}}" /> </Grid> </Border> </ControlTemplate> </Setter> </Style> <Style Selector="cc|OverloadViewer /template/ Button"> <Setter Property="Background" Value="LightGray" /> <Setter Property="Padding" Value="2,2,2,2" /> <Setter Property="Width" Value="9" /> <Setter Property="Height" Value="9" /> <Setter Property="Template"> <ControlTemplate> <Border Name="bd" Background="{TemplateBinding Background}" CornerRadius="2"> <ContentPresenter Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" /> </Border> </ControlTemplate> </Setter> </Style> </Styles> <MSG> compatibility with latest avalonia. <DFF> @@ -24,7 +24,7 @@ Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" - IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> + IsVisible="{TemplateBinding Path=Provider.Count, Converter={x:Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black"
1
compatibility with latest avalonia.
1
.xaml
xaml
mit
AvaloniaUI/AvaloniaEdit
10058169
<NME> InsightWindow.xaml <BEF> <Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cc="clr-namespace:AvaloniaEdit.CodeCompletion;assembly=AvaloniaEdit"> <Style Selector="cc|OverloadViewer"> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush" Value="Black" /> <Setter Property="Background" Value="#eeeeee" /> <Setter Property="Padding" Value="2" /> <Setter Property="Template"> <ControlTemplate> <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"> <Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,*"> <StackPanel Grid.Row="0" Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black" Data="M 0,0.866 L 1,0.866 L 0.5,0 Z" Stretch="UniformToFill" /> </Button> <TextBlock Margin="2,0,2,0" Text="{Binding Provider.CurrentIndexText, RelativeSource={RelativeSource TemplatedParent}}" /> <Button Name="PART_DOWN"> <Path Stroke="Black" Fill="Black" Data="M 0,0 L 1,0 L 0.5,0.866 Z" Stretch="UniformToFill" /> </Button> </StackPanel> <ContentPresenter Grid.Row="0" Grid.Column="1" Content="{Binding Provider.CurrentHeader, RelativeSource={RelativeSource TemplatedParent}}" /> <ContentPresenter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{Binding Provider.CurrentContent, RelativeSource={RelativeSource TemplatedParent}}" /> </Grid> </Border> </ControlTemplate> </Setter> </Style> <Style Selector="cc|OverloadViewer /template/ Button"> <Setter Property="Background" Value="LightGray" /> <Setter Property="Padding" Value="2,2,2,2" /> <Setter Property="Width" Value="9" /> <Setter Property="Height" Value="9" /> <Setter Property="Template"> <ControlTemplate> <Border Name="bd" Background="{TemplateBinding Background}" CornerRadius="2"> <ContentPresenter Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" /> </Border> </ControlTemplate> </Setter> </Style> </Styles> <MSG> compatibility with latest avalonia. <DFF> @@ -24,7 +24,7 @@ Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" - IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> + IsVisible="{TemplateBinding Path=Provider.Count, Converter={x:Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black"
1
compatibility with latest avalonia.
1
.xaml
xaml
mit
AvaloniaUI/AvaloniaEdit
10058170
<NME> InsightWindow.xaml <BEF> <Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cc="clr-namespace:AvaloniaEdit.CodeCompletion;assembly=AvaloniaEdit"> <Style Selector="cc|OverloadViewer"> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush" Value="Black" /> <Setter Property="Background" Value="#eeeeee" /> <Setter Property="Padding" Value="2" /> <Setter Property="Template"> <ControlTemplate> <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"> <Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,*"> <StackPanel Grid.Row="0" Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black" Data="M 0,0.866 L 1,0.866 L 0.5,0 Z" Stretch="UniformToFill" /> </Button> <TextBlock Margin="2,0,2,0" Text="{Binding Provider.CurrentIndexText, RelativeSource={RelativeSource TemplatedParent}}" /> <Button Name="PART_DOWN"> <Path Stroke="Black" Fill="Black" Data="M 0,0 L 1,0 L 0.5,0.866 Z" Stretch="UniformToFill" /> </Button> </StackPanel> <ContentPresenter Grid.Row="0" Grid.Column="1" Content="{Binding Provider.CurrentHeader, RelativeSource={RelativeSource TemplatedParent}}" /> <ContentPresenter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{Binding Provider.CurrentContent, RelativeSource={RelativeSource TemplatedParent}}" /> </Grid> </Border> </ControlTemplate> </Setter> </Style> <Style Selector="cc|OverloadViewer /template/ Button"> <Setter Property="Background" Value="LightGray" /> <Setter Property="Padding" Value="2,2,2,2" /> <Setter Property="Width" Value="9" /> <Setter Property="Height" Value="9" /> <Setter Property="Template"> <ControlTemplate> <Border Name="bd" Background="{TemplateBinding Background}" CornerRadius="2"> <ContentPresenter Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" /> </Border> </ControlTemplate> </Setter> </Style> </Styles> <MSG> compatibility with latest avalonia. <DFF> @@ -24,7 +24,7 @@ Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" - IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> + IsVisible="{TemplateBinding Path=Provider.Count, Converter={x:Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black"
1
compatibility with latest avalonia.
1
.xaml
xaml
mit
AvaloniaUI/AvaloniaEdit
10058171
<NME> InsightWindow.xaml <BEF> <Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cc="clr-namespace:AvaloniaEdit.CodeCompletion;assembly=AvaloniaEdit"> <Style Selector="cc|OverloadViewer"> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush" Value="Black" /> <Setter Property="Background" Value="#eeeeee" /> <Setter Property="Padding" Value="2" /> <Setter Property="Template"> <ControlTemplate> <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"> <Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,*"> <StackPanel Grid.Row="0" Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black" Data="M 0,0.866 L 1,0.866 L 0.5,0 Z" Stretch="UniformToFill" /> </Button> <TextBlock Margin="2,0,2,0" Text="{Binding Provider.CurrentIndexText, RelativeSource={RelativeSource TemplatedParent}}" /> <Button Name="PART_DOWN"> <Path Stroke="Black" Fill="Black" Data="M 0,0 L 1,0 L 0.5,0.866 Z" Stretch="UniformToFill" /> </Button> </StackPanel> <ContentPresenter Grid.Row="0" Grid.Column="1" Content="{Binding Provider.CurrentHeader, RelativeSource={RelativeSource TemplatedParent}}" /> <ContentPresenter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{Binding Provider.CurrentContent, RelativeSource={RelativeSource TemplatedParent}}" /> </Grid> </Border> </ControlTemplate> </Setter> </Style> <Style Selector="cc|OverloadViewer /template/ Button"> <Setter Property="Background" Value="LightGray" /> <Setter Property="Padding" Value="2,2,2,2" /> <Setter Property="Width" Value="9" /> <Setter Property="Height" Value="9" /> <Setter Property="Template"> <ControlTemplate> <Border Name="bd" Background="{TemplateBinding Background}" CornerRadius="2"> <ContentPresenter Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" /> </Border> </ControlTemplate> </Setter> </Style> </Styles> <MSG> compatibility with latest avalonia. <DFF> @@ -24,7 +24,7 @@ Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" - IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> + IsVisible="{TemplateBinding Path=Provider.Count, Converter={x:Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black"
1
compatibility with latest avalonia.
1
.xaml
xaml
mit
AvaloniaUI/AvaloniaEdit
10058172
<NME> InsightWindow.xaml <BEF> <Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cc="clr-namespace:AvaloniaEdit.CodeCompletion;assembly=AvaloniaEdit"> <Style Selector="cc|OverloadViewer"> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush" Value="Black" /> <Setter Property="Background" Value="#eeeeee" /> <Setter Property="Padding" Value="2" /> <Setter Property="Template"> <ControlTemplate> <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"> <Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,*"> <StackPanel Grid.Row="0" Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black" Data="M 0,0.866 L 1,0.866 L 0.5,0 Z" Stretch="UniformToFill" /> </Button> <TextBlock Margin="2,0,2,0" Text="{Binding Provider.CurrentIndexText, RelativeSource={RelativeSource TemplatedParent}}" /> <Button Name="PART_DOWN"> <Path Stroke="Black" Fill="Black" Data="M 0,0 L 1,0 L 0.5,0.866 Z" Stretch="UniformToFill" /> </Button> </StackPanel> <ContentPresenter Grid.Row="0" Grid.Column="1" Content="{Binding Provider.CurrentHeader, RelativeSource={RelativeSource TemplatedParent}}" /> <ContentPresenter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{Binding Provider.CurrentContent, RelativeSource={RelativeSource TemplatedParent}}" /> </Grid> </Border> </ControlTemplate> </Setter> </Style> <Style Selector="cc|OverloadViewer /template/ Button"> <Setter Property="Background" Value="LightGray" /> <Setter Property="Padding" Value="2,2,2,2" /> <Setter Property="Width" Value="9" /> <Setter Property="Height" Value="9" /> <Setter Property="Template"> <ControlTemplate> <Border Name="bd" Background="{TemplateBinding Background}" CornerRadius="2"> <ContentPresenter Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" /> </Border> </ControlTemplate> </Setter> </Style> </Styles> <MSG> compatibility with latest avalonia. <DFF> @@ -24,7 +24,7 @@ Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" - IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> + IsVisible="{TemplateBinding Path=Provider.Count, Converter={x:Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black"
1
compatibility with latest avalonia.
1
.xaml
xaml
mit
AvaloniaUI/AvaloniaEdit
10058173
<NME> InsightWindow.xaml <BEF> <Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cc="clr-namespace:AvaloniaEdit.CodeCompletion;assembly=AvaloniaEdit"> <Style Selector="cc|OverloadViewer"> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush" Value="Black" /> <Setter Property="Background" Value="#eeeeee" /> <Setter Property="Padding" Value="2" /> <Setter Property="Template"> <ControlTemplate> <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"> <Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,*"> <StackPanel Grid.Row="0" Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black" Data="M 0,0.866 L 1,0.866 L 0.5,0 Z" Stretch="UniformToFill" /> </Button> <TextBlock Margin="2,0,2,0" Text="{Binding Provider.CurrentIndexText, RelativeSource={RelativeSource TemplatedParent}}" /> <Button Name="PART_DOWN"> <Path Stroke="Black" Fill="Black" Data="M 0,0 L 1,0 L 0.5,0.866 Z" Stretch="UniformToFill" /> </Button> </StackPanel> <ContentPresenter Grid.Row="0" Grid.Column="1" Content="{Binding Provider.CurrentHeader, RelativeSource={RelativeSource TemplatedParent}}" /> <ContentPresenter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{Binding Provider.CurrentContent, RelativeSource={RelativeSource TemplatedParent}}" /> </Grid> </Border> </ControlTemplate> </Setter> </Style> <Style Selector="cc|OverloadViewer /template/ Button"> <Setter Property="Background" Value="LightGray" /> <Setter Property="Padding" Value="2,2,2,2" /> <Setter Property="Width" Value="9" /> <Setter Property="Height" Value="9" /> <Setter Property="Template"> <ControlTemplate> <Border Name="bd" Background="{TemplateBinding Background}" CornerRadius="2"> <ContentPresenter Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" /> </Border> </ControlTemplate> </Setter> </Style> </Styles> <MSG> compatibility with latest avalonia. <DFF> @@ -24,7 +24,7 @@ Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" - IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> + IsVisible="{TemplateBinding Path=Provider.Count, Converter={x:Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black"
1
compatibility with latest avalonia.
1
.xaml
xaml
mit
AvaloniaUI/AvaloniaEdit
10058174
<NME> InsightWindow.xaml <BEF> <Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cc="clr-namespace:AvaloniaEdit.CodeCompletion;assembly=AvaloniaEdit"> <Style Selector="cc|OverloadViewer"> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush" Value="Black" /> <Setter Property="Background" Value="#eeeeee" /> <Setter Property="Padding" Value="2" /> <Setter Property="Template"> <ControlTemplate> <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"> <Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,*"> <StackPanel Grid.Row="0" Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black" Data="M 0,0.866 L 1,0.866 L 0.5,0 Z" Stretch="UniformToFill" /> </Button> <TextBlock Margin="2,0,2,0" Text="{Binding Provider.CurrentIndexText, RelativeSource={RelativeSource TemplatedParent}}" /> <Button Name="PART_DOWN"> <Path Stroke="Black" Fill="Black" Data="M 0,0 L 1,0 L 0.5,0.866 Z" Stretch="UniformToFill" /> </Button> </StackPanel> <ContentPresenter Grid.Row="0" Grid.Column="1" Content="{Binding Provider.CurrentHeader, RelativeSource={RelativeSource TemplatedParent}}" /> <ContentPresenter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{Binding Provider.CurrentContent, RelativeSource={RelativeSource TemplatedParent}}" /> </Grid> </Border> </ControlTemplate> </Setter> </Style> <Style Selector="cc|OverloadViewer /template/ Button"> <Setter Property="Background" Value="LightGray" /> <Setter Property="Padding" Value="2,2,2,2" /> <Setter Property="Width" Value="9" /> <Setter Property="Height" Value="9" /> <Setter Property="Template"> <ControlTemplate> <Border Name="bd" Background="{TemplateBinding Background}" CornerRadius="2"> <ContentPresenter Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" /> </Border> </ControlTemplate> </Setter> </Style> </Styles> <MSG> compatibility with latest avalonia. <DFF> @@ -24,7 +24,7 @@ Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" - IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> + IsVisible="{TemplateBinding Path=Provider.Count, Converter={x:Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black"
1
compatibility with latest avalonia.
1
.xaml
xaml
mit
AvaloniaUI/AvaloniaEdit
10058175
<NME> InsightWindow.xaml <BEF> <Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cc="clr-namespace:AvaloniaEdit.CodeCompletion;assembly=AvaloniaEdit"> <Style Selector="cc|OverloadViewer"> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush" Value="Black" /> <Setter Property="Background" Value="#eeeeee" /> <Setter Property="Padding" Value="2" /> <Setter Property="Template"> <ControlTemplate> <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"> <Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,*"> <StackPanel Grid.Row="0" Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black" Data="M 0,0.866 L 1,0.866 L 0.5,0 Z" Stretch="UniformToFill" /> </Button> <TextBlock Margin="2,0,2,0" Text="{Binding Provider.CurrentIndexText, RelativeSource={RelativeSource TemplatedParent}}" /> <Button Name="PART_DOWN"> <Path Stroke="Black" Fill="Black" Data="M 0,0 L 1,0 L 0.5,0.866 Z" Stretch="UniformToFill" /> </Button> </StackPanel> <ContentPresenter Grid.Row="0" Grid.Column="1" Content="{Binding Provider.CurrentHeader, RelativeSource={RelativeSource TemplatedParent}}" /> <ContentPresenter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{Binding Provider.CurrentContent, RelativeSource={RelativeSource TemplatedParent}}" /> </Grid> </Border> </ControlTemplate> </Setter> </Style> <Style Selector="cc|OverloadViewer /template/ Button"> <Setter Property="Background" Value="LightGray" /> <Setter Property="Padding" Value="2,2,2,2" /> <Setter Property="Width" Value="9" /> <Setter Property="Height" Value="9" /> <Setter Property="Template"> <ControlTemplate> <Border Name="bd" Background="{TemplateBinding Background}" CornerRadius="2"> <ContentPresenter Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" /> </Border> </ControlTemplate> </Setter> </Style> </Styles> <MSG> compatibility with latest avalonia. <DFF> @@ -24,7 +24,7 @@ Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" - IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> + IsVisible="{TemplateBinding Path=Provider.Count, Converter={x:Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black"
1
compatibility with latest avalonia.
1
.xaml
xaml
mit
AvaloniaUI/AvaloniaEdit
10058176
<NME> InsightWindow.xaml <BEF> <Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cc="clr-namespace:AvaloniaEdit.CodeCompletion;assembly=AvaloniaEdit"> <Style Selector="cc|OverloadViewer"> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush" Value="Black" /> <Setter Property="Background" Value="#eeeeee" /> <Setter Property="Padding" Value="2" /> <Setter Property="Template"> <ControlTemplate> <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"> <Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,*"> <StackPanel Grid.Row="0" Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black" Data="M 0,0.866 L 1,0.866 L 0.5,0 Z" Stretch="UniformToFill" /> </Button> <TextBlock Margin="2,0,2,0" Text="{Binding Provider.CurrentIndexText, RelativeSource={RelativeSource TemplatedParent}}" /> <Button Name="PART_DOWN"> <Path Stroke="Black" Fill="Black" Data="M 0,0 L 1,0 L 0.5,0.866 Z" Stretch="UniformToFill" /> </Button> </StackPanel> <ContentPresenter Grid.Row="0" Grid.Column="1" Content="{Binding Provider.CurrentHeader, RelativeSource={RelativeSource TemplatedParent}}" /> <ContentPresenter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{Binding Provider.CurrentContent, RelativeSource={RelativeSource TemplatedParent}}" /> </Grid> </Border> </ControlTemplate> </Setter> </Style> <Style Selector="cc|OverloadViewer /template/ Button"> <Setter Property="Background" Value="LightGray" /> <Setter Property="Padding" Value="2,2,2,2" /> <Setter Property="Width" Value="9" /> <Setter Property="Height" Value="9" /> <Setter Property="Template"> <ControlTemplate> <Border Name="bd" Background="{TemplateBinding Background}" CornerRadius="2"> <ContentPresenter Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" /> </Border> </ControlTemplate> </Setter> </Style> </Styles> <MSG> compatibility with latest avalonia. <DFF> @@ -24,7 +24,7 @@ Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" - IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> + IsVisible="{TemplateBinding Path=Provider.Count, Converter={x:Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black"
1
compatibility with latest avalonia.
1
.xaml
xaml
mit
AvaloniaUI/AvaloniaEdit
10058177
<NME> InsightWindow.xaml <BEF> <Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cc="clr-namespace:AvaloniaEdit.CodeCompletion;assembly=AvaloniaEdit"> <Style Selector="cc|OverloadViewer"> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush" Value="Black" /> <Setter Property="Background" Value="#eeeeee" /> <Setter Property="Padding" Value="2" /> <Setter Property="Template"> <ControlTemplate> <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"> <Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,*"> <StackPanel Grid.Row="0" Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black" Data="M 0,0.866 L 1,0.866 L 0.5,0 Z" Stretch="UniformToFill" /> </Button> <TextBlock Margin="2,0,2,0" Text="{Binding Provider.CurrentIndexText, RelativeSource={RelativeSource TemplatedParent}}" /> <Button Name="PART_DOWN"> <Path Stroke="Black" Fill="Black" Data="M 0,0 L 1,0 L 0.5,0.866 Z" Stretch="UniformToFill" /> </Button> </StackPanel> <ContentPresenter Grid.Row="0" Grid.Column="1" Content="{Binding Provider.CurrentHeader, RelativeSource={RelativeSource TemplatedParent}}" /> <ContentPresenter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{Binding Provider.CurrentContent, RelativeSource={RelativeSource TemplatedParent}}" /> </Grid> </Border> </ControlTemplate> </Setter> </Style> <Style Selector="cc|OverloadViewer /template/ Button"> <Setter Property="Background" Value="LightGray" /> <Setter Property="Padding" Value="2,2,2,2" /> <Setter Property="Width" Value="9" /> <Setter Property="Height" Value="9" /> <Setter Property="Template"> <ControlTemplate> <Border Name="bd" Background="{TemplateBinding Background}" CornerRadius="2"> <ContentPresenter Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" /> </Border> </ControlTemplate> </Setter> </Style> </Styles> <MSG> compatibility with latest avalonia. <DFF> @@ -24,7 +24,7 @@ Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" - IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> + IsVisible="{TemplateBinding Path=Provider.Count, Converter={x:Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black"
1
compatibility with latest avalonia.
1
.xaml
xaml
mit
AvaloniaUI/AvaloniaEdit
10058178
<NME> InsightWindow.xaml <BEF> <Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cc="clr-namespace:AvaloniaEdit.CodeCompletion;assembly=AvaloniaEdit"> <Style Selector="cc|OverloadViewer"> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush" Value="Black" /> <Setter Property="Background" Value="#eeeeee" /> <Setter Property="Padding" Value="2" /> <Setter Property="Template"> <ControlTemplate> <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"> <Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,*"> <StackPanel Grid.Row="0" Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black" Data="M 0,0.866 L 1,0.866 L 0.5,0 Z" Stretch="UniformToFill" /> </Button> <TextBlock Margin="2,0,2,0" Text="{Binding Provider.CurrentIndexText, RelativeSource={RelativeSource TemplatedParent}}" /> <Button Name="PART_DOWN"> <Path Stroke="Black" Fill="Black" Data="M 0,0 L 1,0 L 0.5,0.866 Z" Stretch="UniformToFill" /> </Button> </StackPanel> <ContentPresenter Grid.Row="0" Grid.Column="1" Content="{Binding Provider.CurrentHeader, RelativeSource={RelativeSource TemplatedParent}}" /> <ContentPresenter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{Binding Provider.CurrentContent, RelativeSource={RelativeSource TemplatedParent}}" /> </Grid> </Border> </ControlTemplate> </Setter> </Style> <Style Selector="cc|OverloadViewer /template/ Button"> <Setter Property="Background" Value="LightGray" /> <Setter Property="Padding" Value="2,2,2,2" /> <Setter Property="Width" Value="9" /> <Setter Property="Height" Value="9" /> <Setter Property="Template"> <ControlTemplate> <Border Name="bd" Background="{TemplateBinding Background}" CornerRadius="2"> <ContentPresenter Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" /> </Border> </ControlTemplate> </Setter> </Style> </Styles> <MSG> compatibility with latest avalonia. <DFF> @@ -24,7 +24,7 @@ Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" - IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> + IsVisible="{TemplateBinding Path=Provider.Count, Converter={x:Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black"
1
compatibility with latest avalonia.
1
.xaml
xaml
mit
AvaloniaUI/AvaloniaEdit
10058179
<NME> InsightWindow.xaml <BEF> <Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cc="clr-namespace:AvaloniaEdit.CodeCompletion;assembly=AvaloniaEdit"> <Style Selector="cc|OverloadViewer"> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush" Value="Black" /> <Setter Property="Background" Value="#eeeeee" /> <Setter Property="Padding" Value="2" /> <Setter Property="Template"> <ControlTemplate> <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"> <Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,*"> <StackPanel Grid.Row="0" Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black" Data="M 0,0.866 L 1,0.866 L 0.5,0 Z" Stretch="UniformToFill" /> </Button> <TextBlock Margin="2,0,2,0" Text="{Binding Provider.CurrentIndexText, RelativeSource={RelativeSource TemplatedParent}}" /> <Button Name="PART_DOWN"> <Path Stroke="Black" Fill="Black" Data="M 0,0 L 1,0 L 0.5,0.866 Z" Stretch="UniformToFill" /> </Button> </StackPanel> <ContentPresenter Grid.Row="0" Grid.Column="1" Content="{Binding Provider.CurrentHeader, RelativeSource={RelativeSource TemplatedParent}}" /> <ContentPresenter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{Binding Provider.CurrentContent, RelativeSource={RelativeSource TemplatedParent}}" /> </Grid> </Border> </ControlTemplate> </Setter> </Style> <Style Selector="cc|OverloadViewer /template/ Button"> <Setter Property="Background" Value="LightGray" /> <Setter Property="Padding" Value="2,2,2,2" /> <Setter Property="Width" Value="9" /> <Setter Property="Height" Value="9" /> <Setter Property="Template"> <ControlTemplate> <Border Name="bd" Background="{TemplateBinding Background}" CornerRadius="2"> <ContentPresenter Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" /> </Border> </ControlTemplate> </Setter> </Style> </Styles> <MSG> compatibility with latest avalonia. <DFF> @@ -24,7 +24,7 @@ Grid.Column="0" Margin="0,0,4,0" Orientation="Horizontal" - IsVisible="{TemplateBinding Path=Provider.Count, Converter={Static cc:CollapseIfSingleOverloadConverter.Instance}}"> + IsVisible="{TemplateBinding Path=Provider.Count, Converter={x:Static cc:CollapseIfSingleOverloadConverter.Instance}}"> <Button Name="PART_UP"> <Path Stroke="Black" Fill="Black"
1
compatibility with latest avalonia.
1
.xaml
xaml
mit
AvaloniaUI/AvaloniaEdit
10058180
<NME> History.md <BEF> 0.4.2 / 2013-05-20 ================== * add support for third party models * change `fruitmachine.View` => `fruitmachine.Module` * change component.json to bower.json 0.4.2 / 2013-05-20 ================== * change allow `name` key as an alternative to `module` in module definitions 0.4.1 / 2013-05-17 ================== * fix bug with delegate event listeners not being passed correct aguments 0.4.0 / 2013-05-17 ================== * change `slot` now defines placement over `id` * change `children` can now be an object (keys as `slot`) or an array. * change `id` is optional, used only for queries. * change 'LazyViews' can only be instantiated `var view = fruitmachine(layout)` no longer via `fruitmachine.View`. * add event hooks on `View` for `'tojson'` and `'inflation'` * add events to `fruitmachine` namespace to allow `fruitmachine.on('inflation')` <MSG> Update history for 0.5.0 <DFF> @@ -1,3 +1,9 @@ +0.5.0 / 2013-05-20 +================== + + * change `fruitmachine.View` => `fruitmachine.Module` + * add support for third party models + 0.4.2 / 2013-05-20 ==================
6
Update history for 0.5.0
0
.md
md
mit
ftlabs/fruitmachine
10058181
<NME> History.md <BEF> 0.4.0 / 2013-05-17 ================== ================== * add support for third party models * change `fruitmachine.View` => `fruitmachine.Module` * change component.json to bower.json 0.4.2 / 2013-05-20 ================== * change allow `name` key as an alternative to `module` in module definitions 0.4.1 / 2013-05-17 ================== * fix bug with delegate event listeners not being passed correct aguments 0.4.0 / 2013-05-17 ================== * change `slot` now defines placement over `id` * change `children` can now be an object (keys as `slot`) or an array. * change `id` is optional, used only for queries. * change 'LazyViews' can only be instantiated `var view = fruitmachine(layout)` no longer via `fruitmachine.View`. * add event hooks on `View` for `'tojson'` and `'inflation'` * add events to `fruitmachine` namespace to allow `fruitmachine.on('inflation')` <MSG> Update history <DFF> @@ -1,3 +1,8 @@ +0.4.1 / 2013-05-17 +================== + + * fix bug with delegate event listeners not being passed correct aguments + 0.4.0 / 2013-05-17 ==================
5
Update history
0
.md
md
mit
ftlabs/fruitmachine
10058182
<NME> TextMateColoringTransformer.cs <BEF> using System; using System.Buffers; using System.Collections.Generic; using Avalonia.Media; using Avalonia.Media.Immutable; using Avalonia.Threading; using AvaloniaEdit.Document; using AvaloniaEdit.Rendering; using TextMateSharp.Grammars; using TextMateSharp.Model; using TextMateSharp.Themes; namespace AvaloniaEdit.TextMate { public class TextMateColoringTransformer : GenericLineTransformer, IModelTokensChangedListener, ForegroundTextTransformation.IColorMap { private Theme _theme; private TextDocument _document; private TextView _textView; private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; public TextMateColoringTransformer() { _brushes = new Dictionary<int, IBrush>(); } public void SetModel(TextDocument document, TextView textView, TMModel model) { _document = document; _model = model; _textView = textView; _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) public void SetModel(TextDocument document, TMModel model) } } public void SetTheme(Theme theme) { _theme = theme; } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } public void Dispose() { _textView.VisualLinesChanged -= TextView_VisualLinesChanged; } public void SetTheme(Theme theme) { _theme = theme; _brushes.Clear(); var map = _theme.GetColorMap(); foreach (var color in map) { var id = _theme.GetColorId(color); _brushes[id] = new ImmutableSolidColorBrush(Color.Parse(NormalizeColor(color))); } } public void SetGrammar(IGrammar grammar) { _grammar = grammar; if (_model != null) { _model.SetGrammar(grammar); } } protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { if (_transformations is { }) { var transformsInLine = _transformations.FindOverlappingSegments(line); foreach (var transform in transformsInLine) { transform.Transform(this, line); } } } return; var transformsInLine = ArrayPool<ForegroundTextTransformation>.Shared.Rent(tokens.Count); try { GetLineTransformations(lineNumber, tokens, transformsInLine); for (int i = 0; i < tokens.Count; i++) { if (transformsInLine[i] == null) continue; transformsInLine[i].Transform(this, line); } } finally { ArrayPool<ForegroundTextTransformation>.Shared.Return(transformsInLine); } } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } private void GetLineTransformations(int lineNumber, List<TMToken> tokens, ForegroundTextTransformation[] transformations) { for (int i = 0; i < tokens.Count; i++) { var token = tokens[i]; var nextToken = (i + 1) < tokens.Count ? tokens[i + 1] : null; var startIndex = token.StartIndex; var endIndex = nextToken?.StartIndex ?? _model.GetLines().GetLineLength(lineNumber - 1); if (startIndex >= endIndex || token.Scopes == null || token.Scopes.Count == 0) } } private void ProcessRange(Range range) { for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) { var tokens = _model.GetLineTokens(i - 1); if (tokens == null) continue; RemoveLineTransformations(i); ProcessTokens(i, tokens); } } public void ModelTokensChanged(ModelTokensChangedEvent e) { var ranges = e.ranges.ToArray(); Dispatcher.UIThread.Post(() => { if (_model.IsStopped) return; foreach (var range in ranges) { if (!IsValidRange(range, _document.LineCount)) continue; ProcessRange(range); var startLine = _document.GetLineByNumber(range.fromLineNumber); var endLine = _document.GetLineByNumber(range.toLineNumber); _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); } }); } static bool IsValidRange(Range range, int lineCount) { if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) return false; if (range.toLineNumber < 0 || range.toLineNumber > lineCount) return false; return true; } } } } } public void ModelTokensChanged(ModelTokensChangedEvent e) { if (e.Ranges == null) return; if (_model == null || _model.IsStopped) return; int firstChangedLineIndex = int.MaxValue; int lastChangedLineIndex = -1; foreach (var range in e.Ranges) { firstChangedLineIndex = Math.Min(range.FromLineNumber - 1, firstChangedLineIndex); lastChangedLineIndex = Math.Max(range.ToLineNumber - 1, lastChangedLineIndex); } if (_areVisualLinesValid) { bool changedLinesAreNotVisible = ((firstChangedLineIndex < _firstVisibleLineIndex && lastChangedLineIndex < _firstVisibleLineIndex) || (firstChangedLineIndex > _lastVisibleLineIndex && lastChangedLineIndex > _lastVisibleLineIndex)); if (changedLinesAreNotVisible) return; } Dispatcher.UIThread.Post(() => { int firstLineIndexToRedraw = Math.Max(firstChangedLineIndex, _firstVisibleLineIndex); int lastLineIndexToRedrawLine = Math.Min(lastChangedLineIndex, _lastVisibleLineIndex); int totalLines = _document.Lines.Count - 1; firstLineIndexToRedraw = Clamp(firstLineIndexToRedraw, 0, totalLines); lastLineIndexToRedrawLine = Clamp(lastLineIndexToRedrawLine, 0, totalLines); DocumentLine firstLineToRedraw = _document.Lines[firstLineIndexToRedraw]; DocumentLine lastLineToRedraw = _document.Lines[lastLineIndexToRedrawLine]; _textView.Redraw( firstLineToRedraw.Offset, (lastLineToRedraw.Offset + lastLineToRedraw.TotalLength) - firstLineToRedraw.Offset); }); } static int Clamp(int value, int min, int max) { if (value < min) return min; if (value > max) return max; return value; } static string NormalizeColor(string color) { if (color.Length == 9) { Span<char> normalizedColor = stackalloc char[] { '#', color[7], color[8], color[1], color[2], color[3], color[4], color[5], color[6] }; return normalizedColor.ToString(); } return color; } } } <MSG> Improve TM perf <DFF> @@ -24,20 +24,23 @@ namespace AvaloniaEdit.TextMate private TextDocument _document; private TextView _textView; + private volatile int _firstVisibleLine = -1; + private volatile int _lastVisibleLine = -1; + private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; - public TextMateColoringTransformer() + public TextMateColoringTransformer(TextView textView) { + _textView = textView; _brushes = new Dictionary<int, IBrush>(); + _textView.VisualLinesChanged += TextView_VisualLinesChanged; } - public void SetModel(TextDocument document, TextView textView, TMModel model) + public void SetModel(TextDocument document, TMModel model) { _document = document; _model = model; - _textView = textView; - _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) @@ -46,6 +49,21 @@ namespace AvaloniaEdit.TextMate } } + private void TextView_VisualLinesChanged(object sender, EventArgs e) + { + if (!_textView.VisualLinesValid || _textView.VisualLines.Count == 0) + return; + + _firstVisibleLine = _textView.VisualLines[0].FirstDocumentLine.LineNumber - 1; + _lastVisibleLine = _textView.VisualLines[_textView.VisualLines.Count - 1].LastDocumentLine.LineNumber - 1; + } + + public void Dispose() + { + if (_textView != null) + _textView.VisualLinesChanged -= TextView_VisualLinesChanged; + } + public void SetTheme(Theme theme) { _theme = theme; @@ -90,14 +108,21 @@ namespace AvaloniaEdit.TextMate protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { - if (_transformations is { }) - { - var transformsInLine = _transformations.FindOverlappingSegments(line); + int i = line.LineNumber; - foreach (var transform in transformsInLine) - { - transform.Transform(this, line); - } + var tokens = _model.GetLineTokens(i - 1); + + if (tokens == null) + return; + + RemoveLineTransformations(i); + ProcessTokens(i, tokens); + + var transformsInLine = _transformations.FindOverlappingSegments(line); + + foreach (var transform in transformsInLine) + { + transform.Transform(this, line); } } @@ -142,53 +167,33 @@ namespace AvaloniaEdit.TextMate } } - private void ProcessRange(Range range) + public void ModelTokensChanged(ModelTokensChangedEvent e) { - for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) - { - var tokens = _model.GetLineTokens(i - 1); + if (e.ranges == null) + return; - if (tokens == null) - continue; + if (_model.IsStopped) + return; - RemoveLineTransformations(i); - ProcessTokens(i, tokens); - } - } + bool redraw = false; - public void ModelTokensChanged(ModelTokensChangedEvent e) - { - var ranges = e.ranges.ToArray(); - - Dispatcher.UIThread.Post(() => + foreach (var range in e.ranges) { - if (_model.IsStopped) - return; - - foreach (var range in ranges) + if (range.fromLineNumber >= _firstVisibleLine || range.toLineNumber >= _firstVisibleLine || + range.fromLineNumber <= _lastVisibleLine || range.toLineNumber <= _lastVisibleLine) { - if (!IsValidRange(range, _document.LineCount)) - continue; - - ProcessRange(range); - - var startLine = _document.GetLineByNumber(range.fromLineNumber); - var endLine = _document.GetLineByNumber(range.toLineNumber); - - _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); + redraw = true; + break; } - }); - } - - static bool IsValidRange(Range range, int lineCount) - { - if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) - return false; + } - if (range.toLineNumber < 0 || range.toLineNumber > lineCount) - return false; + if (!redraw) + return; - return true; + Dispatcher.UIThread.Post(() => + { + _textView.Redraw(); + }, DispatcherPriority.Render - 1); } } } \ No newline at end of file
54
Improve TM perf
49
.cs
TextMate/TextMateColoringTransformer
mit
AvaloniaUI/AvaloniaEdit
10058183
<NME> TextMateColoringTransformer.cs <BEF> using System; using System.Buffers; using System.Collections.Generic; using Avalonia.Media; using Avalonia.Media.Immutable; using Avalonia.Threading; using AvaloniaEdit.Document; using AvaloniaEdit.Rendering; using TextMateSharp.Grammars; using TextMateSharp.Model; using TextMateSharp.Themes; namespace AvaloniaEdit.TextMate { public class TextMateColoringTransformer : GenericLineTransformer, IModelTokensChangedListener, ForegroundTextTransformation.IColorMap { private Theme _theme; private TextDocument _document; private TextView _textView; private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; public TextMateColoringTransformer() { _brushes = new Dictionary<int, IBrush>(); } public void SetModel(TextDocument document, TextView textView, TMModel model) { _document = document; _model = model; _textView = textView; _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) public void SetModel(TextDocument document, TMModel model) } } public void SetTheme(Theme theme) { _theme = theme; } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } public void Dispose() { _textView.VisualLinesChanged -= TextView_VisualLinesChanged; } public void SetTheme(Theme theme) { _theme = theme; _brushes.Clear(); var map = _theme.GetColorMap(); foreach (var color in map) { var id = _theme.GetColorId(color); _brushes[id] = new ImmutableSolidColorBrush(Color.Parse(NormalizeColor(color))); } } public void SetGrammar(IGrammar grammar) { _grammar = grammar; if (_model != null) { _model.SetGrammar(grammar); } } protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { if (_transformations is { }) { var transformsInLine = _transformations.FindOverlappingSegments(line); foreach (var transform in transformsInLine) { transform.Transform(this, line); } } } return; var transformsInLine = ArrayPool<ForegroundTextTransformation>.Shared.Rent(tokens.Count); try { GetLineTransformations(lineNumber, tokens, transformsInLine); for (int i = 0; i < tokens.Count; i++) { if (transformsInLine[i] == null) continue; transformsInLine[i].Transform(this, line); } } finally { ArrayPool<ForegroundTextTransformation>.Shared.Return(transformsInLine); } } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } private void GetLineTransformations(int lineNumber, List<TMToken> tokens, ForegroundTextTransformation[] transformations) { for (int i = 0; i < tokens.Count; i++) { var token = tokens[i]; var nextToken = (i + 1) < tokens.Count ? tokens[i + 1] : null; var startIndex = token.StartIndex; var endIndex = nextToken?.StartIndex ?? _model.GetLines().GetLineLength(lineNumber - 1); if (startIndex >= endIndex || token.Scopes == null || token.Scopes.Count == 0) } } private void ProcessRange(Range range) { for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) { var tokens = _model.GetLineTokens(i - 1); if (tokens == null) continue; RemoveLineTransformations(i); ProcessTokens(i, tokens); } } public void ModelTokensChanged(ModelTokensChangedEvent e) { var ranges = e.ranges.ToArray(); Dispatcher.UIThread.Post(() => { if (_model.IsStopped) return; foreach (var range in ranges) { if (!IsValidRange(range, _document.LineCount)) continue; ProcessRange(range); var startLine = _document.GetLineByNumber(range.fromLineNumber); var endLine = _document.GetLineByNumber(range.toLineNumber); _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); } }); } static bool IsValidRange(Range range, int lineCount) { if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) return false; if (range.toLineNumber < 0 || range.toLineNumber > lineCount) return false; return true; } } } } } public void ModelTokensChanged(ModelTokensChangedEvent e) { if (e.Ranges == null) return; if (_model == null || _model.IsStopped) return; int firstChangedLineIndex = int.MaxValue; int lastChangedLineIndex = -1; foreach (var range in e.Ranges) { firstChangedLineIndex = Math.Min(range.FromLineNumber - 1, firstChangedLineIndex); lastChangedLineIndex = Math.Max(range.ToLineNumber - 1, lastChangedLineIndex); } if (_areVisualLinesValid) { bool changedLinesAreNotVisible = ((firstChangedLineIndex < _firstVisibleLineIndex && lastChangedLineIndex < _firstVisibleLineIndex) || (firstChangedLineIndex > _lastVisibleLineIndex && lastChangedLineIndex > _lastVisibleLineIndex)); if (changedLinesAreNotVisible) return; } Dispatcher.UIThread.Post(() => { int firstLineIndexToRedraw = Math.Max(firstChangedLineIndex, _firstVisibleLineIndex); int lastLineIndexToRedrawLine = Math.Min(lastChangedLineIndex, _lastVisibleLineIndex); int totalLines = _document.Lines.Count - 1; firstLineIndexToRedraw = Clamp(firstLineIndexToRedraw, 0, totalLines); lastLineIndexToRedrawLine = Clamp(lastLineIndexToRedrawLine, 0, totalLines); DocumentLine firstLineToRedraw = _document.Lines[firstLineIndexToRedraw]; DocumentLine lastLineToRedraw = _document.Lines[lastLineIndexToRedrawLine]; _textView.Redraw( firstLineToRedraw.Offset, (lastLineToRedraw.Offset + lastLineToRedraw.TotalLength) - firstLineToRedraw.Offset); }); } static int Clamp(int value, int min, int max) { if (value < min) return min; if (value > max) return max; return value; } static string NormalizeColor(string color) { if (color.Length == 9) { Span<char> normalizedColor = stackalloc char[] { '#', color[7], color[8], color[1], color[2], color[3], color[4], color[5], color[6] }; return normalizedColor.ToString(); } return color; } } } <MSG> Improve TM perf <DFF> @@ -24,20 +24,23 @@ namespace AvaloniaEdit.TextMate private TextDocument _document; private TextView _textView; + private volatile int _firstVisibleLine = -1; + private volatile int _lastVisibleLine = -1; + private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; - public TextMateColoringTransformer() + public TextMateColoringTransformer(TextView textView) { + _textView = textView; _brushes = new Dictionary<int, IBrush>(); + _textView.VisualLinesChanged += TextView_VisualLinesChanged; } - public void SetModel(TextDocument document, TextView textView, TMModel model) + public void SetModel(TextDocument document, TMModel model) { _document = document; _model = model; - _textView = textView; - _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) @@ -46,6 +49,21 @@ namespace AvaloniaEdit.TextMate } } + private void TextView_VisualLinesChanged(object sender, EventArgs e) + { + if (!_textView.VisualLinesValid || _textView.VisualLines.Count == 0) + return; + + _firstVisibleLine = _textView.VisualLines[0].FirstDocumentLine.LineNumber - 1; + _lastVisibleLine = _textView.VisualLines[_textView.VisualLines.Count - 1].LastDocumentLine.LineNumber - 1; + } + + public void Dispose() + { + if (_textView != null) + _textView.VisualLinesChanged -= TextView_VisualLinesChanged; + } + public void SetTheme(Theme theme) { _theme = theme; @@ -90,14 +108,21 @@ namespace AvaloniaEdit.TextMate protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { - if (_transformations is { }) - { - var transformsInLine = _transformations.FindOverlappingSegments(line); + int i = line.LineNumber; - foreach (var transform in transformsInLine) - { - transform.Transform(this, line); - } + var tokens = _model.GetLineTokens(i - 1); + + if (tokens == null) + return; + + RemoveLineTransformations(i); + ProcessTokens(i, tokens); + + var transformsInLine = _transformations.FindOverlappingSegments(line); + + foreach (var transform in transformsInLine) + { + transform.Transform(this, line); } } @@ -142,53 +167,33 @@ namespace AvaloniaEdit.TextMate } } - private void ProcessRange(Range range) + public void ModelTokensChanged(ModelTokensChangedEvent e) { - for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) - { - var tokens = _model.GetLineTokens(i - 1); + if (e.ranges == null) + return; - if (tokens == null) - continue; + if (_model.IsStopped) + return; - RemoveLineTransformations(i); - ProcessTokens(i, tokens); - } - } + bool redraw = false; - public void ModelTokensChanged(ModelTokensChangedEvent e) - { - var ranges = e.ranges.ToArray(); - - Dispatcher.UIThread.Post(() => + foreach (var range in e.ranges) { - if (_model.IsStopped) - return; - - foreach (var range in ranges) + if (range.fromLineNumber >= _firstVisibleLine || range.toLineNumber >= _firstVisibleLine || + range.fromLineNumber <= _lastVisibleLine || range.toLineNumber <= _lastVisibleLine) { - if (!IsValidRange(range, _document.LineCount)) - continue; - - ProcessRange(range); - - var startLine = _document.GetLineByNumber(range.fromLineNumber); - var endLine = _document.GetLineByNumber(range.toLineNumber); - - _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); + redraw = true; + break; } - }); - } - - static bool IsValidRange(Range range, int lineCount) - { - if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) - return false; + } - if (range.toLineNumber < 0 || range.toLineNumber > lineCount) - return false; + if (!redraw) + return; - return true; + Dispatcher.UIThread.Post(() => + { + _textView.Redraw(); + }, DispatcherPriority.Render - 1); } } } \ No newline at end of file
54
Improve TM perf
49
.cs
TextMate/TextMateColoringTransformer
mit
AvaloniaUI/AvaloniaEdit
10058184
<NME> TextMateColoringTransformer.cs <BEF> using System; using System.Buffers; using System.Collections.Generic; using Avalonia.Media; using Avalonia.Media.Immutable; using Avalonia.Threading; using AvaloniaEdit.Document; using AvaloniaEdit.Rendering; using TextMateSharp.Grammars; using TextMateSharp.Model; using TextMateSharp.Themes; namespace AvaloniaEdit.TextMate { public class TextMateColoringTransformer : GenericLineTransformer, IModelTokensChangedListener, ForegroundTextTransformation.IColorMap { private Theme _theme; private TextDocument _document; private TextView _textView; private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; public TextMateColoringTransformer() { _brushes = new Dictionary<int, IBrush>(); } public void SetModel(TextDocument document, TextView textView, TMModel model) { _document = document; _model = model; _textView = textView; _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) public void SetModel(TextDocument document, TMModel model) } } public void SetTheme(Theme theme) { _theme = theme; } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } public void Dispose() { _textView.VisualLinesChanged -= TextView_VisualLinesChanged; } public void SetTheme(Theme theme) { _theme = theme; _brushes.Clear(); var map = _theme.GetColorMap(); foreach (var color in map) { var id = _theme.GetColorId(color); _brushes[id] = new ImmutableSolidColorBrush(Color.Parse(NormalizeColor(color))); } } public void SetGrammar(IGrammar grammar) { _grammar = grammar; if (_model != null) { _model.SetGrammar(grammar); } } protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { if (_transformations is { }) { var transformsInLine = _transformations.FindOverlappingSegments(line); foreach (var transform in transformsInLine) { transform.Transform(this, line); } } } return; var transformsInLine = ArrayPool<ForegroundTextTransformation>.Shared.Rent(tokens.Count); try { GetLineTransformations(lineNumber, tokens, transformsInLine); for (int i = 0; i < tokens.Count; i++) { if (transformsInLine[i] == null) continue; transformsInLine[i].Transform(this, line); } } finally { ArrayPool<ForegroundTextTransformation>.Shared.Return(transformsInLine); } } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } private void GetLineTransformations(int lineNumber, List<TMToken> tokens, ForegroundTextTransformation[] transformations) { for (int i = 0; i < tokens.Count; i++) { var token = tokens[i]; var nextToken = (i + 1) < tokens.Count ? tokens[i + 1] : null; var startIndex = token.StartIndex; var endIndex = nextToken?.StartIndex ?? _model.GetLines().GetLineLength(lineNumber - 1); if (startIndex >= endIndex || token.Scopes == null || token.Scopes.Count == 0) } } private void ProcessRange(Range range) { for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) { var tokens = _model.GetLineTokens(i - 1); if (tokens == null) continue; RemoveLineTransformations(i); ProcessTokens(i, tokens); } } public void ModelTokensChanged(ModelTokensChangedEvent e) { var ranges = e.ranges.ToArray(); Dispatcher.UIThread.Post(() => { if (_model.IsStopped) return; foreach (var range in ranges) { if (!IsValidRange(range, _document.LineCount)) continue; ProcessRange(range); var startLine = _document.GetLineByNumber(range.fromLineNumber); var endLine = _document.GetLineByNumber(range.toLineNumber); _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); } }); } static bool IsValidRange(Range range, int lineCount) { if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) return false; if (range.toLineNumber < 0 || range.toLineNumber > lineCount) return false; return true; } } } } } public void ModelTokensChanged(ModelTokensChangedEvent e) { if (e.Ranges == null) return; if (_model == null || _model.IsStopped) return; int firstChangedLineIndex = int.MaxValue; int lastChangedLineIndex = -1; foreach (var range in e.Ranges) { firstChangedLineIndex = Math.Min(range.FromLineNumber - 1, firstChangedLineIndex); lastChangedLineIndex = Math.Max(range.ToLineNumber - 1, lastChangedLineIndex); } if (_areVisualLinesValid) { bool changedLinesAreNotVisible = ((firstChangedLineIndex < _firstVisibleLineIndex && lastChangedLineIndex < _firstVisibleLineIndex) || (firstChangedLineIndex > _lastVisibleLineIndex && lastChangedLineIndex > _lastVisibleLineIndex)); if (changedLinesAreNotVisible) return; } Dispatcher.UIThread.Post(() => { int firstLineIndexToRedraw = Math.Max(firstChangedLineIndex, _firstVisibleLineIndex); int lastLineIndexToRedrawLine = Math.Min(lastChangedLineIndex, _lastVisibleLineIndex); int totalLines = _document.Lines.Count - 1; firstLineIndexToRedraw = Clamp(firstLineIndexToRedraw, 0, totalLines); lastLineIndexToRedrawLine = Clamp(lastLineIndexToRedrawLine, 0, totalLines); DocumentLine firstLineToRedraw = _document.Lines[firstLineIndexToRedraw]; DocumentLine lastLineToRedraw = _document.Lines[lastLineIndexToRedrawLine]; _textView.Redraw( firstLineToRedraw.Offset, (lastLineToRedraw.Offset + lastLineToRedraw.TotalLength) - firstLineToRedraw.Offset); }); } static int Clamp(int value, int min, int max) { if (value < min) return min; if (value > max) return max; return value; } static string NormalizeColor(string color) { if (color.Length == 9) { Span<char> normalizedColor = stackalloc char[] { '#', color[7], color[8], color[1], color[2], color[3], color[4], color[5], color[6] }; return normalizedColor.ToString(); } return color; } } } <MSG> Improve TM perf <DFF> @@ -24,20 +24,23 @@ namespace AvaloniaEdit.TextMate private TextDocument _document; private TextView _textView; + private volatile int _firstVisibleLine = -1; + private volatile int _lastVisibleLine = -1; + private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; - public TextMateColoringTransformer() + public TextMateColoringTransformer(TextView textView) { + _textView = textView; _brushes = new Dictionary<int, IBrush>(); + _textView.VisualLinesChanged += TextView_VisualLinesChanged; } - public void SetModel(TextDocument document, TextView textView, TMModel model) + public void SetModel(TextDocument document, TMModel model) { _document = document; _model = model; - _textView = textView; - _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) @@ -46,6 +49,21 @@ namespace AvaloniaEdit.TextMate } } + private void TextView_VisualLinesChanged(object sender, EventArgs e) + { + if (!_textView.VisualLinesValid || _textView.VisualLines.Count == 0) + return; + + _firstVisibleLine = _textView.VisualLines[0].FirstDocumentLine.LineNumber - 1; + _lastVisibleLine = _textView.VisualLines[_textView.VisualLines.Count - 1].LastDocumentLine.LineNumber - 1; + } + + public void Dispose() + { + if (_textView != null) + _textView.VisualLinesChanged -= TextView_VisualLinesChanged; + } + public void SetTheme(Theme theme) { _theme = theme; @@ -90,14 +108,21 @@ namespace AvaloniaEdit.TextMate protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { - if (_transformations is { }) - { - var transformsInLine = _transformations.FindOverlappingSegments(line); + int i = line.LineNumber; - foreach (var transform in transformsInLine) - { - transform.Transform(this, line); - } + var tokens = _model.GetLineTokens(i - 1); + + if (tokens == null) + return; + + RemoveLineTransformations(i); + ProcessTokens(i, tokens); + + var transformsInLine = _transformations.FindOverlappingSegments(line); + + foreach (var transform in transformsInLine) + { + transform.Transform(this, line); } } @@ -142,53 +167,33 @@ namespace AvaloniaEdit.TextMate } } - private void ProcessRange(Range range) + public void ModelTokensChanged(ModelTokensChangedEvent e) { - for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) - { - var tokens = _model.GetLineTokens(i - 1); + if (e.ranges == null) + return; - if (tokens == null) - continue; + if (_model.IsStopped) + return; - RemoveLineTransformations(i); - ProcessTokens(i, tokens); - } - } + bool redraw = false; - public void ModelTokensChanged(ModelTokensChangedEvent e) - { - var ranges = e.ranges.ToArray(); - - Dispatcher.UIThread.Post(() => + foreach (var range in e.ranges) { - if (_model.IsStopped) - return; - - foreach (var range in ranges) + if (range.fromLineNumber >= _firstVisibleLine || range.toLineNumber >= _firstVisibleLine || + range.fromLineNumber <= _lastVisibleLine || range.toLineNumber <= _lastVisibleLine) { - if (!IsValidRange(range, _document.LineCount)) - continue; - - ProcessRange(range); - - var startLine = _document.GetLineByNumber(range.fromLineNumber); - var endLine = _document.GetLineByNumber(range.toLineNumber); - - _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); + redraw = true; + break; } - }); - } - - static bool IsValidRange(Range range, int lineCount) - { - if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) - return false; + } - if (range.toLineNumber < 0 || range.toLineNumber > lineCount) - return false; + if (!redraw) + return; - return true; + Dispatcher.UIThread.Post(() => + { + _textView.Redraw(); + }, DispatcherPriority.Render - 1); } } } \ No newline at end of file
54
Improve TM perf
49
.cs
TextMate/TextMateColoringTransformer
mit
AvaloniaUI/AvaloniaEdit
10058185
<NME> TextMateColoringTransformer.cs <BEF> using System; using System.Buffers; using System.Collections.Generic; using Avalonia.Media; using Avalonia.Media.Immutable; using Avalonia.Threading; using AvaloniaEdit.Document; using AvaloniaEdit.Rendering; using TextMateSharp.Grammars; using TextMateSharp.Model; using TextMateSharp.Themes; namespace AvaloniaEdit.TextMate { public class TextMateColoringTransformer : GenericLineTransformer, IModelTokensChangedListener, ForegroundTextTransformation.IColorMap { private Theme _theme; private TextDocument _document; private TextView _textView; private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; public TextMateColoringTransformer() { _brushes = new Dictionary<int, IBrush>(); } public void SetModel(TextDocument document, TextView textView, TMModel model) { _document = document; _model = model; _textView = textView; _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) public void SetModel(TextDocument document, TMModel model) } } public void SetTheme(Theme theme) { _theme = theme; } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } public void Dispose() { _textView.VisualLinesChanged -= TextView_VisualLinesChanged; } public void SetTheme(Theme theme) { _theme = theme; _brushes.Clear(); var map = _theme.GetColorMap(); foreach (var color in map) { var id = _theme.GetColorId(color); _brushes[id] = new ImmutableSolidColorBrush(Color.Parse(NormalizeColor(color))); } } public void SetGrammar(IGrammar grammar) { _grammar = grammar; if (_model != null) { _model.SetGrammar(grammar); } } protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { if (_transformations is { }) { var transformsInLine = _transformations.FindOverlappingSegments(line); foreach (var transform in transformsInLine) { transform.Transform(this, line); } } } return; var transformsInLine = ArrayPool<ForegroundTextTransformation>.Shared.Rent(tokens.Count); try { GetLineTransformations(lineNumber, tokens, transformsInLine); for (int i = 0; i < tokens.Count; i++) { if (transformsInLine[i] == null) continue; transformsInLine[i].Transform(this, line); } } finally { ArrayPool<ForegroundTextTransformation>.Shared.Return(transformsInLine); } } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } private void GetLineTransformations(int lineNumber, List<TMToken> tokens, ForegroundTextTransformation[] transformations) { for (int i = 0; i < tokens.Count; i++) { var token = tokens[i]; var nextToken = (i + 1) < tokens.Count ? tokens[i + 1] : null; var startIndex = token.StartIndex; var endIndex = nextToken?.StartIndex ?? _model.GetLines().GetLineLength(lineNumber - 1); if (startIndex >= endIndex || token.Scopes == null || token.Scopes.Count == 0) } } private void ProcessRange(Range range) { for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) { var tokens = _model.GetLineTokens(i - 1); if (tokens == null) continue; RemoveLineTransformations(i); ProcessTokens(i, tokens); } } public void ModelTokensChanged(ModelTokensChangedEvent e) { var ranges = e.ranges.ToArray(); Dispatcher.UIThread.Post(() => { if (_model.IsStopped) return; foreach (var range in ranges) { if (!IsValidRange(range, _document.LineCount)) continue; ProcessRange(range); var startLine = _document.GetLineByNumber(range.fromLineNumber); var endLine = _document.GetLineByNumber(range.toLineNumber); _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); } }); } static bool IsValidRange(Range range, int lineCount) { if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) return false; if (range.toLineNumber < 0 || range.toLineNumber > lineCount) return false; return true; } } } } } public void ModelTokensChanged(ModelTokensChangedEvent e) { if (e.Ranges == null) return; if (_model == null || _model.IsStopped) return; int firstChangedLineIndex = int.MaxValue; int lastChangedLineIndex = -1; foreach (var range in e.Ranges) { firstChangedLineIndex = Math.Min(range.FromLineNumber - 1, firstChangedLineIndex); lastChangedLineIndex = Math.Max(range.ToLineNumber - 1, lastChangedLineIndex); } if (_areVisualLinesValid) { bool changedLinesAreNotVisible = ((firstChangedLineIndex < _firstVisibleLineIndex && lastChangedLineIndex < _firstVisibleLineIndex) || (firstChangedLineIndex > _lastVisibleLineIndex && lastChangedLineIndex > _lastVisibleLineIndex)); if (changedLinesAreNotVisible) return; } Dispatcher.UIThread.Post(() => { int firstLineIndexToRedraw = Math.Max(firstChangedLineIndex, _firstVisibleLineIndex); int lastLineIndexToRedrawLine = Math.Min(lastChangedLineIndex, _lastVisibleLineIndex); int totalLines = _document.Lines.Count - 1; firstLineIndexToRedraw = Clamp(firstLineIndexToRedraw, 0, totalLines); lastLineIndexToRedrawLine = Clamp(lastLineIndexToRedrawLine, 0, totalLines); DocumentLine firstLineToRedraw = _document.Lines[firstLineIndexToRedraw]; DocumentLine lastLineToRedraw = _document.Lines[lastLineIndexToRedrawLine]; _textView.Redraw( firstLineToRedraw.Offset, (lastLineToRedraw.Offset + lastLineToRedraw.TotalLength) - firstLineToRedraw.Offset); }); } static int Clamp(int value, int min, int max) { if (value < min) return min; if (value > max) return max; return value; } static string NormalizeColor(string color) { if (color.Length == 9) { Span<char> normalizedColor = stackalloc char[] { '#', color[7], color[8], color[1], color[2], color[3], color[4], color[5], color[6] }; return normalizedColor.ToString(); } return color; } } } <MSG> Improve TM perf <DFF> @@ -24,20 +24,23 @@ namespace AvaloniaEdit.TextMate private TextDocument _document; private TextView _textView; + private volatile int _firstVisibleLine = -1; + private volatile int _lastVisibleLine = -1; + private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; - public TextMateColoringTransformer() + public TextMateColoringTransformer(TextView textView) { + _textView = textView; _brushes = new Dictionary<int, IBrush>(); + _textView.VisualLinesChanged += TextView_VisualLinesChanged; } - public void SetModel(TextDocument document, TextView textView, TMModel model) + public void SetModel(TextDocument document, TMModel model) { _document = document; _model = model; - _textView = textView; - _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) @@ -46,6 +49,21 @@ namespace AvaloniaEdit.TextMate } } + private void TextView_VisualLinesChanged(object sender, EventArgs e) + { + if (!_textView.VisualLinesValid || _textView.VisualLines.Count == 0) + return; + + _firstVisibleLine = _textView.VisualLines[0].FirstDocumentLine.LineNumber - 1; + _lastVisibleLine = _textView.VisualLines[_textView.VisualLines.Count - 1].LastDocumentLine.LineNumber - 1; + } + + public void Dispose() + { + if (_textView != null) + _textView.VisualLinesChanged -= TextView_VisualLinesChanged; + } + public void SetTheme(Theme theme) { _theme = theme; @@ -90,14 +108,21 @@ namespace AvaloniaEdit.TextMate protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { - if (_transformations is { }) - { - var transformsInLine = _transformations.FindOverlappingSegments(line); + int i = line.LineNumber; - foreach (var transform in transformsInLine) - { - transform.Transform(this, line); - } + var tokens = _model.GetLineTokens(i - 1); + + if (tokens == null) + return; + + RemoveLineTransformations(i); + ProcessTokens(i, tokens); + + var transformsInLine = _transformations.FindOverlappingSegments(line); + + foreach (var transform in transformsInLine) + { + transform.Transform(this, line); } } @@ -142,53 +167,33 @@ namespace AvaloniaEdit.TextMate } } - private void ProcessRange(Range range) + public void ModelTokensChanged(ModelTokensChangedEvent e) { - for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) - { - var tokens = _model.GetLineTokens(i - 1); + if (e.ranges == null) + return; - if (tokens == null) - continue; + if (_model.IsStopped) + return; - RemoveLineTransformations(i); - ProcessTokens(i, tokens); - } - } + bool redraw = false; - public void ModelTokensChanged(ModelTokensChangedEvent e) - { - var ranges = e.ranges.ToArray(); - - Dispatcher.UIThread.Post(() => + foreach (var range in e.ranges) { - if (_model.IsStopped) - return; - - foreach (var range in ranges) + if (range.fromLineNumber >= _firstVisibleLine || range.toLineNumber >= _firstVisibleLine || + range.fromLineNumber <= _lastVisibleLine || range.toLineNumber <= _lastVisibleLine) { - if (!IsValidRange(range, _document.LineCount)) - continue; - - ProcessRange(range); - - var startLine = _document.GetLineByNumber(range.fromLineNumber); - var endLine = _document.GetLineByNumber(range.toLineNumber); - - _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); + redraw = true; + break; } - }); - } - - static bool IsValidRange(Range range, int lineCount) - { - if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) - return false; + } - if (range.toLineNumber < 0 || range.toLineNumber > lineCount) - return false; + if (!redraw) + return; - return true; + Dispatcher.UIThread.Post(() => + { + _textView.Redraw(); + }, DispatcherPriority.Render - 1); } } } \ No newline at end of file
54
Improve TM perf
49
.cs
TextMate/TextMateColoringTransformer
mit
AvaloniaUI/AvaloniaEdit
10058186
<NME> TextMateColoringTransformer.cs <BEF> using System; using System.Buffers; using System.Collections.Generic; using Avalonia.Media; using Avalonia.Media.Immutable; using Avalonia.Threading; using AvaloniaEdit.Document; using AvaloniaEdit.Rendering; using TextMateSharp.Grammars; using TextMateSharp.Model; using TextMateSharp.Themes; namespace AvaloniaEdit.TextMate { public class TextMateColoringTransformer : GenericLineTransformer, IModelTokensChangedListener, ForegroundTextTransformation.IColorMap { private Theme _theme; private TextDocument _document; private TextView _textView; private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; public TextMateColoringTransformer() { _brushes = new Dictionary<int, IBrush>(); } public void SetModel(TextDocument document, TextView textView, TMModel model) { _document = document; _model = model; _textView = textView; _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) public void SetModel(TextDocument document, TMModel model) } } public void SetTheme(Theme theme) { _theme = theme; } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } public void Dispose() { _textView.VisualLinesChanged -= TextView_VisualLinesChanged; } public void SetTheme(Theme theme) { _theme = theme; _brushes.Clear(); var map = _theme.GetColorMap(); foreach (var color in map) { var id = _theme.GetColorId(color); _brushes[id] = new ImmutableSolidColorBrush(Color.Parse(NormalizeColor(color))); } } public void SetGrammar(IGrammar grammar) { _grammar = grammar; if (_model != null) { _model.SetGrammar(grammar); } } protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { if (_transformations is { }) { var transformsInLine = _transformations.FindOverlappingSegments(line); foreach (var transform in transformsInLine) { transform.Transform(this, line); } } } return; var transformsInLine = ArrayPool<ForegroundTextTransformation>.Shared.Rent(tokens.Count); try { GetLineTransformations(lineNumber, tokens, transformsInLine); for (int i = 0; i < tokens.Count; i++) { if (transformsInLine[i] == null) continue; transformsInLine[i].Transform(this, line); } } finally { ArrayPool<ForegroundTextTransformation>.Shared.Return(transformsInLine); } } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } private void GetLineTransformations(int lineNumber, List<TMToken> tokens, ForegroundTextTransformation[] transformations) { for (int i = 0; i < tokens.Count; i++) { var token = tokens[i]; var nextToken = (i + 1) < tokens.Count ? tokens[i + 1] : null; var startIndex = token.StartIndex; var endIndex = nextToken?.StartIndex ?? _model.GetLines().GetLineLength(lineNumber - 1); if (startIndex >= endIndex || token.Scopes == null || token.Scopes.Count == 0) } } private void ProcessRange(Range range) { for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) { var tokens = _model.GetLineTokens(i - 1); if (tokens == null) continue; RemoveLineTransformations(i); ProcessTokens(i, tokens); } } public void ModelTokensChanged(ModelTokensChangedEvent e) { var ranges = e.ranges.ToArray(); Dispatcher.UIThread.Post(() => { if (_model.IsStopped) return; foreach (var range in ranges) { if (!IsValidRange(range, _document.LineCount)) continue; ProcessRange(range); var startLine = _document.GetLineByNumber(range.fromLineNumber); var endLine = _document.GetLineByNumber(range.toLineNumber); _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); } }); } static bool IsValidRange(Range range, int lineCount) { if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) return false; if (range.toLineNumber < 0 || range.toLineNumber > lineCount) return false; return true; } } } } } public void ModelTokensChanged(ModelTokensChangedEvent e) { if (e.Ranges == null) return; if (_model == null || _model.IsStopped) return; int firstChangedLineIndex = int.MaxValue; int lastChangedLineIndex = -1; foreach (var range in e.Ranges) { firstChangedLineIndex = Math.Min(range.FromLineNumber - 1, firstChangedLineIndex); lastChangedLineIndex = Math.Max(range.ToLineNumber - 1, lastChangedLineIndex); } if (_areVisualLinesValid) { bool changedLinesAreNotVisible = ((firstChangedLineIndex < _firstVisibleLineIndex && lastChangedLineIndex < _firstVisibleLineIndex) || (firstChangedLineIndex > _lastVisibleLineIndex && lastChangedLineIndex > _lastVisibleLineIndex)); if (changedLinesAreNotVisible) return; } Dispatcher.UIThread.Post(() => { int firstLineIndexToRedraw = Math.Max(firstChangedLineIndex, _firstVisibleLineIndex); int lastLineIndexToRedrawLine = Math.Min(lastChangedLineIndex, _lastVisibleLineIndex); int totalLines = _document.Lines.Count - 1; firstLineIndexToRedraw = Clamp(firstLineIndexToRedraw, 0, totalLines); lastLineIndexToRedrawLine = Clamp(lastLineIndexToRedrawLine, 0, totalLines); DocumentLine firstLineToRedraw = _document.Lines[firstLineIndexToRedraw]; DocumentLine lastLineToRedraw = _document.Lines[lastLineIndexToRedrawLine]; _textView.Redraw( firstLineToRedraw.Offset, (lastLineToRedraw.Offset + lastLineToRedraw.TotalLength) - firstLineToRedraw.Offset); }); } static int Clamp(int value, int min, int max) { if (value < min) return min; if (value > max) return max; return value; } static string NormalizeColor(string color) { if (color.Length == 9) { Span<char> normalizedColor = stackalloc char[] { '#', color[7], color[8], color[1], color[2], color[3], color[4], color[5], color[6] }; return normalizedColor.ToString(); } return color; } } } <MSG> Improve TM perf <DFF> @@ -24,20 +24,23 @@ namespace AvaloniaEdit.TextMate private TextDocument _document; private TextView _textView; + private volatile int _firstVisibleLine = -1; + private volatile int _lastVisibleLine = -1; + private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; - public TextMateColoringTransformer() + public TextMateColoringTransformer(TextView textView) { + _textView = textView; _brushes = new Dictionary<int, IBrush>(); + _textView.VisualLinesChanged += TextView_VisualLinesChanged; } - public void SetModel(TextDocument document, TextView textView, TMModel model) + public void SetModel(TextDocument document, TMModel model) { _document = document; _model = model; - _textView = textView; - _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) @@ -46,6 +49,21 @@ namespace AvaloniaEdit.TextMate } } + private void TextView_VisualLinesChanged(object sender, EventArgs e) + { + if (!_textView.VisualLinesValid || _textView.VisualLines.Count == 0) + return; + + _firstVisibleLine = _textView.VisualLines[0].FirstDocumentLine.LineNumber - 1; + _lastVisibleLine = _textView.VisualLines[_textView.VisualLines.Count - 1].LastDocumentLine.LineNumber - 1; + } + + public void Dispose() + { + if (_textView != null) + _textView.VisualLinesChanged -= TextView_VisualLinesChanged; + } + public void SetTheme(Theme theme) { _theme = theme; @@ -90,14 +108,21 @@ namespace AvaloniaEdit.TextMate protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { - if (_transformations is { }) - { - var transformsInLine = _transformations.FindOverlappingSegments(line); + int i = line.LineNumber; - foreach (var transform in transformsInLine) - { - transform.Transform(this, line); - } + var tokens = _model.GetLineTokens(i - 1); + + if (tokens == null) + return; + + RemoveLineTransformations(i); + ProcessTokens(i, tokens); + + var transformsInLine = _transformations.FindOverlappingSegments(line); + + foreach (var transform in transformsInLine) + { + transform.Transform(this, line); } } @@ -142,53 +167,33 @@ namespace AvaloniaEdit.TextMate } } - private void ProcessRange(Range range) + public void ModelTokensChanged(ModelTokensChangedEvent e) { - for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) - { - var tokens = _model.GetLineTokens(i - 1); + if (e.ranges == null) + return; - if (tokens == null) - continue; + if (_model.IsStopped) + return; - RemoveLineTransformations(i); - ProcessTokens(i, tokens); - } - } + bool redraw = false; - public void ModelTokensChanged(ModelTokensChangedEvent e) - { - var ranges = e.ranges.ToArray(); - - Dispatcher.UIThread.Post(() => + foreach (var range in e.ranges) { - if (_model.IsStopped) - return; - - foreach (var range in ranges) + if (range.fromLineNumber >= _firstVisibleLine || range.toLineNumber >= _firstVisibleLine || + range.fromLineNumber <= _lastVisibleLine || range.toLineNumber <= _lastVisibleLine) { - if (!IsValidRange(range, _document.LineCount)) - continue; - - ProcessRange(range); - - var startLine = _document.GetLineByNumber(range.fromLineNumber); - var endLine = _document.GetLineByNumber(range.toLineNumber); - - _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); + redraw = true; + break; } - }); - } - - static bool IsValidRange(Range range, int lineCount) - { - if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) - return false; + } - if (range.toLineNumber < 0 || range.toLineNumber > lineCount) - return false; + if (!redraw) + return; - return true; + Dispatcher.UIThread.Post(() => + { + _textView.Redraw(); + }, DispatcherPriority.Render - 1); } } } \ No newline at end of file
54
Improve TM perf
49
.cs
TextMate/TextMateColoringTransformer
mit
AvaloniaUI/AvaloniaEdit
10058187
<NME> TextMateColoringTransformer.cs <BEF> using System; using System.Buffers; using System.Collections.Generic; using Avalonia.Media; using Avalonia.Media.Immutable; using Avalonia.Threading; using AvaloniaEdit.Document; using AvaloniaEdit.Rendering; using TextMateSharp.Grammars; using TextMateSharp.Model; using TextMateSharp.Themes; namespace AvaloniaEdit.TextMate { public class TextMateColoringTransformer : GenericLineTransformer, IModelTokensChangedListener, ForegroundTextTransformation.IColorMap { private Theme _theme; private TextDocument _document; private TextView _textView; private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; public TextMateColoringTransformer() { _brushes = new Dictionary<int, IBrush>(); } public void SetModel(TextDocument document, TextView textView, TMModel model) { _document = document; _model = model; _textView = textView; _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) public void SetModel(TextDocument document, TMModel model) } } public void SetTheme(Theme theme) { _theme = theme; } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } public void Dispose() { _textView.VisualLinesChanged -= TextView_VisualLinesChanged; } public void SetTheme(Theme theme) { _theme = theme; _brushes.Clear(); var map = _theme.GetColorMap(); foreach (var color in map) { var id = _theme.GetColorId(color); _brushes[id] = new ImmutableSolidColorBrush(Color.Parse(NormalizeColor(color))); } } public void SetGrammar(IGrammar grammar) { _grammar = grammar; if (_model != null) { _model.SetGrammar(grammar); } } protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { if (_transformations is { }) { var transformsInLine = _transformations.FindOverlappingSegments(line); foreach (var transform in transformsInLine) { transform.Transform(this, line); } } } return; var transformsInLine = ArrayPool<ForegroundTextTransformation>.Shared.Rent(tokens.Count); try { GetLineTransformations(lineNumber, tokens, transformsInLine); for (int i = 0; i < tokens.Count; i++) { if (transformsInLine[i] == null) continue; transformsInLine[i].Transform(this, line); } } finally { ArrayPool<ForegroundTextTransformation>.Shared.Return(transformsInLine); } } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } private void GetLineTransformations(int lineNumber, List<TMToken> tokens, ForegroundTextTransformation[] transformations) { for (int i = 0; i < tokens.Count; i++) { var token = tokens[i]; var nextToken = (i + 1) < tokens.Count ? tokens[i + 1] : null; var startIndex = token.StartIndex; var endIndex = nextToken?.StartIndex ?? _model.GetLines().GetLineLength(lineNumber - 1); if (startIndex >= endIndex || token.Scopes == null || token.Scopes.Count == 0) } } private void ProcessRange(Range range) { for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) { var tokens = _model.GetLineTokens(i - 1); if (tokens == null) continue; RemoveLineTransformations(i); ProcessTokens(i, tokens); } } public void ModelTokensChanged(ModelTokensChangedEvent e) { var ranges = e.ranges.ToArray(); Dispatcher.UIThread.Post(() => { if (_model.IsStopped) return; foreach (var range in ranges) { if (!IsValidRange(range, _document.LineCount)) continue; ProcessRange(range); var startLine = _document.GetLineByNumber(range.fromLineNumber); var endLine = _document.GetLineByNumber(range.toLineNumber); _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); } }); } static bool IsValidRange(Range range, int lineCount) { if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) return false; if (range.toLineNumber < 0 || range.toLineNumber > lineCount) return false; return true; } } } } } public void ModelTokensChanged(ModelTokensChangedEvent e) { if (e.Ranges == null) return; if (_model == null || _model.IsStopped) return; int firstChangedLineIndex = int.MaxValue; int lastChangedLineIndex = -1; foreach (var range in e.Ranges) { firstChangedLineIndex = Math.Min(range.FromLineNumber - 1, firstChangedLineIndex); lastChangedLineIndex = Math.Max(range.ToLineNumber - 1, lastChangedLineIndex); } if (_areVisualLinesValid) { bool changedLinesAreNotVisible = ((firstChangedLineIndex < _firstVisibleLineIndex && lastChangedLineIndex < _firstVisibleLineIndex) || (firstChangedLineIndex > _lastVisibleLineIndex && lastChangedLineIndex > _lastVisibleLineIndex)); if (changedLinesAreNotVisible) return; } Dispatcher.UIThread.Post(() => { int firstLineIndexToRedraw = Math.Max(firstChangedLineIndex, _firstVisibleLineIndex); int lastLineIndexToRedrawLine = Math.Min(lastChangedLineIndex, _lastVisibleLineIndex); int totalLines = _document.Lines.Count - 1; firstLineIndexToRedraw = Clamp(firstLineIndexToRedraw, 0, totalLines); lastLineIndexToRedrawLine = Clamp(lastLineIndexToRedrawLine, 0, totalLines); DocumentLine firstLineToRedraw = _document.Lines[firstLineIndexToRedraw]; DocumentLine lastLineToRedraw = _document.Lines[lastLineIndexToRedrawLine]; _textView.Redraw( firstLineToRedraw.Offset, (lastLineToRedraw.Offset + lastLineToRedraw.TotalLength) - firstLineToRedraw.Offset); }); } static int Clamp(int value, int min, int max) { if (value < min) return min; if (value > max) return max; return value; } static string NormalizeColor(string color) { if (color.Length == 9) { Span<char> normalizedColor = stackalloc char[] { '#', color[7], color[8], color[1], color[2], color[3], color[4], color[5], color[6] }; return normalizedColor.ToString(); } return color; } } } <MSG> Improve TM perf <DFF> @@ -24,20 +24,23 @@ namespace AvaloniaEdit.TextMate private TextDocument _document; private TextView _textView; + private volatile int _firstVisibleLine = -1; + private volatile int _lastVisibleLine = -1; + private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; - public TextMateColoringTransformer() + public TextMateColoringTransformer(TextView textView) { + _textView = textView; _brushes = new Dictionary<int, IBrush>(); + _textView.VisualLinesChanged += TextView_VisualLinesChanged; } - public void SetModel(TextDocument document, TextView textView, TMModel model) + public void SetModel(TextDocument document, TMModel model) { _document = document; _model = model; - _textView = textView; - _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) @@ -46,6 +49,21 @@ namespace AvaloniaEdit.TextMate } } + private void TextView_VisualLinesChanged(object sender, EventArgs e) + { + if (!_textView.VisualLinesValid || _textView.VisualLines.Count == 0) + return; + + _firstVisibleLine = _textView.VisualLines[0].FirstDocumentLine.LineNumber - 1; + _lastVisibleLine = _textView.VisualLines[_textView.VisualLines.Count - 1].LastDocumentLine.LineNumber - 1; + } + + public void Dispose() + { + if (_textView != null) + _textView.VisualLinesChanged -= TextView_VisualLinesChanged; + } + public void SetTheme(Theme theme) { _theme = theme; @@ -90,14 +108,21 @@ namespace AvaloniaEdit.TextMate protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { - if (_transformations is { }) - { - var transformsInLine = _transformations.FindOverlappingSegments(line); + int i = line.LineNumber; - foreach (var transform in transformsInLine) - { - transform.Transform(this, line); - } + var tokens = _model.GetLineTokens(i - 1); + + if (tokens == null) + return; + + RemoveLineTransformations(i); + ProcessTokens(i, tokens); + + var transformsInLine = _transformations.FindOverlappingSegments(line); + + foreach (var transform in transformsInLine) + { + transform.Transform(this, line); } } @@ -142,53 +167,33 @@ namespace AvaloniaEdit.TextMate } } - private void ProcessRange(Range range) + public void ModelTokensChanged(ModelTokensChangedEvent e) { - for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) - { - var tokens = _model.GetLineTokens(i - 1); + if (e.ranges == null) + return; - if (tokens == null) - continue; + if (_model.IsStopped) + return; - RemoveLineTransformations(i); - ProcessTokens(i, tokens); - } - } + bool redraw = false; - public void ModelTokensChanged(ModelTokensChangedEvent e) - { - var ranges = e.ranges.ToArray(); - - Dispatcher.UIThread.Post(() => + foreach (var range in e.ranges) { - if (_model.IsStopped) - return; - - foreach (var range in ranges) + if (range.fromLineNumber >= _firstVisibleLine || range.toLineNumber >= _firstVisibleLine || + range.fromLineNumber <= _lastVisibleLine || range.toLineNumber <= _lastVisibleLine) { - if (!IsValidRange(range, _document.LineCount)) - continue; - - ProcessRange(range); - - var startLine = _document.GetLineByNumber(range.fromLineNumber); - var endLine = _document.GetLineByNumber(range.toLineNumber); - - _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); + redraw = true; + break; } - }); - } - - static bool IsValidRange(Range range, int lineCount) - { - if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) - return false; + } - if (range.toLineNumber < 0 || range.toLineNumber > lineCount) - return false; + if (!redraw) + return; - return true; + Dispatcher.UIThread.Post(() => + { + _textView.Redraw(); + }, DispatcherPriority.Render - 1); } } } \ No newline at end of file
54
Improve TM perf
49
.cs
TextMate/TextMateColoringTransformer
mit
AvaloniaUI/AvaloniaEdit
10058188
<NME> TextMateColoringTransformer.cs <BEF> using System; using System.Buffers; using System.Collections.Generic; using Avalonia.Media; using Avalonia.Media.Immutable; using Avalonia.Threading; using AvaloniaEdit.Document; using AvaloniaEdit.Rendering; using TextMateSharp.Grammars; using TextMateSharp.Model; using TextMateSharp.Themes; namespace AvaloniaEdit.TextMate { public class TextMateColoringTransformer : GenericLineTransformer, IModelTokensChangedListener, ForegroundTextTransformation.IColorMap { private Theme _theme; private TextDocument _document; private TextView _textView; private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; public TextMateColoringTransformer() { _brushes = new Dictionary<int, IBrush>(); } public void SetModel(TextDocument document, TextView textView, TMModel model) { _document = document; _model = model; _textView = textView; _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) public void SetModel(TextDocument document, TMModel model) } } public void SetTheme(Theme theme) { _theme = theme; } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } public void Dispose() { _textView.VisualLinesChanged -= TextView_VisualLinesChanged; } public void SetTheme(Theme theme) { _theme = theme; _brushes.Clear(); var map = _theme.GetColorMap(); foreach (var color in map) { var id = _theme.GetColorId(color); _brushes[id] = new ImmutableSolidColorBrush(Color.Parse(NormalizeColor(color))); } } public void SetGrammar(IGrammar grammar) { _grammar = grammar; if (_model != null) { _model.SetGrammar(grammar); } } protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { if (_transformations is { }) { var transformsInLine = _transformations.FindOverlappingSegments(line); foreach (var transform in transformsInLine) { transform.Transform(this, line); } } } return; var transformsInLine = ArrayPool<ForegroundTextTransformation>.Shared.Rent(tokens.Count); try { GetLineTransformations(lineNumber, tokens, transformsInLine); for (int i = 0; i < tokens.Count; i++) { if (transformsInLine[i] == null) continue; transformsInLine[i].Transform(this, line); } } finally { ArrayPool<ForegroundTextTransformation>.Shared.Return(transformsInLine); } } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } private void GetLineTransformations(int lineNumber, List<TMToken> tokens, ForegroundTextTransformation[] transformations) { for (int i = 0; i < tokens.Count; i++) { var token = tokens[i]; var nextToken = (i + 1) < tokens.Count ? tokens[i + 1] : null; var startIndex = token.StartIndex; var endIndex = nextToken?.StartIndex ?? _model.GetLines().GetLineLength(lineNumber - 1); if (startIndex >= endIndex || token.Scopes == null || token.Scopes.Count == 0) } } private void ProcessRange(Range range) { for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) { var tokens = _model.GetLineTokens(i - 1); if (tokens == null) continue; RemoveLineTransformations(i); ProcessTokens(i, tokens); } } public void ModelTokensChanged(ModelTokensChangedEvent e) { var ranges = e.ranges.ToArray(); Dispatcher.UIThread.Post(() => { if (_model.IsStopped) return; foreach (var range in ranges) { if (!IsValidRange(range, _document.LineCount)) continue; ProcessRange(range); var startLine = _document.GetLineByNumber(range.fromLineNumber); var endLine = _document.GetLineByNumber(range.toLineNumber); _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); } }); } static bool IsValidRange(Range range, int lineCount) { if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) return false; if (range.toLineNumber < 0 || range.toLineNumber > lineCount) return false; return true; } } } } } public void ModelTokensChanged(ModelTokensChangedEvent e) { if (e.Ranges == null) return; if (_model == null || _model.IsStopped) return; int firstChangedLineIndex = int.MaxValue; int lastChangedLineIndex = -1; foreach (var range in e.Ranges) { firstChangedLineIndex = Math.Min(range.FromLineNumber - 1, firstChangedLineIndex); lastChangedLineIndex = Math.Max(range.ToLineNumber - 1, lastChangedLineIndex); } if (_areVisualLinesValid) { bool changedLinesAreNotVisible = ((firstChangedLineIndex < _firstVisibleLineIndex && lastChangedLineIndex < _firstVisibleLineIndex) || (firstChangedLineIndex > _lastVisibleLineIndex && lastChangedLineIndex > _lastVisibleLineIndex)); if (changedLinesAreNotVisible) return; } Dispatcher.UIThread.Post(() => { int firstLineIndexToRedraw = Math.Max(firstChangedLineIndex, _firstVisibleLineIndex); int lastLineIndexToRedrawLine = Math.Min(lastChangedLineIndex, _lastVisibleLineIndex); int totalLines = _document.Lines.Count - 1; firstLineIndexToRedraw = Clamp(firstLineIndexToRedraw, 0, totalLines); lastLineIndexToRedrawLine = Clamp(lastLineIndexToRedrawLine, 0, totalLines); DocumentLine firstLineToRedraw = _document.Lines[firstLineIndexToRedraw]; DocumentLine lastLineToRedraw = _document.Lines[lastLineIndexToRedrawLine]; _textView.Redraw( firstLineToRedraw.Offset, (lastLineToRedraw.Offset + lastLineToRedraw.TotalLength) - firstLineToRedraw.Offset); }); } static int Clamp(int value, int min, int max) { if (value < min) return min; if (value > max) return max; return value; } static string NormalizeColor(string color) { if (color.Length == 9) { Span<char> normalizedColor = stackalloc char[] { '#', color[7], color[8], color[1], color[2], color[3], color[4], color[5], color[6] }; return normalizedColor.ToString(); } return color; } } } <MSG> Improve TM perf <DFF> @@ -24,20 +24,23 @@ namespace AvaloniaEdit.TextMate private TextDocument _document; private TextView _textView; + private volatile int _firstVisibleLine = -1; + private volatile int _lastVisibleLine = -1; + private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; - public TextMateColoringTransformer() + public TextMateColoringTransformer(TextView textView) { + _textView = textView; _brushes = new Dictionary<int, IBrush>(); + _textView.VisualLinesChanged += TextView_VisualLinesChanged; } - public void SetModel(TextDocument document, TextView textView, TMModel model) + public void SetModel(TextDocument document, TMModel model) { _document = document; _model = model; - _textView = textView; - _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) @@ -46,6 +49,21 @@ namespace AvaloniaEdit.TextMate } } + private void TextView_VisualLinesChanged(object sender, EventArgs e) + { + if (!_textView.VisualLinesValid || _textView.VisualLines.Count == 0) + return; + + _firstVisibleLine = _textView.VisualLines[0].FirstDocumentLine.LineNumber - 1; + _lastVisibleLine = _textView.VisualLines[_textView.VisualLines.Count - 1].LastDocumentLine.LineNumber - 1; + } + + public void Dispose() + { + if (_textView != null) + _textView.VisualLinesChanged -= TextView_VisualLinesChanged; + } + public void SetTheme(Theme theme) { _theme = theme; @@ -90,14 +108,21 @@ namespace AvaloniaEdit.TextMate protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { - if (_transformations is { }) - { - var transformsInLine = _transformations.FindOverlappingSegments(line); + int i = line.LineNumber; - foreach (var transform in transformsInLine) - { - transform.Transform(this, line); - } + var tokens = _model.GetLineTokens(i - 1); + + if (tokens == null) + return; + + RemoveLineTransformations(i); + ProcessTokens(i, tokens); + + var transformsInLine = _transformations.FindOverlappingSegments(line); + + foreach (var transform in transformsInLine) + { + transform.Transform(this, line); } } @@ -142,53 +167,33 @@ namespace AvaloniaEdit.TextMate } } - private void ProcessRange(Range range) + public void ModelTokensChanged(ModelTokensChangedEvent e) { - for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) - { - var tokens = _model.GetLineTokens(i - 1); + if (e.ranges == null) + return; - if (tokens == null) - continue; + if (_model.IsStopped) + return; - RemoveLineTransformations(i); - ProcessTokens(i, tokens); - } - } + bool redraw = false; - public void ModelTokensChanged(ModelTokensChangedEvent e) - { - var ranges = e.ranges.ToArray(); - - Dispatcher.UIThread.Post(() => + foreach (var range in e.ranges) { - if (_model.IsStopped) - return; - - foreach (var range in ranges) + if (range.fromLineNumber >= _firstVisibleLine || range.toLineNumber >= _firstVisibleLine || + range.fromLineNumber <= _lastVisibleLine || range.toLineNumber <= _lastVisibleLine) { - if (!IsValidRange(range, _document.LineCount)) - continue; - - ProcessRange(range); - - var startLine = _document.GetLineByNumber(range.fromLineNumber); - var endLine = _document.GetLineByNumber(range.toLineNumber); - - _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); + redraw = true; + break; } - }); - } - - static bool IsValidRange(Range range, int lineCount) - { - if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) - return false; + } - if (range.toLineNumber < 0 || range.toLineNumber > lineCount) - return false; + if (!redraw) + return; - return true; + Dispatcher.UIThread.Post(() => + { + _textView.Redraw(); + }, DispatcherPriority.Render - 1); } } } \ No newline at end of file
54
Improve TM perf
49
.cs
TextMate/TextMateColoringTransformer
mit
AvaloniaUI/AvaloniaEdit
10058189
<NME> TextMateColoringTransformer.cs <BEF> using System; using System.Buffers; using System.Collections.Generic; using Avalonia.Media; using Avalonia.Media.Immutable; using Avalonia.Threading; using AvaloniaEdit.Document; using AvaloniaEdit.Rendering; using TextMateSharp.Grammars; using TextMateSharp.Model; using TextMateSharp.Themes; namespace AvaloniaEdit.TextMate { public class TextMateColoringTransformer : GenericLineTransformer, IModelTokensChangedListener, ForegroundTextTransformation.IColorMap { private Theme _theme; private TextDocument _document; private TextView _textView; private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; public TextMateColoringTransformer() { _brushes = new Dictionary<int, IBrush>(); } public void SetModel(TextDocument document, TextView textView, TMModel model) { _document = document; _model = model; _textView = textView; _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) public void SetModel(TextDocument document, TMModel model) } } public void SetTheme(Theme theme) { _theme = theme; } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } public void Dispose() { _textView.VisualLinesChanged -= TextView_VisualLinesChanged; } public void SetTheme(Theme theme) { _theme = theme; _brushes.Clear(); var map = _theme.GetColorMap(); foreach (var color in map) { var id = _theme.GetColorId(color); _brushes[id] = new ImmutableSolidColorBrush(Color.Parse(NormalizeColor(color))); } } public void SetGrammar(IGrammar grammar) { _grammar = grammar; if (_model != null) { _model.SetGrammar(grammar); } } protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { if (_transformations is { }) { var transformsInLine = _transformations.FindOverlappingSegments(line); foreach (var transform in transformsInLine) { transform.Transform(this, line); } } } return; var transformsInLine = ArrayPool<ForegroundTextTransformation>.Shared.Rent(tokens.Count); try { GetLineTransformations(lineNumber, tokens, transformsInLine); for (int i = 0; i < tokens.Count; i++) { if (transformsInLine[i] == null) continue; transformsInLine[i].Transform(this, line); } } finally { ArrayPool<ForegroundTextTransformation>.Shared.Return(transformsInLine); } } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } private void GetLineTransformations(int lineNumber, List<TMToken> tokens, ForegroundTextTransformation[] transformations) { for (int i = 0; i < tokens.Count; i++) { var token = tokens[i]; var nextToken = (i + 1) < tokens.Count ? tokens[i + 1] : null; var startIndex = token.StartIndex; var endIndex = nextToken?.StartIndex ?? _model.GetLines().GetLineLength(lineNumber - 1); if (startIndex >= endIndex || token.Scopes == null || token.Scopes.Count == 0) } } private void ProcessRange(Range range) { for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) { var tokens = _model.GetLineTokens(i - 1); if (tokens == null) continue; RemoveLineTransformations(i); ProcessTokens(i, tokens); } } public void ModelTokensChanged(ModelTokensChangedEvent e) { var ranges = e.ranges.ToArray(); Dispatcher.UIThread.Post(() => { if (_model.IsStopped) return; foreach (var range in ranges) { if (!IsValidRange(range, _document.LineCount)) continue; ProcessRange(range); var startLine = _document.GetLineByNumber(range.fromLineNumber); var endLine = _document.GetLineByNumber(range.toLineNumber); _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); } }); } static bool IsValidRange(Range range, int lineCount) { if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) return false; if (range.toLineNumber < 0 || range.toLineNumber > lineCount) return false; return true; } } } } } public void ModelTokensChanged(ModelTokensChangedEvent e) { if (e.Ranges == null) return; if (_model == null || _model.IsStopped) return; int firstChangedLineIndex = int.MaxValue; int lastChangedLineIndex = -1; foreach (var range in e.Ranges) { firstChangedLineIndex = Math.Min(range.FromLineNumber - 1, firstChangedLineIndex); lastChangedLineIndex = Math.Max(range.ToLineNumber - 1, lastChangedLineIndex); } if (_areVisualLinesValid) { bool changedLinesAreNotVisible = ((firstChangedLineIndex < _firstVisibleLineIndex && lastChangedLineIndex < _firstVisibleLineIndex) || (firstChangedLineIndex > _lastVisibleLineIndex && lastChangedLineIndex > _lastVisibleLineIndex)); if (changedLinesAreNotVisible) return; } Dispatcher.UIThread.Post(() => { int firstLineIndexToRedraw = Math.Max(firstChangedLineIndex, _firstVisibleLineIndex); int lastLineIndexToRedrawLine = Math.Min(lastChangedLineIndex, _lastVisibleLineIndex); int totalLines = _document.Lines.Count - 1; firstLineIndexToRedraw = Clamp(firstLineIndexToRedraw, 0, totalLines); lastLineIndexToRedrawLine = Clamp(lastLineIndexToRedrawLine, 0, totalLines); DocumentLine firstLineToRedraw = _document.Lines[firstLineIndexToRedraw]; DocumentLine lastLineToRedraw = _document.Lines[lastLineIndexToRedrawLine]; _textView.Redraw( firstLineToRedraw.Offset, (lastLineToRedraw.Offset + lastLineToRedraw.TotalLength) - firstLineToRedraw.Offset); }); } static int Clamp(int value, int min, int max) { if (value < min) return min; if (value > max) return max; return value; } static string NormalizeColor(string color) { if (color.Length == 9) { Span<char> normalizedColor = stackalloc char[] { '#', color[7], color[8], color[1], color[2], color[3], color[4], color[5], color[6] }; return normalizedColor.ToString(); } return color; } } } <MSG> Improve TM perf <DFF> @@ -24,20 +24,23 @@ namespace AvaloniaEdit.TextMate private TextDocument _document; private TextView _textView; + private volatile int _firstVisibleLine = -1; + private volatile int _lastVisibleLine = -1; + private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; - public TextMateColoringTransformer() + public TextMateColoringTransformer(TextView textView) { + _textView = textView; _brushes = new Dictionary<int, IBrush>(); + _textView.VisualLinesChanged += TextView_VisualLinesChanged; } - public void SetModel(TextDocument document, TextView textView, TMModel model) + public void SetModel(TextDocument document, TMModel model) { _document = document; _model = model; - _textView = textView; - _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) @@ -46,6 +49,21 @@ namespace AvaloniaEdit.TextMate } } + private void TextView_VisualLinesChanged(object sender, EventArgs e) + { + if (!_textView.VisualLinesValid || _textView.VisualLines.Count == 0) + return; + + _firstVisibleLine = _textView.VisualLines[0].FirstDocumentLine.LineNumber - 1; + _lastVisibleLine = _textView.VisualLines[_textView.VisualLines.Count - 1].LastDocumentLine.LineNumber - 1; + } + + public void Dispose() + { + if (_textView != null) + _textView.VisualLinesChanged -= TextView_VisualLinesChanged; + } + public void SetTheme(Theme theme) { _theme = theme; @@ -90,14 +108,21 @@ namespace AvaloniaEdit.TextMate protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { - if (_transformations is { }) - { - var transformsInLine = _transformations.FindOverlappingSegments(line); + int i = line.LineNumber; - foreach (var transform in transformsInLine) - { - transform.Transform(this, line); - } + var tokens = _model.GetLineTokens(i - 1); + + if (tokens == null) + return; + + RemoveLineTransformations(i); + ProcessTokens(i, tokens); + + var transformsInLine = _transformations.FindOverlappingSegments(line); + + foreach (var transform in transformsInLine) + { + transform.Transform(this, line); } } @@ -142,53 +167,33 @@ namespace AvaloniaEdit.TextMate } } - private void ProcessRange(Range range) + public void ModelTokensChanged(ModelTokensChangedEvent e) { - for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) - { - var tokens = _model.GetLineTokens(i - 1); + if (e.ranges == null) + return; - if (tokens == null) - continue; + if (_model.IsStopped) + return; - RemoveLineTransformations(i); - ProcessTokens(i, tokens); - } - } + bool redraw = false; - public void ModelTokensChanged(ModelTokensChangedEvent e) - { - var ranges = e.ranges.ToArray(); - - Dispatcher.UIThread.Post(() => + foreach (var range in e.ranges) { - if (_model.IsStopped) - return; - - foreach (var range in ranges) + if (range.fromLineNumber >= _firstVisibleLine || range.toLineNumber >= _firstVisibleLine || + range.fromLineNumber <= _lastVisibleLine || range.toLineNumber <= _lastVisibleLine) { - if (!IsValidRange(range, _document.LineCount)) - continue; - - ProcessRange(range); - - var startLine = _document.GetLineByNumber(range.fromLineNumber); - var endLine = _document.GetLineByNumber(range.toLineNumber); - - _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); + redraw = true; + break; } - }); - } - - static bool IsValidRange(Range range, int lineCount) - { - if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) - return false; + } - if (range.toLineNumber < 0 || range.toLineNumber > lineCount) - return false; + if (!redraw) + return; - return true; + Dispatcher.UIThread.Post(() => + { + _textView.Redraw(); + }, DispatcherPriority.Render - 1); } } } \ No newline at end of file
54
Improve TM perf
49
.cs
TextMate/TextMateColoringTransformer
mit
AvaloniaUI/AvaloniaEdit
10058190
<NME> TextMateColoringTransformer.cs <BEF> using System; using System.Buffers; using System.Collections.Generic; using Avalonia.Media; using Avalonia.Media.Immutable; using Avalonia.Threading; using AvaloniaEdit.Document; using AvaloniaEdit.Rendering; using TextMateSharp.Grammars; using TextMateSharp.Model; using TextMateSharp.Themes; namespace AvaloniaEdit.TextMate { public class TextMateColoringTransformer : GenericLineTransformer, IModelTokensChangedListener, ForegroundTextTransformation.IColorMap { private Theme _theme; private TextDocument _document; private TextView _textView; private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; public TextMateColoringTransformer() { _brushes = new Dictionary<int, IBrush>(); } public void SetModel(TextDocument document, TextView textView, TMModel model) { _document = document; _model = model; _textView = textView; _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) public void SetModel(TextDocument document, TMModel model) } } public void SetTheme(Theme theme) { _theme = theme; } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } public void Dispose() { _textView.VisualLinesChanged -= TextView_VisualLinesChanged; } public void SetTheme(Theme theme) { _theme = theme; _brushes.Clear(); var map = _theme.GetColorMap(); foreach (var color in map) { var id = _theme.GetColorId(color); _brushes[id] = new ImmutableSolidColorBrush(Color.Parse(NormalizeColor(color))); } } public void SetGrammar(IGrammar grammar) { _grammar = grammar; if (_model != null) { _model.SetGrammar(grammar); } } protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { if (_transformations is { }) { var transformsInLine = _transformations.FindOverlappingSegments(line); foreach (var transform in transformsInLine) { transform.Transform(this, line); } } } return; var transformsInLine = ArrayPool<ForegroundTextTransformation>.Shared.Rent(tokens.Count); try { GetLineTransformations(lineNumber, tokens, transformsInLine); for (int i = 0; i < tokens.Count; i++) { if (transformsInLine[i] == null) continue; transformsInLine[i].Transform(this, line); } } finally { ArrayPool<ForegroundTextTransformation>.Shared.Return(transformsInLine); } } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } private void GetLineTransformations(int lineNumber, List<TMToken> tokens, ForegroundTextTransformation[] transformations) { for (int i = 0; i < tokens.Count; i++) { var token = tokens[i]; var nextToken = (i + 1) < tokens.Count ? tokens[i + 1] : null; var startIndex = token.StartIndex; var endIndex = nextToken?.StartIndex ?? _model.GetLines().GetLineLength(lineNumber - 1); if (startIndex >= endIndex || token.Scopes == null || token.Scopes.Count == 0) } } private void ProcessRange(Range range) { for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) { var tokens = _model.GetLineTokens(i - 1); if (tokens == null) continue; RemoveLineTransformations(i); ProcessTokens(i, tokens); } } public void ModelTokensChanged(ModelTokensChangedEvent e) { var ranges = e.ranges.ToArray(); Dispatcher.UIThread.Post(() => { if (_model.IsStopped) return; foreach (var range in ranges) { if (!IsValidRange(range, _document.LineCount)) continue; ProcessRange(range); var startLine = _document.GetLineByNumber(range.fromLineNumber); var endLine = _document.GetLineByNumber(range.toLineNumber); _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); } }); } static bool IsValidRange(Range range, int lineCount) { if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) return false; if (range.toLineNumber < 0 || range.toLineNumber > lineCount) return false; return true; } } } } } public void ModelTokensChanged(ModelTokensChangedEvent e) { if (e.Ranges == null) return; if (_model == null || _model.IsStopped) return; int firstChangedLineIndex = int.MaxValue; int lastChangedLineIndex = -1; foreach (var range in e.Ranges) { firstChangedLineIndex = Math.Min(range.FromLineNumber - 1, firstChangedLineIndex); lastChangedLineIndex = Math.Max(range.ToLineNumber - 1, lastChangedLineIndex); } if (_areVisualLinesValid) { bool changedLinesAreNotVisible = ((firstChangedLineIndex < _firstVisibleLineIndex && lastChangedLineIndex < _firstVisibleLineIndex) || (firstChangedLineIndex > _lastVisibleLineIndex && lastChangedLineIndex > _lastVisibleLineIndex)); if (changedLinesAreNotVisible) return; } Dispatcher.UIThread.Post(() => { int firstLineIndexToRedraw = Math.Max(firstChangedLineIndex, _firstVisibleLineIndex); int lastLineIndexToRedrawLine = Math.Min(lastChangedLineIndex, _lastVisibleLineIndex); int totalLines = _document.Lines.Count - 1; firstLineIndexToRedraw = Clamp(firstLineIndexToRedraw, 0, totalLines); lastLineIndexToRedrawLine = Clamp(lastLineIndexToRedrawLine, 0, totalLines); DocumentLine firstLineToRedraw = _document.Lines[firstLineIndexToRedraw]; DocumentLine lastLineToRedraw = _document.Lines[lastLineIndexToRedrawLine]; _textView.Redraw( firstLineToRedraw.Offset, (lastLineToRedraw.Offset + lastLineToRedraw.TotalLength) - firstLineToRedraw.Offset); }); } static int Clamp(int value, int min, int max) { if (value < min) return min; if (value > max) return max; return value; } static string NormalizeColor(string color) { if (color.Length == 9) { Span<char> normalizedColor = stackalloc char[] { '#', color[7], color[8], color[1], color[2], color[3], color[4], color[5], color[6] }; return normalizedColor.ToString(); } return color; } } } <MSG> Improve TM perf <DFF> @@ -24,20 +24,23 @@ namespace AvaloniaEdit.TextMate private TextDocument _document; private TextView _textView; + private volatile int _firstVisibleLine = -1; + private volatile int _lastVisibleLine = -1; + private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; - public TextMateColoringTransformer() + public TextMateColoringTransformer(TextView textView) { + _textView = textView; _brushes = new Dictionary<int, IBrush>(); + _textView.VisualLinesChanged += TextView_VisualLinesChanged; } - public void SetModel(TextDocument document, TextView textView, TMModel model) + public void SetModel(TextDocument document, TMModel model) { _document = document; _model = model; - _textView = textView; - _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) @@ -46,6 +49,21 @@ namespace AvaloniaEdit.TextMate } } + private void TextView_VisualLinesChanged(object sender, EventArgs e) + { + if (!_textView.VisualLinesValid || _textView.VisualLines.Count == 0) + return; + + _firstVisibleLine = _textView.VisualLines[0].FirstDocumentLine.LineNumber - 1; + _lastVisibleLine = _textView.VisualLines[_textView.VisualLines.Count - 1].LastDocumentLine.LineNumber - 1; + } + + public void Dispose() + { + if (_textView != null) + _textView.VisualLinesChanged -= TextView_VisualLinesChanged; + } + public void SetTheme(Theme theme) { _theme = theme; @@ -90,14 +108,21 @@ namespace AvaloniaEdit.TextMate protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { - if (_transformations is { }) - { - var transformsInLine = _transformations.FindOverlappingSegments(line); + int i = line.LineNumber; - foreach (var transform in transformsInLine) - { - transform.Transform(this, line); - } + var tokens = _model.GetLineTokens(i - 1); + + if (tokens == null) + return; + + RemoveLineTransformations(i); + ProcessTokens(i, tokens); + + var transformsInLine = _transformations.FindOverlappingSegments(line); + + foreach (var transform in transformsInLine) + { + transform.Transform(this, line); } } @@ -142,53 +167,33 @@ namespace AvaloniaEdit.TextMate } } - private void ProcessRange(Range range) + public void ModelTokensChanged(ModelTokensChangedEvent e) { - for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) - { - var tokens = _model.GetLineTokens(i - 1); + if (e.ranges == null) + return; - if (tokens == null) - continue; + if (_model.IsStopped) + return; - RemoveLineTransformations(i); - ProcessTokens(i, tokens); - } - } + bool redraw = false; - public void ModelTokensChanged(ModelTokensChangedEvent e) - { - var ranges = e.ranges.ToArray(); - - Dispatcher.UIThread.Post(() => + foreach (var range in e.ranges) { - if (_model.IsStopped) - return; - - foreach (var range in ranges) + if (range.fromLineNumber >= _firstVisibleLine || range.toLineNumber >= _firstVisibleLine || + range.fromLineNumber <= _lastVisibleLine || range.toLineNumber <= _lastVisibleLine) { - if (!IsValidRange(range, _document.LineCount)) - continue; - - ProcessRange(range); - - var startLine = _document.GetLineByNumber(range.fromLineNumber); - var endLine = _document.GetLineByNumber(range.toLineNumber); - - _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); + redraw = true; + break; } - }); - } - - static bool IsValidRange(Range range, int lineCount) - { - if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) - return false; + } - if (range.toLineNumber < 0 || range.toLineNumber > lineCount) - return false; + if (!redraw) + return; - return true; + Dispatcher.UIThread.Post(() => + { + _textView.Redraw(); + }, DispatcherPriority.Render - 1); } } } \ No newline at end of file
54
Improve TM perf
49
.cs
TextMate/TextMateColoringTransformer
mit
AvaloniaUI/AvaloniaEdit
10058191
<NME> TextMateColoringTransformer.cs <BEF> using System; using System.Buffers; using System.Collections.Generic; using Avalonia.Media; using Avalonia.Media.Immutable; using Avalonia.Threading; using AvaloniaEdit.Document; using AvaloniaEdit.Rendering; using TextMateSharp.Grammars; using TextMateSharp.Model; using TextMateSharp.Themes; namespace AvaloniaEdit.TextMate { public class TextMateColoringTransformer : GenericLineTransformer, IModelTokensChangedListener, ForegroundTextTransformation.IColorMap { private Theme _theme; private TextDocument _document; private TextView _textView; private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; public TextMateColoringTransformer() { _brushes = new Dictionary<int, IBrush>(); } public void SetModel(TextDocument document, TextView textView, TMModel model) { _document = document; _model = model; _textView = textView; _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) public void SetModel(TextDocument document, TMModel model) } } public void SetTheme(Theme theme) { _theme = theme; } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } public void Dispose() { _textView.VisualLinesChanged -= TextView_VisualLinesChanged; } public void SetTheme(Theme theme) { _theme = theme; _brushes.Clear(); var map = _theme.GetColorMap(); foreach (var color in map) { var id = _theme.GetColorId(color); _brushes[id] = new ImmutableSolidColorBrush(Color.Parse(NormalizeColor(color))); } } public void SetGrammar(IGrammar grammar) { _grammar = grammar; if (_model != null) { _model.SetGrammar(grammar); } } protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { if (_transformations is { }) { var transformsInLine = _transformations.FindOverlappingSegments(line); foreach (var transform in transformsInLine) { transform.Transform(this, line); } } } return; var transformsInLine = ArrayPool<ForegroundTextTransformation>.Shared.Rent(tokens.Count); try { GetLineTransformations(lineNumber, tokens, transformsInLine); for (int i = 0; i < tokens.Count; i++) { if (transformsInLine[i] == null) continue; transformsInLine[i].Transform(this, line); } } finally { ArrayPool<ForegroundTextTransformation>.Shared.Return(transformsInLine); } } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } private void GetLineTransformations(int lineNumber, List<TMToken> tokens, ForegroundTextTransformation[] transformations) { for (int i = 0; i < tokens.Count; i++) { var token = tokens[i]; var nextToken = (i + 1) < tokens.Count ? tokens[i + 1] : null; var startIndex = token.StartIndex; var endIndex = nextToken?.StartIndex ?? _model.GetLines().GetLineLength(lineNumber - 1); if (startIndex >= endIndex || token.Scopes == null || token.Scopes.Count == 0) } } private void ProcessRange(Range range) { for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) { var tokens = _model.GetLineTokens(i - 1); if (tokens == null) continue; RemoveLineTransformations(i); ProcessTokens(i, tokens); } } public void ModelTokensChanged(ModelTokensChangedEvent e) { var ranges = e.ranges.ToArray(); Dispatcher.UIThread.Post(() => { if (_model.IsStopped) return; foreach (var range in ranges) { if (!IsValidRange(range, _document.LineCount)) continue; ProcessRange(range); var startLine = _document.GetLineByNumber(range.fromLineNumber); var endLine = _document.GetLineByNumber(range.toLineNumber); _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); } }); } static bool IsValidRange(Range range, int lineCount) { if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) return false; if (range.toLineNumber < 0 || range.toLineNumber > lineCount) return false; return true; } } } } } public void ModelTokensChanged(ModelTokensChangedEvent e) { if (e.Ranges == null) return; if (_model == null || _model.IsStopped) return; int firstChangedLineIndex = int.MaxValue; int lastChangedLineIndex = -1; foreach (var range in e.Ranges) { firstChangedLineIndex = Math.Min(range.FromLineNumber - 1, firstChangedLineIndex); lastChangedLineIndex = Math.Max(range.ToLineNumber - 1, lastChangedLineIndex); } if (_areVisualLinesValid) { bool changedLinesAreNotVisible = ((firstChangedLineIndex < _firstVisibleLineIndex && lastChangedLineIndex < _firstVisibleLineIndex) || (firstChangedLineIndex > _lastVisibleLineIndex && lastChangedLineIndex > _lastVisibleLineIndex)); if (changedLinesAreNotVisible) return; } Dispatcher.UIThread.Post(() => { int firstLineIndexToRedraw = Math.Max(firstChangedLineIndex, _firstVisibleLineIndex); int lastLineIndexToRedrawLine = Math.Min(lastChangedLineIndex, _lastVisibleLineIndex); int totalLines = _document.Lines.Count - 1; firstLineIndexToRedraw = Clamp(firstLineIndexToRedraw, 0, totalLines); lastLineIndexToRedrawLine = Clamp(lastLineIndexToRedrawLine, 0, totalLines); DocumentLine firstLineToRedraw = _document.Lines[firstLineIndexToRedraw]; DocumentLine lastLineToRedraw = _document.Lines[lastLineIndexToRedrawLine]; _textView.Redraw( firstLineToRedraw.Offset, (lastLineToRedraw.Offset + lastLineToRedraw.TotalLength) - firstLineToRedraw.Offset); }); } static int Clamp(int value, int min, int max) { if (value < min) return min; if (value > max) return max; return value; } static string NormalizeColor(string color) { if (color.Length == 9) { Span<char> normalizedColor = stackalloc char[] { '#', color[7], color[8], color[1], color[2], color[3], color[4], color[5], color[6] }; return normalizedColor.ToString(); } return color; } } } <MSG> Improve TM perf <DFF> @@ -24,20 +24,23 @@ namespace AvaloniaEdit.TextMate private TextDocument _document; private TextView _textView; + private volatile int _firstVisibleLine = -1; + private volatile int _lastVisibleLine = -1; + private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; - public TextMateColoringTransformer() + public TextMateColoringTransformer(TextView textView) { + _textView = textView; _brushes = new Dictionary<int, IBrush>(); + _textView.VisualLinesChanged += TextView_VisualLinesChanged; } - public void SetModel(TextDocument document, TextView textView, TMModel model) + public void SetModel(TextDocument document, TMModel model) { _document = document; _model = model; - _textView = textView; - _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) @@ -46,6 +49,21 @@ namespace AvaloniaEdit.TextMate } } + private void TextView_VisualLinesChanged(object sender, EventArgs e) + { + if (!_textView.VisualLinesValid || _textView.VisualLines.Count == 0) + return; + + _firstVisibleLine = _textView.VisualLines[0].FirstDocumentLine.LineNumber - 1; + _lastVisibleLine = _textView.VisualLines[_textView.VisualLines.Count - 1].LastDocumentLine.LineNumber - 1; + } + + public void Dispose() + { + if (_textView != null) + _textView.VisualLinesChanged -= TextView_VisualLinesChanged; + } + public void SetTheme(Theme theme) { _theme = theme; @@ -90,14 +108,21 @@ namespace AvaloniaEdit.TextMate protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { - if (_transformations is { }) - { - var transformsInLine = _transformations.FindOverlappingSegments(line); + int i = line.LineNumber; - foreach (var transform in transformsInLine) - { - transform.Transform(this, line); - } + var tokens = _model.GetLineTokens(i - 1); + + if (tokens == null) + return; + + RemoveLineTransformations(i); + ProcessTokens(i, tokens); + + var transformsInLine = _transformations.FindOverlappingSegments(line); + + foreach (var transform in transformsInLine) + { + transform.Transform(this, line); } } @@ -142,53 +167,33 @@ namespace AvaloniaEdit.TextMate } } - private void ProcessRange(Range range) + public void ModelTokensChanged(ModelTokensChangedEvent e) { - for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) - { - var tokens = _model.GetLineTokens(i - 1); + if (e.ranges == null) + return; - if (tokens == null) - continue; + if (_model.IsStopped) + return; - RemoveLineTransformations(i); - ProcessTokens(i, tokens); - } - } + bool redraw = false; - public void ModelTokensChanged(ModelTokensChangedEvent e) - { - var ranges = e.ranges.ToArray(); - - Dispatcher.UIThread.Post(() => + foreach (var range in e.ranges) { - if (_model.IsStopped) - return; - - foreach (var range in ranges) + if (range.fromLineNumber >= _firstVisibleLine || range.toLineNumber >= _firstVisibleLine || + range.fromLineNumber <= _lastVisibleLine || range.toLineNumber <= _lastVisibleLine) { - if (!IsValidRange(range, _document.LineCount)) - continue; - - ProcessRange(range); - - var startLine = _document.GetLineByNumber(range.fromLineNumber); - var endLine = _document.GetLineByNumber(range.toLineNumber); - - _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); + redraw = true; + break; } - }); - } - - static bool IsValidRange(Range range, int lineCount) - { - if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) - return false; + } - if (range.toLineNumber < 0 || range.toLineNumber > lineCount) - return false; + if (!redraw) + return; - return true; + Dispatcher.UIThread.Post(() => + { + _textView.Redraw(); + }, DispatcherPriority.Render - 1); } } } \ No newline at end of file
54
Improve TM perf
49
.cs
TextMate/TextMateColoringTransformer
mit
AvaloniaUI/AvaloniaEdit
10058192
<NME> TextMateColoringTransformer.cs <BEF> using System; using System.Buffers; using System.Collections.Generic; using Avalonia.Media; using Avalonia.Media.Immutable; using Avalonia.Threading; using AvaloniaEdit.Document; using AvaloniaEdit.Rendering; using TextMateSharp.Grammars; using TextMateSharp.Model; using TextMateSharp.Themes; namespace AvaloniaEdit.TextMate { public class TextMateColoringTransformer : GenericLineTransformer, IModelTokensChangedListener, ForegroundTextTransformation.IColorMap { private Theme _theme; private TextDocument _document; private TextView _textView; private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; public TextMateColoringTransformer() { _brushes = new Dictionary<int, IBrush>(); } public void SetModel(TextDocument document, TextView textView, TMModel model) { _document = document; _model = model; _textView = textView; _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) public void SetModel(TextDocument document, TMModel model) } } public void SetTheme(Theme theme) { _theme = theme; } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } public void Dispose() { _textView.VisualLinesChanged -= TextView_VisualLinesChanged; } public void SetTheme(Theme theme) { _theme = theme; _brushes.Clear(); var map = _theme.GetColorMap(); foreach (var color in map) { var id = _theme.GetColorId(color); _brushes[id] = new ImmutableSolidColorBrush(Color.Parse(NormalizeColor(color))); } } public void SetGrammar(IGrammar grammar) { _grammar = grammar; if (_model != null) { _model.SetGrammar(grammar); } } protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { if (_transformations is { }) { var transformsInLine = _transformations.FindOverlappingSegments(line); foreach (var transform in transformsInLine) { transform.Transform(this, line); } } } return; var transformsInLine = ArrayPool<ForegroundTextTransformation>.Shared.Rent(tokens.Count); try { GetLineTransformations(lineNumber, tokens, transformsInLine); for (int i = 0; i < tokens.Count; i++) { if (transformsInLine[i] == null) continue; transformsInLine[i].Transform(this, line); } } finally { ArrayPool<ForegroundTextTransformation>.Shared.Return(transformsInLine); } } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } private void GetLineTransformations(int lineNumber, List<TMToken> tokens, ForegroundTextTransformation[] transformations) { for (int i = 0; i < tokens.Count; i++) { var token = tokens[i]; var nextToken = (i + 1) < tokens.Count ? tokens[i + 1] : null; var startIndex = token.StartIndex; var endIndex = nextToken?.StartIndex ?? _model.GetLines().GetLineLength(lineNumber - 1); if (startIndex >= endIndex || token.Scopes == null || token.Scopes.Count == 0) } } private void ProcessRange(Range range) { for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) { var tokens = _model.GetLineTokens(i - 1); if (tokens == null) continue; RemoveLineTransformations(i); ProcessTokens(i, tokens); } } public void ModelTokensChanged(ModelTokensChangedEvent e) { var ranges = e.ranges.ToArray(); Dispatcher.UIThread.Post(() => { if (_model.IsStopped) return; foreach (var range in ranges) { if (!IsValidRange(range, _document.LineCount)) continue; ProcessRange(range); var startLine = _document.GetLineByNumber(range.fromLineNumber); var endLine = _document.GetLineByNumber(range.toLineNumber); _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); } }); } static bool IsValidRange(Range range, int lineCount) { if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) return false; if (range.toLineNumber < 0 || range.toLineNumber > lineCount) return false; return true; } } } } } public void ModelTokensChanged(ModelTokensChangedEvent e) { if (e.Ranges == null) return; if (_model == null || _model.IsStopped) return; int firstChangedLineIndex = int.MaxValue; int lastChangedLineIndex = -1; foreach (var range in e.Ranges) { firstChangedLineIndex = Math.Min(range.FromLineNumber - 1, firstChangedLineIndex); lastChangedLineIndex = Math.Max(range.ToLineNumber - 1, lastChangedLineIndex); } if (_areVisualLinesValid) { bool changedLinesAreNotVisible = ((firstChangedLineIndex < _firstVisibleLineIndex && lastChangedLineIndex < _firstVisibleLineIndex) || (firstChangedLineIndex > _lastVisibleLineIndex && lastChangedLineIndex > _lastVisibleLineIndex)); if (changedLinesAreNotVisible) return; } Dispatcher.UIThread.Post(() => { int firstLineIndexToRedraw = Math.Max(firstChangedLineIndex, _firstVisibleLineIndex); int lastLineIndexToRedrawLine = Math.Min(lastChangedLineIndex, _lastVisibleLineIndex); int totalLines = _document.Lines.Count - 1; firstLineIndexToRedraw = Clamp(firstLineIndexToRedraw, 0, totalLines); lastLineIndexToRedrawLine = Clamp(lastLineIndexToRedrawLine, 0, totalLines); DocumentLine firstLineToRedraw = _document.Lines[firstLineIndexToRedraw]; DocumentLine lastLineToRedraw = _document.Lines[lastLineIndexToRedrawLine]; _textView.Redraw( firstLineToRedraw.Offset, (lastLineToRedraw.Offset + lastLineToRedraw.TotalLength) - firstLineToRedraw.Offset); }); } static int Clamp(int value, int min, int max) { if (value < min) return min; if (value > max) return max; return value; } static string NormalizeColor(string color) { if (color.Length == 9) { Span<char> normalizedColor = stackalloc char[] { '#', color[7], color[8], color[1], color[2], color[3], color[4], color[5], color[6] }; return normalizedColor.ToString(); } return color; } } } <MSG> Improve TM perf <DFF> @@ -24,20 +24,23 @@ namespace AvaloniaEdit.TextMate private TextDocument _document; private TextView _textView; + private volatile int _firstVisibleLine = -1; + private volatile int _lastVisibleLine = -1; + private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; - public TextMateColoringTransformer() + public TextMateColoringTransformer(TextView textView) { + _textView = textView; _brushes = new Dictionary<int, IBrush>(); + _textView.VisualLinesChanged += TextView_VisualLinesChanged; } - public void SetModel(TextDocument document, TextView textView, TMModel model) + public void SetModel(TextDocument document, TMModel model) { _document = document; _model = model; - _textView = textView; - _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) @@ -46,6 +49,21 @@ namespace AvaloniaEdit.TextMate } } + private void TextView_VisualLinesChanged(object sender, EventArgs e) + { + if (!_textView.VisualLinesValid || _textView.VisualLines.Count == 0) + return; + + _firstVisibleLine = _textView.VisualLines[0].FirstDocumentLine.LineNumber - 1; + _lastVisibleLine = _textView.VisualLines[_textView.VisualLines.Count - 1].LastDocumentLine.LineNumber - 1; + } + + public void Dispose() + { + if (_textView != null) + _textView.VisualLinesChanged -= TextView_VisualLinesChanged; + } + public void SetTheme(Theme theme) { _theme = theme; @@ -90,14 +108,21 @@ namespace AvaloniaEdit.TextMate protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { - if (_transformations is { }) - { - var transformsInLine = _transformations.FindOverlappingSegments(line); + int i = line.LineNumber; - foreach (var transform in transformsInLine) - { - transform.Transform(this, line); - } + var tokens = _model.GetLineTokens(i - 1); + + if (tokens == null) + return; + + RemoveLineTransformations(i); + ProcessTokens(i, tokens); + + var transformsInLine = _transformations.FindOverlappingSegments(line); + + foreach (var transform in transformsInLine) + { + transform.Transform(this, line); } } @@ -142,53 +167,33 @@ namespace AvaloniaEdit.TextMate } } - private void ProcessRange(Range range) + public void ModelTokensChanged(ModelTokensChangedEvent e) { - for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) - { - var tokens = _model.GetLineTokens(i - 1); + if (e.ranges == null) + return; - if (tokens == null) - continue; + if (_model.IsStopped) + return; - RemoveLineTransformations(i); - ProcessTokens(i, tokens); - } - } + bool redraw = false; - public void ModelTokensChanged(ModelTokensChangedEvent e) - { - var ranges = e.ranges.ToArray(); - - Dispatcher.UIThread.Post(() => + foreach (var range in e.ranges) { - if (_model.IsStopped) - return; - - foreach (var range in ranges) + if (range.fromLineNumber >= _firstVisibleLine || range.toLineNumber >= _firstVisibleLine || + range.fromLineNumber <= _lastVisibleLine || range.toLineNumber <= _lastVisibleLine) { - if (!IsValidRange(range, _document.LineCount)) - continue; - - ProcessRange(range); - - var startLine = _document.GetLineByNumber(range.fromLineNumber); - var endLine = _document.GetLineByNumber(range.toLineNumber); - - _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); + redraw = true; + break; } - }); - } - - static bool IsValidRange(Range range, int lineCount) - { - if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) - return false; + } - if (range.toLineNumber < 0 || range.toLineNumber > lineCount) - return false; + if (!redraw) + return; - return true; + Dispatcher.UIThread.Post(() => + { + _textView.Redraw(); + }, DispatcherPriority.Render - 1); } } } \ No newline at end of file
54
Improve TM perf
49
.cs
TextMate/TextMateColoringTransformer
mit
AvaloniaUI/AvaloniaEdit
10058193
<NME> TextMateColoringTransformer.cs <BEF> using System; using System.Buffers; using System.Collections.Generic; using Avalonia.Media; using Avalonia.Media.Immutable; using Avalonia.Threading; using AvaloniaEdit.Document; using AvaloniaEdit.Rendering; using TextMateSharp.Grammars; using TextMateSharp.Model; using TextMateSharp.Themes; namespace AvaloniaEdit.TextMate { public class TextMateColoringTransformer : GenericLineTransformer, IModelTokensChangedListener, ForegroundTextTransformation.IColorMap { private Theme _theme; private TextDocument _document; private TextView _textView; private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; public TextMateColoringTransformer() { _brushes = new Dictionary<int, IBrush>(); } public void SetModel(TextDocument document, TextView textView, TMModel model) { _document = document; _model = model; _textView = textView; _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) public void SetModel(TextDocument document, TMModel model) } } public void SetTheme(Theme theme) { _theme = theme; } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } public void Dispose() { _textView.VisualLinesChanged -= TextView_VisualLinesChanged; } public void SetTheme(Theme theme) { _theme = theme; _brushes.Clear(); var map = _theme.GetColorMap(); foreach (var color in map) { var id = _theme.GetColorId(color); _brushes[id] = new ImmutableSolidColorBrush(Color.Parse(NormalizeColor(color))); } } public void SetGrammar(IGrammar grammar) { _grammar = grammar; if (_model != null) { _model.SetGrammar(grammar); } } protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { if (_transformations is { }) { var transformsInLine = _transformations.FindOverlappingSegments(line); foreach (var transform in transformsInLine) { transform.Transform(this, line); } } } return; var transformsInLine = ArrayPool<ForegroundTextTransformation>.Shared.Rent(tokens.Count); try { GetLineTransformations(lineNumber, tokens, transformsInLine); for (int i = 0; i < tokens.Count; i++) { if (transformsInLine[i] == null) continue; transformsInLine[i].Transform(this, line); } } finally { ArrayPool<ForegroundTextTransformation>.Shared.Return(transformsInLine); } } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } private void GetLineTransformations(int lineNumber, List<TMToken> tokens, ForegroundTextTransformation[] transformations) { for (int i = 0; i < tokens.Count; i++) { var token = tokens[i]; var nextToken = (i + 1) < tokens.Count ? tokens[i + 1] : null; var startIndex = token.StartIndex; var endIndex = nextToken?.StartIndex ?? _model.GetLines().GetLineLength(lineNumber - 1); if (startIndex >= endIndex || token.Scopes == null || token.Scopes.Count == 0) } } private void ProcessRange(Range range) { for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) { var tokens = _model.GetLineTokens(i - 1); if (tokens == null) continue; RemoveLineTransformations(i); ProcessTokens(i, tokens); } } public void ModelTokensChanged(ModelTokensChangedEvent e) { var ranges = e.ranges.ToArray(); Dispatcher.UIThread.Post(() => { if (_model.IsStopped) return; foreach (var range in ranges) { if (!IsValidRange(range, _document.LineCount)) continue; ProcessRange(range); var startLine = _document.GetLineByNumber(range.fromLineNumber); var endLine = _document.GetLineByNumber(range.toLineNumber); _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); } }); } static bool IsValidRange(Range range, int lineCount) { if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) return false; if (range.toLineNumber < 0 || range.toLineNumber > lineCount) return false; return true; } } } } } public void ModelTokensChanged(ModelTokensChangedEvent e) { if (e.Ranges == null) return; if (_model == null || _model.IsStopped) return; int firstChangedLineIndex = int.MaxValue; int lastChangedLineIndex = -1; foreach (var range in e.Ranges) { firstChangedLineIndex = Math.Min(range.FromLineNumber - 1, firstChangedLineIndex); lastChangedLineIndex = Math.Max(range.ToLineNumber - 1, lastChangedLineIndex); } if (_areVisualLinesValid) { bool changedLinesAreNotVisible = ((firstChangedLineIndex < _firstVisibleLineIndex && lastChangedLineIndex < _firstVisibleLineIndex) || (firstChangedLineIndex > _lastVisibleLineIndex && lastChangedLineIndex > _lastVisibleLineIndex)); if (changedLinesAreNotVisible) return; } Dispatcher.UIThread.Post(() => { int firstLineIndexToRedraw = Math.Max(firstChangedLineIndex, _firstVisibleLineIndex); int lastLineIndexToRedrawLine = Math.Min(lastChangedLineIndex, _lastVisibleLineIndex); int totalLines = _document.Lines.Count - 1; firstLineIndexToRedraw = Clamp(firstLineIndexToRedraw, 0, totalLines); lastLineIndexToRedrawLine = Clamp(lastLineIndexToRedrawLine, 0, totalLines); DocumentLine firstLineToRedraw = _document.Lines[firstLineIndexToRedraw]; DocumentLine lastLineToRedraw = _document.Lines[lastLineIndexToRedrawLine]; _textView.Redraw( firstLineToRedraw.Offset, (lastLineToRedraw.Offset + lastLineToRedraw.TotalLength) - firstLineToRedraw.Offset); }); } static int Clamp(int value, int min, int max) { if (value < min) return min; if (value > max) return max; return value; } static string NormalizeColor(string color) { if (color.Length == 9) { Span<char> normalizedColor = stackalloc char[] { '#', color[7], color[8], color[1], color[2], color[3], color[4], color[5], color[6] }; return normalizedColor.ToString(); } return color; } } } <MSG> Improve TM perf <DFF> @@ -24,20 +24,23 @@ namespace AvaloniaEdit.TextMate private TextDocument _document; private TextView _textView; + private volatile int _firstVisibleLine = -1; + private volatile int _lastVisibleLine = -1; + private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; - public TextMateColoringTransformer() + public TextMateColoringTransformer(TextView textView) { + _textView = textView; _brushes = new Dictionary<int, IBrush>(); + _textView.VisualLinesChanged += TextView_VisualLinesChanged; } - public void SetModel(TextDocument document, TextView textView, TMModel model) + public void SetModel(TextDocument document, TMModel model) { _document = document; _model = model; - _textView = textView; - _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) @@ -46,6 +49,21 @@ namespace AvaloniaEdit.TextMate } } + private void TextView_VisualLinesChanged(object sender, EventArgs e) + { + if (!_textView.VisualLinesValid || _textView.VisualLines.Count == 0) + return; + + _firstVisibleLine = _textView.VisualLines[0].FirstDocumentLine.LineNumber - 1; + _lastVisibleLine = _textView.VisualLines[_textView.VisualLines.Count - 1].LastDocumentLine.LineNumber - 1; + } + + public void Dispose() + { + if (_textView != null) + _textView.VisualLinesChanged -= TextView_VisualLinesChanged; + } + public void SetTheme(Theme theme) { _theme = theme; @@ -90,14 +108,21 @@ namespace AvaloniaEdit.TextMate protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { - if (_transformations is { }) - { - var transformsInLine = _transformations.FindOverlappingSegments(line); + int i = line.LineNumber; - foreach (var transform in transformsInLine) - { - transform.Transform(this, line); - } + var tokens = _model.GetLineTokens(i - 1); + + if (tokens == null) + return; + + RemoveLineTransformations(i); + ProcessTokens(i, tokens); + + var transformsInLine = _transformations.FindOverlappingSegments(line); + + foreach (var transform in transformsInLine) + { + transform.Transform(this, line); } } @@ -142,53 +167,33 @@ namespace AvaloniaEdit.TextMate } } - private void ProcessRange(Range range) + public void ModelTokensChanged(ModelTokensChangedEvent e) { - for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) - { - var tokens = _model.GetLineTokens(i - 1); + if (e.ranges == null) + return; - if (tokens == null) - continue; + if (_model.IsStopped) + return; - RemoveLineTransformations(i); - ProcessTokens(i, tokens); - } - } + bool redraw = false; - public void ModelTokensChanged(ModelTokensChangedEvent e) - { - var ranges = e.ranges.ToArray(); - - Dispatcher.UIThread.Post(() => + foreach (var range in e.ranges) { - if (_model.IsStopped) - return; - - foreach (var range in ranges) + if (range.fromLineNumber >= _firstVisibleLine || range.toLineNumber >= _firstVisibleLine || + range.fromLineNumber <= _lastVisibleLine || range.toLineNumber <= _lastVisibleLine) { - if (!IsValidRange(range, _document.LineCount)) - continue; - - ProcessRange(range); - - var startLine = _document.GetLineByNumber(range.fromLineNumber); - var endLine = _document.GetLineByNumber(range.toLineNumber); - - _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); + redraw = true; + break; } - }); - } - - static bool IsValidRange(Range range, int lineCount) - { - if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) - return false; + } - if (range.toLineNumber < 0 || range.toLineNumber > lineCount) - return false; + if (!redraw) + return; - return true; + Dispatcher.UIThread.Post(() => + { + _textView.Redraw(); + }, DispatcherPriority.Render - 1); } } } \ No newline at end of file
54
Improve TM perf
49
.cs
TextMate/TextMateColoringTransformer
mit
AvaloniaUI/AvaloniaEdit
10058194
<NME> TextMateColoringTransformer.cs <BEF> using System; using System.Buffers; using System.Collections.Generic; using Avalonia.Media; using Avalonia.Media.Immutable; using Avalonia.Threading; using AvaloniaEdit.Document; using AvaloniaEdit.Rendering; using TextMateSharp.Grammars; using TextMateSharp.Model; using TextMateSharp.Themes; namespace AvaloniaEdit.TextMate { public class TextMateColoringTransformer : GenericLineTransformer, IModelTokensChangedListener, ForegroundTextTransformation.IColorMap { private Theme _theme; private TextDocument _document; private TextView _textView; private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; public TextMateColoringTransformer() { _brushes = new Dictionary<int, IBrush>(); } public void SetModel(TextDocument document, TextView textView, TMModel model) { _document = document; _model = model; _textView = textView; _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) public void SetModel(TextDocument document, TMModel model) } } public void SetTheme(Theme theme) { _theme = theme; } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } public void Dispose() { _textView.VisualLinesChanged -= TextView_VisualLinesChanged; } public void SetTheme(Theme theme) { _theme = theme; _brushes.Clear(); var map = _theme.GetColorMap(); foreach (var color in map) { var id = _theme.GetColorId(color); _brushes[id] = new ImmutableSolidColorBrush(Color.Parse(NormalizeColor(color))); } } public void SetGrammar(IGrammar grammar) { _grammar = grammar; if (_model != null) { _model.SetGrammar(grammar); } } protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { if (_transformations is { }) { var transformsInLine = _transformations.FindOverlappingSegments(line); foreach (var transform in transformsInLine) { transform.Transform(this, line); } } } return; var transformsInLine = ArrayPool<ForegroundTextTransformation>.Shared.Rent(tokens.Count); try { GetLineTransformations(lineNumber, tokens, transformsInLine); for (int i = 0; i < tokens.Count; i++) { if (transformsInLine[i] == null) continue; transformsInLine[i].Transform(this, line); } } finally { ArrayPool<ForegroundTextTransformation>.Shared.Return(transformsInLine); } } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } private void GetLineTransformations(int lineNumber, List<TMToken> tokens, ForegroundTextTransformation[] transformations) { for (int i = 0; i < tokens.Count; i++) { var token = tokens[i]; var nextToken = (i + 1) < tokens.Count ? tokens[i + 1] : null; var startIndex = token.StartIndex; var endIndex = nextToken?.StartIndex ?? _model.GetLines().GetLineLength(lineNumber - 1); if (startIndex >= endIndex || token.Scopes == null || token.Scopes.Count == 0) } } private void ProcessRange(Range range) { for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) { var tokens = _model.GetLineTokens(i - 1); if (tokens == null) continue; RemoveLineTransformations(i); ProcessTokens(i, tokens); } } public void ModelTokensChanged(ModelTokensChangedEvent e) { var ranges = e.ranges.ToArray(); Dispatcher.UIThread.Post(() => { if (_model.IsStopped) return; foreach (var range in ranges) { if (!IsValidRange(range, _document.LineCount)) continue; ProcessRange(range); var startLine = _document.GetLineByNumber(range.fromLineNumber); var endLine = _document.GetLineByNumber(range.toLineNumber); _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); } }); } static bool IsValidRange(Range range, int lineCount) { if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) return false; if (range.toLineNumber < 0 || range.toLineNumber > lineCount) return false; return true; } } } } } public void ModelTokensChanged(ModelTokensChangedEvent e) { if (e.Ranges == null) return; if (_model == null || _model.IsStopped) return; int firstChangedLineIndex = int.MaxValue; int lastChangedLineIndex = -1; foreach (var range in e.Ranges) { firstChangedLineIndex = Math.Min(range.FromLineNumber - 1, firstChangedLineIndex); lastChangedLineIndex = Math.Max(range.ToLineNumber - 1, lastChangedLineIndex); } if (_areVisualLinesValid) { bool changedLinesAreNotVisible = ((firstChangedLineIndex < _firstVisibleLineIndex && lastChangedLineIndex < _firstVisibleLineIndex) || (firstChangedLineIndex > _lastVisibleLineIndex && lastChangedLineIndex > _lastVisibleLineIndex)); if (changedLinesAreNotVisible) return; } Dispatcher.UIThread.Post(() => { int firstLineIndexToRedraw = Math.Max(firstChangedLineIndex, _firstVisibleLineIndex); int lastLineIndexToRedrawLine = Math.Min(lastChangedLineIndex, _lastVisibleLineIndex); int totalLines = _document.Lines.Count - 1; firstLineIndexToRedraw = Clamp(firstLineIndexToRedraw, 0, totalLines); lastLineIndexToRedrawLine = Clamp(lastLineIndexToRedrawLine, 0, totalLines); DocumentLine firstLineToRedraw = _document.Lines[firstLineIndexToRedraw]; DocumentLine lastLineToRedraw = _document.Lines[lastLineIndexToRedrawLine]; _textView.Redraw( firstLineToRedraw.Offset, (lastLineToRedraw.Offset + lastLineToRedraw.TotalLength) - firstLineToRedraw.Offset); }); } static int Clamp(int value, int min, int max) { if (value < min) return min; if (value > max) return max; return value; } static string NormalizeColor(string color) { if (color.Length == 9) { Span<char> normalizedColor = stackalloc char[] { '#', color[7], color[8], color[1], color[2], color[3], color[4], color[5], color[6] }; return normalizedColor.ToString(); } return color; } } } <MSG> Improve TM perf <DFF> @@ -24,20 +24,23 @@ namespace AvaloniaEdit.TextMate private TextDocument _document; private TextView _textView; + private volatile int _firstVisibleLine = -1; + private volatile int _lastVisibleLine = -1; + private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; - public TextMateColoringTransformer() + public TextMateColoringTransformer(TextView textView) { + _textView = textView; _brushes = new Dictionary<int, IBrush>(); + _textView.VisualLinesChanged += TextView_VisualLinesChanged; } - public void SetModel(TextDocument document, TextView textView, TMModel model) + public void SetModel(TextDocument document, TMModel model) { _document = document; _model = model; - _textView = textView; - _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) @@ -46,6 +49,21 @@ namespace AvaloniaEdit.TextMate } } + private void TextView_VisualLinesChanged(object sender, EventArgs e) + { + if (!_textView.VisualLinesValid || _textView.VisualLines.Count == 0) + return; + + _firstVisibleLine = _textView.VisualLines[0].FirstDocumentLine.LineNumber - 1; + _lastVisibleLine = _textView.VisualLines[_textView.VisualLines.Count - 1].LastDocumentLine.LineNumber - 1; + } + + public void Dispose() + { + if (_textView != null) + _textView.VisualLinesChanged -= TextView_VisualLinesChanged; + } + public void SetTheme(Theme theme) { _theme = theme; @@ -90,14 +108,21 @@ namespace AvaloniaEdit.TextMate protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { - if (_transformations is { }) - { - var transformsInLine = _transformations.FindOverlappingSegments(line); + int i = line.LineNumber; - foreach (var transform in transformsInLine) - { - transform.Transform(this, line); - } + var tokens = _model.GetLineTokens(i - 1); + + if (tokens == null) + return; + + RemoveLineTransformations(i); + ProcessTokens(i, tokens); + + var transformsInLine = _transformations.FindOverlappingSegments(line); + + foreach (var transform in transformsInLine) + { + transform.Transform(this, line); } } @@ -142,53 +167,33 @@ namespace AvaloniaEdit.TextMate } } - private void ProcessRange(Range range) + public void ModelTokensChanged(ModelTokensChangedEvent e) { - for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) - { - var tokens = _model.GetLineTokens(i - 1); + if (e.ranges == null) + return; - if (tokens == null) - continue; + if (_model.IsStopped) + return; - RemoveLineTransformations(i); - ProcessTokens(i, tokens); - } - } + bool redraw = false; - public void ModelTokensChanged(ModelTokensChangedEvent e) - { - var ranges = e.ranges.ToArray(); - - Dispatcher.UIThread.Post(() => + foreach (var range in e.ranges) { - if (_model.IsStopped) - return; - - foreach (var range in ranges) + if (range.fromLineNumber >= _firstVisibleLine || range.toLineNumber >= _firstVisibleLine || + range.fromLineNumber <= _lastVisibleLine || range.toLineNumber <= _lastVisibleLine) { - if (!IsValidRange(range, _document.LineCount)) - continue; - - ProcessRange(range); - - var startLine = _document.GetLineByNumber(range.fromLineNumber); - var endLine = _document.GetLineByNumber(range.toLineNumber); - - _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); + redraw = true; + break; } - }); - } - - static bool IsValidRange(Range range, int lineCount) - { - if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) - return false; + } - if (range.toLineNumber < 0 || range.toLineNumber > lineCount) - return false; + if (!redraw) + return; - return true; + Dispatcher.UIThread.Post(() => + { + _textView.Redraw(); + }, DispatcherPriority.Render - 1); } } } \ No newline at end of file
54
Improve TM perf
49
.cs
TextMate/TextMateColoringTransformer
mit
AvaloniaUI/AvaloniaEdit
10058195
<NME> TextMateColoringTransformer.cs <BEF> using System; using System.Buffers; using System.Collections.Generic; using Avalonia.Media; using Avalonia.Media.Immutable; using Avalonia.Threading; using AvaloniaEdit.Document; using AvaloniaEdit.Rendering; using TextMateSharp.Grammars; using TextMateSharp.Model; using TextMateSharp.Themes; namespace AvaloniaEdit.TextMate { public class TextMateColoringTransformer : GenericLineTransformer, IModelTokensChangedListener, ForegroundTextTransformation.IColorMap { private Theme _theme; private TextDocument _document; private TextView _textView; private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; public TextMateColoringTransformer() { _brushes = new Dictionary<int, IBrush>(); } public void SetModel(TextDocument document, TextView textView, TMModel model) { _document = document; _model = model; _textView = textView; _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) public void SetModel(TextDocument document, TMModel model) } } public void SetTheme(Theme theme) { _theme = theme; } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } public void Dispose() { _textView.VisualLinesChanged -= TextView_VisualLinesChanged; } public void SetTheme(Theme theme) { _theme = theme; _brushes.Clear(); var map = _theme.GetColorMap(); foreach (var color in map) { var id = _theme.GetColorId(color); _brushes[id] = new ImmutableSolidColorBrush(Color.Parse(NormalizeColor(color))); } } public void SetGrammar(IGrammar grammar) { _grammar = grammar; if (_model != null) { _model.SetGrammar(grammar); } } protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { if (_transformations is { }) { var transformsInLine = _transformations.FindOverlappingSegments(line); foreach (var transform in transformsInLine) { transform.Transform(this, line); } } } return; var transformsInLine = ArrayPool<ForegroundTextTransformation>.Shared.Rent(tokens.Count); try { GetLineTransformations(lineNumber, tokens, transformsInLine); for (int i = 0; i < tokens.Count; i++) { if (transformsInLine[i] == null) continue; transformsInLine[i].Transform(this, line); } } finally { ArrayPool<ForegroundTextTransformation>.Shared.Return(transformsInLine); } } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } private void GetLineTransformations(int lineNumber, List<TMToken> tokens, ForegroundTextTransformation[] transformations) { for (int i = 0; i < tokens.Count; i++) { var token = tokens[i]; var nextToken = (i + 1) < tokens.Count ? tokens[i + 1] : null; var startIndex = token.StartIndex; var endIndex = nextToken?.StartIndex ?? _model.GetLines().GetLineLength(lineNumber - 1); if (startIndex >= endIndex || token.Scopes == null || token.Scopes.Count == 0) } } private void ProcessRange(Range range) { for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) { var tokens = _model.GetLineTokens(i - 1); if (tokens == null) continue; RemoveLineTransformations(i); ProcessTokens(i, tokens); } } public void ModelTokensChanged(ModelTokensChangedEvent e) { var ranges = e.ranges.ToArray(); Dispatcher.UIThread.Post(() => { if (_model.IsStopped) return; foreach (var range in ranges) { if (!IsValidRange(range, _document.LineCount)) continue; ProcessRange(range); var startLine = _document.GetLineByNumber(range.fromLineNumber); var endLine = _document.GetLineByNumber(range.toLineNumber); _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); } }); } static bool IsValidRange(Range range, int lineCount) { if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) return false; if (range.toLineNumber < 0 || range.toLineNumber > lineCount) return false; return true; } } } } } public void ModelTokensChanged(ModelTokensChangedEvent e) { if (e.Ranges == null) return; if (_model == null || _model.IsStopped) return; int firstChangedLineIndex = int.MaxValue; int lastChangedLineIndex = -1; foreach (var range in e.Ranges) { firstChangedLineIndex = Math.Min(range.FromLineNumber - 1, firstChangedLineIndex); lastChangedLineIndex = Math.Max(range.ToLineNumber - 1, lastChangedLineIndex); } if (_areVisualLinesValid) { bool changedLinesAreNotVisible = ((firstChangedLineIndex < _firstVisibleLineIndex && lastChangedLineIndex < _firstVisibleLineIndex) || (firstChangedLineIndex > _lastVisibleLineIndex && lastChangedLineIndex > _lastVisibleLineIndex)); if (changedLinesAreNotVisible) return; } Dispatcher.UIThread.Post(() => { int firstLineIndexToRedraw = Math.Max(firstChangedLineIndex, _firstVisibleLineIndex); int lastLineIndexToRedrawLine = Math.Min(lastChangedLineIndex, _lastVisibleLineIndex); int totalLines = _document.Lines.Count - 1; firstLineIndexToRedraw = Clamp(firstLineIndexToRedraw, 0, totalLines); lastLineIndexToRedrawLine = Clamp(lastLineIndexToRedrawLine, 0, totalLines); DocumentLine firstLineToRedraw = _document.Lines[firstLineIndexToRedraw]; DocumentLine lastLineToRedraw = _document.Lines[lastLineIndexToRedrawLine]; _textView.Redraw( firstLineToRedraw.Offset, (lastLineToRedraw.Offset + lastLineToRedraw.TotalLength) - firstLineToRedraw.Offset); }); } static int Clamp(int value, int min, int max) { if (value < min) return min; if (value > max) return max; return value; } static string NormalizeColor(string color) { if (color.Length == 9) { Span<char> normalizedColor = stackalloc char[] { '#', color[7], color[8], color[1], color[2], color[3], color[4], color[5], color[6] }; return normalizedColor.ToString(); } return color; } } } <MSG> Improve TM perf <DFF> @@ -24,20 +24,23 @@ namespace AvaloniaEdit.TextMate private TextDocument _document; private TextView _textView; + private volatile int _firstVisibleLine = -1; + private volatile int _lastVisibleLine = -1; + private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; - public TextMateColoringTransformer() + public TextMateColoringTransformer(TextView textView) { + _textView = textView; _brushes = new Dictionary<int, IBrush>(); + _textView.VisualLinesChanged += TextView_VisualLinesChanged; } - public void SetModel(TextDocument document, TextView textView, TMModel model) + public void SetModel(TextDocument document, TMModel model) { _document = document; _model = model; - _textView = textView; - _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) @@ -46,6 +49,21 @@ namespace AvaloniaEdit.TextMate } } + private void TextView_VisualLinesChanged(object sender, EventArgs e) + { + if (!_textView.VisualLinesValid || _textView.VisualLines.Count == 0) + return; + + _firstVisibleLine = _textView.VisualLines[0].FirstDocumentLine.LineNumber - 1; + _lastVisibleLine = _textView.VisualLines[_textView.VisualLines.Count - 1].LastDocumentLine.LineNumber - 1; + } + + public void Dispose() + { + if (_textView != null) + _textView.VisualLinesChanged -= TextView_VisualLinesChanged; + } + public void SetTheme(Theme theme) { _theme = theme; @@ -90,14 +108,21 @@ namespace AvaloniaEdit.TextMate protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { - if (_transformations is { }) - { - var transformsInLine = _transformations.FindOverlappingSegments(line); + int i = line.LineNumber; - foreach (var transform in transformsInLine) - { - transform.Transform(this, line); - } + var tokens = _model.GetLineTokens(i - 1); + + if (tokens == null) + return; + + RemoveLineTransformations(i); + ProcessTokens(i, tokens); + + var transformsInLine = _transformations.FindOverlappingSegments(line); + + foreach (var transform in transformsInLine) + { + transform.Transform(this, line); } } @@ -142,53 +167,33 @@ namespace AvaloniaEdit.TextMate } } - private void ProcessRange(Range range) + public void ModelTokensChanged(ModelTokensChangedEvent e) { - for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) - { - var tokens = _model.GetLineTokens(i - 1); + if (e.ranges == null) + return; - if (tokens == null) - continue; + if (_model.IsStopped) + return; - RemoveLineTransformations(i); - ProcessTokens(i, tokens); - } - } + bool redraw = false; - public void ModelTokensChanged(ModelTokensChangedEvent e) - { - var ranges = e.ranges.ToArray(); - - Dispatcher.UIThread.Post(() => + foreach (var range in e.ranges) { - if (_model.IsStopped) - return; - - foreach (var range in ranges) + if (range.fromLineNumber >= _firstVisibleLine || range.toLineNumber >= _firstVisibleLine || + range.fromLineNumber <= _lastVisibleLine || range.toLineNumber <= _lastVisibleLine) { - if (!IsValidRange(range, _document.LineCount)) - continue; - - ProcessRange(range); - - var startLine = _document.GetLineByNumber(range.fromLineNumber); - var endLine = _document.GetLineByNumber(range.toLineNumber); - - _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); + redraw = true; + break; } - }); - } - - static bool IsValidRange(Range range, int lineCount) - { - if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) - return false; + } - if (range.toLineNumber < 0 || range.toLineNumber > lineCount) - return false; + if (!redraw) + return; - return true; + Dispatcher.UIThread.Post(() => + { + _textView.Redraw(); + }, DispatcherPriority.Render - 1); } } } \ No newline at end of file
54
Improve TM perf
49
.cs
TextMate/TextMateColoringTransformer
mit
AvaloniaUI/AvaloniaEdit
10058196
<NME> TextMateColoringTransformer.cs <BEF> using System; using System.Buffers; using System.Collections.Generic; using Avalonia.Media; using Avalonia.Media.Immutable; using Avalonia.Threading; using AvaloniaEdit.Document; using AvaloniaEdit.Rendering; using TextMateSharp.Grammars; using TextMateSharp.Model; using TextMateSharp.Themes; namespace AvaloniaEdit.TextMate { public class TextMateColoringTransformer : GenericLineTransformer, IModelTokensChangedListener, ForegroundTextTransformation.IColorMap { private Theme _theme; private TextDocument _document; private TextView _textView; private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; public TextMateColoringTransformer() { _brushes = new Dictionary<int, IBrush>(); } public void SetModel(TextDocument document, TextView textView, TMModel model) { _document = document; _model = model; _textView = textView; _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) public void SetModel(TextDocument document, TMModel model) } } public void SetTheme(Theme theme) { _theme = theme; } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } public void Dispose() { _textView.VisualLinesChanged -= TextView_VisualLinesChanged; } public void SetTheme(Theme theme) { _theme = theme; _brushes.Clear(); var map = _theme.GetColorMap(); foreach (var color in map) { var id = _theme.GetColorId(color); _brushes[id] = new ImmutableSolidColorBrush(Color.Parse(NormalizeColor(color))); } } public void SetGrammar(IGrammar grammar) { _grammar = grammar; if (_model != null) { _model.SetGrammar(grammar); } } protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { if (_transformations is { }) { var transformsInLine = _transformations.FindOverlappingSegments(line); foreach (var transform in transformsInLine) { transform.Transform(this, line); } } } return; var transformsInLine = ArrayPool<ForegroundTextTransformation>.Shared.Rent(tokens.Count); try { GetLineTransformations(lineNumber, tokens, transformsInLine); for (int i = 0; i < tokens.Count; i++) { if (transformsInLine[i] == null) continue; transformsInLine[i].Transform(this, line); } } finally { ArrayPool<ForegroundTextTransformation>.Shared.Return(transformsInLine); } } catch (Exception ex) { _exceptionHandler?.Invoke(ex); } } private void GetLineTransformations(int lineNumber, List<TMToken> tokens, ForegroundTextTransformation[] transformations) { for (int i = 0; i < tokens.Count; i++) { var token = tokens[i]; var nextToken = (i + 1) < tokens.Count ? tokens[i + 1] : null; var startIndex = token.StartIndex; var endIndex = nextToken?.StartIndex ?? _model.GetLines().GetLineLength(lineNumber - 1); if (startIndex >= endIndex || token.Scopes == null || token.Scopes.Count == 0) } } private void ProcessRange(Range range) { for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) { var tokens = _model.GetLineTokens(i - 1); if (tokens == null) continue; RemoveLineTransformations(i); ProcessTokens(i, tokens); } } public void ModelTokensChanged(ModelTokensChangedEvent e) { var ranges = e.ranges.ToArray(); Dispatcher.UIThread.Post(() => { if (_model.IsStopped) return; foreach (var range in ranges) { if (!IsValidRange(range, _document.LineCount)) continue; ProcessRange(range); var startLine = _document.GetLineByNumber(range.fromLineNumber); var endLine = _document.GetLineByNumber(range.toLineNumber); _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); } }); } static bool IsValidRange(Range range, int lineCount) { if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) return false; if (range.toLineNumber < 0 || range.toLineNumber > lineCount) return false; return true; } } } } } public void ModelTokensChanged(ModelTokensChangedEvent e) { if (e.Ranges == null) return; if (_model == null || _model.IsStopped) return; int firstChangedLineIndex = int.MaxValue; int lastChangedLineIndex = -1; foreach (var range in e.Ranges) { firstChangedLineIndex = Math.Min(range.FromLineNumber - 1, firstChangedLineIndex); lastChangedLineIndex = Math.Max(range.ToLineNumber - 1, lastChangedLineIndex); } if (_areVisualLinesValid) { bool changedLinesAreNotVisible = ((firstChangedLineIndex < _firstVisibleLineIndex && lastChangedLineIndex < _firstVisibleLineIndex) || (firstChangedLineIndex > _lastVisibleLineIndex && lastChangedLineIndex > _lastVisibleLineIndex)); if (changedLinesAreNotVisible) return; } Dispatcher.UIThread.Post(() => { int firstLineIndexToRedraw = Math.Max(firstChangedLineIndex, _firstVisibleLineIndex); int lastLineIndexToRedrawLine = Math.Min(lastChangedLineIndex, _lastVisibleLineIndex); int totalLines = _document.Lines.Count - 1; firstLineIndexToRedraw = Clamp(firstLineIndexToRedraw, 0, totalLines); lastLineIndexToRedrawLine = Clamp(lastLineIndexToRedrawLine, 0, totalLines); DocumentLine firstLineToRedraw = _document.Lines[firstLineIndexToRedraw]; DocumentLine lastLineToRedraw = _document.Lines[lastLineIndexToRedrawLine]; _textView.Redraw( firstLineToRedraw.Offset, (lastLineToRedraw.Offset + lastLineToRedraw.TotalLength) - firstLineToRedraw.Offset); }); } static int Clamp(int value, int min, int max) { if (value < min) return min; if (value > max) return max; return value; } static string NormalizeColor(string color) { if (color.Length == 9) { Span<char> normalizedColor = stackalloc char[] { '#', color[7], color[8], color[1], color[2], color[3], color[4], color[5], color[6] }; return normalizedColor.ToString(); } return color; } } } <MSG> Improve TM perf <DFF> @@ -24,20 +24,23 @@ namespace AvaloniaEdit.TextMate private TextDocument _document; private TextView _textView; + private volatile int _firstVisibleLine = -1; + private volatile int _lastVisibleLine = -1; + private readonly Dictionary<int, IBrush> _brushes; private TextSegmentCollection<TextTransformation> _transformations; - public TextMateColoringTransformer() + public TextMateColoringTransformer(TextView textView) { + _textView = textView; _brushes = new Dictionary<int, IBrush>(); + _textView.VisualLinesChanged += TextView_VisualLinesChanged; } - public void SetModel(TextDocument document, TextView textView, TMModel model) + public void SetModel(TextDocument document, TMModel model) { _document = document; _model = model; - _textView = textView; - _transformations = new TextSegmentCollection<TextTransformation>(_document); if (_grammar != null) @@ -46,6 +49,21 @@ namespace AvaloniaEdit.TextMate } } + private void TextView_VisualLinesChanged(object sender, EventArgs e) + { + if (!_textView.VisualLinesValid || _textView.VisualLines.Count == 0) + return; + + _firstVisibleLine = _textView.VisualLines[0].FirstDocumentLine.LineNumber - 1; + _lastVisibleLine = _textView.VisualLines[_textView.VisualLines.Count - 1].LastDocumentLine.LineNumber - 1; + } + + public void Dispose() + { + if (_textView != null) + _textView.VisualLinesChanged -= TextView_VisualLinesChanged; + } + public void SetTheme(Theme theme) { _theme = theme; @@ -90,14 +108,21 @@ namespace AvaloniaEdit.TextMate protected override void TransformLine(DocumentLine line, ITextRunConstructionContext context) { - if (_transformations is { }) - { - var transformsInLine = _transformations.FindOverlappingSegments(line); + int i = line.LineNumber; - foreach (var transform in transformsInLine) - { - transform.Transform(this, line); - } + var tokens = _model.GetLineTokens(i - 1); + + if (tokens == null) + return; + + RemoveLineTransformations(i); + ProcessTokens(i, tokens); + + var transformsInLine = _transformations.FindOverlappingSegments(line); + + foreach (var transform in transformsInLine) + { + transform.Transform(this, line); } } @@ -142,53 +167,33 @@ namespace AvaloniaEdit.TextMate } } - private void ProcessRange(Range range) + public void ModelTokensChanged(ModelTokensChangedEvent e) { - for (int i = range.fromLineNumber; i <= range.toLineNumber; i++) - { - var tokens = _model.GetLineTokens(i - 1); + if (e.ranges == null) + return; - if (tokens == null) - continue; + if (_model.IsStopped) + return; - RemoveLineTransformations(i); - ProcessTokens(i, tokens); - } - } + bool redraw = false; - public void ModelTokensChanged(ModelTokensChangedEvent e) - { - var ranges = e.ranges.ToArray(); - - Dispatcher.UIThread.Post(() => + foreach (var range in e.ranges) { - if (_model.IsStopped) - return; - - foreach (var range in ranges) + if (range.fromLineNumber >= _firstVisibleLine || range.toLineNumber >= _firstVisibleLine || + range.fromLineNumber <= _lastVisibleLine || range.toLineNumber <= _lastVisibleLine) { - if (!IsValidRange(range, _document.LineCount)) - continue; - - ProcessRange(range); - - var startLine = _document.GetLineByNumber(range.fromLineNumber); - var endLine = _document.GetLineByNumber(range.toLineNumber); - - _textView.Redraw(startLine.Offset, endLine.EndOffset - startLine.Offset); + redraw = true; + break; } - }); - } - - static bool IsValidRange(Range range, int lineCount) - { - if (range.fromLineNumber < 0 || range.fromLineNumber > lineCount) - return false; + } - if (range.toLineNumber < 0 || range.toLineNumber > lineCount) - return false; + if (!redraw) + return; - return true; + Dispatcher.UIThread.Post(() => + { + _textView.Redraw(); + }, DispatcherPriority.Render - 1); } } } \ No newline at end of file
54
Improve TM perf
49
.cs
TextMate/TextMateColoringTransformer
mit
AvaloniaUI/AvaloniaEdit
10058197
<NME> jsgrid.field.tests.js <BEF> $(function() { var Grid = jsGrid.Grid; module("common field config", { setup: function() { this.isFieldExcluded = function(FieldClass) { return FieldClass === jsGrid.ControlField; }; } }); test("filtering=false prevents rendering filter template", function() { var isFieldExcluded = this.isFieldExcluded; $.each(jsGrid.fields, function(name, FieldClass) { if(isFieldExcluded(FieldClass)) return; var field = new FieldClass({ filtering: false }); equal(field.filterTemplate(), "", "empty filter template for field " + name); }); }); test("inserting=false prevents rendering insert template", function() { var isFieldExcluded = this.isFieldExcluded; $.each(jsGrid.fields, function(name, FieldClass) { if(isFieldExcluded(FieldClass)) return; var field = new FieldClass({ inserting: false }); equal(field.insertTemplate(), "", "empty insert template for field " + name); }); }); test("editing=false renders itemTemplate", function() { var isFieldExcluded = this.isFieldExcluded; $.each(jsGrid.fields, function(name, FieldClass) { if(isFieldExcluded(FieldClass)) return; var field = new FieldClass({ editing: false }); var editTemplate = field.editTemplate("test"); var itemTemplate = field.itemTemplate("test"); var editTemplateContent = editTemplate instanceof jQuery ? editTemplate[0].outerHTML : editTemplate; var itemTemplateContent = itemTemplate instanceof jQuery ? itemTemplate[0].outerHTML : itemTemplate; equal(editTemplateContent, itemTemplateContent, "item template is rendered instead of edit template for field " + name); }); }); module("jsGrid.field"); test("basic", function() { var customSortingFunc = function() { return 1; }, field = new jsGrid.Field({ name: "testField", title: "testTitle", sorter: customSortingFunc }); equal(field.headerTemplate(), "testTitle"); equal(field.itemTemplate("testValue"), "testValue"); equal(field.filterTemplate(), ""); equal(field.insertTemplate(), ""); equal(field.editTemplate("testValue"), "testValue"); strictEqual(field.filterValue(), ""); strictEqual(field.insertValue(), ""); strictEqual(field.editValue(), "testValue"); strictEqual(field.sortingFunc, customSortingFunc); }); module("jsGrid.field.text"); test("basic", function() { var field = new jsGrid.TextField({ name: "testField" }); equal(field.itemTemplate("testValue"), "testValue"); equal(field.filterTemplate()[0].tagName.toLowerCase(), "input"); equal(field.insertTemplate()[0].tagName.toLowerCase(), "input"); equal(field.editTemplate("testEditValue")[0].tagName.toLowerCase(), "input"); strictEqual(field.filterValue(), ""); strictEqual(field.insertValue(), ""); strictEqual(field.editValue(), "testEditValue"); }); test("set default field options with setDefaults", function() { jsGrid.setDefaults("text", { defaultOption: "test" }); var $element = $("#jsGrid").jsGrid({ fields: [{ type: "text" }] }); equal($element.jsGrid("option", "fields")[0].defaultOption, "test", "default field option set"); }); module("jsGrid.field.number"); test("basic", function() { var field = new jsGrid.NumberField({ name: "testField" }); equal(field.itemTemplate(5), "5"); equal(field.filterTemplate()[0].tagName.toLowerCase(), "input"); equal(field.insertTemplate()[0].tagName.toLowerCase(), "input"); equal(field.editTemplate(6)[0].tagName.toLowerCase(), "input"); strictEqual(field.filterValue(), undefined); strictEqual(field.insertValue(), undefined); strictEqual(field.editValue(), 6); }); module("jsGrid.field.textArea"); test("basic", function() { var field = new jsGrid.TextAreaField({ name: "testField" }); equal(field.itemTemplate("testValue"), "testValue"); equal(field.filterTemplate()[0].tagName.toLowerCase(), "input"); equal(field.insertTemplate()[0].tagName.toLowerCase(), "textarea"); equal(field.editTemplate("testEditValue")[0].tagName.toLowerCase(), "textarea"); strictEqual(field.insertValue(), ""); strictEqual(field.editValue(), "testEditValue"); }); module("jsGrid.field.checkbox"); test("basic", function() { var field = new jsGrid.CheckboxField({ name: "testField" }), itemTemplate, filterTemplate, insertTemplate, editTemplate; itemTemplate = field.itemTemplate("testValue"); equal(itemTemplate[0].tagName.toLowerCase(), "input"); equal(itemTemplate.attr("type"), "checkbox"); equal(itemTemplate.attr("disabled"), "disabled"); filterTemplate = field.filterTemplate(); equal(filterTemplate[0].tagName.toLowerCase(), "input"); equal(filterTemplate.attr("type"), "checkbox"); equal(filterTemplate.prop("indeterminate"), true); insertTemplate = field.insertTemplate(); equal(insertTemplate[0].tagName.toLowerCase(), "input"); equal(insertTemplate.attr("type"), "checkbox"); editTemplate = field.editTemplate(true); equal(editTemplate[0].tagName.toLowerCase(), "input"); equal(editTemplate.attr("type"), "checkbox"); equal(editTemplate.is(":checked"), true); strictEqual(field.filterValue(), undefined); strictEqual(field.insertValue(), false); strictEqual(field.editValue(), true); }); module("jsGrid.field.select"); test("basic", function() { var field, filterTemplate, insertTemplate, editTemplate; field = new jsGrid.SelectField({ name: "testField", items: ["test1", "test2", "test3"], selectedIndex: 1 }); equal(field.itemTemplate(1), "test2"); filterTemplate = field.filterTemplate(); equal(filterTemplate[0].tagName.toLowerCase(), "select"); equal(filterTemplate.children().length, 3); insertTemplate = field.insertTemplate(); equal(insertTemplate[0].tagName.toLowerCase(), "select"); equal(insertTemplate.children().length, 3); editTemplate = field.editTemplate(2); equal(editTemplate[0].tagName.toLowerCase(), "select"); equal(editTemplate.find("option:selected").length, 1); ok(editTemplate.children().eq(2).is(":selected")); strictEqual(field.filterValue(), 1); strictEqual(field.insertValue(), 1); strictEqual(field.editValue(), 2); }); test("items as array of integers", function() { var field, filterTemplate, insertTemplate, editTemplate; field = new jsGrid.SelectField({ name: "testField", items: [0, 10, 20], selectedIndex: 0 }); strictEqual(field.itemTemplate(0), 0); filterTemplate = field.filterTemplate(); equal(filterTemplate[0].tagName.toLowerCase(), "select"); equal(filterTemplate.children().length, 3); insertTemplate = field.insertTemplate(); equal(insertTemplate[0].tagName.toLowerCase(), "select"); equal(insertTemplate.children().length, 3); editTemplate = field.editTemplate(1); equal(editTemplate[0].tagName.toLowerCase(), "select"); equal(editTemplate.find("option:selected").length, 1); ok(editTemplate.children().eq(1).is(":selected")); strictEqual(field.filterValue(), 0); strictEqual(field.insertValue(), 0); strictEqual(field.editValue(), 1); }); test("string value type", function() { var field = new jsGrid.SelectField({ name: "testField", items: [ { text: "test1", value: "1" }, { text: "test2", value: "2" }, { text: "test3", value: "3" } ], textField: "text", valueField: "value", valueType: "string", selectedIndex: 1 }); field.filterTemplate(); strictEqual(field.filterValue(), "2"); field.editTemplate("2"); strictEqual(field.editValue(), "2"); field.insertTemplate(); strictEqual(field.insertValue(), "2"); }); test("value type auto-defined", function() { var field = new jsGrid.SelectField({ name: "testField", items: [ { text: "test1", value: "1" }, { text: "test2", value: "2" }, { text: "test3", value: "3" } ], textField: "text", valueField: "value", selectedIndex: 1 }); strictEqual(field.sorter, "string", "sorter set according to value type"); field.filterTemplate(); strictEqual(field.filterValue(), "2"); field.editTemplate("2"); strictEqual(field.editValue(), "2"); field.insertTemplate(); strictEqual(field.insertValue(), "2"); }); test("value type defaulted to string", function() { var field = new jsGrid.SelectField({ name: "testField", items: [ { text: "test1" }, { text: "test2", value: "2" } ], textField: "text", valueField: "value" }); strictEqual(field.sorter, "string", "sorter set to string if first item has no value field"); }); test("object items", function() { var field = new jsGrid.SelectField({ name: "testField", items: [ { text: "test1", value: 1 }, { text: "test2", value: 2 }, { text: "test3", value: 3 } ] }); strictEqual(field.itemTemplate(1), field.items[1]); field.textField = "text"; strictEqual(field.itemTemplate(1), "test2"); field.textField = ""; field.valueField = "value"; strictEqual(field.itemTemplate(1), field.items[0]); ok(field.editTemplate(2)); strictEqual(field.editValue(), 2); field.textField = "text"; strictEqual(field.itemTemplate(1), "test1"); }); module("jsGrid.field.control"); test("basic", function() { var field, itemTemplate, headerTemplate, filterTemplate, insertTemplate, editTemplate; field = new jsGrid.ControlField(); field._grid = { filtering: true, inserting: true, option: $.noop }; itemTemplate = field.itemTemplate("any_value"); equal(itemTemplate.filter("." + field.editButtonClass).length, 1); equal(itemTemplate.filter("." + field.deleteButtonClass).length, 1); headerTemplate = field.headerTemplate(); equal(headerTemplate.filter("." + field.insertModeButtonClass).length, 1); var $modeSwitchButton = headerTemplate.filter("." + field.modeButtonClass); $modeSwitchButton.trigger("click"); equal(headerTemplate.filter("." + field.searchModeButtonClass).length, 1); filterTemplate = field.filterTemplate(); equal(filterTemplate.filter("." + field.searchButtonClass).length, 1); equal(filterTemplate.filter("." + field.clearFilterButtonClass).length, 1); insertTemplate = field.insertTemplate(); equal(insertTemplate.filter("." + field.insertButtonClass).length, 1); editTemplate = field.editTemplate("any_value"); equal(editTemplate.filter("." + field.updateButtonClass).length, 1); equal(editTemplate.filter("." + field.cancelEditButtonClass).length, 1); strictEqual(field.filterValue(), ""); strictEqual(field.insertValue(), ""); strictEqual(field.editValue(), ""); }); test("switchMode button should consider filtering=false", function() { var optionArgs = {}; var field = new jsGrid.ControlField(); field._grid = { filtering: false, inserting: true, option: function(name, value) { optionArgs = { name: name, value: value }; } }; var headerTemplate = field.headerTemplate(); equal(headerTemplate.filter("." + field.insertModeButtonClass).length, 1, "inserting switch button rendered"); var $modeSwitchButton = headerTemplate.filter("." + field.modeButtonClass); $modeSwitchButton.trigger("click"); ok($modeSwitchButton.hasClass(field.modeOnButtonClass), "on class is attached"); equal(headerTemplate.filter("." + field.insertModeButtonClass).length, 1, "insert button rendered"); equal(headerTemplate.filter("." + field.searchModeButtonClass).length, 0, "search button not rendered"); deepEqual(optionArgs, { name: "inserting", value: true }, "turn on grid inserting mode"); $modeSwitchButton.trigger("click"); ok(!$modeSwitchButton.hasClass(field.modeOnButtonClass), "on class is detached"); deepEqual(optionArgs, { name: "inserting", value: false }, "turn off grid inserting mode"); }); test("switchMode button should consider inserting=false", function() { var optionArgs = {}; var field = new jsGrid.ControlField(); field._grid = { filtering: true, inserting: false, option: function(name, value) { optionArgs = { name: name, value: value }; } }; var headerTemplate = field.headerTemplate(); equal(headerTemplate.filter("." + field.searchModeButtonClass).length, 1, "filtering switch button rendered"); var $modeSwitchButton = headerTemplate.filter("." + field.modeButtonClass); $modeSwitchButton.trigger("click"); ok(!$modeSwitchButton.hasClass(field.modeOnButtonClass), "on class is detached"); equal(headerTemplate.filter("." + field.searchModeButtonClass).length, 1, "search button rendered"); equal(headerTemplate.filter("." + field.insertModeButtonClass).length, 0, "insert button not rendered"); deepEqual(optionArgs, { name: "filtering", value: false }, "turn off grid filtering mode"); $modeSwitchButton.trigger("click"); ok($modeSwitchButton.hasClass(field.modeOnButtonClass), "on class is attached"); deepEqual(optionArgs, { name: "filtering", value: true }, "turn on grid filtering mode"); }); test("switchMode is not rendered if inserting=false and filtering=false", function() { var optionArgs = {}; var field = new jsGrid.ControlField(); field._grid = { filtering: false, inserting: false }; var headerTemplate = field.headerTemplate(); strictEqual(headerTemplate, "", "empty header"); }); }); <MSG> Fields: Fix rendering itemTemplate instead of editTemplate when editing is disabled Fixes #466 <DFF> @@ -43,15 +43,29 @@ $(function() { if(isFieldExcluded(FieldClass)) return; - var field = new FieldClass({ editing: false }); + var item = { + field: "test" + }; + var args; + + var field = new FieldClass({ + editing: false, + itemTemplate: function() { + args = arguments; + FieldClass.prototype.itemTemplate.apply(this, arguments); + } + }); - var editTemplate = field.editTemplate("test"); - var itemTemplate = field.itemTemplate("test"); + var itemTemplate = field.itemTemplate("test", item); + var editTemplate = field.editTemplate("test", item); var editTemplateContent = editTemplate instanceof jQuery ? editTemplate[0].outerHTML : editTemplate; var itemTemplateContent = itemTemplate instanceof jQuery ? itemTemplate[0].outerHTML : itemTemplate; - equal(editTemplateContent, itemTemplateContent, "item template is rendered instead of edit template for field " + name); + equal(editTemplateContent, itemTemplateContent, "item template is rendered instead of edit template for " + name); + equal(args.length, 2, "passed both arguments for " + name); + equal(args[0], "test", "field value passed as a first argument for " + name); + equal(args[1], item, "item passed as a second argument for " + name); }); });
18
Fields: Fix rendering itemTemplate instead of editTemplate when editing is disabled
4
.js
field
mit
tabalinas/jsgrid
10058198
<NME> jsgrid.field.tests.js <BEF> $(function() { var Grid = jsGrid.Grid; module("common field config", { setup: function() { this.isFieldExcluded = function(FieldClass) { return FieldClass === jsGrid.ControlField; }; } }); test("filtering=false prevents rendering filter template", function() { var isFieldExcluded = this.isFieldExcluded; $.each(jsGrid.fields, function(name, FieldClass) { if(isFieldExcluded(FieldClass)) return; var field = new FieldClass({ filtering: false }); equal(field.filterTemplate(), "", "empty filter template for field " + name); }); }); test("inserting=false prevents rendering insert template", function() { var isFieldExcluded = this.isFieldExcluded; $.each(jsGrid.fields, function(name, FieldClass) { if(isFieldExcluded(FieldClass)) return; var field = new FieldClass({ inserting: false }); equal(field.insertTemplate(), "", "empty insert template for field " + name); }); }); test("editing=false renders itemTemplate", function() { var isFieldExcluded = this.isFieldExcluded; $.each(jsGrid.fields, function(name, FieldClass) { if(isFieldExcluded(FieldClass)) return; var field = new FieldClass({ editing: false }); var editTemplate = field.editTemplate("test"); var itemTemplate = field.itemTemplate("test"); var editTemplateContent = editTemplate instanceof jQuery ? editTemplate[0].outerHTML : editTemplate; var itemTemplateContent = itemTemplate instanceof jQuery ? itemTemplate[0].outerHTML : itemTemplate; equal(editTemplateContent, itemTemplateContent, "item template is rendered instead of edit template for field " + name); }); }); module("jsGrid.field"); test("basic", function() { var customSortingFunc = function() { return 1; }, field = new jsGrid.Field({ name: "testField", title: "testTitle", sorter: customSortingFunc }); equal(field.headerTemplate(), "testTitle"); equal(field.itemTemplate("testValue"), "testValue"); equal(field.filterTemplate(), ""); equal(field.insertTemplate(), ""); equal(field.editTemplate("testValue"), "testValue"); strictEqual(field.filterValue(), ""); strictEqual(field.insertValue(), ""); strictEqual(field.editValue(), "testValue"); strictEqual(field.sortingFunc, customSortingFunc); }); module("jsGrid.field.text"); test("basic", function() { var field = new jsGrid.TextField({ name: "testField" }); equal(field.itemTemplate("testValue"), "testValue"); equal(field.filterTemplate()[0].tagName.toLowerCase(), "input"); equal(field.insertTemplate()[0].tagName.toLowerCase(), "input"); equal(field.editTemplate("testEditValue")[0].tagName.toLowerCase(), "input"); strictEqual(field.filterValue(), ""); strictEqual(field.insertValue(), ""); strictEqual(field.editValue(), "testEditValue"); }); test("set default field options with setDefaults", function() { jsGrid.setDefaults("text", { defaultOption: "test" }); var $element = $("#jsGrid").jsGrid({ fields: [{ type: "text" }] }); equal($element.jsGrid("option", "fields")[0].defaultOption, "test", "default field option set"); }); module("jsGrid.field.number"); test("basic", function() { var field = new jsGrid.NumberField({ name: "testField" }); equal(field.itemTemplate(5), "5"); equal(field.filterTemplate()[0].tagName.toLowerCase(), "input"); equal(field.insertTemplate()[0].tagName.toLowerCase(), "input"); equal(field.editTemplate(6)[0].tagName.toLowerCase(), "input"); strictEqual(field.filterValue(), undefined); strictEqual(field.insertValue(), undefined); strictEqual(field.editValue(), 6); }); module("jsGrid.field.textArea"); test("basic", function() { var field = new jsGrid.TextAreaField({ name: "testField" }); equal(field.itemTemplate("testValue"), "testValue"); equal(field.filterTemplate()[0].tagName.toLowerCase(), "input"); equal(field.insertTemplate()[0].tagName.toLowerCase(), "textarea"); equal(field.editTemplate("testEditValue")[0].tagName.toLowerCase(), "textarea"); strictEqual(field.insertValue(), ""); strictEqual(field.editValue(), "testEditValue"); }); module("jsGrid.field.checkbox"); test("basic", function() { var field = new jsGrid.CheckboxField({ name: "testField" }), itemTemplate, filterTemplate, insertTemplate, editTemplate; itemTemplate = field.itemTemplate("testValue"); equal(itemTemplate[0].tagName.toLowerCase(), "input"); equal(itemTemplate.attr("type"), "checkbox"); equal(itemTemplate.attr("disabled"), "disabled"); filterTemplate = field.filterTemplate(); equal(filterTemplate[0].tagName.toLowerCase(), "input"); equal(filterTemplate.attr("type"), "checkbox"); equal(filterTemplate.prop("indeterminate"), true); insertTemplate = field.insertTemplate(); equal(insertTemplate[0].tagName.toLowerCase(), "input"); equal(insertTemplate.attr("type"), "checkbox"); editTemplate = field.editTemplate(true); equal(editTemplate[0].tagName.toLowerCase(), "input"); equal(editTemplate.attr("type"), "checkbox"); equal(editTemplate.is(":checked"), true); strictEqual(field.filterValue(), undefined); strictEqual(field.insertValue(), false); strictEqual(field.editValue(), true); }); module("jsGrid.field.select"); test("basic", function() { var field, filterTemplate, insertTemplate, editTemplate; field = new jsGrid.SelectField({ name: "testField", items: ["test1", "test2", "test3"], selectedIndex: 1 }); equal(field.itemTemplate(1), "test2"); filterTemplate = field.filterTemplate(); equal(filterTemplate[0].tagName.toLowerCase(), "select"); equal(filterTemplate.children().length, 3); insertTemplate = field.insertTemplate(); equal(insertTemplate[0].tagName.toLowerCase(), "select"); equal(insertTemplate.children().length, 3); editTemplate = field.editTemplate(2); equal(editTemplate[0].tagName.toLowerCase(), "select"); equal(editTemplate.find("option:selected").length, 1); ok(editTemplate.children().eq(2).is(":selected")); strictEqual(field.filterValue(), 1); strictEqual(field.insertValue(), 1); strictEqual(field.editValue(), 2); }); test("items as array of integers", function() { var field, filterTemplate, insertTemplate, editTemplate; field = new jsGrid.SelectField({ name: "testField", items: [0, 10, 20], selectedIndex: 0 }); strictEqual(field.itemTemplate(0), 0); filterTemplate = field.filterTemplate(); equal(filterTemplate[0].tagName.toLowerCase(), "select"); equal(filterTemplate.children().length, 3); insertTemplate = field.insertTemplate(); equal(insertTemplate[0].tagName.toLowerCase(), "select"); equal(insertTemplate.children().length, 3); editTemplate = field.editTemplate(1); equal(editTemplate[0].tagName.toLowerCase(), "select"); equal(editTemplate.find("option:selected").length, 1); ok(editTemplate.children().eq(1).is(":selected")); strictEqual(field.filterValue(), 0); strictEqual(field.insertValue(), 0); strictEqual(field.editValue(), 1); }); test("string value type", function() { var field = new jsGrid.SelectField({ name: "testField", items: [ { text: "test1", value: "1" }, { text: "test2", value: "2" }, { text: "test3", value: "3" } ], textField: "text", valueField: "value", valueType: "string", selectedIndex: 1 }); field.filterTemplate(); strictEqual(field.filterValue(), "2"); field.editTemplate("2"); strictEqual(field.editValue(), "2"); field.insertTemplate(); strictEqual(field.insertValue(), "2"); }); test("value type auto-defined", function() { var field = new jsGrid.SelectField({ name: "testField", items: [ { text: "test1", value: "1" }, { text: "test2", value: "2" }, { text: "test3", value: "3" } ], textField: "text", valueField: "value", selectedIndex: 1 }); strictEqual(field.sorter, "string", "sorter set according to value type"); field.filterTemplate(); strictEqual(field.filterValue(), "2"); field.editTemplate("2"); strictEqual(field.editValue(), "2"); field.insertTemplate(); strictEqual(field.insertValue(), "2"); }); test("value type defaulted to string", function() { var field = new jsGrid.SelectField({ name: "testField", items: [ { text: "test1" }, { text: "test2", value: "2" } ], textField: "text", valueField: "value" }); strictEqual(field.sorter, "string", "sorter set to string if first item has no value field"); }); test("object items", function() { var field = new jsGrid.SelectField({ name: "testField", items: [ { text: "test1", value: 1 }, { text: "test2", value: 2 }, { text: "test3", value: 3 } ] }); strictEqual(field.itemTemplate(1), field.items[1]); field.textField = "text"; strictEqual(field.itemTemplate(1), "test2"); field.textField = ""; field.valueField = "value"; strictEqual(field.itemTemplate(1), field.items[0]); ok(field.editTemplate(2)); strictEqual(field.editValue(), 2); field.textField = "text"; strictEqual(field.itemTemplate(1), "test1"); }); module("jsGrid.field.control"); test("basic", function() { var field, itemTemplate, headerTemplate, filterTemplate, insertTemplate, editTemplate; field = new jsGrid.ControlField(); field._grid = { filtering: true, inserting: true, option: $.noop }; itemTemplate = field.itemTemplate("any_value"); equal(itemTemplate.filter("." + field.editButtonClass).length, 1); equal(itemTemplate.filter("." + field.deleteButtonClass).length, 1); headerTemplate = field.headerTemplate(); equal(headerTemplate.filter("." + field.insertModeButtonClass).length, 1); var $modeSwitchButton = headerTemplate.filter("." + field.modeButtonClass); $modeSwitchButton.trigger("click"); equal(headerTemplate.filter("." + field.searchModeButtonClass).length, 1); filterTemplate = field.filterTemplate(); equal(filterTemplate.filter("." + field.searchButtonClass).length, 1); equal(filterTemplate.filter("." + field.clearFilterButtonClass).length, 1); insertTemplate = field.insertTemplate(); equal(insertTemplate.filter("." + field.insertButtonClass).length, 1); editTemplate = field.editTemplate("any_value"); equal(editTemplate.filter("." + field.updateButtonClass).length, 1); equal(editTemplate.filter("." + field.cancelEditButtonClass).length, 1); strictEqual(field.filterValue(), ""); strictEqual(field.insertValue(), ""); strictEqual(field.editValue(), ""); }); test("switchMode button should consider filtering=false", function() { var optionArgs = {}; var field = new jsGrid.ControlField(); field._grid = { filtering: false, inserting: true, option: function(name, value) { optionArgs = { name: name, value: value }; } }; var headerTemplate = field.headerTemplate(); equal(headerTemplate.filter("." + field.insertModeButtonClass).length, 1, "inserting switch button rendered"); var $modeSwitchButton = headerTemplate.filter("." + field.modeButtonClass); $modeSwitchButton.trigger("click"); ok($modeSwitchButton.hasClass(field.modeOnButtonClass), "on class is attached"); equal(headerTemplate.filter("." + field.insertModeButtonClass).length, 1, "insert button rendered"); equal(headerTemplate.filter("." + field.searchModeButtonClass).length, 0, "search button not rendered"); deepEqual(optionArgs, { name: "inserting", value: true }, "turn on grid inserting mode"); $modeSwitchButton.trigger("click"); ok(!$modeSwitchButton.hasClass(field.modeOnButtonClass), "on class is detached"); deepEqual(optionArgs, { name: "inserting", value: false }, "turn off grid inserting mode"); }); test("switchMode button should consider inserting=false", function() { var optionArgs = {}; var field = new jsGrid.ControlField(); field._grid = { filtering: true, inserting: false, option: function(name, value) { optionArgs = { name: name, value: value }; } }; var headerTemplate = field.headerTemplate(); equal(headerTemplate.filter("." + field.searchModeButtonClass).length, 1, "filtering switch button rendered"); var $modeSwitchButton = headerTemplate.filter("." + field.modeButtonClass); $modeSwitchButton.trigger("click"); ok(!$modeSwitchButton.hasClass(field.modeOnButtonClass), "on class is detached"); equal(headerTemplate.filter("." + field.searchModeButtonClass).length, 1, "search button rendered"); equal(headerTemplate.filter("." + field.insertModeButtonClass).length, 0, "insert button not rendered"); deepEqual(optionArgs, { name: "filtering", value: false }, "turn off grid filtering mode"); $modeSwitchButton.trigger("click"); ok($modeSwitchButton.hasClass(field.modeOnButtonClass), "on class is attached"); deepEqual(optionArgs, { name: "filtering", value: true }, "turn on grid filtering mode"); }); test("switchMode is not rendered if inserting=false and filtering=false", function() { var optionArgs = {}; var field = new jsGrid.ControlField(); field._grid = { filtering: false, inserting: false }; var headerTemplate = field.headerTemplate(); strictEqual(headerTemplate, "", "empty header"); }); }); <MSG> Fields: Fix rendering itemTemplate instead of editTemplate when editing is disabled Fixes #466 <DFF> @@ -43,15 +43,29 @@ $(function() { if(isFieldExcluded(FieldClass)) return; - var field = new FieldClass({ editing: false }); + var item = { + field: "test" + }; + var args; + + var field = new FieldClass({ + editing: false, + itemTemplate: function() { + args = arguments; + FieldClass.prototype.itemTemplate.apply(this, arguments); + } + }); - var editTemplate = field.editTemplate("test"); - var itemTemplate = field.itemTemplate("test"); + var itemTemplate = field.itemTemplate("test", item); + var editTemplate = field.editTemplate("test", item); var editTemplateContent = editTemplate instanceof jQuery ? editTemplate[0].outerHTML : editTemplate; var itemTemplateContent = itemTemplate instanceof jQuery ? itemTemplate[0].outerHTML : itemTemplate; - equal(editTemplateContent, itemTemplateContent, "item template is rendered instead of edit template for field " + name); + equal(editTemplateContent, itemTemplateContent, "item template is rendered instead of edit template for " + name); + equal(args.length, 2, "passed both arguments for " + name); + equal(args[0], "test", "field value passed as a first argument for " + name); + equal(args[1], item, "item passed as a second argument for " + name); }); });
18
Fields: Fix rendering itemTemplate instead of editTemplate when editing is disabled
4
.js
field
mit
tabalinas/jsgrid
10058199
<NME> module.toJSON.js <BEF> var assert = buster.assertions.assert; buster.testCase('View#toJSON()', { var apple = new Apple(); var json = apple.toJSON(); expect(json.fmid).toBeTruthy(); }); test("Should fire `tojson` event", function() { var apple = new Apple(); var spy = jest.fn(); apple.on('tojson', spy); apple.toJSON(); expect(spy).toHaveBeenCalled(); }); test("Should be able to manipulate json output via `tojson` event", function() { var apple = new Apple(); apple.on('tojson', function(json) { json.test = 'data'; }); var json = apple.toJSON(); expect(json.test).toEqual('data'); }); test("Should be able to inflate the output", function() { var sandbox = helpers.createSandbox(); var layout = new Layout({ children: { 1: { module: 'apple' } } }); layout .render() .inject(sandbox) .setup(); var layoutEl = layout.el; var appleEl = layout.module('apple').el; var json = layout.toJSON(); var inflated = fruitmachine(json); inflated.setup(); var layoutElInflated = inflated.el; var appleElInflated = inflated.module('apple').el; expect(layoutEl).toEqual(layoutElInflated); expect(appleEl).toEqual(appleElInflated); }); }); <MSG> Updated deprecated prop <DFF> @@ -1,4 +1,4 @@ -var assert = buster.assertions.assert; +var assert = buster.referee.assert; buster.testCase('View#toJSON()', {
1
Updated deprecated prop
1
.js
toJSON
mit
ftlabs/fruitmachine
10058200
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard1.3</TargetFramework> </PropertyGroup> <ItemGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> </ItemGroup> </Project> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to netstandard2.0 in order to support upcoming avalonia release. <DFF> @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard1.3</TargetFramework> + <TargetFramework>netstandard2.0</TargetFramework> </PropertyGroup> <ItemGroup> @@ -11,7 +11,7 @@ <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.2-build3791-alpha" /> </ItemGroup> </Project> \ No newline at end of file
2
update to netstandard2.0 in order to support upcoming avalonia release.
2
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058201
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard1.3</TargetFramework> </PropertyGroup> <ItemGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> </ItemGroup> </Project> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to netstandard2.0 in order to support upcoming avalonia release. <DFF> @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard1.3</TargetFramework> + <TargetFramework>netstandard2.0</TargetFramework> </PropertyGroup> <ItemGroup> @@ -11,7 +11,7 @@ <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.2-build3791-alpha" /> </ItemGroup> </Project> \ No newline at end of file
2
update to netstandard2.0 in order to support upcoming avalonia release.
2
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058202
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard1.3</TargetFramework> </PropertyGroup> <ItemGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> </ItemGroup> </Project> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to netstandard2.0 in order to support upcoming avalonia release. <DFF> @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard1.3</TargetFramework> + <TargetFramework>netstandard2.0</TargetFramework> </PropertyGroup> <ItemGroup> @@ -11,7 +11,7 @@ <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.2-build3791-alpha" /> </ItemGroup> </Project> \ No newline at end of file
2
update to netstandard2.0 in order to support upcoming avalonia release.
2
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058203
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard1.3</TargetFramework> </PropertyGroup> <ItemGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> </ItemGroup> </Project> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to netstandard2.0 in order to support upcoming avalonia release. <DFF> @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard1.3</TargetFramework> + <TargetFramework>netstandard2.0</TargetFramework> </PropertyGroup> <ItemGroup> @@ -11,7 +11,7 @@ <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.2-build3791-alpha" /> </ItemGroup> </Project> \ No newline at end of file
2
update to netstandard2.0 in order to support upcoming avalonia release.
2
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058204
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard1.3</TargetFramework> </PropertyGroup> <ItemGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> </ItemGroup> </Project> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to netstandard2.0 in order to support upcoming avalonia release. <DFF> @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard1.3</TargetFramework> + <TargetFramework>netstandard2.0</TargetFramework> </PropertyGroup> <ItemGroup> @@ -11,7 +11,7 @@ <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.2-build3791-alpha" /> </ItemGroup> </Project> \ No newline at end of file
2
update to netstandard2.0 in order to support upcoming avalonia release.
2
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058205
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard1.3</TargetFramework> </PropertyGroup> <ItemGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> </ItemGroup> </Project> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to netstandard2.0 in order to support upcoming avalonia release. <DFF> @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard1.3</TargetFramework> + <TargetFramework>netstandard2.0</TargetFramework> </PropertyGroup> <ItemGroup> @@ -11,7 +11,7 @@ <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.2-build3791-alpha" /> </ItemGroup> </Project> \ No newline at end of file
2
update to netstandard2.0 in order to support upcoming avalonia release.
2
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058206
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard1.3</TargetFramework> </PropertyGroup> <ItemGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> </ItemGroup> </Project> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to netstandard2.0 in order to support upcoming avalonia release. <DFF> @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard1.3</TargetFramework> + <TargetFramework>netstandard2.0</TargetFramework> </PropertyGroup> <ItemGroup> @@ -11,7 +11,7 @@ <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.2-build3791-alpha" /> </ItemGroup> </Project> \ No newline at end of file
2
update to netstandard2.0 in order to support upcoming avalonia release.
2
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058207
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard1.3</TargetFramework> </PropertyGroup> <ItemGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> </ItemGroup> </Project> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to netstandard2.0 in order to support upcoming avalonia release. <DFF> @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard1.3</TargetFramework> + <TargetFramework>netstandard2.0</TargetFramework> </PropertyGroup> <ItemGroup> @@ -11,7 +11,7 @@ <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.2-build3791-alpha" /> </ItemGroup> </Project> \ No newline at end of file
2
update to netstandard2.0 in order to support upcoming avalonia release.
2
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058208
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard1.3</TargetFramework> </PropertyGroup> <ItemGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> </ItemGroup> </Project> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to netstandard2.0 in order to support upcoming avalonia release. <DFF> @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard1.3</TargetFramework> + <TargetFramework>netstandard2.0</TargetFramework> </PropertyGroup> <ItemGroup> @@ -11,7 +11,7 @@ <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.2-build3791-alpha" /> </ItemGroup> </Project> \ No newline at end of file
2
update to netstandard2.0 in order to support upcoming avalonia release.
2
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058209
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard1.3</TargetFramework> </PropertyGroup> <ItemGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> </ItemGroup> </Project> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to netstandard2.0 in order to support upcoming avalonia release. <DFF> @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard1.3</TargetFramework> + <TargetFramework>netstandard2.0</TargetFramework> </PropertyGroup> <ItemGroup> @@ -11,7 +11,7 @@ <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.2-build3791-alpha" /> </ItemGroup> </Project> \ No newline at end of file
2
update to netstandard2.0 in order to support upcoming avalonia release.
2
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058210
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard1.3</TargetFramework> </PropertyGroup> <ItemGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> </ItemGroup> </Project> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to netstandard2.0 in order to support upcoming avalonia release. <DFF> @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard1.3</TargetFramework> + <TargetFramework>netstandard2.0</TargetFramework> </PropertyGroup> <ItemGroup> @@ -11,7 +11,7 @@ <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.2-build3791-alpha" /> </ItemGroup> </Project> \ No newline at end of file
2
update to netstandard2.0 in order to support upcoming avalonia release.
2
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058211
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard1.3</TargetFramework> </PropertyGroup> <ItemGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> </ItemGroup> </Project> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to netstandard2.0 in order to support upcoming avalonia release. <DFF> @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard1.3</TargetFramework> + <TargetFramework>netstandard2.0</TargetFramework> </PropertyGroup> <ItemGroup> @@ -11,7 +11,7 @@ <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.2-build3791-alpha" /> </ItemGroup> </Project> \ No newline at end of file
2
update to netstandard2.0 in order to support upcoming avalonia release.
2
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058212
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard1.3</TargetFramework> </PropertyGroup> <ItemGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> </ItemGroup> </Project> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to netstandard2.0 in order to support upcoming avalonia release. <DFF> @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard1.3</TargetFramework> + <TargetFramework>netstandard2.0</TargetFramework> </PropertyGroup> <ItemGroup> @@ -11,7 +11,7 @@ <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.2-build3791-alpha" /> </ItemGroup> </Project> \ No newline at end of file
2
update to netstandard2.0 in order to support upcoming avalonia release.
2
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058213
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard1.3</TargetFramework> </PropertyGroup> <ItemGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> </ItemGroup> </Project> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to netstandard2.0 in order to support upcoming avalonia release. <DFF> @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard1.3</TargetFramework> + <TargetFramework>netstandard2.0</TargetFramework> </PropertyGroup> <ItemGroup> @@ -11,7 +11,7 @@ <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.2-build3791-alpha" /> </ItemGroup> </Project> \ No newline at end of file
2
update to netstandard2.0 in order to support upcoming avalonia release.
2
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058214
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard1.3</TargetFramework> </PropertyGroup> <ItemGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> </ItemGroup> </Project> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to netstandard2.0 in order to support upcoming avalonia release. <DFF> @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard1.3</TargetFramework> + <TargetFramework>netstandard2.0</TargetFramework> </PropertyGroup> <ItemGroup> @@ -11,7 +11,7 @@ <ItemGroup> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3595-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.2-build3791-alpha" /> </ItemGroup> </Project> \ No newline at end of file
2
update to netstandard2.0 in order to support upcoming avalonia release.
2
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058215
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> <Version>0.10.0-preview1</Version> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to avalonia preview 5. <DFF> @@ -3,7 +3,7 @@ <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> - <Version>0.10.0-preview1</Version> + <Version>0.10.0-preview5</Version> </PropertyGroup> <ItemGroup>
1
update to avalonia preview 5.
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058216
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> <Version>0.10.0-preview1</Version> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to avalonia preview 5. <DFF> @@ -3,7 +3,7 @@ <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> - <Version>0.10.0-preview1</Version> + <Version>0.10.0-preview5</Version> </PropertyGroup> <ItemGroup>
1
update to avalonia preview 5.
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058217
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> <Version>0.10.0-preview1</Version> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to avalonia preview 5. <DFF> @@ -3,7 +3,7 @@ <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> - <Version>0.10.0-preview1</Version> + <Version>0.10.0-preview5</Version> </PropertyGroup> <ItemGroup>
1
update to avalonia preview 5.
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058218
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> <Version>0.10.0-preview1</Version> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to avalonia preview 5. <DFF> @@ -3,7 +3,7 @@ <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> - <Version>0.10.0-preview1</Version> + <Version>0.10.0-preview5</Version> </PropertyGroup> <ItemGroup>
1
update to avalonia preview 5.
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058219
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> <Version>0.10.0-preview1</Version> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to avalonia preview 5. <DFF> @@ -3,7 +3,7 @@ <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> - <Version>0.10.0-preview1</Version> + <Version>0.10.0-preview5</Version> </PropertyGroup> <ItemGroup>
1
update to avalonia preview 5.
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058220
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> <Version>0.10.0-preview1</Version> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to avalonia preview 5. <DFF> @@ -3,7 +3,7 @@ <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> - <Version>0.10.0-preview1</Version> + <Version>0.10.0-preview5</Version> </PropertyGroup> <ItemGroup>
1
update to avalonia preview 5.
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058221
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> <Version>0.10.0-preview1</Version> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to avalonia preview 5. <DFF> @@ -3,7 +3,7 @@ <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> - <Version>0.10.0-preview1</Version> + <Version>0.10.0-preview5</Version> </PropertyGroup> <ItemGroup>
1
update to avalonia preview 5.
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058222
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> <Version>0.10.0-preview1</Version> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to avalonia preview 5. <DFF> @@ -3,7 +3,7 @@ <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> - <Version>0.10.0-preview1</Version> + <Version>0.10.0-preview5</Version> </PropertyGroup> <ItemGroup>
1
update to avalonia preview 5.
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058223
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> <Version>0.10.0-preview1</Version> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to avalonia preview 5. <DFF> @@ -3,7 +3,7 @@ <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> - <Version>0.10.0-preview1</Version> + <Version>0.10.0-preview5</Version> </PropertyGroup> <ItemGroup>
1
update to avalonia preview 5.
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058224
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> <Version>0.10.0-preview1</Version> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to avalonia preview 5. <DFF> @@ -3,7 +3,7 @@ <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> - <Version>0.10.0-preview1</Version> + <Version>0.10.0-preview5</Version> </PropertyGroup> <ItemGroup>
1
update to avalonia preview 5.
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058225
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> <Version>0.10.0-preview1</Version> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to avalonia preview 5. <DFF> @@ -3,7 +3,7 @@ <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> - <Version>0.10.0-preview1</Version> + <Version>0.10.0-preview5</Version> </PropertyGroup> <ItemGroup>
1
update to avalonia preview 5.
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058226
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> <Version>0.10.0-preview1</Version> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to avalonia preview 5. <DFF> @@ -3,7 +3,7 @@ <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> - <Version>0.10.0-preview1</Version> + <Version>0.10.0-preview5</Version> </PropertyGroup> <ItemGroup>
1
update to avalonia preview 5.
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058227
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> <Version>0.10.0-preview1</Version> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to avalonia preview 5. <DFF> @@ -3,7 +3,7 @@ <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> - <Version>0.10.0-preview1</Version> + <Version>0.10.0-preview5</Version> </PropertyGroup> <ItemGroup>
1
update to avalonia preview 5.
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058228
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> <Version>0.10.0-preview1</Version> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to avalonia preview 5. <DFF> @@ -3,7 +3,7 @@ <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> - <Version>0.10.0-preview1</Version> + <Version>0.10.0-preview5</Version> </PropertyGroup> <ItemGroup>
1
update to avalonia preview 5.
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058229
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> <Version>0.10.0-preview1</Version> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> </ItemGroup> <ItemGroup> <Compile Update="SR.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>SR.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update to avalonia preview 5. <DFF> @@ -3,7 +3,7 @@ <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>612,618</WarningsNotAsErrors> - <Version>0.10.0-preview1</Version> + <Version>0.10.0-preview5</Version> </PropertyGroup> <ItemGroup>
1
update to avalonia preview 5.
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058230
<NME> module.toJSON.js <BEF> buster.testCase('View#toJSON()', { var apple = new Apple(); var json = apple.toJSON(); expect(json.fmid).toBeTruthy(); }); test("Should fire `tojson` event", function() { var apple = new Apple(); var spy = jest.fn(); apple.on('tojson', spy); apple.toJSON(); expect(spy).toHaveBeenCalled(); }); test("Should be able to manipulate json output via `tojson` event", function() { var apple = new Apple(); apple.on('tojson', function(json) { json.test = 'data'; }); var json = apple.toJSON(); expect(json.test).toEqual('data'); }); test("Should be able to inflate the output", function() { var sandbox = helpers.createSandbox(); var layout = new Layout({ children: { 1: { module: 'apple' } } }); layout .render() .inject(sandbox) .setup(); var layoutEl = layout.el; var appleEl = layout.module('apple').el; var json = layout.toJSON(); var inflated = fruitmachine(json); inflated.setup(); var layoutElInflated = inflated.el; var appleElInflated = inflated.module('apple').el; expect(layoutEl).toEqual(layoutElInflated); assert.equals(layoutEl, layoutElInflated); assert.equals(appleEl, appleElInflated); } }); <MSG> Merge pull request #57 from ftlabs/nocompiled Remove built javascript from repo to avoid it getting out of date; link to Browserify CDN for built version <DFF> @@ -1,3 +1,4 @@ +var assert = buster.assertions.assert; buster.testCase('View#toJSON()', { @@ -56,4 +57,4 @@ buster.testCase('View#toJSON()', { assert.equals(layoutEl, layoutElInflated); assert.equals(appleEl, appleElInflated); } -}); \ No newline at end of file +});
2
Merge pull request #57 from ftlabs/nocompiled
1
.js
toJSON
mit
ftlabs/fruitmachine
10058231
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>0612,0618</WarningsNotAsErrors> <PackageId>Avalonia.AvaloniaEdit</PackageId> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> </ItemGroup> </Project> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update avalonia <DFF> @@ -38,7 +38,7 @@ <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.1-build3346-alpha" /> </ItemGroup> </Project> \ No newline at end of file
1
update avalonia
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058232
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>0612,0618</WarningsNotAsErrors> <PackageId>Avalonia.AvaloniaEdit</PackageId> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> </ItemGroup> </Project> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update avalonia <DFF> @@ -38,7 +38,7 @@ <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.1-build3346-alpha" /> </ItemGroup> </Project> \ No newline at end of file
1
update avalonia
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058233
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>0612,0618</WarningsNotAsErrors> <PackageId>Avalonia.AvaloniaEdit</PackageId> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> </ItemGroup> </Project> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update avalonia <DFF> @@ -38,7 +38,7 @@ <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.1-build3346-alpha" /> </ItemGroup> </Project> \ No newline at end of file
1
update avalonia
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058234
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>0612,0618</WarningsNotAsErrors> <PackageId>Avalonia.AvaloniaEdit</PackageId> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> </ItemGroup> </Project> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update avalonia <DFF> @@ -38,7 +38,7 @@ <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.1-build3346-alpha" /> </ItemGroup> </Project> \ No newline at end of file
1
update avalonia
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058235
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>0612,0618</WarningsNotAsErrors> <PackageId>Avalonia.AvaloniaEdit</PackageId> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> </ItemGroup> </Project> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update avalonia <DFF> @@ -38,7 +38,7 @@ <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.1-build3346-alpha" /> </ItemGroup> </Project> \ No newline at end of file
1
update avalonia
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058236
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>0612,0618</WarningsNotAsErrors> <PackageId>Avalonia.AvaloniaEdit</PackageId> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> </ItemGroup> </Project> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update avalonia <DFF> @@ -38,7 +38,7 @@ <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.1-build3346-alpha" /> </ItemGroup> </Project> \ No newline at end of file
1
update avalonia
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058237
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>0612,0618</WarningsNotAsErrors> <PackageId>Avalonia.AvaloniaEdit</PackageId> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> </ItemGroup> </Project> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update avalonia <DFF> @@ -38,7 +38,7 @@ <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.1-build3346-alpha" /> </ItemGroup> </Project> \ No newline at end of file
1
update avalonia
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058238
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>0612,0618</WarningsNotAsErrors> <PackageId>Avalonia.AvaloniaEdit</PackageId> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> </ItemGroup> </Project> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update avalonia <DFF> @@ -38,7 +38,7 @@ <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.1-build3346-alpha" /> </ItemGroup> </Project> \ No newline at end of file
1
update avalonia
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058239
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>0612,0618</WarningsNotAsErrors> <PackageId>Avalonia.AvaloniaEdit</PackageId> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> </ItemGroup> </Project> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update avalonia <DFF> @@ -38,7 +38,7 @@ <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.1-build3346-alpha" /> </ItemGroup> </Project> \ No newline at end of file
1
update avalonia
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058240
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>0612,0618</WarningsNotAsErrors> <PackageId>Avalonia.AvaloniaEdit</PackageId> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> </ItemGroup> </Project> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update avalonia <DFF> @@ -38,7 +38,7 @@ <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.1-build3346-alpha" /> </ItemGroup> </Project> \ No newline at end of file
1
update avalonia
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058241
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>0612,0618</WarningsNotAsErrors> <PackageId>Avalonia.AvaloniaEdit</PackageId> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> </ItemGroup> </Project> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update avalonia <DFF> @@ -38,7 +38,7 @@ <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.1-build3346-alpha" /> </ItemGroup> </Project> \ No newline at end of file
1
update avalonia
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058242
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>0612,0618</WarningsNotAsErrors> <PackageId>Avalonia.AvaloniaEdit</PackageId> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> </ItemGroup> </Project> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update avalonia <DFF> @@ -38,7 +38,7 @@ <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.1-build3346-alpha" /> </ItemGroup> </Project> \ No newline at end of file
1
update avalonia
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058243
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>0612,0618</WarningsNotAsErrors> <PackageId>Avalonia.AvaloniaEdit</PackageId> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> </ItemGroup> </Project> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update avalonia <DFF> @@ -38,7 +38,7 @@ <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.1-build3346-alpha" /> </ItemGroup> </Project> \ No newline at end of file
1
update avalonia
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058244
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>0612,0618</WarningsNotAsErrors> <PackageId>Avalonia.AvaloniaEdit</PackageId> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> </ItemGroup> </Project> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update avalonia <DFF> @@ -38,7 +38,7 @@ <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.1-build3346-alpha" /> </ItemGroup> </Project> \ No newline at end of file
1
update avalonia
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058245
<NME> AvaloniaEdit.csproj <BEF> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <WarningsNotAsErrors>0612,0618</WarningsNotAsErrors> <PackageId>Avalonia.AvaloniaEdit</PackageId> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="**\*.xshd;**\*.resx;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> <AvaloniaResource Include="**\*.xaml;Assets\*;" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <ItemGroup> <None Remove="Search\Assets\CaseSensitive.png" /> <None Remove="Search\Assets\CompleteWord.png" /> <None Remove="Search\Assets\FindNext.png" /> <None Remove="Search\Assets\FindPrevious.png" /> <None Remove="Search\Assets\RegularExpression.png" /> <None Remove="Search\Assets\ReplaceAll.png" /> <None Remove="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Search\Assets\CaseSensitive.png" /> <EmbeddedResource Include="Search\Assets\CompleteWord.png" /> <EmbeddedResource Include="Search\Assets\FindNext.png" /> <EmbeddedResource Include="Search\Assets\FindPrevious.png" /> <EmbeddedResource Include="Search\Assets\RegularExpression.png" /> <EmbeddedResource Include="Search\Assets\ReplaceAll.png" /> <EmbeddedResource Include="Search\Assets\ReplaceNext.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0" /> <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> </ItemGroup> </Project> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="SR.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>SR.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="ChangeAliasesOfSystemDrawing" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> <ItemGroup> <ReferencePath Condition="'%(FileName)' == 'Splat'"> <Aliases>SystemDrawing</Aliases> </ReferencePath> </ItemGroup> </Target> </Project> <MSG> update avalonia <DFF> @@ -38,7 +38,7 @@ <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" /> - <PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" /> + <PackageReference Include="Avalonia" Version="0.5.1-build3346-alpha" /> </ItemGroup> </Project> \ No newline at end of file
1
update avalonia
1
.csproj
csproj
mit
AvaloniaUI/AvaloniaEdit
10058246
<NME> EmptySelection.cs <BEF> // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.Runtime.CompilerServices; using AvaloniaEdit.Document; using AvaloniaEdit.Utils; namespace AvaloniaEdit.Editing { sealed class EmptySelection : Selection { public EmptySelection(TextArea textArea) : base(textArea) { } public override Selection UpdateOnDocumentChange(DocumentChangeEventArgs e) { return this; } public override TextViewPosition StartPosition => new TextViewPosition(TextLocation.Empty); public override TextViewPosition EndPosition => new TextViewPosition(TextLocation.Empty); public override ISegment SurroundingSegment => null; public override Selection SetEndpoint(TextViewPosition endPosition) { throw new NotSupportedException(); } public override Selection StartSelectionOrSetEndpoint(TextViewPosition startPosition, TextViewPosition endPosition) { var document = TextArea.Document; if (document == null) throw ThrowUtil.NoDocumentAssigned(); return Create(TextArea, startPosition, endPosition); } public override IEnumerable<SelectionSegment> Segments => Empty<SelectionSegment>.Array; public override string GetText() { return string.Empty; } public override void ReplaceSelectionWithText(string newText) { if (newText == null) throw new ArgumentNullException(nameof(newText)); newText = AddSpacesIfRequired(newText, TextArea.Caret.Position, TextArea.Caret.Position); if (newText.Length > 0) { if (TextArea.ReadOnlySectionProvider.CanInsert(TextArea.Caret.Offset)) { TextArea.Document.Insert(TextArea.Caret.Offset, newText); } } TextArea.Caret.VisualColumn = -1; } public override int Length => 0; public override int Length => 0; // Use reference equality because there's only one EmptySelection per text area. public override int GetHashCode() { return RuntimeHelpers.GetHashCode(this); } public override bool Equals(object obj) { return this == obj; } } } <MSG> Setting visualcolumn to -1 here raises a caret position changed event when it shouldnt. Doesnt seem to be a reason to do this so removed. <DFF> @@ -72,8 +72,7 @@ namespace AvaloniaEdit.Editing { TextArea.Document.Insert(TextArea.Caret.Offset, newText); } - } - TextArea.Caret.VisualColumn = -1; + } } public override int Length => 0;
1
Setting visualcolumn to -1 here raises a caret position changed event
2
.cs
cs
mit
AvaloniaUI/AvaloniaEdit
10058247
<NME> EmptySelection.cs <BEF> // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.Runtime.CompilerServices; using AvaloniaEdit.Document; using AvaloniaEdit.Utils; namespace AvaloniaEdit.Editing { sealed class EmptySelection : Selection { public EmptySelection(TextArea textArea) : base(textArea) { } public override Selection UpdateOnDocumentChange(DocumentChangeEventArgs e) { return this; } public override TextViewPosition StartPosition => new TextViewPosition(TextLocation.Empty); public override TextViewPosition EndPosition => new TextViewPosition(TextLocation.Empty); public override ISegment SurroundingSegment => null; public override Selection SetEndpoint(TextViewPosition endPosition) { throw new NotSupportedException(); } public override Selection StartSelectionOrSetEndpoint(TextViewPosition startPosition, TextViewPosition endPosition) { var document = TextArea.Document; if (document == null) throw ThrowUtil.NoDocumentAssigned(); return Create(TextArea, startPosition, endPosition); } public override IEnumerable<SelectionSegment> Segments => Empty<SelectionSegment>.Array; public override string GetText() { return string.Empty; } public override void ReplaceSelectionWithText(string newText) { if (newText == null) throw new ArgumentNullException(nameof(newText)); newText = AddSpacesIfRequired(newText, TextArea.Caret.Position, TextArea.Caret.Position); if (newText.Length > 0) { if (TextArea.ReadOnlySectionProvider.CanInsert(TextArea.Caret.Offset)) { TextArea.Document.Insert(TextArea.Caret.Offset, newText); } } TextArea.Caret.VisualColumn = -1; } public override int Length => 0; public override int Length => 0; // Use reference equality because there's only one EmptySelection per text area. public override int GetHashCode() { return RuntimeHelpers.GetHashCode(this); } public override bool Equals(object obj) { return this == obj; } } } <MSG> Setting visualcolumn to -1 here raises a caret position changed event when it shouldnt. Doesnt seem to be a reason to do this so removed. <DFF> @@ -72,8 +72,7 @@ namespace AvaloniaEdit.Editing { TextArea.Document.Insert(TextArea.Caret.Offset, newText); } - } - TextArea.Caret.VisualColumn = -1; + } } public override int Length => 0;
1
Setting visualcolumn to -1 here raises a caret position changed event
2
.cs
cs
mit
AvaloniaUI/AvaloniaEdit
10058248
<NME> EmptySelection.cs <BEF> // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.Runtime.CompilerServices; using AvaloniaEdit.Document; using AvaloniaEdit.Utils; namespace AvaloniaEdit.Editing { sealed class EmptySelection : Selection { public EmptySelection(TextArea textArea) : base(textArea) { } public override Selection UpdateOnDocumentChange(DocumentChangeEventArgs e) { return this; } public override TextViewPosition StartPosition => new TextViewPosition(TextLocation.Empty); public override TextViewPosition EndPosition => new TextViewPosition(TextLocation.Empty); public override ISegment SurroundingSegment => null; public override Selection SetEndpoint(TextViewPosition endPosition) { throw new NotSupportedException(); } public override Selection StartSelectionOrSetEndpoint(TextViewPosition startPosition, TextViewPosition endPosition) { var document = TextArea.Document; if (document == null) throw ThrowUtil.NoDocumentAssigned(); return Create(TextArea, startPosition, endPosition); } public override IEnumerable<SelectionSegment> Segments => Empty<SelectionSegment>.Array; public override string GetText() { return string.Empty; } public override void ReplaceSelectionWithText(string newText) { if (newText == null) throw new ArgumentNullException(nameof(newText)); newText = AddSpacesIfRequired(newText, TextArea.Caret.Position, TextArea.Caret.Position); if (newText.Length > 0) { if (TextArea.ReadOnlySectionProvider.CanInsert(TextArea.Caret.Offset)) { TextArea.Document.Insert(TextArea.Caret.Offset, newText); } } TextArea.Caret.VisualColumn = -1; } public override int Length => 0; public override int Length => 0; // Use reference equality because there's only one EmptySelection per text area. public override int GetHashCode() { return RuntimeHelpers.GetHashCode(this); } public override bool Equals(object obj) { return this == obj; } } } <MSG> Setting visualcolumn to -1 here raises a caret position changed event when it shouldnt. Doesnt seem to be a reason to do this so removed. <DFF> @@ -72,8 +72,7 @@ namespace AvaloniaEdit.Editing { TextArea.Document.Insert(TextArea.Caret.Offset, newText); } - } - TextArea.Caret.VisualColumn = -1; + } } public override int Length => 0;
1
Setting visualcolumn to -1 here raises a caret position changed event
2
.cs
cs
mit
AvaloniaUI/AvaloniaEdit
10058249
<NME> EmptySelection.cs <BEF> // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.Runtime.CompilerServices; using AvaloniaEdit.Document; using AvaloniaEdit.Utils; namespace AvaloniaEdit.Editing { sealed class EmptySelection : Selection { public EmptySelection(TextArea textArea) : base(textArea) { } public override Selection UpdateOnDocumentChange(DocumentChangeEventArgs e) { return this; } public override TextViewPosition StartPosition => new TextViewPosition(TextLocation.Empty); public override TextViewPosition EndPosition => new TextViewPosition(TextLocation.Empty); public override ISegment SurroundingSegment => null; public override Selection SetEndpoint(TextViewPosition endPosition) { throw new NotSupportedException(); } public override Selection StartSelectionOrSetEndpoint(TextViewPosition startPosition, TextViewPosition endPosition) { var document = TextArea.Document; if (document == null) throw ThrowUtil.NoDocumentAssigned(); return Create(TextArea, startPosition, endPosition); } public override IEnumerable<SelectionSegment> Segments => Empty<SelectionSegment>.Array; public override string GetText() { return string.Empty; } public override void ReplaceSelectionWithText(string newText) { if (newText == null) throw new ArgumentNullException(nameof(newText)); newText = AddSpacesIfRequired(newText, TextArea.Caret.Position, TextArea.Caret.Position); if (newText.Length > 0) { if (TextArea.ReadOnlySectionProvider.CanInsert(TextArea.Caret.Offset)) { TextArea.Document.Insert(TextArea.Caret.Offset, newText); } } TextArea.Caret.VisualColumn = -1; } public override int Length => 0; public override int Length => 0; // Use reference equality because there's only one EmptySelection per text area. public override int GetHashCode() { return RuntimeHelpers.GetHashCode(this); } public override bool Equals(object obj) { return this == obj; } } } <MSG> Setting visualcolumn to -1 here raises a caret position changed event when it shouldnt. Doesnt seem to be a reason to do this so removed. <DFF> @@ -72,8 +72,7 @@ namespace AvaloniaEdit.Editing { TextArea.Document.Insert(TextArea.Caret.Offset, newText); } - } - TextArea.Caret.VisualColumn = -1; + } } public override int Length => 0;
1
Setting visualcolumn to -1 here raises a caret position changed event
2
.cs
cs
mit
AvaloniaUI/AvaloniaEdit