Audacity  2.2.2
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 #include "../Experimental.h"
16 
17 class ShuttleGui;
18 
19 #include <wx/defs.h>
20 #include <wx/imaglist.h>
21 #include <wx/listctrl.h>
22 #include <wx/radiobut.h>
23 #include <wx/srchctrl.h>
24 #include <wx/string.h>
25 #include <wx/textctrl.h>
26 #include <wx/timer.h>
27 
28 #include "../commands/CommandManager.h"
29 #include "../widgets/KeyView.h"
30 
31 #include "PrefsPanel.h"
32 
33 class wxStaticText;
34 struct NormalizedKeyString;
35 
36 class KeyConfigPrefs final : public PrefsPanel
37 {
38 public:
39  KeyConfigPrefs(wxWindow * parent, wxWindowID winid, const wxString &name);
40  bool Commit() override;
41  void Cancel() override;
42  wxString HelpPageName() override;
43  void PopulateOrExchange(ShuttleGui & S) override;
44 
45 private:
46  void Populate();
47  void RefreshBindings(bool bSort);
48  void FilterKeys( std::vector<NormalizedKeyString> & arr );
49  wxString NameFromKey(const NormalizedKeyString & key);
50  void SetKeyForSelected(const NormalizedKeyString & key);
51 
52  void OnViewBy(wxCommandEvent & e);
53  void OnDefaults(wxCommandEvent & e);
54  void OnImportDefaults(wxCommandEvent & e);
55  void OnImport(wxCommandEvent & e);
56  void OnExport(wxCommandEvent & e);
57  void OnSet(wxCommandEvent & e);
58  void OnClear(wxCommandEvent & e);
59  void OnSelected(wxCommandEvent & e);
60 
61  void OnHotkeyKeyDown(wxKeyEvent & e);
62  void OnHotkeyChar(wxKeyEvent & e);
63  void OnHotkeyKillFocus(wxFocusEvent & e);
64 
65  void OnFilterTimer(wxTimerEvent & e);
66  void OnFilterKeyDown(wxKeyEvent & e);
67  void OnFilterChar(wxKeyEvent & e);
68 
70  wxTextCtrl *mKey;
71  wxButton *mSet;
72  wxButton *mClear;
73 
74  wxTextCtrl *mFilter;
75  wxStaticText *mFilterLabel;
76  wxTimer mFilterTimer;
78 
80  wxRadioButton *mViewByTree;
81  wxRadioButton *mViewByName;
82  wxRadioButton *mViewByKey;
83 
86 
87  wxArrayString mNames;
88  std::vector<NormalizedKeyString> mDefaultKeys; // The full set.
89  std::vector<NormalizedKeyString> mStandardDefaultKeys; // The reduced set.
90  std::vector<NormalizedKeyString> mKeys;
91  std::vector<NormalizedKeyString> mNewKeys; // Used for work in progress.
92 
93  DECLARE_EVENT_TABLE()
94 };
95 
96 
98 {
99 public:
100  KeyConfigPrefsFactory(const wxString &name = wxString{})
101  : mName{ name } {}
102  PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
103 
104 private:
105  wxString mName;
106 };
107 #endif
CommandManager * mManager
wxRadioButton * mViewByKey
ViewByType
Definition: KeyView.h:57
ViewByType mViewType
void OnDefaults(wxCommandEvent &e)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
wxString HelpPageName() override
std::vector< NormalizedKeyString > mStandardDefaultKeys
void OnViewBy(wxCommandEvent &e)
void FilterKeys(std::vector< NormalizedKeyString > &arr)
void OnSelected(wxCommandEvent &e)
void OnFilterTimer(wxTimerEvent &e)
void OnImport(wxCommandEvent &e)
wxStaticText * mFilterLabel
std::vector< NormalizedKeyString > mNewKeys
wxTextCtrl * mKey
void OnClear(wxCommandEvent &e)
void PopulateOrExchange(ShuttleGui &S) override
void OnFilterKeyDown(wxKeyEvent &e)
bool Commit() override
wxRadioButton * mViewByTree
A PrefsPanel for keybindings.
wxTextCtrl * mFilter
KeyConfigPrefsFactory(const wxString &name=wxString{})
void Cancel() override
CommandManager implements a system for organizing all user-callable commands.
wxButton * mClear
wxButton * mSet
wxRadioButton * mViewByName
KeyConfigPrefs(wxWindow *parent, wxWindowID winid, const wxString &name)
void RefreshBindings(bool bSort)
wxArrayString mNames
KeyView * mView
Used within the PrefsDialog, classes derived from this class include AudioIOPrefs, BatchPrefs, DirectoriesPrefs, FileFormatPrefs, GUIPrefs, KeyConfigPrefs, MousePrefs, QualityPrefs, SpectrumPrefs and ThemePrefs.
Definition: PrefsPanel.h:45
void OnFilterChar(wxKeyEvent &e)
wxString NameFromKey(const NormalizedKeyString &key)
PrefsPanel * operator()(wxWindow *parent, wxWindowID winid) override
std::vector< NormalizedKeyString > mKeys
const wxChar * name
Definition: Distortion.cpp:94
void SetKeyForSelected(const NormalizedKeyString &key)
std::vector< NormalizedKeyString > mDefaultKeys
void OnImportDefaults(wxCommandEvent &e)
void OnHotkeyKeyDown(wxKeyEvent &e)
void OnHotkeyKillFocus(wxFocusEvent &e)
void OnSet(wxCommandEvent &e)
Provides multiple views of keyboard shortcuts.
Definition: KeyView.h:73
void OnExport(wxCommandEvent &e)
void OnHotkeyChar(wxKeyEvent &e)
wxTimer mFilterTimer