mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-09 23:25:43 +01:00
Fix up modifier behaviour
- its now possible to use snap modifiers in combination with others afaict this hasn't worked for some time. - use "contains" rather than "equals" during drag. Still uncertain about this wrt beginning a drag. for now they are all "equals". - probably solve the "snap modifier modifier" problem using ArdourKeyboard::indicates_snap () and friend.
This commit is contained in:
parent
5d176eefa6
commit
eaf49f02ff
5 changed files with 35 additions and 12 deletions
|
|
@ -2597,7 +2597,7 @@ Editor::snap_to_with_modifier (framepos_t& start, GdkEvent const * event, RoundM
|
|||
return;
|
||||
}
|
||||
|
||||
if (Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
|
||||
if (ArdourKeyboard::indicates_snap (event->button.state)) {
|
||||
if (_snap_mode == SnapOff) {
|
||||
snap_to_internal (start, direction, for_mark);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -339,11 +339,11 @@ Drag::adjusted_current_frame (GdkEvent const * event, bool snap) const
|
|||
frameoffset_t
|
||||
Drag::snap_delta (GdkEvent const * event) const
|
||||
{
|
||||
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::snap_delta_modifier())) {
|
||||
if (ArdourKeyboard::indicates_snap_delta (event->button.state)) {
|
||||
return 0;
|
||||
} else {
|
||||
return _snap_delta;
|
||||
}
|
||||
|
||||
return _snap_delta;
|
||||
}
|
||||
|
||||
double
|
||||
|
|
@ -2394,7 +2394,7 @@ NoteResizeDrag::motion (GdkEvent* event, bool /*first_move*/)
|
|||
MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*r);
|
||||
if (mrv) {
|
||||
double sd = 0.0;
|
||||
if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::snap_delta_modifier())) {
|
||||
if (!ArdourKeyboard::indicates_snap_delta (event->button.state)) {
|
||||
sd = _snap_delta;
|
||||
}
|
||||
mrv->update_resizing (nb, at_front, _drags->current_pointer_x() - grab_x(), relative, sd);
|
||||
|
|
@ -2411,7 +2411,7 @@ NoteResizeDrag::finished (GdkEvent* event, bool /*movement_occurred*/)
|
|||
assert (nb);
|
||||
MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*r);
|
||||
double sd = 0.0;
|
||||
if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::snap_delta_modifier())) {
|
||||
if (!ArdourKeyboard::indicates_snap_delta (event->button.state)) {
|
||||
sd = _snap_delta;
|
||||
}
|
||||
if (mrv) {
|
||||
|
|
@ -2726,7 +2726,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
|
|||
|
||||
bool non_overlap_trim = false;
|
||||
|
||||
if (event && Keyboard::modifier_state_equals (event->button.state, ArdourKeyboard::trim_overlap_modifier ())) {
|
||||
if (event && Keyboard::modifier_state_contains (event->button.state, ArdourKeyboard::trim_overlap_modifier ())) {
|
||||
non_overlap_trim = true;
|
||||
}
|
||||
|
||||
|
|
@ -3736,7 +3736,7 @@ MarkerDrag::motion (GdkEvent* event, bool)
|
|||
framepos_t const newframe = adjusted_current_frame (event);
|
||||
framepos_t next = newframe;
|
||||
|
||||
if (Keyboard::modifier_state_equals (event->button.state, ArdourKeyboard::push_points_modifier ())) {
|
||||
if (Keyboard::modifier_state_contains (event->button.state, ArdourKeyboard::push_points_modifier ())) {
|
||||
move_both = true;
|
||||
}
|
||||
|
||||
|
|
@ -4003,7 +4003,7 @@ ControlPointDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/)
|
|||
|
||||
show_verbose_cursor_text (_point->line().get_verbose_cursor_string (fraction));
|
||||
|
||||
_pushing = Keyboard::modifier_state_contains (event->button.state, ArdourKeyboard::push_points_modifier ());
|
||||
_pushing = Keyboard::modifier_state_equals (event->button.state, ArdourKeyboard::push_points_modifier ());
|
||||
|
||||
if (!_point->can_slide ()) {
|
||||
_x_constrained = true;
|
||||
|
|
|
|||
|
|
@ -235,6 +235,28 @@ ArdourKeyboard::set_state (const XMLNode& node, int version)
|
|||
return Keyboard::set_state (node, version);
|
||||
}
|
||||
|
||||
bool
|
||||
ArdourKeyboard::indicates_snap (guint state)
|
||||
{
|
||||
bool contains_s = Keyboard::modifier_state_contains (state, Keyboard::snap_modifier());
|
||||
bool equals_s = Keyboard::modifier_state_equals (state, Keyboard::snap_modifier());
|
||||
bool contains_d = Keyboard::modifier_state_contains (state, Keyboard::snap_delta_modifier());
|
||||
bool equals_d = Keyboard::modifier_state_equals (state, Keyboard::snap_delta_modifier());
|
||||
|
||||
return (equals_s || (contains_s && ((contains_d && !equals_d) || !contains_d)));
|
||||
}
|
||||
|
||||
bool
|
||||
ArdourKeyboard::indicates_snap_delta (guint state)
|
||||
{
|
||||
bool contains_d = Keyboard::modifier_state_contains (state, Keyboard::snap_delta_modifier());
|
||||
bool equals_d = Keyboard::modifier_state_equals (state, Keyboard::snap_delta_modifier());
|
||||
bool contains_s = Keyboard::modifier_state_contains (state, Keyboard::snap_modifier());
|
||||
bool equals_s = Keyboard::modifier_state_equals (state, Keyboard::snap_modifier());
|
||||
|
||||
return (equals_d || (contains_d && ((contains_s && !equals_s) || !contains_s)));
|
||||
}
|
||||
|
||||
void
|
||||
ArdourKeyboard::set_trim_contents_modifier (guint mod)
|
||||
{
|
||||
|
|
@ -296,5 +318,3 @@ ArdourKeyboard::selection_type (guint state)
|
|||
return Selection::Set;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,9 @@ class ArdourKeyboard : public Gtkmm2ext::Keyboard
|
|||
|
||||
ARDOUR_UI& ui;
|
||||
|
||||
static bool indicates_snap (guint state);
|
||||
static bool indicates_snap_delta (guint state);
|
||||
|
||||
static void set_trim_contents_modifier (guint);
|
||||
/** @return Modifier mask to move contents rather than region bounds during trim;
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -563,7 +563,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
l = manage (left_aligned_label (_("Ignore snap by including:")));
|
||||
l = manage (left_aligned_label (_("Ignore snap using:")));
|
||||
l->set_name ("OptionsLabel");
|
||||
|
||||
t->attach (*l, col, col + 1, row, row + 1, FILL | EXPAND, FILL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue