1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-25 15:53:52 +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

@@ -1020,7 +1020,7 @@ int ExportFFmpeg::AskResample(int bitrate, int rate, int lowrate, int highrate,
S.EndHorizontalLay();
wxArrayString choices;
wxString selected = wxT("");
int selected = -1;
for (int i = 0; sampRates[i] > 0; i++)
{
int label = sampRates[i];
@@ -1030,21 +1030,19 @@ int ExportFFmpeg::AskResample(int bitrate, int rate, int lowrate, int highrate,
choices.push_back(name);
if (label <= rate)
{
selected = name;
selected = i;
}
}
}
if (selected.empty())
{
selected = choices[0];
}
if (selected == -1)
selected = 0;
S.StartHorizontalLay(wxALIGN_CENTER, false);
{
choice = S.AddChoice(_("Sample Rates"),
selected,
&choices);
&choices,
selected);
}
S.EndHorizontalLay();
}

View File

@@ -2002,26 +2002,26 @@ int ExportMP3::AskResample(int bitrate, int rate, int lowrate, int highrate)
S.EndHorizontalLay();
wxArrayString choices;
wxString selected;
int selected = -1;
for (size_t i = 0; i < WXSIZEOF(sampRates); i++) {
int label = sampRates[i].label;
if (label >= lowrate && label <= highrate) {
choices.push_back(sampRates[i].name);
if (label <= rate) {
selected = sampRates[i].name;
selected = i;
}
}
}
if (selected.empty()) {
selected = choices[0];
if (selected == -1) {
selected = 0;
}
S.StartHorizontalLay(wxALIGN_CENTER, false);
{
choice = S.AddChoice(_("Sample Rates"),
selected,
&choices);
&choices,
selected);
}
S.EndHorizontalLay();
}

View File

@@ -191,12 +191,12 @@ void ExportPCMOptions::PopulateOrExchange(ShuttleGui & S)
S.SetStretchyCol(1);
mHeaderChoice = S.Id(ID_HEADER_CHOICE)
.AddChoice(_("Header:"),
mHeaderNames[mHeaderFromChoice],
&mHeaderNames);
&mHeaderNames,
mHeaderFromChoice);
mEncodingChoice = S.Id(ID_ENCODING_CHOICE)
.AddChoice(_("Encoding:"),
mEncodingNames[mEncodingFromChoice],
&mEncodingNames);
&mEncodingNames,
mEncodingFromChoice);
}
S.EndMultiColumn();
}