[goffice] Support wrapped charts labels, partially fixes #643873.



commit 839f8a6c919068868a61968d207e0347e07e9b12
Author: Jean Brefort <jean brefort normalesup org>
Date:   Tue Dec 27 15:42:07 2011 +0100

    Support wrapped charts labels, partially fixes #643873.

 ChangeLog                 |   12 ++++++++++++
 NEWS                      |    1 +
 configure.in              |    2 +-
 goffice/graph/gog-label.c |   16 +++++++++-------
 goffice/gtk/go-font-sel.c |    2 +-
 goffice/utils/go-image.c  |   14 ++++++++++++++
 6 files changed, 38 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 26f78c9..5080ba7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-12-27  Jean Brefort  <jean brefort normalesup org>
+
+	* configure.in: inhibit eps support for now because it makes gnumeric
+	crash when using jpeg images.
+	* goffice/graph/gog-label.c (gog_text_set_property),
+	(gog_text_view_size_request), (gog_text_view_render): add justification for
+	multi lines text.
+	* goffice/gtk/go-font-sel.c (go_font_sel_set_font): allow non integer font
+	sizes.
+	* goffice/utils/go-image.c (go_image_new_from_data): always display an image
+	even when the format is not supported.
+
 2011-12-25  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* goffice/utils/go-glib-extras.c (go_unichar_issign): add signs
diff --git a/NEWS b/NEWS
index d1c7b75..efeea4d 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ Andreas:
 Jean:
 	* Fixed rounding errors in limits displayed in contour plot legend.
 	[#666292]
+	* Support wrapped charts labels, partially fixes #643873.
 
 Morten:
 	* Embed library ui files into library.
diff --git a/configure.in b/configure.in
index 2edc80a..6df81b7 100644
--- a/configure.in
+++ b/configure.in
@@ -141,7 +141,7 @@ dnl ***************************
 dnl Should we use libspectre ?
 dnl ***************************
 
-goffice_with_eps=true
+goffice_with_eps=false
 PKG_CHECK_MODULES(EPS, libspectre >= 0.2.6,[], [goffice_with_eps=false])
 if test "x$goffice_with_eps" = "xtrue" ; then
 	AC_DEFINE(GOFFICE_WITH_EPS, 1, [Define if EPS is supported])
diff --git a/goffice/graph/gog-label.c b/goffice/graph/gog-label.c
index 5a90565..5fdfa22 100644
--- a/goffice/graph/gog-label.c
+++ b/goffice/graph/gog-label.c
@@ -69,7 +69,7 @@ gog_text_set_property (GObject *obj, guint param_id,
 	default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
 		 return; /* NOTE : RETURN */
 	}
-	gog_object_emit_changed (GOG_OBJECT (obj), FALSE);
+	gog_object_emit_changed (GOG_OBJECT (obj), TRUE);
 }
 
 static void
@@ -644,6 +644,7 @@ gog_text_view_size_request (GogView *v,
 	char *str = gog_text_get_str (text);
 	PangoAttrList *pl = text->allow_markup? NULL: gog_text_get_markup (text);
 	GOGeometryAABR aabr;
+	double w = text->allow_wrap? available->w: -1.;
 
 	req->w = req->h = 0.;
 	if (str != NULL) {
@@ -658,10 +659,10 @@ gog_text_view_size_request (GogView *v,
 			style->text_layout.angle = 0.;
 		gog_renderer_push_style (v->renderer, style);
 		if (gostr) {
-			gog_renderer_get_gostring_AABR (v->renderer, gostr, &aabr, available->w);
+			gog_renderer_get_gostring_AABR (v->renderer, gostr, &aabr, w);
 			go_string_unref (gostr);
 		} else
-			gog_renderer_get_text_AABR (v->renderer, str, text->allow_markup, &aabr, available->w);
+			gog_renderer_get_text_AABR (v->renderer, str, text->allow_markup, &aabr, w);
 		gog_renderer_pop_style (v->renderer);
 		g_object_unref (style);
 		if (text->rotate_frame) {
@@ -684,6 +685,7 @@ gog_text_view_render (GogView *view, GogViewAllocation const *bbox)
 	GOStyle *style = text->base.base.style;
 	char *str = gog_text_get_str (text);
 	PangoAttrList *pl = text->allow_markup? NULL: gog_text_get_markup (text);
+	double w = text->allow_wrap? view->allocation.w: -1.;
 
 	gog_renderer_push_style (view->renderer, style);
 	if (str != NULL) {
@@ -707,9 +709,9 @@ gog_text_view_render (GogView *view, GogViewAllocation const *bbox)
 				gog_renderer_push_style (view->renderer, rect_style);
 			}
 			if (gostr)
-				gog_renderer_get_gostring_AABR (view->renderer, gostr, &aabr, view->allocation.w);
+				gog_renderer_get_gostring_AABR (view->renderer, gostr, &aabr, w);
 			else
-				gog_renderer_get_text_AABR (view->renderer, str, text->allow_markup, &aabr, view->allocation.w);
+				gog_renderer_get_text_AABR (view->renderer, str, text->allow_markup, &aabr, w);
 			if (text->rotate_frame) {
 				rect = view->allocation;
 				rect.w = aabr.w + 2. * outline + pad_x;
@@ -731,14 +733,14 @@ gog_text_view_render (GogView *view, GogViewAllocation const *bbox)
 			gog_renderer_draw_gostring (view->renderer, gostr,
 			                            &view->residual, GO_ANCHOR_NW,
 			                            (GOG_IS_LABEL (text)? GOG_LABEL (text)->justification: GTK_JUSTIFY_LEFT),
-			                            view->allocation.w);
+			                            w);
 			go_string_unref (gostr);
 		} else
 			gog_renderer_draw_text (view->renderer, str,
 		                    		&view->residual, GO_ANCHOR_NW,
 			                        text->allow_markup,
 			                        (GOG_IS_LABEL (text)? GOG_LABEL (text)->justification: GTK_JUSTIFY_LEFT),
-			                        view->allocation.w);
+			                        w);
 		g_free (str);
 	}
 	gog_renderer_pop_style (view->renderer);
diff --git a/goffice/gtk/go-font-sel.c b/goffice/gtk/go-font-sel.c
index a6fc511..4c94031 100644
--- a/goffice/gtk/go-font-sel.c
+++ b/goffice/gtk/go-font-sel.c
@@ -541,7 +541,7 @@ go_font_sel_set_font (GOFontSel *gfs, GOFont const *font)
 		pango_font_description_get_weight (font->desc) >= PANGO_WEIGHT_BOLD,
 		pango_font_description_get_style (font->desc) != PANGO_STYLE_NORMAL);
 	go_font_sel_set_points (gfs,
-		pango_font_description_get_size (font->desc) / PANGO_SCALE);
+		((double) pango_font_description_get_size (font->desc)) / PANGO_SCALE);
 	go_font_sel_set_strike (gfs, font->strikethrough);
 	go_font_sel_set_uline (gfs, font->underline);
 	go_font_sel_set_color (gfs, font->color);
diff --git a/goffice/utils/go-image.c b/goffice/utils/go-image.c
index 0e9f912..d983612 100644
--- a/goffice/utils/go-image.c
+++ b/goffice/utils/go-image.c
@@ -490,6 +490,20 @@ go_image_new_from_data (char const *type, guint8 const *data, gsize length, char
 			g_object_unref (loader);
 		}
 	}
+	if (image == NULL) {
+		GtkIconTheme *theme = gtk_icon_theme_get_default ();
+		GdkPixbuf *placeholder;
+		if (gtk_icon_theme_has_icon (theme,"unknown_image"))
+			placeholder = gtk_icon_theme_load_icon (theme, "unknown_image", 100, 0, NULL);
+		else if (gtk_icon_theme_has_icon (theme,"unknown"))
+			placeholder = gtk_icon_theme_load_icon (theme, "unknown", 100, 0, NULL);
+		else
+			placeholder = gtk_icon_theme_load_icon (theme,
+			                                        gtk_icon_theme_get_example_icon_name (theme),
+			                                        100, 0, NULL);
+		image = go_pixbuf_new_from_pixbuf (placeholder);
+		g_object_unref (placeholder);
+	}
 	if (format)
 		*format = g_strdup (type);
 	g_free (real_type);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]