forward port of 7539 from 2.x
[ardour.git] / gtk2_ardour / midi_region_view.cc
index b761941df19ebd3db696bd1b905296c6351fff76..1ca948f86075590a28475c283449e9753ee7ab35 100644 (file)
@@ -1956,7 +1956,7 @@ MidiRegionView::move_selection(double dx, double dy)
 }
 
 void
-MidiRegionView::note_dropped(CanvasNoteEvent *, double dt, int8_t dnote)
+MidiRegionView::note_dropped(CanvasNoteEvent *, frameoffset_t dt, int8_t dnote)
 {
        assert (!_selection.empty());
 
@@ -1991,15 +1991,7 @@ MidiRegionView::note_dropped(CanvasNoteEvent *, double dt, int8_t dnote)
 
        for (Selection::iterator i = _selection.begin(); i != _selection.end() ; ++i) {
 
-               nframes64_t start_frames = beats_to_frames((*i)->note()->time());
-
-               if (dt >= 0) {
-                       start_frames += snap_frame_to_frame(trackview.editor().pixel_to_frame(dt));
-               } else {
-                       start_frames -= snap_frame_to_frame(trackview.editor().pixel_to_frame(-dt));
-               }
-
-               Evoral::MusicalTime new_time = frames_to_beats(start_frames);
+               Evoral::MusicalTime new_time = frames_to_beats (beats_to_frames ((*i)->note()->time()) + dt);
 
                if (new_time < 0) {
                        continue;
@@ -2260,6 +2252,12 @@ MidiRegionView::commit_resizing (ArdourCanvas::CanvasNote* primary, bool at_fron
        apply_diff();
 }
 
+void
+MidiRegionView::change_note_channel (CanvasNoteEvent* event, int8_t channel)
+{
+       diff_add_change (event, MidiModel::DiffCommand::Channel, (uint8_t) channel);
+}
+
 void
 MidiRegionView::change_note_velocity(CanvasNoteEvent* event, int8_t velocity, bool relative)
 {
@@ -2386,6 +2384,12 @@ MidiRegionView::change_note_time (CanvasNoteEvent* event, Evoral::MusicalTime de
        diff_add_change (event, MidiModel::DiffCommand::StartTime, new_time);
 }
 
+void
+MidiRegionView::change_note_length (CanvasNoteEvent* event, Evoral::MusicalTime t)
+{
+       diff_add_change (event, MidiModel::DiffCommand::Length, t);
+}
+
 void
 MidiRegionView::change_velocities (bool up, bool fine, bool allow_smush)
 {