diff options
Diffstat (limited to 'src/libs/gui/NodeModule.cpp')
-rw-r--r-- | src/libs/gui/NodeModule.cpp | 32 |
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) |