public void Draw(TextView textView, DrawingContext drawingContext) { if (textView.Document == null /*|| !_isFocused.Value*/) { _commentsPanel.HighlightLine(0); return; } DocumentLine line = _editor.Document.GetLineByOffset(_editor.CaretOffset); _commentsPanel.HighlightLine(line.LineNumber); textView.EnsureVisualLines(); foreach (Rect r in BackgroundGeometryBuilder.GetRectsForSegment(textView, new TextSegment() { StartOffset = line.Offset })) { drawingContext.DrawRectangle( _brush, // Строка _pen, // Рамка new Rect(r.Location, new Size(Math.Max(_editor.ExtentWidth, _editor.ViewportWidth), r.Height)) ); } }
void IBackgroundRenderer.Draw(TextView textView, DrawingContext drawingContext) { if (markers == null || !textView.VisualLinesValid) { return; } var visualLines = textView.VisualLines; if (visualLines.Count == 0) { return; } var viewStart = visualLines.First().FirstDocumentLine.Offset; var viewEnd = visualLines.Last().LastDocumentLine.EndOffset; foreach (var marker in markers.FindOverlappingSegments(viewStart, viewEnd - viewStart)) { if (marker.BackgroundColor != null) { var geoBuilder = new BackgroundGeometryBuilder { AlignToWholePixels = true, CornerRadius = 3 }; geoBuilder.AddSegment(textView, marker); var geometry = geoBuilder.CreateGeometry(); if (geometry != null) { var color = marker.BackgroundColor.Value; var brush = new SolidColorBrush(color); brush.Freeze(); drawingContext.DrawGeometry(brush, null, geometry); } } foreach (var r in BackgroundGeometryBuilder.GetRectsForSegment(textView, marker)) { var startPoint = r.BottomLeft; var endPoint = r.BottomRight; var usedPen = new Pen(new SolidColorBrush(marker.MarkerColor), 1); usedPen.Freeze(); const double offset = 2.5; var count = Math.Max((int)((endPoint.X - startPoint.X) / offset) + 1, 4); var geometry = new StreamGeometry(); using (var ctx = geometry.Open()) { ctx.BeginFigure(startPoint, false, false); ctx.PolyLineTo(CreatePoints(startPoint, endPoint, offset, count).ToArray(), true, false); } geometry.Freeze(); drawingContext.DrawGeometry(Brushes.Transparent, usedPen, geometry); break; } } }
public void Draw(TextView textView, DrawingContext drawingContext) { if (_editor.Document == null || _offsetsToMark.Count == 0) { return; } textView.EnsureVisualLines(); foreach (var mark in _offsetsToMark) { foreach (Rect r in BackgroundGeometryBuilder.GetRectsForSegment( textView, new TextSegment { StartOffset = mark.Offset, Length = mark.Length })) { drawingContext.DrawRoundedRectangle( mark.Brush, null, new Rect(r.Location, r.Size), 3, 3 ); } } //http://danielgrunwald.de/coding/AvalonEdit/rendering.php //http://stackoverflow.com/questions/5072761/avalonedit-highlight-current-line-even-when-not-focused //DocumentLine currentLine = _editor.Document.GetLineByOffset((int)_offsetToMark); //foreach (Rect rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, currentLine)) //{ // drawingContext.DrawRectangle( // new SolidColorBrush(Color.FromArgb(0x40, 0, 0, 0xFF)), null, // new Rect(rect.Location, new Size(textView.ActualWidth - 32, rect.Height))); //} }
public void Draw(TextView textView, DrawingContext drawingContext) { _owner = textView; if (textView.VisualLinesValid && textView.Document != null) { if (_line > 0 && _line < textView.Document.LineCount) { var currentLine = textView.Document.GetLineByNumber(_line); var segment = new TextSegment(); segment.StartOffset = currentLine.Offset; segment.EndOffset = currentLine.EndOffset; if (_startColumn != -1 && _endColumn != -1) { segment.StartOffset = textView.Document.GetOffset(_line, _startColumn); segment.EndOffset = textView.Document.GetOffset(_line, _endColumn); } else { _startColumn = textView.Document.GetLocation(segment.StartOffset).Column; _endColumn = textView.Document.GetLocation(segment.EndOffset).Column; } var rects = BackgroundGeometryBuilder.GetRectsForSegment(textView, segment); foreach (var rect in rects) { var drawRect = new Rect(rect.TopLeft.X - 1, rect.TopLeft.Y - 1, rect.Width + 2, rect.Height + 2); drawingContext.FillRectangle(selectedLineBg, drawRect); } } } }
public void Draw(TextView textView, DrawingContext drawingContext) { if (_editor.Document == null || CurrentCodeSectionManager == null || CurrentCodeSectionManager.CompilerErrorCollection == null) { return; } textView.EnsureVisualLines(); for (int i = 0; i < CurrentCodeSectionManager.CompilerErrorCollection.Count; ++i) { var error = CurrentCodeSectionManager.CompilerErrorCollection[i]; int lineNumber = error.Line - CurrentCodeSectionStartLine; if (lineNumber > 0 && lineNumber < _editor.LineCount) { var line = _editor.Document.GetLineByNumber(lineNumber); foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, line)) { var rect2 = new Rect(rect.Location, new Size(textView.ActualWidth, rect.Height)); if (rect2.Height > 1 && rect2.Width > 1) { drawingContext.DrawRoundedRectangle(new SolidColorBrush(Color.FromArgb(0x20, 0xff, 0, 0)), new Pen(new SolidColorBrush(Color.FromArgb(0xa0, 0xff, 0, 0)), 1), rect2, 3, 3); } var column = error.Column - CurrentCodeSectionManager.GetSectionIndendationSize(CurrentCodeSectionId); DrawColumnIndicator(drawingContext, new Point(rect2.Left + column * 7 + 3, rect2.Top - 1)); } } } }
public void Draw(TextView textView, DrawingContext drawingContext) { textView.EnsureVisualLines(); var color = new SolidColorBrush(ConfigHost.Coloring.BreakPoint.TextHighlightColor); color.Freeze(); var invalidBps = new List <DataContext.BreakpointsPaneUtil.Breakpoint>(); foreach (var bp in this.SolutionFileRef.BreakPoints) { if (bp.Line < 0) { Logger.Log(NLog.LogLevel.Warn, $"Removed invalid breakpoint in file '{this.SolutionFileRef.FileName}'."); invalidBps.Add(bp); continue; } var line = this.Document.GetLineByNumber(bp.Line); var segment = new TextSegment { StartOffset = line.Offset, EndOffset = line.EndOffset }; foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, segment)) { drawingContext.DrawRectangle(color, null, new Rect(rect.Location, new Size(textView.ActualWidth, rect.Height))); } } foreach (var bp in invalidBps) { this.SolutionFileRef.BreakPoints.Remove(bp); } }
public void Draw(TextView textView, DrawingContext drawingContext) { foreach (TextSegment current in this.SearchHitsSegments) { foreach (Rect current2 in BackgroundGeometryBuilder.GetRectsForSegment(textView, current)) { Point bottomLeft = current2.BottomLeft; Point bottomRight = current2.BottomRight; Pen pen = new Pen(new SolidColorBrush(Colors.OrangeRed), 1); pen.Freeze(); double num = 2.5; int count = System.Math.Max((int)((bottomRight.X - bottomLeft.X) / num) + 1, 4); StreamGeometry streamGeometry = new StreamGeometry(); using (StreamGeometryContext streamGeometryContext = streamGeometry.Open()) { streamGeometryContext.BeginFigure(bottomLeft, true, true); streamGeometryContext.LineTo(current2.TopLeft, true, false); streamGeometryContext.LineTo(current2.TopRight, true, false); streamGeometryContext.LineTo(current2.BottomRight, true, false); } streamGeometry.Freeze(); drawingContext.DrawGeometry(Brushes.Transparent, pen, streamGeometry); } } }
/// <summary> /// Draw the background line highlighting of the current line. /// </summary> /// <param name="textView"></param> /// <param name="drawingContext"></param> public void Draw(TextView textView, DrawingContext drawingContext) { if (this._Editor == null) { return; } if (this._Editor.Document == null) { return; } if (_Editor.EditorCurrentLineBorderThickness == 0 && _Editor.EditorCurrentLineBackground == null) { return; } Pen borderPen = null; if (_Editor.EditorCurrentLineBorder != null) { borderPen = new Pen(_Editor.EditorCurrentLineBorder, _Editor.EditorCurrentLineBorderThickness); borderPen.Freeze(); } textView.EnsureVisualLines(); var currentLine = _Editor.Document.GetLineByOffset(_Editor.CaretOffset); foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, currentLine)) { drawingContext.DrawRectangle(_Editor.EditorCurrentLineBackground, borderPen, new Rect(rect.Location, new Size(textView.ActualWidth, rect.Height))); } }
public void Draw(TextView textView, DrawingContext drawingContext) { if (this._editor.Document == null) { return; } try { textView.EnsureVisualLines(); var currentLine = this._editor.Document.GetLineByOffset(this._editor.CaretOffset); foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, currentLine)) { if (textView.ActualWidth - 32 > 0 && rect.Height > 0) { var Size = new Size(textView.ActualWidth - 32, rect.Height); var Rect = new Rect(rect.Location, Size); drawingContext.DrawRectangle(new SolidColorBrush(Color.FromArgb(50, 250, 250, 100)), null, Rect); } } } catch (Exception error) { Framework.EventBus.Publish(error); } }
public void Draw(TextView textView, DrawingContext drawingContext) { if (this.FileFolderRef == null) { return; } textView.EnsureVisualLines(); var color = new SolidColorBrush(ConfigHost.Coloring.BreakPoint.TextHighlightColor); color.Freeze(); foreach (var bp in Workspace.Instance.BreakpointManager[this.FileFolderRef]) { if (!bp.IsEnabled) { continue; } if (bp.Line >= this.Document.LineCount) { Workspace.Instance.BreakpointManager.RemoveBreakpoint(bp); continue; } var line = this.Document.GetLineByNumber(bp.Line); var segment = new TextSegment { StartOffset = line.Offset, EndOffset = line.EndOffset }; foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, segment)) { drawingContext.DrawRectangle(color, null, new Rect(rect.Location, new Size(textView.ActualWidth, rect.Height))); } } }
public void Draw(TextView textView, DrawingContext drawingContext) { var typeface = textView.GetValue(TextBlock.FontFamilyProperty); var emSize = textView.GetValue(TextBlock.FontSizeProperty); var formattedText = TextFormatterFactory.CreateFormattedText( textView, "9", typeface, emSize, Brushes.Black ); var charSize = formattedText.Measure(); var pixelSize = PixelSnapHelpers.GetPixelSize(textView); foreach (var entry in markers) { var startLine = textView.Document.GetLineByOffset(entry.StartOffset); var start = entry.StartOffset; var startChar = textView.Document.GetCharAt(startLine.Offset); if (char.IsWhiteSpace(startChar)) { start = TextUtilities.GetNextCaretPosition(textView.Document, startLine.Offset, LogicalDirection.Forward, CaretPositioningMode.WordBorder); } var endLine = textView.Document.GetLineByOffset(entry.EndOffset <= textView.Document.TextLength ? entry.EndOffset : textView.Document.TextLength); if (endLine.EndOffset > start && startLine != endLine) { var newEntry = new TextSegment() { StartOffset = start, EndOffset = endLine.EndOffset }; var rects = BackgroundGeometryBuilder.GetRectsForSegment(textView, newEntry); var rect = GetRectForRange(rects); if (!rect.IsEmpty) { var xPos = charSize.Width * (textView.Document.GetLocation(newEntry.StartOffset).Column - 1); rect = rect.WithX(xPos + (charSize.Width / 2)); rect = rect.WithX(PixelSnapHelpers.PixelAlign(rect.X, pixelSize.Width)); rect = rect.WithY(PixelSnapHelpers.PixelAlign(rect.Y, pixelSize.Height)); drawingContext.DrawLine(_pen, rect.TopLeft, rect.BottomLeft); } } } }
public void Draw(TextView textView, DrawingContext drawingContext) { if (Issues == null) { return; } var segments = new TextSegmentCollection <IssueMarker>(); foreach (var issue in Issues) { segments.Add(new IssueMarker(Theme, issue)); } var visualLines = textView.VisualLines; if (visualLines.Count == 0) { return; } int viewStart = visualLines.First().FirstDocumentLine.Offset; int viewEnd = visualLines.Last().LastDocumentLine.EndOffset; foreach (var marker in segments.FindOverlappingSegments(viewStart, viewEnd - viewStart)) { var brush = marker.Brush; var usedPen = new Pen(brush, 1); usedPen.Freeze(); if (brush == null) { continue; } foreach (var r in BackgroundGeometryBuilder.GetRectsForSegment(textView, marker)) { var startPoint = r.BottomLeft; var endPoint = r.BottomRight; double offset = 2.5; int count = Math.Max((int)((endPoint.X - startPoint.X) / offset) + 1, 4); var geometry = new StreamGeometry(); using (StreamGeometryContext ctx = geometry.Open()) { ctx.BeginFigure(startPoint, false, false); ctx.PolyLineTo(CreatePoints(startPoint, offset, count), true, false); } geometry.Freeze(); drawingContext.DrawGeometry(Brushes.Transparent, usedPen, geometry); } } }
public void Draw(TextView textView, DrawingContext drawingContext) { foreach (TextSegment character in this.PairedCharacters) { foreach (Rect characterRect in BackgroundGeometryBuilder.GetRectsForSegment(textView, character)) { drawingContext.DrawRectangle(highlightBrush, highlightPen, characterRect); } } }
public void Draw(TextView textView, DrawingContext drawingContext) { if (markers == null) { return; } var visualLines = textView.VisualLines; if (visualLines.Count == 0) { return; } int viewStart = visualLines.First().FirstDocumentLine.Offset; int viewEnd = visualLines.Last().LastDocumentLine.EndOffset; int start = Math.Min(viewStart, viewEnd); int end = Math.Max(viewStart, viewEnd); foreach (TextMarker marker in markers.FindOverlappingSegments(start, end - start)) { if (marker.EndOffset < textView.Document.TextLength) { foreach (var r in BackgroundGeometryBuilder.GetRectsForSegment(textView, marker)) { var startPoint = r.BottomLeft; var endPoint = r.BottomRight; var usedPen = new Pen(new SolidColorBrush(marker.MarkerColor), 1); const double offset = 2.5; var count = Math.Max((int)((endPoint.X - startPoint.X) / offset) + 1, 4); var geometry = new StreamGeometry(); using (var ctx = geometry.Open()) { ctx.BeginFigure(startPoint, false); foreach (var point in CreatePoints(startPoint, endPoint, offset, count)) { ctx.LineTo(point); } ctx.EndFigure(false); } drawingContext.DrawGeometry(Brushes.Transparent, usedPen, geometry); break; } } } }
#pragma warning restore 67 public void Draw(TextView textView, DrawingContext drawingContext) { var offset = _editor.CaretOffset; var document = _editor.Document; if (offset != -1 && document != null) { var caretChar = '\0'; var behindCaretChar = '\0'; if (offset < document.TextLength) { caretChar = document.GetCharAt(offset); } if (offset - 1 > 0 && offset < document.TextLength) { behindCaretChar = document.GetCharAt(offset - 1); } if (caretChar.IsOpenBracketChar() && !caretChar.IsPunctuationChar()) { var closeOffset = FindMatchingBracketForward(document, offset, caretChar, caretChar.GetCloseBracketChar()); Highlight(drawingContext, BackgroundGeometryBuilder.GetRectsForSegment(textView, new TextSegment { StartOffset = offset, EndOffset = offset + 1 })); Highlight(drawingContext, BackgroundGeometryBuilder.GetRectsForSegment(textView, new TextSegment { StartOffset = closeOffset, EndOffset = closeOffset + 1 })); } if (behindCaretChar.IsCloseBracketChar() && !behindCaretChar.IsPunctuationChar()) { var openOffset = FindMatchingBracketBackward(document, offset - 1, behindCaretChar, behindCaretChar.GetOpenBracketChar()); Highlight(drawingContext, BackgroundGeometryBuilder.GetRectsForSegment(textView, new TextSegment { StartOffset = offset - 1, EndOffset = offset })); Highlight(drawingContext, BackgroundGeometryBuilder.GetRectsForSegment(textView, new TextSegment { StartOffset = openOffset, EndOffset = openOffset + 1 })); } } }
private static void DrawRectangle(TextView textView, DrawingContext drawingContext, SourcePosition sourceSegment, Brush brush, Pen pen) { var segment = new ICSharpCode.AvalonEdit.Document.TextSegment { StartOffset = sourceSegment.IndexStart, EndOffset = sourceSegment.IndexEnd }; foreach (var rectangle in BackgroundGeometryBuilder.GetRectsForSegment(textView, segment)) { drawingContext.DrawRectangle(brush, pen, rectangle); } }
protected override void OnRender(DrawingContext drawingContext) { try { drawingContext.DrawRectangle(new SolidColorBrush(Colors.Black), null, new Rect(new Size(this.ActualWidth, this.ActualHeight))); base.OnRender(drawingContext); foreach (var highlightRegion in this.HighlightRegions) { var region = highlightRegion; var lineStart = this.x_TextEditor.Document.GetLineByOffset(highlightRegion.TextSpan.Start).LineNumber; var lineEnd = this.x_TextEditor.Document.GetLineByOffset(highlightRegion.TextSpan.Start + highlightRegion.TextSpan.Length).LineNumber; var viewPos = this.TranslatePoint(new Point(), this.x_TextEditor.TextArea.TextView); var highlightBrush = this.GetBrush(highlightRegion); for (int i = lineStart; i < lineEnd; i++) { var currentLine = this.x_TextEditor.Document.GetLineByNumber(i); foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(this.x_TextEditor.TextArea.TextView, currentLine)) { var wid = 3.0; var spacing = 2.0; var left = 0.0; switch (highlightRegion.Kind) { case HighlightKind.Caret: left = rect.Location.X - viewPos.X - 3.0 * (wid + spacing) - spacing; break; case HighlightKind.Hover: left = rect.Location.X - viewPos.X - 2.0 * (wid + spacing) - spacing; break; case HighlightKind.VideoCursor: left = rect.Location.X - viewPos.X - 1.0 * (wid + spacing) - spacing; break; default: throw new NotSupportedException(); } var loc = new Point(left, rect.Location.Y - viewPos.Y); var rect2 = new Rect(loc, new Size(wid, rect.Height)); drawingContext.DrawRectangle(highlightBrush, null, rect2); } } } } catch { //TODO fix issue ere } }
//public KnownLayer Layer => throw new NotImplementedException(); public void Draw(ICSharpCode.AvalonEdit.Rendering.TextView textview, DrawingContext drawingcontext) { if (_editor.Document == null || textview.ActualWidth <= 32) { return; } textview.EnsureVisualLines(); ICSharpCode.AvalonEdit.Document.DocumentLine currentline = _editor.Document.GetLineByOffset(_editor.CaretOffset); foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(textview, currentline)) { drawingcontext.DrawRectangle(new SolidColorBrush(System.Windows.Media.Color.FromArgb(25, 255, 255, 255)), null, new System.Windows.Rect(rect.Location, new System.Windows.Size(textview.ActualWidth - 32, rect.Height))); } }
/// <summary> /// Draw the background line highlighting of the current line. /// </summary> /// <param name="textView"></param> /// <param name="drawingContext"></param> public void Draw(TextView textView, DrawingContext drawingContext) { if (this.mEditor.Document == null) { return; } textView.EnsureVisualLines(); var currentLine = mEditor.Document.GetLineByOffset(mEditor.CaretOffset); foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, currentLine)) { drawingContext.DrawRectangle(new SolidColorBrush(this.BackgroundColorBrush.Color), null, new Rect(rect.Location, new Size(textView.ActualWidth, rect.Height))); } }
public void Draw(TextView textView, DrawingContext drawingContext) { if (_editor.Document == null || Line < 1) { return; } textView.EnsureVisualLines(); var highlight = Brushes.LightGray; var currentLine = _editor.Document.GetLineByNumber(Line); foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, currentLine)) { drawingContext.DrawRectangle(highlight, null, new Rect(rect.Location, new Size(rect.Width, rect.Height))); } }
public void Draw(TextView textView, DrawingContext drawingContext) { if (_editor.HighlightedBreakpointLine.HasValue) { textView.EnsureVisualLines(); var line = _editor.Document.GetLineByNumber(_editor.HighlightedBreakpointLine.Value); var rects = BackgroundGeometryBuilder.GetRectsForSegment(textView, line); foreach (var rect in rects) { drawingContext.DrawRectangle(_background, new Pen(_background, 1), new Rect(rect.Location, new Size(textView.ActualWidth, rect.Height))); } } }
public void Draw(TextView textView, DrawingContext drawingContext) { textView.EnsureVisualLines(); foreach (Rect r in BackgroundGeometryBuilder.GetRectsForSegment(textView, new TextSegment() { StartOffset = editor.Document.GetLineByOffset(editor.CaretOffset).Offset })) { drawingContext.DrawRoundedRectangle( new SolidColorBrush(Color.FromArgb(30, 218, 165, 32)), new Pen(new SolidColorBrush(Color.FromArgb(250, 0xff, 0xff, 0xff)), 1), new Rect(r.Location, new Size(textView.ActualWidth, r.Height)), 3, 3); } }
public void Draw(TextView textView, DrawingContext drawingContext) { if (_editor.Document != null) { textView.EnsureVisualLines(); var currentLine = _editor.Document.GetLineByOffset(_editor.CaretOffset); var lineWidth = textView.ActualWidth + _editor.HorizontalOffset; foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, currentLine)) { drawingContext.DrawRectangle(null, CurrentLinePen, new Rect(rect.Location, new Size(lineWidth, rect.Height))); } } }
public void Draw(TextView textView, DrawingContext drawingContext) { if (_editor.Document == null) { return; } textView.EnsureVisualLines(); foreach (var rect1 in BackgroundGeometryBuilder.GetRectsForSegment(textView, line)) { Rect rect = rect1; rect.Width = Math.Max(rect1.Width, 5000.0); // _editor.Width-10; drawingContext.DrawRectangle(brush, null, new Rect(rect.Location, new Size(rect.Width, rect.Height))); } }
public void Draw(TextView textView, DrawingContext drawingContext) { if (textView == null) { throw new ArgumentNullException("textView"); } if (drawingContext == null) { throw new ArgumentNullException("drawingContext"); } var visualLines = textView.VisualLines; if (visualLines.Count == 0) { return; } if (_errorLineNumber < 0 || _errorLineNumber > textView.Document.LineCount) { return; } var errorLine = textView.Document.GetLineByNumber(_errorLineNumber); var lineText = textView.Document.GetText(errorLine.Offset, errorLine.Length); var segment = new TextSegment { StartOffset = errorLine.Offset + lineText.IndexOfFirstCharAfter(" \t"), EndOffset = errorLine.EndOffset }; foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, segment)) { var startPoint = rect.BottomLeft; var endPoint = rect.BottomRight; var usedPen = new Pen(Brushes.Red, 1); usedPen.Freeze(); const double offset = 2.5; var count = Math.Max((int)((endPoint.X - startPoint.X) / offset) + 1, 4); var geometry = new StreamGeometry(); using (StreamGeometryContext ctx = geometry.Open()) { ctx.BeginFigure(startPoint, false, false); ctx.PolyLineTo(CreatePoints(startPoint, offset, count).ToArray(), true, false); } geometry.Freeze(); drawingContext.DrawGeometry(Brushes.Transparent, usedPen, geometry); } }
public void Draw(TextView textView, DrawingContext drawingContext) { textView.EnsureVisualLines(); foreach (var lineToHighlight in HighlightedLines.Where(i => textView.Document.LineCount >= i)) { if (lineToHighlight <= 0) { continue; } foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, textView.Document.GetLineByNumber(lineToHighlight), true)) { drawingContext.DrawRectangle(new SolidColorBrush(Color.FromArgb(100, 255, 184, 0)), null, new Rect(rect.Location, new Size(textView.ActualWidth, rect.Height))); } } }
public void Draw(TextView textView, DrawingContext drawingContext) { if (_editor.Document == null) { return; } textView.EnsureVisualLines(); //var currentLine = _editor.Document.GetLineByOffset(_editor.CaretOffset); if (_xmlEditor.xDoc == null) { return; } if (textView.ActualWidth > 32) { if (HighlightSegments != null) { foreach (ISegment obj in HighlightSegments) { foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, obj)) { drawingContext.DrawRectangle( new SolidColorBrush(HighlightColor), null, new Rect(rect.Location, rect.Size)); } } } if (UnderlineSegments != null) { foreach (ISegment obj in UnderlineSegments) { foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, obj)) { drawingContext.DrawLine( new Pen(new SolidColorBrush(_underlineColor), 1.0), new Point(rect.BottomLeft.X, rect.BottomLeft.Y), new Point(rect.BottomRight.X, rect.BottomRight.Y)); } } } } }
public void Draw(TextView textView, DrawingContext drawingContext) { if (textView.Document == null) { return; } for (int i = 0; i < textView.Document.LineCount; i++) { var line = textView.Document.GetLineByNumber(i + 1); foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, line)) { drawingContext.DrawRectangle(Brushes.DarkCyan, null, new Rect(rect.Location, new Size(rect.Width, rect.Height))); } } }
public void Draw(TextView textView, DrawingContext drawingContext) { textView.EnsureVisualLines(); var color = new SolidColorBrush(ConfigHost.Coloring.BreakPoint.TextHighlightColor); color.Freeze(); foreach (var bp in this.SolutionFileRef.BreakPoints) { var line = this.Document.GetLineByNumber(bp.Line); var segment = new TextSegment { StartOffset = line.Offset, EndOffset = line.EndOffset }; foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, segment)) { drawingContext.DrawRectangle(color, null, new Rect(rect.Location, new Size(textView.ActualWidth, rect.Height))); } } }
public double[] GetBoundingRectangles() { Log("{0}.GetBoundingRectangles()", ID); var textView = textArea.TextView; var source = PresentationSource.FromVisual(this.textArea); var result = new List <double>(); foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, segment)) { var tl = textView.PointToScreen(rect.TopLeft); var br = textView.PointToScreen(rect.BottomRight); result.Add(tl.X); result.Add(tl.Y); result.Add(br.X - tl.X); result.Add(br.Y - tl.Y); } return(result.ToArray()); }