summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Canvas.cpp17
-rw-r--r--src/canvas-base.c8
-rw-r--r--src/edge.c2
-rw-r--r--src/module.c15
-rw-r--r--src/node.c11
-rw-r--r--src/port.c22
6 files changed, 36 insertions, 39 deletions
diff --git a/src/Canvas.cpp b/src/Canvas.cpp
index ca7a9ad..9bba605 100644
--- a/src/Canvas.cpp
+++ b/src/Canvas.cpp
@@ -132,7 +132,7 @@ struct GanvCanvasImpl {
, _connect_port(NULL)
, _last_selected_port(NULL)
, _base_rect(ganv_item_new(
- ganv_canvas_base_root(GANV_CANVAS_BASE(_gcanvas)),
+ GANV_ITEM(ganv_canvas_base_root(GANV_CANVAS_BASE(_gcanvas))),
ganv_box_get_type(),
"x1", 0.0,
"y1", 0.0,
@@ -892,7 +892,7 @@ GanvCanvasImpl::select_drag_handler(GdkEvent* event)
clear_selection();
_select_rect = GANV_BOX(
ganv_item_new(
- root(),
+ GANV_ITEM(root()),
ganv_box_get_type(),
"x1", event->button.x,
"y1", event->button.y,
@@ -983,12 +983,13 @@ GanvCanvasImpl::connect_drag_handler(GdkEvent* event)
assert(_connect_port);
drag_node = GANV_NODE(
- ganv_item_new(ganv_canvas_base_root(GANV_CANVAS_BASE(_gcanvas)),
- ganv_node_get_type(),
- "x", x,
- "y", y,
- NULL));
-
+ ganv_item_new(
+ GANV_ITEM(ganv_canvas_base_root(GANV_CANVAS_BASE(_gcanvas))),
+ ganv_node_get_type(),
+ "x", x,
+ "y", y,
+ NULL));
+
drag_edge = ganv_edge_new(
_gcanvas,
GANV_NODE(_connect_port),
diff --git a/src/canvas-base.c b/src/canvas-base.c
index 51bd7cb..853c979 100644
--- a/src/canvas-base.c
+++ b/src/canvas-base.c
@@ -103,12 +103,11 @@ ganv_item_init(GanvItem* item)
* Return value: The newly-created item.
**/
GanvItem*
-ganv_item_new(GanvGroup* parent, GType type, const gchar* first_arg_name, ...)
+ganv_item_new(GanvItem* parent, GType type, const gchar* first_arg_name, ...)
{
GanvItem* item;
va_list args;
- g_return_val_if_fail(GANV_IS_GROUP(parent), NULL);
g_return_val_if_fail(g_type_is_a(type, ganv_item_get_type()), NULL);
item = GANV_ITEM(g_object_new(type, NULL));
@@ -192,13 +191,12 @@ ganv_item_get_property(GObject* gobject, guint param_id,
* Constructs a canvas item; meant for use only by item implementations.
**/
void
-ganv_item_construct(GanvItem* item, GanvGroup* parent,
+ganv_item_construct(GanvItem* item, GanvItem* parent,
const gchar* first_arg_name, va_list args)
{
- g_return_if_fail(GANV_IS_GROUP(parent));
g_return_if_fail(GANV_IS_ITEM(item));
- item->parent = GANV_ITEM(parent);
+ item->parent = parent;
item->canvas = item->parent->canvas;
g_object_set_valist(G_OBJECT(item), first_arg_name, args);
diff --git a/src/edge.c b/src/edge.c
index 476955a..e54e277 100644
--- a/src/edge.c
+++ b/src/edge.c
@@ -587,7 +587,7 @@ ganv_edge_new(GanvCanvas* canvas,
va_list args;
va_start(args, first_prop_name);
ganv_item_construct(&edge->item,
- ganv_canvas_get_root(canvas),
+ GANV_ITEM(ganv_canvas_get_root(canvas)),
first_prop_name, args);
va_end(args);
diff --git a/src/module.c b/src/module.c
index e509615..530aabe 100644
--- a/src/module.c
+++ b/src/module.c
@@ -734,13 +734,12 @@ ganv_module_set_icon(GanvModule* module,
}
if (icon) {
- impl->icon_box = ganv_item_new(
- GANV_GROUP(module),
- ganv_canvas_base_pixbuf_get_type(),
- "x", 8.0,
- "y", 10.0,
- "pixbuf", icon,
- NULL);
+ impl->icon_box = ganv_item_new(module,
+ ganv_canvas_base_pixbuf_get_type(),
+ "x", 8.0,
+ "y", 10.0,
+ "pixbuf", icon,
+ NULL);
const double icon_w = gdk_pixbuf_get_width(icon);
const double icon_h = gdk_pixbuf_get_height(icon);
@@ -809,7 +808,7 @@ ganv_module_embed(GanvModule* module,
const double y = 4.0 + title_h;
impl->embed_item = ganv_item_new(
- GANV_GROUP(module),
+ GANV_ITEM(module),
ganv_widget_get_type(),
"x", 2.0,
"y", y,
diff --git a/src/node.c b/src/node.c
index 6092924..7d4a8f2 100644
--- a/src/node.c
+++ b/src/node.c
@@ -256,12 +256,11 @@ ganv_node_set_label(GanvNode* node, const char* str)
"text", str,
NULL);
} else {
- impl->label = GANV_TEXT(ganv_item_new(
- GANV_GROUP(node),
- ganv_text_get_type(),
- "text", str,
- "color", 0xFFFFFFFF,
- NULL));
+ impl->label = GANV_TEXT(ganv_item_new(node,
+ ganv_text_get_type(),
+ "text", str,
+ "color", 0xFFFFFFFF,
+ NULL));
}
GanvNodeClass* klass = GANV_NODE_GET_CLASS(node);
diff --git a/src/port.c b/src/port.c
index b804617..27c99a0 100644
--- a/src/port.c
+++ b/src/port.c
@@ -258,8 +258,8 @@ ganv_port_new(GanvModule* module,
va_list args;
va_start(args, first_prop_name);
ganv_item_construct(item,
- GANV_GROUP(module),
- first_prop_name, args);
+ GANV_ITEM(module),
+ first_prop_name, args);
va_end(args);
port->impl->is_input = is_input;
@@ -303,15 +303,15 @@ ganv_port_show_control(GanvPort* port)
control->max = 0.0f;
control->is_toggle = FALSE;
control->rect = GANV_BOX(ganv_item_new(
- GANV_GROUP(port),
- ganv_box_get_type(),
- "x1", 0.0,
- "y1", 0.0,
- "x2", 0.0,
- "y2", ganv_box_get_height(&port->box),
- "fill-color", 0xFFFFFF80,
- "border-width", 0.0,
- NULL));
+ GANV_ITEM(port),
+ ganv_box_get_type(),
+ "x1", 0.0,
+ "y1", 0.0,
+ "x2", 0.0,
+ "y2", ganv_box_get_height(&port->box),
+ "fill-color", 0xFFFFFF80,
+ "border-width", 0.0,
+ NULL));
ganv_item_show(GANV_ITEM(control->rect));
}