X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fgain_automation_time_axis.cc;h=c1261fdf236c44c6722b3898841f297445cf6f90;hb=aa60114843f4990ef93ba83974501495ddda358b;hp=13b710b157472562147c2aebfe080ce5de8a4743;hpb=14d43ca9fe28a8309b4a52fa85e2b0c64a92248b;p=ardour.git diff --git a/gtk2_ardour/gain_automation_time_axis.cc b/gtk2_ardour/gain_automation_time_axis.cc index 13b710b157..c1261fdf23 100644 --- a/gtk2_ardour/gain_automation_time_axis.cc +++ b/gtk2_ardour/gain_automation_time_axis.cc @@ -20,19 +20,24 @@ #include #include +#include #include "gain_automation_time_axis.h" #include "automation_line.h" +#include "canvas.h" #include "i18n.h" using namespace ARDOUR; +using namespace PBD; using namespace Gtk; -GainAutomationTimeAxisView::GainAutomationTimeAxisView (Session& s, Route& r, PublicEditor& e, TimeAxisView& parent, Widget* p, std::string n, ARDOUR::Curve& c) +GainAutomationTimeAxisView::GainAutomationTimeAxisView (Session& s, boost::shared_ptr r, + PublicEditor& e, TimeAxisView& parent, + ArdourCanvas::Canvas& canvas, const string & n, ARDOUR::Curve& c) : AxisView (s), - AutomationTimeAxisView (s, r, e, parent, p, n, X_("gain"), ""), + AutomationTimeAxisView (s, r, e, parent, canvas, n, X_("gain"), ""), curve (c) { @@ -43,11 +48,11 @@ GainAutomationTimeAxisView::~GainAutomationTimeAxisView () } void -GainAutomationTimeAxisView::add_automation_event (GnomeCanvasItem* item, GdkEvent* event, jack_nframes_t when, double y) +GainAutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* item, GdkEvent* event, nframes_t when, double y) { double x = 0; - gnome_canvas_item_w2i (canvas_display, &x, &y); + canvas_display->w2i (x, y); /* compute vertical fractional position */ @@ -58,11 +63,10 @@ GainAutomationTimeAxisView::add_automation_event (GnomeCanvasItem* item, GdkEven lines.front()->view_to_model_y (y); _session.begin_reversible_command (_("add gain automation event")); - - _session.add_undo (curve.get_memento()); + XMLNode& before = curve.get_state(); curve.add (when, y); - _session.add_redo_no_execute (curve.get_memento()); - _session.commit_reversible_command (); + XMLNode& after = curve.get_state(); + _session.commit_reversible_command (new MementoCommand(curve, &before, &after)); _session.set_dirty (); } @@ -70,6 +74,6 @@ void GainAutomationTimeAxisView::set_automation_state (AutoState state) { if (!ignore_state_request) { - route.set_gain_automation_state (state); + route->set_gain_automation_state (state); } }