summaryrefslogtreecommitdiffstats
path: root/src/gui/PatchPortModule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/PatchPortModule.cpp')
-rw-r--r--src/gui/PatchPortModule.cpp47
1 files changed, 29 insertions, 18 deletions
diff --git a/src/gui/PatchPortModule.cpp b/src/gui/PatchPortModule.cpp
index 200ce12f..ffb05e8d 100644
--- a/src/gui/PatchPortModule.cpp
+++ b/src/gui/PatchPortModule.cpp
@@ -30,6 +30,8 @@
#include "WindowFactory.hpp"
#include "PortMenu.hpp"
+using namespace Raul;
+
namespace Ingen {
namespace GUI {
@@ -130,32 +132,41 @@ PatchPortModule::set_name(const std::string& n)
void
-PatchPortModule::set_variable(const string& key, const Atom& value)
+PatchPortModule::set_variable(const URI& key, const Atom& value)
{
- if (key == "ingen:polyphonic" && value.type() == Atom::BOOL) {
- set_stacked_border(value.get_bool());
- } else if (key == "ingen:selected" && value.type() == Atom::BOOL) {
- if (value.get_bool() != selected()) {
- if (value.get_bool())
- _canvas.lock()->select_item(shared_from_this());
- else
- _canvas.lock()->unselect_item(shared_from_this());
+ if (value.type() == Atom::BOOL) {
+ if (key.str() == "ingen:polyphonic") {
+ set_stacked_border(value.get_bool());
+ } else if (key.str() == "ingen:selected") {
+ if (value.get_bool() != selected()) {
+ if (value.get_bool())
+ _canvas.lock()->select_item(shared_from_this());
+ else
+ _canvas.lock()->unselect_item(shared_from_this());
+ }
}
}
}
void
-PatchPortModule::set_property(const string& key, const Atom& value)
+PatchPortModule::set_property(const URI& key, const Atom& value)
{
- if (key == "ingenuity:canvas-x" && value.type() == Atom::FLOAT) {
- move_to(value.get_float(), property_y());
- } else if (key == "ingenuity:canvas-y" && value.type() == Atom::FLOAT) {
- move_to(property_x(), value.get_float());
- } else if (key == "lv2:name" && value.type() == Atom::STRING && _human_name_visible) {
- set_name(value.get_string());
- } else if (key == "lv2:symbol" && value.type() == Atom::STRING && !_human_name_visible) {
- set_name(value.get_string());
+ switch (value.type()) {
+ case Atom::FLOAT:
+ if (key.str() == "ingenuity:canvas-x") {
+ move_to(value.get_float(), property_y());
+ } else if (key.str() == "ingenuity:canvas-y") {
+ move_to(property_x(), value.get_float());
+ }
+ break;
+ case Atom::STRING:
+ if (key.str() == "lv2:name" && _human_name_visible) {
+ set_name(value.get_string());
+ } else if (key.str() == "lv2:symbol" && !_human_name_visible) {
+ set_name(value.get_string());
+ }
+ default: break;
}
}