mirror of
git://projects.qi-hardware.com/fped.git
synced 2024-11-25 19:02:29 +02:00
Simplified and improved the design of wrapped tables.
- gui_frame.c (build_table): don't add an extra column for wrapped tables. They look better without it. - gui_frame.c (build_table): add two pixels of background color between parts of a wrapped table - gui_style.h (FRAME_AREA_MISC_WIDTH): reduced to better fit real layout git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5848 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
parent
4bfb601a40
commit
c8cf877204
28
gui_frame.c
28
gui_frame.c
@ -961,12 +961,12 @@ static void build_table(GtkWidget *vbox, struct frame *frame,
|
|||||||
struct table *table, int wrap_width)
|
struct table *table, int wrap_width)
|
||||||
{
|
{
|
||||||
GtkWidget *tab, *field;
|
GtkWidget *tab, *field;
|
||||||
GtkWidget *evbox, *align;
|
GtkWidget *evbox, *align, *sep;
|
||||||
struct var *var;
|
struct var *var;
|
||||||
struct row *row;
|
struct row *row;
|
||||||
struct value *value;
|
struct value *value;
|
||||||
int n_vars = 0, n_rows = 0;
|
int n_vars = 0, n_rows = 0;
|
||||||
int n_var, n_row, pos, col;
|
int n_var, n_row, pos;
|
||||||
char *expr;
|
char *expr;
|
||||||
GdkColor color;
|
GdkColor color;
|
||||||
|
|
||||||
@ -982,15 +982,16 @@ static void build_table(GtkWidget *vbox, struct frame *frame,
|
|||||||
n_var = 0;
|
n_var = 0;
|
||||||
n_vars = 0;
|
n_vars = 0;
|
||||||
while (var) {
|
while (var) {
|
||||||
col = n_vars+(n_var != n_vars);;
|
if (n_vars) {
|
||||||
if (!n_vars) {
|
gtk_table_resize(GTK_TABLE(tab), n_rows, n_vars+1);
|
||||||
|
} else {
|
||||||
evbox = gtk_event_box_new();
|
evbox = gtk_event_box_new();
|
||||||
align = gtk_alignment_new(0, 0, 0, 0);
|
align = gtk_alignment_new(0, 0, 0, 0);
|
||||||
gtk_container_add(GTK_CONTAINER(align), evbox);
|
gtk_container_add(GTK_CONTAINER(align), evbox);
|
||||||
gtk_box_pack_start(GTK_BOX(vbox), align,
|
gtk_box_pack_start(GTK_BOX(vbox), align,
|
||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
|
|
||||||
tab = gtk_table_new(n_rows+1, col, FALSE);
|
tab = gtk_table_new(n_rows+1, n_vars, FALSE);
|
||||||
gtk_container_add(GTK_CONTAINER(evbox), tab);
|
gtk_container_add(GTK_CONTAINER(evbox), tab);
|
||||||
color = get_color(COLOR_VAR_TABLE_SEP);
|
color = get_color(COLOR_VAR_TABLE_SEP);
|
||||||
gtk_widget_modify_bg(GTK_WIDGET(evbox),
|
gtk_widget_modify_bg(GTK_WIDGET(evbox),
|
||||||
@ -999,19 +1000,12 @@ static void build_table(GtkWidget *vbox, struct frame *frame,
|
|||||||
gtk_table_set_row_spacings(GTK_TABLE(tab), 1);
|
gtk_table_set_row_spacings(GTK_TABLE(tab), 1);
|
||||||
gtk_table_set_col_spacings(GTK_TABLE(tab), 1);
|
gtk_table_set_col_spacings(GTK_TABLE(tab), 1);
|
||||||
|
|
||||||
/* @@@
|
|
||||||
* for now, we just add an empty first column to
|
|
||||||
* wrapped tables, which yields a thin black line.
|
|
||||||
* Might want to put something more visible later.
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
gtk_table_resize(GTK_TABLE(tab), n_rows, col+1);
|
|
||||||
|
|
||||||
field = label_in_box_new(var->name,
|
field = label_in_box_new(var->name,
|
||||||
"Variable (column) name. Click to edit.");
|
"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),
|
||||||
col, col+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);
|
||||||
g_signal_connect(G_OBJECT(box_of_label(field)),
|
g_signal_connect(G_OBJECT(box_of_label(field)),
|
||||||
"button_press_event",
|
"button_press_event",
|
||||||
@ -1032,7 +1026,7 @@ static void build_table(GtkWidget *vbox, struct frame *frame,
|
|||||||
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),
|
||||||
col, col+1,
|
n_vars, n_vars+1,
|
||||||
n_row+1, n_row+2);
|
n_row+1, n_row+2);
|
||||||
label_in_box_bg(field, table->active_row == row ?
|
label_in_box_bg(field, table->active_row == row ?
|
||||||
COLOR_ROW_SELECTED : COLOR_ROW_UNSELECTED);
|
COLOR_ROW_SELECTED : COLOR_ROW_UNSELECTED);
|
||||||
@ -1065,7 +1059,11 @@ static void build_table(GtkWidget *vbox, struct frame *frame,
|
|||||||
gtk_container_remove(GTK_CONTAINER(tab),
|
gtk_container_remove(GTK_CONTAINER(tab),
|
||||||
box_of_label(value->widget));
|
box_of_label(value->widget));
|
||||||
}
|
}
|
||||||
gtk_table_resize(GTK_TABLE(tab), n_rows, col);
|
gtk_table_resize(GTK_TABLE(tab), n_rows, n_vars);
|
||||||
|
|
||||||
|
sep = gtk_vbox_new(FALSE, 0);
|
||||||
|
gtk_box_pack_start(GTK_BOX(vbox), sep,
|
||||||
|
FALSE, FALSE, 1);
|
||||||
|
|
||||||
n_vars = 0;
|
n_vars = 0;
|
||||||
continue;
|
continue;
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
|
|
||||||
#define DEFAULT_FRAME_AREA_WIDTH 250
|
#define DEFAULT_FRAME_AREA_WIDTH 250
|
||||||
#define DEFAULT_FRAME_AREA_HEIGHT 100
|
#define DEFAULT_FRAME_AREA_HEIGHT 100
|
||||||
#define FRAME_AREA_MISC_WIDTH 26 /* pane, scroll bar, slack */
|
#define FRAME_AREA_MISC_WIDTH 24 /* pane, scroll bar, slack */
|
||||||
|
|
||||||
|
|
||||||
/* ----- assorted colors --------------------------------------------------- */
|
/* ----- assorted colors --------------------------------------------------- */
|
||||||
|
Loading…
Reference in New Issue
Block a user