#include "ardour/midi_region.h"
#include "ardour/session.h"
+#include "gtkmm2ext/keyboard.h"
+
#include "automation_region_view.h"
#include "editing.h"
#include "editor.h"
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;
* @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);
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();
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();
}
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;
_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));
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 ();
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;
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;
}