diff --git a/src/ShuttleGui.cpp b/src/ShuttleGui.cpp index 8729151e4..377e9e5be 100644 --- a/src/ShuttleGui.cpp +++ b/src/ShuttleGui.cpp @@ -1924,7 +1924,8 @@ wxChoice * ShuttleGuiBase::TieNumberAsChoice( const wxString &Prompt, const SettingSpec< int > &Setting, const wxArrayStringEx & Choices, - const std::vector * pInternalChoices) + const std::vector * pInternalChoices, + int iNoMatchSelector) { auto fn = [](int arg){ return wxString::Format( "%d", arg ); }; @@ -1936,7 +1937,11 @@ wxChoice * ShuttleGuiBase::TieNumberAsChoice( for ( int ii = 0; ii < Choices.size(); ++ii ) InternalChoices.push_back( fn( ii ) ); + const auto Default = Setting.GetDefault(); + + miNoMatchSelector = iNoMatchSelector; + long defaultIndex; if ( pInternalChoices ) defaultIndex = make_iterator_range( *pInternalChoices ).index( Default ); diff --git a/src/ShuttleGui.h b/src/ShuttleGui.h index b70b463da..0dcb04dc7 100644 --- a/src/ShuttleGui.h +++ b/src/ShuttleGui.h @@ -248,7 +248,8 @@ public: const wxString &Prompt, const SettingSpec< int > &Setting, const wxArrayStringEx & Choices, - const std::vector * pInternalChoices = nullptr ); + const std::vector * pInternalChoices = nullptr, + int iNoMatchSelector = 0 ); virtual wxTextCtrl * TieTextBox( const wxString &Prompt, @@ -277,7 +278,6 @@ public: void SetSizeHints( int minX, int minY ); void SetBorder( int Border ) {miBorder = Border;}; void SetStyle( int Style ) {miStyle = Style;}; - void SetNoMatchSelector( int iSelector ) {miNoMatchSelector = iSelector;}; void SetSizerProportion( int iProp ) {miSizerProp = iProp;}; void SetStretchyCol( int i ); void SetStretchyRow( int i ); diff --git a/src/commands/GetInfoCommand.cpp b/src/commands/GetInfoCommand.cpp index b20fa1668..60fd17842 100644 --- a/src/commands/GetInfoCommand.cpp +++ b/src/commands/GetInfoCommand.cpp @@ -209,7 +209,7 @@ public: const wxString &Prompt, const SettingSpec< int > &Setting, const wxArrayStringEx & Choices, - const std::vector * pInternalChoices) override; + const std::vector * pInternalChoices, int iNoMatchSelector ) override; wxTextCtrl * TieTextBox( const wxString &Prompt, @@ -274,7 +274,7 @@ wxChoice * ShuttleGuiGetDefinition::TieNumberAsChoice( const wxString &Prompt, const SettingSpec< int > &Setting, const wxArrayStringEx & Choices, - const std::vector * pInternalChoices) + const std::vector * pInternalChoices, int iNoMatchSelector) { // Come here for controls that present non-exhaustive choices among some // numbers, with an associated control that allows arbitrary entry of an @@ -286,7 +286,7 @@ wxChoice * ShuttleGuiGetDefinition::TieNumberAsChoice( AddItem( Setting.GetDefault(), "default" ); EndStruct(); return ShuttleGui::TieNumberAsChoice( - Prompt, Setting, Choices, pInternalChoices ); + Prompt, Setting, Choices, pInternalChoices, iNoMatchSelector ); } wxTextCtrl * ShuttleGuiGetDefinition::TieTextBox( const wxString &Prompt, diff --git a/src/prefs/QualityPrefs.cpp b/src/prefs/QualityPrefs.cpp index 8098e6cc5..220442239 100644 --- a/src/prefs/QualityPrefs.cpp +++ b/src/prefs/QualityPrefs.cpp @@ -146,9 +146,6 @@ void QualityPrefs::PopulateOrExchange(ShuttleGui & S) S.StartMultiColumn(2); { - // If the value in Prefs isn't in the list, then we want - // the last item, 'Other...' to be shown. - S.SetNoMatchSelector(mSampleRateNames.size() - 1); // First the choice... // We make sure it uses the ID we want, so that we get changes S.Id(ID_SAMPLE_RATE_CHOICE); @@ -157,7 +154,11 @@ void QualityPrefs::PopulateOrExchange(ShuttleGui & S) {wxT("/SamplingRate/DefaultProjectSampleRate"), AudioIOBase::GetOptimalSupportedSampleRate()}, mSampleRateNames, - &mSampleRateLabels); + &mSampleRateLabels, + // If the value in Prefs isn't in the list, then we want + // the last item, 'Other...' to be shown. + mSampleRateNames.GetCount() - 1 + ); // Now do the edit box... mOtherSampleRate = S.TieNumericTextBox( {},