Introduce POLYGONHOLE_MODE for creating holes in polygons
[geda-pcb/gde.git] / src / move.h
blobc4a844bf7a6c64e05e7855f40efc96a82feca276
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
25 * RCS: $Id$
28 /* prototypes for move routines
31 #ifndef __MOVE_INCLUDED__
32 #define __MOVE_INCLUDED__
34 #include "global.h"
36 /* ---------------------------------------------------------------------------
37 * some useful transformation macros and constants
39 #define MOVE(xs,ys,deltax,deltay) \
40 { \
41 ((xs) += (deltax)); \
42 ((ys) += (deltay)); \
44 #define MOVE_BOX_LOWLEVEL(b,dx,dy) \
45 { \
46 MOVE((b)->X1,(b)->Y1,(dx),(dy)) \
47 MOVE((b)->X2,(b)->Y2,(dx),(dy)) \
49 #define MOVE_VIA_LOWLEVEL(v,dx,dy) \
50 { \
51 MOVE((v)->X,(v)->Y,(dx),(dy)) \
52 MOVE_BOX_LOWLEVEL(&((v)->BoundingBox),(dx),(dy)); \
54 #define MOVE_PIN_LOWLEVEL(p,dx,dy) \
55 { \
56 MOVE((p)->X,(p)->Y,(dx),(dy)) \
57 MOVE_BOX_LOWLEVEL(&((p)->BoundingBox),(dx),(dy)); \
60 #define MOVE_ARC_LOWLEVEL(a,dx,dy) \
61 { \
62 MOVE((a)->X,(a)->Y,(dx),(dy)) \
63 MOVE_BOX_LOWLEVEL(&((a)->BoundingBox),(dx),(dy)); \
65 /* Rather than mode the line bounding box, we set it so the point bounding
66 * boxes are updated too.
68 #define MOVE_LINE_LOWLEVEL(l,dx,dy) \
69 { \
70 MOVE((l)->Point1.X,(l)->Point1.Y,(dx),(dy)) \
71 MOVE((l)->Point2.X,(l)->Point2.Y,(dx),(dy)) \
72 SetLineBoundingBox ((l)); \
74 #define MOVE_PAD_LOWLEVEL(p,dx,dy) \
75 { \
76 MOVE((p)->Point1.X,(p)->Point1.Y,(dx),(dy)) \
77 MOVE((p)->Point2.X,(p)->Point2.Y,(dx),(dy)) \
78 SetPadBoundingBox ((p)); \
80 #define MOVE_TEXT_LOWLEVEL(t,dx,dy) \
81 { \
82 MOVE_BOX_LOWLEVEL(&((t)->BoundingBox),(dx),(dy)); \
83 MOVE((t)->X, (t)->Y, (dx), (dy)); \
86 #define MOVE_TYPES \
87 (VIA_TYPE | LINE_TYPE | TEXT_TYPE | ELEMENT_TYPE | ELEMENTNAME_TYPE | \
88 POLYGON_TYPE | POLYGONPOINT_TYPE | LINEPOINT_TYPE | ARC_TYPE)
89 #define MOVETOLAYER_TYPES \
90 (LINE_TYPE | TEXT_TYPE | POLYGON_TYPE | RATLINE_TYPE | ARC_TYPE)
93 /* ---------------------------------------------------------------------------
94 * prototypes
96 void MovePolygonLowLevel (PolygonTypePtr, LocationType, LocationType);
97 void MoveElementLowLevel (DataTypePtr, ElementTypePtr, LocationType,
98 LocationType);
99 void *MoveObject (int, void *, void *, void *, LocationType, LocationType);
100 void *MoveObjectToLayer (int, void *, void *, void *, LayerTypePtr, bool);
101 void *MoveObjectAndRubberband (int, void *, void *, void *,
102 LocationType, LocationType);
103 void *MoveLineToLayerLowLevel (LayerTypePtr, LineTypePtr, LayerTypePtr);
104 void *MoveTextToLayerLowLevel (LayerTypePtr, TextTypePtr, LayerTypePtr);
105 void *MovePolygonToLayerLowLevel (LayerTypePtr, PolygonTypePtr, LayerTypePtr);
106 bool MoveSelectedObjectsToLayer (LayerTypePtr);
108 /* index is 0..MAX_LAYER-1. If old_index is -1, a new layer is
109 inserted at that index. If new_index is -1, the specified layer is
110 deleted. Returns non-zero on error, zero if OK. */
111 int MoveLayer(int old_index, int new_index);
113 #endif