summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-12-13 07:09:22 +0000
committerDavid Robillard <d@drobilla.net>2006-12-13 07:09:22 +0000
commite5c8e0d9752cfa6de4e6e0e8314ac572a9d113b1 (patch)
treeb5fe5c74ba99e604f7beca12617ff71b6c075ae1 /src
parentf4bec186d0dfe1e9f0a136c11a6ab0c5e1d74aa9 (diff)
downloadingen-e5c8e0d9752cfa6de4e6e0e8314ac572a9d113b1.tar.gz
ingen-e5c8e0d9752cfa6de4e6e0e8314ac572a9d113b1.tar.bz2
ingen-e5c8e0d9752cfa6de4e6e0e8314ac572a9d113b1.zip
Path parent/child bug fixes, added unit tests.
Breadcrumb/browsing/subsubpatch bug fixes. Fixed about window icon and glade error messages. git-svn-id: http://svn.drobilla.net/lad/ingen@223 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/libs/client/Loader.cpp28
-rw-r--r--src/libs/client/Loader.h1
-rw-r--r--src/progs/ingenuity/BreadCrumbBox.cpp49
-rw-r--r--src/progs/ingenuity/LoadSubpatchWindow.cpp2
-rw-r--r--src/progs/ingenuity/ThreadedLoader.cpp9
-rw-r--r--src/progs/ingenuity/ThreadedLoader.h2
-rw-r--r--src/progs/ingenuity/ingenuity.glade2
-rw-r--r--src/progs/patch_loader/patch_loader.cpp2
8 files changed, 57 insertions, 38 deletions
diff --git a/src/libs/client/Loader.cpp b/src/libs/client/Loader.cpp
index 68b04b58..af51d4c8 100644
--- a/src/libs/client/Loader.cpp
+++ b/src/libs/client/Loader.cpp
@@ -46,6 +46,7 @@ Loader::Loader(SharedPtr<ModelEngineInterface> engine, SharedPtr<Namespaces> nam
bool
Loader::load(const Glib::ustring& filename,
const Path& parent,
+ string patch_name,
Glib::ustring patch_uri,
MetadataMap data)
{
@@ -82,23 +83,24 @@ Loader::load(const Glib::ustring& filename,
size_t patch_poly = atoi(((*results.begin())["poly"]).c_str());
- /* Get name (if available) */
+ /* Get name (if available/necessary) */
- query = RDFQuery(Glib::ustring(
- "SELECT DISTINCT ?name \nFROM <") + document_uri + ">\nWHERE {\n\t" +
- patch_uri + " ingen:name ?name .\n"
- "}");
+ if (patch_name == "") {
+ patch_name = string(filename.substr(filename.find_last_of("/")+1));
+
+ query = RDFQuery(Glib::ustring(
+ "SELECT DISTINCT ?name FROM <") + document_uri + "> WHERE {\n" +
+ patch_uri + " ingen:name ?name .\n"
+ "}");
- results = query.run(document_uri);
-
- string patch_name = string(filename.substr(filename.find_last_of("/")+1));
- Path patch_path = parent.base() + string(filename.substr(filename.find_last_of("/")+1));
+ results = query.run(document_uri);
- if (results.size() > 0)
- patch_path = parent.base() + string((*results.begin())["name"]);
-
- cerr << "************ PATCH: " << patch_path << ", poly = " << patch_poly << endl;
+ if (results.size() > 0)
+ patch_name = string((*results.begin())["name"]);
+ }
+ Path patch_path = parent.base() + patch_name;
+ 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 86317c1f..bca385aa 100644
--- a/src/libs/client/Loader.h
+++ b/src/libs/client/Loader.h
@@ -37,6 +37,7 @@ public:
bool load(const Glib::ustring& filename,
const Path& parent,
+ string patch_name,
Glib::ustring patch_uri = "",
MetadataMap initial_data = MetadataMap());
diff --git a/src/progs/ingenuity/BreadCrumbBox.cpp b/src/progs/ingenuity/BreadCrumbBox.cpp
index 88772953..eca8a761 100644
--- a/src/progs/ingenuity/BreadCrumbBox.cpp
+++ b/src/progs/ingenuity/BreadCrumbBox.cpp
@@ -73,19 +73,21 @@ BreadCrumbBox::build(Path path, SharedPtr<PatchView> view)
// Moving to a child of the full path, just append crumbs (preserve view cache)
} else if (_breadcrumbs.size() > 0 && (path.is_child_of(_full_path))) {
- string postfix = path.substr(_full_path.length());
- while (postfix.length() > 0) {
- const string name = postfix.substr(0, postfix.find("/"));
- cerr << "NAME: " << name << endl;
+
+ string suffix = path.substr(_full_path.length());
+ while (suffix.length() > 0) {
+ if (suffix[0] == '/')
+ suffix = suffix.substr(1);
+ const string name = suffix.substr(0, suffix.find("/"));
_full_path = _full_path.base() + name;
BreadCrumb* but = create_crumb(_full_path, view);
- pack_end(*but, false, false, 1);
+ pack_start(*but, false, false, 1);
_breadcrumbs.push_back(but);
but->show();
- if (postfix.find("/") == string::npos)
+ if (suffix.find("/") == string::npos)
break;
else
- postfix = postfix.substr(postfix.find("/")+1);
+ suffix = suffix.substr(suffix.find("/")+1);
}
for (std::list<BreadCrumb*>::iterator i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i)
@@ -106,21 +108,30 @@ BreadCrumbBox::build(Path path, SharedPtr<PatchView> view)
_breadcrumbs.clear();
// Add root
- BreadCrumb* but = create_crumb("/", view);
- pack_start(*but, false, false, 1);
- _breadcrumbs.push_front(but);
- but->set_active(but->path() == _active_path);
-
- // Add the others
- while (path != "/") {
- BreadCrumb* but = create_crumb(path, view);
+ BreadCrumb* root_but = create_crumb("/", view);
+ pack_start(*root_but, false, false, 1);
+ _breadcrumbs.push_front(root_but);
+ root_but->set_active(root_but->path() == _active_path);
+
+ Path working_path = "/";
+ string suffix = path.substr(1);
+ while (suffix.length() > 0) {
+ if (suffix[0] == '/')
+ suffix = suffix.substr(1);
+ const string name = suffix.substr(0, suffix.find("/"));
+ working_path = working_path.base() + name;
+ BreadCrumb* but = create_crumb(working_path, view);
pack_start(*but, false, false, 1);
- _breadcrumbs.push_front(but);
- but->set_active(but->path() == _active_path);
- path = path.parent();
+ _breadcrumbs.push_back(but);
+ but->set_active(working_path == _active_path);
+ but->show();
+ if (suffix.find("/") == string::npos)
+ break;
+ else
+ suffix = suffix.substr(suffix.find("/")+1);
}
}
-
+
_enable_signal = old_enable_signal;
}
diff --git a/src/progs/ingenuity/LoadSubpatchWindow.cpp b/src/progs/ingenuity/LoadSubpatchWindow.cpp
index 92c8483c..9255bcf1 100644
--- a/src/progs/ingenuity/LoadSubpatchWindow.cpp
+++ b/src/progs/ingenuity/LoadSubpatchWindow.cpp
@@ -156,7 +156,7 @@ LoadSubpatchWindow::ok_clicked()
poly = m_patch->poly();
App::instance().loader()->load_patch(false, get_filename(), "/",
- m_initial_data, m_patch->parent()->path(), name, poly);
+ m_initial_data, m_patch->path(), name, poly);
hide();
}
diff --git a/src/progs/ingenuity/ThreadedLoader.cpp b/src/progs/ingenuity/ThreadedLoader.cpp
index a3920665..79cd8507 100644
--- a/src/progs/ingenuity/ThreadedLoader.cpp
+++ b/src/progs/ingenuity/ThreadedLoader.cpp
@@ -55,12 +55,13 @@ ThreadedLoader::_whipped()
_mutex.unlock();
}
+/** FIXME: most of these paramteres do nothing */
void
ThreadedLoader::load_patch(bool merge,
const string& data_base_uri,
const Path& data_path,
MetadataMap engine_data,
- optional<const Path&> engine_parent,
+ const Path& engine_parent,
optional<const string&> engine_name,
optional<size_t> engine_poly)
{
@@ -75,7 +76,11 @@ ThreadedLoader::load_patch(bool merge,
_events.push_back(sigc::hide_return(sigc::bind(
sigc::mem_fun(_loader, &Loader::load),
- data_base_uri, "/", "", engine_data)));
+ data_base_uri,
+ engine_parent,
+ (engine_name) ? engine_name.get() : "",
+ "",
+ engine_data )));
_mutex.unlock();
diff --git a/src/progs/ingenuity/ThreadedLoader.h b/src/progs/ingenuity/ThreadedLoader.h
index 9212c9c7..d5901a74 100644
--- a/src/progs/ingenuity/ThreadedLoader.h
+++ b/src/progs/ingenuity/ThreadedLoader.h
@@ -68,7 +68,7 @@ public:
const string& data_base_uri,
const Path& data_path,
MetadataMap engine_data,
- optional<const Path&> engine_parent = optional<const Path&>(),
+ const Path& engine_parent,
optional<const string&> engine_name = optional<const string&>(),
optional<size_t> engine_poly = optional<size_t>());
diff --git a/src/progs/ingenuity/ingenuity.glade b/src/progs/ingenuity/ingenuity.glade
index 54cfb402..7fef84d5 100644
--- a/src/progs/ingenuity/ingenuity.glade
+++ b/src/progs/ingenuity/ingenuity.glade
@@ -3303,7 +3303,7 @@ Contributors:
<property name="artists">Usability / UI Design:
Thorsten Wilms</property>
<property name="translator_credits" translatable="yes" comments="TRANSLATORS: Replace this string with your names, one name per line.">translator-credits</property>
- <property name="logo">ingen-icon.png</property>
+ <property name="logo">ingen-icon.svg</property>
</widget>
<widget class="GtkWindow" id="patch_tree_win">
diff --git a/src/progs/patch_loader/patch_loader.cpp b/src/progs/patch_loader/patch_loader.cpp
index ab5c2c53..8d84e706 100644
--- a/src/progs/patch_loader/patch_loader.cpp
+++ b/src/progs/patch_loader/patch_loader.cpp
@@ -72,7 +72,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], "/", "");
}
return 0;