patch from brian to get consistent menu behaviour
[ardour.git] / gtk2_ardour / gain_automation_time_axis.cc
index 5352015f11bb71acad241fb028ba18bca76ab1f7..c1261fdf236c44c6722b3898841f297445cf6f90 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <ardour/curve.h>
 #include <ardour/route.h>
+#include <pbd/memento_command.h>
 
 #include "gain_automation_time_axis.h"
 #include "automation_line.h"
@@ -47,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;
 
@@ -62,11 +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"));
-
-       _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<ARDOUR::Curve>(curve, &before, &after));
        _session.set_dirty ();
 }