13
0

use new API to get selected MIDI regions and clear current note selection in a MIDI region

This commit is contained in:
Paul Davis 2020-04-16 12:14:42 -06:00
parent 8545250936
commit cc32d42388

View File

@ -2583,7 +2583,8 @@ NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*ignored*/)
} else { } else {
relative = true; relative = true;
} }
MidiRegionSelection& ms (_editor->get_selection().midi_regions); MidiRegionSelection ms = _editor->get_selection().midi_regions();
if (ms.size() > 1) { if (ms.size() > 1) {
/* has to be relative, may make no sense otherwise */ /* has to be relative, may make no sense otherwise */
relative = true; relative = true;
@ -2614,7 +2615,7 @@ NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*ignored*/)
void void
NoteResizeDrag::motion (GdkEvent* event, bool first_move) NoteResizeDrag::motion (GdkEvent* event, bool first_move)
{ {
MidiRegionSelection& ms (_editor->get_selection().midi_regions); MidiRegionSelection ms = _editor->get_selection().midi_regions();
if (first_move) { if (first_move) {
_editor->begin_reversible_command (_("resize notes")); _editor->begin_reversible_command (_("resize notes"));
@ -2709,7 +2710,7 @@ NoteResizeDrag::finished (GdkEvent* event, bool movement_occurred)
return; return;
} }
MidiRegionSelection& ms (_editor->get_selection().midi_regions); MidiRegionSelection ms = _editor->get_selection().midi_regions();
for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ++r) { for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ++r) {
NoteBase* nb = reinterpret_cast<NoteBase*> (_item->get_data ("notebase")); NoteBase* nb = reinterpret_cast<NoteBase*> (_item->get_data ("notebase"));
assert (nb); assert (nb);
@ -2746,7 +2747,7 @@ NoteResizeDrag::finished (GdkEvent* event, bool movement_occurred)
void void
NoteResizeDrag::aborted (bool) NoteResizeDrag::aborted (bool)
{ {
MidiRegionSelection& ms (_editor->get_selection().midi_regions); MidiRegionSelection ms = _editor->get_selection().midi_regions();
for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ++r) { for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ++r) {
MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*r); MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*r);
if (mrv) { if (mrv) {
@ -6844,7 +6845,7 @@ NoteCreateDrag::finished (GdkEvent* ev, bool had_movement)
Temporal::Beats qn_length_beats = max (Temporal::Beats::ticks(1), Temporal::Beats (qn_length)); Temporal::Beats qn_length_beats = max (Temporal::Beats::ticks(1), Temporal::Beats (qn_length));
_editor->begin_reversible_command (_("Create Note")); _editor->begin_reversible_command (_("Create Note"));
_region_view->clear_editor_note_selection(); _region_view->clear_note_selection();
_region_view->create_note_at (start, _drag_rect->y0(), qn_length_beats, ev->button.state, false); _region_view->create_note_at (start, _drag_rect->y0(), qn_length_beats, ev->button.state, false);
_editor->commit_reversible_command (); _editor->commit_reversible_command ();
} }
@ -6899,7 +6900,7 @@ HitCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
Temporal::Beats length = Temporal::Beats(1.0 / 32.0); /* 1/32 beat = 1/128 note */ Temporal::Beats length = Temporal::Beats(1.0 / 32.0); /* 1/32 beat = 1/128 note */
_editor->begin_reversible_command (_("Create Hit")); _editor->begin_reversible_command (_("Create Hit"));
_region_view->clear_editor_note_selection(); _region_view->clear_note_selection();
_region_view->create_note_at (start, _y, length, event->button.state, false); _region_view->create_note_at (start, _y, length, event->button.state, false);
_last_pos = start; _last_pos = start;