diff options
-rw-r--r-- | src/gui/PatchCanvas.cpp | 32 | ||||
-rw-r--r-- | src/serialisation/Parser.cpp | 7 | ||||
-rw-r--r-- | src/serialisation/Serialiser.cpp | 6 | ||||
-rw-r--r-- | src/shared/ClashAvoider.cpp | 6 |
4 files changed, 26 insertions, 25 deletions
diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index ce8c0892..52702b30 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -628,8 +628,9 @@ PatchCanvas::select_all() void PatchCanvas::copy_selection() { + static const char* base_uri = ""; Serialiser serialiser(*App::instance().world(), App::instance().store()); - serialiser.start_to_string(_patch->path(), "http://example.org/"); + serialiser.start_to_string(_patch->path(), base_uri); for (list<boost::shared_ptr<Item> >::iterator m = _selected_items.begin(); m != _selected_items.end(); ++m) { boost::shared_ptr<NodeModule> module = boost::dynamic_pointer_cast<NodeModule>(*m); @@ -646,7 +647,8 @@ PatchCanvas::copy_selection() c != _selected_connections.end(); ++c) { boost::shared_ptr<Connection> connection = boost::dynamic_pointer_cast<Connection>(*c); if (connection) { - Sord::URI subject(*App::instance().world()->rdf_world(), _patch->path().str()); + const Sord::URI subject(*App::instance().world()->rdf_world(), + base_uri); serialiser.serialise_connection(subject, connection->model()); } } @@ -706,25 +708,26 @@ PatchCanvas::paste() } ClashAvoider avoider(*App::instance().store().get(), clipboard, &clipboard); - parser->parse_string(App::instance().world(), &avoider, str, Path().str(), - parent, symbol); + parser->parse_string(App::instance().world(), &avoider, str, "", + parent, symbol); for (Store::iterator i = clipboard.begin(); i != clipboard.end(); ++i) { if (_patch->path().is_root() && i->first.is_root()) continue; - GraphObject::Properties::iterator x = i->second->properties().find(uris.ingenui_canvas_x); + + GraphObject::Properties& props = i->second->properties(); + + GraphObject::Properties::iterator x = props.find(uris.ingenui_canvas_x); if (x != i->second->properties().end()) x->second = x->second.get_float() + (20.0f * _paste_count); - GraphObject::Properties::iterator y = i->second->properties().find(uris.ingenui_canvas_y); + + GraphObject::Properties::iterator y = props.find(uris.ingenui_canvas_y); if (y != i->second->properties().end()) y->second = y->second.get_float() + (20.0f * _paste_count); - if (i->first.parent().is_root()) { - GraphObject::Properties::iterator s = i->second->properties().find(uris.ingen_selected); - if (s != i->second->properties().end()) - s->second = true; - else - i->second->properties().insert(make_pair(uris.ingen_selected, true)); - } + + if (i->first.parent().is_root()) + i->second->set_property(uris.ingen_selected, true); + builder.build(i->second); } @@ -733,7 +736,8 @@ PatchCanvas::paste() assert(root); for (Patch::Connections::const_iterator i = root->connections().begin(); i != root->connections().end(); ++i) { - App::instance().engine()->connect(i->second->src_port_path(), i->second->dst_port_path()); + App::instance().engine()->connect(i->second->src_port_path(), + i->second->dst_port_path()); } } diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index cc9312a3..4d561721 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -238,8 +238,6 @@ Parser::parse(Ingen::Shared::World* world, subject = model.base_uri(); } else if (data_path) { subject = Sord::URI(*world->rdf_world(), data_path->chop_start("/")); - } else { - subject = nil; } Raul::Path path("/"); @@ -275,7 +273,9 @@ Parser::parse(Ingen::Shared::World* world, if (types.find(patch_class) != types.end()) { ret = parse_patch(world, target, model, subject, parent, symbol, data); } else if (types.find(node_class) != types.end()) { - ret = parse_node(world, target, model, subject, path, data); + ret = parse_node(world, target, model, + subject, path.child(subject.to_string()), + data); } else if (types.find(port_class) != types.end()) { parse_properties(world, target, model, subject, path, data); ret = path; @@ -461,7 +461,6 @@ Parser::parse_patch(Ingen::Shared::World* world, target->put(i->second.first, i->second.second); } - //parse_properties(world, target, model, subject_node, patch_path, data); parse_connections(world, target, model, subject_node, patch_path); return patch_path; diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index 0629a97c..7da2048c 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -252,11 +252,7 @@ Serialiser::finish() if (_mode == TO_FILE) { _model->write_to_file(_base_uri, "turtle"); } else { - char* c_str = _model->write_to_string("turtle"); - if (c_str != NULL) { - ret = c_str; - free(c_str); - } + ret = _model->write_to_string("turtle"); } delete _model; diff --git a/src/shared/ClashAvoider.cpp b/src/shared/ClashAvoider.cpp index 36244303..9009fe96 100644 --- a/src/shared/ClashAvoider.cpp +++ b/src/shared/ClashAvoider.cpp @@ -108,7 +108,9 @@ ClashAvoider::map_path(const Raul::Path& in) std::stringstream ss; ss << base_path << "_" << offset; if (!exists(ss.str())) { - const string name = (base_path.length() > 1) ? base_path.symbol() : "_"; + string name = base_path.symbol(); + if (name == "") + name = "_"; string str = ss.str(); InsertRecord i = _symbol_map.insert(make_pair(in, str)); debug << "HIT: offset = " << offset << ", str = " << str << endl; @@ -148,7 +150,7 @@ ClashAvoider::put(const Raul::URI& path, const Shared::Resource::Properties& properties, Resource::Graph ctx) { - _target.put(map_uri(path), properties); + _target.put(map_uri(path), properties, ctx); } |