r5851 - trunk/eda/fped

werner at docs.openmoko.org werner at docs.openmoko.org
Tue Feb 23 02:02:20 CET 2010


Author: werner
Date: 2010-02-23 02:02:19 +0100 (Tue, 23 Feb 2010)
New Revision: 5851

Modified:
   trunk/eda/fped/Makefile
   trunk/eda/fped/postscript.c
Log:
Full-page postscript now includes all packages (not just the first one).
Measurement lines now have a fixed size, so they can't scale to invisibility.

- Makefile: don't pass CFLAGS twice when making dependencies
- postscript.c (postscript): moved iteration over packages to new function
  ps_for_all_pkg, for sharing with postscript_fullpage
- postscript.c (postscript_fullpage): print all packages
- postscript.c (ps_meas): use real size for measurement lines
- postscript.c (PS_MEAS_LINE): changed measurement line width from 0.015 scaled
  mm to 0.1 real mm



Modified: trunk/eda/fped/Makefile
===================================================================
--- trunk/eda/fped/Makefile	2010-02-20 05:10:24 UTC (rev 5850)
+++ trunk/eda/fped/Makefile	2010-02-23 01:02:19 UTC (rev 5851)
@@ -91,7 +91,7 @@
 
 %.o:		%.c
 		$(CC) -c $(CFLAGS) $*.c -o $*.o
-		$(DEPEND) $(CFLAGS) $*.c | \
+		$(DEPEND) $*.c | \
 		  sed -e \
 		    '/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/  */:\n/g;H;}' \
 		    -e '$${g;p;}' -e d >$*.d; \

Modified: trunk/eda/fped/postscript.c
===================================================================
--- trunk/eda/fped/postscript.c	2010-02-20 05:10:24 UTC (rev 5850)
+++ trunk/eda/fped/postscript.c	2010-02-23 01:02:19 UTC (rev 5851)
@@ -72,7 +72,7 @@
 #define	PS_VEC_TEXT_HEIGHT	mm_to_units(3)		/* ~8.5 pt, real mm */
 #define	PS_VEC_BASE_OFFSET	mm_to_units(0.5)	/* real mm */
 
-#define	PS_MEAS_LINE		mm_to_units(0.015)
+#define	PS_MEAS_LINE		mm_to_units(0.1)	/* real mm */
 #define	PS_MEAS_ARROW_LEN	mm_to_units(0.15)
 #define	PS_MEAS_ARROW_ANGLE	30
 #define	PS_MEAS_TEXT_HEIGHT	mm_to_units(3)		/* ~8.5 pt, real mm */
@@ -386,7 +386,8 @@
 	a0 = inst->base;
 	b0 = inst->u.meas.end;
 	project_meas(inst, &a1, &b1);
-	fprintf(file, "1 setlinecap 0 setgray %d setlinewidth\n", PS_MEAS_LINE);
+	fprintf(file, "1 setlinecap 0 setgray %d realsize setlinewidth\n",
+	    PS_MEAS_LINE);
 	fprintf(file, "  %d %d moveto\n", a0.x, a0.y);
 	fprintf(file, "  %d %d lineto\n", a1.x, a1.y);
 	fprintf(file, "  %d %d lineto\n", b1.x, b1.y);
@@ -1004,7 +1005,8 @@
 }
 
 
-int postscript(FILE *file)
+static int ps_for_all_pkg(FILE *file,
+    void (*fn)(FILE *file, const struct pkg *pkg, int page))
 {
 	struct pkg *pkg;
 	int pages;
@@ -1016,7 +1018,7 @@
 	pages = 0;
 	for (pkg = pkgs; pkg; pkg = pkg->next)
 		if (pkg->name)
-			ps_package(file, pkg, ++pages);
+			fn(file, pkg, ++pages);
 	epilogue(file);
 
 	fflush(file);
@@ -1024,18 +1026,23 @@
 }
 
 
+int postscript(FILE *file)
+{
+	return ps_for_all_pkg(file, ps_package);
+}
+
+
 /*
  * Experimental. Doesn't work properly.
  */
 
-int postscript_fullpage(FILE *file)
+static void ps_package_fullpage(FILE *file, const struct pkg *pkg, int page)
 {
 	unit_type cx, cy;
 	struct bbox bbox;
 	double fx, fy, f;
 
-	prologue(file, 1);
-	ps_page(file, 1, pkgs);
+	ps_page(file, page, pkg);
 	active_params = postscript_params;
 	bbox = inst_get_bbox();
 	cx = (bbox.min.x+bbox.max.x)/2;
@@ -1044,9 +1051,12 @@
 	fy = 2.0*PAGE_HALF_HEIGHT/(bbox.max.y-bbox.min.y);
 	f = fx < fy ? fx : fy;
 	fprintf(file, "%d %d translate\n", (int) (-cx*f), (int) (-cy*f));
-	ps_draw_package(file, pkgs->next, f);
+	ps_draw_package(file, pkg, f);
 	fprintf(file, "showpage\n");
-	epilogue(file);
-	fflush(file);
-	return !ferror(file);
 }
+
+
+int postscript_fullpage(FILE *file)
+{
+	return ps_for_all_pkg(file, ps_package_fullpage);
+}




More information about the commitlog mailing list