Don't autoscroll right if we are moving left, and vice versa; should fix #4676.
authorCarl Hetherington <carl@carlh.net>
Mon, 30 Jan 2012 21:33:32 +0000 (21:33 +0000)
committerCarl Hetherington <carl@carlh.net>
Mon, 30 Jan 2012 21:33:32 +0000 (21:33 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@11393 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor.h
gtk2_ardour/editor_canvas.cc
gtk2_ardour/editor_drag.cc
gtk2_ardour/public_editor.h
gtk2_ardour/time_axis_view.cc

index 2bf8fa8052650067a393e5a133ddf69c2018ca22..d9f3669730c70f1c7b8eec2c4afd98a3e59c4dc0 100644 (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);
index 6da76503a72ca95876b60c284cdd4ebcc97d62a2..9a990b4dc3528403e0197b95d9771580d56578e4 100644 (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;
                }
index 582ddeb1fccdd1202b8d5cf96ed79f3f2f6a2748..380482b703e0d3c4e11c7c0b227c66a57ea8207a 100644 (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);
index 9e4b9884de27f6062fa91d43056c5c25f90ef797..c0c32a9becb160d99bf8dde255d64c75db7ac669 100644 (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;
index 79f425f32f22501604b742461deca6bfd3446f08..60d19ad6d4f9507477ac5d5f84a49427b5473ca8 100644 (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);