(no commit message)
[geda-pcb/pcjc2.git] / src / move.h
blobf91602efee9991578f7473ed3e515f8e938106fb
1 /*
2 * COPYRIGHT
4 * PCB, interactive printed circuit board design
5 * Copyright (C) 1994,1995,1996 Thomas Nau
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * Contact addresses for paper mail and Email:
22 * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
23 * Thomas.Nau@rz.uni-ulm.de
27 /* prototypes for move routines
30 #ifndef PCB_MOVE_H
31 #define PCB_MOVE_H
33 #include "global.h"
35 /* ---------------------------------------------------------------------------
36 * some useful transformation macros and constants
38 #define MOVE(xs,ys,deltax,deltay) \
39 { \
40 ((xs) += (deltax)); \
41 ((ys) += (deltay)); \
43 #define MOVE_BOX_LOWLEVEL(b,dx,dy) \
44 { \
45 MOVE((b)->X1,(b)->Y1,(dx),(dy)) \
46 MOVE((b)->X2,(b)->Y2,(dx),(dy)) \
48 #define MOVE_VIA_LOWLEVEL(v,dx,dy) \
49 { \
50 MOVE((v)->X,(v)->Y,(dx),(dy)) \
51 MOVE_BOX_LOWLEVEL(&((v)->BoundingBox),(dx),(dy)); \
53 #define MOVE_PIN_LOWLEVEL(p,dx,dy) \
54 { \
55 MOVE((p)->X,(p)->Y,(dx),(dy)) \
56 MOVE_BOX_LOWLEVEL(&((p)->BoundingBox),(dx),(dy)); \
59 #define MOVE_ARC_LOWLEVEL(a,dx,dy) \
60 { \
61 MOVE((a)->X,(a)->Y,(dx),(dy)) \
62 MOVE_BOX_LOWLEVEL(&((a)->BoundingBox),(dx),(dy)); \
63 MOVE((a)->Point1.X,(a)->Point1.Y,(dx),(dy)) \
64 MOVE((a)->Point2.X,(a)->Point2.Y,(dx),(dy)) \
66 /* Rather than mode the line bounding box, we set it so the point bounding
67 * boxes are updated too.
69 #define MOVE_LINE_LOWLEVEL(l,dx,dy) \
70 { \
71 MOVE((l)->Point1.X,(l)->Point1.Y,(dx),(dy)) \
72 MOVE((l)->Point2.X,(l)->Point2.Y,(dx),(dy)) \
73 SetLineBoundingBox ((l)); \
75 #define MOVE_PAD_LOWLEVEL(p,dx,dy) \
76 { \
77 MOVE((p)->Point1.X,(p)->Point1.Y,(dx),(dy)) \
78 MOVE((p)->Point2.X,(p)->Point2.Y,(dx),(dy)) \
79 SetPadBoundingBox ((p)); \
81 #define MOVE_TEXT_LOWLEVEL(t,dx,dy) \
82 { \
83 MOVE_BOX_LOWLEVEL(&((t)->BoundingBox),(dx),(dy)); \
84 MOVE((t)->X, (t)->Y, (dx), (dy)); \
87 #define MOVE_TYPES \
88 (VIA_TYPE | LINE_TYPE | TEXT_TYPE | ELEMENT_TYPE | ELEMENTNAME_TYPE | \
89 POLYGON_TYPE | POLYGONPOINT_TYPE | LINEPOINT_TYPE | ARC_TYPE)
90 #define MOVETOLAYER_TYPES \
91 (LINE_TYPE | TEXT_TYPE | POLYGON_TYPE | RATLINE_TYPE | ARC_TYPE)
94 /* ---------------------------------------------------------------------------
95 * prototypes
97 void MovePolygonLowLevel (PolygonType *, Coord, Coord);
98 void MoveElementLowLevel (DataType *, ElementType *, Coord, Coord);
99 void *MoveObject (int, void *, void *, void *, Coord, Coord);
100 void *MoveObjectToLayer (int, void *, void *, void *, LayerType *, bool);
101 void *MoveObjectAndRubberband (int, void *, void *, void *,
102 Coord, Coord);
103 bool MoveSelectedObjectsToLayer (LayerType *);
105 /* index is 0..MAX_LAYER-1. If old_index is -1, a new layer is
106 inserted at that index. If new_index is -1, the specified layer is
107 deleted. Returns non-zero on error, zero if OK. */
108 int MoveLayer(int old_index, int new_index);
110 #endif