13
0

Allow both types of constrained drag (again).

- Holding the constraint modifier at the time of grab gives constrained x.

	- Holding the constraint modifier after the grab but before the first motion
	  constrains to the direction of first movement.
This commit is contained in:
nick_m 2016-08-20 01:46:04 +10:00
parent 2d7bdda0be
commit 269a08a2b1
2 changed files with 13 additions and 2 deletions

View File

@ -264,6 +264,15 @@ Drag::start_grab (GdkEvent* event, Gdk::Cursor *cursor)
/* we set up x/y dragging constraints on first move */ /* we set up x/y dragging constraints on first move */
_constraint_pressed = ArdourKeyboard::indicates_constraint (event->button.state); _constraint_pressed = ArdourKeyboard::indicates_constraint (event->button.state);
if (_constraint_pressed) {
/* if constraint was indicated at the beginning of the drag, constrain x.
if the user presses these modifiers after this point in time (first move),
the drag will be constrained to the first direction of motion.
*/
_x_constrained = true;
_y_constrained = false;
}
_raw_grab_frame = _editor->canvas_event_sample (event, &_grab_x, &_grab_y); _raw_grab_frame = _editor->canvas_event_sample (event, &_grab_x, &_grab_y);
setup_pointer_frame_offset (); setup_pointer_frame_offset ();
@ -429,7 +438,7 @@ Drag::motion_handler (GdkEvent* event, bool from_autoscroll)
_x_constrained = true; _x_constrained = true;
_y_constrained = false; _y_constrained = false;
} }
} else if (_constraint_pressed) { } else if (!_constraint_pressed && ArdourKeyboard::indicates_constraint (event->button.state)) {
// if dragging normally, the motion is constrained to the first direction of movement. // if dragging normally, the motion is constrained to the first direction of movement.
if (_initially_vertical) { if (_initially_vertical) {
_x_constrained = true; _x_constrained = true;

View File

@ -545,7 +545,9 @@ public:
_constraint_modifier_combo.signal_changed().connect (sigc::mem_fun(*this, &KeyboardOptions::constraint_modifier_chosen)); _constraint_modifier_combo.signal_changed().connect (sigc::mem_fun(*this, &KeyboardOptions::constraint_modifier_chosen));
std::string mod_str = string_compose (X_("%1-%2"), Keyboard::primary_modifier_name (), Keyboard::level4_modifier_name ()); std::string mod_str = string_compose (X_("%1-%2"), Keyboard::primary_modifier_name (), Keyboard::level4_modifier_name ());
Gtkmm2ext::UI::instance()->set_tip (_constraint_modifier_combo, Gtkmm2ext::UI::instance()->set_tip (_constraint_modifier_combo,
(string_compose (_("<b>Recommended Setting: %1</b>%2"), (string_compose (_("At the beginning of a drag, applies vertical constraint (mostly)."
" Holding down after grabbing an object but before the first move constrains the"
" drag to the direction of the first movement. <b>Recommended Setting: %1</b>%2"),
#ifdef __APPLE__ #ifdef __APPLE__
Keyboard::primary_modifier_name (), Keyboard::primary_modifier_name (),
#else #else