Audacity  3.0.3
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 
15 class CommandManager;
16 class ShuttleGui;
17 
18 #include <wx/defs.h>
19 #include <wx/timer.h> // member variable
20 
21 #include "PrefsPanel.h"
22 
23 class wxRadioButton;
24 class wxStaticText;
25 class wxTextCtrl;
26 class KeyView;
27 struct NormalizedKeyString;
28 enum ViewByType : int;
29 
30 #define KEY_CONFIG_PREFS_PLUGIN_SYMBOL ComponentInterfaceSymbol{ XO("Key Config") }
31 
32 class KeyConfigPrefs final : public PrefsPanel
33 {
34 public:
35  KeyConfigPrefs(wxWindow * parent, wxWindowID winid,
36  AudacityProject *pProject,
37  const CommandID &name);
40 
41  bool Commit() override;
42  void Cancel() override;
43  ManualPageID HelpPageName() override;
44  void PopulateOrExchange(ShuttleGui & S) override;
45 
46 private:
47  void Populate();
48  void RefreshBindings(bool bSort);
49  void RefreshKeyInfo();
50  void ClearAllKeys();
51  bool ContainsIllegalDups(TranslatableString & fMatching,
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
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
KeyConfigPrefs::OnDefaults
void OnDefaults(wxCommandEvent &e)
Definition: KeyConfigPrefs.cpp:598
KeyConfigPrefs::mStandardDefaultKeys
std::vector< NormalizedKeyString > mStandardDefaultKeys
Definition: KeyConfigPrefs.h:103
KeyConfigPrefs::NameFromKey
CommandID NameFromKey(const NormalizedKeyString &key)
Definition: KeyConfigPrefs.cpp:737
KeyConfigPrefs::OnShow
void OnShow(wxShowEvent &e)
Definition: KeyConfigPrefs.cpp:479
KeyConfigPrefs::OnHotkeyKillFocus
void OnHotkeyKillFocus(wxEvent &e)
Definition: KeyConfigPrefs.cpp:661
KeyConfigPrefs::ContainsIllegalDups
bool ContainsIllegalDups(TranslatableString &fMatching, TranslatableString &sMatching) const
Definition: KeyConfigPrefs.cpp:385
KeyConfigPrefs::OnExport
void OnExport(wxCommandEvent &e)
Definition: KeyConfigPrefs.cpp:570
PrefsPanel.h
ViewByType
ViewByType
Definition: KeyView.h:61
KeyConfigPrefs::Populate
void Populate()
Definition: KeyConfigPrefs.cpp:130
KeyConfigPrefs::mFilterPending
bool mFilterPending
Definition: KeyConfigPrefs.h:89
KeyConfigPrefs::OnFilterTimer
void OnFilterTimer(wxTimerEvent &e)
Definition: KeyConfigPrefs.cpp:675
KeyConfigPrefs::KeyConfigPrefs
KeyConfigPrefs(wxWindow *parent, wxWindowID winid, AudacityProject *pProject, const CommandID &name)
Definition: KeyConfigPrefs.cpp:92
KeyConfigPrefs::OnViewBy
void OnViewBy(wxCommandEvent &e)
Definition: KeyConfigPrefs.cpp:867
KeyConfigPrefs::GetDescription
TranslatableString GetDescription() override
Definition: KeyConfigPrefs.cpp:120
KeyConfigPrefs::mNames
CommandIDs mNames
Definition: KeyConfigPrefs.h:101
PrefsPanel::Factory
std::function< PrefsPanel *(wxWindow *parent, wxWindowID winid, AudacityProject *) > Factory
Definition: PrefsPanel.h:79
KeyConfigPrefs::mFilterLabel
wxStaticText * mFilterLabel
Definition: KeyConfigPrefs.h:87
KeyConfigPrefs::OnSelected
void OnSelected(wxCommandEvent &e)
Definition: KeyConfigPrefs.cpp:850
KeyConfigPrefs::mNewKeys
std::vector< NormalizedKeyString > mNewKeys
Definition: KeyConfigPrefs.h:105
KeyConfigPrefs::OnImport
void OnImport(wxCommandEvent &e)
Definition: KeyConfigPrefs.cpp:491
KeyConfigPrefs::mProject
AudacityProject * mProject
Definition: KeyConfigPrefs.h:96
KeyConfigPrefs::Commit
bool Commit() override
Definition: KeyConfigPrefs.cpp:891
ComponentInterfaceSymbol
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Definition: ComponentInterfaceSymbol.h:27
KeyConfigPrefs::mKey
wxTextCtrl * mKey
Definition: KeyConfigPrefs.h:82
KeyConfigPrefs::ClearAllKeys
void ClearAllKeys()
Definition: KeyConfigPrefs.cpp:373
KeyConfigPrefs::FilterKeys
void FilterKeys(std::vector< NormalizedKeyString > &arr)
Definition: KeyConfigPrefs.cpp:607
KeyConfigPrefs::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S) override
Definition: KeyConfigPrefs.cpp:178
CommandIDs
std::vector< CommandID > CommandIDs
Definition: Identifier.h:233
KeyConfigPrefs::GetSymbol
ComponentInterfaceSymbol GetSymbol() override
Definition: KeyConfigPrefs.cpp:115
KeyConfigPrefs::HelpPageName
ManualPageID HelpPageName() override
If not empty string, the Help button is added below the panel.
Definition: KeyConfigPrefs.cpp:125
KeyConfigPrefs::mViewByTree
wxRadioButton * mViewByTree
Definition: KeyConfigPrefs.h:92
KeyConfigPrefs::Cancel
void Cancel() override
Definition: KeyConfigPrefs.cpp:930
name
const TranslatableString name
Definition: Distortion.cpp:98
KeyConfigPrefs::OnClear
void OnClear(wxCommandEvent &e)
Definition: KeyConfigPrefs.cpp:841
KeyConfigPrefs::mViewByName
wxRadioButton * mViewByName
Definition: KeyConfigPrefs.h:93
KeyConfigPrefs::OnFilterKeyDown
void OnFilterKeyDown(wxKeyEvent &e)
Definition: KeyConfigPrefs.cpp:685
KeyConfigPrefs::mFilter
wxTextCtrl * mFilter
Definition: KeyConfigPrefs.h:86
KeyConfigPrefs::mView
KeyView * mView
Definition: KeyConfigPrefs.h:81
NormalizedKeyString
Definition: Keyboard.h:24
KeyConfigPrefs
A PrefsPanel for keybindings.
Definition: KeyConfigPrefs.h:33
KeyConfigPrefs::RefreshKeyInfo
void RefreshKeyInfo()
Definition: KeyConfigPrefs.cpp:363
KeyConfigPrefs::mCommandSelected
int mCommandSelected
Definition: KeyConfigPrefs.h:99
KeyConfigPrefs::mKeys
std::vector< NormalizedKeyString > mKeys
Definition: KeyConfigPrefs.h:104
key
static const AudacityProject::AttachedObjects::RegisteredFactory key
Definition: CommandManager.cpp:201
KeyConfigPrefs::mDefaultKeys
std::vector< NormalizedKeyString > mDefaultKeys
Definition: KeyConfigPrefs.h:102
TaggedIdentifier< CommandIdTag, false >
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
KeyConfigPrefs::mClear
wxButton * mClear
Definition: KeyConfigPrefs.h:84
KeyConfigPrefs::mSet
wxButton * mSet
Definition: KeyConfigPrefs.h:83
KeyConfigPrefs::OnHotkeyChar
void OnHotkeyChar(wxEvent &e)
Definition: KeyConfigPrefs.cpp:656
KeyConfigPrefs::OnSet
void OnSet(wxCommandEvent &e)
Definition: KeyConfigPrefs.cpp:764
CommandManager
CommandManager implements a system for organizing all user-callable commands.
Definition: CommandManager.h:59
KeyView
Provides multiple views of keyboard shortcuts.
Definition: KeyView.h:73
KeyConfigPrefs::OnHotkeyContext
void OnHotkeyContext(wxEvent &e)
Definition: KeyConfigPrefs.cpp:670
KeyConfigPrefs::RefreshBindings
void RefreshBindings(bool bSort)
Definition: KeyConfigPrefs.cpp:327
PrefsPanel
Base class for a panel in the PrefsDialog. Classes derived from this class include BatchPrefs,...
Definition: PrefsPanel.h:51
KeyConfigPrefs::mViewByKey
wxRadioButton * mViewByKey
Definition: KeyConfigPrefs.h:94
KeyConfigPrefs::OnFilterChar
void OnFilterChar(wxEvent &e)
Definition: KeyConfigPrefs.cpp:727
KeyConfigPrefs::MergeWithExistingKeys
TranslatableString MergeWithExistingKeys(const std::vector< NormalizedKeyString > &toAdd)
Definition: KeyConfigPrefs.cpp:425
KeyConfigPrefsFactory
PrefsPanel::Factory KeyConfigPrefsFactory(const CommandID &name={})
Definition: KeyConfigPrefs.cpp:941
KeyConfigPrefs::SetKeyForSelected
void SetKeyForSelected(const NormalizedKeyString &key)
Definition: KeyConfigPrefs.cpp:744
KeyConfigPrefs::mFilterTimer
wxTimer mFilterTimer
Definition: KeyConfigPrefs.h:88
KeyConfigPrefs::mManager
CommandManager * mManager
Definition: KeyConfigPrefs.h:98
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
KeyConfigPrefs::OnImportDefaults
void OnImportDefaults(wxCommandEvent &e)
Definition: KeyConfigPrefs.cpp:618
KeyConfigPrefs::mViewType
ViewByType mViewType
Definition: KeyConfigPrefs.h:91
KeyConfigPrefs::OnHotkeyKeyDown
void OnHotkeyKeyDown(wxKeyEvent &e)
Definition: KeyConfigPrefs.cpp:634