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

View File

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

View File

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

View File

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

View File

@ -56,17 +56,15 @@ void TimeDialog::PopulateOrExchange(ShuttleGui &S)
{
mTimeCtrl = safenew
NumericTextCtrl(
NumericConverter::TIME, this,
wxID_ANY,
this, wxID_ANY,
NumericConverter::TIME,
mFormat,
mTime,
mRate,
wxDefaultPosition,
wxDefaultSize,
true);
NumericTextCtrl::Options{}
.AutoPos(true));
mTimeCtrl->SetName(mPrompt);
S.AddWindow(mTimeCtrl);
mTimeCtrl->EnableMenu();
}
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.
*/
wxString strFormat = _("099 h 060 m 060 s");
using Options = NumericTextCtrl::Options;
S.StartStatic(_("Start Date and Time"), true);
{
m_pDatePickerCtrl_Start =
@ -808,13 +809,14 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
S.AddWindow(m_pDatePickerCtrl_Start);
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->SetFormatString(strFormat);
m_pTimeTextCtrl_Start->
SetValue(wxDateTime_to_AudacityTime(m_DateTime_Start));
S.AddWindow(m_pTimeTextCtrl_Start);
m_pTimeTextCtrl_Start->EnableMenu(false);
}
S.EndStatic();
@ -836,12 +838,14 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
S.AddWindow(m_pDatePickerCtrl_End);
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->SetFormatString(strFormat);
m_pTimeTextCtrl_End->SetValue(wxDateTime_to_AudacityTime(m_DateTime_End));
S.AddWindow(m_pTimeTextCtrl_End);
m_pTimeTextCtrl_End->EnableMenu(false);
}
S.EndStatic();
@ -856,12 +860,15 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
* seconds.
*/
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->SetFormatString(strFormat1);
m_pTimeTextCtrl_Duration->SetValue(m_TimeSpan_Duration.GetSeconds().ToDouble());
S.AddWindow(m_pTimeTextCtrl_Duration);
m_pTimeTextCtrl_Duration->EnableMenu(false);
}
S.EndStatic();
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2836,17 +2836,14 @@ void VSTEffect::BuildPlain()
wxControl *item = safenew wxStaticText(scroller, 0, _("Duration:"));
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
mDuration = safenew
NumericTextCtrl(NumericConverter::TIME,
scroller,
ID_Duration,
NumericTextCtrl(scroller, ID_Duration,
NumericConverter::TIME,
mHost->GetDurationFormat(),
mHost->GetDuration(),
mSampleRate,
wxDefaultPosition,
wxDefaultSize,
true);
NumericTextCtrl::Options{}
.AutoPos(true));
mDuration->SetName(_("Duration"));
mDuration->EnableMenu();
gridSizer->Add(mDuration, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
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:"));
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
mDuration = safenew
NumericTextCtrl(NumericConverter::TIME,
w,
ID_Duration,
NumericTextCtrl(w, ID_Duration,
NumericConverter::TIME,
mHost->GetDurationFormat(),
mHost->GetDuration(),
mSampleRate,
wxDefaultPosition,
wxDefaultSize,
true);
NumericTextCtrl::Options{}
.AutoPos(true));
mDuration->SetName(_("Duration"));
mDuration->EnableMenu();
gridSizer->Add(mDuration, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
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:"));
sizer->Add(item, 0, wxALIGN_CENTER | wxALL, 5);
mDuration = safenew
NumericTextCtrl(NumericConverter::TIME,
w,
ID_Duration,
NumericTextCtrl(w, ID_Duration,
NumericConverter::TIME,
mHost->GetDurationFormat(),
mHost->GetDuration(),
mSampleRate,
wxDefaultPosition,
wxDefaultSize,
true);
NumericTextCtrl::Options{}
.AutoPos(true));
mDuration->SetName(_("Duration"));
mDuration->EnableMenu();
sizer->Add(mDuration, 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)
END_EVENT_TABLE()
ExportMixerPanel::ExportMixerPanel( MixerSpec *mixerSpec,
wxArrayString trackNames,wxWindow *parent, wxWindowID id,
ExportMixerPanel::ExportMixerPanel( wxWindow *parent, wxWindowID id,
MixerSpec *mixerSpec,
wxArrayString trackNames,
const wxPoint& pos, const wxSize& size):
wxPanelWrapper(parent, id, pos, size)
, mMixerSpec{mixerSpec}
@ -1311,8 +1312,9 @@ ExportMixerDialog::ExportMixerDialog( const TrackList *tracks, bool selectedOnly
auto uVertSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
vertSizer = uVertSizer.get();
wxWindow *mixerPanel = safenew ExportMixerPanel(mMixerSpec.get(), mTrackNames, this,
ID_MIXERPANEL, wxDefaultPosition, wxSize(400, -1));
wxWindow *mixerPanel = safenew ExportMixerPanel(this, ID_MIXERPANEL,
mMixerSpec.get(), mTrackNames,
wxDefaultPosition, wxSize(400, -1));
mixerPanel->SetName(_("Mixer Panel"));
vertSizer->Add(mixerPanel, 1, wxEXPAND | wxALIGN_CENTRE | wxALL, 5);

View File

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

View File

@ -32,8 +32,8 @@ BEGIN_EVENT_TABLE(BatchPrefs, PrefsPanel)
END_EVENT_TABLE()
/// Constructor
BatchPrefs::BatchPrefs(wxWindow * parent):
PrefsPanel(parent, _("Batch"))
BatchPrefs::BatchPrefs(wxWindow * parent, wxWindowID winid):
PrefsPanel(parent, winid, _("Batch"))
{
Populate();
}
@ -83,8 +83,8 @@ BatchPrefs::~BatchPrefs()
{
}
PrefsPanel *BatchPrefsFactory::Create(wxWindow *parent)
PrefsPanel *BatchPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{
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
{
public:
BatchPrefs(wxWindow * parent);
BatchPrefs(wxWindow * parent, wxWindowID winid);
~BatchPrefs();
bool Commit() override;
@ -37,6 +37,6 @@ private:
class BatchPrefsFactory final : public PrefsPanelFactory
{
public:
PrefsPanel *Create(wxWindow *parent) override;
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
};
#endif

View File

@ -52,8 +52,8 @@ BEGIN_EVENT_TABLE(DevicePrefs, PrefsPanel)
EVT_CHOICE(RecordID, DevicePrefs::OnDevice)
END_EVENT_TABLE()
DevicePrefs::DevicePrefs(wxWindow * parent)
: PrefsPanel(parent, _("Devices"))
DevicePrefs::DevicePrefs(wxWindow * parent, wxWindowID winid)
: PrefsPanel(parent, winid, _("Devices"))
{
Populate();
}
@ -414,8 +414,8 @@ wxString DevicePrefs::HelpPageName()
return "Devices_Preferences";
}
PrefsPanel *DevicePrefsFactory::Create(wxWindow *parent)
PrefsPanel *DevicePrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{
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
{
public:
DevicePrefs(wxWindow * parent);
DevicePrefs(wxWindow * parent, wxWindowID winid);
virtual ~DevicePrefs();
bool Commit() override;
wxString HelpPageName() override;
@ -58,7 +58,7 @@ class DevicePrefs final : public PrefsPanel
class DevicePrefsFactory final : public PrefsPanelFactory
{
public:
PrefsPanel *Create(wxWindow *parent) override;
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
};
#endif

View File

@ -48,9 +48,9 @@ BEGIN_EVENT_TABLE(DirectoriesPrefs, PrefsPanel)
EVT_BUTTON(ChooseButtonID, DirectoriesPrefs::OnChooseTempDir)
END_EVENT_TABLE()
DirectoriesPrefs::DirectoriesPrefs(wxWindow * parent)
DirectoriesPrefs::DirectoriesPrefs(wxWindow * parent, wxWindowID winid)
/* i18n-hint: Directories, also called folders, in computer file systems */
: PrefsPanel(parent, _("Directories")),
: PrefsPanel(parent, winid, _("Directories")),
mFreeSpace(NULL),
mTempDir(NULL)
{
@ -273,8 +273,8 @@ wxString DirectoriesPrefs::HelpPageName()
return "Directories_Preferences";
}
PrefsPanel *DirectoriesPrefsFactory::Create(wxWindow *parent)
PrefsPanel *DirectoriesPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{
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
{
public:
DirectoriesPrefs(wxWindow * parent);
DirectoriesPrefs(wxWindow * parent, wxWindowID winid);
~DirectoriesPrefs();
bool Commit() override;
bool Validate() override;
@ -42,6 +42,6 @@ class DirectoriesPrefs final : public PrefsPanel
class DirectoriesPrefsFactory final : public PrefsPanelFactory
{
public:
PrefsPanel *Create(wxWindow *parent) override;
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
};
#endif

View File

@ -32,8 +32,8 @@
#include "../Experimental.h"
#include "../Internat.h"
EffectsPrefs::EffectsPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Effects"))
EffectsPrefs::EffectsPrefs(wxWindow * parent, wxWindowID winid)
: PrefsPanel(parent, winid, _("Effects"))
{
Populate();
}
@ -176,8 +176,8 @@ wxString EffectsPrefs::HelpPageName()
return "Effects_Preferences";
}
PrefsPanel *EffectsPrefsFactory::Create(wxWindow *parent)
PrefsPanel *EffectsPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{
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
{
public:
EffectsPrefs(wxWindow * parent);
EffectsPrefs(wxWindow * parent, wxWindowID winid);
~EffectsPrefs();
bool Commit() override;
wxString HelpPageName() override;
@ -38,6 +38,6 @@ class EffectsPrefs final : public PrefsPanel
class EffectsPrefsFactory final : public PrefsPanelFactory
{
public:
PrefsPanel *Create(wxWindow *parent) override;
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
};
#endif

View File

@ -56,10 +56,10 @@ BEGIN_EVENT_TABLE(ExtImportPrefs, PrefsPanel)
EVT_BUTTON(EIPMoveFilterDown,ExtImportPrefs::OnFilterMoveDown)
END_EVENT_TABLE()
ExtImportPrefs::ExtImportPrefs(wxWindow * parent)
ExtImportPrefs::ExtImportPrefs(wxWindow * parent, wxWindowID winid)
/* i18n-hint: Title of dialog governing "Extended", or "advanced,"
* audio file import options */
: PrefsPanel(parent, _("Extended Import")), RuleTable(NULL),
: PrefsPanel(parent, winid, _("Extended Import")), RuleTable(NULL),
PluginList(NULL), mCreateTable (false), mDragFocus (NULL),
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
return safenew ExtImportPrefs(parent);
return safenew ExtImportPrefs(parent, winid);
}

View File

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

View File

@ -36,9 +36,9 @@
#include "../AColor.h"
#include "../Internat.h"
GUIPrefs::GUIPrefs(wxWindow * parent)
GUIPrefs::GUIPrefs(wxWindow * parent, wxWindowID winid)
/* i18n-hint: refers to Audacity's user interface settings */
: PrefsPanel(parent, _("Interface"))
: PrefsPanel(parent, winid, _("Interface"))
{
Populate();
}
@ -233,8 +233,8 @@ wxString GUIPrefs::HelpPageName()
return "Interface_Preferences";
}
PrefsPanel *GUIPrefsFactory::Create(wxWindow *parent)
PrefsPanel *GUIPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{
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
{
public:
GUIPrefs(wxWindow * parent);
GUIPrefs(wxWindow * parent, wxWindowID winid);
~GUIPrefs();
bool Commit() override;
wxString HelpPageName() override;
@ -52,6 +52,6 @@ class GUIPrefs final : public PrefsPanel
class GUIPrefsFactory final : public PrefsPanelFactory
{
public:
PrefsPanel *Create(wxWindow *parent) override;
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
};
#endif

View File

@ -25,8 +25,8 @@
#include "ImportExportPrefs.h"
#include "../Internat.h"
ImportExportPrefs::ImportExportPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Import / Export"))
ImportExportPrefs::ImportExportPrefs(wxWindow * parent, wxWindowID winid)
: PrefsPanel(parent, winid, _("Import / Export"))
{
Populate();
}
@ -118,8 +118,8 @@ wxString ImportExportPrefs::HelpPageName()
return "Import_-_Export_Preferences";
}
PrefsPanel *ImportExportPrefsFactory::Create(wxWindow *parent)
PrefsPanel *ImportExportPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{
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
{
public:
ImportExportPrefs(wxWindow * parent);
ImportExportPrefs(wxWindow * parent, wxWindowID winid);
~ImportExportPrefs();
bool Commit() override;
wxString HelpPageName() override;
@ -37,6 +37,6 @@ class ImportExportPrefs final : public PrefsPanel
class ImportExportPrefsFactory final : public PrefsPanelFactory
{
public:
PrefsPanel *Create(wxWindow *parent) override;
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
};
#endif

View File

@ -72,9 +72,10 @@ BEGIN_EVENT_TABLE(KeyConfigPrefs, PrefsPanel)
EVT_TIMER(FilterTimerID, KeyConfigPrefs::OnFilterTimer)
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!) */
: PrefsPanel(parent, _("Keyboard")),
: PrefsPanel(parent, winid, _("Keyboard")),
mView(NULL),
mKey(NULL),
mFilter(NULL),
@ -749,9 +750,9 @@ wxString KeyConfigPrefs::HelpPageName()
return "Keyboard_Preferences";
}
PrefsPanel *KeyConfigPrefsFactory::Create(wxWindow *parent)
PrefsPanel *KeyConfigPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{
wxASSERT(parent); // to justify safenew
auto result = safenew KeyConfigPrefs{ parent, mName };
auto result = safenew KeyConfigPrefs{ parent, winid, mName };
return result;
}

View File

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

View File

@ -46,9 +46,9 @@ BEGIN_EVENT_TABLE(LibraryPrefs, PrefsPanel)
EVT_BUTTON(ID_FFMPEG_DOWN_BUTTON, LibraryPrefs::OnFFmpegDownButton)
END_EVENT_TABLE()
LibraryPrefs::LibraryPrefs(wxWindow * parent)
LibraryPrefs::LibraryPrefs(wxWindow * parent, wxWindowID winid)
/* i18-hint: refers to optional plug-in software libraries */
: PrefsPanel(parent, _("Libraries"))
: PrefsPanel(parent, winid, _("Libraries"))
{
Populate();
}
@ -250,8 +250,8 @@ wxString LibraryPrefs::HelpPageName()
return "Libraries_Preferences";
}
PrefsPanel *LibraryPrefsFactory::Create(wxWindow *parent)
PrefsPanel *LibraryPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{
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
{
public:
LibraryPrefs(wxWindow * parent);
LibraryPrefs(wxWindow * parent, wxWindowID winid);
~LibraryPrefs();
bool Commit() override;
wxString HelpPageName() override;
@ -50,6 +50,6 @@ class LibraryPrefs final : public PrefsPanel
class LibraryPrefsFactory final : public PrefsPanelFactory
{
public:
PrefsPanel *Create(wxWindow *parent) override;
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
};
#endif

View File

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

View File

@ -29,7 +29,7 @@ class ShuttleGui;
class MidiIOPrefs final : public PrefsPanel
{
public:
MidiIOPrefs(wxWindow * parent);
MidiIOPrefs(wxWindow * parent, wxWindowID winid);
virtual ~MidiIOPrefs();
bool Commit() override;
bool Validate() override;
@ -66,7 +66,7 @@ class MidiIOPrefs final : public PrefsPanel
class MidiIOPrefsFactory final : public PrefsPanelFactory
{
public:
PrefsPanel *Create(wxWindow *parent) override;
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
};
#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.*/
ModulePrefs::ModulePrefs(wxWindow * parent)
: PrefsPanel(parent, _("Modules"))
ModulePrefs::ModulePrefs(wxWindow * parent, wxWindowID winid)
: PrefsPanel(parent, winid, _("Modules"))
{
Populate();
}
@ -168,8 +168,8 @@ wxString ModulePrefs::HelpPageName()
return "Modules_Preferences";
}
PrefsPanel *ModulePrefsFactory::Create(wxWindow *parent)
PrefsPanel *ModulePrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{
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
{
public:
ModulePrefs(wxWindow * parent);
ModulePrefs(wxWindow * parent, wxWindowID winid);
~ModulePrefs();
bool Commit() override;
wxString HelpPageName() override;
@ -54,6 +54,6 @@ class ModulePrefs final : public PrefsPanel
class ModulePrefsFactory final : public PrefsPanelFactory
{
public:
PrefsPanel *Create(wxWindow *parent) override;
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
};
#endif

View File

@ -61,8 +61,8 @@ enum
#endif
/// Constructor
MousePrefs::MousePrefs(wxWindow * parent)
: PrefsPanel(parent, _("Mouse"))
MousePrefs::MousePrefs(wxWindow * parent, wxWindowID winid)
: PrefsPanel(parent, winid, _("Mouse"))
{
Populate();
}
@ -203,8 +203,8 @@ wxString MousePrefs::HelpPageName()
return "Mouse_Preferences";
}
PrefsPanel *MousePrefsFactory::Create(wxWindow *parent)
PrefsPanel *MousePrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{
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
{
public:
MousePrefs(wxWindow * parent);
MousePrefs(wxWindow * parent, wxWindowID winid);
~MousePrefs();
bool Commit() override;
wxString HelpPageName() override;
@ -42,6 +42,6 @@ class MousePrefs final : public PrefsPanel
class MousePrefsFactory final : public PrefsPanelFactory
{
public:
PrefsPanel *Create(wxWindow *parent) override;
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
};
#endif

View File

@ -28,8 +28,8 @@
#include "../Prefs.h"
#include "../Internat.h"
PlaybackPrefs::PlaybackPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Playback"))
PlaybackPrefs::PlaybackPrefs(wxWindow * parent, wxWindowID winid)
: PrefsPanel(parent, winid, _("Playback"))
{
Populate();
}
@ -132,9 +132,9 @@ wxString PlaybackPrefs::HelpPageName()
return "Playback_Preferences";
}
PrefsPanel *PlaybackPrefsFactory::Create(wxWindow *parent)
PrefsPanel *PlaybackPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{
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
{
public:
PlaybackPrefs(wxWindow * parent);
PlaybackPrefs(wxWindow * parent, wxWindowID winid);
virtual ~PlaybackPrefs();
bool Commit() override;
wxString HelpPageName() override;
@ -36,7 +36,7 @@ class PlaybackPrefs final : public PrefsPanel
class PlaybackPrefsFactory final : public PrefsPanelFactory
{
public:
PrefsPanel *Create(wxWindow *parent) override;
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
};
#endif

View File

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

View File

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

View File

@ -29,8 +29,8 @@ handling.
////////////////////////////////////////////////////////////////////////////////
ProjectsPrefs::ProjectsPrefs(wxWindow * parent)
: PrefsPanel(parent,
ProjectsPrefs::ProjectsPrefs(wxWindow * parent, wxWindowID winid)
: PrefsPanel(parent, winid,
/* i18n-hint: (noun) i.e Audacity projects. */
_("Projects"))
{
@ -89,8 +89,8 @@ wxString ProjectsPrefs::HelpPageName()
return "Projects_Preferences";
}
PrefsPanel *ProjectsPrefsFactory::Create(wxWindow *parent)
PrefsPanel *ProjectsPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{
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
{
public:
ProjectsPrefs(wxWindow * parent);
ProjectsPrefs(wxWindow * parent, wxWindowID winid);
~ProjectsPrefs();
bool Commit() override;
wxString HelpPageName() override;
@ -37,6 +37,6 @@ class ProjectsPrefs final : public PrefsPanel
class ProjectsPrefsFactory final : public PrefsPanelFactory
{
public:
PrefsPanel *Create(wxWindow *parent) override;
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
};
#endif

View File

@ -34,9 +34,9 @@ BEGIN_EVENT_TABLE(QualityPrefs, PrefsPanel)
EVT_CHOICE(ID_SAMPLE_RATE_CHOICE, QualityPrefs::OnSampleRateChoice)
END_EVENT_TABLE()
QualityPrefs::QualityPrefs(wxWindow * parent)
QualityPrefs::QualityPrefs(wxWindow * parent, wxWindowID winid)
/* i18n-hint: meaning accuracy in reproduction of sounds */
: PrefsPanel(parent, _("Quality"))
: PrefsPanel(parent, winid, _("Quality"))
{
Populate();
}
@ -240,8 +240,8 @@ wxString QualityPrefs::HelpPageName()
return "Quality_Preferences";
}
PrefsPanel *QualityPrefsFactory::Create(wxWindow *parent)
PrefsPanel *QualityPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{
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
{
public:
QualityPrefs(wxWindow * parent);
QualityPrefs(wxWindow * parent, wxWindowID winid);
virtual ~QualityPrefs();
bool Commit() override;
@ -57,6 +57,6 @@ class QualityPrefs final : public PrefsPanel
class QualityPrefsFactory final : public PrefsPanelFactory
{
public:
PrefsPanel *Create(wxWindow *parent) override;
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
};
#endif

View File

@ -45,8 +45,8 @@ BEGIN_EVENT_TABLE(RecordingPrefs, PrefsPanel)
EVT_CHECKBOX(UseCustomTrackNameID, RecordingPrefs::OnToggleCustomName)
END_EVENT_TABLE()
RecordingPrefs::RecordingPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Recording"))
RecordingPrefs::RecordingPrefs(wxWindow * parent, wxWindowID winid)
: PrefsPanel(parent, winid, _("Recording"))
{
gPrefs->Read(wxT("/GUI/TrackNames/RecordingNameCustom"), &mUseCustomTrackName, false);
mOldNameChoice = mUseCustomTrackName;
@ -268,8 +268,8 @@ wxString RecordingPrefs::HelpPageName()
return "Recording_Preferences";
}
PrefsPanel *RecordingPrefsFactory::Create(wxWindow *parent)
PrefsPanel *RecordingPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{
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
{
public:
RecordingPrefs(wxWindow * parent);
RecordingPrefs(wxWindow * parent, wxWindowID winid);
virtual ~RecordingPrefs();
bool Commit() override;
wxString HelpPageName() override;
@ -44,6 +44,6 @@ class RecordingPrefs final : public PrefsPanel
class RecordingPrefsFactory final : public PrefsPanelFactory
{
public:
PrefsPanel *Create(wxWindow *parent) override;
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
};
#endif

View File

@ -33,8 +33,8 @@
#include "../Experimental.h"
#include "../widgets/ErrorDialog.h"
SpectrumPrefs::SpectrumPrefs(wxWindow * parent, WaveTrack *wt)
: PrefsPanel(parent, wt ? _("Spectrogram Settings") : _("Spectrograms"))
SpectrumPrefs::SpectrumPrefs(wxWindow * parent, wxWindowID winid, WaveTrack *wt)
: PrefsPanel(parent, winid, wt ? _("Spectrogram Settings") : _("Spectrograms"))
, mWt(wt)
, 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
return safenew SpectrumPrefs(parent, mWt);
return safenew SpectrumPrefs(parent, winid, mWt);
}

View File

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

View File

@ -56,12 +56,12 @@ BEGIN_EVENT_TABLE(ThemePrefs, PrefsPanel)
EVT_BUTTON(idSaveThemeAsCode, ThemePrefs::OnSaveThemeAsCode)
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
graphical user interface, including choices of colors, and similarity of images
such as those on button controls. Audacity can load and save alternative
themes. */
: PrefsPanel(parent, _("Theme"))
: PrefsPanel(parent, winid, _("Theme"))
{
Populate();
}
@ -201,8 +201,8 @@ bool ThemePrefs::Commit()
return true;
}
PrefsPanel *ThemePrefsFactory::Create(wxWindow *parent)
PrefsPanel *ThemePrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{
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
{
public:
ThemePrefs(wxWindow * parent);
ThemePrefs(wxWindow * parent, wxWindowID winid);
~ThemePrefs(void);
bool Commit() override;
@ -44,6 +44,6 @@ class ThemePrefs final : public PrefsPanel
class ThemePrefsFactory final : public PrefsPanelFactory
{
public:
PrefsPanel *Create(wxWindow *parent) override;
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
};
#endif

View File

@ -22,9 +22,9 @@
#include "../Experimental.h"
#include "../Internat.h"
TracksBehaviorsPrefs::TracksBehaviorsPrefs(wxWindow * parent)
TracksBehaviorsPrefs::TracksBehaviorsPrefs(wxWindow * parent, wxWindowID winid)
/* i18n-hint: two nouns */
: PrefsPanel(parent, _("Tracks Behaviors"))
: PrefsPanel(parent, winid, _("Tracks Behaviors"))
{
Populate();
}
@ -125,8 +125,8 @@ TracksBehaviorsPrefsFactory::TracksBehaviorsPrefsFactory()
{
}
PrefsPanel *TracksBehaviorsPrefsFactory::Create(wxWindow *parent)
PrefsPanel *TracksBehaviorsPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{
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
{
public:
TracksBehaviorsPrefs(wxWindow * parent);
TracksBehaviorsPrefs(wxWindow * parent, wxWindowID winid);
~TracksBehaviorsPrefs();
bool Commit() override;
wxString HelpPageName() override;
@ -41,7 +41,7 @@ class TracksBehaviorsPrefsFactory final : public PrefsPanelFactory
{
public:
explicit TracksBehaviorsPrefsFactory();
PrefsPanel *Create(wxWindow *parent) override;
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
};
#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
* data associated with a time line, such as sequences of labels, and musical
* notes */
: PrefsPanel(parent, _("Tracks"))
: PrefsPanel(parent, winid, _("Tracks"))
{
// Bugs 1043, 1044
// First rewrite legacy preferences
@ -239,8 +239,8 @@ wxString TracksPrefs::HelpPageName()
return "Tracks_Preferences";
}
PrefsPanel *TracksPrefsFactory::Create(wxWindow *parent)
PrefsPanel *TracksPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{
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
{
public:
TracksPrefs(wxWindow * parent);
TracksPrefs(wxWindow * parent, wxWindowID winid);
~TracksPrefs();
bool Commit() override;
wxString HelpPageName() override;
@ -52,6 +52,6 @@ class TracksPrefs final : public PrefsPanel
class TracksPrefsFactory final : public PrefsPanelFactory
{
public:
PrefsPanel *Create(wxWindow *parent) override;
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
};
#endif

View File

@ -28,8 +28,8 @@
////////////////////////////////////////////////////////////////////////////////
WarningsPrefs::WarningsPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Warnings"))
WarningsPrefs::WarningsPrefs(wxWindow * parent, wxWindowID winid)
: PrefsPanel(parent, winid, _("Warnings"))
{
Populate();
}
@ -96,8 +96,8 @@ wxString WarningsPrefs::HelpPageName()
return "Warnings_Preferences";
}
PrefsPanel *WarningsPrefsFactory::Create(wxWindow *parent)
PrefsPanel *WarningsPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{
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
{
public:
WarningsPrefs(wxWindow * parent);
WarningsPrefs(wxWindow * parent, wxWindowID winid);
~WarningsPrefs();
bool Commit() override;
wxString HelpPageName() override;
@ -37,6 +37,6 @@ class WarningsPrefs final : public PrefsPanel
class WarningsPrefsFactory final : public PrefsPanelFactory
{
public:
PrefsPanel *Create(wxWindow *parent) override;
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
};
#endif

View File

@ -26,9 +26,9 @@ Paul Licameli
#include "../ShuttleGui.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 */
: PrefsPanel(parent, _("Waveforms"))
: PrefsPanel(parent, winid, _("Waveforms"))
, mWt(wt)
, 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
return safenew WaveformPrefs(parent, mWt);
return safenew WaveformPrefs(parent, winid, mWt);
}

View File

@ -23,7 +23,7 @@ class wxChoice;
class WaveformPrefs final : public PrefsPanel
{
public:
WaveformPrefs(wxWindow * parent, WaveTrack *wt);
WaveformPrefs(wxWindow * parent, wxWindowID winid, WaveTrack *wt);
virtual ~WaveformPrefs();
bool Commit() override;
bool ShowsPreviewButton() override;
@ -60,7 +60,7 @@ class WaveformPrefsFactory final : public PrefsPanelFactory
{
public:
explicit WaveformPrefsFactory(WaveTrack *wt = 0);
PrefsPanel *Create(wxWindow *parent) override;
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
private:
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
// 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,
bool processdownevents,
const wxChar *label)
{
AButton *r = ToolBar::MakeButton(this,
AButton *r = ToolBar::MakeButton(pBar,
bmpRecoloredUpLarge, bmpRecoloredDownLarge, bmpRecoloredUpHiliteLarge, bmpRecoloredHiliteLarge,
eEnabledUp, eEnabledDown, eDisabled,
wxWindowID(id),
@ -170,10 +171,10 @@ void ControlToolBar::Populate()
SetBackgroundColour( theTheme.Colour( clrMedium ) );
MakeButtonBackgroundsLarge();
mPause = MakeButton(bmpPause, bmpPause, bmpPauseDisabled,
mPause = MakeButton(this, bmpPause, bmpPause, bmpPauseDisabled,
ID_PAUSE_BUTTON, true, _("Pause"));
mPlay = MakeButton( bmpPlay, bmpPlay, bmpPlayDisabled,
mPlay = MakeButton(this, bmpPlay, bmpPlay, bmpPlayDisabled,
ID_PLAY_BUTTON, true, _("Play"));
MakeAlternateImages(*mPlay, 1, bmpLoop, bmpLoop, bmpLoopDisabled);
MakeAlternateImages(*mPlay, 2,
@ -184,16 +185,16 @@ void ControlToolBar::Populate()
bmpSeek, bmpSeek, bmpSeekDisabled);
mPlay->FollowModifierKeys();
mStop = MakeButton( bmpStop, bmpStop, bmpStopDisabled ,
mStop = MakeButton(this, bmpStop, bmpStop, bmpStopDisabled ,
ID_STOP_BUTTON, false, _("Stop"));
mRewind = MakeButton(bmpRewind, bmpRewind, bmpRewindDisabled,
mRewind = MakeButton(this, bmpRewind, bmpRewind, bmpRewindDisabled,
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"));
mRecord = MakeButton(bmpRecord, bmpRecord, bmpRecordDisabled,
mRecord = MakeButton(this, bmpRecord, bmpRecord, bmpRecordDisabled,
ID_RECORD_BUTTON, false, _("Record"));
bool bPreferNewTrack;

View File

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

View File

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

View File

@ -86,7 +86,9 @@ class EditToolBar final : public ToolBar {
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);
void AddSeparator();

View File

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

View File

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

View File

@ -56,7 +56,9 @@ public:
private:
AButton *AddButton(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
static AButton *AddButton(
ScrubbingToolBar *pBar,
teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
int id, const wxChar *label, bool toggle = false);
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 ){
wxString formatName = mListener ? mListener->AS_GetSelectionFormat()
: wxString(wxEmptyString);
NumericTextCtrl * pCtrl = safenew NumericTextCtrl(
NumericConverter::TIME, this, id, formatName, 0.0, mRate);
auto pCtrl = safenew NumericTextCtrl(
this, id, NumericConverter::TIME, formatName, 0.0, mRate);
pCtrl->SetName(Name);
pCtrl->EnableMenu();
pSizer->Add(pCtrl, 0, wxALIGN_TOP | wxRIGHT, 5);
return pCtrl;
}

View File

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

View File

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

View File

@ -70,7 +70,8 @@ class ToolsToolBar final : public ToolBar {
void RegenerateTooltips() override;
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];
wxGridSizer *mToolSizer;

View File

@ -137,13 +137,14 @@ void TranscriptionToolBar::Create(wxWindow * parent)
/// MakeButtons() with fewer arguments
/// Very similar to code in ControlToolBar...
AButton *TranscriptionToolBar::AddButton(
TranscriptionToolBar *pBar,
teBmps eFore, teBmps eDisabled,
int id,
const wxChar *label)
{
AButton *&r = mButtons[id];
AButton *&r = pBar->mButtons[id];
r = ToolBar::MakeButton(this,
r = ToolBar::MakeButton(pBar,
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredUpHiliteSmall,bmpRecoloredHiliteSmall,
eFore, eFore, eDisabled,
wxWindowID(id),
@ -155,7 +156,7 @@ AButton *TranscriptionToolBar::AddButton(
// JKC: Unlike ControlToolBar, does not have a focus rect. Shouldn't it?
// r->SetFocusRect( r->GetRect().Deflate( 4, 4 ) );
Add( r, 0, wxALIGN_CENTER );
pBar->Add( r, 0, wxALIGN_CENTER );
return r;
}
@ -177,7 +178,7 @@ void TranscriptionToolBar::Populate()
// Very similar to code in EditToolBar
MakeButtonBackgroundsSmall();
AddButton(bmpPlay, bmpPlayDisabled, TTB_PlaySpeed,
AddButton(this, bmpPlay, bmpPlayDisabled, TTB_PlaySpeed,
_("Play at selected speed"));
MakeAlternateImages(bmpLoop, bmpLoopDisabled, TTB_PlaySpeed, 1);
MakeAlternateImages(bmpCutPreview, bmpCutPreviewDisabled, TTB_PlaySpeed, 2);
@ -190,11 +191,14 @@ void TranscriptionToolBar::Populate()
_("Playback Speed"),
wxDefaultPosition,
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->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 );
mPlaySpeedSlider->Connect(wxEVT_SET_FOCUS,
wxFocusEventHandler(TranscriptionToolBar::OnFocus),
@ -209,23 +213,23 @@ void TranscriptionToolBar::Populate()
// If we need these strings translated, then search and replace
// TRANSLATBLE by _ and remove this #define.
#define TRANSLATABLE( x ) wxT( x )
AddButton(bmpTnStartOn, bmpTnStartOnDisabled, TTB_StartOn,
AddButton(this, bmpTnStartOn, bmpTnStartOnDisabled, TTB_StartOn,
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"));
AddButton(bmpTnStartOff, bmpTnStartOffDisabled, TTB_StartOff,
AddButton(this, bmpTnStartOff, bmpTnStartOffDisabled, TTB_StartOff,
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"));
AddButton(bmpTnSelectSound, bmpTnSelectSoundDisabled, TTB_SelectSound,
AddButton(this, bmpTnSelectSound, bmpTnSelectSoundDisabled, TTB_SelectSound,
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"));
AddButton(bmpTnAutomateSelection, bmpTnAutomateSelectionDisabled, TTB_AutomateSelection,
AddButton(this, bmpTnAutomateSelection, bmpTnAutomateSelectionDisabled, TTB_AutomateSelection,
TRANSLATABLE("Automatically make labels from words"));
AddButton(bmpTnMakeTag, bmpTnMakeTagDisabled, TTB_MakeLabel,
AddButton(this, bmpTnMakeTag, bmpTnMakeTagDisabled, TTB_MakeLabel,
TRANSLATABLE("Add label at selection"));
AddButton(bmpTnCalibrate, bmpTnCalibrateDisabled, TTB_Calibrate,
AddButton(this, bmpTnCalibrate, bmpTnCalibrateDisabled, TTB_Calibrate,
TRANSLATABLE("Calibrate voicekey"));
mSensitivitySlider = safenew ASlider(this,

View File

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

View File

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

View File

@ -244,16 +244,35 @@ class ASlider /* not final */ : public wxPanel
friend class ASliderAx;
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,
wxWindowID id,
const wxString &name,
const wxPoint & pos,
const wxSize & size,
int style = FRAC_SLIDER,
bool popup = true,
bool canUseShift = true,
float stepValue = STEP_CONTINUOUS,
int orientation = wxHORIZONTAL);
const Options &options = Options{});
virtual ~ASlider();
bool AcceptsFocus() const override { return s_AcceptsFocus; }

View File

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

View File

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

View File

@ -145,15 +145,36 @@ class NumericTextCtrl final : public wxControl, public NumericConverter
public:
DECLARE_DYNAMIC_CLASS(NumericTextCtrl)
NumericTextCtrl(NumericConverter::Type type,
wxWindow *parent,
wxWindowID id,
struct Options {
bool autoPos { false };
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,
double value = 0.0,
double sampleRate = 44100,
const Options &options = {},
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
bool autoPos = false);
const wxSize &size = wxDefaultSize);
virtual ~NumericTextCtrl();

View File

@ -1606,10 +1606,37 @@ END_EVENT_TABLE()
IMPLEMENT_CLASS(RulerPanel, wxPanelWrapper)
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 wxSize& size /*= wxDefaultSize*/):
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()

View File

@ -245,7 +245,41 @@ class AUDACITY_DLL_API RulerPanel final : public wxPanelWrapper {
DECLARE_DYNAMIC_CLASS(RulerPanel)
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,
wxOrientation orientation,
const wxSize &bounds,
const Range &range,
Ruler::RulerFormat format,
const wxString &units,
const Options &options = {},
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize);