From b5ebbef03278917f246e04c4077e180de168749c Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Mon, 30 Sep 2013 16:34:40 +1000 Subject: Removed command: method from ScintillaNotificationProtocol as all events can now be received through the notification: method. --- cocoa/ScintillaCocoa.h | 1 - cocoa/ScintillaCocoa.mm | 10 ---------- cocoa/ScintillaView.h | 3 --- cocoa/ScintillaView.mm | 23 ++--------------------- doc/ScintillaDoc.html | 2 -- 5 files changed, 2 insertions(+), 37 deletions(-) diff --git a/cocoa/ScintillaCocoa.h b/cocoa/ScintillaCocoa.h index c857fd21a..c9f8fde8a 100644 --- a/cocoa/ScintillaCocoa.h +++ b/cocoa/ScintillaCocoa.h @@ -87,7 +87,6 @@ private: NSEvent* lastMouseEvent; id delegate; - bool delegateHasCommand; SciNotifyFunc notifyProc; intptr_t notifyObj; diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 79332eda6..beae1cace 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -385,7 +385,6 @@ ScintillaCocoa::ScintillaCocoa(InnerView* view, MarginView* viewMargin) timerTarget = [[TimerTarget alloc] init: this]; lastMouseEvent = NULL; delegate = NULL; - delegateHasCommand = false; notifyObj = NULL; notifyProc = NULL; capturedMouse = false; @@ -1664,11 +1663,6 @@ void ScintillaCocoa::UpdateForScroll() { void ScintillaCocoa::SetDelegate(id delegate_) { delegate = delegate_; - delegateHasCommand = false; - if (delegate) - { - delegateHasCommand = [(id)delegate respondsToSelector: @selector(command:ctrlID:)]; - } } //-------------------------------------------------------------------------------------------------- @@ -1695,8 +1689,6 @@ void ScintillaCocoa::NotifyChange() if (notifyProc != NULL) notifyProc(notifyObj, WM_COMMAND, Platform::LongFromTwoShorts(GetCtrlID(), SCEN_CHANGE), (uintptr_t) this); - if (delegateHasCommand) - [delegate command:SCEN_CHANGE idFrom:GetCtrlID()]; } //-------------------------------------------------------------------------------------------------- @@ -1706,8 +1698,6 @@ void ScintillaCocoa::NotifyFocus(bool focus) if (notifyProc != NULL) notifyProc(notifyObj, WM_COMMAND, Platform::LongFromTwoShorts(GetCtrlID(), (focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS)), (uintptr_t) this); - if (delegateHasCommand) - [delegate command:(focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS) idFrom:GetCtrlID()]; Editor::NotifyFocus(focus); } diff --git a/cocoa/ScintillaView.h b/cocoa/ScintillaView.h index 653f111d3..63b5cf4e9 100644 --- a/cocoa/ScintillaView.h +++ b/cocoa/ScintillaView.h @@ -46,8 +46,6 @@ extern NSString *const SCIUpdateUINotification; @protocol ScintillaNotificationProtocol - (void)notification: (Scintilla::SCNotification*)notification; -@optional -- (void)command:(int)command idFrom:(int)idFrom; @end /** @@ -129,7 +127,6 @@ extern NSString *const SCIUpdateUINotification; - (void) suspendDrawing: (BOOL) suspend; - (void) notification: (Scintilla::SCNotification*) notification; -- (void) command:(int) command idFrom:(int) idFrom; // Scroller handling - (void) setMarginWidth: (int) width; diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index ce0123982..3bdc9646a 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -1014,29 +1014,10 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) } break; } - } -} - -//-------------------------------------------------------------------------------------------------- - -/** - * Method receives notifications from Scintilla for gaining and losing focus and for changes. - * A delegate can be set to receive all notifications. - */ -- (void) command:(int)command idFrom:(int)idFrom -{ - if ((mDelegate != nil) && ([(id)mDelegate respondsToSelector:@selector(command:ctrlID:)])) - { - [mDelegate command:command idFrom:idFrom]; - } - - // Notifications for the editor itself. - switch (command) - { - case SCEN_KILLFOCUS: + case SCN_FOCUSOUT: [self sendNotification: NSTextDidEndEditingNotification]; break; - case SCEN_SETFOCUS: // Nothing to do for now. + case SCN_FOCUSIN: // Nothing to do for now. break; } } diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 031fc0f72..faf438753 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -6542,8 +6542,6 @@ struct SCNotification { 16 bits of the control's ID is passed in these notifications.

On GTK+, the "command" signal is sent and the signal handler should have the signature handler(GtkWidget *, gint wParam, gpointer lParam, gpointer userData).

-

On Cocoa, a delegate implementing the - ScintillaNotificationProtocol with a command:idFrom: method may be set.

SCEN_CHANGE
SCEN_SETFOCUS
SCEN_KILLFOCUS
-- cgit v1.2.3