KiCad PCB EDA Suite
Loading...
Searching...
No Matches
hotkey_store.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2016-2018 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 3
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef HOTKEY_STORE__H
25#define HOTKEY_STORE__H
26
27#include <hotkeys_basic.h>
28#include <tool/tool_action.h>
29#include <vector>
30
31class TOOL_MANAGER;
32
33
34struct HOTKEY
35{
36 std::vector<TOOL_ACTION*> m_Actions;
39
41 m_EditKeycode( 0 ),
43 { }
44
45 HOTKEY( TOOL_ACTION* aAction ) :
46 m_EditKeycode( aAction->GetHotKey() ),
47 m_EditKeycodeAlt( aAction->GetHotKeyAlt() )
48 {
49 m_Actions.push_back( aAction );
50 }
51};
52
53
55{
56 wxString m_SectionName; // The displayed, translated, name of the section
57 std::vector<HOTKEY> m_HotKeys;
58};
59
60
66{
67public:
68
75
76 void Init( std::vector<TOOL_ACTION*> aActionsList, bool aIncludeReadOnlyCmds );
77
78 static wxString GetAppName( TOOL_ACTION* aAction );
79 static wxString GetSectionName( TOOL_ACTION* aAction );
80
84 std::vector<HOTKEY_SECTION>& GetSections();
85
90 void SaveAllHotkeys();
91
96
101
110 bool CheckKeyConflicts( TOOL_ACTION* aAction, long aKey, HOTKEY** aConflict );
111
112private:
113 std::vector<TOOL_MANAGER*> m_toolManagers;
114 std::vector<HOTKEY_SECTION> m_hk_sections;
115};
116
117#endif // HOTKEY_STORE__H
A class that contains a set of hotkeys, arranged into "sections" and provides some book-keeping funct...
Definition: hotkey_store.h:66
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.
std::vector< TOOL_MANAGER * > m_toolManagers
Definition: hotkey_store.h:113
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
Definition: hotkey_store.h:114
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)
Represent a single user action.
Definition: tool_action.h:269
Master controller class:
Definition: tool_manager.h:62
std::vector< HOTKEY > m_HotKeys
Definition: hotkey_store.h:57
wxString m_SectionName
Definition: hotkey_store.h:56
int m_EditKeycodeAlt
Definition: hotkey_store.h:38
HOTKEY(TOOL_ACTION *aAction)
Definition: hotkey_store.h:45
int m_EditKeycode
Definition: hotkey_store.h:37
std::vector< TOOL_ACTION * > m_Actions
Definition: hotkey_store.h:36