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.
This commit is contained in:
Paul Licameli 2018-02-01 19:23:02 -05:00
parent dcd82b8ef5
commit dd86346156
57 changed files with 244 additions and 253 deletions

View File

@ -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"
);
}

View File

@ -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);

View File

@ -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<wxArrayString>(
return transform_range<wxArrayStringEx>(
strings, strings + nStrings,
std::mem_fn( &EnumValueSymbol::Translation )
);

View File

@ -12,7 +12,6 @@
#ifndef __AUDACITY_INTERNAT__
#define __AUDACITY_INTERNAT__
#include <wx/arrstr.h>
#include <wx/string.h>
#include <wx/longlong.h>
@ -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.

View File

@ -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();

View File

@ -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;i<n;i++)
{
Choices[i] = (*pChoices)[i];
Choices[i] = choices[i];
}
mpWind = pCombo = safenew wxComboBox(GetParent(), miId, Selected, wxDefaultPosition, wxDefaultSize,
@ -653,7 +653,7 @@ void ShuttleGuiBase::AddConstTextBox(const wxString &Prompt, const wxString &Val
UpdateSizers();
}
wxListBox * ShuttleGuiBase::AddListBox(const wxArrayString * pChoices, long style)
wxListBox * ShuttleGuiBase::AddListBox(const wxArrayStringEx &choices, long style)
{
UseUpId();
if( mShuttleMode != eIsCreating )
@ -661,7 +661,7 @@ wxListBox * ShuttleGuiBase::AddListBox(const wxArrayString * pChoices, long styl
wxListBox * pListBox;
SetProportions( 1 );
mpWind = pListBox = safenew wxListBox(GetParent(), miId,
wxDefaultPosition, wxDefaultSize,*pChoices, style);
wxDefaultPosition, wxDefaultSize, choices, style);
pListBox->SetMinSize( 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<int> & 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<int> & 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<int> & 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<int> & InternalChoices)
{
// Come here for controls that present non-exhaustive choices among some

View File

@ -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<int> &Choices );
int TranslateFromIndex( const int nIn, const std::vector<int> &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<int> & 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<int> & 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<int> & InternalChoices) override;
wxChoice * TieNumberAsChoice(
const wxString &Prompt,
const wxString &SettingName,
const int Default,
const wxArrayString & Choices,
const wxArrayStringEx & Choices,
const std::vector<int> & InternalChoices) override;
wxTextCtrl * TieTextBox(

View File

@ -943,7 +943,7 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
#endif
m_pTimerAfterCompleteChoiceCtrl = S.AddChoice(_("After Recording completes:"),
&m_sTimerAfterCompleteOptionsArray,
m_sTimerAfterCompleteOptionsArray,
iPostTimerRecordAction);
}
S.EndMultiColumn();

View File

@ -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()
};

View File

@ -14,7 +14,7 @@ Paul Licameli
#include <wx/app.h>
#include <wx/event.h>
class wxArrayString;
class wxArrayStringEx;
wxDECLARE_EXPORTED_EVENT(AUDACITY_DLL_API, EVT_LANGUAGE_CHANGE, wxCommandEvent);

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();

View File

@ -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();
}

View File

@ -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();

View File

@ -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 );
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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();

View File

@ -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();

View File

@ -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<double> vldAmp(6, &mAmp, NumValidatorStyle::NO_TRAILING_ZEROES);

View File

@ -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();

View File

@ -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);

View File

@ -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

View File

@ -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);
}

View File

@ -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();
}

View File

@ -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)
{

View File

@ -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())

View File

@ -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( {} );

View File

@ -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();

View File

@ -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();

View File

@ -24,6 +24,7 @@ LRN
#include <unordered_map>
class wxArrayStringEx;
/// Identifiers for pre-set export types.
enum FFmpegExposedFormat
@ -84,7 +85,7 @@ public:
private:
wxArrayString mBitRateNames;
wxArrayStringEx mBitRateNames;
std::vector<int> mBitRateLabels;
wxChoice *mBitRateChoice;
@ -122,7 +123,7 @@ public:
private:
wxArrayString mBitRateNames;
wxArrayStringEx mBitRateNames;
std::vector<int> mBitRateLabels;
wxChoice *mBitRateChoice;
@ -145,7 +146,7 @@ public:
private:
wxArrayString mBitRateNames;
wxArrayStringEx mBitRateNames;
std::vector<int> 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<int> mProfileLabels;
wxArrayString mPredictionOrderMethodNames;
wxArrayStringEx mPredictionOrderMethodNames;
std::vector<int> mPredictionOrderMethodLabels;
wxChoice *mFormatChoice;
@ -268,7 +269,7 @@ private:
std::unique_ptr<FFmpegPresets> mPresets;
wxArrayString mPresetNames;
wxArrayStringEx mPresetNames;
/// Finds the format currently selected and returns it's name and description
void FindSelectedFormat(wxString **name, wxString **longname);

View File

@ -93,7 +93,7 @@ public:
bool TransferDataFromWindow() override;
private:
wxArrayString mBitRateNames;
wxArrayStringEx mBitRateNames;
std::vector<int> mBitRateLabels;
};

View File

@ -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();

View File

@ -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;

View File

@ -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();

View File

@ -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();

View File

@ -931,7 +931,7 @@ void OnResample(const CommandContext &context)
{
cb = S.AddCombo(_("New sample rate (Hz):"),
rate,
&rates);
rates);
}
S.EndHorizontalLay();

View File

@ -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++) {

View File

@ -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;

View File

@ -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++) {

View File

@ -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

View File

@ -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 )

View File

@ -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<int> mSampleRateLabels;
wxChoice *mSampleRates;

View File

@ -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
{

View File

@ -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();

View File

@ -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();

View File

@ -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

View File

@ -17,6 +17,7 @@
#include "PrefsPanel.h"
class ShuttleGui;
class wxArrayStringEx;
class TracksBehaviorsPrefs final : public PrefsPanel
{

View File

@ -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();
}

View File

@ -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;

View File

@ -147,7 +147,7 @@ void WaveformSettings::NextHigherDBRange()
}
//static
const wxArrayString &WaveformSettings::GetScaleNames()
const wxArrayStringEx &WaveformSettings::GetScaleNames()
{
class ScaleNamesArray final : public TranslatableStringArray
{

View File

@ -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;

View File

@ -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();

View File

@ -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