protected virtual void OnScintillaUiEvent(NativeScintillaEventArgs args) { EventHandler handler = ScintillaUIEvent; if (handler != null) { handler(this, args); } }
// Scintilla is firing off TextChanged events when no changes have ocurred private void SourceChanged(object sender, NativeScintillaEventArgs e) { assembly = null; if (saved) { saved = false; Text = WindowTitle(); } }
private void Editor_DocumentChange(object sender, NativeScintillaEventArgs e) { if (!this._bLoaded || this.Text.EndsWith("*")) { return; } this.Text = this.Text + " *"; this._bChanged = true; }
/// <summary> /// DocumentChange event handler for ToggleScrollBarsVisible method. /// </summary> private static void ToggleScrollBarsScintillaDocumentChange(object sender, NativeScintillaEventArgs e) { var scintilla = (Scintilla)sender; // before insert: we need to capture the lines added, since we do not get them later if ((e.SCNotification.modificationType & Constants.SC_MOD_INSERTTEXT) != 0) { _modificationType = Constants.SC_MOD_INSERTTEXT; _textInsertStartLine = scintilla.Caret.LineNumber; _textInsertEndLine = _textInsertStartLine + e.SCNotification.linesAdded; } // after insert: only scan new lines else if (e.SCNotification.modificationType == 0x14 && _modificationType == Constants.SC_MOD_INSERTTEXT) { _modificationType = 0; _longestLineIndex = GetMaxLineIndex(scintilla, _longestLineIndex, _textInsertStartLine, _textInsertEndLine); _longestLineLength = scintilla.Lines[_longestLineIndex].Length; } // after delete: do selective scan for longest line else if ((e.SCNotification.modificationType & Constants.SC_MOD_DELETETEXT) != 0) { _modificationType = 0; if (_longestLineIndex == scintilla.Caret.LineNumber) { // we need a full scan, if parts of the current line were deleted if (_longestLineLength > scintilla.Lines[scintilla.Caret.LineNumber].Length) { _longestLineIndex = GetMaxLineIndex(scintilla, 0, 0, scintilla.Lines.Count); _longestLineLength = scintilla.Lines[_longestLineIndex].Length; } } // we need a full scan, if one of the deleted lines contained the longest line else if (_longestLineIndex >= scintilla.Caret.LineNumber && _longestLineIndex <= scintilla.Caret.LineNumber - e.SCNotification.linesAdded) { _longestLineIndex = GetMaxLineIndex(scintilla, 0, 0, scintilla.Lines.Count); _longestLineLength = scintilla.Lines[_longestLineIndex].Length; } // scan beyond current line, if longest line was below deleted lines else if (_longestLineIndex > scintilla.Caret.LineNumber - e.SCNotification.linesAdded) { _longestLineIndex = GetMaxLineIndex(scintilla, _longestLineIndex, scintilla.Caret.LineNumber, scintilla.Lines.Count); _longestLineLength = scintilla.Lines[_longestLineIndex].Length; } } }
private void scintilla_DocumentChange(object sender, NativeScintillaEventArgs e) { if (this.addSpace && ((e.SCNotification.modificationType & 4) != 0)) { this.addSpace = false; if (this.Scintilla.CharAt(this.Scintilla.CurrentPos - 1) == ')') { this.Scintilla.UndoRedo.Undo(); } this.Scintilla.InsertText(" )"); this.Scintilla.CurrentPos = this.Scintilla.CurrentPos - 1; } }
private void EditorView_DocumentChange(object sender, NativeScintillaEventArgs e) { //update line marging to suit the content const int LINENUMBER_MARGIN = 0; const int STYLE_LINENUMBER = 33; int Ratio = (int)this.EditorView.Styles[STYLE_LINENUMBER].Font.Size; if (this.LineMarginWidth < Ratio * this.EditorView.Lines.Count.ToString().Length) { this.LineMarginWidth = Ratio * this.EditorView.Lines.Count.ToString().Length; this.EditorView.Margins[LINENUMBER_MARGIN].Width = this.LineMarginWidth + 4; } //update the title to notify that the doc has changed if (this.EditorView.Modified) { if (!this.TabText.EndsWith(" *")) { TabText += " *"; } } }
/// <summary> /// Check if cursor is on a brace or not, highlighting if necessary /// </summary> private void Scintilla_NativeInterface_UpdateUI(object sender, NativeScintillaEventArgs e) { Scintilla scintilla = (Scintilla)sender; int pos = scintilla.CurrentPos; if (IsBrace(pos) || IsBrace(--pos)) { int match = scintilla.NativeInterface.BraceMatch(pos, 0); if (match != -1) { scintilla.NativeInterface.BraceHighlight(pos, match); } else { scintilla.NativeInterface.BraceBadLight(pos); } } else { scintilla.NativeInterface.BraceHighlight(-1, -1); } }
private void Scintilla_DocumentChange(object sender, NativeScintillaEventArgs e) { SetStatusLabels(); }
private void AWBEditor_DocumentChange(object sender, NativeScintillaEventArgs e) { int i = 0; }
private void editor_DocumentChange(object sender, NativeScintillaEventArgs e) { modifiedDocument = true; }