summaryrefslogtreecommitdiffstats
path: root/src/progs/ingenuity/NodeController.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-09-09 21:42:33 +0000
committerDavid Robillard <d@drobilla.net>2006-09-09 21:42:33 +0000
commita90181962d3f9eca3e00f665465bbd66bdd79927 (patch)
treebcebc1dc25b788cbd647f70068cd6d1ff40ac722 /src/progs/ingenuity/NodeController.cpp
parentfca95e5d454d37bd74b98f5bce35cfcbaee86c3f (diff)
downloadingen-a90181962d3f9eca3e00f665465bbd66bdd79927.tar.gz
ingen-a90181962d3f9eca3e00f665465bbd66bdd79927.tar.bz2
ingen-a90181962d3f9eca3e00f665465bbd66bdd79927.zip
Canvas cleanups, bugfixes, more robustness, etc.
git-svn-id: http://svn.drobilla.net/lad/ingen@124 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/progs/ingenuity/NodeController.cpp')
-rw-r--r--src/progs/ingenuity/NodeController.cpp46
1 files changed, 25 insertions, 21 deletions
diff --git a/src/progs/ingenuity/NodeController.cpp b/src/progs/ingenuity/NodeController.cpp
index 331a714e..1c340516 100644
--- a/src/progs/ingenuity/NodeController.cpp
+++ b/src/progs/ingenuity/NodeController.cpp
@@ -97,31 +97,42 @@ NodeController::NodeController(CountedPtr<NodeModel> model)
NodeController::~NodeController()
{
+ destroy_module();
}
void
NodeController::create_module(OmFlowCanvas* canvas)
{
- //cerr << "Creating node module " << m_model->path() << endl;
-
- // If this is a DSSI plugin, DSSIController should be doing this
- /*assert(node_model()->plugin());
- assert(node_model()->plugin()->type() != PluginModel::DSSI);
- assert(canvas != NULL);
- assert(m_module == NULL);*/
-
- assert(canvas);
- assert(node_model());
- m_module = new OmModule(canvas, this);
-
- create_all_ports();
+ if (!m_module || m_module->canvas() != canvas) {
+ delete m_module;
+ //cerr << "Creating node module " << m_model->path() << endl;
+
+ // If this is a DSSI plugin, DSSIController should be doing this
+ /*assert(node_model()->plugin());
+ assert(node_model()->plugin()->type() != PluginModel::DSSI);
+ assert(canvas != NULL);
+ assert(m_module == NULL);*/
+
+ assert(canvas);
+ assert(node_model());
+ m_module = new OmModule(canvas, this);
+ create_all_ports();
+ }
m_module->move_to(node_model()->x(), node_model()->y());
}
void
+NodeController::destroy_module()
+{
+ delete m_module;
+ m_module = NULL;
+}
+
+
+void
NodeController::set_path(const Path& new_path)
{
cerr << "FIXME: rename\n";
@@ -214,12 +225,6 @@ NodeController::add_port(CountedPtr<PortModel> pm)
if (has_control_inputs())
enable_controls_menuitem();
}
-
- if (m_control_window != NULL) {
- assert(m_control_window->control_panel() != NULL);
- m_control_window->control_panel()->add_port(pc);
- m_control_window->resize();
- }
}
@@ -233,8 +238,7 @@ NodeController::show_control_window()
if (!m_control_window)
m_control_window = new NodeControlWindow(this, poly);
- if (m_control_window->control_panel()->num_controls() > 0)
- m_control_window->present();
+ m_control_window->present();
}