From 4a2ad4c2bd0d4e96a2844272681a5560733a91b6 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 1 Dec 2011 23:08:55 +0000 Subject: Move color stuff down to C level. git-svn-id: http://svn.drobilla.net/lad/trunk/machina@3733 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/MachinaCanvas.cpp | 4 ++-- src/gui/NodeView.cpp | 21 +++++++++++++-------- src/gui/NodeView.hpp | 4 +++- 3 files changed, 18 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp index b0ea6b4..b961a0c 100644 --- a/src/gui/MachinaCanvas.cpp +++ b/src/gui/MachinaCanvas.cpp @@ -67,12 +67,12 @@ MachinaCanvas::node_clicked(WeakPtr item, GdkEventButton* event) action_connect(last, node); } - last->set_default_base_color(); + last->set_default_colors(); _last_clicked.reset(); } else { _last_clicked = node; - node->set_base_color(0xFF0000FF); + node->set_fill_color(0xFF0000FF); } return true; diff --git a/src/gui/NodeView.cpp b/src/gui/NodeView.cpp index 4e27594..407961c 100644 --- a/src/gui/NodeView.cpp +++ b/src/gui/NodeView.cpp @@ -37,8 +37,8 @@ NodeView::NodeView(Gtk::Window* window, : FlowCanvas::Ellipse(canvas, "", x, y, 20, 20, false) , _window(window) , _node(node) - , _default_border_color(_border_color) - , _old_color(_color) + , _default_border_color(get_border_color()) + , _default_fill_color(get_fill_color()) { signal_click().connect( sigc::mem_fun(this, &NodeView::on_click)); @@ -133,14 +133,12 @@ NodeView::on_property(Machina::URIInt key, const Raul::Atom& value) set_border_width(value.get_bool() ? 4.0 : 1.0); } else if (key == URIs::instance().machina_active) { if (value.get_bool()) { - if (_color != active_color) { - _old_color = _color; - set_base_color(active_color); + if (get_fill_color() != active_color) { + set_fill_color(active_color); set_border_color(active_border_color); } - } else if (_color == active_color) { - set_base_color(_old_color); - set_border_color(_default_border_color); + } else if (get_fill_color() == active_color) { + set_default_colors(); } } else if (key == URIs::instance().machina_enter_action) { const uint64_t action_id = value.get_int32(); @@ -160,3 +158,10 @@ NodeView::on_action_property(Machina::URIInt key, const Raul::Atom& value) if (key == URIs::instance().machina_note_number) show_label(true); } + +void +NodeView::set_default_colors() +{ + set_fill_color(_default_fill_color); + set_border_color(_default_border_color); +} diff --git a/src/gui/NodeView.hpp b/src/gui/NodeView.hpp index 9b827c1..b37b73b 100644 --- a/src/gui/NodeView.hpp +++ b/src/gui/NodeView.hpp @@ -40,6 +40,8 @@ public: void update_state(bool show_labels); + void set_default_colors(); + private: bool on_click(GdkEventButton* ev); void on_double_click(GdkEventButton* ev); @@ -52,7 +54,7 @@ private: Gtk::Window* _window; SharedPtr _node; uint32_t _default_border_color; - uint32_t _old_color; + uint32_t _default_fill_color; SharedPtr _enter_action; sigc::connection _enter_action_connection; -- cgit v1.2.1