From 4577aed921f48e5c99b64381adb2288054fec0a8 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Tue, 13 May 2014 11:22:51 +0200 Subject: [PATCH] Minor reorganization of handling custom events with CONTEXT_MENU. --- common/tool/context_menu.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/common/tool/context_menu.cpp b/common/tool/context_menu.cpp index 8bdcd57536..7413761ed3 100644 --- a/common/tool/context_menu.cpp +++ b/common/tool/context_menu.cpp @@ -160,7 +160,8 @@ void CONTEXT_MENU::Clear() void CONTEXT_MENU::onMenuEvent( wxEvent& aEvent ) { - TOOL_EVENT evt; + OPT_TOOL_EVENT evt; + wxEventType type = aEvent.GetEventType(); // When the currently chosen item in the menu is changed, an update event is issued. @@ -182,20 +183,16 @@ void CONTEXT_MENU::onMenuEvent( wxEvent& aEvent ) } else { - OPT_TOOL_EVENT custom = m_customHandler( aEvent ); + evt = m_customHandler( aEvent ); - if( custom ) - evt = *custom; - else - { - // Handling non-action menu entries (e.g. items in clarification list) + // Handling non-action menu entries (e.g. items in clarification list) + if( !evt ) evt = TOOL_EVENT( TC_COMMAND, TA_CONTEXT_MENU_CHOICE, aEvent.GetId() ); - } } } // forward the action/update event to the TOOL_MANAGER - TOOL_MANAGER::Instance().ProcessEvent( evt ); + TOOL_MANAGER::Instance().ProcessEvent( *evt ); }