Index: trunk/src/libcschem/common_types.h =================================================================== --- trunk/src/libcschem/common_types.h (revision 493) +++ trunk/src/libcschem/common_types.h (revision 494) @@ -13,7 +13,7 @@ #define CSCH_COORD_MIN ((csch_color_t)-0x7fffffff) #define CSCH_COORD_MAX ((csch_color_t)+0x7fffffff) -#define CSCH_COORD_INV CSCH_COORD_MIN +#define CSCH_COORD_INV CSCH_COORD_MAX #define csch_pixelr(p) (((p) & 0xFF000000) >> 24) #define csch_pixelg(p) (((p) & 0x00FF0000) >> 16) Index: trunk/src/libcschem/concrete.c =================================================================== --- trunk/src/libcschem/concrete.c (revision 493) +++ trunk/src/libcschem/concrete.c (revision 494) @@ -39,6 +39,7 @@ csch_rtree_init(&sheet->rtree); csch_cobj_init(&sheet->grp.hdr, sheet, oid, CSCH_CTYPE_GRP, CSCH_INVALID_OID); sheet->next_id = oid+1; + csch_bbox_invalidate(&sheet->bbox); return sheet; } Index: trunk/src/libcschem/concrete.h =================================================================== --- trunk/src/libcschem/concrete.h (revision 493) +++ trunk/src/libcschem/concrete.h (revision 494) @@ -84,6 +84,7 @@ char *dflt_font, *dflt_font_size, *dflt_font_style; char *filename; /* original file name */ + csch_rtree_box_t bbox; }; /* Standard low level object operations; when int, return 0 for success */ Index: trunk/src/libcschem/concrete_obj.h =================================================================== --- trunk/src/libcschem/concrete_obj.h (revision 493) +++ trunk/src/libcschem/concrete_obj.h (revision 494) @@ -46,11 +46,10 @@ #define csch_obj_bbox_bump(obj, coord, value) \ do { \ - if (value < obj->hdr.bbox.coord ## 1) obj->hdr.bbox.coord ## 1 = value; \ - if (value > obj->hdr.bbox.coord ## 2) obj->hdr.bbox.coord ## 2 = value; \ + if (value < obj->hdr.bbox.coord ## 1) { obj->hdr.bbox.coord ## 1 = value; obj->hdr.sheet->bbox.x1 = CSCH_COORD_INV; } \ + if (value > obj->hdr.bbox.coord ## 2) { obj->hdr.bbox.coord ## 2 = value; obj->hdr.sheet->bbox.x1 = CSCH_COORD_INV; } \ } while(0) - /* Initialize an object by setting the common header fields; the only purpose of this function is to get compiler warnings at every caller when the header is extended (because the number of args would be extended here) */ Index: trunk/src/libcschem/rtree.h =================================================================== --- trunk/src/libcschem/rtree.h (revision 493) +++ trunk/src/libcschem/rtree.h (revision 494) @@ -14,4 +14,7 @@ #include +#define csch_bbox_invalidate(bbox) (bbox)->x1 = CSCH_COORD_INV +#define csch_bbox_is_invalid(bbox) ((bbox)->x1 == CSCH_COORD_INV) + #endif /* CSCH_RTREE2_H */