diff options
-rw-r--r-- | ganv/canvas-base.h | 14 | ||||
-rw-r--r-- | src/canvas-base.c | 67 | ||||
-rw-r--r-- | src/node.c | 6 | ||||
-rw-r--r-- | src/port.c | 1 |
4 files changed, 2 insertions, 86 deletions
diff --git a/ganv/canvas-base.h b/ganv/canvas-base.h index c247dfa..1c24cd8 100644 --- a/ganv/canvas-base.h +++ b/ganv/canvas-base.h @@ -205,22 +205,10 @@ int ganv_item_grab(GanvItem* item, unsigned int event_mask, */ void ganv_item_ungrab(GanvItem* item, guint32 etime); -/* These functions convert from a coordinate system to another. "w" is world - * coordinates and "i" is item coordinates. +/* Convert from item coordinate to world coordinates. */ -void ganv_item_w2i(GanvItem* item, double* x, double* y); void ganv_item_i2w(GanvItem* item, double* x, double* y); -/* Gets the affine transform that converts from item-relative coordinates to - * world coordinates. - */ -void ganv_item_i2w_affine(GanvItem* item, cairo_matrix_t* matrix); - -/* Gets the affine transform that converts from item-relative coordinates to - * canvas pixel coordinates. - */ -void ganv_item_i2c_affine(GanvItem* item, cairo_matrix_t* matrix); - /* Used to send all of the keystroke events to a specific item as well as * GDK_FOCUS_CHANGE events. */ diff --git a/src/canvas-base.c b/src/canvas-base.c index d316f16..662aab6 100644 --- a/src/canvas-base.c +++ b/src/canvas-base.c @@ -586,51 +586,6 @@ ganv_item_ungrab(GanvItem* item, guint32 etime) gdk_pointer_ungrab(etime); } -/** - * ganv_item_i2w_affine: - * @item: A canvas item - * @matrix: An affine transformation matrix (return value). - * - * Gets the affine transform that converts from the item's coordinate system to - * world coordinates. - **/ -void -ganv_item_i2w_affine(GanvItem* item, cairo_matrix_t* matrix) -{ - g_return_if_fail(GANV_IS_ITEM(item)); - - cairo_matrix_init_identity(matrix); - - while (item) { - matrix->x0 += item->x; - matrix->y0 += item->y; - item = item->parent; - } -} - -/** - * ganv_item_w2i: - * @item: A canvas item. - * @x: X coordinate to convert (input/output value). - * @y: Y coordinate to convert (input/output value). - * - * Converts a coordinate pair from world coordinates to item-relative - * coordinates. - **/ -void -ganv_item_w2i(GanvItem* item, double* x, double* y) -{ - g_return_if_fail(GANV_IS_ITEM(item)); - g_return_if_fail(x != NULL); - g_return_if_fail(y != NULL); - - cairo_matrix_t matrix; - ganv_item_i2w_affine(item, &matrix); - cairo_matrix_invert(&matrix); - - cairo_matrix_transform_point(&matrix, x, y); -} - void ganv_item_i2w_offset(GanvItem* item, double* px, double* py) { @@ -682,26 +637,6 @@ ganv_item_i2w_pair(GanvItem* item, double* x1, double* y1, double* x2, double* y *y2 += off_y; } -/** - * ganv_item_i2c_affine: - * @item: A canvas item. - * @matrix: An affine transformation matrix (return value). - * - * Gets the affine transform that converts from item-relative coordinates to - * canvas pixel coordinates. - **/ -void -ganv_item_i2c_affine(GanvItem* item, cairo_matrix_t* matrix) -{ - cairo_matrix_t i2w; - ganv_item_i2w_affine(item, &i2w); - - cairo_matrix_t w2c; - ganv_canvas_base_w2c_affine(item->canvas, &w2c); - - cairo_matrix_multiply(matrix, &i2w, &w2c); -} - /* Returns whether the item is an inferior of or is equal to the parent. */ static gboolean is_descendant(GanvItem* item, GanvItem* parent) @@ -1800,7 +1735,7 @@ ganv_canvas_base_paint_rect(GanvCanvasBase* canvas, gint x0, gint y0, gint x1, g draw_width = draw_x2 - draw_x1; draw_height = draw_y2 - draw_y1; - if (( draw_width < 1) || ( draw_height < 1) ) { + if ((draw_width < 1) || (draw_height < 1)) { return; } @@ -427,12 +427,6 @@ ganv_node_default_event(GanvItem* item, static double drag_start_x, drag_start_y; static gboolean dragging = FALSE; - /* - double click_x, - ganv_item_w2i(GANV_ITEM(GANV_ITEM(node)->parent), - &click_x, &click_y); - */ - switch (event->type) { case GDK_ENTER_NOTIFY: ganv_item_raise(GANV_ITEM(node)); @@ -474,7 +474,6 @@ void ganv_port_set_value_label(GanvPort* port, const char* str) { - GanvNode* node = GANV_NODE(port); GanvPortImpl* impl = port->impl; if (!impl->control) { return; |