internal 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.PtrToStringUtf8(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);
        }
예제 #2
0
 protected virtual void OnMarkerChanged(MarkerChangedEventArgs e)
 {
     if (Events[_markerChangedEventKey] != null)
         ((EventHandler<MarkerChangedEventArgs>)Events[_markerChangedEventKey])(this, e);
 }