Introduce POLYGONHOLE_MODE for creating holes in polygons
[geda-pcb/gde.git] / src / mirror.c
blob7ef7d4149e2a0722dc49fa65f406f1b69f1472ec
1 /* $Id$ */
3 /*
4 * COPYRIGHT
6 * PCB, interactive printed circuit board design
7 * Copyright (C) 1994,1995,1996 Thomas Nau
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 * Contact addresses for paper mail and Email:
24 * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
25 * Thomas.Nau@rz.uni-ulm.de
30 /* functions used to change the mirror flag of an object
32 * an undo operation is not implemented because it's easy to
33 * recover an object
36 #ifdef HAVE_CONFIG_H
37 #include "config.h"
38 #endif
40 #include <stdlib.h>
42 #include "global.h"
44 #include "data.h"
45 #include "draw.h"
46 #include "mirror.h"
47 #include "misc.h"
48 #include "polygon.h"
49 #include "search.h"
50 #include "select.h"
51 #include "set.h"
53 #ifdef HAVE_LIBDMALLOC
54 #include <dmalloc.h>
55 #endif
57 RCSID ("$Id$");
62 /* ---------------------------------------------------------------------------
63 * mirrors the coordinates of an element
64 * an additional offset is passed
66 void
67 MirrorElementCoordinates (DataTypePtr Data, ElementTypePtr Element,
68 LocationType yoff)
70 r_delete_element (Data, Element);
71 ELEMENTLINE_LOOP (Element);
73 line->Point1.X = SWAP_X (line->Point1.X);
74 line->Point1.Y = SWAP_Y (line->Point1.Y) + yoff;
75 line->Point2.X = SWAP_X (line->Point2.X);
76 line->Point2.Y = SWAP_Y (line->Point2.Y) + yoff;
78 END_LOOP;
79 PIN_LOOP (Element);
81 RestoreToPolygon (Data, PIN_TYPE, Element, pin);
82 pin->X = SWAP_X (pin->X);
83 pin->Y = SWAP_Y (pin->Y) + yoff;
85 END_LOOP;
86 PAD_LOOP (Element);
88 RestoreToPolygon (Data, PAD_TYPE, Element, pad);
89 pad->Point1.X = SWAP_X (pad->Point1.X);
90 pad->Point1.Y = SWAP_Y (pad->Point1.Y) + yoff;
91 pad->Point2.X = SWAP_X (pad->Point2.X);
92 pad->Point2.Y = SWAP_Y (pad->Point2.Y) + yoff;
93 TOGGLE_FLAG (ONSOLDERFLAG, pad);
95 END_LOOP;
96 ARC_LOOP (Element);
98 arc->X = SWAP_X (arc->X);
99 arc->Y = SWAP_Y (arc->Y) + yoff;
100 arc->StartAngle = SWAP_ANGLE (arc->StartAngle);
101 arc->Delta = SWAP_DELTA (arc->Delta);
103 END_LOOP;
104 ELEMENTTEXT_LOOP (Element);
106 text->X = SWAP_X (text->X);
107 text->Y = SWAP_Y (text->Y) + yoff;
108 TOGGLE_FLAG (ONSOLDERFLAG, text);
110 END_LOOP;
111 Element->MarkX = SWAP_X (Element->MarkX);
112 Element->MarkY = SWAP_Y (Element->MarkY) + yoff;
114 /* now toggle the solder-side flag */
115 TOGGLE_FLAG (ONSOLDERFLAG, Element);
116 /* this inserts all of the rtree data too */
117 SetElementBoundingBox (Data, Element, &PCB->Font);
118 ClearFromPolygon (Data, ELEMENT_TYPE, Element, Element);