make autoscroll a bit easier to use, fix missing measure lines when moving the editor...
[ardour.git] / gtk2_ardour / automation_time_axis.cc
index cdeed5cc4d5c7d46bd02007658c1445172b19588..80ed2acd164502eaa5a929b1aad3aea3155aacd0 100644 (file)
@@ -1,4 +1,5 @@
 #include <ardour/route.h>
+#include <pbd/memento_command.h>
 
 #include "ardour_ui.h"
 #include "automation_time_axis.h"
@@ -101,7 +102,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro
                }
        }
        name_label.set_text (shortpname);
-       name_label.set_alignment (1.0, 0.5);
+       name_label.set_alignment (Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
 
        if (nomparent.length()) {
 
@@ -117,7 +118,6 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro
 
                plugname = new Label (pname);
                plugname->set_name (X_("TrackPlugName"));
-               plugname->set_alignment (1.0, 0.5);
                plugname->show();
                name_label.set_name (X_("TrackParameterName"));
                controls_table.remove (name_hbox);
@@ -476,13 +476,13 @@ AutomationTimeAxisView::cut_copy_clear_one (AutomationLine& line, Selection& sel
        AutomationList& alist (line.the_list());
        bool ret = false;
 
-       _session.add_undo (alist.get_memento());
+        XMLNode &before = alist.get_state();
 
        switch (op) {
        case Cut:
                if ((what_we_got = alist.cut (selection.time.front().start, selection.time.front().end)) != 0) {
                        editor.get_cut_buffer().add (what_we_got);
-                       _session.add_redo_no_execute (alist.get_memento());
+                       _session.add_command(new MementoCommand<AutomationList>(alist, &before, &alist.get_state()));
                        ret = true;
                }
                break;
@@ -494,7 +494,7 @@ AutomationTimeAxisView::cut_copy_clear_one (AutomationLine& line, Selection& sel
 
        case Clear:
                if ((what_we_got = alist.cut (selection.time.front().start, selection.time.front().end)) != 0) {
-                       _session.add_redo_no_execute (alist.get_memento());
+                       _session.add_command(new MementoCommand<AutomationList>(alist, &before, &alist.get_state()));
                        delete what_we_got;
                        what_we_got = 0;
                        ret = true;
@@ -526,7 +526,7 @@ AutomationTimeAxisView::reset_objects_one (AutomationLine& line, PointSelection&
 {
        AutomationList& alist (line.the_list());
 
-       _session.add_undo (alist.get_memento());
+       _session.add_command (new MementoCommand<AutomationList>(alist, &alist.get_state(), 0));
 
        for (PointSelection::iterator i = selection.begin(); i != selection.end(); ++i) {
 
@@ -557,7 +557,7 @@ AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointS
        AutomationList& alist (line.the_list());
        bool ret = false;
 
-       _session.add_undo (alist.get_memento());
+        XMLNode &before = alist.get_state();
 
        for (PointSelection::iterator i = selection.begin(); i != selection.end(); ++i) {
 
@@ -569,7 +569,7 @@ AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointS
                case Cut:
                        if ((what_we_got = alist.cut ((*i).start, (*i).end)) != 0) {
                                editor.get_cut_buffer().add (what_we_got);
-                               _session.add_redo_no_execute (alist.get_memento());
+                               _session.add_command (new MementoCommand<AutomationList>(alist, &before, &alist.get_state()));
                                ret = true;
                        }
                        break;
@@ -581,7 +581,7 @@ AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointS
                        
                case Clear:
                        if ((what_we_got = alist.cut ((*i).start, (*i).end)) != 0) {
-                               _session.add_redo_no_execute (alist.get_memento());
+                               _session.add_command (new MementoCommand<AutomationList>(alist, &before, &alist.get_state()));
                                delete what_we_got;
                                what_we_got = 0;
                                ret = true;
@@ -638,9 +638,9 @@ AutomationTimeAxisView::paste_one (AutomationLine& line, jack_nframes_t pos, flo
                (*x)->value = foo;
        }
 
-       _session.add_undo (alist.get_memento());
+        XMLNode &before = alist.get_state();
        alist.paste (copy, pos, times);
-       _session.add_redo_no_execute (alist.get_memento());
+       _session.add_command (new MementoCommand<AutomationList>(alist, &before, &alist.get_state()));
 
        return true;
 }