patch from brian to get consistent menu behaviour
[ardour.git] / gtk2_ardour / gain_automation_time_axis.cc
index 3e3d02bfc428259c3addc5da3a7f49a3c5e48bdb..c1261fdf236c44c6722b3898841f297445cf6f90 100644 (file)
@@ -32,7 +32,9 @@ using namespace ARDOUR;
 using namespace PBD;
 using namespace Gtk;
 
-GainAutomationTimeAxisView::GainAutomationTimeAxisView (Session& s, Route& r, PublicEditor& e, TimeAxisView& parent, ArdourCanvas::Canvas& canvas, const string & n, ARDOUR::Curve& c)
+GainAutomationTimeAxisView::GainAutomationTimeAxisView (Session& s, boost::shared_ptr<Route> r, 
+                                                       PublicEditor& e, TimeAxisView& parent, 
+                                                       ArdourCanvas::Canvas& canvas, const string & n, ARDOUR::Curve& c)
 
        : AxisView (s),
          AutomationTimeAxisView (s, r, e, parent, canvas, n, X_("gain"), ""),
@@ -46,7 +48,7 @@ GainAutomationTimeAxisView::~GainAutomationTimeAxisView ()
 }
 
 void
-GainAutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* 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;
 
@@ -61,12 +63,10 @@ GainAutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* item, GdkE
        lines.front()->view_to_model_y (y);
 
        _session.begin_reversible_command (_("add gain automation event"));
-
-        XMLNode &before = curve.get_state();
+        XMLNode& before = curve.get_state();
        curve.add (when, y);
-        XMLNode &after = curve.get_state();
-        _session.add_command(new MementoCommand<ARDOUR::Curve>(curve, before, after));
-       _session.commit_reversible_command ();
+        XMLNode& after = curve.get_state();
+       _session.commit_reversible_command (new MementoCommand<ARDOUR::Curve>(curve, &before, &after));
        _session.set_dirty ();
 }
 
@@ -74,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);
        }
 }