Index: trunk/src/Makefile.dep =================================================================== --- trunk/src/Makefile.dep (revision 4881) +++ trunk/src/Makefile.dep (revision 4882) @@ -1981,11 +1981,8 @@ ../src_plugins/io_pcb/parse_common.h pcb-printf.h polygon.h rtree.h \ rats.h netlist.h route_style.h remove.h set.h flag_str.h compat_fs.h \ paths.h rats_patch.h hid_actions.h hid_flags.h \ - ../src_plugins/io_pcb/flags.h flag.h ../src_plugins/io_pcb/attribs.h \ + flag.h ../src_plugins/io_pcb/attribs.h \ route_style.h obj_poly.h -../src_plugins/io_pcb/flags.o: ../src_plugins/io_pcb/flags.c ../config.h \ - flag_str.h flag.h globalconst.h ../src_plugins/io_pcb/flags.h flag.h \ - const.h macro.h ../src_plugins/io_pcb/io_pcb.o: ../src_plugins/io_pcb/io_pcb.c \ ../config.h plugins.h ../src_plugins/io_pcb/parse_common.h plug_io.h \ library.h global_typedefs.h pcb_bool.h unit.h conf.h pcb-printf.h \ @@ -2016,7 +2013,7 @@ ../src_3rd/genvector/vtp0.h list_conf.h \ ../src_3rd/genlist/gentdlist_undef.h ../src_3rd/genlist/gentdlist_impl.h \ ../src_3rd/genlist/gendlist.h globalconst.h \ - ../src_plugins/io_pcb/flags.h flag.h crosshair.h rubberband.h \ + flag.h crosshair.h rubberband.h \ vtonpoint.h hid.h error.h drc.h attrib.h obj_line.h obj_common.h \ ../src_3rd/genlist/gendlist.h flag.h obj_poly.h polyarea.h data.h \ layer.h obj_all_list.h obj_arc_list.h obj_arc.h obj_elem_list.h \ @@ -2051,7 +2048,7 @@ rubberband.h vtonpoint.h hid.h error.h drc.h buffer.h error.h \ ../src_plugins/io_pcb/file.h plug_io.h ../src_plugins/io_pcb/parse_l.h \ polygon.h rtree.h remove.h rtree.h flag_str.h obj_pinvia_therm.h \ - rats_patch.h ../src_plugins/io_pcb/flags.h flag.h route_style.h \ + rats_patch.h flag.h route_style.h \ compat_misc.h obj_all.h ../src_plugins/io_pcb/parse_y.h ../src_plugins/jostle/jostle.o: ../src_plugins/jostle/jostle.c \ ../config.h board.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ Index: trunk/src/flag.h =================================================================== --- trunk/src/flag.h (revision 4881) +++ trunk/src/flag.h (revision 4882) @@ -94,7 +94,96 @@ /* PCB_FLAG_NOCOPY = (PCB_FLAG_FOUND | CONNECTEDFLAG | PCB_FLAG_ONPOINT)*/ } pcb_flag_values_t; +/* --------------------------------------------------------------------------- + * PCB flags - kept only for file format compatibility reasons; these bits + should be a mirror of booleans from the conf. + */ +/* %start-doc pcbfile ~pcbflags +@node PCBFlags +@section PCBFlags +@table @code +@item 0x00001 +Pinout displays pin numbers instead of pin names. +@item 0x00002 +Use local reference for moves, by setting the mark at the beginning of +each move. +@item 0x00004 +When set, only polygons and their clearances are drawn, to see if +polygons have isolated regions. +@item 0x00008 +Display DRC region on crosshair. +@item 0x00010 +Do all move, mirror, rotate with rubberband connections. +@item 0x00020 +Display descriptions of elements, instead of refdes. +@item 0x00040 +Display names of elements, instead of refdes. +@item 0x00080 +Auto-DRC flag. When set, PCB doesn't let you place copper that +violates DRC. +@item 0x00100 +Enable 'all-direction' lines. +@item 0x00200 +Switch starting angle after each click. +@item 0x00400 +Force unique names on board. +@item 0x00800 +New lines/arc clear polygons. +@item 0x01000 +Crosshair snaps to pins and pads. +@item 0x02000 +Show the solder mask layer. +@item 0x04000 +Draw with thin lines. +@item 0x08000 +Move items orthogonally. +@item 0x10000 +Draw autoroute paths real-time. +@item 0x20000 +New polygons are full ones. +@item 0x40000 +Names are locked, the mouse cannot select them. +@item 0x80000 +Everything but names are locked, the mouse cannot select anything else. +@item 0x100000 +New polygons are full polygons. +@item 0x200000 +When set, element names are not drawn. ++@item 0x800000 ++snap to certain off-grid points. ++@item 0x1000000 ++highlight lines and arcs when the crosshair is on one of their endpoints. +@end table +%end-doc */ +#define PCB_FLAGS 0x01ffffff /* all used flags */ + +#define SHOWNUMBERFLAG 0x00000001 +#define LOCALREFFLAG 0x00000002 +#define CHECKPLANESFLAG 0x00000004 +#define SHOWPCB_FLAG_DRC 0x00000008 +#define RUBBERBANDFLAG 0x00000010 +#define DESCRIPTIONFLAG 0x00000020 +#define NAMEONPCBFLAG 0x00000040 +#define AUTOPCB_FLAG_DRC 0x00000080 +#define ALLDIRECTIONFLAG 0x00000100 +#define SWAPSTARTDIRFLAG 0x00000200 +#define UNIQUENAMEFLAG 0x00000400 +#define CLEARNEWFLAG 0x00000800 +#define SNAPPCB_FLAG_PIN 0x00001000 +#define SHOWMASKFLAG 0x00002000 +#define THINDRAWFLAG 0x00004000 +#define ORTHOMOVEFLAG 0x00008000 +#define LIVEROUTEFLAG 0x00010000 +#define THINDRAWPOLYFLAG 0x00020000 +#define LOCKNAMESFLAG 0x00040000 +#define ONLYNAMESFLAG 0x00080000 +#define NEWPCB_FLAG_FULLPOLY 0x00100000 +#define HIDENAMESFLAG 0x00200000 +#define ENABLEPCB_FLAG_MINCUT 0x00400000 + + + /* For passing modified flags to other functions. */ pcb_flag_t pcb_flag_make(unsigned int); pcb_flag_t pcb_flag_old(unsigned int); Index: trunk/src/flag_str.c =================================================================== --- trunk/src/flag_str.c (revision 4881) +++ trunk/src/flag_str.c (revision 4882) @@ -538,3 +538,43 @@ { return common_flags_to_string(flags, object_type, pcb_object_flagbits, ENTRIES(pcb_object_flagbits)); } + + +#define N(x) x, sizeof(x)-1 +static pcb_flag_bits_t pcb_flagbits[] = { + {SHOWNUMBERFLAG, N("shownumber"), 1}, + {LOCALREFFLAG, N("localref"), 1}, + {CHECKPLANESFLAG, N("checkplanes"), 1}, + {SHOWPCB_FLAG_DRC, N("showdrc"), 1}, + {RUBBERBANDFLAG, N("rubberband"), 1}, + {DESCRIPTIONFLAG, N("description"), 1}, + {NAMEONPCBFLAG, N("nameonpcb"), 1}, + {AUTOPCB_FLAG_DRC, N("autodrc"), 1}, + {ALLDIRECTIONFLAG, N("alldirection"), 1}, + {SWAPSTARTDIRFLAG, N("swapstartdir"), 1}, + {UNIQUENAMEFLAG, N("uniquename"), 1}, + {CLEARNEWFLAG, N("clearnew"), 1}, + {NEWPCB_FLAG_FULLPOLY, N("newfullpoly"), 1}, + {SNAPPCB_FLAG_PIN, N("snappin"), 1}, + {SHOWMASKFLAG, N("showmask"), 1}, + {THINDRAWFLAG, N("thindraw"), 1}, + {ORTHOMOVEFLAG, N("orthomove"), 1}, + {LIVEROUTEFLAG, N("liveroute"), 1}, + {THINDRAWPOLYFLAG, N("thindrawpoly"), 1}, + {LOCKNAMESFLAG, N("locknames"), 1}, + {ONLYNAMESFLAG, N("onlynames"), 1}, + {HIDENAMESFLAG, N("hidenames"), 1}, + {ENABLEPCB_FLAG_MINCUT, N("enablemincut"), 1}, +}; +#undef N + + +char *pcbflags_to_string(pcb_flag_t flags) +{ + return common_flags_to_string(flags, PCB_TYPEMASK_ALL, pcb_flagbits, ENTRIES(pcb_flagbits)); +} + +pcb_flag_t string_to_pcbflags(const char *flagstring, int (*error) (const char *msg)) +{ + return common_string_to_flags(flagstring, error, pcb_flagbits, ENTRIES(pcb_flagbits)); +} Index: trunk/src/flag_str.h =================================================================== --- trunk/src/flag_str.h (revision 4881) +++ trunk/src/flag_str.h (revision 4882) @@ -62,10 +62,14 @@ freed. */ char *flags_to_string(pcb_flag_t flags, int object_type); +/* same as above, for pcb level flags */ +char *pcbflags_to_string(pcb_flag_t flags); +pcb_flag_t string_to_pcbflags(const char *flagstring, int (*error) (const char *msg)); + void uninit_strflags_buf(void); void uninit_strflags_layerlist(void); -/* io_pcb() needs this for historic reasons */ +/* low level */ pcb_flag_t common_string_to_flags(const char *flagstring, int (*error) (const char *msg), pcb_flag_bits_t * flagbits, int n_flagbits); char *common_flags_to_string(pcb_flag_t flags, int object_type, pcb_flag_bits_t * flagbits, int n_flagbits); Index: trunk/src_plugins/io_pcb/flags.c =================================================================== --- trunk/src_plugins/io_pcb/flags.c (revision 4881) +++ trunk/src_plugins/io_pcb/flags.c (nonexistent) @@ -1,69 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 2005 DJ Delorie - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * DJ Delorie, 334 North Road, Deerfield NH 03037-1110, USA - * dj@delorie.com - * - */ - -#include "config.h" -#include "flag_str.h" -#include "flags.h" -#include "const.h" -#include "macro.h" - -#define N(x) x, sizeof(x)-1 -static pcb_flag_bits_t pcb_flagbits[] = { - {SHOWNUMBERFLAG, N("shownumber"), 1}, - {LOCALREFFLAG, N("localref"), 1}, - {CHECKPLANESFLAG, N("checkplanes"), 1}, - {SHOWPCB_FLAG_DRC, N("showdrc"), 1}, - {RUBBERBANDFLAG, N("rubberband"), 1}, - {DESCRIPTIONFLAG, N("description"), 1}, - {NAMEONPCBFLAG, N("nameonpcb"), 1}, - {AUTOPCB_FLAG_DRC, N("autodrc"), 1}, - {ALLDIRECTIONFLAG, N("alldirection"), 1}, - {SWAPSTARTDIRFLAG, N("swapstartdir"), 1}, - {UNIQUENAMEFLAG, N("uniquename"), 1}, - {CLEARNEWFLAG, N("clearnew"), 1}, - {NEWPCB_FLAG_FULLPOLY, N("newfullpoly"), 1}, - {SNAPPCB_FLAG_PIN, N("snappin"), 1}, - {SHOWMASKFLAG, N("showmask"), 1}, - {THINDRAWFLAG, N("thindraw"), 1}, - {ORTHOMOVEFLAG, N("orthomove"), 1}, - {LIVEROUTEFLAG, N("liveroute"), 1}, - {THINDRAWPOLYFLAG, N("thindrawpoly"), 1}, - {LOCKNAMESFLAG, N("locknames"), 1}, - {ONLYNAMESFLAG, N("onlynames"), 1}, - {HIDENAMESFLAG, N("hidenames"), 1}, - {ENABLEPCB_FLAG_MINCUT, N("enablemincut"), 1}, -}; -#undef N - -char *pcbflags_to_string(pcb_flag_t flags) -{ - return common_flags_to_string(flags, PCB_TYPEMASK_ALL, pcb_flagbits, ENTRIES(pcb_flagbits)); -} - -pcb_flag_t string_to_pcbflags(const char *flagstring, int (*error) (const char *msg)) -{ - return common_string_to_flags(flagstring, error, pcb_flagbits, ENTRIES(pcb_flagbits)); -} Index: trunk/src_plugins/io_pcb/Plug.tmpasm =================================================================== --- trunk/src_plugins/io_pcb/Plug.tmpasm (revision 4881) +++ trunk/src_plugins/io_pcb/Plug.tmpasm (revision 4882) @@ -1,5 +1,11 @@ put /local/pcb/mod {io_pcb} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/io_pcb/io_pcb.o $(PLUGDIR)/io_pcb/file.o $(PLUGDIR)/io_pcb/parse_y.o $(PLUGDIR)/io_pcb/parse_l.o $(PLUGDIR)/io_pcb/flags.o $(PLUGDIR)/io_pcb/attribs.o @] +put /local/pcb/mod/OBJS [@ + $(PLUGDIR)/io_pcb/io_pcb.o + $(PLUGDIR)/io_pcb/file.o + $(PLUGDIR)/io_pcb/parse_y.o + $(PLUGDIR)/io_pcb/parse_l.o + $(PLUGDIR)/io_pcb/attribs.o +@] put /local/pcb/mod/YACC {$(PLUGDIR)/io_pcb/parse_y} put /local/pcb/mod/LEX {$(PLUGDIR)/io_pcb/parse_l} @@ -8,3 +14,4 @@ case {plugin} include /local/pcb/tmpasm/plugin; end; case {disable} include /local/pcb/tmpasm/disable; end; end + Index: trunk/src_plugins/io_pcb/parse_l.c =================================================================== --- trunk/src_plugins/io_pcb/parse_l.c (revision 4881) +++ trunk/src_plugins/io_pcb/parse_l.c (revision 4882) @@ -680,7 +680,7 @@ #include #endif -#include "flags.h" +#include "flag_str.h" #include "crosshair.h" #include "data.h" Index: trunk/src_plugins/io_pcb/parse_l.l =================================================================== --- trunk/src_plugins/io_pcb/parse_l.l (revision 4881) +++ trunk/src_plugins/io_pcb/parse_l.l (revision 4882) @@ -46,7 +46,7 @@ #include #endif -#include "flags.h" +#include "flag_str.h" #include "crosshair.h" #include "data.h" Index: trunk/src_plugins/io_pcb/parse_y.c =================================================================== --- trunk/src_plugins/io_pcb/parse_y.c (revision 4881) +++ trunk/src_plugins/io_pcb/parse_y.c (revision 4882) @@ -113,9 +113,9 @@ #include "remove.h" #include "rtree.h" #include "flag_str.h" +#include "flag_str.h" #include "obj_pinvia_therm.h" #include "rats_patch.h" -#include "flags.h" #include "route_style.h" #include "compat_misc.h" #include "obj_all.h" Index: trunk/src_plugins/io_pcb/parse_y.y =================================================================== --- trunk/src_plugins/io_pcb/parse_y.y (revision 4881) +++ trunk/src_plugins/io_pcb/parse_y.y (revision 4882) @@ -50,9 +50,9 @@ #include "remove.h" #include "rtree.h" #include "flag_str.h" +#include "flag_str.h" #include "obj_pinvia_therm.h" #include "rats_patch.h" -#include "flags.h" #include "route_style.h" #include "compat_misc.h" #include "obj_all.h"