public SimpleTextWord(TextWordType Type, string Word, bool Bold, System.Drawing.Color Color) { this.Type = Type; this.Word = Word; this.Bold = Bold; this.Color = Color; }
public SimpleTextWord(TextWordType Type, string Word, bool Bold, Color Color) { this.Type = Type; this.Word = Word; this.Bold = Bold; this.Color = Color; }
public TextWord(IDocument document, LineSegment word, int offset, int length, HighlightColor color, bool hasDefaultColor) { Debug.Assert(document != null); Debug.Assert(word != null); Debug.Assert(color != null); this.document = document; this.word = word; this.offset = offset; this.length = length; this.color = color; this.hasDefaultColor = hasDefaultColor; this.type = TextWordType.Word; }
// TAB private TextWord(TextWordType type) { this.type = type; }
private int PaintLinePart(Graphics g, int lineNumber, int startColumn, int endColumn, Rectangle lineRectangle, int physicalXPos) { IList <TextMarker> textMarkers; Color color; RectangleF rectangleF; IList <TextMarker> markers; bool flag = this.DrawLineMarkerAtLine(lineNumber); Brush brush = (this.textArea.Enabled ? this.GetBgColorBrush(lineNumber) : SystemBrushes.InactiveBorder); HighlightColor colorFor = this.textArea.Document.HighlightingStrategy.GetColorFor("Selection"); ColumnRange selectionAtLine = this.textArea.SelectionManager.GetSelectionAtLine(lineNumber); HighlightColor highlightColor = this.textArea.Document.HighlightingStrategy.GetColorFor("TabMarkers"); HighlightColor colorFor1 = this.textArea.Document.HighlightingStrategy.GetColorFor("SpaceMarkers"); LineSegment lineSegment = this.textArea.Document.GetLineSegment(lineNumber); Brush brush1 = BrushRegistry.GetBrush(colorFor.BackgroundColor); if (lineSegment.Words == null) { return(physicalXPos); } int length = 0; TextWord textWord = null; FontContainer fontContainer = base.TextEditorProperties.FontContainer; for (int i = 0; i < lineSegment.Words.Count; i++) { TextWord item = lineSegment.Words[i]; if (length >= startColumn) { while (length < endColumn && physicalXPos < lineRectangle.Right) { int num = length + item.Length - 1; TextWordType type = item.Type; if (type != TextWordType.Space) { color = (type != TextWordType.Tab ? item.Color : highlightColor.Color); } else { color = colorFor1.Color; } Brush markerBrushAt = this.GetMarkerBrushAt(lineSegment.Offset + length, item.Length, ref color, out textMarkers); if (item.Length > 1) { int num1 = 2147483647; if (this.highlight != null) { if (this.highlight.OpenBrace.Y == lineNumber && this.highlight.OpenBrace.X >= length && this.highlight.OpenBrace.X <= num) { TextLocation openBrace = this.highlight.OpenBrace; num1 = Math.Min(num1, openBrace.X - length); } if (this.highlight.CloseBrace.Y == lineNumber && this.highlight.CloseBrace.X >= length && this.highlight.CloseBrace.X <= num) { TextLocation closeBrace = this.highlight.CloseBrace; num1 = Math.Min(num1, closeBrace.X - length); } if (num1 == 0) { num1 = 1; } } if (endColumn < num) { num1 = Math.Min(num1, endColumn - length); } if (selectionAtLine.StartColumn > length && selectionAtLine.StartColumn <= num) { num1 = Math.Min(num1, selectionAtLine.StartColumn - length); } else if (selectionAtLine.EndColumn > length && selectionAtLine.EndColumn <= num) { num1 = Math.Min(num1, selectionAtLine.EndColumn - length); } foreach (TextMarker textMarker in textMarkers) { int offset = textMarker.Offset - lineSegment.Offset; int endOffset = textMarker.EndOffset - lineSegment.Offset + 1; if (offset <= length || offset > num) { if (endOffset <= length || endOffset > num) { continue; } num1 = Math.Min(num1, endOffset - length); } else { num1 = Math.Min(num1, offset - length); } } if (num1 != 2147483647) { if (textWord != null) { throw new ApplicationException("split part invalid: first part cannot be splitted further"); } textWord = TextWord.Split(ref item, num1); continue; } } if (ColumnRange.WholeColumn.Equals(selectionAtLine) || selectionAtLine.StartColumn <= length && selectionAtLine.EndColumn > num) { markerBrushAt = brush1; if (colorFor.HasForeground) { color = colorFor.Color; } } else if (flag) { markerBrushAt = brush; } if (markerBrushAt == null) { markerBrushAt = (item.SyntaxColor == null || !item.SyntaxColor.HasBackground ? brush : BrushRegistry.GetBrush(item.SyntaxColor.BackgroundColor)); } if (item.Type == TextWordType.Space) { this.physicalColumn++; rectangleF = new RectangleF((float)physicalXPos, (float)lineRectangle.Y, (float)this.SpaceWidth, (float)lineRectangle.Height); g.FillRectangle(markerBrushAt, rectangleF); if (base.TextEditorProperties.ShowSpaces) { this.DrawSpaceMarker(g, color, physicalXPos, lineRectangle.Y); } physicalXPos += this.SpaceWidth; } else if (item.Type != TextWordType.Tab) { int num2 = this.DrawDocumentWord(g, item.Word, new Point(physicalXPos, lineRectangle.Y), item.GetFont(fontContainer), color, markerBrushAt); rectangleF = new RectangleF((float)physicalXPos, (float)lineRectangle.Y, (float)num2, (float)lineRectangle.Height); physicalXPos += num2; } else { this.physicalColumn += base.TextEditorProperties.TabIndent; this.physicalColumn = this.physicalColumn / base.TextEditorProperties.TabIndent * base.TextEditorProperties.TabIndent; int wideSpaceWidth = (physicalXPos + 4 - lineRectangle.X) / this.WideSpaceWidth / base.TextEditorProperties.TabIndent * this.WideSpaceWidth * base.TextEditorProperties.TabIndent + lineRectangle.X; wideSpaceWidth = wideSpaceWidth + this.WideSpaceWidth * base.TextEditorProperties.TabIndent; rectangleF = new RectangleF((float)physicalXPos, (float)lineRectangle.Y, (float)(wideSpaceWidth - physicalXPos), (float)lineRectangle.Height); g.FillRectangle(markerBrushAt, rectangleF); if (base.TextEditorProperties.ShowTabs) { this.DrawTabMarker(g, color, physicalXPos, lineRectangle.Y); } physicalXPos = wideSpaceWidth; } foreach (TextMarker textMarker1 in textMarkers) { if (textMarker1.TextMarkerType == TextMarkerType.SolidBlock) { continue; } this.DrawMarker(g, textMarker1, rectangleF); } if (this.highlight != null && (this.highlight.OpenBrace.Y == lineNumber && this.highlight.OpenBrace.X == length || this.highlight.CloseBrace.Y == lineNumber && this.highlight.CloseBrace.X == length)) { this.DrawBracketHighlight(g, new Rectangle((int)rectangleF.X, lineRectangle.Y, (int)rectangleF.Width - 1, lineRectangle.Height - 1)); } length += item.Length; if (textWord == null) { goto label0; } item = textWord; textWord = null; } if (physicalXPos < lineRectangle.Right && endColumn >= lineSegment.Length) { markers = base.Document.MarkerStrategy.GetMarkers(lineSegment.Offset + lineSegment.Length); foreach (TextMarker marker in markers) { if (marker.TextMarkerType == TextMarkerType.SolidBlock) { continue; } this.DrawMarker(g, marker, new RectangleF((float)physicalXPos, (float)lineRectangle.Y, (float)this.WideSpaceWidth, (float)lineRectangle.Height)); } } return(physicalXPos); } else { length += item.Length; } label0 :; } if (physicalXPos < lineRectangle.Right && endColumn >= lineSegment.Length) { markers = base.Document.MarkerStrategy.GetMarkers(lineSegment.Offset + lineSegment.Length); foreach (TextMarker marker1 in markers) { if (marker1.TextMarkerType == TextMarkerType.SolidBlock) { continue; } this.DrawMarker(g, marker1, new RectangleF((float)physicalXPos, (float)lineRectangle.Y, (float)this.WideSpaceWidth, (float)lineRectangle.Height)); } } return(physicalXPos); }