Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 6
0
 internal CharAddedEventArgs(SCNotification eventSource)
     : this(eventSource.ch)
 {
 }
Ejemplo n.º 7
0
 internal StyleChangedEventArgs(SCNotification eventSource)
     : base(eventSource)
 {
 }
Ejemplo n.º 8
0
 internal HotspotClickEventArgs(SCNotification eventSource)
     : this(eventSource.modifiers, eventSource.position)
 {
 }
Ejemplo n.º 9
0
 internal UriDroppedEventArgs(SCNotification eventSource)
 {
 }
Ejemplo n.º 10
0
 internal FoldChangedEventArgs(SCNotification eventSource)
     : this(eventSource.line, eventSource.foldLevelNow, eventSource.foldLevelPrev, eventSource.modificationType)
 {
 }
Ejemplo n.º 11
0
 internal UserListSelectionEventArgs(SCNotification eventSource) : base(eventSource)
 {
     _listType = (int)eventSource.wParam;
 }
Ejemplo n.º 12
0
        internal SCKeyEventArgs(SCNotification eventSource)
			: this(eventSource.ch, eventSource.modifiers){}
Ejemplo n.º 13
0
 internal ModifyAttemptROEventArgs(SCNotification eventSource)
 {
 }
Ejemplo n.º 14
0
 internal ModifyAttemptROEventArgs(SCNotification eventSource)
 {
 }
Ejemplo n.º 15
0
        internal SCDoubleClickEventArgs(SCNotification eventSource)
			: this(eventSource.position, eventSource.line){}
Ejemplo n.º 16
0
 internal SavePointLeftEventArgs(SCNotification eventSource)
 {
 }
Ejemplo n.º 17
0
 internal SavePointReachedEventArgs(SCNotification eventSource)
 {
 }
Ejemplo n.º 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);
		}
Ejemplo n.º 19
0
 internal UriDroppedEventArgs(SCNotification eventSource)
 {
 }
Ejemplo n.º 20
0
 internal UpdateUIEventArgs(SCNotification eventSource)
 {
 }
Ejemplo n.º 21
0
 internal SavePointReachedEventArgs(SCNotification eventSource)
 {
 }
Ejemplo n.º 22
0
        internal MacroRecordEventArgs(SCNotification eventSource)
        {
			_message		= new Message();
			_message.HWnd	= eventSource.nmhdr.hwndFrom;
			_message.LParam = eventSource.lParam;
			_message.WParam = eventSource.wParam;
        }
Ejemplo n.º 23
0
 internal SCKeyEventArgs(SCNotification eventSource)
     : this(eventSource.ch, eventSource.modifiers)
 {
 }
Ejemplo n.º 24
0
        internal MarginClickEventArgs(SCNotification eventSource)
			: this(eventSource.modifiers, eventSource.position, eventSource.margin){}
Ejemplo n.º 25
0
 internal NeedShownEventArgs(SCNotification eventSource)
 {
     _position = eventSource.position;
     _length   = eventSource.length;
 }
Ejemplo n.º 26
0
		internal FoldChangedEventArgs(SCNotification eventSource) 
			: this(eventSource.line, eventSource.foldLevelNow, eventSource.foldLevelPrev, eventSource.modificationType){}
Ejemplo n.º 27
0
 internal DwellEndEventArgs(SCNotification eventSource) : base(eventSource)
 {
 }
Ejemplo n.º 28
0
        internal NeedShownEventArgs(SCNotification eventSource)
        {
			_position	= eventSource.position;
			_length		= eventSource.length;
        }
Ejemplo n.º 29
0
 internal CallTipClickEventArgs(SCNotification eventSource)
     : this(eventSource.position)
 {
 }
Ejemplo n.º 30
0
        internal PaintedEventArgs(SCNotification eventSource)
        {

        }
Ejemplo n.º 31
0
		internal StyleChangedEventArgs(SCNotification eventSource)
			: base(eventSource){}
Ejemplo n.º 32
0
        internal UserListSelectionEventArgs(SCNotification eventSource) : base(eventSource)
        {
			_listType = (int)eventSource.wParam;
        }
Ejemplo n.º 33
0
 internal NativeScintillaEventArgs(Message Msg, SCNotification notification)
 {
     _msg          = Msg;
     _notification = notification;
 }
Ejemplo n.º 34
0
		internal DwellEventArgs(SCNotification eventSource) 
			: this(eventSource.position, eventSource.x, eventSource.y) { }
Ejemplo n.º 35
0
 internal StyleNeededEventArgs(SCNotification eventSource)
 {
     _position = eventSource.position;
 }
Ejemplo n.º 36
0
		internal DwellEndEventArgs(SCNotification eventSource) : base(eventSource) { }
Ejemplo n.º 37
0
 public DwellStartEventArgs(SCNotification eventSource)
 {
     _x        = eventSource.x;
     _y        = eventSource.y;
     _position = eventSource.position;
 }
Ejemplo n.º 38
0
 internal SCZoomEventArgs(SCNotification eventSource)
 {
 }
Ejemplo n.º 39
0
 internal SavePointLeftEventArgs(SCNotification eventSource)
 {
 }
Ejemplo n.º 40
0
        internal HotspotClickEventArgs(SCNotification eventSource)
			: this(eventSource.modifiers, eventSource.position){}
Ejemplo n.º 41
0
 internal SCDoubleClickEventArgs(SCNotification eventSource)
     : this(eventSource.position, eventSource.line)
 {
 }
Ejemplo n.º 42
0
		internal HotspotDoubleClickEventArgs(SCNotification eventSource) : base(eventSource) { }
Ejemplo n.º 43
0
 internal UpdateUIEventArgs(SCNotification eventSource)
 {
 }
Ejemplo n.º 44
0
        internal CallTipClickEventArgs(SCNotification eventSource)
	       : this(eventSource.position){}
Ejemplo n.º 45
0
 internal MarginClickEventArgs(SCNotification eventSource)
     : this(eventSource.modifiers, eventSource.position, eventSource.margin)
 {
 }
Ejemplo n.º 46
0
 public DwellStartEventArgs(SCNotification eventSource)
 {
     _x = eventSource.x;
     _y = eventSource.y;
     _position = eventSource.position;
 }
Ejemplo n.º 47
0
 internal PaintedEventArgs(SCNotification eventSource)
 {
 }
Ejemplo n.º 48
0
 public MarginClickEventArgs(SCNotification eventSource, int lineNumber)
 {
     _margin = eventSource.margin;
     _lineNumber = lineNumber;
 }
Ejemplo n.º 49
0
 internal DwellEventArgs(SCNotification eventSource)
     : this(eventSource.position, eventSource.x, eventSource.y)
 {
 }
Ejemplo n.º 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);


                        
    

        }
Ejemplo n.º 51
0
 internal SCZoomEventArgs(SCNotification eventSource)
 {
 }
Ejemplo n.º 52
0
 internal CharAddedEventArgs(SCNotification eventSource)
     : this(eventSource.ch) { }
Ejemplo n.º 53
0
 internal HotspotDoubleClickEventArgs(SCNotification eventSource) : base(eventSource)
 {
 }
Ejemplo n.º 54
0
 public MarginClickEventArgs(SCNotification eventSource, int lineNumber)
 {
     _margin     = eventSource.margin;
     _lineNumber = lineNumber;
 }
Ejemplo n.º 55
0
 public NativeScintillaEventArgs(Message Msg, SCNotification notification)
 {
     _msg = Msg;
     _notification = notification;
 }
Ejemplo n.º 56
0
        internal StyleNeededEventArgs(SCNotification eventSource)
        {
			_position = eventSource.position;
        }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 58
0
 public TextModifiedEventArgs(SCNotification notification)
     : base(notification.modificationType)
 {
     _position = notification.position;
     _length = notification.length;
     _isUserChange = (notification.position & 0x10) != 0;
 }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 60
0
 public AutoCSelectionEventArgs(SCNotification eventSource)
 {
     _text = Utilities.PtrToStringUtf8( eventSource.text , eventSource.length );
 }