Audacity  2.2.2
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:
PrefsPanel wxPanelWrapper wxTabTraversalWrapper< wxPanel >

Public Member Functions

 GUIPrefs (wxWindow *parent, wxWindowID winid)
 
 ~GUIPrefs ()
 
bool Commit () override
 
wxString HelpPageName () override
 
void PopulateOrExchange (ShuttleGui &S) override
 
- Public Member Functions inherited from PrefsPanel
 PrefsPanel (wxWindow *parent, wxWindowID winid, const wxString &title)
 
virtual ~PrefsPanel ()
 
virtual void Preview ()
 
virtual bool ShowsPreviewButton ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
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 wxString &name=_("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const wxString &name=_("Panel"))
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&...args)
 

Static Public Member Functions

static void GetRangeChoices (wxArrayString *pChoices, wxArrayString *pCodes)
 

Private Member Functions

void Populate ()
 

Private Attributes

wxArrayString mLangCodes
 
wxArrayString mLangNames
 
wxArrayString mHtmlHelpCodes
 
wxArrayString mHtmlHelpChoices
 
wxArrayString mThemeCodes
 
wxArrayString mThemeChoices
 
wxArrayString mRangeCodes
 
wxArrayString mRangeChoices
 

Detailed Description

A PrefsPanel for general GUI preferences.

Definition at line 25 of file GUIPrefs.h.

Constructor & Destructor Documentation

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

Definition at line 39 of file GUIPrefs.cpp.

References Populate().

41 : PrefsPanel(parent, winid, _("Interface"))
42 {
43  Populate();
44 }
PrefsPanel(wxWindow *parent, wxWindowID winid, const wxString &title)
Definition: PrefsPanel.h:48
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
void Populate()
Definition: GUIPrefs.cpp:79
GUIPrefs::~GUIPrefs ( )

Definition at line 46 of file GUIPrefs.cpp.

47 {
48 }

Member Function Documentation

bool GUIPrefs::Commit ( )
overridevirtual

Implements PrefsPanel.

Definition at line 206 of file GUIPrefs.cpp.

References eIsSavingToPrefs, gPrefs, AudacityApp::InitLang(), PopulateOrExchange(), and wxGetApp().

207 {
208  ShuttleGui S(this, eIsSavingToPrefs);
210 
211  // If language has changed, we want to change it now, not on the next reboot.
212  wxString lang = gPrefs->Read(wxT("/Locale/Language"), wxT(""));
213  wxString usedLang = wxGetApp().InitLang(lang);
214  // Bug 1523: Previously didn't check no-language (=System Language)
215  if (!(lang.empty()) && (lang != usedLang)) {
216  // lang was not usable and is not system language. We got overridden.
217  gPrefs->Write(wxT("/Locale/Language"), usedLang);
218  gPrefs->Flush();
219  }
220 
221  return true;
222 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
void PopulateOrExchange(ShuttleGui &S) override
Definition: GUIPrefs.cpp:123
wxString InitLang(const wxString &lang)
AudacityApp & wxGetApp()
void GUIPrefs::GetRangeChoices ( wxArrayString *  pChoices,
wxArrayString *  pCodes 
)
static

Definition at line 50 of file GUIPrefs.cpp.

References _().

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

51 {
52  if (pCodes) {
53  wxArrayString &codes = *pCodes;
54  codes.Clear();
55  codes.Add(wxT("36"));
56  codes.Add(wxT("48"));
57  codes.Add(wxT("60"));
58  codes.Add(wxT("72"));
59  codes.Add(wxT("84"));
60  codes.Add(wxT("96"));
61  codes.Add(wxT("120"));
62  codes.Add(wxT("145"));
63  }
64 
65  if (pChoices) {
66  wxArrayString &choices = *pChoices;
67  choices.Clear();
68  choices.Add(_("-36 dB (shallow range for high-amplitude editing)"));
69  choices.Add(_("-48 dB (PCM range of 8 bit samples)"));
70  choices.Add(_("-60 dB (PCM range of 10 bit samples)"));
71  choices.Add(_("-72 dB (PCM range of 12 bit samples)"));
72  choices.Add(_("-84 dB (PCM range of 14 bit samples)"));
73  choices.Add(_("-96 dB (PCM range of 16 bit samples)"));
74  choices.Add(_("-120 dB (approximate limit of human hearing)"));
75  choices.Add(_("-145 dB (PCM range of 24 bit samples)"));
76  }
77 }
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxString GUIPrefs::HelpPageName ( )
overridevirtual

Reimplemented from PrefsPanel.

Definition at line 224 of file GUIPrefs.cpp.

225 {
226  return "Interface_Preferences";
227 }
void GUIPrefs::Populate ( )
private

Definition at line 79 of file GUIPrefs.cpp.

References _(), eIsCreatingFromPrefs, GetLanguages(), GetRangeChoices(), mHtmlHelpChoices, mHtmlHelpCodes, mLangCodes, mLangNames, mRangeChoices, mRangeCodes, mThemeChoices, mThemeCodes, and PopulateOrExchange().

Referenced by GUIPrefs().

80 {
81  // First any pre-processing for constructing the GUI.
83 
84  mHtmlHelpCodes.Add(wxT("Local"));
85  mHtmlHelpCodes.Add(wxT("FromInternet"));
86 
87  mHtmlHelpChoices.Add(_("Local"));
88  mHtmlHelpChoices.Add(_("From Internet"));
89 
90  mThemeCodes.Add( wxT("classic") );
91  mThemeCodes.Add( wxT("light") );
92  mThemeCodes.Add( wxT("dark") );
93  mThemeCodes.Add( wxT("high-contrast") );
94  mThemeCodes.Add( wxT("custom") );
95 
96  /* i18n-hint: describing the "classic" or traditional appearance of older versions of Audacity */
97  mThemeChoices.Add( _("Classic") );
98  /* i18n-hint: Light meaning opposite of dark */
99  mThemeChoices.Add( _("Light") );
100  mThemeChoices.Add( _("Dark") );
101  /* i18n-hint: greater difference between foreground and background colors */
102  mThemeChoices.Add( _("High Contrast") );
103  /* i18n-hint: user defined */
104  mThemeChoices.Add( _("Custom") );
105 
107 
108 #if 0
109  // only for testing...
110  mLangCodes.Add("kg"); mLangNames.Add("Klingon");
111  mLangCodes.Add("ep"); mLangNames.Add("Esperanto");
112 #endif
113 
114  //------------------------- Main section --------------------
115  // Now construct the GUI itself.
116  // Use 'eIsCreatingFromPrefs' so that the GUI is
117  // initialised with values from gPrefs.
120  // ----------------------- End of main section --------------
121 }
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
wxArrayString mLangCodes
Definition: GUIPrefs.h:39
void PopulateOrExchange(ShuttleGui &S) override
Definition: GUIPrefs.cpp:123
static void GetRangeChoices(wxArrayString *pChoices, wxArrayString *pCodes)
Definition: GUIPrefs.cpp:50
wxArrayString mRangeChoices
Definition: GUIPrefs.h:49
wxArrayString mThemeCodes
Definition: GUIPrefs.h:45
wxArrayString mThemeChoices
Definition: GUIPrefs.h:46
wxArrayString mHtmlHelpCodes
Definition: GUIPrefs.h:42
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
void GetLanguages(wxArrayString &langCodes, wxArrayString &langNames)
Definition: Languages.cpp:132
wxArrayString mLangNames
Definition: GUIPrefs.h:40
wxArrayString mHtmlHelpChoices
Definition: GUIPrefs.h:43
wxArrayString mRangeCodes
Definition: GUIPrefs.h:48
void GUIPrefs::PopulateOrExchange ( ShuttleGui S)
override

Definition at line 123 of file GUIPrefs.cpp.

References _(), ShuttleGuiBase::EndMultiColumn(), ShuttleGuiBase::EndScroller(), ShuttleGuiBase::EndStatic(), ENV_DB_KEY, ENV_DB_RANGE, mHtmlHelpChoices, mHtmlHelpCodes, mLangCodes, mLangNames, mRangeChoices, mRangeCodes, mThemeChoices, mThemeCodes, ShuttleGuiBase::SetBorder(), ShuttleGuiBase::StartMultiColumn(), ShuttleGuiBase::StartScroller(), ShuttleGuiBase::StartStatic(), ShuttleGuiBase::TieCheckBox(), and ShuttleGuiBase::TieChoice().

Referenced by Commit(), and Populate().

124 {
125  S.SetBorder(2);
126  S.StartScroller();
127 
128  S.StartStatic(_("Display"));
129  {
130  S.StartMultiColumn(2);
131  {
132 
133 #ifdef EXPERIMENTAL_DA
134  const wxString defaultTheme = wxT("dark");
135 #else
136  const wxString defaultTheme = wxT("light");
137 #endif
138  const wxString defaultRange = wxString::Format(wxT("%d"), ENV_DB_RANGE);
139 
140  S.TieChoice(_("&Language:"),
141  wxT("/Locale/Language"),
142  wxT(""),
143  mLangNames,
144  mLangCodes);
145 
146  S.TieChoice(_("Location of &Manual:"),
147  wxT("/GUI/Help"),
148  wxT("Local"),
151 
152  S.TieChoice(_("Th&eme:"),
153  wxT("/GUI/Theme"),
154  defaultTheme,
156  mThemeCodes);
157 
158  S.TieChoice(_("Meter dB &range:"),
159  ENV_DB_KEY,
160  defaultRange,
162  mRangeCodes);
163  }
164  S.EndMultiColumn();
165 // S.AddSpace(10);
166 // JKC: This is a silly preference. Kept here as a reminder that we may
167 // later want to have configurable button order.
168 // S.TieCheckBox(_("&Ergonomic order of Transport Toolbar buttons"),
169 // wxT("/GUI/ErgonomicTransportButtons"),
170 // true);
171 
172  }
173  S.EndStatic();
174 
175  S.StartStatic(_("Options"));
176  {
177  // Start wording of options with a verb, if possible.
178  S.TieCheckBox(_("Show 'How to Get &Help' at launch"),
179  wxT("/GUI/ShowSplashScreen"),
180  true);
181  S.TieCheckBox(_("Show e&xtra menus"),
182  wxT("/GUI/ShowExtraMenus"),
183  false);
184 #ifdef EXPERIMENTAL_THEME_PREFS
185  // We do not want to make this option mainstream. It's a
186  // convenience for developers.
187  S.TieCheckBox(_("Show alternative &styling (Mac vs PC)"),
188  wxT("/GUI/ShowMac"),
189  false);
190 #endif
191  S.TieCheckBox(_("&Beep on completion of longer activities"),
192  wxT("/GUI/BeepOnCompletion"),
193  false);
194  S.TieCheckBox(_("Re&tain labels if selection snaps to a label"),
195  wxT("/GUI/RetainLabels"),
196  false);
197  S.TieCheckBox(_("B&lend system and Audacity theme"),
198  wxT("/GUI/BlendThemes"),
199  true);
200  }
201  S.EndStatic();
202 
203  S.EndScroller();
204 }
wxChoice * TieChoice(const wxString &Prompt, WrappedType &WrappedRef, const wxArrayString *pChoices)
#define ENV_DB_KEY
Definition: GUISettings.h:15
wxArrayString mLangCodes
Definition: GUIPrefs.h:39
void EndMultiColumn()
void EndScroller()
Definition: ShuttleGui.cpp:828
wxArrayString mRangeChoices
Definition: GUIPrefs.h:49
#define ENV_DB_RANGE
Definition: GUISettings.h:16
wxScrolledWindow * StartScroller(int iStyle=0)
Definition: ShuttleGui.cpp:795
wxArrayString mThemeCodes
Definition: GUIPrefs.h:45
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
wxArrayString mThemeChoices
Definition: GUIPrefs.h:46
wxArrayString mHtmlHelpCodes
Definition: GUIPrefs.h:42
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxArrayString mLangNames
Definition: GUIPrefs.h:40
wxCheckBox * TieCheckBox(const wxString &Prompt, WrappedType &WrappedRef)
wxStaticBox * StartStatic(const wxString &Str, int iProp=0)
Definition: ShuttleGui.cpp:763
void SetBorder(int Border)
Definition: ShuttleGui.h:286
wxArrayString mHtmlHelpChoices
Definition: GUIPrefs.h:43
wxArrayString mRangeCodes
Definition: GUIPrefs.h:48

Member Data Documentation

wxArrayString GUIPrefs::mHtmlHelpChoices
private

Definition at line 43 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

wxArrayString GUIPrefs::mHtmlHelpCodes
private

Definition at line 42 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

wxArrayString GUIPrefs::mLangCodes
private

Definition at line 39 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

wxArrayString GUIPrefs::mLangNames
private

Definition at line 40 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

wxArrayString GUIPrefs::mRangeChoices
private

Definition at line 49 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

wxArrayString GUIPrefs::mRangeCodes
private

Definition at line 48 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

wxArrayString GUIPrefs::mThemeChoices
private

Definition at line 46 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

wxArrayString GUIPrefs::mThemeCodes
private

Definition at line 45 of file GUIPrefs.h.

Referenced by Populate(), and PopulateOrExchange().


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