More stackup changes
[geda-pcb/pcjc2/v2.git] / src / search.h
blobd4e01e5c9cd21b009e7ff7ddf678329f3880aff3
1 /*!
2 * \file src/search.h
4 * \brief Prototypes for search routines.
6 * <hr>
8 * <h1><b>Copyright.</b></h1>\n
10 * PCB, interactive printed circuit board design
12 * Copyright (C) 1994,1995,1996 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., 675 Mass Ave, Cambridge, MA 02139, USA.
28 * Contact addresses for paper mail and Email:
30 * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
32 * Thomas.Nau@rz.uni-ulm.de
35 #ifndef PCB_SEARCH_H
36 #define PCB_SEARCH_H
38 #include "global.h"
40 #define SLOP 5
41 /* ---------------------------------------------------------------------------
42 * some useful macros
44 /* ---------------------------------------------------------------------------
45 * some define to check for 'type' in box
47 #define POINT_IN_BOX(x,y,b) \
48 ((x) >= (b)->X1 && (x) <= (b)->X2 && (y) >= (b)->Y1 && (y) <= (b)->Y2)
50 #define VIA_OR_PIN_IN_BOX(v,b) \
51 POINT_IN_BOX((v)->X,(v)->Y,(b))
53 #define LINE_IN_BOX(l,b) \
54 (POINT_IN_BOX((l)->Point1.X,(l)->Point1.Y,(b)) && \
55 POINT_IN_BOX((l)->Point2.X,(l)->Point2.Y,(b)))
57 #define PAD_IN_BOX(p,b) LINE_IN_BOX((LineType *)(p),(b))
59 #define BOX_IN_BOX(b1,b) \
60 ((b1)->X1 >= (b)->X1 && (b1)->X2 <= (b)->X2 && \
61 ((b1)->Y1 >= (b)->Y1 && (b1)->Y2 <= (b)->Y2))
63 #define TEXT_IN_BOX(t,b) \
64 (BOX_IN_BOX(&((t)->BoundingBox), (b)))
66 #define POLYGON_IN_BOX(p,b) \
67 (BOX_IN_BOX(&((p)->BoundingBox), (b)))
69 #define ELEMENT_IN_BOX(e,b) \
70 (BOX_IN_BOX(&((e)->BoundingBox), (b)))
72 #define ARC_IN_BOX(a,b) \
73 (BOX_IN_BOX(&((a)->BoundingBox), (b)))
75 /* ---------------------------------------------------------------------------
76 * prototypes
78 bool IsPointOnLine (Coord, Coord, Coord, LineType *);
79 bool IsPointOnPin (Coord, Coord, Coord, PinType *);
80 bool IsPointOnArc (Coord, Coord, Coord, ArcType *);
81 bool IsPointOnLineEnd (Coord, Coord, RatType *);
82 bool IsLineInRectangle (Coord, Coord, Coord, Coord, LineType *);
83 bool IsLineInQuadrangle (PointType p[4], LineType * Line);
84 bool IsArcInRectangle (Coord, Coord, Coord, Coord, ArcType *);
85 bool IsPointInPad (Coord, Coord, Coord, PadType *);
86 bool IsPointInBox (Coord, Coord, BoxType *, Coord);
87 int SearchObjectByLocation (unsigned, void **, void **, void **, Coord, Coord, Coord);
88 int SearchScreen (Coord, Coord, int, void **, void **, void **);
89 int SearchObjectByID (DataType *, void **, void **, void **, int, int);
90 ElementType * SearchElementByName (DataType *, char *);
91 int SearchLayerByName (DataType *Base, char *Name);
92 #endif