From c8cf8772040bfc46444258bbb9653ae464ee6200 Mon Sep 17 00:00:00 2001 From: werner Date: Fri, 19 Feb 2010 14:00:55 +0000 Subject: [PATCH] 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 --- gui_frame.c | 28 +++++++++++++--------------- gui_style.h | 2 +- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/gui_frame.c b/gui_frame.c index 2e30976..7c76c89 100644 --- a/gui_frame.c +++ b/gui_frame.c @@ -961,12 +961,12 @@ static void build_table(GtkWidget *vbox, struct frame *frame, struct table *table, int wrap_width) { GtkWidget *tab, *field; - GtkWidget *evbox, *align; + GtkWidget *evbox, *align, *sep; struct var *var; struct row *row; struct value *value; int n_vars = 0, n_rows = 0; - int n_var, n_row, pos, col; + int n_var, n_row, pos; char *expr; GdkColor color; @@ -982,15 +982,16 @@ static void build_table(GtkWidget *vbox, struct frame *frame, n_var = 0; n_vars = 0; 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(); align = gtk_alignment_new(0, 0, 0, 0); gtk_container_add(GTK_CONTAINER(align), evbox); gtk_box_pack_start(GTK_BOX(vbox), align, 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); color = get_color(COLOR_VAR_TABLE_SEP); 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_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, "Variable (column) name. Click to edit."); 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); g_signal_connect(G_OBJECT(box_of_label(field)), "button_press_event", @@ -1032,7 +1026,7 @@ static void build_table(GtkWidget *vbox, struct frame *frame, free(expr); gtk_table_attach_defaults(GTK_TABLE(tab), box_of_label(field), - col, col+1, + n_vars, n_vars+1, n_row+1, n_row+2); label_in_box_bg(field, table->active_row == row ? 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), 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; continue; diff --git a/gui_style.h b/gui_style.h index f3468e3..bd15109 100644 --- a/gui_style.h +++ b/gui_style.h @@ -63,7 +63,7 @@ #define DEFAULT_FRAME_AREA_WIDTH 250 #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 --------------------------------------------------- */