mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-24 00:18:07 +02:00
ShuttleGuiBase::DoTieChoice is no longer needed
This commit is contained in:
parent
d396472c9f
commit
416cdbefb6
@ -1449,9 +1449,9 @@ wxSlider * ShuttleGuiBase::DoTieSlider(
|
||||
}
|
||||
|
||||
|
||||
wxChoice * ShuttleGuiBase::DoTieChoice(
|
||||
wxChoice * ShuttleGuiBase::TieChoice(
|
||||
const TranslatableString &Prompt,
|
||||
WrappedType &WrappedRef,
|
||||
int &Selected,
|
||||
const TranslatableStrings &choices )
|
||||
{
|
||||
HandleOptionality( Prompt );
|
||||
@ -1465,17 +1465,7 @@ wxChoice * ShuttleGuiBase::DoTieChoice(
|
||||
{
|
||||
case eIsCreating:
|
||||
{
|
||||
if( WrappedRef.IsString() ) {
|
||||
auto str = WrappedRef.ReadAsString();
|
||||
auto begin = choices.begin();
|
||||
auto iter = std::find_if( begin, choices.end(),
|
||||
[&str]( const TranslatableString &choice ){
|
||||
return str == choice.Translation(); } );
|
||||
int Selected = std::distance( begin, iter );
|
||||
pChoice = AddChoice( Prompt, choices, Selected );
|
||||
}
|
||||
else
|
||||
pChoice = AddChoice( Prompt, choices, WrappedRef.ReadAsInt() );
|
||||
ShuttleGui::SetMinSize(pChoice, choices);
|
||||
}
|
||||
break;
|
||||
@ -1487,10 +1477,7 @@ wxChoice * ShuttleGuiBase::DoTieChoice(
|
||||
wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
|
||||
pChoice = wxDynamicCast(pWnd, wxChoice);
|
||||
wxASSERT( pChoice );
|
||||
if( WrappedRef.IsString())
|
||||
WrappedRef.WriteToAsString( pChoice->GetStringSelection());
|
||||
else
|
||||
WrappedRef.WriteToAsInt( pChoice->GetSelection() );
|
||||
Selected = pChoice->GetSelection();
|
||||
}
|
||||
break;
|
||||
case eIsSettingToDialog:
|
||||
@ -1498,10 +1485,7 @@ wxChoice * ShuttleGuiBase::DoTieChoice(
|
||||
wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
|
||||
pChoice = wxDynamicCast(pWnd, wxChoice);
|
||||
wxASSERT( pChoice );
|
||||
if( WrappedRef.IsString() )
|
||||
pChoice->SetStringSelection( WrappedRef.ReadAsString() );
|
||||
else
|
||||
pChoice->SetSelection( WrappedRef.ReadAsInt() );
|
||||
pChoice->SetSelection( Selected );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -1709,8 +1693,7 @@ wxChoice * ShuttleGuiBase::TieChoice(
|
||||
const TranslatableStrings &choices )
|
||||
{
|
||||
int Index = make_iterator_range( choices ).index( Selected );
|
||||
WrappedType WrappedRef( Index );
|
||||
auto result = DoTieChoice( Prompt, WrappedRef, choices );
|
||||
auto result = TieChoice( Prompt, Index, choices );
|
||||
if ( Index >= 0 && Index < choices.size() )
|
||||
Selected = choices[ Index ];
|
||||
else
|
||||
@ -1718,15 +1701,6 @@ wxChoice * ShuttleGuiBase::TieChoice(
|
||||
return result;
|
||||
}
|
||||
|
||||
wxChoice * ShuttleGuiBase::TieChoice(
|
||||
const TranslatableString &Prompt,
|
||||
int &Selected,
|
||||
const TranslatableStrings &choices )
|
||||
{
|
||||
WrappedType WrappedRef( Selected );
|
||||
return DoTieChoice( Prompt, WrappedRef, choices );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------//
|
||||
|
||||
// ShuttleGui utility functions to look things up in a list.
|
||||
|
@ -562,9 +562,6 @@ private:
|
||||
wxTextCtrl * DoTieNumericTextBox(
|
||||
const TranslatableString &Prompt, WrappedType & WrappedRef, const int nChars);
|
||||
wxCheckBox * DoTieCheckBox( const TranslatableString &Prompt, WrappedType & WrappedRef );
|
||||
wxChoice * DoTieChoice(
|
||||
const TranslatableString &Prompt, WrappedType & WrappedRef,
|
||||
const TranslatableStrings & choices );
|
||||
wxSlider * DoTieSlider(
|
||||
const TranslatableString &Prompt,
|
||||
WrappedType & WrappedRef, const int max, const int min = 0 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user