[gnumeric] Always use margins when positioning text inside a sheet object.



commit 6489634ba4bfca4652b398cdc4e416cb83f86cd9
Author: Jean Brefort <jean brefort normalesup org>
Date:   Tue May 15 16:09:29 2012 +0200

    Always use margins when positioning text inside a sheet object.

 ChangeLog           |    5 +++++
 src/gnm-so-filled.c |    8 ++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fe64f1f..c8be359 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-15  Jean Brefort  <jean brefort normalesup org>
+
+	* src/gnm-so-filled.c (cb_gnm_so_filled_changed): allways use margins
+	to evaluate text position.
+
 2012-05-14  Morten Welinder  <terra gnome org>
 
 	* src/sheet-style.c (sheet_style_get_range, cell_tile_optimize)
diff --git a/src/gnm-so-filled.c b/src/gnm-so-filled.c
index 04d7510..85b7d13 100644
--- a/src/gnm-so-filled.c
+++ b/src/gnm-so-filled.c
@@ -199,7 +199,15 @@ cb_gnm_so_filled_changed (GnmSOFilled const *sof,
 		if (group->text == NULL) {
 			if (sof->is_oval) {
 				double w, h;
+				double scale = goc_canvas_get_pixels_per_unit (GOC_ITEM (group)->canvas);
 				g_object_get (group->bg, "width", &w, "height", &h, NULL);
+				w -= (sof->margin_pts.left + sof->margin_pts.right)
+					/ scale;
+				w = MAX (w, DBL_MIN);
+
+				h -= (sof->margin_pts.top + sof->margin_pts.bottom)
+					/ scale;
+				h = MAX (h, DBL_MIN);
 				group->text = goc_item_new (GOC_GROUP (group), GOC_TYPE_TEXT,
 					"anchor",	GO_ANCHOR_CENTER,
 					"clip",		TRUE,



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