diff options
author | David Robillard <d@drobilla.net> | 2012-06-12 23:23:23 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-06-12 23:23:23 +0000 |
commit | ca397ba278f703a0674a853dac87c3940b618e58 (patch) | |
tree | 3e812fd3c7ef9a9956a9f297433708bce11b7ad0 | |
parent | 071e36b69b5bcc203f70179580c8bed924b7305b (diff) | |
download | ingen-ca397ba278f703a0674a853dac87c3940b618e58.tar.gz ingen-ca397ba278f703a0674a853dac87c3940b618e58.tar.bz2 ingen-ca397ba278f703a0674a853dac87c3940b618e58.zip |
Tidy.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4497 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | src/gui/PortMenu.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index 2785db77..241811e5 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -143,28 +143,25 @@ PortMenu::on_menu_reset_range() void PortMenu::on_menu_expose() { - const URIs& uris = _app->uris(); - SharedPtr<const PortModel> port = PtrCast<const PortModel>(_object); - SharedPtr<const NodeModel> node = PtrCast<const NodeModel>(_object->parent()); + const URIs& uris = _app->uris(); + SharedPtr<const PortModel> port = PtrCast<const PortModel>(_object); + SharedPtr<const NodeModel> node = PtrCast<const NodeModel>(port->parent()); - std::string label = node->label() + " " + node->port_label(port); - Raul::Path path = node->path().str() + "_" + _object->symbol().c_str(); - Raul::Atom symbol = _app->forge().alloc(path.symbol()); - Raul::Atom name = _app->forge().alloc(label.c_str()); + const std::string label = node->label() + " " + node->port_label(port); + const Raul::Path path = node->path().str() + "_" + port->symbol().c_str(); Shared::ResourceImpl r(*_object.get()); r.remove_property(uris.lv2_index, uris.wildcard); - r.set_property(uris.lv2_symbol, symbol); - r.set_property(uris.lv2_name, name); + r.set_property(uris.lv2_symbol, _app->forge().alloc(path.symbol())); + r.set_property(uris.lv2_name, _app->forge().alloc(label.c_str())); // TODO: Pretty kludgey coordinates const float node_x = node->get_property(uris.ingen_canvasX).get_float(); const float node_y = node->get_property(uris.ingen_canvasY).get_float(); - r.set_property(uris.ingen_canvasX, - _app->forge().make(node_x + ((label.length() * 16.0f) - * (port->is_input() ? -1 : 1)))); - r.set_property(uris.ingen_canvasY, - _app->forge().make(node_y + port->index() * 32.0f)); + const float x_off = (label.length() * 16.0f) * (port->is_input() ? -1 : 1); + const float y_off = port->index() * 32.0f; + r.set_property(uris.ingen_canvasX, _app->forge().make(node_x + x_off)); + r.set_property(uris.ingen_canvasY, _app->forge().make(node_y + y_off)); _app->interface()->put(path, r.properties()); |