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 
35 class KeyConfigPrefs final : public PrefsPanel
36 {
37 public:
38  KeyConfigPrefs(wxWindow * parent, wxWindowID winid, const wxString &name);
39  bool Commit() override;
40  void Cancel() override;
41  wxString HelpPageName() override;
42 
43 private:
44  void Populate();
46  void RefreshBindings(bool bSort);
47  void FilterKeys( wxArrayString & arr );
48  wxString NameFromKey(const wxString & key);
49  void SetKeyForSelected(const wxString & key);
50 
51  void OnViewBy(wxCommandEvent & e);
52  void OnDefaults(wxCommandEvent & e);
53  void OnImportDefaults(wxCommandEvent & e);
54  void OnImport(wxCommandEvent & e);
55  void OnExport(wxCommandEvent & e);
56  void OnSet(wxCommandEvent & e);
57  void OnClear(wxCommandEvent & e);
58  void OnSelected(wxCommandEvent & e);
59 
60  void OnHotkeyKeyDown(wxKeyEvent & e);
61  void OnHotkeyChar(wxKeyEvent & e);
62  void OnHotkeyKillFocus(wxFocusEvent & e);
63 
64  void OnFilterTimer(wxTimerEvent & e);
65  void OnFilterKeyDown(wxKeyEvent & e);
66  void OnFilterChar(wxKeyEvent & e);
67 
69  wxTextCtrl *mKey;
70  wxButton *mSet;
71  wxButton *mClear;
72 
73  wxTextCtrl *mFilter;
74  wxStaticText *mFilterLabel;
75  wxTimer mFilterTimer;
77 
79  wxRadioButton *mViewByTree;
80  wxRadioButton *mViewByName;
81  wxRadioButton *mViewByKey;
82 
85 
86  wxArrayString mNames;
87  wxArrayString mDefaultKeys; // The full set.
88  wxArrayString mStandardDefaultKeys; // The reduced set.
89  wxArrayString mKeys;
90  wxArrayString mNewKeys; // Used for work in progress.
91 
92  DECLARE_EVENT_TABLE()
93 };
94 
95 
97 {
98 public:
99  KeyConfigPrefsFactory(const wxString &name = wxString{})
100  : mName{ name } {}
101  PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
102 
103 private:
104  wxString mName;
105 };
106 #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:366
wxString HelpPageName() override
void OnViewBy(wxCommandEvent &e)
wxArrayString mDefaultKeys
void OnSelected(wxCommandEvent &e)
void OnFilterTimer(wxTimerEvent &e)
void OnImport(wxCommandEvent &e)
void SetKeyForSelected(const wxString &key)
wxStaticText * mFilterLabel
wxArrayString mKeys
wxTextCtrl * mKey
void OnClear(wxCommandEvent &e)
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)
wxArrayString mNewKeys
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:43
void OnFilterChar(wxKeyEvent &e)
PrefsPanel * operator()(wxWindow *parent, wxWindowID winid) override
void PopulateOrExchange(ShuttleGui &S)
const wxChar * name
Definition: Distortion.cpp:94
wxArrayString mStandardDefaultKeys
void OnImportDefaults(wxCommandEvent &e)
void OnHotkeyKeyDown(wxKeyEvent &e)
wxString NameFromKey(const wxString &key)
void OnHotkeyKillFocus(wxFocusEvent &e)
void FilterKeys(wxArrayString &arr)
void OnSet(wxCommandEvent &e)
Provides multiple views of keyboard shortcuts.
Definition: KeyView.h:72
void OnExport(wxCommandEvent &e)
void OnHotkeyChar(wxKeyEvent &e)
wxTimer mFilterTimer