r5767 - trunk/eda/fped
werner at docs.openmoko.org
werner at docs.openmoko.org
Fri Jan 1 15:59:17 CET 2010
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);
More information about the commitlog
mailing list