Translate mod flags between wx and Kicad.

Also we have to use wxEVT_CHAR_HOOK instead of wxEVT_CHAR or up/down
end up getting handed to COMMON_TOOLS.

Fixes https://gitlab.com/kicad/code/kicad/issues/11034
This commit is contained in:
Jeff Young 2022-10-03 18:41:37 +01:00
parent 2422b9a7c8
commit 230762053d
1 changed files with 11 additions and 2 deletions

View File

@ -140,7 +140,7 @@ LIB_TREE::LIB_TREE( wxWindow* aParent, const wxString& aRecentSearchesKey, LIB_T
this ); this );
// Process hotkeys when the tree control has focus: // Process hotkeys when the tree control has focus:
m_tree_ctrl->Bind( wxEVT_CHAR, &LIB_TREE::onTreeCharHook, this ); m_tree_ctrl->Bind( wxEVT_CHAR_HOOK, &LIB_TREE::onTreeCharHook, this );
Bind( SYMBOL_PRESELECTED, &LIB_TREE::onPreselect, this ); Bind( SYMBOL_PRESELECTED, &LIB_TREE::onPreselect, this );
@ -540,7 +540,16 @@ void LIB_TREE::onTreeCharHook( wxKeyEvent& aKeyStroke )
{ {
if( TOOL_INTERACTIVE* tool = m_adapter->GetContextMenuTool() ) if( TOOL_INTERACTIVE* tool = m_adapter->GetContextMenuTool() )
{ {
int hotkey = aKeyStroke.GetModifiers() | aKeyStroke.GetKeyCode(); int hotkey = aKeyStroke.GetKeyCode();
if( aKeyStroke.ShiftDown() )
hotkey |= MD_SHIFT;
if( aKeyStroke.AltDown() )
hotkey |= MD_ALT;
if( aKeyStroke.ControlDown() )
hotkey |= MD_CTRL;
if( tool->GetManager()->GetActionManager()->RunHotKey( hotkey ) ) if( tool->GetManager()->GetActionManager()->RunHotKey( hotkey ) )
aKeyStroke.Skip( false ); aKeyStroke.Skip( false );