diff options
author | David Robillard <d@drobilla.net> | 2007-08-08 02:01:14 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-08-08 02:01:14 +0000 |
commit | 7caaa6a0e993489e7b968abc6aa7eb86745173a8 (patch) | |
tree | 64dd2ba22e4f552ec42145d00d29413092b9ac27 /gtk2_ardour/midi_region_view.cc | |
parent | 8f6a131e41937b94e02e2848dc4dd8c2c33db82f (diff) |
Multi-note (ie selection) dragging.
git-svn-id: svn://localhost/ardour2/trunk@2267 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/midi_region_view.cc')
-rw-r--r-- | gtk2_ardour/midi_region_view.cc | 27 |
1 files changed, 27 insertions, 0 deletions
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(); + } +} |