[cairo-commit] goocanvas/src goocanvasellipse.c, 1.2, 1.3 goocanvasgroup.c, 1.6, 1.7 goocanvasgroup.h, 1.4, 1.5 goocanvasgroupview.c, 1.7, 1.8 goocanvasimage.c, 1.3, 1.4 goocanvasitem.c, 1.4, 1.5 goocanvasitem.h, 1.5, 1.6 goocanvasitemsimple.c, 1.5, 1.6 goocanvasitemsimple.h, 1.5, 1.6 goocanvaspath.c, 1.2, 1.3 goocanvaspolyline.c, 1.2, 1.3 goocanvasrect.c, 1.2, 1.3 goocanvastext.c, 1.2, 1.3 goocanvasview.c, 1.9, 1.10

Damon Chaplin commit at pdx.freedesktop.org
Sun Apr 16 03:39:53 PDT 2006


Committed by: damon

Update of /cvs/cairo/goocanvas/src
In directory kemper:/tmp/cvs-serv17356/src

Modified Files:
	goocanvasellipse.c goocanvasgroup.c goocanvasgroup.h 
	goocanvasgroupview.c goocanvasimage.c goocanvasitem.c 
	goocanvasitem.h goocanvasitemsimple.c goocanvasitemsimple.h 
	goocanvaspath.c goocanvaspolyline.c goocanvasrect.c 
	goocanvastext.c goocanvasview.c 
Log Message:
2006-04-16  Damon Chaplin  <damon at gnome.org>

	* src/goocanvasitem.c: 
	* src/goocanvasitemsimple.c: 
	* src/goocanvasgroup.c: moved "pointer-events" and "transform"
	properties, and the "changed" signal to the GooCanvasItem interface.

	* src/*.[hc]: updated use of above.



Index: goocanvasellipse.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasellipse.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- goocanvasellipse.c	13 Apr 2006 16:06:04 -0000	1.2
+++ goocanvasellipse.c	16 Apr 2006 10:39:51 -0000	1.3
@@ -45,7 +45,7 @@
   PROP_RADIUS_Y
 };
 
-static void goo_canvas_ellipse_finalize (GObject *object);
+
 static void item_interface_init (GooCanvasItemIface *iface);
 static void goo_canvas_ellipse_get_property (GObject            *object,
 					     guint               param_id,
@@ -67,8 +67,6 @@
 {
   GObjectClass *gobject_class = (GObjectClass*) klass;
 
-  gobject_class->finalize = goo_canvas_ellipse_finalize;
-
   gobject_class->get_property = goo_canvas_ellipse_get_property;
   gobject_class->set_property = goo_canvas_ellipse_set_property;
 
@@ -178,15 +176,6 @@
 
 
 static void
-goo_canvas_ellipse_finalize (GObject *object)
-{
-  /*GooCanvasEllipse *o = (GooCanvasEllipse*) object;*/
-
-  G_OBJECT_CLASS (goo_canvas_ellipse_parent_class)->finalize (object);
-}
-
-
-static void
 goo_canvas_ellipse_get_property (GObject              *object,
 				 guint                 prop_id,
 				 GValue               *value,
@@ -222,7 +211,6 @@
 				 GParamSpec           *pspec)
 {
   GooCanvasEllipse *ellipse = (GooCanvasEllipse*) object;
-  GooCanvasItemSimple *simple = (GooCanvasItemSimple*) object;
 
   switch (prop_id)
     {
@@ -243,8 +231,7 @@
       break;
     }
 
-  if (simple->parent)
-    goo_canvas_item_simple_emit_changed (simple, TRUE);
+  g_signal_emit_by_name (ellipse, "changed", TRUE);
 }
 
 

Index: goocanvasgroup.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasgroup.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- goocanvasgroup.c	14 Apr 2006 16:59:04 -0000	1.6
+++ goocanvasgroup.c	16 Apr 2006 10:39:51 -0000	1.7
@@ -16,7 +16,8 @@
  *
  * #GooCanvasGroup implements the #GooCanvasItem interface, so you can use the
  * #GooCanvasItem functions such as goo_canvas_item_raise() and
- * goo_canvas_item_rotate().
+ * goo_canvas_item_rotate(), and the properties such as "visibility" and
+ * "pointer-events".
  *
  * To create a #GooCanvasGroup use goo_canvas_group_new().
  *
@@ -45,14 +46,6 @@
   PROP_POINTER_EVENTS
 };
 
-enum {
-  CHANGED,
-
-  LAST_SIGNAL
-};
-
-static guint group_signals[LAST_SIGNAL] = { 0 };
-
 
 static void goo_canvas_group_finalize  (GObject *object);
 static void canvas_item_interface_init (GooCanvasItemIface *iface);
@@ -81,42 +74,17 @@
   gobject_class->get_property = goo_canvas_group_get_property;
   gobject_class->set_property = goo_canvas_group_set_property;
 
-  g_object_class_install_property (gobject_class, PROP_TRANSFORM,
-				   g_param_spec_boxed ("transform",
-						       _("Transform"),
-						       _("The transformation matrix of the item"),
-						       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");
 
-  g_object_class_install_property (gobject_class, PROP_POINTER_EVENTS,
-				   g_param_spec_enum ("pointer-events",
-						      _("Pointer Events"),
-						      _("Specifies when the item receives pointer events"),
-						      GOO_TYPE_CANVAS_POINTER_EVENTS,
-						      GOO_CANVAS_EVENTS_VISIBLE_PAINTED,
-						      G_PARAM_READWRITE));
-
-  /* Signals. */
+  g_object_class_override_property (gobject_class, PROP_TRANSFORM,
+				    "transform");
 
-  /**
-   * GooCanvasGroup::changed
-   *
-   * Emitted when the group is changed.
-   */
-  group_signals[CHANGED] =
-    g_signal_new ("changed",
-		  G_TYPE_FROM_CLASS (gobject_class),
-		  G_SIGNAL_RUN_LAST,
-		  G_STRUCT_OFFSET (GooCanvasGroupClass, changed),
-		  NULL, NULL,
-		  goo_canvas_marshal_VOID__VOID,
-		  G_TYPE_NONE, 0);
+  g_object_class_override_property (gobject_class, PROP_POINTER_EVENTS,
+				    "pointer-events");
 }
 
 
@@ -300,7 +268,7 @@
   else
     cairo_matrix_init_identity (&group->transform);
 
-  g_signal_emit (group, group_signals[CHANGED], 0);
+  g_signal_emit_by_name (group, "changed", TRUE);
 }
 
 
@@ -393,5 +361,5 @@
       break;
     }
 
-  g_signal_emit (group, group_signals[CHANGED], 0);
+  g_signal_emit_by_name (group, "changed", TRUE);
 }

Index: goocanvasgroup.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasgroup.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- goocanvasgroup.h	13 Apr 2006 16:06:04 -0000	1.4
+++ goocanvasgroup.h	16 Apr 2006 10:39:51 -0000	1.5
@@ -61,8 +61,6 @@
 struct _GooCanvasGroupClass
 {
   GObjectClass parent_class;
-
-  void         (* changed)	            (GooCanvasGroup *group);
 };
 
 

Index: goocanvasgroupview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasgroupview.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- goocanvasgroupview.c	14 Apr 2006 12:49:10 -0000	1.7
+++ goocanvasgroupview.c	16 Apr 2006 10:39:51 -0000	1.8
@@ -38,6 +38,7 @@
 static void add_child_views_recursively     (GooCanvasGroupView   *group_view);
 static void connect_group_signals           (GooCanvasGroupView   *group_view);
 static void on_group_changed                (GooCanvasGroup       *group,
+					     gboolean              recompute_bounds,
 					     GooCanvasGroupView   *view);
 
 G_DEFINE_TYPE_WITH_CODE (GooCanvasGroupView, goo_canvas_group_view,
@@ -470,6 +471,7 @@
 
 static void
 on_group_changed                (GooCanvasGroup     *group,
+				 gboolean            recompute_bounds,
 				 GooCanvasGroupView *view)
 {
   view->need_entire_subtree_update = TRUE;

Index: goocanvasimage.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasimage.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- goocanvasimage.c	14 Apr 2006 12:49:10 -0000	1.3
+++ goocanvasimage.c	16 Apr 2006 10:39:51 -0000	1.4
@@ -262,7 +262,6 @@
 			       GParamSpec           *pspec)
 {
   GooCanvasImage *image = (GooCanvasImage*) object;
-  GooCanvasItemSimple *simple = (GooCanvasItemSimple*) object;
   GdkPixbuf *pixbuf;
 
   switch (prop_id)
@@ -296,6 +295,5 @@
       break;
   }
 
-  if (simple->parent)
-    goo_canvas_item_simple_emit_changed (simple, TRUE);
+  g_signal_emit_by_name (image, "changed", TRUE);
 }

Index: goocanvasitem.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitem.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- goocanvasitem.c	14 Apr 2006 18:52:28 -0000	1.4
+++ goocanvasitem.c	16 Apr 2006 10:39:51 -0000	1.5
@@ -17,6 +17,7 @@
 #include <math.h>
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
+#include "goocanvasprivate.h"
 #include "goocanvasitem.h"
 #include "goocanvasutils.h"
 #include "goocanvasmarshal.h"
@@ -28,6 +29,7 @@
   CHILD_ADDED,
   CHILD_MOVED,
   CHILD_REMOVED,
+  CHANGED,
 
   LAST_SIGNAL
 };
@@ -125,6 +127,24 @@
 		      G_TYPE_NONE, 1,
 		      G_TYPE_INT);
 
+      /**
+       * GooCanvasItem::changed
+       * @item: the item that received the signal.
+       * @recompute_bounds: if the bounds of the item need to be recomputed.
+       *
+       * Emitted when the item has been changed.
+       */
+      canvas_item_signals[CHANGED] =
+	g_signal_new ("changed",
+		      iface_type,
+		      G_SIGNAL_RUN_LAST,
+		      G_STRUCT_OFFSET (GooCanvasItemIface, changed),
+		      NULL, NULL,
+		      goo_canvas_marshal_VOID__BOOLEAN,
+		      G_TYPE_NONE, 1,
+		      G_TYPE_BOOLEAN);
+
+
       g_object_interface_install_property (g_iface,
 					   g_param_spec_enum ("visibility",
 							      _("Visibility"),
@@ -141,6 +161,21 @@
 								0.0,
 								G_PARAM_READWRITE));
 
+      g_object_interface_install_property (g_iface,
+					   g_param_spec_boxed ("transform",
+							       _("Transform"),
+							       _("The transformation matrix of the item"),
+							       GOO_TYPE_CAIRO_MATRIX,
+							       G_PARAM_READWRITE));
+
+      g_object_interface_install_property (g_iface,
+					   g_param_spec_enum ("pointer-events",
+							      _("Pointer Events"),
+							      _("Specifies when the item receives pointer events"),
+							      GOO_TYPE_CANVAS_POINTER_EVENTS,
+							      GOO_CANVAS_EVENTS_VISIBLE_PAINTED,
+							      G_PARAM_READWRITE));
+
       initialized = TRUE;
     }
 }

Index: goocanvasitem.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitem.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- goocanvasitem.h	14 Apr 2006 16:59:04 -0000	1.5
+++ goocanvasitem.h	16 Apr 2006 10:39:51 -0000	1.6
@@ -125,6 +125,8 @@
 					   gint                new_child_num);
   void                 (* child_removed)  (GooCanvasItem      *item,
 					   gint                child_num);
+  void                 (* changed)	  (GooCanvasItem      *item,
+					   gboolean            recompute_bounds);
 };
 
 

Index: goocanvasitemsimple.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemsimple.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- goocanvasitemsimple.c	14 Apr 2006 16:59:04 -0000	1.5
+++ goocanvasitemsimple.c	16 Apr 2006 10:39:51 -0000	1.6
@@ -58,14 +58,6 @@
   PROP_POINTER_EVENTS
 };
 
-enum {
-  CHANGED,
-
-  LAST_SIGNAL
-};
-
-static guint item_simple_signals[LAST_SIGNAL] = { 0 };
-
 
 static void goo_canvas_item_simple_finalize (GObject *object);
 static void item_interface_init (GooCanvasItemIface *iface);
@@ -322,45 +314,17 @@
                                                         G_PARAM_WRITABLE));
 
   /* Other properties. */
-  g_object_class_install_property (gobject_class, PROP_TRANSFORM,
-				   g_param_spec_boxed ("transform",
-						       _("Transform"),
-						       _("The transformation matrix of the item"),
-						       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");
 
-  g_object_class_install_property (gobject_class, PROP_POINTER_EVENTS,
-				   g_param_spec_enum ("pointer-events",
-						      _("Pointer Events"),
-						      _("Specifies when the item receives pointer events"),
-						      GOO_TYPE_CANVAS_POINTER_EVENTS,
-						      GOO_CANVAS_EVENTS_VISIBLE_PAINTED,
-						      G_PARAM_READWRITE));
-
-  /* Signals. */
+  g_object_class_override_property (gobject_class, PROP_TRANSFORM,
+				    "transform");
 
-  /**
-   * GooCanvasItemSimple::changed
-   * @item: the item that received the signal.
-   * @recompute_bounds: if the bounds of the item need to be recomputed.
-   *
-   * Emitted when the item has been changed.
-   */
-  item_simple_signals[CHANGED] =
-    g_signal_new ("changed",
-		  G_TYPE_FROM_CLASS (gobject_class),
-		  G_SIGNAL_RUN_LAST,
-		  G_STRUCT_OFFSET (GooCanvasItemSimpleClass, changed),
-		  NULL, NULL,
-		  goo_canvas_marshal_VOID__BOOLEAN,
-		  G_TYPE_NONE, 1,
-		  G_TYPE_BOOLEAN);
+  g_object_class_override_property (gobject_class, PROP_POINTER_EVENTS,
+				    "pointer-events");
 }
 
 
@@ -632,8 +596,7 @@
       break;
   }
 
-  if (item->parent)
-    goo_canvas_item_simple_emit_changed (item, recompute_bounds);
+  g_signal_emit_by_name (item, "changed", recompute_bounds);
 }
 
 /**
@@ -655,8 +618,7 @@
 
   item->style = goo_canvas_style_ref (style);
 
-  if (item->parent)
-    goo_canvas_item_simple_emit_changed (item, TRUE);
+  g_signal_emit_by_name (item, "changed", TRUE);
 }
 
 
@@ -702,8 +664,7 @@
       simple->transform = NULL;
     }
 
-  if (simple->parent)
-    goo_canvas_item_simple_emit_changed (simple, TRUE);
+  g_signal_emit_by_name (item, "changed", TRUE);
 }
 
 
@@ -993,18 +954,3 @@
 }
 
 
-/**
- * goo_canvas_item_simple_emit_changed:
- * @item: a #GooCanvasItemSimple.
- * @recompute_bounds: %TRUE if the item's bounds need to be recomputed.
- * 
- * Emits the "changed" signal on the item, so any views are updated.
- **/
-void
-goo_canvas_item_simple_emit_changed  (GooCanvasItemSimple *item,
-				      gboolean             recompute_bounds)
-{
-  g_signal_emit (item, item_simple_signals[CHANGED], 0, recompute_bounds);
-}
-
-

Index: goocanvasitemsimple.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemsimple.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- goocanvasitemsimple.h	14 Apr 2006 16:59:04 -0000	1.5
+++ goocanvasitemsimple.h	16 Apr 2006 10:39:51 -0000	1.6
@@ -141,9 +141,6 @@
 struct _GooCanvasItemSimpleClass
 {
   GObjectClass parent_class;
-
-  void         (* changed)	       (GooCanvasItemSimple *item,
-					gboolean             recompute_bounds);
 };
 
 
@@ -171,8 +168,6 @@
 void           goo_canvas_item_simple_paint_path    (GooCanvasItemSimple *item,
 						     cairo_t             *cr);
 
-void           goo_canvas_item_simple_emit_changed  (GooCanvasItemSimple *item,
-						     gboolean             recompute_bounds);
 
 G_END_DECLS
 

Index: goocanvaspath.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvaspath.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- goocanvaspath.c	13 Apr 2006 16:06:04 -0000	1.2
+++ goocanvaspath.c	16 Apr 2006 10:39:51 -0000	1.3
@@ -350,7 +350,6 @@
 			      GParamSpec           *pspec)
 {
   GooCanvasPath *path = (GooCanvasPath*) object;
-  GooCanvasItemSimple *simple = (GooCanvasItemSimple*) object;
 
   switch (prop_id)
     {
@@ -362,8 +361,7 @@
       break;
   }
 
-  if (simple->parent)
-    goo_canvas_item_simple_emit_changed (simple, TRUE);
+  g_signal_emit_by_name (path, "changed", TRUE);
 }
 
 

Index: goocanvaspolyline.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvaspolyline.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- goocanvaspolyline.c	13 Apr 2006 16:06:04 -0000	1.2
+++ goocanvaspolyline.c	16 Apr 2006 10:39:51 -0000	1.3
@@ -428,7 +428,6 @@
 				  GParamSpec           *pspec)
 {
   GooCanvasPolyline *polyline = (GooCanvasPolyline*) object;
-  GooCanvasItemSimple *simple = (GooCanvasItemSimple*) object;
   GooCanvasPoints *points;
 
   switch (prop_id)
@@ -487,8 +486,7 @@
       break;
   }
 
-  if (simple->parent)
-    goo_canvas_item_simple_emit_changed (simple, TRUE);
+  g_signal_emit_by_name (polyline, "changed", TRUE);
 }
 
 

Index: goocanvasrect.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasrect.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- goocanvasrect.c	13 Apr 2006 16:06:04 -0000	1.2
+++ goocanvasrect.c	16 Apr 2006 10:39:51 -0000	1.3
@@ -46,7 +46,7 @@
   PROP_RADIUS_Y
 };
 
-static void goo_canvas_rect_finalize (GObject *object);
+
 static void item_interface_init (GooCanvasItemIface *iface);
 static void goo_canvas_rect_get_property (GObject            *object,
 					  guint               param_id,
@@ -68,8 +68,6 @@
 {
   GObjectClass *gobject_class = (GObjectClass*) klass;
 
-  gobject_class->finalize = goo_canvas_rect_finalize;
-
   gobject_class->get_property = goo_canvas_rect_get_property;
   gobject_class->set_property = goo_canvas_rect_set_property;
 
@@ -193,15 +191,6 @@
 }
 
 
-static void
-goo_canvas_rect_finalize (GObject *object)
-{
-  /*GooCanvasRect *item = (GooCanvasRect*) object;*/
-
-  G_OBJECT_CLASS (goo_canvas_rect_parent_class)->finalize (object);
-}
-
-
 static GooCanvasItemView*
 goo_canvas_rect_create_view (GooCanvasItem     *item,
 			     GooCanvasView     *canvas_view,
@@ -260,7 +249,6 @@
 			      GParamSpec           *pspec)
 {
   GooCanvasRect *rect = (GooCanvasRect*) object;
-  GooCanvasItemSimple *simple = (GooCanvasItemSimple*) object;
 
   switch (prop_id)
     {
@@ -287,7 +275,6 @@
       break;
   }
 
-  if (simple->parent)
-    goo_canvas_item_simple_emit_changed (simple, TRUE);
+  g_signal_emit_by_name (rect, "changed", TRUE);
 }
 

Index: goocanvastext.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvastext.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- goocanvastext.c	13 Apr 2006 16:06:04 -0000	1.2
+++ goocanvastext.c	16 Apr 2006 10:39:51 -0000	1.3
@@ -314,7 +314,6 @@
 			      GParamSpec           *pspec)
 {
   GooCanvasText *text = (GooCanvasText*) object;
-  GooCanvasItemSimple *simple = (GooCanvasItemSimple*) object;
   const char *font_name;
   PangoFontDescription *font_desc;
 
@@ -365,7 +364,6 @@
       break;
   }
 
-  if (simple->parent)
-    goo_canvas_item_simple_emit_changed (simple, TRUE);
+  g_signal_emit_by_name (text, "changed", TRUE);
 }
 

Index: goocanvasview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasview.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- goocanvasview.c	14 Apr 2006 18:52:28 -0000	1.9
+++ goocanvasview.c	16 Apr 2006 10:39:51 -0000	1.10
@@ -6,11 +6,11 @@
  */
 
 /**
- * SECTION:goocanvasview
+ * SECTION: goocanvasview
  * @Title: GooCanvasView
- * @Short_Description: the main #GooCanvas widget.
+ * @Short_Description: the main canvas widget.
  *
- * #GooCanvasView is the main widget containing the view of the canvas.
+ * #GooCanvasView is the main widget containing the view of the canvas model.
  */
 #include <config.h>
 #include <gtk/gtk.h>
@@ -905,8 +905,11 @@
  * 
  * Updates any item views that need updating.
  *
+ * This is only intended to be used by subclasses of #GooCanvasView or
+ * #GooCanvasItemView implementations.
+ *
  * If the bounds of items change, they will request a redraw of the old and
- * new bounds.
+ * new bounds so the display is updated correctly.
  **/
 void
 goo_canvas_view_update (GooCanvasView *view)



More information about the cairo-commit mailing list