Index: trunk/src/draw.c =================================================================== --- trunk/src/draw.c (revision 6205) +++ trunk/src/draw.c (revision 6206) @@ -625,7 +625,7 @@ * HID drawing callback. */ -void pcb_hid_expose_callback(pcb_hid_t * hid, pcb_box_t * region, void *item) +static pcb_hid_t *expose_begin(pcb_hid_t *hid) { pcb_hid_t *old_gui = pcb_gui; @@ -636,17 +636,33 @@ hid->set_color(Output.pmGC, "erase"); hid->set_color(Output.bgGC, "drill"); + return old_gui; +} - if (item) { - pcb_draw_doing_pinout = pcb_true; - draw_element((pcb_element_t *) item); - pcb_draw_doing_pinout = pcb_false; - } - else if (!pcb_draw_inhibit) - DrawEverything(region); - +static void *expose_end(pcb_hid_t *old_gui) +{ pcb_gui->destroy_gc(Output.fgGC); pcb_gui->destroy_gc(Output.bgGC); pcb_gui->destroy_gc(Output.pmGC); pcb_gui = old_gui; } + +void pcb_hid_expose_all(pcb_hid_t * hid, void *region) +{ + if (!pcb_draw_inhibit) { + pcb_hid_t *old_gui = expose_begin(hid); + DrawEverything((pcb_box_t *)region); + expose_end(old_gui); + } +} + +void pcb_hid_expose_pinout(pcb_hid_t * hid, void *element) +{ + pcb_hid_t *old_gui = expose_begin(hid); + + pcb_draw_doing_pinout = pcb_true; + draw_element((pcb_element_t *)element); + pcb_draw_doing_pinout = pcb_false; + + expose_end(old_gui); +} Index: trunk/src/hid.h =================================================================== --- trunk/src/hid.h (revision 6205) +++ trunk/src/hid.h (revision 6206) @@ -533,10 +533,8 @@ void (*propedit_add_stat)(void *pe, const char *propname, void *propctx, const char *most_common, const char *min, const char *max, const char *avg); }; -/* This function (in the common code) will be called whenever the GUI - needs to redraw the screen, print the board, or export a layer. If - item is not NULL, only draw the given item. Item is only non-NULL - if the HID was created via show_item. +/* On of these functions (in the common code) will be called whenever the GUI + needs to redraw the screen, print the board, or export a layer. Each time func is called, it should do the following: @@ -548,9 +546,16 @@ Do *not* assume that the hid that is passed is the GUI hid. This callback is also used for printing and exporting. */ -struct pcb_box_t; -void pcb_hid_expose_callback(pcb_hid_t * hid_, pcb_box_t *region_, void *item_); +typedef void (*pcb_hid_expose_t)(pcb_hid_t *hid, void *region); +/* Normal expose: draw all layers with all flags region is (pcb_box_t *) */ +void pcb_hid_expose_all(pcb_hid_t *hid, void *region); + +/* Pinout preview expose: draw an element; element is (pcb_element_t *) */ +void pcb_hid_expose_pinout(pcb_hid_t *hid, void *element); + + + /* This is initially set to a "no-gui" gui, and later reset by main. hid_expose_callback also temporarily set it for drawing. */ extern pcb_hid_t *pcb_gui; Index: trunk/src/hid_extents.c =================================================================== --- trunk/src/hid_extents.c (revision 6205) +++ trunk/src/hid_extents.c (revision 6206) @@ -145,10 +145,8 @@ initialised = pcb_true; } -pcb_box_t *pcb_hid_get_extents(void *item) +pcb_box_t *pcb_hid_get_extents_pinout(void *item) { - pcb_box_t region; - /* As this isn't a real "HID", we need to ensure we are initialised. */ hid_extents_init(); @@ -157,11 +155,7 @@ box.X2 = -COORD_MAX; box.Y2 = -COORD_MAX; - region.X1 = -COORD_MAX; - region.Y1 = -COORD_MAX; - region.X2 = COORD_MAX; - region.Y2 = COORD_MAX; - pcb_hid_expose_callback(&extents_hid, ®ion, item); + pcb_hid_expose_pinout(&extents_hid, item); return &box; } Index: trunk/src/hid_extents.h =================================================================== --- trunk/src/hid_extents.h (revision 6205) +++ trunk/src/hid_extents.h (revision 6206) @@ -6,7 +6,7 @@ /* Convenience function that calls the expose callback for the item, and returns the extents of what was drawn. */ -pcb_box_t *pcb_hid_get_extents(void *item); +pcb_box_t *pcb_hid_get_extents_pinout(void *item); #endif Index: trunk/src_plugins/export_dxf/dxf.c =================================================================== --- trunk/src_plugins/export_dxf/dxf.c (revision 6205) +++ trunk/src_plugins/export_dxf/dxf.c (revision 6206) @@ -4308,10 +4308,10 @@ lastgroup = -1; c_layerapps = 0; dxf_finding_apertures = 1; - pcb_hid_expose_callback(&dxf_hid, ®ion, 0); + pcb_hid_expose_all(&dxf_hid, ®ion); c_layerapps = 0; dxf_finding_apertures = 0; - pcb_hid_expose_callback(&dxf_hid, ®ion, 0); + pcb_hid_expose_all(&dxf_hid, ®ion); memcpy(pcb_layer_stack, saved_layer_stack, sizeof(pcb_layer_stack)); dxf_maybe_close_file(); pcb_hid_restore_layer_ons(save_ons); Index: trunk/src_plugins/export_gcode/gcode.c =================================================================== --- trunk/src_plugins/export_gcode/gcode.c (revision 6205) +++ trunk/src_plugins/export_gcode/gcode.c (revision 6206) @@ -346,7 +346,7 @@ lastbrush = (gdImagePtr) ((void *) -1); lastcolor = -1; - pcb_hid_expose_callback(&gcode_hid, ®ion, 0); + pcb_hid_expose_all(&gcode_hid, ®ion); } static void gcode_do_export(pcb_hid_attr_val_t * options) Index: trunk/src_plugins/export_gerber/gerber.c =================================================================== --- trunk/src_plugins/export_gerber/gerber.c (revision 6205) +++ trunk/src_plugins/export_gerber/gerber.c (revision 6206) @@ -579,11 +579,11 @@ lastgroup = -1; layer_list_idx = 0; finding_apertures = 1; - pcb_hid_expose_callback(&gerber_hid, ®ion, 0); + pcb_hid_expose_all(&gerber_hid, ®ion); layer_list_idx = 0; finding_apertures = 0; - pcb_hid_expose_callback(&gerber_hid, ®ion, 0); + pcb_hid_expose_all(&gerber_hid, ®ion); memcpy(pcb_layer_stack, saved_layer_stack, sizeof(pcb_layer_stack)); Index: trunk/src_plugins/export_nelma/nelma.c =================================================================== --- trunk/src_plugins/export_nelma/nelma.c (revision 6205) +++ trunk/src_plugins/export_nelma/nelma.c (revision 6206) @@ -575,7 +575,7 @@ lastbrush = (gdImagePtr) ((void *) -1); lastcolor = -1; - pcb_hid_expose_callback(&nelma_hid, ®ion, 0); + pcb_hid_expose_all(&nelma_hid, ®ion); } static void nelma_do_export(pcb_hid_attr_val_t * options) Index: trunk/src_plugins/export_openscad/scad.c =================================================================== --- trunk/src_plugins/export_openscad/scad.c (revision 6205) +++ trunk/src_plugins/export_openscad/scad.c (revision 6206) @@ -581,7 +581,7 @@ layer_open = 0; - pcb_hid_expose_callback(&scad_hid, ®ion, 0); + pcb_hid_expose_all(&scad_hid, ®ion); /* And now .... Board outlines */ Index: trunk/src_plugins/export_png/png.c =================================================================== --- trunk/src_plugins/export_png/png.c (revision 6205) +++ trunk/src_plugins/export_png/png.c (revision 6206) @@ -526,7 +526,7 @@ } } - pcb_hid_expose_callback(&png_hid, bounds, 0); + pcb_hid_expose_all(&png_hid, bounds); memcpy(pcb_layer_stack, saved_layer_stack, sizeof(pcb_layer_stack)); conf_update(NULL); /* restore forced sets */ Index: trunk/src_plugins/export_ps/eps.c =================================================================== --- trunk/src_plugins/export_ps/eps.c (revision 6205) +++ trunk/src_plugins/export_ps/eps.c (revision 6206) @@ -297,7 +297,7 @@ fprintf(f, "/cc { 0 360 arc nclip } bind def\n"); fprintf(f, "/a { gsave setlinewidth translate scale 0 0 1 5 3 roll arc stroke grestore} bind def\n"); - pcb_hid_expose_callback(&eps_hid, bounds, 0); + pcb_hid_expose_all(&eps_hid, bounds); fprintf(f, "showpage\n"); Index: trunk/src_plugins/export_ps/ps.c =================================================================== --- trunk/src_plugins/export_ps/ps.c (revision 6205) +++ trunk/src_plugins/export_ps/ps.c (revision 6206) @@ -671,14 +671,14 @@ fprintf(the_file, "/tocp { /y y 12 sub def 90 y moveto rightshow } bind def\n"); global.doing_toc = 1; - global.pagecount = 1; /* 'pagecount' is modified by pcb_hid_expose_callback() call */ - pcb_hid_expose_callback(&ps_hid, &global.region, 0); + global.pagecount = 1; /* 'pagecount' is modified by pcb_hid_expose_all() call */ + pcb_hid_expose_all(&ps_hid, &global.region); } global.pagecount = 1; /* Reset 'pagecount' if single file */ global.doing_toc = 0; ps_set_layer_group(-1, -1, 0, -1); /* reset static vars */ - pcb_hid_expose_callback(&ps_hid, &global.region, 0); + pcb_hid_expose_all(&ps_hid, &global.region); if (the_file) fprintf(the_file, "showpage\n"); Index: trunk/src_plugins/export_svg/svg.c =================================================================== --- trunk/src_plugins/export_svg/svg.c (revision 6205) +++ trunk/src_plugins/export_svg/svg.c (revision 6206) @@ -237,7 +237,7 @@ gds_init(&sbright); gds_init(&sdark); gds_init(&snormal); - pcb_hid_expose_callback(&svg_hid, ®ion, 0); + pcb_hid_expose_all(&svg_hid, ®ion); conf_update(NULL); /* restore forced sets */ } Index: trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/hid/hid_callbacks.c =================================================================== --- trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/hid/hid_callbacks.c (revision 6205) +++ trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/hid/hid_callbacks.c (revision 6206) @@ -66,7 +66,7 @@ region.X2 = PCB->MaxWidth; region.Y2 = PCB->MaxHeight; - pcb_hid_expose_callback(h->hid, ®ion, 0); + pcb_hid_expose_all(h->hid, ®ion); pcb_hid_restore_layer_ons(save_ons); gpmi_event(h->module, HIDE_do_export_finish, h); h->result = NULL; Index: trunk/src_plugins/hid_gtk/gtkhid-gdk.c =================================================================== --- trunk/src_plugins/hid_gtk/gtkhid-gdk.c (revision 6205) +++ trunk/src_plugins/hid_gtk/gtkhid-gdk.c (revision 6206) @@ -819,7 +819,7 @@ ghid_draw_bg_image(); - pcb_hid_expose_callback(&ghid_hid, ®ion, 0); + pcb_hid_expose_all(&ghid_hid, ®ion); ghid_draw_grid(); /* In some cases we are called with the crosshair still off */ @@ -1174,7 +1174,7 @@ gdk_draw_rectangle(window, priv->bg_gc, TRUE, 0, 0, allocation.width, allocation.height); /* call the drawing routine */ - pcb_hid_expose_callback(&ghid_hid, NULL, &pinout->element); + pcb_hid_expose_pinout(&ghid_hid, &pinout->element); gport->drawable = save_drawable; gport->view = save_view; @@ -1228,7 +1228,7 @@ region.Y1 = MAX(0, MIN(PCB->MaxHeight, region.Y1)); region.Y2 = MAX(0, MIN(PCB->MaxHeight, region.Y2)); - pcb_hid_expose_callback(&ghid_hid, ®ion, NULL); + pcb_hid_expose_all(&ghid_hid, ®ion); gport->drawable = save_drawable; gport->view = save_view; Index: trunk/src_plugins/hid_gtk/gtkhid-gl.c =================================================================== --- trunk/src_plugins/hid_gtk/gtkhid-gl.c (revision 6205) +++ trunk/src_plugins/hid_gtk/gtkhid-gl.c (revision 6206) @@ -852,7 +852,7 @@ hidgl_init_triangle_array(&buffer); ghid_invalidate_current_gc(); - pcb_hid_expose_callback(&ghid_hid, ®ion, 0); + pcb_hid_expose_all(&ghid_hid, ®ion); hidgl_flush_triangles(&buffer); ghid_draw_grid(®ion); @@ -958,7 +958,7 @@ (conf_core.editor.view.flip_y ? -1. : 1.) / gport->view.coord_per_px, 1); glTranslatef(conf_core.editor.view.flip_x ? gport->view.x0 - PCB->MaxWidth : -gport->view.x0, conf_core.editor.view.flip_y ? gport->view.y0 - PCB->MaxHeight : -gport->view.y0, 0); - pcb_hid_expose_callback(&ghid_hid, NULL, &pinout->element); + pcb_hid_expose_pinout(&ghid_hid, &pinout->element); hidgl_flush_triangles(&buffer); glPopMatrix(); @@ -1062,7 +1062,7 @@ region.Y1 = MAX(0, MIN(PCB->MaxHeight, region.Y1)); region.Y2 = MAX(0, MIN(PCB->MaxHeight, region.Y2)); - pcb_hid_expose_callback(&ghid_hid, ®ion, NULL); + pcb_hid_expose_all(&ghid_hid, ®ion); hidgl_flush_triangles(&buffer); glPopMatrix(); Index: trunk/src_plugins/hid_lesstif/main.c =================================================================== --- trunk/src_plugins/hid_lesstif/main.c (revision 6205) +++ trunk/src_plugins/hid_lesstif/main.c (revision 6206) @@ -767,7 +767,7 @@ time(&start); do { XFillRectangle(display, pixmap, bg_gc, 0, 0, view_width, view_height); - pcb_hid_expose_callback(&lesstif_hid, ®ion, 0); + pcb_hid_expose_all(&lesstif_hid, ®ion); XSync(display, 0); time(&end); i++; @@ -2343,7 +2343,7 @@ } } DrawBackgroundImage(); - pcb_hid_expose_callback(&lesstif_hid, ®ion, 0); + pcb_hid_expose_all(&lesstif_hid, ®ion); draw_grid(); lesstif_use_mask(0); show_crosshair(0); /* To keep the drawn / not drawn info correct */ @@ -3381,7 +3381,7 @@ static void pinout_callback(Widget da, PinoutData * pd, XmDrawingAreaCallbackStruct * cbs) { - pcb_box_t region; +/* pcb_box_t region;*/ int save_vx, save_vy, save_vw, save_vh; int save_fx, save_fy; double save_vz; @@ -3429,13 +3429,13 @@ use_mask = 0; conf_force_set_bool(conf_core.editor.view.flip_x, 0); conf_force_set_bool(conf_core.editor.view.flip_y, 0); - region.X1 = 0; +/* region.X1 = 0; region.Y1 = 0; region.X2 = PCB->MaxWidth; - region.Y2 = PCB->MaxHeight; + region.Y2 = PCB->MaxHeight;*/ XFillRectangle(display, pixmap, bg_gc, 0, 0, pd->v_width, pd->v_height); - pcb_hid_expose_callback(&lesstif_hid, ®ion, pd->item); + pcb_hid_expose_pinout(&lesstif_hid, pd->item); pinout = 0; view_left_x = save_vx; @@ -3477,7 +3477,7 @@ pd->item = item; - extents = pcb_hid_get_extents(item); + extents = pcb_hid_get_extents_pinout(item); pd->left = extents->X1; pd->right = extents->X2; pd->top = extents->Y1; Index: trunk/src_plugins/hid_remote/remote.c =================================================================== --- trunk/src_plugins/hid_remote/remote.c (revision 6205) +++ trunk/src_plugins/hid_remote/remote.c (revision 6206) @@ -92,7 +92,7 @@ if (remote_proto_send_ready() != 0) exit(1); - pcb_hid_expose_callback(&remote_hid, ®ion, 0); + pcb_hid_expose_all(&remote_hid, ®ion); /* main loop, parser */ if (remote_proto_parse_all() != 0)