r5363 - in developers/werner/fped: . icons

werner at docs.openmoko.org werner at docs.openmoko.org
Sat Aug 1 22:13:05 CEST 2009


Author: werner
Date: 2009-08-01 22:13:04 +0200 (Sat, 01 Aug 2009)
New Revision: 5363

Added:
   developers/werner/fped/gui_icons.c
   developers/werner/fped/gui_icons.h
   developers/werner/fped/icons/
   developers/werner/fped/icons/arc.fig
   developers/werner/fped/icons/circ.fig
   developers/werner/fped/icons/frame.fig
   developers/werner/fped/icons/line.fig
   developers/werner/fped/icons/meas.fig
   developers/werner/fped/icons/pad.fig
   developers/werner/fped/icons/point.fig
   developers/werner/fped/icons/rect.fig
   developers/werner/fped/icons/template.fig
   developers/werner/fped/icons/vec.fig
Modified:
   developers/werner/fped/Makefile
   developers/werner/fped/README
   developers/werner/fped/gui.c
   developers/werner/fped/gui_style.h
Log:
- README: added motivation
- added icon bar for object creation (doesn't do anything yet)
- tables now have thin black lines as separators, instead of the default grey



Modified: developers/werner/fped/Makefile
===================================================================
--- developers/werner/fped/Makefile	2009-08-01 17:33:13 UTC (rev 5362)
+++ developers/werner/fped/Makefile	2009-08-01 20:13:04 UTC (rev 5363)
@@ -13,8 +13,12 @@
 OBJS = fped.o expr.o coord.o obj.o inst.o util.o error.o \
        unparse.o \
        cpp.o lex.yy.o y.tab.o \
-       gui.o gui_util.o gui_style.o gui_inst.o gui_status.o gui_canvas.o
+       gui.o gui_util.o gui_style.o gui_inst.o gui_status.o gui_canvas.o \
+       gui_icons.o
 
+XPMS = point.xpm vec.xpm frame.xpm \
+       line.xpm rect.xpm pad.xpm circ.xpm arc.xpm meas.xpm
+
 CFLAGS_GTK = `pkg-config --cflags gtk+-2.0`
 LIBS_GTK = `pkg-config --libs gtk+-2.0`
 
@@ -62,6 +66,18 @@
 
 .PHONY:		all dep depend clean
 
+.SUFFIXES:	.fig .xpm
+
+# generate 26x26 pixels icons, then drop the 1-pixel frame
+
+# this adds a magenta border
+# sed '/2 2 0 1 /{s//2 2 0 15 /;s/ 0 7 / 22 7 /;}' $< | \
+
+.fig.xpm:
+		fig2dev -L xpm -Z 0.32 -S 4 $< | \
+		  convert -crop 24x24+1+1 - - | \
+		  sed s/xpm__/xpm_`basename $@ .xpm`/ >$@
+
 all:		fped
 
 fped:		$(OBJS)
@@ -79,6 +95,8 @@
 y.tab.o:	y.tab.c
 		$(CC) -c $(CFLAGS) $(SLOPPY) y.tab.c
 
+gui_icons.o:	$(XPMS:%=icons/%)
+
 # ----- Dependencies ----------------------------------------------------------
 
 dep depend .depend: lex.yy.c y.tab.h y.tab.c
@@ -90,5 +108,6 @@
 
 # ----- Cleanup ---------------------------------------------------------------
 
-clean:
-		rm -f $(OBJS) lex.yy.c y.tab.c y.tab.h y.output .depend
+      clean:
+		rm -f $(OBJS) $(XPMS:%=icons/%)
+		rm -f lex.yy.c y.tab.c y.tab.h y.output .depend

Modified: developers/werner/fped/README
===================================================================
--- developers/werner/fped/README	2009-08-01 17:33:13 UTC (rev 5362)
+++ developers/werner/fped/README	2009-08-01 20:13:04 UTC (rev 5363)
@@ -10,8 +10,32 @@
 that can be performed through the GUI.
 
 
+Motivation
+----------
+
+KiCad already includes a footprint ("module") editor, so why do we need
+a new one ? The issue with footprint generation for KiCad is that the
+built-in module editor is basically a drawing program that only captures
+the result of the module author's interpretation of a footprint drawing,
+but does not include the steps that led to this construction.
+
+Furthermore, accurate measuring of dimensions in the drawing can only be
+done manually in the module editor, which makes review difficult and
+time-consuming.
+
+In fped, the construction process is made explicit and each step can be
+expressed in terms of the parameters that appear in the vendor's
+drawing. Dimensions can be explicitly measured and the results can be
+included in the graphical output generated by fped.
+
+Directly using parameters and construction steps from the reference
+drawing reduces the risk of mistakes. Visualizing the construction
+process and verificative measurements helps efficient and accurate
+review.
+
+
 Footprint definition file format
-================================
+--------------------------------
 
 Footprint definitions are stored in text files. The program "fped" reads
 and (soon) writes such files, visualizes their content, and provides a
@@ -30,7 +54,7 @@
 
 
 Geometry model
-==============
+--------------
 
 The geometry model consists of frames, vectors, and objects. The shape of
 objects is defined by a number of points. These points are produced by
@@ -43,7 +67,7 @@
 
 
 Units
------
+- - -
 
 fped can calculate in mm and mil. Units are specified by following a
 number with "mm" or "mil", separated by zero or more spaces or tabs.
@@ -62,7 +86,7 @@
 
 
 Vectors
--------
+- - - -
 
 Vectors can be anonymous or they can be named for future reference:
 
@@ -84,7 +108,7 @@
 
 
 Silk screen objects
--------------------
+- - - - - - - - - -
 
 The output of fped is a footprint definition that contains pads and silk
 screen drawings (we may add more layers in the future). These items are
@@ -128,7 +152,7 @@
 
 
 Pads
-----
+- -
 
 Pads are similar to rectangles, but they also have a name.
 
@@ -144,7 +168,7 @@
 
 
 Frames
-------
+- - -
 
 Frames are used to group things and to reuse them multiple times. Frames
 must be defined before they can be used:
@@ -176,7 +200,7 @@
 
 
 Names and variables
-===================
+-------------------
 
 fped uses several name spaces:
 
@@ -203,7 +227,7 @@
 
 
 Simple variables
-----------------
+- - - - - - - -
 
 A variable with a single value is defined with the following
 assignment syntax:
@@ -216,7 +240,7 @@
 
 
 Loops
------
+- - -
 
 A loop is a variable with a range of values:
 
@@ -247,7 +271,7 @@
 
 
 Tables
-------
+- - -
 
 Tables combine values for multiple variables. Like loops, they are
 used to iteratively generate objects. A table begins with a row of
@@ -284,7 +308,7 @@
 
 
 Expressions
-===========
+-----------
 
 Expressions can contain numeric constants (in non-exponential notation),
 variable names, the arithmetic operations +, -, *, /, and unary -.

Modified: developers/werner/fped/gui.c
===================================================================
--- developers/werner/fped/gui.c	2009-08-01 17:33:13 UTC (rev 5362)
+++ developers/werner/fped/gui.c	2009-08-01 20:13:04 UTC (rev 5363)
@@ -24,6 +24,7 @@
 #include "gui_style.h"
 #include "gui_status.h"
 #include "gui_canvas.h"
+#include "gui_icons.h"
 #include "gui.h"
 
 
@@ -220,11 +221,13 @@
      struct table *table)
 {
 	GtkWidget *tab, *field;
+	GtkWidget *evbox;
 	struct var *var;
 	struct row *row;
 	struct value *value;
 	int n_vars = 0, n_rows = 0;
 	char *expr;
+	GdkColor col;
 
 	for (var = table->vars; var; var = var->next)
 		n_vars++;
@@ -234,11 +237,17 @@
 	if (n_vars == 1 && n_rows == 1)
 		return;
 
+	evbox = gtk_event_box_new();
+	gtk_box_pack_start(GTK_BOX(vbox), evbox, FALSE, FALSE, 0);
+
 	tab = gtk_table_new(n_rows+1, n_vars, FALSE);
-//	gtk_misc_set_alignment(GTK_MISC(tab), 0, 0);
+	gtk_container_add(GTK_CONTAINER(evbox), tab);
+	col = get_color(COLOR_VAR_TABLE_SEP);
+	gtk_widget_modify_bg(GTK_WIDGET(evbox),
+            GTK_STATE_NORMAL, &col);
+
 	gtk_table_set_row_spacings(GTK_TABLE(tab), 1);
 	gtk_table_set_col_spacings(GTK_TABLE(tab), 1);
-	gtk_box_pack_start(GTK_BOX(vbox), tab, FALSE, FALSE, 0);
 
 	n_vars = 0;
 	for (var = table->vars; var; var = var->next) {
@@ -470,7 +479,7 @@
 static void make_center_area(GtkWidget *vbox)
 {
 	GtkWidget *hbox, *vars, *paned;
-	GtkWidget *frame_list;
+	GtkWidget *frame_list, *icons;
 
 	hbox = gtk_hbox_new(FALSE, 0);
 	gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
@@ -508,6 +517,11 @@
 	/* Canvas */
 
 	gtk_paned_add2(GTK_PANED(paned), make_canvas());
+
+	/* Icon bar */
+
+	icons = gui_setup_icons(root->window);
+	gtk_box_pack_end(GTK_BOX(hbox), icons, FALSE, FALSE, 0);
 }
 
 

Added: developers/werner/fped/gui_icons.c
===================================================================
--- developers/werner/fped/gui_icons.c	                        (rev 0)
+++ developers/werner/fped/gui_icons.c	2009-08-01 20:13:04 UTC (rev 5363)
@@ -0,0 +1,72 @@
+/*
+ * gui_icons.c - GUI, icon bar
+ *
+ * Written 2009 by Werner Almesberger
+ * Copyright 2009 by Werner Almesberger
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+
+#include <gtk/gtk.h>
+
+#include "gui_util.h"
+#include "gui_icons.h"
+
+
+#include "icons/arc.xpm"
+#include "icons/circ.xpm"
+#include "icons/frame.xpm"
+#include "icons/line.xpm"
+#include "icons/meas.xpm"
+#include "icons/pad.xpm"
+#include "icons/point.xpm"
+#include "icons/rect.xpm"
+#include "icons/vec.xpm"
+
+
+static GtkWidget *icon_button(GtkWidget *bar, GdkDrawable *drawable,
+     char **xpm)
+{
+	GdkPixmap *pixmap;
+	GtkWidget *image;	
+	GtkToolItem *item;
+
+	pixmap = gdk_pixmap_create_from_xpm_d(drawable, NULL, NULL, xpm);
+	image = gtk_image_new_from_pixmap(pixmap, NULL);
+
+	item = gtk_tool_item_new();
+	gtk_container_add(GTK_CONTAINER(item), image);
+
+	gtk_container_set_border_width(GTK_CONTAINER(item), 1);
+	gtk_toolbar_insert(GTK_TOOLBAR(bar), item, -1);
+
+	return NULL;
+}
+
+
+GtkWidget *gui_setup_icons(GdkDrawable *drawable)
+{
+	GtkWidget *bar;
+
+	bar = gtk_toolbar_new();
+	gtk_toolbar_set_style(GTK_TOOLBAR(bar), GTK_TOOLBAR_ICONS);
+	gtk_toolbar_set_orientation(GTK_TOOLBAR(bar),
+	    GTK_ORIENTATION_VERTICAL);
+//gtk_container_set_border_width(GTK_CONTAINER(bar), 5);
+
+	icon_button(bar, drawable, xpm_point);
+	icon_button(bar, drawable, xpm_vec);
+	icon_button(bar, drawable, xpm_frame);
+	icon_button(bar, drawable, xpm_pad);
+	icon_button(bar, drawable, xpm_line);
+	icon_button(bar, drawable, xpm_rect);
+	icon_button(bar, drawable, xpm_circ);
+	icon_button(bar, drawable, xpm_arc);
+	icon_button(bar, drawable, xpm_meas);
+
+	return bar;
+}

Added: developers/werner/fped/gui_icons.h
===================================================================
--- developers/werner/fped/gui_icons.h	                        (rev 0)
+++ developers/werner/fped/gui_icons.h	2009-08-01 20:13:04 UTC (rev 5363)
@@ -0,0 +1,22 @@
+/*
+ * gui_icons.h - GUI, icon bar
+ *
+ * Written 2009 by Werner Almesberger
+ * Copyright 2009 by Werner Almesberger
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+
+#ifndef GUI_ICONS_H
+#define	GUI_ICONS_H
+
+#include <gtk/gtk.h>
+
+
+GtkWidget *gui_setup_icons(GdkDrawable *drawable);
+
+#endif /* !GUI_ICONS_H */

Modified: developers/werner/fped/gui_style.h
===================================================================
--- developers/werner/fped/gui_style.h	2009-08-01 17:33:13 UTC (rev 5362)
+++ developers/werner/fped/gui_style.h	2009-08-01 20:13:04 UTC (rev 5363)
@@ -57,7 +57,9 @@
 #define	COLOR_ROW_UNSELECTED	COLOR_CHOICE_UNSELECTED
 #define	COLOR_ROW_SELECTED	COLOR_CHOICE_SELECTED
 
+#define	COLOR_VAR_TABLE_SEP	"black"
 
+
 /* ----- canvas drawing styles --------------------------------------------- */
 
 

Added: developers/werner/fped/icons/arc.fig
===================================================================
--- developers/werner/fped/icons/arc.fig	                        (rev 0)
+++ developers/werner/fped/icons/arc.fig	2009-08-01 20:13:04 UTC (rev 5363)
@@ -0,0 +1,13 @@
+#FIG 3.2  Produced by xfig version 3.2.5a
+Landscape
+Center
+Inches
+A4      
+100.00
+Single
+-2
+1200 2
+5 1 0 10 3 7 50 -1 -1 0.000 0 1 1 0 4005.000 4395.000 5550 4500 5100 3300 3900 2850
+	0 0 10.00 450.00 600.00
+2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
+	 3600 2400 6000 2400 6000 4800 3600 4800 3600 2400

Added: developers/werner/fped/icons/circ.fig
===================================================================
--- developers/werner/fped/icons/circ.fig	                        (rev 0)
+++ developers/werner/fped/icons/circ.fig	2009-08-01 20:13:04 UTC (rev 5363)
@@ -0,0 +1,12 @@
+#FIG 3.2  Produced by xfig version 3.2.5a
+Landscape
+Center
+Inches
+A4      
+100.00
+Single
+-2
+1200 2
+1 3 0 10 3 7 50 -1 -1 0.000 1 0.0000 4800 3600 900 900 4800 3600 5700 3600
+2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
+	 3600 2400 6000 2400 6000 4800 3600 4800 3600 2400

Added: developers/werner/fped/icons/frame.fig
===================================================================
--- developers/werner/fped/icons/frame.fig	                        (rev 0)
+++ developers/werner/fped/icons/frame.fig	2009-08-01 20:13:04 UTC (rev 5363)
@@ -0,0 +1,14 @@
+#FIG 3.2  Produced by xfig version 3.2.5a
+Landscape
+Center
+Inches
+A4      
+100.00
+Single
+-2
+1200 2
+2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
+	 3600 2400 6000 2400 6000 4800 3600 4800 3600 2400
+2 1 0 10 12 7 50 -1 -1 0.000 0 0 -1 0 0 3
+	 3900 4275 3900 3675 5700 3675
+4 0 12 50 -1 22 42 0.0000 4 135 450 3750 3525 FRAME\001

Added: developers/werner/fped/icons/line.fig
===================================================================
--- developers/werner/fped/icons/line.fig	                        (rev 0)
+++ developers/werner/fped/icons/line.fig	2009-08-01 20:13:04 UTC (rev 5363)
@@ -0,0 +1,13 @@
+#FIG 3.2  Produced by xfig version 3.2.5a
+Landscape
+Center
+Inches
+A4      
+100.00
+Single
+-2
+1200 2
+2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
+	 3600 2400 6000 2400 6000 4800 3600 4800 3600 2400
+2 1 0 10 3 7 50 -1 -1 0.000 0 0 -1 0 0 2
+	 3900 4200 5700 3000

Added: developers/werner/fped/icons/meas.fig
===================================================================
--- developers/werner/fped/icons/meas.fig	                        (rev 0)
+++ developers/werner/fped/icons/meas.fig	2009-08-01 20:13:04 UTC (rev 5363)
@@ -0,0 +1,19 @@
+#FIG 3.2  Produced by xfig version 3.2.5a
+Landscape
+Center
+Inches
+A4      
+100.00
+Single
+-2
+1200 2
+2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
+	 3600 2400 6000 2400 6000 4800 3600 4800 3600 2400
+2 1 0 10 21 7 50 -1 -1 0.000 0 0 -1 0 0 2
+	 3900 3300 3900 3900
+2 1 0 10 21 7 50 -1 -1 0.000 0 0 -1 0 0 2
+	 5700 3300 5700 3900
+2 1 0 10 21 7 50 -1 -1 0.000 0 0 -1 1 1 2
+	0 0 10.00 450.00 450.00
+	0 0 10.00 450.00 450.00
+	 3900 3600 5700 3600

Added: developers/werner/fped/icons/pad.fig
===================================================================
--- developers/werner/fped/icons/pad.fig	                        (rev 0)
+++ developers/werner/fped/icons/pad.fig	2009-08-01 20:13:04 UTC (rev 5363)
@@ -0,0 +1,15 @@
+#FIG 3.2  Produced by xfig version 3.2.5a
+Landscape
+Center
+Inches
+A4      
+100.00
+Single
+-2
+1200 2
+2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
+	 3600 2400 6000 2400 6000 4800 3600 4800 3600 2400
+2 2 0 0 0 4 50 -1 20 0.000 0 0 -1 0 0 5
+	 4200 2700 5400 2700 5400 4500 4200 4500 4200 2700
+2 1 0 15 7 7 45 -1 -1 0.000 1 1 -1 0 0 3
+	 4875 4050 4875 3150 4650 3375

Added: developers/werner/fped/icons/point.fig
===================================================================
--- developers/werner/fped/icons/point.fig	                        (rev 0)
+++ developers/werner/fped/icons/point.fig	2009-08-01 20:13:04 UTC (rev 5363)
@@ -0,0 +1,14 @@
+#FIG 3.2  Produced by xfig version 3.2.5a
+Landscape
+Center
+Inches
+A4      
+100.00
+Single
+-2
+1200 2
+2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
+	 3600 2400 6000 2400 6000 4800 3600 4800 3600 2400
+2 3 0 0 0 7 50 -1 10 0.000 0 0 -1 0 0 8
+	 3900 4350 4050 4500 5250 3300 5325 3675 5700 2700 4725 3075
+	 5100 3150 3900 4350

Added: developers/werner/fped/icons/rect.fig
===================================================================
--- developers/werner/fped/icons/rect.fig	                        (rev 0)
+++ developers/werner/fped/icons/rect.fig	2009-08-01 20:13:04 UTC (rev 5363)
@@ -0,0 +1,13 @@
+#FIG 3.2  Produced by xfig version 3.2.5a
+Landscape
+Center
+Inches
+A4      
+100.00
+Single
+-2
+1200 2
+2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
+	 3600 2400 6000 2400 6000 4800 3600 4800 3600 2400
+2 2 0 10 3 7 50 -1 -1 0.000 0 0 -1 0 0 5
+	 3900 3000 5700 3000 5700 4200 3900 4200 3900 3000

Added: developers/werner/fped/icons/template.fig
===================================================================
--- developers/werner/fped/icons/template.fig	                        (rev 0)
+++ developers/werner/fped/icons/template.fig	2009-08-01 20:13:04 UTC (rev 5363)
@@ -0,0 +1,11 @@
+#FIG 3.2  Produced by xfig version 3.2.5a
+Landscape
+Center
+Inches
+A4      
+100.00
+Single
+-2
+1200 2
+2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
+	 3600 2400 6000 2400 6000 4800 3600 4800 3600 2400

Added: developers/werner/fped/icons/vec.fig
===================================================================
--- developers/werner/fped/icons/vec.fig	                        (rev 0)
+++ developers/werner/fped/icons/vec.fig	2009-08-01 20:13:04 UTC (rev 5363)
@@ -0,0 +1,17 @@
+#FIG 3.2  Produced by xfig version 3.2.5a
+Landscape
+Center
+Inches
+A4      
+100.00
+Single
+-2
+1200 2
+0 32 #c0c000
+2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
+	 3600 2400 6000 2400 6000 4800 3600 4800 3600 2400
+2 1 0 10 32 7 50 -1 -1 0.000 0 0 -1 1 0 2
+	1 1 10.00 300.00 300.00
+	 3900 4275 5700 3075
+2 1 0 10 32 7 50 -1 -1 0.000 1 1 -1 0 0 3
+	 4050 3150 4575 3525 4425 2925




More information about the commitlog mailing list