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

A PrefsPanel for spectrum settings. More...

#include <WaveformPrefs.h>

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

Public Member Functions

 WaveformPrefs (wxWindow *parent, wxWindowID winid, AudacityProject *pProject, WaveChannel *wc)
 
virtual ~WaveformPrefs ()
 
ComponentInterfaceSymbol GetSymbol () const override
 
TranslatableString GetDescription () const override
 
ManualPageID HelpPageName () override
 If not empty string, the Help button is added below the panel. More...
 
bool Commit () override
 
bool ShowsPreviewButton () override
 
bool Validate () override
 
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 ()
 
void OnControl (wxCommandEvent &)
 
void OnScale (wxCommandEvent &)
 
void OnDefaults (wxCommandEvent &)
 
void EnableDisableRange ()
 

Private Attributes

AudacityProjectmProject {}
 
WaveChannel *const mWc
 
bool mDefaulted
 
wxCheckBox * mDefaultsCheckbox
 
wxChoice * mScaleChoice
 
wxChoice * mRangeChoice
 
wxArrayStringEx mRangeCodes
 
TranslatableStrings mRangeChoices
 
WaveformSettings mTempSettings
 
bool mPopulating
 

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 spectrum settings.

Definition at line 25 of file WaveformPrefs.h.

Constructor & Destructor Documentation

◆ WaveformPrefs()

WaveformPrefs::WaveformPrefs ( wxWindow *  parent,
wxWindowID  winid,
AudacityProject pProject,
WaveChannel wc 
)

Definition at line 33 of file WaveformPrefs.cpp.

36: PrefsPanel(parent, winid, XO("Waveforms"))
37, mProject{ pProject }
38, mWc(wc)
39, mPopulating(false)
40{
41 if (mWc) {
45 }
46 else {
48 mDefaulted = false;
49 }
50
52 Populate();
53}
XO("Cut/Copy/Paste")
static Settings & settings()
Definition: TrackInfo.cpp:69
PrefsPanel(wxWindow *parent, wxWindowID winid, const TranslatableString &title)
Definition: PrefsPanel.h:94
WaveChannel *const mWc
Definition: WaveformPrefs.h:52
WaveformSettings mTempSettings
Definition: WaveformPrefs.h:62
AudacityProject * mProject
Definition: WaveformPrefs.h:50
static WaveformSettings & defaults()
static WaveformSettings & Get(const WaveTrack &track)

References WaveformSettings::ConvertToEnumeratedDBRange(), WaveformSettings::defaults(), WaveformSettings::Get(), mDefaulted, mTempSettings, mWc, Populate(), and settings().

Here is the call graph for this function:

◆ ~WaveformPrefs()

WaveformPrefs::~WaveformPrefs ( )
virtual

Definition at line 55 of file WaveformPrefs.cpp.

56{
57}

Member Function Documentation

◆ Commit()

bool WaveformPrefs::Commit ( )
overridevirtual

Implements PrefsPanel.

Definition at line 158 of file WaveformPrefs.cpp.

159{
160 const bool isOpenPage = this->IsShown();
161
164
167
168 if (mWc) {
169 if (mDefaulted)
171 else {
174 }
175 }
176
177 WaveformSettings *const pSettings = &WaveformSettings::defaults();
178 if (!mWc || mDefaulted) {
179 *pSettings = mTempSettings;
180 pSettings->SavePrefs();
181 }
182 pSettings->LoadPrefs(); // always; in case Globals changed
183
185
186 if (mWc && isOpenPage) {
188 }
189
190 if (isOpenPage) {
191 if ( mProject ) {
192 auto &tp = TrackPanel::Get( *mProject );
193 tp.UpdateVRulers();
194 tp.Refresh(false);
195 }
196 }
197
198 return true;
199}
@ eIsGettingFromDialog
Definition: ShuttleGui.h:38
#define S(N)
Definition: ToChars.cpp:64
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
static TrackPanel & Get(AudacityProject &project)
Definition: TrackPanel.cpp:234
void SetDisplay(Display display, bool exclusive=true)
static WaveChannelView & Get(WaveChannel &channel)
void PopulateOrExchange(ShuttleGui &S) override
Waveform settings, either for one track or as defaults.
static void Set(WaveChannel &channel, std::unique_ptr< WaveformSettings > pSettings)
Guarantee independence of settings, then assign.

References WaveformSettings::ConvertToActualDBRange(), WaveformSettings::ConvertToEnumeratedDBRange(), WaveformSettings::defaults(), eIsGettingFromDialog, WaveformSettings::Globals::Get(), TrackPanel::Get(), WaveformSettings::Get(), WaveChannelView::Get(), WaveformSettings::LoadPrefs(), mDefaulted, mProject, mTempSettings, mWc, PopulateOrExchange(), S, WaveformSettings::Globals::SavePrefs(), WaveformSettings::SavePrefs(), WaveformSettings::Set(), WaveChannelView::SetDisplay(), settings(), and WaveChannelViewConstants::Waveform.

Here is the call graph for this function:

◆ EnableDisableRange()

void WaveformPrefs::EnableDisableRange ( )
private

Definition at line 238 of file WaveformPrefs.cpp.

239{
240 mRangeChoice->Enable(
242}
wxChoice * mRangeChoice
Definition: WaveformPrefs.h:57
wxChoice * mScaleChoice
Definition: WaveformPrefs.h:56

References mRangeChoice, mScaleChoice, and WaveformSettings::stLogarithmicDb.

Referenced by OnScale(), and PopulateOrExchange().

Here is the caller graph for this function:

◆ GetDescription()

TranslatableString WaveformPrefs::GetDescription ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 64 of file WaveformPrefs.cpp.

65{
66 return XO("Preferences for Waveforms");
67}

References XO().

Here is the call graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol WaveformPrefs::GetSymbol ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 59 of file WaveformPrefs.cpp.

60{
62}
#define WAVEFORM_PREFS_PLUGIN_SYMBOL
Definition: WaveformPrefs.h:23

References WAVEFORM_PREFS_PLUGIN_SYMBOL.

◆ HelpPageName()

ManualPageID WaveformPrefs::HelpPageName ( )
overridevirtual

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

Default returns empty string.

Reimplemented from PrefsPanel.

Definition at line 69 of file WaveformPrefs.cpp.

70{
71 return "Waveform_Preferences";
72}

◆ OnControl()

void WaveformPrefs::OnControl ( wxCommandEvent &  )
private

Definition at line 206 of file WaveformPrefs.cpp.

207{
208 // Common routine for most controls
209 // If any per-track setting is changed, break the association with defaults
210 // Skip this, and View Settings... will be able to change defaults instead
211 // when the checkbox is on, as in the original design.
212
214 mDefaulted = false;
215 mDefaultsCheckbox->SetValue(false);
216 }
217}
wxCheckBox * mDefaultsCheckbox
Definition: WaveformPrefs.h:55

References mDefaulted, mDefaultsCheckbox, and mPopulating.

Referenced by OnScale().

Here is the caller graph for this function:

◆ OnDefaults()

void WaveformPrefs::OnDefaults ( wxCommandEvent &  )
private

Definition at line 227 of file WaveformPrefs.cpp.

228{
229 if (mDefaultsCheckbox->IsChecked()) {
232 mDefaulted = true;
235 }
236}
@ eIsSettingToDialog
Definition: ShuttleGui.h:39

References WaveformSettings::ConvertToEnumeratedDBRange(), WaveformSettings::defaults(), eIsSettingToDialog, mDefaulted, mDefaultsCheckbox, mTempSettings, PopulateOrExchange(), and S.

Here is the call graph for this function:

◆ OnScale()

void WaveformPrefs::OnScale ( wxCommandEvent &  e)
private

Definition at line 219 of file WaveformPrefs.cpp.

220{
222
223 // do the common part
224 OnControl(e);
225}
void OnControl(wxCommandEvent &)
void EnableDisableRange()

References EnableDisableRange(), and OnControl().

Here is the call graph for this function:

◆ Populate()

void WaveformPrefs::Populate ( )
private

Definition at line 81 of file WaveformPrefs.cpp.

82{
83 // Reuse the same choices and codes as for Interface prefs
85
86 //------------------------- Main section --------------------
87 // Now construct the GUI itself.
90 // ----------------------- End of main section --------------
91}
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:46
static void GetRangeChoices(TranslatableStrings *pChoices, wxArrayStringEx *pCodes, int *pDefaultRangeIndex=nullptr)
Definition: GUIPrefs.cpp:65
TranslatableStrings mRangeChoices
Definition: WaveformPrefs.h:60
wxArrayStringEx mRangeCodes
Definition: WaveformPrefs.h:59

References eIsCreatingFromPrefs, GUIPrefs::GetRangeChoices(), mRangeChoices, mRangeCodes, PopulateOrExchange(), and S.

Referenced by WaveformPrefs().

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

◆ PopulateOrExchange()

void WaveformPrefs::PopulateOrExchange ( ShuttleGui S)
override

Definition at line 93 of file WaveformPrefs.cpp.

94{
95 mPopulating = true;
96
97 S.SetBorder(2);
98 S.StartScroller();
99
100 // S.StartStatic(XO("Track Settings"));
101 {
103 if (mWc) {
104 /* i18n-hint: use is a verb */
105 mDefaultsCheckbox = S.Id(ID_DEFAULTS).TieCheckBox(XXO("&Use Preferences"), mDefaulted);
106 }
107
108 S.StartStatic(XO("Display"));
109 {
110 S.StartTwoColumn();
111 {
113 S.Id(ID_SCALE).TieChoice(XXO("S&cale:"),
116
118 S.Id(ID_RANGE).TieChoice(XXO("Waveform dB &range:"),
121 }
122 S.EndTwoColumn();
123 }
124 S.EndStatic();
125 }
126 // S.EndStatic();
127
128 /*
129 S.StartStatic(XO("Global settings"));
130 {
131 }
132 S.EndStatic();
133 */
134
135 S.EndScroller();
136
138
139 mPopulating = false;
140}
XXO("&Cut/Copy/Paste Toolbar")
TranslatableStrings Msgids(const EnumValueSymbol strings[], size_t nStrings)
Convenience function often useful when adding choice controls.
@ ID_SCALE
@ ID_DEFAULTS
@ ID_RANGE
static const EnumValueSymbols & GetScaleNames()

References WaveformSettings::dBRange, EnableDisableRange(), WaveformSettings::GetScaleNames(), ID_DEFAULTS, ID_RANGE, ID_SCALE, mDefaulted, mDefaultsCheckbox, mPopulating, mRangeChoice, mRangeChoices, mScaleChoice, Msgids(), mTempSettings, mWc, S, WaveformSettings::scaleType, XO(), and XXO().

Referenced by Commit(), OnDefaults(), Populate(), and Validate().

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

◆ ShowsPreviewButton()

bool WaveformPrefs::ShowsPreviewButton ( )
overridevirtual

Reimplemented from PrefsPanel.

Definition at line 201 of file WaveformPrefs.cpp.

202{
203 return true;
204}

◆ Validate()

bool WaveformPrefs::Validate ( )
override

Definition at line 142 of file WaveformPrefs.cpp.

143{
144 // Do checking for whole numbers
145
146 // ToDo: use wxIntegerValidator<unsigned> when available
147
150
151 // Delegate range checking to WaveformSettings class
153 const bool result = mTempSettings.Validate(false);
155 return result;
156}
bool Validate(bool quiet)

References WaveformSettings::ConvertToActualDBRange(), WaveformSettings::ConvertToEnumeratedDBRange(), eIsGettingFromDialog, mTempSettings, PopulateOrExchange(), S, and WaveformSettings::Validate().

Here is the call graph for this function:

Member Data Documentation

◆ mDefaulted

bool WaveformPrefs::mDefaulted
private

Definition at line 53 of file WaveformPrefs.h.

Referenced by Commit(), OnControl(), OnDefaults(), PopulateOrExchange(), and WaveformPrefs().

◆ mDefaultsCheckbox

wxCheckBox* WaveformPrefs::mDefaultsCheckbox
private

Definition at line 55 of file WaveformPrefs.h.

Referenced by OnControl(), OnDefaults(), and PopulateOrExchange().

◆ mPopulating

bool WaveformPrefs::mPopulating
private

Definition at line 64 of file WaveformPrefs.h.

Referenced by OnControl(), and PopulateOrExchange().

◆ mProject

AudacityProject* WaveformPrefs::mProject {}
private

Definition at line 50 of file WaveformPrefs.h.

Referenced by Commit().

◆ mRangeChoice

wxChoice* WaveformPrefs::mRangeChoice
private

Definition at line 57 of file WaveformPrefs.h.

Referenced by EnableDisableRange(), and PopulateOrExchange().

◆ mRangeChoices

TranslatableStrings WaveformPrefs::mRangeChoices
private

Definition at line 60 of file WaveformPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mRangeCodes

wxArrayStringEx WaveformPrefs::mRangeCodes
private

Definition at line 59 of file WaveformPrefs.h.

Referenced by Populate().

◆ mScaleChoice

wxChoice* WaveformPrefs::mScaleChoice
private

Definition at line 56 of file WaveformPrefs.h.

Referenced by EnableDisableRange(), and PopulateOrExchange().

◆ mTempSettings

WaveformSettings WaveformPrefs::mTempSettings
private

Definition at line 62 of file WaveformPrefs.h.

Referenced by Commit(), OnDefaults(), PopulateOrExchange(), Validate(), and WaveformPrefs().

◆ mWc

WaveChannel* const WaveformPrefs::mWc
private

Definition at line 52 of file WaveformPrefs.h.

Referenced by Commit(), PopulateOrExchange(), and WaveformPrefs().


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