summaryrefslogtreecommitdiffstats
path: root/src/gui/Port.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-11-21 18:45:38 +0000
committerDavid Robillard <d@drobilla.net>2012-11-21 18:45:38 +0000
commit3b257a6a2f81c677cab83111051a79c5c3d5307f (patch)
treec771b0cd89528d51897db11b84601999281c734c /src/gui/Port.cpp
parent716e1e839790be24ebfa56c5fe8b688a3def60d2 (diff)
downloadingen-3b257a6a2f81c677cab83111051a79c5c3d5307f.tar.gz
ingen-3b257a6a2f81c677cab83111051a79c5c3d5307f.tar.bz2
ingen-3b257a6a2f81c677cab83111051a79c5c3d5307f.zip
Move human name and port label options to main configuration.
This makes it possible to persistently set the desired style in configuration files. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4843 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui/Port.cpp')
-rw-r--r--src/gui/Port.cpp30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp
index f747234a..843f0816 100644
--- a/src/gui/Port.cpp
+++ b/src/gui/Port.cpp
@@ -18,6 +18,7 @@
#include <string>
#include "ganv/Module.hpp"
+#include "ingen/Configuration.hpp"
#include "ingen/Interface.hpp"
#include "ingen/Log.hpp"
#include "ingen/client/GraphModel.hpp"
@@ -44,15 +45,19 @@ Port::create(App& app,
bool human_name,
bool flip)
{
- Glib::ustring label(human_name ? "" : pm->path().symbol());
- if (human_name) {
- const Raul::Atom& name = pm->get_property(app.uris().lv2_name);
- if (name.type() == app.forge().String) {
- label = name.get_string();
+ Glib::ustring label;
+ if (app.world()->conf().option("port-labels").get_bool()) {
+ if (human_name) {
+ const Raul::Atom& name = pm->get_property(app.uris().lv2_name);
+ if (name.type() == app.forge().String) {
+ label = name.get_string();
+ } else {
+ const SharedPtr<const BlockModel> parent(PtrCast<const BlockModel>(pm->parent()));
+ if (parent && parent->plugin_model())
+ label = parent->plugin_model()->port_human_name(pm->index());
+ }
} else {
- const SharedPtr<const BlockModel> parent(PtrCast<const BlockModel>(pm->parent()));
- if (parent && parent->plugin_model())
- label = parent->plugin_model()->port_human_name(pm->index());
+ label = pm->path().symbol();
}
}
return new Port(app, module, pm, label, flip);
@@ -135,8 +140,10 @@ Port::show_menu(GdkEventButton* ev)
void
Port::moved()
{
- if (_app.configuration()->name_style() == Configuration::PATH)
+ if (_app.world()->conf().option("port-labels").get_bool() &&
+ !_app.world()->conf().option("human-names").get_bool()) {
set_label(model()->symbol().c_str());
+ }
}
void
@@ -340,8 +347,9 @@ Port::property_changed(const Raul::URI& key, const Raul::Atom& value)
if (value == uris.lv2_toggled)
set_control_is_toggle(true);
} else if (key == uris.lv2_name) {
- if (value.type() == uris.forge.String
- && _app.configuration()->name_style() == Configuration::HUMAN) {
+ if (value.type() == uris.forge.String &&
+ _app.world()->conf().option("port-labels").get_bool() &&
+ _app.world()->conf().option("human-names").get_bool()) {
set_label(value.get_string());
}
}