diff --git a/src/effects/Distortion.cpp b/src/effects/Distortion.cpp index 58fe7892e..69a9f0001 100644 --- a/src/effects/Distortion.cpp +++ b/src/effects/Distortion.cpp @@ -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); diff --git a/src/effects/Distortion.h b/src/effects/Distortion.h index 752c37d87..79fd5ab35 100644 --- a/src/effects/Distortion.h +++ b/src/effects/Distortion.h @@ -181,7 +181,6 @@ private: double mMakeupGain; int mTypChoiceIndex; - wxArrayString mTableTypes; wxChoice *mTypeChoiceCtrl; wxTextCtrl *mThresholdT; diff --git a/src/effects/Equalization.cpp b/src/effects/Equalization.cpp index dd9cf7ab7..fee675a80 100644 --- a/src/effects/Equalization.cpp +++ b/src/effects/Equalization.cpp @@ -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 (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); } diff --git a/src/effects/Equalization.h b/src/effects/Equalization.h index addb4e3ed..58dd52e2d 100644 --- a/src/effects/Equalization.h +++ b/src/effects/Equalization.h @@ -220,7 +220,6 @@ private: RulerPanel *mdBRuler; RulerPanel *mFreqRuler; - wxArrayString mInterpolations; bool mDisallowCustom; double mLoFreq; double mHiFreq; diff --git a/src/effects/Noise.cpp b/src/effects/Noise.cpp index d7d293c10..bd12cd78d 100644 --- a/src/effects/Noise.cpp +++ b/src/effects/Noise.cpp @@ -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 vldAmp(6, &mAmp, NumValidatorStyle::NO_TRAILING_ZEROES); diff --git a/src/effects/ScienFilter.cpp b/src/effects/ScienFilter.cpp index 987e0fe45..143b83e93 100644 --- a/src/effects/ScienFilter.cpp +++ b/src/effects/ScienFilter.cpp @@ -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); diff --git a/src/effects/ToneGen.cpp b/src/effects/ToneGen.cpp index 6103efc65..661fa9447 100644 --- a/src/effects/ToneGen.cpp +++ b/src/effects/ToneGen.cpp @@ -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 diff --git a/src/effects/ToneGen.h b/src/effects/ToneGen.h index 348bfd077..ac1f97c5f 100644 --- a/src/effects/ToneGen.h +++ b/src/effects/ToneGen.h @@ -77,8 +77,6 @@ private: double mAmplitude[2]; double mLogFrequency[2]; - wxArrayString mWaveforms; - wxArrayString mInterpolations; NumericTextCtrl *mToneDurationT; DECLARE_EVENT_TABLE() diff --git a/src/effects/TruncSilence.cpp b/src/effects/TruncSilence.cpp index 1e9d46b85..629751a65 100644 --- a/src/effects/TruncSilence.cpp +++ b/src/effects/TruncSilence.cpp @@ -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); diff --git a/src/effects/TruncSilence.h b/src/effects/TruncSilence.h index 2cb289193..eecd3754f 100644 --- a/src/effects/TruncSilence.h +++ b/src/effects/TruncSilence.h @@ -104,8 +104,6 @@ private: double mSilenceCompressPercent; bool mbIndependent; - wxArrayString mDbChoices; - size_t mBlendFrameCount; wxChoice *mTruncDbChoice;