src/undo.c: Converted plain comments into doxygen comments.
[geda-pcb/pcjc2.git] / src / global.h
blob8b7ca603916622b4ebeb54836981736e5fadbed0
1 /*!
2 * \file src/global.h
4 * \brief Definition of types.
6 * <hr>
8 * <h1><b>Copyright.</b></h1>\n
10 * PCB, interactive printed circuit board design
12 * Copyright (C) 1994,1995,1996, 2004 Thomas Nau
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 * Contact addresses for paper mail and Email:
29 * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
30 * Thomas.Nau@rz.uni-ulm.de
32 * <hr>
34 * Change History:
36 * 10/11/96 11:37 AJF Added support for a Text() driver function.
37 * This was done out of a pressing need to force text to be printed on the
38 * silkscreen layer. Perhaps the design is not the best.
41 #ifndef PCB_GLOBAL_H
42 #define PCB_GLOBAL_H
44 #ifdef HAVE_CONFIG_H
45 #include "config.h"
46 #endif
48 #include "const.h"
49 #include "macro.h"
51 #include <locale.h>
52 #ifdef HAVE_STDINT_H
53 #include <stdint.h>
54 #endif
55 #include <stdio.h>
56 #include <stdlib.h>
57 #include <string.h>
58 #include <strings.h>
59 #include <stdarg.h>
60 #include <math.h>
61 #include <ctype.h>
62 #include <sys/types.h>
63 #include <stdbool.h>
64 #include <glib.h>
66 /* Forward declarations for structures the HIDs need. */
67 typedef struct BoxType BoxType;
68 typedef struct polygon_st PolygonType;
69 typedef struct pad_st PadType;
70 typedef struct pin_st PinType;
71 typedef struct drc_violation_st DrcViolationType;
72 typedef struct rtree rtree_t;
73 typedef struct AttributeListType AttributeListType;
75 typedef struct unit Unit;
76 typedef struct increments Increments;
78 typedef COORD_TYPE Coord; /*!< pcb base unit. */
79 typedef double Angle; /*!< Degrees. */
81 #include "hid.h"
82 #include "polyarea.h"
84 /* Internationalization support. */
85 #include "gettext.h"
87 #if defined (ENABLE_NLS)
88 /* When an empty string is used for msgid, the functions may return a nonempty
89 string. */
90 # define _(S) (S[0] != '\0') ? gettext(S) : S
91 # define N_(S) gettext_noop(S)
92 # define C_(C, S) pgettext(C, S)
93 #else
94 # define _(S) S
95 # define N_(S) S
96 # define C_(C, S) S
97 #endif /* ENABLE_NLS */
99 /*!
100 * \brief This is used by the lexer/parser.
102 typedef struct {
103 int ival;
104 Coord bval;
105 double dval;
106 char has_units;
107 } PLMeasure;
109 #ifndef XtSpecificationRelease
110 typedef unsigned int Cardinal;
111 /*typedef unsigned int Pixel;*/
112 typedef char *String;
113 typedef short Position;
114 typedef short Dimension;
115 #endif
116 typedef unsigned char BYTE;
119 * \brief Nobody should know about the internals of this except the
120 * macros in macros.h that access it.
122 * This structure must be simple-assignable for now.
124 typedef struct
126 unsigned long f; /* generic flags */
127 unsigned char t[(MAX_LAYER + 1) / 2]; /* thermals */
128 } FlagType;
130 #ifndef __GNUC__
131 #define __FUNCTION1(a,b) a ":" #b
132 #define __FUNCTION2(a,b) __FUNCTION1(a,b)
133 #define __FUNCTION__ __FUNCTION2(__FILE__,__LINE__)
134 #endif
137 /* ---------------------------------------------------------------------------
138 * Macros to annotate branch-prediction information.
139 * Taken from GLib 2.16.3 (LGPL 2).G_ / g_ prefixes have
140 * been removed to avoid namespace clashes.
143 /* The LIKELY and UNLIKELY macros let the programmer give hints to
144 * the compiler about the expected result of an expression. Some compilers
145 * can use this information for optimizations.
147 * The PCB_BOOLEAN_EXPR macro is intended to trigger a gcc warning when
148 * putting assignments inside the test.
150 #if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
151 #define PCB_BOOLEAN_EXPR(expr) \
152 __extension__ ({ \
153 int _boolean_var_; \
154 if (expr) \
155 _boolean_var_ = 1; \
156 else \
157 _boolean_var_ = 0; \
158 _boolean_var_; \
160 #define LIKELY(expr) (__builtin_expect (PCB_BOOLEAN_EXPR(expr), 1))
161 #define UNLIKELY(expr) (__builtin_expect (PCB_BOOLEAN_EXPR(expr), 0))
162 #else
163 #define LIKELY(expr) (expr)
164 #define UNLIKELY(expr) (expr)
165 #endif
168 /* ---------------------------------------------------------------------------
169 * Do not change the following definitions even if they're not very
170 * nice. It allows us to have functions act on these "base types" and
171 * not need to know what kind of actual object they're working on.
174 /* Any object that uses the "object flags" defined in const.h, or
175 exists as an object on the pcb, MUST be defined using this as the
176 first fields, either directly or through ANYLINEFIELDS. */
177 #define ANYOBJECTFIELDS \
178 BoxType BoundingBox; \
179 long int ID; \
180 FlagType Flags; \
181 // struct LibraryEntryType *net
183 /* Lines, pads, and rats all use this so they can be cross-cast. */
184 #define ANYLINEFIELDS \
185 ANYOBJECTFIELDS; \
186 Coord Thickness, \
187 Clearance; \
188 PointType Point1, \
189 Point2
191 /* ---------------------------------------------------------------------------
192 * some useful values of our widgets
196 * \brief Holds information about output window.
198 typedef struct
200 hidGC bgGC, /*!< Background; changed from some routines. */
201 fgGC, /*!< Foreground; changed from some routines. */
202 pmGC; /*!< Depth 1 pixmap GC to store clip. */
204 OutputType;
207 * \brief Layer group.
209 * A layer group identifies layers which are always switched on/off
210 * together.
212 typedef struct
214 Cardinal Number[MAX_GROUP], /*!< Number of entries per groups. */
215 Entries[MAX_GROUP][MAX_ALL_LAYER];
216 } LayerGroupType;
219 * \brief A bounding box.
221 struct BoxType
223 Coord X1, Y1; /*!< Upper left corner. */
224 Coord X2, Y2; /*!< Lower right corner. */
227 typedef struct
229 Coord x, y;
230 Coord width, height;
231 } RectangleType;
233 typedef struct
235 char *name;
236 char *value;
237 } AttributeType;
239 struct AttributeListType
241 int Number, Max;
242 AttributeType *List;
245 /* ---------------------------------------------------------------------------
246 * the basic object types supported by PCB
250 * \brief All on-pcb objects (elements, lines, pads, vias, rats, etc)
251 * are based on this.
253 typedef struct {
254 ANYOBJECTFIELDS;
255 } AnyObjectType;
258 * \brief A line/polygon point.
260 typedef struct
262 Coord X, Y, X2, Y2; /*!< So Point type can be cast as BoxType. */
263 long int ID;
264 } PointType;
267 * \brief Lines, rats, pads, etc.
269 typedef struct {
270 ANYLINEFIELDS;
271 } AnyLineObjectType;
274 * \brief Holds information about one line.
276 typedef struct
278 ANYLINEFIELDS;
279 char *Number;
280 } LineType;
282 typedef struct
284 ANYOBJECTFIELDS;
285 int Scale; /*!< Text scaling in percent. */
286 Coord X; /*!< X-coordinate of origin. */
287 Coord Y; /*!< Y-coordinate of origin. */
288 BYTE Direction;
289 char *TextString; /*!< String. */
290 void *Element;
291 } TextType;
294 * \brief Holds information about a polygon.
296 struct polygon_st
298 ANYOBJECTFIELDS;
299 Cardinal PointN; /*!< Number of points in polygon. */
300 Cardinal PointMax; /*!< Max number from malloc(). */
301 POLYAREA *Clipped; /*!< The clipped region of this polygon. */
302 PLINE *NoHoles; /*!< The polygon broken into hole-less regions */
303 int NoHolesValid; /*!< Is the NoHoles polygon up to date? */
304 PointType *Points; /*!< Data. */
305 Cardinal *HoleIndex; /*!< Index of hole data within the Points array. */
306 Cardinal HoleIndexN; /*!< Number of holes in polygon. */
307 Cardinal HoleIndexMax; /*!< Max number from malloc(). */
312 * \brief Holds information about arcs.
314 typedef struct
316 ANYOBJECTFIELDS;
317 Coord Thickness, Clearance;
318 PointType Point1;
319 PointType Point2;
320 Coord Width; /*!< Length of axis */
321 Coord Height; /*!< Width of axis */
322 Coord X; /*!< X-value of the center coordinates. */
323 Coord Y; /*!< Y-value of the center coordinates. */
324 Angle StartAngle; /*!< The start angle in degrees. */
325 Angle Delta; /*!< The described angle in degrees. */
326 } ArcType;
328 struct rtree
330 struct rtree_node *root;
331 int size; /*!< Number of entries in tree */
335 * \brief Holds information about one layer. */
336 typedef struct
338 LayertypeType Type; /*!< LT_* from hid.h */
339 char *Name; /*!< Layer name. */
340 Cardinal LineN; /*!< Number of lines. */
341 Cardinal TextN; /*!< Labels. */
342 Cardinal PolygonN; /*!< Polygons. */
343 Cardinal ArcN; /*!< Arcs. */
344 GList *Line;
345 GList *Text;
346 GList *Polygon;
347 GList *Arc;
348 rtree_t *line_tree, *text_tree, *polygon_tree, *arc_tree;
349 bool On; /*!< Visible flag. */
350 char *Color, /*!< Color. */
351 *SelectedColor;
352 AttributeListType Attributes;
353 int no_drc; /*!< Whether to ignore the layer when checking the design
354 rules */
356 LayerType;
359 * \brief A rat line.
361 typedef struct
363 ANYLINEFIELDS;
364 Cardinal group1; /*!< The layer group each point is on. */
365 Cardinal group2; /*!< The layer group each point is on. */
366 } RatType;
369 * \brief A SMD pad.
371 struct pad_st
373 ANYLINEFIELDS;
374 Coord Mask;
375 char *Name, *Number; /*!< 'Line'. */
376 void *Element;
377 void *Spare;
381 * \brief A pin.
383 struct pin_st
385 ANYOBJECTFIELDS;
386 Coord Thickness;
387 Coord Clearance;
388 Coord Mask;
389 Coord DrillingHole; /*!< Diameter of the drill hole. */
390 Coord X; /*!< X-value of the center coordinates. */
391 Coord Y; /*!< Y-value of the center coordinates. */
392 char *Name;
393 char *Number;
394 void *Element;
395 void *Spare;
398 /* This is the extents of a Pin or Via, depending on whether it's a
399 hole or not. */
400 #define PIN_SIZE(pinptr) (TEST_FLAG(HOLEFLAG, (pinptr)) \
401 ? (pinptr)->DrillingHole \
402 : (pinptr)->Thickness)
405 * \brief An element.
407 typedef struct
409 ANYOBJECTFIELDS;
410 TextType Name[MAX_ELEMENTNAMES];
411 /*!< The elements names;
412 * - description text,
413 * - name on PCB second,
414 * - value third.
415 * see macro.h.
417 Coord MarkX; /*!< X-value of the position mark. */
418 Coord MarkY; /*!< Y-value of the position mark. */
419 Cardinal PinN; /*!< Number of pins. */
420 Cardinal PadN; /*!< Number of pads. */
421 Cardinal LineN; /*!< Number of lines. */
422 Cardinal ArcN; /*!< Number of arcs. */
423 GList *Pin;
424 GList *Pad;
425 GList *Line;
426 GList *Arc;
427 BoxType VBox;
428 AttributeListType Attributes;
429 } ElementType;
431 /* ---------------------------------------------------------------------------
432 * symbol and font related stuff
435 * \brief A single symbol.
437 typedef struct
439 LineType *Line;
440 bool Valid;
441 Cardinal LineN; /*!< Number of lines. */
442 Cardinal LineMax;
443 Coord Width; /*!< Width of cell. */
444 Coord Height; /*!< Height of cell. */
445 Coord Delta; /*!< Distance to next symbol. */
446 } SymbolType;
449 * \brief Complete set of symbols.
451 typedef struct
453 Coord MaxHeight; /*!< Maximum cell width. */
454 Coord MaxWidth; /*!< Maximum cell height. */
455 BoxType DefaultSymbol; /*!< The default symbol is a filled box. */
456 SymbolType Symbol[MAX_FONTPOSITION + 1];
457 bool Valid;
458 } FontType;
461 * \brief Holds all objects.
463 typedef struct
465 Cardinal ViaN; /*!< Number of vias. */
466 Cardinal ElementN; /*!< Number of elements. */
467 Cardinal RatN; /*!< Number of rat-lines. */
468 int LayerN; /*!< Number of layers in this board. */
469 GList *Via;
470 GList *Element;
471 GList *Rat;
472 rtree_t *via_tree, *element_tree, *pin_tree, *pad_tree, *name_tree[3], /* for element names */
473 *rat_tree;
474 struct PCBType *pcb;
475 LayerType Layer[MAX_ALL_LAYER];
476 int polyClip;
477 } DataType;
480 * \brief Holds drill information.
482 typedef struct
484 Coord DrillSize; /*!< This drill's diameter. */
485 Cardinal ElementN; /*!< The number of elements using this drill size. */
486 Cardinal ElementMax; /*!< Max. number of elements from malloc(). */
487 Cardinal PinCount; /*!< Number of pins drilled this size. */
488 Cardinal ViaCount; /*!< Number of vias drilled this size. */
489 Cardinal UnplatedCount; /*!< Number of these holes that are unplated. */
490 Cardinal PinN; /*!< Number of drill coordinates in the list. */
491 Cardinal PinMax; /*!< Max. number of coordinates from malloc(). */
492 PinType **Pin; /*!< Coordinates to drill. */
493 ElementType **Element; /*!< A pointer to an array of element pointers. */
494 } DrillType;
497 * \brief Holds a range of Drill Infos.
499 typedef struct
501 Cardinal DrillN; /*!< Number of drill sizes. */
502 Cardinal DrillMax; /*!< Max. number from malloc(). */
503 DrillType *Drill; /*!< Plated holes. */
504 } DrillInfoType;
506 typedef struct
508 Coord Thick; /*!< Line thickness. */
509 Coord Diameter; /*!< Via diameter. */
510 Coord Hole; /*!< Via drill hole. */
511 Coord Keepaway; /*!< Min. separation from other nets. */
512 char *Name;
513 int index;
514 } RouteStyleType;
517 * \brief Structure used by library routines.
519 typedef struct
521 char *ListEntry; /*!< The string for the selection box. */
522 char *AllocatedMemory; /*!< Pointer to allocated memory;
523 all others point to parts of the string. */
524 char *Template; /*!< m4 template name. */
525 char *Package; /*!< Package. */
526 char *Value; /*!< The value field. */
527 char *Description; /*!< Some descriptional text. */
528 } LibraryEntryType;
531 * \brief .
533 * If the internal flag is set, the only field that is valid is Name,
534 * and the struct is allocated with malloc instead of
535 * CreateLibraryEntry. These "internal" entries are used for
536 * electrical paths that aren't yet assigned to a real net.
538 typedef struct
540 char *Name; /*!< Name of the menu entry. */
541 char *directory; /*!< Directory name library elements are from. */
542 char *Style; /*!< Routing style. */
543 Cardinal EntryN; /*!< Number of objects. */
544 Cardinal EntryMax; /*!< Number of reserved memory locations. */
545 LibraryEntryType *Entry; /*!< The entries. */
546 char flag; /*!< Used by the netlist window to enable/disable nets. */
547 char internal; /*!< If set, this is an internal-only entry, not
548 * part of the global netlist. */
549 } LibraryMenuType;
551 typedef struct
553 Cardinal MenuN; /*!< Number of objects. */
554 Cardinal MenuMax; /*!< Number of reserved memory locations. */
555 LibraryMenuType *Menu; /*!< The entries. */
556 } LibraryType;
560 * \brief The PCBType struct holds information about board layout most
561 * of which is saved with the layout.
563 * A new PCB layout struct is first initialized with values from the
564 * user configurable \c Settings struct and then reset to the saved
565 * layout values when a layout is loaded.
567 * This struct is also used for the remove list and for buffer handling.
569 typedef struct PCBType
571 long ID; /*!< See macro.h. */
572 FlagType Flags;
573 char *Name, /*!< Name of board. */
574 *Filename, /*!< Name of file (from load). */
575 *PrintFilename, /*!< From print dialog. */
576 *Netlistname, /*!< Name of netlist file. */
577 ThermStyle; /*!< Type of thermal to place with thermal tool. */
578 bool Changed, /*!< Layout has been changed. */
579 ViaOn, /*!< Visibility flag for vias. */
580 ElementOn, /*!< Visibility flag for elements. */
581 RatOn, /*!< Visibility flag for rat lines. */
582 InvisibleObjectsOn,
583 PinOn, /*!< Visibility flag for pins. */
584 SilkActive, /*!< Active layer is actually silk. */
585 RatDraw; /*!< We're drawing rats. */
586 char *ViaColor, /*!< Via color. */
587 *ViaSelectedColor, /*!< Selected via color. */
588 *PinColor, /*!< Pin color. */
589 *PinSelectedColor, /*!< Selected pin color. */
590 *PinNameColor, /*!< Pin name color. */
591 *ElementColor, /*!< Element color. */
592 *RatColor, /*!< Rat line color. */
593 *InvisibleObjectsColor, /*!< Invisible objects color. */
594 *InvisibleMarkColor, /*!< Invisible mark color. */
595 *ElementSelectedColor, /*!< Selected elements color. */
596 *RatSelectedColor, /*!< Selected rat line color. */
597 *ConnectedColor, /*!< Connected color. */
598 *FoundColor, /*!< Found color. */
599 *WarnColor, /*!< Warning color. */
600 *MaskColor; /*!< Mask color. */
601 long CursorX, /*!< Cursor position as saved with layout (X value). */
602 CursorY, /*!< Cursor position as saved with layout (Y value). */
603 Clipping;
604 Coord Bloat, /*!< DRC bloat size saved with layout. */
605 Shrink, /*!< DRC shrink size saved with layout. */
606 minWid, /*!< DRC minimum width size saved with layout. */
607 minSlk, /*!< DRC minimum silk size saved with layout. */
608 minDrill, /*!< DRC minimum drill size saved with layout. */
609 minRing; /*!< DRC minimum annular ring size saved with layout. */
610 Coord GridOffsetX, /*!< As saved with layout (X value). */
611 GridOffsetY, /*!< As saved with layout (Y value). */
612 MaxWidth, /*!< Maximum allowed width size. */
613 MaxHeight; /*!< Maximum allowed height size. */
615 Coord Grid; /*!< Used grid with offsets. */
616 double IsleArea, /*!< Minimum poly island to retain. */
617 ThermScale; /*!< Scale factor used with thermals. */
618 FontType Font;
619 LayerGroupType LayerGroups;
620 RouteStyleType RouteStyle[NUM_STYLES];
621 LibraryType NetlistLib;
622 AttributeListType Attributes;
623 DataType *Data; /*!< Entire database. */
625 bool is_footprint; /*!< If set, the user has loaded a footprint, not a pcb. */
627 PCBType;
630 * \brief Information about the paste buffer.
632 typedef struct
634 Coord X; /*!< Offset (X value). */
635 Coord Y; /*!< Offset (Y value). */
636 BoxType BoundingBox;
637 DataType *Data; /*!< Data; not all members of PCBType are used. */
638 } BufferType;
640 /* ---------------------------------------------------------------------------
641 * some types for cursor drawing, setting of block and lines
642 * as well as for merging of elements
646 * \brief Rubberband lines for element moves.
648 typedef struct
650 LayerType *Layer; /*!< Layer that holds the line. */
651 LineType *Line; /*!< The line itself. */
652 PointType *MovedPoint; /*!< And finally the point. */
653 } RubberbandType;
656 * \brief Current marked line.
658 typedef struct
660 PointType Point1; /*!< Start position. */
661 PointType Point2; /*!< End position. */
662 long int State;
663 bool draw;
664 } AttachedLineType;
667 * \brief Currently marked block.
669 typedef struct
671 PointType Point1; /*!< Start position. */
672 PointType Point2; /*!< End position. */
673 long int State;
674 bool otherway;
675 } AttachedBoxType;
678 * \brief Currently attached object.
680 typedef struct
682 Coord X; /*!< Saved position when MOVE_MODE (X value). */
683 Coord Y; /*!< Saved position when MOVE_MODE (Y value). */
684 BoxType BoundingBox;
685 long int Type, /*!< Object type. */
686 State;
687 void *Ptr1; /*!< Pointer to data, see search.c. */
688 void *Ptr2; /*!< Pointer to data, see search.c. */
689 void *Ptr3; /*!< Pointer to data, see search.c. */
690 Cardinal RubberbandN, /*!< Number of lines in array. */
691 RubberbandMax;
692 RubberbandType *Rubberband;
693 } AttachedObjectType;
695 enum crosshair_shape
697 Basic_Crosshair_Shape = 0, /*!< 4-ray. */
698 Union_Jack_Crosshair_Shape, /*!< 8-ray. */
699 Dozen_Crosshair_Shape, /*!< 12-ray. */
700 Crosshair_Shapes_Number
704 * \brief Holds cursor information.
706 typedef struct
708 hidGC GC; /*!< GC for cursor drawing. */
709 hidGC AttachGC; /*!< GC for displaying buffer contents. */
710 Coord X; /*!< Position in PCB coordinates (X value). */
711 Coord Y; /*!< Position in PCB coordinates (Y value). */
712 Coord MinX; /*!< Lowest coordinates (X value). */
713 Coord MinY; /*!< Lowest coordinates (Y value). */
714 Coord MaxX; /*!< Highest coordinates (X value). */
715 Coord MaxY; /*!< Highest coordinates (Y value). */
716 AttachedLineType AttachedLine; /*!< Data of new lines. */
717 AttachedBoxType AttachedBox;
718 PolygonType AttachedPolygon;
719 AttachedObjectType AttachedObject; /*!< Data of attached objects. */
720 enum crosshair_shape shape; /*!< Shape of Crosshair. */
721 } CrosshairType;
723 typedef struct
725 bool status;
726 Coord X, Y;
727 } MarkType;
730 * \brief Our resources.
732 * Most of them are used as default when a new design is started.
734 typedef struct
736 const Unit *grid_unit;
737 Increments *increments;
739 int verbose;
741 char *BlackColor,
742 *WhiteColor,
743 *BackgroundColor, /*!< Background color. */
744 *CrosshairColor, /*!< Crosshair color. */
745 *CrossColor, /*!< Cross color. */
746 *ViaColor, /*!< Via color. */
747 *ViaSelectedColor, /*!< Selected via color. */
748 *PinColor, /*!< Pin color. */
749 *PinSelectedColor, /*!< Selected pin color. */
750 *PinNameColor, /*!< Pin name color. */
751 *ElementColor, /*!< Element color. */
752 *RatColor, /*!< Rat color. */
753 *InvisibleObjectsColor, /*!< Invisible objects color. */
754 *InvisibleMarkColor, /*!< Invisible mark color. */
755 *ElementSelectedColor, /*!< Selected element color. */
756 *RatSelectedColor, /*!< Selected rat color. */
757 *ConnectedColor, /*!< Connected color. */
758 *FoundColor, /*!< Found color. */
759 *OffLimitColor,
760 *GridColor, /*!< Grid color. */
761 *LayerColor[MAX_LAYER],
762 *LayerSelectedColor[MAX_LAYER],
763 *WarnColor, /*!< Warning color. */
764 *MaskColor; /*!< Mask color. */
765 Coord ViaThickness, /*!< Default via thickness value. */
766 ViaDrillingHole, /*!< Default via drill hole value. */
767 LineThickness, /*!< Default line thickness value. */
768 RatThickness, /*!< Default rat thickness value. */
769 Keepaway, /*!< Default keepaway value. */
770 MaxWidth, /*!< Default size of a new layout (X value). */
771 MaxHeight, /*!< Default size of a new layout (Y value). */
772 AlignmentDistance,
773 Bloat, /*!< Default drc size for bloat. */
774 Shrink, /*!< Default drc size for shrink. */
775 minWid, /*!< Default drc size for minimum trace width. */
776 minSlk, /*!< Default drc size for minumum silk width. */
777 minDrill, /*!< Default drc size for minimum drill size. */
778 minRing; /*!< Default drc size for minimum annular ring. */
779 int TextScale; /*!< Text scaling in %. */
780 Coord Grid; /*!< Grid in pcb-units. */
781 double IsleArea; /*!< Polygon min area. */
782 int PinoutNameLength, /*!< Max displayed length of a pinname. */
783 Volume, /*!< The speakers volume -100 .. 100. */
784 CharPerLine, /*!< Width of an output line in characters. */
785 Mode, /*!< Currently active mode. */
786 BufferNumber; /*!< Number of the current buffer. */
787 int BackupInterval; /*!< Time between two backups in seconds. */
788 char *DefaultLayerName[MAX_LAYER],
789 *FontCommand, /*!< Command for font file loading. */
790 *FileCommand, /*!< Command for file loading. */
791 *ElementCommand, /*!< Command for element file loading. */
792 *PrintFile,
793 *LibraryCommandDir,
794 *LibraryCommand,
795 *LibraryContentsCommand,
796 *LibraryTree, /*!< Path to library tree. */
797 *SaveCommand,
798 *LibraryFilename,
799 *FontFile, /*!< Name of default font file. */
800 *Groups, /*!< String with layergroups. */
801 *Routes, /*!< String with route styles. */
802 *FilePath,
803 *RatPath,
804 *RatCommand,
805 *FontPath,
806 *PinoutFont,
807 *ElementPath,
808 *LibraryPath,
809 *Size, /*!< Geometry string for size. */
810 *BackgroundImage, /*!< PPM file for board background. */
811 *ScriptFilename, /*!< PCB Actions script to execute on startup. */
812 *ActionString, /*!< PCB Actions string to execute on startup. */
813 *FabAuthor, /*!< Full name of author for FAB drawings. */
814 *GnetlistProgram, /*!< gnetlist program name. */
815 *MakeProgram, /*!< make program name. */
816 *InitialLayerStack; /*!< If set, the initial layer stack is set to this. */
817 Coord PinoutOffsetX; /*!< Offset of origin (X value). */
818 Coord PinoutOffsetY; /*!< Offset of origin (Y value). */
819 Coord PinoutTextOffsetX; /*!< Offset of text from pin center (X value). */
820 Coord PinoutTextOffsetY; /*!< Offset of text from pin center (Y value). */
821 RouteStyleType RouteStyle[NUM_STYLES]; /*!< Default routing styles. */
822 LayerGroupType LayerGroups; /*!< Default layer groups. */
823 bool ClearLine,
824 FullPoly,
825 UniqueNames, /*!< Force unique names. */
826 SnapPin, /*!< Snap to pins and pads. */
827 ShowBottomSide, /*!< Mirror output. */
828 SaveLastCommand, /*!< Save the last command entered by user. */
829 SaveInTMP, /*!< Always save data in /tmp. */
830 SaveMetricOnly, /*!< Save with mm suffix only, not mil/mm hybrid. */
831 DrawGrid, /*!< Draw grid points. */
832 RatWarn, /*!< Rats nest has set warnings. */
833 StipplePolygons, /*!< Draw polygons with stipple. */
834 AllDirectionLines, /*!< Enable lines to all directions. */
835 RubberBandMode, /*!< Move, rotate use rubberband connections. */
836 SwapStartDirection,/*!< Change starting direction after each click. */
837 ShowDRC, /*!< Show drc region on crosshair. */
838 AutoDRC, /*!< . */
839 ShowNumber, /*!< Pinout shows number. */
840 OrthogonalMoves, /*!< . */
841 ResetAfterElement, /*!< Reset connections after each element. */
842 liveRouting, /*!< Autorouter shows tracks in progress. */
843 RingBellWhenFinished,
844 /*!< flag if a signal should be produced when searching of
845 * connections is done. */
846 AutoPlace;
847 /*!< Flag which says we should force placement of the windows on
848 * startup. */
850 SettingType;
853 * \brief Pointer to low-level copy, move and rotate functions.
855 typedef struct
857 void *(*Line) (LayerType *, LineType *);
858 void *(*Text) (LayerType *, TextType *);
859 void *(*Polygon) (LayerType *, PolygonType *);
860 void *(*Via) (PinType *);
861 void *(*Element) (ElementType *);
862 void *(*ElementName) (ElementType *);
863 void *(*Pin) (ElementType *, PinType *);
864 void *(*Pad) (ElementType *, PadType *);
865 void *(*LinePoint) (LayerType *, LineType *, PointType *);
866 void *(*Point) (LayerType *, PolygonType *, PointType *);
867 void *(*Arc) (LayerType *, ArcType *);
868 void *(*Rat) (RatType *);
869 } ObjectFunctionType;
871 /* ---------------------------------------------------------------------------
872 * structure used by device drivers
877 * \brief Holds a connection.
879 typedef struct
881 Coord X; /*!< Coordinate of connection (X value). */
882 Coord Y; /*!< Coordinate of connection (Y value). */
883 long int type; /*!< Type of object in ptr1 - 3. */
884 void *ptr1; /*!< The object of the connection. */
885 void *ptr2; /*!< The object of the connection. */
886 Cardinal group; /*!< The layer group of the connection. */
887 LibraryMenuType *menu; /*!< The netmenu this *SHOULD* belong to. */
888 } ConnectionType;
891 * \brief Holds a net of connections.
893 typedef struct
895 Cardinal ConnectionN; /*!< The number of connections contained. */
896 Cardinal ConnectionMax; /*!< Max connections from malloc. */
897 ConnectionType *Connection;
898 RouteStyleType *Style;
899 } NetType;
902 * \brief Holds a list of nets.
904 typedef struct
906 Cardinal NetN; /*!< The number of subnets contained. */
907 Cardinal NetMax; /*!< Max subnets from malloc. */
908 NetType *Net;
909 } NetListType;
912 * \brief Holds a list of net lists.
914 typedef struct
916 Cardinal NetListN; /*!< The number of net lists contained. */
917 Cardinal NetListMax; /*!< Max net lists from malloc. */
918 NetListType *NetList;
919 } NetListListType;
922 * \brief Holds a generic list of pointers.
924 typedef struct
926 Cardinal PtrN; /*!< The number of pointers contained. */
927 Cardinal PtrMax; /*!< Max subnets from malloc. */
928 void **Ptr;
929 } PointerListType;
931 typedef struct
933 Cardinal BoxN; /*!< The number of boxes contained. */
934 Cardinal BoxMax; /*!< Max boxes from malloc. */
935 BoxType *Box;
936 } BoxListType;
938 struct drc_violation_st
940 char *title;
941 char *explanation;
942 Coord x, y;
943 Angle angle;
944 int have_measured;
945 Coord measured_value;
946 Coord required_value;
947 int object_count;
948 long int *object_id_list;
949 int *object_type_list;
952 /* ---------------------------------------------------------------------------
953 * define supported types of undo operations
954 * note these must be separate bits now
956 #define UNDO_CHANGENAME 0x0001 /*!< Change of names. */
957 #define UNDO_MOVE 0x0002 /*!< Moving objects. */
958 #define UNDO_REMOVE 0x0004 /*!< Removing objects. */
959 #define UNDO_REMOVE_POINT 0x0008 /*!< Removing polygon/... points. */
960 #define UNDO_INSERT_POINT 0x0010 /*!< Inserting polygon/... points. */
961 #define UNDO_REMOVE_CONTOUR 0x0020 /*!< Removing a contour from a polygon. */
962 #define UNDO_INSERT_CONTOUR 0x0040 /*!< Inserting a contour from a polygon. */
963 #define UNDO_ROTATE 0x0080 /*!< Rotations. */
964 #define UNDO_CREATE 0x0100 /*!< Creation of objects. */
965 #define UNDO_MOVETOLAYER 0x0200 /*!< Moving objects to. */
966 #define UNDO_FLAG 0x0400 /*!< Toggling SELECTED flag. */
967 #define UNDO_CHANGESIZE 0x0800 /*!< Change size of object. */
968 #define UNDO_CHANGE2NDSIZE 0x1000 /*!< Change 2ndSize of object. */
969 #define UNDO_MIRROR 0x2000 /*!< Change side of board. */
970 #define UNDO_CHANGECLEARSIZE 0x4000 /*!< Change clearance size. */
971 #define UNDO_CHANGEMASKSIZE 0x8000 /*!< Change mask size. */
972 #define UNDO_CHANGEANGLES 0x10000 /*!< Change arc angles. */
973 #define UNDO_LAYERCHANGE 0x20000 /*!< Layer new/delete/move. */
974 #define UNDO_CLEAR 0x40000 /*!< Clear/restore to polygons. */
975 #define UNDO_NETLISTCHANGE 0x80000 /*!< Netlist change. */
977 /* ---------------------------------------------------------------------------
979 #if (__GNUC__ * 1000 + __GNUC_MINOR__) > 2007
980 #define ATTRIBUTE_UNUSED __attribute__((unused))
981 #else
982 #define ATTRIBUTE_UNUSED
983 #endif
985 /* ---------------------------------------------------------------------------
986 * Macros called by various action routines to show usage or to report
987 * a syntax error and fail
989 #define AUSAGE(x) Message ("Usage:\n%s\n", (x##_syntax))
990 #define AFAIL(x) { Message ("Syntax error. Usage:\n%s\n", (x##_syntax)); return 1; }
992 /* ---------------------------------------------------------------------------
993 * Variables with absolute paths to various directories. These are deduced
994 * at runtime to allow pcb to be relocatable
996 extern char *bindir; /*!< The dir in which PCB installation was found. */
997 extern char *pcblibdir; /*!< The system M4 fp directory. */
998 extern char *pcblibpath; /*!< The search path for M4 fps. */
999 extern char *pcbtreedir; /*!< The system newlib fp directory. */
1000 extern char *pcbtreepath; /*!< The search path for newlib fps. */
1001 extern char *exec_prefix;
1002 extern char *homedir;
1004 #endif /* PCB_GLOBAL_H */