From a795ba2553d1663bc29b8e8fa3186efb516f27d4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 12 Feb 2007 03:52:47 +0000 Subject: Added missing files. git-svn-id: http://svn.drobilla.net/lad/machina@305 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/NodeView.cpp | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/gui/NodeView.cpp (limited to 'src/gui/NodeView.cpp') diff --git a/src/gui/NodeView.cpp b/src/gui/NodeView.cpp new file mode 100644 index 0000000..62be95b --- /dev/null +++ b/src/gui/NodeView.cpp @@ -0,0 +1,54 @@ +/* This file is part of Machina. + * Copyright (C) 2007 Dave Robillard + * + * Machina is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Machina is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "NodeView.hpp" +#include + +NodeView::NodeView(SharedPtr node, + SharedPtr canvas, + const std::string& name, + double x, + double y) + : LibFlowCanvas::Ellipse(canvas, name, x, y, 20, 20, false) + , _node(node) +{ + //signal_double_clicked.connect(sigc::mem_fun(this, &NodeView::on_double_click)); +} + + +void +NodeView::on_double_click(GdkEventButton*) +{ + bool is_initial = _node->is_initial(); + std::cerr << "INITIAL " << is_initial; + _node->set_initial( ! is_initial ); +} + +void +NodeView::update_state() +{ + static const uint32_t active_color = 0x80808AFF; + + if (_node->is_active()) { + if (_color != active_color) { + _old_color = _color; + set_base_color(active_color); + } + } else if (_color == active_color) { + set_base_color(_old_color); + } +} -- cgit v1.2.1