Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
GUIPrefs Class Referencefinal

A PrefsPanel for general GUI preferences. More...

#include <GUIPrefs.h>

Inheritance diagram for GUIPrefs:
[legend]
Collaboration diagram for GUIPrefs:
[legend]

Public Member Functions

 GUIPrefs (wxWindow *parent, wxWindowID winid)
 
 ~GUIPrefs ()
 
ComponentInterfaceSymbol GetSymbol () const override
 
TranslatableString GetDescription () const override
 
bool Commit () override
 
ManualPageID HelpPageName () override
 If not empty string, the Help button is added below the panel. More...
 
void PopulateOrExchange (ShuttleGui &S) override
 
- Public Member Functions inherited from PrefsPanel
 PrefsPanel (wxWindow *parent, wxWindowID winid, const TranslatableString &title)
 
virtual ~PrefsPanel ()
 
virtual void Preview ()
 
virtual bool Commit ()=0
 
virtual PluginPath GetPath () const override
 
virtual VendorSymbol GetVendor () const override
 
virtual wxString GetVersion () const override
 
virtual bool ShowsPreviewButton ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
virtual ManualPageID HelpPageName ()
 If not empty string, the Help button is added below the panel. More...
 
virtual void Cancel ()
 
- Public Member Functions inherited from wxPanelWrapper
 wxPanelWrapper ()
 
 wxPanelWrapper (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
void SetLabel (const TranslatableString &label)
 
void SetName (const TranslatableString &name)
 
void SetToolTip (const TranslatableString &toolTip)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Static Public Member Functions

static void GetRangeChoices (TranslatableStrings *pChoices, wxArrayStringEx *pCodes, int *pDefaultRangeIndex=nullptr)
 
static void GetLTSChoices (TranslatableStrings *pChoices, wxArrayStringEx *pCodes, int *pDefaultIndex=nullptr)
 
- Static Public Member Functions inherited from PrefsPanel
static FactoriesDefaultFactories ()
 

Private Member Functions

void Populate ()
 

Private Attributes

wxArrayStringEx mLangCodes
 
TranslatableStrings mLangNames
 
wxArrayStringEx mRangeCodes
 
TranslatableStrings mRangeChoices
 
int mDefaultRangeIndex
 
TranslatableStrings mUTSNames
 
std::vector< int > mUTSLabels
 
wxArrayStringEx mLTSCodes
 
TranslatableStrings mLTSChoices
 
int mDefaultLTSIndex
 

Additional Inherited Members

- Public Types inherited from PrefsPanel
using Factories = std::vector< PrefsPanel::PrefsNode >
 
using Factory = std::function< PrefsPanel *(wxWindow *parent, wxWindowID winid, AudacityProject *) >
 

Detailed Description

A PrefsPanel for general GUI preferences.

Definition at line 25 of file GUIPrefs.h.

Constructor & Destructor Documentation

◆ GUIPrefs()

GUIPrefs::GUIPrefs ( wxWindow *  parent,
wxWindowID  winid 
)

Definition at line 39 of file GUIPrefs.cpp.

41: PrefsPanel(parent, winid, XC("Interface", "GUI"))
42{
43 Populate();
44}
#define XC(s, c)
Definition: Internat.h:37
void Populate()
Definition: GUIPrefs.cpp:133
PrefsPanel(wxWindow *parent, wxWindowID winid, const TranslatableString &title)
Definition: PrefsPanel.h:94

References Populate().

Here is the call graph for this function:

◆ ~GUIPrefs()

GUIPrefs::~GUIPrefs ( )

Definition at line 46 of file GUIPrefs.cpp.

47{
48}

Member Function Documentation

◆ Commit()

bool GUIPrefs::Commit ( )
overridevirtual

Implements PrefsPanel.

Definition at line 257 of file GUIPrefs.cpp.

258{
261
262 // If language has changed, we want to change it now, not on the next reboot.
263 wxString lang = gPrefs->Read(wxT("/Locale/Language"), wxT(""));
264 wxString usedLang = GUISettings::SetLang(lang);
265 // Bug 1523: Previously didn't check no-language (=System Language)
266 if (!(lang.empty() || lang == L"System") && (lang != usedLang)) {
267 // lang was not usable and is not system language. We got overridden.
268 gPrefs->Write(wxT("/Locale/Language"), usedLang);
269 gPrefs->Flush();
270 }
271
272 // Reads preference GUITheme
273 {
274 wxBusyCursor busy;
277 }
279
285
286 return true;
287}
wxT("CloseDown"))
IntSetting UpperTimeSignature
The upper time signature of the Beats & Measures ruler.
Definition: Beats.cpp:14
IntSetting LowerTimeSignature
The lower time signature of the Beats & Measures ruler.
Definition: Beats.cpp:15
DoubleSetting BeatsPerMinute
The tempo used for drawing the Beats & Measures ruler.
Definition: Beats.cpp:13
IntSetting DecibelScaleCutoff
Negation of this value is the lowest dB level that should be shown in dB scales.
Definition: Decibels.cpp:12
FileConfig * gPrefs
Definition: Prefs.cpp:70
@ eIsSavingToPrefs
Definition: ShuttleGui.h:47
THEME_API Theme theTheme
Definition: Theme.cpp:82
THEME_API BoolSetting GUIBlendThemes
#define S(N)
Definition: ToChars.cpp:64
static void ApplyUpdatedImages()
Definition: AColor.cpp:872
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143
void PopulateOrExchange(ShuttleGui &S) override
Definition: GUIPrefs.cpp:165
void Invalidate() override
Definition: Prefs.h:282
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:625
void DeleteUnusedThemes()
static bool LoadPreferredTheme()
Definition: Theme.cpp:162
AUDACITY_DLL_API wxString SetLang(const wxString &lang)
Definition: GUISettings.cpp:19

References AColor::ApplyUpdatedImages(), BeatsPerMinute, DecibelScaleCutoff, ThemeBase::DeleteUnusedThemes(), eIsSavingToPrefs, FileConfig::Flush(), gPrefs, GUIBlendThemes, Setting< T >::Invalidate(), ThemeBase::LoadPreferredTheme(), LowerTimeSignature, PopulateOrExchange(), S, GUISettings::SetLang(), theTheme, UpperTimeSignature, and wxT().

Here is the call graph for this function:

◆ GetDescription()

TranslatableString GUIPrefs::GetDescription ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 55 of file GUIPrefs.cpp.

56{
57 return XO("Preferences for GUI");
58}
XO("Cut/Copy/Paste")

References XO().

Here is the call graph for this function:

◆ GetLTSChoices()

void GUIPrefs::GetLTSChoices ( TranslatableStrings pChoices,
wxArrayStringEx pCodes,
int *  pDefaultIndex = nullptr 
)
static

Definition at line 102 of file GUIPrefs.cpp.

107{
108 static wxArrayStringEx sCodes;
109 static TranslatableStrings sChoices;
110
111 static std::once_flag flag;
112 std::call_once(flag, [&]{
113 sCodes.Clear();
114 sChoices.clear();
115
116 for (int i = 1; i <= 64; i *= 2) {
117 auto lts = wxString::Format(wxT("%d"), i);
118 sCodes.Add(lts);
119 sChoices.push_back(Verbatim(lts));
120 }
121 });
122
123 if (pCodes)
124 *pCodes = sCodes;
125
126 if (pChoices)
127 *pChoices = sChoices;
128
129 if (pDefaultIndex)
130 *pDefaultIndex = 2; // 4 == LowerTimeSig
131}
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
std::vector< TranslatableString > TranslatableStrings
static std::once_flag flag
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.

References flag, Verbatim(), and wxT().

Referenced by Populate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetRangeChoices()

void GUIPrefs::GetRangeChoices ( TranslatableStrings pChoices,
wxArrayStringEx pCodes,
int *  pDefaultRangeIndex = nullptr 
)
static

Definition at line 65 of file GUIPrefs.cpp.

70{
71 static const auto sCodes = {
72 wxT("36") ,
73 wxT("48") ,
74 wxT("60") ,
75 wxT("72") ,
76 wxT("84") ,
77 wxT("96") ,
78 wxT("120") ,
79 wxT("145") ,
80 };
81 if (pCodes)
82 *pCodes = sCodes;
83
84 static const std::initializer_list<TranslatableString> sChoices = {
85 XO("-36 dB (shallow range for high-amplitude editing)") ,
86 XO("-48 dB (PCM range of 8 bit samples)") ,
87 XO("-60 dB (PCM range of 10 bit samples)") ,
88 XO("-72 dB (PCM range of 12 bit samples)") ,
89 XO("-84 dB (PCM range of 14 bit samples)") ,
90 XO("-96 dB (PCM range of 16 bit samples)") ,
91 XO("-120 dB (approximate limit of human hearing)") ,
92 XO("-145 dB (PCM range of 24 bit samples)") ,
93 };
94
95 if (pChoices)
96 *pChoices = sChoices;
97
98 if (pDefaultRangeIndex)
99 *pDefaultRangeIndex = 2; // 60 == ENV_DB_RANGE
100}

References wxT(), and XO().

Referenced by WaveformSettings::ConvertToActualDBRange(), WaveformSettings::ConvertToEnumeratedDBRange(), Populate(), and WaveformPrefs::Populate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol GUIPrefs::GetSymbol ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 50 of file GUIPrefs.cpp.

51{
53}
#define GUI_PREFS_PLUGIN_SYMBOL
Definition: GUIPrefs.h:23

References GUI_PREFS_PLUGIN_SYMBOL.

◆ HelpPageName()

ManualPageID GUIPrefs::HelpPageName ( )
overridevirtual

If not empty string, the Help button is added below the panel.

Default returns empty string.

Reimplemented from PrefsPanel.

Definition at line 60 of file GUIPrefs.cpp.

61{
62 return "Interface_Preferences";
63}

◆ Populate()

void GUIPrefs::Populate ( )
private

Definition at line 133 of file GUIPrefs.cpp.

134{
135 // First any pre-processing for constructing the GUI.
138
140
142
143#if 0
145 // only for testing...
146 "kg" ,
147 "ep" ,
148 } );
149
150 mLangNames.insert( mLangNames.end(), {
151 "Klingon" ,
152 "Esperanto" ,
153 } );
154#endif
155
156 //------------------------- Main section --------------------
157 // Now construct the GUI itself.
158 // Use 'eIsCreatingFromPrefs' so that the GUI is
159 // initialised with values from gPrefs.
162 // ----------------------- End of main section --------------
163}
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:46
int mDefaultRangeIndex
Definition: GUIPrefs.h:57
wxArrayStringEx mRangeCodes
Definition: GUIPrefs.h:55
int mDefaultLTSIndex
Definition: GUIPrefs.h:64
wxArrayStringEx mLangCodes
Definition: GUIPrefs.h:52
TranslatableStrings mLTSChoices
Definition: GUIPrefs.h:63
static void GetLTSChoices(TranslatableStrings *pChoices, wxArrayStringEx *pCodes, int *pDefaultIndex=nullptr)
Definition: GUIPrefs.cpp:102
static void GetRangeChoices(TranslatableStrings *pChoices, wxArrayStringEx *pCodes, int *pDefaultRangeIndex=nullptr)
Definition: GUIPrefs.cpp:65
TranslatableStrings mLangNames
Definition: GUIPrefs.h:53
wxArrayStringEx mLTSCodes
Definition: GUIPrefs.h:62
TranslatableStrings mRangeChoices
Definition: GUIPrefs.h:56
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,...
void GetLanguages(FilePaths pathList, wxArrayString &langCodes, TranslatableStrings &langNames)
Definition: Languages.cpp:140

References FileNames::AudacityPathList(), eIsCreatingFromPrefs, Languages::GetLanguages(), GetLTSChoices(), GetRangeChoices(), wxArrayStringEx::insert(), mDefaultLTSIndex, mDefaultRangeIndex, mLangCodes, mLangNames, mLTSChoices, mLTSCodes, mRangeChoices, mRangeCodes, PopulateOrExchange(), and S.

Referenced by GUIPrefs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PopulateOrExchange()

void GUIPrefs::PopulateOrExchange ( ShuttleGui S)
override

Definition at line 165 of file GUIPrefs.cpp.

166{
167 ChoiceSetting LanguageSetting{ wxT("/Locale/Language"),
169 };
173 };
174
175 ChoiceSetting LowerTimeSigSettings{ LowerTimeSignature,
178 };
179
180 S.SetBorder(2);
181 S.StartScroller();
182
183 S.StartStatic(XO("Display"));
184 {
185 S.StartMultiColumn(2);
186 {
187 S.TieChoice( XXO("&Language:"), LanguageSetting);
188 // S.TieChoice( XXO("Location of &Manual:"), GUIManualLocation);
189 S.TieChoice( XXO("Th&eme:"), GUITheme());
190 S.TieChoice( XXO("Meter dB &range:"), DBSetting);
191 }
192 S.EndMultiColumn();
193
194 S.StartMultiColumn(2);
195 {
196 S.TieNumericTextBox(XXO("Beats per &minute:"), BeatsPerMinute, 10);
197 S.TieIntegerTextBox(XXO("Upper time &signature:"), UpperTimeSignature, 6);
198 S.TieChoice(XXO("Lower time &signature:"), LowerTimeSigSettings);
199 }
200 S.EndMultiColumn();
201
202 }
203 S.EndStatic();
204
205 S.StartStatic(XO("Options"));
206 {
207 // Start wording of options with a verb, if possible.
208 S.TieCheckBox(XXO("Show 'How to Get &Help' at launch"),
209 {wxT("/GUI/ShowSplashScreen"),
210 true});
211 S.TieCheckBox(XXO("Show e&xtra menus"),
212 {wxT("/GUI/ShowExtraMenus"),
213 false});
214#ifdef EXPERIMENTAL_THEME_PREFS
215 // We do not want to make this option mainstream. It's a
216 // convenience for developers.
217 S.TieCheckBox(XXO("Show alternative &styling (Mac vs PC)"),
218 {wxT("/GUI/ShowMac"),
219 false});
220#endif
221 S.TieCheckBox(XXO("&Beep on completion of longer activities"),
222 {wxT("/GUI/BeepOnCompletion"),
223 false});
224 S.TieCheckBox(XXO("Re&tain labels if selection snaps to a label"),
225 {wxT("/GUI/RetainLabels"),
226 false});
227 S.TieCheckBox(XXO("B&lend system and Audacity theme"),
229#ifndef __WXMAC__
230 /* i18n-hint: RTL stands for 'Right to Left' */
231 S.TieCheckBox(XXO("Use mostly Left-to-Right layouts in RTL languages"),
232 {"/GUI/RtlWorkaround",
233 true});
234#endif
235#ifdef EXPERIMENTAL_CEE_NUMBERS_OPTION
236 S.TieCheckBox(XXO("Never use comma as decimal point"),
237 {wxT("/Locale/CeeNumberFormat"),
238 false});
239#endif
240 }
241 S.EndStatic();
242
243 S.StartStatic(XO("Timeline"));
244 {
245 S.TieCheckBox(XXO("Show Timeline Tooltips"),
246 {wxT("/QuickPlay/ToolTips"),
247 true});
248 S.TieCheckBox(XXO("Show Scrub Ruler"),
249 {wxT("/QuickPlay/ScrubbingEnabled"),
250 false});
251 }
252 S.EndStatic();
253
254 S.EndScroller();
255}
XXO("&Cut/Copy/Paste Toolbar")
ByColumns_t ByColumns
Definition: Prefs.cpp:474
THEME_API ChoiceSetting & GUITheme()

References BeatsPerMinute, ByColumns, DecibelScaleCutoff, GUIBlendThemes, GUITheme(), LowerTimeSignature, mDefaultLTSIndex, mDefaultRangeIndex, mLangCodes, mLangNames, mLTSChoices, mLTSCodes, mRangeChoices, mRangeCodes, S, UpperTimeSignature, wxT(), XO(), and XXO().

Referenced by Commit(), and Populate().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mDefaultLTSIndex

int GUIPrefs::mDefaultLTSIndex
private

Definition at line 64 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mDefaultRangeIndex

int GUIPrefs::mDefaultRangeIndex
private

Definition at line 57 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mLangCodes

wxArrayStringEx GUIPrefs::mLangCodes
private

Definition at line 52 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mLangNames

TranslatableStrings GUIPrefs::mLangNames
private

Definition at line 53 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mLTSChoices

TranslatableStrings GUIPrefs::mLTSChoices
private

Definition at line 63 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mLTSCodes

wxArrayStringEx GUIPrefs::mLTSCodes
private

Definition at line 62 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mRangeChoices

TranslatableStrings GUIPrefs::mRangeChoices
private

Definition at line 56 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mRangeCodes

wxArrayStringEx GUIPrefs::mRangeCodes
private

Definition at line 55 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mUTSLabels

std::vector<int> GUIPrefs::mUTSLabels
private

Definition at line 60 of file GUIPrefs.h.

◆ mUTSNames

TranslatableStrings GUIPrefs::mUTSNames
private

Definition at line 59 of file GUIPrefs.h.


The documentation for this class was generated from the following files: