From 7caaa6a0e993489e7b968abc6aa7eb86745173a8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 8 Aug 2007 02:01:14 +0000 Subject: Multi-note (ie selection) dragging. git-svn-id: svn://localhost/ardour2/trunk@2267 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/midi_region_view.cc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'gtk2_ardour/midi_region_view.cc') diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 49817a35a0..88e7a98e7b 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -659,4 +659,31 @@ MidiRegionView::update_drag_selection(double last_x, double x, double last_y, do } } + +void +MidiRegionView::move_selection(double dx, double dy) +{ + for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) + (*i)->item()->move(dx, dy); +} + +void +MidiRegionView::note_dropped(CanvasMidiEvent* ev, double dt, uint8_t dnote) +{ + // TODO: This would be faster/nicer with a MoveCommand that doesn't need to copy... + if (_selection.find(ev) != _selection.end()) { + start_delta_command(); + + for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) { + command_remove_note(*i); + MidiModel::Note copy(*(*i)->note()); + + copy.set_time((*i)->note()->time() + dt); + copy.set_note((*i)->note()->note() + dnote); + + command_add_note(copy); + } + apply_command(); + } +} -- cgit v1.2.3