X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fsession_command.cc;h=e5ddd0a0973ac9c816933584f7e852a74b76efcd;hb=454f14d9c58de541a230c266ad59987b8ca7b1a4;hp=17ffa1e26dce27c2b3aadf5650774ebee1df0366;hpb=3a85e71031bc26d67d66db985da2159415f84fdb;p=ardour.git diff --git a/libs/ardour/session_command.cc b/libs/ardour/session_command.cc index 17ffa1e26d..e5ddd0a097 100644 --- a/libs/ardour/session_command.cc +++ b/libs/ardour/session_command.cc @@ -33,6 +33,9 @@ #include "ardour/midi_region.h" #include "ardour/session_playlists.h" #include "ardour/region_factory.h" +#include "ardour/midi_automation_list_binder.h" +#include "ardour/crossfade_binder.h" +#include "ardour/crossfade.h" #include "pbd/error.h" #include "pbd/id.h" #include "pbd/statefuldestructible.h" @@ -58,7 +61,12 @@ Session::memento_command_factory(XMLNode *n) XMLNode *child = 0; /* get id */ - id = PBD::ID(n->property("obj-id")->value()); + + /* XXX: HACK! */ + bool have_id = n->property("obj-id") != 0; + if (have_id) { + id = PBD::ID(n->property("obj-id")->value()); + } /* get before/after */ @@ -97,13 +105,13 @@ Session::memento_command_factory(XMLNode *n) return new MementoCommand(*sources[id], before, after); } else if (obj_T == "ARDOUR::Location") { - Location* loc = _locations.get_location_by_id(id); + Location* loc = _locations->get_location_by_id(id); if (loc) { return new MementoCommand(*loc, before, after); } } else if (obj_T == "ARDOUR::Locations") { - return new MementoCommand(_locations, before, after); + return new MementoCommand(*_locations, before, after); } else if (obj_T == "ARDOUR::TempoMap") { return new MementoCommand(*_tempo_map, before, after); @@ -121,11 +129,33 @@ Session::memento_command_factory(XMLNode *n) } } else if (obj_T == "Evoral::Curve" || obj_T == "ARDOUR::AutomationList") { - std::map::iterator i = automation_lists.find(id); - if (i != automation_lists.end()) { - return new MementoCommand(*i->second, before, after); - } - cerr << "Alist not found\n"; + if (have_id) { + std::map::iterator i = automation_lists.find(id); + if (i != automation_lists.end()) { + return new MementoCommand(*i->second, before, after); + } + } else { + return new MementoCommand ( + new MidiAutomationListBinder (n, sources), + before, after + ); + } + + cerr << "Alist " << id << " not found\n"; + + } else if (obj_T == "ARDOUR::Crossfade") { + if (have_id) { + boost::shared_ptr c = playlists->find_crossfade (id); + if (c) { + return new MementoCommand (*c.get(), before, after); + } + } else { + return new MementoCommand ( + new CrossfadeBinder (n, playlists), + before, after + ); + } + } else if (registry.count(id)) { // For Editor and AutomationLine which are off-limits herea return new MementoCommand(*registry[id], before, after); } @@ -158,10 +188,10 @@ Session::stateful_diff_command_factory (XMLNode* 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; }