diff options
author | David Robillard <d@drobilla.net> | 2008-07-29 00:24:06 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-07-29 00:24:06 +0000 |
commit | 99aacf95b16b828ca5f50d7dab34487240d07eff (patch) | |
tree | e4e827eb2c343fc9e604a98f0e61046dffda6d36 /src | |
parent | 2811066546dfe0bd9349502572ee3b35c2532bad (diff) | |
download | ingen-99aacf95b16b828ca5f50d7dab34487240d07eff.tar.gz ingen-99aacf95b16b828ca5f50d7dab34487240d07eff.tar.bz2 ingen-99aacf95b16b828ca5f50d7dab34487240d07eff.zip |
Loading of recursive old-style Om patches (multi-file).
git-svn-id: http://svn.drobilla.net/lad/ingen@1300 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/client/DeprecatedLoader.cpp | 17 | ||||
-rw-r--r-- | src/libs/client/DeprecatedLoader.hpp | 2 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/libs/client/DeprecatedLoader.cpp b/src/libs/client/DeprecatedLoader.cpp index cb869827..fa1dc7b9 100644 --- a/src/libs/client/DeprecatedLoader.cpp +++ b/src/libs/client/DeprecatedLoader.cpp @@ -160,9 +160,11 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, GraphObject::Variables initial_data, bool existing) { - cerr << "[DeprecatedLoader] Loading patch " << filename << "" << endl; + cerr << "[DeprecatedLoader] Loading patch " << filename << " under " + << parent_path << " / " << name << endl; - Path path = "/"; // path of the new patch + Path path = parent_path ? (parent_path.get().base() + name) + : "/" + name; const bool load_name = (name == ""); @@ -235,6 +237,8 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, if (poly == 0) poly = 1; + cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!! LOADING " << path << endl; + // Create it, if we're not merging if (!existing && path != "/") { _engine->create_patch(path, poly); @@ -255,7 +259,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, cur = xmlDocGetRootElement(doc)->xmlChildrenNode; while (cur != NULL) { if ((!xmlStrcmp(cur->name, (const xmlChar*)"subpatch"))) { - load_subpatch(path, doc, cur); + load_subpatch(filename.substr(0, filename.find_last_of("/")), path, doc, cur); } cur = cur->next; } @@ -415,6 +419,8 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr } else if (plugin_label == "midi_output" ) { _engine->create_port(path, "ingen:MIDIPort", true); is_port = true; + } else { + cerr << "WARNING: Unknown internal plugin label \"" << plugin_label << "\"" << endl; } } @@ -477,7 +483,7 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr bool -DeprecatedLoader::load_subpatch(const Path& parent, xmlDocPtr doc, const xmlNodePtr subpatch) +DeprecatedLoader::load_subpatch(const string& base_filename, const Path& parent, xmlDocPtr doc, const xmlNodePtr subpatch) { xmlChar *key; xmlNodePtr cur = subpatch->xmlChildrenNode; @@ -496,7 +502,7 @@ DeprecatedLoader::load_subpatch(const Path& parent, xmlDocPtr doc, const xmlNode } else if ((!xmlStrcmp(cur->name, (const xmlChar*)"polyphony"))) { initial_data.insert(make_pair("ingen::polyphony", (int)poly)); } else if ((!xmlStrcmp(cur->name, (const xmlChar*)"filename"))) { - filename = (const char*)key; + filename = base_filename + "/" + (const char*)key; } else { // Don't know what this tag is, add it as variable if (key != NULL && strlen((const char*)key) > 0) add_variable(initial_data, (const char*)cur->name, (const char*)key); @@ -507,6 +513,7 @@ DeprecatedLoader::load_subpatch(const Path& parent, xmlDocPtr doc, const xmlNode cur = cur->next; } + cout << "Loading subpatch " << filename << " under " << parent << endl; // load_patch sets the passed variable last, so values stored in the parent // will override values stored in the child patch file /*string path = */load_patch(filename, parent, name, initial_data, false); diff --git a/src/libs/client/DeprecatedLoader.hpp b/src/libs/client/DeprecatedLoader.hpp index 1baf9271..209e1f1c 100644 --- a/src/libs/client/DeprecatedLoader.hpp +++ b/src/libs/client/DeprecatedLoader.hpp @@ -82,7 +82,7 @@ private: bool load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); bool load_connection(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); - bool load_subpatch(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); + bool load_subpatch(const string& base_filename, const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); SharedPtr<PresetModel> load_preset(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); }; |