Date:2012-07-19 03:39:50 (7 years 4 months ago)
Author:Werner Almesberger
Commit:b4d61a867efb8edd0c5d2f4ea185f84faecc9491
Message:postscript.c: only show the key for pad types actually used in the package

Files: postscript.c (5 diffs)

Change Details

postscript.c
109109
110110static const struct postscript_params minimal_params;
111111static struct postscript_params active_params;
112static int pad_type_seen[pt_n];
112113
113114
114115/* ----- Boxes ------------------------------------------------------------- */
...... 
265266
266267static void ps_pad(FILE *file, const struct inst *inst, int show_name)
267268{
268    ps_filled_box(file, inst->base, inst->u.pad.other,
269        hatch(layers_to_pad_type(inst->u.pad.layers)));
269    enum pad_type type = layers_to_pad_type(inst->u.pad.layers);
270
271    pad_type_seen[type] = 1;
272    ps_filled_box(file, inst->base, inst->u.pad.other, hatch(type));
270273
271274    if (show_name && !inst->u.pad.hole)
272275        ps_pad_name(file, inst);
...... 
299302
300303static void ps_rpad(FILE *file, const struct inst *inst, int show_name)
301304{
305    enum pad_type type = layers_to_pad_type(inst->u.pad.layers);
306
307    pad_type_seen[type] = 1;
308
302309    fprintf(file, "0 setgray %d setlinewidth\n", PS_HATCH_LINE);
303310    ps_rounded_rect(file, inst->base, inst->u.pad.other);
304    fprintf(file, " closepath gsave %s grestore stroke\n",
305        hatch(layers_to_pad_type(inst->u.pad.layers)));
311    fprintf(file, " closepath gsave %s grestore stroke\n", hatch(type));
306312
307313    if (show_name && !inst->u.pad.hole)
308314        ps_pad_name(file, inst);
...... 
844850    enum pad_type i;
845851
846852    for (i = 0; i != pt_n; i++)
847        ps_key(file, w, h, i);
853        if (pad_type_seen[i])
854            ps_key(file, w, h, i);
848855}
849856
850857
...... 
12091216    }
12101217    fprintf(file, "gsave\n");
12111218    fprintf(file, "%d %d translate\n", (int) (-cx*f), (int) (-cy*f)+yoff);
1219    memset(pad_type_seen, 0, sizeof(pad_type_seen));
12121220    ps_draw_package(file, pkg, f, 0);
12131221    fprintf(file, "grestore\n");
12141222    if (active_params.show_key) {

Archive Download the corresponding diff file

Branches:
master



interactive