Send commitlog mailing list submissions to
        commitlog@lists.openmoko.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        commitlog-requ...@lists.openmoko.org

You can reach the person managing the list at
        commitlog-ow...@lists.openmoko.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r5848 - trunk/eda/fped (wer...@docs.openmoko.org)
   2. r5849 - trunk/eda/fped (wer...@docs.openmoko.org)
   3. r5850 - trunk/eda/fped (wer...@docs.openmoko.org)
--- Begin Message ---
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 --------------------------------------------------- */




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2010-02-19 23:27:25 +0100 (Fri, 19 Feb 2010)
New Revision: 5849

Modified:
   trunk/eda/fped/file.c
   trunk/eda/fped/file.h
   trunk/eda/fped/fped.c
   trunk/eda/fped/postscript.c
   trunk/eda/fped/postscript.h
Log:
New option -P for batch output for full-page postscript.

- fped.c (main, usage): new option -P to output full-page Postscript
- postscript.c (postscript): renamed full-page output to postscript_page,
  uncommented it, and added auto-zoom
- file.c, file.h (write_ps_fullpage): handler for full-page postscript
- fped.c (usage): clarified that -k and -p/-P don/t exclude each other



Modified: trunk/eda/fped/file.c
===================================================================
--- trunk/eda/fped/file.c       2010-02-19 14:00:55 UTC (rev 5848)
+++ trunk/eda/fped/file.c       2010-02-19 22:27:25 UTC (rev 5849)
@@ -1,8 +1,8 @@
 /*
  * file.c - File handling
  *
- * Written 2009 by Werner Almesberger
- * Copyright 2009 by Werner Almesberger
+ * Written 2009, 2010 by Werner Almesberger
+ * Copyright 2009, 2010 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
@@ -172,16 +172,28 @@
 }
 
 
-void write_ps(void)
+static void do_write_ps(int (*fn)(FILE *file))
 {
        char *name;
 
        if (save_file_name) {
                name = set_extension(save_file_name, "ps");
-               save_to(name, postscript);
+               save_to(name, fn);
                free(name);
        } else {
-               if (!postscript(stdout))
+               if (!fn(stdout))
                        perror("stdout");
        }
 }
+
+
+void write_ps(void)
+{
+       do_write_ps(postscript);
+}
+
+
+void write_ps_fullpage(void)
+{
+       do_write_ps(postscript_fullpage);
+}

Modified: trunk/eda/fped/file.h
===================================================================
--- trunk/eda/fped/file.h       2010-02-19 14:00:55 UTC (rev 5848)
+++ trunk/eda/fped/file.h       2010-02-19 22:27:25 UTC (rev 5849)
@@ -1,8 +1,8 @@
 /*
  * file.h - File handling
  *
- * Written 2009 by Werner Almesberger
- * Copyright 2009 by Werner Almesberger
+ * Written 2009, 2010 by Werner Almesberger
+ * Copyright 2009, 2010 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
@@ -29,5 +29,6 @@
 void save_fpd(void);
 void write_kicad(void);
 void write_ps(void);
+void write_ps_fullpage(void);
 
 #endif /* !FILE_H */

Modified: trunk/eda/fped/fped.c
===================================================================
--- trunk/eda/fped/fped.c       2010-02-19 14:00:55 UTC (rev 5848)
+++ trunk/eda/fped/fped.c       2010-02-19 22:27:25 UTC (rev 5849)
@@ -1,8 +1,8 @@
 /*
  * fped.c - Footprint editor, main function
  *
- * Written 2009 by Werner Almesberger
- * Copyright 2009 by Werner Almesberger
+ * Written 2009, 2010 by Werner Almesberger
+ * Copyright 2009, 2010 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
@@ -44,9 +44,10 @@
 static void usage(const char *name)
 {
        fprintf(stderr,
-"usage: %s [-k|-p] [cpp_option ...] [in_file [out_file]]\n\n"
+"usage: %s [-k] [-p|-P] [cpp_option ...] [in_file [out_file]]\n\n"
 "  -k          write KiCad output, then exit\n"
 "  -p          write Postscript output, then exit\n"
+"  -P          write Postscript output (full page), then exit\n"
 "  cpp_option  -Idir, -Dname[=value], or -Uname\n"
     , name);
        exit(1);
@@ -61,10 +62,11 @@
        int fake_argc;
        char opt[] = "-?";
        int error, batch;
-       int batch_write_kicad = 0, batch_write_ps = 0;
+       int batch_write_kicad = 0;
+       int batch_write_ps = 0, batch_write_ps_fullpage = 0;
        int c;
 
-       while ((c = getopt(argc, argv, "kpD:U:I:")) != EOF)
+       while ((c = getopt(argc, argv, "kpD:I:U:P")) != EOF)
                switch (c) {
                case 'k':
                        batch_write_kicad = 1;
@@ -72,6 +74,9 @@
                case 'p':
                        batch_write_ps = 1;
                        break;
+               case 'P':
+                       batch_write_ps_fullpage = 1;
+                       break;
                case 'D':
                case 'U':
                case 'I':
@@ -83,8 +88,11 @@
                        usage(name);
                }
 
-       batch = batch_write_kicad || batch_write_ps;
+       if (batch_write_ps && batch_write_ps_fullpage)
+               usage(name);
 
+       batch = batch_write_kicad || batch_write_ps || batch_write_ps_fullpage;
+
        if (!batch) {
                args[0] = name;
                args[1] = NULL;
@@ -125,6 +133,8 @@
                write_kicad();
        if (batch_write_ps)
                write_ps();
+       if (batch_write_ps_fullpage)
+               write_ps_fullpage();
        if (!batch) {
                error = gui_main();
                if (error)

Modified: trunk/eda/fped/postscript.c
===================================================================
--- trunk/eda/fped/postscript.c 2010-02-19 14:00:55 UTC (rev 5848)
+++ trunk/eda/fped/postscript.c 2010-02-19 22:27:25 UTC (rev 5849)
@@ -1,8 +1,8 @@
 /*
  * postscript.c - Dump objects in Postscript
  *
- * Written 2009 by Werner Almesberger
- * Copyright 2009 by Werner Almesberger
+ * Written 2009, 2010 by Werner Almesberger
+ * Copyright 2009, 2010 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
@@ -1004,7 +1004,6 @@
 }
 
 
-#if 1
 int postscript(FILE *file)
 {
        struct pkg *pkg;
@@ -1023,16 +1022,17 @@
        fflush(file);
        return !ferror(file);
 }
-#else
 
+
 /*
  * Experimental. Doesn't work properly.
  */
-int postscript(FILE *file)
+
+int postscript_fullpage(FILE *file)
 {
        unit_type cx, cy;
        struct bbox bbox;
-       double f = 0.2;
+       double fx, fy, f;
 
        prologue(file, 1);
        ps_page(file, 1, pkgs);
@@ -1040,6 +1040,9 @@
        bbox = inst_get_bbox();
        cx = (bbox.min.x+bbox.max.x)/2;
        cy = (bbox.min.y+bbox.max.y)/2;
+       fx = 2.0*PAGE_HALF_WIDTH/(bbox.max.x-bbox.min.x);
+       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);
        fprintf(file, "showpage\n");
@@ -1047,4 +1050,3 @@
        fflush(file);
        return !ferror(file);
 }
-#endif

Modified: trunk/eda/fped/postscript.h
===================================================================
--- trunk/eda/fped/postscript.h 2010-02-19 14:00:55 UTC (rev 5848)
+++ trunk/eda/fped/postscript.h 2010-02-19 22:27:25 UTC (rev 5849)
@@ -1,8 +1,8 @@
 /*
  * ps.h - Dump objects in Postscript
  *
- * Written 2009 by Werner Almesberger
- * Copyright 2009 by Werner Almesberger
+ * Written 2009, 2010 by Werner Almesberger
+ * Copyright 2009, 2010 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
@@ -27,5 +27,6 @@
 
 
 int postscript(FILE *file);
+int postscript_fullpage(FILE *file);
 
 #endif /* !POSTSCRIPT_H */




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2010-02-20 06:10:24 +0100 (Sat, 20 Feb 2010)
New Revision: 5850

Modified:
   trunk/eda/fped/Makefile
Log:
Generating full dependencies for each and every change slowed down development
quite a bit. We now use per-file granularity for dependencies, reducing the
overhead by about a factor of 30.

- Makefile: generate per-file dependencies (.d) when compiling, based on
  http://scottmcpeak.com/autodepend/autodepend.html
- Makefile: "depend" target is no longer used



Modified: trunk/eda/fped/Makefile
===================================================================
--- trunk/eda/fped/Makefile     2010-02-19 22:27:25 UTC (rev 5849)
+++ trunk/eda/fped/Makefile     2010-02-20 05:10:24 UTC (rev 5850)
@@ -57,15 +57,13 @@
 CC_normal      := $(CC)
 YACC_normal    := $(YACC)
 LEX_normal     := $(LEX)
-DEPEND_normal = \
-  $(CPP) $(CFLAGS) -MM -MG *.c >.depend || \
-  { rm -f .depend; exit 1; }
+DEPEND_normal  := $(CPP) $(CFLAGS) -MM -MG
 
 CC_quiet       = @echo "  CC       " $@ && $(CC_normal)
 YACC_quiet     = @echo "  YACC     " $@ && $(YACC_normal)
 LEX_quiet      = @echo "  LEX      " $@ && $(LEX_normal)
 GEN_quiet      = @echo "  GENERATE " $@ &&
-DEPEND_quiet   = @echo "  DEPENDENCIES" && $(DEPEND_normal)
+DEPEND_quiet   = @$(DEPEND_normal)
 
 ifeq ($(V),1)
     CC         = $(CC_normal)
@@ -88,6 +86,17 @@
 
 .SUFFIXES:     .fig .xpm .ppm
 
+# compile and generate dependencies, based on
+# http://scottmcpeak.com/autodepend/autodepend.html
+
+%.o:           %.c
+               $(CC) -c $(CFLAGS) $*.c -o $*.o
+               $(DEPEND) $(CFLAGS) $*.c | \
+                 sed -e \
+                   '/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/  */:\n/g;H;}' \
+                   -e '$${g;p;}' -e d >$*.d; \
+                 [ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $*.d; exit 1; }
+               
 # generate 26x26 pixels icons, then drop the 1-pixel frame
 
 .fig.ppm:
@@ -142,16 +151,16 @@
 
 # ----- Dependencies ----------------------------------------------------------
 
-dep depend .depend: lex.yy.c y.tab.h y.tab.c *.h *.c
-               $(DEPEND)
+dep depend .depend:
+               @echo 'no need to run "make depend" anymore' 1>&2
 
--include .depend
+-include $(OBJS:.o=.d)
 
 # ----- Cleanup ---------------------------------------------------------------
 
 clean:
                rm -f $(OBJS) $(XPMS:%=icons/%) $(XPMS:%.xpm=icons/%.ppm)
-               rm -f lex.yy.c y.tab.c y.tab.h y.output .depend
+               rm -f lex.yy.c y.tab.c y.tab.h y.output .depend $(OBJS:.o=.d)
                rm -f __dbg????.png _tmp*
 
 # ----- Install / uninstall ---------------------------------------------------




--- End Message ---
_______________________________________________
commitlog mailing list
commitlog@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to