From b405b793ef2487dbf3fa22e124818b3d37f165f9 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 2 Feb 2013 23:26:18 +0000 Subject: GUI support for integer controls. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5034 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/Port.cpp | 26 ++++++++++++++++++-------- src/gui/Port.hpp | 1 + 2 files changed, 19 insertions(+), 8 deletions(-) (limited to 'src/gui') diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index db7e2d51..d1c0eda3 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -64,7 +64,7 @@ Port::create(App& app, return new Port(app, module, pm, label, flip); } -/** @a flip Make an input port appear as an output port, and vice versa. +/** @param flip Make an input port appear as an output port, and vice versa. */ Port::Port(App& app, Ganv::Module& module, @@ -85,7 +85,7 @@ Port::Port(App& app, set_border_width(1.0); if (app.can_control(pm.get())) { - set_control_is_toggle(pm->is_toggle()); + port_properties_changed(); show_control(); pm->signal_property().connect( sigc::mem_fun(this, &Port::property_changed)); @@ -106,10 +106,6 @@ Port::Port(App& app, signal_event().connect( sigc::mem_fun(this, &Port::on_event)); - if (pm->is_enumeration()) { - const uint8_t ellipsis[] = { 0xE2, 0x80, 0xA6, 0 }; - set_value_label((const char*)ellipsis); - } update_metadata(); value_changed(pm->value()); @@ -396,6 +392,21 @@ Port::get_graph_box() const return _app.window_factory()->graph_box(graph); } +void +Port::port_properties_changed() +{ + if (model()->is_toggle()) { + set_control_is_toggle(true); + } else if (model()->is_enumeration()) { + const uint8_t ellipsis[] = { 0xE2, 0x80, 0xA6, 0 }; + set_value_label((const char*)ellipsis); + } else if (model()->is_integer()) { + const uint8_t bigZ[] = { 0xE2, 0x84, 0xA4, 0 }; + set_value_label((const char*)bigZ); + set_control_is_integer(true); + } +} + void Port::property_changed(const Raul::URI& key, const Raul::Atom& value) { @@ -416,8 +427,7 @@ Port::property_changed(const Raul::URI& key, const Raul::Atom& value) set_control_max(val); } } else if (key == uris.lv2_portProperty) { - if (value == uris.lv2_toggled) - set_control_is_toggle(true); + port_properties_changed(); } else if (key == uris.lv2_name) { if (value.type() == uris.forge.String && _app.world()->conf().option("port-labels").get() && diff --git a/src/gui/Port.hpp b/src/gui/Port.hpp index a9d24c1f..67862e17 100644 --- a/src/gui/Port.hpp +++ b/src/gui/Port.hpp @@ -84,6 +84,7 @@ private: void on_scale_point_activated(float f); void on_uri_activated(const Raul::URI& uri); bool on_event(GdkEvent* ev); + void port_properties_changed(); App& _app; WPtr _port_model; -- cgit v1.2.1