Make absolute snap the default snap.

- also fixes a couple of absolute snap bugs wrt midi notes.
This commit is contained in:
nick_m 2015-06-11 01:36:34 +10:00
parent 9563e75cca
commit b3a4c88e0e
4 changed files with 22 additions and 11 deletions

View file

@ -339,10 +339,10 @@ frameoffset_t
Drag::snap_delta (guint state) const
{
if (ArdourKeyboard::indicates_snap_delta (state)) {
return 0;
return _snap_delta;
}
return _snap_delta;
return 0;
}
double
@ -2410,7 +2410,7 @@ NoteResizeDrag::motion (GdkEvent* event, bool /*first_move*/)
if (mrv) {
double sd = 0.0;
bool snap = true;
bool apply_snap_delta = !ArdourKeyboard::indicates_snap_delta (event->button.state);
bool apply_snap_delta = ArdourKeyboard::indicates_snap_delta (event->button.state);
if (ArdourKeyboard::indicates_snap (event->button.state)) {
if (_editor->snap_mode () != SnapOff) {
@ -2420,7 +2420,7 @@ NoteResizeDrag::motion (GdkEvent* event, bool /*first_move*/)
if (_editor->snap_mode () == SnapOff) {
snap = false;
/* inverted logic here - we;re in snapoff but we've pressed the snap delta modifier */
if (!apply_snap_delta) {
if (apply_snap_delta) {
snap = true;
}
}
@ -2445,7 +2445,7 @@ NoteResizeDrag::finished (GdkEvent* event, bool /*movement_occurred*/)
MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*r);
double sd = 0.0;
bool snap = true;
bool apply_snap_delta = !ArdourKeyboard::indicates_snap_delta (event->button.state);
bool apply_snap_delta = ArdourKeyboard::indicates_snap_delta (event->button.state);
if (mrv) {
if (ArdourKeyboard::indicates_snap (event->button.state)) {
if (_editor->snap_mode () != SnapOff) {
@ -2455,7 +2455,7 @@ NoteResizeDrag::finished (GdkEvent* event, bool /*movement_occurred*/)
if (_editor->snap_mode () == SnapOff) {
snap = false;
/* inverted logic here - we;re in snapoff but we've pressed the snap delta modifier */
if (!apply_snap_delta) {
if (apply_snap_delta) {
snap = true;
}
}
@ -5278,7 +5278,13 @@ NoteDrag::total_dx (const guint state) const
}
}
return _region->snap_frame_to_frame (st - rp, snap) + rp - n - snap_delta (state);
frameoffset_t ret;
if (snap) {
ret = _region->snap_frame_to_frame (st - rp, snap) + rp - n - snap_delta (state);
} else {
ret = st - n - snap_delta (state);
}
return ret;
}
/** @return Current total drag y change in note number */

View file

@ -2893,7 +2893,12 @@ MidiRegionView::commit_resizing (NoteBase* primary, bool at_front, double delta_
}
/* Convert the new x position to a frame within the source */
const framepos_t current_fr = snap_pixel_to_sample (current_x, with_snap) + _region->start ();
framepos_t current_fr;
if (with_snap) {
current_fr = snap_pixel_to_sample (current_x, with_snap) + _region->start ();
} else {
current_fr = trackview.editor().pixel_to_sample (current_x) + _region->start ();
}
/* and then to beats */
const Evoral::Beats x_beats = region_frames_to_region_beats (current_fr);

View file

@ -605,7 +605,7 @@ public:
}
}
l = manage (left_aligned_label (_("Snap to absolute using:")));
l = manage (left_aligned_label (_("Snap relatively using:")));
l->set_name ("OptionsLabel");
t->attach (*l, col, col + 1, row, row + 1, FILL | EXPAND, FILL);

View file

@ -126,8 +126,8 @@ class LIBGTKMM2EXT_API Keyboard : public sigc::trackable, PBD::Stateful
* Absolute grid is for aligning objects with the grid lines.
* Relative grid is for maintaining an initial position relative to the grid lines.
* With this modifier:
* - magnetic or normal grid should snap absolutely to the grid lines
* - no grid should become absolute grid.
* - magnetic or normal grid should snap relative to an initial grid offset
* - no grid should snap relative to the grid.
*/
static ModifierMask snap_delta_modifier () { return ModifierMask (snap_delta_mod); }