Index: trunk/doc-rnd/hacking/renames =================================================================== --- trunk/doc-rnd/hacking/renames (revision 4840) +++ trunk/doc-rnd/hacking/renames (revision 4841) @@ -139,3 +139,9 @@ CountHoles -> pcb_board_count_holes SWAP_X -> PCB_SWAP_X SWAP_Y -> PCB_SWAP_Y +ROTATEBOX_CW -> PCB_BOX_ROTATE_CW +ROTATEBOX_TO_NORTH -> PCB_BOX_ROTATE_TO_NORTH +ROTATEBOX_FROM_NORTH -> PCB_BOX_ROTATE_FROM_NORTH +CENTER_X -> PCB_BOX_CENTER_X +CENTER_Y -> PCB_BOX_CENTER_Y +MOVE_BOX_LOWLEVEL -> PCB_BOX_MOVE_LOWLEVEL Index: trunk/src/box.h =================================================================== --- trunk/src/box.h (revision 4840) +++ trunk/src/box.h (revision 4841) @@ -56,11 +56,11 @@ /* rotates box 90-degrees cw */ /* that's a strange rotation! */ -#define ROTATEBOX_CW(box) { pcb_coord_t t;\ +#define PCB_BOX_ROTATE_CW(box) { pcb_coord_t t;\ t = (box).X1; (box).X1 = -(box).Y2; (box).Y2 = (box).X2;\ (box).X2 = -(box).Y1; (box).Y1 = t;\ } -#define ROTATEBOX_TO_NORTH(box, dir) do { pcb_coord_t t;\ +#define PCB_BOX_ROTATE_TO_NORTH(box, dir) do { pcb_coord_t t;\ switch(dir) {\ case EAST: \ t = (box).X1; (box).X1 = (box).Y1; (box).Y1 = -(box).X2;\ @@ -75,7 +75,7 @@ default: assert(0);\ }\ } while (0) -#define ROTATEBOX_FROM_NORTH(box, dir) do { pcb_coord_t t;\ +#define PCB_BOX_ROTATE_FROM_NORTH(box, dir) do { pcb_coord_t t;\ switch(dir) {\ case WEST: \ t = (box).X1; (box).X1 = (box).Y1; (box).Y1 = -(box).X2;\ @@ -92,11 +92,11 @@ } while (0) /* to avoid overflow, we calculate centers this way */ -#define CENTER_X(b) ((b).X1 + ((b).X2 - (b).X1)/2) -#define CENTER_Y(b) ((b).Y1 + ((b).Y2 - (b).Y1)/2) +#define PCB_BOX_CENTER_X(b) ((b).X1 + ((b).X2 - (b).X1)/2) +#define PCB_BOX_CENTER_Y(b) ((b).Y1 + ((b).Y2 - (b).Y1)/2) /* some useful box utilities. */ -#define MOVE_BOX_LOWLEVEL(b,dx,dy) \ +#define PCB_BOX_MOVE_LOWLEVEL(b,dx,dy) \ { \ MOVE((b)->X1,(b)->Y1,(dx),(dy)) \ MOVE((b)->X2,(b)->Y2,(dx),(dy)) \ Index: trunk/src/obj_arc.h =================================================================== --- trunk/src/obj_arc.h (revision 4840) +++ trunk/src/obj_arc.h (revision 4841) @@ -62,7 +62,7 @@ #define MOVE_ARC_LOWLEVEL(a,dx,dy) \ { \ MOVE((a)->X,(a)->Y,(dx),(dy)) \ - MOVE_BOX_LOWLEVEL(&((a)->BoundingBox),(dx),(dy)); \ + PCB_BOX_MOVE_LOWLEVEL(&((a)->BoundingBox),(dx),(dy)); \ } #define ARC_LOOP(element) do { \ Index: trunk/src/obj_elem.c =================================================================== --- trunk/src/obj_elem.c (revision 4840) +++ trunk/src/obj_elem.c (revision 4841) @@ -1040,8 +1040,8 @@ r_insert_entry(PCB->Data->name_tree[n], (pcb_box_t *) text, 0); } END_LOOP; - MOVE_BOX_LOWLEVEL(&Element->BoundingBox, DX, DY); - MOVE_BOX_LOWLEVEL(&Element->VBox, DX, DY); + PCB_BOX_MOVE_LOWLEVEL(&Element->BoundingBox, DX, DY); + PCB_BOX_MOVE_LOWLEVEL(&Element->VBox, DX, DY); MOVE(Element->MarkX, Element->MarkY, DX, DY); if (Data) r_insert_entry(Data->element_tree, (pcb_box_t *) Element, 0); Index: trunk/src/obj_pinvia.h =================================================================== --- trunk/src/obj_pinvia.h (revision 4840) +++ trunk/src/obj_pinvia.h (revision 4841) @@ -64,13 +64,13 @@ #define MOVE_VIA_LOWLEVEL(v,dx,dy) \ { \ MOVE((v)->X,(v)->Y,(dx),(dy)) \ - MOVE_BOX_LOWLEVEL(&((v)->BoundingBox),(dx),(dy)); \ + PCB_BOX_MOVE_LOWLEVEL(&((v)->BoundingBox),(dx),(dy)); \ } #define MOVE_PIN_LOWLEVEL(p,dx,dy) \ { \ MOVE((p)->X,(p)->Y,(dx),(dy)) \ - MOVE_BOX_LOWLEVEL(&((p)->BoundingBox),(dx),(dy)); \ + PCB_BOX_MOVE_LOWLEVEL(&((p)->BoundingBox),(dx),(dy)); \ } Index: trunk/src/obj_poly.c =================================================================== --- trunk/src/obj_poly.c (revision 4840) +++ trunk/src/obj_poly.c (revision 4841) @@ -347,7 +347,7 @@ MOVE(point->X, point->Y, DX, DY); } END_LOOP; - MOVE_BOX_LOWLEVEL(&Polygon->BoundingBox, DX, DY); + PCB_BOX_MOVE_LOWLEVEL(&Polygon->BoundingBox, DX, DY); } /* moves a polygon */ Index: trunk/src/obj_text.h =================================================================== --- trunk/src/obj_text.h (revision 4840) +++ trunk/src/obj_text.h (revision 4841) @@ -56,7 +56,7 @@ #define MOVE_TEXT_LOWLEVEL(t,dx,dy) \ { \ - MOVE_BOX_LOWLEVEL(&((t)->BoundingBox),(dx),(dy)); \ + PCB_BOX_MOVE_LOWLEVEL(&((t)->BoundingBox),(dx),(dy)); \ MOVE((t)->X, (t)->Y, (dx), (dy)); \ } Index: trunk/src_plugins/autoplace/autoplace.c =================================================================== --- trunk/src_plugins/autoplace/autoplace.c (revision 4840) +++ trunk/src_plugins/autoplace/autoplace.c (revision 4841) @@ -224,7 +224,7 @@ { struct r_neighbor_info *ni = (struct r_neighbor_info *) cl; pcb_box_t query = *region; - ROTATEBOX_TO_NORTH(query, ni->search_dir); + PCB_BOX_ROTATE_TO_NORTH(query, ni->search_dir); /* ______________ __ trap.y1 __ * \ / |__| query rect. * \__________/ __ trap.y2 @@ -241,7 +241,7 @@ struct r_neighbor_info *ni = (struct r_neighbor_info *) cl; pcb_box_t query = *box; int r; - ROTATEBOX_TO_NORTH(query, ni->search_dir); + PCB_BOX_ROTATE_TO_NORTH(query, ni->search_dir); /* ______________ __ trap.y1 __ * \ / |__| query rect. * \__________/ __ trap.y2 @@ -273,8 +273,8 @@ bbox.X2 = PCB->MaxWidth; bbox.Y2 = PCB->MaxHeight; /* rotate so that we can use the 'north' case for everything */ - ROTATEBOX_TO_NORTH(bbox, search_direction); - ROTATEBOX_TO_NORTH(ni.trap, search_direction); + PCB_BOX_ROTATE_TO_NORTH(bbox, search_direction); + PCB_BOX_ROTATE_TO_NORTH(ni.trap, search_direction); /* shift Y's such that trap contains full bounds of trapezoid */ ni.trap.Y2 = ni.trap.Y1; ni.trap.Y1 = bbox.Y1; Index: trunk/src_plugins/autoroute/autoroute.c =================================================================== --- trunk/src_plugins/autoroute/autoroute.c (revision 4840) +++ trunk/src_plugins/autoroute/autoroute.c (revision 4841) @@ -1264,8 +1264,8 @@ return pcb_true; } else { - nextpoint->X = CENTER_X(target->sbox); - nextpoint->Y = CENTER_Y(target->sbox); + nextpoint->X = PCB_BOX_CENTER_X(target->sbox); + nextpoint->Y = PCB_BOX_CENTER_Y(target->sbox); } return pcb_false; } @@ -1617,12 +1617,12 @@ routebox_t *target; pcb_cheap_point_t pnt; /* find a target near this via box */ - pnt.X = CENTER_X(*area); - pnt.Y = CENTER_Y(*area); + pnt.X = PCB_BOX_CENTER_X(*area); + pnt.Y = PCB_BOX_CENTER_Y(*area); target = minpcb_cost_target_to_point(&pnt, rb->group, targets, previous_edge->minpcb_cost_target); /* now find point near the target */ - pnt.X = CENTER_X(target->box); - pnt.Y = CENTER_Y(target->box); + pnt.X = PCB_BOX_CENTER_X(target->box); + pnt.Y = PCB_BOX_CENTER_Y(target->box); costpoint = closest_point_in_routebox(&pnt, rb); /* we moved from the previous cost point through the plane which is free travel */ d = (scale[through_site_conflict] * pcb_cost_to_point(&costpoint, group, &costpoint, previous_edge->rb->group)); @@ -1754,8 +1754,8 @@ origbox = *original; breakbox = bloat_routebox(breaker); - ROTATEBOX_TO_NORTH(origbox, which_edge); - ROTATEBOX_TO_NORTH(breakbox, which_edge); + PCB_BOX_ROTATE_TO_NORTH(origbox, which_edge); + PCB_BOX_ROTATE_TO_NORTH(breakbox, which_edge); result.right.Y1 = result.center.Y1 = result.left.Y1 = origbox.Y1; result.right.Y2 = result.center.Y2 = result.left.Y2 = origbox.Y1 + 1; /* validity of breaker is not important because the boxes are marked invalid */ @@ -1774,9 +1774,9 @@ result.is_valid_center = (result.center.X1 < result.center.X2); result.is_valid_right = (result.right.X1 < result.right.X2); /* rotate back */ - ROTATEBOX_FROM_NORTH(result.left, which_edge); - ROTATEBOX_FROM_NORTH(result.center, which_edge); - ROTATEBOX_FROM_NORTH(result.right, which_edge); + PCB_BOX_ROTATE_FROM_NORTH(result.left, which_edge); + PCB_BOX_ROTATE_FROM_NORTH(result.center, which_edge); + PCB_BOX_ROTATE_FROM_NORTH(result.right, which_edge); /* done */ return result; } @@ -2788,8 +2788,8 @@ } else { sq = shrink_box(&ti->query, rbox->style->Diameter); - sb.X1 = CENTER_X(sb); - sb.Y1 = CENTER_Y(sb); + sb.X1 = PCB_BOX_CENTER_X(sb); + sb.Y1 = PCB_BOX_CENTER_Y(sb); } if (!box_intersect(&sb, &sq)) return R_DIR_NOT_FOUND; @@ -2798,8 +2798,8 @@ sq = shrink_box(&ti->query, rbox->style->Diameter); if (!box_intersect(&sb, &sq)) return R_DIR_NOT_FOUND; - sb.X1 = CENTER_X(sb); - sb.Y1 = CENTER_Y(sb); + sb.X1 = PCB_BOX_CENTER_X(sb); + sb.Y1 = PCB_BOX_CENTER_Y(sb); break; default: assert(0); @@ -3133,8 +3133,8 @@ * is where we're utlimately headed on this path. However, it * must reside in the plane as well as the via area too. */ - nextpoint.X = CENTER_X(path->sbox); - nextpoint.Y = CENTER_Y(path->sbox); + nextpoint.X = PCB_BOX_CENTER_X(path->sbox); + nextpoint.Y = PCB_BOX_CENTER_Y(path->sbox); if (path->parent.expansion_area->flags.is_via) { TargetPoint(&nextpoint, rb_source(path)); /* nextpoint is the middle of the source terminal now */ @@ -3152,8 +3152,8 @@ } else { /* start from best place of target box */ - lastpoint.X = CENTER_X(target->sbox); - lastpoint.Y = CENTER_Y(target->sbox); + lastpoint.X = PCB_BOX_CENTER_X(target->sbox); + lastpoint.Y = PCB_BOX_CENTER_Y(target->sbox); TargetPoint(&lastpoint, target); if (AutoRouteParameters.last_smooth && box_in_box(&path->sbox, &target->sbox)) path = path->parent.expansion_area; @@ -3659,8 +3659,8 @@ /* may expand in all directions from source; center edge cost point. */ /* note that planes shouldn't really expand, but we need an edge */ - cp.X = CENTER_X(b); - cp.Y = CENTER_Y(b); + cp.X = PCB_BOX_CENTER_X(b); + cp.Y = PCB_BOX_CENTER_Y(b); e = CreateEdge(p, cp.X, cp.Y, 0, NULL, ALL, targets); cp = closest_point_in_box(&cp, &e->minpcb_cost_target->sbox); cp = closest_point_in_box(&cp, &b); @@ -3889,22 +3889,22 @@ switch (e->rb->came_from) { case NORTH: b.Y2 = b.Y1 + 1; - b.X1 = CENTER_X(b); + b.X1 = PCB_BOX_CENTER_X(b); b.X2 = b.X1 + 1; break; case EAST: b.X1 = b.X2 - 1; - b.Y1 = CENTER_Y(b); + b.Y1 = PCB_BOX_CENTER_Y(b); b.Y2 = b.Y1 + 1; break; case SOUTH: b.Y1 = b.Y2 - 1; - b.X1 = CENTER_X(b); + b.X1 = PCB_BOX_CENTER_X(b); b.X2 = b.X1 + 1; break; case WEST: b.X2 = b.X1 + 1; - b.Y1 = CENTER_Y(b); + b.Y1 = PCB_BOX_CENTER_Y(b); b.Y2 = b.Y1 + 1; break; default: