summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/client/DeprecatedLoader.cpp24
-rw-r--r--src/client/DeprecatedLoader.hpp11
-rw-r--r--src/gui/ThreadedLoader.cpp26
3 files changed, 34 insertions, 27 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);
diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp
index 530c3840..0dd1b1dd 100644
--- a/src/gui/ThreadedLoader.cpp
+++ b/src/gui/ThreadedLoader.cpp
@@ -90,27 +90,31 @@ ThreadedLoader::load_patch(bool merge,
{
_mutex.lock();
- // FIXME: Filthy hack to load deprecated patches based on file extension
+ Glib::ustring engine_base = "";
+ if (engine_parent) {
+ cout << "A " << merge << endl;
+ if (merge)
+ engine_base = engine_parent.get();
+ else
+ engine_base = engine_parent.get().base();
+ }
+
+
+
+ // Filthy hack to load deprecated patches based on file extension
if (data_base_uri.substr(data_base_uri.length()-3) == ".om") {
_events.push_back(sigc::hide_return(sigc::bind(
sigc::mem_fun(_deprecated_loader, &DeprecatedLoader::load_patch),
data_base_uri,
+ merge,
engine_parent,
- engine_symbol ? (string)engine_symbol.get() : string(""),
+ engine_symbol,
engine_data,
false)));
} else {
- Glib::ustring engine_base = "";
- if (engine_parent) {
- if (merge)
- engine_base = engine_parent.get();
- else
- engine_base = engine_parent.get().base();
- }
-
if (merge && (!engine_parent || engine_parent.get() == "/"))
engine_base = engine_base.substr(0, engine_base.find_last_of("/"));
-
+
_events.push_back(sigc::hide_return(sigc::bind(
sigc::mem_fun(_parser.get(), &Ingen::Serialisation::Parser::parse_document),
App::instance().world(),