diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/MachinaCanvas.cpp | 5 | ||||
-rw-r--r-- | src/gui/MachinaCanvas.hpp | 6 | ||||
-rw-r--r-- | src/gui/NodeView.cpp | 32 | ||||
-rw-r--r-- | src/gui/NodeView.hpp | 1 |
4 files changed, 34 insertions, 10 deletions
diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp index 3524035..e899a64 100644 --- a/src/gui/MachinaCanvas.cpp +++ b/src/gui/MachinaCanvas.cpp @@ -31,8 +31,9 @@ using namespace FlowCanvas; MachinaCanvas::MachinaCanvas(MachinaGUI* app, int width, int height) -: Canvas(width, height), - _app(app) + : Canvas(width, height) + , _app(app) + , _selector_dash(NULL) { grab_focus(); } diff --git a/src/gui/MachinaCanvas.hpp b/src/gui/MachinaCanvas.hpp index 9e20051..63c88fd 100644 --- a/src/gui/MachinaCanvas.hpp +++ b/src/gui/MachinaCanvas.hpp @@ -42,6 +42,8 @@ public: void build(SharedPtr<Machina::Machine> machine); + ArtVpathDash* selector_dash() { return _selector_dash; } + protected: bool canvas_event(GdkEvent* event); @@ -50,8 +52,8 @@ protected: private: SharedPtr<NodeView> create_node_view(SharedPtr<Machina::Node> node); - MachinaGUI* _app; - + MachinaGUI* _app; + ArtVpathDash* _selector_dash; WeakPtr<NodeView> _last_clicked; }; diff --git a/src/gui/NodeView.cpp b/src/gui/NodeView.cpp index fc9b0bb..61f1858 100644 --- a/src/gui/NodeView.cpp +++ b/src/gui/NodeView.cpp @@ -22,7 +22,6 @@ using namespace std; - NodeView::NodeView(Gtk::Window* window, SharedPtr<FlowCanvas::Canvas> canvas, SharedPtr<Machina::Node> node, @@ -85,6 +84,31 @@ NodeView::show_label(bool show) } +/// Dash style for selector node outlines +static ArtVpathDash* selector_dash() +{ + static ArtVpathDash* selector_dash = NULL; + + if (!selector_dash) { + selector_dash = new ArtVpathDash(); + selector_dash->n_dash = 2; + selector_dash->dash = art_new(double, 2); + selector_dash->dash[0] = 8; + selector_dash->dash[1] = 8; + } + + return selector_dash; +} + +void +NodeView::set_selected(bool selected) +{ + Ellipse::set_selected(selected); + if (!selected) + _ellipse.property_dash() = _node->is_selector() ? selector_dash() : 0; +} + + void NodeView::update_state(bool show_labels) { @@ -102,11 +126,7 @@ NodeView::update_state(bool show_labels) set_border_color(_default_border_color); } - if (_node->is_selector()) - if (_node->is_active()) - set_base_color(0x00FF00FF); - else - set_base_color(0x00A000FF); + _ellipse.property_dash() = _node->is_selector() ? selector_dash() : 0; set_border_width(_node->is_initial() ? 4.0 : 1.0); diff --git a/src/gui/NodeView.hpp b/src/gui/NodeView.hpp index bc94efa..02b34e6 100644 --- a/src/gui/NodeView.hpp +++ b/src/gui/NodeView.hpp @@ -40,6 +40,7 @@ public: private: void handle_click(GdkEventButton* ev); void on_double_click(GdkEventButton* ev); + void set_selected(bool selected); Gtk::Window* _window; SharedPtr<Machina::Node> _node; |