[gnumeric] fix interaction between tooltips and formula guru



commit 7fc73970d42621fd095f0d0656d1299835847a54
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Tue Jun 15 01:47:48 2010 -0600

    fix interaction between tooltips and formula guru
    
    2010-06-15  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* dialogs.h (dialog_formula_guru): change storage class of an arg
    	* dialog-function-select.c (cb_dialog_function_select_ok_clicked):
    	  change call of dialog_formula_guru
    	* dialog-formula-guru.c (dialog_formula_guru_load_fd): remove
    	  unneeded code
    	(cb_dialog_formula_guru_destroy): reenable tips
    	(dialog_formula_guru): change storage class of an arg and disable
    	  tips
    
    2010-06-15  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* gnumeric-expr-entry.h (gnm_expr_entry_enable_tips): new
    	(gnm_expr_entry_disable_tips): new
    	* gnumeric-expr-entry.c (gnm_expr_entry_enable_tips): new
    	(gnm_expr_entry_disable_tips): new
    	(_GnmExprEntry): new field
    	(gee_check_tooltip): only create tooltips if enabled
    	(gee_init): iitalize new fields

 src/dialogs/ChangeLog                |   11 +++++++++++
 src/dialogs/dialog-formula-guru.c    |   16 +++++++++-------
 src/dialogs/dialog-function-select.c |    2 +-
 src/dialogs/dialogs.h                |    2 +-
 src/widgets/ChangeLog                |   10 ++++++++++
 src/widgets/gnumeric-expr-entry.c    |   22 ++++++++++++++++++++++
 src/widgets/gnumeric-expr-entry.h    |    2 ++
 7 files changed, 56 insertions(+), 9 deletions(-)
---
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index c4f68f6..94e270c 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,14 @@
+2010-06-15  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* dialogs.h (dialog_formula_guru): change storage class of an arg
+	* dialog-function-select.c (cb_dialog_function_select_ok_clicked):
+	  change call of dialog_formula_guru
+	* dialog-formula-guru.c (dialog_formula_guru_load_fd): remove
+	  unneeded code
+	(cb_dialog_formula_guru_destroy): reenable tips
+	(dialog_formula_guru): change storage class of an arg and disable
+	  tips
+
 2010-06-10 Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* dialog-function-select.c 
diff --git a/src/dialogs/dialog-formula-guru.c b/src/dialogs/dialog-formula-guru.c
index 17fa7ee..b395a28 100644
--- a/src/dialogs/dialog-formula-guru.c
+++ b/src/dialogs/dialog-formula-guru.c
@@ -370,15 +370,15 @@ dialog_formula_guru_adjust_varargs (GtkTreeIter *iter, FormulaGuruState *state)
 
 
 static gint
-dialog_formula_guru_load_fd (GtkTreePath *path, GnmFunc const *fd,
+dialog_formula_guru_load_fd (GtkTreePath *path, GnmFunc *fd,
 			     FormulaGuruState *state)
 {
 	GtkTreeIter iter;
-	TokenizedHelp *help = tokenized_help_new (fd);
-	char const *f_syntax = tokenized_help_find (help, "SYNTAX");
 	gint min_arg, max_arg;
 	GtkTreePath *new_path;
 
+	gnm_func_load_if_stub (fd);
+
 	if (path == NULL) {
 		gtk_tree_store_clear (state->model);
 		gtk_tree_store_append (state->model, &iter, NULL);
@@ -405,14 +405,12 @@ dialog_formula_guru_load_fd (GtkTreePath *path, GnmFunc const *fd,
 	function_def_count_args (fd, &min_arg, &max_arg);
 
 	gtk_tree_store_set (state->model, &iter,
-			    FUN_ARG_ENTRY, f_syntax,
+			    FUN_ARG_ENTRY, "",
 			    IS_NON_FUN, FALSE,
 			    FUNCTION, fd,
 			    MIN_ARG, min_arg,
 			    MAX_ARG, max_arg,
 			    -1);
-	tokenized_help_destroy (help);
-
 	dialog_formula_guru_adjust_children (&iter, fd, state);
 	dialog_formula_guru_adjust_varargs (&iter, state);
 
@@ -526,6 +524,7 @@ cb_dialog_formula_guru_destroy (FormulaGuruState *state)
 		g_object_unref (state->editable);
 	if (state->gui != NULL)
 		g_object_unref (G_OBJECT (state->gui));
+	gnm_expr_entry_enable_tips (wbcg_get_entry_logical (state->wbcg));
 	g_free (state);
 }
 
@@ -869,6 +868,7 @@ dialog_formula_guru_init (FormulaGuruState *state)
 	state->column = column;
 	gtk_tree_view_append_column (state->treeview, column);
 	gtk_tree_view_set_headers_visible (state->treeview, TRUE);
+	gtk_tree_view_set_enable_tree_lines (state->treeview, TRUE);
 	gtk_container_add (GTK_CONTAINER (scrolled), GTK_WIDGET (state->treeview));
 
 	g_signal_connect (state->treeview,
@@ -942,7 +942,7 @@ dialog_formula_guru_show (FormulaGuruState *state)
  * Pop up a function selector then a formula guru.
  */
 void
-dialog_formula_guru (WBCGtk *wbcg, GnmFunc const *fd)
+dialog_formula_guru (WBCGtk *wbcg, GnmFunc *fd)
 {
 	SheetView *sv;
 	GladeXML  *gui;
@@ -995,6 +995,8 @@ dialog_formula_guru (WBCGtk *wbcg, GnmFunc const *fd)
 	state->active_path = NULL;
 	state->pos = g_new (GnmParsePos, 1);
 
+	gnm_expr_entry_disable_tips (wbcg_get_entry_logical (wbcg));
+
 	sv = wb_control_cur_sheet_view (WORKBOOK_CONTROL (wbcg));
 	cell = sheet_cell_get (sv_sheet (sv), sv->edit_pos.col, sv->edit_pos.row);
 	if (cell != NULL) {
diff --git a/src/dialogs/dialog-function-select.c b/src/dialogs/dialog-function-select.c
index d54fd7d..cdb2eba 100644
--- a/src/dialogs/dialog-function-select.c
+++ b/src/dialogs/dialog-function-select.c
@@ -342,7 +342,7 @@ cb_dialog_function_select_ok_clicked (G_GNUC_UNUSED GtkWidget *button,
 {
 	GtkTreeIter  iter;
 	GtkTreeModel *model;
-	GnmFunc const *func;
+	GnmFunc *func;
 	GtkTreeSelection *the_selection = gtk_tree_view_get_selection (state->treeview);
 
 	if (state->formula_guru_key != NULL && 
diff --git a/src/dialogs/dialogs.h b/src/dialogs/dialogs.h
index 6d2d7b7..eb38c9e 100644
--- a/src/dialogs/dialogs.h
+++ b/src/dialogs/dialogs.h
@@ -18,7 +18,7 @@ typedef enum {
 	FD_LAST = FD_INPUT_MSG
 } FormatDialogPosition_t;
 
-void	 dialog_formula_guru	(WBCGtk *wbcg, GnmFunc const *func);
+void	 dialog_formula_guru	(WBCGtk *wbcg, GnmFunc *func);
 void	 dialog_plugin_manager	(WBCGtk *wbcg);
 void	 dialog_goto_cell	(WBCGtk *wbcg);
 void	 dialog_cell_format	(WBCGtk *wbcg,
diff --git a/src/widgets/ChangeLog b/src/widgets/ChangeLog
index 7f4681d..16be652 100644
--- a/src/widgets/ChangeLog
+++ b/src/widgets/ChangeLog
@@ -1,3 +1,13 @@
+2010-06-15  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* gnumeric-expr-entry.h (gnm_expr_entry_enable_tips): new
+	(gnm_expr_entry_disable_tips): new
+	* gnumeric-expr-entry.c (gnm_expr_entry_enable_tips): new
+	(gnm_expr_entry_disable_tips): new
+	(_GnmExprEntry): new field
+	(gee_check_tooltip): only create tooltips if enabled
+	(gee_init): iitalize new fields
+
 2010-06-14  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* gnumeric-expr-entry.c (cb_gee_configure_event): delete
diff --git a/src/widgets/gnumeric-expr-entry.c b/src/widgets/gnumeric-expr-entry.c
index a177d66..4ec4e2c 100644
--- a/src/widgets/gnumeric-expr-entry.c
+++ b/src/widgets/gnumeric-expr-entry.c
@@ -76,6 +76,7 @@ struct _GnmExprEntry {
 		GnmFunc         *fd;
 		gint             args;
 		guint            handlerid;
+		gboolean         enabled;
 	}                        tooltip;
 
 	GOFormat const *constant_format;
@@ -726,6 +727,9 @@ gee_check_tooltip (GnmExprEntry *gee)
 	gchar sep = go_locale_get_arg_sep ();
 	gint  para = 0;
 
+	if (!gee->tooltip.enabled)
+		return;
+
 	end = gtk_editable_get_position (editable);
 
 	if (end == 0) {
@@ -1031,6 +1035,7 @@ gee_init (GnmExprEntry *gee)
 	gee->tooltip.tooltip = NULL;
 	gee->tooltip.fd = NULL;
 	gee->tooltip.handlerid = 0;
+	gee->tooltip.enabled = TRUE;
 	gee_rangesel_reset (gee);
 
 	gee->entry = GTK_ENTRY (gtk_entry_new ());
@@ -2205,3 +2210,20 @@ gnm_expr_entry_enable_highlight (GnmExprEntry *gee)
 	gee->feedback_disabled = FALSE;
 }
 
+/*****************************************************************************/
+
+void
+gnm_expr_entry_disable_tips (GnmExprEntry *gee)
+{
+	g_return_if_fail (gee != NULL);
+	gee_delete_tooltip (gee);
+	gee->tooltip.enabled = FALSE;
+}
+
+void
+gnm_expr_entry_enable_tips (GnmExprEntry *gee)
+{
+	g_return_if_fail (gee != NULL);
+	gee->tooltip.enabled = TRUE;
+}
+
diff --git a/src/widgets/gnumeric-expr-entry.h b/src/widgets/gnumeric-expr-entry.h
index 68884a6..21ed6fa 100644
--- a/src/widgets/gnumeric-expr-entry.h
+++ b/src/widgets/gnumeric-expr-entry.h
@@ -77,6 +77,8 @@ void    gnm_expr_entry_disable_highlight (GnmExprEntry *gee);
 void    gnm_expr_entry_enable_highlight  (GnmExprEntry *gee);
 
 void    gnm_expr_entry_close_tips  (GnmExprEntry *gee);
+void    gnm_expr_entry_enable_tips  (GnmExprEntry *gee);
+void    gnm_expr_entry_disable_tips  (GnmExprEntry *gee);
 
 /* Cell Renderer Specific Method */
 



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