summaryrefslogtreecommitdiffstats
path: root/src/libs/client
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-06-17 23:47:42 +0000
committerDavid Robillard <d@drobilla.net>2006-06-17 23:47:42 +0000
commitc6d42dbbf9f6872d4fed67aecde8f7a65effab08 (patch)
tree424f7ec643cf81b8282e6404ac56d81e4ef34021 /src/libs/client
parent471c9e43493ab1d3a83ed6a8ca53bd818a2ed275 (diff)
downloadingen-c6d42dbbf9f6872d4fed67aecde8f7a65effab08.tar.gz
ingen-c6d42dbbf9f6872d4fed67aecde8f7a65effab08.tar.bz2
ingen-c6d42dbbf9f6872d4fed67aecde8f7a65effab08.zip
New patch ports interface
git-svn-id: http://svn.drobilla.net/lad/grauph@48 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/client')
-rw-r--r--src/libs/client/Store.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp
index 34b86e2e..542c1bc5 100644
--- a/src/libs/client/Store.cpp
+++ b/src/libs/client/Store.cpp
@@ -209,13 +209,16 @@ Store::new_patch_event(const string& path, uint32_t poly)
CountedPtr<PatchModel> p(new PatchModel(path, poly));
add_object(p);
- CountedPtr<PatchModel> parent = object(p->path().parent());
- if (parent) {
- p->set_parent(parent);
- parent->add_node(p);
- assert(p->parent() == parent);
- } else {
- cerr << "ERROR: new patch with no parent" << endl;
+ if (path != "/") {
+ CountedPtr<PatchModel> parent = object(p->path().parent());
+ if (parent) {
+ assert(path.substr(0, parent->path().length()) == parent->path());
+ p->set_parent(parent);
+ parent->add_node(p);
+ assert(p->parent() == parent);
+ } else {
+ cerr << "ERROR: new patch with no parent" << endl;
+ }
}
}
}
@@ -283,16 +286,14 @@ Store::new_port_event(const string& path, const string& type, bool is_output)
CountedPtr<PortModel> p(new PortModel(path, ptype, pdir));
add_object(p);
- std::map<string, CountedPtr<ObjectModel> >::iterator pi = m_objects.find(p->path().parent());
- if (pi != m_objects.end()) {
- CountedPtr<NodeModel> parent = (*pi).second;
+ CountedPtr<NodeModel> parent = object(p->path().parent());
+ if (parent) {
p->set_parent(parent);
- if (parent) {
- parent->add_port(p);
- assert(p->parent() == parent);
- } else {
- cerr << "ERROR: new port with no parent" << endl;
- }
+ assert(p->parent() == parent);
+ parent->add_port(p);
+ assert(p->parent() == parent);
+ } else {
+ cerr << "ERROR: new port with no parent" << endl;
}
}
}