Index: trunk/src/change.c =================================================================== --- trunk/src/change.c (revision 15) +++ trunk/src/change.c (revision 16) @@ -1453,6 +1453,7 @@ CLEAR_FLAG (SQUAREFLAG, Pin); else SET_FLAG (SQUAREFLAG, Pin); + SetPinBoundingBox (Pin); AddObjectToClearPolyUndoList (PIN_TYPE, Element, Pin, Pin, true); ClearFromPolygon (PCB->Data, PIN_TYPE, Element, Pin); DrawPin (Pin); Index: trunk/src/misc.c =================================================================== --- trunk/src/misc.c (revision 15) +++ trunk/src/misc.c (revision 16) @@ -232,6 +232,12 @@ { Coord width; + if ((GET_SQUARE(Pin) > 1) && (TEST_FLAG (SQUAREFLAG, Pin))) { + POLYAREA *p = PinPoly(Pin, PIN_SIZE(Pin), Pin->Clearance); + poly_bbox (p, &Pin->BoundingBox); + return; + } + /* the bounding box covers the extent of influence * so it must include the clearance values too */ Index: trunk/src/polyarea.h =================================================================== --- trunk/src/polyarea.h (revision 15) +++ trunk/src/polyarea.h (revision 16) @@ -183,6 +183,10 @@ int poly_Boolean_free(POLYAREA * a, POLYAREA * b, POLYAREA ** res, int action); int poly_AndSubtract_free(POLYAREA * a, POLYAREA * b, POLYAREA ** aandb, POLYAREA ** aminusb); int SavePOLYAREA( POLYAREA *PA, char * fname); + +/* calculate the bounding box of a POLYAREA and save result in b */ +void poly_bbox (POLYAREA *p, BoxType *b); + #ifdef __cplusplus } #endif Index: trunk/src/polygon1.c =================================================================== --- trunk/src/polygon1.c (revision 15) +++ trunk/src/polygon1.c (revision 16) @@ -3241,7 +3241,27 @@ return FALSE; } +void +poly_bbox (POLYAREA *p, BoxType *b) +{ + PLINE *n; + int cnt; + n = p->contours; + b->X1 = b->X2 = n->xmin; + b->Y1 = b->Y2 = n->ymin; + + for(cnt = 0; /*cnt < 2*/ n != NULL; n = n->next) { + if (n->xmin < b->X1) b->X1 = n->xmin; + if (n->ymin < b->Y1) b->Y1 = n->ymin; + if (n->xmax > b->X2) b->X2 = n->xmax; + if (n->ymax > b->Y2) b->Y2 = n->ymax; +/* if (n == p->contours) + cnt++;*/ + } +} + + BOOLp poly_Valid (POLYAREA * p) {