Provides data for native Scintilla Events
All events fired from the INativeScintilla Interface uses NativeScintillaEventArgs. Msg is a copy of the Notification Message sent to Scintilla's Parent WndProc and SCNotification is the SCNotification Struct pointed to by Msg's lParam.
Inheritance: System.EventArgs
        internal void FireCallTipClick(NativeScintillaEventArgs ea)
        {
            if(Events[_callTipClickEventKeyNative] != null)
                ((EventHandler<NativeScintillaEventArgs>)Events[_callTipClickEventKeyNative])(this, ea);

            FireCallTipClick(ea.SCNotification.position);
        }
        internal void FireAutoCSelection(NativeScintillaEventArgs ea)
        {
            if (Events[_autoCSelectionEventKey] != null)
                ((EventHandler<NativeScintillaEventArgs>)Events[_autoCSelectionEventKey])(this, ea);

            OnAutoCompleteAccepted(new AutoCompleteAcceptedEventArgs(ea.SCNotification, _encoding));
        }
        internal void FireDwellEnd(NativeScintillaEventArgs ea)
        {
            if(Events[_dwellEndEventKeyNative] != null)
                ((EventHandler<NativeScintillaEventArgs>)Events[_dwellEndEventKeyNative])(this, ea);

            OnDwellEnd(new ScintillaMouseEventArgs(ea.SCNotification.x, ea.SCNotification.y, ea.SCNotification.position));
        }
        internal void FireCharAdded(NativeScintillaEventArgs ea)
        {
            
            if(Events[_charAddedEventKeyNative] != null)
                ((EventHandler<NativeScintillaEventArgs>)Events[_charAddedEventKeyNative])(this, ea);

            OnCharAdded(new CharAddedEventArgs(ea.SCNotification.ch));
        }
Example #5
0
 private void txtSnippet_DocumentChange(object sender, NativeScintillaEventArgs e)
 {
     ////	If for any reason the window DOES manage to hide itself
     ////	we merely reshow it.
     if (!txtSnippet.AutoComplete.IsActive && Visible)
     {
         int pos = Scintilla.Caret.Position;
         Scintilla.Caret.Goto(0);
         txtSnippet.AutoComplete.Show(0, _snippetList);
         Scintilla.Caret.Goto(pos);
     }
 }
Example #6
0
 private void sciEdit_DocumentChange(object sender, NativeScintillaEventArgs e)
 {
     PosMarker.Text = "Line: "+(sciEdit.Lines.Current.Number+1).ToString() + " Column: " + (sciEdit.GetColumn(sciEdit.CurrentPos)+1);
 }
        internal void FireIndicatorClick(NativeScintillaEventArgs ea)
        {
            if (Events[_indicatorClickKeyNative] != null)
                ((EventHandler<NativeScintillaEventArgs>)Events[_indicatorClickKeyNative])(this, ea);

            OnIndicatorClick(new ScintillaMouseEventArgs(ea.SCNotification.x, ea.SCNotification.y, ea.SCNotification.position));
        }
 protected virtual void OnScintillaUiEvent( NativeScintillaEventArgs args )
 {
     EventHandler handler = ScintillaUIEvent;
     if (handler != null) handler( this, args );
 }
 internal void FireUserListSelection(NativeScintillaEventArgs ea)
 {
     if(Events[_userListSelectionEventKeyNative] != null)
         ((EventHandler<NativeScintillaEventArgs>)Events[_userListSelectionEventKeyNative])(this, ea);
 }
        internal void FireZoom(NativeScintillaEventArgs ea)
        {
            if(Events[_zoomEventKey] != null)
                ((EventHandler<NativeScintillaEventArgs>)Events[_zoomEventKey])(this, ea);

            OnZoomChanged(EventArgs.Empty);
        }
        internal void FireMacroRecord(NativeScintillaEventArgs ea)
        {
            if(Events[_macroRecordEventKeyNative] != null)
                ((EventHandler<NativeScintillaEventArgs>)Events[_macroRecordEventKeyNative])(this, ea);

            OnMacroRecord(new MacroRecordEventArgs(ea));
        }
 internal void FireUriDropped(NativeScintillaEventArgs ea)
 {
     if(Events[_uriDroppedEventKeyNative] != null)
         ((EventHandler<NativeScintillaEventArgs>)Events[_uriDroppedEventKeyNative])(this, ea);
 }
Example #13
0
 private void txtSnippet_DocumentChange(object sender, NativeScintillaEventArgs e)
 {
     ////	If for any reason the window DOES manage to hide itself
     ////	we merely reshow it.
     if (!txtSnippet.AutoComplete.IsActive && Visible)
     {
         int pos = Scintilla.Caret.Position;
         Scintilla.Caret.Goto(0);
         txtSnippet.AutoComplete.Show(0, _snippetList);
         Scintilla.Caret.Goto(pos);
     }
 }
Example #14
0
 /// <summary>
 ///     Raises the <see cref="DocumentChange"/> event.
 /// </summary>
 /// <param name="e">An <see cref="NativeScintillaEventArgs"/> that contains the event data.</param>
 protected virtual void OnDocumentChange(NativeScintillaEventArgs e)
 {
     EventHandler<NativeScintillaEventArgs> handler = Events[_documentChangeEventKey] as EventHandler<NativeScintillaEventArgs>;
     if (handler != null)
         handler(this, e);
 }
        internal void FireNeedShown(NativeScintillaEventArgs ea)
        {
            if(Events[_needShownEventKey] != null)
                ((EventHandler<NativeScintillaEventArgs>)Events[_needShownEventKey])(this, ea);

            //	Again, this shoold look familiar...
            int pos			= ea.SCNotification.position;
            int firstLine	= _ns.LineFromPosition(pos);
            int lastLine	= _ns.LineFromPosition(pos + ea.SCNotification.length - 1);
            OnLinesNeedShown(new LinesNeedShownEventArgs(firstLine, lastLine));
        }
 /// <summary>
 ///     Initializes a new instance of the MacroRecordEventArgs class.
 /// </summary>
 /// <param name="ea">NativeScintillaEventArgs object containing the message data</param>
 public MacroRecordEventArgs(NativeScintillaEventArgs ea)
 {
     _recordedMessage = ea.Msg;
     _recordedMessage.LParam = ea.SCNotification.lParam;
     _recordedMessage.WParam = ea.SCNotification.wParam;
 }
        internal void FireModifyAttemptRO(NativeScintillaEventArgs ea)
        {
            if(Events[_modifyAttemptROEventKey] != null)
                ((EventHandler<NativeScintillaEventArgs>)Events[_modifyAttemptROEventKey])(this, ea);

            OnReadOnlyModifyAttempt(EventArgs.Empty);
        }
        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);
        }
        internal void FireMarginClick(NativeScintillaEventArgs ea)
        {
            if(Events[_marginClickEventKeyNative] != null)
                ((EventHandler<NativeScintillaEventArgs>)Events[_marginClickEventKeyNative])(this, ea);

            FireMarginClick(ea.SCNotification);
        }
 internal void FireDoubleClick(NativeScintillaEventArgs ea)
 {
     if(Events[_doubleClickEventKey] != null)
         ((EventHandler<NativeScintillaEventArgs>)Events[_doubleClickEventKey])(this, ea);
 }
Example #21
0
 //trigger autosave on change
 private void scEdit_DocumentChange(object sender, NativeScintillaEventArgs e)
 {
     if (saveTimer == null) {
     saveTimer = new Timer();
     saveTimer.Interval = 5000;
     saveTimer.Tick += saveTimer_Elapsed;
       }
       if (statusText.Text != Glob.Changed) statusText.Text = Glob.Changed;
       saveTimer.Stop();
       saveTimer.Start();
 }
 internal void FirePainted(NativeScintillaEventArgs ea)
 {
     if(Events[_paintedEventKey] != null)
         ((EventHandler<NativeScintillaEventArgs>)Events[_paintedEventKey])(this, ea);
 }
 internal void FireIndicatorRelease(NativeScintillaEventArgs ea)
 {
     if (Events[_indicatorReleaseKeyNative] != null)
         ((EventHandler<NativeScintillaEventArgs>)Events[_indicatorReleaseKeyNative])(this, ea);
 }
Example #24
0
 private void AWBEditor_DocumentChange(object sender, NativeScintillaEventArgs e)
 {
     int i = 0;
 }
        internal void FireSavePointReached(NativeScintillaEventArgs ea)
        {
            if(Events[_savePointReachedEventKeyNative] != null)
                ((EventHandler<NativeScintillaEventArgs>)Events[_savePointReachedEventKeyNative])(this, ea);

            // Update the local property (and if necessary raise the changed event)
            Modified = false;
        }
Example #26
0
 /// <summary>
 ///     Initializes a new instance of the MacroRecordEventArgs class.
 /// </summary>
 /// <param name="ea">NativeScintillaEventArgs object containing the message data</param>
 public MacroRecordEventArgs(NativeScintillaEventArgs ea)
 {
     _recordedMessage        = ea.Msg;
     _recordedMessage.LParam = ea.SCNotification.lParam;
     _recordedMessage.WParam = ea.SCNotification.wParam;
 }
        internal void FireStyleNeeded(NativeScintillaEventArgs ea)
        {
            if(Events[_styleNeededEventKeyNative] != null)
                ((EventHandler<NativeScintillaEventArgs>)Events[_styleNeededEventKeyNative])(this, ea);

            //	TODO: When this event fires it fires A LOT over and over again if
            //	you don't actually style the document. Additionally I'm making 2
            //	more calls to Scintilla to get the Start position of the style
            //	range. I need to come up with a good way to supress this logic
            //	unless the client app is actually interested in it. 

            //	Now that we've fired the Native event we do the same for the
            //	SourceEdit's StyleNeeded event. This code should look VERY familliar
            //	to anyone who's read the Scintilla Documentation
            int startPos	= _ns.GetEndStyled();
            int lineNumber	= _ns.LineFromPosition(startPos);
            startPos		= _ns.PositionFromLine(lineNumber);

            StyleNeededEventArgs snea = new StyleNeededEventArgs(new Range(startPos, ea.SCNotification.position, this));
            OnStyleNeeded(snea);
        }
Example #28
0
        private void WmReflectNotify(ref Message m)
        {
            // New *internal* structure...
            NativeMethods.SCNotification scn = (NativeMethods.SCNotification)Marshal.PtrToStructure(m.LParam, typeof(NativeMethods.SCNotification));

            // Old *public* *outdated* structure and event args...
            SCNotification scnOld = (SCNotification)Marshal.PtrToStructure(m.LParam, typeof(SCNotification));
            NativeScintillaEventArgs nsea = new NativeScintillaEventArgs(m, scnOld);

            switch (scnOld.nmhdr.code)
            {
                case Constants.SCN_AUTOCSELECTION:
                    FireAutoCSelection(nsea);
                    break;

                case Constants.SCN_CALLTIPCLICK:
                    FireCallTipClick(nsea);
                    break;

                case Constants.SCN_CHARADDED:
                    FireCharAdded(nsea);
                    break;

                case Constants.SCN_DOUBLECLICK:
                    FireDoubleClick(nsea);
                    break;

                case Constants.SCN_DWELLEND:
                    FireDwellEnd(nsea);
                    break;

                case Constants.SCN_DWELLSTART:
                    FireDwellStart(nsea);
                    break;

                case NativeMethods.SCN_HOTSPOTCLICK:
                    OnHotspotClick(new HotspotClickEventArgs(scn.position));
                    break;

                case NativeMethods.SCN_HOTSPOTDOUBLECLICK:
                    OnHotspotDoubleClick(new HotspotClickEventArgs(scn.position));
                    break;

                case NativeMethods.SCN_HOTSPOTRELEASECLICK:
                    OnHotspotReleaseClick(new HotspotClickEventArgs(scn.position));
                    break;

                case Constants.SCN_INDICATORCLICK:
                    FireIndicatorClick(nsea);
                    break;

                case Constants.SCN_INDICATORRELEASE:
                    FireIndicatorRelease(nsea);
                    break;

                case Constants.SCN_KEY:
                    FireKey(nsea);
                    break;

                case Constants.SCN_MACRORECORD:
                    FireMacroRecord(nsea);
                    break;

                case Constants.SCN_MARGINCLICK:
                    FireMarginClick(nsea);
                    break;

                case Constants.SCN_MODIFIED:
                    ScnModified(ref scn);
                    FireModified(nsea);
                    break;

                case Constants.SCN_MODIFYATTEMPTRO:
                    FireModifyAttemptRO(nsea);
                    break;

                case Constants.SCN_NEEDSHOWN:
                    FireNeedShown(nsea);
                    break;

                case Constants.SCN_PAINTED:
                    FirePainted(nsea);
                    break;

                case Constants.SCN_SAVEPOINTLEFT:
                    FireSavePointLeft(nsea);
                    break;

                case Constants.SCN_SAVEPOINTREACHED:
                    FireSavePointReached(nsea);
                    break;

                case Constants.SCN_STYLENEEDED:
                    FireStyleNeeded(nsea);
                    break;

                case Constants.SCN_UPDATEUI:
                    FireUpdateUI(nsea);
                    break;

                case Constants.SCN_URIDROPPED:
                    FireUriDropped(nsea);
                    break;

                case Constants.SCN_USERLISTSELECTION:
                    FireUserListSelection(nsea);
                    break;

                case Constants.SCN_ZOOM:
                    FireZoom(nsea);
                    break;
            }
        }
        internal void FireUpdateUI(NativeScintillaEventArgs ea)
        {
            if (Events[_updateUIEventKey] != null)
                ((EventHandler<NativeScintillaEventArgs>)Events[_updateUIEventKey])(this, ea);

            //	The SCN_UPDATEUI Notification message is sent whenever text, style or
            //	selection range changes. This means that the SelectionChangeEvent could
            //	potentially fire without the selection actually having changed. However
            //	I feel that it's important enough that SelectionChanged gets its own
            //	event.

            if (lastSelection.Start != this.Selection.Start
            || lastSelection.End != this.Selection.End
            || lastSelection.Length != this.Selection.Length)
            {
                OnSelectionChanged(EventArgs.Empty);
            }

            //I think the selection changed event should only be fired if the selection differs
            //from the selection values in the previous call to this function			
            //so here we take note of what the selection was last time 
            lastSelection.Start = this.Selection.Start;
            lastSelection.End = this.Selection.End;
            lastSelection.Length = this.Selection.Length;
        }