1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-25 15:53:52 +02:00

Less use of wxArrayString::Index() ...

... instead use the utility make_iterator_range and its index() or contains()
method.  This generic utility works with any container defining begin() and
end().

This further lessens dependency on wxWidgets container idioms.
This commit is contained in:
Paul Licameli
2019-03-04 02:13:40 -05:00
parent c68e336247
commit dd8eb9e3d9
21 changed files with 42 additions and 37 deletions

View File

@@ -98,7 +98,7 @@ void DevicePrefs::GetNamesAndLabels()
const PaDeviceInfo *info = Pa_GetDeviceInfo(i);
if ((info!=NULL)&&(info->maxOutputChannels > 0 || info->maxInputChannels > 0)) {
wxString name = wxSafeConvertMB2WX(Pa_GetHostApiInfo(info->hostApi)->name);
if (mHostNames.Index(name) == wxNOT_FOUND) {
if ( ! make_iterator_range( mHostNames ).contains( name ) ) {
mHostNames.push_back(name);
mHostLabels.push_back(name);
}

View File

@@ -521,7 +521,7 @@ void KeyConfigPrefs::SetKeyForSelected(const NormalizedKeyString & key)
mView->SetKey(mCommandSelected, key);
mManager->SetKeyFromName(name, key);
mNewKeys[mNames.Index(name)] = key;
mNewKeys[ make_iterator_range( mNames ).index( name ) ] = key;
}
@@ -563,7 +563,7 @@ void KeyConfigPrefs::OnSet(wxCommandEvent & WXUNUSED(event))
mView->SetKeyByName(oldname, {});
mManager->SetKeyFromName(oldname, {});
mNewKeys[mNames.Index(oldname)] = {};
mNewKeys[ make_iterator_range( mNames ).index( oldname ) ] = {};
}

View File

@@ -103,7 +103,7 @@ void MidiIOPrefs::GetNamesAndLabels() {
const PmDeviceInfo *info = Pm_GetDeviceInfo(i);
if (info->output || info->input) { //should always happen
wxString name = wxSafeConvertMB2WX(info->interf);
if (mHostNames.Index(name) == wxNOT_FOUND) {
if ( ! make_iterator_range( mHostNames ).contains( name ) ) {
mHostNames.push_back(name);
mHostLabels.push_back(name);
}