1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-23 15:50:05 +02:00

Change constructor & factory arguments of some window classes...

... Follow convention of parent first, id second.

Do more work in constructors, rather than having multi-stage setup.
This commit is contained in:
Paul Licameli 2018-01-26 11:23:55 -05:00
commit 0efb7ce4d1
91 changed files with 617 additions and 512 deletions

View File

@ -280,17 +280,16 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id,
S.StartVerticalLay(2); S.StartVerticalLay(2);
{ {
vRuler = safenew RulerPanel(this, wxID_ANY); vRuler = safenew RulerPanel(
vRuler->ruler.SetBounds(0, 0, 100, 100); // Ruler can't handle small sizes this, wxID_ANY, wxVERTICAL,
vRuler->ruler.SetOrientation(wxVERTICAL); wxSize{ 100, 100 }, // Ruler can't handle small sizes
vRuler->ruler.SetRange(0.0, -dBRange); RulerPanel::Range{ 0.0, -dBRange },
vRuler->ruler.SetFormat(Ruler::LinearDBFormat); Ruler::LinearDBFormat,
vRuler->ruler.SetUnits(_("dB")); _("dB"),
vRuler->ruler.SetLabelEdges(true); RulerPanel::Options{}
int w; .LabelEdges(true)
vRuler->ruler.GetMaxSize(&w, NULL); .TickColour( theTheme.Colour( clrGraphLabels ) )
vRuler->SetMinSize(wxSize(w, 150)); // height needed for wxGTK );
vRuler->SetTickColour( theTheme.Colour( clrGraphLabels ));
S.AddSpace(wxDefaultCoord, 1); S.AddSpace(wxDefaultCoord, 1);
S.Prop(1); S.Prop(1);
@ -299,7 +298,7 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id,
} }
S.EndVerticalLay(); S.EndVerticalLay();
mFreqPlot = safenew FreqPlot(this); mFreqPlot = safenew FreqPlot(this, wxID_ANY);
mFreqPlot->SetMinSize(wxSize(wxDefaultCoord, FREQ_WINDOW_HEIGHT)); mFreqPlot->SetMinSize(wxSize(wxDefaultCoord, FREQ_WINDOW_HEIGHT));
S.Prop(1); S.Prop(1);
S.AddWindow(mFreqPlot, wxEXPAND); S.AddWindow(mFreqPlot, wxEXPAND);
@ -348,19 +347,18 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id,
S.StartHorizontalLay(wxEXPAND, 0); S.StartHorizontalLay(wxEXPAND, 0);
{ {
hRuler = safenew RulerPanel(this, wxID_ANY); hRuler = safenew RulerPanel(
hRuler->ruler.SetBounds(0, 0, 100, 100); // Ruler can't handle small sizes this, wxID_ANY, wxHORIZONTAL,
hRuler->ruler.SetOrientation(wxHORIZONTAL); wxSize{ 100, 100 }, // Ruler can't handle small sizes
hRuler->ruler.SetLog(true); RulerPanel::Range{ 10, 20000 },
hRuler->ruler.SetRange(10, 20000); Ruler::RealFormat,
hRuler->ruler.SetFormat(Ruler::RealFormat); _("Hz"),
hRuler->ruler.SetUnits(_("Hz")); RulerPanel::Options{}
hRuler->ruler.SetFlip(true); .Log(true)
hRuler->ruler.SetLabelEdges(true); .Flip(true)
int h; .LabelEdges(true)
hRuler->ruler.GetMaxSize(NULL, &h); .TickColour( theTheme.Colour( clrGraphLabels ) )
hRuler->SetMinSize(wxSize(wxDefaultCoord, h)); );
hRuler->SetTickColour( theTheme.Colour( clrGraphLabels ));
S.AddSpace(1, wxDefaultCoord); S.AddSpace(1, wxDefaultCoord);
S.Prop(1); S.Prop(1);
@ -483,7 +481,7 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id,
S.AddSpace(5); S.AddSpace(5);
mProgress = safenew FreqGauge(this); //, wxID_ANY, wxST_SIZEGRIP); mProgress = safenew FreqGauge(this, wxID_ANY); //, wxST_SIZEGRIP);
S.AddWindow(mProgress, wxEXPAND); S.AddWindow(mProgress, wxEXPAND);
// Log-frequency axis works for spectrum plots only. // Log-frequency axis works for spectrum plots only.
@ -1111,8 +1109,8 @@ BEGIN_EVENT_TABLE(FreqPlot, wxWindow)
EVT_MOUSE_EVENTS(FreqPlot::OnMouseEvent) EVT_MOUSE_EVENTS(FreqPlot::OnMouseEvent)
END_EVENT_TABLE() END_EVENT_TABLE()
FreqPlot::FreqPlot(wxWindow *parent) FreqPlot::FreqPlot(wxWindow *parent, wxWindowID winid)
: wxWindow(parent, wxID_ANY) : wxWindow(parent, winid)
{ {
freqWindow = (FreqWindow *) parent; freqWindow = (FreqWindow *) parent;
} }
@ -1137,8 +1135,8 @@ void FreqPlot::OnMouseEvent(wxMouseEvent & event)
freqWindow->PlotMouseEvent(event); freqWindow->PlotMouseEvent(event);
} }
FreqGauge::FreqGauge(wxWindow * parent) FreqGauge::FreqGauge(wxWindow * parent, wxWindowID winid)
: wxStatusBar(parent, wxID_ANY, wxST_SIZEGRIP) : wxStatusBar(parent, winid, wxST_SIZEGRIP)
{ {
mRange = 0; mRange = 0;
} }

View File

@ -86,7 +86,7 @@ private:
class FreqGauge final : public wxStatusBar class FreqGauge final : public wxStatusBar
{ {
public: public:
FreqGauge(wxWindow * parent); FreqGauge(wxWindow * parent, wxWindowID winid);
void SetRange(int range, int bar = 12, int gap = 3); void SetRange(int range, int bar = 12, int gap = 3);
void SetValue(int value); void SetValue(int value);
@ -106,7 +106,7 @@ private:
class FreqPlot final : public wxWindow class FreqPlot final : public wxWindow
{ {
public: public:
FreqPlot(wxWindow *parent); FreqPlot(wxWindow *parent, wxWindowID winid);
// We don't need or want to accept focus. // We don't need or want to accept focus.
bool AcceptsFocus() const; bool AcceptsFocus() const;

View File

@ -62,13 +62,8 @@ MixerTrackSlider::MixerTrackSlider(wxWindow * parent,
const wxString &name, const wxString &name,
const wxPoint & pos, const wxPoint & pos,
const wxSize & size, const wxSize & size,
int style /*= FRAC_SLIDER*/, const ASlider::Options &options)
bool popup /*= true*/, : ASlider(parent, id, name, pos, size, options)
bool canUseShift /*= true*/,
float stepValue /*= STEP_CONTINUOUS*/,
int orientation /*= wxHORIZONTAL*/)
: ASlider(parent, id, name, pos, size,
style, popup, canUseShift, stepValue, orientation)
{ {
} }
@ -209,8 +204,10 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent,
this, ID_SLIDER_GAIN, this, ID_SLIDER_GAIN,
/* i18n-hint: title of the Gain slider, used to adjust the volume */ /* i18n-hint: title of the Gain slider, used to adjust the volume */
_("Gain"), _("Gain"),
ctrlPos, ctrlSize, DB_SLIDER, true, ctrlPos, ctrlSize,
true, 0.0, wxVERTICAL); ASlider::Options{}
.Style( DB_SLIDER )
.Orientation( wxVERTICAL ));
mSlider_Gain->SetName(_("Gain")); mSlider_Gain->SetName(_("Gain"));
this->UpdateGain(); this->UpdateGain();
#ifdef EXPERIMENTAL_MIDI_OUT #ifdef EXPERIMENTAL_MIDI_OUT
@ -219,8 +216,10 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent,
this, ID_SLIDER_VELOCITY, this, ID_SLIDER_VELOCITY,
/* i18n-hint: title of the MIDI Velocity slider */ /* i18n-hint: title of the MIDI Velocity slider */
_("Velocity"), _("Velocity"),
ctrlPos, ctrlSize, VEL_SLIDER, true, ctrlPos, ctrlSize,
true, 0.0, wxVERTICAL); ASlider::Options{}
.Style( VEL_SLIDER )
.Orientation( wxVERTICAL ));
mSlider_Velocity->SetName(_("Velocity")); mSlider_Velocity->SetName(_("Velocity"));
this->UpdateVelocity(); this->UpdateVelocity();
#endif #endif
@ -254,7 +253,8 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent,
this, ID_SLIDER_PAN, this, ID_SLIDER_PAN,
/* i18n-hint: Title of the Pan slider, used to move the sound left or right */ /* i18n-hint: Title of the Pan slider, used to move the sound left or right */
_("Pan"), _("Pan"),
ctrlPos, ctrlSize, PAN_SLIDER, true); ctrlPos, ctrlSize,
ASlider::Options{}.Style( PAN_SLIDER ));
mSlider_Pan->SetName(_("Pan")); mSlider_Pan->SetName(_("Pan"));
this->UpdatePan(); this->UpdatePan();

View File

@ -39,11 +39,7 @@ public:
const wxString &name, const wxString &name,
const wxPoint & pos, const wxPoint & pos,
const wxSize & size, const wxSize & size,
int style = FRAC_SLIDER, const ASlider::Options &options = ASlider::Options{});
bool popup = true,
bool canUseShift = true,
float stepValue = STEP_CONTINUOUS,
int orientation = wxHORIZONTAL);
virtual ~MixerTrackSlider() {} virtual ~MixerTrackSlider() {}
void OnMouseEvent(wxMouseEvent & event); void OnMouseEvent(wxMouseEvent & event);

View File

@ -56,17 +56,15 @@ void TimeDialog::PopulateOrExchange(ShuttleGui &S)
{ {
mTimeCtrl = safenew mTimeCtrl = safenew
NumericTextCtrl( NumericTextCtrl(
NumericConverter::TIME, this, this, wxID_ANY,
wxID_ANY, NumericConverter::TIME,
mFormat, mFormat,
mTime, mTime,
mRate, mRate,
wxDefaultPosition, NumericTextCtrl::Options{}
wxDefaultSize, .AutoPos(true));
true);
mTimeCtrl->SetName(mPrompt); mTimeCtrl->SetName(mPrompt);
S.AddWindow(mTimeCtrl); S.AddWindow(mTimeCtrl);
mTimeCtrl->EnableMenu();
} }
S.EndStatic(); S.EndStatic();
} }

View File

@ -793,6 +793,7 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
* displayed is minutes, and the 's' indicates that the third number displayed is seconds. * displayed is minutes, and the 's' indicates that the third number displayed is seconds.
*/ */
wxString strFormat = _("099 h 060 m 060 s"); wxString strFormat = _("099 h 060 m 060 s");
using Options = NumericTextCtrl::Options;
S.StartStatic(_("Start Date and Time"), true); S.StartStatic(_("Start Date and Time"), true);
{ {
m_pDatePickerCtrl_Start = m_pDatePickerCtrl_Start =
@ -808,13 +809,14 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
S.AddWindow(m_pDatePickerCtrl_Start); S.AddWindow(m_pDatePickerCtrl_Start);
m_pTimeTextCtrl_Start = safenew NumericTextCtrl( m_pTimeTextCtrl_Start = safenew NumericTextCtrl(
NumericConverter::TIME, this, ID_TIMETEXT_START); this, ID_TIMETEXT_START, NumericConverter::TIME,
wxEmptyString, 0, 44100,
Options{}
.MenuEnabled(false)
.Format(strFormat)
.Value(true, wxDateTime_to_AudacityTime(m_DateTime_Start)));
m_pTimeTextCtrl_Start->SetName(_("Start Time")); m_pTimeTextCtrl_Start->SetName(_("Start Time"));
m_pTimeTextCtrl_Start->SetFormatString(strFormat);
m_pTimeTextCtrl_Start->
SetValue(wxDateTime_to_AudacityTime(m_DateTime_Start));
S.AddWindow(m_pTimeTextCtrl_Start); S.AddWindow(m_pTimeTextCtrl_Start);
m_pTimeTextCtrl_Start->EnableMenu(false);
} }
S.EndStatic(); S.EndStatic();
@ -836,12 +838,14 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
S.AddWindow(m_pDatePickerCtrl_End); S.AddWindow(m_pDatePickerCtrl_End);
m_pTimeTextCtrl_End = safenew NumericTextCtrl( m_pTimeTextCtrl_End = safenew NumericTextCtrl(
NumericConverter::TIME, this, ID_TIMETEXT_END); this, ID_TIMETEXT_END, NumericConverter::TIME,
wxEmptyString, 0, 44100,
Options{}
.MenuEnabled(false)
.Format(strFormat)
.Value(true, wxDateTime_to_AudacityTime(m_DateTime_End)));
m_pTimeTextCtrl_End->SetName(_("End Time")); m_pTimeTextCtrl_End->SetName(_("End Time"));
m_pTimeTextCtrl_End->SetFormatString(strFormat);
m_pTimeTextCtrl_End->SetValue(wxDateTime_to_AudacityTime(m_DateTime_End));
S.AddWindow(m_pTimeTextCtrl_End); S.AddWindow(m_pTimeTextCtrl_End);
m_pTimeTextCtrl_End->EnableMenu(false);
} }
S.EndStatic(); S.EndStatic();
@ -856,12 +860,15 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
* seconds. * seconds.
*/ */
wxString strFormat1 = _("099 days 024 h 060 m 060 s"); wxString strFormat1 = _("099 days 024 h 060 m 060 s");
m_pTimeTextCtrl_Duration = safenew NumericTextCtrl(NumericConverter::TIME, this, ID_TIMETEXT_DURATION); m_pTimeTextCtrl_Duration = safenew NumericTextCtrl(
this, ID_TIMETEXT_DURATION, NumericConverter::TIME,
wxEmptyString, 0, 44100,
Options{}
.MenuEnabled(false)
.Format(strFormat1)
.Value(true, m_TimeSpan_Duration.GetSeconds().ToDouble()));
m_pTimeTextCtrl_Duration->SetName(_("Duration")); m_pTimeTextCtrl_Duration->SetName(_("Duration"));
m_pTimeTextCtrl_Duration->SetFormatString(strFormat1);
m_pTimeTextCtrl_Duration->SetValue(m_TimeSpan_Duration.GetSeconds().ToDouble());
S.AddWindow(m_pTimeTextCtrl_Duration); S.AddWindow(m_pTimeTextCtrl_Duration);
m_pTimeTextCtrl_Duration->EnableMenu(false);
} }
S.EndStatic(); S.EndStatic();
} }

View File

@ -428,7 +428,7 @@ void EffectAutoDuck::PopulateOrExchange(ShuttleGui & S)
{ {
S.AddSpace(0, 5); S.AddSpace(0, 5);
mPanel = safenew EffectAutoDuckPanel(S.GetParent(), this); mPanel = safenew EffectAutoDuckPanel(S.GetParent(), wxID_ANY, this);
S.AddWindow(mPanel); S.AddWindow(mPanel);
S.AddSpace(0, 5); S.AddSpace(0, 5);
@ -618,8 +618,9 @@ BEGIN_EVENT_TABLE(EffectAutoDuckPanel, wxPanelWrapper)
EVT_MOTION(EffectAutoDuckPanel::OnMotion) EVT_MOTION(EffectAutoDuckPanel::OnMotion)
END_EVENT_TABLE() END_EVENT_TABLE()
EffectAutoDuckPanel::EffectAutoDuckPanel(wxWindow *parent, EffectAutoDuck *effect) EffectAutoDuckPanel::EffectAutoDuckPanel(
: wxPanelWrapper(parent, wxID_ANY, wxDefaultPosition, wxSize(600, 300)) wxWindow *parent, wxWindowID winid, EffectAutoDuck *effect)
: wxPanelWrapper(parent, winid, wxDefaultPosition, wxSize(600, 300))
{ {
mParent = parent; mParent = parent;
mEffect = effect; mEffect = effect;

View File

@ -94,7 +94,8 @@ private:
class EffectAutoDuckPanel final : public wxPanelWrapper class EffectAutoDuckPanel final : public wxPanelWrapper
{ {
public: public:
EffectAutoDuckPanel(wxWindow *parent, EffectAutoDuck *effect); EffectAutoDuckPanel(
wxWindow *parent, wxWindowID winid, EffectAutoDuck *effect);
virtual ~EffectAutoDuckPanel(); virtual ~EffectAutoDuckPanel();
private: private:

View File

@ -369,31 +369,29 @@ void EffectChangeSpeed::PopulateOrExchange(ShuttleGui & S)
S.AddPrompt(_("Current Length:")); S.AddPrompt(_("Current Length:"));
mpFromLengthCtrl = safenew mpFromLengthCtrl = safenew
NumericTextCtrl(NumericConverter::TIME, NumericTextCtrl(S.GetParent(), wxID_ANY,
S.GetParent(), NumericConverter::TIME,
wxID_ANY,
mFormat, mFormat,
mFromLength, mFromLength,
mProjectRate); mProjectRate,
NumericTextCtrl::Options{}
.ReadOnly(true)
.MenuEnabled(false));
mpFromLengthCtrl->SetName(_("from")); mpFromLengthCtrl->SetName(_("from"));
mpFromLengthCtrl->SetToolTip(_("Current length of selection.")); mpFromLengthCtrl->SetToolTip(_("Current length of selection."));
mpFromLengthCtrl->SetReadOnly(true);
mpFromLengthCtrl->EnableMenu(false);
S.AddWindow(mpFromLengthCtrl, wxALIGN_LEFT); S.AddWindow(mpFromLengthCtrl, wxALIGN_LEFT);
S.AddPrompt(_("New Length:")); S.AddPrompt(_("New Length:"));
mpToLengthCtrl = safenew mpToLengthCtrl = safenew
NumericTextCtrl(NumericConverter::TIME, NumericTextCtrl(S.GetParent(), ID_ToLength,
S.GetParent(), NumericConverter::TIME,
ID_ToLength,
mFormat, mFormat,
mToLength, mToLength,
mProjectRate); mProjectRate);
mpToLengthCtrl->SetName(_("to")); mpToLengthCtrl->SetName(_("to"));
mpToLengthCtrl->EnableMenu();
S.AddWindow(mpToLengthCtrl, wxALIGN_LEFT); S.AddWindow(mpToLengthCtrl, wxALIGN_LEFT);
} }
S.EndMultiColumn(); S.EndMultiColumn();

View File

@ -196,7 +196,7 @@ void EffectCompressor::PopulateOrExchange(ShuttleGui & S)
S.StartHorizontalLay(wxEXPAND, true); S.StartHorizontalLay(wxEXPAND, true);
{ {
S.SetBorder(10); S.SetBorder(10);
mPanel = safenew EffectCompressorPanel(S.GetParent(), mPanel = safenew EffectCompressorPanel(S.GetParent(), wxID_ANY,
mThresholdDB, mThresholdDB,
mNoiseFloorDB, mNoiseFloorDB,
mRatio); mRatio);
@ -644,11 +644,11 @@ BEGIN_EVENT_TABLE(EffectCompressorPanel, wxPanelWrapper)
EVT_SIZE(EffectCompressorPanel::OnSize) EVT_SIZE(EffectCompressorPanel::OnSize)
END_EVENT_TABLE() END_EVENT_TABLE()
EffectCompressorPanel::EffectCompressorPanel(wxWindow *parent, EffectCompressorPanel::EffectCompressorPanel(wxWindow *parent, wxWindowID winid,
double & threshold, double & threshold,
double & noiseFloor, double & noiseFloor,
double & ratio) double & ratio)
: wxPanelWrapper(parent), : wxPanelWrapper(parent, winid),
threshold(threshold), threshold(threshold),
noiseFloor(noiseFloor), noiseFloor(noiseFloor),
ratio(ratio) ratio(ratio)

View File

@ -138,7 +138,7 @@ private:
class EffectCompressorPanel final : public wxPanelWrapper class EffectCompressorPanel final : public wxPanelWrapper
{ {
public: public:
EffectCompressorPanel(wxWindow *parent, EffectCompressorPanel(wxWindow *parent, wxWindowID winid,
double & threshold, double & threshold,
double & noiseFloor, double & noiseFloor,
double & ratio); double & ratio);

View File

@ -200,39 +200,36 @@ ContrastDialog::ContrastDialog(wxWindow * parent, wxWindowID id,
S.AddFixedText( {} ); // spacer S.AddFixedText( {} ); // spacer
S.AddFixedText(_("Volume ")); S.AddFixedText(_("Volume "));
const auto options = NumericTextCtrl::Options{}
.AutoPos(true)
.MenuEnabled(false)
.ReadOnly(true);
//Foreground //Foreground
S.AddFixedText(_("&Foreground:"), false); S.AddFixedText(_("&Foreground:"), false);
if (S.GetMode() == eIsCreating) if (S.GetMode() == eIsCreating)
{ {
mForegroundStartT = safenew mForegroundStartT = safenew
NumericTextCtrl(NumericConverter::TIME, this, NumericTextCtrl(this, ID_FOREGROUNDSTART_T,
ID_FOREGROUNDSTART_T, NumericConverter::TIME,
_("hh:mm:ss + hundredths"), _("hh:mm:ss + hundredths"),
0.0, 0.0,
mProjectRate, mProjectRate,
wxDefaultPosition, options);
wxDefaultSize,
true);
mForegroundStartT->SetName(_("Foreground start time")); mForegroundStartT->SetName(_("Foreground start time"));
mForegroundStartT->EnableMenu(false);
mForegroundStartT->SetReadOnly(true);
} }
S.AddWindow(mForegroundStartT); S.AddWindow(mForegroundStartT);
if (S.GetMode() == eIsCreating) if (S.GetMode() == eIsCreating)
{ {
mForegroundEndT = safenew mForegroundEndT = safenew
NumericTextCtrl(NumericConverter::TIME, this, NumericTextCtrl(this, ID_FOREGROUNDEND_T,
ID_FOREGROUNDEND_T, NumericConverter::TIME,
_("hh:mm:ss + hundredths"), _("hh:mm:ss + hundredths"),
0.0, 0.0,
mProjectRate, mProjectRate,
wxDefaultPosition, options);
wxDefaultSize,
true);
mForegroundEndT->SetName(_("Foreground end time")); mForegroundEndT->SetName(_("Foreground end time"));
mForegroundEndT->EnableMenu(false);
mForegroundEndT->SetReadOnly(true);
} }
S.AddWindow(mForegroundEndT); S.AddWindow(mForegroundEndT);
@ -245,34 +242,26 @@ ContrastDialog::ContrastDialog(wxWindow * parent, wxWindowID id,
if (S.GetMode() == eIsCreating) if (S.GetMode() == eIsCreating)
{ {
mBackgroundStartT = safenew mBackgroundStartT = safenew
NumericTextCtrl(NumericConverter::TIME, this, NumericTextCtrl(this, ID_BACKGROUNDSTART_T,
ID_BACKGROUNDSTART_T, NumericConverter::TIME,
_("hh:mm:ss + hundredths"), _("hh:mm:ss + hundredths"),
0.0, 0.0,
mProjectRate, mProjectRate,
wxDefaultPosition, options);
wxDefaultSize,
true);
mBackgroundStartT->SetName(_("Background start time")); mBackgroundStartT->SetName(_("Background start time"));
mBackgroundStartT->EnableMenu(false);
mBackgroundStartT->SetReadOnly(true);
} }
S.AddWindow(mBackgroundStartT); S.AddWindow(mBackgroundStartT);
if (S.GetMode() == eIsCreating) if (S.GetMode() == eIsCreating)
{ {
mBackgroundEndT = safenew mBackgroundEndT = safenew
NumericTextCtrl(NumericConverter::TIME, this, NumericTextCtrl(this, ID_BACKGROUNDEND_T,
ID_BACKGROUNDEND_T, NumericConverter::TIME,
_("hh:mm:ss + hundredths"), _("hh:mm:ss + hundredths"),
0.0, 0.0,
mProjectRate, mProjectRate,
wxDefaultPosition, options);
wxDefaultSize,
true);
mBackgroundEndT->SetName(_("Background end time")); mBackgroundEndT->SetName(_("Background end time"));
mBackgroundEndT->EnableMenu(false);
mBackgroundEndT->SetReadOnly(true);
} }
S.AddWindow(mBackgroundEndT); S.AddWindow(mBackgroundEndT);

View File

@ -326,17 +326,14 @@ void EffectDtmf::PopulateOrExchange(ShuttleGui & S)
S.AddPrompt(_("Duration:")); S.AddPrompt(_("Duration:"));
mDtmfDurationT = safenew mDtmfDurationT = safenew
NumericTextCtrl(NumericConverter::TIME, NumericTextCtrl(S.GetParent(), ID_Duration,
S.GetParent(), NumericConverter::TIME,
ID_Duration,
GetDurationFormat(), GetDurationFormat(),
GetDuration(), GetDuration(),
mProjectRate, mProjectRate,
wxDefaultPosition, NumericTextCtrl::Options{}
wxDefaultSize, .AutoPos(true));
true);
mDtmfDurationT->SetName(_("Duration")); mDtmfDurationT->SetName(_("Duration"));
mDtmfDurationT->EnableMenu();
S.AddWindow(mDtmfDurationT); S.AddWindow(mDtmfDurationT);
S.AddFixedText(_("Tone/silence ratio:"), false); S.AddFixedText(_("Tone/silence ratio:"), false);

View File

@ -623,18 +623,17 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S)
// ------------------------------------------------------------------- // -------------------------------------------------------------------
S.StartVerticalLay(); S.StartVerticalLay();
{ {
mdBRuler = safenew RulerPanel(parent, wxID_ANY); mdBRuler = safenew RulerPanel(
mdBRuler->ruler.SetBounds(0, 0, 100, 100); // Ruler can't handle small sizes parent, wxID_ANY, wxVERTICAL,
mdBRuler->ruler.SetOrientation(wxVERTICAL); wxSize{ 100, 100 }, // Ruler can't handle small sizes
mdBRuler->ruler.SetRange(60.0, -120.0); RulerPanel::Range{ 60.0, -120.0 },
mdBRuler->ruler.SetFormat(Ruler::LinearDBFormat); Ruler::LinearDBFormat,
mdBRuler->ruler.SetUnits(_("dB")); _("dB"),
mdBRuler->ruler.SetLabelEdges(true); RulerPanel::Options{}
mdBRuler->ruler.mbTicksAtExtremes = true; .LabelEdges(true)
int w; .TicksAtExtremes(true)
mdBRuler->ruler.GetMaxSize(&w, NULL); .TickColour( { 0, 0, 0 } )
mdBRuler->SetMinSize(wxSize(w, 150)); // height needed for wxGTK );
mdBRuler->ruler.SetTickColour( wxColour(0,0,0) );
S.Prop(1); S.Prop(1);
S.AddSpace(0, 1); S.AddSpace(0, 1);
@ -643,7 +642,7 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S)
} }
S.EndVerticalLay(); S.EndVerticalLay();
mPanel = safenew EqualizationPanel(this, parent); mPanel = safenew EqualizationPanel(parent, wxID_ANY, this);
S.Prop(1); S.Prop(1);
S.AddWindow(mPanel, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP); S.AddWindow(mPanel, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP);
S.SetSizeHints(wxDefaultCoord, wxDefaultCoord); S.SetSizeHints(wxDefaultCoord, wxDefaultCoord);
@ -677,20 +676,19 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S)
// Column 1 is empty // Column 1 is empty
S.AddSpace(1, 1); S.AddSpace(1, 1);
mFreqRuler = safenew RulerPanel(parent, wxID_ANY); mFreqRuler = safenew RulerPanel(
mFreqRuler->ruler.SetBounds(0, 0, 100, 100); // Ruler can't handle small sizes parent, wxID_ANY, wxHORIZONTAL,
mFreqRuler->ruler.SetOrientation(wxHORIZONTAL); wxSize{ 100, 100 }, // Ruler can't handle small sizes
mFreqRuler->ruler.SetLog(true); RulerPanel::Range{ mLoFreq, mHiFreq },
mFreqRuler->ruler.SetRange(mLoFreq, mHiFreq); Ruler::IntFormat,
mFreqRuler->ruler.SetFormat(Ruler::IntFormat); _("Hz"),
mFreqRuler->ruler.SetUnits(_("Hz")); RulerPanel::Options{}
mFreqRuler->ruler.SetFlip(true); .Log(true)
mFreqRuler->ruler.SetLabelEdges(true); .Flip(true)
mFreqRuler->ruler.mbTicksAtExtremes = true; .LabelEdges(true)
int h; .TicksAtExtremes(true)
mFreqRuler->ruler.GetMaxSize(NULL, &h); .TickColour( { 0, 0, 0 } )
mFreqRuler->SetMinSize(wxSize(wxDefaultCoord, h)); );
mFreqRuler->ruler.SetTickColour( wxColour(0,0,0) );
S.Prop(1); S.Prop(1);
@ -2846,8 +2844,9 @@ BEGIN_EVENT_TABLE(EqualizationPanel, wxPanelWrapper)
EVT_SIZE(EqualizationPanel::OnSize) EVT_SIZE(EqualizationPanel::OnSize)
END_EVENT_TABLE() END_EVENT_TABLE()
EqualizationPanel::EqualizationPanel(EffectEqualization *effect, wxWindow *parent) EqualizationPanel::EqualizationPanel(
: wxPanelWrapper(parent) wxWindow *parent, wxWindowID winid, EffectEqualization *effect)
: wxPanelWrapper(parent, winid)
{ {
mParent = parent; mParent = parent;
mEffect = effect; mEffect = effect;

View File

@ -287,7 +287,8 @@ private:
class EqualizationPanel final : public wxPanelWrapper class EqualizationPanel final : public wxPanelWrapper
{ {
public: public:
EqualizationPanel(EffectEqualization *effect, wxWindow *parent); EqualizationPanel(
wxWindow *parent, wxWindowID winid, EffectEqualization *effect);
~EqualizationPanel(); ~EqualizationPanel();
// We don't need or want to accept focus. // We don't need or want to accept focus.

View File

@ -231,17 +231,14 @@ void EffectNoise::PopulateOrExchange(ShuttleGui & S)
S.AddPrompt(_("Duration:")); S.AddPrompt(_("Duration:"));
mNoiseDurationT = safenew mNoiseDurationT = safenew
NumericTextCtrl(NumericConverter::TIME, NumericTextCtrl(S.GetParent(), wxID_ANY,
S.GetParent(), NumericConverter::TIME,
wxID_ANY,
GetDurationFormat(), GetDurationFormat(),
GetDuration(), GetDuration(),
mProjectRate, mProjectRate,
wxDefaultPosition, NumericTextCtrl::Options{}
wxDefaultSize, .AutoPos(true));
true);
mNoiseDurationT->SetName(_("Duration")); mNoiseDurationT->SetName(_("Duration"));
mNoiseDurationT->EnableMenu();
S.AddWindow(mNoiseDurationT, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL); S.AddWindow(mNoiseDurationT, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL);
} }
S.EndMultiColumn(); S.EndMultiColumn();

View File

@ -377,16 +377,15 @@ void EffectScienFilter::PopulateOrExchange(ShuttleGui & S)
S.StartVerticalLay(); S.StartVerticalLay();
{ {
mdBRuler = safenew RulerPanel(parent, wxID_ANY); mdBRuler = safenew RulerPanel(
mdBRuler->ruler.SetBounds(0, 0, 100, 100); // Ruler can't handle small sizes parent, wxID_ANY, wxVERTICAL,
mdBRuler->ruler.SetOrientation(wxVERTICAL); wxSize{ 100, 100 }, // Ruler can't handle small sizes
mdBRuler->ruler.SetRange(30.0, -120.0); RulerPanel::Range{ 30.0, -120.0 },
mdBRuler->ruler.SetFormat(Ruler::LinearDBFormat); Ruler::LinearDBFormat,
mdBRuler->ruler.SetUnits(_("dB")); _("dB"),
mdBRuler->ruler.SetLabelEdges(true); RulerPanel::Options{}
int w; .LabelEdges(true)
mdBRuler->ruler.GetMaxSize(&w, NULL); );
mdBRuler->SetSize(wxSize(w, 150)); // height needed for wxGTK
S.SetBorder(1); S.SetBorder(1);
S.AddSpace(1, 1); S.AddSpace(1, 1);
@ -396,8 +395,10 @@ void EffectScienFilter::PopulateOrExchange(ShuttleGui & S)
} }
S.EndVerticalLay(); S.EndVerticalLay();
mPanel = safenew EffectScienFilterPanel(this, parent); mPanel = safenew EffectScienFilterPanel(
mPanel->SetFreqRange(mLoFreq, mNyquist); parent, wxID_ANY,
this, mLoFreq, mNyquist
);
S.SetBorder(5); S.SetBorder(5);
S.Prop(1); S.Prop(1);
@ -430,18 +431,17 @@ void EffectScienFilter::PopulateOrExchange(ShuttleGui & S)
S.AddSpace(1, 1); S.AddSpace(1, 1);
mfreqRuler = safenew RulerPanel(parent, wxID_ANY); mfreqRuler = safenew RulerPanel(
mfreqRuler->ruler.SetBounds(0, 0, 100, 100); // Ruler can't handle small sizes parent, wxID_ANY, wxHORIZONTAL,
mfreqRuler->ruler.SetOrientation(wxHORIZONTAL); wxSize{ 100, 100 }, // Ruler can't handle small sizes
mfreqRuler->ruler.SetLog(true); RulerPanel::Range{ mLoFreq, mNyquist },
mfreqRuler->ruler.SetRange(mLoFreq, mNyquist); Ruler::IntFormat,
mfreqRuler->ruler.SetFormat(Ruler::IntFormat); wxT(""),
mfreqRuler->ruler.SetUnits(wxT("")); RulerPanel::Options{}
mfreqRuler->ruler.SetFlip(true); .Log(true)
mfreqRuler->ruler.SetLabelEdges(true); .Flip(true)
int h; .LabelEdges(true)
mfreqRuler->ruler.GetMaxSize(NULL, &h); );
mfreqRuler->SetMinSize(wxSize(-1, h));
S.Prop(1); S.Prop(1);
S.AddWindow(mfreqRuler, wxEXPAND | wxALIGN_LEFT | wxRIGHT); S.AddWindow(mfreqRuler, wxEXPAND | wxALIGN_LEFT | wxRIGHT);
@ -1012,8 +1012,10 @@ BEGIN_EVENT_TABLE(EffectScienFilterPanel, wxPanelWrapper)
EVT_SIZE(EffectScienFilterPanel::OnSize) EVT_SIZE(EffectScienFilterPanel::OnSize)
END_EVENT_TABLE() END_EVENT_TABLE()
EffectScienFilterPanel::EffectScienFilterPanel(EffectScienFilter *effect, wxWindow *parent) EffectScienFilterPanel::EffectScienFilterPanel(
: wxPanelWrapper(parent, wxID_ANY, wxDefaultPosition, wxSize(400, 200)) wxWindow *parent, wxWindowID winid,
EffectScienFilter *effect, double lo, double hi)
: wxPanelWrapper(parent, winid, wxDefaultPosition, wxSize(400, 200))
{ {
mEffect = effect; mEffect = effect;
mParent = parent; mParent = parent;
@ -1025,6 +1027,8 @@ EffectScienFilterPanel::EffectScienFilterPanel(EffectScienFilter *effect, wxWind
mHiFreq = 0.0; mHiFreq = 0.0;
mDbMin = 0.0; mDbMin = 0.0;
mDbMax = 0.0; mDbMax = 0.0;
SetFreqRange(lo, hi);
} }
EffectScienFilterPanel::~EffectScienFilterPanel() EffectScienFilterPanel::~EffectScienFilterPanel()

View File

@ -139,7 +139,9 @@ private:
class EffectScienFilterPanel final : public wxPanelWrapper class EffectScienFilterPanel final : public wxPanelWrapper
{ {
public: public:
EffectScienFilterPanel(EffectScienFilter *effect, wxWindow *parent); EffectScienFilterPanel(
wxWindow *parent, wxWindowID winid,
EffectScienFilter *effect, double lo, double hi);
virtual ~EffectScienFilterPanel(); virtual ~EffectScienFilterPanel();
// We don't need or want to accept focus. // We don't need or want to accept focus.

View File

@ -65,17 +65,14 @@ void EffectSilence::PopulateOrExchange(ShuttleGui & S)
{ {
S.AddPrompt(_("Duration:")); S.AddPrompt(_("Duration:"));
mDurationT = safenew mDurationT = safenew
NumericTextCtrl(NumericConverter::TIME, NumericTextCtrl(S.GetParent(), wxID_ANY,
S.GetParent(), NumericConverter::TIME,
wxID_ANY,
GetDurationFormat(), GetDurationFormat(),
GetDuration(), GetDuration(),
mProjectRate, mProjectRate,
wxDefaultPosition, NumericTextCtrl::Options{}
wxDefaultSize, .AutoPos(true));
true);
mDurationT->SetName(_("Duration")); mDurationT->SetName(_("Duration"));
mDurationT->EnableMenu();
S.AddWindow(mDurationT, wxALIGN_CENTER | wxALL); S.AddWindow(mDurationT, wxALIGN_CENTER | wxALL);
} }
S.EndHorizontalLay(); S.EndHorizontalLay();

View File

@ -406,17 +406,14 @@ void EffectToneGen::PopulateOrExchange(ShuttleGui & S)
S.AddPrompt(_("Duration:")); S.AddPrompt(_("Duration:"));
mToneDurationT = safenew mToneDurationT = safenew
NumericTextCtrl(NumericConverter::TIME, NumericTextCtrl(S.GetParent(), wxID_ANY,
S.GetParent(), NumericConverter::TIME,
wxID_ANY,
GetDurationFormat(), GetDurationFormat(),
GetDuration(), GetDuration(),
mProjectRate, mProjectRate,
wxDefaultPosition, NumericTextCtrl::Options{}
wxDefaultSize, .AutoPos(true));
true);
mToneDurationT->SetName(_("Duration")); mToneDurationT->SetName(_("Duration"));
mToneDurationT->EnableMenu();
S.AddWindow(mToneDurationT, wxALIGN_LEFT | wxALL); S.AddWindow(mToneDurationT, wxALIGN_LEFT | wxALL);
} }
S.EndMultiColumn(); S.EndMultiColumn();

View File

@ -2836,17 +2836,14 @@ void VSTEffect::BuildPlain()
wxControl *item = safenew wxStaticText(scroller, 0, _("Duration:")); wxControl *item = safenew wxStaticText(scroller, 0, _("Duration:"));
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5); gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
mDuration = safenew mDuration = safenew
NumericTextCtrl(NumericConverter::TIME, NumericTextCtrl(scroller, ID_Duration,
scroller, NumericConverter::TIME,
ID_Duration, mHost->GetDurationFormat(),
mHost->GetDurationFormat(), mHost->GetDuration(),
mHost->GetDuration(), mSampleRate,
mSampleRate, NumericTextCtrl::Options{}
wxDefaultPosition, .AutoPos(true));
wxDefaultSize,
true);
mDuration->SetName(_("Duration")); mDuration->SetName(_("Duration"));
mDuration->EnableMenu();
gridSizer->Add(mDuration, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); gridSizer->Add(mDuration, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
gridSizer->Add(1, 1, 0); gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0); gridSizer->Add(1, 1, 0);

View File

@ -1210,17 +1210,14 @@ bool LadspaEffect::PopulateUI(wxWindow *parent)
item = safenew wxStaticText(w, 0, _("Duration:")); item = safenew wxStaticText(w, 0, _("Duration:"));
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5); gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
mDuration = safenew mDuration = safenew
NumericTextCtrl(NumericConverter::TIME, NumericTextCtrl(w, ID_Duration,
w, NumericConverter::TIME,
ID_Duration, mHost->GetDurationFormat(),
mHost->GetDurationFormat(), mHost->GetDuration(),
mHost->GetDuration(), mSampleRate,
mSampleRate, NumericTextCtrl::Options{}
wxDefaultPosition, .AutoPos(true));
wxDefaultSize,
true);
mDuration->SetName(_("Duration")); mDuration->SetName(_("Duration"));
mDuration->EnableMenu();
gridSizer->Add(mDuration, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); gridSizer->Add(mDuration, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
gridSizer->Add(1, 1, 0); gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0); gridSizer->Add(1, 1, 0);

View File

@ -1566,17 +1566,14 @@ bool LV2Effect::BuildPlain()
wxWindow *item = safenew wxStaticText(w, 0, _("&Duration:")); wxWindow *item = safenew wxStaticText(w, 0, _("&Duration:"));
sizer->Add(item, 0, wxALIGN_CENTER | wxALL, 5); sizer->Add(item, 0, wxALIGN_CENTER | wxALL, 5);
mDuration = safenew mDuration = safenew
NumericTextCtrl(NumericConverter::TIME, NumericTextCtrl(w, ID_Duration,
w, NumericConverter::TIME,
ID_Duration, mHost->GetDurationFormat(),
mHost->GetDurationFormat(), mHost->GetDuration(),
mHost->GetDuration(), mSampleRate,
mSampleRate, NumericTextCtrl::Options{}
wxDefaultPosition, .AutoPos(true));
wxDefaultSize,
true);
mDuration->SetName(_("Duration")); mDuration->SetName(_("Duration"));
mDuration->EnableMenu();
sizer->Add(mDuration, 0, wxALIGN_CENTER | wxALL, 5); sizer->Add(mDuration, 0, wxALIGN_CENTER | wxALL, 5);
groupSizer->Add(sizer.release(), 0, wxALIGN_CENTER | wxALL, 5); groupSizer->Add(sizer.release(), 0, wxALIGN_CENTER | wxALL, 5);

View File

@ -1019,8 +1019,9 @@ BEGIN_EVENT_TABLE(ExportMixerPanel, wxPanelWrapper)
EVT_MOUSE_EVENTS(ExportMixerPanel::OnMouseEvent) EVT_MOUSE_EVENTS(ExportMixerPanel::OnMouseEvent)
END_EVENT_TABLE() END_EVENT_TABLE()
ExportMixerPanel::ExportMixerPanel( MixerSpec *mixerSpec, ExportMixerPanel::ExportMixerPanel( wxWindow *parent, wxWindowID id,
wxArrayString trackNames,wxWindow *parent, wxWindowID id, MixerSpec *mixerSpec,
wxArrayString trackNames,
const wxPoint& pos, const wxSize& size): const wxPoint& pos, const wxSize& size):
wxPanelWrapper(parent, id, pos, size) wxPanelWrapper(parent, id, pos, size)
, mMixerSpec{mixerSpec} , mMixerSpec{mixerSpec}
@ -1311,8 +1312,9 @@ ExportMixerDialog::ExportMixerDialog( const TrackList *tracks, bool selectedOnly
auto uVertSizer = std::make_unique<wxBoxSizer>(wxVERTICAL); auto uVertSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
vertSizer = uVertSizer.get(); vertSizer = uVertSizer.get();
wxWindow *mixerPanel = safenew ExportMixerPanel(mMixerSpec.get(), mTrackNames, this, wxWindow *mixerPanel = safenew ExportMixerPanel(this, ID_MIXERPANEL,
ID_MIXERPANEL, wxDefaultPosition, wxSize(400, -1)); mMixerSpec.get(), mTrackNames,
wxDefaultPosition, wxSize(400, -1));
mixerPanel->SetName(_("Mixer Panel")); mixerPanel->SetName(_("Mixer Panel"));
vertSizer->Add(mixerPanel, 1, wxEXPAND | wxALIGN_CENTRE | wxALL, 5); vertSizer->Add(mixerPanel, 1, wxEXPAND | wxALIGN_CENTRE | wxALL, 5);

View File

@ -233,8 +233,9 @@ private:
class ExportMixerPanel final : public wxPanelWrapper class ExportMixerPanel final : public wxPanelWrapper
{ {
public: public:
ExportMixerPanel( MixerSpec *mixerSpec, wxArrayString trackNames, ExportMixerPanel( wxWindow *parent, wxWindowID id,
wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, MixerSpec *mixerSpec, wxArrayString trackNames,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize); const wxSize& size = wxDefaultSize);
virtual ~ExportMixerPanel(); virtual ~ExportMixerPanel();

View File

@ -32,8 +32,8 @@ BEGIN_EVENT_TABLE(BatchPrefs, PrefsPanel)
END_EVENT_TABLE() END_EVENT_TABLE()
/// Constructor /// Constructor
BatchPrefs::BatchPrefs(wxWindow * parent): BatchPrefs::BatchPrefs(wxWindow * parent, wxWindowID winid):
PrefsPanel(parent, _("Batch")) PrefsPanel(parent, winid, _("Batch"))
{ {
Populate(); Populate();
} }
@ -83,8 +83,8 @@ BatchPrefs::~BatchPrefs()
{ {
} }
PrefsPanel *BatchPrefsFactory::Create(wxWindow *parent) PrefsPanel *BatchPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew BatchPrefs(parent); return safenew BatchPrefs(parent, winid);
} }

View File

@ -23,7 +23,7 @@ class ShuttleGui;
class BatchPrefs final : public PrefsPanel class BatchPrefs final : public PrefsPanel
{ {
public: public:
BatchPrefs(wxWindow * parent); BatchPrefs(wxWindow * parent, wxWindowID winid);
~BatchPrefs(); ~BatchPrefs();
bool Commit() override; bool Commit() override;
@ -37,6 +37,6 @@ private:
class BatchPrefsFactory final : public PrefsPanelFactory class BatchPrefsFactory final : public PrefsPanelFactory
{ {
public: public:
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
}; };
#endif #endif

View File

@ -52,8 +52,8 @@ BEGIN_EVENT_TABLE(DevicePrefs, PrefsPanel)
EVT_CHOICE(RecordID, DevicePrefs::OnDevice) EVT_CHOICE(RecordID, DevicePrefs::OnDevice)
END_EVENT_TABLE() END_EVENT_TABLE()
DevicePrefs::DevicePrefs(wxWindow * parent) DevicePrefs::DevicePrefs(wxWindow * parent, wxWindowID winid)
: PrefsPanel(parent, _("Devices")) : PrefsPanel(parent, winid, _("Devices"))
{ {
Populate(); Populate();
} }
@ -414,8 +414,8 @@ wxString DevicePrefs::HelpPageName()
return "Devices_Preferences"; return "Devices_Preferences";
} }
PrefsPanel *DevicePrefsFactory::Create(wxWindow *parent) PrefsPanel *DevicePrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew DevicePrefs(parent); return safenew DevicePrefs(parent, winid);
} }

View File

@ -26,7 +26,7 @@ class ShuttleGui;
class DevicePrefs final : public PrefsPanel class DevicePrefs final : public PrefsPanel
{ {
public: public:
DevicePrefs(wxWindow * parent); DevicePrefs(wxWindow * parent, wxWindowID winid);
virtual ~DevicePrefs(); virtual ~DevicePrefs();
bool Commit() override; bool Commit() override;
wxString HelpPageName() override; wxString HelpPageName() override;
@ -58,7 +58,7 @@ class DevicePrefs final : public PrefsPanel
class DevicePrefsFactory final : public PrefsPanelFactory class DevicePrefsFactory final : public PrefsPanelFactory
{ {
public: public:
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
}; };
#endif #endif

View File

@ -48,9 +48,9 @@ BEGIN_EVENT_TABLE(DirectoriesPrefs, PrefsPanel)
EVT_BUTTON(ChooseButtonID, DirectoriesPrefs::OnChooseTempDir) EVT_BUTTON(ChooseButtonID, DirectoriesPrefs::OnChooseTempDir)
END_EVENT_TABLE() END_EVENT_TABLE()
DirectoriesPrefs::DirectoriesPrefs(wxWindow * parent) DirectoriesPrefs::DirectoriesPrefs(wxWindow * parent, wxWindowID winid)
/* i18n-hint: Directories, also called folders, in computer file systems */ /* i18n-hint: Directories, also called folders, in computer file systems */
: PrefsPanel(parent, _("Directories")), : PrefsPanel(parent, winid, _("Directories")),
mFreeSpace(NULL), mFreeSpace(NULL),
mTempDir(NULL) mTempDir(NULL)
{ {
@ -273,8 +273,8 @@ wxString DirectoriesPrefs::HelpPageName()
return "Directories_Preferences"; return "Directories_Preferences";
} }
PrefsPanel *DirectoriesPrefsFactory::Create(wxWindow *parent) PrefsPanel *DirectoriesPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew DirectoriesPrefs(parent); return safenew DirectoriesPrefs(parent, winid);
} }

View File

@ -21,7 +21,7 @@ class ShuttleGui;
class DirectoriesPrefs final : public PrefsPanel class DirectoriesPrefs final : public PrefsPanel
{ {
public: public:
DirectoriesPrefs(wxWindow * parent); DirectoriesPrefs(wxWindow * parent, wxWindowID winid);
~DirectoriesPrefs(); ~DirectoriesPrefs();
bool Commit() override; bool Commit() override;
bool Validate() override; bool Validate() override;
@ -42,6 +42,6 @@ class DirectoriesPrefs final : public PrefsPanel
class DirectoriesPrefsFactory final : public PrefsPanelFactory class DirectoriesPrefsFactory final : public PrefsPanelFactory
{ {
public: public:
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
}; };
#endif #endif

View File

@ -32,8 +32,8 @@
#include "../Experimental.h" #include "../Experimental.h"
#include "../Internat.h" #include "../Internat.h"
EffectsPrefs::EffectsPrefs(wxWindow * parent) EffectsPrefs::EffectsPrefs(wxWindow * parent, wxWindowID winid)
: PrefsPanel(parent, _("Effects")) : PrefsPanel(parent, winid, _("Effects"))
{ {
Populate(); Populate();
} }
@ -176,8 +176,8 @@ wxString EffectsPrefs::HelpPageName()
return "Effects_Preferences"; return "Effects_Preferences";
} }
PrefsPanel *EffectsPrefsFactory::Create(wxWindow *parent) PrefsPanel *EffectsPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew EffectsPrefs(parent); return safenew EffectsPrefs(parent, winid);
} }

View File

@ -25,7 +25,7 @@ class ShuttleGui;
class EffectsPrefs final : public PrefsPanel class EffectsPrefs final : public PrefsPanel
{ {
public: public:
EffectsPrefs(wxWindow * parent); EffectsPrefs(wxWindow * parent, wxWindowID winid);
~EffectsPrefs(); ~EffectsPrefs();
bool Commit() override; bool Commit() override;
wxString HelpPageName() override; wxString HelpPageName() override;
@ -38,6 +38,6 @@ class EffectsPrefs final : public PrefsPanel
class EffectsPrefsFactory final : public PrefsPanelFactory class EffectsPrefsFactory final : public PrefsPanelFactory
{ {
public: public:
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
}; };
#endif #endif

View File

@ -56,10 +56,10 @@ BEGIN_EVENT_TABLE(ExtImportPrefs, PrefsPanel)
EVT_BUTTON(EIPMoveFilterDown,ExtImportPrefs::OnFilterMoveDown) EVT_BUTTON(EIPMoveFilterDown,ExtImportPrefs::OnFilterMoveDown)
END_EVENT_TABLE() END_EVENT_TABLE()
ExtImportPrefs::ExtImportPrefs(wxWindow * parent) ExtImportPrefs::ExtImportPrefs(wxWindow * parent, wxWindowID winid)
/* i18n-hint: Title of dialog governing "Extended", or "advanced," /* i18n-hint: Title of dialog governing "Extended", or "advanced,"
* audio file import options */ * audio file import options */
: PrefsPanel(parent, _("Extended Import")), RuleTable(NULL), : PrefsPanel(parent, winid, _("Extended Import")), RuleTable(NULL),
PluginList(NULL), mCreateTable (false), mDragFocus (NULL), PluginList(NULL), mCreateTable (false), mDragFocus (NULL),
mFakeKeyEvent (false), mStopRecursiveSelection (false), last_selected (-1) mFakeKeyEvent (false), mStopRecursiveSelection (false), last_selected (-1)
{ {
@ -811,8 +811,8 @@ void ExtImportPrefsDropTarget::OnLeave()
{ {
} }
PrefsPanel *ExtImportPrefsFactory::Create(wxWindow *parent) PrefsPanel *ExtImportPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew ExtImportPrefs(parent); return safenew ExtImportPrefs(parent, winid);
} }

View File

@ -46,7 +46,7 @@ private:
class ExtImportPrefs final : public PrefsPanel class ExtImportPrefs final : public PrefsPanel
{ {
public: public:
ExtImportPrefs(wxWindow * parent); ExtImportPrefs(wxWindow * parent, wxWindowID winid);
~ExtImportPrefs(); ~ExtImportPrefs();
bool Commit() override; bool Commit() override;
wxString HelpPageName() override; wxString HelpPageName() override;
@ -111,6 +111,6 @@ class ExtImportPrefs final : public PrefsPanel
class ExtImportPrefsFactory final : public PrefsPanelFactory class ExtImportPrefsFactory final : public PrefsPanelFactory
{ {
public: public:
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
}; };
#endif #endif

View File

@ -36,9 +36,9 @@
#include "../AColor.h" #include "../AColor.h"
#include "../Internat.h" #include "../Internat.h"
GUIPrefs::GUIPrefs(wxWindow * parent) GUIPrefs::GUIPrefs(wxWindow * parent, wxWindowID winid)
/* i18n-hint: refers to Audacity's user interface settings */ /* i18n-hint: refers to Audacity's user interface settings */
: PrefsPanel(parent, _("Interface")) : PrefsPanel(parent, winid, _("Interface"))
{ {
Populate(); Populate();
} }
@ -233,8 +233,8 @@ wxString GUIPrefs::HelpPageName()
return "Interface_Preferences"; return "Interface_Preferences";
} }
PrefsPanel *GUIPrefsFactory::Create(wxWindow *parent) PrefsPanel *GUIPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew GUIPrefs(parent); return safenew GUIPrefs(parent, winid);
} }

View File

@ -25,7 +25,7 @@ class ShuttleGui;
class GUIPrefs final : public PrefsPanel class GUIPrefs final : public PrefsPanel
{ {
public: public:
GUIPrefs(wxWindow * parent); GUIPrefs(wxWindow * parent, wxWindowID winid);
~GUIPrefs(); ~GUIPrefs();
bool Commit() override; bool Commit() override;
wxString HelpPageName() override; wxString HelpPageName() override;
@ -52,6 +52,6 @@ class GUIPrefs final : public PrefsPanel
class GUIPrefsFactory final : public PrefsPanelFactory class GUIPrefsFactory final : public PrefsPanelFactory
{ {
public: public:
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
}; };
#endif #endif

View File

@ -25,8 +25,8 @@
#include "ImportExportPrefs.h" #include "ImportExportPrefs.h"
#include "../Internat.h" #include "../Internat.h"
ImportExportPrefs::ImportExportPrefs(wxWindow * parent) ImportExportPrefs::ImportExportPrefs(wxWindow * parent, wxWindowID winid)
: PrefsPanel(parent, _("Import / Export")) : PrefsPanel(parent, winid, _("Import / Export"))
{ {
Populate(); Populate();
} }
@ -118,8 +118,8 @@ wxString ImportExportPrefs::HelpPageName()
return "Import_-_Export_Preferences"; return "Import_-_Export_Preferences";
} }
PrefsPanel *ImportExportPrefsFactory::Create(wxWindow *parent) PrefsPanel *ImportExportPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew ImportExportPrefs(parent); return safenew ImportExportPrefs(parent, winid);
} }

View File

@ -24,7 +24,7 @@ class ShuttleGui;
class ImportExportPrefs final : public PrefsPanel class ImportExportPrefs final : public PrefsPanel
{ {
public: public:
ImportExportPrefs(wxWindow * parent); ImportExportPrefs(wxWindow * parent, wxWindowID winid);
~ImportExportPrefs(); ~ImportExportPrefs();
bool Commit() override; bool Commit() override;
wxString HelpPageName() override; wxString HelpPageName() override;
@ -37,6 +37,6 @@ class ImportExportPrefs final : public PrefsPanel
class ImportExportPrefsFactory final : public PrefsPanelFactory class ImportExportPrefsFactory final : public PrefsPanelFactory
{ {
public: public:
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
}; };
#endif #endif

View File

@ -72,9 +72,10 @@ BEGIN_EVENT_TABLE(KeyConfigPrefs, PrefsPanel)
EVT_TIMER(FilterTimerID, KeyConfigPrefs::OnFilterTimer) EVT_TIMER(FilterTimerID, KeyConfigPrefs::OnFilterTimer)
END_EVENT_TABLE() END_EVENT_TABLE()
KeyConfigPrefs::KeyConfigPrefs(wxWindow * parent, const wxString &name) KeyConfigPrefs::KeyConfigPrefs(wxWindow * parent, wxWindowID winid,
const wxString &name)
/* i18n-hint: as in computer keyboard (not musical!) */ /* i18n-hint: as in computer keyboard (not musical!) */
: PrefsPanel(parent, _("Keyboard")), : PrefsPanel(parent, winid, _("Keyboard")),
mView(NULL), mView(NULL),
mKey(NULL), mKey(NULL),
mFilter(NULL), mFilter(NULL),
@ -749,9 +750,9 @@ wxString KeyConfigPrefs::HelpPageName()
return "Keyboard_Preferences"; return "Keyboard_Preferences";
} }
PrefsPanel *KeyConfigPrefsFactory::Create(wxWindow *parent) PrefsPanel *KeyConfigPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
auto result = safenew KeyConfigPrefs{ parent, mName }; auto result = safenew KeyConfigPrefs{ parent, winid, mName };
return result; return result;
} }

View File

@ -35,7 +35,7 @@ class wxStaticText;
class KeyConfigPrefs final : public PrefsPanel class KeyConfigPrefs final : public PrefsPanel
{ {
public: public:
KeyConfigPrefs(wxWindow * parent, const wxString &name); KeyConfigPrefs(wxWindow * parent, wxWindowID winid, const wxString &name);
~KeyConfigPrefs(); ~KeyConfigPrefs();
bool Commit() override; bool Commit() override;
void Cancel() override; void Cancel() override;
@ -99,8 +99,8 @@ class KeyConfigPrefsFactory final : public PrefsPanelFactory
public: public:
KeyConfigPrefsFactory(const wxString &name = wxString{}) KeyConfigPrefsFactory(const wxString &name = wxString{})
: mName{ name } {} : mName{ name } {}
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
private: private:
wxString mName; wxString mName;
}; };

View File

@ -46,9 +46,9 @@ BEGIN_EVENT_TABLE(LibraryPrefs, PrefsPanel)
EVT_BUTTON(ID_FFMPEG_DOWN_BUTTON, LibraryPrefs::OnFFmpegDownButton) EVT_BUTTON(ID_FFMPEG_DOWN_BUTTON, LibraryPrefs::OnFFmpegDownButton)
END_EVENT_TABLE() END_EVENT_TABLE()
LibraryPrefs::LibraryPrefs(wxWindow * parent) LibraryPrefs::LibraryPrefs(wxWindow * parent, wxWindowID winid)
/* i18-hint: refers to optional plug-in software libraries */ /* i18-hint: refers to optional plug-in software libraries */
: PrefsPanel(parent, _("Libraries")) : PrefsPanel(parent, winid, _("Libraries"))
{ {
Populate(); Populate();
} }
@ -250,8 +250,8 @@ wxString LibraryPrefs::HelpPageName()
return "Libraries_Preferences"; return "Libraries_Preferences";
} }
PrefsPanel *LibraryPrefsFactory::Create(wxWindow *parent) PrefsPanel *LibraryPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew LibraryPrefs(parent); return safenew LibraryPrefs(parent, winid);
} }

View File

@ -25,7 +25,7 @@ class ShuttleGui;
class LibraryPrefs final : public PrefsPanel class LibraryPrefs final : public PrefsPanel
{ {
public: public:
LibraryPrefs(wxWindow * parent); LibraryPrefs(wxWindow * parent, wxWindowID winid);
~LibraryPrefs(); ~LibraryPrefs();
bool Commit() override; bool Commit() override;
wxString HelpPageName() override; wxString HelpPageName() override;
@ -50,6 +50,6 @@ class LibraryPrefs final : public PrefsPanel
class LibraryPrefsFactory final : public PrefsPanelFactory class LibraryPrefsFactory final : public PrefsPanelFactory
{ {
public: public:
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
}; };
#endif #endif

View File

@ -55,9 +55,9 @@ BEGIN_EVENT_TABLE(MidiIOPrefs, PrefsPanel)
// EVT_CHOICE(RecordID, MidiIOPrefs::OnDevice) // EVT_CHOICE(RecordID, MidiIOPrefs::OnDevice)
END_EVENT_TABLE() END_EVENT_TABLE()
MidiIOPrefs::MidiIOPrefs(wxWindow * parent) MidiIOPrefs::MidiIOPrefs(wxWindow * parent, wxWindowID winid)
/* i18n-hint: untranslatable acronym for "Musical Instrument Device Interface" */ /* i18n-hint: untranslatable acronym for "Musical Instrument Device Interface" */
: PrefsPanel(parent, _("MIDI Devices")) : PrefsPanel(parent, winid, _("MIDI Devices"))
{ {
Populate(); Populate();
} }
@ -296,10 +296,10 @@ wxString MidiIOPrefs::HelpPageName()
return "MIDI_Devices_Preferences"; return "MIDI_Devices_Preferences";
} }
PrefsPanel *MidiIOPrefsFactory::Create(wxWindow *parent) PrefsPanel *MidiIOPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew MidiIOPrefs(parent); return safenew MidiIOPrefs(parent, winid);
} }
#endif #endif

View File

@ -29,7 +29,7 @@ class ShuttleGui;
class MidiIOPrefs final : public PrefsPanel class MidiIOPrefs final : public PrefsPanel
{ {
public: public:
MidiIOPrefs(wxWindow * parent); MidiIOPrefs(wxWindow * parent, wxWindowID winid);
virtual ~MidiIOPrefs(); virtual ~MidiIOPrefs();
bool Commit() override; bool Commit() override;
bool Validate() override; bool Validate() override;
@ -66,7 +66,7 @@ class MidiIOPrefs final : public PrefsPanel
class MidiIOPrefsFactory final : public PrefsPanelFactory class MidiIOPrefsFactory final : public PrefsPanelFactory
{ {
public: public:
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
}; };
#endif #endif

View File

@ -29,8 +29,8 @@ with names like mnod-script-pipe that add NEW features.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/* i18n-hint: Modules are optional extensions to Audacity that add NEW features.*/ /* i18n-hint: Modules are optional extensions to Audacity that add NEW features.*/
ModulePrefs::ModulePrefs(wxWindow * parent) ModulePrefs::ModulePrefs(wxWindow * parent, wxWindowID winid)
: PrefsPanel(parent, _("Modules")) : PrefsPanel(parent, winid, _("Modules"))
{ {
Populate(); Populate();
} }
@ -168,8 +168,8 @@ wxString ModulePrefs::HelpPageName()
return "Modules_Preferences"; return "Modules_Preferences";
} }
PrefsPanel *ModulePrefsFactory::Create(wxWindow *parent) PrefsPanel *ModulePrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew ModulePrefs(parent); return safenew ModulePrefs(parent, winid);
} }

View File

@ -34,7 +34,7 @@ enum {
class ModulePrefs final : public PrefsPanel class ModulePrefs final : public PrefsPanel
{ {
public: public:
ModulePrefs(wxWindow * parent); ModulePrefs(wxWindow * parent, wxWindowID winid);
~ModulePrefs(); ~ModulePrefs();
bool Commit() override; bool Commit() override;
wxString HelpPageName() override; wxString HelpPageName() override;
@ -54,6 +54,6 @@ class ModulePrefs final : public PrefsPanel
class ModulePrefsFactory final : public PrefsPanelFactory class ModulePrefsFactory final : public PrefsPanelFactory
{ {
public: public:
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
}; };
#endif #endif

View File

@ -61,8 +61,8 @@ enum
#endif #endif
/// Constructor /// Constructor
MousePrefs::MousePrefs(wxWindow * parent) MousePrefs::MousePrefs(wxWindow * parent, wxWindowID winid)
: PrefsPanel(parent, _("Mouse")) : PrefsPanel(parent, winid, _("Mouse"))
{ {
Populate(); Populate();
} }
@ -203,8 +203,8 @@ wxString MousePrefs::HelpPageName()
return "Mouse_Preferences"; return "Mouse_Preferences";
} }
PrefsPanel *MousePrefsFactory::Create(wxWindow *parent) PrefsPanel *MousePrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew MousePrefs(parent); return safenew MousePrefs(parent, winid);
} }

View File

@ -22,7 +22,7 @@ class ShuttleGui;
class MousePrefs final : public PrefsPanel class MousePrefs final : public PrefsPanel
{ {
public: public:
MousePrefs(wxWindow * parent); MousePrefs(wxWindow * parent, wxWindowID winid);
~MousePrefs(); ~MousePrefs();
bool Commit() override; bool Commit() override;
wxString HelpPageName() override; wxString HelpPageName() override;
@ -42,6 +42,6 @@ class MousePrefs final : public PrefsPanel
class MousePrefsFactory final : public PrefsPanelFactory class MousePrefsFactory final : public PrefsPanelFactory
{ {
public: public:
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
}; };
#endif #endif

View File

@ -28,8 +28,8 @@
#include "../Prefs.h" #include "../Prefs.h"
#include "../Internat.h" #include "../Internat.h"
PlaybackPrefs::PlaybackPrefs(wxWindow * parent) PlaybackPrefs::PlaybackPrefs(wxWindow * parent, wxWindowID winid)
: PrefsPanel(parent, _("Playback")) : PrefsPanel(parent, winid, _("Playback"))
{ {
Populate(); Populate();
} }
@ -132,9 +132,9 @@ wxString PlaybackPrefs::HelpPageName()
return "Playback_Preferences"; return "Playback_Preferences";
} }
PrefsPanel *PlaybackPrefsFactory::Create(wxWindow *parent) PrefsPanel *PlaybackPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew PlaybackPrefs(parent); return safenew PlaybackPrefs(parent, winid);
} }

View File

@ -23,7 +23,7 @@ class ShuttleGui;
class PlaybackPrefs final : public PrefsPanel class PlaybackPrefs final : public PrefsPanel
{ {
public: public:
PlaybackPrefs(wxWindow * parent); PlaybackPrefs(wxWindow * parent, wxWindowID winid);
virtual ~PlaybackPrefs(); virtual ~PlaybackPrefs();
bool Commit() override; bool Commit() override;
wxString HelpPageName() override; wxString HelpPageName() override;
@ -36,7 +36,7 @@ class PlaybackPrefs final : public PrefsPanel
class PlaybackPrefsFactory final : public PrefsPanelFactory class PlaybackPrefsFactory final : public PrefsPanelFactory
{ {
public: public:
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
}; };
#endif #endif

View File

@ -261,7 +261,7 @@ PrefsDialog::PrefsDialog
{ {
const PrefsNode &node = *it; const PrefsNode &node = *it;
PrefsPanelFactory &factory = *node.pFactory; PrefsPanelFactory &factory = *node.pFactory;
wxWindow *const w = factory.Create(mCategories); wxWindow *const w = factory(mCategories, wxID_ANY);
if (stack.empty()) if (stack.empty())
// Parameters are: AddPage(page, name, IsSelected, imageId). // Parameters are: AddPage(page, name, IsSelected, imageId).
mCategories->AddPage(w, w->GetName(), false, 0); mCategories->AddPage(w, w->GetName(), false, 0);
@ -289,7 +289,7 @@ PrefsDialog::PrefsDialog
// Unique page, don't show the factory // Unique page, don't show the factory
const PrefsNode &node = factories[0]; const PrefsNode &node = factories[0];
PrefsPanelFactory &factory = *node.pFactory; PrefsPanelFactory &factory = *node.pFactory;
mUniquePage = factory.Create(this); mUniquePage = factory(this, wxID_ANY);
wxWindow * uniquePageWindow = S.Prop(1).AddWindow(mUniquePage, wxEXPAND); wxWindow * uniquePageWindow = S.Prop(1).AddWindow(mUniquePage, wxEXPAND);
// We're not in the wxTreebook, so add the accelerator here // We're not in the wxTreebook, so add the accelerator here
wxAcceleratorEntry entries[1]; wxAcceleratorEntry entries[1];

View File

@ -43,8 +43,8 @@ ThemePrefs.
class PrefsPanel /* not final */ : public wxPanelWrapper class PrefsPanel /* not final */ : public wxPanelWrapper
{ {
public: public:
PrefsPanel(wxWindow * parent, const wxString &title) PrefsPanel(wxWindow * parent, wxWindowID winid, const wxString &title)
: wxPanelWrapper(parent, wxID_ANY) : wxPanelWrapper(parent, winid)
{ {
SetLabel(title); // Provide visual label SetLabel(title); // Provide visual label
SetName(title); // Provide audible label SetName(title); // Provide audible label
@ -71,7 +71,7 @@ class PrefsPanelFactory /* not final */
{ {
public: public:
// Precondition: parent != NULL // Precondition: parent != NULL
virtual PrefsPanel *Create(wxWindow *parent) = 0; virtual PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) = 0;
}; };
#endif #endif

View File

@ -29,8 +29,8 @@ handling.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ProjectsPrefs::ProjectsPrefs(wxWindow * parent) ProjectsPrefs::ProjectsPrefs(wxWindow * parent, wxWindowID winid)
: PrefsPanel(parent, : PrefsPanel(parent, winid,
/* i18n-hint: (noun) i.e Audacity projects. */ /* i18n-hint: (noun) i.e Audacity projects. */
_("Projects")) _("Projects"))
{ {
@ -89,8 +89,8 @@ wxString ProjectsPrefs::HelpPageName()
return "Projects_Preferences"; return "Projects_Preferences";
} }
PrefsPanel *ProjectsPrefsFactory::Create(wxWindow *parent) PrefsPanel *ProjectsPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew ProjectsPrefs(parent); return safenew ProjectsPrefs(parent, winid);
} }

View File

@ -24,7 +24,7 @@ class ShuttleGui;
class ProjectsPrefs final : public PrefsPanel class ProjectsPrefs final : public PrefsPanel
{ {
public: public:
ProjectsPrefs(wxWindow * parent); ProjectsPrefs(wxWindow * parent, wxWindowID winid);
~ProjectsPrefs(); ~ProjectsPrefs();
bool Commit() override; bool Commit() override;
wxString HelpPageName() override; wxString HelpPageName() override;
@ -37,6 +37,6 @@ class ProjectsPrefs final : public PrefsPanel
class ProjectsPrefsFactory final : public PrefsPanelFactory class ProjectsPrefsFactory final : public PrefsPanelFactory
{ {
public: public:
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
}; };
#endif #endif

View File

@ -34,9 +34,9 @@ BEGIN_EVENT_TABLE(QualityPrefs, PrefsPanel)
EVT_CHOICE(ID_SAMPLE_RATE_CHOICE, QualityPrefs::OnSampleRateChoice) EVT_CHOICE(ID_SAMPLE_RATE_CHOICE, QualityPrefs::OnSampleRateChoice)
END_EVENT_TABLE() END_EVENT_TABLE()
QualityPrefs::QualityPrefs(wxWindow * parent) QualityPrefs::QualityPrefs(wxWindow * parent, wxWindowID winid)
/* i18n-hint: meaning accuracy in reproduction of sounds */ /* i18n-hint: meaning accuracy in reproduction of sounds */
: PrefsPanel(parent, _("Quality")) : PrefsPanel(parent, winid, _("Quality"))
{ {
Populate(); Populate();
} }
@ -240,8 +240,8 @@ wxString QualityPrefs::HelpPageName()
return "Quality_Preferences"; return "Quality_Preferences";
} }
PrefsPanel *QualityPrefsFactory::Create(wxWindow *parent) PrefsPanel *QualityPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew QualityPrefs(parent); return safenew QualityPrefs(parent, winid);
} }

View File

@ -26,7 +26,7 @@ class ShuttleGui;
class QualityPrefs final : public PrefsPanel class QualityPrefs final : public PrefsPanel
{ {
public: public:
QualityPrefs(wxWindow * parent); QualityPrefs(wxWindow * parent, wxWindowID winid);
virtual ~QualityPrefs(); virtual ~QualityPrefs();
bool Commit() override; bool Commit() override;
@ -57,6 +57,6 @@ class QualityPrefs final : public PrefsPanel
class QualityPrefsFactory final : public PrefsPanelFactory class QualityPrefsFactory final : public PrefsPanelFactory
{ {
public: public:
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
}; };
#endif #endif

View File

@ -45,8 +45,8 @@ BEGIN_EVENT_TABLE(RecordingPrefs, PrefsPanel)
EVT_CHECKBOX(UseCustomTrackNameID, RecordingPrefs::OnToggleCustomName) EVT_CHECKBOX(UseCustomTrackNameID, RecordingPrefs::OnToggleCustomName)
END_EVENT_TABLE() END_EVENT_TABLE()
RecordingPrefs::RecordingPrefs(wxWindow * parent) RecordingPrefs::RecordingPrefs(wxWindow * parent, wxWindowID winid)
: PrefsPanel(parent, _("Recording")) : PrefsPanel(parent, winid, _("Recording"))
{ {
gPrefs->Read(wxT("/GUI/TrackNames/RecordingNameCustom"), &mUseCustomTrackName, false); gPrefs->Read(wxT("/GUI/TrackNames/RecordingNameCustom"), &mUseCustomTrackName, false);
mOldNameChoice = mUseCustomTrackName; mOldNameChoice = mUseCustomTrackName;
@ -268,8 +268,8 @@ wxString RecordingPrefs::HelpPageName()
return "Recording_Preferences"; return "Recording_Preferences";
} }
PrefsPanel *RecordingPrefsFactory::Create(wxWindow *parent) PrefsPanel *RecordingPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew RecordingPrefs(parent); return safenew RecordingPrefs(parent, winid);
} }

View File

@ -24,7 +24,7 @@ class ShuttleGui;
class RecordingPrefs final : public PrefsPanel class RecordingPrefs final : public PrefsPanel
{ {
public: public:
RecordingPrefs(wxWindow * parent); RecordingPrefs(wxWindow * parent, wxWindowID winid);
virtual ~RecordingPrefs(); virtual ~RecordingPrefs();
bool Commit() override; bool Commit() override;
wxString HelpPageName() override; wxString HelpPageName() override;
@ -44,6 +44,6 @@ class RecordingPrefs final : public PrefsPanel
class RecordingPrefsFactory final : public PrefsPanelFactory class RecordingPrefsFactory final : public PrefsPanelFactory
{ {
public: public:
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
}; };
#endif #endif

View File

@ -33,8 +33,8 @@
#include "../Experimental.h" #include "../Experimental.h"
#include "../widgets/ErrorDialog.h" #include "../widgets/ErrorDialog.h"
SpectrumPrefs::SpectrumPrefs(wxWindow * parent, WaveTrack *wt) SpectrumPrefs::SpectrumPrefs(wxWindow * parent, wxWindowID winid, WaveTrack *wt)
: PrefsPanel(parent, wt ? _("Spectrogram Settings") : _("Spectrograms")) : PrefsPanel(parent, winid, wt ? _("Spectrogram Settings") : _("Spectrograms"))
, mWt(wt) , mWt(wt)
, mPopulating(false) , mPopulating(false)
{ {
@ -585,8 +585,8 @@ SpectrumPrefsFactory::SpectrumPrefsFactory(WaveTrack *wt)
{ {
} }
PrefsPanel *SpectrumPrefsFactory::Create(wxWindow *parent) PrefsPanel *SpectrumPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew SpectrumPrefs(parent, mWt); return safenew SpectrumPrefs(parent, winid, mWt);
} }

View File

@ -42,7 +42,7 @@ class WaveTrack;
class SpectrumPrefs final : public PrefsPanel class SpectrumPrefs final : public PrefsPanel
{ {
public: public:
SpectrumPrefs(wxWindow * parent, WaveTrack *wt); SpectrumPrefs(wxWindow * parent, wxWindowID winid, WaveTrack *wt);
virtual ~SpectrumPrefs(); virtual ~SpectrumPrefs();
void Preview() override; void Preview() override;
bool Commit() override; bool Commit() override;
@ -108,7 +108,7 @@ class SpectrumPrefsFactory final : public PrefsPanelFactory
{ {
public: public:
explicit SpectrumPrefsFactory(WaveTrack *wt = 0); explicit SpectrumPrefsFactory(WaveTrack *wt = 0);
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
private: private:
WaveTrack *const mWt; WaveTrack *const mWt;

View File

@ -56,12 +56,12 @@ BEGIN_EVENT_TABLE(ThemePrefs, PrefsPanel)
EVT_BUTTON(idSaveThemeAsCode, ThemePrefs::OnSaveThemeAsCode) EVT_BUTTON(idSaveThemeAsCode, ThemePrefs::OnSaveThemeAsCode)
END_EVENT_TABLE() END_EVENT_TABLE()
ThemePrefs::ThemePrefs(wxWindow * parent) ThemePrefs::ThemePrefs(wxWindow * parent, wxWindowID winid)
/* i18n-hint: A theme is a consistent visual style across an application's /* i18n-hint: A theme is a consistent visual style across an application's
graphical user interface, including choices of colors, and similarity of images graphical user interface, including choices of colors, and similarity of images
such as those on button controls. Audacity can load and save alternative such as those on button controls. Audacity can load and save alternative
themes. */ themes. */
: PrefsPanel(parent, _("Theme")) : PrefsPanel(parent, winid, _("Theme"))
{ {
Populate(); Populate();
} }
@ -201,8 +201,8 @@ bool ThemePrefs::Commit()
return true; return true;
} }
PrefsPanel *ThemePrefsFactory::Create(wxWindow *parent) PrefsPanel *ThemePrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew ThemePrefs(parent); return safenew ThemePrefs(parent, winid);
} }

View File

@ -24,7 +24,7 @@ class ShuttleGui;
class ThemePrefs final : public PrefsPanel class ThemePrefs final : public PrefsPanel
{ {
public: public:
ThemePrefs(wxWindow * parent); ThemePrefs(wxWindow * parent, wxWindowID winid);
~ThemePrefs(void); ~ThemePrefs(void);
bool Commit() override; bool Commit() override;
@ -44,6 +44,6 @@ class ThemePrefs final : public PrefsPanel
class ThemePrefsFactory final : public PrefsPanelFactory class ThemePrefsFactory final : public PrefsPanelFactory
{ {
public: public:
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
}; };
#endif #endif

View File

@ -22,9 +22,9 @@
#include "../Experimental.h" #include "../Experimental.h"
#include "../Internat.h" #include "../Internat.h"
TracksBehaviorsPrefs::TracksBehaviorsPrefs(wxWindow * parent) TracksBehaviorsPrefs::TracksBehaviorsPrefs(wxWindow * parent, wxWindowID winid)
/* i18n-hint: two nouns */ /* i18n-hint: two nouns */
: PrefsPanel(parent, _("Tracks Behaviors")) : PrefsPanel(parent, winid, _("Tracks Behaviors"))
{ {
Populate(); Populate();
} }
@ -125,8 +125,8 @@ TracksBehaviorsPrefsFactory::TracksBehaviorsPrefsFactory()
{ {
} }
PrefsPanel *TracksBehaviorsPrefsFactory::Create(wxWindow *parent) PrefsPanel *TracksBehaviorsPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew TracksBehaviorsPrefs(parent); return safenew TracksBehaviorsPrefs(parent, winid);
} }

View File

@ -21,7 +21,7 @@ class ShuttleGui;
class TracksBehaviorsPrefs final : public PrefsPanel class TracksBehaviorsPrefs final : public PrefsPanel
{ {
public: public:
TracksBehaviorsPrefs(wxWindow * parent); TracksBehaviorsPrefs(wxWindow * parent, wxWindowID winid);
~TracksBehaviorsPrefs(); ~TracksBehaviorsPrefs();
bool Commit() override; bool Commit() override;
wxString HelpPageName() override; wxString HelpPageName() override;
@ -41,7 +41,7 @@ class TracksBehaviorsPrefsFactory final : public PrefsPanelFactory
{ {
public: public:
explicit TracksBehaviorsPrefsFactory(); explicit TracksBehaviorsPrefsFactory();
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
}; };
#endif #endif

View File

@ -45,11 +45,11 @@ namespace {
} }
TracksPrefs::TracksPrefs(wxWindow * parent) TracksPrefs::TracksPrefs(wxWindow * parent, wxWindowID winid)
/* i18n-hint: "Tracks" include audio recordings but also other collections of /* i18n-hint: "Tracks" include audio recordings but also other collections of
* data associated with a time line, such as sequences of labels, and musical * data associated with a time line, such as sequences of labels, and musical
* notes */ * notes */
: PrefsPanel(parent, _("Tracks")) : PrefsPanel(parent, winid, _("Tracks"))
{ {
// Bugs 1043, 1044 // Bugs 1043, 1044
// First rewrite legacy preferences // First rewrite legacy preferences
@ -239,8 +239,8 @@ wxString TracksPrefs::HelpPageName()
return "Tracks_Preferences"; return "Tracks_Preferences";
} }
PrefsPanel *TracksPrefsFactory::Create(wxWindow *parent) PrefsPanel *TracksPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew TracksPrefs(parent); return safenew TracksPrefs(parent, winid);
} }

View File

@ -25,7 +25,7 @@ class ShuttleGui;
class TracksPrefs final : public PrefsPanel class TracksPrefs final : public PrefsPanel
{ {
public: public:
TracksPrefs(wxWindow * parent); TracksPrefs(wxWindow * parent, wxWindowID winid);
~TracksPrefs(); ~TracksPrefs();
bool Commit() override; bool Commit() override;
wxString HelpPageName() override; wxString HelpPageName() override;
@ -52,6 +52,6 @@ class TracksPrefs final : public PrefsPanel
class TracksPrefsFactory final : public PrefsPanelFactory class TracksPrefsFactory final : public PrefsPanelFactory
{ {
public: public:
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
}; };
#endif #endif

View File

@ -28,8 +28,8 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
WarningsPrefs::WarningsPrefs(wxWindow * parent) WarningsPrefs::WarningsPrefs(wxWindow * parent, wxWindowID winid)
: PrefsPanel(parent, _("Warnings")) : PrefsPanel(parent, winid, _("Warnings"))
{ {
Populate(); Populate();
} }
@ -96,8 +96,8 @@ wxString WarningsPrefs::HelpPageName()
return "Warnings_Preferences"; return "Warnings_Preferences";
} }
PrefsPanel *WarningsPrefsFactory::Create(wxWindow *parent) PrefsPanel *WarningsPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew WarningsPrefs(parent); return safenew WarningsPrefs(parent, winid);
} }

View File

@ -24,7 +24,7 @@ class ShuttleGui;
class WarningsPrefs final : public PrefsPanel class WarningsPrefs final : public PrefsPanel
{ {
public: public:
WarningsPrefs(wxWindow * parent); WarningsPrefs(wxWindow * parent, wxWindowID winid);
~WarningsPrefs(); ~WarningsPrefs();
bool Commit() override; bool Commit() override;
wxString HelpPageName() override; wxString HelpPageName() override;
@ -37,6 +37,6 @@ class WarningsPrefs final : public PrefsPanel
class WarningsPrefsFactory final : public PrefsPanelFactory class WarningsPrefsFactory final : public PrefsPanelFactory
{ {
public: public:
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
}; };
#endif #endif

View File

@ -26,9 +26,9 @@ Paul Licameli
#include "../ShuttleGui.h" #include "../ShuttleGui.h"
#include "../WaveTrack.h" #include "../WaveTrack.h"
WaveformPrefs::WaveformPrefs(wxWindow * parent, WaveTrack *wt) WaveformPrefs::WaveformPrefs(wxWindow * parent, wxWindowID winid, WaveTrack *wt)
/* i18n-hint: A waveform is a visual representation of vibration */ /* i18n-hint: A waveform is a visual representation of vibration */
: PrefsPanel(parent, _("Waveforms")) : PrefsPanel(parent, winid, _("Waveforms"))
, mWt(wt) , mWt(wt)
, mPopulating(false) , mPopulating(false)
{ {
@ -250,8 +250,8 @@ WaveformPrefsFactory::WaveformPrefsFactory(WaveTrack *wt)
{ {
} }
PrefsPanel *WaveformPrefsFactory::Create(wxWindow *parent) PrefsPanel *WaveformPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
return safenew WaveformPrefs(parent, mWt); return safenew WaveformPrefs(parent, winid, mWt);
} }

View File

@ -23,7 +23,7 @@ class wxChoice;
class WaveformPrefs final : public PrefsPanel class WaveformPrefs final : public PrefsPanel
{ {
public: public:
WaveformPrefs(wxWindow * parent, WaveTrack *wt); WaveformPrefs(wxWindow * parent, wxWindowID winid, WaveTrack *wt);
virtual ~WaveformPrefs(); virtual ~WaveformPrefs();
bool Commit() override; bool Commit() override;
bool ShowsPreviewButton() override; bool ShowsPreviewButton() override;
@ -60,7 +60,7 @@ class WaveformPrefsFactory final : public PrefsPanelFactory
{ {
public: public:
explicit WaveformPrefsFactory(WaveTrack *wt = 0); explicit WaveformPrefsFactory(WaveTrack *wt = 0);
PrefsPanel *Create(wxWindow *parent) override; PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
private: private:
WaveTrack *const mWt; WaveTrack *const mWt;

View File

@ -129,12 +129,13 @@ void ControlToolBar::Create(wxWindow * parent)
// This is a convenience function that allows for button creation in // This is a convenience function that allows for button creation in
// MakeButtons() with fewer arguments // MakeButtons() with fewer arguments
AButton *ControlToolBar::MakeButton(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled, AButton *ControlToolBar::MakeButton(ControlToolBar *pBar,
teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
int id, int id,
bool processdownevents, bool processdownevents,
const wxChar *label) const wxChar *label)
{ {
AButton *r = ToolBar::MakeButton(this, AButton *r = ToolBar::MakeButton(pBar,
bmpRecoloredUpLarge, bmpRecoloredDownLarge, bmpRecoloredUpHiliteLarge, bmpRecoloredHiliteLarge, bmpRecoloredUpLarge, bmpRecoloredDownLarge, bmpRecoloredUpHiliteLarge, bmpRecoloredHiliteLarge,
eEnabledUp, eEnabledDown, eDisabled, eEnabledUp, eEnabledDown, eDisabled,
wxWindowID(id), wxWindowID(id),
@ -170,10 +171,10 @@ void ControlToolBar::Populate()
SetBackgroundColour( theTheme.Colour( clrMedium ) ); SetBackgroundColour( theTheme.Colour( clrMedium ) );
MakeButtonBackgroundsLarge(); MakeButtonBackgroundsLarge();
mPause = MakeButton(bmpPause, bmpPause, bmpPauseDisabled, mPause = MakeButton(this, bmpPause, bmpPause, bmpPauseDisabled,
ID_PAUSE_BUTTON, true, _("Pause")); ID_PAUSE_BUTTON, true, _("Pause"));
mPlay = MakeButton( bmpPlay, bmpPlay, bmpPlayDisabled, mPlay = MakeButton(this, bmpPlay, bmpPlay, bmpPlayDisabled,
ID_PLAY_BUTTON, true, _("Play")); ID_PLAY_BUTTON, true, _("Play"));
MakeAlternateImages(*mPlay, 1, bmpLoop, bmpLoop, bmpLoopDisabled); MakeAlternateImages(*mPlay, 1, bmpLoop, bmpLoop, bmpLoopDisabled);
MakeAlternateImages(*mPlay, 2, MakeAlternateImages(*mPlay, 2,
@ -184,16 +185,16 @@ void ControlToolBar::Populate()
bmpSeek, bmpSeek, bmpSeekDisabled); bmpSeek, bmpSeek, bmpSeekDisabled);
mPlay->FollowModifierKeys(); mPlay->FollowModifierKeys();
mStop = MakeButton( bmpStop, bmpStop, bmpStopDisabled , mStop = MakeButton(this, bmpStop, bmpStop, bmpStopDisabled ,
ID_STOP_BUTTON, false, _("Stop")); ID_STOP_BUTTON, false, _("Stop"));
mRewind = MakeButton(bmpRewind, bmpRewind, bmpRewindDisabled, mRewind = MakeButton(this, bmpRewind, bmpRewind, bmpRewindDisabled,
ID_REW_BUTTON, false, _("Skip to Start")); ID_REW_BUTTON, false, _("Skip to Start"));
mFF = MakeButton(bmpFFwd, bmpFFwd, bmpFFwdDisabled, mFF = MakeButton(this, bmpFFwd, bmpFFwd, bmpFFwdDisabled,
ID_FF_BUTTON, false, _("Skip to End")); ID_FF_BUTTON, false, _("Skip to End"));
mRecord = MakeButton(bmpRecord, bmpRecord, bmpRecordDisabled, mRecord = MakeButton(this, bmpRecord, bmpRecord, bmpRecordDisabled,
ID_RECORD_BUTTON, false, _("Record")); ID_RECORD_BUTTON, false, _("Record"));
bool bPreferNewTrack; bool bPreferNewTrack;

View File

@ -120,7 +120,9 @@ class ControlToolBar final : public ToolBar {
private: private:
AButton *MakeButton(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled, static AButton *MakeButton(
ControlToolBar *pBar,
teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
int id, int id,
bool processdownevents, bool processdownevents,
const wxChar *label); const wxChar *label);

View File

@ -98,14 +98,15 @@ void EditToolBar::AddSeparator()
/// MakeButtons() with fewer arguments /// MakeButtons() with fewer arguments
/// Very similar to code in ControlToolBar... /// Very similar to code in ControlToolBar...
AButton *EditToolBar::AddButton( AButton *EditToolBar::AddButton(
EditToolBar *pBar,
teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled, teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
int id, int id,
const wxChar *label, const wxChar *label,
bool toggle) bool toggle)
{ {
AButton *&r = mButtons[id]; AButton *&r = pBar->mButtons[id];
r = ToolBar::MakeButton(this, r = ToolBar::MakeButton(pBar,
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredUpHiliteSmall, bmpRecoloredHiliteSmall, bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredUpHiliteSmall, bmpRecoloredHiliteSmall,
eEnabledUp, eEnabledDown, eDisabled, eEnabledUp, eEnabledDown, eDisabled,
wxWindowID(id), wxWindowID(id),
@ -117,7 +118,7 @@ AButton *EditToolBar::AddButton(
// JKC: Unlike ControlToolBar, does not have a focus rect. Shouldn't it? // JKC: Unlike ControlToolBar, does not have a focus rect. Shouldn't it?
// r->SetFocusRect( r->GetRect().Deflate( 4, 4 ) ); // r->SetFocusRect( r->GetRect().Deflate( 4, 4 ) );
Add( r, 0, wxALIGN_CENTER ); pBar->Add( r, 0, wxALIGN_CENTER );
return r; return r;
} }
@ -129,28 +130,28 @@ void EditToolBar::Populate()
/* Buttons */ /* Buttons */
// Tooltips slightly more verbose than the menu entries are. // Tooltips slightly more verbose than the menu entries are.
AddButton(bmpCut, bmpCut, bmpCutDisabled, ETBCutID, AddButton(this, bmpCut, bmpCut, bmpCutDisabled, ETBCutID,
_("Cut selection")); _("Cut selection"));
AddButton(bmpCopy, bmpCopy, bmpCopyDisabled, ETBCopyID, AddButton(this, bmpCopy, bmpCopy, bmpCopyDisabled, ETBCopyID,
_("Copy selection")); _("Copy selection"));
AddButton(bmpPaste, bmpPaste, bmpPasteDisabled, ETBPasteID, AddButton(this, bmpPaste, bmpPaste, bmpPasteDisabled, ETBPasteID,
_("Paste")); _("Paste"));
AddButton(bmpTrim, bmpTrim, bmpTrimDisabled, ETBTrimID, AddButton(this, bmpTrim, bmpTrim, bmpTrimDisabled, ETBTrimID,
_("Trim audio outside selection")); _("Trim audio outside selection"));
AddButton(bmpSilence, bmpSilence, bmpSilenceDisabled, ETBSilenceID, AddButton(this, bmpSilence, bmpSilence, bmpSilenceDisabled, ETBSilenceID,
_("Silence audio selection")); _("Silence audio selection"));
AddSeparator(); AddSeparator();
AddButton(bmpUndo, bmpUndo, bmpUndoDisabled, ETBUndoID, AddButton(this, bmpUndo, bmpUndo, bmpUndoDisabled, ETBUndoID,
_("Undo")); _("Undo"));
AddButton(bmpRedo, bmpRedo, bmpRedoDisabled, ETBRedoID, AddButton(this, bmpRedo, bmpRedo, bmpRedoDisabled, ETBRedoID,
_("Redo")); _("Redo"));
AddSeparator(); AddSeparator();
#ifdef OPTION_SYNC_LOCK_BUTTON #ifdef OPTION_SYNC_LOCK_BUTTON
AddButton(bmpSyncLockTracksUp, bmpSyncLockTracksDown, bmpSyncLockTracksUp, ETBSyncLockID, AddButton(this, bmpSyncLockTracksUp, bmpSyncLockTracksDown, bmpSyncLockTracksUp, ETBSyncLockID,
_("Sync-Lock Tracks"), true); _("Sync-Lock Tracks"), true);
AddSeparator(); AddSeparator();
@ -158,17 +159,17 @@ void EditToolBar::Populate()
// Tooltips match menu entries. // Tooltips match menu entries.
// We previously had longer tooltips which were not more clear. // We previously had longer tooltips which were not more clear.
AddButton(bmpZoomIn, bmpZoomIn, bmpZoomInDisabled, ETBZoomInID, AddButton(this, bmpZoomIn, bmpZoomIn, bmpZoomInDisabled, ETBZoomInID,
_("Zoom In")); _("Zoom In"));
AddButton(bmpZoomOut, bmpZoomOut, bmpZoomOutDisabled, ETBZoomOutID, AddButton(this, bmpZoomOut, bmpZoomOut, bmpZoomOutDisabled, ETBZoomOutID,
_("Zoom Out")); _("Zoom Out"));
AddButton(bmpZoomSel, bmpZoomSel, bmpZoomSelDisabled, ETBZoomSelID, AddButton(this, bmpZoomSel, bmpZoomSel, bmpZoomSelDisabled, ETBZoomSelID,
_("Zoom to Selection")); _("Zoom to Selection"));
AddButton(bmpZoomFit, bmpZoomFit, bmpZoomFitDisabled, ETBZoomFitID, AddButton(this, bmpZoomFit, bmpZoomFit, bmpZoomFitDisabled, ETBZoomFitID,
_("Fit to Width")); _("Fit to Width"));
#ifdef EXPERIMENTAL_ZOOM_TOGGLE_BUTTON #ifdef EXPERIMENTAL_ZOOM_TOGGLE_BUTTON
AddButton(bmpZoomToggle, bmpZoomToggle, bmpZoomToggleDisabled, ETBZoomToggleID, AddButton(this, bmpZoomToggle, bmpZoomToggle, bmpZoomToggleDisabled, ETBZoomToggleID,
_("Zoom Toggle")); _("Zoom Toggle"));
#endif #endif
@ -190,7 +191,7 @@ void EditToolBar::Populate()
#if defined(EXPERIMENTAL_EFFECTS_RACK) #if defined(EXPERIMENTAL_EFFECTS_RACK)
AddSeparator(); AddSeparator();
AddButton(bmpEditEffects, bmpEditEffects, bmpEditEffects, ETBEffectsID, AddButton(this, bmpEditEffects, bmpEditEffects, bmpEditEffects, ETBEffectsID,
_("Show Effects Rack"), true); _("Show Effects Rack"), true);
#endif #endif

View File

@ -86,7 +86,9 @@ class EditToolBar final : public ToolBar {
private: private:
AButton *AddButton(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled, static AButton *AddButton(
EditToolBar *pBar,
teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
int id, const wxChar *label, bool toggle = false); int id, const wxChar *label, bool toggle = false);
void AddSeparator(); void AddSeparator();

View File

@ -78,8 +78,8 @@ void MixerToolBar::Populate()
wxID_ANY, wxID_ANY,
theTheme.Bitmap(bmpMic)), 0, wxALIGN_CENTER); theTheme.Bitmap(bmpMic)), 0, wxALIGN_CENTER);
mInputSlider = safenew ASlider(this, wxID_ANY, _("Recording Volume"), mInputSlider = safenew ASlider(this, wxID_ANY, _("Recording Volume"),
wxDefaultPosition, wxSize(130, 25)); wxDefaultPosition, wxSize(130, 25),
mInputSlider->SetScroll(0.1f, 2.0f); ASlider::Options{}.Line( 0.1f ).Page( 2.0f ));
mInputSlider->SetName(_("Slider Recording")); mInputSlider->SetName(_("Slider Recording"));
Add(mInputSlider, 0, wxALIGN_CENTER); Add(mInputSlider, 0, wxALIGN_CENTER);
@ -88,8 +88,8 @@ void MixerToolBar::Populate()
wxID_ANY, wxID_ANY,
theTheme.Bitmap(bmpSpeaker)), 0, wxALIGN_CENTER); theTheme.Bitmap(bmpSpeaker)), 0, wxALIGN_CENTER);
mOutputSlider = safenew ASlider(this, wxID_ANY, _("Playback Volume"), mOutputSlider = safenew ASlider(this, wxID_ANY, _("Playback Volume"),
wxDefaultPosition, wxSize(130, 25)); wxDefaultPosition, wxSize(130, 25),
mOutputSlider->SetScroll(0.1f, 2.0f); ASlider::Options{}.Line( 0.1f ).Page( 2.0f ));
mOutputSlider->SetName(_("Slider Playback")); mOutputSlider->SetName(_("Slider Playback"));
Add(mOutputSlider, 0, wxALIGN_CENTER); Add(mOutputSlider, 0, wxALIGN_CENTER);

View File

@ -76,15 +76,16 @@ void ScrubbingToolBar::Create(wxWindow * parent)
/// MakeButtons() with fewer arguments /// MakeButtons() with fewer arguments
/// Very similar to code in ControlToolBar... /// Very similar to code in ControlToolBar...
AButton *ScrubbingToolBar::AddButton AButton *ScrubbingToolBar::AddButton
(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled, (ScrubbingToolBar *pBar,
teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
int id, int id,
const wxChar *label, const wxChar *label,
bool toggle) bool toggle)
{ {
AButton *&r = mButtons[id]; AButton *&r = pBar->mButtons[id];
r = ToolBar::MakeButton r = ToolBar::MakeButton
(this, (pBar,
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredUpHiliteSmall, bmpRecoloredHiliteSmall, bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredUpHiliteSmall, bmpRecoloredHiliteSmall,
eEnabledUp, eEnabledDown, eDisabled, eEnabledUp, eEnabledDown, eDisabled,
wxWindowID(id), wxWindowID(id),
@ -96,7 +97,7 @@ AButton *ScrubbingToolBar::AddButton
// JKC: Unlike ControlToolBar, does not have a focus rect. Shouldn't it? // JKC: Unlike ControlToolBar, does not have a focus rect. Shouldn't it?
// r->SetFocusRect( r->GetRect().Deflate( 4, 4 ) ); // r->SetFocusRect( r->GetRect().Deflate( 4, 4 ) );
Add( r, 0, wxALIGN_CENTER ); pBar->Add( r, 0, wxALIGN_CENTER );
return r; return r;
} }
@ -107,11 +108,11 @@ void ScrubbingToolBar::Populate()
MakeButtonBackgroundsSmall(); MakeButtonBackgroundsSmall();
/* Buttons */ /* Buttons */
AddButton(bmpScrub, bmpScrub, bmpScrubDisabled, STBScrubID, AddButton(this, bmpScrub, bmpScrub, bmpScrubDisabled, STBScrubID,
_("Scrub"), true); _("Scrub"), true);
AddButton(bmpSeek, bmpSeek, bmpSeekDisabled, STBSeekID, AddButton(this, bmpSeek, bmpSeek, bmpSeekDisabled, STBSeekID,
_("Seek"), true); _("Seek"), true);
AddButton(bmpToggleScrubRuler, bmpToggleScrubRuler, bmpToggleScrubRuler, AddButton(this, bmpToggleScrubRuler, bmpToggleScrubRuler, bmpToggleScrubRuler,
STBRulerID, STBRulerID,
_("Scrub Ruler"), true); _("Scrub Ruler"), true);

View File

@ -56,8 +56,10 @@ public:
private: private:
AButton *AddButton(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled, static AButton *AddButton(
int id, const wxChar *label, bool toggle = false); ScrubbingToolBar *pBar,
teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
int id, const wxChar *label, bool toggle = false);
void MakeButtons(); void MakeButtons();

View File

@ -205,10 +205,9 @@ auStaticText * SelectionBar::AddTitle( const wxString & Title, wxSizer * pSizer
NumericTextCtrl * SelectionBar::AddTime( const wxString Name, int id, wxSizer * pSizer ){ NumericTextCtrl * SelectionBar::AddTime( const wxString Name, int id, wxSizer * pSizer ){
wxString formatName = mListener ? mListener->AS_GetSelectionFormat() wxString formatName = mListener ? mListener->AS_GetSelectionFormat()
: wxString(wxEmptyString); : wxString(wxEmptyString);
NumericTextCtrl * pCtrl = safenew NumericTextCtrl( auto pCtrl = safenew NumericTextCtrl(
NumericConverter::TIME, this, id, formatName, 0.0, mRate); this, id, NumericConverter::TIME, formatName, 0.0, mRate);
pCtrl->SetName(Name); pCtrl->SetName(Name);
pCtrl->EnableMenu();
pSizer->Add(pCtrl, 0, wxALIGN_TOP | wxRIGHT, 5); pSizer->Add(pCtrl, 0, wxALIGN_TOP | wxRIGHT, 5);
return pCtrl; return pCtrl;
} }

View File

@ -166,31 +166,39 @@ void SpectralSelectionBar::Populate()
auto subSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL); auto subSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
mCenterCtrl = safenew NumericTextCtrl( mCenterCtrl = safenew NumericTextCtrl(
NumericConverter::FREQUENCY, this, OnCenterID, frequencyFormatName, 0.0); this, OnCenterID,
mCenterCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency); NumericConverter::FREQUENCY, frequencyFormatName, 0.0, 44100.0,
NumericTextCtrl::Options{}
.InvalidValue( true, SelectedRegion::UndefinedFrequency )
);
mCenterCtrl->SetName(_("Center Frequency:")); mCenterCtrl->SetName(_("Center Frequency:"));
mCenterCtrl->EnableMenu();
subSizer->Add(mCenterCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); subSizer->Add(mCenterCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
mWidthCtrl = safenew NumericTextCtrl( mWidthCtrl = safenew NumericTextCtrl(
NumericConverter::BANDWIDTH, this, OnWidthID, bandwidthFormatName, 0.0); this, OnWidthID,
mWidthCtrl->SetInvalidValue(-1.0); NumericConverter::BANDWIDTH, bandwidthFormatName, 0.0, 44100.0,
NumericTextCtrl::Options{}
.InvalidValue( true, -1.0 )
);
mWidthCtrl->SetName(wxString(_("Bandwidth:"))); mWidthCtrl->SetName(wxString(_("Bandwidth:")));
mWidthCtrl->EnableMenu();
subSizer->Add(mWidthCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); subSizer->Add(mWidthCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
mLowCtrl = safenew NumericTextCtrl( mLowCtrl = safenew NumericTextCtrl(
NumericConverter::FREQUENCY, this, OnLowID, frequencyFormatName, 0.0); this, OnLowID,
mLowCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency); NumericConverter::FREQUENCY, frequencyFormatName, 0.0, 44100.0,
NumericTextCtrl::Options{}
.InvalidValue( true, SelectedRegion::UndefinedFrequency )
);
mLowCtrl->SetName(_("Low Frequency:")); mLowCtrl->SetName(_("Low Frequency:"));
mLowCtrl->EnableMenu();
subSizer->Add(mLowCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); subSizer->Add(mLowCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
mHighCtrl = safenew NumericTextCtrl( mHighCtrl = safenew NumericTextCtrl(
NumericConverter::FREQUENCY, this, OnHighID, frequencyFormatName, 0.0); this, OnHighID,
mHighCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency); NumericConverter::FREQUENCY, frequencyFormatName, 0.0, 44100.0,
NumericTextCtrl::Options{}
.InvalidValue( true, SelectedRegion::UndefinedFrequency )
);
mHighCtrl->SetName(wxString(_("High Frequency:"))); mHighCtrl->SetName(wxString(_("High Frequency:")));
mHighCtrl->EnableMenu();
subSizer->Add(mHighCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); subSizer->Add(mHighCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
mCenterCtrl->Show(mbCenterAndWidth); mCenterCtrl->Show(mbCenterAndWidth);

View File

@ -155,10 +155,11 @@ void ToolsToolBar::UpdatePrefs()
ToolBar::UpdatePrefs(); ToolBar::UpdatePrefs();
} }
AButton * ToolsToolBar::MakeTool( teBmps eTool, AButton * ToolsToolBar::MakeTool(
ToolsToolBar *pBar, teBmps eTool,
int id, const wxChar *label) int id, const wxChar *label)
{ {
AButton *button = ToolBar::MakeButton(this, AButton *button = ToolBar::MakeButton(pBar,
bmpRecoloredUpSmall, bmpRecoloredUpSmall,
bmpRecoloredDownSmall, bmpRecoloredDownSmall,
bmpRecoloredUpHiliteSmall, bmpRecoloredUpHiliteSmall,
@ -168,7 +169,7 @@ AButton * ToolsToolBar::MakeTool( teBmps eTool,
wxDefaultPosition, true, wxDefaultPosition, true,
theTheme.ImageSize( bmpRecoloredUpSmall )); theTheme.ImageSize( bmpRecoloredUpSmall ));
button->SetLabel( label ); button->SetLabel( label );
mToolSizer->Add( button ); pBar->mToolSizer->Add( button );
return button; return button;
} }
@ -180,12 +181,12 @@ void ToolsToolBar::Populate()
Add(mToolSizer = safenew wxGridSizer(2, 3, 1, 1)); Add(mToolSizer = safenew wxGridSizer(2, 3, 1, 1));
/* Tools */ /* Tools */
mTool[ selectTool ] = MakeTool( bmpIBeam, selectTool, _("Selection Tool") ); mTool[ selectTool ] = MakeTool( this, bmpIBeam, selectTool, _("Selection Tool") );
mTool[ envelopeTool ] = MakeTool( bmpEnvelope, envelopeTool, _("Envelope Tool") ); mTool[ envelopeTool ] = MakeTool( this, bmpEnvelope, envelopeTool, _("Envelope Tool") );
mTool[ drawTool ] = MakeTool( bmpDraw, drawTool, _("Draw Tool") ); mTool[ drawTool ] = MakeTool( this, bmpDraw, drawTool, _("Draw Tool") );
mTool[ zoomTool ] = MakeTool( bmpZoom, zoomTool, _("Zoom Tool") ); mTool[ zoomTool ] = MakeTool( this, bmpZoom, zoomTool, _("Zoom Tool") );
mTool[ slideTool ] = MakeTool( bmpTimeShift, slideTool, _("Slide Tool") ); mTool[ slideTool ] = MakeTool( this, bmpTimeShift, slideTool, _("Slide Tool") );
mTool[ multiTool ] = MakeTool( bmpMulti, multiTool, _("Multi Tool") ); mTool[ multiTool ] = MakeTool( this, bmpMulti, multiTool, _("Multi Tool") );
mTool[mCurrentTool]->PushDown(); mTool[mCurrentTool]->PushDown();

View File

@ -70,7 +70,8 @@ class ToolsToolBar final : public ToolBar {
void RegenerateTooltips() override; void RegenerateTooltips() override;
wxImage *MakeToolImage(wxImage *tool, wxImage *mask, int style); wxImage *MakeToolImage(wxImage *tool, wxImage *mask, int style);
AButton *MakeTool(teBmps eTool, int id, const wxChar *label); static AButton *MakeTool(
ToolsToolBar *pBar, teBmps eTool, int id, const wxChar *label);
AButton *mTool[numTools]; AButton *mTool[numTools];
wxGridSizer *mToolSizer; wxGridSizer *mToolSizer;

View File

@ -137,13 +137,14 @@ void TranscriptionToolBar::Create(wxWindow * parent)
/// MakeButtons() with fewer arguments /// MakeButtons() with fewer arguments
/// Very similar to code in ControlToolBar... /// Very similar to code in ControlToolBar...
AButton *TranscriptionToolBar::AddButton( AButton *TranscriptionToolBar::AddButton(
TranscriptionToolBar *pBar,
teBmps eFore, teBmps eDisabled, teBmps eFore, teBmps eDisabled,
int id, int id,
const wxChar *label) const wxChar *label)
{ {
AButton *&r = mButtons[id]; AButton *&r = pBar->mButtons[id];
r = ToolBar::MakeButton(this, r = ToolBar::MakeButton(pBar,
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredUpHiliteSmall,bmpRecoloredHiliteSmall, bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredUpHiliteSmall,bmpRecoloredHiliteSmall,
eFore, eFore, eDisabled, eFore, eFore, eDisabled,
wxWindowID(id), wxWindowID(id),
@ -155,7 +156,7 @@ AButton *TranscriptionToolBar::AddButton(
// JKC: Unlike ControlToolBar, does not have a focus rect. Shouldn't it? // JKC: Unlike ControlToolBar, does not have a focus rect. Shouldn't it?
// r->SetFocusRect( r->GetRect().Deflate( 4, 4 ) ); // r->SetFocusRect( r->GetRect().Deflate( 4, 4 ) );
Add( r, 0, wxALIGN_CENTER ); pBar->Add( r, 0, wxALIGN_CENTER );
return r; return r;
} }
@ -177,7 +178,7 @@ void TranscriptionToolBar::Populate()
// Very similar to code in EditToolBar // Very similar to code in EditToolBar
MakeButtonBackgroundsSmall(); MakeButtonBackgroundsSmall();
AddButton(bmpPlay, bmpPlayDisabled, TTB_PlaySpeed, AddButton(this, bmpPlay, bmpPlayDisabled, TTB_PlaySpeed,
_("Play at selected speed")); _("Play at selected speed"));
MakeAlternateImages(bmpLoop, bmpLoopDisabled, TTB_PlaySpeed, 1); MakeAlternateImages(bmpLoop, bmpLoopDisabled, TTB_PlaySpeed, 1);
MakeAlternateImages(bmpCutPreview, bmpCutPreviewDisabled, TTB_PlaySpeed, 2); MakeAlternateImages(bmpCutPreview, bmpCutPreviewDisabled, TTB_PlaySpeed, 2);
@ -186,15 +187,18 @@ void TranscriptionToolBar::Populate()
//Add a slider that controls the speed of playback. //Add a slider that controls the speed of playback.
const int SliderWidth=100; const int SliderWidth=100;
mPlaySpeedSlider = safenew ASlider(this, mPlaySpeedSlider = safenew ASlider(this,
TTB_PlaySpeedSlider, TTB_PlaySpeedSlider,
_("Playback Speed"), _("Playback Speed"),
wxDefaultPosition, wxDefaultPosition,
wxSize(SliderWidth,25), wxSize(SliderWidth,25),
SPEED_SLIDER); ASlider::Options{}
.Style( SPEED_SLIDER )
// 6 steps using page up/down, and 60 using arrow keys
.Line( 0.16667f )
.Page( 0.16667f )
);
mPlaySpeedSlider->Set(mPlaySpeed / 100.0); mPlaySpeedSlider->Set(mPlaySpeed / 100.0);
mPlaySpeedSlider->SetLabel(_("Playback Speed")); mPlaySpeedSlider->SetLabel(_("Playback Speed"));
// 6 steps using page up/down, and 60 using arrow keys
mPlaySpeedSlider->SetScroll(0.16667f, 1.6667f);
Add( mPlaySpeedSlider, 0, wxALIGN_CENTER ); Add( mPlaySpeedSlider, 0, wxALIGN_CENTER );
mPlaySpeedSlider->Connect(wxEVT_SET_FOCUS, mPlaySpeedSlider->Connect(wxEVT_SET_FOCUS,
wxFocusEventHandler(TranscriptionToolBar::OnFocus), wxFocusEventHandler(TranscriptionToolBar::OnFocus),
@ -209,23 +213,23 @@ void TranscriptionToolBar::Populate()
// If we need these strings translated, then search and replace // If we need these strings translated, then search and replace
// TRANSLATBLE by _ and remove this #define. // TRANSLATBLE by _ and remove this #define.
#define TRANSLATABLE( x ) wxT( x ) #define TRANSLATABLE( x ) wxT( x )
AddButton(bmpTnStartOn, bmpTnStartOnDisabled, TTB_StartOn, AddButton(this, bmpTnStartOn, bmpTnStartOnDisabled, TTB_StartOn,
TRANSLATABLE("Adjust left selection to next onset")); TRANSLATABLE("Adjust left selection to next onset"));
AddButton(bmpTnEndOn, bmpTnEndOnDisabled, TTB_EndOn, AddButton(this, bmpTnEndOn, bmpTnEndOnDisabled, TTB_EndOn,
TRANSLATABLE("Adjust right selection to previous offset")); TRANSLATABLE("Adjust right selection to previous offset"));
AddButton(bmpTnStartOff, bmpTnStartOffDisabled, TTB_StartOff, AddButton(this, bmpTnStartOff, bmpTnStartOffDisabled, TTB_StartOff,
TRANSLATABLE("Adjust left selection to next offset")); TRANSLATABLE("Adjust left selection to next offset"));
AddButton(bmpTnEndOff, bmpTnEndOffDisabled, TTB_EndOff, AddButton(this, bmpTnEndOff, bmpTnEndOffDisabled, TTB_EndOff,
TRANSLATABLE("Adjust right selection to previous onset")); TRANSLATABLE("Adjust right selection to previous onset"));
AddButton(bmpTnSelectSound, bmpTnSelectSoundDisabled, TTB_SelectSound, AddButton(this, bmpTnSelectSound, bmpTnSelectSoundDisabled, TTB_SelectSound,
TRANSLATABLE("Select region of sound around cursor")); TRANSLATABLE("Select region of sound around cursor"));
AddButton(bmpTnSelectSilence, bmpTnSelectSilenceDisabled, TTB_SelectSilence, AddButton(this, bmpTnSelectSilence, bmpTnSelectSilenceDisabled, TTB_SelectSilence,
TRANSLATABLE("Select region of silence around cursor")); TRANSLATABLE("Select region of silence around cursor"));
AddButton(bmpTnAutomateSelection, bmpTnAutomateSelectionDisabled, TTB_AutomateSelection, AddButton(this, bmpTnAutomateSelection, bmpTnAutomateSelectionDisabled, TTB_AutomateSelection,
TRANSLATABLE("Automatically make labels from words")); TRANSLATABLE("Automatically make labels from words"));
AddButton(bmpTnMakeTag, bmpTnMakeTagDisabled, TTB_MakeLabel, AddButton(this, bmpTnMakeTag, bmpTnMakeTagDisabled, TTB_MakeLabel,
TRANSLATABLE("Add label at selection")); TRANSLATABLE("Add label at selection"));
AddButton(bmpTnCalibrate, bmpTnCalibrateDisabled, TTB_Calibrate, AddButton(this, bmpTnCalibrate, bmpTnCalibrateDisabled, TTB_Calibrate,
TRANSLATABLE("Calibrate voicekey")); TRANSLATABLE("Calibrate voicekey"));
mSensitivitySlider = safenew ASlider(this, mSensitivitySlider = safenew ASlider(this,

View File

@ -122,7 +122,8 @@ class TranscriptionToolBar final : public ToolBar {
private: private:
void InitializeTranscriptionToolBar(); void InitializeTranscriptionToolBar();
AButton *AddButton( static AButton *AddButton(
TranscriptionToolBar *pBar,
teBmps eFore, teBmps eDisabled, teBmps eFore, teBmps eDisabled,
int id, int id,
const wxChar *label); const wxChar *label);

View File

@ -215,9 +215,8 @@ SliderDialog::SliderDialog(wxWindow * parent, wxWindowID id,
title, title,
wxDefaultPosition, wxDefaultPosition,
size, size,
style, ASlider::Options{}
false); .Style( style ).Line( line ).Page( page ) );
mSlider->SetScroll(line, page);
S.AddWindow(mSlider, wxEXPAND); S.AddWindow(mSlider, wxEXPAND);
} }
S.EndVerticalLay(); S.EndVerticalLay();
@ -1557,11 +1556,7 @@ ASlider::ASlider( wxWindow * parent,
const wxString &name, const wxString &name,
const wxPoint & pos, const wxPoint & pos,
const wxSize & size, const wxSize & size,
int style, const Options &options)
bool popup,
bool canUseShift,
float stepValue,
int orientation /*= wxHORIZONTAL*/)
: wxPanel( parent, id, pos, size, wxWANTS_CHARS ) : wxPanel( parent, id, pos, size, wxWANTS_CHARS )
{ {
//wxColour Col(parent->GetBackgroundColour()); //wxColour Col(parent->GetBackgroundColour());
@ -1571,23 +1566,25 @@ ASlider::ASlider( wxWindow * parent,
name, name,
wxPoint(0,0), wxPoint(0,0),
size, size,
style, options.style,
canUseShift, options.canUseShift,
popup, options.popup,
orientation); options.orientation);
mLWSlider->mStepValue = stepValue; mLWSlider->mStepValue = options.stepValue;
mLWSlider->SetId( id ); mLWSlider->SetId( id );
SetName( name ); SetName( name );
mSliderIsFocused = false; mSliderIsFocused = false;
mStyle = style; mStyle = options.style;
mTimer.SetOwner(this); mTimer.SetOwner(this);
#if wxUSE_ACCESSIBILITY #if wxUSE_ACCESSIBILITY
SetAccessible( safenew ASliderAx( this ) ); SetAccessible( safenew ASliderAx( this ) );
#endif #endif
mLWSlider->SetScroll( options.line, options.page );
} }

View File

@ -244,16 +244,35 @@ class ASlider /* not final */ : public wxPanel
friend class ASliderAx; friend class ASliderAx;
public: public:
struct Options {
Options() {}
int style{ FRAC_SLIDER };
wxOrientation orientation{ wxHORIZONTAL };
bool popup{ true };
bool canUseShift{ true };
float stepValue{ STEP_CONTINUOUS };
float line{ 1.0 };
float page{ 5.0 };
Options& Style( int s ) { style = s; return *this; }
Options& Orientation( wxOrientation o )
{ orientation = o; return *this; }
Options& Popup( bool p ) { popup = p; return *this; }
Options& CanUseShift( bool c ) { canUseShift = c; return *this; }
Options& StepValue( float v ) { stepValue = v; return *this; }
Options& Line( float l ) { line = l; return *this; }
Options& Page( float p ) { page = p; return *this; }
};
ASlider( wxWindow * parent, ASlider( wxWindow * parent,
wxWindowID id, wxWindowID id,
const wxString &name, const wxString &name,
const wxPoint & pos, const wxPoint & pos,
const wxSize & size, const wxSize & size,
int style = FRAC_SLIDER, const Options &options = Options{});
bool popup = true,
bool canUseShift = true,
float stepValue = STEP_CONTINUOUS,
int orientation = wxHORIZONTAL);
virtual ~ASlider(); virtual ~ASlider();
bool AcceptsFocus() const override { return s_AcceptsFocus; } bool AcceptsFocus() const override { return s_AcceptsFocus; }

View File

@ -44,16 +44,17 @@ NumericEditor::~NumericEditor()
void NumericEditor::Create(wxWindow *parent, wxWindowID id, wxEvtHandler *handler) void NumericEditor::Create(wxWindow *parent, wxWindowID id, wxEvtHandler *handler)
{ {
wxASSERT(parent); // to justify safenew wxASSERT(parent); // to justify safenew
auto control = safenew NumericTextCtrl(mType, parent, auto control = safenew NumericTextCtrl(
wxID_ANY, parent, wxID_ANY,
mFormat, mType,
mOld, mFormat,
mRate, mOld,
wxDefaultPosition, mRate,
wxDefaultSize, NumericTextCtrl::Options{}
true); .AutoPos(true)
if (mType == NumericTextCtrl::FREQUENCY) .InvalidValue(mType == NumericTextCtrl::FREQUENCY,
control->SetInvalidValue(SelectedRegion::UndefinedFrequency); SelectedRegion::UndefinedFrequency)
);
m_control = control; m_control = control;
wxGridCellEditor::Create(parent, id, handler); wxGridCellEditor::Create(parent, id, handler);
@ -174,14 +175,13 @@ void NumericRenderer::Draw(wxGrid &grid,
table->GetValue(row, col).ToDouble(&value); table->GetValue(row, col).ToDouble(&value);
NumericTextCtrl tt(mType, &grid, NumericTextCtrl tt(&grid, wxID_ANY,
wxID_ANY, mType,
ne->GetFormat(), ne->GetFormat(),
value, value,
ne->GetRate(), ne->GetRate(),
wxPoint(10000, 10000), // create offscreen NumericTextCtrl::Options{}.AutoPos(true),
wxDefaultSize, wxPoint(10000, 10000)); // create offscreen
true);
tstr = tt.GetString(); tstr = tt.GetString();
ne->DecRef(); ne->DecRef();
@ -231,14 +231,13 @@ wxSize NumericRenderer::GetBestSize(wxGrid &grid,
if (ne) { if (ne) {
double value; double value;
table->GetValue(row, col).ToDouble(&value); table->GetValue(row, col).ToDouble(&value);
NumericTextCtrl tt(mType, &grid, NumericTextCtrl tt(&grid, wxID_ANY,
wxID_ANY, mType,
ne->GetFormat(), ne->GetFormat(),
value, value,
ne->GetRate(), ne->GetRate(),
wxPoint(10000, 10000), // create offscreen NumericTextCtrl::Options{}.AutoPos(true),
wxDefaultSize, wxPoint(10000, 10000)); // create offscreen
true);
sz = tt.GetSize(); sz = tt.GetSize();
ne->DecRef(); ne->DecRef();

View File

@ -1239,22 +1239,21 @@ END_EVENT_TABLE()
IMPLEMENT_CLASS(NumericTextCtrl, wxControl) IMPLEMENT_CLASS(NumericTextCtrl, wxControl)
NumericTextCtrl::NumericTextCtrl(NumericConverter::Type type, NumericTextCtrl::NumericTextCtrl(wxWindow *parent, wxWindowID id,
wxWindow *parent, NumericConverter::Type type,
wxWindowID id,
const wxString &formatName, const wxString &formatName,
double timeValue, double timeValue,
double sampleRate, double sampleRate,
const Options &options,
const wxPoint &pos, const wxPoint &pos,
const wxSize &size, const wxSize &size):
bool autoPos):
wxControl(parent, id, pos, size, wxSUNKEN_BORDER | wxWANTS_CHARS), wxControl(parent, id, pos, size, wxSUNKEN_BORDER | wxWANTS_CHARS),
NumericConverter(type, formatName, timeValue, sampleRate), NumericConverter(type, formatName, timeValue, sampleRate),
mBackgroundBitmap{}, mBackgroundBitmap{},
mDigitFont{}, mDigitFont{},
mLabelFont{}, mLabelFont{},
mLastField(1), mLastField(1),
mAutoPos(autoPos) mAutoPos(options.autoPos)
, mType(type) , mType(type)
{ {
mAllowInvalidValue = false; mAllowInvalidValue = false;
@ -1262,8 +1261,8 @@ NumericTextCtrl::NumericTextCtrl(NumericConverter::Type type,
mDigitBoxW = 10; mDigitBoxW = 10;
mDigitBoxH = 16; mDigitBoxH = 16;
mReadOnly = false; mReadOnly = options.readOnly;
mMenuEnabled = true; mMenuEnabled = options.menuEnabled;
mButtonWidth = 9; mButtonWidth = 9;
Layout(); Layout();
@ -1282,6 +1281,15 @@ NumericTextCtrl::NumericTextCtrl(NumericConverter::Type type,
SetName(wxT("")); SetName(wxT(""));
SetAccessible(safenew NumericTextCtrlAx(this)); SetAccessible(safenew NumericTextCtrlAx(this));
#endif #endif
if (options.hasInvalidValue)
SetInvalidValue( options.invalidValue );
if (!options.format.empty())
SetFormatString( options.format );
if (options.hasValue)
SetValue( options.value );
} }
NumericTextCtrl::~NumericTextCtrl() NumericTextCtrl::~NumericTextCtrl()

View File

@ -145,15 +145,36 @@ class NumericTextCtrl final : public wxControl, public NumericConverter
public: public:
DECLARE_DYNAMIC_CLASS(NumericTextCtrl) DECLARE_DYNAMIC_CLASS(NumericTextCtrl)
NumericTextCtrl(NumericConverter::Type type, struct Options {
wxWindow *parent, bool autoPos { false };
wxWindowID id, bool readOnly { false };
bool menuEnabled { true };
bool hasInvalidValue { false };
double invalidValue { -1.0 };
wxString format {};
bool hasValue { false };
double value{ -1.0 };
Options() {}
Options &AutoPos (bool value) { autoPos = value; return *this; }
Options &ReadOnly (bool value) { readOnly = value; return *this; }
Options &MenuEnabled (bool value) { menuEnabled = value; return *this; }
Options &InvalidValue (bool has, double value = -1.0)
{ hasInvalidValue = has, invalidValue = value; return *this; }
Options &Format (const wxString &value) { format = value; return *this; }
Options &Value (bool has, double v)
{ hasValue = has, value = v; return *this; }
};
NumericTextCtrl(wxWindow *parent, wxWindowID winid,
NumericConverter::Type type,
const wxString &formatName = wxEmptyString, const wxString &formatName = wxEmptyString,
double value = 0.0, double value = 0.0,
double sampleRate = 44100, double sampleRate = 44100,
const Options &options = {},
const wxPoint &pos = wxDefaultPosition, const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize, const wxSize &size = wxDefaultSize);
bool autoPos = false);
virtual ~NumericTextCtrl(); virtual ~NumericTextCtrl();

View File

@ -1606,10 +1606,37 @@ END_EVENT_TABLE()
IMPLEMENT_CLASS(RulerPanel, wxPanelWrapper) IMPLEMENT_CLASS(RulerPanel, wxPanelWrapper)
RulerPanel::RulerPanel(wxWindow* parent, wxWindowID id, RulerPanel::RulerPanel(wxWindow* parent, wxWindowID id,
wxOrientation orientation,
const wxSize &bounds,
const Range &range,
Ruler::RulerFormat format,
const wxString &units,
const Options &options,
const wxPoint& pos /*= wxDefaultPosition*/, const wxPoint& pos /*= wxDefaultPosition*/,
const wxSize& size /*= wxDefaultSize*/): const wxSize& size /*= wxDefaultSize*/):
wxPanelWrapper(parent, id, pos, size) wxPanelWrapper(parent, id, pos, size)
{ {
ruler.SetBounds( 0, 0, bounds.x, bounds.y );
ruler.SetOrientation(orientation);
ruler.SetRange( range.first, range.second );
ruler.SetLog( options.log );
ruler.SetFormat(format);
ruler.SetUnits( units );
ruler.SetFlip( options.flip );
ruler.SetLabelEdges( options.labelEdges );
ruler.mbTicksAtExtremes = options.ticksAtExtremes;
if (orientation == wxVERTICAL) {
wxCoord w;
ruler.GetMaxSize(&w, NULL);
SetMinSize(wxSize(w, 150)); // height needed for wxGTK
}
else if (orientation == wxHORIZONTAL) {
wxCoord h;
ruler.GetMaxSize(NULL, &h);
SetMinSize(wxSize(wxDefaultCoord, h));
}
if (options.hasTickColour)
ruler.SetTickColour( options.tickColour );
} }
RulerPanel::~RulerPanel() RulerPanel::~RulerPanel()

View File

@ -245,7 +245,41 @@ class AUDACITY_DLL_API RulerPanel final : public wxPanelWrapper {
DECLARE_DYNAMIC_CLASS(RulerPanel) DECLARE_DYNAMIC_CLASS(RulerPanel)
public: public:
using Range = std::pair<double, double>;
struct Options {
bool log { false };
bool flip { false };
bool labelEdges { false };
bool ticksAtExtremes { false };
bool hasTickColour{ false };
wxColour tickColour;
Options() {}
Options &Log( bool l )
{ log = l; return *this; }
Options &Flip( bool f )
{ flip = f; return *this; }
Options &LabelEdges( bool l )
{ labelEdges = l; return *this; }
Options &TicksAtExtremes( bool t )
{ ticksAtExtremes = t; return *this; }
Options &TickColour( const wxColour c )
{ tickColour = c; hasTickColour = true; return *this; }
};
RulerPanel(wxWindow* parent, wxWindowID id, RulerPanel(wxWindow* parent, wxWindowID id,
wxOrientation orientation,
const wxSize &bounds,
const Range &range,
Ruler::RulerFormat format,
const wxString &units,
const Options &options = {},
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize); const wxSize& size = wxDefaultSize);