public TextArea(TextEditorControl motherTextEditorControl, TextAreaControl motherTextAreaControl) { this.motherTextAreaControl = motherTextAreaControl; this.motherTextEditorControl = motherTextEditorControl; caret = new Caret(this); selectionManager = new SelectionManager(Document, this); this.textAreaClipboardHandler = new TextAreaClipboardHandler(this); ResizeRedraw = true; SetStyle(ControlStyles.OptimizedDoubleBuffer, true); // SetStyle(ControlStyles.AllPaintingInWmPaint, true); // SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.Opaque, false); SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.Selectable, true); textView = new TextView(this); gutterMargin = new GutterMargin(this); foldMargin = new FoldMargin(this); iconBarMargin = new IconBarMargin(this); leftMargins.AddRange(new AbstractMargin[] { iconBarMargin, gutterMargin, foldMargin }); OptionsChanged(); new TextAreaMouseHandler(this).Attach(); // 下列语句需要在STAThread 下才能运行 //new TextAreaDragDropHandler().Attach(this); bracketshemes.Add(new BracketHighlightingSheme('{', '}')); bracketshemes.Add(new BracketHighlightingSheme('(', ')')); bracketshemes.Add(new BracketHighlightingSheme('[', ']')); caret.PositionChanged += new EventHandler(SearchMatchingBracket); Document.TextContentChanged += new EventHandler(TextContentChanged); Document.FoldingManager.FoldingsChanged += new EventHandler(DocumentFoldingsChanged); }
void OnIconBarMarginMouseDown(ICSharpCode.TextEditor.AbstractMargin sender, Point mousepos, MouseButtons mouseButtons) { if (mouseButtons != MouseButtons.Left) { return; } ICSharpCode.TextEditor.IconBarMargin marginObj = (ICSharpCode.TextEditor.IconBarMargin)sender; Rectangle viewRect = marginObj.TextArea.TextView.DrawingPosition; Point logicPos = marginObj.TextArea.TextView.GetLogicalPosition(0, mousepos.Y - viewRect.Top); if (logicPos.Y >= 0 && logicPos.Y < marginObj.TextArea.Document.TotalNumberOfLines) { LineSegment l = marginObj.Document.GetLineSegment(logicPos.Y); string s = marginObj.Document.GetText(l); if (s.Trim().Length == 0) { return; } // FIXME: // Not quite happy with this. It's hidden. Also, removing // the breakpoint has extra code in OnBookmarkManager not // matching up with OnBookmarkAdded. this.textEditor.Document.BookmarkManager.AddMark ( new Breakpoint( this._filename, this.textEditor.Document, logicPos.Y ) ); this.RedrawBreakpoints(); marginObj.Paint(marginObj.TextArea.CreateGraphics(), marginObj.TextArea.DisplayRectangle); } }
public override void Paint(Graphics g, Rectangle rect) { if (rect.Width <= 0 || rect.Height <= 0) { return; } g.FillRectangle(SystemBrushes.Control, new Rectangle(this.drawingPosition.X, rect.Top, this.drawingPosition.Width - 1, rect.Height)); g.DrawLine(SystemPens.ControlDark, this.drawingPosition.Right - 1, rect.Top, this.drawingPosition.Right - 1, rect.Bottom); foreach (Bookmark mark in this.textArea.Document.BookmarkManager.Marks) { int visibleLine = this.textArea.Document.GetVisibleLine(mark.LineNumber); int fontHeight = this.textArea.TextView.FontHeight; Point virtualTop = this.textArea.VirtualTop; int y = visibleLine * fontHeight - virtualTop.Y; if (!IconBarMargin.IsLineInsideRegion(y, y + fontHeight, rect.Y, rect.Bottom) || visibleLine == this.textArea.Document.GetVisibleLine(mark.LineNumber - 1)) { continue; } mark.Draw(this, g, new Point(0, y)); } base.Paint(g, rect); }
public TextArea(TextEditorControl motherTextEditorControl, TextAreaControl motherTextAreaControl) { MotherTextAreaControl = motherTextAreaControl; MotherTextEditorControl = motherTextEditorControl; Caret = new Caret(this); SelectionManager = new SelectionManager(Document, this); MousePos = new Point(0, 0); ResizeRedraw = true; SetStyle(ControlStyles.OptimizedDoubleBuffer, true); // SetStyle(ControlStyles.AllPaintingInWmPaint, true); // SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.Opaque, false); SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.Selectable, true); TextView = new TextView(this); GutterMargin = new GutterMargin(this); FoldMargin = new FoldMargin(this); IconBarMargin = new IconBarMargin(this); _leftMargins.AddRange(new IMargin[] { IconBarMargin, GutterMargin, FoldMargin }); OptionsChanged(); new TextAreaMouseHandler(this).Attach(); //TODO1 refactor all these new TextAreaDragDropHandler().Attach(this); _bracketSchemes.Add(new BracketHighlightingSheme('{', '}')); //TODO1 hardcoded _bracketSchemes.Add(new BracketHighlightingSheme('(', ')')); _bracketSchemes.Add(new BracketHighlightingSheme('[', ']')); Caret.PositionChanged += new EventHandler(SearchMatchingBracket); Document.TextContentChanged += TextContentChanged; Document.FoldingManager.FoldingsChanged += new EventHandler(DocumentFoldingsChanged); }
public TextArea(TextEditorControl motherTextEditorControl, TextAreaControl motherTextAreaControl) { MotherTextAreaControl = motherTextAreaControl; MotherTextEditorControl = motherTextEditorControl; Caret = new Caret(this); SelectionManager = new SelectionManager(Document, this); ClipboardHandler = new TextAreaClipboardHandler(this); ResizeRedraw = true; SetStyle(ControlStyles.OptimizedDoubleBuffer, value: true); // SetStyle(ControlStyles.AllPaintingInWmPaint, true); // SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.Opaque, value: false); SetStyle(ControlStyles.ResizeRedraw, value: true); SetStyle(ControlStyles.Selectable, value: true); TextView = new TextView(this); GutterMargin = new GutterMargin(this); FoldMargin = new FoldMargin(this); IconBarMargin = new IconBarMargin(this); leftMargins.AddRange(new AbstractMargin[] { IconBarMargin, GutterMargin, FoldMargin }); OptionsChanged(); new TextAreaMouseHandler(this).Attach(); new TextAreaDragDropHandler().Attach(this); bracketshemes.Add(new BracketHighlightingSheme(opentag: '{', closingtag: '}')); bracketshemes.Add(new BracketHighlightingSheme(opentag: '(', closingtag: ')')); bracketshemes.Add(new BracketHighlightingSheme(opentag: '[', closingtag: ']')); Caret.PositionChanged += SearchMatchingBracket; Document.TextContentChanged += TextContentChanged; Document.FoldingManager.FoldingsChanged += DocumentFoldingsChanged; }
public TextArea(TextEditorControl motherTextEditorControl, TextAreaControl motherTextAreaControl) { this.motherTextAreaControl = motherTextAreaControl; this.motherTextEditorControl = motherTextEditorControl; caret = new Caret(this); selectionManager = new SelectionManager(Document); this.textAreaClipboardHandler = new TextAreaClipboardHandler(this); ResizeRedraw = true; SetStyle(ControlStyles.DoubleBuffer, false); // SetStyle(ControlStyles.AllPaintingInWmPaint, true); // SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.Opaque, false); SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.Selectable, true); textView = new TextView(this); gutterMargin = new GutterMargin(this); foldMargin = new FoldMargin(this); iconBarMargin = new IconBarMargin(this); leftMargins.AddRange(new AbstractMargin[] { iconBarMargin, gutterMargin, foldMargin }); OptionsChanged(); new TextAreaMouseHandler(this).Attach(); new TextAreaDragDropHandler().Attach(this); bracketshemes.Add(new BracketHighlightingSheme('{', '}')); bracketshemes.Add(new BracketHighlightingSheme('(', ')')); bracketshemes.Add(new BracketHighlightingSheme('[', ']')); caret.PositionChanged += new EventHandler(SearchMatchingBracket); Document.TextContentChanged += new EventHandler(TextContentChanged); Document.FoldingManager.FoldingsChanged += new EventHandler(DocumentFoldingsChanged); }
public override void Draw(IconBarMargin margin, Graphics g, Point p) { margin.DrawArrow(g, p.Y); }
public override void Draw(IconBarMargin margin, Graphics g, Point p) { g.DrawImageUnscaled(ClassBrowserIconService.ImageList.Images[ClassBrowserIconService.GetIcon(@class)], p); }
public override void Draw(IconBarMargin margin, Graphics g, Point p) { margin.DrawBreakpoint(g, p.Y, IsEnabled, WillBeHit); }
/// <summary> /// Draws the breakpoint icon. /// </summary> public override void Draw(ICSharpCode.TextEditor.IconBarMargin margin, System.Drawing.Graphics g, System.Drawing.Point p) { margin.DrawBreakpoint(g, p.Y, true, true); }
public override void Draw(ICSharpCode.TextEditor.IconBarMargin margin, Graphics g, Point p) { margin.DrawBreakpoint(g, p.Y, IsEnabled, true); }