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

Rewrite AddChoice and TieChoice calls...

... either lifting or inlining array-of-string computations, so fewer statements
are mixed among ShuttleGui method calls
This commit is contained in:
Paul Licameli
2019-02-22 15:15:19 -05:00
parent f07d33f4b5
commit f846c25806
15 changed files with 183 additions and 187 deletions

View File

@@ -558,22 +558,19 @@ void VampEffect::PopulateOrExchange(ShuttleGui & S)
if (!programs.empty())
{
wxString currentProgram = wxString::FromUTF8(mPlugin->getCurrentProgram().c_str());
wxArrayStringEx choices;
for (size_t i = 0, cnt = programs.size(); i < cnt; i++)
{
choices.push_back(wxString::FromUTF8(programs[i].c_str()));
}
S.AddPrompt(_("Program"));
S.Id(ID_Program);
mProgram = S.AddChoice(
{},
choices,
currentProgram
);
mProgram = S
.AddChoice( {},
[&]{
wxArrayStringEx choices;
for (const auto &program : programs)
choices.push_back(wxString::FromUTF8(program.c_str()));
return choices;
}(),
wxString::FromUTF8(mPlugin->getCurrentProgram().c_str())
);
mProgram->SetName(_("Program"));
mProgram->SetSizeHints(-1, -1);
wxSizer *s = mProgram->GetContainingSizer();