Add support for filling / thindrawing raw polygons to the HID interface
[geda-pcb/gde.git] / src / const.h
blob2f97d4ea6c6d629a1336366b878519f132d9af5f
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 /* global source constants
31 #ifndef __CONST_INCLUDED__
32 #define __CONST_INCLUDED__
34 #include <limits.h>
35 #include <math.h>
37 #include "globalconst.h"
39 /* ---------------------------------------------------------------------------
40 * the layer-numbers of the two additional special layers
41 * 'component' and 'solder'. The offset of MAX_LAYER is not added
43 #define SOLDER_LAYER 0
44 #define COMPONENT_LAYER 1
46 /* ---------------------------------------------------------------------------
47 * misc constants
49 #define MARK_SIZE 5000 /* relative marker size */
50 #define UNDO_WARNING_SIZE (1024*1024) /* warning limit of undo */
51 #define USERMEDIANAME "user defined" /* label of default media */
53 /* ---------------------------------------------------------------------------
54 * some math constants
56 #ifndef M_PI
57 #define M_PI 3.14159265358979323846
58 #endif
59 #ifndef M_SQRT1_2
60 #define M_SQRT1_2 0.707106781 /* 1/sqrt(2) */
61 #endif
62 #define M180 (M_PI/180.0)
63 #define RAD_TO_DEG (180.0/M_PI)
64 #define TAN_22_5_DEGREE_2 0.207106781 /* 0.5*tan(22.5) */
65 #define COS_22_5_DEGREE 0.923879533 /* cos(22.5) */
66 #define TAN_30_DEGREE 0.577350269 /* tan(30) */
67 #define TAN_60_DEGREE 1.732050808 /* tan(60) */
68 #define MIL_TO_MM 0.025400000
69 #define MM_TO_MIL 39.37007874
70 #define COOR_TO_MM 0.000254000
71 #define MM_TO_COOR 3937.007874
72 #define LN_2_OVER_2 0.346573590
74 /* ---------------------------------------------------------------------------
75 * modes
77 #define NO_MODE 0 /* no mode selected */
78 #define VIA_MODE 1 /* draw vias */
79 #define LINE_MODE 2 /* draw lines */
80 #define RECTANGLE_MODE 3 /* create rectangles */
81 #define POLYGON_MODE 4 /* draw filled polygons */
82 #define PASTEBUFFER_MODE 5 /* paste objects from buffer */
83 #define TEXT_MODE 6 /* create text objects */
84 #define ROTATE_MODE 102 /* rotate objects */
85 #define REMOVE_MODE 103 /* remove objects */
86 #define MOVE_MODE 104 /* move objects */
87 #define COPY_MODE 105 /* copy objects */
88 #define INSERTPOINT_MODE 106 /* insert point into line/polygon */
89 #define RUBBERBANDMOVE_MODE 107 /* move objects and attached lines */
90 #define THERMAL_MODE 108 /* toggle thermal layer flag */
91 #define ARC_MODE 109 /* draw arcs */
92 #define ARROW_MODE 110 /* selection with arrow mode */
93 #define PAN_MODE 0 /* same as no mode */
94 #define LOCK_MODE 111 /* lock/unlock objects */
96 /* ---------------------------------------------------------------------------
97 * object flags
100 /* %start-doc pcbfile ~objectflags
101 @node Object Flags
102 @section Object Flags
104 Note that object flags can be given numerically (like @code{0x0147})
105 or symbolically (like @code{"found,showname,square"}. Some numeric
106 values are reused for different object types. The table below lists
107 the numeric value followed by the symbolic name.
109 @table @code
110 @item 0x0001 pin
111 If set, this object is a pin. This flag is for internal use only.
112 @item 0x0002 via
113 Likewise, for vias.
114 @item 0x0004 found
115 If set, this object has been found by @code{FindConnection()}.
116 @item 0x0008 hole
117 For pins and vias, this flag means that the pin or via is a hole
118 without a copper annulus.
119 @item 0x0010 rat
120 If set for a line, indicates that this line is a rat line instead of a
121 copper trace.
122 @item 0x0010 pininpoly
123 For pins and pads, this flag is used internally to indicate that the
124 pin or pad overlaps a polygon on some layer.
125 @item 0x0010 clearpoly
126 For polygons, this flag means that pins and vias will normally clear
127 these polygons (thus, thermals are required for electrical
128 connection). When clear, polygons will solidly connect to pins and
129 vias.
130 @item 0x0010 hidename
131 For elements, when set the name of the element is hidden.
132 @item 0x0020 showname
133 For elements, when set the names of pins are shown.
134 @item 0x0020 clearline
135 For lines and arcs, the line/arc will clear polygons instead of
136 connecting to them.
137 @item 0x0020 fullpoly
138 For polygons, the full polygon is drawn (i.e. all parts instead of only the biggest one).
139 @item 0x0040 selected
140 Set when the object is selected.
141 @item 0x0080 onsolder
142 For elements and pads, indicates that they are on the solder side.
143 @item 0x0080 auto
144 For lines and vias, indicates that these were created by the
145 autorouter.
146 @item 0x0100 square
147 For pins and pads, indicates a square (vs round) pin/pad.
148 @item 0x0200 rubberend
149 For lines, used internally for rubber band moves.
150 @item 0x0200 warn
151 For pins, vias, and pads, set to indicate a warning.
152 @item 0x0400 usetherm
153 Obsolete, indicates that pins/vias should be drawn with thermal
154 fingers.
155 @item 0x0400
156 Obsolete, old files used this to indicate lines drawn on silk.
157 @item 0x0800 octagon
158 Draw pins and vias as octagons.
159 @item 0x1000 drc
160 Set for objects that fail DRC.
161 @item 0x2000 lock
162 Set for locked objects.
163 @item 0x4000 edge2
164 For pads, indicates that the second point is closer to the edge. For
165 pins, indicates that the pin is closer to a horizontal edge and thus
166 pinout text should be vertical.
167 @item 0x8000 marker
168 Marker used internally to avoid revisiting an object.
169 @item 0x10000 nopaste
170 For pads, set to prevent a solderpaste stencil opening for the
171 pad. Primarily used for pads used as fiducials.
172 @end table
173 %end-doc */
175 #define NOFLAG 0x0000
176 #define PINFLAG 0x0001 /* is a pin */
177 #define VIAFLAG 0x0002 /* is a via */
178 #define FOUNDFLAG 0x0004 /* used by 'FindConnection()' */
179 #define HOLEFLAG 0x0008 /* pin or via is only a hole */
180 #define NOPASTEFLAG 0x0008 /* pad should not receive
181 solderpaste. This is to
182 support fiducials */
183 #define RATFLAG 0x0010 /* indicates line is a rat line */
184 #define PININPOLYFLAG 0x0010 /* pin found inside poly - same as */
185 /* rat line since not used on lines */
186 #define CLEARPOLYFLAG 0x0010 /* pins/vias clear these polygons */
187 #define HIDENAMEFLAG 0x0010 /* hide the element name */
188 #define DISPLAYNAMEFLAG 0x0020 /* display the names of pins/pads */
189 /* of an element */
190 #define CLEARLINEFLAG 0x0020 /* line doesn't touch polygons */
191 #define FULLPOLYFLAG 0x0020 /* full polygon is drawn (i.e. all parts instead of only the biggest one) */
192 #define SELECTEDFLAG 0x0040 /* object has been selected */
193 #define ONSOLDERFLAG 0x0080 /* element is on bottom side */
194 #define AUTOFLAG 0x0080 /* line/via created by auto-router */
195 #define SQUAREFLAG 0x0100 /* pin is square, not round */
196 #define RUBBERENDFLAG 0x0200 /* indicates one end already rubber */
197 /* banding same as warn flag */
198 /* since pins/pads won't use it */
199 #define WARNFLAG 0x0200 /* Warning for pin/via/pad */
200 #define USETHERMALFLAG 0x0400 /* draw pin, via with thermal fingers */
201 #define ONSILKFLAG 0x0400 /* old files use this to indicate silk */
202 #define OCTAGONFLAG 0x0800 /* draw pin/via as octagon instead of round */
203 #define DRCFLAG 0x1000 /* flag like FOUND flag for DRC checking */
204 #define LOCKFLAG 0x2000 /* object locked in place */
205 #define EDGE2FLAG 0x4000 /* Padr.Point2 is closer to outside edge */
206 /* also pinout text for pins is vertical */
207 #define VISITFLAG 0x8000 /* marker to avoid re-visiting an object */
208 /* ---------------------------------------------------------------------------
209 * PCB flags
212 /* %start-doc pcbfile ~pcbflags
213 @node PCBFlags
214 @section PCBFlags
215 @table @code
216 @item 0x00001
217 Pinout displays pin numbers instead of pin names.
218 @item 0x00002
219 Use local reference for moves, by setting the mark at the beginning of
220 each move.
221 @item 0x00004
222 When set, only polygons and their clearances are drawn, to see if
223 polygons have isolated regions.
224 @item 0x00008
225 Display DRC region on crosshair.
226 @item 0x00010
227 Do all move, mirror, rotate with rubberband connections.
228 @item 0x00020
229 Display descriptions of elements, instead of refdes.
230 @item 0x00040
231 Display names of elements, instead of refdes.
232 @item 0x00080
233 Auto-DRC flag. When set, PCB doesn't let you place copper that
234 violates DRC.
235 @item 0x00100
236 Enable 'all-direction' lines.
237 @item 0x00200
238 Switch starting angle after each click.
239 @item 0x00400
240 Force unique names on board.
241 @item 0x00800
242 New lines/arc clear polygons.
243 @item 0x01000
244 Crosshair snaps to pins and pads.
245 @item 0x02000
246 Show the solder mask layer.
247 @item 0x04000
248 Draw with thin lines.
249 @item 0x08000
250 Move items orthogonally.
251 @item 0x10000
252 Draw autoroute paths real-time.
253 @item 0x20000
254 New polygons are full ones.
255 @item 0x40000
256 Names are locked, the mouse cannot select them.
257 @item 0x80000
258 Everything but names are locked, the mouse cannot select anything else.
259 @item 0x100000
260 New polygons are full polygons.
261 @item 0x200000
262 When set, element names are not drawn.
263 @end table
264 %end-doc */
266 #define PCB_FLAGS 0x000fffff /* all used flags */
268 #define SHOWNUMBERFLAG 0x00000001
269 #define LOCALREFFLAG 0x00000002
270 #define CHECKPLANESFLAG 0x00000004
271 #define SHOWDRCFLAG 0x00000008
272 #define RUBBERBANDFLAG 0x00000010
273 #define DESCRIPTIONFLAG 0x00000020
274 #define NAMEONPCBFLAG 0x00000040
275 #define AUTODRCFLAG 0x00000080
276 #define ALLDIRECTIONFLAG 0x00000100
277 #define SWAPSTARTDIRFLAG 0x00000200
278 #define UNIQUENAMEFLAG 0x00000400
279 #define CLEARNEWFLAG 0x00000800
280 #define SNAPPINFLAG 0x00001000
281 #define SHOWMASKFLAG 0x00002000
282 #define THINDRAWFLAG 0x00004000
283 #define ORTHOMOVEFLAG 0x00008000
284 #define LIVEROUTEFLAG 0x00010000
285 #define THINDRAWPOLYFLAG 0x00020000
286 #define LOCKNAMESFLAG 0x00040000
287 #define ONLYNAMESFLAG 0x00080000
288 #define NEWFULLPOLYFLAG 0x00100000
289 #define HIDENAMESFLAG 0x00200000
291 /* ---------------------------------------------------------------------------
292 * object types
294 #define NO_TYPE 0x00000 /* no object */
295 #define VIA_TYPE 0x00001
296 #define ELEMENT_TYPE 0x00002
297 #define LINE_TYPE 0x00004
298 #define POLYGON_TYPE 0x00008
299 #define TEXT_TYPE 0x00010
300 #define RATLINE_TYPE 0x00020
302 #define PIN_TYPE 0x00100 /* objects that are part */
303 #define PAD_TYPE 0x00200 /* 'pin' of SMD element */
304 #define ELEMENTNAME_TYPE 0x00400 /* of others */
305 #define POLYGONPOINT_TYPE 0x00800
306 #define LINEPOINT_TYPE 0x01000
307 #define ELEMENTLINE_TYPE 0x02000
308 #define ARC_TYPE 0x04000
309 #define ELEMENTARC_TYPE 0x08000
311 #define LOCKED_TYPE 0x10000 /* used to tell search to include locked items. */
313 #define PIN_TYPES (VIA_TYPE | PIN_TYPE)
314 #define LOCK_TYPES (VIA_TYPE | LINE_TYPE | ARC_TYPE | POLYGON_TYPE | ELEMENT_TYPE \
315 | TEXT_TYPE | ELEMENTNAME_TYPE | LOCKED_TYPE)
317 #define ALL_TYPES (~0) /* all bits set */
319 #endif