Don't autoscroll right if we are moving left, and vice versa; should fix #4676.

git-svn-id: svn://localhost/ardour2/branches/3.0@11393 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington
2012-01-30 21:33:32 +00:00
parent 8d0f685d52
commit 664cec2135
5 changed files with 18 additions and 9 deletions

View File

@@ -440,7 +440,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
return _drags;
}
void maybe_autoscroll (bool, bool);
void maybe_autoscroll (bool, bool, bool, bool);
Gdk::Cursor* get_canvas_cursor () const { return current_canvas_cursor; }
void set_canvas_cursor (Gdk::Cursor*, bool save=false);

View File

@@ -491,8 +491,15 @@ Editor::autoscroll_fudge_threshold () const
return current_page_frames() / 6;
}
/** @param allow_horiz true to allow horizontal autoscroll, otherwise false.
* @param allow_vert true to allow vertical autoscroll, otherwise false.
* @param moving_left true if we are moving left, so we only want to autoscroll on the left of the canvas,
* otherwise false, so we only want to autoscroll on the right of the canvas.
* @param moving_up true if we are moving up, so we only want to autoscroll at the top of the canvas,
* otherwise false, so we only want to autoscroll at the bottom of the canvas.
*/
void
Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert)
Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert, bool moving_left, bool moving_up)
{
bool startit = false;
@@ -522,10 +529,10 @@ Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert)
autoscroll_y = 0;
autoscroll_x = 0;
if (ty < canvas_timebars_vsize && allow_vert) {
if (ty < canvas_timebars_vsize && moving_up && allow_vert) {
autoscroll_y = -1;
startit = true;
} else if (ty > _canvas_height && allow_vert) {
} else if (ty > _canvas_height && !moving_up && allow_vert) {
autoscroll_y = 1;
startit = true;
}
@@ -536,12 +543,12 @@ Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert)
}
if (_drags->current_pointer_frame() > rightmost_frame && allow_horiz) {
if (rightmost_frame < max_framepos) {
if (rightmost_frame < max_framepos && !moving_left) {
autoscroll_x = 1;
startit = true;
}
} else if (_drags->current_pointer_frame() < leftmost_frame && allow_horiz) {
if (leftmost_frame > 0) {
if (leftmost_frame > 0 && moving_left) {
autoscroll_x = -1;
startit = true;
}

View File

@@ -331,7 +331,9 @@ Drag::motion_handler (GdkEvent* event, bool from_autoscroll)
if (event->motion.state & Gdk::BUTTON1_MASK || event->motion.state & Gdk::BUTTON2_MASK) {
if (!from_autoscroll) {
_editor->maybe_autoscroll (true, allow_vertical_autoscroll ());
bool const moving_left = _drags->current_pointer_x() < _last_pointer_x;
bool const moving_up = _drags->current_pointer_y() < _last_pointer_y;
_editor->maybe_autoscroll (true, allow_vertical_autoscroll (), moving_left, moving_up);
}
motion (event, _move_threshold_passed != old_move_threshold_passed);

View File

@@ -382,7 +382,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
virtual Gtkmm2ext::TearOff* tools_tearoff () const = 0;
virtual DragManager* drags () const = 0;
virtual void maybe_autoscroll (bool, bool) = 0;
virtual void maybe_autoscroll (bool, bool, bool, bool) = 0;
virtual void stop_canvas_autoscroll () = 0;
virtual MouseCursors const * cursors () const = 0;

View File

@@ -380,7 +380,7 @@ TimeAxisView::controls_ebox_motion (GdkEventMotion* ev)
controls_ebox.translate_coordinates (*control_parent, ev->x, ev->y, tx, ty);
ev->y = ty - _editor.get_trackview_group_vertical_offset();
_editor.drags()->motion_handler ((GdkEvent *) ev, false);
_editor.maybe_autoscroll (false, true);
_editor.maybe_autoscroll (false, true, false, ev->y_root < _resize_drag_start);
/* now do the actual TAV resize */
int32_t const delta = (int32_t) floor (ev->y_root - _resize_drag_start);