diff options
author | Nick Mainsbridge <beatroute@iprimus.com.au> | 2008-02-03 08:32:18 +0000 |
---|---|---|
committer | Nick Mainsbridge <beatroute@iprimus.com.au> | 2008-02-03 08:32:18 +0000 |
commit | affdf459a546237cca750a2a8d7a409556017d5c (patch) | |
tree | e77f75bfccf1f01dd8cdf16b0bf05127f7788cf0 | |
parent | 58c2facb6a34c8a39e7f33bc87f8384c6b435975 (diff) |
Fix reversed bounds check in Region::adjust_to_sync (), regions with a sync point snap to the sync point again.
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2997 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/editor_mouse.cc | 22 | ||||
-rw-r--r-- | libs/ardour/region.cc | 8 |
2 files changed, 17 insertions, 13 deletions
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index bcc00739ed..b293a28696 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -3297,23 +3297,27 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) nframes_t sync_frame; nframes_t sync_offset; int32_t sync_dir; - + pending_region_position = drag_info.current_pointer_frame - drag_info.pointer_frame_offset; sync_offset = rv->region()->sync_offset (sync_dir); - sync_frame = rv->region()->adjust_to_sync (pending_region_position); - /* we snap if the snap modifier is not enabled. + /* we don't handle a sync point that lies before zero. */ + if (sync_dir > 0 || (sync_dir < 0 && pending_region_position >= sync_offset)) { + sync_frame = pending_region_position + (sync_dir*sync_offset); + + /* we snap if the snap modifier is not enabled. + */ - if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) { - snap_to (sync_frame); - } + if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) { + snap_to (sync_frame); + } - if (sync_frame - sync_offset <= sync_frame) { - pending_region_position = sync_frame - (sync_dir*sync_offset); + pending_region_position = rv->region()->adjust_to_sync (sync_frame); + } else { - pending_region_position = 0; + pending_region_position = drag_info.last_frame_position; } } else { diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 6bbc4329eb..0819704bcf 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -764,14 +764,14 @@ Region::adjust_to_sync (nframes_t pos) // cerr << "adjusting pos = " << pos << " to sync at " << _sync_position << " offset = " << offset << " with dir = " << sync_dir << endl; if (sync_dir > 0) { - if (max_frames - pos > offset) { + if (pos > offset) { pos -= offset; + } else { + pos = 0; } } else { - if (pos > offset) { + if (max_frames - pos > offset) { pos += offset; - } else { - pos = 0; } } |