From 1d82f4ca07a38342e0815cd6b695b96d72386f39 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 19 Feb 2014 12:54:00 -0500 Subject: ctrl-click when adding automation points no longer adds guard points --- gtk2_ardour/automation_region_view.cc | 12 +++++++++--- gtk2_ardour/automation_region_view.h | 2 +- gtk2_ardour/automation_time_axis.cc | 4 ++-- gtk2_ardour/automation_time_axis.h | 2 +- gtk2_ardour/editor_mouse.cc | 9 ++++++--- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc index 5c9fc767df..2e22556f27 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_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 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 3e2a9b6bbf..8933b30b19 100644 --- a/gtk2_ardour/automation_region_view.h +++ b/gtk2_ardour/automation_region_view.h @@ -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(); diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 848298c8b8..08690cd61c 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -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 (*list, &before, &after)); diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h index f1a9a8bd57..3e29831872 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_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 (); diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 7f90fe2d0f..9e19578ce7 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; } -- cgit v1.2.3