Audacity 3.2.0
GUIPrefs.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 GUIPrefs.cpp
6
7 Brian Gunlogson
8 Joshua Haberman
9 Dominic Mazzoni
10 James Crook
11
12
13*******************************************************************//*******************************************************************/
19
20
21#include "GUIPrefs.h"
22
23#include <wx/defs.h>
24#include <mutex> // once_flag
25
26#include "FileNames.h"
27#include "Languages.h"
28#include "Theme.h"
29#include "Prefs.h"
30#include "ShuttleGui.h"
31
32#include "Decibels.h"
33#include "Beats.h"
34
35#include "ThemePrefs.h"
36#include "AColor.h"
37#include "GUISettings.h"
38#include "WaveformSettings.h"
39
40GUIPrefs::GUIPrefs(wxWindow * parent, wxWindowID winid)
41/* i18n-hint: refers to Audacity's user interface settings */
42: PrefsPanel(parent, winid, XC("Interface", "GUI"))
43{
44 Populate();
45}
46
48{
49}
50
52{
54}
55
57{
58 return XO("Preferences for GUI");
59}
60
62{
63 return "Interface_Preferences";
64}
65
67{
68 // First any pre-processing for constructing the GUI.
71
74
75#if 0
77 // only for testing...
78 "kg" ,
79 "ep" ,
80 } );
81
82 mLangNames.insert( mLangNames.end(), {
83 "Klingon" ,
84 "Esperanto" ,
85 } );
86#endif
87
88 //------------------------- Main section --------------------
89 // Now construct the GUI itself.
90 // Use 'eIsCreatingFromPrefs' so that the GUI is
91 // initialised with values from gPrefs.
94 // ----------------------- End of main section --------------
95}
96
98{
99 ChoiceSetting LanguageSetting{ wxT("/Locale/Language"),
101 };
105 };
106
107 S.SetBorder(2);
108 S.StartScroller();
109
110 S.StartStatic(XO("Display"));
111 {
112 S.StartMultiColumn(2);
113 {
114 S.TieChoice( XXO("&Language:"), LanguageSetting);
115 // S.TieChoice( XXO("Location of &Manual:"), GUIManualLocation);
116 S.TieChoice( XXO("Th&eme:"), GUITheme());
117 S.TieChoice( XXO("Meter dB &range:"), DBSetting);
118 }
119 S.EndMultiColumn();
120 }
121 S.EndStatic();
122
123 S.StartStatic(XO("Options"));
124 {
125 // Start wording of options with a verb, if possible.
126 S.TieCheckBox(XXO("Show 'How to Get &Help' at launch"),
127 {wxT("/GUI/ShowSplashScreen"),
128 true});
129 S.TieCheckBox(XXO("Show e&xtra menus"),
130 {wxT("/GUI/ShowExtraMenus"),
131 false});
132#ifdef EXPERIMENTAL_THEME_PREFS
133 // We do not want to make this option mainstream. It's a
134 // convenience for developers.
135 S.TieCheckBox(XXO("Show alternative &styling (Mac vs PC)"),
136 {wxT("/GUI/ShowMac"),
137 false});
138#endif
139 S.TieCheckBox(XXO("&Beep on completion of longer activities"),
140 {wxT("/GUI/BeepOnCompletion"),
141 false});
142 S.TieCheckBox(XXO("Re&tain labels if selection snaps to a label"),
143 {wxT("/GUI/RetainLabels"),
144 false});
145#ifndef __WXMAC__
146 /* i18n-hint: RTL stands for 'Right to Left' */
147 S.TieCheckBox(XXO("Use mostly Left-to-Right layouts in RTL languages"),
148 {"/GUI/RtlWorkaround",
149 true});
150#endif
151#ifdef EXPERIMENTAL_CEE_NUMBERS_OPTION
152 S.TieCheckBox(XXO("Never use comma as decimal point"),
153 {wxT("/Locale/CeeNumberFormat"),
154 false});
155#endif
156 }
157 S.EndStatic();
158
159 S.EndScroller();
160}
161
163{
166
167 // If language has changed, we want to change it now, not on the next reboot.
168 wxString lang = gPrefs->Read(wxT("/Locale/Language"), wxT(""));
169 wxString usedLang = GUISettings::SetLang(lang);
170 // Bug 1523: Previously didn't check no-language (=System Language)
171 if (!(lang.empty() || lang == L"System") && (lang != usedLang)) {
172 // lang was not usable and is not system language. We got overridden.
173 gPrefs->Write(wxT("/Locale/Language"), usedLang);
174 gPrefs->Flush();
175 }
176
177 // Reads preference GUITheme
178 {
179 wxBusyCursor busy;
182 }
184
186
187 return true;
188}
189
191{
192 static BoolSetting pref { "/GUI/ShowRMS", false };
193 return pref;
194}
195
197{
198 static BoolSetting pref { "/GUI/ShowClipping", false };
199 return pref;
200}
201
202namespace{
204 [](wxWindow *parent, wxWindowID winid, AudacityProject *)
205 {
206 wxASSERT(parent); // to justify safenew
207 return safenew GUIPrefs(parent, winid);
208 }
209};
210}
wxT("CloseDown"))
IntSetting DecibelScaleCutoff
Negation of this value is the lowest dB level that should be shown in dB scales.
Definition: Decibels.cpp:12
XO("Cut/Copy/Paste")
XXO("&Cut/Copy/Paste Toolbar")
BoolSetting & ShowRMSPref()
Definition: GUIPrefs.cpp:190
BoolSetting & ShowClippingPref()
Definition: GUIPrefs.cpp:196
#define GUI_PREFS_PLUGIN_SYMBOL
Definition: GUIPrefs.h:24
#define XC(s, c)
Definition: Internat.h:37
#define safenew
Definition: MemoryX.h:10
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
ByColumns_t ByColumns
Definition: Prefs.cpp:515
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:46
@ eIsSavingToPrefs
Definition: ShuttleGui.h:47
THEME_API Theme theTheme
Definition: Theme.cpp:82
THEME_API ChoiceSetting & GUITheme()
#define S(N)
Definition: ToChars.cpp:64
static void ApplyUpdatedImages()
Definition: AColor.cpp:841
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
This specialization of Setting for bool adds a Toggle method to negate the saved value.
Definition: Prefs.h:346
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
A PrefsPanel for general GUI preferences.
Definition: GUIPrefs.h:27
int mDefaultRangeIndex
Definition: GUIPrefs.h:46
GUIPrefs(wxWindow *parent, wxWindowID winid)
Definition: GUIPrefs.cpp:40
wxArrayStringEx mRangeCodes
Definition: GUIPrefs.h:44
TranslatableString GetDescription() const override
Definition: GUIPrefs.cpp:56
wxArrayStringEx mLangCodes
Definition: GUIPrefs.h:41
void PopulateOrExchange(ShuttleGui &S) override
Definition: GUIPrefs.cpp:97
~GUIPrefs()
Definition: GUIPrefs.cpp:47
ComponentInterfaceSymbol GetSymbol() const override
Definition: GUIPrefs.cpp:51
bool Commit() override
Definition: GUIPrefs.cpp:162
TranslatableStrings mLangNames
Definition: GUIPrefs.h:42
ManualPageID HelpPageName() override
If not empty string, the Help button is added below the panel.
Definition: GUIPrefs.cpp:61
void Populate()
Definition: GUIPrefs.cpp:66
TranslatableStrings mRangeChoices
Definition: GUIPrefs.h:45
Base class for a panel in the PrefsDialog. Classes derived from this class include BatchPrefs,...
Definition: PrefsPanel.h:51
void Invalidate() override
Definition: Prefs.h:289
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
void DeleteUnusedThemes()
static bool LoadPreferredTheme()
Definition: Theme.cpp:162
Holds a msgid for the translation catalog; may also bind format arguments.
static void GetRangeChoices(TranslatableStrings *pChoices, wxArrayStringEx *pCodes, int *pDefaultRangeIndex=nullptr)
virtual bool Flush() noexcept=0
virtual bool Write(const wxString &key, bool value)=0
virtual bool Read(const wxString &key, bool *value) const =0
iterator insert(const_iterator pos, std::initializer_list< T > items)
FILES_API const FilePaths & AudacityPathList()
A list of directories that should be searched for Audacity files (plug-ins, help files,...
AUDACITY_DLL_API wxString SetLang(const wxString &lang)
Definition: GUISettings.cpp:19
void GetLanguages(FilePaths pathList, wxArrayString &langCodes, TranslatableStrings &langNames)
Definition: Languages.cpp:140
PrefsPanel::Registration sAttachment
Definition: GUIPrefs.cpp:203