ctrl-click when adding automation points no longer adds guard points
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 19 Feb 2014 17:54:00 +0000 (12:54 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 19 Feb 2014 18:22:52 +0000 (13:22 -0500)
gtk2_ardour/automation_region_view.cc
gtk2_ardour/automation_region_view.h
gtk2_ardour/automation_time_axis.cc
gtk2_ardour/automation_time_axis.h
gtk2_ardour/editor_mouse.cc

index 5c9fc767dfa04354713d853602e495295ce01e7b..2e22556f27bc3cf791c7acf4f83d689710313d18 100644 (file)
@@ -27,6 +27,8 @@
 #include "ardour/midi_region.h"
 #include "ardour/session.h"
 
+#include "gtkmm2ext/keyboard.h"
+
 #include "automation_region_view.h"
 #include "editing.h"
 #include "editor.h"
@@ -120,7 +122,11 @@ AutomationRegionView::canvas_event (GdkEvent* ev)
                y = std::max (y, 0.0);
                y = std::min (y, _height - NAME_HIGHLIGHT_SIZE);
 
-               add_automation_event (ev, trackview.editor().pixel_to_frame (x) - _region->position() + _region->start(), y);
+               /* no guard points if primary modifier is used */
+
+               bool with_guard_points = !Gtkmm2ext::Keyboard::modifier_state_equals (ev->button.state, Gtkmm2ext::Keyboard::PrimaryModifier);
+
+               add_automation_event (ev, trackview.editor().pixel_to_frame (x) - _region->position() + _region->start(), y, with_guard_points);
        }
 
        return false;
@@ -130,7 +136,7 @@ AutomationRegionView::canvas_event (GdkEvent* ev)
  *  @param y y position, relative to our TimeAxisView.
  */
 void
-AutomationRegionView::add_automation_event (GdkEvent *, framepos_t when, double y)
+AutomationRegionView::add_automation_event (GdkEvent *, framepos_t when, double y, bool with_guard_points)
 {
        if (!_line) {
                boost::shared_ptr<Evoral::Control> c = _region->control(_parameter, true);
@@ -160,7 +166,7 @@ AutomationRegionView::add_automation_event (GdkEvent *, framepos_t when, double
        view->session()->begin_reversible_command (_("add automation event"));
        XMLNode& before = _line->the_list()->get_state();
 
-       _line->the_list()->add (when_d, y);
+       _line->the_list()->add (when_d, y, with_guard_points);
 
        XMLNode& after = _line->the_list()->get_state();
 
index 3e2a9b6bbff531965fcadc5fb471d14f148d88a3..8933b30b19e7d660a61e7c2f2c9a6661c5052b7a 100644 (file)
@@ -66,7 +66,7 @@ protected:
        bool set_position(framepos_t pos, void* src, double* ignored);
        void region_resized (const PBD::PropertyChange&);
        bool canvas_event(GdkEvent* ev);
-       void add_automation_event (GdkEvent* event, framepos_t when, double y);
+        void add_automation_event (GdkEvent* event, framepos_t when, double y, bool with_guard_points);
        void entered (bool);
        void exited();
 
index 848298c8b805a47f7ab4f9aa0773b71910dd763d..08690cd61c01b984f10082136e9eb53f958c1378 100644 (file)
@@ -550,7 +550,7 @@ AutomationTimeAxisView::build_display_menu ()
 }
 
 void
-AutomationTimeAxisView::add_automation_event (GdkEvent* event, framepos_t when, double y)
+AutomationTimeAxisView::add_automation_event (GdkEvent* event, framepos_t when, double y, bool with_guard_points)
 {
        if (!_line) {
                return;
@@ -583,7 +583,7 @@ AutomationTimeAxisView::add_automation_event (GdkEvent* event, framepos_t when,
        _session->begin_reversible_command (_("add automation event"));
        XMLNode& before = list->get_state();
 
-       list->add (when, y);
+       list->add (when, y, with_guard_points);
 
        XMLNode& after = list->get_state();
        _session->commit_reversible_command (new MementoCommand<ARDOUR::AutomationList> (*list, &before, &after));
index f1a9a8bd57327a35a7da6c81d9b4cb02f53a6196..3e298318726a912be190a1212f5a168776df7925 100644 (file)
@@ -72,7 +72,7 @@ class AutomationTimeAxisView : public TimeAxisView {
        void set_samples_per_unit (double);
        std::string name() const { return _name; }
 
-       void add_automation_event (GdkEvent *, framepos_t, double);
+        void add_automation_event (GdkEvent *, framepos_t, double, bool with_guard_points);
 
        void clear_lines ();
 
index 7f90fe2d0fffc0065fd0b3f3a6d215dd85e42593..9e19578ce7e983dbc9d9a666996b007cf6578f09 100644 (file)
@@ -1682,7 +1682,8 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                        case AutomationTrackItem:
                                atv = dynamic_cast<AutomationTimeAxisView*>(clicked_axisview);
                                if (atv) {
-                                       atv->add_automation_event (event, where, event->button.y);
+                                       bool with_guard_points = !Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier);
+                                       atv->add_automation_event (event, where, event->button.y, with_guard_points);
                                }
                                return true;
                                break;
@@ -1707,11 +1708,13 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                                break;
                        }
 
-                       case AutomationTrackItem:
+                       case AutomationTrackItem: {
+                               bool with_guard_points = !Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier);
                                dynamic_cast<AutomationTimeAxisView*>(clicked_axisview)->
-                                       add_automation_event (event, where, event->button.y);
+                                       add_automation_event (event, where, event->button.y, with_guard_points);
                                return true;
                                break;
+                       }
                        default:
                                break;
                        }