diff options
author | Carl Hetherington <carl@carlh.net> | 2012-01-30 21:33:32 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2012-01-30 21:33:32 +0000 |
commit | 664cec21359ba055243c3feaf47c6eb16fccbb3b (patch) | |
tree | 8a0fa5b385f2fa57b818910a97a7194523efa628 | |
parent | 8d0f685d521e0bba07b0beb510518e8f6bffb209 (diff) |
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
-rw-r--r-- | gtk2_ardour/editor.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_canvas.cc | 17 | ||||
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/public_editor.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view.cc | 2 |
5 files changed, 18 insertions, 9 deletions
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 2bf8fa8052..d9f3669730 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -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); diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 6da76503a7..9a990b4dc3 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -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; } diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 582ddeb1fc..380482b703 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -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); diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 9e4b9884de..c0c32a9bec 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -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; diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index 79f425f32f..60d19ad6d4 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -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); |