Commit d1255492 authored by Andreas J. Guelzow 's avatar Andreas J. Guelzow

Show the tooltips also for editing on teh sheet, and make sure they close when editing is finished.

2010-06-14 Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* src/wbc-gtk-edit.c (wbcg_edit_finish): close the tooltips of
	  the entry

2010-06-14  Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* gnumeric-expr-entry.h (gnm_expr_entry_close_tips): new
	* gnumeric-expr-entry.c (gnm_expr_entry_close_tips): new
	(gee_check_tooltip): new
	(cb_entry_changed): connect with gee_check_tooltip
	(cb_gee_key_press_event): move handling of () into gee_check_tooltip
	(cb_gee_button_press_event): keep the tool tips
parent 6602aef4
2010-06-14 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* src/wbc-gtk-edit.c (wbcg_edit_finish): close the tooltips of
the entry
2010-06-14 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* src/func-builtin.c (help_if): fix argument description
......
......@@ -100,6 +100,8 @@ wbcg_edit_finish (WBCGtk *wbcg, WBCEditResult result,
wbcg_focus_cur_scg (wbcg);
gnm_expr_entry_close_tips (wbcg_get_entry_logical (wbcg));
if (showed_dialog != NULL)
*showed_dialog = FALSE;
......
2010-06-14 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* gnumeric-expr-entry.h (gnm_expr_entry_close_tips): new
* gnumeric-expr-entry.c (gnm_expr_entry_close_tips): new
(gee_check_tooltip): new
(cb_entry_changed): connect with gee_check_tooltip
(cb_gee_key_press_event): move handling of () into gee_check_tooltip
(cb_gee_button_press_event): keep the tool tips
2010-06-14 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* gnumeric-expr-entry.c (gee_delete_tooltip): watch
......
......@@ -599,6 +599,15 @@ gee_delete_tooltip (GnmExprEntry *gee)
}
}
void
gnm_expr_entry_close_tips (GnmExprEntry *gee)
{
if (gee != NULL)
gee_delete_tooltip (gee);
}
static gboolean
cb_gee_configure_event (GtkWidget *widget,
GdkEventConfigure *event,
......@@ -703,11 +712,58 @@ gee_set_tooltip (GnmExprEntry *gee, GnmFunc *fd)
g_string_free (str, TRUE);
}
static void
gee_check_tooltip (GnmExprEntry *gee)
{
GtkEditable *editable = GTK_EDITABLE (gee->entry);
gint end;
char *str;
char *prefix;
char *str_end;
char last;
end = gtk_editable_get_position (editable);
if (end == 0) {
gee_delete_tooltip (gee);
return;
}
str = gtk_editable_get_chars (editable, end, end+1);
last = *str;
g_free (str);
if (last == ')') {
gee_delete_tooltip (gee);
return;
}
if (last != '(')
return;
str = gtk_editable_get_chars (editable, 0, end);
prefix = str_end = str + strlen (str);
do {prefix--;} while (prefix >= str && (('a' <= *prefix && *prefix <= 'z') ||
('a' <= *prefix && *prefix <= 'z')));
prefix++;
if (prefix < str_end) {
GnmFunc *fd = gnm_func_lookup (prefix, NULL);
if (fd != NULL)
gee_set_tooltip (gee, fd);
}
g_free (str);
}
static void
cb_entry_changed (GnmExprEntry *gee)
{
gee_update_env (gee);
gee_update_calendar (gee);
gee_check_tooltip (gee);
g_signal_emit (G_OBJECT (gee), signals[CHANGED], 0);
}
......@@ -896,36 +952,6 @@ cb_gee_key_press_event (GtkEntry *entry,
return TRUE;
}
case GDK_parenright: {
gee_delete_tooltip (gee);
return FALSE;
}
case GDK_parenleft: {
/* Create tooltip with the syntax of the current function */
GtkEditable *editable = GTK_EDITABLE (entry);
gint end;
char *str;
char *prefix;
char *str_end;
end = gtk_editable_get_position (editable);
str = gtk_editable_get_chars (editable, 0, end);
prefix = str_end = str + strlen (str);
do {prefix--;} while (prefix >= str && (('a' <= *prefix && *prefix <= 'z') ||
('a' <= *prefix && *prefix <= 'z')));
prefix++;
if (prefix < str_end) {
GnmFunc *fd = gnm_func_lookup (prefix, NULL);
if (fd != NULL)
gee_set_tooltip (gee, fd);
}
g_free (str);
return FALSE;
}
default:
break;
}
......@@ -944,7 +970,6 @@ cb_gee_button_press_event (G_GNUC_UNUSED GtkEntry *entry,
scg_rangesel_stop (gee->scg, FALSE);
gnm_expr_entry_find_range (gee);
g_signal_emit (G_OBJECT (gee), signals[CHANGED], 0);
gee_delete_tooltip (gee);
}
return FALSE;
......
......@@ -76,6 +76,8 @@ void gnm_expr_entry_grab_focus (GnmExprEntry *gee, gboolean select_all);
void gnm_expr_entry_disable_highlight (GnmExprEntry *gee);
void gnm_expr_entry_enable_highlight (GnmExprEntry *gee);
void gnm_expr_entry_close_tips (GnmExprEntry *gee);
/* Cell Renderer Specific Method */
gboolean gnm_expr_entry_editing_canceled (GnmExprEntry *gee);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment