[cairo-commit] goocanvas/src goocanvastext.c, 1.19, 1.20 goocanvastext.h, 1.8, 1.9

Damon Chaplin commit at pdx.freedesktop.org
Mon Aug 13 04:33:33 PDT 2007


Committed by: damon

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

Modified Files:
	goocanvastext.c goocanvastext.h 
Log Message:
2007-08-13  Damon Chaplin  <damon at gnome.org>

	* src/goocanvastext.c: added "wrap" property (patch from James
	Dietrich).



Index: goocanvastext.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvastext.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- goocanvastext.c	8 Mar 2007 12:31:59 -0000	1.19
+++ goocanvastext.c	13 Aug 2007 11:33:15 -0000	1.20
@@ -41,7 +41,8 @@
   PROP_USE_MARKUP,
   PROP_ANCHOR,
   PROP_ALIGN,
-  PROP_ELLIPSIZE
+  PROP_ELLIPSIZE,
+  PROP_WRAP
 };
 
 static void goo_canvas_text_finalize     (GObject            *object);
@@ -87,6 +88,14 @@
 						      PANGO_ELLIPSIZE_NONE,
                                                       G_PARAM_READWRITE));
 
+  g_object_class_install_property (gobject_class, PROP_WRAP,
+                                   g_param_spec_enum ("wrap",
+                                                      _("Wrap"),
+                                                      _("The preferred method of wrapping the string if a width has been set"),
+						      PANGO_TYPE_WRAP_MODE,
+						      PANGO_WRAP_WORD,
+                                                      G_PARAM_READWRITE));
+
   /* Position */
   g_object_class_install_property (gobject_class, PROP_X,
 				   g_param_spec_double ("x",
@@ -137,6 +146,7 @@
   text->text_data->width = -1.0;
   text->text_data->anchor = GTK_ANCHOR_NW;
   text->text_data->ellipsize = PANGO_ELLIPSIZE_NONE;
+  text->text_data->wrap = PANGO_WRAP_WORD;
 
   text->layout_width = -1.0;
 }
@@ -260,6 +270,9 @@
     case PROP_ELLIPSIZE:
       g_value_set_enum (value, text_data->ellipsize);
       break;
+    case PROP_WRAP:
+      g_value_set_enum (value, text_data->wrap);
+      break;
     case PROP_ANCHOR:
       g_value_set_enum (value, text_data->anchor);
       break;
@@ -314,6 +327,9 @@
     case PROP_ELLIPSIZE:
       text_data->ellipsize = g_value_get_enum (value);
       break;
+    case PROP_WRAP:
+      text_data->wrap = g_value_get_enum (value);
+      break;
     case PROP_ANCHOR:
       text_data->anchor = g_value_get_enum (value);
       break;
@@ -403,6 +419,8 @@
 
   pango_layout_set_ellipsize (layout, text_data->ellipsize);
 
+  pango_layout_set_wrap (layout, text_data->wrap);
+
   if (bounds)
     {
       /* Get size of the text, so we can position it according to anchor. */
@@ -802,6 +820,7 @@
   tmodel->text_data.width = -1.0;
   tmodel->text_data.anchor = GTK_ANCHOR_NW;
   tmodel->text_data.ellipsize = PANGO_ELLIPSIZE_NONE;
+  tmodel->text_data.wrap = PANGO_WRAP_WORD;
 }
 
 

Index: goocanvastext.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvastext.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- goocanvastext.h	8 Mar 2007 12:31:59 -0000	1.8
+++ goocanvastext.h	13 Aug 2007 11:33:15 -0000	1.9
@@ -23,6 +23,7 @@
   guint anchor			: 5;	/* GtkAnchorType */
   guint alignment		: 3;	/* PangoAlignment */
   guint ellipsize		: 3;	/* PangoEllipsizeMode */
+  guint wrap			: 3;	/* PangoWrapMode */
 };
 
 



More information about the cairo-commit mailing list