Minor reorganization of handling custom events with CONTEXT_MENU.

This commit is contained in:
Maciej Suminski 2014-05-13 11:22:51 +02:00
parent 3f2fc34075
commit 4577aed921
1 changed files with 6 additions and 9 deletions

View File

@ -160,7 +160,8 @@ void CONTEXT_MENU::Clear()
void CONTEXT_MENU::onMenuEvent( wxEvent& aEvent ) void CONTEXT_MENU::onMenuEvent( wxEvent& aEvent )
{ {
TOOL_EVENT evt; OPT_TOOL_EVENT evt;
wxEventType type = aEvent.GetEventType(); wxEventType type = aEvent.GetEventType();
// When the currently chosen item in the menu is changed, an update event is issued. // 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 else
{ {
OPT_TOOL_EVENT custom = m_customHandler( aEvent ); evt = m_customHandler( aEvent );
if( custom ) // Handling non-action menu entries (e.g. items in clarification list)
evt = *custom; if( !evt )
else
{
// Handling non-action menu entries (e.g. items in clarification list)
evt = TOOL_EVENT( TC_COMMAND, TA_CONTEXT_MENU_CHOICE, aEvent.GetId() ); evt = TOOL_EVENT( TC_COMMAND, TA_CONTEXT_MENU_CHOICE, aEvent.GetId() );
}
} }
} }
// forward the action/update event to the TOOL_MANAGER // forward the action/update event to the TOOL_MANAGER
TOOL_MANAGER::Instance().ProcessEvent( evt ); TOOL_MANAGER::Instance().ProcessEvent( *evt );
} }