diff options
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/editor_drag.h | 13 |
2 files changed, 18 insertions, 3 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 0d8736b5fb..09d43fe300 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -543,9 +543,12 @@ RegionMotionDrag::compute_x_delta (GdkEvent const * event, nframes64_t* pending_ /* x movement since last time */ dx = (static_cast<double> (*pending_region_position) - _last_frame_position) / _editor->frames_per_unit; - + /* total x movement */ - framecnt_t total_dx = *pending_region_position - grab_frame () + _pointer_frame_offset; + framecnt_t total_dx = *pending_region_position; + if (regions_came_from_canvas()) { + total_dx = total_dx - grab_frame () + _pointer_frame_offset; + } /* check that no regions have gone off the start of the session */ for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) { @@ -774,7 +777,6 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move) y_delta = rtv->view()->child_height () * pointer_layer_span; } - if (_brushing) { _editor->mouse_brush_insert_region (rv, pending_region_position); } else { diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h index b194366380..fc04f83b3d 100644 --- a/gtk2_ardour/editor_drag.h +++ b/gtk2_ardour/editor_drag.h @@ -255,6 +255,11 @@ public: virtual void finished (GdkEvent *, bool) = 0; virtual void aborted (); + /** @return true if the regions being `moved' came from somewhere on the canvas; + * false if they came from outside (e.g. from the region list). + */ + virtual bool regions_came_from_canvas () const = 0; + protected: struct TimeAxisViewSummary { TimeAxisViewSummary () : height_list(512) {} @@ -300,6 +305,10 @@ public: void finished (GdkEvent *, bool); void aborted (); + bool regions_came_from_canvas () const { + return true; + } + std::pair<nframes64_t, int> move_threshold () const { return std::make_pair (4, 4); } @@ -316,6 +325,10 @@ public: void finished (GdkEvent *, bool); void aborted (); + + bool regions_came_from_canvas () const { + return false; + } }; /** Region drag in splice mode */ |