diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index adb896af8b..ea54cb4098 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -688,17 +688,18 @@ bool Editor::canvas_line_event (GdkEvent *event, ArdourCanvas::Item* item, AutomationLine* al) { ItemType type; - - if (dynamic_cast (al) != 0) { + AudioRegionGainLine* gl; + if ((gl = dynamic_cast (al)) != 0) { type = GainLineItem; + clicked_regionview = &gl->region_view (); } else { type = AutomationLineItem; + clicked_regionview = 0; } clicked_control_point = 0; clicked_axisview = &al->trackview; clicked_routeview = dynamic_cast(clicked_axisview); - clicked_regionview = 0; return typed_event (item, event, type); } diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 81e6cb7dff..04590da885 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -4057,8 +4057,9 @@ MarkerDrag::update_item (Location*) ControlPointDrag::ControlPointDrag (Editor* e, ArdourCanvas::Item* i) : Drag (e, i), - _cumulative_x_drag (0), - _cumulative_y_drag (0) + _cumulative_x_drag (0) + , _cumulative_y_drag (0) + , _pushing (false) { if (_zero_gain_fraction < 0.0) { _zero_gain_fraction = gain_to_slider_position_with_max (dB_to_coefficient (0.0), Config->get_max_gain()); @@ -4278,8 +4279,15 @@ LineDrag::finished (GdkEvent* event, bool movement_occured) AutomationTimeAxisView* atv; if ((atv = dynamic_cast(_editor->clicked_axisview)) != 0) { - framepos_t where = _editor->window_event_sample (event, 0, 0); + framepos_t where = _editor->canvas_event_sample (event, 0, 0); + atv->add_automation_event (event, where, event->button.y, false); + } else if (dynamic_cast(_editor->clicked_axisview) != 0) { + AudioRegionView* arv; + + if ((arv = dynamic_cast(_editor->clicked_regionview)) != 0) { + arv->add_gain_point_event (arv->get_canvas_group (), event, false); + } } } } diff --git a/gtk2_ardour/region_gain_line.h b/gtk2_ardour/region_gain_line.h index 683537ee69..018ed3d936 100644 --- a/gtk2_ardour/region_gain_line.h +++ b/gtk2_ardour/region_gain_line.h @@ -41,7 +41,7 @@ class AudioRegionGainLine : public AutomationLine void end_drag (bool with_push, uint32_t final_index); void remove_point (ControlPoint&); - + AudioRegionView& region_view () { return rv; } private: PBD::ScopedConnection _region_changed_connection;