Make Clear option work for MIDI automation tracks. Fixes part of #3137.
authorCarl Hetherington <carl@carlh.net>
Sat, 31 Jul 2010 00:44:26 +0000 (00:44 +0000)
committerCarl Hetherington <carl@carlh.net>
Sat, 31 Jul 2010 00:44:26 +0000 (00:44 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7523 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/automation_line.cc
gtk2_ardour/automation_line.h
gtk2_ardour/automation_streamview.cc
gtk2_ardour/automation_streamview.h
gtk2_ardour/automation_time_axis.cc

index 71a29af3dcd278d142e8e9d8b58f3716cb39ed1b..7d5ca540a865c2258f2e8e597a351724639f3800 100644 (file)
@@ -1121,16 +1121,13 @@ AutomationLine::reset ()
 void
 AutomationLine::clear ()
 {
-       /* parent must create command */
+       /* parent must create and commit command */
        XMLNode &before = alist->get_state();
        alist->clear();
 
        trackview.editor().session()->add_command (
                new MementoCommand<AutomationList> (memento_command_binder (), &before, &alist->get_state())
                );
-       
-       trackview.editor().session()->commit_reversible_command ();
-       trackview.editor().session()->set_dirty ();
 }
 
 void
index 2b63cb1295db86c37ea0eb93dc8992f70c2d1423..7fcad9a4f85448c121602a247d2f954fb5b60799 100644 (file)
@@ -64,7 +64,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulDestructible
 
        void queue_reset ();
        void reset ();
-       void clear();
+       void clear ();
 
        std::list<ControlPoint*> point_selection_to_control_points (PointSelection const &); 
        void set_selected_points (PointSelection&);
index 146cdc7b8918077f672e772b115533b00ff84fdb..76e565d4143d5f290a9128eb085802da47ff00e0 100644 (file)
@@ -262,3 +262,14 @@ AutomationStreamView::interpolation () const
 
        return v->line()->the_list()->interpolation ();
 }
+
+/** Clear all automation displayed in this view */
+void
+AutomationStreamView::clear ()
+{
+       for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
+               AutomationRegionView* arv = dynamic_cast<AutomationRegionView*> (*i);
+               assert (arv);
+               arv->line()->clear ();
+       }
+}
index 335d63ca7abf1c2a27b1408be50fe9ab3705f6a1..0791764a4ab0e0badd924aefccf17e68e38f4d85 100644 (file)
@@ -59,6 +59,8 @@ class AutomationStreamView : public StreamView
        void set_interpolation (ARDOUR::AutomationList::InterpolationStyle);
        ARDOUR::AutomationList::InterpolationStyle interpolation () const;
 
+       void clear ();
+
   private:
        void setup_rec_box ();
 
index a7114f8ff0ece3bea569cd8a5d4df8832b5cd600..e9cb98ca34fb24e418139337f90dfcc6c9431f72 100644 (file)
@@ -379,10 +379,18 @@ AutomationTimeAxisView::set_interpolation (AutomationList::InterpolationStyle st
 void
 AutomationTimeAxisView::clear_clicked ()
 {
+       assert (_line || _view);
+       
+       _session->begin_reversible_command (_("clear automation"));
+       
        if (_line) {
-               _session->begin_reversible_command (_("clear automation"));
                _line->clear ();
+       } else if (_view) {
+               _view->clear ();
        }
+
+       _session->commit_reversible_command ();
+       _session->set_dirty ();
 }
 
 void