Rewrite AddChoice and TieChoice calls...

... either lifting or inlining array-of-string computations, so fewer statements
are mixed among ShuttleGui method calls
This commit is contained in:
Paul Licameli 2019-02-22 15:15:19 -05:00
parent f07d33f4b5
commit f846c25806
15 changed files with 183 additions and 187 deletions

View File

@ -395,22 +395,22 @@ void DependencyDialog::PopulateOrExchange(ShuttleGui& S)
{ {
S.StartHorizontalLay(wxALIGN_LEFT,0); S.StartHorizontalLay(wxALIGN_LEFT,0);
{ {
wxArrayStringEx choices{
/*i18n-hint: One of the choices of what you want Audacity to do when
* Audacity finds a project depends on another file.*/
_("Ask me") ,
_("Always copy all files (safest)") ,
_("Never copy any files") ,
};
mFutureActionChoice = mFutureActionChoice =
S.Id(FutureActionChoiceID).AddChoice( S.Id(FutureActionChoiceID).AddChoice(
_("Whenever a project depends on other files:"), _("Whenever a project depends on other files:"),
choices, {
/*i18n-hint: One of the choices of what you want Audacity to do when
* Audacity finds a project depends on another file.*/
_("Ask me") ,
_("Always copy all files (safest)") ,
_("Never copy any files") ,
},
0 // "Ask me" 0 // "Ask me"
); );
} }
S.EndHorizontalLay(); S.EndHorizontalLay();
} else }
else
{ {
mFutureActionChoice = NULL; mFutureActionChoice = NULL;
} }

View File

@ -809,6 +809,12 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
int iPostTimerRecordAction = gPrefs->ReadLong("/TimerRecord/PostAction", 0); int iPostTimerRecordAction = gPrefs->ReadLong("/TimerRecord/PostAction", 0);
S.SetBorder(5); S.SetBorder(5);
using Options = NumericTextCtrl::Options;
/* i18n-hint a format string for hours, minutes, and seconds */
auto strFormat = _("099 h 060 m 060 s");
/* i18n-hint a format string for days, hours, minutes, and seconds */
auto strFormat1 = _("099 days 024 h 060 m 060 s");
S.StartMultiColumn(2, wxCENTER); S.StartMultiColumn(2, wxCENTER);
{ {
S.StartVerticalLay(true); S.StartVerticalLay(true);
@ -819,8 +825,6 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
* The 'h' indicates the first number displayed is hours, the 'm' indicates the second number * The 'h' indicates the first number displayed is hours, the 'm' indicates the second number
* 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.
*/ */
auto 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 =
@ -886,7 +890,6 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
* number displayed is minutes, and the 's' indicates that the fourth number displayed is * number displayed is minutes, and the 's' indicates that the fourth number displayed is
* seconds. * seconds.
*/ */
auto strFormat1 = _("099 days 024 h 060 m 060 s");
m_pTimeTextCtrl_Duration = safenew NumericTextCtrl( m_pTimeTextCtrl_Duration = safenew NumericTextCtrl(
S.GetParent(), ID_TIMETEXT_DURATION, NumericConverter::TIME, S.GetParent(), ID_TIMETEXT_DURATION, NumericConverter::TIME,
{}, 0, 44100, {}, 0, 44100,
@ -950,23 +953,17 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
S.StartMultiColumn(1, wxEXPAND); S.StartMultiColumn(1, wxEXPAND);
{ {
S.SetStretchyCol( 0 ); S.SetStretchyCol( 0 );
wxArrayStringEx arrayOptions{
_("Do nothing") ,
_("Exit Audacity") ,
_("Restart system") ,
_("Shutdown system") ,
};
m_sTimerAfterCompleteOptionsArray.push_back(arrayOptions[0]);
m_sTimerAfterCompleteOptionsArray.push_back(arrayOptions[1]);
#ifdef __WINDOWS__
m_sTimerAfterCompleteOptionsArray.push_back(arrayOptions[2]);
m_sTimerAfterCompleteOptionsArray.push_back(arrayOptions[3]);
#endif
m_pTimerAfterCompleteChoiceCtrl = S.AddChoice(_("After Recording completes:"), m_pTimerAfterCompleteChoiceCtrl = S.AddChoice(_("After Recording completes:"),
m_sTimerAfterCompleteOptionsArray, {
iPostTimerRecordAction); _("Do nothing") ,
_("Exit Audacity") ,
#ifdef __WINDOWS__
_("Restart system") ,
_("Shutdown system") ,
#endif
},
iPostTimerRecordAction
);
} }
S.EndMultiColumn(); S.EndMultiColumn();
} }

View File

@ -146,9 +146,6 @@ private:
int m_iAutoExportFilterIndex; int m_iAutoExportFilterIndex;
bool m_bProjectAlreadySaved; bool m_bProjectAlreadySaved;
// Variables for After Timer Recording Option
wxArrayStringEx m_sTimerAfterCompleteOptionsArray;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@ -296,6 +296,21 @@ void EffectChangeSpeed::PopulateOrExchange(ShuttleGui & S)
} }
GetPrivateConfig(GetCurrentSettingsGroup(), wxT("VinylChoice"), mFromVinyl, mFromVinyl); GetPrivateConfig(GetCurrentSettingsGroup(), wxT("VinylChoice"), mFromVinyl, mFromVinyl);
wxASSERT(nVinyl == WXSIZEOF(kVinylStrings));
wxArrayStringEx vinylChoices;
for (int i = 0; i < nVinyl; i++)
{
if (i == kVinyl_NA)
{
vinylChoices.push_back(wxGetTranslation(kVinylStrings[i]));
}
else
{
vinylChoices.push_back(kVinylStrings[i]);
}
}
S.SetBorder(5); S.SetBorder(5);
S.StartVerticalLay(0); S.StartVerticalLay(0);
@ -337,23 +352,9 @@ void EffectChangeSpeed::PopulateOrExchange(ShuttleGui & S)
/* i18n-hint: "rpm" is an English abbreviation meaning "revolutions per minute". */ /* i18n-hint: "rpm" is an English abbreviation meaning "revolutions per minute". */
S.AddUnits(_("Standard Vinyl rpm:")); S.AddUnits(_("Standard Vinyl rpm:"));
wxASSERT(nVinyl == WXSIZEOF(kVinylStrings)); mpChoice_FromVinyl = S.Id(ID_FromVinyl)
/* i18n-hint: changing a quantity "from" one value "to" another */
wxArrayStringEx vinylChoices; .AddChoice(_("from"), vinylChoices);
for (int i = 0; i < nVinyl; i++)
{
if (i == kVinyl_NA)
{
vinylChoices.push_back(wxGetTranslation(kVinylStrings[i]));
}
else
{
vinylChoices.push_back(kVinylStrings[i]);
}
}
mpChoice_FromVinyl =
S.Id(ID_FromVinyl).AddChoice(_("from"), vinylChoices);
mpChoice_FromVinyl->SetName(_("From rpm")); mpChoice_FromVinyl->SetName(_("From rpm"));
mpChoice_FromVinyl->SetSizeHints(100, -1); mpChoice_FromVinyl->SetSizeHints(100, -1);

View File

@ -372,8 +372,9 @@ void EffectDistortion::PopulateOrExchange(ShuttleGui & S)
{ {
S.StartMultiColumn(4, wxCENTER); S.StartMultiColumn(4, wxCENTER);
{ {
auto tableTypes = LocalizedStrings(kTableTypeStrings, nTableTypes); mTypeChoiceCtrl = S.Id(ID_Type)
mTypeChoiceCtrl = S.Id(ID_Type).AddChoice(_("Distortion type:"), tableTypes); .AddChoice(_("Distortion type:"),
LocalizedStrings(kTableTypeStrings, nTableTypes));
mTypeChoiceCtrl->SetValidator(wxGenericValidator(&mParams.mTableChoiceIndx)); mTypeChoiceCtrl->SetValidator(wxGenericValidator(&mParams.mTableChoiceIndx));
S.SetSizeHints(-1, -1); S.SetSizeHints(-1, -1);

View File

@ -924,9 +924,9 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S)
{ {
szrI = S.GetSizer(); szrI = S.GetSizer();
auto interpolations = mInterpChoice = S.Id(ID_Interp)
LocalizedStrings(kInterpStrings, nInterpolations); .AddChoice( {},
mInterpChoice = S.Id(ID_Interp).AddChoice( {}, interpolations, 0 ); LocalizedStrings(kInterpStrings, nInterpolations), 0 );
#if wxUSE_ACCESSIBILITY #if wxUSE_ACCESSIBILITY
// so that name can be set on a standard control // so that name can be set on a standard control
mInterpChoice->SetAccessible(safenew WindowAccessible(mInterpChoice)); mInterpChoice->SetAccessible(safenew WindowAccessible(mInterpChoice));
@ -995,13 +995,15 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S)
{ {
S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1); S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1);
{ {
wxArrayStringEx curves; mCurve = S.Id(ID_Curve)
for (size_t i = 0, cnt = mCurves.size(); i < cnt; i++) .AddChoice( {},
{ [this]{
curves.push_back(mCurves[ i ].Name); wxArrayStringEx curves;
} for (const auto &curve : mCurves)
curves.push_back(curve.Name);
mCurve = S.Id(ID_Curve).AddChoice( {}, curves ); return curves;
}()
);
mCurve->SetName(_("Select Curve")); mCurve->SetName(_("Select Curve"));
} }
S.EndHorizontalLay(); S.EndHorizontalLay();

View File

@ -286,8 +286,10 @@ void EffectLoudness::PopulateOrExchange(ShuttleGui & S)
S.AddVariableText(_("Normalize"), false, S.AddVariableText(_("Normalize"), false,
wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT); wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
auto targetChoices = LocalizedStrings(kNormalizeTargetStrings, nAlgos); mNormalizeToCtl = S.AddChoice( {},
mNormalizeToCtl = S.AddChoice(wxEmptyString, targetChoices, mNormalizeTo); LocalizedStrings(kNormalizeTargetStrings, nAlgos),
mNormalizeTo
);
mNormalizeToCtl->SetValidator(wxGenericValidator(&mNormalizeTo)); mNormalizeToCtl->SetValidator(wxGenericValidator(&mNormalizeTo));
S.AddVariableText(_("to"), false, S.AddVariableText(_("to"), false,
wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT); wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);

View File

@ -225,8 +225,8 @@ void EffectNoise::PopulateOrExchange(ShuttleGui & S)
S.StartMultiColumn(2, wxCENTER); S.StartMultiColumn(2, wxCENTER);
{ {
auto typeChoices = LocalizedStrings(kTypeStrings, nTypes); S
S.AddChoice(_("Noise type:"), typeChoices) .AddChoice(_("Noise type:"), LocalizedStrings(kTypeStrings, nTypes))
->SetValidator(wxGenericValidator(&mType)); ->SetValidator(wxGenericValidator(&mType));
FloatingPointValidator<double> vldAmp(6, &mAmp, NumValidatorStyle::NO_TRAILING_ZEROES); FloatingPointValidator<double> vldAmp(6, &mAmp, NumValidatorStyle::NO_TRAILING_ZEROES);

View File

@ -1751,62 +1751,59 @@ void EffectNoiseReduction::Dialog::PopulateOrExchange(ShuttleGui & S)
{ {
S.StartMultiColumn(2); S.StartMultiColumn(2);
{ {
{ S.TieChoice(_("&Window types") + wxString(wxT(":")),
wxArrayStringEx windowTypeChoices; mTempSettings.mWindowTypes,
for (int ii = 0; ii < WT_N_WINDOW_TYPES; ++ii) []{
windowTypeChoices.push_back(windowTypesInfo[ii].name); wxArrayStringEx windowTypeChoices;
S.TieChoice(_("&Window types") + wxString(wxT(":")), for (int ii = 0; ii < WT_N_WINDOW_TYPES; ++ii)
mTempSettings.mWindowTypes, windowTypeChoices.push_back(windowTypesInfo[ii].name);
windowTypeChoices); return windowTypeChoices;
} }()
);
{ S.TieChoice(_("Window si&ze") + wxString(wxT(":")),
S.TieChoice(_("Window si&ze") + wxString(wxT(":")), mTempSettings.mWindowSizeChoice,
mTempSettings.mWindowSizeChoice, {
{ _("8") ,
_("8") , _("16") ,
_("16") , _("32") ,
_("32") , _("64") ,
_("64") , _("128") ,
_("128") , _("256") ,
_("256") , _("512") ,
_("512") , _("1024") ,
_("1024") , _("2048 (default)") ,
_("2048 (default)") , _("4096") ,
_("4096") , _("8192") ,
_("8192") , _("16384") ,
_("16384") , }
} );
);
}
{ S.TieChoice(_("S&teps per window") + wxString(wxT(":")),
S.TieChoice(_("S&teps per window") + wxString(wxT(":")), mTempSettings.mStepsPerWindowChoice,
mTempSettings.mStepsPerWindowChoice, {
{ _("2") ,
_("2") , _("4 (default)") ,
_("4 (default)") , _("8") ,
_("8") , _("16") ,
_("16") , _("32") ,
_("32") , _("64") ,
_("64") , }
} );
);
}
S.Id(ID_CHOICE_METHOD); S.Id(ID_CHOICE_METHOD)
{ .TieChoice(_("Discrimination &method") + wxString(wxT(":")),
wxArrayStringEx methodChoices; mTempSettings.mMethod,
int nn = DM_N_METHODS; []{
wxArrayStringEx methodChoices;
int nn = DM_N_METHODS;
#ifndef OLD_METHOD_AVAILABLE #ifndef OLD_METHOD_AVAILABLE
--nn; --nn;
#endif #endif
for (int ii = 0; ii < nn; ++ii) for (int ii = 0; ii < nn; ++ii)
methodChoices.push_back(discriminationMethodInfo[ii].name); methodChoices.push_back(discriminationMethodInfo[ii].name);
S.TieChoice(_("Discrimination &method") + wxString(wxT(":")), return methodChoices;
mTempSettings.mMethod, }());
methodChoices);
}
} }
S.EndMultiColumn(); S.EndMultiColumn();

View File

@ -117,6 +117,8 @@ static const EnumValueSymbol kSubTypeStrings[nSubTypes] =
{ XO("Highpass") } { XO("Highpass") }
}; };
static_assert(nSubTypes == WXSIZEOF(kSubTypeStrings), "size mismatch");
// Define keys, defaults, minimums, and maximums for the effect parameters // Define keys, defaults, minimums, and maximums for the effect parameters
// //
// Name Type Key Def Min Max Scale // Name Type Key Def Min Max Scale
@ -453,19 +455,23 @@ void EffectScienFilter::PopulateOrExchange(ShuttleGui & S)
{ {
wxASSERT(nTypes == WXSIZEOF(kTypeStrings)); wxASSERT(nTypes == WXSIZEOF(kTypeStrings));
auto typeChoices = LocalizedStrings(kTypeStrings, nTypes);
mFilterTypeCtl = S.Id(ID_Type) mFilterTypeCtl = S.Id(ID_Type)
.AddChoice(_("&Filter Type:"), typeChoices); .AddChoice(_("&Filter Type:"),
LocalizedStrings(kTypeStrings, nTypes)
);
mFilterTypeCtl->SetValidator(wxGenericValidator(&mFilterType)); mFilterTypeCtl->SetValidator(wxGenericValidator(&mFilterType));
S.SetSizeHints(-1, -1); S.SetSizeHints(-1, -1);
wxArrayStringEx orders; mFilterOrderCtl = S.Id(ID_Order)
for (int i = 1; i <= 10; i++) /*i18n-hint: 'Order' means the complexity of the filter, and is a number between 1 and 10.*/
{ .AddChoice(_("O&rder:"),
orders.push_back(wxString::Format(wxT("%d"), i)); []{
} wxArrayStringEx orders;
/*i18n-hint: 'Order' means the complexity of the filter, and is a number between 1 and 10.*/ for (int i = 1; i <= 10; i++)
mFilterOrderCtl = S.Id(ID_Order).AddChoice(_("O&rder:"), orders); orders.push_back(wxString::Format(wxT("%d"), i));
return orders;
}()
);
mFilterOrderCtl->SetValidator(wxGenericValidator(&mOrderIndex)); mFilterOrderCtl->SetValidator(wxGenericValidator(&mOrderIndex));
S.SetSizeHints(-1, -1); S.SetSizeHints(-1, -1);
S.AddSpace(1, 1); S.AddSpace(1, 1);
@ -479,11 +485,10 @@ void EffectScienFilter::PopulateOrExchange(ShuttleGui & S)
mRippleCtl->SetValidator(vldRipple); mRippleCtl->SetValidator(vldRipple);
mRippleCtlU = S.AddVariableText(_("dB"), false, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); mRippleCtlU = S.AddVariableText(_("dB"), false, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
wxASSERT(nSubTypes == WXSIZEOF(kSubTypeStrings));
auto subTypeChoices = LocalizedStrings(kSubTypeStrings, nSubTypes);
mFilterSubTypeCtl = S.Id(ID_SubType) mFilterSubTypeCtl = S.Id(ID_SubType)
.AddChoice(_("&Subtype:"), subTypeChoices); .AddChoice(_("&Subtype:"),
LocalizedStrings(kSubTypeStrings, nSubTypes)
);
mFilterSubTypeCtl->SetValidator(wxGenericValidator(&mFilterSubtype)); mFilterSubTypeCtl->SetValidator(wxGenericValidator(&mFilterSubtype));
S.SetSizeHints(-1, -1); S.SetSizeHints(-1, -1);

View File

@ -340,8 +340,9 @@ void EffectToneGen::PopulateOrExchange(ShuttleGui & S)
S.StartMultiColumn(2, wxCENTER); S.StartMultiColumn(2, wxCENTER);
{ {
auto waveforms = LocalizedStrings(kWaveStrings, nWaveforms); wxChoice *c = S
wxChoice *c = S.AddChoice(_("Waveform:"), waveforms); .AddChoice(_("Waveform:"),
LocalizedStrings(kWaveStrings, nWaveforms));
c->SetValidator(wxGenericValidator(&mWaveform)); c->SetValidator(wxGenericValidator(&mWaveform));
if (mChirp) if (mChirp)
@ -419,8 +420,9 @@ void EffectToneGen::PopulateOrExchange(ShuttleGui & S)
} }
S.EndHorizontalLay(); S.EndHorizontalLay();
auto interpolations = LocalizedStrings(kInterStrings, nInterpolations); c = S
c = S.AddChoice(_("Interpolation:"), interpolations); .AddChoice(_("Interpolation:"),
LocalizedStrings(kInterStrings, nInterpolations));
c->SetValidator(wxGenericValidator(&mInterpolation)); c->SetValidator(wxGenericValidator(&mInterpolation));
} }
else else

View File

@ -2637,9 +2637,8 @@ void NyquistEffect::BuildEffectWindow(ShuttleGui & S)
{ {
S.AddSpace(10, 10); S.AddSpace(10, 10);
auto choices = S.Id(ID_Choice + i).AddChoice( {},
LocalizedStrings(ctrl.choices.data(), ctrl.choices.size()); LocalizedStrings(ctrl.choices.data(), ctrl.choices.size()));
S.Id(ID_Choice + i).AddChoice( {}, choices );
} }
else if (ctrl.type == NYQ_CTRL_TIME) else if (ctrl.type == NYQ_CTRL_TIME)
{ {

View File

@ -558,22 +558,19 @@ void VampEffect::PopulateOrExchange(ShuttleGui & S)
if (!programs.empty()) if (!programs.empty())
{ {
wxString currentProgram = wxString::FromUTF8(mPlugin->getCurrentProgram().c_str());
wxArrayStringEx choices;
for (size_t i = 0, cnt = programs.size(); i < cnt; i++)
{
choices.push_back(wxString::FromUTF8(programs[i].c_str()));
}
S.AddPrompt(_("Program")); S.AddPrompt(_("Program"));
S.Id(ID_Program); S.Id(ID_Program);
mProgram = S.AddChoice( mProgram = S
{}, .AddChoice( {},
choices, [&]{
currentProgram wxArrayStringEx choices;
); for (const auto &program : programs)
choices.push_back(wxString::FromUTF8(program.c_str()));
return choices;
}(),
wxString::FromUTF8(mPlugin->getCurrentProgram().c_str())
);
mProgram->SetName(_("Program")); mProgram->SetName(_("Program"));
mProgram->SetSizeHints(-1, -1); mProgram->SetSizeHints(-1, -1);
wxSizer *s = mProgram->GetContainingSizer(); wxSizer *s = mProgram->GetContainingSizer();

View File

@ -1003,6 +1003,8 @@ int ExportFFmpeg::AskResample(int bitrate, int rate, int lowrate, int highrate,
ShuttleGui S(&d, eIsCreating); ShuttleGui S(&d, eIsCreating);
wxString text; wxString text;
int selected = -1;
S.StartVerticalLay(); S.StartVerticalLay();
{ {
S.SetBorder(10); S.SetBorder(10);
@ -1022,30 +1024,26 @@ int ExportFFmpeg::AskResample(int bitrate, int rate, int lowrate, int highrate,
} }
S.EndHorizontalLay(); S.EndHorizontalLay();
wxArrayStringEx choices;
int selected = -1;
for (int i = 0; sampRates[i] > 0; i++)
{
int label = sampRates[i];
if (label >= lowrate && label <= highrate)
{
wxString name = wxString::Format(wxT("%d"),label);
choices.push_back(name);
if (label <= rate)
{
selected = i;
}
}
}
if (selected == -1)
selected = 0;
S.StartHorizontalLay(wxALIGN_CENTER, false); S.StartHorizontalLay(wxALIGN_CENTER, false);
{ {
choice = S.AddChoice(_("Sample Rates"), choice = S.AddChoice(_("Sample Rates"),
choices, [&]{
selected); wxArrayStringEx choices;
for (int i = 0; sampRates[i] > 0; i++)
{
int label = sampRates[i];
if (label >= lowrate && label <= highrate)
{
wxString name = wxString::Format(wxT("%d"),label);
choices.push_back(name);
if (label <= rate)
selected = i;
}
}
return choices;
}(),
std::max( 0, selected )
);
} }
S.EndHorizontalLay(); S.EndHorizontalLay();
} }

View File

@ -2002,6 +2002,8 @@ int ExportMP3::AskResample(int bitrate, int rate, int lowrate, int highrate)
ShuttleGui S(&d, eIsCreating); ShuttleGui S(&d, eIsCreating);
wxString text; wxString text;
int selected = -1;
S.StartVerticalLay(); S.StartVerticalLay();
{ {
S.SetBorder(10); S.SetBorder(10);
@ -2021,27 +2023,23 @@ int ExportMP3::AskResample(int bitrate, int rate, int lowrate, int highrate)
} }
S.EndHorizontalLay(); S.EndHorizontalLay();
wxArrayStringEx choices;
int selected = -1;
for (size_t ii = 0, nn = sampRates.size(); ii < nn; ++ii) {
int label = sampRates[ii];
if (label >= lowrate && label <= highrate) {
choices.push_back( wxString::Format( "%d", label ) );
if (label <= rate) {
selected = ii;
}
}
}
if (selected == -1) {
selected = 0;
}
S.StartHorizontalLay(wxALIGN_CENTER, false); S.StartHorizontalLay(wxALIGN_CENTER, false);
{ {
choice = S.AddChoice(_("Sample Rates"), choice = S.AddChoice(_("Sample Rates"),
choices, [&]{
selected); wxArrayStringEx choices;
for (size_t ii = 0, nn = sampRates.size(); ii < nn; ++ii) {
int label = sampRates[ii];
if (label >= lowrate && label <= highrate) {
choices.push_back( wxString::Format( "%d", label ) );
if (label <= rate)
selected = ii;
}
}
return choices;
}(),
std::max( 0, selected )
);
} }
S.EndHorizontalLay(); S.EndHorizontalLay();
} }