Commit 4577aed9 authored by Maciej Suminski's avatar Maciej Suminski

Minor reorganization of handling custom events with CONTEXT_MENU.

parent 3f2fc340
...@@ -160,7 +160,8 @@ void CONTEXT_MENU::Clear() ...@@ -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 ) ...@@ -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 );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment