diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-02-12 13:37:18 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-02-13 16:21:37 -0500 |
commit | 994dff91a263b038b3d5990e727b93d0dbdb9d9c (patch) | |
tree | 21f0e58c52e90f4a87755e7f85e8363efd4aca6b /gtk2_ardour | |
parent | eb45b3baaa1d2565da3ce04b91f924df80512725 (diff) |
detect if drags appear to be vertical or horizontal as we cross the move threshold
Conflicts:
gtk2_ardour/editor_drag.cc
gtk2_ardour/editor_drag.h
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 28 | ||||
-rw-r--r-- | gtk2_ardour/editor_drag.h | 2 |
2 files changed, 24 insertions, 6 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index a5ead24562..7747f3fffb 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -220,7 +220,8 @@ Drag::Drag (Editor* e, ArdourCanvas::Item* i, bool trackview_only) , _pointer_frame_offset (0) , _trackview_only (trackview_only) , _move_threshold_passed (false) - , _starting_point_passed (false) + , _starting_point_passed (false) + , _initially_vertical (false) , _was_double_click (false) , _raw_grab_frame (0) , _grab_frame (0) @@ -383,14 +384,29 @@ Drag::motion_handler (GdkEvent* event, bool from_autoscroll) if (active (_editor->mouse_mode) && _move_threshold_passed) { if (event->motion.state & Gdk::BUTTON1_MASK || event->motion.state & Gdk::BUTTON2_MASK) { + + if (old_move_threshold_passed != _move_threshold_passed) { + + /* just changed */ + + if (fabs (current_pointer_y() - _grab_y) > fabs (current_pointer_x() - _grab_x)) { + _initially_vertical = true; + } else { + _initially_vertical = false; + } + + cerr << "IV = " << _initially_vertical << endl; + } + if (!from_autoscroll) { _editor->maybe_autoscroll (true, allow_vertical_autoscroll (), false); } - + if (!_editor->autoscroll_active() || from_autoscroll) { + - bool first_move = (_move_threshold_passed != old_move_threshold_passed) || - from_autoscroll; + bool first_move = (_move_threshold_passed != old_move_threshold_passed) || from_autoscroll; + motion (event, first_move && !_starting_point_passed); if (first_move && !_starting_point_passed) { @@ -1470,8 +1486,8 @@ RegionMotionDrag::aborted (bool) * @param c true to make copies of the regions being moved, otherwise false. */ RegionMoveDrag::RegionMoveDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<RegionView*> const & v, bool b, bool c) - : RegionMotionDrag (e, i, p, v, b), - _copy (c) + : RegionMotionDrag (e, i, p, v, b) + , _copy (c) { DEBUG_TRACE (DEBUG::Drags, "New RegionMoveDrag\n"); diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h index 64e894c092..ce983cf4f2 100644 --- a/gtk2_ardour/editor_drag.h +++ b/gtk2_ardour/editor_drag.h @@ -236,6 +236,8 @@ private: bool _move_threshold_passed; ///< true if the move threshold has been passed, otherwise false bool _starting_point_passed; ///< true if we called move () with first_move flag, otherwise false bool _was_double_click; ///< true if drag initiated by a double click event + bool _initially_vertical; ///< true if after move threshold is passed we appear to be moving vertically; undefined before that + bool _was_double_click; ///< true if drag initiated by a double click event double _grab_x; ///< trackview x of the grab start position double _grab_y; ///< y of the grab start position, possibly adjusted if _trackview_only is true double _last_pointer_x; ///< trackview x of the pointer last time a motion occurred |