pcb 4.1.1
An interactive printed circuit board layout editor.

move.h

Go to the documentation of this file.
00001 
00035 #ifndef PCB_MOVE_H
00036 #define PCB_MOVE_H
00037 
00038 #include "global.h"
00039 
00040 /* ---------------------------------------------------------------------------
00041  * some useful transformation macros and constants
00042  */
00043 #define MOVE(xs,ys,deltax,deltay)                                                       \
00044         {                                                                                                               \
00045                 ((xs) += (deltax));                                                                     \
00046                 ((ys) += (deltay));                                                                     \
00047         }
00048 #define MOVE_BOX_LOWLEVEL(b,dx,dy)              \
00049         {                                                                       \
00050                 MOVE((b)->X1,(b)->Y1,(dx),(dy)) \
00051                 MOVE((b)->X2,(b)->Y2,(dx),(dy)) \
00052         }
00053 #define MOVE_VIA_LOWLEVEL(v,dx,dy) \
00054         { \
00055                 MOVE((v)->X,(v)->Y,(dx),(dy)) \
00056                 MOVE_BOX_LOWLEVEL(&((v)->BoundingBox),(dx),(dy));               \
00057         }
00058 #define MOVE_PIN_LOWLEVEL(p,dx,dy) \
00059         { \
00060                 MOVE((p)->X,(p)->Y,(dx),(dy)) \
00061                 MOVE_BOX_LOWLEVEL(&((p)->BoundingBox),(dx),(dy));               \
00062         }
00063 
00064 #define MOVE_ARC_LOWLEVEL(a,dx,dy) \
00065         { \
00066                 MOVE((a)->X,(a)->Y,(dx),(dy)) \
00067                 MOVE_BOX_LOWLEVEL(&((a)->BoundingBox),(dx),(dy));               \
00068                 MOVE((a)->Point1.X,(a)->Point1.Y,(dx),(dy))                     \
00069                 MOVE((a)->Point2.X,(a)->Point2.Y,(dx),(dy))                     \
00070         }
00071 /* Rather than mode the line bounding box, we set it so the point bounding
00072  * boxes are updated too.
00073  */
00074 #define MOVE_LINE_LOWLEVEL(l,dx,dy)                                                     \
00075         {                                                                       \
00076                 MOVE((l)->Point1.X,(l)->Point1.Y,(dx),(dy))                     \
00077                 MOVE((l)->Point2.X,(l)->Point2.Y,(dx),(dy))                     \
00078                 SetLineBoundingBox ((l)); \
00079         }
00080 #define MOVE_PAD_LOWLEVEL(p,dx,dy)      \
00081         {                                                                       \
00082                 MOVE((p)->Point1.X,(p)->Point1.Y,(dx),(dy))                     \
00083                 MOVE((p)->Point2.X,(p)->Point2.Y,(dx),(dy))                     \
00084                 SetPadBoundingBox ((p)); \
00085         }
00086 #define MOVE_TEXT_LOWLEVEL(t,dx,dy)                                                             \
00087         {                                                                                                                       \
00088                 MOVE_BOX_LOWLEVEL(&((t)->BoundingBox),(dx),(dy));               \
00089                 MOVE((t)->X, (t)->Y, (dx), (dy));                                               \
00090         }
00091 
00092 #define MOVE_TYPES      \
00093         (VIA_TYPE | LINE_TYPE | TEXT_TYPE | ELEMENT_TYPE | ELEMENTNAME_TYPE |   \
00094         POLYGON_TYPE | POLYGONPOINT_TYPE | LINEPOINT_TYPE | ARC_TYPE)
00095 #define MOVETOLAYER_TYPES       \
00096         (LINE_TYPE | TEXT_TYPE | POLYGON_TYPE | RATLINE_TYPE | ARC_TYPE)
00097 
00098 
00099 /* ---------------------------------------------------------------------------
00100  * prototypes
00101  */
00102 void MovePolygonLowLevel (PolygonType *, Coord, Coord);
00103 void MoveElementLowLevel (DataType *, ElementType *, Coord, Coord);
00104 void *MoveObject (int, void *, void *, void *, Coord, Coord);
00105 void *MoveObjectToLayer (int, void *, void *, void *, LayerType *, bool);
00106 void *MoveObjectAndRubberband (int, void *, void *, void *,
00107                                Coord, Coord);
00108 bool MoveSelectedObjectsToLayer (LayerType *);
00109 
00110 int MoveLayer(int old_index, int new_index);
00111 
00112 #endif