Send commitlog mailing list submissions to
        commitlog@lists.openmoko.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        commitlog-requ...@lists.openmoko.org

You can reach the person managing the list at
        commitlog-ow...@lists.openmoko.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r5767 - trunk/eda/fped (wer...@docs.openmoko.org)
   2. r5768 - trunk/eda/fped (wer...@docs.openmoko.org)
--- Begin Message ---
Author: werner
Date: 2010-01-01 15:59:17 +0100 (Fri, 01 Jan 2010)
New Revision: 5767

Modified:
   trunk/eda/fped/TODO
   trunk/eda/fped/gui.c
   trunk/eda/fped/gui_tool.c
   trunk/eda/fped/gui_util.c
   trunk/eda/fped/gui_util.h
Log:
Added tooltips to all icons acting as buttons.



Modified: trunk/eda/fped/TODO
===================================================================
--- trunk/eda/fped/TODO 2009-12-31 16:24:23 UTC (rev 5766)
+++ trunk/eda/fped/TODO 2010-01-01 14:59:17 UTC (rev 5767)
@@ -27,7 +27,7 @@
 - when changing the part, we should automatically switch to a configuration
   that generates any of its (non-global) elements
 - add zoom controls to top toolbar
-- add tooltips
+- add tooltips (in progress)
 
 Bugs:
 - default silk width has no business being hard-coded in obj.c

Modified: trunk/eda/fped/gui.c
===================================================================
--- trunk/eda/fped/gui.c        2009-12-31 16:24:23 UTC (rev 5766)
+++ trunk/eda/fped/gui.c        2010-01-01 14:59:17 UTC (rev 5767)
@@ -1,8 +1,8 @@
 /*
  * gui.c - Editor GUI core
  *
- * Written 2009 by Werner Almesberger
- * Copyright 2009 by Werner Almesberger
+ * Written 2009, 2010 by Werner Almesberger
+ * Copyright 2009, 2010 by Werner Almesberger
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -163,19 +163,27 @@
        //gtk_box_pack_end(GTK_BOX(hbox), bar, FALSE, FALSE, 0);
        gtk_toolbar_set_style(GTK_TOOLBAR(bar), GTK_TOOLBAR_ICONS);
 
-       ev_all = tool_button(bar, drawable, NULL, toggle_all, NULL);
-       ev_stuff = tool_button(bar, drawable, NULL, toggle_stuff, NULL);
-       ev_meas = tool_button(bar, drawable, NULL, toggle_meas, NULL);
-       ev_bright = tool_button(bar, drawable, NULL, toggle_bright, NULL);
+       ev_all = tool_button(bar, drawable, NULL, NULL, toggle_all, NULL);
+       ev_stuff = tool_button(bar, drawable, NULL, NULL, toggle_stuff, NULL);
+       ev_meas = tool_button(bar, drawable, NULL, NULL, toggle_meas, NULL);
+       ev_bright = tool_button(bar, drawable, NULL, NULL, toggle_bright, NULL);
 
-       stuff_image[0] = gtk_widget_ref(make_image(drawable, xpm_stuff_off));
-       stuff_image[1] = gtk_widget_ref(make_image(drawable, xpm_stuff));
-       meas_image[0] = gtk_widget_ref(make_image(drawable, xpm_meas_off));
-       meas_image[1] = gtk_widget_ref(make_image(drawable, xpm_meas));
-       all_image[0] = gtk_widget_ref(make_image(drawable, xpm_all_off));
-       all_image[1] = gtk_widget_ref(make_image(drawable, xpm_all));
-       bright_image[0] = gtk_widget_ref(make_image(drawable, xpm_bright_off));
-       bright_image[1] = gtk_widget_ref(make_image(drawable, xpm_bright));
+       stuff_image[0] = gtk_widget_ref(make_image(drawable, xpm_stuff_off,
+           "Show vectors and frame references (disabled)"));
+       stuff_image[1] = gtk_widget_ref(make_image(drawable, xpm_stuff,
+           "Show vectors and frame references (enabled)"));
+       meas_image[0] = gtk_widget_ref(make_image(drawable, xpm_meas_off,
+           "Show measurements (disabled)"));
+       meas_image[1] = gtk_widget_ref(make_image(drawable, xpm_meas,
+           "Show measurements (enabled)"));
+       all_image[0] = gtk_widget_ref(make_image(drawable, xpm_all_off,
+           "Show all frames (currently showing only the active frame)"));
+       all_image[1] = gtk_widget_ref(make_image(drawable, xpm_all,
+           "Show all frames (enabled)"));
+       bright_image[0] = gtk_widget_ref(make_image(drawable, xpm_bright_off,
+           "Highlight elements (disabled)"));
+       bright_image[1] = gtk_widget_ref(make_image(drawable, xpm_bright,
+           "Highlight elements (enabled)"));
 
        set_image(ev_stuff, stuff_image[show_stuff]);
        set_image(ev_meas, meas_image[show_meas]);

Modified: trunk/eda/fped/gui_tool.c
===================================================================
--- trunk/eda/fped/gui_tool.c   2009-12-31 16:24:23 UTC (rev 5766)
+++ trunk/eda/fped/gui_tool.c   2010-01-01 14:59:17 UTC (rev 5767)
@@ -1,8 +1,8 @@
 /*
  * gui_tool.c - GUI, tool bar
  *
- * Written 2009 by Werner Almesberger
- * Copyright 2009 by Werner Almesberger
+ * Written 2009, 2010 by Werner Almesberger
+ * Copyright 2009, 2010 by Werner Almesberger
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1030,7 +1030,7 @@
        default:
                abort();
        }
-       return make_transparent_image(DA, image);
+       return make_transparent_image(DA, image, NULL);
 }
 
 
@@ -1097,41 +1097,57 @@
            GTK_ORIENTATION_VERTICAL);
 
        ev_point = tool_button(bar, drawable, xpm_point,
+           "Select and move items",
            tool_button_press_event, NULL);
-       ev_delete = tool_button(bar, drawable, NULL,
+       ev_delete = tool_button(bar, drawable, NULL, NULL,
             tool_button_press_event, &delete_ops);
        tool_separator(bar);
        tool_button(bar, drawable, xpm_vec,
+           "Add a vector",
            tool_button_press_event, &vec_ops);
-       ev_frame = tool_button(bar, drawable, NULL,
+       ev_frame = tool_button(bar, drawable, NULL, NULL,
            tool_button_press_event, &frame_ops);
        tool_button(bar, drawable, xpm_pad,
+           "Add a rectangular pad",
            tool_button_press_event, &pad_ops);
        tool_button(bar, drawable, xpm_rpad,
+           "Add a rounded pad",
            tool_button_press_event, &rpad_ops);
        tool_button(bar, drawable, xpm_line,
+           "Add a silk screen line",
            tool_button_press_event, &line_ops);
        tool_button(bar, drawable, xpm_rect,
+           "Add a silk screen rectangle",
            tool_button_press_event, &rect_ops);
        tool_button(bar, drawable, xpm_circ,
+           "Add a silk screen circle or arc",
            tool_button_press_event, &circ_ops);
        tool_separator(bar);
        tool_button(bar, drawable, xpm_meas,
+           "Add a measurement",
            tool_button_press_event, &tool_meas_ops);
        tool_button(bar, drawable, xpm_meas_x,
+           "Add a horizontal measurement",
            tool_button_press_event, &tool_meas_ops_x);
        tool_button(bar, drawable, xpm_meas_y,
+           "Add a vertical measurement",
            tool_button_press_event, &tool_meas_ops_y);
 
-       frame_image = gtk_widget_ref(make_image(drawable, xpm_frame));
+       frame_image = gtk_widget_ref(make_image(drawable, xpm_frame,
+           "Step 1: select the current frame for insertion"));
        frame_image_locked =
-           gtk_widget_ref(make_image(drawable, xpm_frame_locked));
+           gtk_widget_ref(make_image(drawable, xpm_frame_locked,
+           "Step 2: select the frame into which to insert"));
        frame_image_ready =
-           gtk_widget_ref(make_image(drawable, xpm_frame_ready));
+           gtk_widget_ref(make_image(drawable, xpm_frame_ready,
+           "Final step: add the frame reference to an anchor point "
+           "(vector or origin)"));
        set_frame_image(frame_image);
 
-       delete_image[0] = gtk_widget_ref(make_image(drawable, xpm_delete_off));
-       delete_image[1] = gtk_widget_ref(make_image(drawable, xpm_delete));
+       delete_image[0] = gtk_widget_ref(make_image(drawable, xpm_delete_off,
+           NULL));
+       delete_image[1] = gtk_widget_ref(make_image(drawable, xpm_delete,
+           "Delete the selected item"));
        set_image(ev_delete, delete_image[0]);
 
        tool_reset();

Modified: trunk/eda/fped/gui_util.c
===================================================================
--- trunk/eda/fped/gui_util.c   2009-12-31 16:24:23 UTC (rev 5766)
+++ trunk/eda/fped/gui_util.c   2010-01-01 14:59:17 UTC (rev 5767)
@@ -1,8 +1,8 @@
 /*
  * gui_util.c - GUI helper functions
  *
- * Written 2009 by Werner Almesberger
- * Copyright 2009 by Werner Almesberger
+ * Written 2009, 2010 by Werner Almesberger
+ * Copyright 2009, 2010 by Werner Almesberger
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -172,7 +172,7 @@
 /* ----- generate a tool button with an XPM image -------------------------- */
 
 
-GtkWidget *make_image(GdkDrawable *drawable, char **xpm)
+GtkWidget *make_image(GdkDrawable *drawable, char **xpm, const char *tooltip)
 {
        GdkPixmap *pixmap;
        GtkWidget *image;
@@ -181,11 +181,14 @@
        pixmap = gdk_pixmap_create_from_xpm_d(drawable, NULL, &white, xpm);
        image = gtk_image_new_from_pixmap(pixmap, NULL);
        gtk_misc_set_padding(GTK_MISC(image), 1, 1);
+       if (tooltip)
+               gtk_widget_set_tooltip_markup(image, tooltip);
        return image;
 }
 
 
-GtkWidget *make_transparent_image(GdkDrawable *drawable, char **xpm)
+GtkWidget *make_transparent_image(GdkDrawable *drawable, char **xpm,
+    const char *tooltip)
 {
        GdkPixmap *pixmap;
        GdkBitmap *mask;
@@ -194,6 +197,8 @@
        pixmap = gdk_pixmap_create_from_xpm_d(drawable, &mask, NULL, xpm);
        image = gtk_image_new_from_pixmap(pixmap, mask);
        gtk_misc_set_padding(GTK_MISC(image), 1, 1);
+       if (tooltip)
+               gtk_widget_set_tooltip_markup(image, tooltip);
        return image;
 }
 
@@ -218,7 +223,8 @@
 }
 
 
-GtkWidget *tool_button(GtkWidget *bar, GdkDrawable *drawable, char **xpm,
+GtkWidget *tool_button(GtkWidget *bar, GdkDrawable *drawable,
+    char **xpm, const char *tooltip,
     gboolean (*cb)(GtkWidget *widget, GdkEventButton *event, gpointer data),
     gpointer data)
 {
@@ -233,7 +239,7 @@
 
        evbox = gtk_event_box_new();
        if (xpm) {
-               image = make_image(drawable, xpm);
+               image = make_image(drawable, xpm, tooltip);
                gtk_container_add(GTK_CONTAINER(evbox), image);
        }
        g_signal_connect(G_OBJECT(evbox), "button_press_event",

Modified: trunk/eda/fped/gui_util.h
===================================================================
--- trunk/eda/fped/gui_util.h   2009-12-31 16:24:23 UTC (rev 5766)
+++ trunk/eda/fped/gui_util.h   2010-01-01 14:59:17 UTC (rev 5767)
@@ -1,8 +1,8 @@
 /*
  * gui_util.h - GUI helper functions
  *
- * Written 2009 by Werner Almesberger
- * Copyright 2009 by Werner Almesberger
+ * Written 2009, 2010 by Werner Almesberger
+ * Copyright 2009, 2010 by Werner Almesberger
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -59,10 +59,14 @@
 
 void vacate_widget(GtkWidget *widget);
 
-GtkWidget *make_image(GdkDrawable *drawable, char **xpm);
-GtkWidget *make_transparent_image(GdkDrawable *drawable, char **xpm);
+/* tooltips are optional (use NULL for none) */
+
+GtkWidget *make_image(GdkDrawable *drawable, char **xpm, const char *tooltip);
+GtkWidget *make_transparent_image(GdkDrawable *drawable, char **xpm,
+    const char *tooltip);
 void set_image(GtkWidget *widget, GtkWidget *image);
-GtkWidget *tool_button(GtkWidget *bar, GdkDrawable *drawable, char **xpm,
+GtkWidget *tool_button(GtkWidget *bar, GdkDrawable *drawable,
+    char **xpm, const char *tooltip,
     gboolean (*cb)(GtkWidget *widget, GdkEventButton *event, gpointer data),
     gpointer data);
 




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2010-01-01 23:08:29 +0100 (Fri, 01 Jan 2010)
New Revision: 5768

Modified:
   trunk/eda/fped/gui_frame.c
   trunk/eda/fped/gui_status.c
   trunk/eda/fped/gui_util.c
   trunk/eda/fped/gui_util.h
Log:
Added tooltips to frame/items list.



Modified: trunk/eda/fped/gui_frame.c
===================================================================
--- trunk/eda/fped/gui_frame.c  2010-01-01 14:59:17 UTC (rev 5767)
+++ trunk/eda/fped/gui_frame.c  2010-01-01 22:08:29 UTC (rev 5768)
@@ -598,7 +598,7 @@
 
 static GtkWidget *add_activator(GtkWidget *hbox, int active,
     gboolean (*cb)(GtkWidget *widget, GdkEventButton *event, gpointer data),
-    gpointer user, const char *fmt, ...)
+    gpointer user, const char *tooltip, const char *fmt, ...)
 {
        GtkWidget *label;
        va_list ap;
@@ -607,7 +607,7 @@
        va_start(ap, fmt);
        vsprintf(buf, fmt, ap);
        va_end(ap);
-       label = label_in_box_new(buf);
+       label = label_in_box_new(buf, tooltip);
        gtk_misc_set_padding(GTK_MISC(label), 2, 2);
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
        label_in_box_bg(label,
@@ -699,7 +699,8 @@
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
 
-       field = label_in_box_new(table->vars->name);
+       field = label_in_box_new(table->vars->name,
+           "Variable name. Click to edit.");
        gtk_box_pack_start(GTK_BOX(hbox), box_of_label(field), FALSE, FALSE, 0);
        label_in_box_bg(field, COLOR_VAR_PASSIVE);
        table->vars->widget = field;
@@ -711,7 +712,7 @@
            FALSE, FALSE, 0);
 
        expr = unparse(table->rows->values->expr);
-       field = label_in_box_new(expr);
+       field = label_in_box_new(expr, "Variable value. Click to edit.");
        free(expr);
        gtk_box_pack_start(GTK_BOX(hbox), box_of_label(field), FALSE, FALSE, 0);
        label_in_box_bg(field, COLOR_EXPR_PASSIVE);
@@ -872,7 +873,8 @@
 
        n_vars = 0;
        for (var = table->vars; var; var = var->next) {
-               field = label_in_box_new(var->name);
+               field = label_in_box_new(var->name,
+                   "Variable (column) name. Click to edit.");
                gtk_table_attach_defaults(GTK_TABLE(tab), box_of_label(field),
                    n_vars, n_vars+1, 0, 1);
                label_in_box_bg(field, COLOR_VAR_PASSIVE);
@@ -890,7 +892,8 @@
                n_vars = 0;
                for (value = row->values; value; value = value->next) {
                        expr = unparse(value->expr);
-                       field = label_in_box_new(expr);
+                       field = label_in_box_new(expr,
+                           "Variable value. Click to select row or to edit.");
                        free(expr);
                        gtk_table_attach_defaults(GTK_TABLE(tab),
                            box_of_label(field),
@@ -1037,7 +1040,8 @@
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
 
-       field = label_in_box_new(loop->var.name);
+       field = label_in_box_new(loop->var.name,
+           "Variable name. Click to edit.");
        gtk_box_pack_start(GTK_BOX(hbox), box_of_label(field), FALSE, FALSE, 0);
        label_in_box_bg(field, COLOR_VAR_PASSIVE);
        if (instantiation_error == loop)
@@ -1051,7 +1055,8 @@
            FALSE, FALSE, 0);
 
        expr = unparse(loop->from.expr);
-       field = label_in_box_new(expr);
+       field = label_in_box_new(expr,
+           "Start value of loop. Click to edit.");
        free(expr);
        gtk_box_pack_start(GTK_BOX(hbox), box_of_label(field), FALSE, FALSE, 0);
        label_in_box_bg(field, COLOR_EXPR_PASSIVE);
@@ -1064,7 +1069,7 @@
            FALSE, FALSE, 0);
 
        expr = unparse(loop->to.expr);
-       field = label_in_box_new(expr);
+       field = label_in_box_new(expr, "End value of loop. Click to edit.");
        free(expr);
        gtk_box_pack_start(GTK_BOX(hbox), box_of_label(field), FALSE, FALSE, 0);
        label_in_box_bg(field, COLOR_EXPR_PASSIVE);
@@ -1078,7 +1083,9 @@
 
        for (i = 0; i != loop->iterations; i++) {
                label = add_activator(hbox, loop->active == i,
-                   loop_select_event, loop, "%g", loop->n+i);
+                   loop_select_event, loop,
+                   "Loop value. Click to make active.",
+                   "%g", loop->n+i);
                gtk_object_set_data(GTK_OBJECT(box_of_label(label)), "value",
                    (gpointer) (long) i);
 
@@ -1179,7 +1186,7 @@
 {
        GtkWidget *label;
 
-       label = label_in_box_new(s);
+       label = label_in_box_new(s, "Click to select.");
        gtk_misc_set_padding(GTK_MISC(label), 0, 0);
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
        gtk_widget_modify_font(label, item_list_font);
@@ -1343,7 +1350,8 @@
 {
        GtkWidget *label;
 
-       label = label_in_box_new(pkg_name);
+       label = label_in_box_new(pkg_name,
+           "Package name. (Template) Click to edit.");
        gtk_misc_set_padding(GTK_MISC(label), 2, 2);
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
 
@@ -1414,6 +1422,7 @@
                if (pkg->name) {
                        field = add_activator(hbox, pkg == active_pkg,
                            pkg_select_event, pkg,
+                           "Package name. Click to make active.",
                            "%s", pkg->name);
                        g_signal_connect(G_OBJECT(box_of_label(field)),
                            "scroll_event",
@@ -1503,7 +1512,9 @@
 {
        GtkWidget *label;
 
-       label = label_in_box_new(frame->name ? frame->name : "(root)");
+       label = label_in_box_new(frame->name ? frame->name : "(root)",
+           frame->name ? "Frame name. Click to select or edit." :
+           "Root frame. Click to select.");
        gtk_misc_set_padding(GTK_MISC(label), 2, 2);
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
 
@@ -1540,14 +1551,22 @@
 {
        GtkWidget *hbox;
        struct obj *obj;
+       char *tooltip;
 
        hbox = gtk_hbox_new(FALSE, 0);
        for (obj = frame->objs; obj; obj = obj->next)
-               if (obj->type == ot_frame && obj->u.frame.ref == active_frame)
+               if (obj->type == ot_frame &&
+                   obj->u.frame.ref == active_frame) {
+                       tooltip = stralloc_printf(
+                           "Frame <b>%s</b> is referenced here. "
+                           "Click to make active.", active_frame->name);
                        add_activator(hbox,
                            obj == obj->u.frame.ref->active_ref,
                            frame_ref_select_event, obj,
+                           tooltip,
                            "%d", obj->u.frame.lineno);
+                       free(tooltip);
+               }
        return hbox;
 }
 

Modified: trunk/eda/fped/gui_status.c
===================================================================
--- trunk/eda/fped/gui_status.c 2010-01-01 14:59:17 UTC (rev 5767)
+++ trunk/eda/fped/gui_status.c 2010-01-01 22:08:29 UTC (rev 5768)
@@ -1,8 +1,8 @@
 /*
  * gui_status.c - GUI, status area
  *
- * Written 2009 by Werner Almesberger
- * Copyright 2009 by Werner Almesberger
+ * Written 2009, 2010 by Werner Almesberger
+ * Copyright 2009, 2010 by Werner Almesberger
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -238,7 +238,7 @@
 {
        vacate_widget(status_box_x);
        curr_pad_type = type;
-       pad_type = label_in_box_new(NULL);
+       pad_type = label_in_box_new(NULL, "Pad type. Click to cycle.");
        gtk_container_add(GTK_CONTAINER(status_box_x), box_of_label(pad_type));
        label_in_box_bg(pad_type, COLOR_SELECTOR);
        g_signal_connect(G_OBJECT(box_of_label(pad_type)),
@@ -880,7 +880,7 @@
 {
        GtkWidget *label;
 
-       label = label_in_box_new(NULL);
+       label = label_in_box_new(NULL, NULL);
        gtk_table_attach(GTK_TABLE(tab), box_of_label(label),
            col, col+1, row, row+1,
            GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 1);

Modified: trunk/eda/fped/gui_util.c
===================================================================
--- trunk/eda/fped/gui_util.c   2010-01-01 14:59:17 UTC (rev 5767)
+++ trunk/eda/fped/gui_util.c   2010-01-01 22:08:29 UTC (rev 5768)
@@ -133,7 +133,7 @@
 /* ----- labels in a box --------------------------------------------------- */
 
 
-GtkWidget *label_in_box_new(const char *s)
+GtkWidget *label_in_box_new(const char *s, const char *tooltip)
 {
        GtkWidget *evbox, *label;
 
@@ -141,6 +141,8 @@
        label = gtk_label_new(s);
        gtk_misc_set_padding(GTK_MISC(label), 1, 1);
        gtk_container_add(GTK_CONTAINER(evbox), label);
+       if (tooltip)
+               gtk_widget_set_tooltip_markup(evbox, tooltip);
        return label;
 }
 

Modified: trunk/eda/fped/gui_util.h
===================================================================
--- trunk/eda/fped/gui_util.h   2010-01-01 14:59:17 UTC (rev 5767)
+++ trunk/eda/fped/gui_util.h   2010-01-01 22:08:29 UTC (rev 5768)
@@ -52,15 +52,15 @@
 void draw_circle(GdkDrawable *da, GdkGC *gc, int fill,
     int x, int y, int r);
 
-GtkWidget *label_in_box_new(const char *s);
+/* tooltips are optional (use NULL for none) */
+
+GtkWidget *label_in_box_new(const char *s, const char *tooltip);
 GtkWidget *box_of_label(GtkWidget *label);
 void label_in_box_fg(GtkWidget *box, const char *color);
 void label_in_box_bg(GtkWidget *box, const char *color);
 
 void vacate_widget(GtkWidget *widget);
 
-/* tooltips are optional (use NULL for none) */
-
 GtkWidget *make_image(GdkDrawable *drawable, char **xpm, const char *tooltip);
 GtkWidget *make_transparent_image(GdkDrawable *drawable, char **xpm,
     const char *tooltip);




--- End Message ---
_______________________________________________
commitlog mailing list
commitlog@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to