summaryrefslogtreecommitdiff
path: root/gtk2_ardour/automation_line.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-07-14 12:27:37 +0000
committerCarl Hetherington <carl@carlh.net>2010-07-14 12:27:37 +0000
commit66062a85b6388b28ed04f90bab3d302eec0f2a77 (patch)
tree89c1ea74a896e60e14143bc6e3dde867eac42c48 /gtk2_ardour/automation_line.cc
parent5ce47b52da7bb60b5b7dde94ca0bacc6ae44197a (diff)
Fix binding of automation list undo records to MIDI sources. Should fix the remainder of #3203.
git-svn-id: svn://localhost/ardour2/branches/3.0@7411 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/automation_line.cc')
-rw-r--r--gtk2_ardour/automation_line.cc44
1 files changed, 35 insertions, 9 deletions
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc
index ed94b03355..da76e0abd5 100644
--- a/gtk2_ardour/automation_line.cc
+++ b/gtk2_ardour/automation_line.cc
@@ -218,7 +218,9 @@ AutomationLine::modify_point_y (ControlPoint& cp, double y)
double const x = trackview.editor().frame_to_unit (_time_converter.to((*cp.model())->when));
trackview.editor().session()->begin_reversible_command (_("automation event move"));
- trackview.editor().session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &get_state(), 0));
+ trackview.editor().session()->add_command (
+ new MementoCommand<AutomationList> (memento_command_binder(), &get_state(), 0)
+ );
cp.move_to (x, y, ControlPoint::Full);
reset_line_coords (cp);
@@ -233,7 +235,10 @@ AutomationLine::modify_point_y (ControlPoint& cp, double y)
update_pending = false;
- trackview.editor().session()->add_command (new MementoCommand<AutomationList>(*alist.get(), 0, &alist->get_state()));
+ trackview.editor().session()->add_command (
+ new MementoCommand<AutomationList> (memento_command_binder(), 0, &alist->get_state())
+ );
+
trackview.editor().session()->commit_reversible_command ();
trackview.editor().session()->set_dirty ();
}
@@ -568,7 +573,9 @@ void
AutomationLine::start_drag_single (ControlPoint* cp, double x, float fraction)
{
trackview.editor().session()->begin_reversible_command (_("automation event move"));
- trackview.editor().session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &get_state(), 0));
+ trackview.editor().session()->add_command (
+ new MementoCommand<AutomationList> (memento_command_binder(), &get_state(), 0)
+ );
_drag_points.clear ();
_drag_points.push_back (cp);
@@ -593,7 +600,9 @@ void
AutomationLine::start_drag_line (uint32_t i1, uint32_t i2, float fraction)
{
trackview.editor().session()->begin_reversible_command (_("automation range move"));
- trackview.editor().session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &get_state(), 0));
+ trackview.editor().session()->add_command (
+ new MementoCommand<AutomationList> (memento_command_binder (), &get_state(), 0)
+ );
_drag_points.clear ();
for (uint32_t i = i1; i <= i2; i++) {
@@ -611,7 +620,9 @@ void
AutomationLine::start_drag_multiple (list<ControlPoint*> cp, float fraction, XMLNode* state)
{
trackview.editor().session()->begin_reversible_command (_("automation range move"));
- trackview.editor().session()->add_command (new MementoCommand<AutomationList>(*alist.get(), state, 0));
+ trackview.editor().session()->add_command (
+ new MementoCommand<AutomationList> (memento_command_binder(), state, 0)
+ );
_drag_points = cp;
start_drag_common (0, fraction);
@@ -778,7 +789,10 @@ AutomationLine::end_drag ()
update_pending = false;
- trackview.editor().session()->add_command (new MementoCommand<AutomationList>(*alist.get(), 0, &alist->get_state()));
+ trackview.editor().session()->add_command (
+ new MementoCommand<AutomationList>(memento_command_binder (), 0, &alist->get_state())
+ );
+
trackview.editor().session()->commit_reversible_command ();
trackview.editor().session()->set_dirty ();
}
@@ -924,8 +938,10 @@ AutomationLine::remove_point (ControlPoint& cp)
alist->erase (mr.start, mr.end);
- trackview.editor().session()->add_command(new MementoCommand<AutomationList>(
- *alist.get(), &before, &alist->get_state()));
+ 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 ();
}
@@ -1107,7 +1123,11 @@ AutomationLine::clear ()
/* parent must create command */
XMLNode &before = alist->get_state();
alist->clear();
- trackview.editor().session()->add_command (new MementoCommand<AutomationList>(*(alist.get()), &before, &alist->get_state()));
+
+ 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 ();
}
@@ -1311,3 +1331,9 @@ AutomationLine::connect_to_list ()
_list_connections, invalidator (*this), boost::bind (&AutomationLine::interpolation_changed, this, _1), gui_context()
);
}
+
+MementoCommandBinder<AutomationList>*
+AutomationLine::memento_command_binder ()
+{
+ return new SimpleMementoCommandBinder<AutomationList> (*alist.get());
+}