diff options
author | Carl Hetherington <carl@carlh.net> | 2011-04-20 23:50:31 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-04-20 23:50:31 +0000 |
commit | 884de065bdbb2af770c4a877a86d3c2d9340336e (patch) | |
tree | ee4690f79f20ca2b9a573ca901d95ab7356ad9c5 /gtk2_ardour/editor_drag.cc | |
parent | 8fc896a24d9d9f01dd447ef65f31777ab7c4a34a (diff) |
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
Diffstat (limited to 'gtk2_ardour/editor_drag.cc')
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 10 |
1 files changed, 8 insertions, 2 deletions
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); } } |