Beispiel #1
0
        protected override void WndProc(ref Message m)
        {
            //	Uh-oh. Code based on undocumented unsupported .NET behavior coming up!
            //	Windows Forms Sends Notify messages back to the originating
            //	control ORed with 0x2000. This is way cool becuase we can listen for
            //	WM_NOTIFY messages originating form our own hWnd (from Scintilla)
            if ((m.Msg ^ 0x2000) != NativeMethods.WM_NOTIFY)
            {
                base.WndProc(ref m);
                return;
            }

            SCNotification scnotification = (SCNotification)Marshal.PtrToStructure(m.LParam, typeof(SCNotification));

            // dispatch to listeners of the native event first
            // this allows listeners to get the raw event if they really wish
            // but ideally, they'd just use the .NET event
            if (Events[_nativeEventKey] != null)
            {
                ((EventHandler <NativeScintillaEventArgs>)Events[_nativeEventKey])(this, new NativeScintillaEventArgs(m, scnotification));
            }

            DispatchScintillaEvent(scnotification);
            base.WndProc(ref m);
        }
Beispiel #2
0
        internal AutoCSelectionEventArgs(SCNotification eventSource)
        {
            _wordStartPosition = (int)eventSource.lParam;

            //	I'm pretty sure this is bad, but not positive. I don't quite know which of the
            //	which of Scintilla's strings support non-ANSI besides the main document text
            _text = Marshal.PtrToStringAnsi(eventSource.text);
        }
Beispiel #3
0
 internal ModifiedEventArgs(SCNotification eventSource)
     : this(eventSource.modificationType)
 {
     _foldLevelNow    = eventSource.foldLevelNow;
     _foldLevelPrev   = eventSource.foldLevelPrev;
     _length          = eventSource.length;
     _line            = eventSource.line;
     _linesAddedCount = eventSource.linesAdded;
     _position        = eventSource.position;
     _text            = Utilities.PtrToStringUtf8(eventSource.text, eventSource.length);
 }
Beispiel #4
0
        public void StyleDialog(SCNotification notify) //THIS NEED REFACTORING OUT OF THIS CLASS
        {
            if (!IsDialog)
            {
                return;
            }

            int line_number = SendMessageDirect(Constants.SCI_LINEFROMPOSITION, SendMessageDirect(Constants.SCI_GETENDSTYLED));
            int end_pos     = notify.position;

            Style(line_number, end_pos);
        }
Beispiel #5
0
        protected override void WndProc(ref Message m)
        {
            //	If we get a destroy message we make this window
            //	a message-only window so that it doesn't actually
            //	get destroyed, causing Scintilla to wipe out all
            //	its settings associated with this window handle.
            //	We do send a WM_DESTROY message to Scintilla in the
            //	Dispose() method so that it does clean up its
            //	resources when this control is actually done with.
            //	Solution was taken from QuickSharp.
            if (m.Msg == WinAPI.WM_DESTROY)
            {
                if (this.IsHandleCreated)
                {
                    WinAPI.SetParent(this.Handle, WinAPI.HWND_MESSAGE);
                    return;
                }
            }
            // [AVD] moving this above WM_NOTIFY fixes cursor flickering and cpu usage on W10
            else if (m.Msg == WinAPI.WM_SETCURSOR)
            {
                base.DefWndProc(ref m); // Make sure message is sent to Scintilla
                return;
            }
            //	Uh-oh. Code based on undocumented unsupported .NET behavior coming up!
            //	Windows Forms Sends Notify messages back to the originating
            //	control ORed with 0x2000. This is way cool becuase we can listen for
            //	WM_NOTIFY messages originating form our own hWnd (from Scintilla)
            else if ((m.Msg ^ 0x2000) != WinAPI.WM_NOTIFY)
            {
                base.WndProc(ref m);
                return;
            }


            SCNotification scnotification = (SCNotification)Marshal.PtrToStructure(m.LParam, typeof(SCNotification));

            // dispatch to listeners of the native event first
            // this allows listeners to get the raw event if they really wish
            // but ideally, they'd just use the .NET event
            if (Events[_nativeEventKey] != null)
            {
                ((EventHandler <NativeScintillaEventArgs>)Events[_nativeEventKey])(this, new NativeScintillaEventArgs(m, scnotification));
            }

            DispatchScintillaEvent(scnotification);
            base.WndProc(ref m);
        }
Beispiel #6
0
 internal CharAddedEventArgs(SCNotification eventSource)
     : this(eventSource.ch)
 {
 }
Beispiel #7
0
 internal StyleChangedEventArgs(SCNotification eventSource)
     : base(eventSource)
 {
 }
Beispiel #8
0
 internal HotspotClickEventArgs(SCNotification eventSource)
     : this(eventSource.modifiers, eventSource.position)
 {
 }
Beispiel #9
0
 internal UriDroppedEventArgs(SCNotification eventSource)
 {
 }
Beispiel #10
0
 internal FoldChangedEventArgs(SCNotification eventSource)
     : this(eventSource.line, eventSource.foldLevelNow, eventSource.foldLevelPrev, eventSource.modificationType)
 {
 }
Beispiel #11
0
 internal UserListSelectionEventArgs(SCNotification eventSource) : base(eventSource)
 {
     _listType = (int)eventSource.wParam;
 }
Beispiel #12
0
        internal SCKeyEventArgs(SCNotification eventSource)
			: this(eventSource.ch, eventSource.modifiers){}
Beispiel #13
0
 internal ModifyAttemptROEventArgs(SCNotification eventSource)
 {
 }
Beispiel #14
0
 internal ModifyAttemptROEventArgs(SCNotification eventSource)
 {
 }
Beispiel #15
0
        internal SCDoubleClickEventArgs(SCNotification eventSource)
			: this(eventSource.position, eventSource.line){}
Beispiel #16
0
 internal SavePointLeftEventArgs(SCNotification eventSource)
 {
 }
Beispiel #17
0
 internal SavePointReachedEventArgs(SCNotification eventSource)
 {
 }
Beispiel #18
0
		internal AutoCSelectionEventArgs(SCNotification eventSource)
		{
			_wordStartPosition = (int)eventSource.lParam;

			//	I'm pretty sure this is bad, but not positive. I don't quite know which of the
			//	which of Scintilla's strings support non-ANSI besides the main document text
			_text = Marshal.PtrToStringAnsi(eventSource.text);
		}
Beispiel #19
0
 internal UriDroppedEventArgs(SCNotification eventSource)
 {
 }
Beispiel #20
0
 internal UpdateUIEventArgs(SCNotification eventSource)
 {
 }
Beispiel #21
0
 internal SavePointReachedEventArgs(SCNotification eventSource)
 {
 }
Beispiel #22
0
        internal MacroRecordEventArgs(SCNotification eventSource)
        {
			_message		= new Message();
			_message.HWnd	= eventSource.nmhdr.hwndFrom;
			_message.LParam = eventSource.lParam;
			_message.WParam = eventSource.wParam;
        }
Beispiel #23
0
 internal SCKeyEventArgs(SCNotification eventSource)
     : this(eventSource.ch, eventSource.modifiers)
 {
 }
Beispiel #24
0
        internal MarginClickEventArgs(SCNotification eventSource)
			: this(eventSource.modifiers, eventSource.position, eventSource.margin){}
Beispiel #25
0
 internal NeedShownEventArgs(SCNotification eventSource)
 {
     _position = eventSource.position;
     _length   = eventSource.length;
 }
Beispiel #26
0
		internal FoldChangedEventArgs(SCNotification eventSource) 
			: this(eventSource.line, eventSource.foldLevelNow, eventSource.foldLevelPrev, eventSource.modificationType){}
Beispiel #27
0
 internal DwellEndEventArgs(SCNotification eventSource) : base(eventSource)
 {
 }
Beispiel #28
0
        internal NeedShownEventArgs(SCNotification eventSource)
        {
			_position	= eventSource.position;
			_length		= eventSource.length;
        }
Beispiel #29
0
 internal CallTipClickEventArgs(SCNotification eventSource)
     : this(eventSource.position)
 {
 }
Beispiel #30
0
        internal PaintedEventArgs(SCNotification eventSource)
        {

        }
Beispiel #31
0
		internal StyleChangedEventArgs(SCNotification eventSource)
			: base(eventSource){}
Beispiel #32
0
        internal UserListSelectionEventArgs(SCNotification eventSource) : base(eventSource)
        {
			_listType = (int)eventSource.wParam;
        }
Beispiel #33
0
 internal NativeScintillaEventArgs(Message Msg, SCNotification notification)
 {
     _msg          = Msg;
     _notification = notification;
 }
Beispiel #34
0
		internal DwellEventArgs(SCNotification eventSource) 
			: this(eventSource.position, eventSource.x, eventSource.y) { }
Beispiel #35
0
 internal StyleNeededEventArgs(SCNotification eventSource)
 {
     _position = eventSource.position;
 }
Beispiel #36
0
		internal DwellEndEventArgs(SCNotification eventSource) : base(eventSource) { }
Beispiel #37
0
 public DwellStartEventArgs(SCNotification eventSource)
 {
     _x        = eventSource.x;
     _y        = eventSource.y;
     _position = eventSource.position;
 }
Beispiel #38
0
 internal SCZoomEventArgs(SCNotification eventSource)
 {
 }
Beispiel #39
0
 internal SavePointLeftEventArgs(SCNotification eventSource)
 {
 }
Beispiel #40
0
        internal HotspotClickEventArgs(SCNotification eventSource)
			: this(eventSource.modifiers, eventSource.position){}
Beispiel #41
0
 internal SCDoubleClickEventArgs(SCNotification eventSource)
     : this(eventSource.position, eventSource.line)
 {
 }
Beispiel #42
0
		internal HotspotDoubleClickEventArgs(SCNotification eventSource) : base(eventSource) { }
Beispiel #43
0
 internal UpdateUIEventArgs(SCNotification eventSource)
 {
 }
Beispiel #44
0
        internal CallTipClickEventArgs(SCNotification eventSource)
	       : this(eventSource.position){}
Beispiel #45
0
 internal MarginClickEventArgs(SCNotification eventSource)
     : this(eventSource.modifiers, eventSource.position, eventSource.margin)
 {
 }
Beispiel #46
0
 public DwellStartEventArgs(SCNotification eventSource)
 {
     _x = eventSource.x;
     _y = eventSource.y;
     _position = eventSource.position;
 }
Beispiel #47
0
 internal PaintedEventArgs(SCNotification eventSource)
 {
 }
Beispiel #48
0
 public MarginClickEventArgs(SCNotification eventSource, int lineNumber)
 {
     _margin = eventSource.margin;
     _lineNumber = lineNumber;
 }
Beispiel #49
0
 internal DwellEventArgs(SCNotification eventSource)
     : this(eventSource.position, eventSource.x, eventSource.y)
 {
 }
Beispiel #50
0
        public void StyleDialog(SCNotification notify) //THIS NEED REFACTORING OUT OF THIS CLASS
        {
            if (!IsDialog) return;

            int line_number = SendMessageDirect(Constants.SCI_LINEFROMPOSITION, SendMessageDirect(Constants.SCI_GETENDSTYLED));
            int end_pos = notify.position;
                             
            Style(line_number, end_pos);


                        
    

        }
Beispiel #51
0
 internal SCZoomEventArgs(SCNotification eventSource)
 {
 }
Beispiel #52
0
 internal CharAddedEventArgs(SCNotification eventSource)
     : this(eventSource.ch) { }
Beispiel #53
0
 internal HotspotDoubleClickEventArgs(SCNotification eventSource) : base(eventSource)
 {
 }
Beispiel #54
0
 public MarginClickEventArgs(SCNotification eventSource, int lineNumber)
 {
     _margin     = eventSource.margin;
     _lineNumber = lineNumber;
 }
Beispiel #55
0
 public NativeScintillaEventArgs(Message Msg, SCNotification notification)
 {
     _msg = Msg;
     _notification = notification;
 }
Beispiel #56
0
        internal StyleNeededEventArgs(SCNotification eventSource)
        {
			_position = eventSource.position;
        }
Beispiel #57
0
        protected void DispatchScintillaEvent(SCNotification notification)
        {
            switch (notification.nmhdr.code)
            {

                case Scintilla.Enums.Events.StyleNeeded:

                        
                        StyleDialog(notification);
                       

                    break;
                    
                case Scintilla.Enums.Events.MarginClick:

                    int lineNumber = SendMessageDirect(Constants.SCI_LINEFROMPOSITION, notification.position, 0);                                   
                      MarginClick(this, new MarginClickEventArgs(notification, lineNumber));
                    break;
                case Scintilla.Enums.Events.AutoCSelection:
                    if (Events[Scintilla.Enums.Events.AutoCSelection] != null)
                        ((EventHandler<AutoCSelectionEventArgs>)Events[Scintilla.Enums.Events.AutoCSelection])(this, new AutoCSelectionEventArgs(notification));
                    break;

                case Scintilla.Enums.Events.SavePointLeft:
                    if (SavePointLeft != null)
                    {
                        SavePointLeft(this, null);
                    }
                    break;

                case Scintilla.Enums.Events.SavePointReached:
                    if (SavePointReached != null)
                    {
                        SavePointReached(this, null);
                    }
                    break;

                case Scintilla.Enums.Events.CharAdded:
                    if (CharAdded != null)
                    {
                        CharAdded(this, new CharAddedEventArgs(notification.ch));
                    }
                    break;

                case Scintilla.Enums.Events.UpdateUI:
                    if (UpdateUI != null)
                    {
                        UpdateUI(this, null);
                    }
                    break;

                case Scintilla.Enums.Events.ModifyAttemptRO:
                    if (ModifyAttemptOnReadOnly != null)
                    {
                        ModifyAttemptOnReadOnly(this, null);
                    }
                    break;

                case Scintilla.Enums.Events.Modified:
                    if (TextModified != null)
                    {
                        TextModified(this, new TextModifiedEventArgs(notification));
                    }
                    break;

                case Scintilla.Enums.Events.DwellStart:
                    if (DwellStart != null)
                    {
                        DwellStart(this, new DwellStartEventArgs(notification));
                    }
                    break;
                case Scintilla.Enums.Events.DwellEnd:
                    if (DwellEnd != null)
                    {
                        DwellEnd(this, null);
                    }
                    break;
            }
        }
Beispiel #58
0
 public TextModifiedEventArgs(SCNotification notification)
     : base(notification.modificationType)
 {
     _position = notification.position;
     _length = notification.length;
     _isUserChange = (notification.position & 0x10) != 0;
 }
Beispiel #59
0
        protected void DispatchScintillaEvent(SCNotification notification)
        {
            switch (notification.nmhdr.code)
            {
            case Scintilla.Enums.Events.StyleNeeded:


                StyleDialog(notification);


                break;

            case Scintilla.Enums.Events.MarginClick:

                int lineNumber = SendMessageDirect(Constants.SCI_LINEFROMPOSITION, notification.position, 0);
                MarginClick(this, new MarginClickEventArgs(notification, lineNumber));
                break;

            case Scintilla.Enums.Events.AutoCSelection:
                if (Events[Scintilla.Enums.Events.AutoCSelection] != null)
                {
                    ((EventHandler <AutoCSelectionEventArgs>)Events[Scintilla.Enums.Events.AutoCSelection])(this, new AutoCSelectionEventArgs(notification));
                }
                break;

            case Scintilla.Enums.Events.SavePointLeft:
                if (SavePointLeft != null)
                {
                    SavePointLeft(this, null);
                }
                break;

            case Scintilla.Enums.Events.SavePointReached:
                if (SavePointReached != null)
                {
                    SavePointReached(this, null);
                }
                break;

            case Scintilla.Enums.Events.CharAdded:
                if (CharAdded != null)
                {
                    CharAdded(this, new CharAddedEventArgs(notification.ch));
                }
                break;

            case Scintilla.Enums.Events.UpdateUI:
                if (UpdateUI != null)
                {
                    UpdateUI(this, null);
                }
                break;

            case Scintilla.Enums.Events.ModifyAttemptRO:
                if (ModifyAttemptOnReadOnly != null)
                {
                    ModifyAttemptOnReadOnly(this, null);
                }
                break;

            case Scintilla.Enums.Events.Modified:
                if (TextModified != null)
                {
                    TextModified(this, new TextModifiedEventArgs(notification));
                }
                break;

            case Scintilla.Enums.Events.DwellStart:
                if (DwellStart != null)
                {
                    DwellStart(this, new DwellStartEventArgs(notification));
                }
                break;

            case Scintilla.Enums.Events.DwellEnd:
                if (DwellEnd != null)
                {
                    DwellEnd(this, null);
                }
                break;
            }
        }
Beispiel #60
0
 public AutoCSelectionEventArgs(SCNotification eventSource)
 {
     _text = Utilities.PtrToStringUtf8( eventSource.text , eventSource.length );
 }