Promote selection up context menu hierarchy.

This is so that tools checking for a selected item won't think
the menu has been cancelled if the selection was in a submenu.

Fixes: lp:1758372
* https://bugs.launchpad.net/kicad/+bug/1758372
This commit is contained in:
Jeff Young 2018-03-26 20:34:41 +01:00
parent 778a3a4777
commit 8b94606fb5
1 changed files with 8 additions and 0 deletions

View File

@ -335,6 +335,14 @@ void CONTEXT_MENU::onMenuEvent( wxMenuEvent& aEvent )
// Store the selected position, so it can be checked by the tools // Store the selected position, so it can be checked by the tools
m_selected = aEvent.GetId(); m_selected = aEvent.GetId();
CONTEXT_MENU* parent = dynamic_cast<CONTEXT_MENU*>( GetParent() );
while( parent )
{
parent->m_selected = m_selected;
parent = dynamic_cast<CONTEXT_MENU*>( parent->GetParent() );
}
// Check if there is a TOOL_ACTION for the given ID // Check if there is a TOOL_ACTION for the given ID
if( m_selected >= ACTION_ID ) if( m_selected >= ACTION_ID )
evt = findToolAction( m_selected ); evt = findToolAction( m_selected );