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. r5398 - trunk/eda/fped (wer...@docs.openmoko.org)
   2. r5399 - trunk/eda/fped (wer...@docs.openmoko.org)
--- Begin Message ---
Author: werner
Date: 2009-08-07 02:48:06 +0200 (Fri, 07 Aug 2009)
New Revision: 5398

Modified:
   trunk/eda/fped/TODO
   trunk/eda/fped/delete.c
   trunk/eda/fped/fpd.y
   trunk/eda/fped/fped.c
   trunk/eda/fped/gui.c
   trunk/eda/fped/gui_status.c
   trunk/eda/fped/gui_status.h
   trunk/eda/fped/gui_tools.c
   trunk/eda/fped/inst.c
Log:
Finished deletion. Assorted bug fixes.

- columns can now be deleted/undeleted
- reset active row if deleting that row
- grammar now accepts an empty file
- when a non-canvas entry becomes editable, we set the focus to it
- when adding the first reference to a frame, make it active
- when deleting the active reference to a frame, set the pointer to NULL
- measurements didn't have a drag_new action, causing trying to create them to
  crash fped
- offset field of measurements was incorrectly labeled "width"
- fixed operator precedence in gridify. Someone needs more sleep :-(



Modified: trunk/eda/fped/TODO
===================================================================
--- trunk/eda/fped/TODO 2009-08-06 21:57:18 UTC (rev 5397)
+++ trunk/eda/fped/TODO 2009-08-07 00:48:06 UTC (rev 5398)
@@ -1,6 +1,5 @@
 Missing features:
 - populate input area (still needed: mm/mil, rezoom)
-- add table/var/loop editor (missing: add col/row, add/del var/table/loop)
 - add default unit (combine with grid unit selection ?)
 - consider adding auto/mm/mil selection for each dimension
 - add measurements (partly done. still needed: find out how to define
@@ -8,6 +7,10 @@
 - add KiCad output
 - add postscript output
 - add option to include/omit helper vecs and frames (display and postscript)
+- reorder frames (can use text editor)
+- reorder rows in a table (can use text editor)
+- reorder columns in a table
+- reorder variables in a frame (can use text editor)
 
 Error detection:
 - eliminate duplicate instances
@@ -16,10 +19,12 @@
 - make column of entry field greedily consume all unallocated space
 - status area looks awful
 - add button with GTK_STOCK_UNDELETE for "undelete" to menu bar
+- edit names/values/etc. in place if possible
 
 Bugs:
 - default silk width has no business being hard-coded in obj.c
 - undelete only works if not much has changed since the deletion
+- re-center while dragging confuses the save-under mechanism
 
 Code cleanup:
 - merge edit_unique with edit_name

Modified: trunk/eda/fped/delete.c
===================================================================
--- trunk/eda/fped/delete.c     2009-08-06 21:57:18 UTC (rev 5397)
+++ trunk/eda/fped/delete.c     2009-08-07 00:48:06 UTC (rev 5398)
@@ -52,7 +52,7 @@
                        struct row *ref;
                        struct row *prev;
                } row;
-               struct {
+               struct column {
                        struct var *var;
                        struct value *values;
                        struct table *table;
@@ -187,7 +187,8 @@
 {
        switch (obj->type) {
        case ot_frame:
-               /* nothing */
+               if (obj->u.frame.ref->active_ref == obj)
+                       obj->u.frame.ref->active_ref = NULL;
                break;
        case ot_pad:
                free(obj->u.pad.name);
@@ -288,10 +289,65 @@
 
 void delete_column(struct table *table, int n)
 {
+       struct deletion *del;
+       struct column *col;
+       struct var **var;
+       struct row *row;
+       struct value **next, **value;
+       int i;
+
        groups++;
+
+       del = new_deletion(dt_column);
+       col = &del->u.col;
+       col->table = table;
+       col->n = n;
+
+       var = &table->vars;
+       for (i = 0; i != n; i++)
+               var = &(*var)->next;
+       col->var = *var;
+       *var = (*var)->next;
+
+       next = &col->values;
+       for (row = table->rows; row; row = row->next) {
+               value = &row->values;
+               for (i = 0; i != n; i++)
+                       value = &(*value)->next;
+               *next = *value;
+               *value = (*value)->next;
+               next = &(*next)->next;
+       }
+       *next = NULL;
 }
 
 
+static void undelete_column(const struct column *col)
+{
+       struct var **var;
+       struct row *row;
+       struct value **anchor, *value, *next;
+       int i;
+
+       var = &col->table->vars;
+       for (i = 0; i != col->n; i++)
+               var = &(*var)->next;
+       col->var->next = *var;
+       *var = col->var;
+
+       value = col->values;
+       for (row = col->table->rows; row; row = row->next) {
+               anchor = &row->values;
+               for (i = 0; i != col->n; i++)
+                       anchor = &(*anchor)->next;
+               next = value->next;
+               value->next = *anchor;
+               *anchor = value;
+               value = next;
+       }
+}
+
+
 /* ----- tables ------------------------------------------------------------ */
 
 
@@ -471,6 +527,9 @@
        case dt_row:
                undelete_row(del->u.row.ref, del->u.row.prev);
                break;
+       case dt_column:
+               undelete_column(&del->u.col);
+               break;
        default:
                abort();
        }

Modified: trunk/eda/fped/fpd.y
===================================================================
--- trunk/eda/fped/fpd.y        2009-08-06 21:57:18 UTC (rev 5397)
+++ trunk/eda/fped/fpd.y        2009-08-07 00:48:06 UTC (rev 5398)
@@ -162,19 +162,13 @@
 %%
 
 all:
-       START_FPD fpd
-       | START_EXPR expr
+       START_FPD
                {
-                       expr_result = $2;
-               }
-       ;
-
-fpd:
-               {
                        root_frame = zalloc_type(struct frame);
                        set_frame(root_frame);
                }
-       frame_defs part_name frame_items
+
+           fpd
                {
                        root_frame->prev = last_frame;
                        if (last_frame)
@@ -182,8 +176,16 @@
                        else
                                frames = root_frame;
                }
+       | START_EXPR expr
+               {
+                       expr_result = $2;
+               }
        ;
 
+fpd:
+       | frame_defs part_name frame_items
+       ;
+
 part_name:
        TOK_PART STRING
                {

Modified: trunk/eda/fped/fped.c
===================================================================
--- trunk/eda/fped/fped.c       2009-08-06 21:57:18 UTC (rev 5397)
+++ trunk/eda/fped/fped.c       2009-08-07 00:48:06 UTC (rev 5398)
@@ -13,6 +13,7 @@
 
 
 #include "cpp.h"
+#include "util.h"
 #include "error.h"
 #include "obj.h"
 #include "inst.h"
@@ -46,6 +47,10 @@
                argc--;
                argv++;
        }
+
+       if (!part_name)
+               part_name = stralloc("_");
+
        reporter = report_to_stderr;
        if (!instantiate())
                return 1;

Modified: trunk/eda/fped/gui.c
===================================================================
--- trunk/eda/fped/gui.c        2009-08-06 21:57:18 UTC (rev 5397)
+++ trunk/eda/fped/gui.c        2009-08-07 00:48:06 UTC (rev 5398)
@@ -329,8 +329,11 @@
 static void popup_del_row(void)
 {
        struct value *value = popup_data;
+       struct table *table = value->row->table;
 
        delete_row(value->row);
+       if (table->active_row == value->row)
+               table->active_row = table->rows;
        change_world();
 }
 
@@ -341,7 +344,8 @@
        const struct value *walk;
        int n = 0;
 
-       for (walk = value->row->values; walk != value; walk = walk->next);
+       for (walk = value->row->values; walk != value; walk = walk->next)
+               n++;
        delete_column(value->row->table, n);
        change_world();
 }
@@ -530,7 +534,7 @@
        label_in_box_bg(var->widget, COLOR_VAR_EDITING);
        status_set_type_entry("name =");
        status_set_name("%s", var->name);
-       edit_unique(&var->name, validate_var_name, var);
+       edit_unique(&var->name, validate_var_name, var, 1);
 }
 
 
@@ -551,7 +555,7 @@
 {
        inst_select_outside(value, unselect_value);
        label_in_box_bg(value->widget, COLOR_EXPR_EDITING);
-       edit_expr(&value->expr);
+       edit_expr(&value->expr, 1);
 }
 
 
@@ -954,7 +958,7 @@
                label_in_box_bg(widget, COLOR_PART_NAME_EDITING);
                status_set_type_entry("part =");
                status_set_name("%s", part_name);
-               edit_name(&part_name, validate_part_name, NULL);
+               edit_name(&part_name, validate_part_name, NULL, 1);
                break;
        }
        return TRUE;
@@ -1015,7 +1019,7 @@
        label_in_box_bg(frame->label, COLOR_FRAME_EDITING);
        status_set_type_entry("name =");
        status_set_name("%s", frame->name);
-       edit_unique(&frame->name, validate_frame_name, frame);
+       edit_unique(&frame->name, validate_frame_name, frame, 1);
 }
 
 

Modified: trunk/eda/fped/gui_status.c
===================================================================
--- trunk/eda/fped/gui_status.c 2009-08-06 21:57:18 UTC (rev 5397)
+++ trunk/eda/fped/gui_status.c 2009-08-07 00:48:06 UTC (rev 5398)
@@ -110,10 +110,12 @@
 
 
 static void setup_edit(GtkWidget *widget, const char *s,
-    struct edit_ops *ops, void *ctx)
+    struct edit_ops *ops, void *ctx, int focus)
 {
        gtk_entry_set_text(GTK_ENTRY(widget), s);
        entry_color(widget, COLOR_EDIT_ASIS);
+       if (focus)
+               gtk_widget_grab_focus(GTK_WIDGET(widget));
        gtk_widget_show(widget);
        gtk_object_set_data(GTK_OBJECT(widget), "edit-ops", ops);
        gtk_object_set_data(GTK_OBJECT(widget), "edit-ctx", ctx);
@@ -165,14 +167,14 @@
 
 
 void edit_unique(const char **s, int (*validate)(const char *s, void *ctx), 
-    void *ctx)
+    void *ctx, int focus)
 {
        static struct edit_unique_ctx unique_ctx;
 
        unique_ctx.s = s;
        unique_ctx.validate = validate;
        unique_ctx.ctx = ctx;
-       setup_edit(status_entry, *s, &edit_ops_unique, &unique_ctx);
+       setup_edit(status_entry, *s, &edit_ops_unique, &unique_ctx, focus);
 }
 
 
@@ -221,7 +223,7 @@
 
 
 void edit_unique_null(const char **s,
-    int (*validate)(const char *s, void *ctx), void *ctx)
+    int (*validate)(const char *s, void *ctx), void *ctx, int focus)
 {
        static struct edit_unique_ctx unique_ctx;
 
@@ -229,7 +231,7 @@
        unique_ctx.validate = validate;
        unique_ctx.ctx = ctx;
        setup_edit(status_entry, *s ? *s : "",
-           &edit_ops_null_unique, &unique_ctx);
+           &edit_ops_null_unique, &unique_ctx, focus);
 }
 
 
@@ -277,14 +279,15 @@
 };
 
 
-void edit_name(char **s, int (*validate)(const char *s, void *ctx), void *ctx)
+void edit_name(char **s, int (*validate)(const char *s, void *ctx), void *ctx,
+    int focus)
 {
        static struct edit_name_ctx name_ctx;
 
        name_ctx.s = s;
        name_ctx.validate = validate;
        name_ctx.ctx = ctx;
-       setup_edit(status_entry, *s, &edit_ops_name, &name_ctx);
+       setup_edit(status_entry, *s, &edit_ops_name, &name_ctx, focus);
 }
 
 
@@ -335,31 +338,31 @@
 };
 
 
-static void edit_any_expr(GtkWidget *widget, struct expr **expr)
+static void edit_any_expr(GtkWidget *widget, struct expr **expr, int focus)
 {
        char *s;
 
        s = unparse(*expr);
-       setup_edit(widget, s, &edit_ops_expr, expr);
+       setup_edit(widget, s, &edit_ops_expr, expr, focus);
        free(s);
 }
 
 
-void edit_expr(struct expr **expr)
+void edit_expr(struct expr **expr, int focus)
 {
-       edit_any_expr(status_entry, expr);
+       edit_any_expr(status_entry, expr, focus);
 }
 
 
 void edit_x(struct expr **expr)
 {
-       edit_any_expr(status_entry_x, expr);
+       edit_any_expr(status_entry_x, expr, 0);
 }
 
 
 void edit_y(struct expr **expr)
 {
-       edit_any_expr(status_entry_y, expr);
+       edit_any_expr(status_entry_y, expr, 0);
 }
 
 

Modified: trunk/eda/fped/gui_status.h
===================================================================
--- trunk/eda/fped/gui_status.h 2009-08-06 21:57:18 UTC (rev 5397)
+++ trunk/eda/fped/gui_status.h 2009-08-07 00:48:06 UTC (rev 5398)
@@ -21,11 +21,12 @@
 
 
 void edit_unique(const char **s, int (*validate)(const char *s, void *ctx),
-    void *ctx);
+    void *ctx, int focus);
 void edit_unique_null(const char **s, int (*validate)(const char *s, void 
*ctx),
-    void *ctx);
-void edit_name(char **s, int (*validate)(const char *s, void *ctx), void *ctx);
-void edit_expr(struct expr **expr);
+    void *ctx, int focus);
+void edit_name(char **s, int (*validate)(const char *s, void *ctx), void *ctx,
+    int focus);
+void edit_expr(struct expr **expr, int focus);
 void edit_x(struct expr **expr);
 void edit_y(struct expr **expr);
 void edit_nothing(void);

Modified: trunk/eda/fped/gui_tools.c
===================================================================
--- trunk/eda/fped/gui_tools.c  2009-08-06 21:57:18 UTC (rev 5397)
+++ trunk/eda/fped/gui_tools.c  2009-08-07 00:48:06 UTC (rev 5398)
@@ -168,8 +168,8 @@
        struct coord new;
        unit_type unit = mm_to_units(0.1);
 
-       new.x = pos.x-(pos.x-base.x % unit);
-       new.y = pos.y-(pos.y-base.y % unit);
+       new.x = pos.x-((pos.x-base.x) % unit);
+       new.y = pos.y-((pos.y-base.y) % unit);
        if (new.x != base.x || new.y != base.y)
                return new;
        if (fabs(pos.x-base.x) > fabs(pos.y-base.y))
@@ -494,7 +494,7 @@
 
 
 static struct tool_ops meas_ops = {
-       .drag_new       = NULL,
+       .drag_new       = drag_new_line,
        .end_new        = end_new_meas,
 };
 
@@ -588,6 +588,8 @@
        obj = new_obj(ot_frame, from);
        obj->u.frame.ref = locked_frame;
        obj->u.frame.lineno = 0;
+       if (!locked_frame->active_ref)
+               locked_frame->active_ref = obj;
        locked_frame = NULL;
        tool_frame_update();
        return 1;

Modified: trunk/eda/fped/inst.c
===================================================================
--- trunk/eda/fped/inst.c       2009-08-06 21:57:18 UTC (rev 5397)
+++ trunk/eda/fped/inst.c       2009-08-07 00:48:06 UTC (rev 5398)
@@ -353,7 +353,7 @@
        status_set_type_entry("ref =");
        status_set_name("%s", self->vec->name ? self->vec->name : "");
        rect_status(self->base, self->u.rect.end, -1);
-       edit_unique_null(&self->vec->name, validate_vec_name, self->vec);
+       edit_unique_null(&self->vec->name, validate_vec_name, self->vec, 0);
        edit_x(&self->vec->x);
        edit_y(&self->vec->y);
 }
@@ -404,7 +404,7 @@
 static void line_op_select(struct inst *self)
 {
        rect_status(self->bbox.min, self->bbox.max, self->u.rect.width);
-       edit_expr(&self->obj->u.line.width);
+       edit_expr(&self->obj->u.line.width, 0);
 }
 
 
@@ -457,7 +457,7 @@
 static void rect_op_select(struct inst *self)
 {
        rect_status(self->bbox.min, self->bbox.max, self->u.rect.width);
-       edit_expr(&self->obj->u.rect.width);
+       edit_expr(&self->obj->u.rect.width, 0);
 }
 
 
@@ -514,7 +514,7 @@
        status_set_type_entry("label =");
        status_set_name("%s", self->u.pad.name);
        rect_status(self->base, self->u.pad.other, -1);
-       edit_name(&self->obj->u.pad.name, validate_pad_name, NULL);
+       edit_name(&self->obj->u.pad.name, validate_pad_name, NULL, 0);
 }
 
 
@@ -572,7 +572,7 @@
        status_set_r("r = %5.2f mm", units_to_mm(self->u.arc.r));
        status_set_type_entry("width =");
        status_set_name("%5.2f mm", units_to_mm(self->u.arc.width));
-       edit_expr(&self->obj->u.arc.width);
+       edit_expr(&self->obj->u.arc.width, 0);
 }
 
 
@@ -638,9 +638,9 @@
 static void meas_op_select(struct inst *self)
 {
        rect_status(self->bbox.min, self->bbox.max, -1);
-       status_set_type_entry("width =");
+       status_set_type_entry("offset =");
        status_set_name("%5.2f mm", units_to_mm(self->u.meas.offset));
-       edit_expr(&self->obj->u.meas.offset);
+       edit_expr(&self->obj->u.meas.offset, 0);
 }
 
 




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2009-08-07 04:23:04 +0200 (Fri, 07 Aug 2009)
New Revision: 5399

Added:
   trunk/eda/fped/sc89.fpd
Log:
Experimental SC-89 footprint.



Added: trunk/eda/fped/sc89.fpd
===================================================================
--- trunk/eda/fped/sc89.fpd                             (rev 0)
+++ trunk/eda/fped/sc89.fpd     2009-08-07 02:23:04 UTC (rev 5399)
@@ -0,0 +1,43 @@
+/* MACHINE-GENERATED ! */
+
+frame pad {
+       _pad_0: vec @(-Px/2, -Py/2)
+       _pad_1: vec .(Px, 0mm)
+       _pad_2: vec _pad_0(0mm, Py)
+       pad "$pad" _pad_1 _pad_2
+       meas _pad_0 _pad_1 -0.1mm
+       meas _pad_0 _pad_2 0.1mm
+}
+
+frame pad_ne {
+       set pad = 2
+
+       _pad_ne_0: vec @(-Px/2, -Py/2)
+       frame pad _pad_ne_0
+}
+
+frame pad_nw {
+       set pad = 1
+
+       _pad_nw_0: vec @(Px/2, -Py/2)
+       frame pad _pad_nw_0
+}
+
+frame pad_sc {
+       set pad = 3
+
+       _pad_sc_0: vec @(0mm, Py/2)
+       frame pad _pad_sc_0
+}
+
+part "SC_89"
+table
+    { Gx, Gy, Px, Py }
+    { 1.5mm, 0.7mm, 0.5mm, 0.6mm }
+
+__0: vec @(0mm, Gy/2)
+__1: vec @(-Gx/2, -Gy/2)
+__2: vec @(Gx/2, -Gy/2)
+frame pad_sc __0
+frame pad_nw __1
+frame pad_ne __2




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

Reply via email to