Hotkeys: show user config for unloaded KiFACEs
Otherwise, only the default hotkeys will be listed. Fixes: https://gitlab.com/kicad/code/kicad/-/issues/10687
This commit is contained in:
parent
497061de35
commit
193248e202
|
@ -52,6 +52,10 @@ DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS( EDA_BASE_FRAME* aParent ):
|
|||
kiface = Kiway().KiFACE( KIWAY::FACE_PL_EDITOR );
|
||||
kiface->GetActions( m_hk_list->ActionsList() );
|
||||
|
||||
// Update all of the action hotkeys. The process of loading the actions through
|
||||
// the KiFACE will only get us the default hotkeys
|
||||
ReadHotKeyConfigIntoActions( wxEmptyString, m_hk_list->ActionsList() );
|
||||
|
||||
main_sizer->Add( m_hk_list, 1, wxTOP | wxLEFT | wxRIGHT | wxEXPAND, margin );
|
||||
|
||||
wxStdDialogButtonSizer* sdb_sizer = new wxStdDialogButtonSizer;
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <id.h>
|
||||
#include <kiface_base.h>
|
||||
#include <menus_helpers.h>
|
||||
#include <hotkeys_basic.h>
|
||||
#include <panel_hotkeys_editor.h>
|
||||
#include <paths.h>
|
||||
#include <confirm.h>
|
||||
|
@ -1077,6 +1078,11 @@ void EDA_BASE_FRAME::OnPreferences( wxCommandEvent& event )
|
|||
book->AddSubPage( CREATE_PANEL( PANEL_DS_DISPLAY_OPTIONS ), _( "Display Options" ) );
|
||||
book->AddSubPage( CREATE_PANEL( PANEL_DS_COLORS ), _( "Colors" ) );
|
||||
|
||||
|
||||
// Update all of the action hotkeys. The process of loading the actions through
|
||||
// the KiFACE will only get us the default hotkeys
|
||||
ReadHotKeyConfigIntoActions( wxEmptyString, hotkeysPanel->ActionsList() );
|
||||
|
||||
for( size_t i = 0; i < book->GetPageCount(); ++i )
|
||||
book->GetPage( i )->Layout();
|
||||
|
||||
|
|
|
@ -377,6 +377,20 @@ void ReadHotKeyConfig( const wxString& aFileName, std::map<std::string, int>& aH
|
|||
}
|
||||
|
||||
|
||||
void ReadHotKeyConfigIntoActions( const wxString& aFileName, std::vector<TOOL_ACTION*>& aActions )
|
||||
{
|
||||
std::map<std::string, int> hotkeys;
|
||||
|
||||
// Read the existing config (all hotkeys)
|
||||
ReadHotKeyConfig( aFileName, hotkeys );
|
||||
|
||||
// Set each tool action hotkey to the config file hotkey if present
|
||||
for( TOOL_ACTION* action : aActions )
|
||||
if( hotkeys.find( action->GetName() ) != hotkeys.end() )
|
||||
action->SetHotKey( hotkeys[action->GetName()] );
|
||||
}
|
||||
|
||||
|
||||
int WriteHotKeyConfig( const std::vector<TOOL_ACTION*>& aActions )
|
||||
{
|
||||
std::map<std::string, int> hotkeys;
|
||||
|
|
|
@ -103,6 +103,13 @@ void DisplayHotkeyList( EDA_BASE_FRAME* aFrame );
|
|||
*/
|
||||
void ReadHotKeyConfig( const wxString& aFileName, std::map<std::string, int>& aHotKeys );
|
||||
|
||||
/**
|
||||
* Reads a hotkey config file into a list of actions
|
||||
*
|
||||
* If \a aFileName is empty it will read in the default hotkeys file.
|
||||
*/
|
||||
void ReadHotKeyConfigIntoActions( const wxString& aFileName, std::vector<TOOL_ACTION*>& aActions );
|
||||
|
||||
/**
|
||||
* Update the hotkeys config file with the hotkeys from the given actions map.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue