1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-11-24 21:53:43 +02:00

postscript.c: only show the key for pad types actually used in the package

This commit is contained in:
Werner Almesberger 2012-07-18 22:39:50 -03:00
parent ed69b7b0e0
commit b4d61a867e

View File

@ -109,6 +109,7 @@ struct postscript_params postscript_params = {
static const struct postscript_params minimal_params; static const struct postscript_params minimal_params;
static struct postscript_params active_params; static struct postscript_params active_params;
static int pad_type_seen[pt_n];
/* ----- Boxes ------------------------------------------------------------- */ /* ----- Boxes ------------------------------------------------------------- */
@ -265,8 +266,10 @@ static const char *hatch(enum pad_type type)
static void ps_pad(FILE *file, const struct inst *inst, int show_name) static void ps_pad(FILE *file, const struct inst *inst, int show_name)
{ {
ps_filled_box(file, inst->base, inst->u.pad.other, enum pad_type type = layers_to_pad_type(inst->u.pad.layers);
hatch(layers_to_pad_type(inst->u.pad.layers)));
pad_type_seen[type] = 1;
ps_filled_box(file, inst->base, inst->u.pad.other, hatch(type));
if (show_name && !inst->u.pad.hole) if (show_name && !inst->u.pad.hole)
ps_pad_name(file, inst); ps_pad_name(file, inst);
@ -299,10 +302,13 @@ static void ps_rounded_rect(FILE *file, struct coord a, struct coord b)
static void ps_rpad(FILE *file, const struct inst *inst, int show_name) static void ps_rpad(FILE *file, const struct inst *inst, int show_name)
{ {
enum pad_type type = layers_to_pad_type(inst->u.pad.layers);
pad_type_seen[type] = 1;
fprintf(file, "0 setgray %d setlinewidth\n", PS_HATCH_LINE); fprintf(file, "0 setgray %d setlinewidth\n", PS_HATCH_LINE);
ps_rounded_rect(file, inst->base, inst->u.pad.other); ps_rounded_rect(file, inst->base, inst->u.pad.other);
fprintf(file, " closepath gsave %s grestore stroke\n", fprintf(file, " closepath gsave %s grestore stroke\n", hatch(type));
hatch(layers_to_pad_type(inst->u.pad.layers)));
if (show_name && !inst->u.pad.hole) if (show_name && !inst->u.pad.hole)
ps_pad_name(file, inst); ps_pad_name(file, inst);
@ -844,7 +850,8 @@ static void ps_keys(FILE *file, double w, double h)
enum pad_type i; enum pad_type i;
for (i = 0; i != pt_n; i++) for (i = 0; i != pt_n; i++)
ps_key(file, w, h, i); if (pad_type_seen[i])
ps_key(file, w, h, i);
} }
@ -1209,6 +1216,7 @@ static void ps_package_fullpage(FILE *file, const struct pkg *pkg, int page)
} }
fprintf(file, "gsave\n"); fprintf(file, "gsave\n");
fprintf(file, "%d %d translate\n", (int) (-cx*f), (int) (-cy*f)+yoff); fprintf(file, "%d %d translate\n", (int) (-cx*f), (int) (-cy*f)+yoff);
memset(pad_type_seen, 0, sizeof(pad_type_seen));
ps_draw_package(file, pkg, f, 0); ps_draw_package(file, pkg, f, 0);
fprintf(file, "grestore\n"); fprintf(file, "grestore\n");
if (active_params.show_key) { if (active_params.show_key) {