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

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 *) >
 
- Static Public Member Functions inherited from PrefsPanel
static FactoriesDefaultFactories ()
 

Detailed Description

A PrefsPanel for general GUI preferences.

Definition at line 26 of file GUIPrefs.h.

Constructor & Destructor Documentation

◆ GUIPrefs()

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

Definition at line 40 of file GUIPrefs.cpp.

42: PrefsPanel(parent, winid, XC("Interface", "GUI"))
43{
44 Populate();
45}
#define XC(s, c)
Definition: Internat.h:37
void Populate()
Definition: GUIPrefs.cpp:66
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 47 of file GUIPrefs.cpp.

48{
49}

Member Function Documentation

◆ Commit()

bool GUIPrefs::Commit ( )
overridevirtual

Implements PrefsPanel.

Definition at line 162 of file GUIPrefs.cpp.

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}
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
#define S(N)
Definition: ToChars.cpp:64
static void ApplyUpdatedImages()
Definition: AColor.cpp:841
void PopulateOrExchange(ShuttleGui &S) override
Definition: GUIPrefs.cpp:97
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, 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 56 of file GUIPrefs.cpp.

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

References XO().

Here is the call graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol GUIPrefs::GetSymbol ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 51 of file GUIPrefs.cpp.

52{
54}
#define GUI_PREFS_PLUGIN_SYMBOL
Definition: GUIPrefs.h:24

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

62{
63 return "Interface_Preferences";
64}

◆ Populate()

void GUIPrefs::Populate ( )
private

Definition at line 66 of file GUIPrefs.cpp.

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}
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:46
int mDefaultRangeIndex
Definition: GUIPrefs.h:46
wxArrayStringEx mRangeCodes
Definition: GUIPrefs.h:44
wxArrayStringEx mLangCodes
Definition: GUIPrefs.h:41
TranslatableStrings mLangNames
Definition: GUIPrefs.h:42
TranslatableStrings mRangeChoices
Definition: GUIPrefs.h:45
static void GetRangeChoices(TranslatableStrings *pChoices, wxArrayStringEx *pCodes, int *pDefaultRangeIndex=nullptr)
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(), WaveformSettings::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 97 of file GUIPrefs.cpp.

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}
XXO("&Cut/Copy/Paste Toolbar")
ByColumns_t ByColumns
Definition: Prefs.cpp:515
THEME_API ChoiceSetting & GUITheme()

References ByColumns, DecibelScaleCutoff, 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 46 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mLangCodes

wxArrayStringEx GUIPrefs::mLangCodes
private

Definition at line 41 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mLangNames

TranslatableStrings GUIPrefs::mLangNames
private

Definition at line 42 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mRangeChoices

TranslatableStrings GUIPrefs::mRangeChoices
private

Definition at line 45 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mRangeCodes

wxArrayStringEx GUIPrefs::mRangeCodes
private

Definition at line 44 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().


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