diff options
author | David Robillard <d@drobilla.net> | 2009-12-31 18:27:20 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-12-31 18:27:20 +0000 |
commit | 3dded8a655b6cad1925f160cb1012b8334e00c3e (patch) | |
tree | 5d743f58c6494ea7e5ed4010f9016c7d3c3f7665 /src/gui/PatchWindow.cpp | |
parent | c11b1bd6fe15f281c5e6b1ab2109590c17e739e9 (diff) | |
download | ingen-3dded8a655b6cad1925f160cb1012b8334e00c3e.tar.gz ingen-3dded8a655b6cad1925f160cb1012b8334e00c3e.tar.bz2 ingen-3dded8a655b6cad1925f160cb1012b8334e00c3e.zip |
Various fixes related to port values and metadata (fix ticket #459 among other things).
Fix jitterey behaviour of port controls (on module) while dragging.
Update value in status bar while dragging port slider (on module).
Update plugin data (e.g. port control range) if the plugin is sent to the
client after nodes that are instances of it (i.e. more robust plugin state
tracking via merging like with objects).
Correctly save and restore port values (ticket #459).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2327 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui/PatchWindow.cpp')
-rw-r--r-- | src/gui/PatchWindow.cpp | 64 |
1 files changed, 41 insertions, 23 deletions
diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp index a2992215..2638cbbe 100644 --- a/src/gui/PatchWindow.cpp +++ b/src/gui/PatchWindow.cpp @@ -18,6 +18,7 @@ #include "PatchWindow.hpp" #include <iostream> #include <cassert> +#include <sstream> #include <fstream> #include <boost/format.hpp> #include "raul/AtomRDF.hpp" @@ -300,38 +301,55 @@ PatchWindow::patch_port_removed(SharedPtr<PortModel> port) void -PatchWindow::object_entered(ObjectModel* model) +PatchWindow::show_status(ObjectModel* model) { - string msg = model->path().str(); - NodeModel* node = dynamic_cast<NodeModel*>(model); - if (node) { - PluginModel* plugin = (PluginModel*)node->plugin(); + std::stringstream msg; + msg << model->path().chop_scheme(); + + PortModel* port = 0; + NodeModel* node = 0; + + if ((port = dynamic_cast<PortModel*>(model))) { + show_port_status(port, port->value()); + + } else if ((node = dynamic_cast<NodeModel*>(model))) { + PluginModel* plugin = dynamic_cast<PluginModel*>(node->plugin()); if (plugin) - msg.append((boost::format(" (%1%)") % plugin->human_name()).str()); + msg << ((boost::format(" (%1%)") % plugin->human_name()).str()); + _status_bar->push(msg.str(), STATUS_CONTEXT_HOVER); } +} - PortModel* port = dynamic_cast<PortModel*>(model); - if (port) { - NodeModel* parent = dynamic_cast<NodeModel*>(port->parent().get()); - if (parent) { - const PluginModel* plugin = dynamic_cast<const PluginModel*>(parent->plugin()); - if (plugin) { - const string human_name = plugin->port_human_name(port->index()); - if (human_name != "") - msg.append((boost::format(" (%1%)") % human_name).str()); - } - } +void +PatchWindow::show_port_status(PortModel* port, const Raul::Atom& value) +{ + std::stringstream msg; + msg << port->path().chop_scheme(); - const Atom& value = port->value(); - if (value.is_valid()) { - const Redland::Node node = AtomRDF::atom_to_node( - *App::instance().world()->rdf_world, value); - msg.append(" = ").append(node.to_string()); + NodeModel* parent = dynamic_cast<NodeModel*>(port->parent().get()); + if (parent) { + const PluginModel* plugin = dynamic_cast<const PluginModel*>(parent->plugin()); + if (plugin) { + const string& human_name = plugin->port_human_name(port->index()); + if (human_name != "") + msg << " (" << human_name << ")"; } } - _status_bar->push(msg, STATUS_CONTEXT_HOVER); + if (value.is_valid()) { + msg << " = " << value; + } + + _status_bar->pop(STATUS_CONTEXT_HOVER); + _status_bar->push(msg.str(), STATUS_CONTEXT_HOVER); +} + + +void +PatchWindow::object_entered(ObjectModel* model) +{ + show_status(model); } |