Index: trunk/src/hid_cam.c =================================================================== --- trunk/src/hid_cam.c (revision 27607) +++ trunk/src/hid_cam.c (revision 27608) @@ -318,12 +318,22 @@ } } -int pcb_cam_begin(pcb_board_t *pcb, pcb_cam_t *dst, const char *src, const pcb_export_opt_t *attr_tbl, int numa, pcb_hid_attr_val_t *options) +static void cam_xform_init(pcb_xform_t *dst_xform) { + memset(dst_xform, 0, sizeof(pcb_xform_t)); + dst_xform->omit_overlay = 1; /* normally exporters shouldn't draw overlays */ +} + + +int pcb_cam_begin(pcb_board_t *pcb, pcb_cam_t *dst, pcb_xform_t *dst_xform, const char *src, const pcb_export_opt_t *attr_tbl, int numa, pcb_hid_attr_val_t *options) +{ char *curr, *next, *purpose; memset(dst, 0, sizeof(pcb_cam_t)); + if (dst_xform != NULL) + cam_xform_init(dst_xform); + if ((src == NULL) || (*src == '\0')) return 0; @@ -484,12 +494,16 @@ } cam_name_ctx_t; static int cam_update_name_cb(void *ctx_, gds_t *s, const char **input); -void pcb_cam_begin_nolayer(pcb_board_t *pcb, pcb_cam_t *dst, const char *src, const char **fn_out) +void pcb_cam_begin_nolayer(pcb_board_t *pcb, pcb_cam_t *dst, pcb_xform_t *dst_xform, const char *src, const char **fn_out) { cam_name_ctx_t ctx; memset(dst, 0, sizeof(pcb_cam_t)); dst->pcb = pcb; + + if (dst_xform != NULL) + cam_xform_init(dst_xform); + if (src != NULL) { if (strchr(src, '=') != NULL) pcb_message(PCB_MSG_ERROR, "global exporter --cam doesn't take '=' and layers, only a file name\n"); Index: trunk/src/hid_cam.h =================================================================== --- trunk/src/hid_cam.h (revision 27607) +++ trunk/src/hid_cam.h (revision 27608) @@ -28,7 +28,7 @@ int exported_grps; } pcb_cam_t; -int pcb_cam_begin(pcb_board_t *pcb, pcb_cam_t *dst, const char *src, const pcb_export_opt_t *attr_tbl, int numa, pcb_hid_attr_val_t *options); +int pcb_cam_begin(pcb_board_t *pcb, pcb_cam_t *dst, pcb_xform_t *dst_xform, const char *src, const pcb_export_opt_t *attr_tbl, int numa, pcb_hid_attr_val_t *options); /* Finish cam export, free all memory, mark cam export inactive and report the number of layer groups exported */ @@ -36,7 +36,7 @@ /* load *fn_out with the cam-requested output file name in cam mode; useful for non layer based exporters */ -void pcb_cam_begin_nolayer(pcb_board_t *pcb, pcb_cam_t *dst, const char *src, const char **fn_out); +void pcb_cam_begin_nolayer(pcb_board_t *pcb, pcb_cam_t *dst, pcb_xform_t *dst_xform, const char *src, const char **fn_out); /* Shall be the first rule in a cam capable exporter's set_layer_group() Index: trunk/src_plugins/export_bom/bom.c =================================================================== --- trunk/src_plugins/export_bom/bom.c (revision 27607) +++ trunk/src_plugins/export_bom/bom.c (revision 27608) @@ -276,7 +276,7 @@ if (!bom_filename) bom_filename = "pcb-out.bom"; - pcb_cam_begin_nolayer(PCB, &cam, options[HA_cam].str, &bom_filename); + pcb_cam_begin_nolayer(PCB, &cam, NULL, options[HA_cam].str, &bom_filename); PrintBOM(); pcb_cam_end(&cam); Index: trunk/src_plugins/export_dsn/dsn.c =================================================================== --- trunk/src_plugins/export_dsn/dsn.c (revision 27607) +++ trunk/src_plugins/export_dsn/dsn.c (revision 27608) @@ -587,7 +587,7 @@ if (!dsn_filename) dsn_filename = "pcb-out.dsn"; - pcb_cam_begin_nolayer(PCB, &cam, options[HA_cam].str, &dsn_filename); + pcb_cam_begin_nolayer(PCB, &cam, NULL, options[HA_cam].str, &dsn_filename); trackwidth = options[HA_trackwidth].crd; clearance = options[HA_clearance].crd; Index: trunk/src_plugins/export_dxf/dxf.c =================================================================== --- trunk/src_plugins/export_dxf/dxf.c (revision 27607) +++ trunk/src_plugins/export_dxf/dxf.c (revision 27608) @@ -211,7 +211,7 @@ return dxf_attribute_list; } -void dxf_hid_export_to_file(dxf_ctx_t *ctx, pcb_hid_attr_val_t * options) +void dxf_hid_export_to_file(dxf_ctx_t *ctx, pcb_hid_attr_val_t * options, pcb_xform_t *xform) { static int saved_layer_stack[PCB_MAX_LAYER]; pcb_hid_expose_ctx_t hectx; @@ -234,7 +234,7 @@ dxf_ctx.drill_fill = options[HA_drill_fill].lng; dxf_ctx.drill_contour = options[HA_drill_contour].lng; - pcbhl_expose_main(&dxf_hid, &hectx, NULL); + pcbhl_expose_main(&dxf_hid, &hectx, xform); pcb_conf_update(NULL, -1); /* restore forced sets */ } @@ -273,6 +273,7 @@ const char *fn; char *errmsg; lht_err_t err; + pcb_xform_t xform; if (!options) { dxf_get_export_options(hid, 0); @@ -281,7 +282,7 @@ options = dxf_values; } - pcb_cam_begin(PCB, &dxf_cam, options[HA_cam].str, dxf_attribute_list, NUM_OPTIONS, options); + pcb_cam_begin(PCB, &dxf_cam, &xform, options[HA_cam].str, dxf_attribute_list, NUM_OPTIONS, options); filename = options[HA_dxffile].str; if (!filename) @@ -326,7 +327,7 @@ if (!dxf_cam.active) pcb_hid_save_and_show_layer_ons(save_ons); - dxf_hid_export_to_file(&dxf_ctx, options); + dxf_hid_export_to_file(&dxf_ctx, options, &xform); if (!dxf_cam.active) pcb_hid_restore_layer_ons(save_ons); Index: trunk/src_plugins/export_excellon/excellon.c =================================================================== --- trunk/src_plugins/export_excellon/excellon.c (revision 27607) +++ trunk/src_plugins/export_excellon/excellon.c (revision 27608) @@ -211,6 +211,7 @@ int i; int save_ons[PCB_MAX_LAYER]; pcb_hid_expose_ctx_t ctx; + pcb_xform_t xform; conf_force_set_bool(conf_core.editor.thin_draw, 0); conf_force_set_bool(conf_core.editor.thin_draw_poly, 0); @@ -227,7 +228,7 @@ options = excellon_values; } - pcb_cam_begin(PCB, &excellon_cam, options[HA_cam].str, excellon_options, NUM_OPTIONS, options); + pcb_cam_begin(PCB, &excellon_cam, &xform, options[HA_cam].str, excellon_options, NUM_OPTIONS, options); fnbase = options[HA_excellonfile].str; if (!fnbase) @@ -248,11 +249,11 @@ lastwidth = -1; finding_apertures = 1; - pcbhl_expose_main(&excellon_hid, &ctx, NULL); + pcbhl_expose_main(&excellon_hid, &ctx, &xform); lastwidth = -1; finding_apertures = 0; - pcbhl_expose_main(&excellon_hid, &ctx, NULL); + pcbhl_expose_main(&excellon_hid, &ctx, &xform); pcb_conf_update(NULL, -1); /* resotre forced sets */ Index: trunk/src_plugins/export_gerber/gerber.c =================================================================== --- trunk/src_plugins/export_gerber/gerber.c (revision 27607) +++ trunk/src_plugins/export_gerber/gerber.c (revision 27608) @@ -520,6 +520,7 @@ static int saved_layer_stack[PCB_MAX_LAYER]; int save_ons[PCB_MAX_LAYER]; pcb_hid_expose_ctx_t ctx; + pcb_xform_t xform; gerber_ovr = 0; @@ -549,7 +550,7 @@ pcb_printf_slot[4] = gerber_cfmt->cfmt; pcb_printf_slot[5] = gerber_cfmt->afmt; - pcb_cam_begin(PCB, &gerber_cam, options[HA_cam].str, gerber_options, NUM_OPTIONS, options); + pcb_cam_begin(PCB, &gerber_cam, &xform, options[HA_cam].str, gerber_options, NUM_OPTIONS, options); fnbase = options[HA_gerberfile].str; if (!fnbase) @@ -592,12 +593,12 @@ lastgroup = -1; layer_list_idx = 0; finding_apertures = 1; - pcbhl_expose_main(&gerber_hid, &ctx, NULL); + pcbhl_expose_main(&gerber_hid, &ctx, &xform); lastgroup = -2; layer_list_idx = 0; finding_apertures = 0; - pcbhl_expose_main(&gerber_hid, &ctx, NULL); + pcbhl_expose_main(&gerber_hid, &ctx, &xform); memcpy(pcb_layer_stack, saved_layer_stack, sizeof(pcb_layer_stack)); Index: trunk/src_plugins/export_ipcd356/ipcd356.c =================================================================== --- trunk/src_plugins/export_ipcd356/ipcd356.c (revision 27607) +++ trunk/src_plugins/export_ipcd356/ipcd356.c (revision 27608) @@ -457,7 +457,7 @@ if (fn == NULL) fn = "pcb-rnd-out.net"; - pcb_cam_begin_nolayer(PCB, &cam, options[HA_cam].str, &fn); + pcb_cam_begin_nolayer(PCB, &cam, NULL, options[HA_cam].str, &fn); f = pcb_fopen_askovr(&PCB->hidlib, fn, "w", NULL); if (f == NULL) { Index: trunk/src_plugins/export_lpr/lpr.c =================================================================== --- trunk/src_plugins/export_lpr/lpr.c (revision 27607) +++ trunk/src_plugins/export_lpr/lpr.c (revision 27608) @@ -88,7 +88,7 @@ return; } - ps_hid_export_to_file(f, options); + ps_hid_export_to_file(f, options, NULL); pcb_pclose(f); } Index: trunk/src_plugins/export_openscad/export_openscad.c =================================================================== --- trunk/src_plugins/export_openscad/export_openscad.c (revision 27607) +++ trunk/src_plugins/export_openscad/export_openscad.c (revision 27608) @@ -314,7 +314,7 @@ if (!filename) filename = "pcb.openscad"; - pcb_cam_begin_nolayer(PCB, &cam, options[HA_cam].str, &filename); + pcb_cam_begin_nolayer(PCB, &cam, NULL, options[HA_cam].str, &filename); f = pcb_fopen_askovr(&PCB->hidlib, filename, "wb", NULL); if (!f) { Index: trunk/src_plugins/export_png/png.c =================================================================== --- trunk/src_plugins/export_png/png.c (revision 27607) +++ trunk/src_plugins/export_png/png.c (revision 27608) @@ -524,12 +524,11 @@ fprintf(stderr, "Error: Invalid graphic file format." " This is a bug. Please report it.\n"); } -void png_hid_export_to_file(FILE *the_file, pcb_hid_attr_val_t *options) +void png_hid_export_to_file(FILE *the_file, pcb_hid_attr_val_t *options, pcb_xform_t *xform) { static int saved_layer_stack[PCB_MAX_LAYER]; pcb_box_t tmp, region; pcb_hid_expose_ctx_t ctx; - pcb_xform_t *xform = NULL, xform_tmp; f = the_file; @@ -573,9 +572,7 @@ if (as_shown) { /* disable (exporter default) hiding overlay in as_shown */ - memset(&xform_tmp, 0, sizeof(xform_tmp)); - xform = &xform_tmp; - xform_tmp.omit_overlay = 0; + xform->omit_overlay = 0; } ctx.view = *bounds; @@ -608,6 +605,7 @@ pcb_box_t tmp, *bbox; int w, h; int xmax, ymax, dpi; + pcb_xform_t xform; png_free_cache(); @@ -618,7 +616,7 @@ options = png_values; } - pcb_cam_begin(PCB, &png_cam, options[HA_cam].str, png_attribute_list, NUM_OPTIONS, options); + pcb_cam_begin(PCB, &png_cam, &xform, options[HA_cam].str, png_attribute_list, NUM_OPTIONS, options); if (options[HA_photo_mode].lng) { photo_mode = 1; @@ -755,7 +753,7 @@ if ((!png_cam.active) && (!options[HA_as_shown].lng)) pcb_hid_save_and_show_layer_ons(save_ons); - png_hid_export_to_file(f, options); + png_hid_export_to_file(f, options, &xform); if ((!png_cam.active) && (!options[HA_as_shown].lng)) pcb_hid_restore_layer_ons(save_ons); Index: trunk/src_plugins/export_png/png.h =================================================================== --- trunk/src_plugins/export_png/png.h (revision 27607) +++ trunk/src_plugins/export_png/png.h (revision 27608) @@ -1,2 +1,2 @@ extern const char *png_cookie; -extern void png_hid_export_to_file(FILE *, pcb_hid_attr_val_t *); +extern void png_hid_export_to_file(FILE *, pcb_hid_attr_val_t *, pcb_xform_t *); Index: trunk/src_plugins/export_ps/eps.c =================================================================== --- trunk/src_plugins/export_ps/eps.c (revision 27607) +++ trunk/src_plugins/export_ps/eps.c (revision 27608) @@ -214,13 +214,12 @@ fprintf(f, "%%%%EOF\n"); } -void eps_hid_export_to_file(FILE * the_file, pcb_hid_attr_val_t *options) +void eps_hid_export_to_file(FILE * the_file, pcb_hid_attr_val_t *options, pcb_xform_t *xform) { int i; static int saved_layer_stack[PCB_MAX_LAYER]; pcb_box_t tmp, region; pcb_hid_expose_ctx_t ctx; - pcb_xform_t *xform = NULL, xform_tmp; options_ = options; @@ -299,9 +298,7 @@ if (as_shown) { /* disable (exporter default) hiding overlay in as_shown */ - memset(&xform_tmp, 0, sizeof(xform_tmp)); - xform = &xform_tmp; - xform_tmp.omit_overlay = 0; + xform->omit_overlay = 0; } ctx.view = *bounds; @@ -318,6 +315,7 @@ { int i; int save_ons[PCB_MAX_LAYER]; + pcb_xform_t xform; if (!options) { eps_get_export_options(hid, 0); @@ -326,7 +324,7 @@ options = eps_values; } - pcb_cam_begin(PCB, &eps_cam, options[HA_cam].str, eps_attribute_list, NUM_OPTIONS, options); + pcb_cam_begin(PCB, &eps_cam, &xform, options[HA_cam].str, eps_attribute_list, NUM_OPTIONS, options); filename = options[HA_psfile].str; if (!filename) @@ -344,7 +342,7 @@ if ((!eps_cam.active) && (!options[HA_as_shown].lng)) pcb_hid_save_and_show_layer_ons(save_ons); - eps_hid_export_to_file(f, options); + eps_hid_export_to_file(f, options, &xform); if ((!eps_cam.active) && (!options[HA_as_shown].lng)) pcb_hid_restore_layer_ons(save_ons); Index: trunk/src_plugins/export_ps/ps.c =================================================================== --- trunk/src_plugins/export_ps/ps.c (revision 27607) +++ trunk/src_plugins/export_ps/ps.c (revision 27608) @@ -521,7 +521,7 @@ /* This is used by other HIDs that use a postscript format, like lpr or eps. */ -void ps_hid_export_to_file(FILE * the_file, pcb_hid_attr_val_t * options) +void ps_hid_export_to_file(FILE * the_file, pcb_hid_attr_val_t * options, pcb_xform_t *xform) { static int saved_layer_stack[PCB_MAX_LAYER]; @@ -592,13 +592,13 @@ global.doing_toc = 1; global.pagecount = 1; /* 'pagecount' is modified by pcbhl_expose_main() call */ - pcbhl_expose_main(&ps_hid, &global.exps, NULL); + pcbhl_expose_main(&ps_hid, &global.exps, xform); } global.pagecount = 1; /* Reset 'pagecount' if single file */ global.doing_toc = 0; ps_set_layer_group(pcb_render, -1, NULL, -1, -1, 0, -1, NULL); /* reset static vars */ - pcbhl_expose_main(&ps_hid, &global.exps, NULL); + pcbhl_expose_main(&ps_hid, &global.exps, xform); if (the_file) fprintf(the_file, "showpage\n"); @@ -612,6 +612,7 @@ FILE *fh; int save_ons[PCB_MAX_LAYER]; int i; + pcb_xform_t xform; global.ovr_all = 0; @@ -622,7 +623,7 @@ options = global.ps_values; } - pcb_cam_begin(PCB, &ps_cam, options[HA_cam].str, ps_attribute_list, NUM_OPTIONS, options); + pcb_cam_begin(PCB, &ps_cam, &xform, options[HA_cam].str, ps_attribute_list, NUM_OPTIONS, options); global.filename = options[HA_psfile].str; if (!global.filename) @@ -651,7 +652,7 @@ if (!ps_cam.active) pcb_hid_save_and_show_layer_ons(save_ons); - ps_hid_export_to_file(fh, options); + ps_hid_export_to_file(fh, options, &xform); if (!ps_cam.active) pcb_hid_restore_layer_ons(save_ons); Index: trunk/src_plugins/export_ps/ps.h =================================================================== --- trunk/src_plugins/export_ps/ps.h (revision 27607) +++ trunk/src_plugins/export_ps/ps.h (revision 27608) @@ -1,6 +1,6 @@ extern const char *ps_cookie; extern pcb_hid_t ps_hid; -extern void ps_hid_export_to_file(FILE *, pcb_hid_attr_val_t *); +extern void ps_hid_export_to_file(FILE *, pcb_hid_attr_val_t *, pcb_xform_t *); extern void ps_start_file(FILE *); extern void ps_calibrate_1(pcb_hid_t *hid, double, double, int); extern void hid_eps_init(); Index: trunk/src_plugins/export_stat/stat.c =================================================================== --- trunk/src_plugins/export_stat/stat.c (revision 27607) +++ trunk/src_plugins/export_stat/stat.c (revision 27608) @@ -157,7 +157,7 @@ if (!filename) filename = "pcb.stat.lht"; - pcb_cam_begin_nolayer(PCB, &cam, options[HA_cam].str, &filename); + pcb_cam_begin_nolayer(PCB, &cam, NULL, options[HA_cam].str, &filename); f = pcb_fopen_askovr(&PCB->hidlib, filename, "w", NULL); if (!f) { Index: trunk/src_plugins/export_svg/svg.c =================================================================== --- trunk/src_plugins/export_svg/svg.c (revision 27607) +++ trunk/src_plugins/export_svg/svg.c (revision 27608) @@ -209,11 +209,10 @@ return svg_attribute_list; } -void svg_hid_export_to_file(FILE * the_file, pcb_hid_attr_val_t * options) +void svg_hid_export_to_file(FILE * the_file, pcb_hid_attr_val_t * options, pcb_xform_t *xform) { static int saved_layer_stack[PCB_MAX_LAYER]; pcb_hid_expose_ctx_t ctx; - pcb_xform_t *xform = NULL, xform_tmp; ctx.view.X1 = 0; ctx.view.Y1 = 0; @@ -257,9 +256,7 @@ if (options[HA_as_shown].lng) { /* disable (exporter default) hiding overlay in as_shown */ - memset(&xform_tmp, 0, sizeof(xform_tmp)); - xform = &xform_tmp; - xform_tmp.omit_overlay = 0; + xform->omit_overlay = 0; } pcbhl_expose_main(&svg_hid, &ctx, xform); @@ -328,6 +325,7 @@ const char *filename; int save_ons[PCB_MAX_LAYER]; int i; + pcb_xform_t xform; comp_cnt = 0; @@ -338,7 +336,7 @@ options = svg_values; } - pcb_cam_begin(PCB, &svg_cam, options[HA_cam].str, svg_attribute_list, NUM_OPTIONS, options); + pcb_cam_begin(PCB, &svg_cam, &xform, options[HA_cam].str, svg_attribute_list, NUM_OPTIONS, options); if (svg_cam.fn_template == NULL) { filename = options[HA_svgfile].str; @@ -358,7 +356,7 @@ if (!svg_cam.active) pcb_hid_save_and_show_layer_ons(save_ons); - svg_hid_export_to_file(f, options); + svg_hid_export_to_file(f, options, &xform); if (!svg_cam.active) pcb_hid_restore_layer_ons(save_ons); Index: trunk/src_plugins/export_xy/xy.c =================================================================== --- trunk/src_plugins/export_xy/xy.c (revision 27607) +++ trunk/src_plugins/export_xy/xy.c (revision 27608) @@ -811,7 +811,7 @@ if (!xy_filename) xy_filename = "pcb-out.xy"; - pcb_cam_begin_nolayer(PCB, &cam, options[HA_cam].str, &xy_filename); + pcb_cam_begin_nolayer(PCB, &cam, NULL, options[HA_cam].str, &xy_filename); if (options[HA_unit].lng == -1) xy_unit = get_unit_struct("mil"); Index: trunk/src_plugins/io_tedax/tetest.c =================================================================== --- trunk/src_plugins/io_tedax/tetest.c (revision 27607) +++ trunk/src_plugins/io_tedax/tetest.c (revision 27608) @@ -216,7 +216,7 @@ if (!tedax_etest_filename) tedax_etest_filename = "unknown.etest.tdx"; - pcb_cam_begin_nolayer(PCB, &cam, options[HA_cam].str, &tedax_etest_filename); + pcb_cam_begin_nolayer(PCB, &cam, NULL, options[HA_cam].str, &tedax_etest_filename); name = PCB->hidlib.name;