Alter snap modifier so that it turns the grid on when it's off as well as vice-versa.

git-svn-id: svn://localhost/ardour2/branches/3.0@5584 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-08-24 20:26:34 +00:00
parent 29fea7b61d
commit df71243d6c
6 changed files with 49 additions and 43 deletions

View file

@ -2515,6 +2515,29 @@ Editor::trackview_by_y_position (double y)
return std::make_pair ( (TimeAxisView *) 0, 0);
}
/** Snap a position to the grid, if appropriate, taking into account current
* grid settings and also the state of any snap modifier keys that may be pressed.
* @param start Position to snap.
* @param event Event to get current key modifier information from.
*/
void
Editor::snap_to_with_modifier (nframes64_t& start, GdkEvent const * event, int32_t direction, bool for_mark)
{
if (!session) {
return;
}
if (Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
if (snap_mode == SnapOff) {
snap_to_internal (start, direction, for_mark);
}
} else {
if (snap_mode != SnapOff) {
snap_to_internal (start, direction, for_mark);
}
}
}
void
Editor::snap_to (nframes64_t& start, int32_t direction, bool for_mark)
{