Changeset 5345


Ignore:
Timestamp:
07/31/09 03:33:56 (4 years ago)
Author:
werner
Message:
  • name of anonymous vectors wasn't initialized
  • made active vectors a little brighter to better tell them apart from inactive ones
  • frames are now (again) ordered from root down
  • added new item .circ to avoid crazy .arc syntax
Location:
developers/werner/fped
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • developers/werner/fped/README

    r5344 r5345  
    8787A circle is defined by its center and a point on the circle: 
    8888 
    89 .arc <center> <point> 
     89.circ <center> <point> 
    9090 
    9191This example draws a unit circle: 
    9292 
    9393.vec @ 1mm, 0mm 
    94 .arc @ . 
     94.circ @ . 
    9595 
    9696An arc is like a circle, but the part of the circle drawn is determined 
     
    9999from the center is ignored. 
    100100 
    101 .arc <center> <radius>, <end> 
    102  
    103 Note the comma between the radius and the end angle. The arc is drawn 
    104 in a counter-clockwise direction. The following example draws an arc 
    105 of the unit circle in the x > 0, y > 0 quadrant: 
     101.arc <center> <radius> <end> 
     102 
     103The arc is drawn in a counter-clockwise direction. The following example 
     104draws an arc of the unit circle in the x > 0, y > 0 quadrant: 
    106105 
    107106from = .vec @ 1mm, 0mm 
    108107to = .vec @ 0mm, 1mm 
    109 .arc @ from, to 
     108.arc @ from to 
    110109 
    111110 
     
    226225x = 1, 3 
    227226.vec @ x*1mm, 0mm 
    228 .arc @ . 
     227.circ @ . 
    229228 
    230229 
     
    251250    { 3mm } 
    252251.vec @ x, 0mm 
    253 .arc @ . 
     252.circ @ . 
    254253 
    255254Note that we can set the unit of the values directly in this case. 
  • developers/werner/fped/TODO

    r5344 r5345  
    1818- syntax seems a little cryptic. too many dots and at signs. 
    1919- add measurements 
    20 - arc syntax is weird, with comma where we use spaces 
    2120- Q: allow reassignment of vector names ? (no: would cause confusion in GUI) 
    2221- add KiCad output 
  • developers/werner/fped/fpd.l

    r5335 r5345  
    3838".rect"                         return TOK_RECT; 
    3939".line"                         return TOK_LINE; 
     40".circ"                         return TOK_CIRC; 
    4041".arc"                          return TOK_ARC; 
    4142 
  • developers/werner/fped/fpd.y

    r5341 r5345  
    2222 
    2323static struct frame *curr_frame; 
    24 static struct frame **next_frame; 
     24static struct frame *last_frame = NULL; 
    2525static struct table **next_table; 
    2626static struct loop **next_loop; 
     
    123123 
    124124 
    125 %token          TOK_FRAME TOK_TABLE TOK_VEC TOK_PAD TOK_RECT TOK_LINE TOK_ARC 
     125%token          TOK_FRAME TOK_TABLE TOK_VEC 
     126%token          TOK_PAD TOK_RECT TOK_LINE TOK_CIRC TOK_ARC 
    126127 
    127128%token  <num>   NUMBER 
     
    142143all: 
    143144                { 
    144                         frames = zalloc_type(struct frame); 
    145                         next_frame = &frames->next; 
    146                         set_frame(frames); 
     145                        root_frame = zalloc_type(struct frame); 
     146                        set_frame(root_frame); 
    147147                } 
    148148        frame_defs frame_items 
     149                { 
     150                        root_frame->prev = last_frame; 
     151                        if (last_frame) 
     152                                last_frame->next = root_frame; 
     153                        else 
     154                                frames = root_frame; 
     155                } 
    149156        ; 
    150157 
     
    158165                        if (find_frame($2)) 
    159166                                yyerrorf("duplicate frame \"%s\"", $2); 
    160                         *next_frame = zalloc_type(struct frame); 
    161                         (*next_frame)->name = $2; 
    162                         set_frame(*next_frame); 
    163                         next_frame = &(*next_frame)->next; 
     167                        curr_frame = zalloc_type(struct frame); 
     168                        curr_frame->name = $2; 
     169                        set_frame(curr_frame); 
     170                        curr_frame->prev = last_frame; 
     171                        if (last_frame) 
     172                                last_frame->next = curr_frame; 
     173                        else 
     174                                frames = curr_frame; 
     175                        last_frame = curr_frame; 
    164176 
    165177                } 
    166178            frame_items '}' 
    167179                { 
    168                         set_frame(frames); 
     180                        set_frame(root_frame); 
    169181                } 
    170182        ; 
     
    302314                { 
    303315                        $$ = alloc_type(struct vec); 
     316                        $$->name = NULL; 
    304317                        $$->base = $2; 
    305318                        if ($2) 
     
    354367                        $$->u.line.other = $3; 
    355368                } 
    356         | TOK_ARC base base opt_base 
     369        | TOK_CIRC base base 
    357370                { 
    358371                        $$ = new_obj(ot_arc); 
    359372                        $$->base = $2; 
    360373                        $$->u.arc.start = $3; 
    361                         $$->u.arc.end = $4 ? $4 : $3; 
     374                        $$->u.arc.end = $3; 
     375                } 
     376        | TOK_ARC base base base 
     377                { 
     378                        $$ = new_obj(ot_arc); 
     379                        $$->base = $2; 
     380                        $$->u.arc.start = $3; 
     381                        $$->u.arc.end = $4; 
    362382                } 
    363383        | TOK_FRAME ID base 
  • developers/werner/fped/gui.c

    r5343 r5345  
    221221        GtkWidget *label; 
    222222 
    223         for (f = frames; f; f = f->next) { 
     223        for (f = root_frame; f; f = f->prev) { 
    224224                label = label_in_box_new(f->name ? f->name : "(root)"); 
    225225                gtk_box_pack_start(GTK_BOX(vbox), box_of_label(label), 
     
    322322 
    323323        make_screen(root); 
    324         build_vars(vars_box, frames); 
     324        build_vars(vars_box, root_frame); 
    325325 
    326326        gtk_widget_show_all(root); 
     
    328328        gui_setup_style(root->window); 
    329329        init_canvas(); 
    330         select_frame(frames); 
     330        select_frame(root_frame); 
    331331 
    332332        gtk_main(); 
  • developers/werner/fped/gui_style.c

    r5342 r5345  
    5252        gc_bg = gc("#000000", 0); 
    5353        /*              inactive   in+path    active     act+path   selected */ 
    54         style(gc_vec,   "#202000", "#404020", "#808040", "#c0c080", "#ffff80"); 
     54        style(gc_vec,   "#202000", "#404020", "#909040", "#c0c080", "#ffff80"); 
    5555        style(gc_obj,   "#006060", INVALID,   "#00ffff", INVALID,   "#ffff80"); 
    5656        style(gc_pad,   "#400000", INVALID,   "#ff0000", INVALID,   "#ffff80"); 
  • developers/werner/fped/obj.c

    r5343 r5345  
    2626 
    2727struct frame *frames = NULL; 
     28struct frame *root_frame = NULL; 
    2829struct frame *active_frame = NULL; 
    2930 
     
    278279 
    279280        inst_start(); 
    280         ok = generate_frame(frames, zero, NULL, 1); 
     281        ok = generate_frame(root_frame, zero, NULL, 1); 
    281282        if (ok) 
    282283                inst_commit(); 
  • developers/werner/fped/obj.h

    r5343 r5345  
    8080        struct obj *objs; 
    8181        struct frame *next; 
     82        struct frame *prev; /* for the list of frames in the GUI */ 
    8283 
    8384        /* used during generation */ 
     
    124125 
    125126 
    126 struct frame *frames; 
    127 struct frame *active_frame; 
     127extern struct frame *frames; 
     128extern struct frame *root_frame; 
     129extern struct frame *active_frame; 
    128130 
    129131 
  • developers/werner/fped/qfn.fpd

    r5341 r5345  
    5252r = .vec c 0mm, 0.5mm 
    5353e = .vec c -0.5mm, 0mm 
    54 .arc c r, e 
     54.arc c r e 
    5555 
    5656r2 = .vec c 0mm, 0.8mm 
    57 .arc c r2 
     57.circ c r2 
    5858 
    5959/* 
Note: See TracChangeset for help on using the changeset viewer.