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:
parent
f07d33f4b5
commit
f846c25806
|
@ -395,22 +395,22 @@ void DependencyDialog::PopulateOrExchange(ShuttleGui& S)
|
|||
{
|
||||
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 =
|
||||
S.Id(FutureActionChoiceID).AddChoice(
|
||||
_("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"
|
||||
);
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
mFutureActionChoice = NULL;
|
||||
}
|
||||
|
|
|
@ -809,6 +809,12 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
|
|||
int iPostTimerRecordAction = gPrefs->ReadLong("/TimerRecord/PostAction", 0);
|
||||
|
||||
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.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
|
||||
* 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);
|
||||
{
|
||||
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
|
||||
* seconds.
|
||||
*/
|
||||
auto strFormat1 = _("099 days 024 h 060 m 060 s");
|
||||
m_pTimeTextCtrl_Duration = safenew NumericTextCtrl(
|
||||
S.GetParent(), ID_TIMETEXT_DURATION, NumericConverter::TIME,
|
||||
{}, 0, 44100,
|
||||
|
@ -950,23 +953,17 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
|
|||
S.StartMultiColumn(1, wxEXPAND);
|
||||
{
|
||||
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_sTimerAfterCompleteOptionsArray,
|
||||
iPostTimerRecordAction);
|
||||
{
|
||||
_("Do nothing") ,
|
||||
_("Exit Audacity") ,
|
||||
#ifdef __WINDOWS__
|
||||
_("Restart system") ,
|
||||
_("Shutdown system") ,
|
||||
#endif
|
||||
},
|
||||
iPostTimerRecordAction
|
||||
);
|
||||
}
|
||||
S.EndMultiColumn();
|
||||
}
|
||||
|
|
|
@ -146,9 +146,6 @@ private:
|
|||
int m_iAutoExportFilterIndex;
|
||||
bool m_bProjectAlreadySaved;
|
||||
|
||||
// Variables for After Timer Recording Option
|
||||
wxArrayStringEx m_sTimerAfterCompleteOptionsArray;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
|
|
@ -296,6 +296,21 @@ void EffectChangeSpeed::PopulateOrExchange(ShuttleGui & S)
|
|||
}
|
||||
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.StartVerticalLay(0);
|
||||
|
@ -337,23 +352,9 @@ void EffectChangeSpeed::PopulateOrExchange(ShuttleGui & S)
|
|||
/* i18n-hint: "rpm" is an English abbreviation meaning "revolutions per minute". */
|
||||
S.AddUnits(_("Standard Vinyl rpm:"));
|
||||
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
mpChoice_FromVinyl =
|
||||
S.Id(ID_FromVinyl).AddChoice(_("from"), vinylChoices);
|
||||
mpChoice_FromVinyl = S.Id(ID_FromVinyl)
|
||||
/* i18n-hint: changing a quantity "from" one value "to" another */
|
||||
.AddChoice(_("from"), vinylChoices);
|
||||
mpChoice_FromVinyl->SetName(_("From rpm"));
|
||||
mpChoice_FromVinyl->SetSizeHints(100, -1);
|
||||
|
||||
|
|
|
@ -372,8 +372,9 @@ void EffectDistortion::PopulateOrExchange(ShuttleGui & S)
|
|||
{
|
||||
S.StartMultiColumn(4, wxCENTER);
|
||||
{
|
||||
auto tableTypes = LocalizedStrings(kTableTypeStrings, nTableTypes);
|
||||
mTypeChoiceCtrl = S.Id(ID_Type).AddChoice(_("Distortion type:"), tableTypes);
|
||||
mTypeChoiceCtrl = S.Id(ID_Type)
|
||||
.AddChoice(_("Distortion type:"),
|
||||
LocalizedStrings(kTableTypeStrings, nTableTypes));
|
||||
mTypeChoiceCtrl->SetValidator(wxGenericValidator(&mParams.mTableChoiceIndx));
|
||||
S.SetSizeHints(-1, -1);
|
||||
|
||||
|
|
|
@ -924,9 +924,9 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S)
|
|||
{
|
||||
szrI = S.GetSizer();
|
||||
|
||||
auto interpolations =
|
||||
LocalizedStrings(kInterpStrings, nInterpolations);
|
||||
mInterpChoice = S.Id(ID_Interp).AddChoice( {}, interpolations, 0 );
|
||||
mInterpChoice = S.Id(ID_Interp)
|
||||
.AddChoice( {},
|
||||
LocalizedStrings(kInterpStrings, nInterpolations), 0 );
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
// so that name can be set on a standard control
|
||||
mInterpChoice->SetAccessible(safenew WindowAccessible(mInterpChoice));
|
||||
|
@ -995,13 +995,15 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S)
|
|||
{
|
||||
S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1);
|
||||
{
|
||||
wxArrayStringEx curves;
|
||||
for (size_t i = 0, cnt = mCurves.size(); i < cnt; i++)
|
||||
{
|
||||
curves.push_back(mCurves[ i ].Name);
|
||||
}
|
||||
|
||||
mCurve = S.Id(ID_Curve).AddChoice( {}, curves );
|
||||
mCurve = S.Id(ID_Curve)
|
||||
.AddChoice( {},
|
||||
[this]{
|
||||
wxArrayStringEx curves;
|
||||
for (const auto &curve : mCurves)
|
||||
curves.push_back(curve.Name);
|
||||
return curves;
|
||||
}()
|
||||
);
|
||||
mCurve->SetName(_("Select Curve"));
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
|
|
|
@ -286,8 +286,10 @@ void EffectLoudness::PopulateOrExchange(ShuttleGui & S)
|
|||
S.AddVariableText(_("Normalize"), false,
|
||||
wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
|
||||
|
||||
auto targetChoices = LocalizedStrings(kNormalizeTargetStrings, nAlgos);
|
||||
mNormalizeToCtl = S.AddChoice(wxEmptyString, targetChoices, mNormalizeTo);
|
||||
mNormalizeToCtl = S.AddChoice( {},
|
||||
LocalizedStrings(kNormalizeTargetStrings, nAlgos),
|
||||
mNormalizeTo
|
||||
);
|
||||
mNormalizeToCtl->SetValidator(wxGenericValidator(&mNormalizeTo));
|
||||
S.AddVariableText(_("to"), false,
|
||||
wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
|
||||
|
|
|
@ -225,8 +225,8 @@ void EffectNoise::PopulateOrExchange(ShuttleGui & S)
|
|||
|
||||
S.StartMultiColumn(2, wxCENTER);
|
||||
{
|
||||
auto typeChoices = LocalizedStrings(kTypeStrings, nTypes);
|
||||
S.AddChoice(_("Noise type:"), typeChoices)
|
||||
S
|
||||
.AddChoice(_("Noise type:"), LocalizedStrings(kTypeStrings, nTypes))
|
||||
->SetValidator(wxGenericValidator(&mType));
|
||||
|
||||
FloatingPointValidator<double> vldAmp(6, &mAmp, NumValidatorStyle::NO_TRAILING_ZEROES);
|
||||
|
|
|
@ -1751,62 +1751,59 @@ void EffectNoiseReduction::Dialog::PopulateOrExchange(ShuttleGui & S)
|
|||
{
|
||||
S.StartMultiColumn(2);
|
||||
{
|
||||
{
|
||||
wxArrayStringEx windowTypeChoices;
|
||||
for (int ii = 0; ii < WT_N_WINDOW_TYPES; ++ii)
|
||||
windowTypeChoices.push_back(windowTypesInfo[ii].name);
|
||||
S.TieChoice(_("&Window types") + wxString(wxT(":")),
|
||||
mTempSettings.mWindowTypes,
|
||||
windowTypeChoices);
|
||||
}
|
||||
S.TieChoice(_("&Window types") + wxString(wxT(":")),
|
||||
mTempSettings.mWindowTypes,
|
||||
[]{
|
||||
wxArrayStringEx windowTypeChoices;
|
||||
for (int ii = 0; ii < WT_N_WINDOW_TYPES; ++ii)
|
||||
windowTypeChoices.push_back(windowTypesInfo[ii].name);
|
||||
return windowTypeChoices;
|
||||
}()
|
||||
);
|
||||
|
||||
{
|
||||
S.TieChoice(_("Window si&ze") + wxString(wxT(":")),
|
||||
mTempSettings.mWindowSizeChoice,
|
||||
{
|
||||
_("8") ,
|
||||
_("16") ,
|
||||
_("32") ,
|
||||
_("64") ,
|
||||
_("128") ,
|
||||
_("256") ,
|
||||
_("512") ,
|
||||
_("1024") ,
|
||||
_("2048 (default)") ,
|
||||
_("4096") ,
|
||||
_("8192") ,
|
||||
_("16384") ,
|
||||
}
|
||||
);
|
||||
}
|
||||
S.TieChoice(_("Window si&ze") + wxString(wxT(":")),
|
||||
mTempSettings.mWindowSizeChoice,
|
||||
{
|
||||
_("8") ,
|
||||
_("16") ,
|
||||
_("32") ,
|
||||
_("64") ,
|
||||
_("128") ,
|
||||
_("256") ,
|
||||
_("512") ,
|
||||
_("1024") ,
|
||||
_("2048 (default)") ,
|
||||
_("4096") ,
|
||||
_("8192") ,
|
||||
_("16384") ,
|
||||
}
|
||||
);
|
||||
|
||||
{
|
||||
S.TieChoice(_("S&teps per window") + wxString(wxT(":")),
|
||||
mTempSettings.mStepsPerWindowChoice,
|
||||
{
|
||||
_("2") ,
|
||||
_("4 (default)") ,
|
||||
_("8") ,
|
||||
_("16") ,
|
||||
_("32") ,
|
||||
_("64") ,
|
||||
}
|
||||
);
|
||||
}
|
||||
S.TieChoice(_("S&teps per window") + wxString(wxT(":")),
|
||||
mTempSettings.mStepsPerWindowChoice,
|
||||
{
|
||||
_("2") ,
|
||||
_("4 (default)") ,
|
||||
_("8") ,
|
||||
_("16") ,
|
||||
_("32") ,
|
||||
_("64") ,
|
||||
}
|
||||
);
|
||||
|
||||
S.Id(ID_CHOICE_METHOD);
|
||||
{
|
||||
wxArrayStringEx methodChoices;
|
||||
int nn = DM_N_METHODS;
|
||||
S.Id(ID_CHOICE_METHOD)
|
||||
.TieChoice(_("Discrimination &method") + wxString(wxT(":")),
|
||||
mTempSettings.mMethod,
|
||||
[]{
|
||||
wxArrayStringEx methodChoices;
|
||||
int nn = DM_N_METHODS;
|
||||
#ifndef OLD_METHOD_AVAILABLE
|
||||
--nn;
|
||||
--nn;
|
||||
#endif
|
||||
for (int ii = 0; ii < nn; ++ii)
|
||||
methodChoices.push_back(discriminationMethodInfo[ii].name);
|
||||
S.TieChoice(_("Discrimination &method") + wxString(wxT(":")),
|
||||
mTempSettings.mMethod,
|
||||
methodChoices);
|
||||
}
|
||||
for (int ii = 0; ii < nn; ++ii)
|
||||
methodChoices.push_back(discriminationMethodInfo[ii].name);
|
||||
return methodChoices;
|
||||
}());
|
||||
}
|
||||
S.EndMultiColumn();
|
||||
|
||||
|
|
|
@ -117,6 +117,8 @@ static const EnumValueSymbol kSubTypeStrings[nSubTypes] =
|
|||
{ XO("Highpass") }
|
||||
};
|
||||
|
||||
static_assert(nSubTypes == WXSIZEOF(kSubTypeStrings), "size mismatch");
|
||||
|
||||
// Define keys, defaults, minimums, and maximums for the effect parameters
|
||||
//
|
||||
// Name Type Key Def Min Max Scale
|
||||
|
@ -453,19 +455,23 @@ void EffectScienFilter::PopulateOrExchange(ShuttleGui & S)
|
|||
{
|
||||
wxASSERT(nTypes == WXSIZEOF(kTypeStrings));
|
||||
|
||||
auto typeChoices = LocalizedStrings(kTypeStrings, nTypes);
|
||||
mFilterTypeCtl = S.Id(ID_Type)
|
||||
.AddChoice(_("&Filter Type:"), typeChoices);
|
||||
.AddChoice(_("&Filter Type:"),
|
||||
LocalizedStrings(kTypeStrings, nTypes)
|
||||
);
|
||||
mFilterTypeCtl->SetValidator(wxGenericValidator(&mFilterType));
|
||||
S.SetSizeHints(-1, -1);
|
||||
|
||||
wxArrayStringEx orders;
|
||||
for (int i = 1; i <= 10; i++)
|
||||
{
|
||||
orders.push_back(wxString::Format(wxT("%d"), i));
|
||||
}
|
||||
/*i18n-hint: 'Order' means the complexity of the filter, and is a number between 1 and 10.*/
|
||||
mFilterOrderCtl = S.Id(ID_Order).AddChoice(_("O&rder:"), orders);
|
||||
mFilterOrderCtl = S.Id(ID_Order)
|
||||
/*i18n-hint: 'Order' means the complexity of the filter, and is a number between 1 and 10.*/
|
||||
.AddChoice(_("O&rder:"),
|
||||
[]{
|
||||
wxArrayStringEx orders;
|
||||
for (int i = 1; i <= 10; i++)
|
||||
orders.push_back(wxString::Format(wxT("%d"), i));
|
||||
return orders;
|
||||
}()
|
||||
);
|
||||
mFilterOrderCtl->SetValidator(wxGenericValidator(&mOrderIndex));
|
||||
S.SetSizeHints(-1, -1);
|
||||
S.AddSpace(1, 1);
|
||||
|
@ -479,11 +485,10 @@ void EffectScienFilter::PopulateOrExchange(ShuttleGui & S)
|
|||
mRippleCtl->SetValidator(vldRipple);
|
||||
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)
|
||||
.AddChoice(_("&Subtype:"), subTypeChoices);
|
||||
.AddChoice(_("&Subtype:"),
|
||||
LocalizedStrings(kSubTypeStrings, nSubTypes)
|
||||
);
|
||||
mFilterSubTypeCtl->SetValidator(wxGenericValidator(&mFilterSubtype));
|
||||
S.SetSizeHints(-1, -1);
|
||||
|
||||
|
|
|
@ -340,8 +340,9 @@ void EffectToneGen::PopulateOrExchange(ShuttleGui & S)
|
|||
|
||||
S.StartMultiColumn(2, wxCENTER);
|
||||
{
|
||||
auto waveforms = LocalizedStrings(kWaveStrings, nWaveforms);
|
||||
wxChoice *c = S.AddChoice(_("Waveform:"), waveforms);
|
||||
wxChoice *c = S
|
||||
.AddChoice(_("Waveform:"),
|
||||
LocalizedStrings(kWaveStrings, nWaveforms));
|
||||
c->SetValidator(wxGenericValidator(&mWaveform));
|
||||
|
||||
if (mChirp)
|
||||
|
@ -419,8 +420,9 @@ void EffectToneGen::PopulateOrExchange(ShuttleGui & S)
|
|||
}
|
||||
S.EndHorizontalLay();
|
||||
|
||||
auto interpolations = LocalizedStrings(kInterStrings, nInterpolations);
|
||||
c = S.AddChoice(_("Interpolation:"), interpolations);
|
||||
c = S
|
||||
.AddChoice(_("Interpolation:"),
|
||||
LocalizedStrings(kInterStrings, nInterpolations));
|
||||
c->SetValidator(wxGenericValidator(&mInterpolation));
|
||||
}
|
||||
else
|
||||
|
|
|
@ -2637,9 +2637,8 @@ void NyquistEffect::BuildEffectWindow(ShuttleGui & S)
|
|||
{
|
||||
S.AddSpace(10, 10);
|
||||
|
||||
auto choices =
|
||||
LocalizedStrings(ctrl.choices.data(), ctrl.choices.size());
|
||||
S.Id(ID_Choice + i).AddChoice( {}, choices );
|
||||
S.Id(ID_Choice + i).AddChoice( {},
|
||||
LocalizedStrings(ctrl.choices.data(), ctrl.choices.size()));
|
||||
}
|
||||
else if (ctrl.type == NYQ_CTRL_TIME)
|
||||
{
|
||||
|
|
|
@ -558,22 +558,19 @@ void VampEffect::PopulateOrExchange(ShuttleGui & S)
|
|||
|
||||
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.Id(ID_Program);
|
||||
mProgram = S.AddChoice(
|
||||
{},
|
||||
choices,
|
||||
currentProgram
|
||||
);
|
||||
mProgram = S
|
||||
.AddChoice( {},
|
||||
[&]{
|
||||
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->SetSizeHints(-1, -1);
|
||||
wxSizer *s = mProgram->GetContainingSizer();
|
||||
|
|
|
@ -1003,6 +1003,8 @@ int ExportFFmpeg::AskResample(int bitrate, int rate, int lowrate, int highrate,
|
|||
ShuttleGui S(&d, eIsCreating);
|
||||
wxString text;
|
||||
|
||||
int selected = -1;
|
||||
|
||||
S.StartVerticalLay();
|
||||
{
|
||||
S.SetBorder(10);
|
||||
|
@ -1022,30 +1024,26 @@ int ExportFFmpeg::AskResample(int bitrate, int rate, int lowrate, int highrate,
|
|||
}
|
||||
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);
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -2002,6 +2002,8 @@ int ExportMP3::AskResample(int bitrate, int rate, int lowrate, int highrate)
|
|||
ShuttleGui S(&d, eIsCreating);
|
||||
wxString text;
|
||||
|
||||
int selected = -1;
|
||||
|
||||
S.StartVerticalLay();
|
||||
{
|
||||
S.SetBorder(10);
|
||||
|
@ -2021,27 +2023,23 @@ int ExportMP3::AskResample(int bitrate, int rate, int lowrate, int highrate)
|
|||
}
|
||||
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);
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue