summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ganv/canvas.h4
-rw-r--r--src/box.c18
-rw-r--r--src/canvas-base.c28
-rw-r--r--src/circle.c14
-rw-r--r--src/edge.c12
-rw-r--r--src/ganv-private.h11
-rw-r--r--src/ganv_bench.cpp8
-rw-r--r--src/group.c28
-rw-r--r--src/module.c16
-rw-r--r--src/node.c35
-rw-r--r--src/port.c18
-rw-r--r--src/text.c12
-rw-r--r--src/widget.c14
13 files changed, 103 insertions, 115 deletions
diff --git a/ganv/canvas.h b/ganv/canvas.h
index edf39f6..bcc2e3d 100644
--- a/ganv/canvas.h
+++ b/ganv/canvas.h
@@ -81,6 +81,10 @@ void
ganv_canvas_add_node(GanvCanvas* canvas,
GanvNode* node);
+void
+ganv_canvas_remove_node(GanvCanvas* canvas,
+ GanvNode* node);
+
/**
* ganv_canvas_get_edge:
* Get the edge between two nodes, or NULL if none exists.
diff --git a/src/box.c b/src/box.c
index f3d65cd..c41f5ed 100644
--- a/src/box.c
+++ b/src/box.c
@@ -369,16 +369,16 @@ ganv_box_default_set_height(GanvBox* box,
}
static void
-ganv_box_class_init(GanvBoxClass* class)
+ganv_box_class_init(GanvBoxClass* klass)
{
- GObjectClass* gobject_class = (GObjectClass*)class;
- GtkObjectClass* object_class = (GtkObjectClass*)class;
- GanvItemClass* item_class = (GanvItemClass*)class;
- GanvNodeClass* node_class = (GanvNodeClass*)class;
+ GObjectClass* gobject_class = (GObjectClass*)klass;
+ GtkObjectClass* object_class = (GtkObjectClass*)klass;
+ GanvItemClass* item_class = (GanvItemClass*)klass;
+ GanvNodeClass* node_class = (GanvNodeClass*)klass;
- parent_class = GANV_NODE_CLASS(g_type_class_peek_parent(class));
+ parent_class = GANV_NODE_CLASS(g_type_class_peek_parent(klass));
- g_type_class_add_private(class, sizeof(GanvBoxImpl));
+ g_type_class_add_private(klass, sizeof(GanvBoxImpl));
gobject_class->set_property = ganv_box_set_property;
gobject_class->get_property = ganv_box_get_property;
@@ -472,8 +472,8 @@ ganv_box_class_init(GanvBoxClass* class)
node_class->is_within = ganv_box_is_within;
- class->set_width = ganv_box_default_set_width;
- class->set_height = ganv_box_default_set_height;
+ klass->set_width = ganv_box_default_set_width;
+ klass->set_height = ganv_box_default_set_height;
}
void
diff --git a/src/canvas-base.c b/src/canvas-base.c
index 0c070be..76e34e0 100644
--- a/src/canvas-base.c
+++ b/src/canvas-base.c
@@ -62,9 +62,7 @@ enum {
ITEM_LAST_SIGNAL
};
-static void ganv_item_class_init(GanvItemClass* class);
-static void ganv_item_init(GanvItem* item);
-static int emit_event(GanvCanvasBase* canvas, GdkEvent* event);
+static int emit_event(GanvCanvasBase* canvas, GdkEvent* event);
static guint item_signals[ITEM_LAST_SIGNAL];
@@ -845,8 +843,6 @@ enum {
LAST_SIGNAL
};
-static void ganv_canvas_base_class_init(GanvCanvasBaseClass* class);
-static void ganv_canvas_base_init(GanvCanvasBase* canvas);
static void ganv_canvas_base_destroy(GtkObject* object);
static void ganv_canvas_base_map(GtkWidget* widget);
static void ganv_canvas_base_unmap(GtkWidget* widget);
@@ -2405,7 +2401,7 @@ ganv_canvas_base_request_redraw(GanvCanvasBase* canvas, int x1, int y1, int x2,
return;
}
- IRect* r = g_malloc(sizeof(IRect));
+ IRect* r = (IRect*)g_malloc(sizeof(IRect));
*r = rect;
canvas->redraw_region = g_slist_prepend(canvas->redraw_region, r);
@@ -2600,13 +2596,13 @@ boolean_handled_accumulator(GSignalInvocationHint* ihint,
/* Class initialization function for GanvItemClass */
static void
-ganv_item_class_init(GanvItemClass* class)
+ganv_item_class_init(GanvItemClass* klass)
{
GObjectClass* gobject_class;
- gobject_class = (GObjectClass*)class;
+ gobject_class = (GObjectClass*)klass;
- item_parent_class = g_type_class_peek_parent(class);
+ item_parent_class = (GtkObjectClass*)g_type_class_peek_parent(klass);
gobject_class->set_property = ganv_item_set_property;
gobject_class->get_property = ganv_item_get_property;
@@ -2642,7 +2638,7 @@ ganv_item_class_init(GanvItemClass* class)
item_signals[ITEM_EVENT]
= g_signal_new("event",
- G_TYPE_FROM_CLASS(class),
+ G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GanvItemClass, event),
boolean_handled_accumulator, NULL,
@@ -2652,10 +2648,10 @@ ganv_item_class_init(GanvItemClass* class)
gobject_class->dispose = ganv_item_dispose;
- class->realize = ganv_item_realize;
- class->unrealize = ganv_item_unrealize;
- class->map = ganv_item_map;
- class->unmap = ganv_item_unmap;
- class->update = ganv_item_update;
- class->point = ganv_item_point;
+ klass->realize = ganv_item_realize;
+ klass->unrealize = ganv_item_unrealize;
+ klass->map = ganv_item_map;
+ klass->unmap = ganv_item_unmap;
+ klass->update = ganv_item_update;
+ klass->point = ganv_item_point;
}
diff --git a/src/circle.c b/src/circle.c
index 6010dc2..1d1e032 100644
--- a/src/circle.c
+++ b/src/circle.c
@@ -308,16 +308,16 @@ ganv_circle_point(GanvItem* item,
}
static void
-ganv_circle_class_init(GanvCircleClass* class)
+ganv_circle_class_init(GanvCircleClass* klass)
{
- GObjectClass* gobject_class = (GObjectClass*)class;
- GtkObjectClass* object_class = (GtkObjectClass*)class;
- GanvItemClass* item_class = (GanvItemClass*)class;
- GanvNodeClass* node_class = (GanvNodeClass*)class;
+ GObjectClass* gobject_class = (GObjectClass*)klass;
+ GtkObjectClass* object_class = (GtkObjectClass*)klass;
+ GanvItemClass* item_class = (GanvItemClass*)klass;
+ GanvNodeClass* node_class = (GanvNodeClass*)klass;
- parent_class = GANV_NODE_CLASS(g_type_class_peek_parent(class));
+ parent_class = GANV_NODE_CLASS(g_type_class_peek_parent(klass));
- g_type_class_add_private(class, sizeof(GanvCircleImpl));
+ g_type_class_add_private(klass, sizeof(GanvCircleImpl));
gobject_class->set_property = ganv_circle_set_property;
gobject_class->get_property = ganv_circle_get_property;
diff --git a/src/edge.c b/src/edge.c
index 1a726c8..871498a 100644
--- a/src/edge.c
+++ b/src/edge.c
@@ -466,15 +466,15 @@ ganv_edge_is_within(const GanvEdge* edge,
}
static void
-ganv_edge_class_init(GanvEdgeClass* class)
+ganv_edge_class_init(GanvEdgeClass* klass)
{
- GObjectClass* gobject_class = (GObjectClass*)class;
- GtkObjectClass* object_class = (GtkObjectClass*)class;
- GanvItemClass* item_class = (GanvItemClass*)class;
+ GObjectClass* gobject_class = (GObjectClass*)klass;
+ GtkObjectClass* object_class = (GtkObjectClass*)klass;
+ GanvItemClass* item_class = (GanvItemClass*)klass;
- parent_class = GANV_ITEM_CLASS(g_type_class_peek_parent(class));
+ parent_class = GANV_ITEM_CLASS(g_type_class_peek_parent(klass));
- g_type_class_add_private(class, sizeof(GanvEdgeImpl));
+ g_type_class_add_private(klass, sizeof(GanvEdgeImpl));
gobject_class->set_property = ganv_edge_set_property;
gobject_class->get_property = ganv_edge_get_property;
diff --git a/src/ganv-private.h b/src/ganv-private.h
index 4c2a56d..a5d7047 100644
--- a/src/ganv-private.h
+++ b/src/ganv-private.h
@@ -150,14 +150,6 @@ struct _GanvTextImpl
/* Canvas */
void
-ganv_canvas_add_node(GanvCanvas* canvas,
- GanvNode* node);
-
-void
-ganv_canvas_remove_node(GanvCanvas* canvas,
- GanvNode* node);
-
-void
ganv_canvas_move_selected_items(GanvCanvas* canvas,
double dx,
double dy);
@@ -189,9 +181,6 @@ void
ganv_canvas_unselect_edge(GanvCanvas* canvas,
GanvEdge* edge);
-GdkCursor*
-ganv_canvas_get_move_cursor(const GanvCanvas* canvas);
-
gboolean
ganv_canvas_port_event(GanvCanvas* canvas,
GanvPort* port,
diff --git a/src/ganv_bench.cpp b/src/ganv_bench.cpp
index b4bda63..ee2ebfc 100644
--- a/src/ganv_bench.cpp
+++ b/src/ganv_bench.cpp
@@ -31,7 +31,7 @@ static const int MAX_NUM_PORTS = 16;
vector<Node*> ins;
vector<Node*> outs;
-Module*
+static Module*
make_module(Canvas* canvas)
{
char name[8];
@@ -62,7 +62,7 @@ make_module(Canvas* canvas)
return m;
}
-Circle*
+static Circle*
make_circle(Canvas* canvas)
{
char name[8];
@@ -80,14 +80,14 @@ make_circle(Canvas* canvas)
return e;
}
-bool
+static bool
quit()
{
Gtk::Main::quit();
return true;
}
-int
+static int
print_usage(const char* name)
{
fprintf(stderr,
diff --git a/src/group.c b/src/group.c
index 160c755..cd5e912 100644
--- a/src/group.c
+++ b/src/group.c
@@ -100,7 +100,7 @@ ganv_group_update(GanvItem* item, int flags)
double max_y = 0.0;
for (list = group->item_list; list; list = list->next) {
- i = list->data;
+ i = (GanvItem*)list->data;
ganv_item_invoke_update(i, flags);
@@ -125,7 +125,7 @@ ganv_group_realize(GanvItem* item)
group = GANV_GROUP(item);
for (list = group->item_list; list; list = list->next) {
- i = list->data;
+ i = (GanvItem*)list->data;
if (!(i->object.flags & GANV_ITEM_REALIZED)) {
(*GANV_ITEM_GET_CLASS(i)->realize)(i);
@@ -145,7 +145,7 @@ ganv_group_unrealize(GanvItem* item)
group = GANV_GROUP(item);
for (list = group->item_list; list; list = list->next) {
- i = list->data;
+ i = (GanvItem*)list->data;
if (i->object.flags & GANV_ITEM_REALIZED) {
(*GANV_ITEM_GET_CLASS(i)->unrealize)(i);
@@ -165,7 +165,7 @@ ganv_group_map(GanvItem* item)
group = GANV_GROUP(item);
for (list = group->item_list; list; list = list->next) {
- i = list->data;
+ i = (GanvItem*)list->data;
if (!(i->object.flags & GANV_ITEM_MAPPED)) {
(*GANV_ITEM_GET_CLASS(i)->map)(i);
@@ -185,7 +185,7 @@ ganv_group_unmap(GanvItem* item)
group = GANV_GROUP(item);
for (list = group->item_list; list; list = list->next) {
- i = list->data;
+ i = (GanvItem*)list->data;
if (i->object.flags & GANV_ITEM_MAPPED) {
(*GANV_ITEM_GET_CLASS(i)->unmap)(i);
@@ -211,7 +211,7 @@ ganv_group_draw(GanvItem* item, cairo_t* cr,
cairo_fill(cr);
for (list = group->item_list; list; list = list->next) {
- child = list->data;
+ child = (GanvItem*)list->data;
if (((child->object.flags & GANV_ITEM_VISIBLE)
&& ((child->x1 < (x + width))
@@ -259,7 +259,7 @@ ganv_group_point(GanvItem* item, double x, double y, int cx, int cy,
dist = 0.0; /* keep gcc happy */
for (list = group->item_list; list; list = list->next) {
- child = list->data;
+ child = (GanvItem*)list->data;
if ((child->x1 > x2) || (child->y1 > y2) || (child->x2 < x1) || (child->y2 < y1)) {
continue;
@@ -315,7 +315,7 @@ ganv_group_bounds(GanvItem* item, double* x1, double* y1, double* x2, double* y2
set = FALSE;
for (list = group->item_list; list; list = list->next) {
- child = list->data;
+ child = (GanvItem*)list->data;
if (child->object.flags & GANV_ITEM_VISIBLE) {
set = TRUE;
@@ -336,7 +336,7 @@ ganv_group_bounds(GanvItem* item, double* x1, double* y1, double* x2, double* y2
list = list->next;
for (; list; list = list->next) {
- child = list->data;
+ child = (GanvItem*)list->data;
if (!(child->object.flags & GANV_ITEM_VISIBLE)) {
continue;
@@ -429,17 +429,17 @@ ganv_group_remove(GanvItem* parent, GanvItem* item)
}
static void
-ganv_group_class_init(GanvGroupClass* class)
+ganv_group_class_init(GanvGroupClass* klass)
{
GObjectClass* gobject_class;
GtkObjectClass* object_class;
GanvItemClass* item_class;
- gobject_class = (GObjectClass*)class;
- object_class = (GtkObjectClass*)class;
- item_class = (GanvItemClass*)class;
+ gobject_class = (GObjectClass*)klass;
+ object_class = (GtkObjectClass*)klass;
+ item_class = (GanvItemClass*)klass;
- group_parent_class = g_type_class_peek_parent(class);
+ group_parent_class = (GanvItemClass*)g_type_class_peek_parent(klass);
gobject_class->set_property = ganv_group_set_property;
gobject_class->get_property = ganv_group_get_property;
diff --git a/src/module.c b/src/module.c
index 83d127b..be79d88 100644
--- a/src/module.c
+++ b/src/module.c
@@ -659,16 +659,16 @@ ganv_module_point(GanvItem* item,
}
static void
-ganv_module_class_init(GanvModuleClass* class)
+ganv_module_class_init(GanvModuleClass* klass)
{
- GObjectClass* gobject_class = (GObjectClass*)class;
- GtkObjectClass* object_class = (GtkObjectClass*)class;
- GanvItemClass* item_class = (GanvItemClass*)class;
- GanvNodeClass* node_class = (GanvNodeClass*)class;
+ GObjectClass* gobject_class = (GObjectClass*)klass;
+ GtkObjectClass* object_class = (GtkObjectClass*)klass;
+ GanvItemClass* item_class = (GanvItemClass*)klass;
+ GanvNodeClass* node_class = (GanvNodeClass*)klass;
- parent_class = GANV_BOX_CLASS(g_type_class_peek_parent(class));
+ parent_class = GANV_BOX_CLASS(g_type_class_peek_parent(klass));
- g_type_class_add_private(class, sizeof(GanvModuleImpl));
+ g_type_class_add_private(klass, sizeof(GanvModuleImpl));
gobject_class->set_property = ganv_module_set_property;
gobject_class->get_property = ganv_module_get_property;
@@ -712,7 +712,7 @@ GanvPort*
ganv_module_get_port(GanvModule* module,
guint index)
{
- return g_ptr_array_index(module->impl->ports, index);
+ return (GanvPort*)g_ptr_array_index(module->impl->ports, index);
}
double
diff --git a/src/node.c b/src/node.c
index 85415d8..5886dba 100644
--- a/src/node.c
+++ b/src/node.c
@@ -128,7 +128,6 @@ ganv_node_set_property(GObject* object,
GanvNode* node = GANV_NODE(object);
GanvNodeImpl* impl = node->impl;
- GanvItem* item = GANV_ITEM(object);
switch (prop_id) {
SET_CASE(PARTNER, object, impl->partner);
@@ -143,6 +142,7 @@ ganv_node_set_property(GObject* object,
SET_CASE(DRAGGABLE, boolean, impl->draggable);
case PROP_SELECTED:
if (impl->selected != g_value_get_boolean(value)) {
+ GanvItem* item = GANV_ITEM(object);
impl->selected = g_value_get_boolean(value);
if (item->canvas) {
if (impl->selected) {
@@ -155,7 +155,7 @@ ganv_node_set_property(GObject* object,
}
break;
case PROP_CANVAS:
- if (!item->parent) {
+ if (!GANV_ITEM(object)->parent) {
GanvCanvasBase* canvas = GANV_CANVAS_BASE(g_value_get_object(value));
g_object_set(object, "parent", ganv_canvas_base_root(canvas), NULL);
ganv_canvas_add_node(GANV_CANVAS(canvas), node);
@@ -186,7 +186,6 @@ ganv_node_get_property(GObject* object,
GanvNode* node = GANV_NODE(object);
GanvNodeImpl* impl = node->impl;
- GanvItem* item = GANV_ITEM(object);
typedef char* gstring;
@@ -204,7 +203,7 @@ ganv_node_get_property(GObject* object,
GET_CASE(HIGHLIGHTED, boolean, impl->highlighted);
GET_CASE(DRAGGABLE, boolean, impl->draggable);
case PROP_CANVAS:
- g_value_set_object(value, item->canvas);
+ g_value_set_object(value, GANV_ITEM(object)->canvas);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
@@ -519,15 +518,15 @@ ganv_node_default_event(GanvItem* item,
}
static void
-ganv_node_class_init(GanvNodeClass* class)
+ganv_node_class_init(GanvNodeClass* klass)
{
- GObjectClass* gobject_class = (GObjectClass*)class;
- GtkObjectClass* object_class = (GtkObjectClass*)class;
- GanvItemClass* item_class = (GanvItemClass*)class;
+ GObjectClass* gobject_class = (GObjectClass*)klass;
+ GtkObjectClass* object_class = (GtkObjectClass*)klass;
+ GanvItemClass* item_class = (GanvItemClass*)klass;
- parent_class = GANV_ITEM_CLASS(g_type_class_peek_parent(class));
+ parent_class = GANV_ITEM_CLASS(g_type_class_peek_parent(klass));
- g_type_class_add_private(class, sizeof(GanvNodeImpl));
+ g_type_class_add_private(klass, sizeof(GanvNodeImpl));
gobject_class->set_property = ganv_node_set_property;
gobject_class->get_property = ganv_node_get_property;
@@ -671,14 +670,14 @@ ganv_node_class_init(GanvNodeClass* class)
item_class->event = ganv_node_default_event;
item_class->draw = ganv_node_draw;
- class->disconnect = ganv_node_default_disconnect;
- class->move = ganv_node_default_move;
- class->move_to = ganv_node_default_move_to;
- class->resize = ganv_node_default_resize;
- class->redraw_text = ganv_node_default_redraw_text;
- class->tick = ganv_node_default_tick;
- class->tail_vector = ganv_node_default_tail_vector;
- class->head_vector = ganv_node_default_head_vector;
+ klass->disconnect = ganv_node_default_disconnect;
+ klass->move = ganv_node_default_move;
+ klass->move_to = ganv_node_default_move_to;
+ klass->resize = ganv_node_default_resize;
+ klass->redraw_text = ganv_node_default_redraw_text;
+ klass->tick = ganv_node_default_tick;
+ klass->tail_vector = ganv_node_default_tail_vector;
+ klass->head_vector = ganv_node_default_head_vector;
}
gboolean
diff --git a/src/port.c b/src/port.c
index 8b234bf..f2594a2 100644
--- a/src/port.c
+++ b/src/port.c
@@ -271,17 +271,17 @@ ganv_port_event(GanvItem* item, GdkEvent* event)
}
static void
-ganv_port_class_init(GanvPortClass* class)
+ganv_port_class_init(GanvPortClass* klass)
{
- GObjectClass* gobject_class = (GObjectClass*)class;
- GtkObjectClass* object_class = (GtkObjectClass*)class;
- GanvItemClass* item_class = (GanvItemClass*)class;
- GanvNodeClass* node_class = (GanvNodeClass*)class;
- GanvBoxClass* box_class = (GanvBoxClass*)class;
+ GObjectClass* gobject_class = (GObjectClass*)klass;
+ GtkObjectClass* object_class = (GtkObjectClass*)klass;
+ GanvItemClass* item_class = (GanvItemClass*)klass;
+ GanvNodeClass* node_class = (GanvNodeClass*)klass;
+ GanvBoxClass* box_class = (GanvBoxClass*)klass;
- parent_class = GANV_BOX_CLASS(g_type_class_peek_parent(class));
+ parent_class = GANV_BOX_CLASS(g_type_class_peek_parent(klass));
- g_type_class_add_private(class, sizeof(GanvPortImpl));
+ g_type_class_add_private(klass, sizeof(GanvPortImpl));
gobject_class->set_property = ganv_port_set_property;
gobject_class->get_property = ganv_port_get_property;
@@ -296,7 +296,7 @@ ganv_port_class_init(GanvPortClass* class)
port_signals[PORT_VALUE_CHANGED]
= g_signal_new("value-changed",
- G_TYPE_FROM_CLASS(class),
+ G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
diff --git a/src/text.c b/src/text.c
index 06a29bc..ca9a126 100644
--- a/src/text.c
+++ b/src/text.c
@@ -310,15 +310,15 @@ ganv_text_draw(GanvItem* item,
}
static void
-ganv_text_class_init(GanvTextClass* class)
+ganv_text_class_init(GanvTextClass* klass)
{
- GObjectClass* gobject_class = (GObjectClass*)class;
- GtkObjectClass* object_class = (GtkObjectClass*)class;
- GanvItemClass* item_class = (GanvItemClass*)class;
+ GObjectClass* gobject_class = (GObjectClass*)klass;
+ GtkObjectClass* object_class = (GtkObjectClass*)klass;
+ GanvItemClass* item_class = (GanvItemClass*)klass;
- parent_class = GANV_ITEM_CLASS(g_type_class_peek_parent(class));
+ parent_class = GANV_ITEM_CLASS(g_type_class_peek_parent(klass));
- g_type_class_add_private(class, sizeof(GanvTextImpl));
+ g_type_class_add_private(klass, sizeof(GanvTextImpl));
gobject_class->set_property = ganv_text_set_property;
gobject_class->get_property = ganv_text_get_property;
diff --git a/src/widget.c b/src/widget.c
index d9be6da..1d341d1 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -142,7 +142,7 @@ do_destroy(GtkObject* object, gpointer data)
GanvWidget* witem = GANV_WIDGET(data);
witem->in_destroy = TRUE;
- gtk_object_destroy(data);
+ gtk_object_destroy(GTK_OBJECT(data));
}
static void
@@ -164,7 +164,7 @@ ganv_widget_set_property(GObject* object,
gtk_container_remove(GTK_CONTAINER(item->canvas), witem->widget);
}
- obj = g_value_get_object(value);
+ obj = (GObject*)g_value_get_object(value);
if (obj) {
witem->widget = GTK_WIDGET(obj);
witem->destroy_id = g_signal_connect(obj, "destroy",
@@ -420,13 +420,13 @@ ganv_widget_bounds(GanvItem* item, double* x1, double* y1, double* x2, double* y
}
static void
-ganv_widget_class_init(GanvWidgetClass* class)
+ganv_widget_class_init(GanvWidgetClass* klass)
{
- GObjectClass* gobject_class = (GObjectClass*)class;
- GtkObjectClass* object_class = (GtkObjectClass*)class;
- GanvItemClass* item_class = (GanvItemClass*)class;
+ GObjectClass* gobject_class = (GObjectClass*)klass;
+ GtkObjectClass* object_class = (GtkObjectClass*)klass;
+ GanvItemClass* item_class = (GanvItemClass*)klass;
- parent_class = g_type_class_peek_parent(class);
+ parent_class = g_type_class_peek_parent(klass);
gobject_class->set_property = ganv_widget_set_property;
gobject_class->get_property = ganv_widget_get_property;