From 89405ae847f6690471462319a794c541cc6343b1 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 4 Feb 2010 19:15:40 +0000 Subject: Change patch port label when human name changes (e.g. update label when changed in the rename dialog). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2424 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/PatchPortModule.cpp | 17 +++++++++-------- src/gui/PatchPortModule.hpp | 1 - src/gui/Port.cpp | 7 ++++++- 3 files changed, 15 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gui/PatchPortModule.cpp b/src/gui/PatchPortModule.cpp index b1a71cf2..a32d202f 100644 --- a/src/gui/PatchPortModule.cpp +++ b/src/gui/PatchPortModule.cpp @@ -23,13 +23,14 @@ #include "client/PatchModel.hpp" #include "client/NodeModel.hpp" #include "App.hpp" +#include "Configuration.hpp" +#include "GladeFactory.hpp" #include "PatchCanvas.hpp" +#include "PatchWindow.hpp" #include "Port.hpp" -#include "GladeFactory.hpp" +#include "PortMenu.hpp" #include "RenameWindow.hpp" -#include "PatchWindow.hpp" #include "WindowFactory.hpp" -#include "PortMenu.hpp" using namespace std; using namespace Raul; @@ -41,7 +42,6 @@ namespace GUI { PatchPortModule::PatchPortModule(boost::shared_ptr canvas, SharedPtr model) : FlowCanvas::Module(canvas, "", 0, 0, false) // FIXME: coords? , _model(model) - , _human_name_visible(false) { assert(canvas); assert(model); @@ -113,8 +113,6 @@ void PatchPortModule::show_human_names(bool b) { const LV2URIMap& uris = App::instance().uris(); - using namespace std; - _human_name_visible = b; const Atom& name = _model->get_property(uris.lv2_name); if (b && name.type() == Atom::STRING) set_name(name.get_string()); @@ -146,11 +144,14 @@ PatchPortModule::set_property(const URI& key, const Atom& value) } break; case Atom::STRING: - if (key == uris.lv2_name && _human_name_visible) { + if (key == uris.lv2_name + && App::instance().configuration()->name_style() == Configuration::HUMAN) { set_name(value.get_string()); - } else if (key == uris.lv2_symbol && !_human_name_visible) { + } else if (key == uris.lv2_symbol + && App::instance().configuration()->name_style() == Configuration::PATH) { set_name(value.get_string()); } + break; case Atom::BOOL: if (key == uris.ingen_polyphonic) { set_stacked_border(value.get_bool()); diff --git a/src/gui/PatchPortModule.hpp b/src/gui/PatchPortModule.hpp index e85b7c90..6659864a 100644 --- a/src/gui/PatchPortModule.hpp +++ b/src/gui/PatchPortModule.hpp @@ -74,7 +74,6 @@ protected: SharedPtr _model; SharedPtr _port; PortMenu* _menu; - bool _human_name_visible; }; diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index 84557548..e353190d 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -227,10 +227,15 @@ Port::property_changed(const URI& key, const Atom& value) } else if (key == uris.lv2_portProperty) { if (value == uris.lv2_toggled) set_toggled(true); - } else if (value.type() == Atom::URI) { + } else if (key == uris.ctx_context) { ArtVpathDash* dash = this->dash(); _rect->property_dash() = dash; set_border_width(dash ? 2.0 : 0.0); + } else if (key == uris.lv2_name) { + if (value.type() == Atom::STRING + && App::instance().configuration()->name_style() == Configuration::HUMAN) { + set_name(value.get_string()); + } } } -- cgit v1.2.1