Editor::maybe_autoscroll (GdkEventMotion* event, bool allow_vert)
{
nframes64_t rightmost_frame = leftmost_frame + current_page_frames();
- nframes64_t frame = _drag->adjusted_current_frame (0);
+ pair<nframes64_t, nframes64_t> frames = _drag->extent ();
bool startit = false;
autoscroll_y = 0;
startit = true;
}
- if (frame > rightmost_frame) {
+ if (frames.second > rightmost_frame) {
if (rightmost_frame < max_frames) {
autoscroll_x = 1;
startit = true;
}
- } else if (frame < leftmost_frame) {
+ } else if (frames.first < leftmost_frame) {
if (leftmost_frame > 0) {
autoscroll_x = -1;
startit = true;
assert (_drag);
if (autoscroll_x_distance != 0) {
+
+ pair<nframes64_t, nframes64_t> const e = _drag->extent ();
+
if (autoscroll_x > 0) {
- autoscroll_x_distance = (unit_to_frame (_drag->current_pointer_x()) - (leftmost_frame + current_page_frames())) / 3;
+ autoscroll_x_distance = (e.second - (leftmost_frame + current_page_frames())) / 3;
} else if (autoscroll_x < 0) {
- autoscroll_x_distance = (leftmost_frame - unit_to_frame (_drag->current_pointer_x())) / 3;
+ autoscroll_x_distance = (leftmost_frame - e.first) / 3;
}
}
Gdk::ModifierType mask;
canvas_window->get_pointer (x, y, mask);
ev.type = GDK_MOTION_NOTIFY;
- ev.state &= Gdk::BUTTON1_MASK;
+ ev.state = Gdk::BUTTON1_MASK;
ev.x = x;
ev.y = y;
}
}
+pair<nframes64_t, nframes64_t>
+Drag::extent () const
+{
+ nframes64_t const f = adjusted_current_frame (0);
+ return make_pair (f, f);
+}
RegionDrag::RegionDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<RegionView*> const & v)
: Drag (e, i),
_views.remove (v);
}
+pair<nframes64_t, nframes64_t>
+RegionDrag::extent () const
+{
+ nframes64_t const f = adjusted_current_frame (0);
+ return make_pair (f, f + _primary->region()->length ());
+}
+
+
RegionMotionDrag::RegionMotionDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<RegionView*> const & v, bool b)
: RegionDrag (e, i, p, v),
_dest_trackview (0),
return true;
}
+ /** @return current x extent of the thing being dragged; ie
+ * a pair of (leftmost_position, rightmost_position)
+ */
+ virtual std::pair<nframes64_t, nframes64_t> extent () const;
+
protected:
double grab_x () const {
RegionDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
virtual ~RegionDrag () {}
+ std::pair<nframes64_t, nframes64_t> extent () const;
+
protected:
RegionView* _primary; ///< the view that was clicked on (or whatever) to start the drag