4 * PCB, interactive printed circuit board design
5 * Copyright (C) 2005 DJ Delorie
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.
37 #include "pcb-printf.h"
39 #ifdef HAVE_LIBDMALLOC
44 FlagCurrentStyle (int dummy
)
48 if (style
->Thick
== Settings
.LineThickness
&&
49 style
->Diameter
== Settings
.ViaThickness
&&
50 style
->Hole
== Settings
.ViaDrillingHole
&&
51 style
->Keepaway
== Settings
.Keepaway
)
65 FlagGridSize (int dummy
)
71 FlagUnitsMm (int dummy
)
73 static const Unit
*u
= NULL
;
75 u
= get_unit_struct ("mm");
76 return (Settings
.grid_unit
== u
);
80 FlagUnitsMil (int dummy
)
82 static const Unit
*u
= NULL
;
84 u
= get_unit_struct ("mil");
85 return (Settings
.grid_unit
== u
);
89 FlagBuffer (int dummy
)
91 return (int) (Settings
.BufferNumber
+ 1);
95 FlagElementName (int dummy
)
97 if (TEST_FLAG (NAMEONPCBFLAG
, PCB
))
99 if (TEST_FLAG (DESCRIPTIONFLAG
, PCB
))
105 FlagTESTFLAG (int bit
)
107 return TEST_FLAG (bit
, PCB
) ? 1 : 0;
111 FlagSETTINGS (int ofs
)
113 return *(bool *) ((char *) (&Settings
) + ofs
);
120 return Settings
.Mode
;
121 return Settings
.Mode
== x
;
125 FlagHaveRegex (int x
)
127 #if defined(HAVE_REGCOMP) || defined(HAVE_RE_COMP)
144 FlagLayerShown (int n
)
149 return PCB
->ElementOn
;
157 return PCB
->InvisibleObjectsOn
;
159 return TEST_FLAG (SHOWMASKFLAG
, PCB
);
161 if (n
>= 0 && n
< max_copper_layer
)
162 return PCB
->Data
->Layer
[n
].On
;
168 FlagLayerActive (int n
)
172 current_layer
= FL_RATS
;
173 else if (PCB
->SilkActive
)
174 current_layer
= FL_SILK
;
178 return current_layer
== n
;
181 /* The cast to (int) is ONLY valid because we know we are
182 * taking offsets on structures where the offset will fit
183 * in an integer variable. It silences compile warnings on
186 #define OffsetOf(a,b) (int)(size_t)(&(((a *)0)->b))
188 HID_Flag flags_flag_list
[] = {
189 {"style", FlagCurrentStyle
, 0},
190 {"grid", FlagGrid
, 0},
191 {"gridsize", FlagGridSize
, 0},
192 {"elementname", FlagElementName
, 0},
193 {"have_regex", FlagHaveRegex
, 0},
195 {"silk_shown", FlagLayerShown
, FL_SILK
},
196 {"pins_shown", FlagLayerShown
, FL_PINS
},
197 {"rats_shown", FlagLayerShown
, FL_RATS
},
198 {"vias_shown", FlagLayerShown
, FL_VIAS
},
199 {"back_shown", FlagLayerShown
, FL_BACK
},
200 {"mask_shown", FlagLayerShown
, FL_MASK
},
201 {"silk_active", FlagLayerActive
, FL_SILK
},
202 {"rats_active", FlagLayerActive
, FL_RATS
},
204 {"mode", FlagMode
, -1},
205 {"nomode", FlagMode
, NO_MODE
},
206 {"arcmode", FlagMode
, ARC_MODE
},
207 {"arrowmode", FlagMode
, ARROW_MODE
},
208 {"copymode", FlagMode
, COPY_MODE
},
209 {"insertpointmode", FlagMode
, INSERTPOINT_MODE
},
210 {"linemode", FlagMode
, LINE_MODE
},
211 {"lockmode", FlagMode
, LOCK_MODE
},
212 {"movemode", FlagMode
, MOVE_MODE
},
213 {"pastebuffermode", FlagMode
, PASTEBUFFER_MODE
},
214 {"polygonmode", FlagMode
, POLYGON_MODE
},
215 {"polygonholemode", FlagMode
, POLYGONHOLE_MODE
},
216 {"rectanglemode", FlagMode
, RECTANGLE_MODE
},
217 {"removemode", FlagMode
, REMOVE_MODE
},
218 {"rotatemode", FlagMode
, ROTATE_MODE
},
219 {"rubberbandmovemode", FlagMode
, RUBBERBANDMOVE_MODE
},
220 {"textmode", FlagMode
, TEXT_MODE
},
221 {"thermalmode", FlagMode
, THERMAL_MODE
},
222 {"viamode", FlagMode
, VIA_MODE
},
224 {"shownumber", FlagTESTFLAG
, SHOWNUMBERFLAG
},
225 {"localref", FlagTESTFLAG
, LOCALREFFLAG
},
226 {"checkplanes", FlagTESTFLAG
, CHECKPLANESFLAG
},
227 {"showdrc", FlagTESTFLAG
, SHOWDRCFLAG
},
228 {"rubberband", FlagTESTFLAG
, RUBBERBANDFLAG
},
229 {"description", FlagTESTFLAG
, DESCRIPTIONFLAG
},
230 {"nameonpcb", FlagTESTFLAG
, NAMEONPCBFLAG
},
231 {"autodrc", FlagTESTFLAG
, AUTODRCFLAG
},
232 {"alldirection", FlagTESTFLAG
, ALLDIRECTIONFLAG
},
233 {"swapstartdir", FlagTESTFLAG
, SWAPSTARTDIRFLAG
},
234 {"uniquename", FlagTESTFLAG
, UNIQUENAMEFLAG
},
235 {"clearnew", FlagTESTFLAG
, CLEARNEWFLAG
},
236 {"snappin", FlagTESTFLAG
, SNAPPINFLAG
},
237 {"showmask", FlagTESTFLAG
, SHOWMASKFLAG
},
238 {"thindraw", FlagTESTFLAG
, THINDRAWFLAG
},
239 {"orthomove", FlagTESTFLAG
, ORTHOMOVEFLAG
},
240 {"liveroute", FlagTESTFLAG
, LIVEROUTEFLAG
},
241 {"thindrawpoly", FlagTESTFLAG
, THINDRAWPOLYFLAG
},
242 {"locknames", FlagTESTFLAG
, LOCKNAMESFLAG
},
243 {"onlynames", FlagTESTFLAG
, ONLYNAMESFLAG
},
244 {"newfullpoly", FlagTESTFLAG
, NEWFULLPOLYFLAG
},
245 {"hidenames", FlagTESTFLAG
, HIDENAMESFLAG
},
247 {"fullpoly", FlagSETTINGS
, OffsetOf (SettingType
, FullPoly
)},
248 {"grid_units_mm", FlagUnitsMm
, -1},
249 {"grid_units_mil", FlagUnitsMil
, -1},
250 {"clearline", FlagSETTINGS
, OffsetOf (SettingType
, ClearLine
)},
251 {"uniquenames", FlagSETTINGS
, OffsetOf (SettingType
, UniqueNames
)},
252 {"showsolderside", FlagSETTINGS
, OffsetOf (SettingType
, ShowSolderSide
)},
253 {"savelastcommand", FlagSETTINGS
, OffsetOf (SettingType
, SaveLastCommand
)},
254 {"saveintmp", FlagSETTINGS
, OffsetOf (SettingType
, SaveInTMP
)},
255 {"drawgrid", FlagSETTINGS
, OffsetOf (SettingType
, DrawGrid
)},
256 {"ratwarn", FlagSETTINGS
, OffsetOf (SettingType
, RatWarn
)},
257 {"stipplepolygons", FlagSETTINGS
, OffsetOf (SettingType
, StipplePolygons
)},
258 {"alldirectionlines", FlagSETTINGS
,
259 OffsetOf (SettingType
, AllDirectionLines
)},
260 {"rubberbandmode", FlagSETTINGS
, OffsetOf (SettingType
, RubberBandMode
)},
261 {"swapstartdirection", FlagSETTINGS
,
262 OffsetOf (SettingType
, SwapStartDirection
)},
263 {"showdrcmode", FlagSETTINGS
, OffsetOf (SettingType
, ShowDRC
)},
264 {"resetafterelement", FlagSETTINGS
,
265 OffsetOf (SettingType
, ResetAfterElement
)},
266 {"ringbellwhenfinished", FlagSETTINGS
,
267 OffsetOf (SettingType
, RingBellWhenFinished
)},
269 {"buffer", FlagBuffer
, 0},
273 REGISTER_FLAGS (flags_flag_list
)