diff options
author | Carl Hetherington <carl@carlh.net> | 2010-02-09 22:28:46 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-02-09 22:28:46 +0000 |
commit | 12b9571b8007238a365324238e42721ab994853f (patch) | |
tree | bfe504849d6d25ce74ea08f1c2bb34465b3c51a4 /libs/ardour | |
parent | cf9ce8636a95ffcebc1454f842250733edf41de6 (diff) |
Save and not-yet-working restore of StatefulDiffCommands.
git-svn-id: svn://localhost/ardour2/branches/3.0@6669 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/session.h | 1 | ||||
-rw-r--r-- | libs/ardour/session_command.cc | 19 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 4 |
3 files changed, 24 insertions, 0 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index de2dbaa149..f0b71d8019 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -728,6 +728,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi // these commands are implemented in libs/ardour/session_command.cc Command* memento_command_factory(XMLNode* n); + Command* stateful_diff_command_factory (XMLNode *); void register_with_memento_command_factory(PBD::ID, PBD::StatefulDestructible*); /* clicking */ diff --git a/libs/ardour/session_command.cc b/libs/ardour/session_command.cc index 19253cc725..897359b274 100644 --- a/libs/ardour/session_command.cc +++ b/libs/ardour/session_command.cc @@ -36,6 +36,7 @@ #include "pbd/id.h" #include "pbd/statefuldestructible.h" #include "pbd/failed_constructor.h" +#include "pbd/stateful_diff_command.h" #include "evoral/Curve.hpp" using namespace PBD; @@ -132,3 +133,21 @@ Session::memento_command_factory(XMLNode *n) return 0 ; } +Command * +Session::stateful_diff_command_factory (XMLNode* n) +{ + PBD::ID const id (n->property("obj-id")->value ()); + + string const obj_T = n->property ("type-name")->value (); + if ((obj_T == typeid (AudioRegion).name() || obj_T == typeid (MidiRegion).name()) && regions.count(id)) { + return new StatefulDiffCommand (regions[id].get(), *n); + } + + /* we failed */ + + error << string_compose ( + _("could not reconstitute StatefulDiffCommand from XMLNode. object type = %1 id = %2"), obj_T, id.to_s()) + << endmsg; + + return 0; +} diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index fd14094f7f..45e35c91fd 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -2955,6 +2955,10 @@ Session::restore_history (string snapshot_name) error << string_compose (_("Region command references an unknown region ID=%1"), id.to_s()) << endmsg; } + } else if (n->name() == "StatefulDiffCommand") { + if ((c = stateful_diff_command_factory (n))) { + ut->add_command (c); + } } else { error << string_compose(_("Couldn't figure out how to make a Command out of a %1 XMLNode."), n->name()) << endmsg; } |