From dd86346156b876e72cc8d65047ca3b6389801d4c Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Thu, 1 Feb 2018 19:23:02 -0500 Subject: [PATCH] ShuttlegGUI: const wxArrayStringEx & arguments, not wxArrayString *... ... for choice, combo, and listbox; reference allows passing temporaries, eliminating need for some variables to hold the string arrays. --- src/Dependencies.cpp | 2 +- src/FreqWindow.cpp | 10 +-- src/Internat.cpp | 4 +- src/Internat.h | 5 +- src/LangChoice.cpp | 4 +- src/ShuttleGui.cpp | 64 +++++++++---------- src/ShuttleGui.h | 38 +++++------ src/TimerRecordDialog.cpp | 2 +- src/TimerRecordDialog.h | 4 +- src/TranslatableStringArray.h | 2 +- src/commands/DragCommand.cpp | 5 +- src/commands/GetInfoCommand.cpp | 8 +-- src/commands/GetTrackInfoCommand.cpp | 3 +- src/commands/ScreenshotCommand.cpp | 8 +-- src/commands/SelectCommand.cpp | 9 ++- src/commands/SetClipCommand.cpp | 5 +- src/commands/SetTrackInfoCommand.cpp | 17 +++-- src/effects/ChangePitch.cpp | 6 +- src/effects/ChangeSpeed.cpp | 6 +- src/effects/Distortion.cpp | 2 +- src/effects/Effect.cpp | 6 +- src/effects/Equalization.cpp | 6 +- src/effects/Noise.cpp | 2 +- src/effects/NoiseReduction.cpp | 52 +++++++-------- src/effects/ScienFilter.cpp | 8 +-- src/effects/ToneGen.cpp | 4 +- src/effects/TruncSilence.cpp | 2 +- src/effects/audiounits/AudioUnitEffect.cpp | 8 +-- src/effects/nyquist/Nyquist.cpp | 2 +- src/effects/vamp/VampEffect.cpp | 8 +-- src/export/ExportCL.cpp | 4 +- src/export/ExportFFmpeg.cpp | 4 +- src/export/ExportFFmpegDialogs.cpp | 6 +- src/export/ExportFFmpegDialogs.h | 17 ++--- src/export/ExportMP2.cpp | 2 +- src/export/ExportMP3.cpp | 4 +- src/export/ExportMultiple.cpp | 2 +- src/export/ExportPCM.cpp | 8 +-- src/import/ImportRaw.cpp | 8 +-- src/menus/TrackMenus.cpp | 2 +- src/prefs/DevicePrefs.cpp | 10 ++- src/prefs/DevicePrefs.h | 5 +- src/prefs/MidiIOPrefs.cpp | 9 ++- src/prefs/MidiIOPrefs.h | 6 +- src/prefs/ModulePrefs.cpp | 19 +++--- src/prefs/QualityPrefs.h | 4 +- src/prefs/SpectrogramSettings.cpp | 4 +- src/prefs/SpectrogramSettings.h | 5 +- src/prefs/SpectrumPrefs.cpp | 44 ++++++------- src/prefs/SpectrumPrefs.h | 10 ++- src/prefs/TracksBehaviorsPrefs.h | 1 + src/prefs/WaveformPrefs.cpp | 6 +- src/prefs/WaveformPrefs.h | 3 +- src/prefs/WaveformSettings.cpp | 2 +- src/prefs/WaveformSettings.h | 4 +- src/toolbars/DeviceToolBar.cpp | 4 +- .../wavetrack/ui/WaveTrackControls.cpp | 2 +- 57 files changed, 244 insertions(+), 253 deletions(-) diff --git a/src/Dependencies.cpp b/src/Dependencies.cpp index 16de1a003..3690d64f5 100644 --- a/src/Dependencies.cpp +++ b/src/Dependencies.cpp @@ -397,7 +397,7 @@ void DependencyDialog::PopulateOrExchange(ShuttleGui& S) mFutureActionChoice = S.Id(FutureActionChoiceID).AddChoice( _("Whenever a project depends on other files:"), - &choices, + choices, 0 // "Ask me" ); } diff --git a/src/FreqWindow.cpp b/src/FreqWindow.cpp index d8f6215bb..c18bc9645 100644 --- a/src/FreqWindow.cpp +++ b/src/FreqWindow.cpp @@ -235,7 +235,7 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id, wxT("65536") , }; - wxArrayString funcChoices; + wxArrayStringEx funcChoices; for (int i = 0, cnt = NumWindowFuncs(); i < cnt; i++) { /* i18n-hint: This refers to a "window function", @@ -444,13 +444,13 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id, S.AddSpace(5); mAlgChoice = S.Id(FreqAlgChoiceID) - .AddChoice(_("&Algorithm:"), &algChoices, mAlg); + .AddChoice(_("&Algorithm:"), algChoices, mAlg); S.SetSizeHints(wxDefaultCoord, wxDefaultCoord); S.AddSpace(5); mSizeChoice = S.Id(FreqSizeChoiceID) - .AddChoice(_("&Size:"), &sizeChoices, mSize); + .AddChoice(_("&Size:"), sizeChoices, mSize); S.SetSizeHints(wxDefaultCoord, wxDefaultCoord); S.AddSpace(5); @@ -467,14 +467,14 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id, S.AddSpace(5); mFuncChoice = S.Id(FreqFuncChoiceID) - .AddChoice(_("&Function:"), &funcChoices, mFunc); + .AddChoice(_("&Function:"), funcChoices, mFunc); S.SetSizeHints(wxDefaultCoord, wxDefaultCoord); mFuncChoice->MoveAfterInTabOrder(mSizeChoice); S.AddSpace(5); mAxisChoice = S.Id(FreqAxisChoiceID) - .AddChoice(_("&Axis:"), &axisChoices, mAxis); + .AddChoice(_("&Axis:"), axisChoices, mAxis); S.SetSizeHints(wxDefaultCoord, wxDefaultCoord); mAxisChoice->MoveAfterInTabOrder(mFuncChoice); diff --git a/src/Internat.cpp b/src/Internat.cpp index 8420f0c45..ea2f78d70 100644 --- a/src/Internat.cpp +++ b/src/Internat.cpp @@ -300,10 +300,10 @@ wxString Internat::StripAccelerators(const wxString &s) return result; } -wxArrayString LocalizedStrings( +wxArrayStringEx LocalizedStrings( const EnumValueSymbol strings[], size_t nStrings) { - return transform_range( + return transform_range( strings, strings + nStrings, std::mem_fn( &EnumValueSymbol::Translation ) ); diff --git a/src/Internat.h b/src/Internat.h index 92e960995..97ad6dda3 100644 --- a/src/Internat.h +++ b/src/Internat.h @@ -12,7 +12,6 @@ #ifndef __AUDACITY_INTERNAT__ #define __AUDACITY_INTERNAT__ -#include #include #include @@ -22,6 +21,8 @@ #include "Audacity.h" #include "audacity/Types.h" +class wxArrayString; +class wxArrayStringEx; class wxString; extern AUDACITY_DLL_API const wxString& GetCustomTranslation(const wxString& str1 ); @@ -181,7 +182,7 @@ private: #define LAT1CTOWX(X) wxString((X), wxConvISO8859_1) class ComponentInterfaceSymbol; -wxArrayString LocalizedStrings( +wxArrayStringEx LocalizedStrings( const EnumValueSymbol strings[], size_t nStrings); // This object pairs an internal string, maybe empty, with a translated string. diff --git a/src/LangChoice.cpp b/src/LangChoice.cpp index 3d7b47952..9d05c0717 100644 --- a/src/LangChoice.cpp +++ b/src/LangChoice.cpp @@ -47,7 +47,7 @@ private: int mNumLangs; wxArrayString mLangCodes; - wxArrayString mLangNames; + wxArrayStringEx mLangNames; DECLARE_EVENT_TABLE() }; @@ -88,7 +88,7 @@ LangChoiceDialog::LangChoiceDialog(wxWindow * parent, { S.SetBorder(15); mChoice = S.AddChoice(_("Choose Language for Audacity to use:"), - &mLangNames, + mLangNames, lang); } S.EndVerticalLay(); diff --git a/src/ShuttleGui.cpp b/src/ShuttleGui.cpp index 41fb82385..a040e5ea0 100644 --- a/src/ShuttleGui.cpp +++ b/src/ShuttleGui.cpp @@ -377,7 +377,7 @@ wxBitmapButton * ShuttleGuiBase::AddBitmapButton(const wxBitmap &Bitmap, int Pos } wxChoice * ShuttleGuiBase::AddChoice( const wxString &Prompt, - const wxArrayString * pChoices, int Selected ) + const wxArrayStringEx &choices, int Selected ) { HandleOptionality( Prompt ); AddPrompt( Prompt ); @@ -392,12 +392,12 @@ wxChoice * ShuttleGuiBase::AddChoice( const wxString &Prompt, miId, wxDefaultPosition, wxDefaultSize, - *pChoices, + choices, Style( 0 ) ); pChoice->SetSizeHints( 180,-1);// Use -1 for 'default size' - Platform specific. pChoice->SetName(wxStripMenuCodes(Prompt)); - if ( Selected >= 0 && Selected < pChoices->size() ) + if ( Selected >= 0 && Selected < choices.size() ) pChoice->SetSelection( Selected ); UpdateSizers(); @@ -447,7 +447,7 @@ wxStaticText * ShuttleGuiBase::AddVariableText(const wxString &Str, bool bCenter return pStatic; } -wxComboBox * ShuttleGuiBase::AddCombo( const wxString &Prompt, const wxString &Selected,const wxArrayString * pChoices, long style ) +wxComboBox * ShuttleGuiBase::AddCombo( const wxString &Prompt, const wxString &Selected,const wxArrayStringEx & choices, long style ) { HandleOptionality( Prompt ); AddPrompt( Prompt ); @@ -457,13 +457,13 @@ wxComboBox * ShuttleGuiBase::AddCombo( const wxString &Prompt, const wxString &S wxComboBox * pCombo; miProp=0; - int n = pChoices->size(); + int n = choices.size(); if( n>50 ) n=50; int i; wxString Choices[50]; for(i=0;iSetMinSize( wxSize( 120,150 )); UpdateSizers(); return pListBox; @@ -1363,7 +1363,7 @@ wxSlider * ShuttleGuiBase::TieSlider( const wxString &Prompt, WrappedType & Wrap wxChoice * ShuttleGuiBase::TieChoice( const wxString &Prompt, WrappedType &WrappedRef, - const wxArrayString * pChoices ) + const wxArrayStringEx &choices ) { HandleOptionality( Prompt ); @@ -1377,11 +1377,11 @@ wxChoice * ShuttleGuiBase::TieChoice( case eIsCreating: { if( WrappedRef.IsString() ) { - auto Selected = pChoices->Index( WrappedRef.ReadAsString() ); - pChoice = AddChoice( Prompt, pChoices, Selected ); + auto Selected = choices.Index( WrappedRef.ReadAsString() ); + pChoice = AddChoice( Prompt, choices, Selected ); } else - pChoice = AddChoice( Prompt, pChoices, WrappedRef.ReadAsInt() ); + pChoice = AddChoice( Prompt, choices, WrappedRef.ReadAsInt() ); } break; // IF setting internal storage from the controls. @@ -1419,7 +1419,7 @@ wxChoice * ShuttleGuiBase::TieChoice( wxASSERT( false ); break; } - SetSizeHints(*pChoices); + SetSizeHints(choices); return pChoice; } @@ -1582,19 +1582,19 @@ wxSlider * ShuttleGuiBase::TieVSlider( const wxString &Prompt, float &pos, const wxChoice * ShuttleGuiBase::TieChoice( const wxString &Prompt, wxString &Selected, - const wxArrayString * pChoices ) + const wxArrayStringEx &choices ) { WrappedType WrappedRef( Selected ); - return TieChoice( Prompt, WrappedRef, pChoices ); + return TieChoice( Prompt, WrappedRef, choices ); } wxChoice * ShuttleGuiBase::TieChoice( const wxString &Prompt, int &Selected, - const wxArrayString * pChoices ) + const wxArrayStringEx &choices ) { WrappedType WrappedRef( Selected ); - return TieChoice( Prompt, WrappedRef, pChoices ); + return TieChoice( Prompt, WrappedRef, choices ); } //-----------------------------------------------------------------------// @@ -1605,7 +1605,7 @@ wxChoice * ShuttleGuiBase::TieChoice( //-----------------------------------------------------------------------// /// String-to-Index -int ShuttleGuiBase::TranslateToIndex( const wxString &Value, const wxArrayString &Choices ) +int ShuttleGuiBase::TranslateToIndex( const wxString &Value, const wxArrayStringEx &Choices ) { int n = make_iterator_range( Choices ).index( Value ); if( n == wxNOT_FOUND ) @@ -1615,7 +1615,7 @@ int ShuttleGuiBase::TranslateToIndex( const wxString &Value, const wxArrayString } /// Index-to-String -wxString ShuttleGuiBase::TranslateFromIndex( const int nIn, const wxArrayString &Choices ) +wxString ShuttleGuiBase::TranslateFromIndex( const int nIn, const wxArrayStringEx &Choices ) { int n = nIn; if( n== wxNOT_FOUND ) @@ -1882,7 +1882,7 @@ wxChoice *ShuttleGuiBase::TieChoice( // Do this to force any needed migrations first enumSetting.Read(); - wxArrayString visibleChoices, internalChoices; + wxArrayStringEx visibleChoices, internalChoices; for (const auto &ident : enumSetting) { visibleChoices.push_back( ident.Translation() ); internalChoices.push_back( ident.Internal() ); @@ -1903,8 +1903,8 @@ wxChoice * ShuttleGuiBase::TieChoice( const wxString &Prompt, const wxString &SettingName, const wxString &Default, - const wxArrayString & Choices, - const wxArrayString & InternalChoices) + const wxArrayStringEx & Choices, + const wxArrayStringEx & InternalChoices) { wxChoice * pChoice=(wxChoice*)NULL; @@ -1916,7 +1916,7 @@ wxChoice * ShuttleGuiBase::TieChoice( // Put to prefs does 2 and 3. if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef ); // Get Index from Prefs. if( DoStep(1) ) TempIndex = TranslateToIndex( TempStr, InternalChoices ); // To an index - if( DoStep(2) ) pChoice = TieChoice( Prompt, TempIndex, &Choices ); // Get/Put index from GUI. + if( DoStep(2) ) pChoice = TieChoice( Prompt, TempIndex, Choices ); // Get/Put index from GUI. if( DoStep(3) ) TempStr = TranslateFromIndex( TempIndex, InternalChoices ); // To a string if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef ); // Put into Prefs. return pChoice; @@ -1935,7 +1935,7 @@ wxChoice * ShuttleGuiBase::TieChoice( const wxString &Prompt, const wxString &SettingName, const int Default, - const wxArrayString & Choices, + const wxArrayStringEx & Choices, const std::vector & InternalChoices) { wxChoice * pChoice=(wxChoice*)NULL; @@ -1947,7 +1947,7 @@ wxChoice * ShuttleGuiBase::TieChoice( // Put to prefs does 2 and 3. if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef ); // Get Int from Prefs. if( DoStep(1) ) TempIndex = TranslateToIndex( TranslatedInt, InternalChoices ); // Int to an index. - if( DoStep(2) ) pChoice = TieChoice( Prompt, TempIndex, &Choices ); // Get/Put index from GUI. + if( DoStep(2) ) pChoice = TieChoice( Prompt, TempIndex, Choices ); // Get/Put index from GUI. if( DoStep(3) ) TranslatedInt = TranslateFromIndex( TempIndex, InternalChoices ); // Index to int if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef ); // Put into Prefs. return pChoice; @@ -1967,7 +1967,7 @@ wxChoice * ShuttleGuiBase::TieNumberAsChoice( const wxString &Prompt, const wxString &SettingName, const int Default, - const wxArrayString & Choices, + const wxArrayStringEx & Choices, const std::vector & InternalChoices) { return ShuttleGuiBase::TieChoice( @@ -2375,7 +2375,7 @@ wxSizerItem * ShuttleGui::AddSpace( int width, int height ) return mpSizer->Add( width, height, miProp); } -void ShuttleGuiBase::SetSizeHints( wxWindow *window, const wxArrayString & items ) +void ShuttleGuiBase::SetSizeHints( wxWindow *window, const wxArrayStringEx & items ) { int maxw = 0; @@ -2406,7 +2406,7 @@ void ShuttleGuiBase::SetSizeHints( wxWindow *window, const wxArrayString & items window->SetSizeHints( maxw, -1 ); } -void ShuttleGuiBase::SetSizeHints( const wxArrayString & items ) +void ShuttleGuiBase::SetSizeHints( const wxArrayStringEx & items ) { if( mShuttleMode != eIsCreating ) return; @@ -2457,8 +2457,8 @@ wxChoice * ShuttleGuiGetDefinition::TieChoice( const wxString &Prompt, const wxString &SettingName, const wxString &Default, - const wxArrayString &Choices, - const wxArrayString & InternalChoices ) + const wxArrayStringEx &Choices, + const wxArrayStringEx & InternalChoices ) { StartStruct(); AddItem( SettingName, "id" ); @@ -2478,7 +2478,7 @@ wxChoice * ShuttleGuiGetDefinition::TieChoice( const wxString &Prompt, const wxString &SettingName, const int Default, - const wxArrayString & Choices, + const wxArrayStringEx & Choices, const std::vector & InternalChoices) { // Should no longer come here! @@ -2506,7 +2506,7 @@ wxChoice * ShuttleGuiGetDefinition::TieNumberAsChoice( const wxString &Prompt, const wxString &SettingName, const int Default, - const wxArrayString & Choices, + const wxArrayStringEx & Choices, const std::vector & InternalChoices) { // Come here for controls that present non-exhaustive choices among some diff --git a/src/ShuttleGui.h b/src/ShuttleGui.h index 479011f5e..d9c472ef6 100644 --- a/src/ShuttleGui.h +++ b/src/ShuttleGui.h @@ -29,6 +29,8 @@ class EnumSetting; +class wxArrayStringEx; + const int nMaxNestedSizers = 20; @@ -103,14 +105,14 @@ public: wxTextCtrl * AddTextBox(const wxString &Caption, const wxString &Value, const int nChars); wxTextCtrl * AddNumericTextBox(const wxString &Caption, const wxString &Value, const int nChars); wxTextCtrl * AddTextWindow(const wxString &Value); - wxListBox * AddListBox(const wxArrayString * pChoices, long style = 0); + wxListBox * AddListBox(const wxArrayStringEx &choices, long style = 0); wxListCtrl * AddListControl(); wxListCtrl * AddListControlReportMode(); wxGrid * AddGrid(); wxCheckBox * AddCheckBox( const wxString &Prompt, const wxString &Selected); wxCheckBox * AddCheckBoxOnRight( const wxString &Prompt, const wxString &Selected); - wxComboBox * AddCombo( const wxString &Prompt, const wxString &Selected,const wxArrayString * pChoices, long style = 0 ); - wxChoice * AddChoice( const wxString &Prompt, const wxArrayString * pChoices, int Selected = -1 ); + wxComboBox * AddCombo( const wxString &Prompt, const wxString &Selected,const wxArrayStringEx & choices, long style = 0 ); + wxChoice * AddChoice( const wxString &Prompt, const wxArrayStringEx &choices, int Selected = -1 ); wxMenuBar * AddMenuBar( ); wxMenu * AddMenu( const wxString & Title ); void AddIcon( wxBitmap * pBmp); @@ -158,8 +160,8 @@ public: void DoDataShuttle( const wxString &Name, WrappedType & WrappedRef ); bool DoStep( int iStep ); - int TranslateToIndex( const wxString &Value, const wxArrayString &Choices ); - wxString TranslateFromIndex( const int nIn, const wxArrayString &Choices ); + int TranslateToIndex( const wxString &Value, const wxArrayStringEx &Choices ); + wxString TranslateFromIndex( const int nIn, const wxArrayStringEx &Choices ); int TranslateToIndex( const int Value, const std::vector &Choices ); int TranslateFromIndex( const int nIn, const std::vector &Choices ); @@ -182,9 +184,9 @@ public: wxCheckBox * TieCheckBoxOnRight( const wxString & Prompt, WrappedType & WrappedRef ); wxCheckBox * TieCheckBoxOnRight( const wxString & Prompt, bool & Var ); - wxChoice * TieChoice( const wxString &Prompt, WrappedType & WrappedRef, const wxArrayString * pChoices ); - wxChoice * TieChoice( const wxString &Prompt, wxString &Selected, const wxArrayString * pChoices ); - wxChoice * TieChoice( const wxString &Prompt, int &Selected, const wxArrayString * pChoices ); + wxChoice * TieChoice( const wxString &Prompt, WrappedType & WrappedRef, const wxArrayStringEx &choices ); + wxChoice * TieChoice( const wxString &Prompt, wxString &Selected, const wxArrayStringEx &choices ); + wxChoice * TieChoice( const wxString &Prompt, int &Selected, const wxArrayStringEx &choices ); wxSlider * TieSlider( const wxString &Prompt, WrappedType & WrappedRef, const int max, const int min = 0 ); wxSlider * TieSlider( const wxString &Prompt, int &pos, const int max, const int min = 0); @@ -222,8 +224,8 @@ public: const wxString &Prompt, const wxString &SettingName, const wxString &Default, - const wxArrayString &Choices, - const wxArrayString & InternalChoices ); + const wxArrayStringEx &Choices, + const wxArrayStringEx & InternalChoices ); // This overload of TieChoice should no longer be used in Preferences! // Some uses do remain in export settings dialogs. @@ -231,7 +233,7 @@ public: const wxString &Prompt, const wxString &SettingName, const int Default, - const wxArrayString & Choices, + const wxArrayStringEx & Choices, const std::vector & InternalChoices ); // This overload presents what is really a numerical setting as a choice among @@ -245,7 +247,7 @@ public: const wxString &Prompt, const wxString &SettingName, const int Default, - const wxArrayString & Choices, + const wxArrayStringEx & Choices, const std::vector & InternalChoices ); virtual wxTextCtrl * TieTextBox( @@ -316,9 +318,9 @@ protected: long Style( long Style ); private: - void SetSizeHints( const wxArrayString & items ); + void SetSizeHints( const wxArrayStringEx & items ); public: - static void SetSizeHints( wxWindow *window, const wxArrayString & items ); + static void SetSizeHints( wxWindow *window, const wxArrayStringEx & items ); protected: wxWindow * mpLastWind; @@ -447,22 +449,22 @@ public: const wxString &Prompt, const wxString &SettingName, const wxString &Default, - const wxArrayString &Choices, - const wxArrayString & InternalChoices ) override; + const wxArrayStringEx &Choices, + const wxArrayStringEx & InternalChoices ) override; // An assertion will be violated if this override is reached! wxChoice * TieChoice( const wxString &Prompt, const wxString &SettingName, const int Default, - const wxArrayString & Choices, + const wxArrayStringEx & Choices, const std::vector & InternalChoices) override; wxChoice * TieNumberAsChoice( const wxString &Prompt, const wxString &SettingName, const int Default, - const wxArrayString & Choices, + const wxArrayStringEx & Choices, const std::vector & InternalChoices) override; wxTextCtrl * TieTextBox( diff --git a/src/TimerRecordDialog.cpp b/src/TimerRecordDialog.cpp index e9d9b844a..f824f91f5 100644 --- a/src/TimerRecordDialog.cpp +++ b/src/TimerRecordDialog.cpp @@ -943,7 +943,7 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S) #endif m_pTimerAfterCompleteChoiceCtrl = S.AddChoice(_("After Recording completes:"), - &m_sTimerAfterCompleteOptionsArray, + m_sTimerAfterCompleteOptionsArray, iPostTimerRecordAction); } S.EndMultiColumn(); diff --git a/src/TimerRecordDialog.h b/src/TimerRecordDialog.h index 4a2e50079..1e4a6c5c2 100644 --- a/src/TimerRecordDialog.h +++ b/src/TimerRecordDialog.h @@ -30,6 +30,8 @@ class NumericTextCtrl; class ShuttleGui; class TimerRecordPathCtrl; +class wxArrayStringEx; + enum TimerRecordCompletedActions { TR_ACTION_NOTHING = 0x00000000, TR_ACTION_SAVED = 0x00000001, @@ -145,7 +147,7 @@ private: bool m_bProjectAlreadySaved; // Variables for After Timer Recording Option - wxArrayString m_sTimerAfterCompleteOptionsArray; + wxArrayStringEx m_sTimerAfterCompleteOptionsArray; DECLARE_EVENT_TABLE() }; diff --git a/src/TranslatableStringArray.h b/src/TranslatableStringArray.h index 2f494ddfe..aed8ede73 100644 --- a/src/TranslatableStringArray.h +++ b/src/TranslatableStringArray.h @@ -14,7 +14,7 @@ Paul Licameli #include #include -class wxArrayString; +class wxArrayStringEx; wxDECLARE_EXPORTED_EVENT(AUDACITY_DLL_API, EVT_LANGUAGE_CHANGE, wxCommandEvent); diff --git a/src/commands/DragCommand.cpp b/src/commands/DragCommand.cpp index a0ecb53cd..e2298c48d 100644 --- a/src/commands/DragCommand.cpp +++ b/src/commands/DragCommand.cpp @@ -60,8 +60,6 @@ bool DragCommand::DefineParams( ShuttleParams & S ){ void DragCommand::PopulateOrExchange(ShuttleGui & S) { - auto coords = LocalizedStrings( kCoordTypeStrings, nCoordTypes ); - S.AddSpace(0, 5); S.StartMultiColumn(3, wxALIGN_CENTER); @@ -73,7 +71,8 @@ void DragCommand::PopulateOrExchange(ShuttleGui & S) S.Optional( bHasFromY ).TieNumericTextBox( _("From Y:"), mFromY ); S.Optional( bHasToX ).TieNumericTextBox( _("To X:"), mToX ); S.Optional( bHasToY ).TieNumericTextBox( _("To Y:"), mToY ); - S.Optional( bHasRelativeTo ).TieChoice( _("Relative To:"), mRelativeTo, &coords ); + S.Optional( bHasRelativeTo ).TieChoice( _("Relative To:"), mRelativeTo, + LocalizedStrings( kCoordTypeStrings, nCoordTypes ) ); } S.EndMultiColumn(); } diff --git a/src/commands/GetInfoCommand.cpp b/src/commands/GetInfoCommand.cpp index f6170554c..a900cb53e 100644 --- a/src/commands/GetInfoCommand.cpp +++ b/src/commands/GetInfoCommand.cpp @@ -96,14 +96,14 @@ bool GetInfoCommand::DefineParams( ShuttleParams & S ){ void GetInfoCommand::PopulateOrExchange(ShuttleGui & S) { - auto types = LocalizedStrings( kTypes, nTypes ); - auto formats = LocalizedStrings( kFormats, nFormats ); S.AddSpace(0, 5); S.StartMultiColumn(2, wxALIGN_CENTER); { - S.TieChoice( _("Type:"), mInfoType, &types); - S.TieChoice( _("Format:"), mFormat, &formats); + S.TieChoice( _("Type:"), + mInfoType, LocalizedStrings( kTypes, nTypes )); + S.TieChoice( _("Format:"), + mFormat, LocalizedStrings( kFormats, nFormats )); } S.EndMultiColumn(); } diff --git a/src/commands/GetTrackInfoCommand.cpp b/src/commands/GetTrackInfoCommand.cpp index 592689aba..9da7df48b 100644 --- a/src/commands/GetTrackInfoCommand.cpp +++ b/src/commands/GetTrackInfoCommand.cpp @@ -48,12 +48,11 @@ bool GetTrackInfoCommand::DefineParams( ShuttleParams & S ){ void GetTrackInfoCommand::PopulateOrExchange(ShuttleGui & S) { - auto types = LocalizedStrings( kTypes, nTypes ); S.AddSpace(0, 5); S.StartMultiColumn(2, wxALIGN_CENTER); { - S.TieChoice( _("Types:"), mInfoType, &types); + S.TieChoice( _("Types:"), mInfoType, LocalizedStrings( kTypes, nTypes )); } S.EndMultiColumn(); } diff --git a/src/commands/ScreenshotCommand.cpp b/src/commands/ScreenshotCommand.cpp index 384f665c3..8d30764f3 100644 --- a/src/commands/ScreenshotCommand.cpp +++ b/src/commands/ScreenshotCommand.cpp @@ -105,15 +105,15 @@ bool ScreenshotCommand::DefineParams( ShuttleParams & S ){ void ScreenshotCommand::PopulateOrExchange(ShuttleGui & S) { - auto whats = LocalizedStrings(kCaptureWhatStrings, nCaptureWhats); - auto backs = LocalizedStrings(kBackgroundStrings, nBackgrounds); S.AddSpace(0, 5); S.StartMultiColumn(2, wxALIGN_CENTER); { S.TieTextBox( _("Path:"), mPath); - S.TieChoice( _("Capture What:"), mWhat, &whats); - S.TieChoice( _("Background:"), mBack, &backs); + S.TieChoice( _("Capture What:"), + mWhat, LocalizedStrings(kCaptureWhatStrings, nCaptureWhats)); + S.TieChoice( _("Background:"), + mBack, LocalizedStrings(kBackgroundStrings, nBackgrounds)); S.TieCheckBox( _("Bring To Top:"), mbBringToTop); } S.EndMultiColumn(); diff --git a/src/commands/SelectCommand.cpp b/src/commands/SelectCommand.cpp index ad4680031..39fc65ae8 100644 --- a/src/commands/SelectCommand.cpp +++ b/src/commands/SelectCommand.cpp @@ -65,7 +65,6 @@ bool SelectTimeCommand::DefineParams( ShuttleParams & S ){ void SelectTimeCommand::PopulateOrExchange(ShuttleGui & S) { - auto relativeSpec = LocalizedStrings( kRelativeTo, nRelativeTos ); S.AddSpace(0, 5); S.StartMultiColumn(3, wxEXPAND); @@ -74,8 +73,9 @@ void SelectTimeCommand::PopulateOrExchange(ShuttleGui & S) S.Optional( bHasT0 ).TieTextBox(_("Start Time:"), mT0); S.Optional( bHasT1 ).TieTextBox(_("End Time:"), mT1); // Chooses what time is relative to. - S.Optional( bHasRelativeSpec ).TieChoice( - _("Relative To:"), mRelativeTo, &relativeSpec); + S.Optional( bHasRelativeSpec ).TieChoice( + _("Relative To:"), + mRelativeTo, LocalizedStrings( kRelativeTo, nRelativeTos )); } S.EndMultiColumn(); } @@ -187,7 +187,6 @@ bool SelectTracksCommand::DefineParams( ShuttleParams & S ){ void SelectTracksCommand::PopulateOrExchange(ShuttleGui & S) { - auto modes = LocalizedStrings( kModes, nModes ); S.AddSpace(0, 5); S.StartMultiColumn(3, wxEXPAND); @@ -200,7 +199,7 @@ void SelectTracksCommand::PopulateOrExchange(ShuttleGui & S) S.StartMultiColumn(2, wxALIGN_CENTER); { // Always used, so no check box. - S.TieChoice( _("Mode:"), mMode, &modes); + S.TieChoice( _("Mode:"), mMode, LocalizedStrings( kModes, nModes )); } S.EndMultiColumn(); } diff --git a/src/commands/SetClipCommand.cpp b/src/commands/SetClipCommand.cpp index 95e5e96a2..9e56f5585 100644 --- a/src/commands/SetClipCommand.cpp +++ b/src/commands/SetClipCommand.cpp @@ -58,14 +58,13 @@ bool SetClipCommand::DefineParams( ShuttleParams & S ){ void SetClipCommand::PopulateOrExchange(ShuttleGui & S) { - auto colours = LocalizedStrings( kColourStrings, nColours ); - S.AddSpace(0, 5); S.StartMultiColumn(3, wxALIGN_CENTER); { S.Optional( bHasContainsTime).TieNumericTextBox( _("At:"), mContainsTime ); - S.Optional( bHasColour ).TieChoice( _("Colour:"), mColour, &colours ); + S.Optional( bHasColour ).TieChoice( _("Colour:"), mColour, + LocalizedStrings( kColourStrings, nColours ) ); S.Optional( bHasT0 ).TieNumericTextBox( _("Start:"), mT0 ); } S.EndMultiColumn(); diff --git a/src/commands/SetTrackInfoCommand.cpp b/src/commands/SetTrackInfoCommand.cpp index cf87d12a4..e5295e893 100644 --- a/src/commands/SetTrackInfoCommand.cpp +++ b/src/commands/SetTrackInfoCommand.cpp @@ -306,20 +306,19 @@ bool SetTrackVisualsCommand::DefineParams( ShuttleParams & S ){ void SetTrackVisualsCommand::PopulateOrExchange(ShuttleGui & S) { - auto colours = LocalizedStrings( kColourStrings, nColours ); - auto displays = LocalizedStrings( kDisplayTypeStrings, nDisplayTypes ); - auto scales = LocalizedStrings( kScaleTypeStrings, nScaleTypes ); - auto vzooms = LocalizedStrings( kZoomTypeStrings, nZoomTypes ); - SetTrackBase::PopulateOrExchange( S ); S.StartMultiColumn(3, wxEXPAND); { S.SetStretchyCol( 2 ); S.Optional( bHasHeight ).TieNumericTextBox( _("Height:"), mHeight ); - S.Optional( bHasColour ).TieChoice( _("Colour:"), mColour, &colours ); - S.Optional( bHasDisplayType ).TieChoice( _("Display:"), mDisplayType, &displays ); - S.Optional( bHasScaleType ).TieChoice( _("Scale:"), mScaleType, &scales ); - S.Optional( bHasVZoom ).TieChoice( _("VZoom:"), mVZoom, &vzooms ); + S.Optional( bHasColour ).TieChoice( _("Colour:"), mColour, + LocalizedStrings( kColourStrings, nColours ) ); + S.Optional( bHasDisplayType ).TieChoice( _("Display:"), mDisplayType, + LocalizedStrings( kDisplayTypeStrings, nDisplayTypes ) ); + S.Optional( bHasScaleType ).TieChoice( _("Scale:"), mScaleType, + LocalizedStrings( kScaleTypeStrings, nScaleTypes ) ); + S.Optional( bHasVZoom ).TieChoice( _("VZoom:"), mVZoom, + LocalizedStrings( kZoomTypeStrings, nZoomTypes ) ); S.Optional( bHasVZoomTop ).TieTextBox( _("VZoom Top:"), mVZoomTop ); S.Optional( bHasVZoomBottom ).TieTextBox( _("VZoom Bottom:"), mVZoomBottom ); } diff --git a/src/effects/ChangePitch.cpp b/src/effects/ChangePitch.cpp index 284e55f95..e7c826e6c 100644 --- a/src/effects/ChangePitch.cpp +++ b/src/effects/ChangePitch.cpp @@ -248,7 +248,7 @@ void EffectChangePitch::PopulateOrExchange(ShuttleGui & S) { DeduceFrequencies(); // Set frequency-related control values based on sample. - wxArrayString pitch; + wxArrayStringEx pitch; for (int ii = 0; ii < 12; ++ii) pitch.push_back( PitchName( ii, PitchNameChoice::Both ) ); @@ -270,7 +270,7 @@ void EffectChangePitch::PopulateOrExchange(ShuttleGui & S) { S.StartMultiColumn(6, wxALIGN_CENTER); // 6 controls, because each AddChoice adds a wxStaticText and a wxChoice. { - m_pChoice_FromPitch = S.Id(ID_FromPitch).AddChoice(_("from"), &pitch); + m_pChoice_FromPitch = S.Id(ID_FromPitch).AddChoice(_("from"), pitch); m_pChoice_FromPitch->SetName(_("from")); m_pChoice_FromPitch->SetSizeHints(80, -1); @@ -278,7 +278,7 @@ void EffectChangePitch::PopulateOrExchange(ShuttleGui & S) m_pSpin_FromOctave->SetName(_("from Octave")); m_pSpin_FromOctave->SetSizeHints(50, -1); - m_pChoice_ToPitch = S.Id(ID_ToPitch).AddChoice(_("to"), &pitch); + m_pChoice_ToPitch = S.Id(ID_ToPitch).AddChoice(_("to"), pitch); m_pChoice_ToPitch->SetName(_("to")); m_pChoice_ToPitch->SetSizeHints(80, -1); diff --git a/src/effects/ChangeSpeed.cpp b/src/effects/ChangeSpeed.cpp index 87ce0e47e..4018d31ac 100644 --- a/src/effects/ChangeSpeed.cpp +++ b/src/effects/ChangeSpeed.cpp @@ -336,7 +336,7 @@ void EffectChangeSpeed::PopulateOrExchange(ShuttleGui & S) wxASSERT(nVinyl == WXSIZEOF(kVinylStrings)); - wxArrayString vinylChoices; + wxArrayStringEx vinylChoices; for (int i = 0; i < nVinyl; i++) { if (i == kVinyl_NA) @@ -350,12 +350,12 @@ void EffectChangeSpeed::PopulateOrExchange(ShuttleGui & S) } mpChoice_FromVinyl = - S.Id(ID_FromVinyl).AddChoice(_("from"), &vinylChoices); + S.Id(ID_FromVinyl).AddChoice(_("from"), vinylChoices); mpChoice_FromVinyl->SetName(_("From rpm")); mpChoice_FromVinyl->SetSizeHints(100, -1); mpChoice_ToVinyl = - S.Id(ID_ToVinyl).AddChoice(_("to"), &vinylChoices); + S.Id(ID_ToVinyl).AddChoice(_("to"), vinylChoices); mpChoice_ToVinyl->SetName(_("To rpm")); mpChoice_ToVinyl->SetSizeHints(100, -1); } diff --git a/src/effects/Distortion.cpp b/src/effects/Distortion.cpp index 6df26c01e..224512ee2 100644 --- a/src/effects/Distortion.cpp +++ b/src/effects/Distortion.cpp @@ -367,7 +367,7 @@ 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:"), tableTypes); mTypeChoiceCtrl->SetValidator(wxGenericValidator(&mParams.mTableChoiceIndx)); S.SetSizeHints(-1, -1); diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index 1582fe219..46b1c7667 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -3917,13 +3917,11 @@ EffectPresetsDialog::EffectPresetsDialog(wxWindow *parent, Effect *effect) S.StartTwoColumn(); S.SetStretchyCol(1); { - wxArrayString empty; - S.AddPrompt(_("Type:")); - mType = S.Id(ID_Type).AddChoice( {}, &empty, 0 ); + mType = S.Id(ID_Type).AddChoice( {}, {}, 0 ); S.AddPrompt(_("&Preset:")); - mPresets = S.AddListBox(&empty, wxLB_SINGLE | wxLB_NEEDED_SB ); + mPresets = S.AddListBox( {}, wxLB_SINGLE | wxLB_NEEDED_SB ); } S.EndTwoColumn(); diff --git a/src/effects/Equalization.cpp b/src/effects/Equalization.cpp index a4bbff7fb..a992b1810 100644 --- a/src/effects/Equalization.cpp +++ b/src/effects/Equalization.cpp @@ -762,7 +762,7 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S) auto interpolations = LocalizedStrings(kInterpStrings, nInterpolations); - mInterpChoice = S.Id(ID_Interp).AddChoice( {}, &interpolations, 0 ); + mInterpChoice = S.Id(ID_Interp).AddChoice( {}, interpolations, 0 ); mInterpChoice->SetName(_("Interpolation type")); } S.EndHorizontalLay(); @@ -829,13 +829,13 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S) { S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1); { - wxArrayString curves; + 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( {}, curves ); mCurve->SetName(_("Select Curve")); } S.EndHorizontalLay(); diff --git a/src/effects/Noise.cpp b/src/effects/Noise.cpp index 2492569fb..41f003809 100644 --- a/src/effects/Noise.cpp +++ b/src/effects/Noise.cpp @@ -224,7 +224,7 @@ void EffectNoise::PopulateOrExchange(ShuttleGui & S) S.StartMultiColumn(2, wxCENTER); { auto typeChoices = LocalizedStrings(kTypeStrings, nTypes); - S.AddChoice(_("Noise type:"), &typeChoices) + S.AddChoice(_("Noise type:"), typeChoices) ->SetValidator(wxGenericValidator(&mType)); FloatingPointValidator vldAmp(6, &mAmp, NumValidatorStyle::NO_TRAILING_ZEROES); diff --git a/src/effects/NoiseReduction.cpp b/src/effects/NoiseReduction.cpp index 1d6af1f7d..26d2d892c 100644 --- a/src/effects/NoiseReduction.cpp +++ b/src/effects/NoiseReduction.cpp @@ -1754,41 +1754,41 @@ void EffectNoiseReduction::Dialog::PopulateOrExchange(ShuttleGui & S) windowTypeChoices.push_back(windowTypesInfo[ii].name); S.TieChoice(_("&Window types") + wxString(wxT(":")), mTempSettings.mWindowTypes, - &windowTypeChoices); + windowTypeChoices); } { - wxArrayStringEx windowSizeChoices{ - _("8") , - _("16") , - _("32") , - _("64") , - _("128") , - _("256") , - _("512") , - _("1024") , - _("2048 (default)") , - _("4096") , - _("8192") , - _("16384") , - }; S.TieChoice(_("Window si&ze") + wxString(wxT(":")), mTempSettings.mWindowSizeChoice, - &windowSizeChoices); + { + _("8") , + _("16") , + _("32") , + _("64") , + _("128") , + _("256") , + _("512") , + _("1024") , + _("2048 (default)") , + _("4096") , + _("8192") , + _("16384") , + } + ); } { - wxArrayStringEx stepsPerWindowChoices{ - _("2") , - _("4 (default)") , - _("8") , - _("16") , - _("32") , - _("64") , - }; S.TieChoice(_("S&teps per window") + wxString(wxT(":")), mTempSettings.mStepsPerWindowChoice, - &stepsPerWindowChoices); + { + _("2") , + _("4 (default)") , + _("8") , + _("16") , + _("32") , + _("64") , + } + ); } S.Id(ID_CHOICE_METHOD); @@ -1802,7 +1802,7 @@ void EffectNoiseReduction::Dialog::PopulateOrExchange(ShuttleGui & S) methodChoices.push_back(discriminationMethodInfo[ii].name); S.TieChoice(_("Discrimination &method") + wxString(wxT(":")), mTempSettings.mMethod, - &methodChoices); + methodChoices); } } S.EndMultiColumn(); diff --git a/src/effects/ScienFilter.cpp b/src/effects/ScienFilter.cpp index c2220058b..2808b5a1a 100644 --- a/src/effects/ScienFilter.cpp +++ b/src/effects/ScienFilter.cpp @@ -463,17 +463,17 @@ void EffectScienFilter::PopulateOrExchange(ShuttleGui & S) auto typeChoices = LocalizedStrings(kTypeStrings, nTypes); mFilterTypeCtl = S.Id(ID_Type) - .AddChoice(_("&Filter Type:"), &typeChoices); + .AddChoice(_("&Filter Type:"), typeChoices); mFilterTypeCtl->SetValidator(wxGenericValidator(&mFilterType)); S.SetSizeHints(-1, -1); - wxArrayString orders; + 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).AddChoice(_("O&rder:"), orders); mFilterOrderCtl->SetValidator(wxGenericValidator(&mOrderIndex)); S.SetSizeHints(-1, -1); S.AddSpace(1, 1); @@ -491,7 +491,7 @@ void EffectScienFilter::PopulateOrExchange(ShuttleGui & S) auto subTypeChoices = LocalizedStrings(kSubTypeStrings, nSubTypes); mFilterSubTypeCtl = S.Id(ID_SubType) - .AddChoice(_("&Subtype:"), &subTypeChoices); + .AddChoice(_("&Subtype:"), subTypeChoices); mFilterSubTypeCtl->SetValidator(wxGenericValidator(&mFilterSubtype)); S.SetSizeHints(-1, -1); diff --git a/src/effects/ToneGen.cpp b/src/effects/ToneGen.cpp index bfa700e70..51b4c489c 100644 --- a/src/effects/ToneGen.cpp +++ b/src/effects/ToneGen.cpp @@ -334,7 +334,7 @@ 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:"), waveforms); c->SetValidator(wxGenericValidator(&mWaveform)); if (mChirp) @@ -407,7 +407,7 @@ void EffectToneGen::PopulateOrExchange(ShuttleGui & S) S.EndHorizontalLay(); auto interpolations = LocalizedStrings(kInterStrings, nInterpolations); - c = S.AddChoice(_("Interpolation:"), &interpolations); + c = S.AddChoice(_("Interpolation:"), interpolations); c->SetValidator(wxGenericValidator(&mInterpolation)); } else diff --git a/src/effects/TruncSilence.cpp b/src/effects/TruncSilence.cpp index 77f2fefcb..91e76bb0c 100644 --- a/src/effects/TruncSilence.cpp +++ b/src/effects/TruncSilence.cpp @@ -775,7 +775,7 @@ void EffectTruncSilence::PopulateOrExchange(ShuttleGui & S) { // Action choices auto actionChoices = LocalizedStrings(kActionStrings, nActions); - mActionChoice = S.AddChoice( {}, &actionChoices ); + mActionChoice = S.AddChoice( {}, actionChoices ); mActionChoice->SetValidator(wxGenericValidator(&mActionIndex)); S.SetSizeHints(-1, -1); } diff --git a/src/effects/audiounits/AudioUnitEffect.cpp b/src/effects/audiounits/AudioUnitEffect.cpp index 401497828..2900b4a02 100644 --- a/src/effects/audiounits/AudioUnitEffect.cpp +++ b/src/effects/audiounits/AudioUnitEffect.cpp @@ -338,8 +338,6 @@ private: bool mUseLatency; wxString mUIType; - wxArrayStringEx mUITypes; - DECLARE_EVENT_TABLE() }; @@ -352,10 +350,6 @@ AudioUnitEffectOptionsDialog::AudioUnitEffectOptionsDialog(wxWindow * parent, Ef { mHost = host; - mUITypes.push_back(_("Full")); - mUITypes.push_back(_("Generic")); - mUITypes.push_back(_("Basic")); - mHost->GetSharedConfig(wxT("Options"), wxT("UseLatency"), mUseLatency, true); mHost->GetSharedConfig(wxT("Options"), wxT("UIType"), mUIType, wxT("Full")); @@ -407,7 +401,7 @@ void AudioUnitEffectOptionsDialog::PopulateOrExchange(ShuttleGui & S) { S.TieChoice(_("Select &interface"), mUIType, - &mUITypes); + { _("Full"), _("Generic"), _("Basic") }); } S.EndHorizontalLay(); } diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index 1b3cca2dc..0fad62773 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -2609,7 +2609,7 @@ void NyquistEffect::BuildEffectWindow(ShuttleGui & S) auto choices = LocalizedStrings(ctrl.choices.data(), ctrl.choices.size()); - S.Id(ID_Choice + i).AddChoice( {}, &choices ); + S.Id(ID_Choice + i).AddChoice( {}, choices ); } else if (ctrl.type == NYQ_CTRL_TIME) { diff --git a/src/effects/vamp/VampEffect.cpp b/src/effects/vamp/VampEffect.cpp index d86bd8b29..845508820 100644 --- a/src/effects/vamp/VampEffect.cpp +++ b/src/effects/vamp/VampEffect.cpp @@ -558,7 +558,7 @@ void VampEffect::PopulateOrExchange(ShuttleGui & S) { wxString currentProgram = wxString::FromUTF8(mPlugin->getCurrentProgram().c_str()); - wxArrayString choices; + wxArrayStringEx choices; for (size_t i = 0, cnt = programs.size(); i < cnt; i++) { choices.push_back(wxString::FromUTF8(programs[i].c_str())); @@ -569,7 +569,7 @@ void VampEffect::PopulateOrExchange(ShuttleGui & S) S.Id(ID_Program); mProgram = S.AddChoice( {}, - &choices, + choices, choices.Index( currentProgram ) ); mProgram->SetName(_("Program")); @@ -627,7 +627,7 @@ void VampEffect::PopulateOrExchange(ShuttleGui & S) mParameters[p].quantizeStep == 1.0 && !mParameters[p].valueNames.empty()) { - wxArrayString choices; + wxArrayStringEx choices; int selected = -1; for (size_t i = 0, cnt = mParameters[p].valueNames.size(); i < cnt; i++) @@ -641,7 +641,7 @@ void VampEffect::PopulateOrExchange(ShuttleGui & S) } S.Id(ID_Choices + p); - mChoices[p] = S.AddChoice( {}, &choices, selected ); + mChoices[p] = S.AddChoice( {}, choices, selected ); mChoices[p]->SetName(labelText); mChoices[p]->SetSizeHints(-1, -1); if (!tip.empty()) diff --git a/src/export/ExportCL.cpp b/src/export/ExportCL.cpp index 02c1f7bbc..2d020ab6e 100644 --- a/src/export/ExportCL.cpp +++ b/src/export/ExportCL.cpp @@ -99,7 +99,7 @@ ExportCLOptions::~ExportCLOptions() /// void ExportCLOptions::PopulateOrExchange(ShuttleGui & S) { - wxArrayString cmds; + wxArrayStringEx cmds; wxString cmd; for (size_t i = 0; i < mHistory.GetCount(); i++) { @@ -117,7 +117,7 @@ void ExportCLOptions::PopulateOrExchange(ShuttleGui & S) S.SetStretchyCol(1); mCmd = S.AddCombo(_("Command:"), cmd, - &cmds); + cmds); S.Id(ID_BROWSE).AddButton(_("Browse..."), wxALIGN_CENTER_VERTICAL); S.AddFixedText( {} ); diff --git a/src/export/ExportFFmpeg.cpp b/src/export/ExportFFmpeg.cpp index 3f7ab1fa1..374c5f6c0 100644 --- a/src/export/ExportFFmpeg.cpp +++ b/src/export/ExportFFmpeg.cpp @@ -1019,7 +1019,7 @@ int ExportFFmpeg::AskResample(int bitrate, int rate, int lowrate, int highrate, } S.EndHorizontalLay(); - wxArrayString choices; + wxArrayStringEx choices; int selected = -1; for (int i = 0; sampRates[i] > 0; i++) { @@ -1041,7 +1041,7 @@ int ExportFFmpeg::AskResample(int bitrate, int rate, int lowrate, int highrate, S.StartHorizontalLay(wxALIGN_CENTER, false); { choice = S.AddChoice(_("Sample Rates"), - &choices, + choices, selected); } S.EndHorizontalLay(); diff --git a/src/export/ExportFFmpegDialogs.cpp b/src/export/ExportFFmpegDialogs.cpp index 6dbc3ac5b..9562408db 100644 --- a/src/export/ExportFFmpegDialogs.cpp +++ b/src/export/ExportFFmpegDialogs.cpp @@ -1460,7 +1460,7 @@ void ExportFFmpegOptions::PopulateOrExchange(ShuttleGui & S) S.StartMultiColumn(7, wxEXPAND); { S.SetStretchyCol(1); - mPresetCombo = S.Id(FEPresetID).AddCombo(_("Preset:"), gPrefs->Read(wxT("/FileFormats/FFmpegPreset"),wxEmptyString), &mPresetNames); + mPresetCombo = S.Id(FEPresetID).AddCombo(_("Preset:"), gPrefs->Read(wxT("/FileFormats/FFmpegPreset"),wxEmptyString), mPresetNames); mLoadPreset = S.Id(FELoadPresetID).AddButton(_("Load Preset")); mSavePreset = S.Id(FESavePresetID).AddButton(_("Save Preset")); mDeletePreset = S.Id(FEDeletePresetID).AddButton(_("Delete Preset")); @@ -1486,9 +1486,9 @@ void ExportFFmpegOptions::PopulateOrExchange(ShuttleGui & S) S.SetStretchyRow(1); S.Id(FEAllFormatsID).AddButton(_("Show All Formats")); S.Id(FEAllCodecsID).AddButton(_("Show All Codecs")); - mFormatList = S.Id(FEFormatID).AddListBox(&mFormatNames); + mFormatList = S.Id(FEFormatID).AddListBox(mFormatNames); mFormatList->DeselectAll(); - mCodecList = S.Id(FECodecID).AddListBox(&mCodecNames); + mCodecList = S.Id(FECodecID).AddListBox(mCodecNames); mCodecList->DeselectAll(); } S.EndMultiColumn(); diff --git a/src/export/ExportFFmpegDialogs.h b/src/export/ExportFFmpegDialogs.h index b2f4afe20..61cc69b6a 100644 --- a/src/export/ExportFFmpegDialogs.h +++ b/src/export/ExportFFmpegDialogs.h @@ -24,6 +24,7 @@ LRN #include +class wxArrayStringEx; /// Identifiers for pre-set export types. enum FFmpegExposedFormat @@ -84,7 +85,7 @@ public: private: - wxArrayString mBitRateNames; + wxArrayStringEx mBitRateNames; std::vector mBitRateLabels; wxChoice *mBitRateChoice; @@ -122,7 +123,7 @@ public: private: - wxArrayString mBitRateNames; + wxArrayStringEx mBitRateNames; std::vector mBitRateLabels; wxChoice *mBitRateChoice; @@ -145,7 +146,7 @@ public: private: - wxArrayString mBitRateNames; + wxArrayStringEx mBitRateNames; std::vector mBitRateLabels; wxChoice *mBitRateChoice; @@ -215,13 +216,13 @@ private: wxArrayString mShownFormatLongNames; wxArrayString mShownCodecNames; wxArrayString mShownCodecLongNames; - wxArrayString mFormatNames; + wxArrayStringEx mFormatNames; wxArrayString mFormatLongNames; - wxArrayString mCodecNames; + wxArrayStringEx mCodecNames; wxArrayString mCodecLongNames; - wxArrayString mProfileNames; + wxArrayStringEx mProfileNames; std::vector mProfileLabels; - wxArrayString mPredictionOrderMethodNames; + wxArrayStringEx mPredictionOrderMethodNames; std::vector mPredictionOrderMethodLabels; wxChoice *mFormatChoice; @@ -268,7 +269,7 @@ private: std::unique_ptr mPresets; - wxArrayString mPresetNames; + wxArrayStringEx mPresetNames; /// Finds the format currently selected and returns it's name and description void FindSelectedFormat(wxString **name, wxString **longname); diff --git a/src/export/ExportMP2.cpp b/src/export/ExportMP2.cpp index e5dcf8389..fc2e01268 100644 --- a/src/export/ExportMP2.cpp +++ b/src/export/ExportMP2.cpp @@ -93,7 +93,7 @@ public: bool TransferDataFromWindow() override; private: - wxArrayString mBitRateNames; + wxArrayStringEx mBitRateNames; std::vector mBitRateLabels; }; diff --git a/src/export/ExportMP3.cpp b/src/export/ExportMP3.cpp index 8ccf6870d..3ae13668f 100644 --- a/src/export/ExportMP3.cpp +++ b/src/export/ExportMP3.cpp @@ -2001,7 +2001,7 @@ int ExportMP3::AskResample(int bitrate, int rate, int lowrate, int highrate) } S.EndHorizontalLay(); - wxArrayString choices; + wxArrayStringEx choices; int selected = -1; for (size_t i = 0; i < WXSIZEOF(sampRates); i++) { int label = sampRates[i].label; @@ -2020,7 +2020,7 @@ int ExportMP3::AskResample(int bitrate, int rate, int lowrate, int highrate) S.StartHorizontalLay(wxALIGN_CENTER, false); { choice = S.AddChoice(_("Sample Rates"), - &choices, + choices, selected); } S.EndHorizontalLay(); diff --git a/src/export/ExportMultiple.cpp b/src/export/ExportMultiple.cpp index 42a5fe21b..6654daeca 100644 --- a/src/export/ExportMultiple.cpp +++ b/src/export/ExportMultiple.cpp @@ -192,7 +192,7 @@ void ExportMultiple::PopulateOrExchange(ShuttleGui& S) wxString name = mProject->GetName(); wxString defaultFormat = gPrefs->Read(wxT("/Export/Format"), wxT("WAV")); - wxArrayString formats; + wxArrayStringEx formats; mPluginIndex = -1; mFilterIndex = 0; diff --git a/src/export/ExportPCM.cpp b/src/export/ExportPCM.cpp index c751f8996..eeaab93e2 100644 --- a/src/export/ExportPCM.cpp +++ b/src/export/ExportPCM.cpp @@ -116,8 +116,8 @@ private: private: - wxArrayString mHeaderNames; - wxArrayString mEncodingNames; + wxArrayStringEx mHeaderNames; + wxArrayStringEx mEncodingNames; wxChoice *mHeaderChoice; wxChoice *mEncodingChoice; int mHeaderFromChoice; @@ -191,11 +191,11 @@ void ExportPCMOptions::PopulateOrExchange(ShuttleGui & S) S.SetStretchyCol(1); mHeaderChoice = S.Id(ID_HEADER_CHOICE) .AddChoice(_("Header:"), - &mHeaderNames, + mHeaderNames, mHeaderFromChoice); mEncodingChoice = S.Id(ID_ENCODING_CHOICE) .AddChoice(_("Encoding:"), - &mEncodingNames, + mEncodingNames, mEncodingFromChoice); } S.EndMultiColumn(); diff --git a/src/import/ImportRaw.cpp b/src/import/ImportRaw.cpp index de2f8d692..88bef5727 100644 --- a/src/import/ImportRaw.cpp +++ b/src/import/ImportRaw.cpp @@ -320,7 +320,7 @@ ImportRawDialog::ImportRawDialog(wxWindow * parent, SetName(GetTitle()); ShuttleGui S(this, eIsCreating); - wxArrayString encodings; + wxArrayStringEx encodings; int num; int selection; int endian; @@ -398,13 +398,13 @@ ImportRawDialog::ImportRawDialog(wxWindow * parent, S.StartTwoColumn(); { mEncodingChoice = S.Id(ChoiceID).AddChoice(_("Encoding:"), - &encodings, + encodings, selection); mEndianChoice = S.Id(ChoiceID).AddChoice(_("Byte order:"), - &endians, + endians, endian); mChannelChoice = S.Id(ChoiceID).AddChoice(_("Channels:"), - &chans, + chans, mChannels - 1); } S.EndTwoColumn(); diff --git a/src/menus/TrackMenus.cpp b/src/menus/TrackMenus.cpp index e103a1ae3..fec31fdb8 100644 --- a/src/menus/TrackMenus.cpp +++ b/src/menus/TrackMenus.cpp @@ -931,7 +931,7 @@ void OnResample(const CommandContext &context) { cb = S.AddCombo(_("New sample rate (Hz):"), rate, - &rates); + rates); } S.EndHorizontalLay(); diff --git a/src/prefs/DevicePrefs.cpp b/src/prefs/DevicePrefs.cpp index f541b0c1d..0e46b0ab4 100644 --- a/src/prefs/DevicePrefs.cpp +++ b/src/prefs/DevicePrefs.cpp @@ -108,8 +108,6 @@ void DevicePrefs::GetNamesAndLabels() void DevicePrefs::PopulateOrExchange(ShuttleGui & S) { - wxArrayString empty; - S.SetBorder(2); S.StartScroller(); @@ -137,7 +135,7 @@ void DevicePrefs::PopulateOrExchange(ShuttleGui & S) { S.Id(PlayID); mPlay = S.AddChoice(_("&Device:"), - &empty); + {} ); } S.EndMultiColumn(); } @@ -149,11 +147,11 @@ void DevicePrefs::PopulateOrExchange(ShuttleGui & S) { S.Id(RecordID); mRecord = S.AddChoice(_("De&vice:"), - &empty); + {} ); S.Id(ChannelsID); mChannels = S.AddChoice(_("Cha&nnels:"), - &empty); + {} ); } S.EndMultiColumn(); } @@ -336,7 +334,7 @@ void DevicePrefs::OnDevice(wxCommandEvent & WXUNUSED(event)) cnt = 256; } - wxArrayString channelnames; + wxArrayStringEx channelnames; // Channel counts, mono, stereo etc... for (int i = 0; i < cnt; i++) { diff --git a/src/prefs/DevicePrefs.h b/src/prefs/DevicePrefs.h index 5d92b2390..52ad18d51 100644 --- a/src/prefs/DevicePrefs.h +++ b/src/prefs/DevicePrefs.h @@ -21,6 +21,7 @@ #include "PrefsPanel.h" class ShuttleGui; +class wxArrayStringEx; class DevicePrefs final : public PrefsPanel { @@ -38,8 +39,8 @@ class DevicePrefs final : public PrefsPanel void OnHost(wxCommandEvent & e); void OnDevice(wxCommandEvent & e); - wxArrayString mHostNames; - wxArrayString mHostLabels; + wxArrayStringEx mHostNames; + wxArrayStringEx mHostLabels; wxString mPlayDevice; wxString mRecordDevice; diff --git a/src/prefs/MidiIOPrefs.cpp b/src/prefs/MidiIOPrefs.cpp index 2ac427c0f..82bb1265b 100644 --- a/src/prefs/MidiIOPrefs.cpp +++ b/src/prefs/MidiIOPrefs.cpp @@ -112,7 +112,6 @@ void MidiIOPrefs::GetNamesAndLabels() { } void MidiIOPrefs::PopulateOrExchange( ShuttleGui & S ) { - wxArrayString empty; S.SetBorder(2); S.StartScroller(); @@ -141,7 +140,7 @@ void MidiIOPrefs::PopulateOrExchange( ShuttleGui & S ) { { S.Id(PlayID); mPlay = S.AddChoice(_("&Device:"), - &empty); + {} ); int latency = gPrefs->Read(wxT("/MidiIO/OutputLatency"), DEFAULT_SYNTH_LATENCY); mLatency = S.TieNumericTextBox(_("MIDI Synth L&atency (ms):"), @@ -158,13 +157,13 @@ void MidiIOPrefs::PopulateOrExchange( ShuttleGui & S ) { { S.Id(RecordID); mRecord = S.AddChoice(_("De&vice:"), - &empty); + {} ); S.Id(ChannelsID); /* mChannels = S.AddChoice(_("&Channels:"), wxEmptyString, - &empty); + {} ); */ } S.EndMultiColumn(); @@ -194,7 +193,7 @@ void MidiIOPrefs::OnHost(wxCommandEvent & WXUNUSED(e)) mRecord->clear(); #endif - wxArrayString playnames; + wxArrayStringEx playnames; wxArrayString recordnames; for (int i = 0; i < nDevices; i++) { diff --git a/src/prefs/MidiIOPrefs.h b/src/prefs/MidiIOPrefs.h index df1d36d12..662cf4f3c 100644 --- a/src/prefs/MidiIOPrefs.h +++ b/src/prefs/MidiIOPrefs.h @@ -26,6 +26,8 @@ class ShuttleGui; #include "PrefsPanel.h" +class wxArrayStringEx; + class MidiIOPrefs final : public PrefsPanel { public: @@ -43,8 +45,8 @@ class MidiIOPrefs final : public PrefsPanel void OnHost(wxCommandEvent & e); // void OnDevice(wxCommandEvent & e); - wxArrayString mHostNames; - wxArrayString mHostLabels; + wxArrayStringEx mHostNames; + wxArrayStringEx mHostLabels; wxString mPlayDevice; #ifdef EXPERIMENTAL_MIDI_IN diff --git a/src/prefs/ModulePrefs.cpp b/src/prefs/ModulePrefs.cpp index 21bc4ea34..9885e0cd8 100644 --- a/src/prefs/ModulePrefs.cpp +++ b/src/prefs/ModulePrefs.cpp @@ -95,14 +95,6 @@ void ModulePrefs::Populate() void ModulePrefs::PopulateOrExchange(ShuttleGui & S) { - wxArrayStringEx StatusChoices{ - _("Disabled" ) , - _("Enabled" ) , - _("Ask" ) , - _("Failed" ) , - _("New" ) , - }; - S.SetBorder(2); S.StartScroller(); @@ -117,7 +109,16 @@ void ModulePrefs::PopulateOrExchange(ShuttleGui & S) S.StartMultiColumn( 2 ); int i; for(i=0;i<(int)mModules.size();i++) - S.TieChoice( mModules[i], mStatuses[i], &StatusChoices ); + S.TieChoice( mModules[i], + mStatuses[i], + { + _("Disabled" ) , + _("Enabled" ) , + _("Ask" ) , + _("Failed" ) , + _("New" ) , + } + ); S.EndMultiColumn(); } if( mModules.size() < 1 ) diff --git a/src/prefs/QualityPrefs.h b/src/prefs/QualityPrefs.h index c44119f06..f48461b55 100644 --- a/src/prefs/QualityPrefs.h +++ b/src/prefs/QualityPrefs.h @@ -25,6 +25,8 @@ class ShuttleGui; enum sampleFormat : unsigned; enum DitherType : unsigned; +class wxArrayStringEx; + class QualityPrefs final : public PrefsPanel { public: @@ -45,7 +47,7 @@ class QualityPrefs final : public PrefsPanel void GetNamesAndLabels(); void OnSampleRateChoice(wxCommandEvent & e); - wxArrayString mSampleRateNames; + wxArrayStringEx mSampleRateNames; std::vector mSampleRateLabels; wxChoice *mSampleRates; diff --git a/src/prefs/SpectrogramSettings.cpp b/src/prefs/SpectrogramSettings.cpp index 561e1900a..4ecbe6f90 100644 --- a/src/prefs/SpectrogramSettings.cpp +++ b/src/prefs/SpectrogramSettings.cpp @@ -139,7 +139,7 @@ SpectrogramSettings& SpectrogramSettings::defaults() } //static -const wxArrayString &SpectrogramSettings::GetScaleNames() +const wxArrayStringEx &SpectrogramSettings::GetScaleNames() { class ScaleNamesArray final : public TranslatableStringArray { @@ -166,7 +166,7 @@ const wxArrayString &SpectrogramSettings::GetScaleNames() } //static -const wxArrayString &SpectrogramSettings::GetAlgorithmNames() +const wxArrayStringEx &SpectrogramSettings::GetAlgorithmNames() { class AlgorithmNamesArray final : public TranslatableStringArray { diff --git a/src/prefs/SpectrogramSettings.h b/src/prefs/SpectrogramSettings.h index 81f9db896..2582482a7 100644 --- a/src/prefs/SpectrogramSettings.h +++ b/src/prefs/SpectrogramSettings.h @@ -21,6 +21,7 @@ struct FFTParam; class NumberScale; class SpectrumPrefs; class wxArrayString; +class wxArrayStringEx; class SpectrogramSettings { @@ -65,8 +66,8 @@ public: stNumScaleTypes, }; - static const wxArrayString &GetScaleNames(); - static const wxArrayString &GetAlgorithmNames(); + static const wxArrayStringEx &GetScaleNames(); + static const wxArrayStringEx &GetAlgorithmNames(); static SpectrogramSettings &defaults(); SpectrogramSettings(); diff --git a/src/prefs/SpectrumPrefs.cpp b/src/prefs/SpectrumPrefs.cpp index e14992ad7..0a43bcbaa 100644 --- a/src/prefs/SpectrumPrefs.cpp +++ b/src/prefs/SpectrumPrefs.cpp @@ -83,31 +83,12 @@ enum { void SpectrumPrefs::Populate(size_t windowSize) { - mSizeChoices.push_back(_("8 - most wideband")); - mSizeChoices.push_back(wxT("16")); - mSizeChoices.push_back(wxT("32")); - mSizeChoices.push_back(wxT("64")); - mSizeChoices.push_back(wxT("128")); - mSizeChoices.push_back(wxT("256")); - mSizeChoices.push_back(wxT("512")); - mSizeChoices.push_back(_("1024 - default")); - mSizeChoices.push_back(wxT("2048")); - mSizeChoices.push_back(wxT("4096")); - mSizeChoices.push_back(wxT("8192")); - mSizeChoices.push_back(wxT("16384")); - mSizeChoices.push_back(_("32768 - most narrowband")); - wxASSERT(mSizeChoices.size() == SpectrogramSettings::NumWindowSizes); - PopulatePaddingChoices(windowSize); for (int i = 0; i < NumWindowFuncs(); i++) { mTypeChoices.push_back(WindowFuncName(i)); } - mScaleChoices = SpectrogramSettings::GetScaleNames(); - - mAlgorithmChoices = SpectrogramSettings::GetAlgorithmNames(); - //------------------------- Main section -------------------- // Now construct the GUI itself. ShuttleGui S(this, eIsCreatingFromPrefs); @@ -183,7 +164,7 @@ void SpectrumPrefs::PopulateOrExchange(ShuttleGui & S) S.SetStretchyCol( 1 ); S.Id(ID_SCALE).TieChoice(_("S&cale") + wxString(wxT(":")), mTempSettings.scaleType, - &mScaleChoices); + SpectrogramSettings::GetScaleNames()); mMinFreq = S.Id(ID_MINIMUM).TieNumericTextBox(_("Mi&n Frequency (Hz):"), mTempSettings.minFreq, @@ -233,21 +214,36 @@ void SpectrumPrefs::PopulateOrExchange(ShuttleGui & S) mAlgorithmChoice = S.Id(ID_ALGORITHM).TieChoice(_("A&lgorithm") + wxString(wxT(":")), mTempSettings.algorithm, - &mAlgorithmChoices); + SpectrogramSettings::GetAlgorithmNames()); S.Id(ID_WINDOW_SIZE).TieChoice(_("Window &size:"), mTempSettings.windowSize, - &mSizeChoices); + { + _("8 - most wideband"), + _("16"), + _("32"), + _("64"), + _("128"), + _("256"), + _("512"), + _("1024 - default"), + _("2048"), + _("4096"), + _("8192"), + _("16384"), + _("32768 - most narrowband"), + } + ); S.Id(ID_WINDOW_TYPE).TieChoice(_("Window &type:"), mTempSettings.windowType, - &mTypeChoices); + mTypeChoices); #ifdef EXPERIMENTAL_ZERO_PADDED_SPECTROGRAMS mZeroPaddingChoiceCtrl = S.Id(ID_PADDING_SIZE).TieChoice(_("&Zero padding factor") + wxString(wxT(":")), mTempSettings.zeroPaddingFactor, - &mZeroPaddingChoices); + mZeroPaddingChoices); #endif } S.EndMultiColumn(); diff --git a/src/prefs/SpectrumPrefs.h b/src/prefs/SpectrumPrefs.h index d3cf328ad..d1d43c9be 100644 --- a/src/prefs/SpectrumPrefs.h +++ b/src/prefs/SpectrumPrefs.h @@ -31,6 +31,8 @@ #include "PrefsPanel.h" #include "SpectrogramSettings.h" +class wxArrayStringEx; + class wxChoice; class wxCheckBox; class wxTextCtrl; @@ -73,19 +75,15 @@ class SpectrumPrefs final : public PrefsPanel wxTextCtrl *mRange; wxTextCtrl *mFrequencyGain; - wxArrayStringEx mSizeChoices; - #ifdef EXPERIMENTAL_ZERO_PADDED_SPECTROGRAMS int mZeroPaddingChoice; wxChoice *mZeroPaddingChoiceCtrl; - wxArrayString mZeroPaddingChoices; + wxArrayStringEx mZeroPaddingChoices; #endif - wxArrayString mTypeChoices; - wxArrayString mScaleChoices; + wxArrayStringEx mTypeChoices; wxChoice *mAlgorithmChoice; - wxArrayString mAlgorithmChoices; #ifdef EXPERIMENTAL_FIND_NOTES diff --git a/src/prefs/TracksBehaviorsPrefs.h b/src/prefs/TracksBehaviorsPrefs.h index ba7eca13a..6d66da08d 100644 --- a/src/prefs/TracksBehaviorsPrefs.h +++ b/src/prefs/TracksBehaviorsPrefs.h @@ -17,6 +17,7 @@ #include "PrefsPanel.h" class ShuttleGui; +class wxArrayStringEx; class TracksBehaviorsPrefs final : public PrefsPanel { diff --git a/src/prefs/WaveformPrefs.cpp b/src/prefs/WaveformPrefs.cpp index 4126f2d90..ddd132770 100644 --- a/src/prefs/WaveformPrefs.cpp +++ b/src/prefs/WaveformPrefs.cpp @@ -59,8 +59,6 @@ enum { void WaveformPrefs::Populate() { - mScaleChoices = WaveformSettings::GetScaleNames(); - // Reuse the same choices and codes as for Interface prefs GUIPrefs::GetRangeChoices(&mRangeChoices, &mRangeCodes); @@ -93,12 +91,12 @@ void WaveformPrefs::PopulateOrExchange(ShuttleGui & S) mScaleChoice = S.Id(ID_SCALE).TieChoice(_("S&cale") + wxString(wxT(":")), mTempSettings.scaleType, - &mScaleChoices); + WaveformSettings::GetScaleNames()); mRangeChoice = S.Id(ID_RANGE).TieChoice(_("Waveform dB &range") + wxString(wxT(":")), mTempSettings.dBRange, - &mRangeChoices); + mRangeChoices); } S.EndTwoColumn(); } diff --git a/src/prefs/WaveformPrefs.h b/src/prefs/WaveformPrefs.h index 35407ff67..853d20697 100644 --- a/src/prefs/WaveformPrefs.h +++ b/src/prefs/WaveformPrefs.h @@ -20,6 +20,8 @@ class WaveTrack; class wxCheckBox; class wxChoice; +class wxArrayStringEx; + class WaveformPrefs final : public PrefsPanel { public: @@ -47,7 +49,6 @@ private: wxChoice *mScaleChoice; wxChoice *mRangeChoice; - wxArrayString mScaleChoices; wxArrayStringEx mRangeCodes; wxArrayStringEx mRangeChoices; diff --git a/src/prefs/WaveformSettings.cpp b/src/prefs/WaveformSettings.cpp index 51e4d0138..6deeb0601 100644 --- a/src/prefs/WaveformSettings.cpp +++ b/src/prefs/WaveformSettings.cpp @@ -147,7 +147,7 @@ void WaveformSettings::NextHigherDBRange() } //static -const wxArrayString &WaveformSettings::GetScaleNames() +const wxArrayStringEx &WaveformSettings::GetScaleNames() { class ScaleNamesArray final : public TranslatableStringArray { diff --git a/src/prefs/WaveformSettings.h b/src/prefs/WaveformSettings.h index 3ad4ae257..fb09092dc 100644 --- a/src/prefs/WaveformSettings.h +++ b/src/prefs/WaveformSettings.h @@ -11,7 +11,7 @@ Paul Licameli #ifndef __AUDACITY_WAVEFORM_SETTINGS__ #define __AUDACITY_WAVEFORM_SETTINGS__ -class wxArrayString; +class wxArrayStringEx; class WaveformSettings { @@ -58,7 +58,7 @@ public: stNumScaleTypes, }; - static const wxArrayString &GetScaleNames(); + static const wxArrayStringEx &GetScaleNames(); ScaleType scaleType; int dBRange; diff --git a/src/toolbars/DeviceToolBar.cpp b/src/toolbars/DeviceToolBar.cpp index d2651be61..7fcd7a8ec 100644 --- a/src/toolbars/DeviceToolBar.cpp +++ b/src/toolbars/DeviceToolBar.cpp @@ -810,7 +810,7 @@ void DeviceToolBar::ShowComboDialog(wxChoice *combo, const wxString &title) } #if USE_PORTMIXER - auto inputSources = combo->GetStrings(); + wxArrayStringEx inputSources = combo->GetStrings(); wxDialogWrapper dlg(nullptr, wxID_ANY, title); dlg.SetName(dlg.GetTitle()); @@ -822,7 +822,7 @@ void DeviceToolBar::ShowComboDialog(wxChoice *combo, const wxString &title) S.StartHorizontalLay(wxCENTER, false); { c = S.AddChoice(combo->GetName(), - &inputSources, + inputSources, combo->GetSelection()); } S.EndHorizontalLay(); diff --git a/src/tracks/playabletrack/wavetrack/ui/WaveTrackControls.cpp b/src/tracks/playabletrack/wavetrack/ui/WaveTrackControls.cpp index dbe4b7d53..6a562fdd1 100644 --- a/src/tracks/playabletrack/wavetrack/ui/WaveTrackControls.cpp +++ b/src/tracks/playabletrack/wavetrack/ui/WaveTrackControls.cpp @@ -494,7 +494,7 @@ void RateMenuTable::OnRateOther(wxCommandEvent &) { cb = S.AddCombo(_("New sample rate (Hz):"), rate, - &rates); + rates); #if defined(__WXMAC__) // As of wxMac-2.8.12, setting manually is required // to handle rates not in the list. See: Bug #427