From: Carl Hetherington Date: Sat, 31 Jul 2010 00:44:26 +0000 (+0000) Subject: Make Clear option work for MIDI automation tracks. Fixes part of #3137. X-Git-Tag: 3.0-alpha5~1736 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=97c8ad6564b90e13db6e598e6fc142f1d1f67246;p=ardour.git Make Clear option work for MIDI automation tracks. Fixes part of #3137. git-svn-id: svn://localhost/ardour2/branches/3.0@7523 d708f5d6-7413-0410-9779-e7cbd77b26cf --- diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 71a29af3dc..7d5ca540a8 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -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 (memento_command_binder (), &before, &alist->get_state()) ); - - trackview.editor().session()->commit_reversible_command (); - trackview.editor().session()->set_dirty (); } void diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h index 2b63cb1295..7fcad9a4f8 100644 --- a/gtk2_ardour/automation_line.h +++ b/gtk2_ardour/automation_line.h @@ -64,7 +64,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulDestructible void queue_reset (); void reset (); - void clear(); + void clear (); std::list point_selection_to_control_points (PointSelection const &); void set_selected_points (PointSelection&); diff --git a/gtk2_ardour/automation_streamview.cc b/gtk2_ardour/automation_streamview.cc index 146cdc7b89..76e565d414 100644 --- a/gtk2_ardour/automation_streamview.cc +++ b/gtk2_ardour/automation_streamview.cc @@ -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::iterator i = region_views.begin(); i != region_views.end(); ++i) { + AutomationRegionView* arv = dynamic_cast (*i); + assert (arv); + arv->line()->clear (); + } +} diff --git a/gtk2_ardour/automation_streamview.h b/gtk2_ardour/automation_streamview.h index 335d63ca7a..0791764a4a 100644 --- a/gtk2_ardour/automation_streamview.h +++ b/gtk2_ardour/automation_streamview.h @@ -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 (); diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index a7114f8ff0..e9cb98ca34 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -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