mirror of
git://projects.qi-hardware.com/fped.git
synced 2024-11-25 16:55:20 +02:00
Added tooltips to frame/items list.
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5768 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
parent
bdd6e95521
commit
329b8306aa
47
gui_frame.c
47
gui_frame.c
@ -598,7 +598,7 @@ static void edit_value_list(struct value *value,
|
|||||||
|
|
||||||
static GtkWidget *add_activator(GtkWidget *hbox, int active,
|
static GtkWidget *add_activator(GtkWidget *hbox, int active,
|
||||||
gboolean (*cb)(GtkWidget *widget, GdkEventButton *event, gpointer data),
|
gboolean (*cb)(GtkWidget *widget, GdkEventButton *event, gpointer data),
|
||||||
gpointer user, const char *fmt, ...)
|
gpointer user, const char *tooltip, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@ -607,7 +607,7 @@ static GtkWidget *add_activator(GtkWidget *hbox, int active,
|
|||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsprintf(buf, fmt, ap);
|
vsprintf(buf, fmt, ap);
|
||||||
va_end(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_padding(GTK_MISC(label), 2, 2);
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
label_in_box_bg(label,
|
label_in_box_bg(label,
|
||||||
@ -699,7 +699,8 @@ static void build_assignment(GtkWidget *vbox, struct frame *frame,
|
|||||||
hbox = gtk_hbox_new(FALSE, 0);
|
hbox = gtk_hbox_new(FALSE, 0);
|
||||||
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, 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);
|
gtk_box_pack_start(GTK_BOX(hbox), box_of_label(field), FALSE, FALSE, 0);
|
||||||
label_in_box_bg(field, COLOR_VAR_PASSIVE);
|
label_in_box_bg(field, COLOR_VAR_PASSIVE);
|
||||||
table->vars->widget = field;
|
table->vars->widget = field;
|
||||||
@ -711,7 +712,7 @@ static void build_assignment(GtkWidget *vbox, struct frame *frame,
|
|||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
|
|
||||||
expr = unparse(table->rows->values->expr);
|
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);
|
free(expr);
|
||||||
gtk_box_pack_start(GTK_BOX(hbox), box_of_label(field), FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(hbox), box_of_label(field), FALSE, FALSE, 0);
|
||||||
label_in_box_bg(field, COLOR_EXPR_PASSIVE);
|
label_in_box_bg(field, COLOR_EXPR_PASSIVE);
|
||||||
@ -872,7 +873,8 @@ static void build_table(GtkWidget *vbox, struct frame *frame,
|
|||||||
|
|
||||||
n_vars = 0;
|
n_vars = 0;
|
||||||
for (var = table->vars; var; var = var->next) {
|
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),
|
gtk_table_attach_defaults(GTK_TABLE(tab), box_of_label(field),
|
||||||
n_vars, n_vars+1, 0, 1);
|
n_vars, n_vars+1, 0, 1);
|
||||||
label_in_box_bg(field, COLOR_VAR_PASSIVE);
|
label_in_box_bg(field, COLOR_VAR_PASSIVE);
|
||||||
@ -890,7 +892,8 @@ static void build_table(GtkWidget *vbox, struct frame *frame,
|
|||||||
n_vars = 0;
|
n_vars = 0;
|
||||||
for (value = row->values; value; value = value->next) {
|
for (value = row->values; value; value = value->next) {
|
||||||
expr = unparse(value->expr);
|
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);
|
free(expr);
|
||||||
gtk_table_attach_defaults(GTK_TABLE(tab),
|
gtk_table_attach_defaults(GTK_TABLE(tab),
|
||||||
box_of_label(field),
|
box_of_label(field),
|
||||||
@ -1037,7 +1040,8 @@ static void build_loop(GtkWidget *vbox, struct frame *frame,
|
|||||||
hbox = gtk_hbox_new(FALSE, 0);
|
hbox = gtk_hbox_new(FALSE, 0);
|
||||||
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, 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);
|
gtk_box_pack_start(GTK_BOX(hbox), box_of_label(field), FALSE, FALSE, 0);
|
||||||
label_in_box_bg(field, COLOR_VAR_PASSIVE);
|
label_in_box_bg(field, COLOR_VAR_PASSIVE);
|
||||||
if (instantiation_error == loop)
|
if (instantiation_error == loop)
|
||||||
@ -1051,7 +1055,8 @@ static void build_loop(GtkWidget *vbox, struct frame *frame,
|
|||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
|
|
||||||
expr = unparse(loop->from.expr);
|
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);
|
free(expr);
|
||||||
gtk_box_pack_start(GTK_BOX(hbox), box_of_label(field), FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(hbox), box_of_label(field), FALSE, FALSE, 0);
|
||||||
label_in_box_bg(field, COLOR_EXPR_PASSIVE);
|
label_in_box_bg(field, COLOR_EXPR_PASSIVE);
|
||||||
@ -1064,7 +1069,7 @@ static void build_loop(GtkWidget *vbox, struct frame *frame,
|
|||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
|
|
||||||
expr = unparse(loop->to.expr);
|
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);
|
free(expr);
|
||||||
gtk_box_pack_start(GTK_BOX(hbox), box_of_label(field), FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(hbox), box_of_label(field), FALSE, FALSE, 0);
|
||||||
label_in_box_bg(field, COLOR_EXPR_PASSIVE);
|
label_in_box_bg(field, COLOR_EXPR_PASSIVE);
|
||||||
@ -1078,7 +1083,9 @@ static void build_loop(GtkWidget *vbox, struct frame *frame,
|
|||||||
|
|
||||||
for (i = 0; i != loop->iterations; i++) {
|
for (i = 0; i != loop->iterations; i++) {
|
||||||
label = add_activator(hbox, loop->active == 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",
|
gtk_object_set_data(GTK_OBJECT(box_of_label(label)), "value",
|
||||||
(gpointer) (long) i);
|
(gpointer) (long) i);
|
||||||
|
|
||||||
@ -1179,7 +1186,7 @@ static GtkWidget *item_label(GtkWidget *tab, char *s, int col, int row,
|
|||||||
{
|
{
|
||||||
GtkWidget *label;
|
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_padding(GTK_MISC(label), 0, 0);
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
gtk_widget_modify_font(label, item_list_font);
|
gtk_widget_modify_font(label, item_list_font);
|
||||||
@ -1343,7 +1350,8 @@ static GtkWidget *build_pkg_name(void)
|
|||||||
{
|
{
|
||||||
GtkWidget *label;
|
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_padding(GTK_MISC(label), 2, 2);
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
|
||||||
@ -1414,6 +1422,7 @@ static GtkWidget *build_pkg_names(void)
|
|||||||
if (pkg->name) {
|
if (pkg->name) {
|
||||||
field = add_activator(hbox, pkg == active_pkg,
|
field = add_activator(hbox, pkg == active_pkg,
|
||||||
pkg_select_event, pkg,
|
pkg_select_event, pkg,
|
||||||
|
"Package name. Click to make active.",
|
||||||
"%s", pkg->name);
|
"%s", pkg->name);
|
||||||
g_signal_connect(G_OBJECT(box_of_label(field)),
|
g_signal_connect(G_OBJECT(box_of_label(field)),
|
||||||
"scroll_event",
|
"scroll_event",
|
||||||
@ -1503,7 +1512,9 @@ static GtkWidget *build_frame_label(struct frame *frame)
|
|||||||
{
|
{
|
||||||
GtkWidget *label;
|
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_padding(GTK_MISC(label), 2, 2);
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
|
||||||
@ -1540,14 +1551,22 @@ static GtkWidget *build_frame_refs(const struct frame *frame)
|
|||||||
{
|
{
|
||||||
GtkWidget *hbox;
|
GtkWidget *hbox;
|
||||||
struct obj *obj;
|
struct obj *obj;
|
||||||
|
char *tooltip;
|
||||||
|
|
||||||
hbox = gtk_hbox_new(FALSE, 0);
|
hbox = gtk_hbox_new(FALSE, 0);
|
||||||
for (obj = frame->objs; obj; obj = obj->next)
|
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,
|
add_activator(hbox,
|
||||||
obj == obj->u.frame.ref->active_ref,
|
obj == obj->u.frame.ref->active_ref,
|
||||||
frame_ref_select_event, obj,
|
frame_ref_select_event, obj,
|
||||||
|
tooltip,
|
||||||
"%d", obj->u.frame.lineno);
|
"%d", obj->u.frame.lineno);
|
||||||
|
free(tooltip);
|
||||||
|
}
|
||||||
return hbox;
|
return hbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* gui_status.c - GUI, status area
|
* gui_status.c - GUI, status area
|
||||||
*
|
*
|
||||||
* Written 2009 by Werner Almesberger
|
* Written 2009, 2010 by Werner Almesberger
|
||||||
* Copyright 2009 by Werner Almesberger
|
* Copyright 2009, 2010 by Werner Almesberger
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -238,7 +238,7 @@ void edit_pad_type(enum pad_type *type)
|
|||||||
{
|
{
|
||||||
vacate_widget(status_box_x);
|
vacate_widget(status_box_x);
|
||||||
curr_pad_type = type;
|
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));
|
gtk_container_add(GTK_CONTAINER(status_box_x), box_of_label(pad_type));
|
||||||
label_in_box_bg(pad_type, COLOR_SELECTOR);
|
label_in_box_bg(pad_type, COLOR_SELECTOR);
|
||||||
g_signal_connect(G_OBJECT(box_of_label(pad_type)),
|
g_signal_connect(G_OBJECT(box_of_label(pad_type)),
|
||||||
@ -880,7 +880,7 @@ static GtkWidget *add_label_basic(GtkWidget *tab, int col, int row)
|
|||||||
{
|
{
|
||||||
GtkWidget *label;
|
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),
|
gtk_table_attach(GTK_TABLE(tab), box_of_label(label),
|
||||||
col, col+1, row, row+1,
|
col, col+1, row, row+1,
|
||||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 1);
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 1);
|
||||||
|
@ -133,7 +133,7 @@ void draw_circle(GdkDrawable *da, GdkGC *gc, int fill,
|
|||||||
/* ----- labels in a box --------------------------------------------------- */
|
/* ----- 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;
|
GtkWidget *evbox, *label;
|
||||||
|
|
||||||
@ -141,6 +141,8 @@ GtkWidget *label_in_box_new(const char *s)
|
|||||||
label = gtk_label_new(s);
|
label = gtk_label_new(s);
|
||||||
gtk_misc_set_padding(GTK_MISC(label), 1, 1);
|
gtk_misc_set_padding(GTK_MISC(label), 1, 1);
|
||||||
gtk_container_add(GTK_CONTAINER(evbox), label);
|
gtk_container_add(GTK_CONTAINER(evbox), label);
|
||||||
|
if (tooltip)
|
||||||
|
gtk_widget_set_tooltip_markup(evbox, tooltip);
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,15 +52,15 @@ void draw_arc(GdkDrawable *da, GdkGC *gc, int fill,
|
|||||||
void draw_circle(GdkDrawable *da, GdkGC *gc, int fill,
|
void draw_circle(GdkDrawable *da, GdkGC *gc, int fill,
|
||||||
int x, int y, int r);
|
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);
|
GtkWidget *box_of_label(GtkWidget *label);
|
||||||
void label_in_box_fg(GtkWidget *box, const char *color);
|
void label_in_box_fg(GtkWidget *box, const char *color);
|
||||||
void label_in_box_bg(GtkWidget *box, const char *color);
|
void label_in_box_bg(GtkWidget *box, const char *color);
|
||||||
|
|
||||||
void vacate_widget(GtkWidget *widget);
|
void vacate_widget(GtkWidget *widget);
|
||||||
|
|
||||||
/* tooltips are optional (use NULL for none) */
|
|
||||||
|
|
||||||
GtkWidget *make_image(GdkDrawable *drawable, char **xpm, const char *tooltip);
|
GtkWidget *make_image(GdkDrawable *drawable, char **xpm, const char *tooltip);
|
||||||
GtkWidget *make_transparent_image(GdkDrawable *drawable, char **xpm,
|
GtkWidget *make_transparent_image(GdkDrawable *drawable, char **xpm,
|
||||||
const char *tooltip);
|
const char *tooltip);
|
||||||
|
Loading…
Reference in New Issue
Block a user