[gnumeric] Fix function tool tip. [#668685]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Fix function tool tip. [#668685]
- Date: Fri, 27 Jan 2012 03:05:51 +0000 (UTC)
commit 6045e8158ba5d2d8a0aeb2df7c0bc0928556bebf
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Thu Jan 26 20:04:39 2012 -0700
Fix function tool tip. [#668685]
2012-01-26 Andreas J. Guelzow <aguelzow pyrshep ca>
* gnumeric-expr-entry.c (gee_create_tooltip): use a text view
(gee_set_tooltip_completion): format the info in a nicer way
2012-01-26 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/gui-util.c (gnumeric_create_tooltip_text_view_widget): new
(gnumeric_convert_to_tooltip): new
(gnumeric_create_tooltip): use gnumeric_convert_to_tooltip
* src/gui-util.h (gnumeric_create_tooltip_text_view_widget): new
(gnumeric_convert_to_tooltip): new
ChangeLog | 8 +++++++
NEWS | 1 +
src/gui-util.c | 25 +++++++++++++++++++--
src/gui-util.h | 3 ++
src/widgets/ChangeLog | 5 ++++
src/widgets/gnumeric-expr-entry.c | 41 ++++++++++++++++++++++++++----------
6 files changed, 68 insertions(+), 15 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5b19f2b..2249a6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-01-26 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * src/gui-util.c (gnumeric_create_tooltip_text_view_widget): new
+ (gnumeric_convert_to_tooltip): new
+ (gnumeric_create_tooltip): use gnumeric_convert_to_tooltip
+ * src/gui-util.h (gnumeric_create_tooltip_text_view_widget): new
+ (gnumeric_convert_to_tooltip): new
+
2012-01-15 Morten Welinder <terra gnome org>
* src/wbc-gtk.c: Switch to using a GtkBuilder ui.
diff --git a/NEWS b/NEWS
index 61e25cb..b7f113f 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ Andreas:
* Colour the range expressions to match the range cursor. [#632156]
* Implement ctrl-click cell deselection. [#610696]
* Fix LaTeX export of cyrillic. [#666340]
+ * Fix function tool tip. [#668685]
Jean:
* Fix formula interpretation in plot series (with Morten's help). [#662237]
diff --git a/src/gui-util.c b/src/gui-util.c
index fb9900b..a86b26a 100644
--- a/src/gui-util.c
+++ b/src/gui-util.c
@@ -477,6 +477,20 @@ gnumeric_tooltip_set_style (GtkWidget *widget)
}
GtkWidget *
+gnumeric_create_tooltip_text_view_widget (void)
+{
+ GtkWidget *label, *frame;
+
+ frame = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
+ label = gtk_text_view_new ();
+
+ gtk_container_add (GTK_CONTAINER (frame), label);
+
+ return label;
+}
+
+GtkWidget *
gnumeric_create_tooltip_widget (void)
{
GtkWidget *label, *frame;
@@ -491,9 +505,9 @@ gnumeric_create_tooltip_widget (void)
}
GtkWidget *
-gnumeric_create_tooltip (GtkWidget *ref_widget)
+gnumeric_convert_to_tooltip (GtkWidget *ref_widget, GtkWidget *label)
{
- GtkWidget *tip, *label, *frame;
+ GtkWidget *tip, *frame;
tip = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_type_hint (GTK_WINDOW (tip),
@@ -503,7 +517,6 @@ gnumeric_create_tooltip (GtkWidget *ref_widget)
gtk_window_set_screen (GTK_WINDOW (tip), gtk_widget_get_screen (ref_widget));
gtk_widget_set_name (tip, "gnumeric-tooltip");
- label = gnumeric_create_tooltip_widget ();
frame = gtk_widget_get_toplevel (label);
gtk_container_add (GTK_CONTAINER (tip), frame);
@@ -514,6 +527,12 @@ gnumeric_create_tooltip (GtkWidget *ref_widget)
return label;
}
+GtkWidget *
+gnumeric_create_tooltip (GtkWidget *ref_widget)
+{
+ return gnumeric_convert_to_tooltip (ref_widget, gnumeric_create_tooltip_widget ());
+}
+
void
gnumeric_position_tooltip (GtkWidget *tip, int px, int py, gboolean horizontal)
{
diff --git a/src/gui-util.h b/src/gui-util.h
index b37ae53..30e5d53 100644
--- a/src/gui-util.h
+++ b/src/gui-util.h
@@ -41,7 +41,10 @@ void gnumeric_popup_menu (GtkMenu *menu, GdkEventButton *event);
void gnumeric_position_tooltip (GtkWidget *tip, int px, int py,
gboolean horizontal);
GtkWidget *gnumeric_create_tooltip_widget (void);
+GtkWidget *gnumeric_create_tooltip_text_view_widget (void);
GtkWidget *gnumeric_create_tooltip (GtkWidget *ref_widget);
+GtkWidget *gnumeric_convert_to_tooltip (GtkWidget *ref_widget,
+ GtkWidget *widget);
void gnumeric_tooltip_set_style (GtkWidget *widget);
GtkBuilder *gnm_gtk_builder_new (char const *uifile, char const *domain,
diff --git a/src/widgets/ChangeLog b/src/widgets/ChangeLog
index c9bb15a..e805bb0 100644
--- a/src/widgets/ChangeLog
+++ b/src/widgets/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-26 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * gnumeric-expr-entry.c (gee_create_tooltip): use a text view
+ (gee_set_tooltip_completion): format the info in a nicer way
+
2012-01-25 Morten Welinder <terra gnome org>
* gnumeric-expr-entry.c (gnm_expr_entry_set_scg): Set the right
diff --git a/src/widgets/gnumeric-expr-entry.c b/src/widgets/gnumeric-expr-entry.c
index a7ad205..004536e 100644
--- a/src/widgets/gnumeric-expr-entry.c
+++ b/src/widgets/gnumeric-expr-entry.c
@@ -49,6 +49,7 @@
#define UNICODE_ELLIPSIS "\xe2\x80\xa6"
#define UNICODE_ELLIPSIS_VERT "\xe2\x8b\xae"
#define UNICODE_ARROW_UP "\xe2\x87\xa7"
+#define UNICODE_CHECKMARK "\342\234\223"
#warning We should replace these token names with the correct values
enum yytokentype {
@@ -772,6 +773,9 @@ gee_create_tooltip (GnmExprEntry *gee, gchar const *str,
GdkWindow *gdkw;
gchar *markup = NULL;
GString *string;
+ GtkTextBuffer *buffer;
+ PangoAttrList *attr_list = NULL;
+ char *text = NULL;
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (gee->entry));
gtk_widget_add_events(toplevel, GDK_FOCUS_CHANGE_MASK);
@@ -780,7 +784,7 @@ gee_create_tooltip (GnmExprEntry *gee, gchar const *str,
(G_OBJECT (toplevel), "focus-out-event",
G_CALLBACK (cb_gee_focus_out_event), gee);
- label = gnumeric_create_tooltip (toplevel);
+ label = gnumeric_convert_to_tooltip (toplevel, gnumeric_create_tooltip_text_view_widget ());
tip = gtk_widget_get_toplevel (label);
if (str)
@@ -788,18 +792,31 @@ gee_create_tooltip (GnmExprEntry *gee, gchar const *str,
string = g_string_new (markup);
if (marked_str)
g_string_append (string, marked_str);
- gtk_label_set_markup (GTK_LABEL (label), string->str);
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (label));
+
+ if (pango_parse_markup (string->str, -1, 0,
+ &attr_list, &text,
+ NULL, NULL)) {
+ gnm_create_std_tags_for_buffer (buffer);
+ gtk_text_buffer_set_text (buffer, text, -1);
+ gnm_load_pango_attributes_into_buffer (attr_list, buffer, text);
+ g_free (text);
+ pango_attr_list_unref (attr_list);
+ } else
+ gtk_text_buffer_set_text (buffer, string->str, -1);
g_free (markup);
g_string_free (string, TRUE);
if (set_tabs) {
- PangoLayout *pl = gtk_label_get_layout (GTK_LABEL (label));
PangoTabArray *tabs;
tabs = pango_tab_array_new_with_positions
- (2, TRUE,
- PANGO_TAB_LEFT, 120,
- PANGO_TAB_LEFT, 140);
- pango_layout_set_tabs (pl, tabs);
+ (5, TRUE,
+ PANGO_TAB_LEFT, 20,
+ PANGO_TAB_LEFT, 140,
+ PANGO_TAB_LEFT, 160,
+ PANGO_TAB_LEFT, 180,
+ PANGO_TAB_LEFT, 200);
+ gtk_text_view_set_tabs (GTK_TEXT_VIEW (label), tabs);
pango_tab_array_free (tabs);
}
@@ -928,12 +945,12 @@ gee_set_tooltip_completion (GnmExprEntry *gee, GSList *list, guint start, guint
if ((end - start) < (guint) g_utf8_strlen (name, -1))
/* xgettext: the first %s is a function name and */
/* the second %s the function description */
- g_string_append_printf (str, _("%s : \t%s\n"), name,
+ g_string_append_printf (str, _("\t%s \t%s\n"), name,
gnm_func_get_description (fd));
else {
/* xgettext: the first %s is a function name and */
/* the second %s the function description */
- g_string_append_printf (str, _("[%s : \t%s]\n"), name,
+ g_string_append_printf (str, _("\342\234\223\t%s \t%s\n"), name,
gnm_func_get_description (fd));
i--;
}
@@ -941,15 +958,15 @@ gee_set_tooltip_completion (GnmExprEntry *gee, GSList *list, guint start, guint
str_marked = g_string_new (NULL);
if (i == max)
- g_string_append (str_marked, UNICODE_ELLIPSIS_VERT "\n");
+ g_string_append (str_marked, "\t" UNICODE_ELLIPSIS_VERT "\n");
if (i == 1) {
gee->tooltip.completion
= g_strdup (name);
/*xgettext: short form for: "type F4-key to complete the name"*/
- g_string_append (str_marked, _("\n<i>F4 to complete</i>"));
+ g_string_append (str_marked, _("\n\t<i>F4 to complete</i>"));
} else if (i > 1)
/*xgettext: short form for: "type shift-F4-keys to select the completion"*/
- g_string_append (str_marked, _("\n<i>\xe2\x87\xa7""F4 to select</i>"));
+ g_string_append (str_marked, _("\n\t<i>\xe2\x87\xa7""F4 to select</i>"));
else
g_string_truncate (str, str->len - 1);
gee->tooltip.completion_start = start;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]