[gnumeric] Suppress function tooltips on text-formatted cells. [#638832]



commit 12607166f46233f998e10b0026382e2210da5d74
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Sun Jan 16 14:13:31 2011 -0700

    Suppress function tooltips on text-formatted cells. [#638832]
    
    2011-01-16  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/commands.c (cmd_set_text_full): do not enter expressions
    	into text-formatted cells
    
    2011-01-16  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* gnumeric-expr-entry.c (gee_update_lexer_items): check for text
    	formatted cells

 ChangeLog                         |    8 +++++++-
 NEWS                              |    1 +
 src/commands.c                    |   19 +++++++++++--------
 src/widgets/ChangeLog             |    5 +++++
 src/widgets/gnumeric-expr-entry.c |   10 ++++++++--
 5 files changed, 32 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5abb9ff..c73dbf4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
+2011-01-16  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* src/commands.c (cmd_set_text_full): do not enter expressions
+	into text-formatted cells
+	
 2011-01-13  Andreas J. Guelzow <aguelzow pyrshep ca>
 
-	* src/value.c (find_rows_that_match): only one criteria row has to match!
+	* src/value.c (find_rows_that_match): only one criteria row has 
+	to match!
 
 2011-01-11  Morten Welinder  <terra gnome org>
 
diff --git a/NEWS b/NEWS
index 1518cd8..ad7082a 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ Andreas:
 	* Fix locale specific sorting. [#638874]
 	* Ensure we have sub- and sperscript icons. [#639086]
 	* Fix advanced filter. [#639444]
+	* Suppress function tooltips on text-formatted cells. [#638832]
 
 Jean:
 	* Only disable the formula bar when a chart sheet is selected. [#636031]
diff --git a/src/commands.c b/src/commands.c
index b77eb32..05ef4a8 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -820,16 +820,21 @@ cmd_set_text_full (WorkbookControl *wbc, GSList *selection, GnmEvalPos *ep,
 	Sheet *sheet = ep->sheet;
 	GnmParsePos pp;
 	ColRowIndexList *cri_col_list = NULL, *cri_row_list = NULL;
+	GOFormat const *format = gnm_style_get_format
+		(sheet_style_get (sheet, ep->eval.col, ep->eval.row));
 
 	g_return_val_if_fail (selection != NULL , TRUE);
 
 	parse_pos_init_evalpos (&pp, ep);
 	name = undo_range_list_name (sheet, selection);
-	expr_txt = gnm_expr_char_start_p (new_text);
-	if (expr_txt != NULL)
-		texpr = gnm_expr_parse_str
-			(expr_txt, &pp, GNM_EXPR_PARSE_DEFAULT,
-			 sheet_get_conventions (sheet), NULL);
+
+	if ((format == NULL) || !go_format_is_text (format)) {
+		expr_txt = gnm_expr_char_start_p (new_text);
+		if (expr_txt != NULL)
+			texpr = gnm_expr_parse_str
+				(expr_txt, &pp, GNM_EXPR_PARSE_DEFAULT,
+				 sheet_get_conventions (sheet), NULL);
+	}
 
 	if (texpr != NULL) {
 		GOFormat const *sf;
@@ -861,9 +866,7 @@ cmd_set_text_full (WorkbookControl *wbc, GSList *selection, GnmEvalPos *ep,
 
 		text = g_strdup_printf (_("Inserting expression in %s"), name);
 
-		if (go_format_is_general
-		    (gnm_style_get_format
-		     (sheet_style_get (sheet, ep->eval.col, ep->eval.row)))) {
+		if (go_format_is_general (format)) {
 			sf = auto_style_format_suggest (texpr, ep);
 			if (sf != NULL) {
 				new_style = gnm_style_new ();
diff --git a/src/widgets/ChangeLog b/src/widgets/ChangeLog
index bc30d6c..a246523 100644
--- a/src/widgets/ChangeLog
+++ b/src/widgets/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-16  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* gnumeric-expr-entry.c (gee_update_lexer_items): check for text 
+	formatted cells
+
 2011-01-15  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* gnm-cell-combo-view.c (gnm_cell_combo_view_popdown): wait for the
diff --git a/src/widgets/gnumeric-expr-entry.c b/src/widgets/gnumeric-expr-entry.c
index 95e9e2d..1d1fa8a 100644
--- a/src/widgets/gnumeric-expr-entry.c
+++ b/src/widgets/gnumeric-expr-entry.c
@@ -877,6 +877,8 @@ gee_update_lexer_items (GnmExprEntry *gee)
 	GtkEditable *editable = GTK_EDITABLE (gee->entry);
 	char *str = gtk_editable_get_chars (editable, 0, -1);
 	Sheet *sheet = scg_sheet (gee->scg);
+	GOFormat const *format;
+	gboolean forced_text;
 
 	g_free (gee->lexer_items);
 	gee->lexer_items = NULL;
@@ -887,15 +889,19 @@ gee_update_lexer_items (GnmExprEntry *gee)
 	}
 
 	parse_pos_init_editpos (&gee->pp, scg_view (gee->scg));
+	format = gnm_style_get_format
+		(sheet_style_get (sheet, gee->pp.eval.col, gee->pp.eval.row));
+	forced_text = ((format != NULL) && go_format_is_text (format));
 
-	if (!gee->feedback_disabled) {
+	if (!gee->feedback_disabled && !forced_text) {
 		gee->texpr = gnm_expr_parse_str
 			((str[0] == '=') ? str+1 : str,
 			 &gee->pp, GNM_EXPR_PARSE_DEFAULT,
 			 sheet_get_conventions (sheet), NULL);
 	}
 
-	gee->tooltip.is_expr = (NULL != gnm_expr_char_start_p (str));
+	gee->tooltip.is_expr =  (!forced_text) &&
+		(NULL != gnm_expr_char_start_p (str));
 	if (!(gee->flags & GNM_EE_SINGLE_RANGE)) {
 		gee->lexer_items = gnm_expr_lex_all
 			(str, &gee->pp,



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