summaryrefslogtreecommitdiffstats
path: root/src/libs/gui/NodeModule.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-09-15 04:15:03 +0000
committerDavid Robillard <d@drobilla.net>2008-09-15 04:15:03 +0000
commitfccfce4b1e9c9f80b38d20dd8f0e90fe83a93068 (patch)
treea2c81600ac907662f84912fa5375bfd14450811c /src/libs/gui/NodeModule.cpp
parent966b1446fcc3fc5a4cdda778c259bb24ed59539a (diff)
downloadingen-fccfce4b1e9c9f80b38d20dd8f0e90fe83a93068.tar.gz
ingen-fccfce4b1e9c9f80b38d20dd8f0e90fe83a93068.tar.bz2
ingen-fccfce4b1e9c9f80b38d20dd8f0e90fe83a93068.zip
Make view togglable between symbols and human names (just LV2 plugins for now).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1502 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui/NodeModule.cpp')
-rw-r--r--src/libs/gui/NodeModule.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp
index fc6b13de..09df174e 100644
--- a/src/libs/gui/NodeModule.cpp
+++ b/src/libs/gui/NodeModule.cpp
@@ -77,7 +77,7 @@ NodeModule::create_menu()
boost::shared_ptr<NodeModule>
-NodeModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeModel> node)
+NodeModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeModel> node, bool human)
{
boost::shared_ptr<NodeModule> ret;
@@ -94,12 +94,42 @@ NodeModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeModel> n
ret->add_port(*p, false);
}
+ if (human)
+ ret->show_human_names(human);
+
ret->resize();
ret->set_stacked_border(node->polyphonic());
return ret;
}
+
+void
+NodeModule::show_human_names(bool b)
+{
+ if (b && node()->plugin())
+ set_name(((PluginModel*)node()->plugin())->human_name());
+ else
+ b = false;
+
+ if (!b)
+ set_name(node()->symbol());
+
+ uint32_t index = 0;
+ for (PortVector::const_iterator i = ports().begin(); i != ports().end(); ++i) {
+ if (b) {
+ string hn = ((PluginModel*)node()->plugin())->port_human_name(index);
+ if (hn != "")
+ (*i)->set_name(hn);
+ } else {
+ (*i)->set_name(node()->port(index)->symbol());
+ }
+ ++index;
+ }
+
+ resize();
+}
+
void
NodeModule::value_changed(uint32_t index, const Atom& value)