Introduce POLYGONHOLE_MODE for creating holes in polygons
[geda-pcb/gde.git] / src / global.h
blobbb78abc48cfab39533084e31c34127a4e2595b17
1 /*
2 * COPYRIGHT
4 * PCB, interactive printed circuit board design
5 * Copyright (C) 1994,1995,1996, 2004 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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$
27 /* 15 Oct 2008 Ineiev: add different crosshair shapes */
29 /* definition of types
32 /* Change History:
33 * 10/11/96 11:37 AJF Added support for a Text() driver function.
34 * This was done out of a pressing need to force text to be printed on the
35 * silkscreen layer. Perhaps the design is not the best.
38 #ifndef __GLOBAL_INCLUDED__
39 #define __GLOBAL_INCLUDED__
41 #include "const.h"
42 #include "macro.h"
44 #include <stdio.h>
45 #include <stdlib.h>
46 #include <string.h>
47 #include <strings.h>
48 #include <stdarg.h>
49 #include <math.h>
50 #include <ctype.h>
51 #include <sys/types.h>
52 #include <stdbool.h>
54 /* Forward declarations for structures the HIDs need. */
55 typedef struct BoxType BoxType, *BoxTypePtr;
56 typedef struct polygon_st PolygonType, *PolygonTypePtr;
57 typedef struct drc_violation_st DrcViolationType, *DrcViolationTypePtr;
58 typedef struct rtree rtree_t;
59 typedef struct AttributeListType AttributeListType, *AttributeListTypePtr;
61 #include "hid.h"
62 #include "polyarea.h"
64 /* Internationalization support. */
65 #ifdef ENABLE_NLS
66 # include <libintl.h>
67 # define _(S) gettext(S)
68 # if defined(gettext_noop)
69 # define N_(S) gettext_noop(S)
70 # else
71 # define N_(S) (S)
72 # endif
73 #else
74 # define _(S) (S)
75 # define N_(S) (S)
76 # define textdomain(S) (S)
77 # define gettext(S) (S)
78 # define dgettext(D, S) (S)
79 # define dcgettext(D, S, T) (S)
80 # define bindtextdomain(D, Dir) (D)
81 #endif /* ENABLE_NLS */
83 typedef int LocationType;
84 typedef int BDimension; /* big dimension */
87 #ifndef XtSpecificationRelease
88 typedef unsigned int Cardinal;
89 /*typedef unsigned int Pixel;*/
90 typedef char *String;
91 typedef short Position;
92 typedef short Dimension;
93 #endif
94 typedef unsigned char BYTE;
96 /* Nobody should know about the internals of this except the macros in
97 macros.h that access it. This structure must be simple-assignable
98 for now. */
99 typedef struct
101 unsigned long f; /* generic flags */
102 unsigned char t[(MAX_LAYER + 1) / 2]; /* thermals */
103 } FlagType, *FlagTypePtr;
105 #ifndef __GNUC__
106 #define __FUNCTION1(a,b) a ":" #b
107 #define __FUNCTION2(a,b) __FUNCTION1(a,b)
108 #define __FUNCTION__ __FUNCTION2(__FILE__,__LINE__)
109 #endif
112 /* ---------------------------------------------------------------------------
113 * Macros to annotate branch-prediction information.
114 * Taken from GLib 2.16.3 (LGPL 2).G_ / g_ prefixes have
115 * been removed to avoid namespace clashes.
118 /* The LIKELY and UNLIKELY macros let the programmer give hints to
119 * the compiler about the expected result of an expression. Some compilers
120 * can use this information for optimizations.
122 * The _BOOLEAN_EXPR macro is intended to trigger a gcc warning when
123 * putting assignments inside the test.
125 #if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
126 #define _BOOLEAN_EXPR(expr) \
127 __extension__ ({ \
128 int _boolean_var_; \
129 if (expr) \
130 _boolean_var_ = 1; \
131 else \
132 _boolean_var_ = 0; \
133 _boolean_var_; \
135 #define LIKELY(expr) (__builtin_expect (_BOOLEAN_EXPR(expr), 1))
136 #define UNLIKELY(expr) (__builtin_expect (_BOOLEAN_EXPR(expr), 0))
137 #else
138 #define LIKELY(expr) (expr)
139 #define UNLIKELY(expr) (expr)
140 #endif
143 /* ---------------------------------------------------------------------------
144 * Do not change the following definitions even if they're not very
145 * nice. It allows us to have functions act on these "base types" and
146 * not need to know what kind of actual object they're working on.
149 /* Any object that uses the "object flags" defined in const.h, or
150 exists as an object on the pcb, MUST be defined using this as the
151 first fields, either directly or through ANYLINEFIELDS. */
152 #define ANYOBJECTFIELDS \
153 BoxType BoundingBox; \
154 long int ID; \
155 FlagType Flags; \
156 struct LibraryEntryType *net
158 /* Lines, pads, and rats all use this so they can be cross-cast. */
159 #define ANYLINEFIELDS \
160 ANYOBJECTFIELDS; \
161 BDimension Thickness, \
162 Clearance; \
163 PointType Point1, \
164 Point2
166 /* ---------------------------------------------------------------------------
167 * some useful values of our widgets
169 typedef struct /* holds information about output window */
171 hidGC bgGC, /* background and foreground; */
172 fgGC, /* changed from some routines */
173 pmGC, /* depth 1 pixmap GC to store clip */
174 GridGC; /* for the grid */
176 int Width, /* sizes of output window (porthole) */
177 Height;
178 int oldObjState, /* Helpers for GetLocation */
179 oldLineState, oldBoxState;
181 OutputType, *OutputTypePtr;
183 /* ----------------------------------------------------------------------
184 * layer group. A layer group identifies layers which are always switched
185 * on/off together.
187 typedef struct
189 Cardinal Number[MAX_LAYER], /* number of entries per groups */
190 Entries[MAX_LAYER][MAX_LAYER + 2];
191 } LayerGroupType, *LayerGroupTypePtr;
193 struct BoxType /* a bounding box */
195 LocationType X1, Y1; /* upper left */
196 LocationType X2, Y2; /* and lower right corner */
199 typedef struct
201 LocationType x, y;
202 int width, height;
203 } RectangleType, *RectangleTypePtr;
205 typedef struct
207 char *name;
208 char *value;
209 } AttributeType, *AttributeTypePtr;
211 struct AttributeListType
213 int Number, Max;
214 AttributeType *List;
217 /* ---------------------------------------------------------------------------
218 * the basic object types supported by PCB
221 /* All on-pcb objects (elements, lines, pads, vias, rats, etc) are
222 based on this. */
223 typedef struct {
224 ANYOBJECTFIELDS;
225 } AnyObjectType, *AnyObjectTypePtr;
227 typedef struct /* a line/polygon point */
229 LocationType X, Y, X2, Y2; /* so Point type can be cast as BoxType */
230 long int ID;
231 } PointType, *PointTypePtr;
233 /* Lines, rats, pads, etc. */
234 typedef struct {
235 ANYLINEFIELDS;
236 } AnyLineObjectType, *AnyLineObjectTypePtr;
238 typedef struct /* holds information about one line */
240 ANYLINEFIELDS;
241 char *Number;
242 } LineType, *LineTypePtr;
244 typedef struct
246 ANYOBJECTFIELDS;
247 BDimension Scale; /* text scaling in percent */
248 LocationType X, Y; /* origin */
249 BYTE Direction;
250 char *TextString; /* string */
251 void *Element;
252 } TextType, *TextTypePtr;
254 struct polygon_st /* holds information about a polygon */
256 ANYOBJECTFIELDS;
257 Cardinal PointN, /* number of points in polygon */
258 PointMax; /* max number from malloc() */
259 POLYAREA *Clipped; /* the clipped region of this polygon */
260 PLINE *NoHoles; /* the polygon broken into hole-less regions */
261 int NoHolesValid; /* Is the NoHoles polygon up to date? */
262 PointTypePtr Points; /* data */
263 Cardinal *HoleIndex; /* Index of hole data within the Points array */
264 Cardinal HoleIndexN; /* number of holes in polygon */
265 Cardinal HoleIndexMax; /* max number from malloc() */
269 typedef struct /* holds information about arcs */
271 ANYOBJECTFIELDS;
272 BDimension Thickness, Clearance;
273 LocationType Width, /* length of axis */
274 Height, X, /* center coordinates */
276 long int StartAngle, /* the two limiting angles in degrees */
277 Delta;
278 } ArcType, *ArcTypePtr;
280 struct rtree
282 struct rtree_node *root;
283 int size; /* number of entries in tree */
286 typedef struct /* holds information about one layer */
288 char *Name; /* layer name */
289 Cardinal LineN, /* number of lines */
290 TextN, /* labels */
291 PolygonN, /* polygons */
292 ArcN, /* and arcs */
293 LineMax, /* max number from malloc() */
294 TextMax, PolygonMax, ArcMax;
295 LineTypePtr Line; /* pointer to additional structures */
296 TextTypePtr Text;
297 PolygonTypePtr Polygon;
298 ArcTypePtr Arc;
299 rtree_t *line_tree, *text_tree, *polygon_tree, *arc_tree;
300 bool On; /* visible flag */
301 char *Color, /* color */
302 *SelectedColor;
303 AttributeListType Attributes;
305 LayerType, *LayerTypePtr;
307 typedef struct /* a rat-line */
309 ANYLINEFIELDS;
310 Cardinal group1, group2; /* the layer group each point is on */
311 } RatType, *RatTypePtr;
313 typedef struct /* a SMD pad */
315 ANYLINEFIELDS;
316 BDimension Mask;
317 char *Name, *Number; /* 'Line' */
318 void *Element;
319 void *Spare;
320 } PadType, *PadTypePtr;
322 typedef struct
324 ANYOBJECTFIELDS;
325 BDimension Thickness, Clearance, Mask, DrillingHole;
326 LocationType X, /* center and diameter */
328 char *Name, *Number;
329 void *Element;
330 void *Spare;
331 } PinType, *PinTypePtr, **PinTypeHandle;
333 typedef struct
335 ANYOBJECTFIELDS;
336 TextType Name[MAX_ELEMENTNAMES]; /* the elements names; */
337 /* description text */
338 /* name on PCB second, */
339 /* value third */
340 /* see macro.h */
341 LocationType MarkX, /* position mark */
342 MarkY;
343 Cardinal PinN, /* number of pins, lines and arcs */
344 PinMax, PadN, PadMax, LineN, LineMax, ArcN, ArcMax;
345 PinTypePtr Pin; /* pin description */
346 PadTypePtr Pad; /* pad description of SMD components */
347 LineTypePtr Line;
348 ArcTypePtr Arc;
349 BoxType VBox;
350 AttributeListType Attributes;
351 } ElementType, *ElementTypePtr, **ElementTypeHandle;
353 /* ---------------------------------------------------------------------------
354 * symbol and font related stuff
356 typedef struct /* a single symbol */
358 LineTypePtr Line;
359 bool Valid;
360 Cardinal LineN, /* number of lines */
361 LineMax;
362 BDimension Width, /* size of cell */
363 Height, Delta; /* distance to next symbol in 0.00001'' */
364 } SymbolType, *SymbolTypePtr;
366 typedef struct /* complete set of symbols */
368 LocationType MaxHeight, /* maximum cell width and height */
369 MaxWidth;
370 BoxType DefaultSymbol; /* the default symbol is a filled box */
371 SymbolType Symbol[MAX_FONTPOSITION + 1];
372 bool Valid;
373 } FontType, *FontTypePtr;
375 typedef struct /* holds all objects */
377 Cardinal ViaN, /* number of vias */
378 ViaMax, /* max number from malloc() */
379 ElementN, /* and elements */
380 ElementMax, /* max number from malloc() */
381 RatN, /* and rat-lines */
382 RatMax;
383 int LayerN; /* number of layers in this board */
384 PinTypePtr Via; /* pointer to object data */
385 ElementTypePtr Element;
386 RatTypePtr Rat;
387 rtree_t *via_tree, *element_tree, *pin_tree, *pad_tree, *name_tree[3], /* for element names */
388 *rat_tree;
389 struct PCBType *pcb;
390 LayerType Layer[MAX_LAYER + 2]; /* add 2 silkscreen layers */
391 } DataType, *DataTypePtr;
393 typedef struct /* holds drill information */
395 BDimension DrillSize; /* this drill's diameter */
396 Cardinal ElementN, /* the number of elements using this drill size */
397 ElementMax, /* max number of elements from malloc() */
398 PinCount, /* number of pins drilled this size */
399 ViaCount, /* number of vias drilled this size */
400 UnplatedCount, /* number of these holes that are unplated */
401 PinN, /* number of drill coordinates in the list */
402 PinMax; /* max number of coordinates from malloc() */
403 PinTypePtr *Pin; /* coordinates to drill */
404 ElementTypePtr *Element; /* a pointer to an array of element pointers */
405 } DrillType, *DrillTypePtr;
407 typedef struct /* holds a range of Drill Infos */
409 Cardinal DrillN, /* number of drill sizes */
410 DrillMax; /* max number from malloc() */
411 DrillTypePtr Drill; /* plated holes */
412 } DrillInfoType, *DrillInfoTypePtr;
414 typedef struct
416 BDimension Thick, /* line thickness */
417 Diameter, /* via diameter */
418 Hole, /* via drill hole */
419 Keepaway; /* min. separation from other nets */
420 char *Name;
421 int index;
422 } RouteStyleType, *RouteStyleTypePtr;
424 /* ---------------------------------------------------------------------------
425 * structure used by library routines
427 typedef struct
429 char *ListEntry; /* the string for the selection box */
430 char *AllocatedMemory, /* pointer to allocated memory; all others */
431 /* point to parts of the string */
432 *Template, /* m4 template name */
433 *Package, /* package */
434 *Value, /* the value field */
435 *Description; /* some descritional text */
436 } LibraryEntryType, *LibraryEntryTypePtr;
438 /* If the internal flag is set, the only field that is valid is Name,
439 and the struct is allocated with malloc instead of
440 CreateLibraryEntry. These "internal" entries are used for
441 electrical paths that aren't yet assigned to a real net. */
443 typedef struct
445 char *Name, /* name of the menu entry */
446 *directory, /* Directory name library elements are from */
447 *Style; /* routing style */
448 Cardinal EntryN, /* number of objects */
449 EntryMax; /* number of reserved memory locations */
450 LibraryEntryTypePtr Entry; /* the entries */
451 char flag; /* used by the netlist window to enable/disable nets */
452 char internal; /* if set, this is an internal-only entry, not
453 part of the global netlist. */
454 } LibraryMenuType, *LibraryMenuTypePtr;
456 typedef struct
458 Cardinal MenuN; /* number of objects */
459 Cardinal MenuMax; /* number of reserved memory locations */
460 LibraryMenuTypePtr Menu; /* the entries */
461 } LibraryType, *LibraryTypePtr;
464 /* The PCBType struct holds information about board layout most of which is
465 | saved with the layout. A new PCB layout struct is first initialized
466 | with values from the user configurable Settings struct and then reset
467 | to the saved layout values when a layout is loaded.
468 | This struct is also used for the remove list and for buffer handling
470 typedef struct PCBType
472 long ID; /* see macro.h */
473 FlagType Flags;
474 char *Name, /* name of board */
475 *Filename, /* name of file (from load) */
476 *PrintFilename, /* from print dialog */
477 *Netlistname, /* name of netlist file */
478 ThermStyle; /* type of thermal to place with thermal tool */
479 bool Changed, /* layout has been changed */
480 ViaOn, /* visibility flags */
481 ElementOn, RatOn, InvisibleObjectsOn, PinOn, SilkActive, /* active layer is actually silk */
482 RatDraw; /* we're drawing rats */
483 char *ViaColor, /* some colors */
484 *ViaSelectedColor,
485 *PinColor,
486 *PinSelectedColor,
487 *PinNameColor,
488 *ElementColor,
489 *RatColor,
490 *InvisibleObjectsColor,
491 *InvisibleMarkColor,
492 *ElementSelectedColor,
493 *RatSelectedColor, *ConnectedColor, *WarnColor, *MaskColor;
494 long CursorX, /* cursor position as saved with layout */
495 CursorY, Clipping;
496 int Bloat, /* drc sizes saved with layout */
497 Shrink, minWid, minSlk, minDrill, minRing;
498 int GridOffsetX, /* as saved with layout */
499 GridOffsetY, MaxWidth, /* allowed size */
500 MaxHeight;
502 double Grid, /* used grid with offsets */
503 Zoom, /* zoom factor */
504 IsleArea, /* minimum poly island to retain */
505 ThermScale; /* scale factor used with thermals */
506 FontType Font;
507 LayerGroupType LayerGroups;
508 RouteStyleType RouteStyle[NUM_STYLES];
509 LibraryType NetlistLib;
510 AttributeListType Attributes;
511 DataTypePtr Data; /* entire database */
513 PCBType, *PCBTypePtr;
515 typedef struct /* information about the paste buffer */
517 LocationType X, /* offset */
519 BoxType BoundingBox;
520 DataTypePtr Data; /* data; not all members of PCBType */
521 /* are used */
522 } BufferType, *BufferTypePtr;
524 /* ---------------------------------------------------------------------------
525 * some types for cursor drawing, setting of block and lines
526 * as well as for merging of elements
528 typedef struct /* rubberband lines for element moves */
530 LayerTypePtr Layer; /* layer that holds the line */
531 LineTypePtr Line; /* the line itself */
532 PointTypePtr MovedPoint; /* and finally the point */
533 } RubberbandType, *RubberbandTypePtr;
535 typedef struct /* current marked line */
537 PointType Point1, /* start- and end-position */
538 Point2;
539 long int State;
540 bool draw;
541 } AttachedLineType, *AttachedLineTypePtr;
543 typedef struct /* currently marked block */
545 PointType Point1, /* start- and end-position */
546 Point2;
547 long int State;
548 bool otherway;
549 } AttachedBoxType, *AttachedBoxTypePtr;
551 typedef struct /* currently attached object */
553 LocationType X, /* saved position when MOVE_MODE */
554 Y; /* was entered */
555 BoxType BoundingBox;
556 long int Type, /* object type */
557 State;
558 void *Ptr1, /* three pointers to data, see */
559 *Ptr2, /* search.c */
560 *Ptr3;
561 Cardinal RubberbandN, /* number of lines in array */
562 RubberbandMax;
563 RubberbandTypePtr Rubberband;
564 } AttachedObjectType, *AttachedObjectTypePtr;
566 enum crosshair_shape
568 Basic_Crosshair_Shape = 0, /* 4-ray */
569 Union_Jack_Crosshair_Shape, /* 8-ray */
570 Dozen_Crosshair_Shape, /* 12-ray */
571 Crosshair_Shapes_Number
574 typedef struct /* holds cursor information */
576 hidGC GC, /* GC for cursor drawing */
577 AttachGC; /* and for displaying buffer contents */
578 LocationType X, /* position in PCB coordinates */
579 Y, MinX, /* lowest and highest coordinates */
580 MinY, MaxX, MaxY;
581 bool On; /* flag for 'is visible' */
582 AttachedLineType AttachedLine; /* data of new lines... */
583 AttachedBoxType AttachedBox;
584 PolygonType AttachedPolygon;
585 AttachedObjectType AttachedObject; /* data of attached objects */
586 enum crosshair_shape shape; /* shape of crosshair */
587 } CrosshairType, *CrosshairTypePtr;
589 typedef struct
591 bool status;
592 long int X, Y;
593 } MarkType, *MarkTypePtr;
595 /* ---------------------------------------------------------------------------
596 * our resources
597 * most of them are used as default when a new design is started
599 typedef struct /* some resources... */
601 bool grid_units_mm;
603 int verbose;
605 char *BlackColor, *WhiteColor, *BackgroundColor, /* background and cursor color ... */
606 *CrosshairColor, /* different object colors */
607 *CrossColor,
608 *ViaColor,
609 *ViaSelectedColor,
610 *PinColor,
611 *PinSelectedColor,
612 *PinNameColor,
613 *ElementColor,
614 *RatColor,
615 *InvisibleObjectsColor,
616 *InvisibleMarkColor,
617 *ElementSelectedColor,
618 *RatSelectedColor,
619 *ConnectedColor,
620 *OffLimitColor,
621 *GridColor,
622 *LayerColor[MAX_LAYER],
623 *LayerSelectedColor[MAX_LAYER], *WarnColor, *MaskColor;
624 int ViaThickness, /* some preset values */
625 ViaDrillingHole, LineThickness, RatThickness, Keepaway, MaxWidth, /* default size of a new layout */
626 MaxHeight, TextScale, /* text scaling in % */
627 AlignmentDistance, Bloat, /* default drc sizes */
628 Shrink, minWid, minSlk, minDrill, minRing;
629 double Grid, /* grid 0.001'' */
630 IsleArea, /* polygon min area */
631 grid_increment_mm, /* key g and <shift>g value for mil units */
632 grid_increment_mil, /* key g and <shift>g value for mil units */
633 size_increment_mm, /* key s and <shift>s value for mil units */
634 size_increment_mil, /* key s and <shift>s value for mil units */
635 line_increment_mm, line_increment_mil, clear_increment_mm, clear_increment_mil, Zoom, /* number of shift operations for zooming */
636 PinoutZoom; /* same for pinout windows */
637 int PinoutNameLength, /* max displayed length of a pinname */
638 Volume, /* the speakers volume -100..100 */
639 CharPerLine, /* width of an output line in characters */
640 Mode, /* currently active mode */
641 BufferNumber, /* number of the current buffer */
642 GridFactor; /* factor used for grid-drawing */
643 int BackupInterval; /* time between two backups in seconds */
644 char *DefaultLayerName[MAX_LAYER], *FontCommand, /* commands for file loading... */
645 *FileCommand, *ElementCommand, *PrintFile, *LibraryCommandDir, *LibraryCommand, *LibraryContentsCommand, *LibraryTree, /* path to library tree */
646 *SaveCommand, *LibraryFilename, *FontFile, /* name of default font file */
647 *Groups, /* string with layergroups */
648 *Routes, /* string with route styles */
649 *FilePath, *RatPath, *RatCommand, *FontPath, *PinoutFont, *ElementPath, *LibraryPath, *Size, /* geometry string for size */
650 *Media, *MenuFile, /* file containing menu definitions */
651 *BackgroundImage, /* PPM file for board background */
652 *ScriptFilename, /* PCB Actions script to execute on startup */
653 *ActionString, /* PCB Actions string to execute on startup */
654 *FabAuthor, /* Full name of author for FAB drawings */
655 *GnetlistProgram, /* gnetlist program name */
656 *MakeProgram, /* make program name */
657 *InitialLayerStack; /* If set, the initial layer stack is set to this */
658 bool DumpMenuFile; /* dump internal menu definitions */
659 LocationType PinoutOffsetX, /* offset of origin */
660 PinoutOffsetY;
661 int PinoutTextOffsetX, /* offset of text from pin center */
662 PinoutTextOffsetY;
663 RouteStyleType RouteStyle[NUM_STYLES]; /* default routing styles */
664 LayerGroupType LayerGroups; /* default layer groups */
665 bool ClearLine, FullPoly,
666 UniqueNames, /* force unique names */
667 SnapPin, /* snap to pins and pads */
668 ShowSolderSide, /* mirror output */
669 SaveLastCommand, /* save the last command entered by user */
670 SaveInTMP, /* always save data in /tmp */
671 DrawGrid, /* draw grid points */
672 RatWarn, /* rats nest has set warnings */
673 StipplePolygons, /* draw polygons with stipple */
674 AllDirectionLines, /* enable lines to all directions */
675 RubberBandMode, /* move, rotate use rubberband connections */
676 SwapStartDirection, /* change starting direction after each click */
677 ShowDRC, /* show drc region on crosshair */
678 AutoDRC, /* */
679 ShowNumber, /* pinout shows number */
680 OrthogonalMoves, /* */
681 ResetAfterElement, /* reset connections after each element */
682 liveRouting, /* autorouter shows tracks in progress */
683 RingBellWhenFinished, /* flag if a signal should be */
684 /* produced when searching of */
685 /* connections is done */
686 AutoPlace; /* flag which says we should force placement of the
687 windows on startup */
689 SettingType, *SettingTypePtr;
691 /* ----------------------------------------------------------------------
692 * pointer to low-level copy, move and rotate functions
694 typedef struct
696 void *(*Line) (LayerTypePtr, LineTypePtr);
697 void *(*Text) (LayerTypePtr, TextTypePtr);
698 void *(*Polygon) (LayerTypePtr, PolygonTypePtr);
699 void *(*Via) (PinTypePtr);
700 void *(*Element) (ElementTypePtr);
701 void *(*ElementName) (ElementTypePtr);
702 void *(*Pin) (ElementTypePtr, PinTypePtr);
703 void *(*Pad) (ElementTypePtr, PadTypePtr);
704 void *(*LinePoint) (LayerTypePtr, LineTypePtr, PointTypePtr);
705 void *(*Point) (LayerTypePtr, PolygonTypePtr, PointTypePtr);
706 void *(*Arc) (LayerTypePtr, ArcTypePtr);
707 void *(*Rat) (RatTypePtr);
708 } ObjectFunctionType, *ObjectFunctionTypePtr;
710 /* ---------------------------------------------------------------------------
711 * structure used by device drivers
714 typedef struct /* holds a connection */
716 LocationType X, Y; /* coordinate of connection */
717 long int type; /* type of object in ptr1 - 3 */
718 void *ptr1, *ptr2; /* the object of the connection */
719 Cardinal group; /* the layer group of the connection */
720 LibraryMenuType *menu; /* the netmenu this *SHOULD* belong too */
721 } ConnectionType, *ConnectionTypePtr;
723 typedef struct /* holds a net of connections */
725 Cardinal ConnectionN, /* the number of connections contained */
726 ConnectionMax; /* max connections from malloc */
727 ConnectionTypePtr Connection;
728 RouteStyleTypePtr Style;
729 } NetType, *NetTypePtr;
731 typedef struct /* holds a list of nets */
733 Cardinal NetN, /* the number of subnets contained */
734 NetMax; /* max subnets from malloc */
735 NetTypePtr Net;
736 } NetListType, *NetListTypePtr;
738 typedef struct /* holds a list of net lists */
740 Cardinal NetListN, /* the number of net lists contained */
741 NetListMax; /* max net lists from malloc */
742 NetListTypePtr NetList;
743 } NetListListType, *NetListListTypePtr;
745 typedef struct /* holds a generic list of pointers */
747 Cardinal PtrN, /* the number of pointers contained */
748 PtrMax; /* max subnets from malloc */
749 void **Ptr;
750 } PointerListType, *PointerListTypePtr;
752 typedef struct
754 Cardinal BoxN, /* the number of boxes contained */
755 BoxMax; /* max boxes from malloc */
756 BoxTypePtr Box;
758 } BoxListType, *BoxListTypePtr;
760 struct drc_violation_st
762 char *title;
763 char *explanation;
764 int x;
765 int y;
766 int angle;
767 int have_measured;
768 double measured_value;
769 double required_value;
770 int value_digits;
771 const char *value_units;
772 int object_count;
773 long int *object_id_list;
774 int *object_type_list;
777 /* ---------------------------------------------------------------------------
778 * define supported types of undo operations
779 * note these must be separate bits now
781 #define UNDO_CHANGENAME 0x0001 /* change of names */
782 #define UNDO_MOVE 0x0002 /* moving objects */
783 #define UNDO_REMOVE 0x0004 /* removing objects */
784 #define UNDO_REMOVE_POINT 0x0008 /* removing polygon/... points */
785 #define UNDO_INSERT_POINT 0x0010 /* inserting polygon/... points */
786 #define UNDO_REMOVE_CONTOUR 0x0020 /* removing a contour from a polygon */
787 #define UNDO_INSERT_CONTOUR 0x0040 /* inserting a contour from a polygon */
788 #define UNDO_ROTATE 0x0080 /* rotations */
789 #define UNDO_CREATE 0x0100 /* creation of objects */
790 #define UNDO_MOVETOLAYER 0x0200 /* moving objects to */
791 #define UNDO_FLAG 0x0400 /* toggling SELECTED flag */
792 #define UNDO_CHANGESIZE 0x0800 /* change size of object */
793 #define UNDO_CHANGE2NDSIZE 0x1000 /* change 2ndSize of object */
794 #define UNDO_MIRROR 0x2000 /* change side of board */
795 #define UNDO_CHANGECLEARSIZE 0x4000 /* change clearance size */
796 #define UNDO_CHANGEMASKSIZE 0x8000 /* change mask size */
797 #define UNDO_CHANGEANGLES 0x10000 /* change arc angles */
798 #define UNDO_LAYERCHANGE 0x20000 /* layer new/delete/move */
799 #define UNDO_CLEAR 0x40000 /* clear/restore to polygons */
800 #define UNDO_NETLISTCHANGE 0x80000 /* netlist change */
803 /* ---------------------------------------------------------------------------
804 * add a macro for wrapping RCS ID's in so that ident will still work
805 * but we won't get as many compiler warnings
808 #ifndef GCC_VERSION
809 #define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
810 #endif /* GCC_VERSION */
812 #if GCC_VERSION > 2007
813 #define ATTRIBUTE_UNUSED __attribute__((unused))
814 #else
815 #define ATTRIBUTE_UNUSED
816 #endif
818 #define RCSID(x) static char *rcsid ATTRIBUTE_UNUSED = x
820 /* ---------------------------------------------------------------------------
821 * Macros called by various action routines to show usage or to report
822 * a syntax error and fail
824 #define AUSAGE(x) Message ("Usage:\n%s\n", (x##_syntax))
825 #define AFAIL(x) { Message ("Syntax error. Usage:\n%s\n", (x##_syntax)); return 1; }
827 /* ---------------------------------------------------------------------------
828 * Variables with absolute paths to various directories. These are deduced
829 * at runtime to allow pcb to be relocatable
831 extern char *bindir; /* The dir in which PCB installation was found */
832 extern char *pcblibdir; /* The system M4 fp directory */
833 extern char *pcblibpath; /* The search path for M4 fps */
834 extern char *pcbtreedir; /* The system newlib fp directory */
835 extern char *pcbtreepath; /* The search path for newlib fps */
836 extern char *exec_prefix;
837 extern char *homedir;
839 #endif /* __GLOBAL_INCLUDED__ */