[cairo-commit]
goocanvas/src demo.c, 1.2, 1.3 goocanvasellipseview.c,
1.1.1.1, 1.2 goocanvasgroup.c, 1.1.1.1, 1.2 goocanvasgroup.h,
1.1.1.1, 1.2 goocanvasgroupview.c, 1.1.1.1,
1.2 goocanvasimageview.c, 1.1.1.1, 1.2 goocanvasitem.c,
1.1.1.1, 1.2 goocanvasitem.h, 1.1.1.1,
1.2 goocanvasitemsimple.c, 1.1.1.1, 1.2 goocanvasitemsimple.h,
1.1.1.1, 1.2 goocanvasitemview.c, 1.1.1.1,
1.2 goocanvasitemview.h, 1.1.1.1, 1.2 goocanvaspolylineview.c,
1.1.1.1, 1.2 goocanvasrectview.c, 1.1.1.1,
1.2 goocanvastextview.c, 1.2, 1.3 goocanvasutils.c, 1.1.1.1,
1.2 goocanvasutils.h, 1.1.1.1, 1.2 goocanvasview.c, 1.3, 1.4
Damon Chaplin
commit at pdx.freedesktop.org
Thu Mar 23 08:58:50 PST 2006
Committed by: damon
Update of /cvs/cairo/goocanvas/src
In directory kemper:/tmp/cvs-serv10988/src
Modified Files:
demo.c goocanvasellipseview.c goocanvasgroup.c
goocanvasgroup.h goocanvasgroupview.c goocanvasimageview.c
goocanvasitem.c goocanvasitem.h goocanvasitemsimple.c
goocanvasitemsimple.h goocanvasitemview.c goocanvasitemview.h
goocanvaspolylineview.c goocanvasrectview.c
goocanvastextview.c goocanvasutils.c goocanvasutils.h
goocanvasview.c
Log Message:
2006-03-23 Damon Chaplin <damon at gnome.org>
* src/goocanvasitem.c: added new "visibility" and
"visibility-threshold" properties to specify when an item should be
visible (always, never, or above a certain scale threshold).
* src/goocanvasutils.[hc]: added GooCanvasItemVisibility enum stuff.
* src/goocanvasitemsimple.[hc]:
* src/goocanvasgroup.[hc]: implemented new properties.
* src/goocanvasgroupview.c (goo_canvas_group_view_paint):
* src/goocanvastextview.c (goo_canvas_text_view_paint):
* src/goocanvasrectview.c (goo_canvas_rect_view_paint):
* src/goocanvasimageview.c (goo_canvas_image_view_paint):
* src/goocanvasellipseview.c (goo_canvas_ellipse_view_paint): check
the visibility settings to see if the items should be painted.
* src/demo.c (setup_invisible_texts): added test for visibility
settings.
* src/goocanvasitem.[hc] (goo_canvas_item_create_view): removed this as
it is mainly an internal function and the interface can be used
directly instead where needed.
Index: demo.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/demo.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- demo.c 22 Mar 2006 23:49:44 -0000 1.2
+++ demo.c 23 Mar 2006 16:58:48 -0000 1.3
@@ -1041,6 +1041,31 @@
static void
+setup_invisible_texts (GooCanvasItem *root)
+{
+ goo_canvas_text_new (root, "Visible above 0.8x", 500, 330, -1,
+ GTK_ANCHOR_CENTER,
+ "visibility", GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD,
+ "visibility-threshold", 0.8,
+ NULL);
+ goo_canvas_text_new (root, "Visible above 1.5x", 500, 350, -1,
+ GTK_ANCHOR_CENTER,
+ "visibility", GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD,
+ "visibility-threshold", 1.5,
+ NULL);
+ goo_canvas_text_new (root, "Visible above 3.0x", 500, 370, -1,
+ GTK_ANCHOR_CENTER,
+ "visibility", GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD,
+ "visibility-threshold", 3.0,
+ NULL);
+ goo_canvas_text_new (root, "Always Invisible", 500, 390, -1,
+ GTK_ANCHOR_CENTER,
+ "visibility", GOO_CANVAS_ITEM_INVISIBLE,
+ NULL);
+}
+
+
+static void
plant_flower (GooCanvasItem *root, double x, double y, GtkAnchorType anchor)
{
cairo_pattern_t *pattern;
@@ -1115,6 +1140,7 @@
setup_polygons (root);
setup_texts (root);
setup_images (root);
+ setup_invisible_texts (root);
#endif
#if 0
setup_widgets (root);
Index: goocanvasellipseview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasellipseview.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- goocanvasellipseview.c 15 Dec 2005 15:32:02 -0000 1.1.1.1
+++ goocanvasellipseview.c 23 Mar 2006 16:58:48 -0000 1.2
@@ -189,6 +189,7 @@
static void
goo_canvas_ellipse_view_paint (GooCanvasItemView *view,
+ GooCanvasView *canvas_view,
cairo_t *cr,
GooCanvasBounds *bounds)
{
@@ -199,6 +200,12 @@
g_print ("Painting ellipse item %p\n", view);
#endif
+ /* Check if the item should be visible. */
+ if (simple->visibility == GOO_CANVAS_ITEM_INVISIBLE
+ || (simple->visibility == GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD
+ && simple->visibility_threshold < canvas_view->pixels_per_unit))
+ return;
+
cairo_save (cr);
if (simple->transform)
cairo_transform (cr, simple->transform);
Index: goocanvasgroup.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasgroup.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- goocanvasgroup.c 15 Dec 2005 15:32:00 -0000 1.1.1.1
+++ goocanvasgroup.c 23 Mar 2006 16:58:48 -0000 1.2
@@ -8,14 +8,15 @@
#include <gtk/gtk.h>
#include "goocanvasgroup.h"
#include "goocanvasgroupview.h"
-#include "goocanvasutils.h"
#include "goocanvasmarshal.h"
enum {
PROP_0,
- PROP_TRANSFORM
+ PROP_TRANSFORM,
+ PROP_VISIBILITY,
+ PROP_VISIBILITY_THRESHOLD,
};
enum {
@@ -60,6 +61,12 @@
GOO_TYPE_CAIRO_MATRIX,
G_PARAM_READWRITE));
+ g_object_class_override_property (gobject_class, PROP_VISIBILITY,
+ "visibility");
+
+ g_object_class_override_property (gobject_class, PROP_VISIBILITY_THRESHOLD,
+ "visibility-threshold");
+
/* Signals. */
group_signals[CHANGED] =
g_signal_new ("changed",
@@ -297,6 +304,13 @@
case PROP_TRANSFORM:
g_value_set_boxed (value, &group->transform);
break;
+ case PROP_VISIBILITY:
+ g_value_set_enum (value, group->visibility);
+ break;
+ case PROP_VISIBILITY_THRESHOLD:
+ g_value_set_double (value, group->visibility_threshold);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -319,6 +333,13 @@
transform = g_value_get_boxed (value);
group->transform = *transform;
break;
+ case PROP_VISIBILITY:
+ group->visibility = g_value_get_enum (value);
+ break;
+ case PROP_VISIBILITY_THRESHOLD:
+ group->visibility_threshold = g_value_get_double (value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
Index: goocanvasgroup.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasgroup.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- goocanvasgroup.h 15 Dec 2005 15:32:02 -0000 1.1.1.1
+++ goocanvasgroup.h 23 Mar 2006 16:58:48 -0000 1.2
@@ -9,6 +9,7 @@
#include <gtk/gtk.h>
#include "goocanvasmodel.h"
+#include "goocanvasutils.h"
G_BEGIN_DECLS
@@ -40,6 +41,13 @@
/* The transformation matrix, or NULL. */
cairo_matrix_t transform;
+
+ /* Whether the item is visible, invisible, or visible above a given scale. */
+ GooCanvasItemVisibility visibility;
+
+ /* If visibility is VISIBLE_ABOVE_THRESHOLD the item is visible if the canvas
+ scale setting is above this threshold (or equal to it). */
+ gdouble visibility_threshold;
};
struct _GooCanvasGroupClass
Index: goocanvasgroupview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasgroupview.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- goocanvasgroupview.c 15 Dec 2005 15:32:00 -0000 1.1.1.1
+++ goocanvasgroupview.c 23 Mar 2006 16:58:48 -0000 1.2
@@ -348,6 +348,7 @@
static void
goo_canvas_group_view_paint (GooCanvasItemView *view,
+ GooCanvasView *canvas_view,
cairo_t *cr,
GooCanvasBounds *bounds)
{
@@ -361,6 +362,12 @@
group_view->item_views->len, group->items->len);
#endif
+ /* Check if the item should be visible. */
+ if (group->visibility == GOO_CANVAS_ITEM_INVISIBLE
+ || (group->visibility == GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD
+ && group->visibility_threshold < canvas_view->pixels_per_unit))
+ return;
+
/* Paint all the items in the group. */
cairo_save (cr);
cairo_transform (cr, &group->transform);
@@ -375,7 +382,7 @@
|| child_bounds->y1 > bounds->y2 || child_bounds->y2 < bounds->y1)
continue;
- goo_canvas_item_view_paint (child_view, cr, bounds);
+ goo_canvas_item_view_paint (child_view, canvas_view, cr, bounds);
}
cairo_restore (cr);
}
Index: goocanvasimageview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasimageview.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- goocanvasimageview.c 15 Dec 2005 15:32:01 -0000 1.1.1.1
+++ goocanvasimageview.c 23 Mar 2006 16:58:48 -0000 1.2
@@ -172,6 +172,7 @@
static void
goo_canvas_image_view_paint (GooCanvasItemView *view,
+ GooCanvasView *canvas_view,
cairo_t *cr,
GooCanvasBounds *bounds)
{
@@ -187,6 +188,12 @@
g_print ("Painting image item %p\n", view);
#endif
+ /* Check if the item should be visible. */
+ if (simple->visibility == GOO_CANVAS_ITEM_INVISIBLE
+ || (simple->visibility == GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD
+ && simple->visibility_threshold < canvas_view->pixels_per_unit))
+ return;
+
cairo_save (cr);
if (simple->transform)
cairo_transform (cr, simple->transform);
Index: goocanvasitem.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitem.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- goocanvasitem.c 15 Dec 2005 15:32:01 -0000 1.1.1.1
+++ goocanvasitem.c 23 Mar 2006 16:58:48 -0000 1.2
@@ -8,6 +8,7 @@
#include <math.h>
#include <gtk/gtk.h>
#include "goocanvasitem.h"
+#include "goocanvasutils.h"
#include "goocanvasmarshal.h"
@@ -54,13 +55,13 @@
static void
-goo_canvas_item_base_init (gpointer g_class)
+goo_canvas_item_base_init (gpointer g_iface)
{
static gboolean initialized = FALSE;
if (!initialized)
{
- GType iface_type = G_TYPE_FROM_INTERFACE (g_class);
+ GType iface_type = G_TYPE_FROM_INTERFACE (g_iface);
canvas_item_signals[CHILD_ADDED] =
g_signal_new ("child-added",
@@ -102,6 +103,20 @@
G_TYPE_NONE, 1,
G_TYPE_INT);
+ g_object_interface_install_property (g_iface,
+ g_param_spec_enum ("visibility",
+ NULL, NULL,
+ GOO_TYPE_CANVAS_ITEM_VISIBILITY,
+ GOO_CANVAS_ITEM_VISIBLE,
+ G_PARAM_READWRITE));
+ g_object_interface_install_property (g_iface,
+ g_param_spec_double ("visibility-threshold",
+ NULL, NULL,
+ 0.0,
+ G_MAXDOUBLE,
+ 0.0,
+ G_PARAM_READWRITE));
+
initialized = TRUE;
}
}
@@ -743,29 +758,6 @@
/**
- * goo_canvas_item_create_view:
- * @item: an item.
- * @canvas_view: the canvas view.
- * @parent_view: the parent item view.
- *
- * Creates a new default view for the given item.
- *
- * Applications can create custom views for items by subclassing GooCanvasView
- * and overriding the create_item_view() class method.
- *
- * Returns: a new item view.
- **/
-GooCanvasItemView*
-goo_canvas_item_create_view (GooCanvasItem *item,
- GooCanvasView *canvas_view,
- GooCanvasItemView *parent_view)
-{
- return GOO_CANVAS_ITEM_GET_IFACE (item)->create_view (item, canvas_view,
- parent_view);
-}
-
-
-/**
* goo_canvas_item_new:
* @parent: the parent item, or %NULL. If a parent is specified, it will assume
* ownership of the item, and the item will automatically be freed when it is
Index: goocanvasitem.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitem.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- goocanvasitem.h 15 Dec 2005 15:32:01 -0000 1.1.1.1
+++ goocanvasitem.h 23 Mar 2006 16:58:48 -0000 1.2
@@ -15,10 +15,18 @@
/* Specifies what to do when the end of an animation has been reached. */
typedef enum
{
+ GOO_CANVAS_VISIBLE,
+ GOO_CANVAS_VISIBLE_ABOVE_THRESHOLD,
+ GOO_CANVAS_INVISIBLE
+} GooCanvasVisibility;
+
+/* Specifies what to do when the end of an animation has been reached. */
+typedef enum
+{
GOO_CANVAS_ANIMATE_FREEZE,
GOO_CANVAS_ANIMATE_RESET,
GOO_CANVAS_ANIMATE_RESTART,
- GOO_CANVAS_ANIMATE_BOUNCE,
+ GOO_CANVAS_ANIMATE_BOUNCE
} GooCanvasAnimateType;
/* This represents the bounds of an item. */
@@ -78,7 +86,6 @@
GooCanvasView *canvas_view,
GooCanvasItemView *parent_view);
-
/* Signals. */
void (* child_added) (GooCanvasItem *item,
gint child_num);
@@ -163,10 +170,6 @@
GooCanvasAnimateType type);
void goo_canvas_item_stop_animation (GooCanvasItem *item);
-GooCanvasItemView* goo_canvas_item_create_view (GooCanvasItem *item,
- GooCanvasView *canvas_view,
- GooCanvasItemView *parent_view);
-
G_END_DECLS
Index: goocanvasitemsimple.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemsimple.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- goocanvasitemsimple.c 15 Dec 2005 15:32:00 -0000 1.1.1.1
+++ goocanvasitemsimple.c 23 Mar 2006 16:58:48 -0000 1.2
@@ -37,7 +37,9 @@
PROP_FILL_PIXBUF,
/* Other properties. */
- PROP_TRANSFORM
+ PROP_TRANSFORM,
+ PROP_VISIBILITY,
+ PROP_VISIBILITY_THRESHOLD,
};
enum {
@@ -263,6 +265,12 @@
GOO_TYPE_CAIRO_MATRIX,
G_PARAM_READWRITE));
+ g_object_class_override_property (gobject_class, PROP_VISIBILITY,
+ "visibility");
+
+ g_object_class_override_property (gobject_class, PROP_VISIBILITY_THRESHOLD,
+ "visibility-threshold");
+
/* Signals. */
item_simple_signals[CHANGED] =
g_signal_new ("changed",
@@ -365,6 +373,13 @@
case PROP_TRANSFORM:
g_value_set_boxed (value, item->transform);
break;
+ case PROP_VISIBILITY:
+ g_value_set_enum (value, item->visibility);
+ break;
+ case PROP_VISIBILITY_THRESHOLD:
+ g_value_set_double (value, item->visibility_threshold);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -526,6 +541,13 @@
item->transform = goo_cairo_matrix_copy (transform);
recompute_bounds = TRUE;
break;
+ case PROP_VISIBILITY:
+ item->visibility = g_value_get_enum (value);
+ break;
+ case PROP_VISIBILITY_THRESHOLD:
+ item->visibility_threshold = g_value_get_double (value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
Index: goocanvasitemsimple.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemsimple.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- goocanvasitemsimple.h 15 Dec 2005 15:32:01 -0000 1.1.1.1
+++ goocanvasitemsimple.h 23 Mar 2006 16:58:48 -0000 1.2
@@ -86,6 +86,13 @@
/* The transformation matrix, or NULL. */
cairo_matrix_t *transform;
+
+ /* Whether the item is visible, invisible, or visible above a given scale. */
+ GooCanvasItemVisibility visibility;
+
+ /* If visibility is VISIBLE_ABOVE_THRESHOLD the item is visible if the canvas
+ scale setting is above this threshold (or equal to it). */
+ gdouble visibility_threshold;
};
struct _GooCanvasItemSimpleClass
Index: goocanvasitemview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemview.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- goocanvasitemview.c 15 Dec 2005 15:32:01 -0000 1.1.1.1
+++ goocanvasitemview.c 23 Mar 2006 16:58:48 -0000 1.2
@@ -294,10 +294,11 @@
void
goo_canvas_item_view_paint (GooCanvasItemView *view,
+ GooCanvasView *canvas_view,
cairo_t *cr,
GooCanvasBounds *bounds)
{
GooCanvasItemViewIface *iface = GOO_CANVAS_ITEM_VIEW_GET_IFACE (view);
- iface->paint (view, cr, bounds);
+ iface->paint (view, canvas_view, cr, bounds);
}
Index: goocanvasitemview.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemview.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- goocanvasitemview.h 15 Dec 2005 15:32:03 -0000 1.1.1.1
+++ goocanvasitemview.h 23 Mar 2006 16:58:48 -0000 1.2
@@ -47,6 +47,7 @@
gboolean entire_tree,
cairo_t *cr);
void (* paint) (GooCanvasItemView *view,
+ GooCanvasView *canvas_view,
cairo_t *cr,
GooCanvasBounds *bounds);
@@ -109,6 +110,7 @@
gboolean entire_tree,
cairo_t *cr);
void goo_canvas_item_view_paint (GooCanvasItemView *view,
+ GooCanvasView *canvas_view,
cairo_t *cr,
GooCanvasBounds *bounds);
Index: goocanvaspolylineview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvaspolylineview.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- goocanvaspolylineview.c 15 Dec 2005 15:32:00 -0000 1.1.1.1
+++ goocanvaspolylineview.c 23 Mar 2006 16:58:48 -0000 1.2
@@ -333,6 +333,7 @@
static void
goo_canvas_polyline_view_paint (GooCanvasItemView *view,
+ GooCanvasView *canvas_view,
cairo_t *cr,
GooCanvasBounds *bounds)
{
@@ -347,6 +348,12 @@
if (polyline->num_points == 0)
return;
+ /* Check if the item should be visible. */
+ if (simple->visibility == GOO_CANVAS_ITEM_INVISIBLE
+ || (simple->visibility == GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD
+ && simple->visibility_threshold < canvas_view->pixels_per_unit))
+ return;
+
cairo_save (cr);
if (simple->transform)
cairo_transform (cr, simple->transform);
Index: goocanvasrectview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasrectview.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- goocanvasrectview.c 15 Dec 2005 15:32:01 -0000 1.1.1.1
+++ goocanvasrectview.c 23 Mar 2006 16:58:48 -0000 1.2
@@ -239,6 +239,7 @@
static void
goo_canvas_rect_view_paint (GooCanvasItemView *view,
+ GooCanvasView *canvas_view,
cairo_t *cr,
GooCanvasBounds *bounds)
{
@@ -250,6 +251,12 @@
g_print ("Painting rect item %p\n", view);
#endif
+ /* Check if the item should be visible. */
+ if (simple->visibility == GOO_CANVAS_ITEM_INVISIBLE
+ || (simple->visibility == GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD
+ && simple->visibility_threshold < canvas_view->pixels_per_unit))
+ return;
+
cairo_save (cr);
if (simple->transform)
cairo_transform (cr, simple->transform);
Index: goocanvastextview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvastextview.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- goocanvastextview.c 22 Mar 2006 23:49:44 -0000 1.2
+++ goocanvastextview.c 23 Mar 2006 16:58:48 -0000 1.3
@@ -118,7 +118,6 @@
if (bounds)
{
/* Get size of the text, so we can position it according to anchor. */
- /* FIXME: How do Pango coords relate to our coords? */
pango_layout_get_extents (layout, NULL, &logical_rect);
#if 0
@@ -321,6 +320,7 @@
static void
goo_canvas_text_view_paint (GooCanvasItemView *view,
+ GooCanvasView *canvas_view,
cairo_t *cr,
GooCanvasBounds *bounds)
{
@@ -338,6 +338,12 @@
g_print ("Painting text item %p\n", view);
#endif
+ /* Check if the item should be visible. */
+ if (simple->visibility == GOO_CANVAS_ITEM_INVISIBLE
+ || (simple->visibility == GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD
+ && canvas_view->pixels_per_unit < simple->visibility_threshold))
+ return;
+
cairo_save (cr);
if (simple->transform)
cairo_transform (cr, simple->transform);
Index: goocanvasutils.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasutils.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- goocanvasutils.c 15 Dec 2005 15:32:01 -0000 1.1.1.1
+++ goocanvasutils.c 23 Mar 2006 16:58:48 -0000 1.2
@@ -77,6 +77,32 @@
}
+/*
+ * Enum types.
+ */
+GType
+goo_canvas_item_visibility_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { GOO_CANVAS_ITEM_VISIBLE, "GOO_CANVAS_ITEM_VISIBLE", "visible" },
+ { GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD, "GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD", "visible-above-threshold" },
+ { GOO_CANVAS_ITEM_INVISIBLE, "GOO_CANVAS_ITEM_INVISIBLE", "invisible" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GooCanvasItemVisibility", values);
+ }
+ return etype;
+}
+
+
+
+
+/*
+ * Cairo utilities.
+ */
+
cairo_surface_t*
goo_canvas_cairo_surface_from_pixbuf (GdkPixbuf *pixbuf)
{
Index: goocanvasutils.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasutils.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- goocanvasutils.h 15 Dec 2005 15:32:01 -0000 1.1.1.1
+++ goocanvasutils.h 23 Mar 2006 16:58:48 -0000 1.2
@@ -27,6 +27,18 @@
gpointer data);
+/*
+ * Enum types.
+ */
+#define GOO_TYPE_CANVAS_ITEM_VISIBILITY (goo_canvas_item_visibility_get_type ())
+GType goo_canvas_item_visibility_get_type (void) G_GNUC_CONST;
+typedef enum
+{
+ GOO_CANVAS_ITEM_VISIBLE,
+ GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD,
+ GOO_CANVAS_ITEM_INVISIBLE
+} GooCanvasItemVisibility;
+
/*
* Cairo utilities.
Index: goocanvasview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasview.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- goocanvasview.c 23 Mar 2006 00:13:59 -0000 1.3
+++ goocanvasview.c 23 Mar 2006 16:58:48 -0000 1.4
@@ -770,7 +770,8 @@
/* The virtial method can return NULL to use the default view for an item. */
if (!item_view)
- item_view = goo_canvas_item_create_view (item, view, parent_view);
+ item_view = GOO_CANVAS_ITEM_GET_IFACE (item)->create_view (item, view,
+ parent_view);
/* Emit a signal so apps can hook up signal handlers if they want. */
g_signal_emit (view, canvas_view_signals[ITEM_VIEW_CREATED], 0,
@@ -931,7 +932,7 @@
/* Translate it so the top-left of the canvas becomes (0,0). */
cairo_translate (cr, -view->left, -view->top);
- goo_canvas_item_view_paint (view->root_view, cr, &bounds);
+ goo_canvas_item_view_paint (view->root_view, view, cr, &bounds);
cairo_destroy (cr);
@@ -1154,11 +1155,11 @@
{
double x = view->crossing_event.x;
double y = view->crossing_event.y;
+ cairo_t *cr;
goo_canvas_view_convert_from_pixels (view, &x, &y);
- /* FIXME: Should we keep a cairo_t around? */
- cairo_t *cr = goo_canvas_view_create_cairo (view);
+ cr = goo_canvas_view_create_cairo (view);
new_item_view = goo_canvas_item_view_get_item_at (view->root_view,
x, y, cr);
cairo_destroy (cr);
More information about the cairo-commit
mailing list