[gnumeric] Don't autofit text on entry.



commit 1ec416e1c9a1782888799f226ee97804f32cb589
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Fri Aug 13 02:16:24 2010 -0600

    Don't autofit text on entry.
    
    2010-08-13  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/colrow.c (colrow_set_sizes): use -2 as an indicator only to auto-fit
    	  non-strings
    	* src/commands.c (cmd_set_text_full): use size -2
    	* src/undo.c (gnm_undo_colrow_set_sizes_new): use -1 and -2 as autofit markers.

 ChangeLog      |    7 +++++++
 src/colrow.c   |    6 +++---
 src/commands.c |    8 ++++----
 src/undo.c     |    4 ++--
 4 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4cece8f..68b4877 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2010-08-13  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* src/colrow.c (colrow_set_sizes): use -2 as an indicator only to auto-fit 
+	  non-strings
+	* src/commands.c (cmd_set_text_full): use size -2
+	* src/undo.c (gnm_undo_colrow_set_sizes_new): use -1 and -2 as autofit markers.
+
+2010-08-13  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* src/commands.c (cmd_set_text_*): deleted
 	(cmd_set_text_full): new
 	(cmd_set_text): use cmd_set_text_full
diff --git a/src/colrow.c b/src/colrow.c
index 259d2db..f37cb20 100644
--- a/src/colrow.c
+++ b/src/colrow.c
@@ -451,7 +451,7 @@ ColRowStateGroup *
 colrow_set_sizes (Sheet *sheet, gboolean is_cols,
 		  ColRowIndexList *src, int new_size, int from, int to)
 /* from & to are used to restrict fitting to that range. Pass 0, -1 if you want to use the */
-/*whole row/column */
+/* whole row/column */
 {
 	int i;
 	ColRowStateGroup *res = NULL;
@@ -529,8 +529,8 @@ colrow_set_sizes (Sheet *sheet, gboolean is_cols,
 					from = to;
 				/* Fall back to assigning the default if it is empty */
 				tmp = (is_cols)
-					? sheet_col_size_fit_pixels (sheet, i, from, to, FALSE)
-					: sheet_row_size_fit_pixels (sheet, i, from, to, FALSE);
+					? sheet_col_size_fit_pixels (sheet, i, from, to, tmp == -2)
+					: sheet_row_size_fit_pixels (sheet, i, from, to, tmp == -2);
 			}
 			if (tmp > 0) {
 				if (is_cols)
diff --git a/src/commands.c b/src/commands.c
index ff2076d..525a6aa 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -882,18 +882,18 @@ cmd_set_text_full (WorkbookControl *wbc, GSList *selection, GnmEvalPos *ep,
 				(sheet, TRUE, 
 				 colrow_index_list_copy (cri_col_list), 
 				 colrow_get_sizes (sheet, TRUE,
-						   cri_col_list, -1)));
+						   cri_col_list, -2)));
 	undo = go_undo_combine (undo,
 				gnm_undo_colrow_restore_state_group_new 
 				(sheet, FALSE, 
 				 colrow_index_list_copy (cri_row_list), 
 				 colrow_get_sizes (sheet, FALSE,
-						   cri_row_list, -1)));
+						   cri_row_list, -2)));
 	redo  = go_undo_combine (gnm_undo_colrow_set_sizes_new 
-				 (sheet, TRUE, cri_col_list, -1, NULL),
+				 (sheet, TRUE, cri_col_list, -2, NULL),
 				 redo);
 	redo  = go_undo_combine (gnm_undo_colrow_set_sizes_new 
-				 (sheet, FALSE, cri_row_list, -1, NULL),
+				 (sheet, FALSE, cri_row_list, -2, NULL),
 				 redo);
 
 	result = cmd_generic (wbc, text, undo, redo);
diff --git a/src/undo.c b/src/undo.c
index 83b4ee3..f8074fd 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -134,7 +134,7 @@ GSF_CLASS (GNMUndoColrowSetSizes, gnm_undo_colrow_set_sizes,
 /**
  * gnm_undo_colrow_set_sizes_new:
  *
- * If r is non-null and new_size == -1, selection is ignored.
+ * If r is non-null and new_size == -1 or -2, selection is ignored.
  *
  * Returns: a new undo object.
  **/
@@ -154,7 +154,7 @@ gnm_undo_colrow_set_sizes_new (Sheet *sheet, gboolean is_cols,
 	ua->is_cols = is_cols;
 	ua->new_size = new_size;
 	
-	if (r == NULL || new_size != -1) {
+	if (r == NULL || new_size > -1) {
 		ua->selection = selection;
 		ua->from = 0;
 		ua->to = -1;



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