void InternalDraw(int markerStart, int markerEnd, TextEditor editor, Xwt.Drawing.Context cr, TextLayout layout, bool selected, int startOffset, int endOffset, double y, double startXPos, double endXPos) { if (markerStart >= markerEnd) { return; } double @from; double to; if (markerStart < startOffset && endOffset < markerEnd) { @from = startXPos; to = endXPos; } else { int start = startOffset < markerStart ? markerStart : startOffset; int end = endOffset < markerEnd ? endOffset : markerEnd; double /*lineNr,*/ x_pos; x_pos = layout.GetCoordinateFromIndex(start - startOffset).X; @from = startXPos + (int)(x_pos); x_pos = layout.GetCoordinateFromIndex(end - startOffset).X; to = startXPos + (int)(x_pos); } @from = System.Math.Max(@from, editor.TextViewMargin.XOffset); to = System.Math.Max(to, editor.TextViewMargin.XOffset); if (@from >= to) { return; } double height = editor.LineHeight / 5; if (selected) { cr.SetSourceColor(editor.ColorStyle.SelectedText.Foreground); } else { cr.SetSourceColor(ColorName == null ? Color : editor.ColorStyle.GetChunkStyle(ColorName).Foreground); } if (Wave) { //Pango.CairoHelper.ShowErrorUnderline(cr, @from, y + editor.LineHeight - height, to - @from, height); } else { cr.SetLineWidth(1); cr.MoveTo(@from, y + editor.LineHeight - 1.5); cr.LineTo(to, y + editor.LineHeight - 1.5); cr.Stroke(); } }
public Rectangle IndexToPos(int index_) { return(new Rectangle(layout.GetCoordinateFromIndex(index_), new Size(layout.Font.Size, layout.Font.Size))); }