summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libs/gui/LoadPatchWindow.cpp5
-rw-r--r--src/libs/gui/PatchCanvas.cpp10
-rw-r--r--src/libs/gui/ThreadedLoader.cpp18
-rw-r--r--src/libs/serialisation/Parser.cpp42
-rw-r--r--src/libs/serialisation/Parser.hpp14
-rw-r--r--src/libs/shared/Builder.cpp8
-rw-r--r--src/libs/shared/ClashAvoider.cpp26
-rw-r--r--src/libs/shared/ClashAvoider.hpp4
-rw-r--r--src/progs/ingen/main.cpp6
9 files changed, 94 insertions, 39 deletions
diff --git a/src/libs/gui/LoadPatchWindow.cpp b/src/libs/gui/LoadPatchWindow.cpp
index 4a86515a..2f3b6af7 100644
--- a/src/libs/gui/LoadPatchWindow.cpp
+++ b/src/libs/gui/LoadPatchWindow.cpp
@@ -129,8 +129,9 @@ LoadPatchWindow::ok_clicked()
if (_replace)
App::instance().engine()->clear_patch(_patch->path());
- if (_patch->path() != "/")
- parent = _patch->path().parent();
+ //if (_patch->path() != "/")
+ // parent = _patch->path().parent();
+ parent = _patch->path();
_patch.reset();
hide();
diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp
index 135a28c8..2ea4496c 100644
--- a/src/libs/gui/PatchCanvas.cpp
+++ b/src/libs/gui/PatchCanvas.cpp
@@ -58,7 +58,9 @@ PatchCanvas::PatchCanvas(SharedPtr<PatchModel> patch, int width, int height)
, _last_click_x(0)
, _last_click_y(0)
, _refresh_menu(false)
+ , _menu(NULL)
, _internal_menu(NULL)
+ , _plugin_menu(NULL)
{
Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference();
xml->get_widget("canvas_menu", _menu);
@@ -590,7 +592,7 @@ PatchCanvas::paste()
ClashAvoider avoider(*App::instance().store().get(), _patch->path(), clipboard);
//parser->parse_string(App::instance().world(), &avoider, str, _patch->path().base());
parser->parse_string(App::instance().world(), &avoider, str, "/",
- boost::optional<Glib::ustring>(), _patch->path());
+ boost::optional<Glib::ustring>(), (Glib::ustring)_patch->path());
for (Store::iterator i = clipboard.begin(); i != clipboard.end(); ++i) {
if (_patch->path() == "/" && i->first == "/") {
@@ -616,9 +618,13 @@ PatchCanvas::paste()
builder.build(_patch->path(), i->second);
}
+ //avoider.set_target(*App::instance().engine());
+
for (ClientStore::ConnectionRecords::const_iterator i = clipboard.connection_records().begin();
- i != clipboard.connection_records().end(); ++i)
+ i != clipboard.connection_records().end(); ++i) {
+ cout << "CONNECTING " << i->first << " -> " << i->second << endl;
App::instance().engine()->connect(i->first, i->second);
+ }
}
diff --git a/src/libs/gui/ThreadedLoader.cpp b/src/libs/gui/ThreadedLoader.cpp
index 88dd4b1a..86c4ea1c 100644
--- a/src/libs/gui/ThreadedLoader.cpp
+++ b/src/libs/gui/ThreadedLoader.cpp
@@ -100,13 +100,27 @@ ThreadedLoader::load_patch(bool merge,
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();
+ }
+
+ cout << "ENGINE BASE 1: " << engine_base << endl;
+ if (merge && engine_parent.get() == "/" || !engine_parent)
+ engine_base = engine_base.substr(0, engine_base.find_last_of("/"));
+
+ cout << "ENGINE BASE: " << engine_base << endl;
+ cout << "PARENT: " << (engine_parent ? (string)engine_parent.get() : "NONE") << endl;
_events.push_back(sigc::hide_return(sigc::bind(
sigc::mem_fun(_parser.get(), &Ingen::Serialisation::Parser::parse_document),
App::instance().world(),
App::instance().world()->engine.get(),
data_base_uri, // document
- data_base_uri, // patch (root of document)
- engine_parent,
+ data_base_uri + data_path.substr(1), // object URI document
+ engine_base,
engine_symbol,
engine_data)));
}
diff --git a/src/libs/serialisation/Parser.cpp b/src/libs/serialisation/Parser.cpp
index 6d90499a..0e83b858 100644
--- a/src/libs/serialisation/Parser.cpp
+++ b/src/libs/serialisation/Parser.cpp
@@ -63,7 +63,7 @@ Parser::parse_document(
Ingen::Shared::CommonInterface* target,
const Glib::ustring& document_uri,
Glib::ustring object_uri,
- boost::optional<Raul::Path> parent,
+ boost::optional<Glib::ustring> engine_base,
boost::optional<Raul::Symbol> symbol,
boost::optional<GraphObject::Variables> data)
{
@@ -74,7 +74,7 @@ Parser::parse_document(
else
cout << "Parsing " << object_uri << " from " << document_uri << endl;
- return parse(world, target, model, document_uri, object_uri, parent, symbol, data);;
+ return parse(world, target, model, document_uri, object_uri, engine_base, symbol, data);;
}
@@ -85,7 +85,7 @@ Parser::parse_string(
const Glib::ustring& str,
const Glib::ustring& base_uri,
boost::optional<Glib::ustring> object_uri,
- boost::optional<Raul::Path> parent,
+ boost::optional<Glib::ustring> engine_base,
boost::optional<Raul::Symbol> symbol,
boost::optional<GraphObject::Variables> data)
{
@@ -96,10 +96,10 @@ Parser::parse_string(
else
cout << "Parsing all objects found in string (base " << base_uri << ")" << endl;
- bool ret = parse(world, target, model, base_uri, object_uri, parent, symbol, data);
+ bool ret = parse(world, target, model, base_uri, object_uri, engine_base, symbol, data);
if (ret) {
const Glib::ustring subject = Glib::ustring("<") + base_uri + Glib::ustring(">");
- parse_connections(world, target, model, base_uri, subject, parent ? parent.get() : "/");
+ parse_connections(world, target, model, base_uri, subject, (engine_base ? (string)engine_base.get() : "/"));
}
return ret;
@@ -113,7 +113,7 @@ Parser::parse(
Redland::Model& model,
Glib::ustring base_uri,
boost::optional<Glib::ustring> object_uri,
- boost::optional<Raul::Path> parent,
+ boost::optional<Glib::ustring> engine_base,
boost::optional<Raul::Symbol> symbol,
boost::optional<GraphObject::Variables> data)
{
@@ -164,7 +164,7 @@ Parser::parse(
continue;
if (rdf_class == patch_class) {
- ret = parse_patch(world, target, model, base_uri, subject.to_c_string(), path, data);
+ ret = parse_patch(world, target, model, base_uri, subject.to_c_string(), engine_base.get(), data);
if (ret)
target->set_variable(path, "ingen:document", Atom(base_uri.c_str()));
} else if (rdf_class == node_class) {
@@ -193,12 +193,14 @@ Parser::parse_patch(
Redland::Model& model,
const Glib::ustring& base_uri,
const Glib::ustring& object_uri,
- Raul::Path patch_path,
+ Glib::ustring engine_base,
boost::optional<GraphObject::Variables> data=boost::optional<GraphObject::Variables>())
{
std::set<Path> created;
uint32_t patch_poly = 0;
+ cout << "PARSE PATCH: " << base_uri << " - " << object_uri << " - " << engine_base << endl;
+
/* Use parameter overridden polyphony, if given */
if (data) {
GraphObject::Variables::iterator poly_param = data.get().find("ingen:polyphony");
@@ -226,7 +228,23 @@ Parser::parse_patch(
patch_poly = static_cast<uint32_t>(poly_node.to_int());
}
- if (patch_path != "/")
+ cout << "XXXXXXXXXX " << engine_base << endl;
+ cout << "YYYYYYYYYY " << uri_relative_to_base(base_uri, object_uri) << endl;
+ string symbol = uri_relative_to_base(base_uri, object_uri);
+ symbol = symbol.substr(0, symbol.find("."));
+ cout << "SSSSSSSSSS " << symbol << endl;
+ cout << "BBBBBBBBBBB " << engine_base << endl;
+ Path patch_path("/");
+ if (engine_base == "")
+ patch_path = "/";
+ else if (engine_base[engine_base.length()-1] == '/')
+ patch_path = Path(engine_base + symbol);
+ else
+ patch_path = (Path)engine_base;
+
+ cout << "!!!!!!!!!!!!!!!!!!! PATCH PATH: " << patch_path << endl;
+
+ if (patch_path != engine_base && patch_path != "/")
target->new_patch(patch_path, patch_poly);
/* Plugin nodes */
@@ -391,7 +409,7 @@ Parser::parse_node(
Redland::Model& model,
const Glib::ustring& base_uri,
const Glib::ustring& subject,
- Raul::Path path,
+ const Raul::Path& path,
boost::optional<GraphObject::Variables> data=boost::optional<GraphObject::Variables>())
{
/* Get plugin */
@@ -425,7 +443,7 @@ Parser::parse_port(
Redland::Model& model,
const Glib::ustring& base_uri,
const Glib::ustring& subject,
- Raul::Path path,
+ const Raul::Path& path,
boost::optional<GraphObject::Variables> data)
{
Redland::Query query(*world->rdf_world, Glib::ustring(
@@ -501,7 +519,7 @@ Parser::parse_variables(
Redland::Model& model,
const Glib::ustring& base_uri,
const Glib::ustring& subject,
- Raul::Path path,
+ const Raul::Path& path,
boost::optional<GraphObject::Variables> data=boost::optional<GraphObject::Variables>())
{
Redland::Query query(*world->rdf_world, Glib::ustring(
diff --git a/src/libs/serialisation/Parser.hpp b/src/libs/serialisation/Parser.hpp
index fd5fdece..2e088f51 100644
--- a/src/libs/serialisation/Parser.hpp
+++ b/src/libs/serialisation/Parser.hpp
@@ -45,7 +45,7 @@ public:
Shared::CommonInterface* target,
const Glib::ustring& document_uri,
Glib::ustring object_uri,
- boost::optional<Raul::Path> parent=boost::optional<Raul::Path>(),
+ boost::optional<Glib::ustring> engine_base=boost::optional<Glib::ustring>(),
boost::optional<Raul::Symbol> symbol=boost::optional<Raul::Symbol>(),
boost::optional<GraphObject::Variables> data=boost::optional<GraphObject::Variables>());
@@ -55,7 +55,7 @@ public:
const Glib::ustring& str,
const Glib::ustring& base_uri,
boost::optional<Glib::ustring> object_uri=boost::optional<Glib::ustring>(),
- boost::optional<Raul::Path> parent=boost::optional<Raul::Path>(),
+ boost::optional<Glib::ustring> engine_base=boost::optional<Glib::ustring>(),
boost::optional<Raul::Symbol> symbol=boost::optional<Raul::Symbol>(),
boost::optional<GraphObject::Variables> data=boost::optional<GraphObject::Variables>());
@@ -69,7 +69,7 @@ private:
Redland::Model& model,
Glib::ustring base_uri,
boost::optional<Glib::ustring> object_uri=boost::optional<Glib::ustring>(),
- boost::optional<Raul::Path> parent=boost::optional<Raul::Path>(),
+ boost::optional<Glib::ustring> engine_base=boost::optional<Glib::ustring>(),
boost::optional<Raul::Symbol> symbol=boost::optional<Raul::Symbol>(),
boost::optional<GraphObject::Variables> data=boost::optional<GraphObject::Variables>());
@@ -79,7 +79,7 @@ private:
Redland::Model& model,
const Glib::ustring& base_uri,
const Glib::ustring& object_uri,
- Raul::Path path,
+ Glib::ustring engine_base,
boost::optional<GraphObject::Variables> data);
bool parse_node(
@@ -88,7 +88,7 @@ private:
Redland::Model& model,
const Glib::ustring& base_uri,
const Glib::ustring& subject,
- Raul::Path path,
+ const Raul::Path& path,
boost::optional<GraphObject::Variables> data);
bool parse_port(
@@ -97,7 +97,7 @@ private:
Redland::Model& model,
const Glib::ustring& base_uri,
const Glib::ustring& subject,
- Raul::Path path,
+ const Raul::Path& path,
boost::optional<GraphObject::Variables> data=boost::optional<GraphObject::Variables>());
bool parse_variables(
@@ -106,7 +106,7 @@ private:
Redland::Model& model,
const Glib::ustring& base_uri,
const Glib::ustring& subject,
- Raul::Path path,
+ const Raul::Path& path,
boost::optional<GraphObject::Variables> data);
bool parse_connections(
diff --git a/src/libs/shared/Builder.cpp b/src/libs/shared/Builder.cpp
index 7065e0b4..1eb127a5 100644
--- a/src/libs/shared/Builder.cpp
+++ b/src/libs/shared/Builder.cpp
@@ -41,7 +41,7 @@ Builder::build(const Raul::Path& prefix, SharedPtr<const GraphObject> object)
SharedPtr<const Patch> patch = PtrCast<const Patch>(object);
if (patch) {
if (object->path() != "/") {
- const std::string path_str = prefix + object->path();
+ const std::string path_str = prefix.base() + object->path().substr(1);
//cout << "BUILDING PATCH " << path_str << endl;
_interface.new_patch(path_str, patch->internal_polyphony());
}
@@ -49,8 +49,10 @@ Builder::build(const Raul::Path& prefix, SharedPtr<const GraphObject> object)
build_object(prefix, object);
for (Patch::Connections::const_iterator i = patch->connections().begin();
i != patch->connections().end(); ++i) {
- _interface.connect(prefix.base() + (*i)->src_port_path().substr(1),
- prefix.base() + (*i)->dst_port_path().substr(1));
+ string base = prefix.base() + object->path().substr(1);
+ cout << "*********** BASE: " << base << endl;
+ _interface.connect(base + (*i)->src_port_path().substr(1),
+ base + (*i)->dst_port_path().substr(1));
}
return;
}
diff --git a/src/libs/shared/ClashAvoider.cpp b/src/libs/shared/ClashAvoider.cpp
index 75f46bf6..c3078468 100644
--- a/src/libs/shared/ClashAvoider.cpp
+++ b/src/libs/shared/ClashAvoider.cpp
@@ -25,9 +25,11 @@ namespace Ingen {
namespace Shared {
-const Raul::Path&
+const Raul::Path
ClashAvoider::map_path(const Raul::Path& in)
{
+ cout << "MAP PATH: " << in << endl;
+
unsigned offset = 0;
bool has_offset = false;
size_t pos = in.find_last_of("_");
@@ -56,10 +58,16 @@ ClashAvoider::map_path(const Raul::Path& in)
if (p != _symbol_map.end()) {
const Path mapped = p->second.base() + in.substr(parent.base().length());
InsertRecord i = _symbol_map.insert(make_pair(in, mapped));
- return i.first->second;
+ return _prefix.base() + i.first->second.substr(1);
}
+ parent = parent.parent();
} while (parent != "/");
+ cout << "????????????????????????????????? " << in << endl;
+
+ if (in.parent() != "/")
+ cout << "!!!!!!!!!!!!!!!!!!!!!! NOT ROOT PARENT " << endl;
+
// Append _2 _3 etc until an unused symbol is found
string base_name = in.name();
if (has_offset)
@@ -70,10 +78,12 @@ ClashAvoider::map_path(const Raul::Path& in)
if (o != _offsets.end()) {
offset = ++o->second;
} else {
- offset = _store.child_name_offset(
- _prefix.base() + in.parent().base().substr(1),
- base_name,
- false);
+ string parent_str = _prefix.base() + in.parent().base().substr(1);
+ parent_str = parent_str.substr(0, parent_str.find_last_of("/"));
+ if (parent_str == "")
+ parent_str = "/";
+ cout << "***** PARENT: " << parent_str << endl;
+ offset = _store.child_name_offset(parent_str, base_name, false);
_offsets.insert(make_pair(base_name, offset));
}
@@ -81,7 +91,9 @@ ClashAvoider::map_path(const Raul::Path& in)
std::stringstream ss;
ss << in.parent().base() << base_name << "_" << offset;
if (_store.find(ss.str()) == _store.end()) {
- InsertRecord i = _symbol_map.insert(make_pair(in, ss.str()));
+ string str = _prefix.base() + ss.str().substr(1);
+ InsertRecord i = _symbol_map.insert(make_pair(in, str));
+ cout << "HIT: offset = " << offset << ", str = " << str << endl;
return i.first->second;
} else {
cout << "MISSED OFFSET: " << in << " => " << ss.str() << endl;
diff --git a/src/libs/shared/ClashAvoider.hpp b/src/libs/shared/ClashAvoider.hpp
index f70e839a..3c8a1c9f 100644
--- a/src/libs/shared/ClashAvoider.hpp
+++ b/src/libs/shared/ClashAvoider.hpp
@@ -39,6 +39,8 @@ class ClashAvoider : public CommonInterface
public:
ClashAvoider(Store& store, const Raul::Path& prefix, CommonInterface& target)
: _prefix(prefix), _store(store), _target(target) {}
+
+ void set_target(CommonInterface& target) { _target = target; }
// Bundles
void bundle_begin() { _target.bundle_begin(); }
@@ -79,7 +81,7 @@ public:
const Raul::Atom& value);
private:
- const Raul::Path& map_path(const Raul::Path& in);
+ const Raul::Path map_path(const Raul::Path& in);
const Raul::Path& _prefix;
Store& _store;
diff --git a/src/progs/ingen/main.cpp b/src/progs/ingen/main.cpp
index bf01686a..12257021 100644
--- a/src/progs/ingen/main.cpp
+++ b/src/progs/ingen/main.cpp
@@ -156,9 +156,9 @@ main(int argc, char** argv)
/* Load a patch */
if (args.load_given && engine_interface) {
- boost::optional<Raul::Path> parent_path;
+ boost::optional<Glib::ustring> engine_base;
if (args.path_given)
- parent_path = args.path_arg;
+ engine_base = string(args.path_arg) + "/";
bool found = false;
if (!world->serialisation_module)
@@ -184,7 +184,7 @@ main(int argc, char** argv)
engine_interface->load_plugins();
- parser->parse_document(world, engine_interface.get(), uri, uri, parent_path);
+ parser->parse_document(world, engine_interface.get(), uri, uri, engine_base);
} else {
cerr << "Unable to load serialisation module, aborting." << endl;