const SelectionData& /*data*/,
guint /*info*/, guint /*time*/)
{
- assert (_drag);
- _drag->end_grab (0);
- delete _drag;
- _drag = 0;
+ _drags->end_grab (0);
}
void
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 = _drags->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;
double new_pixel;
double target_pixel;
- assert (_drag);
-
if (autoscroll_x_distance != 0) {
+
+ pair<nframes64_t, nframes64_t> const e = _drags->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;
}
}
if (autoscroll_y_distance != 0) {
if (autoscroll_y > 0) {
- autoscroll_y_distance = (_drag->current_pointer_y() - (get_trackview_group_vertical_offset() + _canvas_height)) / 3;
+ autoscroll_y_distance = (_drags->current_pointer_y() - (get_trackview_group_vertical_offset() + _canvas_height)) / 3;
} else if (autoscroll_y < 0) {
- autoscroll_y_distance = (vertical_adjustment.get_value () - _drag->current_pointer_y()) / 3;
+ autoscroll_y_distance = (vertical_adjustment.get_value () - _drags->current_pointer_y()) / 3;
}
}
new_pixel = vertical_pos - autoscroll_y_distance;
}
- target_pixel = _drag->current_pointer_y() - autoscroll_y_distance;
+ target_pixel = _drags->current_pointer_y() - autoscroll_y_distance;
target_pixel = max (target_pixel, 0.0);
} else if (autoscroll_y > 0) {
new_pixel = min (top_of_bottom_of_canvas, new_pixel);
- target_pixel = _drag->current_pointer_y() + autoscroll_y_distance;
+ target_pixel = _drags->current_pointer_y() + autoscroll_y_distance;
/* don't move to the full canvas height because the item will be invisible
(its top edge will line up with the bottom of the visible canvas.
target_pixel = min (target_pixel, full_canvas_height - 10);
} else {
- target_pixel = _drag->current_pointer_y();
+ target_pixel = _drags->current_pointer_y();
new_pixel = vertical_pos;
}
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;
- motion_handler (_drag->item(), (GdkEvent*) &ev, true);
+ motion_handler (0, (GdkEvent*) &ev, true);
autoscroll_cnt++;