[gnumeric] fix warning (and some prep work)



commit 4bfdde2c47ad757ceafe9382198aae7d224b7b80
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Tue Jul 20 16:53:39 2010 -0600

    fix warning (and some prep work)
    
    2010-07-20  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* gnumeric-expr-entry.c (_GnmExprEntry) add field
    	(gee_delete_tooltip): set the completion invalid even if the text is
    	  NULL
    	(gee_set_tooltip_completion): set the completion range even if we don't
    	  know the text
    	(gee_check_tooltip): ditto
    	(cb_gee_key_press_event): pass range information to
    	  dialog_function_select_paste and return a value.
    
    2010-07-20  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* dialogs.h (dialog_function_select_paste): add arguments
    	* dialog-function-select.c (dialog_function_select_paste): add arguments

 src/dialogs/ChangeLog                |    4 ++++
 src/dialogs/dialog-function-select.c |    2 +-
 src/dialogs/dialogs.h                |    2 +-
 src/widgets/ChangeLog                |   11 +++++++++++
 src/widgets/gnumeric-expr-entry.c    |   24 +++++++++++++++++++-----
 5 files changed, 36 insertions(+), 7 deletions(-)
---
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 2c62fb4..4a1dec7 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,5 +1,9 @@
 2010-07-20  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* dialogs.h (dialog_function_select_paste): add arguments
+	* dialog-function-select.c (dialog_function_select_paste): add arguments
+2010-07-20  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* dialog-define-names.c (name_guru_init): set the window title for the 
 	  paste dialog.
 
diff --git a/src/dialogs/dialog-function-select.c b/src/dialogs/dialog-function-select.c
index c59e54c..34c05f0 100644
--- a/src/dialogs/dialog-function-select.c
+++ b/src/dialogs/dialog-function-select.c
@@ -1359,7 +1359,7 @@ dialog_function_select_help (WBCGtk *wbcg)
 }
 
 void
-dialog_function_select_paste (WBCGtk *wbcg)
+dialog_function_select_paste (WBCGtk *wbcg, gint from, gint to)
 {
 	dialog_function_select_full (wbcg, NULL, 
 				     FUNCTION_SELECT_PASTE_KEY, PASTE_MODE);
diff --git a/src/dialogs/dialogs.h b/src/dialogs/dialogs.h
index 87eb2e9..a0e79ff 100644
--- a/src/dialogs/dialogs.h
+++ b/src/dialogs/dialogs.h
@@ -74,7 +74,7 @@ void dialog_merge		 (WBCGtk *wbcg);
 
 void dialog_function_select	 (WBCGtk *wbcg, char const *key);
 void dialog_function_select_help	 (WBCGtk *wbcg);
-void dialog_function_select_paste	 (WBCGtk *wbcg);
+void dialog_function_select_paste	 (WBCGtk *wbcg, gint from, gint to);
 
 int dialog_correlation_tool	 (WBCGtk *wbcg, Sheet *sheet);
 int dialog_covariance_tool	 (WBCGtk *wbcg, Sheet *sheet);
diff --git a/src/widgets/ChangeLog b/src/widgets/ChangeLog
index e1d0944..308fa35 100644
--- a/src/widgets/ChangeLog
+++ b/src/widgets/ChangeLog
@@ -1,5 +1,16 @@
 2010-07-20  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* gnumeric-expr-entry.c (_GnmExprEntry) add field
+	(gee_delete_tooltip): set the completion invalid even if the text is 
+	  NULL
+	(gee_set_tooltip_completion): set the completion range even if we don't
+	  know the text
+	(gee_check_tooltip): ditto
+	(cb_gee_key_press_event): pass range information to 
+	  dialog_function_select_paste and return a value.
+
+2010-07-20  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* gnumeric-expr-entry.c (cb_gee_key_press_event) call 
 	  dialog_function_select_paste on Sift-F4
 
diff --git a/src/widgets/gnumeric-expr-entry.c b/src/widgets/gnumeric-expr-entry.c
index 05c502d..b9900ad 100644
--- a/src/widgets/gnumeric-expr-entry.c
+++ b/src/widgets/gnumeric-expr-entry.c
@@ -117,6 +117,7 @@ struct _GnmExprEntry {
 		gboolean         had_stuff;
 		guint            handlerid;
 		gboolean         enabled;
+		gboolean         completion_se_valid;
 		gchar           *completion;
 		guint            completion_start;
 		guint            completion_end;
@@ -623,9 +624,10 @@ gee_delete_tooltip (GnmExprEntry *gee, gboolean remove_completion)
 					     gee->tooltip.handlerid);
 		gee->tooltip.handlerid = 0;
 	}
-	if (remove_completion && gee->tooltip.completion != NULL) {
+	if (remove_completion) {
 		g_free (gee->tooltip.completion);
 		gee->tooltip.completion = NULL;
+		gee->tooltip.completion_se_valid = FALSE;
 	}
 }
 
@@ -786,9 +788,10 @@ gee_set_tooltip_completion (GnmExprEntry *gee, GSList *list, guint start, guint
 	if (i == 1) {
 		g_free (gee->tooltip.completion);
 		gee->tooltip.completion = g_strdup (list->data);
-		gee->tooltip.completion_start = start;
-		gee->tooltip.completion_end = end;
 	}
+	gee->tooltip.completion_start = start;
+	gee->tooltip.completion_end = end;
+	gee->tooltip.completion_se_valid = TRUE;
 	gee->tooltip.tooltip = gee_create_tooltip (gee, str->str);
 	g_string_free (str, TRUE);
 	g_slist_free (list);	
@@ -879,6 +882,10 @@ gee_check_tooltip (GnmExprEntry *gee)
 			g_free (str);
 			g_free (gli_c);
 			return;
+		} else {
+			gee->tooltip.completion_start = start_t;
+			gee->tooltip.completion_end = end_t;
+			gee->tooltip.completion_se_valid = TRUE;
 		}
 	}
 
@@ -1021,8 +1028,15 @@ cb_gee_key_press_event (GtkEntry	*entry,
 		gboolean c, r;
 
 		if (state == GDK_SHIFT_MASK) {
-			dialog_function_select_paste (gee->wbcg);
-			return;
+			if (gee->tooltip.completion_se_valid)
+				dialog_function_select_paste 
+					(gee->wbcg, 
+					 gee->tooltip.completion_start,
+					 gee->tooltip.completion_end);
+			else
+				dialog_function_select_paste 
+					(gee->wbcg, -1, -1);
+			return TRUE;
 		}
 		if (gee->tooltip.completion != NULL) {
 			guint start = gee->tooltip.completion_start;



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