1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-19 09:01:15 +02:00

ShuttleGui::AddChoice takes int to specify selection, with a default...

... This makes things brief and where non-default avoids some repetition of
literal strings
This commit is contained in:
Paul Licameli
2019-02-12 16:30:22 -05:00
parent fbf324f52e
commit dcd82b8ef5
25 changed files with 78 additions and 87 deletions

View File

@@ -567,7 +567,11 @@ void VampEffect::PopulateOrExchange(ShuttleGui & S)
S.AddPrompt(_("Program"));
S.Id(ID_Program);
mProgram = S.AddChoice( {}, currentProgram, &choices);
mProgram = S.AddChoice(
{},
&choices,
choices.Index( currentProgram )
);
mProgram->SetName(_("Program"));
mProgram->SetSizeHints(-1, -1);
wxSizer *s = mProgram->GetContainingSizer();
@@ -624,20 +628,20 @@ void VampEffect::PopulateOrExchange(ShuttleGui & S)
!mParameters[p].valueNames.empty())
{
wxArrayString choices;
wxString selected;
int selected = -1;
for (size_t i = 0, cnt = mParameters[p].valueNames.size(); i < cnt; i++)
{
wxString choice = wxString::FromUTF8(mParameters[p].valueNames[i].c_str());
if (size_t(value - mParameters[p].minValue + 0.5) == i)
{
selected = choice;
selected = i;
}
choices.push_back(choice);
}
S.Id(ID_Choices + p);
mChoices[p] = S.AddChoice( {}, selected, &choices);
mChoices[p] = S.AddChoice( {}, &choices, selected );
mChoices[p]->SetName(labelText);
mChoices[p]->SetSizeHints(-1, -1);
if (!tip.empty())