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 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:102
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 199 of file GUIPrefs.cpp.

200{
203
204 // If language has changed, we want to change it now, not on the next reboot.
205 wxString lang = gPrefs->Read(wxT("/Locale/Language"), wxT(""));
206 wxString usedLang = GUISettings::SetLang(lang);
207 // Bug 1523: Previously didn't check no-language (=System Language)
208 if (!(lang.empty() || lang == L"System") && (lang != usedLang)) {
209 // lang was not usable and is not system language. We got overridden.
210 gPrefs->Write(wxT("/Locale/Language"), usedLang);
211 gPrefs->Flush();
212 }
213
214 // Reads preference GUITheme
215 {
216 wxBusyCursor busy;
219 }
221
224
225 return true;
226}
wxT("CloseDown"))
IntSetting DecibelScaleCutoff
Negation of this value is the lowest dB level that should be shown in dB scales.
Definition: Decibels.cpp:12
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
@ 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
void PopulateOrExchange(ShuttleGui &S) override
Definition: GUIPrefs.cpp:132
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
virtual bool Flush() noexcept=0
virtual bool Write(const wxString &key, bool value)=0
virtual bool Read(const wxString &key, bool *value) const =0
AUDACITY_DLL_API wxString SetLang(const wxString &lang)
Definition: GUISettings.cpp:19

References AColor::ApplyUpdatedImages(), DecibelScaleCutoff, ThemeBase::DeleteUnusedThemes(), eIsSavingToPrefs, audacity::BasicSettings::Flush(), gPrefs, GUIBlendThemes, Setting< T >::Invalidate(), ThemeBase::LoadPreferredTheme(), PopulateOrExchange(), audacity::BasicSettings::Read(), S, GUISettings::SetLang(), theTheme, audacity::BasicSettings::Write(), 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:

◆ GetRangeChoices()

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

Definition at line 65 of file GUIPrefs.cpp.

70{
71 static const wxArrayStringEx 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}
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.

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

103{
104 // First any pre-processing for constructing the GUI.
107
109
110#if 0
112 // only for testing...
113 "kg" ,
114 "ep" ,
115 } );
116
117 mLangNames.insert( mLangNames.end(), {
118 "Klingon" ,
119 "Esperanto" ,
120 } );
121#endif
122
123 //------------------------- Main section --------------------
124 // Now construct the GUI itself.
125 // Use 'eIsCreatingFromPrefs' so that the GUI is
126 // initialised with values from gPrefs.
129 // ----------------------- End of main section --------------
130}
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:46
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:65
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 132 of file GUIPrefs.cpp.

133{
134 ChoiceSetting LanguageSetting{ wxT("/Locale/Language"),
136 };
140 };
141
142 S.SetBorder(2);
143 S.StartScroller();
144
145 S.StartStatic(XO("Display"));
146 {
147 S.StartMultiColumn(2);
148 {
149 S.TieChoice( XXO("&Language:"), LanguageSetting);
150 // S.TieChoice( XXO("Location of &Manual:"), GUIManualLocation);
151 S.TieChoice( XXO("Th&eme:"), GUITheme());
152 S.TieChoice( XXO("Meter dB &range:"), DBSetting);
153 }
154 S.EndMultiColumn();
155 }
156 S.EndStatic();
157
158 S.StartStatic(XO("Options"));
159 {
160 // Start wording of options with a verb, if possible.
161 S.TieCheckBox(XXO("Show 'How to Get &Help' at launch"),
162 {wxT("/GUI/ShowSplashScreen"),
163 true});
164 S.TieCheckBox(XXO("Show e&xtra menus"),
165 {wxT("/GUI/ShowExtraMenus"),
166 false});
167#ifdef EXPERIMENTAL_THEME_PREFS
168 // We do not want to make this option mainstream. It's a
169 // convenience for developers.
170 S.TieCheckBox(XXO("Show alternative &styling (Mac vs PC)"),
171 {wxT("/GUI/ShowMac"),
172 false});
173#endif
174 S.TieCheckBox(XXO("&Beep on completion of longer activities"),
175 {wxT("/GUI/BeepOnCompletion"),
176 false});
177 S.TieCheckBox(XXO("Re&tain labels if selection snaps to a label"),
178 {wxT("/GUI/RetainLabels"),
179 false});
180 S.TieCheckBox(XXO("B&lend system and Audacity theme"),
182#ifndef __WXMAC__
183 /* i18n-hint: RTL stands for 'Right to Left' */
184 S.TieCheckBox(XXO("Use mostly Left-to-Right layouts in RTL languages"),
185 {"/GUI/RtlWorkaround",
186 true});
187#endif
188#ifdef EXPERIMENTAL_CEE_NUMBERS_OPTION
189 S.TieCheckBox(XXO("Never use comma as decimal point"),
190 {wxT("/Locale/CeeNumberFormat"),
191 false});
192#endif
193 }
194 S.EndStatic();
195
196 S.EndScroller();
197}
XXO("&Cut/Copy/Paste Toolbar")
ByColumns_t ByColumns
Definition: Prefs.cpp:515
THEME_API ChoiceSetting & GUITheme()

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

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