From 0123cdeacc9acc7ca16fa8b0a9dee7a5d916b7df Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 5 Apr 2007 05:50:53 +0000 Subject: Selector states. Togglable edge and state labels. Builder fixes. GUI/input/etc fixes. git-svn-id: http://svn.drobilla.net/lad/machina@398 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/NodeView.cpp | 45 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) (limited to 'src/gui/NodeView.cpp') diff --git a/src/gui/NodeView.cpp b/src/gui/NodeView.cpp index 6ff21ee..d38e228 100644 --- a/src/gui/NodeView.cpp +++ b/src/gui/NodeView.cpp @@ -15,6 +15,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include #include "NodeView.hpp" #include "NodePropertiesWindow.hpp" @@ -29,7 +30,8 @@ NodeView::NodeView(Gtk::Window* window, , _window(window) , _node(node) { - //signal_double_clicked.connect(sigc::mem_fun(this, &NodeView::on_double_click)); + signal_clicked.connect(sigc::mem_fun(this, &NodeView::handle_click)); + update_state(); } @@ -41,27 +43,50 @@ NodeView::on_double_click(GdkEventButton*) void -NodeView::on_click(GdkEventButton* event) +NodeView::handle_click(GdkEventButton* event) { if (event->state & GDK_CONTROL_MASK) { if (event->button == 1) { bool is_initial = _node->is_initial(); _node->set_initial( ! is_initial ); - set_border_width(is_initial ? 1.0 : 6.0); + update_state(); } else if (event->button == 3) { bool is_selector = _node->is_selector(); _node->set_selector( ! is_selector ); - set_border_width(is_selector ? 1.0 : 3.0); + update_state(); } } } void -NodeView::update_state() +NodeView::show_label(bool show) { - static const uint32_t active_color = 0x80808AFF; + char str[4]; + + SharedPtr action + = PtrCast(_node->enter_action()); + + if (show) { + if (action && action->event_size() >= 2 + && (action->event()[0] & 0xF0) == 0x90) { + + unsigned char note = action->event()[1]; + snprintf(str, 4, "%d", (int)note); + + set_name(str); + } + } else { + set_name(""); + } +} + +void +NodeView::update_state() +{ + static const uint32_t active_color = 0xA0A0AAFF; + if (_node->is_active()) { if (_color != active_color) { _old_color = _color; @@ -70,5 +95,13 @@ NodeView::update_state() } else if (_color == active_color) { set_base_color(_old_color); } + + if (_node->is_selector()) + if (_node->is_active()) + set_base_color(0x00FF00FF); + else + set_base_color(0x00A000FF); + + set_border_width(_node->is_initial() ? 4.0 : 1.0); } -- cgit v1.2.1