More uses if LocalizedStrings

This commit is contained in:
Paul Licameli 2018-03-26 22:22:37 -04:00
parent 81dd580c57
commit 595cf05d42
10 changed files with 16 additions and 61 deletions

View File

@ -360,17 +360,13 @@ bool EffectDistortion::LoadFactoryPreset(int id)
void EffectDistortion::PopulateOrExchange(ShuttleGui & S)
{
for (int i = 0; i < nTableTypes; i++)
{
mTableTypes.Add(wxGetTranslation(kTableTypeStrings[i]));
}
S.AddSpace(0, 5);
S.StartVerticalLay();
{
S.StartMultiColumn(4, wxCENTER);
{
mTypeChoiceCtrl = S.Id(ID_Type).AddChoice(_("Distortion type:"), wxT(""), &mTableTypes);
auto tableTypes = LocalizedStrings(kTableTypeStrings, nTableTypes);
mTypeChoiceCtrl = S.Id(ID_Type).AddChoice(_("Distortion type:"), wxT(""), &tableTypes);
mTypeChoiceCtrl->SetValidator(wxGenericValidator(&mParams.mTableChoiceIndx));
S.SetSizeHints(-1, -1);

View File

@ -181,7 +181,6 @@ private:
double mMakeupGain;
int mTypChoiceIndex;
wxArrayString mTableTypes;
wxChoice *mTypeChoiceCtrl;
wxTextCtrl *mThresholdT;

View File

@ -229,11 +229,6 @@ EffectEqualization::EffectEqualization()
GetPrivateConfig(GetCurrentSettingsGroup(), wxT("DrawMode"), mDrawMode, DEF_DrawMode);
GetPrivateConfig(GetCurrentSettingsGroup(), wxT("DrawGrid"), mDrawGrid, DEF_DrawGrid);
for (int i = 0; i < nInterpolations; i++)
{
mInterpolations.Add(wxGetTranslation(kInterpStrings[i]));
}
mLogEnvelope = std::make_unique<Envelope>
(false,
MIN_dBMin, MAX_dBMax, // MB: this is the highest possible range
@ -331,11 +326,6 @@ bool EffectEqualization::SetAutomationParameters(CommandParameters & parms)
{
// Pretty sure the interpolation name shouldn't have been interpreted when
// specified in chains, but must keep it that way for compatibility.
wxArrayString interpolations(mInterpolations);
for (int i = 0; i < nInterpolations; i++)
{
interpolations.Add(kInterpStrings[i]);
}
ReadAndVerifyInt(FilterLength);
ReadAndVerifyString(CurveName);
@ -774,7 +764,9 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S)
{
szrI = S.GetSizer();
mInterpChoice = S.Id(ID_Interp).AddChoice( {}, wxT(""), &mInterpolations);
auto interpolations =
LocalizedStrings(kInterpStrings, nInterpolations);
mInterpChoice = S.Id(ID_Interp).AddChoice( {}, wxT(""), &interpolations);
mInterpChoice->SetName(_("Interpolation type"));
mInterpChoice->SetSelection(0);
}

View File

@ -220,7 +220,6 @@ private:
RulerPanel *mdBRuler;
RulerPanel *mFreqRuler;
wxArrayString mInterpolations;
bool mDisallowCustom;
double mLoFreq;
double mHiFreq;

View File

@ -220,14 +220,9 @@ void EffectNoise::PopulateOrExchange(ShuttleGui & S)
{
wxASSERT(nTypes == WXSIZEOF(kTypeStrings));
wxArrayString typeChoices;
for (int i = 0; i < nTypes; i++)
{
typeChoices.Add(wxGetTranslation(kTypeStrings[i]));
}
S.StartMultiColumn(2, wxCENTER);
{
auto typeChoices = LocalizedStrings(kTypeStrings, nTypes);
S.AddChoice(_("Noise type:"), wxT(""), &typeChoices)->SetValidator(wxGenericValidator(&mType));
FloatingPointValidator<double> vldAmp(6, &mAmp, NumValidatorStyle::NO_TRAILING_ZEROES);

View File

@ -467,12 +467,7 @@ void EffectScienFilter::PopulateOrExchange(ShuttleGui & S)
{
wxASSERT(nTypes == WXSIZEOF(kTypeStrings));
wxArrayString typeChoices;
for (int i = 0; i < nTypes; i++)
{
typeChoices.Add(wxGetTranslation(kTypeStrings[i]));
}
auto typeChoices = LocalizedStrings(kTypeStrings, nTypes);
mFilterTypeCtl = S.Id(ID_Type).AddChoice(_("&Filter Type:"), wxT(""), &typeChoices);
mFilterTypeCtl->SetValidator(wxGenericValidator(&mFilterType));
S.SetSizeHints(-1, -1);
@ -499,12 +494,7 @@ void EffectScienFilter::PopulateOrExchange(ShuttleGui & S)
wxASSERT(nSubTypes == WXSIZEOF(kSubTypeStrings));
wxArrayString subTypeChoices;
for (int i = 0; i < nSubTypes; i++)
{
subTypeChoices.Add(wxGetTranslation(kSubTypeStrings[i]));
}
auto subTypeChoices = LocalizedStrings(kSubTypeStrings, nSubTypes);
mFilterSubTypeCtl = S.Id(ID_SubType).AddChoice(_("&Subtype:"), wxT(""), &subTypeChoices);
mFilterSubTypeCtl->SetValidator(wxGenericValidator(&mFilterSubtype));
S.SetSizeHints(-1, -1);

View File

@ -96,15 +96,6 @@ EffectToneGen::EffectToneGen(bool isChirp)
mAmplitude[1] = DEF_EndAmp;
mInterpolation = DEF_Interp;
for (int i = 0; i < nWaveforms; i++)
{
mWaveforms.Add(wxGetTranslation(kWaveStrings[i]));
}
for (int i = 0; i < nInterpolations; i++)
{
mInterpolations.Add(wxGetTranslation(kInterStrings[i]));
}
// Chirp varies over time so must use selected duration.
// TODO: When previewing, calculate only the first 'preview length'.
if (isChirp)
@ -341,7 +332,8 @@ void EffectToneGen::PopulateOrExchange(ShuttleGui & S)
S.StartMultiColumn(2, wxCENTER);
{
wxChoice *c = S.AddChoice(_("Waveform:"), wxT(""), &mWaveforms);
auto waveforms = LocalizedStrings(kWaveStrings, nWaveforms);
wxChoice *c = S.AddChoice(_("Waveform:"), wxT(""), &waveforms);
c->SetValidator(wxGenericValidator(&mWaveform));
if (mChirp)
@ -413,7 +405,8 @@ void EffectToneGen::PopulateOrExchange(ShuttleGui & S)
}
S.EndHorizontalLay();
c = S.AddChoice(_("Interpolation:"), wxT(""), &mInterpolations);
auto interpolations = LocalizedStrings(kInterStrings, nInterpolations);
c = S.AddChoice(_("Interpolation:"), wxT(""), &interpolations);
c->SetValidator(wxGenericValidator(&mInterpolation));
}
else

View File

@ -77,8 +77,6 @@ private:
double mAmplitude[2];
double mLogFrequency[2];
wxArrayString mWaveforms;
wxArrayString mInterpolations;
NumericTextCtrl *mToneDurationT;
DECLARE_EVENT_TABLE()

View File

@ -123,8 +123,6 @@ END_EVENT_TABLE()
EffectTruncSilence::EffectTruncSilence()
{
mDbChoices = wxArrayString(Enums::NumDbChoices, Enums::DbChoices);
mInitialAllowedSilence = DEF_Minimum;
mTruncLongestAllowedSilence = DEF_Truncate;
mSilenceCompressPercent = DEF_Compress;
@ -744,12 +742,6 @@ void EffectTruncSilence::PopulateOrExchange(ShuttleGui & S)
{
wxASSERT(nActions == WXSIZEOF(kActionStrings));
wxArrayString actionChoices;
for (int i = 0; i < nActions; i++)
{
actionChoices.Add(wxGetTranslation(kActionStrings[i]));
}
S.AddSpace(0, 5);
S.StartStatic(_("Detect Silence"));
@ -757,7 +749,9 @@ void EffectTruncSilence::PopulateOrExchange(ShuttleGui & S)
S.StartMultiColumn(3, wxALIGN_CENTER_HORIZONTAL);
{
// Threshold
mTruncDbChoice = S.AddChoice(_("Level:"), wxT(""), &mDbChoices);
auto dbChoices =
LocalizedStrings( Enums::DbChoices, Enums::NumDbChoices );
mTruncDbChoice = S.AddChoice(_("Level:"), wxT(""), &dbChoices);
mTruncDbChoice->SetValidator(wxGenericValidator(&mTruncDbChoiceIndex));
S.SetSizeHints(-1, -1);
S.AddSpace(0); // 'choices' already includes units.
@ -778,6 +772,7 @@ void EffectTruncSilence::PopulateOrExchange(ShuttleGui & S)
S.StartHorizontalLay();
{
// Action choices
auto actionChoices = LocalizedStrings(kActionStrings, nActions);
mActionChoice = S.AddChoice( {}, wxT(""), &actionChoices);
mActionChoice->SetValidator(wxGenericValidator(&mActionIndex));
S.SetSizeHints(-1, -1);

View File

@ -104,8 +104,6 @@ private:
double mSilenceCompressPercent;
bool mbIndependent;
wxArrayString mDbChoices;
size_t mBlendFrameCount;
wxChoice *mTruncDbChoice;