summaryrefslogtreecommitdiffstats
path: root/ganv
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-11-14 04:51:59 +0000
committerDavid Robillard <d@drobilla.net>2012-11-14 04:51:59 +0000
commita1712c2f1ea3e7bc1de99e40bc7f33ab6c92332d (patch)
tree762946d242f7e0827e95ac52fa7c4a5fd1c74058 /ganv
parentdbb57216238de87aaf0486862d0395374af14120 (diff)
downloadganv-a1712c2f1ea3e7bc1de99e40bc7f33ab6c92332d.tar.gz
ganv-a1712c2f1ea3e7bc1de99e40bc7f33ab6c92332d.tar.bz2
ganv-a1712c2f1ea3e7bc1de99e40bc7f33ab6c92332d.zip
Fix wonky edge selection behaviour when selecting ports.
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@4814 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'ganv')
-rw-r--r--ganv/Canvas.hpp21
-rw-r--r--ganv/canvas.h27
-rw-r--r--ganv/node.h3
-rw-r--r--ganv/wrap.hpp5
4 files changed, 41 insertions, 15 deletions
diff --git a/ganv/Canvas.hpp b/ganv/Canvas.hpp
index 00c267c..886102b 100644
--- a/ganv/Canvas.hpp
+++ b/ganv/Canvas.hpp
@@ -72,17 +72,20 @@ public:
METHOD2(ganv_canvas, for_each_node, GanvNodeFunc, f, void*, data)
METHOD2(ganv_canvas, for_each_selected_node, GanvNodeFunc, f, void*, data)
- METHOD2(ganv_canvas, for_each_edge_from,
+ METHOD3(ganv_canvas, for_each_edge_from,
const GanvNode*, tail,
- GanvEdgeFunc, f);
+ GanvEdgeFunc, f,
+ void*, data);
- METHOD2(ganv_canvas, for_each_edge_to,
+ METHOD3(ganv_canvas, for_each_edge_to,
const GanvNode*, head,
- GanvEdgeFunc, f);
+ GanvEdgeFunc, f,
+ void*, data);
- METHOD2(ganv_canvas, for_each_edge_on,
+ METHOD3(ganv_canvas, for_each_edge_on,
const GanvNode*, node,
- GanvEdgeFunc, f);
+ GanvEdgeFunc, f,
+ void*, data);
METHOD0(ganv_canvas, get_move_cursor);
@@ -101,10 +104,8 @@ public:
void remove_edge(Edge* edge);
- typedef void (*EdgePtrFunc)(GanvEdge* edge, void* data);
-
- void for_each_edge(EdgePtrFunc f, void* data);
- void for_each_selected_edge(EdgePtrFunc f, void* data);
+ void for_each_edge(GanvEdgeFunc f, void* data);
+ void for_each_selected_edge(GanvEdgeFunc f, void* data);
void get_scroll_offsets(int& cx, int& cy) const;
void scroll_to(int x, int y);
diff --git a/ganv/canvas.h b/ganv/canvas.h
index bcc2e3d..bac6597 100644
--- a/ganv/canvas.h
+++ b/ganv/canvas.h
@@ -121,9 +121,23 @@ ganv_canvas_arrange(GanvCanvas* canvas);
void
ganv_canvas_export_dot(GanvCanvas* canvas, const char* filename);
-typedef void (*GanvNodeFunc)(GanvNode* node, void* data);
+/**
+ * A node function that takes a user data argument (for callbacks).
+ *
+ * Note that in the Gtk world it is considered safe to cast a function to a
+ * function with more arguments and call the resulting pointer, so functions
+ * like ganv_edge_select can safely be used where a GanvEdgeFunc is expected.
+ */
+typedef void (*GanvEdgeFunc)(GanvEdge* edge, void* data);
-typedef void (*GanvEdgeFunc)(GanvEdge* edge);
+/**
+ * A node function that takes a user data argument (for callbacks).
+ *
+ * Note that in the Gtk world it is considered safe to cast a function to a
+ * function with more arguments and call the resulting pointer, so functions
+ * like ganv_node_select can safely be used where a GanvNodeFunc is expected.
+ */
+typedef void (*GanvNodeFunc)(GanvNode* node, void* data);
/**
* ganv_canvas_for_each_node:
@@ -167,7 +181,8 @@ ganv_canvas_for_each_edge(GanvCanvas* canvas,
void
ganv_canvas_for_each_edge_from(GanvCanvas* canvas,
const GanvNode* tail,
- GanvEdgeFunc f);
+ GanvEdgeFunc f,
+ void* data);
/**
* ganv_canvas_for_each_edge_to:
@@ -178,7 +193,8 @@ ganv_canvas_for_each_edge_from(GanvCanvas* canvas,
void
ganv_canvas_for_each_edge_to(GanvCanvas* canvas,
const GanvNode* head,
- GanvEdgeFunc f);
+ GanvEdgeFunc f,
+ void* data);
/**
* ganv_canvas_for_each_edge_on:
@@ -189,7 +205,8 @@ ganv_canvas_for_each_edge_to(GanvCanvas* canvas,
void
ganv_canvas_for_each_edge_on(GanvCanvas* canvas,
const GanvNode* node,
- GanvEdgeFunc f);
+ GanvEdgeFunc f,
+ void* data);
/**
* ganv_canvas_destroy:
diff --git a/ganv/node.h b/ganv/node.h
index d640167..13c9e5f 100644
--- a/ganv/node.h
+++ b/ganv/node.h
@@ -157,6 +157,9 @@ ganv_node_redraw_text(GanvNode* node);
void
ganv_node_disconnect(GanvNode* node);
+gboolean
+ganv_node_is_selected(GanvNode* node);
+
G_END_DECLS
#endif /* GANV_NODE_H */
diff --git a/ganv/wrap.hpp b/ganv/wrap.hpp
index db871b5..d29740e 100644
--- a/ganv/wrap.hpp
+++ b/ganv/wrap.hpp
@@ -70,6 +70,11 @@
prefix##_##name(gobj(), a1, a2); \
}
+#define METHOD3(prefix, name, t1, a1, t2, a2, t3, a3) \
+ virtual void name(t1 a1, t2 a2, t3 a3) { \
+ prefix##_##name(gobj(), a1, a2, a3); \
+ }
+
#define SIGNAL1(name, argtype) \
public: \
virtual bool on_##name(argtype arg) { \