public void OptionsChanged() { UpdateMatchingBracket(); TextView.OptionsChanged(); Caret.RecreateCaret(); Caret.UpdateCaretPosition(); Refresh(); }
public void OptionsChanged() { this.BackColor = Enabled ? Document.HighlightingStrategy.GetColorFor("Default").BackgroundColor : SystemColors.InactiveBorder; if (toolTip != null) { toolTip.Dispose(); } UpdateMatchingBracket(); textView.OptionsChanged(); caret.RecreateCaret(); caret.UpdateCaretPosition(); Refresh(); }
/// <summary> /// This method executes a dialog key /// </summary> public bool ExecuteDialogKey(Keys keyData) { // try, if a dialog key processor was set to use this if (DoProcessDialogKey != null && DoProcessDialogKey(keyData)) { return(true); } // if not (or the process was 'silent', use the standard edit actions IEditAction action = motherTextEditorControl.GetEditAction(keyData); AutoClearSelection = true; if (action != null) { BeginUpdate(); try { lock (Document) { action.Execute(this); if (SelectionManager.HasSomethingSelected && AutoClearSelection /*&& caretchanged*/) { if (Document.TextEditorProperties.DocumentSelectionMode == DocumentSelectionMode.Normal) { SelectionManager.ClearSelection(); } } } } finally { EndUpdate(); Caret.UpdateCaretPosition(); } return(true); } return(false); }
void DocumentFoldingsChanged(object sender, EventArgs e) { Caret.UpdateCaretPosition(); Invalidate(); this.motherTextAreaControl.AdjustScrollBars(); }
/// <summary> /// This method executes a dialog key /// </summary> public bool ExecuteDialogKey(Keys keyData) { // try, if a dialog key processor was set to use this if (DoProcessDialogKey != null && DoProcessDialogKey(keyData)) { return(true); } if (keyData == Keys.Back || keyData == Keys.Delete || keyData == Keys.Enter) { if (TextEditorProperties.UseCustomLine == true) { if (SelectionManager.HasSomethingSelected) { if (Document.CustomLineManager.IsReadOnly(SelectionManager.SelectionCollection[0], false)) { return(true); } } else { int curLineNr = Document.GetLineNumberForOffset(Caret.Offset); if (Document.CustomLineManager.IsReadOnly(curLineNr, false) == true) { return(true); } if ((Caret.Column == 0) && (curLineNr - 1 >= 0) && keyData == Keys.Back && Document.CustomLineManager.IsReadOnly(curLineNr - 1, false) == true) { return(true); } if (keyData == Keys.Delete) { LineSegment curLine = Document.GetLineSegment(curLineNr); if (curLine.Offset + curLine.Length == Caret.Offset && Document.CustomLineManager.IsReadOnly(curLineNr + 1, false) == true) { return(true); } } } } } // if not (or the process was 'silent', use the standard edit actions IEditAction action = motherTextEditorControl.GetEditAction(keyData); AutoClearSelection = true; if (action != null) { motherTextEditorControl.BeginUpdate(); try { lock (Document) { action.Execute(this); if (SelectionManager.HasSomethingSelected && AutoClearSelection /*&& caretchanged*/) { if (Document.TextEditorProperties.DocumentSelectionMode == DocumentSelectionMode.Normal) { SelectionManager.ClearSelection(); } } } } finally { motherTextEditorControl.EndUpdate(); Caret.UpdateCaretPosition(); } return(true); } return(false); }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { int currentXPos = 0; int currentYPos = 0; bool adjustScrollBars = false; Graphics g = e.Graphics; Rectangle clipRectangle = e.ClipRectangle; if (updateMargin != null) { updateMargin.Paint(g, updateMargin.DrawingPosition); // clipRectangle.Intersect(updateMargin.DrawingPosition); } if (clipRectangle.Width <= 0 || clipRectangle.Height <= 0) { return; } if (this.TextEditorProperties.UseAntiAliasedFont) { g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; } else { g.TextRenderingHint = TextRenderingHint.SystemDefault; } foreach (AbstractMargin margin in leftMargins) { if (margin.IsVisible) { Rectangle marginRectangle = new Rectangle(currentXPos, currentYPos, margin.Size.Width, Height - currentYPos); if (marginRectangle != margin.DrawingPosition) { adjustScrollBars = true; margin.DrawingPosition = marginRectangle; } currentXPos += margin.DrawingPosition.Width; if (clipRectangle.IntersectsWith(marginRectangle)) { marginRectangle.Intersect(clipRectangle); if (!marginRectangle.IsEmpty) { margin.Paint(g, marginRectangle); } } } } Rectangle textViewArea = new Rectangle(currentXPos, currentYPos, Width - currentXPos, Height - currentYPos); if (textViewArea != textView.DrawingPosition) { adjustScrollBars = true; textView.DrawingPosition = textViewArea; } if (clipRectangle.IntersectsWith(textViewArea)) { textViewArea.Intersect(clipRectangle); if (!textViewArea.IsEmpty) { textView.Paint(g, textViewArea); } } if (adjustScrollBars) { this.motherTextAreaControl.AdjustScrollBars(null, null); } Caret.UpdateCaretPosition(); base.OnPaint(e); }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { int currentXPos = 0; int currentYPos = 0; bool adjustScrollBars = false; Graphics g = e.Graphics; Rectangle clipRectangle = e.ClipRectangle; bool isFullRepaint = clipRectangle.X == 0 && clipRectangle.Y == 0 && clipRectangle.Width == this.Width && clipRectangle.Height == this.Height; g.TextRenderingHint = this.TextEditorProperties.TextRenderingHint; if (updateMargin != null) { updateMargin.Paint(g, updateMargin.DrawingPosition); // clipRectangle.Intersect(updateMargin.DrawingPosition); } if (clipRectangle.Width <= 0 || clipRectangle.Height <= 0) { return; } foreach (AbstractMargin margin in leftMargins) { if (margin.IsVisible) { Rectangle marginRectangle = new Rectangle(currentXPos, currentYPos, margin.Size.Width, Height - currentYPos); if (marginRectangle != margin.DrawingPosition) { // margin changed size if (!isFullRepaint && !clipRectangle.Contains(marginRectangle)) { Invalidate(); // do a full repaint } adjustScrollBars = true; margin.DrawingPosition = marginRectangle; } currentXPos += margin.DrawingPosition.Width; if (clipRectangle.IntersectsWith(marginRectangle)) { marginRectangle.Intersect(clipRectangle); if (!marginRectangle.IsEmpty) { margin.Paint(g, marginRectangle); } } } } Rectangle textViewArea = new Rectangle(currentXPos, currentYPos, Width - currentXPos, Height - currentYPos); if (textViewArea != textView.DrawingPosition) { adjustScrollBars = true; textView.DrawingPosition = textViewArea; } if (clipRectangle.IntersectsWith(textViewArea)) { textViewArea.Intersect(clipRectangle); if (!textViewArea.IsEmpty) { textView.Paint(g, textViewArea); } } if (adjustScrollBars) { this.motherTextAreaControl.AdjustScrollBars(); } Caret.UpdateCaretPosition(); base.OnPaint(e); }