[cairo-commit] goocanvas/src goocanvasgroupview.c, 1.15,
1.16 goocanvasimageview.c, 1.12, 1.13 goocanvasitemview.c,
1.11, 1.12 goocanvasitemview.h, 1.10,
1.11 goocanvasitemviewsimple.c, 1.7,
1.8 goocanvaspolylineview.c, 1.13, 1.14 goocanvastextview.c,
1.14, 1.15 goocanvasview.c, 1.24, 1.25 goocanvasview.h, 1.8, 1.9
Damon Chaplin
commit at pdx.freedesktop.org
Fri Jul 21 03:30:32 PDT 2006
Committed by: damon
Update of /cvs/cairo/goocanvas/src
In directory kemper:/tmp/cvs-serv19874/src
Modified Files:
goocanvasgroupview.c goocanvasimageview.c goocanvasitemview.c
goocanvasitemview.h goocanvasitemviewsimple.c
goocanvaspolylineview.c goocanvastextview.c goocanvasview.c
goocanvasview.h
Log Message:
2006-07-21 Damon Chaplin <damon at gnome.org>
* src/goocanvas*view.c: renamed get_item_at() methods to
get_item_view_at().
* src/goocanvasview.c (goo_canvas_view_get_root_view): new function
to return the root view.
(goo_canvas_view_get_item_view_at): new function to return the item
view at a given point.
Index: goocanvasgroupview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasgroupview.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- goocanvasgroupview.c 19 Jul 2006 15:49:47 -0000 1.15
+++ goocanvasgroupview.c 21 Jul 2006 10:30:30 -0000 1.16
@@ -462,12 +462,12 @@
static GooCanvasItemView*
-goo_canvas_group_view_get_item_at (GooCanvasItemView *view,
- gdouble x,
- gdouble y,
- cairo_t *cr,
- gboolean is_pointer_event,
- gboolean parent_visible)
+goo_canvas_group_view_get_item_view_at (GooCanvasItemView *view,
+ gdouble x,
+ gdouble y,
+ cairo_t *cr,
+ gboolean is_pointer_event,
+ gboolean parent_visible)
{
GooCanvasGroupView *group_view = (GooCanvasGroupView*) view;
GooCanvasGroup *group = group_view->group;
@@ -507,9 +507,9 @@
|| child_bounds.y1 > y || child_bounds.y2 < y)
continue;
- found_item = goo_canvas_item_view_get_item_at (child_view, x, y, cr,
- is_pointer_event,
- visible);
+ found_item = goo_canvas_item_view_get_item_view_at (child_view, x, y, cr,
+ is_pointer_event,
+ visible);
if (found_item)
break;
}
@@ -577,19 +577,19 @@
static void
canvas_item_view_interface_init (GooCanvasItemViewIface *iface)
{
- iface->get_canvas_view = goo_canvas_group_view_get_canvas_view;
- iface->get_n_children = goo_canvas_group_view_get_n_children;
- iface->get_child = goo_canvas_group_view_get_child;
- iface->request_update = goo_canvas_group_view_request_update;
+ iface->get_canvas_view = goo_canvas_group_view_get_canvas_view;
+ iface->get_n_children = goo_canvas_group_view_get_n_children;
+ iface->get_child = goo_canvas_group_view_get_child;
+ iface->request_update = goo_canvas_group_view_request_update;
- iface->get_parent_view = goo_canvas_group_view_get_parent_view;
- iface->set_parent_view = goo_canvas_group_view_set_parent_view;
- iface->get_item = goo_canvas_group_view_get_item;
- iface->get_bounds = goo_canvas_group_view_get_bounds;
- iface->get_item_at = goo_canvas_group_view_get_item_at;
- iface->is_visible = goo_canvas_group_view_is_visible;
- iface->update = goo_canvas_group_view_update;
- iface->paint = goo_canvas_group_view_paint;
+ iface->get_parent_view = goo_canvas_group_view_get_parent_view;
+ iface->set_parent_view = goo_canvas_group_view_set_parent_view;
+ iface->get_item = goo_canvas_group_view_get_item;
+ iface->get_bounds = goo_canvas_group_view_get_bounds;
+ iface->get_item_view_at = goo_canvas_group_view_get_item_view_at;
+ iface->is_visible = goo_canvas_group_view_is_visible;
+ iface->update = goo_canvas_group_view_update;
+ iface->paint = goo_canvas_group_view_paint;
}
Index: goocanvasimageview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasimageview.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- goocanvasimageview.c 19 Jul 2006 15:49:47 -0000 1.12
+++ goocanvasimageview.c 21 Jul 2006 10:30:30 -0000 1.13
@@ -89,12 +89,12 @@
static GooCanvasItemView*
-goo_canvas_image_view_get_item_at (GooCanvasItemView *view,
- gdouble x,
- gdouble y,
- cairo_t *cr,
- gboolean is_pointer_event,
- gboolean parent_visible)
+goo_canvas_image_view_get_item_view_at (GooCanvasItemView *view,
+ gdouble x,
+ gdouble y,
+ cairo_t *cr,
+ gboolean is_pointer_event,
+ gboolean parent_visible)
{
GooCanvasItemViewSimple *simple_view = (GooCanvasItemViewSimple*) view;
GooCanvasItemSimple *simple = simple_view->item;
@@ -218,7 +218,7 @@
static void
canvas_item_view_interface_init (GooCanvasItemViewIface *iface)
{
- iface->get_item_at = goo_canvas_image_view_get_item_at;
- iface->update = goo_canvas_image_view_update;
- iface->paint = goo_canvas_image_view_paint;
+ iface->get_item_view_at = goo_canvas_image_view_get_item_view_at;
+ iface->update = goo_canvas_image_view_update;
+ iface->paint = goo_canvas_image_view_paint;
}
Index: goocanvasitemview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemview.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- goocanvasitemview.c 19 Jul 2006 15:49:47 -0000 1.11
+++ goocanvasitemview.c 21 Jul 2006 10:30:30 -0000 1.12
@@ -540,7 +540,7 @@
/**
- * goo_canvas_item_view_get_item_at:
+ * goo_canvas_item_view_get_item_view_at:
* @view: a #GooCanvasItemView.
* @x: the x coordinate of the point.
* @y: the y coordinate of the point.
@@ -556,17 +556,17 @@
* was found.
**/
GooCanvasItemView*
-goo_canvas_item_view_get_item_at (GooCanvasItemView *view,
- gdouble x,
- gdouble y,
- cairo_t *cr,
- gboolean is_pointer_event,
- gboolean parent_is_visible)
+goo_canvas_item_view_get_item_view_at (GooCanvasItemView *view,
+ gdouble x,
+ gdouble y,
+ cairo_t *cr,
+ gboolean is_pointer_event,
+ gboolean parent_is_visible)
{
GooCanvasItemViewIface *iface = GOO_CANVAS_ITEM_VIEW_GET_IFACE (view);
- return iface->get_item_at (view, x, y, cr, is_pointer_event,
- parent_is_visible);
+ return iface->get_item_view_at (view, x, y, cr, is_pointer_event,
+ parent_is_visible);
}
Index: goocanvasitemview.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemview.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- goocanvasitemview.h 19 Jul 2006 15:49:47 -0000 1.10
+++ goocanvasitemview.h 21 Jul 2006 10:30:30 -0000 1.11
@@ -59,7 +59,7 @@
GooCanvasItem* (* get_item) (GooCanvasItemView *view);
void (* get_bounds) (GooCanvasItemView *view,
GooCanvasBounds *bounds);
- GooCanvasItemView* (* get_item_at) (GooCanvasItemView *view,
+ GooCanvasItemView* (* get_item_view_at) (GooCanvasItemView *view,
gdouble x,
gdouble y,
cairo_t *cr,
@@ -134,12 +134,12 @@
GooCanvasItem* goo_canvas_item_view_get_item (GooCanvasItemView *view);
void goo_canvas_item_view_get_bounds (GooCanvasItemView *view,
GooCanvasBounds *bounds);
-GooCanvasItemView* goo_canvas_item_view_get_item_at (GooCanvasItemView *view,
- gdouble x,
- gdouble y,
- cairo_t *cr,
- gboolean is_pointer_event,
- gboolean parent_is_visible);
+GooCanvasItemView* goo_canvas_item_view_get_item_view_at (GooCanvasItemView *view,
+ gdouble x,
+ gdouble y,
+ cairo_t *cr,
+ gboolean is_pointer_event,
+ gboolean parent_is_visible);
gboolean goo_canvas_item_view_is_visible (GooCanvasItemView *view);
void goo_canvas_item_view_request_update (GooCanvasItemView *view);
void goo_canvas_item_view_ensure_updated (GooCanvasItemView *view);
Index: goocanvasitemviewsimple.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemviewsimple.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- goocanvasitemviewsimple.c 19 Jul 2006 15:49:47 -0000 1.7
+++ goocanvasitemviewsimple.c 21 Jul 2006 10:30:30 -0000 1.8
@@ -174,12 +174,12 @@
static GooCanvasItemView*
-goo_canvas_item_view_simple_get_item_at (GooCanvasItemView *view,
- gdouble x,
- gdouble y,
- cairo_t *cr,
- gboolean is_pointer_event,
- gboolean parent_visible)
+goo_canvas_item_view_simple_get_item_view_at (GooCanvasItemView *view,
+ gdouble x,
+ gdouble y,
+ cairo_t *cr,
+ gboolean is_pointer_event,
+ gboolean parent_visible)
{
GooCanvasItemViewSimple *simple_view = (GooCanvasItemViewSimple*) view;
GooCanvasItemSimple *simple = simple_view->item;
@@ -250,7 +250,6 @@
{
GooCanvasItemViewSimple *simple_view = (GooCanvasItemViewSimple*) view;
GooCanvasItemSimple *simple = simple_view->item;
- GooCanvasView *canvas_view;
if (entire_tree || (simple_view->flags & GOO_CANVAS_ITEM_VIEW_NEED_UPDATE))
{
@@ -260,10 +259,9 @@
if (simple->transform)
cairo_transform (cr, simple->transform);
- canvas_view = goo_canvas_item_view_get_canvas_view (simple_view->parent_view);
-
/* Request a redraw of the existing bounds. */
- goo_canvas_view_request_redraw (canvas_view, &simple_view->bounds);
+ goo_canvas_view_request_redraw (simple_view->canvas_view,
+ &simple_view->bounds);
/* Use the virtual method subclasses define to create the path. */
GOO_CANVAS_ITEM_VIEW_SIMPLE_GET_CLASS (view)->create_path (simple, cr);
@@ -272,7 +270,7 @@
goo_canvas_item_simple_get_path_bounds (simple, cr, bounds);
/* Request a redraw of the new bounds. */
- goo_canvas_view_request_redraw (canvas_view, bounds);
+ goo_canvas_view_request_redraw (simple_view->canvas_view, bounds);
cairo_restore (cr);
@@ -312,14 +310,14 @@
static void
canvas_item_view_interface_init (GooCanvasItemViewIface *iface)
{
- iface->get_parent_view = goo_canvas_item_view_simple_get_parent_view;
- iface->set_parent_view = goo_canvas_item_view_simple_set_parent_view;
- iface->get_item = goo_canvas_item_view_simple_get_item;
- iface->get_bounds = goo_canvas_item_view_simple_get_bounds;
- iface->get_item_at = goo_canvas_item_view_simple_get_item_at;
- iface->is_visible = goo_canvas_item_view_simple_is_visible;
- iface->update = goo_canvas_item_view_simple_update;
- iface->paint = goo_canvas_item_view_simple_paint;
+ iface->get_parent_view = goo_canvas_item_view_simple_get_parent_view;
+ iface->set_parent_view = goo_canvas_item_view_simple_set_parent_view;
+ iface->get_item = goo_canvas_item_view_simple_get_item;
+ iface->get_bounds = goo_canvas_item_view_simple_get_bounds;
+ iface->get_item_view_at = goo_canvas_item_view_simple_get_item_view_at;
+ iface->is_visible = goo_canvas_item_view_simple_is_visible;
+ iface->update = goo_canvas_item_view_simple_update;
+ iface->paint = goo_canvas_item_view_simple_paint;
}
Index: goocanvaspolylineview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvaspolylineview.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- goocanvaspolylineview.c 19 Jul 2006 15:49:47 -0000 1.13
+++ goocanvaspolylineview.c 21 Jul 2006 10:30:30 -0000 1.14
@@ -171,12 +171,12 @@
static GooCanvasItemView*
-goo_canvas_polyline_view_get_item_at (GooCanvasItemView *view,
- gdouble x,
- gdouble y,
- cairo_t *cr,
- gboolean is_pointer_event,
- gboolean parent_visible)
+goo_canvas_polyline_view_get_item_view_at (GooCanvasItemView *view,
+ gdouble x,
+ gdouble y,
+ cairo_t *cr,
+ gboolean is_pointer_event,
+ gboolean parent_visible)
{
GooCanvasItemViewSimple *simple_view = (GooCanvasItemViewSimple*) view;
GooCanvasItemSimple *simple = simple_view->item;
@@ -394,7 +394,7 @@
static void
canvas_item_view_interface_init (GooCanvasItemViewIface *iface)
{
- iface->get_item_at = goo_canvas_polyline_view_get_item_at;
- iface->update = goo_canvas_polyline_view_update;
- iface->paint = goo_canvas_polyline_view_paint;
+ iface->get_item_view_at = goo_canvas_polyline_view_get_item_view_at;
+ iface->update = goo_canvas_polyline_view_update;
+ iface->paint = goo_canvas_polyline_view_paint;
}
Index: goocanvastextview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvastextview.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- goocanvastextview.c 19 Jul 2006 15:49:47 -0000 1.14
+++ goocanvastextview.c 21 Jul 2006 10:30:30 -0000 1.15
@@ -223,12 +223,12 @@
static GooCanvasItemView*
-goo_canvas_text_view_get_item_at (GooCanvasItemView *view,
- gdouble x,
- gdouble y,
- cairo_t *cr,
- gboolean is_pointer_event,
- gboolean parent_visible)
+goo_canvas_text_view_get_item_view_at (GooCanvasItemView *view,
+ gdouble x,
+ gdouble y,
+ cairo_t *cr,
+ gboolean is_pointer_event,
+ gboolean parent_visible)
{
GooCanvasItemViewSimple *simple_view = (GooCanvasItemViewSimple*) view;
GooCanvasTextView *text_view = (GooCanvasTextView*) view;
@@ -355,7 +355,7 @@
static void
canvas_item_view_interface_init (GooCanvasItemViewIface *iface)
{
- iface->get_item_at = goo_canvas_text_view_get_item_at;
- iface->update = goo_canvas_text_view_update;
- iface->paint = goo_canvas_text_view_paint;
+ iface->get_item_view_at = goo_canvas_text_view_get_item_view_at;
+ iface->update = goo_canvas_text_view_update;
+ iface->paint = goo_canvas_text_view_paint;
}
Index: goocanvasview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasview.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- goocanvasview.c 19 Jul 2006 15:49:47 -0000 1.24
+++ goocanvasview.c 21 Jul 2006 10:30:30 -0000 1.25
@@ -410,6 +410,19 @@
}
+static cairo_t*
+goo_canvas_view_create_cairo (GooCanvasView *view)
+{
+ cairo_t *cr;
+
+ cr = gdk_cairo_create (view->canvas_window);
+
+ /*cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);*/
+
+ return cr;
+}
+
+
static void
goo_canvas_view_get_property (GObject *object,
guint prop_id,
@@ -559,6 +572,57 @@
}
+/**
+ * goo_canvas_view_get_root_view:
+ * @view: a #GooCanvasView.
+ *
+ * Gets the root item view.
+ *
+ * Returns: the root item view, or %NULL of no canvas model is set.
+ **/
+GooCanvasItemView*
+goo_canvas_view_get_root_view (GooCanvasView *view)
+{
+ return view->root_view;
+}
+
+
+/**
+ * goo_canvas_view_get_item_view_at:
+ * @view: a #GooCanvasView.
+ * @x: the x coordinate of the point.
+ * @y: the y coordinate of the point
+ * @is_pointer_event: %TRUE if the "pointer-events" properties of items should
+ * be used to determine which parts of the item are tested.
+ *
+ * Gets the item view at the given point.
+ *
+ * Returns: the item view found at the given point, or %NULL if no item view
+ * was found.
+ **/
+GooCanvasItemView*
+goo_canvas_view_get_item_view_at (GooCanvasView *view,
+ gdouble x,
+ gdouble y,
+ gboolean is_pointer_event)
+{
+ cairo_t *cr;
+ GooCanvasItemView *found_view;
+
+ /* If no canvas model is set, just return NULL. */
+ if (!view->root_view)
+ return NULL;
+
+ cr = goo_canvas_view_create_cairo (view);
+ found_view = goo_canvas_item_view_get_item_view_at (view->root_view, x, y,
+ cr, is_pointer_event,
+ TRUE);
+ cairo_destroy (cr);
+
+ return found_view;
+}
+
+
static void
goo_canvas_view_realize (GtkWidget *widget)
{
@@ -991,19 +1055,6 @@
}
-static cairo_t*
-goo_canvas_view_create_cairo (GooCanvasView *view)
-{
- cairo_t *cr;
-
- cr = gdk_cairo_create (view->canvas_window);
-
- /*cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);*/
-
- return cr;
-}
-
-
/* Sets one of our pointers to an item view, adding a reference to it and
releasing any reference to the current item view. */
static void
@@ -1665,8 +1716,9 @@
goo_canvas_view_convert_from_pixels (view, &x, &y);
cr = goo_canvas_view_create_cairo (view);
- new_item_view = goo_canvas_item_view_get_item_at (view->root_view,
- x, y, cr, TRUE, TRUE);
+ new_item_view = goo_canvas_item_view_get_item_view_at (view->root_view,
+ x, y, cr, TRUE,
+ TRUE);
cairo_destroy (cr);
}
Index: goocanvasview.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasview.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- goocanvasview.h 24 Apr 2006 15:14:33 -0000 1.8
+++ goocanvasview.h 21 Jul 2006 10:30:30 -0000 1.9
@@ -127,6 +127,13 @@
void goo_canvas_view_set_model (GooCanvasView *view,
GooCanvasModel *model);
+GooCanvasItemView* goo_canvas_view_get_root_view (GooCanvasView *view);
+
+GooCanvasItemView* goo_canvas_view_get_item_view_at (GooCanvasView *view,
+ gdouble x,
+ gdouble y,
+ gboolean is_pointer_event);
+
gdouble goo_canvas_view_get_scale (GooCanvasView *view);
void goo_canvas_view_set_scale (GooCanvasView *view,
gdouble pixels_per_unit);
More information about the cairo-commit
mailing list