summaryrefslogtreecommitdiffstats
path: root/src/progs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-01-08 02:41:36 +0000
committerDavid Robillard <d@drobilla.net>2007-01-08 02:41:36 +0000
commitc5218b13bac00fbd8c3ceb99b46063b98bc1fdd3 (patch)
treecedcc8e24a0db8d0a40bcfececc25e66df2387e1 /src/progs
parent813e0cbb39809d7cf837e6b91a75815079502f47 (diff)
downloadingen-c5218b13bac00fbd8c3ceb99b46063b98bc1fdd3.tar.gz
ingen-c5218b13bac00fbd8c3ceb99b46063b98bc1fdd3.tar.bz2
ingen-c5218b13bac00fbd8c3ceb99b46063b98bc1fdd3.zip
Fix destruction of nodes with connections to parent patch ports.
git-svn-id: http://svn.drobilla.net/lad/ingen@241 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/progs')
-rw-r--r--src/progs/ingenuity/PatchCanvas.cpp57
1 files changed, 36 insertions, 21 deletions
diff --git a/src/progs/ingenuity/PatchCanvas.cpp b/src/progs/ingenuity/PatchCanvas.cpp
index f7c80987..d305e9c3 100644
--- a/src/progs/ingenuity/PatchCanvas.cpp
+++ b/src/progs/ingenuity/PatchCanvas.cpp
@@ -163,41 +163,56 @@ PatchCanvas::connection(SharedPtr<ConnectionModel> cm)
const Path& src_parent_path = cm->src_port_path().parent();
const Path& dst_parent_path = cm->dst_port_path().parent();
- const string& src_parent_name =
- (src_parent_path == m_patch->path()) ? "" : src_parent_path.name();
- const string& dst_parent_name =
- (dst_parent_path == m_patch->path()) ? "" : dst_parent_path.name();
+ const string& src_parent_name = (src_parent_path == m_patch->path())
+ ? cm->src_port_path().name()
+ : src_parent_path.name();
+
+ const string& dst_parent_name = (dst_parent_path == m_patch->path())
+ ? cm->dst_port_path().name()
+ : dst_parent_path.name();
boost::shared_ptr<LibFlowCanvas::Port> src = get_port(src_parent_name, cm->src_port_path().name());
boost::shared_ptr<LibFlowCanvas::Port> dst = get_port(dst_parent_name, cm->dst_port_path().name());
- if (src && dst) {
- add_connection(boost::shared_ptr<Connection>(
- new Connection(shared_from_this(), cm, src, dst)));
- } else {
- cerr << "[Canvas] ERROR: Unable to find ports to create connection." << endl;
- }
+ cerr << "SPN: " << src_parent_name << endl;
+ cerr << "DPN: " << dst_parent_name << endl;
+
+ if (src && dst)
+ add_connection(boost::shared_ptr<Connection>(new Connection(shared_from_this(), cm, src, dst)));
+ else
+ cerr << "[PatchCanvas] ERROR: Unable to find ports to connect "
+ << cm->src_port_path() << " -> " << cm->dst_port_path() << endl;
}
void
PatchCanvas::disconnection(const Path& src_port_path, const Path& dst_port_path)
{
- const string& src_node_name = src_port_path.parent().name();
- const string& src_port_name = src_port_path.name();
- const string& dst_node_name = dst_port_path.parent().name();
- const string& dst_port_name = dst_port_path.name();
+ // Deal with port "anonymous nodes" for this patch's own ports...
+ const Path& src_parent_path = src_port_path.parent();
+ const Path& dst_parent_path = dst_port_path.parent();
- boost::shared_ptr<LibFlowCanvas::Port> src_port = get_port(src_node_name, src_port_name);
- boost::shared_ptr<LibFlowCanvas::Port> dst_port = get_port(dst_node_name, dst_port_name);
+ const string& src_parent_name = (src_parent_path == m_patch->path())
+ ? src_port_path.name()
+ : src_parent_path.name();
- if (src_port && dst_port) {
- remove_connection(src_port, dst_port);
- }
+ const string& dst_parent_name = (dst_parent_path == m_patch->path())
+ ? dst_port_path.name()
+ : dst_parent_path.name();
+
+ cerr << "SPN: " << src_parent_name << endl;
+ cerr << "DPN: " << dst_parent_name << endl;
- //patch_model()->remove_connection(src_port_path, dst_port_path);
+ boost::shared_ptr<LibFlowCanvas::Port> src = get_port(src_parent_name, src_port_path.name());
+ boost::shared_ptr<LibFlowCanvas::Port> dst = get_port(dst_parent_name, dst_port_path.name());
+
+ if (src && dst)
+ remove_connection(src, dst);
+ else
+ cerr << "[PatchCanvas] ERROR: Unable to find ports to disconnect "
+ << src_port_path << " -> " << dst_port_path << endl;
- cerr << "FIXME: disconnection\n";
+ cerr << "FIXME: disconnection control window stuff\n";
/*
// Enable control slider in destination node control window
PortController* p = (PortController)Store::instance().port(dst_port_path)->controller();