Revert to old Lock mode (still called Lock).
authornick_m <mainsbridge@gmail.com>
Mon, 18 May 2015 17:27:50 +0000 (03:27 +1000)
committernick_m <mainsbridge@gmail.com>
Mon, 18 May 2015 17:27:50 +0000 (03:27 +1000)
Also make midi notes obey the snap delta modifire

gtk2_ardour/editor.cc
gtk2_ardour/editor_actions.cc
gtk2_ardour/editor_drag.cc
gtk2_ardour/editor_ops.cc
libs/ardour/ardour/types.h
libs/ardour/enums.cc
libs/ardour/utils.cc

index e785db3de76afa9377ce422d3163e2cb45135960..ff9d480a3549f947d321992c3239867f6b70cb35 100644 (file)
@@ -195,7 +195,7 @@ static const gchar *_edit_mode_strings[] = {
        N_("Slide"),
        N_("Splice"),
        N_("Ripple"),
-       N_("Constrained"),
+       N_("Lock"),
        0
 };
 
@@ -3171,7 +3171,7 @@ Editor::build_edit_mode_menu ()
        edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_strings[(int)Slide], sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Slide)));
 //     edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_strings[(int)Splice], sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Splice)));
        edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_strings[(int)Ripple], sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Ripple)));
-       edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_strings[(int)Constrained], sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode)  Constrained)));
+       edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_strings[(int)Lock], sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode)  Lock)));
 
        set_size_request_to_display_given_text (edit_mode_selector, edit_mode_strings, COMBO_TRIANGLE_WIDTH, 2);
 }
@@ -3617,16 +3617,16 @@ Editor::cycle_edit_mode ()
        switch (Config->get_edit_mode()) {
        case Slide:
                if (Profile->get_sae()) {
-                       Config->set_edit_mode (Constrained);
+                       Config->set_edit_mode (Lock);
                } else {
                        Config->set_edit_mode (Ripple);
                }
                break;
        case Splice:
        case Ripple:
-               Config->set_edit_mode (Constrained);
+               Config->set_edit_mode (Lock);
                break;
-       case Constrained:
+       case Lock:
                Config->set_edit_mode (Slide);
                break;
        }
index f1cf70fd89f83c74ea5e463ad37ccbbb5fe5d47e..baebda73af3fa707cda4b63646d7700a0c51026c 100644 (file)
@@ -509,7 +509,7 @@ Editor::register_actions ()
 //     ActionManager::register_action (editor_actions, "set-edit-splice", _("Splice"), sigc::bind (sigc::mem_fun (*this, &Editor::set_edit_mode), Splice));
        ActionManager::register_action (editor_actions, "set-edit-ripple", _("Ripple"), bind (mem_fun (*this, &Editor::set_edit_mode), Ripple));
        ActionManager::register_action (editor_actions, "set-edit-slide", _("Slide"), sigc::bind (sigc::mem_fun (*this, &Editor::set_edit_mode), Slide));
-       ActionManager::register_action (editor_actions, "set-edit-constrained", S_("EditMode|Constrained"), sigc::bind (sigc::mem_fun (*this, &Editor::set_edit_mode), Constrained));
+       ActionManager::register_action (editor_actions, "set-edit-lock", S_("EditMode|Lock"), sigc::bind (sigc::mem_fun (*this, &Editor::set_edit_mode), Lock));
        ActionManager::register_action (editor_actions, "cycle-edit-mode", _("Cycle Edit Mode"), sigc::mem_fun (*this, &Editor::cycle_edit_mode));
 
        ActionManager::register_action (editor_actions, X_("SnapTo"), _("Snap to"));
index cf1f8007b9ea5e4f12fd9abfb043b2aa7823052c..0e75c48cdb1aa0cd882edf5065fd840f80232e58 100644 (file)
@@ -401,21 +401,25 @@ Drag::motion_handler (GdkEvent* event, bool from_autoscroll)
                                /* just changed */
 
                                if (fabs (current_pointer_y() - _grab_y) > fabs (current_pointer_x() - _grab_x)) {
-                                       if ((event->motion.state & Gdk::BUTTON2_MASK) || Config->get_edit_mode() == Constrained) {
+                                       if ((event->motion.state & Gdk::BUTTON2_MASK) && Config->get_edit_mode() != Lock) {
                                                _x_constrained = true;
                                                _y_constrained = false;
                                        }
                                        _initially_vertical = true;
                                } else {
-                                       if ((event->motion.state & Gdk::BUTTON2_MASK) || Config->get_edit_mode() == Constrained) {
+                                       if ((event->motion.state & Gdk::BUTTON2_MASK) && Config->get_edit_mode() != Lock) {
                                                _x_constrained = false;
                                                _y_constrained = true;
                                        }
                                        _initially_vertical = false;
                                }
 
-                               if ((event->motion.state & Gdk::BUTTON2_MASK) && Config->get_edit_mode() == Constrained) {
-                                       _x_constrained = false;
+                               if (Config->get_edit_mode() == Lock) {
+                                       if (event->button.state & Gdk::BUTTON2_MASK) {
+                                               _x_constrained = false;
+                                       } else {
+                                               _x_constrained = true;
+                                       }
                                        _y_constrained = false;
                                }
                        }
@@ -635,7 +639,8 @@ RegionMotionDrag::compute_x_delta (GdkEvent const * event, framepos_t* pending_r
        }
 
        double dx = 0;
-       bool x_move_allowed = !_x_constrained;
+
+       bool const x_move_allowed = !_x_constrained;
 
        if ((*pending_region_position != _last_frame_position) && x_move_allowed) {
 
@@ -2389,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_contains (event->button.state, Keyboard::TertiaryModifier)) {
+                       if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::snap_delta_modifier())) {
                                sd = _snap_delta;
                        }
                        mrv->update_resizing (nb, at_front, _drags->current_pointer_x() - grab_x(), relative, sd);
@@ -2406,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_contains (event->button.state, Keyboard::TertiaryModifier)) {
+               if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::snap_delta_modifier())) {
                        sd = _snap_delta;
                }
                if (mrv) {
index 0ff9cbb732c4de0827a8bac99ba8e95447282967..5c45951e04802cb036331b74d5b02a5e2509d796 100644 (file)
@@ -6960,7 +6960,7 @@ Editor::insert_time (
 {
        bool commit = false;
 
-       if (Config->get_edit_mode() == Constrained) {
+       if (Config->get_edit_mode() == Lock) {
                return;
        }
 
@@ -7133,8 +7133,8 @@ Editor::cut_time (framepos_t pos, framecnt_t frames, InsertTimeOption opt,
 {
        bool commit = false;
        
-       if (Config->get_edit_mode() == Constrained) {
-               error << (_("Cannot insert or delete time when in Constrained edit.")) << endmsg;
+       if (Config->get_edit_mode() == Lock) {
+               error << (_("Cannot insert or delete time when in Lock edit.")) << endmsg;
                return;
        }
 
index 33cd94f10163dc8e42dd49f7905dcb060e860c66..b1b4388a747115d3b090decd6471264f07a60f17 100644 (file)
@@ -352,7 +352,7 @@ namespace ARDOUR {
                Slide,
                Splice,
                Ripple,
-               Constrained
+               Lock
        };
 
        enum RegionSelectionAfterSplit {
index 6e53660cfbdfbb7b611bacf9e75bc5c473f9e43c..a1cf8d090cf972c5f4b147071b01026bc24fd240 100644 (file)
@@ -242,7 +242,7 @@ setup_enum_writer ()
        REGISTER_ENUM (Slide);
        REGISTER_ENUM (Splice);
        REGISTER_ENUM (Ripple); // XXX do the old enum values have to stay in order?
-       REGISTER_ENUM (Constrained);
+       REGISTER_ENUM (Lock);
        REGISTER (_EditMode);
        /*
         * Splice mode is undefined, undocumented, and basically fubar'ed
index 82ad8c38d5c732a0971cbd27db8fab4f6f1b2ac8..6d6511bb9f5f377c29d7cd4eb014fcdefe54e45f 100644 (file)
@@ -425,8 +425,8 @@ ARDOUR::string_to_edit_mode (string str)
                return Slide;
        } else if (str == _("Ripple")) {
                return Ripple;
-       } else if (str == _("Constrained")) {
-               return Constrained;
+       } else if (str == _("Lock")) {
+               return Lock;
        }
        fatal << string_compose (_("programming error: unknown edit mode string \"%1\""), str) << endmsg;
        abort(); /*NOTREACHED*/
@@ -440,8 +440,8 @@ ARDOUR::edit_mode_to_string (EditMode mode)
        case Slide:
                return _("Slide");
 
-       case Constrained:
-               return _("Constrained");
+       case Lock:
+               return _("Lock");
 
        case Ripple:
                return _("Ripple");