summaryrefslogtreecommitdiffstats
path: root/src/progs/ingenuity/PortController.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-09-07 06:04:55 +0000
committerDavid Robillard <d@drobilla.net>2006-09-07 06:04:55 +0000
commitacbe9a26ec3ab689e430225d15e95e73a7378aa9 (patch)
treecd10095833a77f3ab6c87d0e21fbbd9a8d74d66a /src/progs/ingenuity/PortController.cpp
parent445b55c6d13db5fffe18113cd6664e7923f8251b (diff)
downloadingen-acbe9a26ec3ab689e430225d15e95e73a7378aa9.tar.gz
ingen-acbe9a26ec3ab689e430225d15e95e73a7378aa9.tar.bz2
ingen-acbe9a26ec3ab689e430225d15e95e73a7378aa9.zip
Patch port fixes.
Port metadata fixes. Compatibility hacks for loading old patches. Internal node fixes, cleanups, minor refactor. Path fixes. git-svn-id: http://svn.drobilla.net/lad/ingen@118 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/progs/ingenuity/PortController.cpp')
-rw-r--r--src/progs/ingenuity/PortController.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/progs/ingenuity/PortController.cpp b/src/progs/ingenuity/PortController.cpp
index 335e673c..a26c14eb 100644
--- a/src/progs/ingenuity/PortController.cpp
+++ b/src/progs/ingenuity/PortController.cpp
@@ -15,6 +15,7 @@
*/
#include "PortController.h"
+#include "OmFlowCanvas.h"
#include "OmModule.h"
#include "PortModel.h"
#include "ControlPanel.h"
@@ -54,10 +55,19 @@ PortController::destroy()
void
-PortController::create_module(OmFlowCanvas* canvas, double x, double y)
+PortController::create_module(OmFlowCanvas* canvas)
{
cerr << "Creating port module " << m_model->path() << endl;
+ const string x_str = m_model->get_metadata("module-x");
+ const string y_str = m_model->get_metadata("module-y");
+
+ double default_x;
+ double default_y;
+ canvas->get_new_module_location(default_x, default_y);
+ const double x = (x_str == "") ? default_x : atof(x_str.c_str());
+ const double y = (y_str == "") ? default_y : atof(y_str.c_str());
+
assert(canvas);
assert(port_model());
m_module = new OmPortModule(canvas, this, x, y);
@@ -65,8 +75,8 @@ PortController::create_module(OmFlowCanvas* canvas, double x, double y)
// FIXME: leak
m_patch_port = new OmPatchPort(m_module, port_model());
m_module->add_port(m_patch_port, false);
-
- m_module->move_to(x, y);
+
+ m_module->move_to(x, y); // FIXME: redundant (?)
}