r5848 - trunk/eda/fped

werner at docs.openmoko.org werner at docs.openmoko.org
Fri Feb 19 15:00:55 CET 2010


Author: werner
Date: 2010-02-19 15:00:55 +0100 (Fri, 19 Feb 2010)
New Revision: 5848

Modified:
   trunk/eda/fped/gui_frame.c
   trunk/eda/fped/gui_style.h
Log:
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



Modified: trunk/eda/fped/gui_frame.c
===================================================================
--- trunk/eda/fped/gui_frame.c	2010-02-19 10:27:46 UTC (rev 5847)
+++ trunk/eda/fped/gui_frame.c	2010-02-19 14:00:55 UTC (rev 5848)
@@ -961,12 +961,12 @@
     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 @@
 	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 @@
 			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 @@
 			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,8 +1059,12 @@
 				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;
 		}

Modified: trunk/eda/fped/gui_style.h
===================================================================
--- trunk/eda/fped/gui_style.h	2010-02-19 10:27:46 UTC (rev 5847)
+++ trunk/eda/fped/gui_style.h	2010-02-19 14:00:55 UTC (rev 5848)
@@ -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 --------------------------------------------------- */




More information about the commitlog mailing list