diff options
-rw-r--r-- | ganv/Canvas.hpp | 61 | ||||
-rw-r--r-- | ganv/Item.hpp | 4 | ||||
-rw-r--r-- | ganv/Module.hpp | 6 | ||||
-rw-r--r-- | ganv/canvas.h | 40 | ||||
-rw-r--r-- | ganv/module.h | 8 | ||||
-rw-r--r-- | ganv/wrap.hpp | 2 | ||||
-rw-r--r-- | src/Canvas.cpp | 58 | ||||
-rw-r--r-- | src/module.c | 6 |
8 files changed, 84 insertions, 101 deletions
diff --git a/ganv/Canvas.hpp b/ganv/Canvas.hpp index 7b38af5..08a1140 100644 --- a/ganv/Canvas.hpp +++ b/ganv/Canvas.hpp @@ -55,70 +55,55 @@ public: Canvas(double width, double height); virtual ~Canvas(); - Gtk::Layout& widget(); - METHOD0(ganv_canvas, destroy); - - /** Get the edge from @c tail to @c head if one exists. */ - Edge* get_edge(Node* tail, Node* head) const; - - /** Delete the edge from @c tail to @c head. */ - void remove_edge(Node* tail, Node* head); - METHOD0(ganv_canvas, clear_selection); METHOD0(ganv_canvas, select_all); - - RW_PROPERTY(gboolean, locked); - METHOD0(ganv_canvas, get_zoom); - METHOD1(ganv_canvas, set_zoom, double, pix_per_unit); METHOD1(ganv_canvas, set_font_size, double, points); METHOD2(ganv_canvas, set_scale, double, zoom, double, points); - METHOD0(ganv_canvas, zoom_full); - METHODRET0(ganv_canvas, double, get_font_size) METHODRET0(ganv_canvas, double, get_default_font_size) - METHOD1(ganv_canvas, export_dot, const char*, filename); - METHOD0(ganv_canvas, arrange); - METHOD2(ganv_canvas, move_contents_to, double, x, double, y); - - RW_PROPERTY(double, width) - RW_PROPERTY(double, height) - METHOD2(ganv_canvas, resize, double, width, double, height); - - RW_PROPERTY(GanvDirection, direction); - - METHOD2(ganv_canvas, for_each_node, - GanvNodeFunction, f, void*, data) - - METHOD2(ganv_canvas, for_each_selected_node, - GanvNodeFunction, f, void*, data) - - typedef void (*EdgePtrFunction)(GanvEdge* edge, void* data); - - void for_each_edge(EdgePtrFunction f, void* data); - void for_each_selected_edge(EdgePtrFunction f, void* data); + 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, const GanvNode*, tail, - GanvEdgeFunction, f); + GanvEdgeFunc, f); METHOD2(ganv_canvas, for_each_edge_to, const GanvNode*, head, - GanvEdgeFunction, f); + GanvEdgeFunc, f); METHOD2(ganv_canvas, for_each_edge_on, const GanvNode*, node, - GanvEdgeFunction, f); + GanvEdgeFunc, f); METHOD0(ganv_canvas, get_move_cursor); + RW_PROPERTY(gboolean, locked); + RW_PROPERTY(double, width) + RW_PROPERTY(double, height) + RW_PROPERTY(GanvDirection, direction); + + Gtk::Layout& widget(); + + /** Get the edge from @c tail to @c head if one exists. */ + Edge* get_edge(Node* tail, Node* head) const; + + /** Delete the edge from @c tail to @c head. */ + void remove_edge(Node* tail, Node* head); + + 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 get_scroll_offsets(int& cx, int& cy) const; void scroll_to(int x, int y); diff --git a/ganv/Item.hpp b/ganv/Item.hpp index 831f402..08ad2d3 100644 --- a/ganv/Item.hpp +++ b/ganv/Item.hpp @@ -70,8 +70,8 @@ public: GanvItem* gobj() const { return _gobj; } - SIGNAL(event, GdkEvent*) - SIGNAL(click, GdkEventButton*) + SIGNAL1(event, GdkEvent*) + SIGNAL1(click, GdkEventButton*) protected: GanvItem* const _gobj; diff --git a/ganv/Module.hpp b/ganv/Module.hpp index f313bb2..6984a70 100644 --- a/ganv/Module.hpp +++ b/ganv/Module.hpp @@ -116,11 +116,9 @@ public: } } - void for_each_port(GanvPortFunction f, void* data) { - ganv_module_for_each_port(gobj(), f, data); - } + METHOD2(ganv_module, for_each_port, GanvPortFunc, f, void*, data); - guint num_ports() const { return ganv_module_num_ports(gobj()); } + METHODRET0(ganv_module, guint, num_ports); RW_PROPERTY(gboolean, stacked) diff --git a/ganv/canvas.h b/ganv/canvas.h index 0b3583a..b7e4dd3 100644 --- a/ganv/canvas.h +++ b/ganv/canvas.h @@ -116,9 +116,9 @@ ganv_canvas_arrange(GanvCanvas* canvas); void ganv_canvas_export_dot(GanvCanvas* canvas, const char* filename); -typedef void (*GanvNodeFunction)(GanvNode* node, void* data); +typedef void (*GanvNodeFunc)(GanvNode* node, void* data); -typedef void (*GanvEdgeFunction)(GanvEdge* edge); +typedef void (*GanvEdgeFunc)(GanvEdge* edge); /** * ganv_canvas_for_each_node: @@ -127,14 +127,14 @@ typedef void (*GanvEdgeFunction)(GanvEdge* edge); * @data: Data to pass to @f. */ void -ganv_canvas_for_each_node(GanvCanvas* canvas, - GanvNodeFunction f, - void* data); +ganv_canvas_for_each_node(GanvCanvas* canvas, + GanvNodeFunc f, + void* data); void -ganv_canvas_for_each_selected_node(GanvCanvas* canvas, - GanvNodeFunction f, - void* data); +ganv_canvas_for_each_selected_node(GanvCanvas* canvas, + GanvNodeFunc f, + void* data); /** * ganv_canvas_for_each_edge: @@ -143,9 +143,9 @@ ganv_canvas_for_each_selected_node(GanvCanvas* canvas, * @data: Data to pass to @f. */ void -ganv_canvas_for_each_edge(GanvCanvas* canvas, - GanvEdgeFunction f, - void* data); +ganv_canvas_for_each_edge(GanvCanvas* canvas, + GanvEdgeFunc f, + void* data); /** * ganv_canvas_for_each_edge_from: @@ -154,9 +154,9 @@ ganv_canvas_for_each_edge(GanvCanvas* canvas, * @f: (scope call): A function to call on every edge leaving @tail. */ void -ganv_canvas_for_each_edge_from(GanvCanvas* canvas, - const GanvNode* tail, - GanvEdgeFunction f); +ganv_canvas_for_each_edge_from(GanvCanvas* canvas, + const GanvNode* tail, + GanvEdgeFunc f); /** * ganv_canvas_for_each_edge_to: @@ -165,9 +165,9 @@ ganv_canvas_for_each_edge_from(GanvCanvas* canvas, * @f: (scope call): A function to call on every edge entering @head. */ void -ganv_canvas_for_each_edge_to(GanvCanvas* canvas, - const GanvNode* head, - GanvEdgeFunction f); +ganv_canvas_for_each_edge_to(GanvCanvas* canvas, + const GanvNode* head, + GanvEdgeFunc f); /** * ganv_canvas_for_each_edge_on: @@ -176,9 +176,9 @@ ganv_canvas_for_each_edge_to(GanvCanvas* canvas, * @f: (scope call): A function to call on every edge attached to @node. */ void -ganv_canvas_for_each_edge_on(GanvCanvas* canvas, - const GanvNode* node, - GanvEdgeFunction f); +ganv_canvas_for_each_edge_on(GanvCanvas* canvas, + const GanvNode* node, + GanvEdgeFunc f); /** * ganv_canvas_destroy: diff --git a/ganv/module.h b/ganv/module.h index 375be67..31b76b1 100644 --- a/ganv/module.h +++ b/ganv/module.h @@ -33,7 +33,7 @@ G_BEGIN_DECLS typedef struct _GanvModuleClass GanvModuleClass; typedef struct _GanvModuleImpl GanvModuleImpl; -typedef void (*GanvPortFunction)(GanvPort* port, void* data); +typedef void (*GanvPortFunc)(GanvPort* port, void* data); struct _GanvModule { GanvBox box; @@ -86,9 +86,9 @@ ganv_module_set_direction(GanvModule* module, * @data: User data to pass to @f. */ void -ganv_module_for_each_port(GanvModule* module, - GanvPortFunction f, - void* data); +ganv_module_for_each_port(GanvModule* module, + GanvPortFunc f, + void* data); G_END_DECLS diff --git a/ganv/wrap.hpp b/ganv/wrap.hpp index 353c700..f0b95bb 100644 --- a/ganv/wrap.hpp +++ b/ganv/wrap.hpp @@ -70,7 +70,7 @@ prefix##_##name(gobj(), a1, a2); \ } -#define SIGNAL(name, argtype) \ +#define SIGNAL1(name, argtype) \ public: \ virtual bool on_##name(argtype arg) { \ return _signal_##name.emit(arg); \ diff --git a/src/Canvas.cpp b/src/Canvas.cpp index ee0cc0c..2d12c17 100644 --- a/src/Canvas.cpp +++ b/src/Canvas.cpp @@ -166,10 +166,10 @@ struct GanvCanvasImpl { void set_zoom_and_font_size(double zoom, double points); - void for_each_node(GanvNodeFunction f, void* data); - void for_each_edge_from(const GanvNode* tail, GanvEdgeFunction f); - void for_each_edge_to(const GanvNode* head, GanvEdgeFunction f); - void for_each_edge_on(const GanvNode* node, GanvEdgeFunction f); + void for_each_node(GanvNodeFunc f, void* data); + void for_each_edge_from(const GanvNode* tail, GanvEdgeFunc f); + void for_each_edge_to(const GanvNode* head, GanvEdgeFunc f); + void for_each_edge_on(const GanvNode* node, GanvEdgeFunc f); void add_item(GanvNode* i); bool remove_item(GanvNode* i); @@ -1292,8 +1292,8 @@ GanvCanvasImpl::move_contents_to_internal(double x, double y, double min_x, doub } void -GanvCanvasImpl::for_each_node(GanvNodeFunction f, - void* data) +GanvCanvasImpl::for_each_node(GanvNodeFunc f, + void* data) { FOREACH_ITEM(_items, i) { f(*i, data); @@ -1301,8 +1301,8 @@ GanvCanvasImpl::for_each_node(GanvNodeFunction f, } void -GanvCanvasImpl::for_each_edge_from(const GanvNode* tail, - GanvEdgeFunction f) +GanvCanvasImpl::for_each_edge_from(const GanvNode* tail, + GanvEdgeFunc f) { for (GanvCanvasImpl::Edges::const_iterator i = first_edge_from(tail); i != _edges.end() && (*i)->impl->tail == tail;) { @@ -1314,8 +1314,8 @@ GanvCanvasImpl::for_each_edge_from(const GanvNode* tail, } void -GanvCanvasImpl::for_each_edge_to(const GanvNode* head, - GanvEdgeFunction f) +GanvCanvasImpl::for_each_edge_to(const GanvNode* head, + GanvEdgeFunc f) { for (GanvCanvasImpl::Edges::const_iterator i = first_edge_to(head); i != _dst_edges.end() && (*i)->impl->head == head;) { @@ -1327,8 +1327,8 @@ GanvCanvasImpl::for_each_edge_to(const GanvNode* head, } void -GanvCanvasImpl::for_each_edge_on(const GanvNode* node, - GanvEdgeFunction f) +GanvCanvasImpl::for_each_edge_on(const GanvNode* node, + GanvEdgeFunc f) { for_each_edge_from(node, f); for_each_edge_to(node, f); @@ -1469,7 +1469,7 @@ Canvas::get_edge(Node* tail, Node* head) const } void -Canvas::for_each_edge(EdgePtrFunction f, void* data) +Canvas::for_each_edge(EdgePtrFunc f, void* data) { FOREACH_EDGE(impl()->_edges, i) { f((*i), data); @@ -1477,7 +1477,7 @@ Canvas::for_each_edge(EdgePtrFunction f, void* data) } void -Canvas::for_each_selected_edge(EdgePtrFunction f, void* data) +Canvas::for_each_selected_edge(EdgePtrFunc f, void* data) { FOREACH_EDGE(impl()->_selected_edges, i) { f((*i), data); @@ -1912,17 +1912,17 @@ ganv_canvas_unselect_edge(GanvCanvas* canvas, } void -ganv_canvas_for_each_node(GanvCanvas* canvas, - GanvNodeFunction f, - void* data) +ganv_canvas_for_each_node(GanvCanvas* canvas, + GanvNodeFunc f, + void* data) { canvas->impl->for_each_node(f, data); } void -ganv_canvas_for_each_selected_node(GanvCanvas* canvas, - GanvNodeFunction f, - void* data) +ganv_canvas_for_each_selected_node(GanvCanvas* canvas, + GanvNodeFunc f, + void* data) { FOREACH_ITEM(canvas->impl->_selected_items, i) { f(*i, data); @@ -1930,25 +1930,25 @@ ganv_canvas_for_each_selected_node(GanvCanvas* canvas, } void -ganv_canvas_for_each_edge_from(GanvCanvas* canvas, - const GanvNode* tail, - GanvEdgeFunction f) +ganv_canvas_for_each_edge_from(GanvCanvas* canvas, + const GanvNode* tail, + GanvEdgeFunc f) { canvas->impl->for_each_edge_from(tail, f); } void -ganv_canvas_for_each_edge_to(GanvCanvas* canvas, - const GanvNode* head, - GanvEdgeFunction f) +ganv_canvas_for_each_edge_to(GanvCanvas* canvas, + const GanvNode* head, + GanvEdgeFunc f) { canvas->impl->for_each_edge_to(head, f); } void -ganv_canvas_for_each_edge_on(GanvCanvas* canvas, - const GanvNode* node, - GanvEdgeFunction f) +ganv_canvas_for_each_edge_on(GanvCanvas* canvas, + const GanvNode* node, + GanvEdgeFunc f) { canvas->impl->for_each_edge_on(node, f); } diff --git a/src/module.c b/src/module.c index ba16fd7..7a45908 100644 --- a/src/module.c +++ b/src/module.c @@ -826,9 +826,9 @@ ganv_module_set_direction(GanvModule* module, } void -ganv_module_for_each_port(GanvModule* module, - GanvPortFunction f, - void* data) +ganv_module_for_each_port(GanvModule* module, + GanvPortFunc f, + void* data) { GanvModuleImpl* impl = module->impl; const int len = impl->ports->len; |