Audacity  2.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 
15 #include "../Experimental.h"
16 
17 class ShuttleGui;
18 
19 #if defined(EXPERIMENTAL_KEY_VIEW)
20 
21 #include <wx/defs.h>
22 #include <wx/imaglist.h>
23 #include <wx/listctrl.h>
24 #include <wx/radiobut.h>
25 #include <wx/srchctrl.h>
26 #include <wx/string.h>
27 #include <wx/textctrl.h>
28 #include <wx/timer.h>
29 
30 #include "../commands/CommandManager.h"
31 #include "../widgets/KeyView.h"
32 
33 #include "PrefsPanel.h"
34 
35 class wxStaticText;
36 
37 class KeyConfigPrefs final : public PrefsPanel
38 {
39 public:
40  KeyConfigPrefs(wxWindow * parent);
42  bool Commit() override;
43  void Cancel() override;
44  wxString HelpPageName() override;
45 
46 private:
47  void Populate();
49  void RefreshBindings(bool bSort);
50  void FilterKeys( wxArrayString & arr );
51  wxString NameFromKey(const wxString & key);
52  void SetKeyForSelected(const wxString & key);
53 
54  void OnViewBy(wxCommandEvent & e);
55  void OnDefaults(wxCommandEvent & e);
56  void OnImportDefaults(wxCommandEvent & e);
57  void OnImport(wxCommandEvent & e);
58  void OnExport(wxCommandEvent & e);
59  void OnSet(wxCommandEvent & e);
60  void OnClear(wxCommandEvent & e);
61  void OnSelected(wxCommandEvent & e);
62 
63  void OnHotkeyKeyDown(wxKeyEvent & e);
64  void OnHotkeyChar(wxKeyEvent & e);
65  void OnHotkeyKillFocus(wxFocusEvent & e);
66 
67  void OnFilterTimer(wxTimerEvent & e);
68  void OnFilterKeyDown(wxKeyEvent & e);
69  void OnFilterChar(wxKeyEvent & e);
70 
72  wxTextCtrl *mKey;
73  wxButton *mSet;
74  wxButton *mClear;
75 
76  wxTextCtrl *mFilter;
77  wxStaticText *mFilterLabel;
78  wxTimer mFilterTimer;
80 
82  wxRadioButton *mViewByTree;
83  wxRadioButton *mViewByName;
84  wxRadioButton *mViewByKey;
85 
88 
89  wxArrayString mNames;
90  wxArrayString mDefaultKeys; // The full set.
91  wxArrayString mStandardDefaultKeys; // The reduced set.
92  wxArrayString mKeys;
93  wxArrayString mNewKeys; // Used for work in progress.
94 
95  DECLARE_EVENT_TABLE()
96 };
97 
98 #else
99 
100 #include <wx/defs.h>
101 #include <wx/listctrl.h>
102 #include <wx/textctrl.h>
103 #include <wx/string.h>
104 
105 #include "../commands/CommandManager.h"
106 
107 #include "PrefsPanel.h"
108 
109 class KeyConfigPrefs final : public PrefsPanel
110 {
111  public:
112  KeyConfigPrefs(wxWindow * parent);
113  ~KeyConfigPrefs();
114  bool Commit() override;
115  void Cancel() override;
116  wxString HelpPageName() override;
117 
118  private:
119  void Populate();
120  void PopulateOrExchange(ShuttleGui & S);
121  void CreateList();
122  void RepopulateBindingsList();
123  wxString NameFromKey( const wxString & key );
124  void SetKeyForSelected( const wxString & key );
125 
126  void OnDefaults(wxCommandEvent & e);
127  void OnImport(wxCommandEvent & e);
128  void OnExport(wxCommandEvent & e);
129  void OnSet(wxCommandEvent & e);
130  void OnClear(wxCommandEvent & e);
131  void OnCategory(wxCommandEvent & e);
132  void OnItemSelected(wxListEvent & e);
133  void OnKeyDown(wxListEvent & e);
134 
135  void OnCaptureKeyDown(wxKeyEvent & e);
136  void OnCaptureChar(wxKeyEvent & e);
137 
138  wxChoice *mCat;
139  wxTextCtrl *mKey;
140  wxListCtrl *mList;
141 
143  int mCommandSelected;
144 
145  wxArrayString mCats;
146  wxArrayString mNames;
147  wxArrayString mDefaultKeys;
148  wxArrayString mKeys;
149  wxArrayString mNewKeys; // Used for work in progress.
150 
151  DECLARE_EVENT_TABLE()
152 };
153 
154 #endif
155 
157 {
158 public:
159  PrefsPanel *Create(wxWindow *parent) override;
160 };
161 #endif
CommandManager * mManager
Definition: KeyConfigPrefs.h:86
wxRadioButton * mViewByKey
Definition: KeyConfigPrefs.h:84
ViewByType
Definition: KeyView.h:56
PrefsPanel * Create(wxWindow *parent) override
Definition: KeyConfigPrefs.cpp:1273
ViewByType mViewType
Definition: KeyConfigPrefs.h:81
void OnDefaults(wxCommandEvent &e)
Definition: KeyConfigPrefs.cpp:388
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:369
wxString HelpPageName() override
Definition: KeyConfigPrefs.cpp:740
void OnViewBy(wxCommandEvent &e)
Definition: KeyConfigPrefs.cpp:669
wxArrayString mDefaultKeys
Definition: KeyConfigPrefs.h:90
void Populate()
Definition: KeyConfigPrefs.cpp:119
void OnSelected(wxCommandEvent &e)
Definition: KeyConfigPrefs.cpp:652
void OnFilterTimer(wxTimerEvent &e)
Definition: KeyConfigPrefs.cpp:514
void OnImport(wxCommandEvent &e)
Definition: KeyConfigPrefs.cpp:333
KeyConfigPrefs(wxWindow *parent)
Definition: KeyConfigPrefs.cpp:77
void SetKeyForSelected(const wxString &key)
Definition: KeyConfigPrefs.cpp:583
bool mFilterPending
Definition: KeyConfigPrefs.h:79
wxStaticText * mFilterLabel
Definition: KeyConfigPrefs.h:77
wxArrayString mKeys
Definition: KeyConfigPrefs.h:92
~KeyConfigPrefs()
Definition: KeyConfigPrefs.cpp:88
wxTextCtrl * mKey
Definition: KeyConfigPrefs.h:72
void OnClear(wxCommandEvent &e)
Definition: KeyConfigPrefs.cpp:643
void OnFilterKeyDown(wxKeyEvent &e)
Definition: KeyConfigPrefs.cpp:524
bool Commit() override
Definition: KeyConfigPrefs.cpp:693
wxRadioButton * mViewByTree
Definition: KeyConfigPrefs.h:82
A PrefsPanel for keybindings.
Definition: KeyConfigPrefs.h:37
wxTextCtrl * mFilter
Definition: KeyConfigPrefs.h:76
void Cancel() override
Definition: KeyConfigPrefs.cpp:730
CommandManager implements a system for organizing all user-callable commands.
Definition: CommandManager.h:94
wxButton * mClear
Definition: KeyConfigPrefs.h:74
wxButton * mSet
Definition: KeyConfigPrefs.h:73
int mCommandSelected
Definition: KeyConfigPrefs.h:87
wxRadioButton * mViewByName
Definition: KeyConfigPrefs.h:83
wxArrayString mNewKeys
Definition: KeyConfigPrefs.h:93
void RefreshBindings(bool bSort)
Definition: KeyConfigPrefs.cpp:299
wxArrayString mNames
Definition: KeyConfigPrefs.h:89
KeyView * mView
Definition: KeyConfigPrefs.h:71
Used within the PrefsDialog, classes derived from this class include AudioIOPrefs, BatchPrefs, DirectoriesPrefs, FileFormatPrefs, GUIPrefs, KeyConfigPrefs, MousePrefs, QualityPrefs, SpectrumPrefs and ThemePrefs.
Definition: PrefsPanel.h:43
void OnFilterChar(wxKeyEvent &e)
Definition: KeyConfigPrefs.cpp:566
void PopulateOrExchange(ShuttleGui &S)
Definition: KeyConfigPrefs.cpp:168
wxArrayString mStandardDefaultKeys
Definition: KeyConfigPrefs.h:91
Definition: PrefsPanel.h:70
void OnImportDefaults(wxCommandEvent &e)
Definition: KeyConfigPrefs.cpp:462
Definition: KeyConfigPrefs.h:156
void OnHotkeyKeyDown(wxKeyEvent &e)
Definition: KeyConfigPrefs.cpp:478
wxString NameFromKey(const wxString &key)
Definition: KeyConfigPrefs.cpp:576
void OnHotkeyKillFocus(wxFocusEvent &e)
Definition: KeyConfigPrefs.cpp:505
void FilterKeys(wxArrayString &arr)
Definition: KeyConfigPrefs.cpp:398
void OnSet(wxCommandEvent &e)
Definition: KeyConfigPrefs.cpp:600
Provides multiple views of keyboard shortcuts.
Definition: KeyView.h:71
void OnExport(wxCommandEvent &e)
Definition: KeyConfigPrefs.cpp:360
void OnHotkeyChar(wxKeyEvent &e)
Definition: KeyConfigPrefs.cpp:500
wxTimer mFilterTimer
Definition: KeyConfigPrefs.h:78