diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/client/DeprecatedLoader.cpp | 18 | ||||
-rw-r--r-- | src/libs/client/DeprecatedLoader.h | 13 | ||||
-rw-r--r-- | src/libs/client/Loader.cpp | 18 | ||||
-rw-r--r-- | src/libs/client/Loader.h | 11 | ||||
-rw-r--r-- | src/progs/ingenuity/LoadPatchWindow.cpp | 13 | ||||
-rw-r--r-- | src/progs/ingenuity/LoadSubpatchWindow.cpp | 6 | ||||
-rw-r--r-- | src/progs/ingenuity/PatchCanvas.cpp | 2 | ||||
-rw-r--r-- | src/progs/ingenuity/PatchWindow.cpp | 4 | ||||
-rw-r--r-- | src/progs/ingenuity/ThreadedLoader.cpp | 2 | ||||
-rw-r--r-- | src/progs/ingenuity/ThreadedLoader.h | 2 | ||||
-rw-r--r-- | src/progs/patch_loader/patch_loader.cpp | 2 |
11 files changed, 52 insertions, 39 deletions
diff --git a/src/libs/client/DeprecatedLoader.cpp b/src/libs/client/DeprecatedLoader.cpp index baa03c93..bb0096e1 100644 --- a/src/libs/client/DeprecatedLoader.cpp +++ b/src/libs/client/DeprecatedLoader.cpp @@ -168,12 +168,12 @@ DeprecatedLoader::add_metadata(MetadataMap& data, string old_key, string value) * Returns the path of the newly created patch. */ string -DeprecatedLoader::load_patch(const Glib::ustring& filename, - const Path& parent_path, - string name, - size_t poly, - MetadataMap initial_data, - bool existing) +DeprecatedLoader::load_patch(const Glib::ustring& filename, + boost::optional<Path> parent_path, + string name, + size_t poly, + MetadataMap initial_data, + bool existing) { cerr << "[DeprecatedLoader] Loading patch " << filename << "" << endl; @@ -216,8 +216,10 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, if ((!xmlStrcmp(cur->name, (const xmlChar*)"name"))) { if (load_name) { assert(key != NULL); - if (parent_path != "") - path = Path(parent_path).base() + Path::nameify((char*)key); + if (parent_path) + path = Path(parent_path.get()).base() + Path::nameify((char*)key); + else + path = Path("/") + Path::nameify((char*)key); } } else if ((!xmlStrcmp(cur->name, (const xmlChar*)"polyphony"))) { if (load_poly) { diff --git a/src/libs/client/DeprecatedLoader.h b/src/libs/client/DeprecatedLoader.h index 3b3b34f0..aa9557f5 100644 --- a/src/libs/client/DeprecatedLoader.h +++ b/src/libs/client/DeprecatedLoader.h @@ -22,6 +22,7 @@ #include <utility> #include <string> #include <cassert> +#include <boost/optional.hpp> #include <glibmm/ustring.h> #include <libxml/tree.h> #include "raul/SharedPtr.h" @@ -58,12 +59,12 @@ public: string find_file(const string& filename, const string& additional_path = ""); - string load_patch(const Glib::ustring& filename, - const Path& parent_path, - string name, - size_t poly, - MetadataMap initial_data, - bool existing = false); + string load_patch(const Glib::ustring& filename, + boost::optional<Path> parent_path, + string name, + size_t poly, + MetadataMap initial_data, + bool existing = false); private: void add_metadata(MetadataMap& data, string key, string value); diff --git a/src/libs/client/Loader.cpp b/src/libs/client/Loader.cpp index 95c29933..70ef0820 100644 --- a/src/libs/client/Loader.cpp +++ b/src/libs/client/Loader.cpp @@ -37,7 +37,7 @@ Loader::Loader(SharedPtr<ModelEngineInterface> engine, SharedPtr<Namespaces> nam (*_namespaces)["xsd"] = "http://www.w3.org/2001/XMLSchema#"; (*_namespaces)["ingen"] = "http://drobilla.net/ns/ingen#"; (*_namespaces)["ingenuity"] = "http://drobilla.net/ns/ingenuity#"; - (*_namespaces)["lv2"] = "http://lv2plug.in/ontology#>"; + (*_namespaces)["lv2"] = "http://lv2plug.in/ontology#"; } @@ -48,11 +48,11 @@ Loader::Loader(SharedPtr<ModelEngineInterface> engine, SharedPtr<Namespaces> nam * @return whether or not load was successful. */ bool -Loader::load(const Glib::ustring& filename, - const Path& parent, - string patch_name, - Glib::ustring patch_uri, - MetadataMap data) +Loader::load(const Glib::ustring& filename, + boost::optional<Path> parent, + string patch_name, + Glib::ustring patch_uri, + MetadataMap data) { // FIXME: this whole thing is a mess @@ -73,7 +73,7 @@ Loader::load(const Glib::ustring& filename, // FIXME: polyphony datatype RDFQuery query(*_namespaces, Glib::ustring( - "SELECT DISTINCT ?poly \nFROM <") + document_uri + ">\nWHERE {\n\t" + + "SELECT DISTINCT ?poly FROM <") + document_uri + "> WHERE {\n" + patch_uri + " ingen:polyphony ?poly .\n" "}"); @@ -91,6 +91,8 @@ Loader::load(const Glib::ustring& filename, if (patch_name == "") { patch_name = string(filename.substr(filename.find_last_of("/")+1)); + if (patch_name.substr(patch_name.length()-6) == ".ingen") + patch_name = patch_name.substr(0, patch_name.length()-6); query = RDFQuery(*_namespaces, Glib::ustring( "SELECT DISTINCT ?name FROM <") + document_uri + "> WHERE {\n" + @@ -103,7 +105,7 @@ Loader::load(const Glib::ustring& filename, patch_name = string((*results.begin())["name"]); } - Path patch_path = parent.base() + patch_name; + Path patch_path = ( parent ? (parent.get().base() + patch_name) : Path("/") ); cerr << "************ PATCH: " << patch_path << ", poly = " << patch_poly << endl; _engine->create_patch(patch_path, patch_poly); diff --git a/src/libs/client/Loader.h b/src/libs/client/Loader.h index fdca9d4f..9afbace6 100644 --- a/src/libs/client/Loader.h +++ b/src/libs/client/Loader.h @@ -18,6 +18,7 @@ #ifndef LOADER_H #define LOADER_H +#include <boost/optional.hpp> #include <glibmm/ustring.h> #include "raul/SharedPtr.h" #include "raul/Path.h" @@ -38,11 +39,11 @@ class Loader { public: Loader(SharedPtr<ModelEngineInterface> engine, SharedPtr<Namespaces> = SharedPtr<Namespaces>()); - bool load(const Glib::ustring& filename, - const Path& parent, - string patch_name, - Glib::ustring patch_uri = "", - MetadataMap initial_data = MetadataMap()); + bool load(const Glib::ustring& filename, + boost::optional<Path> parent, + string patch_name, + Glib::ustring patch_uri = "", + MetadataMap initial_data = MetadataMap()); private: //string _patch_search_path; diff --git a/src/progs/ingenuity/LoadPatchWindow.cpp b/src/progs/ingenuity/LoadPatchWindow.cpp index 0fed5cb9..783c6397 100644 --- a/src/progs/ingenuity/LoadPatchWindow.cpp +++ b/src/progs/ingenuity/LoadPatchWindow.cpp @@ -51,9 +51,9 @@ LoadPatchWindow::LoadPatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gno Gtk::FileFilter filt; filt.add_pattern("*.om"); - filt.set_name("Om patch files (DEPRECATED) (*.om)"); - filt.add_pattern("*.ingen.ttl"); - filt.set_name("Ingen patch files (*.ingen.ttl)"); + filt.set_name("Om patch files (XML, DEPRECATED) (*.om)"); + filt.add_pattern("*.ingen"); + filt.set_name("Ingen patch files (RDF, *.ingen)"); set_filter(filt); // Add global examples directory to "shortcut folders" (bookmarks) @@ -118,14 +118,19 @@ LoadPatchWindow::ok_clicked() optional<const string&> name; optional<size_t> poly; + optional<Path> parent; + if (_poly_from_user_radio->get_active()) poly = _poly_spinbutton->get_value_as_int(); if (_replace) App::instance().engine()->clear_patch(_patch->path()); + if (_patch->path() != "/") + parent = _patch->path().parent(); + App::instance().loader()->load_patch(true, get_filename(), "/", - _initial_data, _patch->parent()->path(), name, poly); + _initial_data, parent, name, poly); hide(); } diff --git a/src/progs/ingenuity/LoadSubpatchWindow.cpp b/src/progs/ingenuity/LoadSubpatchWindow.cpp index c3617cc9..7d3a252c 100644 --- a/src/progs/ingenuity/LoadSubpatchWindow.cpp +++ b/src/progs/ingenuity/LoadSubpatchWindow.cpp @@ -55,9 +55,9 @@ LoadSubpatchWindow::LoadSubpatchWindow(BaseObjectType* cobject, const Glib::RefP Gtk::FileFilter filt; filt.add_pattern("*.om"); - filt.set_name("Om patch files (DEPRECATED) (*.om)"); - filt.add_pattern("*.ingen.ttl"); - filt.set_name("Ingen patch files (*.ingen.ttl)"); + filt.set_name("Om patch files (XML, DEPRECATED) (*.om)"); + filt.add_pattern("*.ingen"); + filt.set_name("Ingen patch files (RDF, *.ingen)"); set_filter(filt); // Add global examples directory to "shortcut folders" (bookmarks) diff --git a/src/progs/ingenuity/PatchCanvas.cpp b/src/progs/ingenuity/PatchCanvas.cpp index 0835bb97..d90c1c1c 100644 --- a/src/progs/ingenuity/PatchCanvas.cpp +++ b/src/progs/ingenuity/PatchCanvas.cpp @@ -133,6 +133,7 @@ PatchCanvas::add_node(SharedPtr<NodeModel> nm) module = NodeModule::create(shared_this, nm); add_item(module); + module->show(); _views.insert(std::make_pair(nm, module)); } @@ -158,6 +159,7 @@ PatchCanvas::add_port(SharedPtr<PortModel> pm) SharedPtr<PatchPortModule> view = PatchPortModule::create(shared_this, pm); _views.insert(std::make_pair(pm, view)); add_item(view); + view->show(); } diff --git a/src/progs/ingenuity/PatchWindow.cpp b/src/progs/ingenuity/PatchWindow.cpp index 556b690d..7556689b 100644 --- a/src/progs/ingenuity/PatchWindow.cpp +++ b/src/progs/ingenuity/PatchWindow.cpp @@ -281,8 +281,8 @@ PatchWindow::event_save_as() if (result == Gtk::RESPONSE_OK) { string filename = dialog.get_filename(); - if (filename.length() < 11 || filename.substr(filename.length()-10) != ".ingen.ttl") - filename += ".ingen.ttl"; + if (filename.length() < 7 || filename.substr(filename.length()-6) != ".ingen") + filename += ".ingen"; bool confirm = false; std::fstream fin; diff --git a/src/progs/ingenuity/ThreadedLoader.cpp b/src/progs/ingenuity/ThreadedLoader.cpp index 7544d3fd..0ba2bb33 100644 --- a/src/progs/ingenuity/ThreadedLoader.cpp +++ b/src/progs/ingenuity/ThreadedLoader.cpp @@ -58,7 +58,7 @@ ThreadedLoader::load_patch(bool merge, const string& data_base_uri, const Path& data_path, MetadataMap engine_data, - const Path& engine_parent, + optional<Path> engine_parent, optional<const string&> engine_name, optional<size_t> engine_poly) { diff --git a/src/progs/ingenuity/ThreadedLoader.h b/src/progs/ingenuity/ThreadedLoader.h index 54cb7833..4cab4acb 100644 --- a/src/progs/ingenuity/ThreadedLoader.h +++ b/src/progs/ingenuity/ThreadedLoader.h @@ -67,7 +67,7 @@ public: const string& data_base_uri, const Path& data_path, MetadataMap engine_data, - const Path& engine_parent, + optional<Path> engine_parent, optional<const string&> engine_name = optional<const string&>(), optional<size_t> engine_poly = optional<size_t>()); diff --git a/src/progs/patch_loader/patch_loader.cpp b/src/progs/patch_loader/patch_loader.cpp index d5243339..d25ac24f 100644 --- a/src/progs/patch_loader/patch_loader.cpp +++ b/src/progs/patch_loader/patch_loader.cpp @@ -73,7 +73,7 @@ int main(int argc, char** argv) for (uint i=0; i < args_info.inputs_num; ++i) { cerr << "FIXME: load patch under root" << endl; cerr << "Load " << args_info.inputs[i] << endl; - loader.load(args_info.inputs[i], "/", ""); + loader.load(args_info.inputs[i], Path("/"), ""); } return 0; |