Index: trunk/src/draw.c =================================================================== --- trunk/src/draw.c (revision 19413) +++ trunk/src/draw.c (revision 19414) @@ -185,12 +185,12 @@ int plated, unplated; pcb_board_count_holes(PCB, &plated, &unplated, info->drawn_area); - if (plated && pcb_layer_gui_set_vlayer(PCB, PCB_VLY_PLATED_DRILL, 0)) { + if (plated && pcb_layer_gui_set_vlayer(PCB, PCB_VLY_PLATED_DRILL, 0, &info->xform_caller)) { pcb_draw_pstk_holes(info, gid, PCB_PHOLE_PLATED); pcb_gui->end_layer(); } - if (unplated && pcb_layer_gui_set_vlayer(PCB, PCB_VLY_UNPLATED_DRILL, 0)) { + if (unplated && pcb_layer_gui_set_vlayer(PCB, PCB_VLY_UNPLATED_DRILL, 0, &info->xform_caller)) { pcb_draw_pstk_holes(info, gid, PCB_PHOLE_UNPLATED); pcb_gui->end_layer(); } @@ -203,22 +203,22 @@ hid_exp.view = *info->drawn_area; hid_exp.force = 0; - if (pcb_layer_gui_set_vlayer(PCB, PCB_VLY_TOP_ASSY, 0)) { + if (pcb_layer_gui_set_vlayer(PCB, PCB_VLY_TOP_ASSY, 0, &info->xform_caller)) { pcb_draw_assembly(info, PCB_LYT_TOP); pcb_gui->end_layer(); } - if (pcb_layer_gui_set_vlayer(PCB, PCB_VLY_BOTTOM_ASSY, 0)) { + if (pcb_layer_gui_set_vlayer(PCB, PCB_VLY_BOTTOM_ASSY, 0, &info->xform_caller)) { pcb_draw_assembly(info, PCB_LYT_BOTTOM); pcb_gui->end_layer(); } - if (pcb_layer_gui_set_vlayer(PCB, PCB_VLY_FAB, 0)) { + if (pcb_layer_gui_set_vlayer(PCB, PCB_VLY_FAB, 0, &info->xform_caller)) { pcb_stub_draw_fab(info, pcb_draw_out.fgGC, &hid_exp); pcb_gui->end_layer(); } - if (pcb_layer_gui_set_vlayer(PCB, PCB_VLY_CSECT, 0)) { + if (pcb_layer_gui_set_vlayer(PCB, PCB_VLY_CSECT, 0, &info->xform_caller)) { pcb_stub_draw_csect(pcb_draw_out.fgGC, &hid_exp); pcb_gui->end_layer(); } @@ -239,7 +239,7 @@ } /* if there's any UI layer, try to draw them */ - if ((first != NULL) && pcb_layer_gui_set_g_ui(first, 0)) { + if ((first != NULL) && pcb_layer_gui_set_g_ui(first, 0, &info->xform_caller)) { int have_canvas = 0; for(i = 0; i < vtp0_len(&pcb_uilayers); i++) { ly = pcb_uilayers.array[i]; @@ -285,7 +285,7 @@ static void draw_rats(const pcb_box_t *drawn_area) { - if (pcb_layer_gui_set_vlayer(PCB, PCB_VLY_RATS, 0)) { + if (pcb_layer_gui_set_vlayer(PCB, PCB_VLY_RATS, 0, NULL)) { pcb_gui->set_drawing_mode(PCB_HID_COMP_RESET, pcb_draw_out.direct, drawn_area); pcb_gui->set_drawing_mode(PCB_HID_COMP_POSITIVE, pcb_draw_out.direct, drawn_area); pcb_draw_rats(drawn_area); @@ -359,7 +359,7 @@ /* * first draw all 'invisible' stuff */ - if (!conf_core.editor.check_planes && pcb_layer_gui_set_vlayer(PCB, PCB_VLY_INVISIBLE, 0)) { + if (!conf_core.editor.check_planes && pcb_layer_gui_set_vlayer(PCB, PCB_VLY_INVISIBLE, 0, &info->xform_caller)) { pcb_draw_silk(info, PCB_LYT_INVISIBLE_SIDE()); pcb_gui->set_drawing_mode(PCB_HID_COMP_RESET, pcb_draw_out.direct, info->drawn_area); @@ -373,7 +373,7 @@ for (i = ngroups - 1; i >= 0; i--) { pcb_layergrp_id_t group = drawn_groups[i]; - if (pcb_layer_gui_set_glayer(PCB, group, 0)) { + if (pcb_layer_gui_set_glayer(PCB, group, 0, &info->xform)) { int is_current = 0; pcb_layergrp_id_t cgrp = CURRENT->meta.real.grp; @@ -405,13 +405,13 @@ /* Draw the solder mask if turned on */ gid = pcb_layergrp_get_top_mask(); - if ((gid >= 0) && (pcb_layer_gui_set_glayer(PCB, gid, 0))) { + if ((gid >= 0) && (pcb_layer_gui_set_glayer(PCB, gid, 0, &info->xform))) { pcb_draw_mask(info, PCB_COMPONENT_SIDE); pcb_gui->end_layer(); } gid = pcb_layergrp_get_bottom_mask(); - if ((gid >= 0) && (pcb_layer_gui_set_glayer(PCB, gid, 0))) { + if ((gid >= 0) && (pcb_layer_gui_set_glayer(PCB, gid, 0, &info->xform))) { pcb_draw_mask(info, PCB_SOLDER_SIDE); pcb_gui->end_layer(); } @@ -419,7 +419,7 @@ /* Draw silks */ slk_len = pcb_layergrp_list(PCB, PCB_LYT_SILK, slk, sizeof(slk) / sizeof(slk[0])); for(i = 0; i < slk_len; i++) { - if (pcb_layer_gui_set_glayer(PCB, slk[i], 0)) { + if (pcb_layer_gui_set_glayer(PCB, slk[i], 0, &info->xform)) { unsigned int loc = pcb_layergrp_flags(PCB, slk[i]); pcb_draw_silk(info, loc & PCB_LYT_ANYWHERE); pcb_gui->end_layer(); @@ -436,7 +436,7 @@ gid = pcb_layergrp_get_top_paste(); if (gid >= 0) paste_empty = pcb_layergrp_is_empty(PCB, gid); - if ((gid >= 0) && (pcb_layer_gui_set_glayer(PCB, gid, paste_empty))) { + if ((gid >= 0) && (pcb_layer_gui_set_glayer(PCB, gid, paste_empty, &info->xform))) { pcb_draw_paste(info, PCB_COMPONENT_SIDE); pcb_gui->end_layer(); } @@ -444,7 +444,7 @@ gid = pcb_layergrp_get_bottom_paste(); if (gid >= 0) paste_empty = pcb_layergrp_is_empty(PCB, gid); - if ((gid >= 0) && (pcb_layer_gui_set_glayer(PCB, gid, paste_empty))) { + if ((gid >= 0) && (pcb_layer_gui_set_glayer(PCB, gid, paste_empty, &info->xform))) { pcb_draw_paste(info, PCB_SOLDER_SIDE); pcb_gui->end_layer(); } @@ -999,7 +999,7 @@ purpi = pcb_layer_purpose(PCB, e->content.layer_id, NULL); if (PCB_LAYER_IS_CSECT(lflg, purpi)) { - if ((pcb_layer_gui_set_vlayer(PCB, PCB_VLY_CSECT, 0)) || (e->force)) { + if ((pcb_layer_gui_set_vlayer(PCB, PCB_VLY_CSECT, 0, NULL)) || (e->force)) { pcb_gui->set_drawing_mode(PCB_HID_COMP_RESET, 1, &e->view); pcb_gui->set_drawing_mode(PCB_HID_COMP_POSITIVE, 1, &e->view); pcb_stub_draw_csect(pcb_draw_out.fgGC, e); @@ -1008,7 +1008,7 @@ } } else if (lflg & PCB_LYT_DIALOG) { - if ((pcb_layer_gui_set_vlayer(PCB, PCB_VLY_DIALOG, 0)) || (e->force)) { + if ((pcb_layer_gui_set_vlayer(PCB, PCB_VLY_DIALOG, 0, NULL)) || (e->force)) { pcb_gui->set_drawing_mode(PCB_HID_COMP_RESET, 1, &e->view); pcb_gui->set_drawing_mode(PCB_HID_COMP_POSITIVE, 1, &e->view); e->dialog_draw(pcb_draw_out.fgGC, e); Index: trunk/src/draw.h =================================================================== --- trunk/src/draw.h (revision 19413) +++ trunk/src/draw.h (revision 19414) @@ -51,7 +51,7 @@ typedef struct pcb_draw_info_s { pcb_board_t *pcb; const pcb_box_t *drawn_area; - const pcb_xform_t *xform_caller; /* the extra transformation the caller requested */ + pcb_xform_t *xform_caller; /* the extra transformation the caller requested */ pcb_xform_t *xform; /* the final transformation applied on objects */ const pcb_layer_t *layer; Index: trunk/src/draw_ly_spec.c =================================================================== --- trunk/src/draw_ly_spec.c (revision 19413) +++ trunk/src/draw_ly_spec.c (revision 19414) @@ -232,7 +232,7 @@ } count += numobj; - if (pcb_layer_gui_set_layer(gid, g, (numobj == 0))) { + if (pcb_layer_gui_set_layer(gid, g, (numobj == 0), &info->xform)) { /* boundary does NOT support compisiting, everything is drawn in positive */ pcb_gui->set_drawing_mode(PCB_HID_COMP_RESET, pcb_draw_out.direct, info->drawn_area); pcb_gui->set_drawing_mode(PCB_HID_COMP_POSITIVE, pcb_draw_out.direct, info->drawn_area); @@ -244,7 +244,7 @@ } } - if ((count == 0) && (goutl != NULL) && (pcb_layer_gui_set_layer(goutid, goutl, 0))) { + if ((count == 0) && (goutl != NULL) && (pcb_layer_gui_set_layer(goutid, goutl, 0, &info->xform))) { /* The implicit outline rectangle (or automatic outline rectanlge). We should check for pcb_gui->gui here, but it's kinda cool seeing the auto-outline magically disappear when you first add something to @@ -267,7 +267,7 @@ pcb_board_count_slots(PCB, &plated, &unplated, info->drawn_area); if ((uslot != NULL) && (uslot->meta.real.vis)) { - if (pcb_layer_gui_set_glayer(PCB, uslot->meta.real.grp, unplated > 0)) { + if (pcb_layer_gui_set_glayer(PCB, uslot->meta.real.grp, unplated > 0, &info->xform)) { pcb_gui->set_drawing_mode(PCB_HID_COMP_RESET, pcb_draw_out.direct, info->drawn_area); pcb_gui->set_drawing_mode(PCB_HID_COMP_POSITIVE, pcb_draw_out.direct, info->drawn_area); pcb_draw_pstk_slots(info, CURRENT->meta.real.grp, PCB_PHOLE_UNPLATED | PCB_PHOLE_BB); @@ -275,7 +275,7 @@ } } if ((pslot != NULL) && (pslot->meta.real.vis)) { - if (pcb_layer_gui_set_glayer(PCB, pslot->meta.real.grp, plated > 0)) { + if (pcb_layer_gui_set_glayer(PCB, pslot->meta.real.grp, plated > 0, &info->xform)) { pcb_gui->set_drawing_mode(PCB_HID_COMP_RESET, pcb_draw_out.direct, info->drawn_area); pcb_gui->set_drawing_mode(PCB_HID_COMP_POSITIVE, pcb_draw_out.direct, info->drawn_area); pcb_draw_pstk_slots(info, CURRENT->meta.real.grp, PCB_PHOLE_PLATED | PCB_PHOLE_BB); Index: trunk/src/layer.c =================================================================== --- trunk/src/layer.c (revision 19413) +++ trunk/src/layer.c (revision 19414) @@ -1063,7 +1063,7 @@ pcb->Data->Layer[n].comb |= PCB_LYC_AUTO; } -int pcb_layer_gui_set_vlayer(pcb_board_t *pcb, pcb_virtual_layer_t vid, int is_empty) +int pcb_layer_gui_set_vlayer(pcb_board_t *pcb, pcb_virtual_layer_t vid, int is_empty, pcb_xform_t **xform) { pcb_virt_layer_t *v = &pcb_virt_layers[vid]; assert((vid >= 0) && (vid < PCB_VLY_end)); @@ -1072,6 +1072,9 @@ if (pcb_gui == NULL) return 0; + if (xform != NULL) + *xform = NULL; + #warning layer TODO: need to pass the flags of the group, not the flags of the layer once we have a group for each layer if (pcb_gui->set_layer_group != NULL) { pcb_layergrp_id_t grp; @@ -1084,12 +1087,15 @@ return 1; } -int pcb_layer_gui_set_g_ui(pcb_layer_t *first, int is_empty) +int pcb_layer_gui_set_g_ui(pcb_layer_t *first, int is_empty, pcb_xform_t **xform) { /* if there's no GUI, that means no draw should be done */ if (pcb_gui == NULL) return 0; + if (xform != NULL) + *xform = NULL; + if (pcb_gui->set_layer_group != NULL) return pcb_gui->set_layer_group(-1, NULL, -1, pcb_layer_id(first->parent.data, first), PCB_LYT_VIRTUAL | PCB_LYT_UI, is_empty); Index: trunk/src/layer.h =================================================================== --- trunk/src/layer.h (revision 19413) +++ trunk/src/layer.h (revision 19414) @@ -228,8 +228,8 @@ /* call the gui to set a virtual layer or the UI layer group */ -int pcb_layer_gui_set_vlayer(pcb_board_t *pcb, pcb_virtual_layer_t vid, int is_empty); -int pcb_layer_gui_set_g_ui(pcb_layer_t *first, int is_empty); +int pcb_layer_gui_set_vlayer(pcb_board_t *pcb, pcb_virtual_layer_t vid, int is_empty, pcb_xform_t **xform); +int pcb_layer_gui_set_g_ui(pcb_layer_t *first, int is_empty, pcb_xform_t **xform); /* returns a bitfield of pcb_layer_type_t; returns 0 if layer_idx or layer is invalid. */ Index: trunk/src/layer_grp.c =================================================================== --- trunk/src/layer_grp.c (revision 19413) +++ trunk/src/layer_grp.c (revision 19414) @@ -630,12 +630,15 @@ return 1; } -int pcb_layer_gui_set_layer(pcb_layergrp_id_t gid, const pcb_layergrp_t *grp, int is_empty) +int pcb_layer_gui_set_layer(pcb_layergrp_id_t gid, const pcb_layergrp_t *grp, int is_empty, pcb_xform_t **xform) { /* if there's no GUI, that means no draw should be done */ if (pcb_gui == NULL) return 0; + if (xform != NULL) + *xform = NULL; + if (pcb_gui->set_layer_group != NULL) return pcb_gui->set_layer_group(gid, grp->purpose, grp->purpi, grp->lid[0], grp->ltype, is_empty); @@ -643,9 +646,9 @@ return 1; } -int pcb_layer_gui_set_glayer(pcb_board_t *pcb, pcb_layergrp_id_t grp, int is_empty) +int pcb_layer_gui_set_glayer(pcb_board_t *pcb, pcb_layergrp_id_t grp, int is_empty, pcb_xform_t **xform) { - return pcb_layer_gui_set_layer(grp, &pcb->LayerGroups.grp[grp], is_empty); + return pcb_layer_gui_set_layer(grp, &pcb->LayerGroups.grp[grp], is_empty, xform); } #define APPEND(n) \ Index: trunk/src/layer_grp.h =================================================================== --- trunk/src/layer_grp.h (revision 19413) +++ trunk/src/layer_grp.h (revision 19414) @@ -94,8 +94,8 @@ pcb_bool pcb_layergrp_is_pure_empty(pcb_board_t *pcb, pcb_layergrp_id_t num); /* call the gui to set a layer group */ -int pcb_layer_gui_set_layer(pcb_layergrp_id_t gid, const pcb_layergrp_t *grp, int is_empty); -int pcb_layer_gui_set_glayer(pcb_board_t *pcb, pcb_layergrp_id_t grp, int is_empty); +int pcb_layer_gui_set_layer(pcb_layergrp_id_t gid, const pcb_layergrp_t *grp, int is_empty, pcb_xform_t **xform); +int pcb_layer_gui_set_glayer(pcb_board_t *pcb, pcb_layergrp_id_t grp, int is_empty, pcb_xform_t **xform); /* returns a bitfield of pcb_layer_type_t; returns 0 if layer_idx is invalid. */ unsigned int pcb_layergrp_flags(const pcb_board_t *pcb, pcb_layergrp_id_t group_idx);