diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc index 148641e4e4..10975a63ec 100644 --- a/gtk2_ardour/automation_region_view.cc +++ b/gtk2_ardour/automation_region_view.cc @@ -170,10 +170,10 @@ AutomationRegionView::canvas_group_event (GdkEvent* ev) void AutomationRegionView::add_automation_event (GdkEvent *, samplepos_t when, double y, bool with_guard_points) { + boost::shared_ptr c = _region->control(_parameter, true); + boost::shared_ptr ac = boost::dynamic_pointer_cast(c); + if (!_line) { - boost::shared_ptr c = _region->control(_parameter, true); - boost::shared_ptr ac - = boost::dynamic_pointer_cast(c); assert(ac); create_line(ac->alist()); } @@ -191,8 +191,6 @@ AutomationRegionView::add_automation_event (GdkEvent *, samplepos_t when, double _line->view_to_model_coord (when_d, y); if (UIConfiguration::instance().get_new_automation_points_on_lane()) { - boost::shared_ptr c = _region->control (_parameter, false); - assert (c); if (c->list()->size () == 0) { /* we need the MidiTrack::MidiControl, not the region's (midi model source) control */ boost::shared_ptr mt = boost::dynamic_pointer_cast (view->parent_stripable ()); @@ -208,6 +206,13 @@ AutomationRegionView::add_automation_event (GdkEvent *, samplepos_t when, double XMLNode& before = _line->the_list()->get_state(); if (_line->the_list()->editor_add (when_d, y, with_guard_points)) { + + if (ac == view->session()->recently_touched_controllable ()) { + if (ac->automation_state () == ARDOUR::Off) { + ac->set_automation_state (ARDOUR::Touch); + } + } + view->editor().begin_reversible_command (_("add automation event")); XMLNode& after = _line->the_list()->get_state(); diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index c130b1a919..d98497a944 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -790,6 +790,13 @@ AutomationTimeAxisView::add_automation_event (GdkEvent* event, samplepos_t sampl std::list results; if (list->editor_add (when.sample, y, with_guard_points)) { + + if (_control == _session->recently_touched_controllable ()) { + if (_control->automation_state () == ARDOUR::Off) { + _control->set_automation_state (ARDOUR::Touch); + } + } + XMLNode& after = list->get_state(); _editor.begin_reversible_command (_("add automation event")); _session->add_command (new MementoCommand (*list.get (), &before, &after));