mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-06 16:00:00 +01:00
More robust clone XML mechanism: use ID
This commit is contained in:
@@ -109,6 +109,9 @@ public:
|
||||
std::list<MixingGroup *>::iterator endMixingGroup ();
|
||||
std::list<MixingGroup *>::iterator deleteMixingGroup (std::list<MixingGroup *>::iterator g);
|
||||
|
||||
// snapshots
|
||||
|
||||
|
||||
// lock and unlock access (e.g. while saving)
|
||||
void lock ();
|
||||
void unlock ();
|
||||
|
||||
@@ -281,8 +281,13 @@ void SessionLoader::load(XMLElement *sessionNode)
|
||||
// clone from given origin
|
||||
XMLElement* originNode = xmlCurrent_->FirstChildElement("origin");
|
||||
if (originNode) {
|
||||
std::string sourcename = std::string ( originNode->GetText() );
|
||||
SourceList::iterator origin = session_->find(sourcename);
|
||||
uint64_t id_origin_ = 0;
|
||||
originNode->QueryUnsigned64Attribute("id", &id_origin_);
|
||||
SourceList::iterator origin;
|
||||
if (id_origin_ > 0)
|
||||
origin = session_->find(id_origin_);
|
||||
else
|
||||
origin = session_->find( std::string ( originNode->GetText() ) );
|
||||
// found the orign source
|
||||
if (origin != session_->end()) {
|
||||
// create a new source of type Clone
|
||||
@@ -356,8 +361,13 @@ Source *SessionLoader::createSource(tinyxml2::XMLElement *sourceNode, Mode mode)
|
||||
// clone from given origin
|
||||
XMLElement* originNode = xmlCurrent_->FirstChildElement("origin");
|
||||
if (originNode) {
|
||||
std::string sourcename = std::string ( originNode->GetText() );
|
||||
SourceList::iterator origin = session_->find(sourcename);
|
||||
uint64_t id_origin_ = 0;
|
||||
originNode->QueryUnsigned64Attribute("id", &id_origin_);
|
||||
SourceList::iterator origin;
|
||||
if (id_origin_ > 0)
|
||||
origin = session_->find(id_origin_);
|
||||
else
|
||||
origin = session_->find( std::string ( originNode->GetText() ) );
|
||||
// found the orign source
|
||||
if (origin != session_->end())
|
||||
load_source = (*origin)->clone(id__);
|
||||
|
||||
@@ -525,6 +525,7 @@ void SessionVisitor::visit (CloneSource& s)
|
||||
xmlCurrent_->SetAttribute("type", "CloneSource");
|
||||
|
||||
XMLElement *origin = xmlDoc_->NewElement("origin");
|
||||
origin->SetAttribute("id", s.origin()->id());
|
||||
xmlCurrent_->InsertEndChild(origin);
|
||||
XMLText *text = xmlDoc_->NewText( s.origin()->name().c_str() );
|
||||
origin->InsertEndChild( text );
|
||||
|
||||
Reference in New Issue
Block a user