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 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
 

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 37 of file GUIPrefs.cpp.

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

References Populate().

Here is the call graph for this function:

◆ ~GUIPrefs()

GUIPrefs::~GUIPrefs ( )

Definition at line 44 of file GUIPrefs.cpp.

45{
46}

Member Function Documentation

◆ Commit()

bool GUIPrefs::Commit ( )
overridevirtual

Implements PrefsPanel.

Definition at line 219 of file GUIPrefs.cpp.

220{
223
224 // If language has changed, we want to change it now, not on the next reboot.
225 wxString lang = gPrefs->Read(wxT("/Locale/Language"), wxT(""));
226 wxString usedLang = GUISettings::SetLang(lang);
227 // Bug 1523: Previously didn't check no-language (=System Language)
228 if (!(lang.empty() || lang == L"System") && (lang != usedLang)) {
229 // lang was not usable and is not system language. We got overridden.
230 gPrefs->Write(wxT("/Locale/Language"), usedLang);
231 gPrefs->Flush();
232 }
233
234 // Reads preference GUITheme
235 {
236 wxBusyCursor busy;
239 }
241
242 return true;
243}
FileConfig * gPrefs
Definition: Prefs.cpp:71
@ eIsSavingToPrefs
Definition: ShuttleGui.h:49
THEME_API Theme theTheme
Definition: Theme.cpp:82
#define S(N)
Definition: ToChars.cpp:64
static void ApplyUpdatedImages()
Definition: AColor.cpp:849
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143
void PopulateOrExchange(ShuttleGui &S) override
Definition: GUIPrefs.cpp:140
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:628
void DeleteUnusedThemes()
static bool LoadPreferredTheme()
Definition: Theme.cpp:162
AUDACITY_DLL_API wxString SetLang(const wxString &lang)
Definition: GUISettings.cpp:19

References AColor::ApplyUpdatedImages(), ThemeBase::DeleteUnusedThemes(), eIsSavingToPrefs, FileConfig::Flush(), gPrefs, ThemeBase::LoadPreferredTheme(), PopulateOrExchange(), S, GUISettings::SetLang(), and theTheme.

Here is the call graph for this function:

◆ GetDescription()

TranslatableString GUIPrefs::GetDescription ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 53 of file GUIPrefs.cpp.

54{
55 return XO("Preferences for GUI");
56}
#define XO(s)
Definition: Internat.h:31

References XO.

◆ GetRangeChoices()

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

Definition at line 63 of file GUIPrefs.cpp.

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

References XO.

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

Here is the caller graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol GUIPrefs::GetSymbol ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 48 of file GUIPrefs.cpp.

49{
51}
#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 58 of file GUIPrefs.cpp.

59{
60 return "Interface_Preferences";
61}

◆ Populate()

void GUIPrefs::Populate ( )
private

Definition at line 100 of file GUIPrefs.cpp.

101{
102 // First any pre-processing for constructing the GUI.
105
107
108#if 0
110 // only for testing...
111 "kg" ,
112 "ep" ,
113 } );
114
115 mLangNames.insert( mLangNames.end(), {
116 "Klingon" ,
117 "Esperanto" ,
118 } );
119#endif
120
121 //------------------------- Main section --------------------
122 // Now construct the GUI itself.
123 // Use 'eIsCreatingFromPrefs' so that the GUI is
124 // initialised with values from gPrefs.
127 // ----------------------- End of main section --------------
128}
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:48
int mDefaultRangeIndex
Definition: GUIPrefs.h:51
wxArrayStringEx mRangeCodes
Definition: GUIPrefs.h:49
wxArrayStringEx mLangCodes
Definition: GUIPrefs.h:46
static void GetRangeChoices(TranslatableStrings *pChoices, wxArrayStringEx *pCodes, int *pDefaultRangeIndex=nullptr)
Definition: GUIPrefs.cpp:63
TranslatableStrings mLangNames
Definition: GUIPrefs.h:47
TranslatableStrings mRangeChoices
Definition: GUIPrefs.h:50
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(), GetRangeChoices(), wxArrayStringEx::insert(), mDefaultRangeIndex, mLangCodes, mLangNames, 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 140 of file GUIPrefs.cpp.

141{
142 ChoiceSetting LanguageSetting{ wxT("/Locale/Language"),
144 };
148 };
149
150 S.SetBorder(2);
151 S.StartScroller();
152
153 S.StartStatic(XO("Display"));
154 {
155 S.StartMultiColumn(2);
156 {
157 S.TieChoice( XXO("&Language:"), LanguageSetting);
158 S.TieChoice( XXO("Location of &Manual:"), GUIManualLocation);
159 S.TieChoice( XXO("Th&eme:"), GUITheme());
160 S.TieChoice( XXO("Meter dB &range:"), DBSetting);
161 }
162 S.EndMultiColumn();
163
164 }
165 S.EndStatic();
166
167 S.StartStatic(XO("Options"));
168 {
169 // Start wording of options with a verb, if possible.
170 S.TieCheckBox(XXO("Show 'How to Get &Help' at launch"),
171 {wxT("/GUI/ShowSplashScreen"),
172 true});
173 S.TieCheckBox(XXO("Show e&xtra menus"),
174 {wxT("/GUI/ShowExtraMenus"),
175 false});
176#ifdef EXPERIMENTAL_THEME_PREFS
177 // We do not want to make this option mainstream. It's a
178 // convenience for developers.
179 S.TieCheckBox(XXO("Show alternative &styling (Mac vs PC)"),
180 {wxT("/GUI/ShowMac"),
181 false});
182#endif
183 S.TieCheckBox(XXO("&Beep on completion of longer activities"),
184 {wxT("/GUI/BeepOnCompletion"),
185 false});
186 S.TieCheckBox(XXO("Re&tain labels if selection snaps to a label"),
187 {wxT("/GUI/RetainLabels"),
188 false});
189 S.TieCheckBox(XXO("B&lend system and Audacity theme"),
191#ifndef __WXMAC__
192 /* i18n-hint: RTL stands for 'Right to Left' */
193 S.TieCheckBox(XXO("Use mostly Left-to-Right layouts in RTL languages"),
194 {"/GUI/RtlWorkaround",
195 true});
196#endif
197#ifdef EXPERIMENTAL_CEE_NUMBERS_OPTION
198 S.TieCheckBox(XXO("Never use comma as decimal point"),
199 {wxT("/Locale/CeeNumberFormat"),
200 false});
201#endif
202 }
203 S.EndStatic();
204
205 S.StartStatic(XO("Timeline"));
206 {
207 S.TieCheckBox(XXO("Show Timeline Tooltips"),
208 {wxT("/QuickPlay/ToolTips"),
209 true});
210 S.TieCheckBox(XXO("Show Scrub Ruler"),
211 {wxT("/QuickPlay/ScrubbingEnabled"),
212 false});
213 }
214 S.EndStatic();
215
216 S.EndScroller();
217}
IntSetting DecibelScaleCutoff
Negation of this value is the lowest dB level that should be shown in dB scales.
Definition: Decibels.cpp:12
ChoiceSetting GUIManualLocation
Definition: GUIPrefs.cpp:130
#define XXO(s)
Definition: Internat.h:44
ByColumns_t ByColumns
Definition: Prefs.cpp:474
THEME_API BoolSetting GUIBlendThemes
THEME_API ChoiceSetting & GUITheme()

References ByColumns, DecibelScaleCutoff, GUIBlendThemes, GUIManualLocation, GUITheme(), mDefaultRangeIndex, mLangCodes, mLangNames, mRangeChoices, mRangeCodes, S, 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

◆ mDefaultRangeIndex

int GUIPrefs::mDefaultRangeIndex
private

Definition at line 51 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mLangCodes

wxArrayStringEx GUIPrefs::mLangCodes
private

Definition at line 46 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mLangNames

TranslatableStrings GUIPrefs::mLangNames
private

Definition at line 47 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mRangeChoices

TranslatableStrings GUIPrefs::mRangeChoices
private

Definition at line 50 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mRangeCodes

wxArrayStringEx GUIPrefs::mRangeCodes
private

Definition at line 49 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().


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