aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-02-12 03:52:47 +0000
committerDavid Robillard <d@drobilla.net>2007-02-12 03:52:47 +0000
commita795ba2553d1663bc29b8e8fa3186efb516f27d4 (patch)
tree16f03f2ed3d1560f2af89b8e5ba4e85612cc6b30
parent547d2e751fe03b6c2e81beef8fad27a31b5905e8 (diff)
downloadmachina-a795ba2553d1663bc29b8e8fa3186efb516f27d4.tar.gz
machina-a795ba2553d1663bc29b8e8fa3186efb516f27d4.tar.bz2
machina-a795ba2553d1663bc29b8e8fa3186efb516f27d4.zip
Added missing files.
git-svn-id: http://svn.drobilla.net/lad/machina@305 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/gui/NodeView.cpp54
-rw-r--r--src/gui/NodeView.hpp45
2 files changed, 99 insertions, 0 deletions
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 <http://drobilla.net>
+ *
+ * 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 <iostream>
+
+NodeView::NodeView(SharedPtr<Machina::Node> node,
+ SharedPtr<LibFlowCanvas::FlowCanvas> 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);
+ }
+}
diff --git a/src/gui/NodeView.hpp b/src/gui/NodeView.hpp
new file mode 100644
index 0000000..ae5c34e
--- /dev/null
+++ b/src/gui/NodeView.hpp
@@ -0,0 +1,45 @@
+/* This file is part of Machina.
+ * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
+ *
+ * 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
+ */
+
+#ifndef MACHINA_NODEVIEW_H
+#define MACHINA_NODEVIEW_H
+
+#include <flowcanvas/Ellipse.h>
+#include "machina/Node.hpp"
+
+
+class NodeView : public LibFlowCanvas::Ellipse {
+public:
+ NodeView(SharedPtr<Machina::Node> node,
+ SharedPtr<LibFlowCanvas::FlowCanvas> canvas,
+ const std::string& name,
+ double x,
+ double y);
+
+ SharedPtr<Machina::Node> node() { return _node; }
+
+ void update_state();
+
+private:
+ void on_double_click(GdkEventButton* ev);
+
+ SharedPtr<Machina::Node> _node;
+ uint32_t _old_color;
+};
+
+
+#endif // MACHINA_NODEVIEW_H