summaryrefslogtreecommitdiffstats
path: root/src/progs/ingenuity/OmPortModule.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-09-14 23:14:53 +0000
committerDavid Robillard <d@drobilla.net>2006-09-14 23:14:53 +0000
commitf9f760893e4fa1ff850becf7d98bd4c6af8b8d73 (patch)
tree1cf83435ef5ee08c31bb9ddc11b9dbca96264158 /src/progs/ingenuity/OmPortModule.cpp
parenta100c20612fc4f7f30372f579e355f782befa7e2 (diff)
downloadingen-f9f760893e4fa1ff850becf7d98bd4c6af8b8d73.tar.gz
ingen-f9f760893e4fa1ff850becf7d98bd4c6af8b8d73.tar.bz2
ingen-f9f760893e4fa1ff850becf7d98bd4c6af8b8d73.zip
Patch port and breadcrumb fixes.
git-svn-id: http://svn.drobilla.net/lad/ingen@135 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/progs/ingenuity/OmPortModule.cpp')
-rw-r--r--src/progs/ingenuity/OmPortModule.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/progs/ingenuity/OmPortModule.cpp b/src/progs/ingenuity/OmPortModule.cpp
index aaa26205..7496a6a6 100644
--- a/src/progs/ingenuity/OmPortModule.cpp
+++ b/src/progs/ingenuity/OmPortModule.cpp
@@ -32,7 +32,8 @@ namespace Ingenuity {
OmPortModule::OmPortModule(OmFlowCanvas* canvas, CountedPtr<PortModel> port)
: LibFlowCanvas::Module(canvas, "", 0, 0), // FIXME: coords?
- m_port(port)
+ m_port(port),
+ m_patch_port(NULL)
{
/*if (port_model()->polyphonic() && port_model()->parent() != NULL
&& port_model()->parent_patch()->poly() > 1) {
@@ -62,33 +63,36 @@ OmPortModule::OmPortModule(OmFlowCanvas* canvas, CountedPtr<PortModel> port)
canvas->get_new_module_location(default_x, default_y);
move_to(default_x, default_y);
}
+
+ port->metadata_update_sig.connect(sigc::mem_fun(this, &OmPortModule::metadata_update));
}
void
OmPortModule::store_location()
-{
- char temp_buf[16];
+{
+ const float x = static_cast<float>(property_x());
+ const float y = static_cast<float>(property_y());
- //m_port->x(property_x());
- snprintf(temp_buf, 16, "%f", property_x().get_value());
- //m_port->set_metadata("module-x", temp_buf); // just in case?
- App::instance().engine()->set_metadata(m_port->path(), "module-x", temp_buf);
+ const Atom& existing_x = m_port->get_metadata("module-x");
+ const Atom& existing_y = m_port->get_metadata("module-y");
- //m_port->y(property_y());
- snprintf(temp_buf, 16, "%f", property_y().get_value());
- //m_port->set_metadata("module-y", temp_buf); // just in case?
- App::instance().engine()->set_metadata(m_port->path(), "module-y", temp_buf);
+ if (existing_x.type() != Atom::FLOAT || existing_y.type() != Atom::FLOAT
+ || existing_x.get_float() != x || existing_y.get_float() != y) {
+ App::instance().engine()->set_metadata(m_port->path(), "module-x", Atom(x));
+ App::instance().engine()->set_metadata(m_port->path(), "module-y", Atom(y));
+ }
}
void
-OmPortModule::move_to(double x, double y)
+OmPortModule::metadata_update(const string& key, const Atom& value)
{
- Module::move_to(x, y);
- //m_port->x(x);
- //m_port->y(y);
- //store_location();
+ if (key == "module-x" && value.type() == Atom::FLOAT)
+ move_to(value.get_float(), property_y());
+ else if (key == "module-y" && value.type() == Atom::FLOAT)
+ move_to(property_x(), value.get_float());
}
+
} // namespace Ingenuity