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); }
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); }
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); }
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); }
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); }
internal CharAddedEventArgs(SCNotification eventSource) : this(eventSource.ch) { }
internal StyleChangedEventArgs(SCNotification eventSource) : base(eventSource) { }
internal HotspotClickEventArgs(SCNotification eventSource) : this(eventSource.modifiers, eventSource.position) { }
internal UriDroppedEventArgs(SCNotification eventSource) { }
internal FoldChangedEventArgs(SCNotification eventSource) : this(eventSource.line, eventSource.foldLevelNow, eventSource.foldLevelPrev, eventSource.modificationType) { }
internal UserListSelectionEventArgs(SCNotification eventSource) : base(eventSource) { _listType = (int)eventSource.wParam; }
internal SCKeyEventArgs(SCNotification eventSource) : this(eventSource.ch, eventSource.modifiers){}
internal ModifyAttemptROEventArgs(SCNotification eventSource) { }
internal SCDoubleClickEventArgs(SCNotification eventSource) : this(eventSource.position, eventSource.line){}
internal SavePointLeftEventArgs(SCNotification eventSource) { }
internal SavePointReachedEventArgs(SCNotification eventSource) { }
internal UpdateUIEventArgs(SCNotification eventSource) { }
internal MacroRecordEventArgs(SCNotification eventSource) { _message = new Message(); _message.HWnd = eventSource.nmhdr.hwndFrom; _message.LParam = eventSource.lParam; _message.WParam = eventSource.wParam; }
internal SCKeyEventArgs(SCNotification eventSource) : this(eventSource.ch, eventSource.modifiers) { }
internal MarginClickEventArgs(SCNotification eventSource) : this(eventSource.modifiers, eventSource.position, eventSource.margin){}
internal NeedShownEventArgs(SCNotification eventSource) { _position = eventSource.position; _length = eventSource.length; }
internal FoldChangedEventArgs(SCNotification eventSource) : this(eventSource.line, eventSource.foldLevelNow, eventSource.foldLevelPrev, eventSource.modificationType){}
internal DwellEndEventArgs(SCNotification eventSource) : base(eventSource) { }
internal CallTipClickEventArgs(SCNotification eventSource) : this(eventSource.position) { }
internal PaintedEventArgs(SCNotification eventSource) { }
internal StyleChangedEventArgs(SCNotification eventSource) : base(eventSource){}
internal NativeScintillaEventArgs(Message Msg, SCNotification notification) { _msg = Msg; _notification = notification; }
internal DwellEventArgs(SCNotification eventSource) : this(eventSource.position, eventSource.x, eventSource.y) { }
internal StyleNeededEventArgs(SCNotification eventSource) { _position = eventSource.position; }
public DwellStartEventArgs(SCNotification eventSource) { _x = eventSource.x; _y = eventSource.y; _position = eventSource.position; }
internal SCZoomEventArgs(SCNotification eventSource) { }
internal HotspotClickEventArgs(SCNotification eventSource) : this(eventSource.modifiers, eventSource.position){}
internal SCDoubleClickEventArgs(SCNotification eventSource) : this(eventSource.position, eventSource.line) { }
internal HotspotDoubleClickEventArgs(SCNotification eventSource) : base(eventSource) { }
internal CallTipClickEventArgs(SCNotification eventSource) : this(eventSource.position){}
internal MarginClickEventArgs(SCNotification eventSource) : this(eventSource.modifiers, eventSource.position, eventSource.margin) { }
public MarginClickEventArgs(SCNotification eventSource, int lineNumber) { _margin = eventSource.margin; _lineNumber = lineNumber; }
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); }
public NativeScintillaEventArgs(Message Msg, SCNotification notification) { _msg = Msg; _notification = notification; }
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; } }
public TextModifiedEventArgs(SCNotification notification) : base(notification.modificationType) { _position = notification.position; _length = notification.length; _isUserChange = (notification.position & 0x10) != 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; } }
public AutoCSelectionEventArgs(SCNotification eventSource) { _text = Utilities.PtrToStringUtf8( eventSource.text , eventSource.length ); }