From 884de065bdbb2af770c4a877a86d3c2d9340336e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 20 Apr 2011 23:50:31 +0000 Subject: When drawing MIDI regions with grid snap enabled, make the region extent 1 frame shy of the next grid boundary. In this way, a duplicate of the new region will land on a grid snap point. git-svn-id: svn://localhost/ardour2/branches/3.0@9398 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_drag.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 2d3feb5db4..462324207e 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -1370,8 +1370,14 @@ RegionCreateDrag::motion (GdkEvent* event, bool first_move) _region->set_position (f, this); } - /* again, don't use a zero-length region (see above) */ - framecnt_t const len = abs (f - grab_frame ()); + /* Don't use a zero-length region, and subtract 1 frame from the snapped length + so that if this region is duplicated, its duplicate starts on + a snap point rather than 1 frame after a snap point. Otherwise things get + a bit confusing as if a region starts 1 frame after a snap point, one cannot + place snapped notes at the start of the region. + */ + + framecnt_t const len = abs (f - grab_frame () - 1); _region->set_length (len < 1 ? 1 : len, this); } } -- cgit v1.2.3