r199@gandalf: fugalh | 2006-07-26 17:22:38 -0600
[ardour.git] / gtk2_ardour / audio_time_axis.cc
index 84c7bf7e15b72616860c352b988e2b301a7e218f..ebc97be77b9ae9125180ba646d45f4d7d5fac228 100644 (file)
@@ -38,7 +38,7 @@
 #include <gtkmm2ext/utils.h>
 
 #include <ardour/audioplaylist.h>
-#include <ardour/diskstream.h>
+#include <ardour/audio_diskstream.h>
 #include <ardour/insert.h>
 #include <ardour/ladspa_plugin.h>
 #include <ardour/location.h>
@@ -80,6 +80,7 @@
 #include "i18n.h"
 
 using namespace ARDOUR;
+using namespace PBD;
 using namespace LADSPA;
 using namespace Gtk;
 using namespace Editing;
@@ -823,7 +824,7 @@ AudioTimeAxisView::rename_current_playlist ()
        string name;
 
        AudioPlaylist *pl;
-       DiskStream *ds;
+       AudioDiskstream *ds;
 
        if (((ds = get_diskstream()) == 0) || ds->destructive() || ((pl = ds->playlist()) == 0)) {
                return;
@@ -851,7 +852,7 @@ void
 AudioTimeAxisView::use_copy_playlist (bool prompt)
 {
        AudioPlaylist *pl;
-       DiskStream *ds;
+       AudioDiskstream *ds;
        string name;
 
        if (((ds = get_diskstream()) == 0) || ds->destructive() || ((pl = ds->playlist()) == 0)) {
@@ -891,7 +892,7 @@ void
 AudioTimeAxisView::use_new_playlist (bool prompt)
 {
        AudioPlaylist *pl;
-       DiskStream *ds;
+       AudioDiskstream *ds;
        string name;
 
        if (((ds = get_diskstream()) == 0) || ds->destructive() || ((pl = ds->playlist()) == 0)) {
@@ -930,7 +931,7 @@ void
 AudioTimeAxisView::clear_playlist ()
 {
        AudioPlaylist *pl;
-       DiskStream *ds;
+       AudioDiskstream *ds;
        
        if ((ds = get_diskstream()) != 0) {
                if ((pl = ds->playlist()) != 0) {
@@ -988,7 +989,7 @@ AudioTimeAxisView::diskstream_changed (void *src)
 void
 AudioTimeAxisView::update_diskstream_display ()
 {
-       DiskStream *ds;
+       AudioDiskstream *ds;
 
        if ((ds = get_diskstream()) != 0) {
                set_playlist (ds->playlist ());
@@ -1092,7 +1093,7 @@ AudioTimeAxisView::name() const
 Playlist *
 AudioTimeAxisView::playlist () const 
 {
-       DiskStream *ds;
+       AudioDiskstream *ds;
 
        if ((ds = get_diskstream()) != 0) {
                return ds->playlist(); 
@@ -1142,7 +1143,7 @@ AudioTimeAxisView::hide_click ()
 Region*
 AudioTimeAxisView::find_next_region (jack_nframes_t pos, RegionPoint point, int32_t dir)
 {
-       DiskStream *stream;
+       AudioDiskstream *stream;
        AudioPlaylist *playlist;
 
        if ((stream = get_diskstream()) != 0 && (playlist = stream->playlist()) != 0) {
@@ -1717,7 +1718,7 @@ bool
 AudioTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
 {
        Playlist* what_we_got;
-       DiskStream* ds = get_diskstream();
+       AudioDiskstream* ds = get_diskstream();
        Playlist* playlist;
        bool ret = false;
 
@@ -1738,12 +1739,14 @@ AudioTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
                }
        }
        
+        XMLNode &before, &after;
        switch (op) {
        case Cut:
-               _session.add_undo (playlist->get_memento());
+                before = playlist->get_state();
                if ((what_we_got = playlist->cut (time)) != 0) {
                        editor.get_cut_buffer().add (what_we_got);
-                       _session.add_redo_no_execute (playlist->get_memento());
+                        after = playlist->get_state();
+                       _session.add_command (MementoCommand<Playlist>(*playlist, before, after));
                        ret = true;
                }
                break;
@@ -1754,9 +1757,9 @@ AudioTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
                break;
 
        case Clear:
-               _session.add_undo (playlist->get_memento());
+               before = playlist->get_state();
                if ((what_we_got = playlist->cut (time)) != 0) {
-                       _session.add_redo_no_execute (playlist->get_memento());
+                       _session.add_command(MementoCommand<Playlist>(*playlist, before, after));
                        what_we_got->unref ();
                        ret = true;
                }
@@ -1785,9 +1788,10 @@ AudioTimeAxisView::paste (jack_nframes_t pos, float times, Selection& selection,
        if (get_diskstream()->speed() != 1.0f)
                pos = session_frame_to_track_frame(pos, get_diskstream()->speed() );
        
-       _session.add_undo (playlist->get_memento());
+        XMLNode &before = playlist->get_state();
        playlist->paste (**p, pos, times);
-       _session.add_redo_no_execute (playlist->get_memento());
+        _session.add_command(MementoCommand<Playlist>(*playlist, before, 
+                                                      playlist->get_state()));
 
        return true;
 }