/// <summary> /// Raises the <see cref="FoldChanged"/> event. /// </summary> /// <param name="e">An <see cref="FoldChangedEventArgs"/> that contains the event data.</param> protected virtual void OnFoldChanged(FoldChangedEventArgs e) { EventHandler<FoldChangedEventArgs> handler = Events[_foldChangedEventKey] as EventHandler<FoldChangedEventArgs>; if (handler != null) handler(this, e); }
private void FireModified(NativeScintillaEventArgs ea) { // First we fire the INativeScintilla Modified event. if(Events[_modifiedEventKey] != null) ((EventHandler<NativeScintillaEventArgs>)Events[_modifiedEventKey])(this, ea); // Now we use raw information from the Modified event to construct // some more user friendly Events to fire. SCNotification scn = ea.SCNotification; int modType = scn.modificationType; if((modType & TEXT_MODIFIED_FLAGS) > 0) { TextModifiedEventArgs mea = new TextModifiedEventArgs ( modType, (modType & Constants.SC_PERFORMED_USER) != 0, scn.line, scn.position, scn.length, scn.linesAdded, Utilities.IntPtrToString(_encoding, scn.text, scn.length) ); // These messages all get fired seperately hence the if else ifs if ((modType & Constants.SC_MOD_BEFOREDELETE) > 0) { OnBeforeTextDelete(mea); } else if ((modType & Constants.SC_MOD_BEFOREINSERT) > 0) { OnBeforeTextInsert(mea); } else if ((modType & Constants.SC_MOD_DELETETEXT) > 0) { OnTextDeleted(mea); } else if ((modType & Constants.SC_MOD_INSERTTEXT) > 0) { OnTextInserted(mea); } } else if((modType & Constants.SC_MOD_CHANGEFOLD) > 0) { FoldChangedEventArgs fea = new FoldChangedEventArgs(scn.line, scn.foldLevelNow, scn.foldLevelPrev, scn.modificationType); OnFoldChanged(fea); } else if((modType & Constants.SC_MOD_CHANGESTYLE) > 0) { StyleChangedEventArgs sea = new StyleChangedEventArgs(scn.position, scn.length, scn.modificationType); OnStyleChanged(sea); } else if((modType & Constants.SC_MOD_CHANGEMARKER) > 0) { MarkerChangedEventArgs mea = new MarkerChangedEventArgs(scn.line, scn.modificationType); OnMarkerChanged(mea); } OnDocumentChange(ea); }