31 PSEUDO_ACTION(
const wxString& aLabel,
int aHotKey,
int aHotKeyAlt = 0 ) :
39 new PSEUDO_ACTION(
_(
"Accept Autocomplete" ), WXK_RETURN, WXK_NUMPAD_ENTER ),
63 return name.BeforeFirst(
'.' );
69 std::map<wxString, wxString> s_AppNames = {
70 { wxT(
"common" ),
_(
"Common" ) },
71 { wxT(
"kicad" ),
_(
"Project Manager" ) },
72 { wxT(
"eeschema" ),
_(
"Schematic Editor" ) },
73 { wxT(
"pcbnew" ),
_(
"PCB Editor" ) },
74 { wxT(
"plEditor" ),
_(
"Drawing Sheet Editor" ), },
75 { wxT(
"3DViewer" ),
_(
"3D Viewer" ) },
76 { wxT(
"gerbview" ),
_(
"Gerber Viewer" ) }
81 if( s_AppNames.count( appName ) )
82 return s_AppNames[ appName ];
95 std::map<std::string, HOTKEY> masterMap;
100 if( action->GetFriendlyName().IsEmpty() )
105 if( action->GetName() ==
"pcbnew.Control.zoneDisplayOutlines"
106 || action->GetName() ==
"pcbnew.Control.zoneDisplayTesselation" )
112 HOTKEY& hotkey = masterMap[ action->GetName() ];
128 for(
const std::pair<const std::string, HOTKEY>& entry : masterMap )
130 TOOL_ACTION* entryAction = entry.second.m_Actions[ 0 ];
131 wxString entryApp =
GetAppName( entryAction );
133 if( !currentSection || entryApp != currentApp )
136 currentApp = entryApp;
140 if( aIncludeReadOnlyCmds && currentApp ==
"common" )
150 if( aIncludeReadOnlyCmds )
172 for(
HOTKEY& hotkey : section.m_HotKeys )
185 for(
HOTKEY& hotkey : section.m_HotKeys )
198 for(
HOTKEY& hotkey : section.m_HotKeys )
222 if( !( section.m_SectionName == sectionName || section.m_SectionName == commonName ) )
225 for(
HOTKEY& hotkey : section.m_HotKeys )
241 *aConflict = &hotkey;
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
bool CheckKeyConflicts(TOOL_ACTION *aAction, long aKey, HOTKEY **aConflict)
Check whether the given key conflicts with anything in this store.
void ResetAllHotkeysToOriginal()
Resets every hotkey to the original values.
void ResetAllHotkeysToDefault()
Reset every hotkey in the store to the default values.
HOTKEY_STORE()
Construct a HOTKEY_STORE from a list of hotkey sections.
void Init(std::vector< TOOL_ACTION * > aActionsList, bool aIncludeReadOnlyCmds)
std::vector< HOTKEY_SECTION > & GetSections()
Get the list of sections managed by this store.
std::vector< HOTKEY_SECTION > m_hk_sections
void SaveAllHotkeys()
Persist all changes to hotkeys in the store to the underlying data structures.
static wxString GetSectionName(TOOL_ACTION *aAction)
static wxString GetAppName(TOOL_ACTION *aAction)
PSEUDO_ACTION(const wxString &aLabel, int aHotKey, int aHotKeyAlt=0)
Base window classes and related definitions.
static PSEUDO_ACTION * g_gesturePseudoActions[]
static PSEUDO_ACTION * g_standardPlatformCommands[]
#define PSEUDO_WXK_DBLCLICK
std::vector< HOTKEY > m_HotKeys
std::vector< TOOL_ACTION * > m_Actions