summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-02-02 23:26:18 +0000
committerDavid Robillard <d@drobilla.net>2013-02-02 23:26:18 +0000
commitb405b793ef2487dbf3fa22e124818b3d37f165f9 (patch)
tree6038c95fd3b69702acfc673e8f3c9f10ad6b1929 /src/gui
parentae49dc5d6d2b696a2e1041085fc181239bc06e6a (diff)
downloadingen-b405b793ef2487dbf3fa22e124818b3d37f165f9.tar.gz
ingen-b405b793ef2487dbf3fa22e124818b3d37f165f9.tar.bz2
ingen-b405b793ef2487dbf3fa22e124818b3d37f165f9.zip
GUI support for integer controls.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5034 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/Port.cpp26
-rw-r--r--src/gui/Port.hpp1
2 files changed, 19 insertions, 8 deletions
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());
@@ -397,6 +393,21 @@ Port::get_graph_box() const
}
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)
{
const URIs& uris = _app.uris();
@@ -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<int32_t>() &&
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<const Client::PortModel> _port_model;