summaryrefslogtreecommitdiff
path: root/gtk2_ardour/route_time_axis.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-03-04 13:15:04 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-03-04 13:15:04 +0000
commit6dde6c5a8fc0630d625f4b73e253ed7e7a48c03a (patch)
tree17160bb08ad26459194490e420e2a15f94e6d4c8 /gtk2_ardour/route_time_axis.cc
parentc2c224727eee4c16bd64ca4a5b5bb2d276f5afe3 (diff)
goodbye to MementoCommand for playlists
git-svn-id: svn://localhost/ardour2/branches/3.0@6726 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/route_time_axis.cc')
-rw-r--r--gtk2_ardour/route_time_axis.cc29
1 files changed, 23 insertions, 6 deletions
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index 39bb1847a1..62a2b2b8a0 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -33,7 +33,7 @@
#include "pbd/whitespace.h"
#include "pbd/memento_command.h"
#include "pbd/enumwriter.h"
-#include "pbd/stacktrace.h"
+#include "pbd/stateful_diff_command.h"
#include <gtkmm/menu.h>
#include <gtkmm/menuitem.h>
@@ -1385,12 +1385,22 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
}
}
- XMLNode &before = playlist->get_state();
+ playlist->clear_history ();
+ playlist->clear_owned_history ();
+
switch (op) {
case Cut:
if ((what_we_got = playlist->cut (time)) != 0) {
_editor.get_cut_buffer().add (what_we_got);
- _session->add_command( new MementoCommand<Playlist>(*playlist.get(), &before, &playlist->get_state()));
+
+ vector<StatefulDiffCommand*> cmds;
+
+ playlist->rdiff (cmds);
+
+ for (vector<StatefulDiffCommand*>::iterator c = cmds.begin(); c != cmds.end(); ++c) {
+ _session->add_command (*c);
+ }
+ _session->add_command (new StatefulDiffCommand (playlist));
ret = true;
}
break;
@@ -1402,7 +1412,14 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
case Clear:
if ((what_we_got = playlist->cut (time)) != 0) {
- _session->add_command( new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+ vector<StatefulDiffCommand*> cmds;
+
+ playlist->rdiff (cmds);
+
+ for (vector<StatefulDiffCommand*>::iterator c = cmds.begin(); c != cmds.end(); ++c) {
+ _session->add_command (*c);
+ }
+ _session->add_command (new StatefulDiffCommand (playlist));
what_we_got->release ();
ret = true;
}
@@ -1432,9 +1449,9 @@ RouteTimeAxisView::paste (nframes_t pos, float times, Selection& selection, size
pos = session_frame_to_track_frame(pos, get_diskstream()->speed() );
}
- XMLNode &before = playlist->get_state();
+ playlist->clear_history ();
playlist->paste (*p, pos, times);
- _session->add_command( new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+ _session->add_command (new StatefulDiffCommand (playlist));
return true;
}