Audacity 3.2.0
PrefsDialog.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 PrefsDialog.h
6
7 Joshua Haberman
8 James Crook
9
10**********************************************************************/
11
12#ifndef __AUDACITY_PREFS_DIALOG__
13#define __AUDACITY_PREFS_DIALOG__
14
15#include <functional>
16#include <vector>
17#include "wxPanelWrapper.h" // to inherit
18#include "PrefsPanel.h"
19
20class AudacityProject;
21class wxTreebook;
22class wxTreeEvent;
24class ShuttleGui;
25
26class AudacityProject;
27
28class AUDACITY_DLL_API PrefsDialog /* not final */ : public wxDialogWrapper
29{
30 public:
31 PrefsDialog(wxWindow * parent,
32 AudacityProject *pProject, // may be null
33 const TranslatableString &titlePrefix = XO("Preferences:"),
34 PrefsPanel::Factories &factories =
36 virtual ~PrefsDialog();
37
38 // Defined this so a protected virtual can be invoked after the constructor
39 int ShowModal() override;
40 void ShuttleAll( ShuttleGui & S);
41
42 void OnCategoryChange(wxCommandEvent & e);
43 void OnOK(wxCommandEvent & e);
44 void OnCancel(wxCommandEvent & e);
45 void OnPreview(wxCommandEvent & e);
46 void OnHelp(wxCommandEvent & e);
47 void OnTreeKeyDown(wxTreeEvent & e); // Used to dismiss the dialog when enter is pressed with focus on tree
48
49 void SelectPageByName(const wxString &pageName);
50
51 // Accessor to help implementations of SavePreferredPage(),
52 // such as by saving a preference after DoModal() returns
53 int GetSelectedPage() const;
54
55 protected:
56 // Decide which page to open first; return -1 for undecided
57 virtual long GetPreferredPage() = 0;
58
59 // Called after OK is clicked and all pages validate
60 virtual void SavePreferredPage() = 0;
61
62private:
63 void RecordExpansionState();
64 PrefsPanel * GetCurrentPanel();
65 wxTreebook *mCategories{};
66 PrefsPanel *mUniquePage{};
69
70 std::unique_ptr< SettingTransaction > mTransaction;
71
72 DECLARE_EVENT_TABLE()
73};
74
75// This adds code appropriate only to the original use of PrefsDialog for
76// global settings -- not its reuses elsewhere as in View Settings
77class AUDACITY_DLL_API GlobalPrefsDialog final : public PrefsDialog
78{
79public:
84 wxWindow * parent, AudacityProject *pProject,
85 PrefsPanel::Factories &factories =
87 virtual ~GlobalPrefsDialog();
88 long GetPreferredPage() override;
89 void SavePreferredPage() override;
90};
91
92class AudacityProject;
93void AUDACITY_DLL_API DoReloadPreferences( AudacityProject &project );
94
95#endif
XO("Cut/Copy/Paste")
void AUDACITY_DLL_API DoReloadPreferences(AudacityProject &project)
const auto project
#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
Dialog that shows the current PrefsPanel in a tabbed divider.
Definition: PrefsDialog.h:29
const TranslatableString mTitlePrefix
Definition: PrefsDialog.h:68
void OnCategoryChange(wxCommandEvent &e)
virtual void SavePreferredPage()=0
std::unique_ptr< SettingTransaction > mTransaction
Definition: PrefsDialog.h:70
virtual long GetPreferredPage()=0
PrefsPanel::Factories & mFactories
Definition: PrefsDialog.h:67
Base class for a panel in the PrefsDialog. Classes derived from this class include BatchPrefs,...
Definition: PrefsPanel.h:51
static Factories & DefaultFactories()
Definition: PrefsPanel.cpp:66
std::vector< PrefsPanel::PrefsNode > Factories
Definition: PrefsPanel.h:72
Extend SettingScope with Commit() which flushes updates in a batch.
Definition: Prefs.h:149
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.
A wxTreebook is a class like wxNotebook, but not yet supported by wxWidgets 2.6.3.