Make absolute snap the default snap.
authornick_m <mainsbridge@gmail.com>
Wed, 10 Jun 2015 15:36:34 +0000 (01:36 +1000)
committernick_m <mainsbridge@gmail.com>
Wed, 10 Jun 2015 15:36:34 +0000 (01:36 +1000)
- also fixes a couple of absolute snap bugs wrt midi notes.

gtk2_ardour/editor_drag.cc
gtk2_ardour/midi_region_view.cc
gtk2_ardour/rc_option_editor.cc
libs/gtkmm2ext/gtkmm2ext/keyboard.h

index 00811f6eea72bedaa88648e5e2e9fcd8a931b816..9d2c53964eb507efaaa231dbb0de3e155c1fb991 100644 (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 */
index 742d7d979366bf592242e82b4eaffffb1ebdf867..fd869af0e7d019cd46ba411e43e701bb8e3e5c40 100644 (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);
index a12fa90f4c4cc5f2f7252a369316764ead6534db..bb0042cf79ef11bbd9ab952a42259d7ea6d3d781 100644 (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);
index 3ffa09f036d618a3f82e866c77dff43334e8cc82..73c9ad7d429e10253e141cb6f2e10dd3251fecaa 100644 (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); }