From 77a9beca75debd2d87d735fc4fe847694eee6f13 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 25 Feb 2010 20:40:13 +0000 Subject: Work on contexts and polymorphic ports. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2492 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/Port.cpp | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'src/gui/Port.cpp') diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index e353190d..4e1a5460 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -89,7 +89,7 @@ Port::Port( pm->signal_moved.connect(sigc::mem_fun(this, &Port::moved)); - if (pm->type().is_control()) { + if (App::instance().can_control(pm.get())) { set_toggled(pm->is_toggle()); show_control(); pm->signal_property.connect(sigc::mem_fun(this, &Port::property_changed)); @@ -114,7 +114,7 @@ void Port::update_metadata() { SharedPtr pm = _port_model.lock(); - if (pm && pm->type().is_control()) { + if (App::instance().can_control(pm.get()) && pm->is_numeric()) { boost::shared_ptr parent = PtrCast(pm->parent()); if (parent) { float min = 0.0f; @@ -191,22 +191,15 @@ Port::set_control(float value, bool signal) if (signal) { App& app = App::instance(); Ingen::Shared::World* const world = app.world(); - if (model()->type() == PortType::CONTROL) { - app.engine()->set_property(model()->path(), - world->uris->ingen_value, Atom(value)); - PatchWindow* pw = app.window_factory()->patch_window( - PtrCast(model()->parent())); - if (!pw) - pw = app.window_factory()->patch_window( - PtrCast(model()->parent()->parent())); - if (pw) - pw->show_port_status(model().get(), value); - - } else if (model()->type() == PortType::EVENTS) { - app.engine()->set_property(model()->path(), - world->uris->ingen_value, - Atom("http://example.org/ev#BangEvent", 0, NULL)); - } + app.engine()->set_property(model()->path(), + world->uris->ingen_value, Atom(value)); + PatchWindow* pw = app.window_factory()->patch_window( + PtrCast(model()->parent())); + if (!pw) + pw = app.window_factory()->patch_window( + PtrCast(model()->parent()->parent())); + if (pw) + pw->show_port_status(model().get(), value); } FlowCanvas::Port::set_control(value); -- cgit v1.2.1