Fix erroneous note resizing in regions with non-zero start (#4143).
authorCarl Hetherington <carl@carlh.net>
Sat, 2 Jul 2011 22:13:19 +0000 (22:13 +0000)
committerCarl Hetherington <carl@carlh.net>
Sat, 2 Jul 2011 22:13:19 +0000 (22:13 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@9785 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/midi_region_view.cc

index 7d585aceb7a1631bd33bb07ebd555f7eda84291a..b873ea884d5ab9b5d9795d66bb5aa24ae47a9a63 100644 (file)
@@ -2461,6 +2461,11 @@ MidiRegionView::commit_resizing (ArdourCanvas::CanvasNoteEvent* primary, bool at
        for (std::vector<NoteResizeData *>::iterator i = _resize_data.begin(); i != _resize_data.end(); ++i) {
                CanvasNote*  canvas_note = (*i)->canvas_note;
                SimpleRect*  resize_rect = (*i)->resize_rect;
+
+               /* Get the new x position for this resize, which is in pixels relative
+                * to the region position.
+                */
+               
                double current_x;
 
                if (at_front) {
@@ -2477,7 +2482,10 @@ MidiRegionView::commit_resizing (ArdourCanvas::CanvasNoteEvent* primary, bool at
                        }
                }
 
-               current_x = snap_pixel_to_frame (current_x);
+               /* Convert that to a frame within the region */
+               current_x = snap_pixel_to_frame (current_x) + _region->start ();
+
+               /* and then to beats */
                current_x = frames_to_beats (current_x);
 
                if (at_front && current_x < canvas_note->note()->end_time()) {