r5776 - trunk/eda/fped
werner at docs.openmoko.org
werner at docs.openmoko.org
Sun Jan 3 01:36:52 CET 2010
Author: werner
Date: 2010-01-03 01:36:52 +0100 (Sun, 03 Jan 2010)
New Revision: 5776
Modified:
trunk/eda/fped/TODO
trunk/eda/fped/gui_frame.c
trunk/eda/fped/gui_status.c
trunk/eda/fped/gui_status.h
trunk/eda/fped/inst.c
Log:
Added tooltips for editable status area items. All tools are now tipped.
- gui_status.h, gui_status.c (edit_*): edit functions now accept a tooltip
- added tooltips for editable status area items
- tooltips on setup_set_type_* looked strange. Show them only for the value
field next to the type field.
Modified: trunk/eda/fped/TODO
===================================================================
--- trunk/eda/fped/TODO 2010-01-02 23:58:52 UTC (rev 5775)
+++ trunk/eda/fped/TODO 2010-01-03 00:36:52 UTC (rev 5776)
@@ -27,7 +27,6 @@
- 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 (in progress)
Bugs:
- default silk width has no business being hard-coded in obj.c
Modified: trunk/eda/fped/gui_frame.c
===================================================================
--- trunk/eda/fped/gui_frame.c 2010-01-02 23:58:52 UTC (rev 5775)
+++ trunk/eda/fped/gui_frame.c 2010-01-03 00:36:52 UTC (rev 5776)
@@ -541,11 +541,13 @@
{
inst_select_outside(var, unselect_var);
label_in_box_bg(var->widget, COLOR_VAR_EDITING);
- status_set_type_entry("Variable name", "name =");
+ status_set_type_entry(NULL, "name =");
status_set_name("Variable name", "%s", var->name);
edit_nothing();
edit_unique_with_values(&var->name, validate_var_name, var,
- set_values, user, max_values);
+ set_values, user, max_values,
+ "Variable name. "
+ "Shortcut:<b><i>name</i>=<i>value</i>,<i>...</i> </b>");
}
@@ -578,7 +580,7 @@
inst_select_outside(value, unselect_value);
label_in_box_bg(value->widget, COLOR_EXPR_EDITING);
edit_nothing();
- edit_expr(&value->expr);
+ edit_expr(&value->expr, "Value");
}
@@ -589,7 +591,7 @@
inst_select_outside(value, unselect_value);
label_in_box_bg(value->widget, COLOR_VAR_EDITING);
edit_nothing();
- edit_expr_list(value->expr, set_values, user);
+ edit_expr_list(value->expr, set_values, user, "Value(s)");
}
@@ -1336,10 +1338,11 @@
case 1:
inst_select_outside(widget, unselect_pkg_name);
label_in_box_bg(widget, COLOR_PART_NAME_EDITING);
- status_set_type_entry("Package name", "package =");
+ status_set_type_entry(NULL, "package =");
status_set_name("Package name (actual)", "%s", pkg_name);
edit_nothing();
- edit_name(&pkg_name, validate_pkg_name, NULL);
+ edit_name(&pkg_name, validate_pkg_name, NULL,
+ "Package name (template)");
break;
}
return TRUE;
@@ -1470,10 +1473,10 @@
inst_select_outside(frame, unselect_frame);
label_in_box_bg(frame->label, COLOR_FRAME_EDITING);
tip = "Frame name";
- status_set_type_entry(tip, "name =");
+ status_set_type_entry(NULL, "name =");
status_set_name(tip, "%s", frame->name);
edit_nothing();
- edit_unique(&frame->name, validate_frame_name, frame);
+ edit_unique(&frame->name, validate_frame_name, frame, tip);
}
Modified: trunk/eda/fped/gui_status.c
===================================================================
--- trunk/eda/fped/gui_status.c 2010-01-02 23:58:52 UTC (rev 5775)
+++ trunk/eda/fped/gui_status.c 2010-01-03 00:36:52 UTC (rev 5776)
@@ -159,8 +159,8 @@
void status_set_xy(struct coord coord)
{
/* do dX/dY etc. stuff later */
- status_set_type_x("Width", "X =");
- status_set_type_y("Height", "Y =");
+ status_set_type_x(NULL, "X =");
+ status_set_type_y(NULL, "Y =");
set_with_units(status_set_x, "", coord.x, "Width");
set_with_units(status_set_y, "", coord.y, "Height");
@@ -301,7 +301,8 @@
}
-static void setup_edit(GtkWidget *widget, struct edit_ops *ops, void *ctx)
+static void setup_edit(GtkWidget *widget, struct edit_ops *ops, void *ctx,
+ const char *tooltip)
{
gtk_object_set_data(GTK_OBJECT(widget), "edit-ops", ops);
gtk_object_set_data(GTK_OBJECT(widget), "edit-ctx", ctx);
@@ -321,6 +322,7 @@
else
open_edits = widget;
last_edit = widget;
+ gtk_widget_set_tooltip_markup(widget, tooltip);
}
@@ -373,14 +375,14 @@
void edit_unique(const char **s, int (*validate)(const char *s, void *ctx),
- void *ctx)
+ void *ctx, const char *tooltip)
{
static struct edit_unique_ctx unique_ctx;
unique_ctx.s = s;
unique_ctx.validate = validate;
unique_ctx.ctx = ctx;
- setup_edit(status_entry, &edit_ops_unique, &unique_ctx);
+ setup_edit(status_entry, &edit_ops_unique, &unique_ctx, tooltip);
}
@@ -419,14 +421,14 @@
void edit_unique_null(const char **s,
- int (*validate)(const char *s, void *ctx), void *ctx)
+ int (*validate)(const char *s, void *ctx), void *ctx, const char *tooltip)
{
static struct edit_unique_ctx unique_ctx;
unique_ctx.s = s;
unique_ctx.validate = validate;
unique_ctx.ctx = ctx;
- setup_edit(status_entry, &edit_ops_null_unique, &unique_ctx);
+ setup_edit(status_entry, &edit_ops_null_unique, &unique_ctx, tooltip);
}
@@ -490,7 +492,8 @@
void edit_unique_with_values(const char **s,
int (*validate)(const char *s, void *ctx), void *ctx,
void (*set_values)(void *user, const struct value *values, int n_values),
- void *user, int max_values)
+ void *user, int max_values,
+ const char *tooltip)
{
static struct edit_unique_with_values_ctx unique_ctx;
@@ -500,7 +503,8 @@
unique_ctx.set_values = set_values;
unique_ctx.user = user;
unique_ctx.max_values = max_values;
- setup_edit(status_entry, &edit_ops_unique_with_values, &unique_ctx);
+ setup_edit(status_entry, &edit_ops_unique_with_values, &unique_ctx,
+ tooltip);
}
@@ -549,14 +553,15 @@
};
-void edit_name(char **s, int (*validate)(const char *s, void *ctx), void *ctx)
+void edit_name(char **s, int (*validate)(const char *s, void *ctx), void *ctx,
+ const char *tooltip)
{
static struct edit_name_ctx name_ctx;
name_ctx.s = s;
name_ctx.validate = validate;
name_ctx.ctx = ctx;
- setup_edit(status_entry, &edit_ops_name, &name_ctx);
+ setup_edit(status_entry, &edit_ops_name, &name_ctx, tooltip);
}
@@ -610,30 +615,31 @@
};
-static void edit_any_expr(GtkWidget *widget, struct expr **expr)
+static void edit_any_expr(GtkWidget *widget, struct expr **expr,
+ const char *tooltip)
{
- setup_edit(widget, &edit_ops_expr, expr);
+ setup_edit(widget, &edit_ops_expr, expr, tooltip);
}
-void edit_expr(struct expr **expr)
+void edit_expr(struct expr **expr, const char *tooltip)
{
- edit_any_expr(status_entry, expr);
+ edit_any_expr(status_entry, expr, tooltip);
}
-void edit_x(struct expr **expr)
+void edit_x(struct expr **expr, const char *tooltip)
{
vacate_widget(status_box_x);
gtk_container_add(GTK_CONTAINER(status_box_x), status_entry_x);
gtk_widget_show(status_box_x);
- edit_any_expr(status_entry_x, expr);
+ edit_any_expr(status_entry_x, expr, tooltip);
}
-void edit_y(struct expr **expr)
+void edit_y(struct expr **expr, const char *tooltip)
{
- edit_any_expr(status_entry_y, expr);
+ edit_any_expr(status_entry_y, expr, tooltip);
}
@@ -693,14 +699,14 @@
void edit_expr_list(struct expr *expr,
void (*set_values)(void *user, const struct value *values, int n_values),
- void *user)
+ void *user, const char *tooltip)
{
static struct edit_expr_list_ctx expr_list_ctx;
expr_list_ctx.expr = expr;
expr_list_ctx.set_values = set_values;
expr_list_ctx.user = user;
- setup_edit(status_entry, &edit_ops_expr_list, &expr_list_ctx);
+ setup_edit(status_entry, &edit_ops_expr_list, &expr_list_ctx, tooltip);
}
Modified: trunk/eda/fped/gui_status.h
===================================================================
--- trunk/eda/fped/gui_status.h 2010-01-02 23:58:52 UTC (rev 5775)
+++ trunk/eda/fped/gui_status.h 2010-01-03 00:36:52 UTC (rev 5776)
@@ -34,20 +34,21 @@
void edit_pad_type(enum pad_type *type);
void edit_unique(const char **s, int (*validate)(const char *s, void *ctx),
- void *ctx);
+ void *ctx, const char *tooltip);
void edit_unique_null(const char **s, int (*validate)(const char *s, void *ctx),
- void *ctx);
+ void *ctx, const char *tooltip);
void edit_unique_with_values(const char **s,
int (*validate)(const char *s, void *ctx), void *ctx,
void (*set_values)(void *user, const struct value *values, int n_values),
- void *user, int max_values);
-void edit_name(char **s, int (*validate)(const char *s, void *ctx), void *ctx);
-void edit_expr(struct expr **expr);
+ void *user, int max_values, const char *tooltip);
+void edit_name(char **s, int (*validate)(const char *s, void *ctx), void *ctx,
+ const char *tooltip);
+void edit_expr(struct expr **expr, const char *tooltip);
void edit_expr_list(struct expr *expr,
void (*set_values)(void *user, const struct value *values, int n_values),
- void *user);
-void edit_x(struct expr **expr);
-void edit_y(struct expr **expr);
+ void *user, const char *tooltip);
+void edit_x(struct expr **expr, const char *tooltip);
+void edit_y(struct expr **expr, const char *tooltip);
void edit_nothing(void);
void set_with_units(void (*set)(const char *tooltip, const char *fmt, ...),
Modified: trunk/eda/fped/inst.c
===================================================================
--- trunk/eda/fped/inst.c 2010-01-02 23:58:52 UTC (rev 5775)
+++ trunk/eda/fped/inst.c 2010-01-03 00:36:52 UTC (rev 5776)
@@ -492,9 +492,8 @@
}
set_with_units(status_set_r, "d = ", diag, "Length of diagonal");
if (width != -1) {
- tip = "Line width";
- status_set_type_entry(tip, "width =");
- set_with_units(status_set_name, "", width, tip);
+ status_set_type_entry(NULL, "width =");
+ set_with_units(status_set_name, "", width, "Line width");
}
}
@@ -573,19 +572,17 @@
static void vec_edit(struct vec *vec)
{
- edit_x(&vec->x);
- edit_y(&vec->y);
- edit_unique_null(&vec->name, validate_vec_name, vec);
+ edit_x(&vec->x, "X distance");
+ edit_y(&vec->y, "Y distance");
+ edit_unique_null(&vec->name, validate_vec_name, vec, "Vector name");
}
static void vec_op_select(struct inst *self)
{
- const char *tip;
-
- tip = "Vector reference (name)";
- status_set_type_entry(tip, "ref =");
- status_set_name(tip, "%s", self->vec->name ? self->vec->name : "");
+ status_set_type_entry(NULL, "ref =");
+ status_set_name("Vector reference (name)",
+ "%s", self->vec->name ? self->vec->name : "");
rect_status(self->base, self->u.vec.end, -1, 0);
vec_edit(self->vec);
}
@@ -710,7 +707,7 @@
static void obj_line_edit(struct obj *obj)
{
- edit_expr(&obj->u.line.width);
+ edit_expr(&obj->u.line.width, "Line width");
}
@@ -760,7 +757,7 @@
static void obj_rect_edit(struct obj *obj)
{
- edit_expr(&obj->u.rect.width);
+ edit_expr(&obj->u.rect.width, "Line width");
}
@@ -814,13 +811,14 @@
static void obj_pad_edit(struct obj *obj)
{
edit_pad_type(&obj->u.pad.type);
- edit_name(&obj->u.pad.name, validate_pad_name, NULL);
+ edit_name(&obj->u.pad.name, validate_pad_name, NULL,
+ "Pad name (template)");
}
static void pad_op_select(struct inst *self)
{
- status_set_type_entry("Pad name", "label =");
+ status_set_type_entry(NULL, "label =");
status_set_name("Pad name (actual)", "%s", self->u.pad.name);
rect_status(self->base, self->u.pad.other, -1, 0);
obj_pad_edit(self->obj);
@@ -848,7 +846,7 @@
static void rpad_op_select(struct inst *self)
{
- status_set_type_entry("Pad name", "label =");
+ status_set_type_entry(NULL, "label =");
status_set_name("Pad name (actual)", "%s", self->u.pad.name);
rect_status(self->base, self->u.pad.other, -1, 1);
obj_pad_edit(self->obj);
@@ -886,22 +884,19 @@
static void obj_arc_edit(struct obj *obj)
{
- edit_expr(&obj->u.arc.width);
+ edit_expr(&obj->u.arc.width, "Line width");
}
static void arc_op_select(struct inst *self)
{
- const char *tip;
-
status_set_xy(self->base);
status_set_angle("Angle", "a = %3.1f deg",
self->u.arc.a1 == self->u.arc.a2 ? 360 :
self->u.arc.a2-self->u.arc.a1);
set_with_units(status_set_r, "r = ", self->u.arc.r, "Radius");
- tip = "Line width";
- status_set_type_entry(tip, "width =");
- set_with_units(status_set_name, "", self->u.arc.width, tip);
+ status_set_type_entry(NULL, "width =");
+ set_with_units(status_set_name, "", self->u.arc.width, "Line width");
obj_arc_edit(self->obj);
}
@@ -962,18 +957,16 @@
static void obj_meas_edit(struct obj *obj)
{
- edit_expr(&obj->u.meas.offset);
+ edit_expr(&obj->u.meas.offset, "Measurement line offset");
}
static void meas_op_select(struct inst *self)
{
- const char *tip;
-
rect_status(self->bbox.min, self->bbox.max, -1, 0);
- tip = "Measurement line offset";
- status_set_type_entry(tip, "offset =");
- set_with_units(status_set_name, "", self->u.meas.offset, tip);
+ status_set_type_entry(NULL, "offset =");
+ set_with_units(status_set_name, "", self->u.meas.offset,
+ "Measurement line offset");
obj_meas_edit(self->obj);
}
@@ -1096,12 +1089,9 @@
static void frame_op_select(struct inst *self)
{
- const char *tip;
-
- tip = "Frame name";
rect_status(self->bbox.min, self->bbox.max, -1, 0);
- status_set_type_entry(tip, "name =");
- status_set_name(tip, "%s", self->u.frame.ref->name);
+ status_set_type_entry(NULL, "name =");
+ status_set_name("Frame name", "%s", self->u.frame.ref->name);
}
More information about the commitlog
mailing list