8 * <h1><b>Copyright.</b></h1>\n
10 * PCB, interactive printed circuit board design
12 * Copyright (C) 2005 DJ Delorie
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.
43 #include "pcb-printf.h"
47 #ifdef HAVE_LIBDMALLOC
52 FlagCurrentStyle (void *data
)
56 if (style
->Thick
== Settings
.LineThickness
&&
57 style
->Diameter
== Settings
.ViaThickness
&&
58 style
->Hole
== Settings
.ViaDrillingHole
&&
59 style
->Keepaway
== Settings
.Keepaway
)
73 FlagGridSize (void *data
)
79 FlagUnitsMm (void *data
)
81 static const Unit
*u
= NULL
;
83 u
= get_unit_struct ("mm");
84 return (Settings
.grid_unit
== u
);
88 FlagUnitsMil (void *data
)
90 static const Unit
*u
= NULL
;
92 u
= get_unit_struct ("mil");
93 return (Settings
.grid_unit
== u
);
97 FlagBuffer (void *data
)
99 return (int) (Settings
.BufferNumber
+ 1);
103 FlagElementName (void *data
)
105 if (TEST_FLAG (NAMEONPCBFLAG
, PCB
))
107 if (TEST_FLAG (DESCRIPTIONFLAG
, PCB
))
113 FlagTESTFLAG (void *data
)
115 int bit
= GPOINTER_TO_INT (data
);
116 return TEST_FLAG (bit
, PCB
) ? 1 : 0;
120 FlagSETTINGS (void *data
)
122 size_t ofs
= (size_t)data
;
123 return *(bool *) ((char *)(&Settings
) + ofs
);
127 FlagMode (void *data
)
129 int x
= GPOINTER_TO_INT (data
);
131 return Settings
.Mode
;
132 return Settings
.Mode
== x
;
136 FlagHaveRegex (void *data
)
138 #if defined(HAVE_REGCOMP) || defined(HAVE_RE_COMP)
155 FlagLayerShown (void *data
)
157 int n
= GPOINTER_TO_INT (data
);
161 return PCB
->ElementOn
;
169 return PCB
->InvisibleObjectsOn
;
171 return TEST_FLAG (SHOWMASKFLAG
, PCB
);
173 if (n
>= 0 && n
< max_copper_layer
)
174 return PCB
->Data
->Layer
[n
].On
;
180 FlagLayerActive (void *data
)
182 int test_layer
= GPOINTER_TO_INT (data
);
185 current_layer
= FL_RATS
;
186 else if (PCB
->SilkActive
)
187 current_layer
= FL_SILK
;
191 return current_layer
== test_layer
;
194 #define OFFSET_POINTER(a, b) (&(((a *)0)->b))
196 HID_Flag flags_flag_list
[] = {
197 {"style", FlagCurrentStyle
, NULL
},
198 {"grid", FlagGrid
, NULL
},
199 {"gridsize", FlagGridSize
, NULL
},
200 {"elementname", FlagElementName
, NULL
},
201 {"have_regex", FlagHaveRegex
, NULL
},
203 {"silk_shown", FlagLayerShown
, GINT_TO_POINTER (FL_SILK
)},
204 {"pins_shown", FlagLayerShown
, GINT_TO_POINTER (FL_PINS
)},
205 {"rats_shown", FlagLayerShown
, GINT_TO_POINTER (FL_RATS
)},
206 {"vias_shown", FlagLayerShown
, GINT_TO_POINTER (FL_VIAS
)},
207 {"back_shown", FlagLayerShown
, GINT_TO_POINTER (FL_BACK
)},
208 {"mask_shown", FlagLayerShown
, GINT_TO_POINTER (FL_MASK
)},
210 {"silk_active", FlagLayerActive
, GINT_TO_POINTER (FL_SILK
)},
211 {"rats_active", FlagLayerActive
, GINT_TO_POINTER (FL_RATS
)},
213 {"mode", FlagMode
, GINT_TO_POINTER (-1)},
214 {"nomode", FlagMode
, GINT_TO_POINTER (NO_MODE
)},
215 {"arcmode", FlagMode
, GINT_TO_POINTER (ARC_MODE
)},
216 {"arrowmode", FlagMode
, GINT_TO_POINTER (ARROW_MODE
)},
217 {"copymode", FlagMode
, GINT_TO_POINTER (COPY_MODE
)},
218 {"insertpointmode", FlagMode
, GINT_TO_POINTER (INSERTPOINT_MODE
)},
219 {"linemode", FlagMode
, GINT_TO_POINTER (LINE_MODE
)},
220 {"lockmode", FlagMode
, GINT_TO_POINTER (LOCK_MODE
)},
221 {"movemode", FlagMode
, GINT_TO_POINTER (MOVE_MODE
)},
222 {"pastebuffermode", FlagMode
, GINT_TO_POINTER (PASTEBUFFER_MODE
)},
223 {"polygonmode", FlagMode
, GINT_TO_POINTER (POLYGON_MODE
)},
224 {"polygonholemode", FlagMode
, GINT_TO_POINTER (POLYGONHOLE_MODE
)},
225 {"rectanglemode", FlagMode
, GINT_TO_POINTER (RECTANGLE_MODE
)},
226 {"removemode", FlagMode
, GINT_TO_POINTER (REMOVE_MODE
)},
227 {"rotatemode", FlagMode
, GINT_TO_POINTER (ROTATE_MODE
)},
228 {"rubberbandmovemode", FlagMode
, GINT_TO_POINTER (RUBBERBANDMOVE_MODE
)},
229 {"textmode", FlagMode
, GINT_TO_POINTER (TEXT_MODE
)},
230 {"thermalmode", FlagMode
, GINT_TO_POINTER (THERMAL_MODE
)},
231 {"viamode", FlagMode
, GINT_TO_POINTER (VIA_MODE
)},
233 {"shownumber", FlagTESTFLAG
, GINT_TO_POINTER (SHOWNUMBERFLAG
)},
234 {"localref", FlagTESTFLAG
, GINT_TO_POINTER (LOCALREFFLAG
)},
235 {"checkplanes", FlagTESTFLAG
, GINT_TO_POINTER (CHECKPLANESFLAG
)},
236 {"showdrc", FlagTESTFLAG
, GINT_TO_POINTER (SHOWDRCFLAG
)},
237 {"rubberband", FlagTESTFLAG
, GINT_TO_POINTER (RUBBERBANDFLAG
)},
238 {"description", FlagTESTFLAG
, GINT_TO_POINTER (DESCRIPTIONFLAG
)},
239 {"nameonpcb", FlagTESTFLAG
, GINT_TO_POINTER (NAMEONPCBFLAG
)},
240 {"autodrc", FlagTESTFLAG
, GINT_TO_POINTER (AUTODRCFLAG
)},
241 {"alldirection", FlagTESTFLAG
, GINT_TO_POINTER (ALLDIRECTIONFLAG
)},
242 {"swapstartdir", FlagTESTFLAG
, GINT_TO_POINTER (SWAPSTARTDIRFLAG
)},
243 {"uniquename", FlagTESTFLAG
, GINT_TO_POINTER (UNIQUENAMEFLAG
)},
244 {"clearnew", FlagTESTFLAG
, GINT_TO_POINTER (CLEARNEWFLAG
)},
245 {"snappin", FlagTESTFLAG
, GINT_TO_POINTER (SNAPPINFLAG
)},
246 {"showmask", FlagTESTFLAG
, GINT_TO_POINTER (SHOWMASKFLAG
)},
247 {"thindraw", FlagTESTFLAG
, GINT_TO_POINTER (THINDRAWFLAG
)},
248 {"orthomove", FlagTESTFLAG
, GINT_TO_POINTER (ORTHOMOVEFLAG
)},
249 {"liveroute", FlagTESTFLAG
, GINT_TO_POINTER (LIVEROUTEFLAG
)},
250 {"thindrawpoly", FlagTESTFLAG
, GINT_TO_POINTER (THINDRAWPOLYFLAG
)},
251 {"locknames", FlagTESTFLAG
, GINT_TO_POINTER (LOCKNAMESFLAG
)},
252 {"onlynames", FlagTESTFLAG
, GINT_TO_POINTER (ONLYNAMESFLAG
)},
253 {"newfullpoly", FlagTESTFLAG
, GINT_TO_POINTER (NEWFULLPOLYFLAG
)},
254 {"hidenames", FlagTESTFLAG
, GINT_TO_POINTER (HIDENAMESFLAG
)},
256 {"grid_units_mm", FlagUnitsMm
, NULL
},
257 {"grid_units_mil", FlagUnitsMil
, NULL
},
259 {"fullpoly", FlagSETTINGS
, OFFSET_POINTER (SettingType
, FullPoly
)},
260 {"clearline", FlagSETTINGS
, OFFSET_POINTER (SettingType
, ClearLine
)},
261 {"uniquenames", FlagSETTINGS
, OFFSET_POINTER (SettingType
, UniqueNames
)},
262 {"showsolderside", FlagSETTINGS
, OFFSET_POINTER (SettingType
, ShowBottomSide
)},
263 {"savelastcommand", FlagSETTINGS
, OFFSET_POINTER (SettingType
, SaveLastCommand
)},
264 {"saveintmp", FlagSETTINGS
, OFFSET_POINTER (SettingType
, SaveInTMP
)},
265 {"drawgrid", FlagSETTINGS
, OFFSET_POINTER (SettingType
, DrawGrid
)},
266 {"ratwarn", FlagSETTINGS
, OFFSET_POINTER (SettingType
, RatWarn
)},
267 {"stipplepolygons", FlagSETTINGS
, OFFSET_POINTER (SettingType
, StipplePolygons
)},
268 {"alldirectionlines", FlagSETTINGS
, OFFSET_POINTER (SettingType
, AllDirectionLines
)},
269 {"rubberbandmode", FlagSETTINGS
, OFFSET_POINTER (SettingType
, RubberBandMode
)},
270 {"swapstartdirection", FlagSETTINGS
, OFFSET_POINTER (SettingType
, SwapStartDirection
)},
271 {"showdrcmode", FlagSETTINGS
, OFFSET_POINTER (SettingType
, ShowDRC
)},
272 {"resetafterelement", FlagSETTINGS
, OFFSET_POINTER (SettingType
, ResetAfterElement
)},
273 {"ringbellwhenfinished", FlagSETTINGS
, OFFSET_POINTER (SettingType
, RingBellWhenFinished
)},
275 {"buffer", FlagBuffer
, NULL
},
279 REGISTER_FLAGS (flags_flag_list
)