Audacity 3.2.0
KeyConfigPrefs.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 KeyConfigPrefs.h
6
7 Brian Gunlogson
8 Dominic Mazzoni
9
10**********************************************************************/
11
12#ifndef __AUDACITY_KEY_CONFIG_PREFS__
13#define __AUDACITY_KEY_CONFIG_PREFS__
14
15class CommandManager;
16class ShuttleGui;
17
18#include <wx/defs.h>
19#include <wx/timer.h> // member variable
20
21#include "PrefsPanel.h"
22
23class wxRadioButton;
24class wxStaticText;
25class wxTextCtrl;
26class KeyView;
28enum ViewByType : int;
29
30#define KEY_CONFIG_PREFS_PLUGIN_SYMBOL ComponentInterfaceSymbol{ XO("Key Config") }
31
32class KeyConfigPrefs final : public PrefsPanel
33{
34public:
35 KeyConfigPrefs(wxWindow * parent, wxWindowID winid,
36 AudacityProject *pProject,
37 const CommandID &name);
38 ComponentInterfaceSymbol GetSymbol() const override;
39 TranslatableString GetDescription() const override;
40
41 bool Commit() override;
42 void Cancel() override;
43 ManualPageID HelpPageName() override;
44 void PopulateOrExchange(ShuttleGui & S) override;
45
46private:
47 void Populate();
48 void RefreshBindings(bool bSort);
49 void RefreshKeyInfo();
50 void ClearAllKeys();
52 TranslatableString & sMatching) const;
54 const std::vector<NormalizedKeyString> &toAdd);
55 void FilterKeys( std::vector<NormalizedKeyString> & arr );
58
59 // See bug #2315 for discussion. This should be reviewed
60 // and (possibly) removed after wx3.1.3.
61 void OnShow(wxShowEvent & e);
62
63 void OnViewBy(wxCommandEvent & e);
64 void OnDefaults(wxCommandEvent & e);
65 void OnImportDefaults(wxCommandEvent & e);
66 void OnImport(wxCommandEvent & e);
67 void OnExport(wxCommandEvent & e);
68 void OnSet(wxCommandEvent & e);
69 void OnClear(wxCommandEvent & e);
70 void OnSelected(wxCommandEvent & e);
71
72 void OnHotkeyKeyDown(wxKeyEvent & e);
73 void OnHotkeyChar(wxEvent & e);
74 void OnHotkeyKillFocus(wxEvent & e);
75 void OnHotkeyContext(wxEvent & e);
76
77 void OnFilterTimer(wxTimerEvent & e);
78 void OnFilterKeyDown(wxKeyEvent & e);
79 void OnFilterChar(wxEvent & e);
80
82 wxTextCtrl *mKey;
83 wxButton *mSet;
84 wxButton *mClear;
85
86 wxTextCtrl *mFilter;
87 wxStaticText *mFilterLabel;
88 wxTimer mFilterTimer;
90
92 wxRadioButton *mViewByTree;
93 wxRadioButton *mViewByName;
94 wxRadioButton *mViewByKey;
95
97
100
102 std::vector<NormalizedKeyString> mDefaultKeys; // The full set.
103 std::vector<NormalizedKeyString> mStandardDefaultKeys; // The reduced set.
104 std::vector<NormalizedKeyString> mKeys;
105 std::vector<NormalizedKeyString> mNewKeys; // Used for work in progress.
106
107 DECLARE_EVENT_TABLE()
108};
109
110
115 const CommandID &name = {} );
116#endif
std::vector< CommandID > CommandIDs
Definition: Identifier.h:233
PrefsPanel::Factory KeyConfigPrefsFactory(const CommandID &name={})
ViewByType
Definition: KeyView.h:61
static const AudacityProject::AttachedObjects::RegisteredFactory key
wxString name
Definition: TagsEditor.cpp:166
#define S(N)
Definition: ToChars.cpp:64
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
CommandManager implements a system for organizing all user-callable commands.
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
A PrefsPanel for keybindings.
void OnFilterKeyDown(wxKeyEvent &e)
void OnImport(wxCommandEvent &e)
void OnHotkeyChar(wxEvent &e)
void OnImportDefaults(wxCommandEvent &e)
TranslatableString MergeWithExistingKeys(const std::vector< NormalizedKeyString > &toAdd)
void OnHotkeyKillFocus(wxEvent &e)
wxStaticText * mFilterLabel
TranslatableString GetDescription() const override
wxTextCtrl * mKey
CommandManager * mManager
void PopulateOrExchange(ShuttleGui &S) override
std::vector< NormalizedKeyString > mDefaultKeys
AudacityProject * mProject
ComponentInterfaceSymbol GetSymbol() const override
void FilterKeys(std::vector< NormalizedKeyString > &arr)
void OnSet(wxCommandEvent &e)
bool ContainsIllegalDups(TranslatableString &fMatching, TranslatableString &sMatching) const
void OnHotkeyContext(wxEvent &e)
void OnFilterChar(wxEvent &e)
ManualPageID HelpPageName() override
If not empty string, the Help button is added below the panel.
wxButton * mClear
void OnFilterTimer(wxTimerEvent &e)
CommandID NameFromKey(const NormalizedKeyString &key)
KeyView * mView
bool Commit() override
std::vector< NormalizedKeyString > mStandardDefaultKeys
std::vector< NormalizedKeyString > mNewKeys
std::vector< NormalizedKeyString > mKeys
KeyConfigPrefs(wxWindow *parent, wxWindowID winid, AudacityProject *pProject, const CommandID &name)
void Cancel() override
wxButton * mSet
void OnClear(wxCommandEvent &e)
wxRadioButton * mViewByKey
wxTextCtrl * mFilter
wxRadioButton * mViewByTree
void OnExport(wxCommandEvent &e)
void OnSelected(wxCommandEvent &e)
CommandIDs mNames
ViewByType mViewType
wxRadioButton * mViewByName
void OnViewBy(wxCommandEvent &e)
wxTimer mFilterTimer
void OnDefaults(wxCommandEvent &e)
void RefreshBindings(bool bSort)
void OnShow(wxShowEvent &e)
void OnHotkeyKeyDown(wxKeyEvent &e)
void SetKeyForSelected(const NormalizedKeyString &key)
Provides multiple views of keyboard shortcuts.
Definition: KeyView.h:73
Base class for a panel in the PrefsDialog. Classes derived from this class include BatchPrefs,...
Definition: PrefsPanel.h:51
std::function< PrefsPanel *(wxWindow *parent, wxWindowID winid, AudacityProject *) > Factory
Definition: PrefsPanel.h:82
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
Holds a msgid for the translation catalog; may also bind format arguments.