diff options
author | David Robillard <d@drobilla.net> | 2008-10-12 08:45:55 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-10-12 08:45:55 +0000 |
commit | 141c34e297b1ffde3293c42f26181bd3d895b2c4 (patch) | |
tree | b37d3b7ac7e3c0ccb6957cdc5d510bcbbc7db382 /src/client | |
parent | 9f0415450bba9b0c32dfd1b9c4033f57806c35cc (diff) | |
download | ingen-141c34e297b1ffde3293c42f26181bd3d895b2c4.tar.gz ingen-141c34e297b1ffde3293c42f26181bd3d895b2c4.tar.bz2 ingen-141c34e297b1ffde3293c42f26181bd3d895b2c4.zip |
Fix Om patch loading (import and load as child).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1656 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/DeprecatedLoader.cpp | 24 | ||||
-rw-r--r-- | src/client/DeprecatedLoader.hpp | 11 |
2 files changed, 19 insertions, 16 deletions
diff --git a/src/client/DeprecatedLoader.cpp b/src/client/DeprecatedLoader.cpp index f22e9bab..8d33e4ff 100644 --- a/src/client/DeprecatedLoader.cpp +++ b/src/client/DeprecatedLoader.cpp @@ -210,19 +210,21 @@ DeprecatedLoader::add_variable(GraphObject::Variables& data, string old_key, str * Returns the path of the newly created patch. */ string -DeprecatedLoader::load_patch(const Glib::ustring& filename, - boost::optional<Path> parent_path, - string name, - GraphObject::Variables initial_data, - bool existing) +DeprecatedLoader::load_patch(const Glib::ustring& filename, + bool merge, + boost::optional<Path> parent_path, + boost::optional<Symbol> name, + GraphObject::Variables initial_data, + bool existing) { cerr << "[DeprecatedLoader] Loading patch " << filename << " under " << parent_path << " / " << name << endl; - Path path = parent_path ? (parent_path.get().base() + name) - : "/" + name; - - const bool load_name = (name == ""); + Path path("/"); + if (parent_path) + path = *parent_path; + if (name) + path = path.base() + *name; size_t poly = 0; @@ -263,7 +265,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); if ((!xmlStrcmp(cur->name, (const xmlChar*)"name"))) { - if (load_name && key) { + if (!merge && parent_path && !name && key) { if (parent_path) path = Path(parent_path.get()).base() + nameify_if_invalid((char*)key); else @@ -570,7 +572,7 @@ DeprecatedLoader::load_subpatch(const string& base_filename, const Path& parent, 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); + /*string path = */load_patch(filename, false, parent, Symbol(name), initial_data, false); return false; } diff --git a/src/client/DeprecatedLoader.hpp b/src/client/DeprecatedLoader.hpp index c1af52c2..f7213aca 100644 --- a/src/client/DeprecatedLoader.hpp +++ b/src/client/DeprecatedLoader.hpp @@ -62,11 +62,12 @@ public: string find_file(const string& filename, const string& additional_path = ""); - string load_patch(const Glib::ustring& filename, - boost::optional<Path> parent_path, - string name, - GraphObject::Variables initial_data, - bool existing = false); + string load_patch(const Glib::ustring& filename, + bool merge, + boost::optional<Path> parent_path, + boost::optional<Symbol> name, + GraphObject::Variables initial_data, + bool existing = false); private: void add_variable(GraphObject::Variables& data, string key, string value); |