mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-05 14:49:25 +02:00
Replace ShuttleGui::SetNoMatchSelector with arg in TieNumberAsChoice
This commit is contained in:
parent
5616137a8b
commit
f20e4786e9
@ -1924,7 +1924,8 @@ wxChoice * ShuttleGuiBase::TieNumberAsChoice(
|
|||||||
const wxString &Prompt,
|
const wxString &Prompt,
|
||||||
const SettingSpec< int > &Setting,
|
const SettingSpec< int > &Setting,
|
||||||
const wxArrayStringEx & Choices,
|
const wxArrayStringEx & Choices,
|
||||||
const std::vector<int> * pInternalChoices)
|
const std::vector<int> * pInternalChoices,
|
||||||
|
int iNoMatchSelector)
|
||||||
{
|
{
|
||||||
auto fn = [](int arg){ return wxString::Format( "%d", arg ); };
|
auto fn = [](int arg){ return wxString::Format( "%d", arg ); };
|
||||||
|
|
||||||
@ -1936,7 +1937,11 @@ wxChoice * ShuttleGuiBase::TieNumberAsChoice(
|
|||||||
for ( int ii = 0; ii < Choices.size(); ++ii )
|
for ( int ii = 0; ii < Choices.size(); ++ii )
|
||||||
InternalChoices.push_back( fn( ii ) );
|
InternalChoices.push_back( fn( ii ) );
|
||||||
|
|
||||||
|
|
||||||
const auto Default = Setting.GetDefault();
|
const auto Default = Setting.GetDefault();
|
||||||
|
|
||||||
|
miNoMatchSelector = iNoMatchSelector;
|
||||||
|
|
||||||
long defaultIndex;
|
long defaultIndex;
|
||||||
if ( pInternalChoices )
|
if ( pInternalChoices )
|
||||||
defaultIndex = make_iterator_range( *pInternalChoices ).index( Default );
|
defaultIndex = make_iterator_range( *pInternalChoices ).index( Default );
|
||||||
|
@ -248,7 +248,8 @@ public:
|
|||||||
const wxString &Prompt,
|
const wxString &Prompt,
|
||||||
const SettingSpec< int > &Setting,
|
const SettingSpec< int > &Setting,
|
||||||
const wxArrayStringEx & Choices,
|
const wxArrayStringEx & Choices,
|
||||||
const std::vector<int> * pInternalChoices = nullptr );
|
const std::vector<int> * pInternalChoices = nullptr,
|
||||||
|
int iNoMatchSelector = 0 );
|
||||||
|
|
||||||
virtual wxTextCtrl * TieTextBox(
|
virtual wxTextCtrl * TieTextBox(
|
||||||
const wxString &Prompt,
|
const wxString &Prompt,
|
||||||
@ -277,7 +278,6 @@ public:
|
|||||||
void SetSizeHints( int minX, int minY );
|
void SetSizeHints( int minX, int minY );
|
||||||
void SetBorder( int Border ) {miBorder = Border;};
|
void SetBorder( int Border ) {miBorder = Border;};
|
||||||
void SetStyle( int Style ) {miStyle = Style;};
|
void SetStyle( int Style ) {miStyle = Style;};
|
||||||
void SetNoMatchSelector( int iSelector ) {miNoMatchSelector = iSelector;};
|
|
||||||
void SetSizerProportion( int iProp ) {miSizerProp = iProp;};
|
void SetSizerProportion( int iProp ) {miSizerProp = iProp;};
|
||||||
void SetStretchyCol( int i );
|
void SetStretchyCol( int i );
|
||||||
void SetStretchyRow( int i );
|
void SetStretchyRow( int i );
|
||||||
|
@ -209,7 +209,7 @@ public:
|
|||||||
const wxString &Prompt,
|
const wxString &Prompt,
|
||||||
const SettingSpec< int > &Setting,
|
const SettingSpec< int > &Setting,
|
||||||
const wxArrayStringEx & Choices,
|
const wxArrayStringEx & Choices,
|
||||||
const std::vector<int> * pInternalChoices) override;
|
const std::vector<int> * pInternalChoices, int iNoMatchSelector ) override;
|
||||||
|
|
||||||
wxTextCtrl * TieTextBox(
|
wxTextCtrl * TieTextBox(
|
||||||
const wxString &Prompt,
|
const wxString &Prompt,
|
||||||
@ -274,7 +274,7 @@ wxChoice * ShuttleGuiGetDefinition::TieNumberAsChoice(
|
|||||||
const wxString &Prompt,
|
const wxString &Prompt,
|
||||||
const SettingSpec< int > &Setting,
|
const SettingSpec< int > &Setting,
|
||||||
const wxArrayStringEx & Choices,
|
const wxArrayStringEx & Choices,
|
||||||
const std::vector<int> * pInternalChoices)
|
const std::vector<int> * pInternalChoices, int iNoMatchSelector)
|
||||||
{
|
{
|
||||||
// Come here for controls that present non-exhaustive choices among some
|
// Come here for controls that present non-exhaustive choices among some
|
||||||
// numbers, with an associated control that allows arbitrary entry of an
|
// numbers, with an associated control that allows arbitrary entry of an
|
||||||
@ -286,7 +286,7 @@ wxChoice * ShuttleGuiGetDefinition::TieNumberAsChoice(
|
|||||||
AddItem( Setting.GetDefault(), "default" );
|
AddItem( Setting.GetDefault(), "default" );
|
||||||
EndStruct();
|
EndStruct();
|
||||||
return ShuttleGui::TieNumberAsChoice(
|
return ShuttleGui::TieNumberAsChoice(
|
||||||
Prompt, Setting, Choices, pInternalChoices );
|
Prompt, Setting, Choices, pInternalChoices, iNoMatchSelector );
|
||||||
}
|
}
|
||||||
wxTextCtrl * ShuttleGuiGetDefinition::TieTextBox(
|
wxTextCtrl * ShuttleGuiGetDefinition::TieTextBox(
|
||||||
const wxString &Prompt,
|
const wxString &Prompt,
|
||||||
|
@ -146,9 +146,6 @@ void QualityPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||||||
|
|
||||||
S.StartMultiColumn(2);
|
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...
|
// First the choice...
|
||||||
// We make sure it uses the ID we want, so that we get changes
|
// We make sure it uses the ID we want, so that we get changes
|
||||||
S.Id(ID_SAMPLE_RATE_CHOICE);
|
S.Id(ID_SAMPLE_RATE_CHOICE);
|
||||||
@ -157,7 +154,11 @@ void QualityPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||||||
{wxT("/SamplingRate/DefaultProjectSampleRate"),
|
{wxT("/SamplingRate/DefaultProjectSampleRate"),
|
||||||
AudioIOBase::GetOptimalSupportedSampleRate()},
|
AudioIOBase::GetOptimalSupportedSampleRate()},
|
||||||
mSampleRateNames,
|
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...
|
// Now do the edit box...
|
||||||
mOtherSampleRate = S.TieNumericTextBox( {},
|
mOtherSampleRate = S.TieNumericTextBox( {},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user