aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-12-03 04:53:27 +0000
committerDavid Robillard <d@drobilla.net>2007-12-03 04:53:27 +0000
commit1760218d029892fc9ba3b25e06479cce319f20a0 (patch)
treece18c686f22df09da44e5ff42219213cee5b7557 /src
parentdc7462b087b364a97b5e4a562f78872d473390d2 (diff)
downloadmachina-1760218d029892fc9ba3b25e06479cce319f20a0.tar.gz
machina-1760218d029892fc9ba3b25e06479cce319f20a0.tar.bz2
machina-1760218d029892fc9ba3b25e06479cce319f20a0.zip
Use dashed outline for selector nodes.
Fix various selector node visual problems. git-svn-id: http://svn.drobilla.net/lad/machina@942 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/gui/MachinaCanvas.cpp5
-rw-r--r--src/gui/MachinaCanvas.hpp6
-rw-r--r--src/gui/NodeView.cpp32
-rw-r--r--src/gui/NodeView.hpp1
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;