diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc index 0f62d3636c..9a96b4b0be 100644 --- a/gtk2_ardour/automation_region_view.cc +++ b/gtk2_ardour/automation_region_view.cc @@ -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_sample (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_sample (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 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(); diff --git a/gtk2_ardour/automation_region_view.h b/gtk2_ardour/automation_region_view.h index 21c1bfcd87..726ce85d31 100644 --- a/gtk2_ardour/automation_region_view.h +++ b/gtk2_ardour/automation_region_view.h @@ -65,7 +65,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(); diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 86f8034be3..c6238e6711 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -543,7 +543,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; @@ -576,7 +576,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 (*list, &before, &after)); diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h index 343c6b5e5c..c169cb59d0 100644 --- a/gtk2_ardour/automation_time_axis.h +++ b/gtk2_ardour/automation_time_axis.h @@ -72,7 +72,7 @@ class AutomationTimeAxisView : public TimeAxisView { void set_samples_per_pixel (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 (); diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 131d0dd611..38380c91cc 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -1682,7 +1682,8 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT case AutomationTrackItem: atv = dynamic_cast(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(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; }