Run all matching global actions for a hotkey

Fixes lp:1834547

https://bugs.launchpad.net/kicad/+bug/1834547
This commit is contained in:
Ian McInerney 2019-08-09 01:10:31 +02:00 committed by Wayne Stambaugh
parent a1fe8cfa5a
commit d68dd09f63
1 changed files with 13 additions and 8 deletions

View File

@ -119,14 +119,15 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
// If there is none, run the global action associated with the hot key
int highestPriority = -1, priority = -1;
const TOOL_ACTION* context = NULL; // pointer to context action of the highest priority tool
const TOOL_ACTION* global = NULL; // pointer to global action, if there is no context action
std::vector<const TOOL_ACTION*> global; // pointers to global actions
// if there is no context action
for( const TOOL_ACTION* action : actions )
{
if( action->GetScope() == AS_GLOBAL )
{
// Store the global action in case there are no context actions to run
global = action;
global.emplace_back( action );
continue;
}
@ -154,13 +155,17 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
return m_toolMgr->RunAction( *context, true );
}
else if( global )
else if( !global.empty() )
{
for( auto act : global )
{
wxLogTrace( kicadTraceToolStack,
"ACTION_MANAGER::RunHotKey Running action: %s for hotkey %s", global->GetName(),
"ACTION_MANAGER::RunHotKey Running action: %s for hotkey %s", act->GetName(),
KeyNameFromKeyCode( aHotKey ) );
return m_toolMgr->RunAction( *global, true );
if( m_toolMgr->RunAction( *act, true ) )
return true;
}
}
wxLogTrace( kicadTraceToolStack, "ACTION_MANAGER::RunHotKey No action found for key %s",