summaryrefslogtreecommitdiffstats
path: root/src/gui/NodeModule.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-11-16 20:10:32 +0000
committerDavid Robillard <d@drobilla.net>2008-11-16 20:10:32 +0000
commit24eb14824c9346ca227a7296cb3f620bcf148410 (patch)
tree99eb4ec5f684e5d8b7a88659d1f81128f27bcb42 /src/gui/NodeModule.cpp
parent77fc40827ed8d713e9cbd8eded2db46aa47ce2d9 (diff)
downloadingen-24eb14824c9346ca227a7296cb3f620bcf148410.tar.gz
ingen-24eb14824c9346ca227a7296cb3f620bcf148410.tar.bz2
ingen-24eb14824c9346ca227a7296cb3f620bcf148410.zip
Hide subpatch module ports on destruction (fix ticket #254).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1730 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui/NodeModule.cpp')
-rw-r--r--src/gui/NodeModule.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index 16e624e4..acb46834 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -49,7 +49,7 @@ NodeModule::NodeModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeMode
assert(_node);
node->signal_new_port.connect(sigc::bind(sigc::mem_fun(this, &NodeModule::add_port), true));
- node->signal_removed_port.connect(sigc::mem_fun(this, &NodeModule::remove_port));
+ node->signal_removed_port.connect(sigc::hide_return(sigc::mem_fun(this, &NodeModule::remove_port)));
node->signal_variable.connect(sigc::mem_fun(this, &NodeModule::set_variable));
node->signal_property.connect(sigc::mem_fun(this, &NodeModule::set_property));
node->signal_renamed.connect(sigc::mem_fun(this, &NodeModule::rename));
@@ -250,12 +250,31 @@ NodeModule::add_port(SharedPtr<PortModel> port, bool resize_to_fit)
resize();
}
+
+boost::shared_ptr<Port>
+NodeModule::port(boost::shared_ptr<PortModel> model)
+{
+ for (PortVector::const_iterator p = ports().begin(); p != ports().end(); ++p) {
+ SharedPtr<Port> port = PtrCast<Port>(*p);
+ if (port->model() == model) {
+ cout << "FOUND: " << model->path() << endl;
+ return port;
+ }
+ }
+ return boost::shared_ptr<Port>();
+}
+
void
-NodeModule::remove_port(SharedPtr<PortModel> port)
+NodeModule::remove_port(SharedPtr<PortModel> model)
{
- SharedPtr<FlowCanvas::Port> p = Module::remove_port(port->path().name());
- p.reset();
+ SharedPtr<Port> p = port(model);
+ if (p) {
+ Module::remove_port(p);
+ p.reset();
+ } else {
+ cerr << "WARNING: Failed to find port on module: " << model->path() << endl;
+ }
}