diff options
author | nick_m <mainsbridge@gmail.com> | 2015-05-23 05:36:03 +1000 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2015-05-23 05:36:03 +1000 |
commit | ea8b5a970f7fdc0818fb86c32c93dd564eff941c (patch) | |
tree | 68b2b6c93267d9131aee82ffa9440c27e40b7782 /gtk2_ardour/editor_drag.cc | |
parent | 3d599be991a71b7e4611b1c38ee88a77bf1c5460 (diff) |
Bring back contrained drag modifier with preference setting.
- this should work as before, but when applied to a button 1 drag,
the constraint is in the first direction travelled.
Diffstat (limited to 'gtk2_ardour/editor_drag.cc')
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 014b4679e8..97a24a1a1a 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -249,7 +249,6 @@ Drag::swap_grab (ArdourCanvas::Item* new_item, Gdk::Cursor* cursor, uint32_t /*t void Drag::start_grab (GdkEvent* event, Gdk::Cursor *cursor) { - // if dragging with button2, the motion is x constrained, with Alt-button2 it is y constrained /* we set up x/y dragging constraints on first move */ _x_constrained = false; @@ -401,20 +400,31 @@ Drag::motion_handler (GdkEvent* event, bool from_autoscroll) /* just changed */ if (fabs (current_pointer_y() - _grab_y) > fabs (current_pointer_x() - _grab_x)) { - if ((event->motion.state & Gdk::BUTTON2_MASK) && Config->get_edit_mode() != Lock) { - _x_constrained = true; - _y_constrained = false; - } _initially_vertical = true; } else { - if ((event->motion.state & Gdk::BUTTON2_MASK) && Config->get_edit_mode() != Lock) { - _x_constrained = false; - _y_constrained = true; - } _initially_vertical = false; } - - if (Config->get_edit_mode() == Lock) { + if (Config->get_edit_mode() != Lock) { + if (event->motion.state & Gdk::BUTTON2_MASK) { + // if dragging with button2, the motion is x constrained, with constraint modifier it is y constrained + if (Keyboard::modifier_state_equals (event->button.state, ArdourKeyboard::constraint_modifier ())) { + _x_constrained = false; + _y_constrained = true; + } else { + _x_constrained = true; + _y_constrained = false; + } + } else if (Keyboard::modifier_state_equals (event->button.state, ArdourKeyboard::constraint_modifier ())) { + // if dragging normally, the motion is constrained to the first direction of movement. + if (_initially_vertical) { + _x_constrained = true; + _y_constrained = false; + } else { + _x_constrained = false; + _y_constrained = true; + } + } + } else { if (event->button.state & Gdk::BUTTON2_MASK) { _x_constrained = false; } else { |