From 6b18de71d1c603255b263a64434005306f152f13 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 19 Feb 2011 05:10:29 +0000 Subject: Save/load patches as nested bundles (fix ticket #520). Sane (context-based, ala RDF quads) approach to the problem of externally visible / internally visible properties. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2993 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/NewSubpatchWindow.cpp | 9 ++++++--- src/gui/NodeModule.cpp | 4 +--- src/gui/PatchCanvas.cpp | 6 ++++-- src/gui/PatchPortModule.cpp | 6 +----- src/gui/PatchView.cpp | 4 ---- src/gui/PortPropertiesWindow.cpp | 2 +- 6 files changed, 13 insertions(+), 18 deletions(-) (limited to 'src/gui') diff --git a/src/gui/NewSubpatchWindow.cpp b/src/gui/NewSubpatchWindow.cpp index 44fb54b0..13ea0c47 100644 --- a/src/gui/NewSubpatchWindow.cpp +++ b/src/gui/NewSubpatchWindow.cpp @@ -96,14 +96,17 @@ NewSubpatchWindow::ok_clicked() const Path path = _patch->path().base() + Path::nameify(_name_entry->get_text()); const uint32_t poly = _poly_spinbutton->get_value_as_int(); + // Create patch Resource::Properties props; props.insert(make_pair(app.uris().rdf_type, app.uris().ingen_Patch)); props.insert(make_pair(app.uris().ingen_polyphony, Atom(int32_t(poly)))); - app.engine()->put(ResourceImpl::meta_uri(path), props); + props.insert(make_pair(app.uris().ingen_enabled, Atom(bool(true)))); + app.engine()->put(path, props, Resource::INTERNAL); + // Set external (node perspective) properties props = _initial_data; - props.insert(make_pair(app.uris().ingen_enabled, bool(true))); - app.engine()->put(path, props); + props.insert(make_pair(app.uris().rdf_type, app.uris().ingen_Patch)); + app.engine()->put(path, _initial_data, Resource::EXTERNAL); hide(); } diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 44748aeb..52f14772 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -94,9 +94,6 @@ NodeModule::create(boost::shared_ptr canvas, SharedPtr n else ret = boost::shared_ptr(new NodeModule(canvas, node)); - for (GraphObject::Properties::const_iterator m = node->meta().properties().begin(); m != node->meta().properties().end(); ++m) - ret->property_changed(m->first, m->second); - for (GraphObject::Properties::const_iterator m = node->properties().begin(); m != node->properties().end(); ++m) ret->property_changed(m->first, m->second); @@ -392,6 +389,7 @@ NodeModule::store_location() add.insert(make_pair(uris.ingenui_canvas_x, Atom(x))); add.insert(make_pair(uris.ingenui_canvas_y, Atom(y))); App::instance().engine()->delta(_node->path(), remove, add); + // FIXME: context } } diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index 3ee6e3cb..ce8c0892 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -645,8 +645,10 @@ PatchCanvas::copy_selection() for (list >::iterator c = _selected_connections.begin(); c != _selected_connections.end(); ++c) { boost::shared_ptr connection = boost::dynamic_pointer_cast(*c); - if (connection) - serialiser.serialise_connection(_patch, connection->model()); + if (connection) { + Sord::URI subject(*App::instance().world()->rdf_world(), _patch->path().str()); + serialiser.serialise_connection(subject, connection->model()); + } } string result = serialiser.finish(); diff --git a/src/gui/PatchPortModule.cpp b/src/gui/PatchPortModule.cpp index cbfb6f03..b8e74a8f 100644 --- a/src/gui/PatchPortModule.cpp +++ b/src/gui/PatchPortModule.cpp @@ -64,10 +64,6 @@ PatchPortModule::create(boost::shared_ptr canvas, SharedPtrset_port(port); ret->set_menu(port->menu()); - for (GraphObject::Properties::const_iterator m = model->meta().properties().begin(); - m != model->meta().properties().end(); ++m) - ret->property_changed(m->first, m->second); - for (GraphObject::Properties::const_iterator m = model->properties().begin(); m != model->properties().end(); ++m) ret->property_changed(m->first, m->second); @@ -104,7 +100,7 @@ PatchPortModule::store_location() Shared::Resource::Properties props; props.insert(make_pair(uris.ingenui_canvas_x, Atom(x))); props.insert(make_pair(uris.ingenui_canvas_y, Atom(y))); - App::instance().engine()->put(_model->meta_uri(), props); + App::instance().engine()->put(_model->path(), props, Resource::INTERNAL); } } diff --git a/src/gui/PatchView.cpp b/src/gui/PatchView.cpp index 21717f55..1313f65e 100644 --- a/src/gui/PatchView.cpp +++ b/src/gui/PatchView.cpp @@ -77,10 +77,6 @@ PatchView::set_patch(SharedPtr patch) _poly_spin->set_value(patch->internal_poly()); - for (GraphObject::Properties::const_iterator i = patch->meta().properties().begin(); - i != patch->meta().properties().end(); ++i) - property_changed(i->first, i->second); - for (GraphObject::Properties::const_iterator i = patch->properties().begin(); i != patch->properties().end(); ++i) property_changed(i->first, i->second); diff --git a/src/gui/PortPropertiesWindow.cpp b/src/gui/PortPropertiesWindow.cpp index 7ba5ba28..5cfe33ef 100644 --- a/src/gui/PortPropertiesWindow.cpp +++ b/src/gui/PortPropertiesWindow.cpp @@ -157,7 +157,7 @@ PortPropertiesWindow::ok() Shared::Resource::Properties props; props.insert(make_pair(uris.lv2_minimum, float(_min_spinner->get_value()))); props.insert(make_pair(uris.lv2_maximum, float(_max_spinner->get_value()))); - App::instance().engine()->put(_port_model->meta().uri(), props); + App::instance().engine()->put(_port_model->path(), props); hide(); } -- cgit v1.2.1