r5425 - trunk/eda/fped

werner at docs.openmoko.org werner at docs.openmoko.org
Wed Aug 12 16:44:17 CEST 2009


Author: werner
Date: 2009-08-12 16:44:17 +0200 (Wed, 12 Aug 2009)
New Revision: 5425

Modified:
   trunk/eda/fped/README
   trunk/eda/fped/gui_canvas.c
   trunk/eda/fped/gui_frame.c
   trunk/eda/fped/gui_frame.h
   trunk/eda/fped/inst.c
Log:
- when selecting an object via the item list, make its frame active
- having variables and items on the screen at the same time was too much. We 
  can now toggle with "/" while the canvas has the focus. (This needs better 
  controls.)



Modified: trunk/eda/fped/README
===================================================================
--- trunk/eda/fped/README	2009-08-12 11:26:59 UTC (rev 5424)
+++ trunk/eda/fped/README	2009-08-12 14:44:17 UTC (rev 5425)
@@ -402,6 +402,7 @@
 *	zoom and center to extents
 #	zoom and center to currently active frame instance
 U	undelete the previously deleted object
+/	Switch between variable and item display.
 
 
 Canvas

Modified: trunk/eda/fped/gui_canvas.c
===================================================================
--- trunk/eda/fped/gui_canvas.c	2009-08-12 11:26:59 UTC (rev 5424)
+++ trunk/eda/fped/gui_canvas.c	2009-08-12 14:44:17 UTC (rev 5425)
@@ -349,6 +349,13 @@
 		if (undelete())
 			change_world();
 		break;
+	case '/':
+{
+/* @@@ find a better place for this */
+extern int show_vars;
+		show_vars = !show_vars;
+change_world();
+}
 	}
 	return TRUE;
 }

Modified: trunk/eda/fped/gui_frame.c
===================================================================
--- trunk/eda/fped/gui_frame.c	2009-08-12 11:26:59 UTC (rev 5424)
+++ trunk/eda/fped/gui_frame.c	2009-08-12 14:44:17 UTC (rev 5425)
@@ -30,6 +30,9 @@
 #include "gui_frame.h"
 
 
+int show_vars = 1;
+
+
 /* ----- popup dispatcher -------------------------------------------------- */
 
 
@@ -1003,7 +1006,7 @@
 
 static GtkWidget *build_items(struct frame *frame)
 {
-	GtkWidget *hbox, *tab;
+	GtkWidget *vbox, *hbox, *tab;
 	struct order *order, *item;
 	struct vec *vec;
 	struct obj *obj;
@@ -1017,7 +1020,11 @@
 		if (obj->type != ot_meas)
 			n++;
 
+	vbox = gtk_vbox_new(FALSE, 0);
+	add_sep(vbox, 3);
+
 	hbox = gtk_hbox_new(FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
 
 	tab = gtk_table_new(n, 2, FALSE);
 	gtk_box_pack_start(GTK_BOX(hbox), tab, FALSE, FALSE, 0);
@@ -1043,13 +1050,13 @@
         }
         free(order);
 
-	return hbox;
+	return vbox;
 }
 
 
 static GtkWidget *build_meas(struct frame *frame)
 {
-	GtkWidget *hbox, *tab;
+	GtkWidget *vbox, *hbox, *tab;
 	struct obj *obj;
 	int n;
 	char *s;
@@ -1059,7 +1066,11 @@
 		if (obj->type == ot_meas)
 			n++;
 
+	vbox = gtk_vbox_new(FALSE, 0);
+	add_sep(vbox, 3);
+
 	hbox = gtk_hbox_new(FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
 
 	tab = gtk_table_new(n, 2, FALSE);
 	gtk_box_pack_start(GTK_BOX(hbox), tab, FALSE, FALSE, 0);
@@ -1074,7 +1085,7 @@
 		n++;
         }
 
-	return hbox;
+	return vbox;
 }
 
 
@@ -1277,7 +1288,7 @@
 
 	hbox = gtk_hbox_new(FALSE, 0);
 
-	tab = gtk_table_new(n*2+3, 3, FALSE);
+	tab = gtk_table_new(n*2+3, 2, FALSE);
 	gtk_table_set_row_spacings(GTK_TABLE(tab), 1);
 	gtk_table_set_col_spacings(GTK_TABLE(tab), 1);
 
@@ -1297,24 +1308,24 @@
 		gtk_table_attach_defaults(GTK_TABLE(tab), refs,
 		    1, 2, n*2+1, n*2+2);
 
-		vars = build_vars(frame);
-		gtk_table_attach_defaults(GTK_TABLE(tab), vars,
-		    1, 2, n*2+2, n*2+3);
+		if (show_vars) {
+			vars = build_vars(frame);
+			gtk_table_attach_defaults(GTK_TABLE(tab), vars,
+			    1, 2, n*2+2, n*2+3);
+		} else {
+			items = build_items(frame);
+			gtk_table_attach_defaults(GTK_TABLE(tab), items,
+			    1, 2, n*2+2, n*2+3);
+		}
 
-		items = build_items(frame);
-		gtk_table_attach_defaults(GTK_TABLE(tab), items,
-		    2, 3, n*2+2, n*2+3);
-
 		n++;
 	}
 
-	label = label_in_box_new(" ");
-	gtk_table_attach_defaults(GTK_TABLE(tab), box_of_label(label),
-	    2, 3, n*2+1, n*2+2);
-	
-	meas = build_meas(root_frame);
-	gtk_table_attach_defaults(GTK_TABLE(tab), meas,
-	    2, 3, n*2+2, n*2+3);
+	if (!show_vars) {
+		meas = build_meas(root_frame);
+		gtk_table_attach_defaults(GTK_TABLE(tab), meas,
+		    1, 2, n*2+2, n*2+3);
+	}
 
 	gtk_widget_show_all(hbox);
 }

Modified: trunk/eda/fped/gui_frame.h
===================================================================
--- trunk/eda/fped/gui_frame.h	2009-08-12 11:26:59 UTC (rev 5424)
+++ trunk/eda/fped/gui_frame.h	2009-08-12 14:44:17 UTC (rev 5425)
@@ -17,6 +17,9 @@
 #include <gtk/gtk.h>
 
 
+extern int show_vars;
+
+
 void make_popups(void);
 
 void select_frame(struct frame *frame);

Modified: trunk/eda/fped/inst.c
===================================================================
--- trunk/eda/fped/inst.c	2009-08-12 11:26:59 UTC (rev 5424)
+++ trunk/eda/fped/inst.c	2009-08-12 14:44:17 UTC (rev 5425)
@@ -303,6 +303,8 @@
 {
 	struct inst *inst;
 
+	if (vec->frame != active_frame)
+		select_frame(vec->frame);
 	for (inst = insts[ip_vec]; inst; inst = inst->next)
 		if (inst->vec == vec && inst->active) {
 			inst_deselect();
@@ -318,6 +320,8 @@
 	enum inst_prio prio;
 	struct inst *inst;
 
+	if (obj->frame != active_frame)
+		select_frame(obj->frame);
 	FOR_INSTS_DOWN(prio, inst)
 		if (inst->obj && inst->obj == obj && inst->active) {
 			inst_deselect();




More information about the commitlog mailing list