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,
|
const TranslatableString &Prompt,
|
||||||
WrappedType &WrappedRef,
|
int &Selected,
|
||||||
const TranslatableStrings &choices )
|
const TranslatableStrings &choices )
|
||||||
{
|
{
|
||||||
HandleOptionality( Prompt );
|
HandleOptionality( Prompt );
|
||||||
@ -1465,17 +1465,7 @@ wxChoice * ShuttleGuiBase::DoTieChoice(
|
|||||||
{
|
{
|
||||||
case eIsCreating:
|
case eIsCreating:
|
||||||
{
|
{
|
||||||
if( WrappedRef.IsString() ) {
|
pChoice = AddChoice( Prompt, choices, Selected );
|
||||||
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);
|
ShuttleGui::SetMinSize(pChoice, choices);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1487,10 +1477,7 @@ wxChoice * ShuttleGuiBase::DoTieChoice(
|
|||||||
wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
|
wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
|
||||||
pChoice = wxDynamicCast(pWnd, wxChoice);
|
pChoice = wxDynamicCast(pWnd, wxChoice);
|
||||||
wxASSERT( pChoice );
|
wxASSERT( pChoice );
|
||||||
if( WrappedRef.IsString())
|
Selected = pChoice->GetSelection();
|
||||||
WrappedRef.WriteToAsString( pChoice->GetStringSelection());
|
|
||||||
else
|
|
||||||
WrappedRef.WriteToAsInt( pChoice->GetSelection() );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eIsSettingToDialog:
|
case eIsSettingToDialog:
|
||||||
@ -1498,10 +1485,7 @@ wxChoice * ShuttleGuiBase::DoTieChoice(
|
|||||||
wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
|
wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
|
||||||
pChoice = wxDynamicCast(pWnd, wxChoice);
|
pChoice = wxDynamicCast(pWnd, wxChoice);
|
||||||
wxASSERT( pChoice );
|
wxASSERT( pChoice );
|
||||||
if( WrappedRef.IsString() )
|
pChoice->SetSelection( Selected );
|
||||||
pChoice->SetStringSelection( WrappedRef.ReadAsString() );
|
|
||||||
else
|
|
||||||
pChoice->SetSelection( WrappedRef.ReadAsInt() );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1709,8 +1693,7 @@ wxChoice * ShuttleGuiBase::TieChoice(
|
|||||||
const TranslatableStrings &choices )
|
const TranslatableStrings &choices )
|
||||||
{
|
{
|
||||||
int Index = make_iterator_range( choices ).index( Selected );
|
int Index = make_iterator_range( choices ).index( Selected );
|
||||||
WrappedType WrappedRef( Index );
|
auto result = TieChoice( Prompt, Index, choices );
|
||||||
auto result = DoTieChoice( Prompt, WrappedRef, choices );
|
|
||||||
if ( Index >= 0 && Index < choices.size() )
|
if ( Index >= 0 && Index < choices.size() )
|
||||||
Selected = choices[ Index ];
|
Selected = choices[ Index ];
|
||||||
else
|
else
|
||||||
@ -1718,15 +1701,6 @@ wxChoice * ShuttleGuiBase::TieChoice(
|
|||||||
return result;
|
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.
|
// ShuttleGui utility functions to look things up in a list.
|
||||||
|
@ -562,9 +562,6 @@ private:
|
|||||||
wxTextCtrl * DoTieNumericTextBox(
|
wxTextCtrl * DoTieNumericTextBox(
|
||||||
const TranslatableString &Prompt, WrappedType & WrappedRef, const int nChars);
|
const TranslatableString &Prompt, WrappedType & WrappedRef, const int nChars);
|
||||||
wxCheckBox * DoTieCheckBox( const TranslatableString &Prompt, WrappedType & WrappedRef );
|
wxCheckBox * DoTieCheckBox( const TranslatableString &Prompt, WrappedType & WrappedRef );
|
||||||
wxChoice * DoTieChoice(
|
|
||||||
const TranslatableString &Prompt, WrappedType & WrappedRef,
|
|
||||||
const TranslatableStrings & choices );
|
|
||||||
wxSlider * DoTieSlider(
|
wxSlider * DoTieSlider(
|
||||||
const TranslatableString &Prompt,
|
const TranslatableString &Prompt,
|
||||||
WrappedType & WrappedRef, const int max, const int min = 0 );
|
WrappedType & WrappedRef, const int max, const int min = 0 );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user