fix thinko in MidiRegionView::add_to_selection()

The existing code isn't wrong, but inefficient. If the selection is empty,
then this is necessarily the first note, and cannot be present in the
selection. So, don't search the std::set<> and then insert, just insert.
This commit is contained in:
Paul Davis 2020-05-02 09:44:34 -06:00
parent 520ccd8ff2
commit f6496524a4
1 changed files with 4 additions and 10 deletions

View File

@ -2445,13 +2445,6 @@ MidiRegionView::remove_from_selection (NoteBase* ev)
void
MidiRegionView::add_to_selection (NoteBase* ev)
{
Selection::iterator n = _selection.find (ev);
if (n != _selection.end()) {
/* already selected */
return;
}
if (_selection.empty()) {
/* first note selected in this region, force Editor region
@ -2461,9 +2454,10 @@ MidiRegionView::add_to_selection (NoteBase* ev)
trackview.editor().set_selected_midi_region_view (*this);
}
_selection.insert (n, ev);
ev->set_selected (true);
start_playing_midi_note ((ev)->note());
if (_selection.insert (ev).second == true) {
ev->set_selected (true);
start_playing_midi_note ((ev)->note());
}
}
Temporal::Beats