1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 09:20:16 +01: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

@@ -553,10 +553,12 @@ void LabelDialog::OnInsert(wxCommandEvent &event)
if (cnt > 0) {
row = mGrid->GetGridCursorRow();
if (row > 0 && row >= cnt) {
index = mTrackNames.Index(mGrid->GetCellValue(row - 1, Col_Track));
index = make_iterator_range( mTrackNames )
.index( mGrid->GetCellValue(row - 1, Col_Track) );
}
else {
index = mTrackNames.Index(mGrid->GetCellValue(row, Col_Track));
index = make_iterator_range( mTrackNames )
.index( mGrid->GetCellValue(row, Col_Track) );
}
}
@@ -801,7 +803,7 @@ void LabelDialog::OnChangeTrack(wxGridEvent & WXUNUSED(event), int row, RowData
wxString val = mGrid->GetCellValue(row, Col_Track);
// User selected the "New..." choice so ask for a NEW name
if (mTrackNames.Index(val) == 0) {
if ( make_iterator_range( mTrackNames ).index( val ) == 0 ) {
AudacityTextEntryDialog d(this,
_("New Label Track"),
_("Enter track name"),
@@ -821,7 +823,7 @@ void LabelDialog::OnChangeTrack(wxGridEvent & WXUNUSED(event), int row, RowData
}
else {
// Remember the tracks index
rd->index = mTrackNames.Index(val);
rd->index = make_iterator_range( mTrackNames ).index( val );
}
// Repopulate the grid