Index: 1.0.8/AUTHORS =================================================================== --- 1.0.8/AUTHORS (nonexistent) +++ 1.0.8/AUTHORS (revision 1136) @@ -0,0 +1,9 @@ +pcb-rnd maintainer: Tibor 'Igor2' Palinkas +email: pcb-rnd (at) igor2.repo.hu + +PCB was originally written by Thomas Nau +Development was later taken over by harry eaton +The port to GTK was done by Bill Wilson +Dan McMahill converted the build system from imake to autoconf/automake. +DJ Delorie wrote the trace optimizer, added symbolic flag support and +many other improvements. Index: 1.0.8/COPYING =================================================================== --- 1.0.8/COPYING (nonexistent) +++ 1.0.8/COPYING (revision 1136) @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. Index: 1.0.8/Changelog =================================================================== --- 1.0.8/Changelog (nonexistent) +++ 1.0.8/Changelog (revision 1136) @@ -0,0 +1,288 @@ +pcb-rnd 1.0.8 +~~~~~~~~~~~~~ + [doc-rnd] + -Add: djopt examples + + [mods] + -Cleanup: split up action.c and spread the code in core and plugins + -Move: action pscalib() to the ps hid code + -Move: autoplace to a core plugin + -Move: autoroute to a core plugin + -Move: dbus to a defunct core plugin + -Move: djopt to a core plugin + -Move: edif to a core plugin + -Move: gpmi to a core plugin + -Move: import_sch to a core plugin + -Move: mincut to a core plugin + -Move: oldactions to a core plugin + -Move: puller to a core plugin + -Move: renumber to a core plugin + -Move: stroke to a core plugin + -Move: toporouter to a core plugin + -Move: vendordrill to a core plugin + + [ba] + -Add: when applying patches to the edited netlist, create missing nets + (new connections may implicitly define new nets) + -Fix: get the renumber action() fixed + -Fix: enable net(add,net,pin) action again and make it operate on the + edited netlist for the back annotation to take notes of the + changes made + + [libstroke] + -Add: menu in the gtk hid's res to toggle stroke enable + -Fix: osolete calls in libstroke action - libstroke support compiles now + -Fix: get the gtk gui call the central crosshair move event handler + instead of reproducing its code locally (... without libstroke) + + [util] + -Add: make clean + -Fix: compiler warnings, mostly unused vars in gsch2pcb + -Cleanup: indentation in gsch2pcb + + +pcb-rnd 1.0.7 +~~~~~~~~~~~~~ + -Cleanup: src/ should compile in c89 - no more // comments and variables declared in for() + -Cleanup: const correctness in src/ + -Cleanup: missing #includes in src/ + -Cleanup: unified, tab based indentation all over src/ + -Cleanup: move dmalloc include to central config.h + -Cleanup: move gts to src/3rd + -Cleanup: remove old/obsolete files inherited from the fork + -Cleanup: rename doc/ to doc-orig/ to avoid confusion and make it compile + -Fix: poly pin bounding box calculation adds clearance as rtree expects ([square]) + -Fix: loading default.pcb shouldn't override cursor pos and board sizes and shoudln't cause file date to be changed in the gui hids since it is loading a "misc" file + -Add: README in each main directory to explain what the directory is for + +pcb-rnd 1.0.6 +~~~~~~~~~~~~~ + [cycdrag] + -Add: "negative sized" selection selects anything that touches + -Add: cycle drag object action + + [scconfig] + -Fix: toporouter Makefile module adds its own action registration code, + so the central Makefile is independent of toporouter + -Add: --disable-toporouter + -Fix: use cc/cc for c compiler (so that it can be overridden) + -Fix: remove -std=gnu99: -std=c99 breaks with new gcc and -std is not + really portable + -Fix: include genht before glib.h because glib.h ruins inline + + [pinnum] + -Add: action and key binding for changing pin numbers in a footprint + + [gpmi] + -Fix: typo in hotkey name for manage plugins (reported by Bert Timmerman) + + [util] + -Fix: keylist: tolerate whitepsace in key sequences + -Fix: keylist resets locale to avoid broken table when gawk tries to + be too clever + + +pcb-rnd 1.0.5 +~~~~~~~~~~~~~ + [onpoint] + -Add: Robert Drehmel's on-point patch adapted for pcb-rnd + + [scconfig] + -Fix: properly configure and build and install even if there's space + in the source path (thanks to Jason White) + -Fix: take genht from the local copy, don't depend it being installed + +pcb-rnd 1.0.4 +~~~~~~~~~~~~~ + [ba] + -Add: back annotation + + [core] + -Fix: suppress no-font error message while loading default.pcb - the actual font is coming from the default font file + + [pcblib-param] + -Add: screw(), low level + -Fix: typo in the help of rcy() + + [mincut] + -Fix: solve debug works again + -Fix: make debug pngs during load optional + -Fix: don't use function-in-function - that's a gcc-specific feature + -Fix: don't use alloca(), use malloc() (C99) + -Add: Makefile to test against known refs + + [pcb-fp] + -Fix: gtk lib window tag print doesn't segfault if there are no tags for a footprint + -Del: local hash and library search implementation for footprint names in buffer.c - libpcb_fp should handle this + +pcb-rnd 1.0.3 +~~~~~~~~~~~~~ + [gpmi] + -Add: GPMI plugin/buildin for scripiting (import of project pcb-gpmi) + + [tostyle] + -Add: new feature to adjust the sizes of object(s) to the values of the current routing style + + [pcb-fp] + -Add: support for parsing and caching footprint tags (file elements) + -Add: the gtk HID displays tags + -Add: the gtk HID can filter for tags + + [pcblib-param] + -Add: bga() + -Add: generic qf() generator + -Add: qfn() - based on qf() + -Add: qfp() - based on qf() + -Add: plcc() - based on qf() + -Add: qsop() - based on so() + -Add: silkmark: accept multiple values + -Add: silkmark: can be external + -Add: silkmark: new styles exteranl45, dot, circle, and arc + -Add: connector() has a sequence option to change pin numbering + -Add: some tunings for connector sequence=zigzag to do something usable with etrunc=1 + + [hid] + -Add: dynamic menus: create_menu(), menu paths, runtime insertion of menus in core + -Add: dynamic menus in gtk + -Add: dynamic menus in lesstif + -Fix: more const correctness in dialog box code + + [scconfig] + -Add: ./configure --help + -Add: print configuration summary at the end + -Add: autodetect HOST (use sys/sysid) + -Add: src/3rd for central hosting of 3rd party software libs + -Add: support "buildins": plugins built into the code + -Change: move genht to src/3rd; policy: prefer genht over glib hash + -Fix: tests try to run pcb-rnd, not pcb + -Fix: central LDFLAGS and CFLAGS should contain the ldflags/cflags detected for generic use + + [pcb-mincut] + -Merge: pcb-mincut is imported in pcb-rnd, the extern repo will be removed + + [core] + -Add: event subsystem + -Add: gui_init event + -Add: generic plugin support: track plugins loaded, have a menu for managing them + -Add: more accessors to query unit details - for the gpmi scripts + -Add: pcb-printf %mI prints coordinate in internal coord format + -Add: calls for removing actions + -Add: calls for removing a hid (useful for removing exporter hids registered by scripts) + -Add: path resolution: support ~ in paths + -Add: real regex search and real string list search (in search by name actions) + -Change: switch over actions from bsearch() to a genht hash - simpler code, potentially also faster + -Fix: don't allow the registration of an action with a name that's already registered + + + [fp2anim] + -Add: optional dimension lines + -Add: more fine grained annotation control + -Change: switch over to vector fonts for better scaling + -Fix: draw rounded pads (new pad syntax only) + -Fix: make sure to generate sane arcs + + [doc-rnd] + -Add: official central key list + +pcb-rnd 1.0.2 +~~~~~~~~~~~~~ + [pcblib-param] + -Fix: central bool handling (connector() etrunc), values: on/off, true/false, 1/0 + -Fix: typo in so() parameter descriptions + -Fix: connector() typo in error() + -Add: more elaborate help syntax: easier to read with scripts + + [fp2anim] + -Fix: read multiline directives properly - a newline after each directive is still needed, tho + -Fix: allow whitepsace between directive name and opening bracket + -Fix: create all layers in advance - this fixes the case when the fp doesn't draw on some layers (the macro still exists) + -Fix: rline() is extended by width/2 if there are no rounding; it seems this how pcb defines lines + -Fix: leave extra margin in photo mode for the 3d edges + -Add: support for old-style pad() + -Add: support for Mark() (relocate the diamond) + -Add: options to turn off the grid and annotation - useful for thumbnails + + [scconfig] + -Fix: always have config.h, don't ifdef it + -Fix: glib is a core dependency that should be added even if the gtk hid is not used + -Fix: make clean removes pcb-rnd, not pcb (executable file name typo) + -Add: make clean in util/ + -Add: options to disable gd and/or jpeg or png or gif + -Add: be able to detect and configure lesstif + -Add: --disable-gtk and --disable-lesstif; --disable-xinerama and --disable-xrender for lesstif + -Add: use detected -rdynamic so that plugins can link against the executable + -Change: detect both gtk and lesstif as optional dependencies + -Cleanup: generate hidlist.h from tmpasm instead of shell to remove shell dependency + -Del: a bunch of obsolete #defines inherited from auto* + + [core] + -Add: --gui explicitly selects a gui hid + -Add: don't leave preferred order of GUIs to the chance, make it explicit + + +pcb-rnd 1.0.1 +~~~~~~~~~~~~~ + [core] + -Fix: don't read beyond the common part of the struct in IsPointInPad (since it's called for lines too, and those have much less fields) + -Fix: where stdarg is avaialble, also print messages to stderr - useful if things go wrong before a GUI is working + + [gtk] + -Fix: don't crash but write error message and exit if gpcb-menu.res is empty + + [square] + -Fix: 90 deg rotation rotates shape style + -Add: action.c and change.c code to get shaped vias + -Fix: don't change pin shape for square and octagon in rotation + + [mincut] + -Add: command line setting --enable-mincut (0 or 1) as mincut can be slow + it is a global disbale setting and make a local, per pcb setting + for enabling mincut; also add a per pcb setting/flag + -Fix: disable debug draw by default + -Fix: fall back to the old short warn method when mincut fails + -Fix: avoid segfaults by detecting broken graph early + -Workaround: if mincut sees a graph with multiple unconnected components, doesn't try to solve but falls back to randomly highlight something + + [intconn] + -Workaround: find intconn pads only on the same layer + + [nonetlist] + -Workaround: ignore nonetlist pads even if the flag is in the element name + + [scconfig] + -Add: scconfig/ - switch over from autotools to scconfig + + [pcblib] + -Cleanup: new, trimmed back pcblib/ with essential footprints only + + [pcblib-param] + -Add: new parametric footprints - no more m4-hardwiring, use your + preferred language! + -Add: acy(), alf(), rcy(), connector(), dip() + -Add: so(), tssop(), msop(), ssop() + + [pcb-fp] + -Add: central lib for footprint search and load in pcb and gsch2pcb + + [util] + -Add: gsch2pcb fork to support [nonetlist] and [pcblib-param] + + [fp2anim] + -Add: fp to animator script for fast preview + + [polygrid] + -Add: ps output: draw grid in polys instead of fill (doesn't fully work) + -Fix: set proper max value so the control is enabled + + + [debian] + -Update: build the package with scconfig and footprint changes + + +pcb-rnd 1.0.0 +~~~~~~~~~~~~~ + [square] -Add: initial implementation + [intconn] -Add: initial implementation + [nonetlist] -Add: initial implementation + [flagcomp] -Add: initial implementation + [mincut] -Add: initial implementation Index: 1.0.8/INSTALL =================================================================== --- 1.0.8/INSTALL (nonexistent) +++ 1.0.8/INSTALL (revision 1136) @@ -0,0 +1,140 @@ +Run ./configure. + +You may want to edit config.manual.h and globalconst.h to change +user preference defaults. + +Run make. + +Run make install. + +-- + +PCB is organized into a core program that deals with all of the +internal database procedures and a collection of Human Interface +Devices (HID's). The HID's provide exporting/printing capability +as well as a graphical user interface. At the time of writing +this document PCB includes the following HIDs: + +TODO: this doesn't work with scconfig: +GUI HID's: + gtk -- GTK based GUI. This is the default GUI. You will + need gtk-2.4 or newer installed (both the runtime + files as well as the developer headers). You only + need gtk if you want the gtk HID. + + lesstif -- motif/lesstif based GUI. To use the lesstif HID + you will need Motif, OpenMotif, or Lesstif installed. + Again you need both libraries and headers. + + The choice of which gui to use (if you want something other than + the default of GTK) is indicated with the --with-gui configure + option. Examples are: + --with-gui=lesstif = picks the lesstif HID + --with-gui=gtk = picks the GTK HID + --without-gui = specifies that no GUI will be built. This + option is primarily intended for use in a + web server environment where you may wish + to export .pcb files to graphical files on + the fly but you do not want to install + X11 or any GUI tooliks on the server. + +Export HID's: + ps -- Postscript and Encapsulated Postscript output. No + additional libraries are needed for this. + + gcode -- CNC G-CODE output (experimental). The gdlib library + is used by this HID. gdlib may be found at + http://www.libgd.org + + gerber -- RS-274-X (Gerber) and Excellon drill output. No + additional libraries are needed for this. + + bom -- Bill of materials (BOM) and Centroid (X-Y) output. + No additional libraries are needed for this. + + png -- png/gif/jpeg output. This HID uses gdlib to do + the majority of the work. gdlib may be obtained + from http://www.libgd.org. At the time of + writing this document, I have tested with + gd-2.0.23 and gd-2.0.33. Other versions may + work as well. + + Since some installations of gdlib may not support + all three of the formats mentioned here (png, gif, + and jpeg), PCB provides configure options to individually + turn off each of these output formats. These options + are: + --disable-gif, --disable-jpeg, and --disable-png + By having you, the user, explicitly turn off the different + formats hopefully it will avoid suprises when the + disabled formats are not available at runtime. + + The choice of which export HID's to compile is indicated with: + + --with-exporters="ps gerber bom png" + + By default all available exporters will be configured in if --with-exporters + is not given. + +Printer HID's: + lpr -- Unix line printer support. No additional libraries are + needed for this. + + The choice of which printer HID's to compile is indicated with: + + --with-printers="lpr" + + By default all available printers will be configured in if --with-printers + is not given. + +In addition to the libraries listed above, there is a graphical QFP footprint +creator which uses TCL/TK. If you do not wish to use this feature, and you +do not have TCL/TK installed on your system, you may simply set WISH to +/usr/bin/true in your configure environment. For example: + + env WISH=/usr/bin/true ./configure + + +Please refer to the output of + + ./configure --help + +for the most up to date details on the options. + +After running ./configure with your selected options, run + + make + +to build PCB. You can try out the program by running + + cd src + ./pcbtest.sh + +prior to installation. + +To install PCB after it has been built run: + + make install + +from the top level directory. + +-------- Summary of dependencies -------------------- + +- GNU m4. In particular your m4 must support -F for frozen files. + +- wish (part of tcl/tk). If not installed, set WISH=/bin/false in + your configure environment and you just won't get the graphical + QFP footprint builder + +- gtk if you are using the gtk frontend + +(- motif or lesstif if you are using the lesstif frontend) + +- gdlib if you are using the png HID + +- (GNU) make for building + +- flex + +- bison + Index: 1.0.8/Makefile =================================================================== --- 1.0.8/Makefile (nonexistent) +++ 1.0.8/Makefile (revision 1136) @@ -0,0 +1,36 @@ +all: + cd src && make + cd util && make + cd pcblib && make + cd tutorial && make + +clean: + cd src && make clean + cd util && make clean + cd pcblib && make clean + cd tutorial && make clean + +install: + cd src && make install + cd util && make install + cd pcblib && make install + cd tutorial && make install + +linstall: + cd src && make linstall + cd util && make linstall + cd pcblib && make linstall + cd tutorial && make linstall + +uninstall: + cd src && make uninstall + cd util && make uninstall + cd pcblib && make uninstall + cd tutorial && make uninstall + +deb: + fakeroot debian/rules clean + fakeroot debian/rules binary + +debclean: + fakeroot debian/rules clean Index: 1.0.8/Makefile.conf.in =================================================================== --- 1.0.8/Makefile.conf.in (nonexistent) +++ 1.0.8/Makefile.conf.in (revision 1136) @@ -0,0 +1,12 @@ +print [@# generated by ./configure, do not modify +# prefix is @/local/prefix@ +DOCDIR=$(install_root)@/local/prefix@/share/doc/pcb-rnd +LIBDIR=$(install_root)@/local/prefix@/lib/pcb-rnd +BINDIR=$(install_root)@/local/prefix@/bin +ETCDIR=$(install_root)/etc +DATADIR=$(install_root)@/local/prefix@/share/pcb-rnd +RM=@fstools/rm@ +CP=@fstools/cp@ +LN=@fstools/ln@ +MKDIR=@fstools/mkdir@ +@] Index: 1.0.8/README =================================================================== --- 1.0.8/README (nonexistent) +++ 1.0.8/README (revision 1136) @@ -0,0 +1,27 @@ +Pcb-rnd is a fork of PCB, adding a lot of random features and patches, +hosted at http://repo.hu/projects/pcb-rnd (src: svn://repo.hu/pcb-rnd/trunk). + +Pcb is a CAD (computer aided design) program for the physical +design of printed circuit boards. + +For installing the release refer to the file 'INSTALL'. +For additional information read the manual (doc/pcb.pdf) + +If you are updating you may wish to read the ChangeLog + +There is also a bug tracking system available which can +be found from http://pcb.gpleda.org. + + +------------------------------------------------------------------------- + COPYRIGHT + +PCB is covered by the GNU General Public License. See the individual +files for the exact copyright notices. + + Contact addresses for paper mail and Email: + harry eaton + 6697 Buttonhole Court + Columbia, MD 21044 + haceaton@aplcomm.jhuapl.edu + Index: 1.0.8/README.w32 =================================================================== --- 1.0.8/README.w32 (nonexistent) +++ 1.0.8/README.w32 (revision 1136) @@ -0,0 +1,22 @@ +Building PCB for Windows with a MinGW cross-compiler + +1) Install a MinGW cross-compiler. +On Debian and derivatives, you can type 'sudo apt-get install mingw32.'. +You can also build your own by using the build script provided by the +MinGW project. + +2) Install native (non-cross) dependencies. + +* autoconf, automake, libtool, gettext, intltool. +* glib and gtk+. + +3) Edit the w32/minipack.conf file to suit your compiler setup. + +4) Enter the w32 directory and run ./build_all. + +5) Wait while the script fetches and compiles the PCB dependencies and PCB itself. + +6) Run the result with wine: wine result/bin/pcb.exe + +7) Copy the result directory to a Windows installation (packaging script is not supplied). + Index: 1.0.8/Release_notes =================================================================== --- 1.0.8/Release_notes (nonexistent) +++ 1.0.8/Release_notes (revision 1136) @@ -0,0 +1,12 @@ +pcb-rnd 1.0.8 +~~~~~~~~~~~~~ +1.0.8 is the second phase of the large scale cleanup started at 1.0.7. + +Major changes: + +- more than 40% of the core code has been turned into plugins + (see http://repo.hu/projects/pcb-rnd/mods) +- revive libstroke support (should work with the gtk HID) +- fix the remaining TODOs in back annotation, including action net(add,net,pin) +- revive the renumber code (was on hold because of the back annotation patch) +- clean up util/ (compiler warnings, indentation) Index: 1.0.8/config.auto.h.in =================================================================== --- 1.0.8/config.auto.h.in (nonexistent) +++ 1.0.8/config.auto.h.in (revision 1136) @@ -0,0 +1,298 @@ +print [@ /***** Generated by scconfig - DO NOT EDIT *****/ + + +/**** GL ****/ + +/* Define to 1 if GL support is to be compiled in */ +/* #undef ENABLE_GL */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GL_GLU_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GL_GL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENGL_GLU_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENGL_GL_H */ + +/**** DBUS ****/ + +/* Define to 1 if DBUS IPC is to be compiled in */ +/* #undef HAVE_DBUS */ + +/* Define to 1 if you have the `dbus_watch_get_unix_fd' function. */ +/* #undef HAVE_DBUS_WATCH_GET_UNIX_FD */ + + +/**** TODO ****/ + +/* Define to 1 if you have the `canonicalize_file_name' function. */ +#define HAVE_CANONICALIZE_FILE_NAME 1 + + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the `getpwuid' function. */ +#define HAVE_GETPWUID 1 + +/* Define to 1 if you have the `mkdir' function. */ +#define HAVE_MKDIR 1 + +/* Define to 1 if you have the `_mkdir' function. */ +/* #undef HAVE__MKDIR */ + + +/* Define to 1 if you have the `mkdtemp' function. */ +#define HAVE_MKDTEMP 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_PWD_H 1 + +/* Define to 1 if you have the `rand' function. */ +#define HAVE_RAND 1 + +/* Define to 1 if you have the `random' function. */ +#define HAVE_RANDOM 1 + +/* Define to 1 if you have the `realpath' function. */ +#define HAVE_REALPATH 1 + +/* Define to 1 if you have the `regcomp' function. */ +#define HAVE_REGCOMP 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_REGEX_H 1 + +/* Define to 1 if you have the `re_comp' function. */ +#define HAVE_RE_COMP 1 + +/* Define to 1 if you have the `rint' function. */ +#define HAVE_RINT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIMES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINDOWS_H */ + + +/* Define to 1 if you have the `_spawnvp' function. */ +/* #undef HAVE__SPAWNVP */ + + +/* Define if mkdir takes only one argument. */ +/* #undef MKDIR_TAKES_ONE_ARG */ + +/* Define if canonicalize_file_name is not declared in system header files. */ +/* #undef NEED_DECLARATION_CANONICALIZE_FILE_NAME */ + +/* Define as the maximum value of type 'size_t', if the system doesn't define + it. */ +/* #undef SIZE_MAX */ + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + +/****************************************************************************/ +/* These are all in C89 - pcb-rnd does not support anything below C89, so + these are safe to hardwire */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDARG_H 1 + +/****************************************************************************/ +/* Package properties */ + +/* Name of package */ +#define PACKAGE "pcb" + +/* Name of this program's gettext domain */ +#define GETTEXT_PACKAGE "pcb" + +/****************************************************************************/ +/* These ones are already autodetected by scconfig */ +@] + + + +print {\n\n/* Define to 1 if you have `alloca', as a function or macro. */ \n} +print_ternary cc/alloca/presents {#define HAVE_ALLOCA 1} {/* #undef HAVE_ALLOCA */} + +print {\n\n/* Define to 1 if you have the `putenv' function. */\n} +print_ternary libs/env/putenv/presents {#define HAVE_PUTENV 1} {/* #undef HAVE_PUTENV */} + +print {\n\n/* Define to 1 if you have the `setenv' function. */\n} +print_ternary libs/env/setenv/presents {#define HAVE_SETENV 1} {/* #undef HAVE_SETENV */} + +print {\n\n/* Define to 1 if you have the `snprintf' function. */\n} +print_ternary libs/snprintf {#define HAVE_SNPRINTF 1} {/* #undef HAVE_SNPRINTF */} + +print {\n\n/* Define to 1 if you have the `vsnprintf' function. */\n} +print_ternary libs/vsnprintf {#define HAVE_VSNPRINTF 1} {/* #undef HAVE_VSNPRINTF */} + +print {\n\n/* Define to 1 if you have the `getcwd' function. */\n} +print_ternary libs/fs/getcwd/presents {#define HAVE_GETCWD 1} {/* #undef HAVE_GETCWD */} + +print {\n\n/* Define to 1 if you have the `expf' function. */\n} +print_ternary libs/math/expf/presents {#define HAVE_EXPF 1} {/* #undef HAVE_EXPF */} + +print {\n\n/* Define to 1 if you have the `logf' function. */\n} +print_ternary libs/math/logf/presents {#define HAVE_LOGF 1} {/* #undef HAVE_LOGF */} + +print {\n\n/* Define to 1 if you have the header file. */\n} +print_ternary libs/gui/gd/presents {#define HAVE_GD_H 1} {/* #undef HAVE_GD_H */} + +print {\n\n/* Define to 1 if you have the `gdImageGif' function. */\n} +print_ternary libs/gui/gd/gdImageGif/presents {#define HAVE_GDIMAGEGIF 1} {/* #undef HAVE_GDIMAGEGIF */} + +print {\n\n/* Define to 1 if you have the `gdImageJpeg' function. */\n} +print_ternary libs/gui/gd/gdImageJpeg/presents {#define HAVE_GDIMAGEJPEG 1} {/* #undef HAVE_GDIMAGEGIF */} + +print {\n\n/* Define to 1 if you have the `gdImagePng' function. */\n} +print_ternary libs/gui/gd/gdImagePng/presents {#define HAVE_GDIMAGEPNG 1} {/* #undef HAVE_GDIMAGEGIF */} + +print {\n\n/* Wrapper for S_ISLNK(x); always return 0 if S_ISLNK doesn't exist */\n} +switch /target/libs/fs/stat/macros/S_ISLNK + case {} print {#define WRAP_S_ISLNK(x) 0}; end; + default print [@#define WRAP_S_ISLNK(x) @/target/libs/fs/stat/macros/S_ISLNK@(x)@]; end; +end; + +print {\n\n/* Define to 1 if Xinerama is available */\n} +print_ternary libs/gui/xinerama/presents {#define HAVE_XINERAMA 1} {/*#undef HAVE_XINERAMA */} + +print {\n\n/* Define to 1 if Xrender is available */\n} +print_ternary libs/gui/xrender/presents {#define HAVE_XRENDER 1} {/*#undef HAVE_XRENDER */} + + + +print [@ + +/* The host "triplet" - it's really a pair now: machine-os */ +#define HOST "@sys/sysid@" + + +/* Directory separator char */ +#define PCB_DIR_SEPARATOR_C '@sys/path_sep@' + +/* Directory separator string */ +#define PCB_DIR_SEPARATOR_S "@sys/path_sep@" + +/* Search path separator string */ +#define PCB_PATH_DELIMETER ":" + +/* m4 program used by pcb */ +#define GNUM4 "@libs/script/m4/bin/path@" + + +/****************************************************************************/ +/* Paths */ + +/* library file name */ +#define LIBRARYFILENAME "pcblib" + +#define PCB_PREFIX "@/local/prefix@" +#define PCBSHAREDIR PCB_PREFIX "/share/pcb-rnd" +#define PCBLIBDIR PCB_PREFIX "/lib/pcb-rnd" +#define PCB_LIBRARY_SHELL NULL +#define PCB_LIBRARY_SEARCH_PATHS \ + "./pcblib"\ + ":" \ + "./footprints"\ + ":" \ + "../pcblib"\ + ":" \ + PCB_PREFIX "/share/pcb-rnd/pcblib"\ + ":"\ + PCB_PREFIX "/share/pcb/pcblib-newlib" + +/* NOTE: /share/pcb/pcblib-newlib is kept as a temporary hack for compatibility */ + +#define PCB_DEFAULT_PCB_FILE PCBSHAREDIR "/default.pcb" +#define PCB_DEFAULT_PCB_FILE_SRC "./default.pcb" + +#define BINDIR PCB_PREFIX "/bin" + +/* Relative path from bindir to exec_prefix */ +#define BINDIR_TO_EXECPREFIX ".." + +/* Relative path from bindir to pcbsharedir TODO: do we still need this? */ +#define BINDIR_TO_PCBSHAREDIR "../share/pcb-rnd" + +/* Version number of package */ +#define VERSION "@/local/version@" +#define REVISION "@/local/revision@" + +#ifdef HAVE_LIBDMALLOC +#include +#endif + +@] + + + + + Index: 1.0.8/config.h =================================================================== --- 1.0.8/config.h (nonexistent) +++ 1.0.8/config.h (revision 1136) @@ -0,0 +1,2 @@ +#include "config.manual.h" +#include "config.auto.h" Index: 1.0.8/config.manual.h.in =================================================================== --- 1.0.8/config.manual.h.in (nonexistent) +++ 1.0.8/config.manual.h.in (revision 1136) @@ -0,0 +1,29 @@ +print [@ +/**** User preferences - feel free to edit this file any time ****/ + +/* Fake binary path, bypassing the clever heuristics that determine it + using the real path of the binary. The heuristics fails if the binary + is a symlink to the source, taking the source dir instead of /usr/bin. + + You need this if you want to use make linstall. +*/ +/* #define FAKE_BINDIR BINDIR */ + +/* Maximum value of coordinate type */ +#define COORD_MAX LONG_MAX + +/* C type for Coordinates */ +#define COORD_TYPE long + +/* Define to 1 if you have the `dmalloc' library (-ldmalloc); + (memory debugging without valgrind) */ +/* #undef HAVE_LIBDMALLOC */ + +/* Define to 1 to enable toporouter graphical output */ +#define TOPO_OUTPUT_ENABLED 0 + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#define ENABLE_NLS 1 + +@] Index: 1.0.8/configure =================================================================== --- 1.0.8/configure (nonexistent) +++ 1.0.8/configure (revision 1136) @@ -0,0 +1,5 @@ +#!/bin/sh +cd scconfig +make +./configure $* + Property changes on: 1.0.8/configure ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/data/Makefile =================================================================== --- 1.0.8/data/Makefile (nonexistent) +++ 1.0.8/data/Makefile (revision 1136) @@ -0,0 +1,64 @@ +# This Makefile is a plain old hand written one; all configuration settings +# are included from ../Makefile.conf which is scconfig generated + +theme = hicolor + +app_icon = pcb + +mime_icons = \ + application-x-pcb-layout \ + application-x-pcb-footprint \ + application-x-pcb-netlist \ + application-x-gerber \ + application-x-excellon + +app_icon_files = \ + $(app_icon:%=%-48.png) \ + $(app_icon:%=%.svg) +# $(app_icon:%=%-16.png) +# $(app_icon:%=%-22.png) +# $(app_icon:%=%-24.png) +# $(app_icon:%=%-32.png) + +mime_icon_files = \ + $(mime_icons:%=%-16.png) \ + $(mime_icons:%=%-22.png) \ + $(mime_icons:%=%-24.png) \ + $(mime_icons:%=%-32.png) \ + $(mime_icons:%=%-48.png) \ + $(mime_icons:%=%.svg) + +mime_icon_sources = \ + $(mime_icons:%=%-16.svg) \ + $(mime_icons:%=%-22.svg) \ + $(mime_icons:%=%-32.svg) \ + $(mime_icons:%=%-48.svg) + +theme_icons = \ + $(mime_icon_files:%=mimetypes,%) \ + $(app_icon_files:%=apps,%) + +all: + +install_: + ./icon-theme-installer \ + -t $(theme) \ + -m "$(MKDIR)" \ + -s `pwd` \ + -d x \ + -b "$(themedir)" \ + -x "$(CPC)" \ + -i $(theme_icons) + +install: + make install_ CPC="$(CP)" + +linstall: + make install_ CPC="$(LN)" + +uninstall: + $(RM) $(DOCDIR)/examples/tut1.pcb + +include ../Makefile.conf +themedir=$(DATADIR)/icons/$(theme) + Index: 1.0.8/data/README =================================================================== --- 1.0.8/data/README (nonexistent) +++ 1.0.8/data/README (revision 1136) @@ -0,0 +1,56 @@ + +PCB +------------------------------------------------------------------------------ + +README for icon data + +This file describes where the various icons came from and their license. + +The PCB layout and gerber icons and mime registration data were contributed +by Tomaz Solc, and subsequently modified by Peter Clifton, including +creation of an excellon icon file with a ruler element taken from +Tomaz's gerber icon. The footprint and netlist icons were drawn by +Peter Clifton. + +The page outline featured in all the above icons is from the GNOME icon +theme's text-x-generic icon by Jakub Steiner. + +The icons are licensed under the GPL2 license. + +Scalable versions: (128x128 canvas for the "hicolor" fallback theme). +These were scaled up from the 48x48 pixel targeted version. + +application-x-excellon.svg +application-x-gerber.svg +application-x-pcb-footprint.svg +application-x-pcb-layout.svg +application-x-pcb-netlist.svg + +Pixel targeted varients: + +application-x-excellon-{16,22,32,48}.svg +application-x-gerber-{16,22,32,48}.svg +application-x-pcb-footprint-{16,22,32,48}.svg +application-x-pcb-layout-{16,22,32,48}.svg +application-x-pcb-netlist-{16,22,32,48}.svg + + +PNG versions of the above icons were exported from Inkscape. The 24x24 pixel +versions are copied from the 22x22 version, with a 1 pixel border added: + +application-x-excellon-{16,22,24,32,48}.png +application-x-gerber-{16,22,24,32,48}.png +application-x-pcb-footprint-{16,22,24,32,48}.png +application-x-pcb-layout-{16,22,24,32,48}.png +application-x-pcb-netlist-{16,22,24,32,48}.png + +The script "regen_files" will re-export the SVG drawings to PNG and also +regenerate the windows icon file. + +The PCB application icons were created by Peter Clifton, based upon the +Gnome "text-editor" icon created by Lapo Calamandrei. The PCB specific +additions are from the mime-type icons by Tomaz Solc. +These icons are licensed under the GPL2 license. + +pcb.svg +pcb-48.png Index: 1.0.8/data/application-x-excellon-16.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-excellon-16.png =================================================================== --- 1.0.8/data/application-x-excellon-16.png (nonexistent) +++ 1.0.8/data/application-x-excellon-16.png (revision 1136) Property changes on: 1.0.8/data/application-x-excellon-16.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-excellon-16.svg =================================================================== --- 1.0.8/data/application-x-excellon-16.svg (nonexistent) +++ 1.0.8/data/application-x-excellon-16.svg (revision 1136) @@ -0,0 +1,1271 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Excellon file + + + + + + + Peter Clifton, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-excellon-22.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-excellon-22.png =================================================================== --- 1.0.8/data/application-x-excellon-22.png (nonexistent) +++ 1.0.8/data/application-x-excellon-22.png (revision 1136) Property changes on: 1.0.8/data/application-x-excellon-22.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-excellon-22.svg =================================================================== --- 1.0.8/data/application-x-excellon-22.svg (nonexistent) +++ 1.0.8/data/application-x-excellon-22.svg (revision 1136) @@ -0,0 +1,1571 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Excellon file + + + + + + + Peter Clifton, Tomaz Solc, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-excellon-24.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-excellon-24.png =================================================================== --- 1.0.8/data/application-x-excellon-24.png (nonexistent) +++ 1.0.8/data/application-x-excellon-24.png (revision 1136) Property changes on: 1.0.8/data/application-x-excellon-24.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-excellon-32.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-excellon-32.png =================================================================== --- 1.0.8/data/application-x-excellon-32.png (nonexistent) +++ 1.0.8/data/application-x-excellon-32.png (revision 1136) Property changes on: 1.0.8/data/application-x-excellon-32.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-excellon-32.svg =================================================================== --- 1.0.8/data/application-x-excellon-32.svg (nonexistent) +++ 1.0.8/data/application-x-excellon-32.svg (revision 1136) @@ -0,0 +1,1406 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Excellon file + + + + + + + Peter Clifton, Tomaz Solc, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-excellon-48.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-excellon-48.png =================================================================== --- 1.0.8/data/application-x-excellon-48.png (nonexistent) +++ 1.0.8/data/application-x-excellon-48.png (revision 1136) Property changes on: 1.0.8/data/application-x-excellon-48.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-excellon-48.svg =================================================================== --- 1.0.8/data/application-x-excellon-48.svg (nonexistent) +++ 1.0.8/data/application-x-excellon-48.svg (revision 1136) @@ -0,0 +1,1283 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Excellon file + + + + + + + Peter Clifton, Tomaz Solc, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-excellon.svg =================================================================== --- 1.0.8/data/application-x-excellon.svg (nonexistent) +++ 1.0.8/data/application-x-excellon.svg (revision 1136) @@ -0,0 +1,1289 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Excellon file + + + + + + + Peter Clifton, Tomaz Solc, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-gerber-16.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-gerber-16.png =================================================================== --- 1.0.8/data/application-x-gerber-16.png (nonexistent) +++ 1.0.8/data/application-x-gerber-16.png (revision 1136) Property changes on: 1.0.8/data/application-x-gerber-16.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-gerber-16.svg =================================================================== --- 1.0.8/data/application-x-gerber-16.svg (nonexistent) +++ 1.0.8/data/application-x-gerber-16.svg (revision 1136) @@ -0,0 +1,543 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Gerber file + + + + + + + Peter Clifton, Tomaz Solc, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-gerber-22.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-gerber-22.png =================================================================== --- 1.0.8/data/application-x-gerber-22.png (nonexistent) +++ 1.0.8/data/application-x-gerber-22.png (revision 1136) Property changes on: 1.0.8/data/application-x-gerber-22.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-gerber-22.svg =================================================================== --- 1.0.8/data/application-x-gerber-22.svg (nonexistent) +++ 1.0.8/data/application-x-gerber-22.svg (revision 1136) @@ -0,0 +1,608 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Gerber file + + + + + + + Peter Clifton, Tomaz Solc, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-gerber-24.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-gerber-24.png =================================================================== --- 1.0.8/data/application-x-gerber-24.png (nonexistent) +++ 1.0.8/data/application-x-gerber-24.png (revision 1136) Property changes on: 1.0.8/data/application-x-gerber-24.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-gerber-32.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-gerber-32.png =================================================================== --- 1.0.8/data/application-x-gerber-32.png (nonexistent) +++ 1.0.8/data/application-x-gerber-32.png (revision 1136) Property changes on: 1.0.8/data/application-x-gerber-32.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-gerber-32.svg =================================================================== --- 1.0.8/data/application-x-gerber-32.svg (nonexistent) +++ 1.0.8/data/application-x-gerber-32.svg (revision 1136) @@ -0,0 +1,544 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Gerber file + + + + + + + Peter Clifton, Tomaz Solc, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-gerber-48.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-gerber-48.png =================================================================== --- 1.0.8/data/application-x-gerber-48.png (nonexistent) +++ 1.0.8/data/application-x-gerber-48.png (revision 1136) Property changes on: 1.0.8/data/application-x-gerber-48.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-gerber-48.svg =================================================================== --- 1.0.8/data/application-x-gerber-48.svg (nonexistent) +++ 1.0.8/data/application-x-gerber-48.svg (revision 1136) @@ -0,0 +1,707 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Gerber file + + + + + + + Peter Clifton, Tomaz Solc, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-gerber.svg =================================================================== --- 1.0.8/data/application-x-gerber.svg (nonexistent) +++ 1.0.8/data/application-x-gerber.svg (revision 1136) @@ -0,0 +1,712 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Gerber file + + + + + + + Peter Clifton, Tomaz Solc, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-pcb-footprint-16.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-pcb-footprint-16.png =================================================================== --- 1.0.8/data/application-x-pcb-footprint-16.png (nonexistent) +++ 1.0.8/data/application-x-pcb-footprint-16.png (revision 1136) Property changes on: 1.0.8/data/application-x-pcb-footprint-16.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-pcb-footprint-16.svg =================================================================== --- 1.0.8/data/application-x-pcb-footprint-16.svg (nonexistent) +++ 1.0.8/data/application-x-pcb-footprint-16.svg (revision 1136) @@ -0,0 +1,554 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + PCB footprint + + + + + + + Peter Clifton, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-pcb-footprint-22.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-pcb-footprint-22.png =================================================================== --- 1.0.8/data/application-x-pcb-footprint-22.png (nonexistent) +++ 1.0.8/data/application-x-pcb-footprint-22.png (revision 1136) Property changes on: 1.0.8/data/application-x-pcb-footprint-22.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-pcb-footprint-22.svg =================================================================== --- 1.0.8/data/application-x-pcb-footprint-22.svg (nonexistent) +++ 1.0.8/data/application-x-pcb-footprint-22.svg (revision 1136) @@ -0,0 +1,573 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + PCB footprint + + + + + + + Peter Clifton, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-pcb-footprint-24.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-pcb-footprint-24.png =================================================================== --- 1.0.8/data/application-x-pcb-footprint-24.png (nonexistent) +++ 1.0.8/data/application-x-pcb-footprint-24.png (revision 1136) Property changes on: 1.0.8/data/application-x-pcb-footprint-24.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-pcb-footprint-32.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-pcb-footprint-32.png =================================================================== --- 1.0.8/data/application-x-pcb-footprint-32.png (nonexistent) +++ 1.0.8/data/application-x-pcb-footprint-32.png (revision 1136) Property changes on: 1.0.8/data/application-x-pcb-footprint-32.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-pcb-footprint-32.svg =================================================================== --- 1.0.8/data/application-x-pcb-footprint-32.svg (nonexistent) +++ 1.0.8/data/application-x-pcb-footprint-32.svg (revision 1136) @@ -0,0 +1,2302 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + PCB footprint + + + + + + + Peter Clifton, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-pcb-footprint-48.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-pcb-footprint-48.png =================================================================== --- 1.0.8/data/application-x-pcb-footprint-48.png (nonexistent) +++ 1.0.8/data/application-x-pcb-footprint-48.png (revision 1136) Property changes on: 1.0.8/data/application-x-pcb-footprint-48.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-pcb-footprint-48.svg =================================================================== --- 1.0.8/data/application-x-pcb-footprint-48.svg (nonexistent) +++ 1.0.8/data/application-x-pcb-footprint-48.svg (revision 1136) @@ -0,0 +1,674 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + PCB footprint + + + + + + + Peter Clifton, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-pcb-footprint.svg =================================================================== --- 1.0.8/data/application-x-pcb-footprint.svg (nonexistent) +++ 1.0.8/data/application-x-pcb-footprint.svg (revision 1136) @@ -0,0 +1,680 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + PCB footprint + + + + + + + Peter Clifton, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-pcb-layout-16.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-pcb-layout-16.png =================================================================== --- 1.0.8/data/application-x-pcb-layout-16.png (nonexistent) +++ 1.0.8/data/application-x-pcb-layout-16.png (revision 1136) Property changes on: 1.0.8/data/application-x-pcb-layout-16.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-pcb-layout-16.svg =================================================================== --- 1.0.8/data/application-x-pcb-layout-16.svg (nonexistent) +++ 1.0.8/data/application-x-pcb-layout-16.svg (revision 1136) @@ -0,0 +1,1333 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + PCB layout + + + + + + + Peter Clifton, Tomaz Solc, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-pcb-layout-22.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-pcb-layout-22.png =================================================================== --- 1.0.8/data/application-x-pcb-layout-22.png (nonexistent) +++ 1.0.8/data/application-x-pcb-layout-22.png (revision 1136) Property changes on: 1.0.8/data/application-x-pcb-layout-22.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-pcb-layout-22.svg =================================================================== --- 1.0.8/data/application-x-pcb-layout-22.svg (nonexistent) +++ 1.0.8/data/application-x-pcb-layout-22.svg (revision 1136) @@ -0,0 +1,1423 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + PCB layout + + + + + + + Peter Clifton, Tomaz Solc, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-pcb-layout-24.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-pcb-layout-24.png =================================================================== --- 1.0.8/data/application-x-pcb-layout-24.png (nonexistent) +++ 1.0.8/data/application-x-pcb-layout-24.png (revision 1136) Property changes on: 1.0.8/data/application-x-pcb-layout-24.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-pcb-layout-32.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-pcb-layout-32.png =================================================================== --- 1.0.8/data/application-x-pcb-layout-32.png (nonexistent) +++ 1.0.8/data/application-x-pcb-layout-32.png (revision 1136) Property changes on: 1.0.8/data/application-x-pcb-layout-32.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-pcb-layout-32.svg =================================================================== --- 1.0.8/data/application-x-pcb-layout-32.svg (nonexistent) +++ 1.0.8/data/application-x-pcb-layout-32.svg (revision 1136) @@ -0,0 +1,1362 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + PCB layout + + + + + + + Peter Clifton, Tomaz Solc, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-pcb-layout-48.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-pcb-layout-48.png =================================================================== --- 1.0.8/data/application-x-pcb-layout-48.png (nonexistent) +++ 1.0.8/data/application-x-pcb-layout-48.png (revision 1136) Property changes on: 1.0.8/data/application-x-pcb-layout-48.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-pcb-layout-48.svg =================================================================== --- 1.0.8/data/application-x-pcb-layout-48.svg (nonexistent) +++ 1.0.8/data/application-x-pcb-layout-48.svg (revision 1136) @@ -0,0 +1,1341 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + PCB layout + + + + + + + Peter Clifton, Tomaz Solc, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-pcb-layout.svg =================================================================== --- 1.0.8/data/application-x-pcb-layout.svg (nonexistent) +++ 1.0.8/data/application-x-pcb-layout.svg (revision 1136) @@ -0,0 +1,1346 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + PCB layout + + + + + + + Peter Clifton, Tomaz Solc, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-pcb-netlist-16.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-pcb-netlist-16.png =================================================================== --- 1.0.8/data/application-x-pcb-netlist-16.png (nonexistent) +++ 1.0.8/data/application-x-pcb-netlist-16.png (revision 1136) Property changes on: 1.0.8/data/application-x-pcb-netlist-16.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-pcb-netlist-16.svg =================================================================== --- 1.0.8/data/application-x-pcb-netlist-16.svg (nonexistent) +++ 1.0.8/data/application-x-pcb-netlist-16.svg (revision 1136) @@ -0,0 +1,530 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + PCB netlist + + + + + + + Peter Clifton, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-pcb-netlist-22.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-pcb-netlist-22.png =================================================================== --- 1.0.8/data/application-x-pcb-netlist-22.png (nonexistent) +++ 1.0.8/data/application-x-pcb-netlist-22.png (revision 1136) Property changes on: 1.0.8/data/application-x-pcb-netlist-22.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-pcb-netlist-22.svg =================================================================== --- 1.0.8/data/application-x-pcb-netlist-22.svg (nonexistent) +++ 1.0.8/data/application-x-pcb-netlist-22.svg (revision 1136) @@ -0,0 +1,567 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + PCB netlist + + + + + + + Peter Clifton, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-pcb-netlist-24.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-pcb-netlist-24.png =================================================================== --- 1.0.8/data/application-x-pcb-netlist-24.png (nonexistent) +++ 1.0.8/data/application-x-pcb-netlist-24.png (revision 1136) Property changes on: 1.0.8/data/application-x-pcb-netlist-24.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-pcb-netlist-32.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-pcb-netlist-32.png =================================================================== --- 1.0.8/data/application-x-pcb-netlist-32.png (nonexistent) +++ 1.0.8/data/application-x-pcb-netlist-32.png (revision 1136) Property changes on: 1.0.8/data/application-x-pcb-netlist-32.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-pcb-netlist-32.svg =================================================================== --- 1.0.8/data/application-x-pcb-netlist-32.svg (nonexistent) +++ 1.0.8/data/application-x-pcb-netlist-32.svg (revision 1136) @@ -0,0 +1,1310 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + PCB netlist + + + + + + + Peter Clifton, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-pcb-netlist-48.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/application-x-pcb-netlist-48.png =================================================================== --- 1.0.8/data/application-x-pcb-netlist-48.png (nonexistent) +++ 1.0.8/data/application-x-pcb-netlist-48.png (revision 1136) Property changes on: 1.0.8/data/application-x-pcb-netlist-48.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/application-x-pcb-netlist-48.svg =================================================================== --- 1.0.8/data/application-x-pcb-netlist-48.svg (nonexistent) +++ 1.0.8/data/application-x-pcb-netlist-48.svg (revision 1136) @@ -0,0 +1,451 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + PCB netlist + + + + + + + Peter Clifton, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/application-x-pcb-netlist.svg =================================================================== --- 1.0.8/data/application-x-pcb-netlist.svg (nonexistent) +++ 1.0.8/data/application-x-pcb-netlist.svg (revision 1136) @@ -0,0 +1,459 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + PCB netlist + + + + + + + Peter Clifton, Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/icon-theme-installer =================================================================== --- 1.0.8/data/icon-theme-installer (nonexistent) +++ 1.0.8/data/icon-theme-installer (revision 1136) @@ -0,0 +1,183 @@ +#!/bin/sh + +# icon-theme-installer +# Copyright (C) 2006 Novell, Inc. +# Written by Aaron Bockover +# Licensed under the MIT/X11 license +# +# Modified by Peter Clifton to allow icons with numerals in the filename +# +# This script is meant to be invoked from within a Makefile/Makefile.am +# in the install-data-local and uninstall-data sections. It handles the +# task of properly installing icons into the icon theme. It requires a +# few arguments to set up its environment, and a list of files to be +# installed. The format of the file list is critical: +# +# , +# +# apps,music-player-banshee.svg +# apps,music-player-banshee-16.png +# apps,music-player-banshee-22.png +# +# is the icon theme category, for instance, apps, devices, +# actions, emblems... +# +# must have a basename in the form of: +# +# proper-theme-name[-]. +# +# Where should be either nothing, which will default to scalable +# or \-[0-9]{2}, which will expand to x. For example: +# +# music-player-banshee-16.png +# +# The here is -16 and will expand to 16x16 per the icon theme spec +# +# What follows is an example Makefile.am for icon theme installation: +# +# --------------- +# theme=hicolor +# themedir=$(datadir)/icons/$(theme) +# theme_icons = \ +# apps,music-player-banshee.svg \ +# apps,music-player-banshee-16.png \ +# apps,music-player-banshee-22.png \ +# apps,music-player-banshee-24.png \ +# apps,music-player-banshee-32.png +# +# install_icon_exec = $(top_srcdir)/build/icon-theme-installer -t $(theme) -s $(srcdir) -d "x$(DESTDIR)" -b $(themedir) -m "$(mkinstalldirs)" -x "$(INSTALL_DATA)" +# install-data-local: +# $(install_icon_exec) -i $(theme_icons) +# +# uninstall-hook: +# $(install_icon_exec) -u $(theme_icons) +# +# MAINTAINERCLEANFILES = Makefile.in +# EXTRA_DIST = $(wildcard *.svg *.png) +# --------------- +# +# Arguments to this program: +# +# -i : Install +# -u : Uninstall +# -t : Theme name (hicolor) +# -b : Theme installation dest directory [x$(DESTDIR)] - Always prefix +# this argument with x; it will be stripped but will act as a +# placeholder for zero $DESTDIRs (only set by packagers) +# -d : Theme installation directory [$(hicolordir)] +# -s : Source directory [$(srcdir)] +# -m : Command to exec for directory creation [$(mkinstalldirs)] +# -x : Command to exec for single file installation [$(INSTALL_DATA)] +# : All remainging should be category,filename pairs + +while getopts "iut:b:d:s:m:x:" flag; do + case "$flag" in + i) INSTALL=yes ;; + u) UNINSTALL=yes ;; + t) THEME_NAME=$OPTARG ;; + d) INSTALL_DEST_DIR="`echo $OPTARG | sed 's;^x;;'`" ;; + b) INSTALL_BASE_DIR=$OPTARG ;; + s) SRC_DIR=$OPTARG ;; + m) MKINSTALLDIRS_EXEC=$OPTARG ;; + x) INSTALL_DATA_EXEC=$OPTARG ;; + esac +done + +shift `expr $OPTIND - 1` + +if test "x$INSTALL" = "xyes" -a "x$UNINSTALL" = "xyes"; then + echo "Cannot pass both -i and -u" + exit 1 +elif test "x$INSTALL" = "x" -a "x$UNINSTALL" = "x"; then + echo "Must path either -i or -u" + exit 1 +fi + +if test -z "$THEME_NAME"; then + echo "Theme name required (-t hicolor)" + exit 1 +fi + +if test -z "$INSTALL_BASE_DIR"; then + echo "Base theme directory required [-d \$(hicolordir)]" + exit 1 +fi + +#if test ! -x `echo "$MKINSTALLDIRS_EXEC" | cut -f1 -d' '`; then +# echo "Cannot find '$MKINSTALLDIRS_EXEC'; You probably want to pass -m \$(mkinstalldirs)" +# exit 1 +#fi + +#if test ! -x `echo "$INSTALL_DATA_EXEC" | cut -f1 -d' '`; then +# echo "Cannot find '$INSTALL_DATA_EXEC'; You probably want to pass -x \$(INSTALL_DATA)" +# exit 1 +#fi + +if test -z "$SRC_DIR"; then + SRC_DIR=. +fi + +for icon in $@; do + size=`echo $icon | sed -n 's/.*-\([0-9]*\).*/\1/p'` + category=`echo $icon | cut -d, -f1` + build_name=`echo $icon | cut -d, -f2` + install_name=`echo $build_name | sed 's/-[0-9]\+//g'` + install_name=`basename $install_name` + + if test -z $size; then + size=scalable; + else + size=${size}x${size}; + fi + + install_dir=${INSTALL_DEST_DIR}${INSTALL_BASE_DIR}/$size/$category + install_path=$install_dir/$install_name + + if test "x$INSTALL" = "xyes"; then + echo "Installing $size $install_name into $THEME_NAME icon theme" + + $MKINSTALLDIRS_EXEC $install_dir || { + echo "Failed to create directory $install_dir" + exit 1 + } + + $INSTALL_DATA_EXEC $SRC_DIR/$build_name $install_path || { + echo "Failed to install $SRC_DIR/$build_name into $install_path" + exit 1 + } + + if test ! -e $install_path; then + echo "Failed to install $SRC_DIR/$build_name into $install_path" + exit 1 + fi + else + if test -e $install_path; then + echo "Removing $size $install_name from $THEME_NAME icon theme" + + rm $install_path || { + echo "Failed to remove $install_path" + exit 1 + } + fi + fi +done + +if test "x$INSTALL" = "xyes"; then + gtk_update_icon_cache_bin="`(which gtk-update-icon-cache || echo /opt/gnome/bin/gtk-update-icon-cache)2>/dev/null`" + gtk_update_icon_cache_bin="${GTK_UPDATE_ICON_CACHE_BIN:-$gtk_update_icon_cache_bin}" + + gtk_update_icon_cache="$gtk_update_icon_cache_bin -f -t $INSTALL_BASE_DIR" + + if test -z "$INSTALL_DEST_DIR"; then + if test -x $gtk_update_icon_cache_bin; then + echo "Updating GTK icon cache" + $gtk_update_icon_cache + else + echo "*** Icon cache not updated. Could not execute $gtk_update_icon_cache_bin" + fi + else + echo "*** Icon cache not updated. After install, run this:" + echo "*** $gtk_update_icon_cache" + fi +fi + Property changes on: 1.0.8/data/icon-theme-installer ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/data/pcb-48.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/pcb-48.png =================================================================== --- 1.0.8/data/pcb-48.png (nonexistent) +++ 1.0.8/data/pcb-48.png (revision 1136) Property changes on: 1.0.8/data/pcb-48.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/pcb.desktop =================================================================== --- 1.0.8/data/pcb.desktop (nonexistent) +++ 1.0.8/data/pcb.desktop (revision 1136) @@ -0,0 +1,10 @@ +[Desktop Entry] +Version=1.0 +Name=PCB Designer +GenericName=PCB Design +Comment=Create and edit printed circuit board designs +Type=Application +Exec=pcb %f +Icon=pcb +MimeType=application/x-pcb-layout;application/x-pcb-footprint; +Categories=Engineering;Electronics; Index: 1.0.8/data/pcb.svg =================================================================== --- 1.0.8/data/pcb.svg (nonexistent) +++ 1.0.8/data/pcb.svg (revision 1136) @@ -0,0 +1,1070 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Lapo Calamandrei + + + + Text editor + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: 1.0.8/data/pcb.xml =================================================================== --- 1.0.8/data/pcb.xml (nonexistent) +++ 1.0.8/data/pcb.xml (revision 1136) @@ -0,0 +1,40 @@ + + + + + PCB layout + + + + + + + + PCB footprint + + + + + + + + PCB netlist + + + + + Gerber file + + + + + + + + Excellon drill file + + + + + + Index: 1.0.8/data/pcb_icon.ico =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/data/pcb_icon.ico =================================================================== --- 1.0.8/data/pcb_icon.ico (nonexistent) +++ 1.0.8/data/pcb_icon.ico (revision 1136) Property changes on: 1.0.8/data/pcb_icon.ico ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/data/regen_files =================================================================== --- 1.0.8/data/regen_files (nonexistent) +++ 1.0.8/data/regen_files (revision 1136) @@ -0,0 +1,165 @@ +#!/bin/sh +# + +CONVERT=${CONVERT:-convert} +COMPOSITE=${COMPOSITE:-composite} +INKSCAPE=${INKSCAPE:-inkscape} +PPMTOWINICON=${PPMTOWINICON:-ppmtowinicon} + +do_inkscape=yes +do_convert=yes +do_winicon=yes + +usage() { +cat << EOF + +$0 -- Regenerate desktop icon files and windows icon files + +Options + + --help Displays this message and exits + + --skip-png Skips the regeneration of the .png file(s) + + --skip-winicon Skips the regneration of the Windows icon file(s) + +EOF + +} + +while test $# -ne 0 ; do + case $1 in + --help) + usage + exit 0 + ;; + + --skip-png) + do_inkscape=no + shift + ;; + + --skip-winicon) + do_convert=no + do_winicon=no + shift + ;; + + -*) + echo "$0: Unknown option $1" + usage + exit 1 + ;; + + *) + break + ;; + esac +done + +if test $? -ne 0 ; then + usage + exit 1 +fi + +## +## Export the SVG graphics +## + +# see if we have inkscape +if test $do_inkscape = yes ; then +${INKSCAPE} --version 2>&1 >/dev/null +if test $? -ne 0 ; then + echo "\"${INKSCAPE} --version\" failed." + echo "Make sure that inkscape is installed and functional on your system." + echo "Skipping the SVG -> PNG conversion." + do_inkscape=no +fi +fi + +if test $do_inkscape = yes ; then + echo "Export SVG graphics to png..." + + for r in 16 22 24 32 48 ; do + case ${r} in + 24) + x=-1 + y=23 + rs=22 + ;; + *) + x=0 + y=${r} + rs=${r} + ;; + esac + for f in *-${rs}.svg ; do + fb=`basename ${f} ${rs}.svg` + p="${fb}${r}.png" + echo "${f} -> ${p}" + ${INKSCAPE} --export-png=${p} --export-area=${x}:${x}:${y}:${y} ${f} + done + done +fi + +## +## Generate the windows icon file +## + +app_icon="application-x-pcb-layout" + +if test $do_convert = yes ; then +# see if we have ImageMagick +${CONVERT} --version 2>&1 >/dev/null +if test $? -ne 0 ; then + echo "\"${CONVERT} --version\" failed." + echo "Make sure that ImageMagick is installed and functional on your system." + echo "Skipping the PNG -> PPM conversion." + do_convert=no +fi +fi + +if test $do_convert = yes ; then +echo "Creating windows pbm mask files..." +${CONVERT} -channel matte -separate +matte ${app_icon}-48.png - | + ${CONVERT} -threshold 65534 -negate - 48_mask.pbm +${CONVERT} -channel matte -separate +matte ${app_icon}-32.png - | + ${CONVERT} -threshold 65534 -negate - 32_mask.pbm +${CONVERT} -channel matte -separate +matte ${app_icon}-16.png - | + ${CONVERT} -threshold 65534 -negate - 16_mask.pbm + +echo "Creating windows ppm flattened files..." +${CONVERT} -flatten -colors 16 ${app_icon}-48.png 48_16.ppm +${CONVERT} -flatten -colors 256 ${app_icon}-48.png 48_256.ppm +${CONVERT} -flatten -colors 16 ${app_icon}-32.png 32_16.ppm +${CONVERT} -flatten -colors 256 ${app_icon}-32.png 32_256.ppm +${CONVERT} -flatten -colors 16 ${app_icon}-16.png 16_16.ppm +${CONVERT} -flatten -colors 256 ${app_icon}-16.png 16_256.ppm +fi + +# see if we have netpbm +if test $do_winicon = yes ; then +${PPMTOWINICON} --version 2>&1 >/dev/null +if test $? -ne 0 ; then + echo "\"${PPMTOWINICON} --version\" failed." + echo "Make sure that netpbm is installed and functional on your system." + echo "Skipping the pbm -> windows icon conversion." + do_winicon=no +fi +fi + +if test $do_winicon = yes ; then +echo "Creating windows icon file..." +${PPMTOWINICON} -output pcb_icon.ico -andpgms\ + 48_16.ppm 48_mask.pbm 48_256.ppm 48_mask.pbm\ + 32_16.ppm 32_mask.pbm 32_256.ppm 32_mask.pbm\ + 16_16.ppm 16_mask.pbm 16_256.ppm 16_mask.pbm +fi + +rm -f \ + 48_16.ppm 48_256.ppm 48_mask.pbm\ + 32_16.ppm 32_256.ppm 32_mask.pbm\ + 16_16.ppm 16_256.ppm 16_mask.pbm + +echo "All done" + Property changes on: 1.0.8/data/regen_files ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/data/x-excellon.desktop =================================================================== --- 1.0.8/data/x-excellon.desktop (nonexistent) +++ 1.0.8/data/x-excellon.desktop (revision 1136) @@ -0,0 +1,8 @@ +[Desktop Entry] +Encoding=UTF-8 +Comment=Excellon drill file +MimeType=application/x-excellon +Type=MimeType +Icon=application-x-excellon +Patterns=*.cnc +X-KDE-IsAlso=text/plain Index: 1.0.8/data/x-gerber.desktop =================================================================== --- 1.0.8/data/x-gerber.desktop (nonexistent) +++ 1.0.8/data/x-gerber.desktop (revision 1136) @@ -0,0 +1,8 @@ +[Desktop Entry] +Encoding=UTF-8 +Comment=Gerber file +MimeType=application/x-gerber +Type=MimeType +Icon=application-x-gerber +Patterns=*.gbr +X-KDE-IsAlso=text/plain Index: 1.0.8/data/x-pcb-footprint.desktop =================================================================== --- 1.0.8/data/x-pcb-footprint.desktop (nonexistent) +++ 1.0.8/data/x-pcb-footprint.desktop (revision 1136) @@ -0,0 +1,8 @@ +[Desktop Entry] +Encoding=UTF-8 +Comment=PCB footprint +MimeType=application/x-pcb-footprint +Type=MimeType +Icon=application-x-pcb-footprint +Patterns=*.fp +X-KDE-IsAlso=text/plain Index: 1.0.8/data/x-pcb-layout.desktop =================================================================== --- 1.0.8/data/x-pcb-layout.desktop (nonexistent) +++ 1.0.8/data/x-pcb-layout.desktop (revision 1136) @@ -0,0 +1,8 @@ +[Desktop Entry] +Encoding=UTF-8 +Comment=PCB layout +MimeType=application/x-pcb-layout +Type=MimeType +Icon=application-x-pcb-layout +Patterns=*.pcb +X-KDE-IsAlso=text/plain Index: 1.0.8/data/x-pcb-netlist.desktop =================================================================== --- 1.0.8/data/x-pcb-netlist.desktop (nonexistent) +++ 1.0.8/data/x-pcb-netlist.desktop (revision 1136) @@ -0,0 +1,8 @@ +[Desktop Entry] +Encoding=UTF-8 +Comment=PCB netlist +MimeType=application/x-pcb-netlist +Type=MimeType +Icon=application-x-pcb-netlist +Patterns=*.net +X-KDE-IsAlso=text/plain Index: 1.0.8/debian/README =================================================================== --- 1.0.8/debian/README (nonexistent) +++ 1.0.8/debian/README (revision 1136) @@ -0,0 +1 @@ +Debian packaging. Index: 1.0.8/debian/README.Debian =================================================================== --- 1.0.8/debian/README.Debian (nonexistent) +++ 1.0.8/debian/README.Debian (revision 1136) @@ -0,0 +1,17 @@ +PCB for Debian +-------------- + +Documentation for PCB is available in several forms: + + - Info ('info pcb') + + - Manual page ('man pcb') + + - PDF (pcb.pdf and refcard.pdf) + + - HTML (/usr/share/doc/pcb/html/index.html) + +Information about PCB is available online at http://pcb.sourceforge.net/ + +Hamish Moffatt , based on original by +Hartmut Koptein , Wed, 9 Jul 1997 02:50:56 +0200 Index: 1.0.8/debian/README.source =================================================================== --- 1.0.8/debian/README.source (nonexistent) +++ 1.0.8/debian/README.source (revision 1136) @@ -0,0 +1,3 @@ +The used patch system is quilt. + +See /usr/share/doc/quilt/README.source for more information. Index: 1.0.8/debian/changelog =================================================================== --- 1.0.8/debian/changelog (nonexistent) +++ 1.0.8/debian/changelog (revision 1136) @@ -0,0 +1,57 @@ +pcb-rnd (1.0.8-r1135) unstable; urgency=low + + * New upstream release (1.0.8) + + -- Tibor Palinkas Tue, 23 Feb 2016 08:00:36 +0100 + +pcb-rnd (1.0.7-r1038) unstable; urgency=low + + * New upstream release (1.0.7) + + -- Tibor Palinkas Wed, 17 Feb 2016 08:43:01 +0100 + +pcb-rnd (1.0.4-r980) unstable; urgency=low + + * New upstream release (1.0.6) + + -- Tibor Palinkas Thu, 31 Dec 2015 15:43:45 +0100 + +pcb-rnd (1.0.4-r951) unstable; urgency=low + + * New upstream release (1.0.5) + + -- Tibor Palinkas Sat, 24 Oct 2015 16:55:56 +0200 + +pcb-rnd (1.0.4-r944) unstable; urgency=low + + * New upstream release (1.0.4) + + -- Tibor Palinkas Sun, 11 Oct 2015 10:50:20 +0200 + +pcb-rnd (1.0.3-r880) unstable; urgency=low + + * New upstream release (1.0.3) + + -- Tibor Palinkas Sun, 30 Aug 2015 07:55:42 +0200 + +pcb-rnd (1.0.2-r492) unstable; urgency=low + + * New upstream release (1.0.2) + + -- Tibor Palinkas Wed, 29 Jul 2015 08:39:30 +0200 + +pcb-rnd (1.0.1-r431) unstable; urgency=low + + * New upstream release (1.0.1) + + -- Tibor Palinkas Sat, 25 Jul 2015 11:46:44 +0200 + + +pcb-rnd (1.0.0-r84) unstable; urgency=low + + * First release (1.0.0) of the fork + + -- Tibor Palinkas Sat, 07 Sep 2013 05:35:02 +0200 + + + Index: 1.0.8/debian/compat =================================================================== --- 1.0.8/debian/compat (nonexistent) +++ 1.0.8/debian/compat (revision 1136) @@ -0,0 +1 @@ +9 Index: 1.0.8/debian/control =================================================================== --- 1.0.8/debian/control (nonexistent) +++ 1.0.8/debian/control (revision 1136) @@ -0,0 +1,46 @@ +Source: pcb-rnd +Section: electronics +Priority: optional +Maintainer: Tibor Palinkas +Build-Depends: debhelper (>= 9), bison, flex, libgtkglext1-dev, tk8.5, libgd-dev, libdbus-1-dev, libmotif-dev, libxmu-dev, libxml-parser-perl, intltool, imagemagick, gerbv +Homepage: http://repo.hu/projects/pcb-rnd +Vcs-Svn: svn://repo.hu/pcb-rnd/trunk + +Package: pcb-rnd +Architecture: all +Depends: ${misc:Depends}, pcb-rnd-gtk, pcb-rnd-common +Description: printed circuit board (pcb) design program - meta-package + PCB is an interactive printed circuit board editor for the X11 window + system. PCB includes a rats nest feature, design rule checking, and can + provide industry standard RS-274-X (Gerber), NC drill, and centroid data + (X-Y data) output for use in the board fabrication and assembly process. + PCB offers high end features such as an autorouter and trace optimizer + which can tremendously reduce layout time. + +Package: pcb-rnd-common +Architecture: all +Replaces: pcb +Depends: ${misc:Depends}, m4, tk8.5 | wish, tcl8.5 | tclsh, pcb-rnd-gtk +Recommends: extra-xdg-menus +Description: printed circuit board (pcb) design program - common files + PCB is an interactive printed circuit board editor for the X11 window + system. PCB includes a rats nest feature, design rule checking, and can + provide industry standard RS-274-X (Gerber), NC drill, and centroid data + (X-Y data) output for use in the board fabrication and assembly process. + PCB offers high end features such as an autorouter and trace optimizer + which can tremendously reduce layout time. + . + This package contains the common files. + +Package: pcb-rnd-gtk +Architecture: any +Depends: ${misc:Depends}, ${shlibs:Depends}, pcb-rnd-common +Description: printed circuit board (pcb) design program - GTK+ interface + PCB is an interactive printed circuit board editor for the X11 window + system. PCB includes a rats nest feature, design rule checking, and can + provide industry standard RS-274-X (Gerber), NC drill, and centroid data + (X-Y data) output for use in the board fabrication and assembly process. + PCB offers high end features such as an autorouter and trace optimizer + which can tremendously reduce layout time. + . + This package contains the GTK+ user-interface for pcb. Index: 1.0.8/debian/copyright =================================================================== --- 1.0.8/debian/copyright (nonexistent) +++ 1.0.8/debian/copyright (revision 1136) @@ -0,0 +1,44 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0 +Upstream-Name: pcb +Upstream-Contact: harry eaton +Source: http://pcb.gpleda.org + + +Files: * +Copyright: 1994-1997,2010 Thomas Nau + 1998-2007,2009 harry eaton + 2001 C. Scott Ananian + 2003-2008 DJ Delorie + 2009-2011 PCB Contributers (See ChangeLog for details) + 2009 Anthony Blake + 2011 Andrew Poelstra + 2010 Alberto Maccioni + 2003-2010 Dan McMahill +License: GPL-2+ + +Files: debian/* +Copyright: 2003-2008 Hamish Moffatt + 1996 Michael Mattice + 1997-1999 Hartmut Koptein + 2009-2013 أحمد المحمودي (Ahmed El-Mahmoudy) +License: GPL-2+ + +License: GPL-2+ + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + USA. + . + On Debian systems, the complete text of the GNU GPL2 licenses can be found at + `/usr/share/common-licenses/GPL-2'. + Index: 1.0.8/debian/patches/0001-Fixed-command-line-batch-output-for-some-exporters.patch =================================================================== --- 1.0.8/debian/patches/0001-Fixed-command-line-batch-output-for-some-exporters.patch (nonexistent) +++ 1.0.8/debian/patches/0001-Fixed-command-line-batch-output-for-some-exporters.patch (revision 1136) @@ -0,0 +1,17 @@ +Description: Fixed command line batch output for some exporters +Author: Vladimir Zhbanov +Origin: http://git.geda-project.org/pcb/commit/?id=63068cafd8da99b442c87aa084944faaacf81cfc +Bug: https://bugs.launchpad.net/pcb/+bug/905968 +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/pcb/+bug/988503 + +--- a/src/main.c ++++ b/src/main.c +@@ -1931,6 +1931,8 @@ + + if (gui->printer || gui->exporter) + { ++ // Workaround to fix batch output for non-C locales ++ setlocale(LC_NUMERIC,"C"); + gui->do_export (0); + exit (0); + } Index: 1.0.8/debian/patches/default_GtkFileChooser_cwd.diff =================================================================== --- 1.0.8/debian/patches/default_GtkFileChooser_cwd.diff (nonexistent) +++ 1.0.8/debian/patches/default_GtkFileChooser_cwd.diff (revision 1136) @@ -0,0 +1,55 @@ +Description: Set default path in GTK file choosers to cwd +Author: أحمد المحمودي (Ahmed El-Mahmoudy) +Bug: https://bugs.launchpad.net/pcb/+bug/855621 +Bug-Debian: http://bugs.debian.org/642060 +Forwarded: https://bugs.launchpad.net/pcb/+bug/855621/+attachment/2436146/+files/default_GtkFileChooser_cwd.diff + +--- a/src/hid/gtk/gtkhid-main.c ++++ b/src/hid/gtk/gtkhid-main.c +@@ -11,6 +11,7 @@ + #endif + #include + #include ++#include + + + #include "action.h" +@@ -1230,6 +1231,13 @@ + static gchar *current_layout_dir = NULL; + static gchar *current_netlist_dir = NULL; + ++ if(!current_element_dir) ++ current_element_dir = get_current_dir_name(); ++ if(!current_layout_dir) ++ current_layout_dir = get_current_dir_name(); ++ if(!current_netlist_dir) ++ current_netlist_dir = get_current_dir_name(); ++ + /* we've been given the file name */ + if (argc > 1) + return hid_actionv ("LoadFrom", argc, argv); +@@ -1303,6 +1311,9 @@ + + static gchar *current_dir = NULL; + ++ if(!current_dir) ++ current_dir = get_current_dir_name(); ++ + if (argc > 1) + return hid_actionv ("SaveTo", argc, argv); + +@@ -1986,6 +1997,9 @@ + static int I_am_recursing = 0; + int rv; + ++ if(!current_layout_dir) ++ current_layout_dir = get_current_dir_name(); ++ + if (I_am_recursing) + return 1; + +--- a/po/POTFILES.skip ++++ b/po/POTFILES.skip +@@ -1 +1,2 @@ + .pc/fix_pan_action.diff/src/hid/gtk/gtkhid-main.c ++.pc/default_GtkFileChooser_cwd.diff/src/hid/gtk/gtkhid-main.c Index: 1.0.8/debian/patches/disable_hid_png3_test.diff =================================================================== --- 1.0.8/debian/patches/disable_hid_png3_test.diff (nonexistent) +++ 1.0.8/debian/patches/disable_hid_png3_test.diff (revision 1136) @@ -0,0 +1,16 @@ +Description: Disable hid_png3 test + According to upstream, the problem is in the hid_png3 test +Author: أحمد المحمودي (Ahmed El-Mahmoudy) +Forwarded: not-needed +Bug: https://bugs.launchpad.net/bugs/860037 +Bug-Debian: http://bugs.debian.org/642923 +--- a/tests/tests.list ++++ b/tests/tests.list +@@ -161,6 +161,6 @@ + # + hid_png1 | gerber_oneline.pcb | png | | | png:gerber_oneline.png + hid_png2 | gerber_oneline.pcb | png | --outfile myfile.png | | png:myfile.png +-hid_png3 | gerber_oneline.pcb | png | --dpi 300 | | png:gerber_oneline.png ++#hid_png3 | gerber_oneline.pcb | png | --dpi 300 | | png:gerber_oneline.png + # + Index: 1.0.8/debian/patches/drop_check_global_included.patch =================================================================== --- 1.0.8/debian/patches/drop_check_global_included.patch (nonexistent) +++ 1.0.8/debian/patches/drop_check_global_included.patch (revision 1136) @@ -0,0 +1,21 @@ +Description: Drop the #if check for the declaration of hid_get_extents() +Author: Michael Bienia +Bug: https://bugs.launchpad.net/pcb/+bug/1002964 +Forwarded: https://bugs.launchpad.net/pcb/+bug/1002964/+attachment/3158021/+files/drop_check_global_included.patch +Index: pcb-20110918/src/hid/hidint.h +=================================================================== +--- pcb-20110918.orig/src/hid/hidint.h 2011-05-20 06:36:57.000000000 +0200 ++++ pcb-20110918/src/hid/hidint.h 2012-05-20 16:03:09.000000000 +0200 +@@ -64,12 +64,8 @@ + /* Returns a filename base that can be used to output the layer. */ + const char *layer_type_to_file_name (int idx, int style); + +-#ifdef __GLOBAL_INCLUDED__ +- + /* Convenience function that calls the expose callback for the item, + and returns the extents of what was drawn. */ + BoxType *hid_get_extents (void *item); + +-#endif +- + void derive_default_filename(const char *pcbfile, HID_Attribute *filename_attrib, const char *suffix, char **memory); Index: 1.0.8/debian/patches/fix_CPPFLAGS.diff =================================================================== --- 1.0.8/debian/patches/fix_CPPFLAGS.diff (nonexistent) +++ 1.0.8/debian/patches/fix_CPPFLAGS.diff (revision 1136) @@ -0,0 +1,26 @@ +Description: Append input CPPFLAGS for lesstif target +Author: أحمد المحمودي (Ahmed El-Mahmoudy) +Bug: https://bugs.launchpad.net/pcb/+bug/1003355 +Forwarded: https://bugs.launchpad.net/pcb/+bug/1003355/+attachment/3159260/+files/fix_CPPFLAGS.diff +--- a/configure ++++ b/configure +@@ -15260,7 +15260,7 @@ + + fi + +- CPPFLAGS="$CFLAGS $X_CFLAGS" ++ CPPFLAGS="$CPPFLAGS $CFLAGS $X_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XOpenDisplay in -lX11" >&5 + $as_echo_n "checking for XOpenDisplay in -lX11... " >&6; } + if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then : +--- a/configure.ac ++++ b/configure.ac +@@ -710,7 +710,7 @@ + case $e in + lesstif ) + AC_PATH_XTRA +- CPPFLAGS="$CFLAGS $X_CFLAGS" ++ CPPFLAGS="$CPPFLAGS $CFLAGS $X_CFLAGS" + AC_CHECK_LIB(X11, XOpenDisplay, , , $X_LIBS) + AC_CHECK_LIB(ICE, main, , , $X_LIBS) + AC_CHECK_LIB(SM, main, , , $X_LIBS) Index: 1.0.8/debian/patches/fix_pan_action.diff =================================================================== --- 1.0.8/debian/patches/fix_pan_action.diff (nonexistent) +++ 1.0.8/debian/patches/fix_pan_action.diff (revision 1136) @@ -0,0 +1,28 @@ +Description: Fix Pan action to stop after button release outside window master + Previously, we required in-view coordinates to stop and start the + pan-action, and when the button was released outside the viewport, + the code was querying the user to click at a particular location. + + Since the pan action doesn't even use the passed in coordinates, + simply remove the requirement for the x-y coordinates from this + action. +Origin: http://git.gpleda.org/?p=pcb.git;a=commit;h=ed9a9d0cd9d054e6fc4a075ec1b8d9a12f1cb376 +Author: Peter Clifton [Mon, 19 Sep 2011 10:16:49 +0000 (11:16 +0100)] +Bug: https://launchpad.net/bugs/699307 +Bug-Debian: http://bugs.debian.org/562641 + +--- a/src/hid/gtk/gtkhid-main.c ++++ b/src/hid/gtk/gtkhid-main.c +@@ -2030,7 +2030,7 @@ + {"LayerGroupsChanged", 0, LayerGroupsChanged}, + {"LibraryChanged", 0, LibraryChanged}, + {"Load", 0, Load}, +- {"Pan", N_("Click on a place to pan"), PanAction, pan_help, pan_syntax}, ++ {"Pan", 0, PanAction, pan_help, pan_syntax}, + {"PCBChanged", 0, PCBChanged}, + {"PointCursor", 0, PointCursor}, + {"Popup", 0, Popup, popup_help, popup_syntax}, +--- /dev/null ++++ b/po/POTFILES.skip +@@ -0,0 +1 @@ ++.pc/fix_pan_action.diff/src/hid/gtk/gtkhid-main.c Index: 1.0.8/debian/patches/fix_typo.diff =================================================================== --- 1.0.8/debian/patches/fix_typo.diff (nonexistent) +++ 1.0.8/debian/patches/fix_typo.diff (revision 1136) @@ -0,0 +1,16 @@ +Description: Fix typo (recieved -> received) +Author: أحمد المحمودي (Ahmed El-Mahmoudy) +Bug: https://bugs.launchpad.net/pcb/+bug/855398 +Forwarded: https://bugs.launchpad.net/pcb/+bug/855398/+attachment/2435156/+files/fix_typo.diff + +--- a/src/hid/common/hidgl.c ++++ b/src/hid/common/hidgl.c +@@ -521,7 +521,7 @@ + } + } + else +- printf ("Vertex recieved with unknown type\n"); ++ printf ("Vertex received with unknown type\n"); + } + + void Index: 1.0.8/debian/patches/outdated_config.diff =================================================================== --- 1.0.8/debian/patches/outdated_config.diff (nonexistent) +++ 1.0.8/debian/patches/outdated_config.diff (revision 1136) @@ -0,0 +1,24 @@ +Description: Patch config.{sub,guess} to call their up-to-date versions. +Author: أحمد المحمودي (Ahmed El-Mahmoudy) +--- a/config.guess ++++ b/config.guess +@@ -1,4 +1,8 @@ + #! /bin/sh ++if [ -x /usr/share/misc/config.guess ]; then ++ exec /usr/share/misc/config.guess "$@" ++fi ++ + # Attempt to guess a canonical system name. + # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +--- a/config.sub ++++ b/config.sub +@@ -1,4 +1,8 @@ + #! /bin/sh ++if [ -x /usr/share/misc/config.sub ]; then ++ exec /usr/share/misc/config.sub "$@" ++fi ++ + # Configuration validation subroutine script. + # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Index: 1.0.8/debian/patches/pcbtest_paths.diff =================================================================== --- 1.0.8/debian/patches/pcbtest_paths.diff (nonexistent) +++ 1.0.8/debian/patches/pcbtest_paths.diff (revision 1136) @@ -0,0 +1,15 @@ +Description: lib/pcblib-newlib is in TOPSRCDIR not in TOP_BUILDDIR +Author: أحمد المحمودي (Ahmed El-Mahmoudy) +Bug: https://bugs.launchpad.net/pcb/+bug/855405 +Forwarded: https://bugs.launchpad.net/pcb/+bug/855405/+attachment/2435173/+files/pcbtest_paths.diff +--- a/src/pcbtest.sh.in ++++ b/src/pcbtest.sh.in +@@ -37,7 +37,7 @@ + # Use --g-fatal-warnings with the gtk HID to cause gtk-WARNING's to + # abort. + +-TEST_PATHS="--lib-path @TOP_BUILDDIR@/lib --lib-newlib @TOPSRCDIR@/newlib:@TOP_BUILDDIR@/lib/pcblib-newlib --element-path @TOP_BUILDDIR@/lib --font-path @TOPSRCDIR@/src" ++TEST_PATHS="--lib-path @TOP_BUILDDIR@/lib --lib-newlib @TOPSRCDIR@/newlib:@TOPSRCDIR@/lib/pcblib-newlib --element-path @TOP_BUILDDIR@/lib --font-path @TOPSRCDIR@/src" + TEST_CMDS="--lib-command-dir @TOP_BUILDDIR@/lib" + + # note: To do command line exporting, pcb requires the "-x " command to appear first. For example Index: 1.0.8/debian/patches/series =================================================================== --- 1.0.8/debian/patches/series (nonexistent) +++ 1.0.8/debian/patches/series (revision 1136) @@ -0,0 +1,9 @@ +fix_typo.diff +outdated_config.diff +fix_pan_action.diff +pcbtest_paths.diff +default_GtkFileChooser_cwd.diff +disable_hid_png3_test.diff +0001-Fixed-command-line-batch-output-for-some-exporters.patch +drop_check_global_included.patch +fix_CPPFLAGS.diff Index: 1.0.8/debian/pcb-rnd-common.dirs =================================================================== --- 1.0.8/debian/pcb-rnd-common.dirs (nonexistent) +++ 1.0.8/debian/pcb-rnd-common.dirs (revision 1136) @@ -0,0 +1 @@ +usr/share/doc/pcb-common Index: 1.0.8/debian/pcb-rnd-common.doc-base =================================================================== --- 1.0.8/debian/pcb-rnd-common.doc-base (nonexistent) +++ 1.0.8/debian/pcb-rnd-common.doc-base (revision 1136) @@ -0,0 +1,20 @@ +Document: pcb +Title: Pcb Manual +Author: harry eaton +Abstract: This document is a manual for Pcb, the interactive printed circuit + board layout system for X11. +Section: Science/Electronics + +Format: HTML +Index: /usr/share/doc/pcb-common/pcb.html +Files: /usr/share/doc/pcb-common/pcb.html + +Format: Info +Index: /usr/share/info/pcb.info.gz +Files: /usr/share/info/pcb.info* + +Format: PDF +Files: /usr/share/doc/pcb-common/pcb.pdf.gz + +Format: DVI +Files: /usr/share/doc/pcb-common/refcard.pdf.gz Index: 1.0.8/debian/pcb-rnd-common.docs =================================================================== --- 1.0.8/debian/pcb-rnd-common.docs (nonexistent) +++ 1.0.8/debian/pcb-rnd-common.docs (revision 1136) @@ -0,0 +1,5 @@ +Release_notes +Changelog +doc/*.png +doc/*.pdf +doc/*.html Index: 1.0.8/debian/pcb-rnd-common.examples =================================================================== --- 1.0.8/debian/pcb-rnd-common.examples (nonexistent) +++ 1.0.8/debian/pcb-rnd-common.examples (revision 1136) @@ -0,0 +1,2 @@ +example/* +tutorial/* Index: 1.0.8/debian/pcb-rnd-common.info =================================================================== --- 1.0.8/debian/pcb-rnd-common.info (nonexistent) +++ 1.0.8/debian/pcb-rnd-common.info (revision 1136) @@ -0,0 +1 @@ +doc/*.info* Index: 1.0.8/debian/pcb-rnd-common.install =================================================================== --- 1.0.8/debian/pcb-rnd-common.install (nonexistent) +++ 1.0.8/debian/pcb-rnd-common.install (revision 1136) @@ -0,0 +1,2 @@ +usr/ +debian/pcb.xpm usr/share/pixmaps/ Index: 1.0.8/debian/pcb-rnd-common.lintian-overrides =================================================================== --- 1.0.8/debian/pcb-rnd-common.lintian-overrides (nonexistent) +++ 1.0.8/debian/pcb-rnd-common.lintian-overrides (revision 1136) @@ -0,0 +1,3 @@ +# /usr/bin/pcb is an alternative installed by postinst script of either pcb-gtk +# or pcb-lesstiff +pcb-common: desktop-command-not-in-package usr/share/applications/pcb.desktop pcb Index: 1.0.8/debian/pcb-rnd-gtk.dirs =================================================================== --- 1.0.8/debian/pcb-rnd-gtk.dirs (nonexistent) +++ 1.0.8/debian/pcb-rnd-gtk.dirs (revision 1136) @@ -0,0 +1 @@ +usr/bin Index: 1.0.8/debian/pcb-rnd-gtk.links =================================================================== --- 1.0.8/debian/pcb-rnd-gtk.links (nonexistent) +++ 1.0.8/debian/pcb-rnd-gtk.links (revision 1136) @@ -0,0 +1 @@ +usr/share/man/man1/pcb.1.gz usr/share/man/man1/pcb-gtk.1.gz Index: 1.0.8/debian/pcb-rnd-gtk.lintian-overrides =================================================================== --- 1.0.8/debian/pcb-rnd-gtk.lintian-overrides (nonexistent) +++ 1.0.8/debian/pcb-rnd-gtk.lintian-overrides (revision 1136) @@ -0,0 +1,2 @@ +# Not a spelling mistake, ang is for angle +pcb-gtk: spelling-error-in-binary usr/bin/pcb-gtk ang and Index: 1.0.8/debian/pcb-rnd-gtk.menu =================================================================== --- 1.0.8/debian/pcb-rnd-gtk.menu (nonexistent) +++ 1.0.8/debian/pcb-rnd-gtk.menu (revision 1136) @@ -0,0 +1,5 @@ +?package(pcb-gtk):needs="x11" section="Applications/Science/Electronics" \ + title="PCB-rnd (GTK+ interface)" \ + longtitle="Printed Circuit Board Design Program" \ + hotkey="P" icon="/usr/share/pixmaps/pcb.xpm" \ + command="/usr/bin/pcb-rnd-gtk" Index: 1.0.8/debian/pcb-rnd-gtk.postinst =================================================================== --- 1.0.8/debian/pcb-rnd-gtk.postinst (nonexistent) +++ 1.0.8/debian/pcb-rnd-gtk.postinst (revision 1136) @@ -0,0 +1,22 @@ +#! /bin/sh +set -e + +case "$1" in + configure) + update-alternatives --quiet --install /usr/bin/pcb pcb /usr/bin/pcb-rnd-gtk 20 + update-alternatives --quiet --install /usr/bin/gsch2pcb gsch2pcb /usr/bin/gsch2pcb-rnd 20 + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 0 + ;; +esac + +#DEBHELPER# + +exit 0 Index: 1.0.8/debian/pcb-rnd-gtk.prerm =================================================================== --- 1.0.8/debian/pcb-rnd-gtk.prerm (nonexistent) +++ 1.0.8/debian/pcb-rnd-gtk.prerm (revision 1136) @@ -0,0 +1,20 @@ +#! /bin/sh +set -e + +case "$1" in + remove) + update-alternatives --quiet --remove pcb /usr/bin/pcb-gtk + ;; + upgrade|failed-upgrade|deconfigure) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 0 + ;; +esac + +#DEBHELPER# + +exit 0 + + Index: 1.0.8/debian/pcb-rnd-lesstif.dirs =================================================================== --- 1.0.8/debian/pcb-rnd-lesstif.dirs (nonexistent) +++ 1.0.8/debian/pcb-rnd-lesstif.dirs (revision 1136) @@ -0,0 +1 @@ +usr/bin Index: 1.0.8/debian/pcb-rnd-lesstif.links =================================================================== --- 1.0.8/debian/pcb-rnd-lesstif.links (nonexistent) +++ 1.0.8/debian/pcb-rnd-lesstif.links (revision 1136) @@ -0,0 +1 @@ +usr/share/man/man1/pcb.1.gz usr/share/man/man1/pcb-lesstif.1.gz Index: 1.0.8/debian/pcb-rnd-lesstif.lintian-overrides =================================================================== --- 1.0.8/debian/pcb-rnd-lesstif.lintian-overrides (nonexistent) +++ 1.0.8/debian/pcb-rnd-lesstif.lintian-overrides (revision 1136) @@ -0,0 +1,2 @@ +# Not a spelling mistake, ang is for angle +pcb-lesstif: spelling-error-in-binary usr/bin/pcb-lesstif ang and Index: 1.0.8/debian/pcb-rnd-lesstif.menu =================================================================== --- 1.0.8/debian/pcb-rnd-lesstif.menu (nonexistent) +++ 1.0.8/debian/pcb-rnd-lesstif.menu (revision 1136) @@ -0,0 +1,5 @@ +?package(pcb-lesstif):needs="x11" section="Applications/Science/Electronics" \ + title="PCB-rnd (LessTif interface)" \ + longtitle="Printed Circuit Board Design Program" \ + hotkey="P" icon="/usr/share/pixmaps/pcb.xpm" \ + command="/usr/bin/pcb-rnd-lesstif" Index: 1.0.8/debian/pcb-rnd-lesstif.postinst =================================================================== --- 1.0.8/debian/pcb-rnd-lesstif.postinst (nonexistent) +++ 1.0.8/debian/pcb-rnd-lesstif.postinst (revision 1136) @@ -0,0 +1,23 @@ +#! /bin/sh +set -e + +case "$1" in + configure) + update-alternatives --quiet --install /usr/bin/pcb pcb /usr/bin/pcb-rnd-lesstif 40 + update-alternatives --quiet --install /usr/bin/gsch2pcb gsch2pcb /usr/bin/gsch2pcb-rnd 20 + ;; + + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 0 + ;; +esac + +#DEBHELPER# + +exit 0 Index: 1.0.8/debian/pcb-rnd-lesstif.prerm =================================================================== --- 1.0.8/debian/pcb-rnd-lesstif.prerm (nonexistent) +++ 1.0.8/debian/pcb-rnd-lesstif.prerm (revision 1136) @@ -0,0 +1,20 @@ +#! /bin/sh +set -e + +case "$1" in + remove) + update-alternatives --quiet --remove pcb /usr/bin/pcb-lesstif + ;; + upgrade|failed-upgrade|deconfigure) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 0 + ;; +esac + +#DEBHELPER# + +exit 0 + + Index: 1.0.8/debian/pcb.xpm =================================================================== --- 1.0.8/debian/pcb.xpm (nonexistent) +++ 1.0.8/debian/pcb.xpm (revision 1136) @@ -0,0 +1,357 @@ +/* XPM */ +static char * pcb_xpm[] = { +"32 32 322 2", +" c None", +". c #3B7305", +"+ c #3B7403", +"@ c #A0C081", +"# c #C5DEAD", +"$ c #C2D9AC", +"% c #C4DDAC", +"& c #C9DFB4", +"* c #3C7303", +"= c #C1D9AB", +"- c #4E9A06", +"; c #50A005", +"> c #57B103", +", c #55AC03", +"' c #4E9B06", +") c #54AA04", +"! c #4F9B06", +"~ c #54A804", +"{ c #B9D79C", +"] c #4C7E1A", +"^ c #D4680C", +"/ c #3A7206", +"( c #C0D7AB", +"_ c #489005", +": c #52A105", +"< c #4C9804", +"[ c #57B003", +"} c #53A803", +"| c #55AC04", +"1 c #478E05", +"2 c #5ABA02", +"3 c #59B602", +"4 c #A9CA8A", +"5 c #5A8A2D", +"6 c #DF8128", +"7 c #FCC068", +"8 c #E99943", +"9 c #387103", +"0 c #C3DBAC", +"a c #5AB902", +"b c #5DC101", +"c c #5EC201", +"d c #56AD04", +"e c #54A904", +"f c #5BBB02", +"g c #59B702", +"h c #9FC878", +"i c #8E842C", +"j c #E08229", +"k c #FCBD60", +"l c #F6A537", +"m c #EDA657", +"n c #D06309", +"o c #397007", +"p c #C3DAAE", +"q c #59B901", +"r c #5FC500", +"s c #5DC100", +"t c #4C9904", +"u c #59B802", +"v c #478F05", +"w c #5AB702", +"x c #A49F48", +"y c #D8842C", +"z c #FCBC5F", +"A c #EC9D47", +"B c #D67420", +"C c #40720F", +"D c #C0DBA6", +"E c #5CBD01", +"F c #5FC300", +"G c #52A604", +"H c #59B502", +"I c #509E05", +"J c #58B203", +"K c #788906", +"L c #D9872E", +"M c #D67520", +"N c #527E25", +"O c #B0CE93", +"P c #5BBE01", +"Q c #4C9A04", +"R c #4A9305", +"S c #58B303", +"T c #4A9604", +"U c #56AE03", +"V c #738105", +"W c #D48427", +"X c #FCBC5E", +"Y c #EC9D46", +"Z c #D77521", +"` c #618939", +" . c #A6CC82", +".. c #62C10A", +"+. c #A5CB80", +"@. c #BAD99C", +"#. c #B9D49D", +"$. c #BCD99E", +"%. c #BAD69E", +"&. c #BCD89E", +"*. c #BBD79E", +"=. c #66A727", +"-. c #F6A538", +";. c #EC9C46", +">. c #D57521", +",. c #71954E", +"'. c #96BF71", +"). c #5CC000", +"!. c #AEDA83", +"~. c #6BAA2F", +"{. c #58AD07", +"]. c #529F0A", +"^. c #56AA08", +"/. c #54A30C", +"(. c #55A706", +"_. c #57A70F", +":. c #61AD1A", +"<. c #AFC995", +"[. c #D48528", +"}. c #D47B2A", +"|. c #AA5D04", +"1. c #7F9F5F", +"2. c #8DBE5F", +"3. c #51A205", +"4. c #BEDF9E", +"5. c #74A844", +"6. c #72A93E", +"7. c #78AA4A", +"8. c #6CA635", +"9. c #7FAC54", +"0. c #65A42C", +"a. c #88AE62", +"b. c #66A42B", +"c. c #B1CE94", +"d. c #CD7921", +"e. c #C2A364", +"f. c #8CA971", +"g. c #7AAD4B", +"h. c #53A704", +"i. c #5FC400", +"j. c #BFDF9F", +"k. c #539317", +"l. c #559D12", +"m. c #55941B", +"n. c #549C10", +"o. c #549319", +"p. c #509A0A", +"q. c #57951E", +"r. c #67A62C", +"s. c #AFA357", +"t. c #CD7920", +"u. c #7C7A03", +"v. c #C1D6AC", +"w. c #9CB682", +"x. c #73AF3B", +"y. c #60C502", +"z. c #BDDD9C", +"A. c #93972D", +"B. c #D98830", +"C. c #818204", +"D. c #C2D8AD", +"E. c #A8C191", +"F. c #619E28", +"G. c #6BC815", +"H. c #AFD789", +"I. c #8D8F1F", +"J. c #DA8833", +"K. c #EC9C45", +"L. c #7B7A03", +"M. c #4C9506", +"N. c #448905", +"O. c #C1D7AC", +"P. c #375E13", +"Q. c #B7CCA2", +"R. c #5AA118", +"S. c #5BB802", +"T. c #7BCD2E", +"U. c #9FCF73", +"V. c #79A84E", +"W. c #7EA953", +"X. c #81AB59", +"Y. c #DCAA5C", +"Z. c #FDF4E6", +"`. c #F9BD6E", +" + c #CC7821", +".+ c #7B7403", +"++ c #448505", +"@+ c #468A05", +"#+ c #499006", +"$+ c #C0D7AA", +"%+ c #395E14", +"&+ c #C1D5AE", +"*+ c #5BBB01", +"=+ c #87D043", +"-+ c #8FC65C", +";+ c #81B056", +">+ c #82B256", +",+ c #81B154", +"'+ c #629E13", +")+ c #E8BC7E", +"!+ c #F7E6CD", +"~+ c #EFC78E", +"{+ c #CF7E28", +"]+ c #726503", +"^+ c #3D7A05", +"/+ c #3A7604", +"(+ c #448605", +"_+ c #418205", +":+ c #B9D29F", +"<+ c #355716", +"[+ c #BBD2A5", +"}+ c #71C81F", +"|+ c #BFD7A7", +"1+ c #8AC850", +"2+ c #83B653", +"3+ c #8AC950", +"4+ c #86B956", +"5+ c #94CC5F", +"6+ c #6F6439", +"7+ c #A27D49", +"8+ c #E1AA5F", +"9+ c #CF9E4A", +"0+ c #88791B", +"a+ c #3B7405", +"b+ c #407F05", +"c+ c #458806", +"d+ c #488E06", +"e+ c #4A9206", +"f+ c #ABCD8B", +"g+ c #3E5F1F", +"h+ c #375919", +"i+ c #B3CE98", +"j+ c #5DC001", +"k+ c #5BBC01", +"l+ c #53A703", +"m+ c #69B028", +"n+ c #88C450", +"o+ c #84B852", +"p+ c #87C350", +"q+ c #7EB54A", +"r+ c #80C640", +"s+ c #58642D", +"t+ c #647A32", +"u+ c #468708", +"v+ c #418105", +"w+ c #458905", +"x+ c #4B9506", +"y+ c #9BC473", +"z+ c #4D6A31", +"A+ c #375718", +"B+ c #ACCC8E", +"C+ c #56AF03", +"D+ c #5BB902", +"E+ c #55AD03", +"F+ c #53A604", +"G+ c #4E9906", +"H+ c #8CBE5E", +"I+ c #58743E", +"J+ c #37551B", +"K+ c #A4C981", +"L+ c #4FA103", +"M+ c #4F9F03", +"N+ c #499105", +"O+ c #499404", +"P+ c #7EB549", +"Q+ c #5E7944", +"R+ c #334E1A", +"S+ c #93B770", +"T+ c #418005", +"U+ c #428105", +"V+ c #438107", +"W+ c #448309", +"X+ c #47830B", +"Y+ c #48840E", +"Z+ c #4A8610", +"`+ c #4C8711", +" @ c #4C8813", +".@ c #4D8915", +"+@ c #508A17", +"@@ c #518A18", +"#@ c #528C1A", +"$@ c #528D1B", +"%@ c #558D1D", +"&@ c #558E1F", +"*@ c #568E20", +"=@ c #578F20", +"-@ c #589022", +";@ c #589122", +">@ c #7CA851", +",@ c #627D4A", +"'@ c #283C15", +")@ c #A3C087", +"!@ c #659535", +"~@ c #669637", +"{@ c #67963A", +"]@ c #6A973C", +"^@ c #6A983F", +"/@ c #6C9941", +"(@ c #6E9A43", +"_@ c #6F9A45", +":@ c #6F9B47", +"<@ c #719B4A", +"[@ c #729B4A", +"}@ c #749C4C", +"|@ c #749D4E", +"1@ c #769D50", +"2@ c #779D51", +"3@ c #789D52", +"4@ c #789E53", +"5@ c #789E54", +"6@ c #96B37A", +"7@ c #5F744A", +"8@ c #705914", +"9@ c #A07A1E", +"0@ c #9E791D", +"a@ c #9E791E", +"b@ c #9E791F", +"c@ c #A0791F", +"d@ c #A0781F", +"e@ c #A07821", +"f@ c #A07721", +"g@ c #946A19", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" . . . . . . . . . . . . . . . . . . . + ", +" @ # $ % $ % $ % $ % $ % $ % $ % $ % $ % & * ", +" = - ; > > , - ' ) - ! ) - ~ - - - - - - { ] ^ ", +" / ( - _ : < [ } - } | 1 2 1 3 1 - 1 - 1 - 4 5 6 7 8 ", +" 9 0 - a b c d > e - f - g - g - - - - - - h i j k l m n ", +" o p - q r r s t f 1 g 1 u v w 1 - 1 - 1 - x y z l A B ", +" C D - E r r F G w ' w ! H I J - - - - - K L z l A M ", +" N O - P r r c Q H R S T > t U 1 - 1 - V W X l Y Z ", +" ` .' b r r ..+.@.#.$.%.&.*.{ =.- - K W X -.;.>. ", +" ,.'.I ).r r !.~.{.].^./.(._.:.<.- V [.X -.;.}.|. ", +" 1.2.3.b r r 4.5.6.7.8.9.0.a.b.c.K [.X -.;.d.e. ", +" f.g.h.i.r r j.k.l.m.n.o.p.q.r.s.[.X -.;.t.u.v. ", +" w.x.| r r y.z.- - - - - - - A.B.X -.;.t.C.- D. ", +" E.F.S r r G.H.1 - 1 - 1 - I.J.X l K.d.L.M.N.O.P. ", +" Q.R.S.r r T.U.V.- W.- X.- Y.Z.`.K. +.+++@+#+$+%+ ", +" &+1 *+r r =+-+;+- >+- ,+'+)+!+~+{+]+^+/+(+_+:+<+ ", +" [+- E r r }+|+1+2+3+4+5+6+7+8+9+0+a+b+c+d+e+f+g+ ", +" h+i+1 j+k+j+l+m+n+o+p+q+r+s+t+u+v+e+w+x+N.x+N.y+z+ ", +" A+B+- G e e U 3 ! 3.C+- h.D+E+U F+- - G+G+G+- H+I+ ", +" J+K+1 h.L+e M+- 1 - N+- 1 3.t 3.O+- 1 - 1 - 1 P+Q+ ", +" R+S+T+T+U+V+W+X+Y+Z+`+ @.@+@@@#@$@%@&@*@=@-@;@>@,@ ", +" '@)@!@!@!@~@{@]@^@/@(@_@:@<@[@}@|@1@1@2@3@4@5@6@7@ ", +" 8@9@0@0@0@0@a@a@a@a@b@c@c@d@c@d@e@e@e@e@e@e@e@f@g@ ", +" ", +" "}; Index: 1.0.8/debian/rules =================================================================== --- 1.0.8/debian/rules (nonexistent) +++ 1.0.8/debian/rules (revision 1136) @@ -0,0 +1,79 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# debian/rules file for the Debian/GNU Linux pcb package +# Copyright 1997-99 by Hartmut Koptein + +package = pcb-rnd + +CONFIGURE_OPTS=--disable-doc --disable-gl --disable-rpath --disable-dbus --disable-update-desktop-database --disable-update-mime-database --enable-dependency-tracking --disable-coord64 LDFLAGS="$(LDFLAGS) -Wl,--as-needed" + +%: + dh $@ + +override_dh_auto_configure: + ./configure --prefix=/usr + +override_dh_auto_build: + make +# dh_auto_build --builddirectory build_gtk +# dh_auto_build --builddirectory build_lesstif + +override_dh_auto_test: + dh_auto_test --builddirectory build_gtk +# dh_auto_test --builddirectory build_lesstif + +override_dh_auto_install: + make install install_root=`pwd`/debian/tmp + +override_dh_auto_clean: + dh_auto_clean --builddirectory build_gtk +# dh_auto_clean --builddirectory build_lesstif + -make distclean + +override_dh_install: + # Remove needlessly installed static library and header file before + # installing common files: + rm -rf $(CURDIR)/debian/tmp/usr/lib + rm -rf $(CURDIR)/debian/tmp/usr/include + dh_install -Xusr/bin -Xusr/share/pcb-rnd- -Xusr/share/doc -Xexamples -Xtutorial -Xusr/share/info + + # Install pcb-gtk binary: + install debian/tmp/usr/bin/pcb-rnd debian/$(package)-gtk/usr/bin/pcb-rnd-gtk + + + # Install pcb-lesstif binary: +# install build_lesstif/src/pcb-rnd debian/$(package)-lesstif/usr/bin/pcb-rnd-lesstif + + # Install common binaries: + mkdir debian/$(package)-common/usr/bin + install debian/tmp/usr/bin/gsch2pcb-rnd debian/$(package)-common/usr/bin/gsch2pcb-rnd + + # Set executable bit for pcb tools: + -[ ! -d debian/$(package)-common ] || chmod a+x debian/$(package)-common/usr/share/pcb-rnd/tools/MergePCBPS + -[ ! -d debian/$(package)-common ] || chmod a+x debian/$(package)-common/usr/share/pcb-rnd/tools/Merge_dimPCBPS + -[ ! -d debian/$(package)-common ] || chmod a+x debian/$(package)-common/usr/share/pcb-rnd/tools/tgo2pcb.tcl + -[ ! -d debian/$(package)-common ] || chmod a+x debian/$(package)-common/usr/share/pcb-rnd/tools/PCB2HPGL + + # Remove empty dirs: + [ ! -d debian/$(package)-common ] || find debian/$(package)-common -type d -empty -delete + +override_dh_fixperms: + dh_fixperms + # Fix permissions of a couple of example files: +# -[ ! -d debian/$(package)-common ] || chmod -x debian/$(package)-common/usr/share/doc/$(package)-common/examples/LED.pcb +# -[ ! -d debian/$(package)-common ] || chmod -x debian/$(package)-common/usr/share/doc/$(package)-common/examples/LED.net + +override_dh_installexamples: + dh_installexamples -XMakefile + +override_dh_installchangelogs: + dh_installchangelogs -p$(package)-common + +override_dh_installdocs: + # Only install docs in $(package)-common & link other packages' docs to + # $(package)-common: + dh_installdocs --link-doc=$(package)-common + +override_dh_compress: + # exclude example files from compression + dh_compress -X.pcb -XLED Property changes on: 1.0.8/debian/rules ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/debian/source/format =================================================================== --- 1.0.8/debian/source/format (nonexistent) +++ 1.0.8/debian/source/format (revision 1136) @@ -0,0 +1 @@ +3.0 (quilt) Index: 1.0.8/debian/source.lintian-overrides =================================================================== --- 1.0.8/debian/source.lintian-overrides (nonexistent) +++ 1.0.8/debian/source.lintian-overrides (revision 1136) @@ -0,0 +1,3 @@ +# Added a patch to use updated config.{sub,guess} +pcb source: outdated-autotools-helper-file config.sub 2005-07-08 +pcb source: outdated-autotools-helper-file config.guess 2005-07-08 Index: 1.0.8/debian/watch =================================================================== --- 1.0.8/debian/watch (nonexistent) +++ 1.0.8/debian/watch (revision 1136) @@ -0,0 +1,3 @@ +version=3 +http://sf.net/pcb/pcb-(.*)\.tar\.gz +http://geda.seul.org/dist/pcb-(.*)\.tar\.gz Index: 1.0.8/doc-orig/Makefile =================================================================== --- 1.0.8/doc-orig/Makefile (nonexistent) +++ 1.0.8/doc-orig/Makefile (revision 1136) @@ -0,0 +1,148 @@ +## -*- makefile -*- +## +## COPYRIGHT +## +## PCB, interactive printed circuit board design +## Copyright (C) 1994,1995,1996 Thomas Nau +## +## 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: +## Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany +## Thomas.Nau@rz.uni-ulm.de +## + +## not until it is fully fixed up in terms of building +##SUBDIRS= gs + +info_TEXINFOS= pcb.texi +pcb_TEXINFOS= ${inline_texi} ${pcb_output} ${tab_texi} ${images_output} + +dist_html_DATA= ${html_docs} ${pcb_output_inst} ${images_output_inst} + +dist_man_MANS= pcb.1 + +html_docs= ${info_TEXINFOS:.texi=.html} + +DVIS= + +# put the html manual into 1 file instead of multiple files? +AM_MAKEINFOHTMLFLAGS= --css-include=pcb.css --no-split + +EXTRA_DIST= \ + ascii2texi.awk \ + eps2png \ + extract-docs \ + refcard.tex \ + pcb.css \ + ${inline_texi} \ + ${pcb_files} \ + ${pcb_output_noinst} \ + ${tab_files} \ + ${tab_texi} \ + ${images} + +all: $(html_docs) + +# use this to avoid having the clean target delete pcb.{dvi,html,pdf,ps} +# which unfortunately deletes files which are part of the distfile +clean: + -rm -rf pcb.aux pcb.cp pcb.cps pcb.fn pcb.fns pcb.ky pcb.kys pcb.log pcb.pg \ + pcb.pgs pcb.tmp pcb.toc pcb.tp pcb.tps pcb.vr pcb.vrs + + +BUILT_SOURCES= ${tab_texi} ${pcb_output} ${inline_texi} +CLEANFILES= \ + refcard.aux refcard.log refcard.pdf \ + ${pcb_output} ${tab_texi} ${inline_texi} pcb.html \ + ${images_output} + +inline_texi= \ + options.texi \ + actions.texi \ + pcbfile.texi + +ASCII2TEXI= ${AWK} -f $(srcdir)/ascii2texi.awk ncol=3 + +# Tables +tab_files= \ + fractional_size.tab \ + letter_size.tab \ + metric_size.tab \ + wire_size.tab +tab_texi= ${tab_files:.tab=.texi} + +# PCB Drawings +pcb_files= \ + pad.pcb \ + puller.pcb \ + thermal.pcb \ + gcode.pcb + +pcb_output_noinst= \ + ${pcb_files:.pcb=.pdf} + +pcb_output_inst= \ + ${pcb_files:.pcb=.png} + +pcb_output= ${pcb_output_inst} ${pcb_output_noinst} + +# Additional images +images= \ + gcode_control_img.eps \ + gcode_tool_path.eps + +images_output_noinst= \ + ${images:.eps=.pdf} + +images_output_inst= \ + ${images:.eps=.png} + +images_output= ${images_output_noinst} ${images_output_inst} + +${inline_texi} : extracted-docs + +# no need to build these when building via a tarball. They're not used then +# anyway. +.PHONY : extracted-docs +extracted-docs : + ${PERL} $(srcdir)/extract-docs $(srcdir) + +SUFFIXES = .eps .pcb .pdf .png .tab .tex .html .texi + +.pcb.eps : + ${PCB} -x eps --only-visible --font-path $(top_srcdir)/src --eps-file $@ $< + +.pcb.png : + ${PCB} -x png --only-visible --font-path $(top_srcdir)/src --outfile $@ $< + +.eps.pdf : + ${PS2PDF} `${AWK} 'BEGIN{s=8}; /BoundingBox/ {printf("-r%d -g%dx%d", s*72, s*$$4, s*$$5);}' $<` $< $@ + +.tab.texi: + ${ASCII2TEXI} $< > $@ + +.tex.pdf: + ${PDFLATEX} $< + ${PDFLATEX} $< + ${PDFLATEX} $< + +.eps.png: + ${PERL} $(srcdir)/eps2png --png $< > $@ + +%.html: %.texi + rm $@ 2>/dev/null; true + makeinfo --html --css-include=pcb.css --no-split --output=$@ $^ + Index: 1.0.8/doc-orig/README =================================================================== --- 1.0.8/doc-orig/README (nonexistent) +++ 1.0.8/doc-orig/README (revision 1136) @@ -0,0 +1,10 @@ +This is the original doc dir of pcb. + +For the modifications introduced by pcb-rnd, check ../doc-rnd + +Most of the original documentation is in texi; makeinfo fails to +produce pdf from pcb.texi and even generating html throws +a large amount of warnings. + +It may be that pcb-rnd will switch from texi to html for documentation +source format. Index: 1.0.8/doc-orig/actions.texi =================================================================== --- 1.0.8/doc-orig/actions.texi (nonexistent) +++ 1.0.8/doc-orig/actions.texi (revision 1136) @@ -0,0 +1,3574 @@ +@c key actions +@c ./../src/action.c 225 + +Many actions take a @code{delta} parameter as the last parameter, +which is an amount to change something. That @code{delta} may include +units, as an additional parameter, such as @code{Action(Object,5,mm)}. +If no units are specified, the default is PCB's native units +(currently 1/100 mil). Also, if the delta is prefixed by @code{+} or +@code{-}, the size is increased or decreased by that amount. +Otherwise, the size size is set to the given amount. + +@example +Action(Object,5,mil) +Action(Object,+0.5,mm) +Action(Object,-1) +@end example + +Actions which take a @code{delta} parameter which do not accept all +these options will specify what they do take. + +@c ./../src/action.c 229 + +@macro pinshapes + +Pins, pads, and vias can have various shapes. All may be round. Pins +and pads may be square (obviously "square" pads are usually +rectangular). Pins and vias may be octagonal. When you change a +shape flag of an element, you actually change all of its pins and +pads. + +Note that the square flag takes precedence over the octagon flag, +thus, if both the square and octagon flags are set, the object is +square. When the square flag is cleared, the pins and pads will be +either round or, if the octagon flag is set, octagonal. + +@end macro + +@c ./../src/command.c 64 + +@macro colonaction + +This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (@code{:}) and thus the syntax +is documented for that purpose. + +@end macro + +@c ./../src/action.c 227 + +Many actions act on indicated objects on the board. They will have +parameters like @code{ToggleObject} or @code{SelectedVias} to indicate +what group of objects they act on. Unless otherwise specified, these +parameters are defined as follows: + +@table @code + +@item Object +@itemx ToggleObject +Affects the object under the mouse pointer. If this action is invoked +from a menu or script, the user will be prompted to click on an +object, which is then the object affected. + +@item Selected +@itemx SelectedObjects + +Affects all objects which are currently selected. At least, all +selected objects for which the given action makes sense. + +@item SelectedPins +@itemx SelectedVias +@itemx Selected@var{Type} +@itemx @i{etc} +Affects all objects which are both selected and of the @var{Type} specified. + +@end table + + +@menu +* core actions:: +* common actions:: +* gtk actions:: +* lesstif actions:: +@end menu + +@node core actions +@section Core actions +@menu +* AddRats Action:: Add one or more rat lines to the board. +* ApplyVendor Action:: Applies the currently loaded vendor drill table to the current design. +* Atomic Action:: Save or restore the undo serial number. +* Attributes Action:: Let the user edit the attributes of the layout, current or given +layer, or selected element. +* AutoPlaceSelected Action:: Auto-place selected components. +* AutoRoute Action:: Auto-route some or all rat lines. +* ChangeClearSize Action:: Changes the clearance size of objects. +* ChangeDrillSize Action:: Changes the drilling hole size of objects. +* ChangeFlag Action:: Sets or clears flags on objects. +* ChangeHole Action:: Changes the hole flag of objects. +* ChangeJoin Action:: Changes the join (clearance through polygons) of objects. +* ChangeName Action:: Sets the name of objects. +* ChangeOctagon Action:: Changes the octagon-flag of pins and vias. +* ChangePaste Action:: Changes the no paste flag of objects. +* ChangePinName Action:: Sets the name of a specific pin on a specific element. +* ChangeSize Action:: Changes the size of objects. +* ChangeSquare Action:: Changes the square flag of pins and pads. +* ClearOctagon Action:: Clears the octagon-flag of pins and vias. +* ClearSquare Action:: Clears the square-flag of pins and pads. +* ClrFlag Action:: Clears flags on objects. +* Connection Action:: Searches connections of the object at the cursor position. +* Delete Action:: Delete stuff. +* DeleteRats Action:: Delete rat lines. +* DisableVendor Action:: Disables automatic drill size mapping. +* DisperseElements Action:: Disperses elements. +* Display Action:: Several display-related actions. +* djopt Action:: Perform various optimizations on the current board. +* DRC Action:: Invoke the DRC check. +* DumpLibrary Action:: Display the entire contents of the libraries. +* elementlist Action:: Adds the given element if it doesn't already exist. +* elementsetattr Action:: Sets or clears an element-specific attribute. +* EnableVendor Action:: Enables automatic drill size mapping. +* execcommand Action:: Runs a command. +* ExecuteFile Action:: Run actions from the given file. +* Flip Action:: Flip an element to the opposite side of the board. +* FontEdit Action:: Convert the current font to a PCB for editing. +* FontSave Action:: Convert the current PCB back to a font. +* FreeRotateBuffer Action:: Rotates the current paste buffer contents by the specified angle. The +angle is given in degrees. If no angle is given, the user is prompted +for one. + +* GlobalPuller Action:: Pull all traces tight. +* h Action:: Print a help message for commands. +* Import Action:: Import schematics. +* l Action:: Loads layout data. +* le Action:: Loads an element into the current buffer. +* LoadFootprint Action:: Loads a single footprint by name. +* LoadFrom Action:: Load layout data from a file. +* LoadVendorFrom Action:: Loads the specified vendor resource file. +* m Action:: Loads a layout into the current buffer. +* MarkCrosshair Action:: Set/Reset the Crosshair mark. +* Message Action:: Writes a message to the log window. +* MinClearGap Action:: Ensures that polygons are a minimum distance from objects. +* MinMaskGap Action:: Ensures the mask is a minimum distance from pins and pads. +* Mode Action:: Change or use the tool mode. +* MorphPolygon Action:: Converts dead polygon islands into separate polygons. +* MoveLayer Action:: Moves/Creates/Deletes Layers. +* MoveObject Action:: Moves the object under the crosshair. +* MoveToCurrentLayer Action:: Moves objects to the current layer. +* Netlist Action:: Perform various actions on netlists. +* New Action:: Starts a new layout. +* OptAutoOnly Action:: Toggles the optimize-only-autorouted flag. +* PasteBuffer Action:: Various operations on the paste buffer. +* Polygon Action:: Some polygon related stuff. +* Puller Action:: Pull an arc-line junction tight. +* q Action:: Quits the application after confirming. +* q! Action:: Quits the application without confirming. +* Quit Action:: Quits the application after confirming. +* Redo Action:: Redo recent``undo''operations. +* RemoveSelected Action:: Removes any selected objects. +* Renumber Action:: Renumber all elements. The changes will be recorded to filename +for use in backannotating these changes to the schematic. +* Report Action:: Produce various report. +* ReportDialog Action:: Report on the object under the crosshair +* RipUp Action:: Ripup auto-routed tracks, or convert an element to parts. +* rn Action:: Reads netlist. +* RouteStyle Action:: Copies the indicated routing style into the current sizes. +* s Action:: Saves layout data. +* SaveSettings Action:: Saves settings. +* SaveTo Action:: Saves data to a file. +* Select Action:: Toggles or sets the selection. +* SetFlag Action:: Sets flags on objects. +* SetOctagon Action:: Sets the octagon-flag of objects. +* SetSame Action:: Sets current layer and sizes to match indicated item. +* SetSquare Action:: sets the square-flag of objects. +* SetThermal Action:: Set the thermal (on the current layer) of pins or vias to the given style. +Style = 0 means no thermal. +Style = 1 has diagonal fingers with sharp edges. +Style = 2 has horizontal and vertical fingers with sharp edges. +Style = 3 is a solid connection to the plane.Style = 4 has diagonal fingers with rounded edges. +Style = 5 has horizontal and vertical fingers with rounded edges. + +* SetValue Action:: Change various board-wide values and sizes. +* ToggleHideName Action:: Toggles the visibility of element names. +* ToggleVendor Action:: Toggles the state of automatic drill size mapping. +* Undo Action:: Undo recent changes. +* UnloadVendor Action:: Unloads the current vendor drill mapping table. +* Unselect Action:: Unselects the object at the pointer location or the specified objects. +* w Action:: Saves layout data. +* wq Action:: Saves the layout data and quits. +@end menu +@node AddRats Action +@subsection AddRats +@c key AddRats in hid +@cartouche +@format +AddRats(AllRats|SelectedRats|Close)@end format +@end cartouche + +Add one or more rat lines to the board. +@c ./../src/action.c 3310 + +@table @code + +@item AllRats +Create rat lines for all loaded nets that aren't already connected on +with copper. + +@item SelectedRats +Similarly, but only add rat lines for nets connected to selected pins +and pads. + +@item Close +Selects the shortest unselected rat on the board. + +@end table + + +@node ApplyVendor Action +@subsection ApplyVendor +@c key ApplyVendor in hid +@cartouche +@format +ApplyVendor()@end format +@end cartouche + +Applies the currently loaded vendor drill table to the current design. +@c ./../src/vendor.c 112 +@cindex vendor map +@cindex vendor drill table +@findex ApplyVendor() + +This will modify all of your drill holes to match the list of allowed +sizes for your vendor. + +@node Atomic Action +@subsection Atomic +@c key Atomic in hid +@cartouche +@format +Atomic(Save|Restore|Close|Block)@end format +@end cartouche + +Save or restore the undo serial number. +@c ./../src/action.c 1720 + +This action allows making multiple-action bindings into an atomic +operation that will be undone by a single Undo command. For example, +to optimize rat lines, you'd delete the rats and re-add them. To +group these into a single undo, you'd want the deletions and the +additions to have the same undo serial number. So, you @code{Save}, +delete the rats, @code{Restore}, add the rats - using the same serial +number as the deletes, then @code{Block}, which checks to see if the +deletions or additions actually did anything. If not, the serial +number is set to the saved number, as there's nothing to undo. If +something did happen, the serial number is incremented so that these +actions are counted as a single undo step. + +@table @code + +@item Save +Saves the undo serial number. + +@item Restore +Returns it to the last saved number. + +@item Close +Sets it to 1 greater than the last save. + +@item Block +Does a Restore if there was nothing to undo, else does a Close. + +@end table + + +@node Attributes Action +@subsection Attributes +@c key Attributes in hid +@cartouche +@format +Attributes(Layout|Layer|Element) +Attributes(Layer,layername)@end format +@end cartouche + +Let the user edit the attributes of the layout, current or given +layer, or selected element. +@c ./../src/action.c 6761 + +This just pops up a dialog letting the user edit the attributes of the +pcb, an element, or a layer. + + +@node AutoPlaceSelected Action +@subsection AutoPlaceSelected +@c key AutoPlaceSelected in hid +@cartouche +@format +AutoPlaceSelected()@end format +@end cartouche + +Auto-place selected components. +@c ./../src/action.c 3450 + +Attempts to re-arrange the selected components such that the nets +connecting them are minimized. Note that you cannot undo this. + + +@node AutoRoute Action +@subsection AutoRoute +@c key AutoRoute in hid +@cartouche +@format +AutoRoute(AllRats|SelectedRats)@end format +@end cartouche + +Auto-route some or all rat lines. +@c ./../src/action.c 3471 + +@table @code + +@item AllRats +Attempt to autoroute all rats. + +@item SelectedRats +Attempt to autoroute the selected rats. + +@end table + +Before autorouting, it's important to set up a few things. First, +make sure any layers you aren't using are disabled, else the +autorouter may use them. Next, make sure the current line and via +styles are set accordingly. Last, make sure "new lines clear +polygons" is set, in case you eventually want to add a copper pour. + +Autorouting takes a while. During this time, the program may not be +responsive. + + +@node ChangeClearSize Action +@subsection ChangeClearSize +@c key ChangeClearSize in hid +@cartouche +@format +ChangeClearSize(Object, delta) +ChangeClearSize(SelectedPins|SelectedPads|SelectedVias, delta) +ChangeClearSize(SelectedLines|SelectedArcs, delta +ChangeClearSize(Selected|SelectedObjects, delta)@end format +@end cartouche + +Changes the clearance size of objects. +@c ./../src/action.c 3686 + +If the solder mask is currently showing, this action changes the +solder mask clearance. If the mask is not showing, this action +changes the polygon clearance. + + +@node ChangeDrillSize Action +@subsection ChangeDrillSize +@c key ChangeDrillSize in hid +@cartouche +@format +ChangeDrillSize(Object, delta) +ChangeDrillSize(SelectedPins|SelectedVias|Selected|SelectedObjects, delta)@end format +@end cartouche + +Changes the drilling hole size of objects. +@c ./../src/action.c 3630 + + +@node ChangeFlag Action +@subsection ChangeFlag +@c key ChangeFlag in hid +@cartouche +@format +ChangeFlag(Object|Selected|SelectedObjects, flag, value) +ChangeFlag(SelectedLines|SelectedPins|SelectedVias, flag, value) +ChangeFlag(SelectedPads|SelectedTexts|SelectedNames, flag, value) +ChangeFlag(SelectedElements, flag, value) +flag = square | octagon | thermal | join +value = 0 | 1@end format +@end cartouche + +Sets or clears flags on objects. +@c ./../src/action.c 5750 + +Toggles the given flag on the indicated object(s). The flag may be +one of the flags listed above (square, octagon, thermal, join). The +value may be the number 0 or 1. If the value is 0, the flag is +cleared. If the value is 1, the flag is set. + + +@node ChangeHole Action +@subsection ChangeHole +@c key ChangeHole in hid +@cartouche +@format +ChangeHole(ToggleObject|Object|SelectedVias|Selected)@end format +@end cartouche + +Changes the hole flag of objects. +@c ./../src/action.c 4571 + +The "hole flag" of a via determines whether the via is a +plated-through hole (not set), or an unplated hole (set). + + +@node ChangeJoin Action +@subsection ChangeJoin +@c key ChangeJoin in hid +@cartouche +@format +ChangeJoin(ToggleObject|SelectedLines|SelectedArcs|Selected)@end format +@end cartouche + +Changes the join (clearance through polygons) of objects. +@c ./../src/action.c 4199 + +The join flag determines whether a line or arc, drawn to intersect a +polygon, electrically connects to the polygon or not. When joined, +the line/arc is simply drawn over the polygon, making an electrical +connection. When not joined, a gap is drawn between the line and the +polygon, insulating them from each other. + + +@node ChangeName Action +@subsection ChangeName +@c key ChangeName in hid +@cartouche +@format +ChangeName(Object) +ChangeName(Layout|Layer)@end format +@end cartouche + +Sets the name of objects. +@c ./../src/action.c 4005 + +@table @code + +@item Object +Changes the name of the element under the cursor. + +@item Layout +Changes the name of the layout. This is printed on the fab drawings. + +@item Layer +Changes the name of the currently active layer. + +@end table + + +@node ChangeOctagon Action +@subsection ChangeOctagon +@c key ChangeOctagon in hid +@cartouche +@format +ChangeOctagon(Object|ToggleObject|SelectedObjects|Selected) +ChangeOctagon(SelectedElements|SelectedPins|SelectedVias)@end format +@end cartouche + +Changes the octagon-flag of pins and vias. +@c ./../src/action.c 4403 + +@pinshapes + + +@node ChangePaste Action +@subsection ChangePaste +@c key ChangePaste in hid +@cartouche +@format +ChangePaste(ToggleObject|Object|SelectedPads|Selected)@end format +@end cartouche + +Changes the no paste flag of objects. +@c ./../src/action.c 4611 + +The "no paste flag" of a pad determines whether the solderpaste + stencil will have an opening for the pad (no set) or if there wil be + no solderpaste on the pad (set). This is used for things such as + fiducial pads. + + +@node ChangePinName Action +@subsection ChangePinName +@c key ChangePinName in hid +@cartouche +@format +ChangePinName(ElementName,PinNumber,PinName)@end format +@end cartouche + +Sets the name of a specific pin on a specific element. +@c ./../src/action.c 3924 + +This can be especially useful for annotating pin names from a +schematic to the layout without requiring knowledge of the pcb file +format. + +@example +ChangePinName(U3, 7, VCC) +@end example + + +@node ChangeSize Action +@subsection ChangeSize +@c key ChangeSize in hid +@cartouche +@format +ChangeSize(Object, delta) +ChangeSize(SelectedObjects|Selected, delta) +ChangeSize(SelectedLines|SelectedPins|SelectedVias, delta) +ChangeSize(SelectedPads|SelectedTexts|SelectedNames, delta) +ChangeSize(SelectedElements, delta)@end format +@end cartouche + +Changes the size of objects. +@c ./../src/action.c 3543 + +For lines and arcs, this changes the width. For pins and vias, this +changes the overall diameter of the copper annulus. For pads, this +changes the width and, indirectly, the length. For texts and names, +this changes the scaling factor. For elements, this changes the width +of the silk layer lines and arcs for this element. + + +@node ChangeSquare Action +@subsection ChangeSquare +@c key ChangeSquare in hid +@cartouche +@format +ChangeSquare(ToggleObject) +ChangeSquare(SelectedElements|SelectedPins) +ChangeSquare(Selected|SelectedObjects)@end format +@end cartouche + +Changes the square flag of pins and pads. +@c ./../src/action.c 4250 + +Note that @code{Pins} means both pins and pads. + +@pinshapes + + +@node ClearOctagon Action +@subsection ClearOctagon +@c key ClearOctagon in hid +@cartouche +@format +ClearOctagon(ToggleObject|Object|SelectedObjects|Selected) +ClearOctagon(SelectedElements|SelectedPins|SelectedVias)@end format +@end cartouche + +Clears the octagon-flag of pins and vias. +@c ./../src/action.c 4515 + +@pinshapes + + +@node ClearSquare Action +@subsection ClearSquare +@c key ClearSquare in hid +@cartouche +@format +ClearSquare(ToggleObject|SelectedElements|SelectedPins)@end format +@end cartouche + +Clears the square-flag of pins and pads. +@c ./../src/action.c 4352 + +Note that @code{Pins} means pins and pads. + +@pinshapes + + +@node ClrFlag Action +@subsection ClrFlag +@c key ClrFlag in hid +@cartouche +@format +ClrFlag(Object|Selected|SelectedObjects, flag) +ClrFlag(SelectedLines|SelectedPins|SelectedVias, flag) +ClrFlag(SelectedPads|SelectedTexts|SelectedNames, flag) +ClrFlag(SelectedElements, flag) +flag = square | octagon | thermal | join@end format +@end cartouche + +Clears flags on objects. +@c ./../src/action.c 5733 + +Turns the given flag off, regardless of its previous setting. See +@code{ChangeFlag}. + +@example +ClrFlag(SelectedLines,join) +@end example + + +@node Connection Action +@subsection Connection +@c key Connection in hid +@cartouche +@format +Connection(Find|ResetLinesAndPolygons|ResetPinsAndVias|Reset)@end format +@end cartouche + +Searches connections of the object at the cursor position. +@c ./../src/action.c 2093 + +Connections found with this action will be highlighted in the +``connected-color'' color and will have the ``found'' flag set. + +@table @code + +@item Find +The net under the cursor is ``found''. + +@item ResetLinesAndPolygons +Any ``found'' lines and polygons are marked ``not found''. + +@item ResetPinsAndVias +Any ``found'' pins and vias are marked ``not found''. + +@item Reset +All ``found'' objects are marked ``not found''. + +@end table + + +@node Delete Action +@subsection Delete +@c key Delete in hid +@cartouche +@format +Delete(Object|Selected) +Delete(AllRats|SelectedRats)@end format +@end cartouche + +Delete stuff. +@c ./../src/action.c 3371 + + +@node DeleteRats Action +@subsection DeleteRats +@c key DeleteRats in hid +@cartouche +@format +DeleteRats(AllRats|Selected|SelectedRats)@end format +@end cartouche + +Delete rat lines. +@c ./../src/action.c 3418 + + +@node DisableVendor Action +@subsection DisableVendor +@c key DisableVendor in hid +@cartouche +@format +DisableVendor()@end format +@end cartouche + +Disables automatic drill size mapping. +@c ./../src/vendor.c 161 + +@cindex vendor map +@cindex vendor drill table +@findex DisableVendor() + +When drill mapping is enabled, new instances of pins and vias will +have their drill holes mapped to one of the allowed drill sizes +specified in the currently loaded vendor drill table. + + +@node DisperseElements Action +@subsection DisperseElements +@c key DisperseElements in hid +@cartouche +@format +DisperseElements(All|Selected)@end format +@end cartouche + +Disperses elements. +@c ./../src/action.c 2146 + +Normally this is used when starting a board, by selecting all elements +and then dispersing them. This scatters the elements around the board +so that you can pick individual ones, rather than have all the +elements at the same 0,0 coordinate and thus impossible to choose +from. + + +@node Display Action +@subsection Display +@c key Display in hid +@cartouche +@format +Display(NameOnPCB|Description|Value) +Display(Grid|Redraw) +Display(CycleClip|CycleCrosshair|Toggle45Degree|ToggleStartDirection) +Display(ToggleGrid|ToggleRubberBandMode|ToggleUniqueNames) +Display(ToggleMask|ToggleName|ToggleClearLine|ToggleFullPoly|ToggleSnapPin) +Display(ToggleThindraw|ToggleThindrawPoly|ToggleOrthoMove|ToggleLocalRef) +Display(ToggleCheckPlanes|ToggleShowDRC|ToggleAutoDRC) +Display(ToggleLiveRoute|LockNames|OnlyNames) +Display(Pinout|PinOrPadName)@end format +@end cartouche + +Several display-related actions. +@c ./../src/action.c 2262 + +@table @code + +@item NameOnPCB +@item Description +@item Value +Specify whether all elements show their name, description, or value. + +@item Redraw +Redraw the whole board. + +@item Toggle45Degree +When clear, lines can be drawn at any angle. When set, lines are +restricted to multiples of 45 degrees and requested lines may be +broken up according to the clip setting. + +@item CycleClip +Changes the way lines are restricted to 45 degree increments. The +various settings are: straight only, orthogonal then angled, and angled +then orthogonal. If AllDirections is set, this action disables it. + +@item CycleCrosshair +Changes crosshair drawing. Crosshair may accept form of 4-ray, +8-ray and 12-ray cross. + +@item ToggleRubberBandMode +If set, moving an object moves all the lines attached to it too. + +@item ToggleStartDirection +If set, each time you set a point in a line, the Clip toggles between +orth-angle and angle-ortho. + +@item ToggleUniqueNames +If set, you will not be permitted to change the name of an element to +match that of another element. + +@item ToggleSnapPin +If set, pin centers and pad end points are treated as additional grid +points that the cursor can snap to. + +@item ToggleLocalRef +If set, the mark is automatically set to the beginning of any move, so +you can see the relative distance you've moved. + +@item ToggleThindraw +If set, objects on the screen are drawn as outlines (lines are drawn +as center-lines). This lets you see line endpoints hidden under pins, +for example. + +@item ToggleThindrawPoly +If set, polygons on the screen are drawn as outlines. + +@item ToggleShowDRC +If set, pending objects (i.e. lines you're in the process of drawing) +will be drawn with an outline showing how far away from other copper +you need to be. + +@item ToggleLiveRoute +If set, the progress of the autorouter will be visible on the screen. + +@item ToggleAutoDRC +If set, you will not be permitted to make connections which violate +the current DRC and netlist settings. + +@item ToggleCheckPlanes +If set, lines and arcs aren't drawn, which usually leaves just the +polygons. If you also disable all but the layer you're interested in, +this allows you to check for isolated regions. + +@item ToggleOrthoMove +If set, the crosshair is only allowed to move orthogonally from its +previous position. I.e. you can move an element or line up, down, +left, or right, but not up+left or down+right. + +@item ToggleName +Selects whether the pinouts show the pin names or the pin numbers. + +@item ToggleLockNames +If set, text will ignore left mouse clicks and actions that work on +objects under the mouse. You can still select text with a lasso (left +mouse drag) and perform actions on the selection. + +@item ToggleOnlyNames +If set, only text will be sensitive for mouse clicks and actions that +work on objects under the mouse. You can still select other objects +with a lasso (left mouse drag) and perform actions on the selection. + +@item ToggleMask +Turns the solder mask on or off. + +@item ToggleClearLine +When set, the clear-line flag causes new lines and arcs to have their +``clear polygons'' flag set, so they won't be electrically connected +to any polygons they overlap. + +@item ToggleFullPoly +When set, the full-poly flag causes new polygons to have their +``full polygon'' flag set, so all parts of them will be displayed +instead of only the biggest one. + +@item ToggleGrid +Resets the origin of the current grid to be wherever the mouse pointer +is (not where the crosshair currently is). If you provide two numbers +after this, the origin is set to that coordinate. + +@item Grid +Toggles whether the grid is displayed or not. + +@item Pinout +Causes the pinout of the element indicated by the cursor to be +displayed, usually in a separate window. + +@item PinOrPadName +Toggles whether the names of pins, pads, or (yes) vias will be +displayed. If the cursor is over an element, all of its pins and pads +are affected. + +@end table + + +@node djopt Action +@subsection djopt +@c key djopt in hid +@cartouche +@format +djopt(debumpify|unjaggy|simple|vianudge|viatrim|orthopull) +djopt(auto) - all of the above +djopt(miter)@end format +@end cartouche + +Perform various optimizations on the current board. +@c ./../src/djopt.c 2853 + +The different types of optimizations change your board in order to +reduce the total trace length and via count. + +@table @code + +@item debumpify +Looks for U-shaped traces that can be shortened or eliminated. + +@item unjaggy +Looks for corners which could be flipped to eliminate one or more +corners (i.e. jaggy lines become simpler). + +@item simple +Removing uneeded vias, replacing two or more trace segments in a row +with a single segment. This is usually performed automatically after +other optimizations. + +@item vianudge +Looks for vias where all traces leave in the same direction. Tries to +move via in that direction to eliminate one of the traces (and thus a +corner). + +@item viatrim +Looks for traces that go from via to via, where moving that trace to a +different layer eliminates one or both vias. + +@item orthopull +Looks for chains of traces all going in one direction, with more +traces orthogonal on one side than on the other. Moves the chain in +that direction, causing a net reduction in trace length, possibly +eliminating traces and/or corners. + +@item splitlines +Looks for lines that pass through vias, pins, or pads, and splits them +into separate lines so they can be managed separately. + +@item auto +Performs the above options, repeating until no further optimizations +can be made. + +@item miter +Replaces 90 degree corners with a pair of 45 degree corners, to reduce +RF losses and trace length. + +@end table + + +@node DRC Action +@subsection DRC +@c key DRC in hid +@cartouche +@format +DRC()@end format +@end cartouche + +Invoke the DRC check. +@c ./../src/action.c 1755 + +Note that the design rule check uses the current board rule settings, +not the current style settings. + + +@node DumpLibrary Action +@subsection DumpLibrary +@c key DumpLibrary in hid +@cartouche +@format +DumpLibrary()@end format +@end cartouche + +Display the entire contents of the libraries. +@c ./../src/action.c 1791 + + + +@node elementlist Action +@subsection elementlist +@c key elementlist in hid +@cartouche +@format +ElementList(Start|Done|Need,,,)@end format +@end cartouche + +Adds the given element if it doesn't already exist. +@c ./../src/action.c 5983 + +@table @code + +@item Start +Indicates the start of an element list; call this before any Need +actions. + +@item Need +Searches the board for an element with a matching refdes. + +If found, the value and footprint are updated. + +If not found, a new element is created with the given footprint and value. + +@item Done +Compares the list of elements needed since the most recent +@code{start} with the list of elements actually on the board. Any +elements that weren't listed are selected, so that the user may delete +them. + +@end table + + +@node elementsetattr Action +@subsection elementsetattr +@c key elementsetattr in hid +@cartouche +@format +ElementSetAttr(refdes,name[,value])@end format +@end cartouche + +Sets or clears an element-specific attribute. +@c ./../src/action.c 6176 + +If a value is specified, the named attribute is added (if not already +present) or changed (if it is) to the given value. If the value is +not specified, the given attribute is removed if present. + + +@node EnableVendor Action +@subsection EnableVendor +@c key EnableVendor in hid +@cartouche +@format +EnableVendor()@end format +@end cartouche + +Enables automatic drill size mapping. +@c ./../src/vendor.c 146 + +@cindex vendor map +@cindex vendor drill table +@findex EnableVendor() + +When drill mapping is enabled, new instances of pins and vias will +have their drill holes mapped to one of the allowed drill sizes +specified in the currently loaded vendor drill table. To enable drill +mapping, a vendor resource file containing a drill table must be +loaded first. + + +@node execcommand Action +@subsection execcommand +@c key execcommand in hid +@cartouche +@format +ExecCommand(command)@end format +@end cartouche + +Runs a command. +@c ./../src/action.c 6234 + +Runs the given command, which is a system executable. + + +@node ExecuteFile Action +@subsection ExecuteFile +@c key ExecuteFile in hid +@cartouche +@format +ExecuteFile(filename)@end format +@end cartouche + +Run actions from the given file. +@c ./../src/action.c 5861 + +Lines starting with @code{#} are ignored. + + +@node Flip Action +@subsection Flip +@c key Flip in hid +@cartouche +@format +Flip(Object|Selected|SelectedElements)@end format +@end cartouche + +Flip an element to the opposite side of the board. +@c ./../src/action.c 1841 + +Note that the location of the element will be symmetric about the +cursor location; i.e. if the part you are pointing at will still be at +the same spot once the element is on the other side. When flipping +multiple elements, this retains their positions relative to each +other, not their absolute positions on the board. + + +@node FontEdit Action +@subsection FontEdit +@c key FontEdit in hid +@cartouche +@format +FontEdit()@end format +@end cartouche + +Convert the current font to a PCB for editing. +@c ./../src/fontmode.c 73 + + +@node FontSave Action +@subsection FontSave +@c key FontSave in hid +@cartouche +@format +FontSave()@end format +@end cartouche + +Convert the current PCB back to a font. +@c ./../src/fontmode.c 173 + + +@node FreeRotateBuffer Action +@subsection FreeRotateBuffer +@c key FreeRotateBuffer in hid +@cartouche +@format +FreeRotateBuffer([Angle])@end format +@end cartouche + +Rotates the current paste buffer contents by the specified angle. The +angle is given in degrees. If no angle is given, the user is prompted +for one. + +@c ./../src/buffer.c 1370 + +Rotates the contents of the pastebuffer by an arbitrary angle. If no +angle is given, the user is prompted for one. + + +@node GlobalPuller Action +@subsection GlobalPuller +@c key GlobalPuller in hid +@cartouche +@format +GlobalPuller()@end format +@end cartouche + +Pull all traces tight. +@c ./../src/puller.c 534 + + +@node h Action +@subsection h +@c key h in hid +@cartouche +@format +h@end format +@end cartouche + +Print a help message for commands. +@c ./../src/command.c 72 + +@colonaction + + +@node Import Action +@subsection Import +@c key Import in hid +@cartouche +@format +Import() +Import([gnetlist|make[,source,source,...]]) +Import(setnewpoint[,(mark|center|X,Y)]) +Import(setdisperse,D,units) +@end format +@end cartouche + +Import schematics. +@c ./../src/action.c 6464 + +Imports element and netlist data from the schematics (or some other +source). The first parameter, which is optional, is the mode. If not +specified, the @code{import::mode} attribute in the PCB is used. +@code{gnetlist} means gnetlist is used to obtain the information from +the schematics. @code{make} invokes @code{make}, assuming the user +has a @code{Makefile} in the current directory. The @code{Makefile} +will be invoked with the following variables set: + +@table @code + +@item PCB +The name of the .pcb file + +@item SRCLIST +A space-separated list of source files + +@item OUT +The name of the file in which to put the command script, which may +contain any @pcb{} actions. By default, this is a temporary file +selected by @pcb{}, but if you specify an @code{import::outfile} +attribute, that file name is used instead (and not automatically +deleted afterwards). + +@end table + +The target specified to be built is the first of these that apply: + +@itemize @bullet + +@item +The target specified by an @code{import::target} attribute. + +@item +The output file specified by an @code{import::outfile} attribute. + +@item +If nothing else is specified, the target is @code{pcb_import}. + +@end itemize + +If you specify an @code{import::makefile} attribute, then "-f " will be added to the command line. + +If you specify the mode, you may also specify the source files +(schematics). If you do not specify any, the list of schematics is +obtained by reading the @code{import::src@var{N}} attributes (like +@code{import::src0}, @code{import::src1}, etc). + +For compatibility with future extensions to the import file format, +the generated file @emph{must not} start with the two characters +@code{#%}. + +If a temporary file is needed the @code{TMPDIR} environment variable +is used to select its location. + +Note that the programs @code{gnetlist} and @code{make} may be +overridden by the user via the @code{make-program} and @code{gnetlist} +@code{pcb} settings (i.e. in @code{~/.pcb/settings} or on the command +line). + +If @pcb{} cannot determine which schematic(s) to import from, the GUI +is called to let user choose (see @code{ImportGUI()}). + +Note that Import() doesn't delete anything - after an Import, elements +which shouldn't be on the board are selected and may be removed once +it's determined that the deletion is appropriate. + +If @code{Import()} is called with @code{setnewpoint}, then the location +of new components can be specified. This is where parts show up when +they're added to the board. The default is the center of the board. + +@table @code + +@item Import(setnewpoint) + +Prompts the user to click on the board somewhere, uses that point. If +called by a hotkey, uses the current location of the crosshair. + +@item Import(setnewpoint,mark) + +Uses the location of the mark. If no mark is present, the point is +not changed. + +@item Import(setnewpoint,center) + +Resets the point to the center of the board. + +@item Import(setnewpoint,X,Y,units) + +Sets the point to the specific coordinates given. Example: +@code{Import(setnewpoint,50,25,mm)} + +@end table + +Note that the X and Y locations are stored in attributes named +@code{import::newX} and @code{import::newY} so you could change them +manually if you wished. + +Calling @code{Import(setdisperse,D,units)} sets how much the newly +placed elements are dispersed relative to the set point. For example, +@code{Import(setdisperse,10,mm)} will offset each part randomly up to +10mm away from the point. The default dispersion is 1/10th of the +smallest board dimension. Dispersion is saved in the +@code{import::disperse} attribute. + + +@node l Action +@subsection l +@c key l in hid +@cartouche +@format +l [name]@end format +@end cartouche + +Loads layout data. +@c ./../src/command.c 99 + +Loads a new datafile (layout) and, if confirmed, overwrites any +existing unsaved data. The filename and the searchpath +(@emph{filePath}) are passed to the command defined by +@emph{fileCommand}. If no filename is specified a file select box +will popup. + +@colonaction + + +@node le Action +@subsection le +@c key le in hid +@cartouche +@format +le [name]@end format +@end cartouche + +Loads an element into the current buffer. +@c ./../src/command.c 129 + +The filename and the searchpath (@emph{elementPath}) are passed to the +command defined by @emph{elementCommand}. If no filename is specified +a file select box will popup. + +@colonaction + + +@node LoadFootprint Action +@subsection LoadFootprint +@c key LoadFootprint in hid +@cartouche +@format +LoadFootprint(filename[,refdes,value])@end format +@end cartouche + +Loads a single footprint by name. +@c ./../src/buffer.c 809 + +Loads a single footprint by name, rather than by reference or through +the library. If a refdes and value are specified, those are inserted +into the footprint as well. The footprint remains in the paste buffer. + + +@node LoadFrom Action +@subsection LoadFrom +@c key LoadFrom in hid +@cartouche +@format +LoadFrom(Layout|LayoutToBuffer|ElementToBuffer|Netlist|Revert,filename)@end format +@end cartouche + +Load layout data from a file. +@c ./../src/action.c 5031 + +This action assumes you know what the filename is. The various GUIs +should have a similar @code{Load} action where the filename is +optional, and will provide their own file selection mechanism to let +you choose the file name. + +@table @code + +@item Layout +Loads an entire PCB layout, replacing the current one. + +@item LayoutToBuffer +Loads an entire PCB layout to the paste buffer. + +@item ElementToBuffer +Loads the given element file into the paste buffer. Element files +contain only a single @code{Element} definition, such as the +``newlib'' library uses. + +@item Netlist +Loads a new netlist, replacing any current netlist. + +@item Revert +Re-loads the current layout from its disk file, reverting any changes +you may have made. + +@end table + + +@node LoadVendorFrom Action +@subsection LoadVendorFrom +@c key LoadVendorFrom in hid +@cartouche +@format +LoadVendorFrom(filename)@end format +@end cartouche + +Loads the specified vendor resource file. +@c ./../src/vendor.c 201 + +@cindex vendor map +@cindex vendor drill table +@findex LoadVendorFrom() + +@table @var +@item filename +Name of the vendor resource file. If not specified, the user will +be prompted to enter one. +@end table + + +@node m Action +@subsection m +@c key m in hid +@cartouche +@format +m [name]@end format +@end cartouche + +Loads a layout into the current buffer. +@c ./../src/command.c 157 + +The filename and the searchpath (@emph{filePath}) are passed to the +command defined by @emph{fileCommand}. +If no filename is specified a file select box will popup. + +@colonaction + + +@node MarkCrosshair Action +@subsection MarkCrosshair +@c key MarkCrosshair in hid +@cartouche +@format +MarkCrosshair() +MarkCrosshair(Center)@end format +@end cartouche + +Set/Reset the Crosshair mark. +@c ./../src/action.c 3502 + +The ``mark'' is a small X-shaped target on the display which is +treated like a second origin (the normal origin is the upper let +corner of the board). The GUI will display a second set of +coordinates for this mark, which tells you how far you are from it. + +If no argument is given, the mark is toggled - disabled if it was +enabled, or enabled at the current cursor position of disabled. If +the @code{Center} argument is given, the mark is moved to the current +cursor location. + + +@node Message Action +@subsection Message +@c key Message in hid +@cartouche +@format +Message(message)@end format +@end cartouche + +Writes a message to the log window. +@c ./../src/action.c 1886 + +This action displays a message to the log window. This action is primarily +provided for use by other programs which may interface with PCB. If +multiple arguments are given, each one is sent to the log window +followed by a newline. + + +@node MinClearGap Action +@subsection MinClearGap +@c key MinClearGap in hid +@cartouche +@format +MinClearGap(delta) +MinClearGap(Selected, delta)@end format +@end cartouche + +Ensures that polygons are a minimum distance from objects. +@c ./../src/action.c 3827 + +Checks all specified objects, and increases the polygon clearance if +needed to ensure a minimum distance between their edges and the +polygon edges. + + +@node MinMaskGap Action +@subsection MinMaskGap +@c key MinMaskGap in hid +@cartouche +@format +MinMaskGap(delta) +MinMaskGap(Selected, delta)@end format +@end cartouche + +Ensures the mask is a minimum distance from pins and pads. +@c ./../src/action.c 3752 + +Checks all specified pins and/or pads, and increases the mask if +needed to ensure a minimum distance between the pin or pad edge and +the mask edge. + + +@node Mode Action +@subsection Mode +@c key Mode in hid +@cartouche +@format +Mode(Arc|Arrow|Copy|InsertPoint|Line|Lock|Move|None|PasteBuffer) +Mode(Polygon|Rectangle|Remove|Rotate|Text|Thermal|Via) +Mode(Notify|Release|Cancel|Stroke) +Mode(Save|Restore)@end format +@end cartouche + +Change or use the tool mode. +@c ./../src/action.c 2612 + +@table @code + +@item Arc +@itemx Arrow +@itemx Copy +@itemx InsertPoint +@itemx Line +@itemx Lock +@itemx Move +@itemx None +@itemx PasteBuffer +@itemx Polygon +@itemx Rectangle +@itemx Remove +@itemx Rotate +@itemx Text +@itemx Thermal +@itemx Via +Select the indicated tool. + +@item Notify +Called when you press the mouse button, or move the mouse. + +@item Release +Called when you release the mouse button. + +@item Cancel +Cancels any pending tool activity, allowing you to restart elsewhere. +For example, this allows you to start a new line rather than attach a +line to the previous line. + +@item Escape +Similar to Cancel but calling this action a second time will return +to the Arrow tool. + +@item Stroke +If your @code{pcb} was built with libstroke, this invokes the stroke +input method. If not, this will restart a drawing mode if you were +drawing, else it will select objects. + +@item Save +Remembers the current tool. + +@item Restore +Restores the tool to the last saved tool. + +@end table + + +@node MorphPolygon Action +@subsection MorphPolygon +@c key MorphPolygon in hid +@cartouche +@format +MorphPolygon(Object|Selected)@end format +@end cartouche + +Converts dead polygon islands into separate polygons. +@c ./../src/action.c 4087 + +If a polygon is divided into unconnected "islands", you can use +this command to convert the otherwise disappeared islands into +separate polygons. Be sure the cursor is over a portion of the +polygon that remains visible. Very small islands that may flake +off are automatically deleted. + + +@node MoveLayer Action +@subsection MoveLayer +@c key MoveLayer in hid +@cartouche +@format +MoveLayer(old,new)@end format +@end cartouche + +Moves/Creates/Deletes Layers. +@c ./../src/move.c 1091 + +Moves a layer, creates a new layer, or deletes a layer. + +@table @code + +@item old +The is the layer number to act upon. Allowed values are: +@table @code + +@item c +Currently selected layer. + +@item -1 +Create a new layer. + +@item number +An existing layer number. + +@end table + +@item new +Specifies where to move the layer to. Allowed values are: +@table @code +@item -1 +Deletes the layer. + +@item up +Moves the layer up. + +@item down +Moves the layer down. + +@item c +Creates a new layer. + +@end table + +@end table + + +@node MoveObject Action +@subsection MoveObject +@c key MoveObject in hid +@cartouche +@format +MoveObject(X,Y,dim)@end format +@end cartouche + +Moves the object under the crosshair. +@c ./../src/action.c 5567 + +The @code{X} and @code{Y} are treated like @code{delta} is for many +other objects. For each, if it's prefixed by @code{+} or @code{-}, +then that amount is relative. Otherwise, it's absolute. Units can be +@code{mil} or @code{mm}; if unspecified, units are PCB's internal +units, currently 1/100 mil. + + +@node MoveToCurrentLayer Action +@subsection MoveToCurrentLayer +@c key MoveToCurrentLayer in hid +@cartouche +@format +MoveToCurrentLayer(Object|SelectedObjects)@end format +@end cartouche + +Moves objects to the current layer. +@c ./../src/action.c 5609 + +Note that moving an element from a component layer to a solder layer, +or from solder to component, won't automatically flip it. Use the +@code{Flip()} action to do that. + + +@node Netlist Action +@subsection Netlist +@c key Netlist in hid +@cartouche +@format +Net(find|select|rats|norats|clear[,net[,pin]]) +Net(freeze|thaw|forcethaw) +Net(add,net,pin)@end format +@end cartouche + +Perform various actions on netlists. +@c ./../src/netlist.c 289 + +Each of these actions apply to a specified set of nets. @var{net} and +@var{pin} are patterns which match one or more nets or pins; these +patterns may be full names or regular expressions. If an exact match +is found, it is the only match; if no exact match is found, +@emph{then} the pattern is tried as a regular expression. + +If neither @var{net} nor @var{pin} are specified, all nets apply. If +@var{net} is specified but not @var{pin}, all nets matching @var{net} +apply. If both are specified, nets which match @var{net} and contain +a pin matching @var{pin} apply. + +@table @code + +@item find +Nets which apply are marked @emph{found} and are drawn in the +@code{connected-color} color. + +@item select +Nets which apply are selected. + +@item rats +Nets which apply are marked as available for the rats nest. + +@item norats +Nets which apply are marked as not available for the rats nest. + +@item clear +Clears the netlist. + +@item add +Add the given pin to the given netlist, creating either if needed. + +@item sort +Called after a list of add's, this sorts the netlist. + +@item freeze +@itemx thaw +@itemx forcethaw +Temporarily prevents changes to the netlist from being reflected in +the GUI. For example, if you need to make multiple changes, you +freeze the netlist, make the changes, then thaw it. Note that +freeze/thaw requests may nest, with the netlist being fully thawed +only when all pending freezes are thawed. You can bypass the nesting +by using forcethaw, which resets the freeze count and immediately +updates the GUI. + +@end table + + +@node New Action +@subsection New +@c key New in hid +@cartouche +@format +New([name])@end format +@end cartouche + +Starts a new layout. +@c ./../src/action.c 5093 + +If a name is not given, one is prompted for. + + +@node OptAutoOnly Action +@subsection OptAutoOnly +@c key OptAutoOnly in hid +@cartouche +@format +OptAutoOnly()@end format +@end cartouche + +Toggles the optimize-only-autorouted flag. +@c ./../src/djopt.c 129 + +The original purpose of the trace optimizer was to clean up the traces +created by the various autorouters that have been used with PCB. When +a board has a mix of autorouted and carefully hand-routed traces, you +don't normally want the optimizer to move your hand-routed traces. +But, sometimes you do. By default, the optimizer only optimizes +autorouted traces. This action toggles that setting, so that you can +optimize hand-routed traces also. + + +@node PasteBuffer Action +@subsection PasteBuffer +@c key PasteBuffer in hid +@cartouche +@format +PasteBuffer(AddSelected|Clear|1..MAX_BUFFER) +PasteBuffer(Rotate, 1..3) +PasteBuffer(Convert|Save|Restore|Mirror) +PasteBuffer(ToLayout, X, Y, units)@end format +@end cartouche + +Various operations on the paste buffer. +@c ./../src/action.c 5153 + +There are a number of paste buffers; the actual limit is a +compile-time constant @code{MAX_BUFFER} in @file{globalconst.h}. It +is currently @code{5}. One of these is the ``current'' paste buffer, +often referred to as ``the'' paste buffer. + +@table @code + +@item AddSelected +Copies the selected objects to the current paste buffer. + +@item Clear +Remove all objects from the current paste buffer. + +@item Convert +Convert the current paste buffer to an element. Vias are converted to +pins, lines are converted to pads. + +@item Restore +Convert any elements in the paste buffer back to vias and lines. + +@item Mirror +Flip all objects in the paste buffer vertically (up/down flip). To mirror +horizontally, combine this with rotations. + +@item Rotate +Rotates the current buffer. The number to pass is 1..3, where 1 means +90 degrees counter clockwise, 2 means 180 degrees, and 3 means 90 +degrees clockwise (270 CCW). + +@item Save +Saves any elements in the current buffer to the indicated file. + +@item ToLayout +Pastes any elements in the current buffer to the indicated X, Y +coordinates in the layout. The @code{X} and @code{Y} are treated like +@code{delta} is for many other objects. For each, if it's prefixed by +@code{+} or @code{-}, then that amount is relative to the last +location. Otherwise, it's absolute. Units can be +@code{mil} or @code{mm}; if unspecified, units are PCB's internal +units, currently 1/100 mil. + + +@item 1..MAX_BUFFER +Selects the given buffer to be the current paste buffer. + +@end table + + +@node Polygon Action +@subsection Polygon +@c key Polygon in hid +@cartouche +@format +Polygon(Close|PreviousPoint)@end format +@end cartouche + +Some polygon related stuff. +@c ./../src/action.c 5503 + +Polygons need a special action routine to make life easier. + +@table @code + +@item Close +Creates the final segment of the polygon. This may fail if clipping +to 45 degree lines is switched on, in which case a warning is issued. + +@item PreviousPoint +Resets the newly entered corner to the previous one. The Undo action +will call Polygon(PreviousPoint) when appropriate to do so. + +@end table + + +@node Puller Action +@subsection Puller +@c key Puller in hid +@cartouche +@format +Puller()@end format +@end cartouche + +Pull an arc-line junction tight. +@c ./../src/puller.c 411 + +The @code{Puller()} action is a special-purpose optimization. When +invoked while the crosshair is over the junction of an arc and a line, +it will adjust the arc's angle and the connecting line's endpoint such +that the line intersects the arc at a tangent. In the example below, +the left side is ``before'' with the black target marking where to put +the crosshair: + +@center @image{puller,,,Example of how puller works,png} + +The right side is ``after'' with the black target marking where the +arc-line intersection was moved to. + + +@node q Action +@subsection q +@c key q in hid +@cartouche +@format +q@end format +@end cartouche + +Quits the application after confirming. +@c ./../src/command.c 185 + +If you have unsaved changes, you will be prompted to confirm (or +save) before quitting. + +@colonaction + + +@node q! Action +@subsection q! +@c key q! in hid +@cartouche +@format +q!@end format +@end cartouche + +Quits the application without confirming. +@c ./../src/command.c 199 + +Note that this command neither saves your data nor prompts for +confirmation. + +@colonaction + + +@node Quit Action +@subsection Quit +@c key Quit in hid +@cartouche +@format +Quit()@end format +@end cartouche + +Quits the application after confirming. +@c ./../src/action.c 2071 + +If you have unsaved changes, you will be prompted to confirm (or +save) before quitting. + + +@node Redo Action +@subsection Redo +@c key Redo in hid +@cartouche +@format +Redo()@end format +@end cartouche + +Redo recent``undo''operations. +@c ./../src/action.c 5468 + +This routine allows you to recover from the last undo command. You +might want to do this if you thought that undo was going to revert +something other than what it actually did (in case you are confused +about which operations are un-doable), or if you have been backing up +through a long undo list and over-shoot your stopping point. Any +change that is made since the undo in question will trim the redo +list. For example if you add ten lines, then undo three of them you +could use redo to put them back, but if you move a line on the board +before performing the redo, you will lose the ability to "redo" the +three "undone" lines. + + +@node RemoveSelected Action +@subsection RemoveSelected +@c key RemoveSelected in hid +@cartouche +@format +RemoveSelected()@end format +@end cartouche + +Removes any selected objects. +@c ./../src/action.c 2832 + + +@node Renumber Action +@subsection Renumber +@c key Renumber in hid +@cartouche +@format +Renumber() +Renumber(filename)@end format +@end cartouche + +Renumber all elements. The changes will be recorded to filename +for use in backannotating these changes to the schematic. +@c ./../src/action.c 2848 + + +@node Report Action +@subsection Report +@c key Report in hid +@cartouche +@format +Report(Object|DrillReport|FoundPins|NetLength|AllNetLengths|[,name])@end format +@end cartouche + +Produce various report. +@c ./../src/report.c 942 + +@table @code + +@item Object +The object under the crosshair will be reported, describing various +aspects of the object. + +@item DrillReport +A report summarizing the number of drill sizes used, and how many of +each, will be produced. + +@item FoundPins +A report listing all pins and pads which are marked as ``found'' will +be produced. + +@item NetLength +The name and length of the net under the crosshair will be reported to +the message log. + +@item AllNetLengths +The name and length of the net under the crosshair will be reported to +the message log. An optional parameter specifies mm, mil, pcb, or in +units + +@end table + + +@node ReportDialog Action +@subsection ReportDialog +@c key ReportDialog in hid +@cartouche +@format +ReportDialog()@end format +@end cartouche + +Report on the object under the crosshair +@c ./../src/report.c 125 + +This is a shortcut for @code{Report(Object)}. + + +@node RipUp Action +@subsection RipUp +@c key RipUp in hid +@cartouche +@format +RipUp(All|Selected|Element)@end format +@end cartouche + +Ripup auto-routed tracks, or convert an element to parts. +@c ./../src/action.c 3199 + +@table @code + +@item All +Removes all lines and vias which were created by the autorouter. + +@item Selected +Removes all selected lines and vias which were created by the +autorouter. + +@item Element +Converts the element under the cursor to parts (vias and lines). Note +that this uses the highest numbered paste buffer. + +@end table + + +@node rn Action +@subsection rn +@c key rn in hid +@cartouche +@format +rn [name]@end format +@end cartouche + +Reads netlist. +@c ./../src/command.c 214 + +If no filename is given a file select box will pop up. The file is +read via the command defined by the @emph{RatCommand} resource. The +command must send its output to @emph{stdout}. + +Netlists are used for generating rat's nests (see @ref{Rats Nest}) and +for verifying the board layout (which is also accomplished by the +@emph{Ratsnest} command). + +@colonaction + + +@node RouteStyle Action +@subsection RouteStyle +@c key RouteStyle in hid +@cartouche +@format +RouteStyle(1|2|3|4)@end format +@end cartouche + +Copies the indicated routing style into the current sizes. +@c ./../src/action.c 5535 + + +@node s Action +@subsection s +@c key s in hid +@cartouche +@format +s [name]@end format +@end cartouche + +Saves layout data. +@c ./../src/command.c 244 + +Data and the filename are passed to the command defined by the +resource @emph{saveCommand}. It must read the layout data from +@emph{stdin}. If no filename is entered, either the last one is used +again or, if it is not available, a file select box will pop up. + +@colonaction + + +@node SaveSettings Action +@subsection SaveSettings +@c key SaveSettings in hid +@cartouche +@format +SaveSettings() +SaveSettings(local)@end format +@end cartouche + +Saves settings. +@c ./../src/action.c 5015 + +If you pass no arguments, the settings are stored in +@code{$HOME/.pcb/settings}. If you pass the word @code{local} they're +saved in @code{./pcb.settings}. + + +@node SaveTo Action +@subsection SaveTo +@c key SaveTo in hid +@cartouche +@format +SaveTo(Layout|LayoutAs,filename) +SaveTo(AllConnections|AllUnusedPins|ElementConnections,filename) +SaveTo(PasteBuffer,filename)@end format +@end cartouche + +Saves data to a file. +@c ./../src/action.c 4919 + +@table @code + +@item Layout +Saves the current layout. + +@item LayoutAs +Saves the current layout, and remembers the filename used. + +@item AllConnections +Save all connections to a file. + +@item AllUnusedPins +List all unused pins to a file. + +@item ElementConnections +Save connections to the element at the cursor to a file. + +@item PasteBuffer +Save the content of the active Buffer to a file. This is the graphical way to create a footprint. + +@end table + + +@node Select Action +@subsection Select +@c key Select in hid +@cartouche +@format +Select(Object|ToggleObject) +Select(All|Block|Connection) +Select(ElementByName|ObjectByName|PadByName|PinByName) +Select(ElementByName|ObjectByName|PadByName|PinByName, Name) +Select(TextByName|ViaByName|NetByName) +Select(TextByName|ViaByName|NetByName, Name) +Select(Convert)@end format +@end cartouche + +Toggles or sets the selection. +@c ./../src/action.c 4651 + +@table @code + +@item ElementByName +@item ObjectByName +@item PadByName +@item PinByName +@item TextByName +@item ViaByName +@item NetByName + +These all rely on having a regular expression parser built into +@code{pcb}. If the name is not specified then the user is prompted +for a pattern, and all objects that match the pattern and are of the +type specified are selected. + +@item Object +@item ToggleObject +Selects the object under the cursor. + +@item Block +Selects all objects in a rectangle indicated by the cursor. + +@item All +Selects all objects on the board. + +@item Connection +Selects all connections with the ``found'' flag set. + +@item Convert +Converts the selected objects to an element. This uses the highest +numbered paste buffer. + +@end table + + +@node SetFlag Action +@subsection SetFlag +@c key SetFlag in hid +@cartouche +@format +SetFlag(Object|Selected|SelectedObjects, flag) +SetFlag(SelectedLines|SelectedPins|SelectedVias, flag) +SetFlag(SelectedPads|SelectedTexts|SelectedNames, flag) +SetFlag(SelectedElements, flag) +flag = square | octagon | thermal | join@end format +@end cartouche + +Sets flags on objects. +@c ./../src/action.c 5716 + +Turns the given flag on, regardless of its previous setting. See +@code{ChangeFlag}. + +@example +SetFlag(SelectedPins,thermal) +@end example + + +@node SetOctagon Action +@subsection SetOctagon +@c key SetOctagon in hid +@cartouche +@format +SetOctagon(Object|ToggleObject|SelectedElements|Selected)@end format +@end cartouche + +Sets the octagon-flag of objects. +@c ./../src/action.c 4459 + +@pinshapes + + +@node SetSame Action +@subsection SetSame +@c key SetSame in hid +@cartouche +@format +SetSame()@end format +@end cartouche + +Sets current layer and sizes to match indicated item. +@c ./../src/action.c 5648 + +When invoked over any line, arc, polygon, or via, this changes the +current layer to be the layer that item is on, and changes the current +sizes (thickness, keepaway, drill, etc) according to that item. + + +@node SetSquare Action +@subsection SetSquare +@c key SetSquare in hid +@cartouche +@format +SetSquare(ToggleObject|SelectedElements|SelectedPins)@end format +@end cartouche + +sets the square-flag of objects. +@c ./../src/action.c 4301 + +Note that @code{Pins} means pins and pads. + +@pinshapes + + +@node SetThermal Action +@subsection SetThermal +@c key SetThermal in hid +@cartouche +@format +SetThermal(Object|SelectedPins|SelectedVias|Selected, Style)@end format +@end cartouche + +Set the thermal (on the current layer) of pins or vias to the given style. +Style = 0 means no thermal. +Style = 1 has diagonal fingers with sharp edges. +Style = 2 has horizontal and vertical fingers with sharp edges. +Style = 3 is a solid connection to the plane.Style = 4 has diagonal fingers with rounded edges. +Style = 5 has horizontal and vertical fingers with rounded edges. + +@c ./../src/action.c 1912 + +This changes how/whether pins or vias connect to any rectangle or polygon +on the current layer. The first argument can specify one object, or all +selected pins, or all selected vias, or all selected pins and vias. +The second argument specifies the style of connection. +There are 5 possibilities: +0 - no connection, +1 - 45 degree fingers with sharp edges, +2 - horizontal & vertical fingers with sharp edges, +3 - solid connection, +4 - 45 degree fingers with rounded corners, +5 - horizontal & vertical fingers with rounded corners. + +Pins and Vias may have thermals whether or not there is a polygon available +to connect with. However, they will have no effect without the polygon. + +@node SetValue Action +@subsection SetValue +@c key SetValue in hid +@cartouche +@format +SetValue(Grid|Line|LineSize|Text|TextScale|ViaDrillingHole|Via|ViaSize, delta)@end format +@end cartouche + +Change various board-wide values and sizes. +@c ./../src/action.c 1996 + +@table @code + +@item ViaDrillingHole +Changes the diameter of the drill for new vias. + +@item Grid +Sets the grid spacing. + +@item Line +@item LineSize +Changes the thickness of new lines. + +@item Via +@item ViaSize +Changes the diameter of new vias. + +@item Text +@item TextScale +Changes the size of new text. + +@end table + + +@node ToggleHideName Action +@subsection ToggleHideName +@c key ToggleHideName in hid +@cartouche +@format +ToggleHideName(Object|SelectedElements)@end format +@end cartouche + +Toggles the visibility of element names. +@c ./../src/action.c 4134 + +If names are hidden you won't see them on the screen and they will not +appear on the silk layer when you print the layout. + + +@node ToggleVendor Action +@subsection ToggleVendor +@c key ToggleVendor in hid +@cartouche +@format +ToggleVendor()@end format +@end cartouche + +Toggles the state of automatic drill size mapping. +@c ./../src/vendor.c 128 + +@cindex vendor map +@cindex vendor drill table +@findex ToggleVendor() + +When drill mapping is enabled, new instances of pins and vias will +have their drill holes mapped to one of the allowed drill sizes +specified in the currently loaded vendor drill table. To enable drill +mapping, a vendor resource file containing a drill table must be +loaded first. + + +@node Undo Action +@subsection Undo +@c key Undo in hid +@cartouche +@format +Undo() +Undo(ClearList)@end format +@end cartouche + +Undo recent changes. +@c ./../src/action.c 5304 + +The unlimited undo feature of @code{Pcb} allows you to recover from +most operations that materially affect you work. Calling +@code{Undo()} without any parameter recovers from the last (non-undo) +operation. @code{ClearList} is used to release the allocated +memory. @code{ClearList} is called whenever a new layout is started or +loaded. See also @code{Redo} and @code{Atomic}. + +Note that undo groups operations by serial number; changes with the +same serial number will be undone (or redone) as a group. See +@code{Atomic}. + + +@node UnloadVendor Action +@subsection UnloadVendor +@c key UnloadVendor in hid +@cartouche +@format +UnloadVendor()@end format +@end cartouche + +Unloads the current vendor drill mapping table. +@c ./../src/vendor.c 176 + +@cindex vendor map +@cindex vendor drill table +@findex UnloadVendor() + + +@node Unselect Action +@subsection Unselect +@c key Unselect in hid +@cartouche +@format +Unselect(All|Block|Connection) +Unselect(ElementByName|ObjectByName|PadByName|PinByName) +Unselect(ElementByName|ObjectByName|PadByName|PinByName, Name) +Unselect(TextByName|ViaByName) +Unselect(TextByName|ViaByName, Name) +@end format +@end cartouche + +Unselects the object at the pointer location or the specified objects. +@c ./../src/action.c 4803 + +@table @code + +@item All +Unselect all objects. + +@item Block +Unselect all objects in a rectangle given by the cursor. + +@item Connection +Unselect all connections with the ``found'' flag set. + +@item ElementByName +@item ObjectByName +@item PadByName +@item PinByName +@item TextByName +@item ViaByName + +These all rely on having a regular expression parser built into +@code{pcb}. If the name is not specified then the user is prompted +for a pattern, and all objects that match the pattern and are of the +type specified are unselected. + + +@end table + + +@node w Action +@subsection w +@c key w in hid +@cartouche +@format +w [name]@end format +@end cartouche + +Saves layout data. +@c ./../src/command.c 250 + +This commands has been added for the convenience of @code{vi} users +and has the same functionality as @code{s}. + +@colonaction + + +@node wq Action +@subsection wq +@c key wq in hid +@cartouche +@format +wq@end format +@end cartouche + +Saves the layout data and quits. +@c ./../src/command.c 291 + +This command has been added for the convenience of @code{vi} users and +has the same functionality as @code{s} combined with @code{q}. + +@colonaction + + +@node common actions +@section common actions +@c ./../src/hid/common/actions.c 425 + +@macro hidaction + +This is one of a number of actions which are part of the HID +interface. The core functions use these actions to tell the current +GUI when to change the presented information in response to changes +that the GUI may not know about. The user normally does not invoke +these directly. + +@end macro + +@menu +* LayersChanged Action:: Tells the GUI that the layers have changed. +* LibraryChanged Action:: Tells the GUI that the libraries have changed. +* NetlistChanged Action:: Tells the GUI that the netlist has changed. +* PCBChanged Action:: Tells the GUI that the whole PCB has changed. The optional``revert"parameter can be used as a hint to the GUI that the same design is beingreloaded, and that it might keep some viewport settings +* RouteStylesChanged Action:: Tells the GUI that the routing styles have changed. +@end menu +@node LayersChanged Action +@subsection LayersChanged +@c key LayersChanged in hid common +@cartouche +@format +LayersChanged()@end format +@end cartouche + +Tells the GUI that the layers have changed. +@c ./../src/hid/common/actions.c 446 + +This includes layer names, colors, stacking order, visibility, etc. + +@hidaction + + +@node LibraryChanged Action +@subsection LibraryChanged +@c key LibraryChanged in hid common +@cartouche +@format +LibraryChanged()@end format +@end cartouche + +Tells the GUI that the libraries have changed. +@c ./../src/hid/common/actions.c 451 + +@hidaction + + +@node NetlistChanged Action +@subsection NetlistChanged +@c key NetlistChanged in hid common +@cartouche +@format +NetlistChanged()@end format +@end cartouche + +Tells the GUI that the netlist has changed. +@c ./../src/hid/common/actions.c 441 + +@hidaction + + +@node PCBChanged Action +@subsection PCBChanged +@c key PCBChanged in hid common +@cartouche +@format +PCBChanged([revert])@end format +@end cartouche + +Tells the GUI that the whole PCB has changed. The optional``revert"parameter can be used as a hint to the GUI that the same design is beingreloaded, and that it might keep some viewport settings +@c ./../src/hid/common/actions.c 431 + +@hidaction + + +@node RouteStylesChanged Action +@subsection RouteStylesChanged +@c key RouteStylesChanged in hid common +@cartouche +@format +RouteStylesChanged()@end format +@end cartouche + +Tells the GUI that the routing styles have changed. +@c ./../src/hid/common/actions.c 436 + +@hidaction + + +@node gtk actions +@section gtk actions +@menu +* gtk About Action:: N_("Tell the user about this version of PCB."); +* gtk AdjustStyle Action:: Open the window which allows editing of the route styles. +* gtk Center Action:: N_("Moves the pointer to the center of the window."); +* gtk Cursor Action:: N_("Move the cursor."); +* gtk DoWindows Action:: N_("Open various GUI windows."); +* gtk EditLayerGroups Action:: Open the preferences window which allows editing of the layer groups. +* gtk GetXY Action:: N_("Get a coordinate."); +* gtk ImportGUI Action:: N_("Asks user which schematics to import into PCB. +"); +* gtk Pan Action:: N_("Start or stop panning (Mode = 1 to start, 0 to stop) +Optional thumb argument is ignored for now in gtk hid. +"); +* gtk Popup Action:: N_("Bring up the popup menu specified by @code{MenuName}. +If called by a mouse event then the mouse button number +must be specified as the optional second argument."); +* gtk Print Action:: N_("Print the layout."); +* gtk PrintCalibrate Action:: N_("Calibrate the printer."); +* gtk Save Action:: N_("Save layout and/or element data to a user-selected file."); +* gtk SelectLayer Action:: Select which layer is the current layer. +* gtk SetUnits Action:: N_("Set the default measurement units."); +* gtk SwapSides Action:: N_("Swaps the side of the board you're looking at."); +* gtk ToggleView Action:: Toggle the visibility of the specified layer or layer group. +* gtk Zoom Action:: N_("Various zoom factor changes."); +@end menu +@node gtk About Action +@subsection gtk About +@c key gtk About in hid gtk +@cartouche +@format +About()@end format +@end cartouche + +N_("Tell the user about this version of PCB."); +@c ./../src/hid/gtk/gtkhid-main.c 1059 + +This just pops up a dialog telling the user which version of +@code{pcb} they're running. + + +@node gtk AdjustStyle Action +@subsection gtk AdjustStyle +@c key gtk AdjustStyle in hid gtk +@cartouche +@format +AdjustStyle() +@end format +@end cartouche + +Open the window which allows editing of the route styles. +@c ./../src/hid/gtk/gui-top-window.c 2081 + +Opens the window which allows editing of the route styles. + + +@node gtk Center Action +@subsection gtk Center +@c key gtk Center in hid gtk +@cartouche +@format +Center() +@end format +@end cartouche + +N_("Moves the pointer to the center of the window."); +@c ./../src/hid/gtk/gtkhid-main.c 1470 + +Move the pointer to the center of the window, but only if it's +currently within the window already. + + +@node gtk Cursor Action +@subsection gtk Cursor +@c key gtk Cursor in hid gtk +@cartouche +@format +Cursor(Type,DeltaUp,DeltaRight,Units)@end format +@end cartouche + +N_("Move the cursor."); +@c ./../src/hid/gtk/gtkhid-main.c 1515 + +This action moves the mouse cursor. Unlike other actions which take +coordinates, this action's coordinates are always relative to the +user's view of the board. Thus, a positive @var{DeltaUp} may move the +cursor towards the board origin if the board is inverted. + +Type is one of @samp{Pan} or @samp{Warp}. @samp{Pan} causes the +viewport to move such that the crosshair is under the mouse cursor. +@samp{Warp} causes the mouse cursor to move to be above the crosshair. + +@var{Units} can be one of the following: + +@table @samp + +@item mil +@itemx mm +The cursor is moved by that amount, in board units. + +@item grid +The cursor is moved by that many grid points. + +@item view +The values are percentages of the viewport's view. Thus, a pan of +@samp{100} would scroll the viewport by exactly the width of the +current view. + +@item board +The values are percentages of the board size. Thus, a move of +@samp{50,50} moves you halfway across the board. + +@end table + + +@node gtk DoWindows Action +@subsection gtk DoWindows +@c key gtk DoWindows in hid gtk +@cartouche +@format +DoWindows(1|2|3|4|5|6) +DoWindows(Layout|Library|Log|Netlist|Preferences|DRC)@end format +@end cartouche + +N_("Open various GUI windows."); +@c ./../src/hid/gtk/gtkhid-main.c 1563 + +@table @code + +@item 1 +@itemx Layout +Open the layout window. Since the layout window is always shown +anyway, this has no effect. + +@item 2 +@itemx Library +Open the library window. + +@item 3 +@itemx Log +Open the log window. + +@item 4 +@itemx Netlist +Open the netlist window. + +@item 5 +@itemx Preferences +Open the preferences window. + +@item 6 +@itemx DRC +Open the DRC violations window. + +@end table + + +@node gtk EditLayerGroups Action +@subsection gtk EditLayerGroups +@c key gtk EditLayerGroups in hid gtk +@cartouche +@format +EditLayerGroups() +@end format +@end cartouche + +Open the preferences window which allows editing of the layer groups. +@c ./../src/hid/gtk/gui-top-window.c 2100 + +Opens the preferences window which is where the layer groups +are edited. This action is primarily provides to provide menu +resource compatibility with the lesstif HID. + + +@node gtk GetXY Action +@subsection gtk GetXY +@c key gtk GetXY in hid gtk +@cartouche +@format +GetXY()@end format +@end cartouche + +N_("Get a coordinate."); +@c ./../src/hid/gtk/gtkhid-main.c 1074 + +Prompts the user for a coordinate, if one is not already selected. + + +@node gtk ImportGUI Action +@subsection gtk ImportGUI +@c key gtk ImportGUI in hid gtk +@cartouche +@format +ImportGUI()@end format +@end cartouche + +N_("Asks user which schematics to import into PCB. +"); +@c ./../src/hid/gtk/gtkhid-main.c 1750 + +Asks user which schematics to import into PCB. + + +@node gtk Pan Action +@subsection gtk Pan +@c key gtk Pan in hid gtk +@cartouche +@format +Pan([thumb], Mode)@end format +@end cartouche + +N_("Start or stop panning (Mode = 1 to start, 0 to stop) +Optional thumb argument is ignored for now in gtk hid. +"); +@c ./../src/hid/gtk/gtkhid-main.c 1687 + +Start or stop panning. To start call with Mode = 1, to stop call with +Mode = 0. + + +@node gtk Popup Action +@subsection gtk Popup +@c key gtk Popup in hid gtk +@cartouche +@format +Popup(MenuName, [Button])@end format +@end cartouche + +N_("Bring up the popup menu specified by @code{MenuName}. +If called by a mouse event then the mouse button number +must be specified as the optional second argument."); +@c ./../src/hid/gtk/gtkhid-main.c 1719 + +This just pops up the specified menu. The menu must have been defined +as a named subresource of the Popups resource in the menu resource +file. + + +@node gtk Print Action +@subsection gtk Print +@c key gtk Print in hid gtk +@cartouche +@format +Print()@end format +@end cartouche + +N_("Print the layout."); +@c ./../src/hid/gtk/gtkhid-main.c 1350 + +This will find the default printing HID, prompt the user for its +options, and print the layout. + + +@node gtk PrintCalibrate Action +@subsection gtk PrintCalibrate +@c key gtk PrintCalibrate in hid gtk +@cartouche +@format +PrintCalibrate()@end format +@end cartouche + +N_("Calibrate the printer."); +@c ./../src/hid/gtk/gtkhid-main.c 1401 + +This will print a calibration page, which you would measure and type +the measurements in, so that future printouts will be more precise. + + +@node gtk Save Action +@subsection gtk Save +@c key gtk Save in hid gtk +@cartouche +@format +Save() +Save(Layout|LayoutAs) +Save(AllConnections|AllUnusedPins|ElementConnections) +Save(PasteBuffer)@end format +@end cartouche + +N_("Save layout and/or element data to a user-selected file."); +@c ./../src/hid/gtk/gtkhid-main.c 1230 + +This action is a GUI front-end to the core's @code{SaveTo} action +(@pxref{SaveTo Action}). If you happen to pass a filename, like +@code{SaveTo}, then @code{SaveTo} is called directly. Else, the +user is prompted for a filename to save, and then @code{SaveTo} is +called with that filename. + + +@node gtk SelectLayer Action +@subsection gtk SelectLayer +@c key gtk SelectLayer in hid gtk +@cartouche +@format +SelectLayer(1..MAXLAYER|Silk|Rats)@end format +@end cartouche + +Select which layer is the current layer. +@c ./../src/hid/gtk/gui-top-window.c 1851 + +The specified layer becomes the currently active layer. It is made +visible if it is not already visible + + +@node gtk SetUnits Action +@subsection gtk SetUnits +@c key gtk SetUnits in hid gtk +@cartouche +@format +SetUnits(mm|mil)@end format +@end cartouche + +N_("Set the default measurement units."); +@c ./../src/hid/gtk/gtkhid-main.c 1606 + +@table @code + +@item mil +Sets the display units to mils (1/1000 inch). + +@item mm +Sets the display units to millimeters. + +@end table + + +@node gtk SwapSides Action +@subsection gtk SwapSides +@c key gtk SwapSides in hid gtk +@cartouche +@format +SwapSides(|v|h|r)@end format +@end cartouche + +N_("Swaps the side of the board you're looking at."); +@c ./../src/hid/gtk/gtkhid-main.c 1295 + +This action changes the way you view the board. + +@table @code + +@item v +Flips the board over vertically (up/down). + +@item h +Flips the board over horizontally (left/right), like flipping pages in +a book. + +@item r +Rotates the board 180 degrees without changing sides. + +@end table + +If no argument is given, the board isn't moved but the opposite side +is shown. + +Normally, this action changes which pads and silk layer are drawn as +true silk, and which are drawn as the "invisible" layer. It also +determines which solder mask you see. + +As a special case, if the layer group for the side you're looking at +is visible and currently active, and the layer group for the opposite +is not visible (i.e. disabled), then this action will also swap which +layer group is visible and active, effectively swapping the ``working +side'' of the board. + + +@node gtk ToggleView Action +@subsection gtk ToggleView +@c key gtk ToggleView in hid gtk +@cartouche +@format +ToggleView(1..MAXLAYER) +ToggleView(layername) +ToggleView(Silk|Rats|Pins|Vias|Mask|BackSide)@end format +@end cartouche + +Toggle the visibility of the specified layer or layer group. +@c ./../src/hid/gtk/gui-top-window.c 1792 + +If you pass an integer, that layer is specified by index (the first +layer is @code{1}, etc). If you pass a layer name, that layer is +specified by name. When a layer is specified, the visibility of the +layer group containing that layer is toggled. + +If you pass a special layer name, the visibility of those components +(silk, rats, etc) is toggled. Note that if you have a layer named +the same as a special layer, the layer is chosen over the special layer. + + +@node gtk Zoom Action +@subsection gtk Zoom +@c key gtk Zoom in hid gtk +@cartouche +@format +Zoom() +Zoom(factor)@end format +@end cartouche + +N_("Various zoom factor changes."); +@c ./../src/hid/gtk/gtkhid-main.c 161 +Changes the zoom (magnification) of the view of the board. If no +arguments are passed, the view is scaled such that the board just fits +inside the visible window (i.e. ``view all''). Otherwise, +@var{factor} specifies a change in zoom factor. It may be prefixed by +@code{+}, @code{-}, or @code{=} to change how the zoom factor is +modified. The @var{factor} is a floating point number, such as +@code{1.5} or @code{0.75}. + +@table @code + +@item +@var{factor} +Values greater than 1.0 cause the board to be drawn smaller; more of +the board will be visible. Values between 0.0 and 1.0 cause the board +to be drawn bigger; less of the board will be visible. + +@item -@var{factor} +Values greater than 1.0 cause the board to be drawn bigger; less of +the board will be visible. Values between 0.0 and 1.0 cause the board +to be drawn smaller; more of the board will be visible. + +@item =@var{factor} + +The @var{factor} is an absolute zoom factor; the unit for this value +is "PCB units per screen pixel". Since PCB units are 0.01 mil, a +@var{factor} of 1000 means 10 mils (0.01 in) per pixel, or 100 DPI, +about the actual resolution of most screens - resulting in an "actual +size" board. Similarly, a @var{factor} of 100 gives you a 10x actual +size. + +@end table + +Note that zoom factors of zero are silently ignored. + + + + +@node lesstif actions +@section lesstif actions +@menu +* lesstif About Action:: Tell the user about this version of PCB. +* lesstif AdjustSizes Action:: Let the user change the board size, DRC parameters, etc +* lesstif AdjustStyle Action:: Displays the route style adjustment window. +* lesstif Benchmark Action:: Benchmark the GUI speed. +* lesstif Command Action:: Displays the command line input window. +* lesstif Cursor Action:: Move the cursor. +* lesstif Debug Action:: Debug action. +* lesstif DebugXY Action:: Debug action, with coordinates +* lesstif DoWindows Action:: Open various GUI windows. +* lesstif DumpKeys Action:: Dump Lesstif key bindings. +* lesstif EditLayerGroups Action:: Let the user change the layer groupings +* lesstif Export Action:: Export the layout. +* lesstif GetXY Action:: Get a coordinate. +* lesstif ImportGUI Action:: Lets the user choose the schematics to import from +* lesstif LibraryShow Action:: Displays the library window. +* lesstif Load Action:: Load layout data from a user-selected file. +* lesstif LoadVendor Action:: Loads a user-selected vendor resource file. +* lesstif NetlistShow Action:: Selects the given pinname or netname in the netlist window. +* lesstif Print Action:: Print the layout. +* lesstif PrintCalibrate Action:: Calibrate the printer. +* lesstif PromptFor Action:: Prompt for a response. +* lesstif Return Action:: Simulate a passing or failing action. +* lesstif Save Action:: Save layout data to a user-selected file. +* lesstif SelectLayer Action:: Select which layer is the current layer. +* lesstif SetUnits Action:: Set the default measurement units. +* lesstif SwapSides Action:: Swaps the side of the board you're looking at. +* lesstif ToggleView Action:: Toggle the visibility of the specified layer or layer group. +* lesstif Zoom Action:: Various zoom factor changes. +@end menu +@node lesstif About Action +@subsection lesstif About +@c key lesstif About in hid lesstif +@cartouche +@format +About()@end format +@end cartouche + +Tell the user about this version of PCB. +@c ./../src/hid/lesstif/dialogs.c 867 + +This just pops up a dialog telling the user which version of +@code{pcb} they're running. + + +@node lesstif AdjustSizes Action +@subsection lesstif AdjustSizes +@c key lesstif AdjustSizes in hid lesstif +@cartouche +@format +AdjustSizes()@end format +@end cartouche + +Let the user change the board size, DRC parameters, etc +@c ./../src/hid/lesstif/dialogs.c 1136 + +Displays a dialog box that lets the user change the board +size, DRC parameters, and text scale. + +The units are determined by the default display units. + + +@node lesstif AdjustStyle Action +@subsection lesstif AdjustStyle +@c key lesstif AdjustStyle in hid lesstif +@cartouche +@format +AdjustStyle()@end format +@end cartouche + +Displays the route style adjustment window. +@c ./../src/hid/lesstif/styles.c 344 + + +@node lesstif Benchmark Action +@subsection lesstif Benchmark +@c key lesstif Benchmark in hid lesstif +@cartouche +@format +Benchmark()@end format +@end cartouche + +Benchmark the GUI speed. +@c ./../src/hid/lesstif/main.c 659 + +This action is used to speed-test the Lesstif graphics subsystem. It +redraws the current screen as many times as possible in ten seconds. +It reports the amount of time needed to draw the screen once. + + +@node lesstif Command Action +@subsection lesstif Command +@c key lesstif Command in hid lesstif +@cartouche +@format +Command()@end format +@end cartouche + +Displays the command line input window. +@c ./../src/hid/lesstif/main.c 644 + +The command window allows the user to manually enter actions to be +executed. Action syntax can be done one of two ways: + +@table @code + +@item +Follow the action name by an open parenthesis, arguments separated by +commas, end with a close parenthesis. Example: @code{Abc(1,2,3)} + +@item +Separate the action name and arguments by spaces. Example: @code{Abc +1 2 3}. + +@end table + +The first option allows you to have arguments with spaces in them, +but the second is more ``natural'' to type for most people. + +Note that action names are not case sensitive, but arguments normally +are. However, most actions will check for ``keywords'' in a case +insensitive way. + +There are three ways to finish with the command window. If you press +the @code{Enter} key, the command is invoked, the window goes away, +and the next time you bring up the command window it's empty. If you +press the @code{Esc} key, the window goes away without invoking +anything, and the next time you bring up the command window it's +empty. If you change focus away from the command window (i.e. click +on some other window), the command window goes away but the next time +you bring it up it resumes entering the command you were entering +before. + + +@node lesstif Cursor Action +@subsection lesstif Cursor +@c key lesstif Cursor in hid lesstif +@cartouche +@format +Cursor(Type,DeltaUp,DeltaRight,Units)@end format +@end cartouche + +Move the cursor. +@c ./../src/hid/lesstif/main.c 716 + +This action moves the mouse cursor. Unlike other actions which take +coordinates, this action's coordinates are always relative to the +user's view of the board. Thus, a positive @var{DeltaUp} may move the +cursor towards the board origin if the board is inverted. + +Type is one of @samp{Pan} or @samp{Warp}. @samp{Pan} causes the +viewport to move such that the crosshair is under the mouse cursor. +@samp{Warp} causes the mouse cursor to move to be above the crosshair. + +@var{Units} can be one of the following: + +@table @samp + +@item mil +@itemx mm +The cursor is moved by that amount, in board units. + +@item grid +The cursor is moved by that many grid points. + +@item view +The values are percentages of the viewport's view. Thus, a pan of +@samp{100} would scroll the viewport by exactly the width of the +current view. + +@item board +The values are percentages of the board size. Thus, a move of +@samp{50,50} moves you halfway across the board. + +@end table + + +@node lesstif Debug Action +@subsection lesstif Debug +@c key lesstif Debug in hid lesstif +@cartouche +@format +Debug(...)@end format +@end cartouche + +Debug action. +@c ./../src/hid/lesstif/menu.c 66 + +This action exists to help debug scripts; it simply prints all its +arguments to stdout. + + +@node lesstif DebugXY Action +@subsection lesstif DebugXY +@c key lesstif DebugXY in hid lesstif +@cartouche +@format +DebugXY(...)@end format +@end cartouche + +Debug action, with coordinates +@c ./../src/hid/lesstif/menu.c 72 + +Like @code{Debug}, but requires a coordinate. If the user hasn't yet +indicated a location on the board, the user will be prompted to click +on one. + + +@node lesstif DoWindows Action +@subsection lesstif DoWindows +@c key lesstif DoWindows in hid lesstif +@cartouche +@format +DoWindows(1|2|3|4) +DoWindows(Layout|Library|Log|Netlist)@end format +@end cartouche + +Open various GUI windows. +@c ./../src/hid/lesstif/dialogs.c 831 + +@table @code + +@item 1 +@itemx Layout +Open the layout window. Since the layout window is always shown +anyway, this has no effect. + +@item 2 +@itemx Library +Open the library window. + +@item 3 +@itemx Log +Open the log window. + +@item 4 +@itemx Netlist +Open the netlist window. + +@end table + + +@node lesstif DumpKeys Action +@subsection lesstif DumpKeys +@c key lesstif DumpKeys in hid lesstif +@cartouche +@format +DumpKeys()@end format +@end cartouche + +Dump Lesstif key bindings. +@c ./../src/hid/lesstif/menu.c 101 + +Causes the list of key bindings (from @code{pcb-menu.res}) to be +dumped to stdout. This is most useful when invoked from the command +line like this: + +@example +pcb --action-string DumpKeys +@end example + + +@node lesstif EditLayerGroups Action +@subsection lesstif EditLayerGroups +@c key lesstif EditLayerGroups in hid lesstif +@cartouche +@format +EditLayerGroups()@end format +@end cartouche + +Let the user change the layer groupings +@c ./../src/hid/lesstif/dialogs.c 1448 + +Displays a dialog that lets the user view and change the layer +groupings. Each layer (row) can be a member of any one layer group +(column). Note the special layers @code{solder} and @code{component} +allow you to specify which groups represent the top and bottom of the +board. + +See @ref{ChangeName Action}. + + +@node lesstif Export Action +@subsection lesstif Export +@c key lesstif Export in hid lesstif +@cartouche +@format +Export()@end format +@end cartouche + +Export the layout. +@c ./../src/hid/lesstif/dialogs.c 957 + +Prompts the user for an exporter to use. Then, prompts the user for +that exporter's options, and exports the layout. + + +@node lesstif GetXY Action +@subsection lesstif GetXY +@c key lesstif GetXY in hid lesstif +@cartouche +@format +GetXY()@end format +@end cartouche + +Get a coordinate. +@c ./../src/hid/lesstif/menu.c 54 + +Prompts the user for a coordinate, if one is not already selected. + + +@node lesstif ImportGUI Action +@subsection lesstif ImportGUI +@c key lesstif ImportGUI in hid lesstif +@cartouche +@format +ImportGUI()@end format +@end cartouche + +Lets the user choose the schematics to import from +@c ./../src/hid/lesstif/dialogs.c 1882 + +Displays a dialog that lets the user select the schematic(s) to import +from, then saves that information in the layout's attributes for +future imports. + + +@node lesstif LibraryShow Action +@subsection lesstif LibraryShow +@c key lesstif LibraryShow in hid lesstif +@cartouche +@format +LibraryShow()@end format +@end cartouche + +Displays the library window. +@c ./../src/hid/lesstif/library.c 151 + + +@node lesstif Load Action +@subsection lesstif Load +@c key lesstif Load in hid lesstif +@cartouche +@format +Load() +Load(Layout|LayoutToBuffer|ElementToBuffer|Netlist|Revert)@end format +@end cartouche + +Load layout data from a user-selected file. +@c ./../src/hid/lesstif/dialogs.c 99 + +This action is a GUI front-end to the core's @code{LoadFrom} action +(@pxref{LoadFrom Action}). If you happen to pass a filename, like +@code{LoadFrom}, then @code{LoadFrom} is called directly. Else, the +user is prompted for a filename to load, and then @code{LoadFrom} is +called with that filename. + + +@node lesstif LoadVendor Action +@subsection lesstif LoadVendor +@c key lesstif LoadVendor in hid lesstif +@cartouche +@format +LoadVendor()@end format +@end cartouche + +Loads a user-selected vendor resource file. +@c ./../src/hid/lesstif/dialogs.c 152 + +The user is prompted for a file to load, and then +@code{LoadVendorFrom} is called (@pxref{LoadVendorFrom Action}) to +load that vendor file. + + +@node lesstif NetlistShow Action +@subsection lesstif NetlistShow +@c key lesstif NetlistShow in hid lesstif +@cartouche +@format +NetlistShow(pinname|netname)@end format +@end cartouche + +Selects the given pinname or netname in the netlist window. +@c ./../src/hid/lesstif/netlist.c 415 + + +@node lesstif Print Action +@subsection lesstif Print +@c key lesstif Print in hid lesstif +@cartouche +@format +Print()@end format +@end cartouche + +Print the layout. +@c ./../src/hid/lesstif/dialogs.c 894 + +This will find the default printing HID, prompt the user for its +options, and print the layout. + + +@node lesstif PrintCalibrate Action +@subsection lesstif PrintCalibrate +@c key lesstif PrintCalibrate in hid lesstif +@cartouche +@format +PrintCalibrate()@end format +@end cartouche + +Calibrate the printer. +@c ./../src/hid/lesstif/dialogs.c 937 + +This will print a calibration page, which you would measure and type +the measurements in, so that future printouts will be more precise. + + +@node lesstif PromptFor Action +@subsection lesstif PromptFor +@c key lesstif PromptFor in hid lesstif +@cartouche +@format +PromptFor([message[,default]])@end format +@end cartouche + +Prompt for a response. +@c ./../src/hid/lesstif/dialogs.c 560 + +This is mostly for testing the lesstif HID interface. The parameters +are passed to the @code{prompt_for()} HID function, causing the user +to be prompted for a response. The respose is simply printed to the +user's stdout. + + +@node lesstif Return Action +@subsection lesstif Return +@c key lesstif Return in hid lesstif +@cartouche +@format +Return(0|1)@end format +@end cartouche + +Simulate a passing or failing action. +@c ./../src/hid/lesstif/menu.c 89 + +This is for testing. If passed a 0, does nothing and succeeds. If +passed a 1, does nothing but pretends to fail. + + +@node lesstif Save Action +@subsection lesstif Save +@c key lesstif Save in hid lesstif +@cartouche +@format +Save() +Save(Layout|LayoutAs) +Save(AllConnections|AllUnusedPins|ElementConnections) +Save(PasteBuffer)@end format +@end cartouche + +Save layout data to a user-selected file. +@c ./../src/hid/lesstif/dialogs.c 197 + +This action is a GUI front-end to the core's @code{SaveTo} action +(@pxref{SaveTo Action}). If you happen to pass a filename, like +@code{SaveTo}, then @code{SaveTo} is called directly. Else, the +user is prompted for a filename to save, and then @code{SaveTo} is +called with that filename. + + +@node lesstif SelectLayer Action +@subsection lesstif SelectLayer +@c key lesstif SelectLayer in hid lesstif +@cartouche +@format +SelectLayer(1..MAXLAYER|Silk|Rats)@end format +@end cartouche + +Select which layer is the current layer. +@c ./../src/hid/lesstif/menu.c 387 + +The specified layer becomes the currently active layer. It is made +visible if it is not already visible + + +@node lesstif SetUnits Action +@subsection lesstif SetUnits +@c key lesstif SetUnits in hid lesstif +@cartouche +@format +SetUnits(mm|mil)@end format +@end cartouche + +Set the default measurement units. +@c ./../src/hid/lesstif/main.c 395 + +@table @code + +@item mil +Sets the display units to mils (1/1000 inch). + +@item mm +Sets the display units to millimeters. + +@end table + + +@node lesstif SwapSides Action +@subsection lesstif SwapSides +@c key lesstif SwapSides in hid lesstif +@cartouche +@format +SwapSides(|v|h|r)@end format +@end cartouche + +Swaps the side of the board you're looking at. +@c ./../src/hid/lesstif/main.c 494 + +This action changes the way you view the board. + +@table @code + +@item v +Flips the board over vertically (up/down). + +@item h +Flips the board over horizontally (left/right), like flipping pages in +a book. + +@item r +Rotates the board 180 degrees without changing sides. + +@end table + +If no argument is given, the board isn't moved but the opposite side +is shown. + +Normally, this action changes which pads and silk layer are drawn as +true silk, and which are drawn as the "invisible" layer. It also +determines which solder mask you see. + +As a special case, if the layer group for the side you're looking at +is visible and currently active, and the layer group for the opposite +is not visible (i.e. disabled), then this action will also swap which +layer group is visible and active, effectively swapping the ``working +side'' of the board. + + +@node lesstif ToggleView Action +@subsection lesstif ToggleView +@c key lesstif ToggleView in hid lesstif +@cartouche +@format +ToggleView(1..MAXLAYER) +ToggleView(layername) +ToggleView(Silk|Rats|Pins|Vias|Mask|BackSide)@end format +@end cartouche + +Toggle the visibility of the specified layer or layer group. +@c ./../src/hid/lesstif/menu.c 409 + +If you pass an integer, that layer is specified by index (the first +layer is @code{1}, etc). If you pass a layer name, that layer is +specified by name. When a layer is specified, the visibility of the +layer group containing that layer is toggled. + +If you pass a special layer name, the visibility of those components +(silk, rats, etc) is toggled. Note that if you have a layer named +the same as a special layer, the layer is chosen over the special layer. + + +@node lesstif Zoom Action +@subsection lesstif Zoom +@c key lesstif Zoom in hid lesstif +@cartouche +@format +Zoom() +Zoom(factor)@end format +@end cartouche + +Various zoom factor changes. +@c ./../src/hid/lesstif/main.c 419 + +Changes the zoom (magnification) of the view of the board. If no +arguments are passed, the view is scaled such that the board just fits +inside the visible window (i.e. ``view all''). Otherwise, +@var{factor} specifies a change in zoom factor. It may be prefixed by +@code{+}, @code{-}, or @code{=} to change how the zoom factor is +modified. The @var{factor} is a floating point number, such as +@code{1.5} or @code{0.75}. + +@table @code + +@item +@var{factor} +Values greater than 1.0 cause the board to be drawn smaller; more of +the board will be visible. Values between 0.0 and 1.0 cause the board +to be drawn bigger; less of the board will be visible. + +@item -@var{factor} +Values greater than 1.0 cause the board to be drawn bigger; less of +the board will be visible. Values between 0.0 and 1.0 cause the board +to be drawn smaller; more of the board will be visible. + +@item =@var{factor} + +The @var{factor} is an absolute zoom factor; the unit for this value +is "PCB units per screen pixel". Since PCB units are 0.01 mil, a +@var{factor} of 1000 means 10 mils (0.01 in) per pixel, or 100 DPI, +about the actual resolution of most screens - resulting in an "actual +size" board. Similarly, a @var{factor} of 100 gives you a 10x actual +size. + +@end table + +Note that zoom factors of zero are silently ignored. + + Index: 1.0.8/doc-orig/ascii2texi.awk =================================================================== --- 1.0.8/doc-orig/ascii2texi.awk (nonexistent) +++ 1.0.8/doc-orig/ascii2texi.awk (revision 1136) @@ -0,0 +1,77 @@ +#!/usr/bin/awk -f +# +# $Id$ +# + +BEGIN { + first = 1; + col = 1; +} + +/^[ \t]*#/ { + # skip comment lines + next; +} + +/^[ \t]*$/ { + # skip blank + next; +} + +# we do this 'first' song and dance because variables set +# on the command line are not available in the BEGIN section +first == 1 { + first = 0; + printf("@c Generated file. Do not edit directly\n"); + printf("@c $" "Id" "$\n"); + printf("@multitable @columnfractions "); + for(i = 1 ; i <= 2*ncol ; i = i + 1) { + printf("%.3g ", 0.5 / ncol); + } + printf("\n"); + + printf("@item "); + for(i = 1 ; i <= ncol ; i = i + 1) { + if( i > 1 ) { printf("@tab "); } + printf("Drill @tab Diameter "); + } + printf("\n"); + + printf("@item "); + for(i = 1 ; i <= ncol ; i = i + 1) { + if( i > 1 ) { printf("@tab "); } + printf("Size @tab (inches) "); + } + printf("\n"); + + printf("\n"); +} + +{ + if( col == 1 ) { + printf("@item "); + } else { + printf("@tab "); + } + drl = $1; + dia = $2; + gsub(/_/, " ", drl); + printf("%s @tab %s ", drl, dia); + col = col + 1; + if( col > ncol ) { + col = 1; + printf("\n"); + } +} + +END { + while( (col > 1) && (col <= ncol ) ) { + printf("@tab @tab "); + col = col + 1; + } + + printf("@end multitable\n\n"); +} + + + Property changes on: 1.0.8/doc-orig/ascii2texi.awk ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/doc-orig/eps2png =================================================================== --- 1.0.8/doc-orig/eps2png (nonexistent) +++ 1.0.8/doc-orig/eps2png (revision 1136) @@ -0,0 +1,495 @@ +#!/usr/bin/perl + +my $RCS_Id = '$Id$ '; + +# Author : Johan Vromans +# Created On : Tue Sep 15 15:59:04 1992 +# Last Modified By: Johan Vromans +# Last Modified On: Sun Jun 24 17:07:29 2001 +# Update Count : 155 +# Status : Okay + +################ Common stuff ################ + +use strict; +use Getopt::Long 2.1; + +my $my_package = "Sciurix"; +my ($my_name, $my_version) = $RCS_Id =~ /: (.+).pl,v ([\d.]+)/; +$my_version .= '*' if length('$Locker$ ') > 12; + +use vars qw($VERSION); +( $VERSION ) = '$Revision$ ' =~ /\$Revision:\s+([^\s]+)/; + +################ Program parameters ################ + +### CONFIG +# Some GhostScript programs can produce GIF directly. +# If not, we need the PBM package for the conversion. +my $use_pbm = 1; # GhostScript can not produce GIF +### END CONFIG + +my $res = 82; # default resolution +my $scale = 1; # default scaling +my $mono = 0; # produce BW images if non-zero +my $format; # output format +my $gs_format; # GS output type +my $output; # output, defaults to STDOUT +my $antialias = 4; # antialiasing +my $width; # desired widht +my $height; # desired height + +my ($verbose,$trace,$test,$debug) = (0,0,0,0); +handle_options (); +unless ( defined $format ) { + if ( $0 =~ /2(gif|jpg|png)$/ ) { + set_out_type ($1); + } + else { + set_out_type ('png') unless defined $format; + } +} +print STDERR ("Producing $format ($gs_format) image.\n") if $verbose; + +$trace |= $test | $debug; +$verbose |= $trace; + +################ Presets ################ + +################ The Process ################ + +my $eps_file; +my $err = 0; + +foreach $eps_file ( @ARGV ) { + + unless ( open (EPS, $eps_file) ) { + print STDERR ("Cannot open $eps_file [$!], skipped\n"); + $err++; + next; + } + + my $line = ; + unless ( $line =~ /^%!PS-Adobe.*EPSF-/ ) { + print STDERR ("Not EPS file: $eps_file, skipped\n"); + $err++; + next; + } + + my $ps = ""; # PostScript input data + my $xscale; + my $yscale; + + while ( $line = ) { + + # Search for BoundingBox. + if ( $line =~ /^%%BoundingBox:\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/i ) { + + print STDERR ("$eps_file: x0=$1, y0=$2, w=", $3-$1, ", h=", $4-$2) + if $verbose; + + if ( defined $width ) { + $res = 72; + $xscale = $width / ($3 - $1); + if ( defined $height ) { + $yscale = $height / ($4 - $2); + } + else { + $yscale = $xscale; + $height = ($4 - $2) * $yscale; + } + } + elsif ( defined $height ) { + $res = 72; + $yscale = $height / ($4 - $2); + if ( defined $width ) { + $xscale = $width / ($3 - $1); + } + else { + $xscale = $yscale; + $width = ($3 - $1) * $xscale; + } + } + unless ( defined $xscale ) { + $xscale = $yscale = $scale; + # Calculate actual width. + $width = $3 - $1; + $height = $4 - $2; + # Normal PostScript resolution is 72. + $width *= $res/72 * $xscale; + $height *= $res/72 * $yscale; + # Round up. + $width = int ($width + 0.5) + 1; + $height = int ($height + 0.5) + 1; + } + print STDERR (", width=$width, height=$height\n") if $verbose; + + # Scale. + $ps .= "$xscale $yscale scale\n" + if $xscale != 1 || $yscale != 1; + + # Create PostScript code to translate coordinates. + $ps .= (0-$1) . " " . (0-$2) . " translate\n" + unless $1 == 0 && $2 == 0; + + # Include the image, show and quit. + $ps .= "($eps_file) run\n". + "showpage\n". + "quit\n"; + + last; + } + elsif ( $line =~ /^%%EndComments/i ) { + print STDERR ("No bounding box in $eps_file\n"); + $err++; + last; + } + } + close (EPS); + + my $out_file; # output file + my $pbm_file; # temporary file for PBM conversion + + # Note the temporary PBM file is created where the output file is + # located, since that will guarantee accessibility (and a valid + # filename). + if ( defined $output ) { + $out_file = $output; + $pbm_file = $output.".ppm"; + } + elsif ( $eps_file =~ /^(.+).epsf?$/i ) { + $out_file = "$1.$format"; + $pbm_file = $1.".ppm"; + } + else { + $out_file = $eps_file . ".$format"; + $pbm_file = $eps_file . ".ppm"; + } + print STDERR ("Creating $out_file\n") if $verbose; + + my $gs0 = "gs -q -dNOPAUSE -r$res -g${width}x$height"; + my $gs1 = "-"; + $gs0 .= " -dTextAlphaBits=$antialias -dGraphicsAlphaBits=$antialias" + if $antialias; + if ( $format eq 'png' ) { + mysystem ("$gs0 -sDEVICE=". ($mono ? "pngmono" : $gs_format). + " -sOutputFile=$out_file $gs1", $ps); + } + elsif ( $format eq 'jpg' ) { + mysystem ("$gs0 -sDEVICE=". ($mono ? "jpeggray" : $gs_format). + " -sOutputFile=$out_file $gs1", $ps); + } + elsif ( $format eq 'gif' ) { + if ( $use_pbm ) { + # Convert to PPM and use some of the PBM converters. + mysystem ("$gs0 -sDEVICE=". ($mono ? "pbm" : "ppm"). + " -sOutputFile=$pbm_file $gs1", $ps); + # mysystem ("pnmcrop $pbm_file | ppmtogif > $out_file"); + mysystem ("ppmtogif $pbm_file > $out_file"); + unlink ($pbm_file); + } + else { + # GhostScript has GIF drivers built-in. + mysystem ("$gs0 -sDEVICE=". ($mono ? "gifmono" : "gif8"). + " -sOutputFile=$out_file $gs1", $ps); + } + } + else { + print STDERR ("ASSERT ERROR: Unhandled output type: $format\n"); + exit (1); + } + + unless ( -s $out_file ) { + print STDERR ("Problem creating $out_file for $eps_file\n"); + $err++; + } + +} + +exit 1 if $err; + +################ Subroutines ################ + +sub mysystem { + my ($cmd, $data) = @_; + print STDERR ("+ $cmd\n") if $trace; + if ( $data ) { + if ( $trace ) { + my $dp = ">> " . $data; + $dp =~ s/\n(.)/\n>> $1/g; + print STDERR ("$dp"); + } + open (CMD, "|$cmd") or die ("cmd: $!\n"); + print CMD $data; + close CMD or die ("cmd close: $!\n"); + } + else { + system ($cmd); + } +} + +sub set_out_type { + my ($opt) = lc (shift (@_)); + if ( $opt =~ /^png(mono|gray|16|256|16m)?$/ ) { + $format = 'png'; + $gs_format = $format.(defined $1 ? $1 : '16m'); + } + elsif ( $opt =~ /^gif(mono)?$/ ) { + $format = 'gif'; + $gs_format = $format.(defined $1 ? $1 : ''); + } + elsif ( $opt =~ /^(jpg|jpeg)(gray)?$/ ) { + $format = 'jpg'; + $gs_format = 'jpeg'.(defined $2 ? $2 : ''); + } + else { + print STDERR ("ASSERT ERROR: Invalid value to set_out_type: $opt\n"); + exit (1); + } +} + +sub handle_options { + my ($help) = 0; # handled locally + my ($ident) = 0; # handled locally + + # Process options. + if ( @ARGV > 0 && $ARGV[0] =~ /^[-+]/ ) { + usage () + unless GetOptions ('ident' => \$ident, + 'verbose' => \$verbose, + 'antialias|aa=i' => \$antialias, + 'noantialias|noaa' => sub { $antialias = 0 }, + 'scale=f' => \$scale, + 'width=i' => \$width, + 'height=i' => \$height, + 'output=s' => \$output, + 'png' => \&set_out_type, + 'pngmono' => \&set_out_type, + 'pnggray' => \&set_out_type, + 'png16' => \&set_out_type, + 'png256' => \&set_out_type, + 'png16m' => \&set_out_type, + 'jpg' => \&set_out_type, + 'jpggray' => \&set_out_type, + 'jpeg' => \&set_out_type, + 'jpeggray' => \&set_out_type, + 'gif' => \&set_out_type, + 'gifmono' => \&set_out_type, + 'mono!' => \$mono, + 'resolution=i' => \$res, + 'pbm!' => \$use_pbm, + 'trace' => \$trace, + 'help' => \$help, + 'debug' => \$debug) + && !$help; + } + print STDERR ("This is $my_package [$my_name $my_version]\n") + if $ident; + die ("Only one file argument is allowed when -output is used\n") + if @ARGV > 1 && defined $output; + die ("At least one input file name must be specified\n") + unless @ARGV; + die ("Antialias value must be 0, 1, 2, 4, or 8\n") + unless "$antialias" =~ /^[01248]$/; +} + +sub usage { + print STDERR < (the default), it produces PNG images by +default. Likewise, C defaults to GIF images and C +defaults to JPG. Note that the normal installation procedure will +I install C. + +It uses GhostScript to produce the images. Since modern GhostScript +programs do not support GIF anymore, GIF images are produced via the +Portable PixMap converters (PBM-package). In this case, a temporary +file is created, named after the output file, with the extension +replaced by ".ppm". It is deleted upon completion. + +=head1 ARGUMENTS + +B always requires at least one argument: the name of the EPS +file to be converted. It is possible to specify more than one file +name. This will cause all named files to be converted into separate +files, e.g., "C" will be converted to "C" and +so on. + +=over 4 + +=item B<-png -pngmono -pnggray -png16 -png256 -png16m> + +Each of these options will instruct Ghostscript to use the +corresponding bitmap generator, and supply a C<.png> default +extension for output files. + +=item B<-jpg -jpggray -jpeg -jpeggray> + +Same, but with a C<.jpg> default extension for output files. + +=item B<-gif -gifmono> + +Same, but with a C<.gif> default extension for output files. + +Note: Since modern Ghostscript versions no longer support the GIF +format due to copyright restrictions, B will request +Ghostscript to produce a Portable Bitmap File (.ppm or .pbm) instead +and run the B converter to produce the actual GIF file. + +=item B<-mono> + +This option will select monochrome (BW or gray) output. It forces the +Ghostscript driver to C, C, C, or C. + +=item B<-nomono> + +Produces colour images. This is the default. + +=item B<-width> I + +The desired width of the output image. + +If B<-height> is not specified, the image will be scaled proportionally. + +=item B<-height> I + +The desired height of the output image. + +If B<-width> is not specified, the image will be scaled proportionally. + +=item B<-resolution> I + +Specifies the resolution for the output image. This is the width, in +pixels, of the bitmap image for an EPS image of one inch wide (72 +PostScript points). + +Note that for best results, use the B<-width> and B<-height> options +instead. + +Default value is 82, which causes the converted image to be of more +or less the same size as the EPS image. On my screen, that is. + +=item B<-scale> I + +Specify a scaling factor. This may be a fractional number. + +For a one-inch EPS image, the resultant bitmap image will be +I times I. + +Note that for best results, use the B<-width> and B<-height> options +instead. + +=item B<-antialias> I + +Sets the antialiasing depth. I must be 0 (no antialiasing), 1, 2, +4, or 8. Default value is 4. + +=item B<-noantialias> + +Sets the antialiasing depth to 0. + +=item B<-pbm> + +Forces GIF conversion through the PBM converters. + +=item B<-nopbm> + +Forces GIF conversion through Ghostscript. + +=item B<-output> I + +Stores the output in this file. Only one input file may be supplied if +this option is specified. + +=item B<-help> + +Prints a help message and exits. + +=item B<-ident> + +Prints the program version before doing anything else. + +=item B<-verbose> + +Provides more verbose information. + +=back + +=head1 AUTHOR + +Johan Vromans, . + +=head1 BUGS + +GhostScript and, if required, the PBM package, need to be installed and +accessible through the user's C. + +GhostScript is assumed to be capable of handling all the image types +listed above. + +The EPS should be well-behaving. + +=head1 COPYRIGHT AND DISCLAIMER + +This program is Copyright 1994,2001 by Johan Vromans. +This program is free software; you can redistribute it and/or +modify it under the terms of the Perl Artistic License or 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. + +If you do not have a copy of the GNU General Public License write to +the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, +MA 02139, USA. + +=cut Property changes on: 1.0.8/doc-orig/eps2png ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/doc-orig/extract-docs =================================================================== --- 1.0.8/doc-orig/extract-docs (nonexistent) +++ 1.0.8/doc-orig/extract-docs (revision 1136) @@ -0,0 +1,322 @@ +#!/usr/bin/perl +# -*- perl -*- +# +# $Id$ +# +################################################################# +# This script extracts special comments from the source. It assembles +# them in texinfo files that are included in the manual. +################################################################# +# +# The general format of what this script looks for is thusly: +# +# %start-doc category sort-key +# texi stuff goes here +# %end-doc +# +# The lines with the %start-doc and %end-doc are not included in the +# texi extraction; only the lines between them. The category is used +# to determine the file that's created; a category of "foo" causes a +# file "foo.texi" to be created. The sort-keys are case insensitive. +# The text extracted is sorte according to the key and put into the +# file according to the category. Each unique sort-key causes a @node +# to be created, unless that sort-key's text already has a @node in +# it. +# If the sort-key contains space characters, it should be enclosed by +# quotation marks ("). Leading digits in the sort key optionally followed +# by space are removed after sort but before creation of nodes. This +# allows to manipulate the order of nodes in the manual. +# +# Note that we synthesize a special @syntax command, which should be +# used for all things syntax. We change those to whatever the current +# desired style is for syntaxes (currently, a cartouche box of +# non-wrapped but variable-pitch font). +# +# For extracting actions, this script expects a very specific syntax +# to be used. It looks like this, with one or more lines +# (continuations are like this example): +# +# static const char some_string_help[] = +# "some text\n" +# "some text"; +# +# Repeat for some_string_syntax[], then follow those with the usual +# %start-doc. Note that the %start-doc for actions must use the +# category "actions" and the sort key must match the action name. +# +# Within start-doc/end-doc pairs, you can use two special @-lines +# to control the generated node names and document structure. +# +# @nodetype section +# You can specify section, subsection, unnumberedsubsec, etc. Each +# unique sort key within each category is assigned one of these. +# @nodename pattern +# A sprintf-like pattern to use to modify the sort-key to make a +# node name. Since node names must be unique and have various +# restrictions as to what characters you can use in them, this +# allows you to use a pattern for various categories which will help +# keep node names unique without requiring lots of repetetive typing +# in the source files. + +$docdir = shift; +$docdir = "." unless $docdir; +$srcdir = "$docdir/../src"; +$docdir = "."; + +my $debug = 0; + +open(FIND, "find $srcdir -type f -name '*.[chly]' -print | sort |"); +while () { + s/[\r\n]+$//; + &scan_file($_); +} +close (FIND); + +sub dsort { + my ($a, $b) = @_; + $a =~ tr/A-Z/a-z/; + $b =~ tr/A-Z/a-z/; + return $a cmp $b; +} + +for $cat (sort keys %text) { + print "$cat\n"; + @k = sort {&dsort($a,$b)} keys %{$text{$cat}}; + $new = ''; + $new .= "\@c key $cat\n"; + if ($cat eq "actions") { + &dump_00_keys($cat, "\0\$"); + $new .= "\n\@menu\n"; + for $hid (sort keys %{$hids{$cat}}) { + if ($hid =~ /../) { + $new .= "* ${hid} actions::\n"; + } else { + $new .= "* core actions::\n"; + } + } + $new .= "\@end menu\n\n"; + for $hid (sort keys %{$hids{$cat}}) { + if ($hid =~ /../) { + $new .= "\@node $hid actions\n"; + $new .= "\@section $hid actions\n"; + &dump_00_keys($cat, "\0$hid\$"); + } else { + $new .= "\@node core actions\n"; + $new .= "\@section Core actions\n"; + } + $new .= "\@menu\n"; + for $key (@k) { + next unless $key =~ /\0$hid$/; + next if $key =~ /^00/; + $k2 = $title{$cat}{$key}; + if ($hid =~ /\S/ && $hid !~ /common/) { + $k2 = "$hid $k2"; + } + $new .= "* ${k2} Action:: $desc{$key}\n"; + } + $new .= "\@end menu\n"; + for $key (@k) { + next unless $key =~ /\0$hid$/; + next if $key =~ /^00/; + $k2 = $title{$cat}{$key}; + if ($hid =~ /\S/ && $hid !~ /common/) { + $k2 = "$hid $k2"; + } + if ($key !~ /^00/) { + $new .= "\@node $k2 Action\n"; + $new .= "\@subsection $k2\n"; + } + $new .= "\@c key $k2 in hid $hid\n"; + if ($synt{$key}) { + $new .= "\@cartouche\n\@format\n"; + $new .= $synt{$key}; + $new .= "\@end format\n\@end cartouche\n\n"; + } + if ($desc{$key}) { + $new .= $desc{$key} . "\n"; + } + $new .= $text{$cat}{$key}; + if (! $desc{$key} && ! $text{$cat}{$key} ) { + $new .= "No documentation yet.\n"; + } + $new .= "\n"; + } + } + } else { + $nodetype = "section"; + &dump_00_keys($cat, ""); + $new .= "\@menu\n"; + $nodename = "%s"; + for $key (@k) { + if ($nodename{$cat}{$key}) { + $nodename = $nodename{$cat}{$key}; + } + next if $key =~ /^00/; + $k2 = $title{$cat}{$key}; + # strip leading digits from the key string + $k2 =~ s/\A\d+\s*//g; + $k2 = sprintf($nodename, $k2); + if ($text{$cat}{$key} !~ /\@node/) { + $new .="* ${k2}::\n"; + } + } + $new .= "\@end menu\n"; + $nodename = "%s"; + for $key (@k) { + if ($nodetype{$cat}{$key}) { + $nodetype = $nodetype{$cat}{$key}; + } + if ($nodename{$cat}{$key}) { + $nodename = $nodename{$cat}{$key}; + } + next if $key =~ /^00/; + $k2 = $title{$cat}{$key}; + # strip leading digits from the key string + $k2 =~ s/\A\d+\s*//g; + $k2n = sprintf($nodename, $k2); + $new .= "\@c $cat $k2\n"; + if ($text{$cat}{$key} !~ /\@node/) { + $new .= "\@node $k2n\n"; + $new .= "\@$nodetype $k2\n"; + } + $new .= $text{$cat}{$key}; + } + } + $^A = ""; + $line = join(' ', @k); + formline(" ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~\n", $line); + print $^A; + + $old = ''; + if ( -f "$docdir/$cat.texi") { + open(CAT, "$docdir/$cat.texi"); + $old = join('', ); + close CAT; + } + if ($old ne $new) { + open(CAT, ">$docdir/$cat.texi"); + print CAT $new; + close CAT; + } +} + +sub dump_00_keys { + my($cat, $regex) = @_; + for $k (@k) { + next unless $k =~ /00.*$regex/; + $new .= $text{$cat}{$k}; + } +} + +sub scan_file { + my ($name) = @_; + print "DEBUG: sub_scan($name)\n" if ($debug); + + # if the source file was in $(srcdir)/hid// then + # pick out the name of the hid and put it into $srcdir. + if ($name =~ m@hid/([^/]+)/@) { + $hid = "$1"; + } else { + $hid = ""; + } + $lineno = 0; + + # skip processing of lex/yacc output files + if ($name =~ /\.[ch]$/) { + $new = $name; + $new =~ s/\.[ch]$/\.y/; + return if -f $new; + $new =~ s/\.y$/\.l/; + return if -f $new; + } + + open(F, $name); + while () { + $lineno ++; + if (/^static\s+const\s+char\s+.*_(help|syntax)\[\]\s*=(.*)/) { + $tag = $1; + $last = 0; + $pending{$tag} = ''; + + # note that the help/syntax string may start on the same line + # as the "static const char"... bit so we pick out that part and + # process it first. + $_ = $2; + LOOP: { + do { + # eat trailing whitespace, new-lines, and carriage returns + s/[\r\n\s]+$//; + + # we're done if we found the terminating ";" + $last = 1 if /;$/; + + # otherwise we need to eat leading whitespace and the leading quote + s/^[\s]*\"//; #" + + # convert \n to a newline + s/\\n/\n/g; + + # eat trailing quotes + s/\";?$//; #" + s/\\\"/\"/g; #" + s/ "/``/g; + s/" /''/g; + $pending{$tag} .= $_; + last if $last; + } while (); + } + # spit out a warning in case we have a malformed help + if ($pending{$tag} =~ /%(start|end)-doc/) { + print "WARNING: $name line $lineno has a $1 string that includes a %start-doc or %end-doc\n"; + print " tag:\n$pending{$tag}\n\n"; + } + next; + } + + if (/%start-doc\s+(\S+)\s+([^"^\s]+|".*?")(\s+(.*))?/) { + # pattern to look for: + # start-doc -> "%start-doc" + # \s+ -> one ore more whitespace + # (\S+) -> string with no whitespace, goes to $1 + # \s+ -> one ore more whitespace + # ([^"^\s]+|".*?") -> a space-less string, or a string delimited by ", goes to $2 + # (\s+(.*))? -> zero or more space separated strings + + $cat = $1; + $key = $2; + # strip leading and trailing quotation marks from the key string + $key =~ s/\A"//g; + $key =~ s/"\Z//g; + $title = $4; + if ($title) { + $title{$cat}{"$key\0$hid"} = $title; + } else { + $title{$cat}{"$key\0$hid"} = $key; + } + $text{$cat}{"$key\0$hid"} .= "\@c $name $lineno\n"; + $hids{$cat}{$hid} = 1; + if ($cat =~ /^(.*_)?actions/) { + $desc{"$key\0$hid"} = $pending{'help'}; + $synt{"$key\0$hid"} = $pending{'syntax'}; + %pending = (); + } + while () { + next if /^\*\/$/; + next if /^\/\*$/; + last if /%end-doc/; + s/\@syntax/\@cartouche\n\@format/g; + s/\@end syntax/\@end format\n\@end cartouche/g; + if (/^\@nodetype\s*(\S+)/) { + $nodetype{$cat}{"$key\0$hid"} = $1; + next; + } + if (/^\@nodename\s*(.+)/) { + $nodename{$cat}{"$key\0$hid"} = $1; + next; + } + $text{$cat}{"$key\0$hid"} .= $_; + } + } + } + close (F); +} Property changes on: 1.0.8/doc-orig/extract-docs ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/doc-orig/fractional_size.tab =================================================================== --- 1.0.8/doc-orig/fractional_size.tab (nonexistent) +++ 1.0.8/doc-orig/fractional_size.tab (revision 1136) @@ -0,0 +1,68 @@ +# $Id$ +# + +1/64 .0156 +1/32 .0313 +3/64 .0469 +1/16 .0625 +5/64 .0781 +3/32 .0938 +7/64 .1094 +1/8 .1250 +9/64 .1406 +5/32 .1562 +11/64 .1719 +3/16 .1875 +13/64 .2031 +7/32 .2188 +15/64 .2344 +1/4 .2500 +17/64 .2656 +9/32 .2812 +19/64 .2969 +5/16 .3125 +21/64 .3281 +11/32 .3438 +23/64 .3594 +3/8 .3750 +25/64 .3906 +13/32 .4062 +27/64 .4219 +7/16 .4375 +29/64 .4531 +15/32 .4688 +31/64 .4844 +1/2 .5000 +33/64 .5156 +17/32 .5313 +35/64 .5469 +9/16 .5625 +37/64 .5781 +19/32 .5938 +39/64 .6094 +5/8 .6250 +41/64 .6406 +21/32 .6562 +43/64 .6719 +11/16 .6875 +45/64 .7031 +23/32 .7188 +47/64 .7344 +3/4 .7500 +49/64 .7656 +25/32 .7812 +51/64 .7969 +13/16 .8125 +53/64 .8281 +27/32 .8438 +55/64 .8594 +7/8 .8750 +57/64 .8906 +29/32 .9062 +59/64 .9219 +15/16 .9375 +61/64 .9531 +31/32 .9688 +63/64 .9844 +1 1.0000 + Index: 1.0.8/doc-orig/fractional_size.texi =================================================================== --- 1.0.8/doc-orig/fractional_size.texi (nonexistent) +++ 1.0.8/doc-orig/fractional_size.texi (revision 1136) @@ -0,0 +1,29 @@ +@c Generated file. Do not edit directly +@c $Id$ +@multitable @columnfractions 0.167 0.167 0.167 0.167 0.167 0.167 +@item Drill @tab Diameter @tab Drill @tab Diameter @tab Drill @tab Diameter +@item Size @tab (inches) @tab Size @tab (inches) @tab Size @tab (inches) + +@item 1/64 @tab .0156 @tab 1/32 @tab .0313 @tab 3/64 @tab .0469 +@item 1/16 @tab .0625 @tab 5/64 @tab .0781 @tab 3/32 @tab .0938 +@item 7/64 @tab .1094 @tab 1/8 @tab .1250 @tab 9/64 @tab .1406 +@item 5/32 @tab .1562 @tab 11/64 @tab .1719 @tab 3/16 @tab .1875 +@item 13/64 @tab .2031 @tab 7/32 @tab .2188 @tab 15/64 @tab .2344 +@item 1/4 @tab .2500 @tab 17/64 @tab .2656 @tab 9/32 @tab .2812 +@item 19/64 @tab .2969 @tab 5/16 @tab .3125 @tab 21/64 @tab .3281 +@item 11/32 @tab .3438 @tab 23/64 @tab .3594 @tab 3/8 @tab .3750 +@item 25/64 @tab .3906 @tab 13/32 @tab .4062 @tab 27/64 @tab .4219 +@item 7/16 @tab .4375 @tab 29/64 @tab .4531 @tab 15/32 @tab .4688 +@item 31/64 @tab .4844 @tab 1/2 @tab .5000 @tab 33/64 @tab .5156 +@item 17/32 @tab .5313 @tab 35/64 @tab .5469 @tab 9/16 @tab .5625 +@item 37/64 @tab .5781 @tab 19/32 @tab .5938 @tab 39/64 @tab .6094 +@item 5/8 @tab .6250 @tab 41/64 @tab .6406 @tab 21/32 @tab .6562 +@item 43/64 @tab .6719 @tab 11/16 @tab .6875 @tab 45/64 @tab .7031 +@item 23/32 @tab .7188 @tab 47/64 @tab .7344 @tab 3/4 @tab .7500 +@item 49/64 @tab .7656 @tab 25/32 @tab .7812 @tab 51/64 @tab .7969 +@item 13/16 @tab .8125 @tab 53/64 @tab .8281 @tab 27/32 @tab .8438 +@item 55/64 @tab .8594 @tab 7/8 @tab .8750 @tab 57/64 @tab .8906 +@item 29/32 @tab .9062 @tab 59/64 @tab .9219 @tab 15/16 @tab .9375 +@item 61/64 @tab .9531 @tab 31/32 @tab .9688 @tab 63/64 @tab .9844 +@item 1 @tab 1.0000 @tab @tab @tab @tab @end multitable + Index: 1.0.8/doc-orig/gcode.pcb =================================================================== --- 1.0.8/doc-orig/gcode.pcb (nonexistent) +++ 1.0.8/doc-orig/gcode.pcb (revision 1136) @@ -0,0 +1,1000 @@ +# release: pcb 20091103 +# date: Tue Feb 9 17:50:10 2010 +# user: amc (amc,/home/alberto,S-1-5-21-3544562028-792812758-4257637587-9314) +# host: ni28979b.office.amsiag.com + +# To read pcb files, the pcb version (or the cvs source date) must be >= the file version +FileVersion[20070407] + +PCB["" 280000 160000] + +Grid[1000.000000 0 0 0] +Cursor[0 0 0.000000] +PolyArea[200000000.000000] +Thermal[0.500000] +DRC[1000 1000 1000 1000 1500 1000] +Flags("showdrc,nameonpcb,swapstartdir,clearnew,snappin") +Groups("1,c:2,s:3:4:5:6:7:8") +Styles["Signal,4000,8000,3000,2000:Power,2500,6000,3500,1000:Fat,4000,6000,3500,1000:Skinny,600,2402,1181,600"] + +Symbol(' ' 18) +( +) +Symbol('!' 12) +( + SymbolLine(0 45 0 50 8) + SymbolLine(0 10 0 35 8) +) +Symbol('"' 12) +( + SymbolLine(0 10 0 20 8) + SymbolLine(10 10 10 20 8) +) +Symbol('#' 12) +( + SymbolLine(0 35 20 35 8) + SymbolLine(0 25 20 25 8) + SymbolLine(15 20 15 40 8) + SymbolLine(5 20 5 40 8) +) +Symbol('$' 12) +( + SymbolLine(15 15 20 20 8) + SymbolLine(5 15 15 15 8) + SymbolLine(0 20 5 15 8) + SymbolLine(0 20 0 25 8) + SymbolLine(0 25 5 30 8) + SymbolLine(5 30 15 30 8) + SymbolLine(15 30 20 35 8) + SymbolLine(20 35 20 40 8) + SymbolLine(15 45 20 40 8) + SymbolLine(5 45 15 45 8) + SymbolLine(0 40 5 45 8) + SymbolLine(10 10 10 50 8) +) +Symbol('%' 12) +( + SymbolLine(0 15 0 20 8) + SymbolLine(0 15 5 10 8) + SymbolLine(5 10 10 10 8) + SymbolLine(10 10 15 15 8) + SymbolLine(15 15 15 20 8) + SymbolLine(10 25 15 20 8) + SymbolLine(5 25 10 25 8) + SymbolLine(0 20 5 25 8) + SymbolLine(0 50 40 10 8) + SymbolLine(35 50 40 45 8) + SymbolLine(40 40 40 45 8) + SymbolLine(35 35 40 40 8) + SymbolLine(30 35 35 35 8) + SymbolLine(25 40 30 35 8) + SymbolLine(25 40 25 45 8) + SymbolLine(25 45 30 50 8) + SymbolLine(30 50 35 50 8) +) +Symbol('&' 12) +( + SymbolLine(0 45 5 50 8) + SymbolLine(0 15 0 25 8) + SymbolLine(0 15 5 10 8) + SymbolLine(0 35 15 20 8) + SymbolLine(5 50 10 50 8) + SymbolLine(10 50 20 40 8) + SymbolLine(0 25 25 50 8) + SymbolLine(5 10 10 10 8) + SymbolLine(10 10 15 15 8) + SymbolLine(15 15 15 20 8) + SymbolLine(0 35 0 45 8) +) +Symbol(''' 12) +( + SymbolLine(0 20 10 10 8) +) +Symbol('(' 12) +( + SymbolLine(0 45 5 50 8) + SymbolLine(0 15 5 10 8) + SymbolLine(0 15 0 45 8) +) +Symbol(')' 12) +( + SymbolLine(0 10 5 15 8) + SymbolLine(5 15 5 45 8) + SymbolLine(0 50 5 45 8) +) +Symbol('*' 12) +( + SymbolLine(0 20 20 40 8) + SymbolLine(0 40 20 20 8) + SymbolLine(0 30 20 30 8) + SymbolLine(10 20 10 40 8) +) +Symbol('+' 12) +( + SymbolLine(0 30 20 30 8) + SymbolLine(10 20 10 40 8) +) +Symbol(',' 12) +( + SymbolLine(0 60 10 50 8) +) +Symbol('-' 12) +( + SymbolLine(0 30 20 30 8) +) +Symbol('.' 12) +( + SymbolLine(0 50 5 50 8) +) +Symbol('/' 12) +( + SymbolLine(0 45 30 15 8) +) +Symbol('0' 12) +( + SymbolLine(0 45 5 50 8) + SymbolLine(0 15 0 45 8) + SymbolLine(0 15 5 10 8) + SymbolLine(5 10 15 10 8) + SymbolLine(15 10 20 15 8) + SymbolLine(20 15 20 45 8) + SymbolLine(15 50 20 45 8) + SymbolLine(5 50 15 50 8) + SymbolLine(0 40 20 20 8) +) +Symbol('1' 12) +( + SymbolLine(5 50 15 50 8) + SymbolLine(10 10 10 50 8) + SymbolLine(0 20 10 10 8) +) +Symbol('2' 12) +( + SymbolLine(0 15 5 10 8) + SymbolLine(5 10 20 10 8) + SymbolLine(20 10 25 15 8) + SymbolLine(25 15 25 25 8) + SymbolLine(0 50 25 25 8) + SymbolLine(0 50 25 50 8) +) +Symbol('3' 12) +( + SymbolLine(0 15 5 10 8) + SymbolLine(5 10 15 10 8) + SymbolLine(15 10 20 15 8) + SymbolLine(20 15 20 45 8) + SymbolLine(15 50 20 45 8) + SymbolLine(5 50 15 50 8) + SymbolLine(0 45 5 50 8) + SymbolLine(5 30 20 30 8) +) +Symbol('4' 12) +( + SymbolLine(0 30 20 10 8) + SymbolLine(0 30 25 30 8) + SymbolLine(20 10 20 50 8) +) +Symbol('5' 12) +( + SymbolLine(0 10 20 10 8) + SymbolLine(0 10 0 30 8) + SymbolLine(0 30 5 25 8) + SymbolLine(5 25 15 25 8) + SymbolLine(15 25 20 30 8) + SymbolLine(20 30 20 45 8) + SymbolLine(15 50 20 45 8) + SymbolLine(5 50 15 50 8) + SymbolLine(0 45 5 50 8) +) +Symbol('6' 12) +( + SymbolLine(15 10 20 15 8) + SymbolLine(5 10 15 10 8) + SymbolLine(0 15 5 10 8) + SymbolLine(0 15 0 45 8) + SymbolLine(0 45 5 50 8) + SymbolLine(15 30 20 35 8) + SymbolLine(0 30 15 30 8) + SymbolLine(5 50 15 50 8) + SymbolLine(15 50 20 45 8) + SymbolLine(20 35 20 45 8) +) +Symbol('7' 12) +( + SymbolLine(0 50 25 25 8) + SymbolLine(25 10 25 25 8) + SymbolLine(0 10 25 10 8) +) +Symbol('8' 12) +( + SymbolLine(0 45 5 50 8) + SymbolLine(0 35 0 45 8) + SymbolLine(0 35 5 30 8) + SymbolLine(5 30 15 30 8) + SymbolLine(15 30 20 35 8) + SymbolLine(20 35 20 45 8) + SymbolLine(15 50 20 45 8) + SymbolLine(5 50 15 50 8) + SymbolLine(0 25 5 30 8) + SymbolLine(0 15 0 25 8) + SymbolLine(0 15 5 10 8) + SymbolLine(5 10 15 10 8) + SymbolLine(15 10 20 15 8) + SymbolLine(20 15 20 25 8) + SymbolLine(15 30 20 25 8) +) +Symbol('9' 12) +( + SymbolLine(0 50 20 30 8) + SymbolLine(20 15 20 30 8) + SymbolLine(15 10 20 15 8) + SymbolLine(5 10 15 10 8) + SymbolLine(0 15 5 10 8) + SymbolLine(0 15 0 25 8) + SymbolLine(0 25 5 30 8) + SymbolLine(5 30 20 30 8) +) +Symbol(':' 12) +( + SymbolLine(0 25 5 25 8) + SymbolLine(0 35 5 35 8) +) +Symbol(';' 12) +( + SymbolLine(0 50 10 40 8) + SymbolLine(10 25 10 30 8) +) +Symbol('<' 12) +( + SymbolLine(0 30 10 20 8) + SymbolLine(0 30 10 40 8) +) +Symbol('=' 12) +( + SymbolLine(0 25 20 25 8) + SymbolLine(0 35 20 35 8) +) +Symbol('>' 12) +( + SymbolLine(0 20 10 30 8) + SymbolLine(0 40 10 30 8) +) +Symbol('?' 12) +( + SymbolLine(10 30 10 35 8) + SymbolLine(10 45 10 50 8) + SymbolLine(0 15 0 20 8) + SymbolLine(0 15 5 10 8) + SymbolLine(5 10 15 10 8) + SymbolLine(15 10 20 15 8) + SymbolLine(20 15 20 20 8) + SymbolLine(10 30 20 20 8) +) +Symbol('@' 12) +( + SymbolLine(0 10 0 40 8) + SymbolLine(0 40 10 50 8) + SymbolLine(10 50 40 50 8) + SymbolLine(50 35 50 10 8) + SymbolLine(50 10 40 0 8) + SymbolLine(40 0 10 0 8) + SymbolLine(10 0 0 10 8) + SymbolLine(15 20 15 30 8) + SymbolLine(15 30 20 35 8) + SymbolLine(20 35 30 35 8) + SymbolLine(30 35 35 30 8) + SymbolLine(35 30 40 35 8) + SymbolLine(35 30 35 15 8) + SymbolLine(35 20 30 15 8) + SymbolLine(20 15 30 15 8) + SymbolLine(20 15 15 20 8) + SymbolLine(40 35 50 35 8) +) +Symbol('A' 12) +( + SymbolLine(0 15 0 50 8) + SymbolLine(0 15 5 10 8) + SymbolLine(5 10 20 10 8) + SymbolLine(20 10 25 15 8) + SymbolLine(25 15 25 50 8) + SymbolLine(0 30 25 30 8) +) +Symbol('B' 12) +( + SymbolLine(0 50 20 50 8) + SymbolLine(20 50 25 45 8) + SymbolLine(25 35 25 45 8) + SymbolLine(20 30 25 35 8) + SymbolLine(5 30 20 30 8) + SymbolLine(5 10 5 50 8) + SymbolLine(0 10 20 10 8) + SymbolLine(20 10 25 15 8) + SymbolLine(25 15 25 25 8) + SymbolLine(20 30 25 25 8) +) +Symbol('C' 12) +( + SymbolLine(5 50 20 50 8) + SymbolLine(0 45 5 50 8) + SymbolLine(0 15 0 45 8) + SymbolLine(0 15 5 10 8) + SymbolLine(5 10 20 10 8) +) +Symbol('D' 12) +( + SymbolLine(5 10 5 50 8) + SymbolLine(20 10 25 15 8) + SymbolLine(25 15 25 45 8) + SymbolLine(20 50 25 45 8) + SymbolLine(0 50 20 50 8) + SymbolLine(0 10 20 10 8) +) +Symbol('E' 12) +( + SymbolLine(0 30 15 30 8) + SymbolLine(0 50 20 50 8) + SymbolLine(0 10 0 50 8) + SymbolLine(0 10 20 10 8) +) +Symbol('F' 12) +( + SymbolLine(0 10 0 50 8) + SymbolLine(0 10 20 10 8) + SymbolLine(0 30 15 30 8) +) +Symbol('G' 12) +( + SymbolLine(20 10 25 15 8) + SymbolLine(5 10 20 10 8) + SymbolLine(0 15 5 10 8) + SymbolLine(0 15 0 45 8) + SymbolLine(0 45 5 50 8) + SymbolLine(5 50 20 50 8) + SymbolLine(20 50 25 45 8) + SymbolLine(25 35 25 45 8) + SymbolLine(20 30 25 35 8) + SymbolLine(10 30 20 30 8) +) +Symbol('H' 12) +( + SymbolLine(0 10 0 50 8) + SymbolLine(25 10 25 50 8) + SymbolLine(0 30 25 30 8) +) +Symbol('I' 12) +( + SymbolLine(0 10 10 10 8) + SymbolLine(5 10 5 50 8) + SymbolLine(0 50 10 50 8) +) +Symbol('J' 12) +( + SymbolLine(0 10 15 10 8) + SymbolLine(15 10 15 45 8) + SymbolLine(10 50 15 45 8) + SymbolLine(5 50 10 50 8) + SymbolLine(0 45 5 50 8) +) +Symbol('K' 12) +( + SymbolLine(0 10 0 50 8) + SymbolLine(0 30 20 10 8) + SymbolLine(0 30 20 50 8) +) +Symbol('L' 12) +( + SymbolLine(0 10 0 50 8) + SymbolLine(0 50 20 50 8) +) +Symbol('M' 12) +( + SymbolLine(0 10 0 50 8) + SymbolLine(0 10 15 25 8) + SymbolLine(15 25 30 10 8) + SymbolLine(30 10 30 50 8) +) +Symbol('N' 12) +( + SymbolLine(0 10 0 50 8) + SymbolLine(0 10 0 15 8) + SymbolLine(0 15 25 40 8) + SymbolLine(25 10 25 50 8) +) +Symbol('O' 12) +( + SymbolLine(0 15 0 45 8) + SymbolLine(0 15 5 10 8) + SymbolLine(5 10 15 10 8) + SymbolLine(15 10 20 15 8) + SymbolLine(20 15 20 45 8) + SymbolLine(15 50 20 45 8) + SymbolLine(5 50 15 50 8) + SymbolLine(0 45 5 50 8) +) +Symbol('P' 12) +( + SymbolLine(5 10 5 50 8) + SymbolLine(0 10 20 10 8) + SymbolLine(20 10 25 15 8) + SymbolLine(25 15 25 25 8) + SymbolLine(20 30 25 25 8) + SymbolLine(5 30 20 30 8) +) +Symbol('Q' 12) +( + SymbolLine(0 15 0 45 8) + SymbolLine(0 15 5 10 8) + SymbolLine(5 10 15 10 8) + SymbolLine(15 10 20 15 8) + SymbolLine(20 15 20 45 8) + SymbolLine(15 50 20 45 8) + SymbolLine(5 50 15 50 8) + SymbolLine(0 45 5 50 8) + SymbolLine(10 40 20 50 8) +) +Symbol('R' 12) +( + SymbolLine(0 10 20 10 8) + SymbolLine(20 10 25 15 8) + SymbolLine(25 15 25 25 8) + SymbolLine(20 30 25 25 8) + SymbolLine(5 30 20 30 8) + SymbolLine(5 10 5 50 8) + SymbolLine(5 30 25 50 8) +) +Symbol('S' 12) +( + SymbolLine(20 10 25 15 8) + SymbolLine(5 10 20 10 8) + SymbolLine(0 15 5 10 8) + SymbolLine(0 15 0 25 8) + SymbolLine(0 25 5 30 8) + SymbolLine(5 30 20 30 8) + SymbolLine(20 30 25 35 8) + SymbolLine(25 35 25 45 8) + SymbolLine(20 50 25 45 8) + SymbolLine(5 50 20 50 8) + SymbolLine(0 45 5 50 8) +) +Symbol('T' 12) +( + SymbolLine(0 10 20 10 8) + SymbolLine(10 10 10 50 8) +) +Symbol('U' 12) +( + SymbolLine(0 10 0 45 8) + SymbolLine(0 45 5 50 8) + SymbolLine(5 50 15 50 8) + SymbolLine(15 50 20 45 8) + SymbolLine(20 10 20 45 8) +) +Symbol('V' 12) +( + SymbolLine(0 10 0 40 8) + SymbolLine(0 40 10 50 8) + SymbolLine(10 50 20 40 8) + SymbolLine(20 10 20 40 8) +) +Symbol('W' 12) +( + SymbolLine(0 10 0 50 8) + SymbolLine(0 50 15 35 8) + SymbolLine(15 35 30 50 8) + SymbolLine(30 10 30 50 8) +) +Symbol('X' 12) +( + SymbolLine(0 10 0 15 8) + SymbolLine(0 15 25 40 8) + SymbolLine(25 40 25 50 8) + SymbolLine(0 40 0 50 8) + SymbolLine(0 40 25 15 8) + SymbolLine(25 10 25 15 8) +) +Symbol('Y' 12) +( + SymbolLine(0 10 0 15 8) + SymbolLine(0 15 10 25 8) + SymbolLine(10 25 20 15 8) + SymbolLine(20 10 20 15 8) + SymbolLine(10 25 10 50 8) +) +Symbol('Z' 12) +( + SymbolLine(0 10 25 10 8) + SymbolLine(25 10 25 15 8) + SymbolLine(0 40 25 15 8) + SymbolLine(0 40 0 50 8) + SymbolLine(0 50 25 50 8) +) +Symbol('[' 12) +( + SymbolLine(0 10 5 10 8) + SymbolLine(0 10 0 50 8) + SymbolLine(0 50 5 50 8) +) +Symbol('\' 12) +( + SymbolLine(0 15 30 45 8) +) +Symbol(']' 12) +( + SymbolLine(0 10 5 10 8) + SymbolLine(5 10 5 50 8) + SymbolLine(0 50 5 50 8) +) +Symbol('^' 12) +( + SymbolLine(0 15 5 10 8) + SymbolLine(5 10 10 15 8) +) +Symbol('_' 12) +( + SymbolLine(0 50 20 50 8) +) +Symbol('a' 12) +( + SymbolLine(15 30 20 35 8) + SymbolLine(5 30 15 30 8) + SymbolLine(0 35 5 30 8) + SymbolLine(0 35 0 45 8) + SymbolLine(0 45 5 50 8) + SymbolLine(20 30 20 45 8) + SymbolLine(20 45 25 50 8) + SymbolLine(5 50 15 50 8) + SymbolLine(15 50 20 45 8) +) +Symbol('b' 12) +( + SymbolLine(0 10 0 50 8) + SymbolLine(0 45 5 50 8) + SymbolLine(5 50 15 50 8) + SymbolLine(15 50 20 45 8) + SymbolLine(20 35 20 45 8) + SymbolLine(15 30 20 35 8) + SymbolLine(5 30 15 30 8) + SymbolLine(0 35 5 30 8) +) +Symbol('c' 12) +( + SymbolLine(5 30 20 30 8) + SymbolLine(0 35 5 30 8) + SymbolLine(0 35 0 45 8) + SymbolLine(0 45 5 50 8) + SymbolLine(5 50 20 50 8) +) +Symbol('d' 12) +( + SymbolLine(20 10 20 50 8) + SymbolLine(15 50 20 45 8) + SymbolLine(5 50 15 50 8) + SymbolLine(0 45 5 50 8) + SymbolLine(0 35 0 45 8) + SymbolLine(0 35 5 30 8) + SymbolLine(5 30 15 30 8) + SymbolLine(15 30 20 35 8) +) +Symbol('e' 12) +( + SymbolLine(5 50 20 50 8) + SymbolLine(0 45 5 50 8) + SymbolLine(0 35 0 45 8) + SymbolLine(0 35 5 30 8) + SymbolLine(5 30 15 30 8) + SymbolLine(15 30 20 35 8) + SymbolLine(0 40 20 40 8) + SymbolLine(20 40 20 35 8) +) +Symbol('f' 10) +( + SymbolLine(5 15 5 50 8) + SymbolLine(5 15 10 10 8) + SymbolLine(10 10 15 10 8) + SymbolLine(0 30 10 30 8) +) +Symbol('g' 12) +( + SymbolLine(15 30 20 35 8) + SymbolLine(5 30 15 30 8) + SymbolLine(0 35 5 30 8) + SymbolLine(0 35 0 45 8) + SymbolLine(0 45 5 50 8) + SymbolLine(5 50 15 50 8) + SymbolLine(15 50 20 45 8) + SymbolLine(0 60 5 65 8) + SymbolLine(5 65 15 65 8) + SymbolLine(15 65 20 60 8) + SymbolLine(20 30 20 60 8) +) +Symbol('h' 12) +( + SymbolLine(0 10 0 50 8) + SymbolLine(0 35 5 30 8) + SymbolLine(5 30 15 30 8) + SymbolLine(15 30 20 35 8) + SymbolLine(20 35 20 50 8) +) +Symbol('i' 10) +( + SymbolLine(0 20 0 25 8) + SymbolLine(0 35 0 50 8) +) +Symbol('j' 10) +( + SymbolLine(5 20 5 25 8) + SymbolLine(5 35 5 60 8) + SymbolLine(0 65 5 60 8) +) +Symbol('k' 12) +( + SymbolLine(0 10 0 50 8) + SymbolLine(0 35 15 50 8) + SymbolLine(0 35 10 25 8) +) +Symbol('l' 10) +( + SymbolLine(0 10 0 45 8) + SymbolLine(0 45 5 50 8) +) +Symbol('m' 12) +( + SymbolLine(5 35 5 50 8) + SymbolLine(5 35 10 30 8) + SymbolLine(10 30 15 30 8) + SymbolLine(15 30 20 35 8) + SymbolLine(20 35 20 50 8) + SymbolLine(20 35 25 30 8) + SymbolLine(25 30 30 30 8) + SymbolLine(30 30 35 35 8) + SymbolLine(35 35 35 50 8) + SymbolLine(0 30 5 35 8) +) +Symbol('n' 12) +( + SymbolLine(5 35 5 50 8) + SymbolLine(5 35 10 30 8) + SymbolLine(10 30 15 30 8) + SymbolLine(15 30 20 35 8) + SymbolLine(20 35 20 50 8) + SymbolLine(0 30 5 35 8) +) +Symbol('o' 12) +( + SymbolLine(0 35 0 45 8) + SymbolLine(0 35 5 30 8) + SymbolLine(5 30 15 30 8) + SymbolLine(15 30 20 35 8) + SymbolLine(20 35 20 45 8) + SymbolLine(15 50 20 45 8) + SymbolLine(5 50 15 50 8) + SymbolLine(0 45 5 50 8) +) +Symbol('p' 12) +( + SymbolLine(5 35 5 65 8) + SymbolLine(0 30 5 35 8) + SymbolLine(5 35 10 30 8) + SymbolLine(10 30 20 30 8) + SymbolLine(20 30 25 35 8) + SymbolLine(25 35 25 45 8) + SymbolLine(20 50 25 45 8) + SymbolLine(10 50 20 50 8) + SymbolLine(5 45 10 50 8) +) +Symbol('q' 12) +( + SymbolLine(20 35 20 65 8) + SymbolLine(15 30 20 35 8) + SymbolLine(5 30 15 30 8) + SymbolLine(0 35 5 30 8) + SymbolLine(0 35 0 45 8) + SymbolLine(0 45 5 50 8) + SymbolLine(5 50 15 50 8) + SymbolLine(15 50 20 45 8) +) +Symbol('r' 12) +( + SymbolLine(5 35 5 50 8) + SymbolLine(5 35 10 30 8) + SymbolLine(10 30 20 30 8) + SymbolLine(0 30 5 35 8) +) +Symbol('s' 12) +( + SymbolLine(5 50 20 50 8) + SymbolLine(20 50 25 45 8) + SymbolLine(20 40 25 45 8) + SymbolLine(5 40 20 40 8) + SymbolLine(0 35 5 40 8) + SymbolLine(0 35 5 30 8) + SymbolLine(5 30 20 30 8) + SymbolLine(20 30 25 35 8) + SymbolLine(0 45 5 50 8) +) +Symbol('t' 10) +( + SymbolLine(5 10 5 45 8) + SymbolLine(5 45 10 50 8) + SymbolLine(0 25 10 25 8) +) +Symbol('u' 12) +( + SymbolLine(0 30 0 45 8) + SymbolLine(0 45 5 50 8) + SymbolLine(5 50 15 50 8) + SymbolLine(15 50 20 45 8) + SymbolLine(20 30 20 45 8) +) +Symbol('v' 12) +( + SymbolLine(0 30 0 40 8) + SymbolLine(0 40 10 50 8) + SymbolLine(10 50 20 40 8) + SymbolLine(20 30 20 40 8) +) +Symbol('w' 12) +( + SymbolLine(0 30 0 45 8) + SymbolLine(0 45 5 50 8) + SymbolLine(5 50 10 50 8) + SymbolLine(10 50 15 45 8) + SymbolLine(15 30 15 45 8) + SymbolLine(15 45 20 50 8) + SymbolLine(20 50 25 50 8) + SymbolLine(25 50 30 45 8) + SymbolLine(30 30 30 45 8) +) +Symbol('x' 12) +( + SymbolLine(0 30 20 50 8) + SymbolLine(0 50 20 30 8) +) +Symbol('y' 12) +( + SymbolLine(0 30 0 45 8) + SymbolLine(0 45 5 50 8) + SymbolLine(20 30 20 60 8) + SymbolLine(15 65 20 60 8) + SymbolLine(5 65 15 65 8) + SymbolLine(0 60 5 65 8) + SymbolLine(5 50 15 50 8) + SymbolLine(15 50 20 45 8) +) +Symbol('z' 12) +( + SymbolLine(0 30 20 30 8) + SymbolLine(0 50 20 30 8) + SymbolLine(0 50 20 50 8) +) +Symbol('{' 12) +( + SymbolLine(5 15 10 10 8) + SymbolLine(5 15 5 25 8) + SymbolLine(0 30 5 25 8) + SymbolLine(0 30 5 35 8) + SymbolLine(5 35 5 45 8) + SymbolLine(5 45 10 50 8) +) +Symbol('|' 12) +( + SymbolLine(0 10 0 50 8) +) +Symbol('}' 12) +( + SymbolLine(0 10 5 15 8) + SymbolLine(5 15 5 25 8) + SymbolLine(5 25 10 30 8) + SymbolLine(5 35 10 30 8) + SymbolLine(5 35 5 45 8) + SymbolLine(0 50 5 45 8) +) +Symbol('~' 12) +( + SymbolLine(0 35 5 30 8) + SymbolLine(5 30 10 30 8) + SymbolLine(10 30 15 35 8) + SymbolLine(15 35 20 35 8) + SymbolLine(20 35 25 30 8) +) +Via[48000 28000 8000 4000 0 3000 "" ""] +Via[63000 86000 8000 4000 0 3000 "" ""] + +Element["" "DIP18" "U5" "16F84" 116500 28500 17000 5000 3 100 ""] +( + Pin[0 0 8000 3000 5600 2800 "1" "1" "square"] + Pin[0 10000 8000 3000 5600 2800 "2" "2" ""] + Pin[0 20000 8000 3000 5600 2800 "3" "3" ""] + Pin[0 30000 8000 3000 5600 2800 "4" "4" ""] + Pin[0 40000 8000 3000 5600 2800 "5" "5" ""] + Pin[0 50000 8000 3000 5600 2800 "6" "6" ""] + Pin[0 60000 8000 3000 5600 2800 "7" "7" ""] + Pin[0 70000 8000 3000 5600 2800 "8" "8" ""] + Pin[0 80000 8000 3000 5600 2800 "9" "9" ""] + Pin[30000 80000 8000 3000 5600 2800 "10" "10" ""] + Pin[30000 70000 8000 3000 5600 2800 "11" "11" ""] + Pin[30000 60000 8000 3000 5600 2800 "12" "12" ""] + Pin[30000 50000 8000 3000 5600 2800 "13" "13" ""] + Pin[30000 40000 8000 3000 5600 2800 "14" "14" ""] + Pin[30000 30000 8000 3000 5600 2800 "15" "15" ""] + Pin[30000 20000 8000 3000 5600 2800 "16" "16" ""] + Pin[30000 10000 8000 3000 5600 2800 "17" "17" ""] + Pin[30000 0 8000 3000 5600 2800 "18" "18" ""] + ElementLine [20000 -5000 35000 -5000 1000] + ElementLine [-5000 -5000 10000 -5000 1000] + ElementLine [35000 85000 35000 -5000 1000] + ElementLine [-5000 85000 35000 85000 1000] + ElementLine [-5000 -5000 -5000 85000 1000] + ElementArc [15000 -5000 5000 5000 0 180 1000] + + ) + +Element["" "TO220" "U6" "unknown" 179500 45000 23000 -15000 0 100 ""] +( + Pin[0 -10000 8000 3000 8600 5000 "1" "1" "square,edge2"] + Pin[0 0 8000 3000 8600 5000 "2" "2" "edge2"] + Pin[0 10000 8000 3000 8600 5000 "3" "3" "edge2"] + Pin[67000 0 17500 3000 15100 13000 "4" "4" "edge2"] + ElementLine [0 -10000 18000 -10000 3000] + ElementLine [0 0 18000 0 3000] + ElementLine [0 10000 18000 10000 3000] + ElementLine [18000 -20000 18000 20000 2000] + ElementLine [18000 20000 55500 20000 2000] + ElementLine [55500 -20000 55500 20000 2000] + ElementLine [18000 -20000 55500 -20000 2000] + ElementLine [55500 -20000 55500 20000 2000] + ElementLine [55500 20000 68000 20000 2000] + ElementLine [68000 18500 68000 20000 2000] + ElementLine [68000 18500 75000 18500 2000] + ElementLine [75000 18500 75000 20000 2000] + ElementLine [75000 20000 79000 20000 2000] + ElementLine [79000 -20000 79000 20000 2000] + ElementLine [75000 -20000 79000 -20000 2000] + ElementLine [75000 -20000 75000 -18500 2000] + ElementLine [68000 -18500 75000 -18500 2000] + ElementLine [68000 -20000 68000 -18500 2000] + ElementLine [55500 -20000 68000 -20000 2000] + + ) + +Element["" "RCY300" "C11" "unknown" 205500 94500 2500 10000 3 100 ""] +( + Pin[0 0 8000 3000 5600 5000 "1" "1" ""] + Pin[0 30000 8000 3000 5600 5000 "2" "2" "square"] + ElementArc [0 15000 30000 30000 270 360 1000] + + ) + +Element["" "ALF400" "Z5" "unknown" 129000 142500 -33800 900 0 100 ""] +( + Pin[0 0 8000 3000 4600 2000 "2" "2" "square,edge2"] + Pin[-40000 0 8000 3000 4600 2000 "1" "1" "edge2"] + ElementLine [-13300 0 0 0 1000] + ElementLine [-40000 0 -26700 0 1000] + ElementLine [-13300 0 -26700 6600 1000] + ElementLine [-26700 -6600 -26700 6600 1000] + ElementLine [-26700 -6600 -13300 0 1000] + ElementLine [-13300 -6600 -13300 6600 1000] + + ) + +Element["" "ACY400" "R21" "unknown" 82500 28000 -5300 32000 3 100 ""] +( + Pin[0 0 8000 3000 5100 3000 "1" "1" "square"] + Pin[0 40000 8000 3000 5100 3000 "2" "2" ""] + ElementLine [0 0 0 10000 1000] + ElementLine [0 30000 0 40000 1000] + ElementLine [3300 10000 3300 30000 1000] + ElementLine [-3300 30000 3300 30000 1000] + ElementLine [-3300 10000 -3300 30000 1000] + ElementLine [-3300 10000 3300 10000 1000] + + ) + +Element["" "AXIAL_LAY-200" "C13" "100n" 87000 110000 -6000 -11400 0 100 ""] +( + Pin[5000 0 8000 3000 8600 3000 "1" "1" "edge2"] + Pin[-15000 0 8000 3000 8600 3000 "2" "2" "edge2"] + ElementLine [0 -1600 0 1600 1000] + ElementLine [-10000 -1600 0 -1600 1000] + ElementLine [-10000 -1600 -10000 1600 1000] + ElementLine [-10000 1600 0 1600 1000] + ElementLine [-15000 0 -10000 0 1000] + ElementLine [0 0 5000 0 1000] + + ) +Layer(1 "component") +( +) +Layer(2 "solder") +( + Line[48000 28000 48000 30000 4000 4000 "clearline"] + Line[48000 30000 69000 51000 4000 4000 "clearline"] + Line[69000 51000 96000 51000 4000 4000 "clearline"] + Line[96000 51000 98000 53000 4000 4000 "clearline"] + Line[98000 53000 98000 60000 4000 4000 "clearline"] + Line[98000 60000 106000 68000 4000 4000 "clearline"] + Line[106000 68000 116000 68000 4000 4000 "clearline"] + Line[116000 68000 116500 68500 4000 4000 "clearline"] + Line[82500 68000 82500 99500 4000 4000 "clearline"] + Line[82500 99500 72000 110000 4000 4000 "clearline"] + Line[92000 110000 93000 110000 4000 4000 "clearline"] + Line[93000 110000 101000 102000 4000 4000 "clearline"] + Line[101000 102000 101000 81000 4000 4000 "clearline"] + Line[101000 81000 103000 79000 4000 4000 "clearline"] + Line[103000 79000 116000 79000 4000 4000 "clearline"] + Line[116000 79000 116500 78500 4000 4000 "clearline"] + Line[116500 48500 129500 48500 4000 4000 "clearline"] + Line[129500 48500 133000 52000 4000 4000 "clearline"] + Line[133000 52000 133000 64000 4000 4000 "clearline"] + Line[133000 64000 137000 68000 4000 4000 "clearline"] + Line[137000 68000 146000 68000 4000 4000 "clearline"] + Line[146000 68000 146500 68500 4000 4000 "clearline"] + Line[146500 88500 137500 88500 4000 4000 "clearline"] + Line[137500 88500 129000 97000 4000 4000 "clearline"] + Line[129000 97000 118000 97000 4000 4000 "clearline"] + Line[118000 97000 116500 98500 4000 4000 "clearline"] + Line[129000 142500 131500 142500 4000 4000 "clearline"] + Line[131500 142500 161000 113000 4000 4000 "clearline"] + Line[161000 113000 161000 63000 4000 4000 "clearline"] + Line[161000 63000 158000 60000 4000 4000 "clearline"] + Line[158000 60000 148000 60000 4000 4000 "clearline"] + Line[148000 60000 146500 58500 4000 4000 "clearline"] + Line[205500 94500 205500 44500 4000 4000 "clearline"] + Line[205500 44500 197000 36000 4000 4000 "clearline"] + Line[197000 36000 180500 36000 4000 4000 "clearline"] + Line[180500 36000 179500 35000 4000 4000 "clearline"] + Line[82500 28000 96500 14000 4000 4000 "clearline"] + Line[96500 14000 128000 14000 4000 4000 "clearline"] + Line[128000 14000 133000 19000 4000 4000 "clearline"] + Line[133000 19000 133000 35000 4000 4000 "clearline"] + Line[133000 35000 136500 38500 4000 4000 "clearline"] + Line[136500 38500 146500 38500 4000 4000 "clearline"] + Line[146500 28500 148000 27000 4000 4000 "clearline"] + Line[148000 27000 166000 27000 4000 4000 "clearline"] + Line[166000 27000 166000 42000 4000 4000 "clearline"] + Line[166000 42000 169000 45000 4000 4000 "clearline"] + Line[169000 45000 179500 45000 4000 4000 "clearline"] + Line[179500 55000 179500 98500 4000 4000 "clearline"] + Line[179500 98500 205500 124500 4000 4000 "clearline"] + Line[89000 142500 107500 124000 4000 4000 "clearline"] + Line[107500 124000 127000 124000 4000 4000 "clearline"] + Line[127000 124000 127000 110000 4000 4000 "clearline"] + Line[127000 110000 138500 98500 4000 4000 "clearline"] + Line[138500 98500 146500 98500 4000 4000 "clearline"] + Line[146500 78500 132500 78500 4000 4000 "clearline"] + Line[132500 78500 132000 78000 4000 4000 "clearline"] + Line[132000 78000 121500 88500 4000 4000 "clearline"] + Line[121500 88500 116500 88500 4000 4000 "clearline"] + Line[63000 86000 63000 72000 4000 4000 "clearline"] + Line[63000 72000 67000 68000 4000 4000 "clearline"] + Line[67000 68000 82500 68000 4000 4000 "clearline"] + Polygon("clearpoly") + ( + [257000 147000] [169000 147000] [169000 10000] [257000 10000] + ) +) +Layer(3 "GND") +( +) +Layer(4 "power") +( +) +Layer(5 "signal1") +( +) +Layer(6 "signal2") +( +) +Layer(7 "signal3") +( +) +Layer(8 "signal4") +( +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( +) Index: 1.0.8/doc-orig/gcode.pdf =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-orig/gcode.pdf =================================================================== --- 1.0.8/doc-orig/gcode.pdf (nonexistent) +++ 1.0.8/doc-orig/gcode.pdf (revision 1136) Property changes on: 1.0.8/doc-orig/gcode.pdf ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-orig/gcode.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-orig/gcode.png =================================================================== --- 1.0.8/doc-orig/gcode.png (nonexistent) +++ 1.0.8/doc-orig/gcode.png (revision 1136) Property changes on: 1.0.8/doc-orig/gcode.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-orig/gcode_control_img.eps =================================================================== --- 1.0.8/doc-orig/gcode_control_img.eps (nonexistent) +++ 1.0.8/doc-orig/gcode_control_img.eps (revision 1136) @@ -0,0 +1,711 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%Creator: GIMP PostScript file plugin V 1,17 by Peter Kirchgessner +%%Title: gcode_control_img.eps +%%CreationDate: Mon May 30 02:37:26 2011 +%%DocumentData: Clean7Bit +%%LanguageLevel: 2 +%%Pages: 1 +%%BoundingBox: 0 0 404 231 +%%EndComments +%%BeginProlog +% Use own dictionary to avoid conflicts +10 dict begin +%%EndProlog +%%Page: 1 1 +% Translate for offset +0 0 translate +% Translate to begin of first scanline +0 230.40000000000001 translate +403.20000000000005 -230.40000000000001 scale +% Image geometry +1680 960 1 +% Transformation matrix +[ 1680 0 0 960 0 0 ] +currentfile /ASCII85Decode filter /RunLengthDecode filter +%%BeginData: 51668 ASCII Bytes +image +JcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqR +JcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqR +JcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqR +JcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqRJcDqR +nG`K=^]4@!KE(H@!._ib!'c,9nG`K=^]4@!KE(H@!._ib!'c,9nG`K=^]4@!KE(H@!._ib!'c,9 +nG`K=^]4@!KE(H@!._ib!'c,9nG`K=^]4@!KE(H@!._ib!'c,9nG`K=^]4@!jSo5LklA9onG`K= +^]4@!jSo4qkl:]J])V:"!._ib!'fQEkPtSn])V:"!._ib!'fTF!<20^!!g+8nG`K=^]4@!jo5>Y +kPtSb])V:"!._ib!'fTF!;PaX!!0\2nG`K=^]4@!jo5>Mk5`*nnG`K=^]4@!jo5>=k5YL3]DqC# +!._ib!'fTF!5Rat!'e*qnG`K=^]4@!jo5=2k5YK(]DqC#!._ib!'fTFjo>Al]DqC#!._ib!'fWG +!<2*\!!g.9nG`K=^]4@!k5PGZjo>A`]DqC#!._ib!'fWG!;P[V!!0_3nG`K=^]4@!k5PGNjT)pm +nG`K=^]4@!k5PG>jT#:1]`7L$!._ib!'fWG!5R[r!'e-rnG`K=^]4@!k5PF3jT#9&]`7L$!._ib +!'fWGj8]/j]`7L$!._ib!'fZH!<2$Z!!g1:nG`K=^]4@!kPkP[j8]/^]`7L$!._ib!'fZH!;PUT +!!0b4nG`K=^]4@!kPkPOirHalnG`K=^]4@!kPkP?irB(/^&RU%!._ib!'fZH!5RUp!'e0snG`K= +^]4@!kPkO4irB'$^&RU%!._ib!'fZHiW&rh^&RU%!._ib!'f]I!<1sX!!g4;nG`K=^]4@!kl1Y\ +iW&r\^&RU%!._ib!'f]I!;QKm!"\Dqr;Zfu^&RU%!._ib!'f]I!:]pe!$CP,!.b"J^&RU%!._ib +!'f]I!9!eU!'ffL!5SO5!.V`_nG`K=^]4@!kl1Xur;ZhIli-tCr;Zg^^Am^&!._ib!'f]I!.b"J +lMgkRr;Zg>^Am^&!._ib!'f]Ir;ZfulMgkZr;Zg.^Am^&!._ib!'f`J!<2os!!DNd!;ucq!!g7< +nG`K=^]4@!l2Lb]r;Zg&lMgk`r;Zg"^Am^&!._ib!'f`J!;QKm!"\>or;Zfu^Am^&!._ib!'f`J +!;QKm!$CJ*!.b"J^Am^&!._ib!'f`J!:]pe!'f`J!5SO5!.Vc`nG`K=^]4@!l2LbQr;ZhIl2LbA +r;Zg^^]3g'!._ib!'f`J!9!eUkl1YPr;Zg>^]3g'!._ib!'f`J!9!hV!!2<`!;QKm!"ZjEnG`K= +^]4@!l2LbArVup#kl1Y\r;Zg&^]3g'!._ib!'f`J!9!hV!!h`f!<2os!!C"9nG`K=^]4@!l2LbA +rVup/kPtJ\!!0k7nG`K=^]4@!l2LbArVup?kPkO4r;aV4nG`K=^]4@!l2LbArVup_kPkOtr;ZhI +_#Np(!._ib!'f`J!9!hV!.X23!9!eU!'e:!nG`K=^]4@!l2LbArW)*\!:]pe!$B#VnG`K=^]4@! +l2LbArW)*\!;QKm!"ZmFnG`K=^]4@!l2LbArW)*\!;ucq!!g=>nG`K=^]4@!l2LbArW)*\!<2os +!!C%:nG`K=^]4@!l2LbArW)'[r;Zfu_#Np(!._ib!'f`J!9!hVjo5=2r;aY5nG`K=^]4@!l2LbA +rW)'[!5SO5!.VibnG`K=^]4@!l2LbArW)'[!9!eU!'e="nG`K=^]4@!l2LbArW)'[!:]pe!$B&W +nG`K=^]4@!l2LbArW)'[!;QKm!"ZpGnG`K=^]4@!l2LbArW)'[!;ucq!!g@?nG`K=^]4@!l2LbA +rW)'[!<2os!!C(;nG`K=^]4@!l2LbArW)$Zr;Zfu_>j$)!._ib!'f`J!9!hVjSo41r;a\6nG`K= +^]4@!l2LbArW)$Z!5SO5!.VlcnG`K=^]4@!l2LbArW)$Z!9!eU!'e@#nG`K=^]4@!l2LbArW)$Z +!:]pe!$B)XnG`K=^]4@!l2LbArW)$Z!;QKm!"ZsHnG`K=^]4@!l2LbArW)$Z!;ucq!!gC@nG`K= +^]4@!l2LbArW)$Z!<2os!!C+^L+ +mf*9;r;Zg"i;`i!!!9%rrD!V!;c]q_#"-#s7u]q&+9GtJGfHJ"5s4Krr@Sc!!*?( +mf3=ir;QcTrW)fp!5SI3n,EBPmr;QcTrW)fp!5SI3n,EC_ +qZ$U,n,ECcqZ$VGiW&EI!._lc!>"tn!!%NIrrD!V!;c]q_#"-#rrDuo!!!PurrDuo!!%N-s7$$g +JAD3d&,>Pm!.XtI!9!hVqYpQ2qZ-*b!;u]o!"\Pu!;u]o!.Wu-nG`K=_#OKHq!J+^5Q1T^i;N`Q +rrBk3!:Tpfr;-Ho&+BMur;-HoJ)UFsrr@Sc!!*W*mJm5OrVllUrW)fp!5SI3n,ECcqZ$U,n,EC_ +qZ$U\iW&EI!._lc!>"tn!!#7^rrD!V!;c]q_#"-#rrDuo!!!PurrDik!!#7Bs7$$gJAD3d&,>Pm +!'gG^!9!hVqYpQ2qZ-*b!;u]o!"\Pu!;QEk!'fHBnG`K=_#OKHq!J+^+8u3>i;N`QrrBk3!:Tpf +r;-Ho&+BMuq"k$k5N2Y3rr@Sc!!*W*mJm5/rVllUrW)fp!5SI3n,ECcqZ$U,n,EC_qZ$U\iW&EI +!._lc!>"tn!!",>rrD!V!;c]q_#"-#rrDuo!!!PurrDik!!#7Bs7$$gJAD3d&,>Pm!$D1>!9!hV +qYpQ2qZ-*b!;u]o!"\Pu!;QEk!'fHBnG`K=_#OKHq!J+^+8u3>i;N`QrrBk3!:Tpfr;-Ho&+BMu +q"k$k5N2Y3rr@Sc!!*W*mJm5/rVllUrW)fp!5SI3n,ECcqZ$U,n,EC_qZ$U\iW&EI!._lc!>"tn +!!",>rrD!V!;c]q_#"-#rrDuo!!!PurrDuo!!%N-s7$$gJAD3d&,>Pm!$D1>!9!hVqYpQ2qZ-*b +!;u]o!"\Pu!;u]o!.Wu-nG`K=_#OKHq!J+^+8u3>i;N`QrrBk3!:Tpfr;-Ho&+BMur;-HoJ)UFs +rr@Sc!!*W*mJm5OrVllUrW)fp!5SI3n,ECcqZ$U,n,ECcqZ$VGiW&EI!.`8n!!2us!<2rt!>"u) +!!#7ZrrE&q!!#7^rrD!V!;c]q_#"-#rrDuo!!!PurrE&q!9!nHrr@Sn!!!,ts8E!!&,?,(!'g;Z +!<2iq!'gG^!9!hVqYpQ2qZ-*b!;u]o!"\Pu!<2iqi;`EquHZp!9!hVqYpQ2qZ-*b +!;u]o!"\Mt!.b"J!!D0ZnG`K=bQ%VbqZ$d%huE`fq#16n5PY6YJG]EFrrD!V!;c]q_#"-#rrDuo +!!!Ptrr@TJ!!!8^s7$$gJBRun+8Z$A"5j.Z&,?,(!'g8Y!5SO5!!3#t!9!hVqYpQ2qZ-*b!;u]o +!"\Mtqu?^-i;`!!NJ_!!!Q)rVup_mJd1ErW(%>!5SO5 +!.Wl*nG`K=f)Pf#pAb!i"U!Z_!"\l(!!#7NrrD!V!6G0?JGfK(s7$$gJCaeos8)d""5j.Z&,?,( +!'flN!9!hVaT)2=!!1pUnG`K=fDkmPp&Fmh"U!Z_!"\l(!!#7NrrD!V!6P6@rqufs"5X"Hrr@T% +!!39&r:'aj"5j.Z&,?,(!'flN!9!hVao;A=r;Zg&h>d!E!.`]%!XJbpnGi^phuE`fq#16n5OJIN +i;N_urrDim!!!Pcs7$$gJCji'&-'H8!!NJ_!!!Q)rVup_mJd1ErW((?!:]pe!$C%snG`K=fDksp +s+'V>"U!Z_!"\l(!!#7WrrMToqYpQRrW)]m!<@W"rrD!U!!#7>s7$$gJCji&5QC3Q"U!Z_!"\l( +!!#7Ws8N'!J,B6G_#=?/rrVZi#M&hS_#465J)1.orr@T%!!.TKn,NUohuE`fq#16n5PP0[qu?^= +qu6YHrW)`n!l+d:ec,W"r;bXQnG`K=fDksPr9s[i"5j.Z&,?,(!'g5X"7Q9j#Q+Q"!;QTn!!%N" +s8;ot!Sm_Err@TH!<<'!^u>=q!WVra!!NJ_!!!Q)rVup_p\t?2!!!&trrE&s!;ZWpr;HZr+4pMm +rqufs"5NqGrr@TI!!=>Cs8M!X!X&Jln,NUohuE`fq#16n5PP0XJGoQHrrDuq!;ZWpq#16n&(gg] +r;?Tq#Mf@Krr@TJ!!!-"rrDQK!!3E*i:$^M"5j.Z&,?,(!'g5Xr;ZhIrVllmr;cZn!:]sf!!h-U +!;QKm!"[lbnG`K=r;Zg.rVllqirB,ks1n+("U!Z_!"\l(!!#7YrrE&s!!#7^rrDQe!;ZWpi;N]V +"5!PQnGN=e+5Hncrr@TJ!!%NHs5O(\+9-l\!!NJ_!!!Q)rVup_q#:?lr;Zg>rVllUr;cZn!5SR6 +!!1^O!9!eU!'f9=nG`K=rVup!qu6ZSj8]3Fs6fpk"5j.Z&,?,(!'g8Y!;QKm!"]&.!5SR6!!2oq +!.b"JfDbidr;ZhIh#HmD!.b%K!!iE$!;PUT!It+;!!NJ_!!!Q)rVup_q#:?`r;Zg&rVlkJrVup! +q>^?m!.WZ$!.b"Jg]-dC!.b%K#9X!G^]FK8ro=%[s8;_s7l$_"U!Z_!"\l(!!#7YrrBk,!!!,t +rrDup!!"+orrE&s!!!,Us7$$gJGoQKrr@TK!<<'!^ubUu"97lZ!!NJ_!!!Q)rVup_q#:?0oDejr +qYpQnqu?^=g&D'Mr;Zg&g]-dC"b6RQ!WW)r!!48Bi8t"@#QN`N!!NJ_!!!Q)rVup_q#:>EoDek% +qYpQjqu?^-g&D'Ir;Zg.g]-dC"b6RQ#QN`\!!39&puVPX&-'H6!!NJ_!!!Q)rVup_q#:>EoDek5 +qYpQjqu?^-g&D'Ar;Zg>g]-dC"b6RQ&-%1X!!3,tjo>H)s+'P<"U!Z_!"\l(!!#7Ys763j5PkB[ +nGE7d#MK+Wi;EWU5MQ5-rrdiP!$D4;!!,=`jo>EHs6]jj"5j.Z&,?,(!'g8Yo)Jc?qYpQbqu?^% +g&D&fr;ZhIg]-dC"FpIPJ,K0D!?_@(!!.TKmJmCmhuE`fq#16n5PbUHooDejnq>UHQqu?^!gA_0Pr;Zg"gAg[B +"FpISs+'qG!WVZQ!!39&nEp8["5j.Z&,?,(!'g;Z!<2Tj!!i?"!9!bT!!CsT!;ucq!!h6XnG`T@ +!!iQ"!!.TEkPtYhs5<;F"U!Z_!"\l(!!#7ZrrDuh!!!Q*rrBk4!!!&RrrDim!!!P`s7$$jJ,g,X +q#CF;r9++^&-'H5!!NJ_!!!Q)rVup_q>UHmoDek5q>UH1qu?]tgA_0Br;Zg>gAg[B"+U@nq"Xmj +&,tbm![%GmmJmCmhuE`fq#16n5Pb;!<`Ac!!.TK +r;Zg"q#C3k"U!Z_!"\l(!!#7ZrrDuh!;QQo_#+04!S[PRJGfK$s7$$jJ,k)7q#CHss+'>6!WW)r +!!!9!s8)d""5j.Z&,?,(!'g;Z!;uKi!!2lp!5SL4!!1gRr;Zfug&LRA"+UCOJG9*Fs1mn"!Wi>r +r;Zg.q#C3k"U!Z_!"\l(!!#7ZrrDui!!!,rrrBk4!!!&SrrE&s!!!,Ss7$$iJ-#]E!!.T-l2Ukf +s7#se!$D"9qZ$d%huE`fq#16n5Pb"tj +!!,=ar;ZfunG`XL!!!Q)rVup_q>UHoo`+uAq#:?Pqu?^!g]%8hr;ZhIg&LRA!e:gNpAb4!r9=7_ +J,]BH!!D`j"Mb!;&,?,(!'g;Z!<2Wkp\t6Oqu?^!g]%8(r;bLMnG`Q?&)d0^!<`8b!!3,tr;Zm( +s5<_R!!iB#"FpIP&,?,(!'g8Yp&G'np\t6_qu?^%g].3P!!1aPnG`Q?+5lkn!<`>e!!33$q#(0o +&-'HA!!!,ts8E!!&,?,(!'g8Yp&G'pp\t6_qu?^%h#@BRr;Zg"f`1I@!e;B.pAb3prp'Oc"97lh +!!48BJG9*EJ,]HKrUBdd!>"u)!!#7Yrr@TD!!!8urrDil!!!PbrrDuq!!!8Vs7$$iJ3UjD!!*-# +lMptks5=Hr;ZkJrqHHs!WW&us8Mrs!C-AY!!#7YrrBk/!!#7XrrDup!!"+rrrDQe!!"+ns7$$h +J:I4l!IoXd!!48BJGfHKs8;Wl"UG(C!$D7>!!,=ZrVup_q#:?0pAjpe!;u`p!$C"r!9!eU!'f-9 +nG`N>J+WdBIt6kc!C-V_!!33$q"Ogl&,uV0#Q+N$q#16n5PY6Yi;EWU"7cBkrql`r5MZ8=_#465 +J(XejrrIZLo`,"W_!D%%J,]BH!X&Jlp](F=qu?]tqu6ZkrVup_q#:?`r;Zg&nGiCd!.Wf(!.b"J +fDk@?!J(1B!!,="li7(dr;?Ts#QN`W!!,=RrVuqJr;QcdrVup_q#:?hr;Zg.nG`K=r;bUPr;Zfu +fDk@?!J11A!!+2"m/R1is7lNm!Y>=Hp](=Zi;N]V5Q(N]i;N]V5PY6Yr;?Tq+7T:1_#=<6!Sm\T +rqufs"5!SBrrI]Ko`,"7i9^LG#QO;l!!48BJG9*FJ&)$`!$D.=!5SR6!'g8Y!<2os!'fuQ!9!hV +!!D$V!;ucq!!h-UnG`N?r:L$j+5lMd!XJb`r;Zj_s7ZKos+((K!"]#-!.b%K!'g5Xr;ZhInG`LX +rVup'h#@BLr;Zg.fDk@?!J1%=!!*Vgm/R1us1nR5!It+D!!*-#r;Zg&r;Z]q!'g5X!.b%Kn,EC_ +rVup/h#@BDr;Zg>fDk@?!JC1?!!*W"m/R20s+(%J!WW)m!!*-"r;Zg"rVllsr;Zg^p\t?2!!!&g +rrDur!!"+rrrD!U!!#78s7$$hKD>*>!>"\e!!+2Ar;Zm"s7l?h!<`8u!!!&urrDuq!!#7Xrr_`j +!!hrlrVuqJh#@Air;ZhIfDk@?!JBn7!!*>om/R/Orqufu"97lc!!*2squH]q!;QKm!'g5X"8i-! ++7B.1^]4Dirr@TJ!7q2>rrIcAo`,!tnEg2V5Q(H[!XJb`p](="nFHV[J+ipB!!%N:rrVZi#M]:W +!!!&Ns7$$hKCJO6!=/,]!!,=Zr;Zm0s1nC0!=/,c!!%NBrrMTom/I(dJ)(&(rqufs"4mMArrIo5 +o`,!pq!A%^J+3C:!?_@9!!*Vgo)Q9"!;ucq!!h*TnG`NEi:R'N"8M6`!Is&+!!,=`pAb4)i:?rX +rrDim!!!P\s7$$hLZ%h*!<`,a!!.Sbr;ZkJr:^0l&&@f;!!0S/!:]pe!$BelnG`NEi:R'N"8M6` +!WTt6!!3,ppAb4)_"7U,"1S:1i;EWU5M#l(rrIo5o`,!pq!A%^s+((K!Wi>jpAb49JFigA#Ij^5 +_#465J(FYhrrIo5o`,!pq!A%^s+((K!X&J\pAb49JFigA&%DQ=JGfJus7$$hLVWQ_!'^#OMHk +!.Wi)!<2os!!CdOnG`NM_"@[.!W;?c![KQr;Zg& +ec5.=!KY%h!!*,umJm7gs8;ou5Q:?V!'g&Tp&>-l!!",/rrTt9!T!bUq#(0m&(U^LrrJ1ro`,!n +r9aOc!WW)u!It%@!!#7U!!!&mrr_`j!!hrlrVuqJhZ!TFr;Zg>ec5.=!KY%h!!*,umJm7gs8;ou +s7l9f!'g)U!!Doo"2Fm:!Up$gr;HZr+5["ti;EWU5Lof'rrJ1ro`,!nr9aOc!WW-!!Wi>jp&G(W +oDejrp&>#BrW)Ee!;QNn!"[rd!5SO5!.WQ!nG`NM_"@[.!W;?c!#BquHQm!<2Tj!"\#f!.b"Je,Sq;!JfV+!!*2smJm7gs8E!!#Q45p!>!!>!!",6rr@TI +!;ZWpr:Bsh&)dKd!!!&Ks7$$hLZ%h*!<`,b!!*-#rVus(r:L$j&)d-]!'g/VqZ$VGqYpQjoDejr +iVroWr;Zg"e,Sq;!JB>'!!*2kmJm7gs8E!!#Q45p!=.QV!!%NAs8)crJ,90FnFQ\\#N>[_r;?Tq +#Li_BrrIcAo`,!tnEp8W!WW-!!=/Pq!!*>opAb0op&>$kqZ$U\qYpQRoDejniVroQr;Zg.e,Sq; +!JBn7!!*>omJm7gs8E!!#Q45p!<_ic!!!8srrE&q!!#7[rrBk,!!!,[rrDQe!!"+is7$$hKCJO6 +!=/,^!!*-#rVus(r:L$j"8Mcon,ECeqZ$U\qYpPGoDejniVro9r;Zg^e,Sq;!JC1?!!*W"mJm7g +s8E!!#Q45p!Ie<[A5Ci/%!$iqZ$U$VrqcZq5Q(N]q!nCb"8DfqpuqbY"4@/$kqZ$U\r;Qcdnc/Xlp\t6_kl:\gdJr_9!e:g>pAb3rr9XIb +!WW-!!=/Po!!!Q/rrBk4!!#7VrrE&q!!#7]rrD!J!!!,qrrD!A!!!PWs7$$iJ.LT4!!*3"m/R.f +s8E!!#Q4/n!"])/!5SL4!'g,UqZ$VGr;Qc4nc/Xpp\t6/kl:]*dJr_9!e:OFpAb4!q!A%^!WW-! +!=/Po!!",?rrD!T!!#7Us8)crJ,Kf!!*-#rVus(r:Bsi5N)M@!C-)P!!#7UrrDuq!!",=rrD!U!;c]q_#=<6!VcToJE[%65LBH" +rr[cO+7T(+!=/Vj!!*-#rVus(r:BsiJ&)$`!?_+8!!#7UrrE&s!!#7]rrD!V!!!&rrrD!V!!!,q +s6'F_J'e5brr[cO&,>r#!>#+p!!*-#rVus(r:Bsis+((K!>#,,!!#7Ts8;otJ,K:li7%es8E!! +#Q45p!<`,p!!*&t!!#7Trr`0!!$D+_#=<65O&1Ji;N`BrrDin!!!P@s7$$gJGoNM5Q?95!<<)a!!*-#rVus(r:L$j +++X7h!>",f!!#7JrrD!V!:0Xbq#16n+1hLArr@TK!!aVGn,NFns8M9`!_rVup_o)J^i!.XnG +!9!hVq#:Eb!!i8u!;QNn!'e'pnG`K=r;Zg.rVllqkl:_bs8E!!#Q45p!'g>\!=.Q^!!#7Trr`0! +!$D+\!=/,n!!#7T +rr_`j!!iE$!9!hVq#C\!=/,n +!!#7Ts8;otJ,K-!WW-!!=/Pq!!#7\!!*>orVup_ +o`"pjr;Zg^r;QcTrW)co!9!hV!!E#r!;QNn!'e'pnG`K=hZ*ZXs8E!!#Q45p!$D(UGFr;cWm!;QNn!'e'pnG`K=hZ*ZXs8E!!#Q45p!?Zji!!*VgrVup_o`"p\ +r;Zg&r;QcTrW)coqu?_Hq>UHirVup_])V:"!.`r,!UHirVup_])V:"!.`r,!UHirVup_])V:"!.`r,!UHirVup_])V:"!.`r,!!!D!!+1WrVup_o`"oAquHZp +!9!hVqYpQjqu?^-q>UHirVup_])V:"!.`r,!UHirVup_])V:"!.`r,!UHirVup_])V:"!.`r,!$VrqcZq5Q1T^i;N`Q +rrD!T!!!,srrDin!!#6ps7$$gJDU>-!WW-!!=/Pq!!*2squ?`sr;Zg^p&>$kqZ$U\rVllUrW)fp +!9!bT!!E&s!;QNn!'e'pnG`K=hZ*ZXs8E!!#Q45p!UHirVup_])V:"!.`r,!!9!hVqYpQ2 +qu?]tq>UHirVup_])V:"!.`r,!i;N`QrrBk4 +!!!&qrrDin!!#6ps7$$gJDU>-!WW-!!=/Pp!!.S"rVus0q#(0m5PtH\i:R'M+8u3>i;N`QrrBk4 +!!!&qrrDin!!#6ps7$$gJDU>-!WW-!!=/Pp!!,="rVus@nGN=e5PtH\_"@[-+8u3>i;N`QrrBk4 +!!!&qrrDin!!#6ps7$$gJDU>-!WW-!!=/Pp!!,=BrVus`i;EWU5PtH\JFrmB+8u3>i;N`QrrBk4 +!!!&qrrDin!!#6ps7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655PtKQ!!",>rrD!V!;c]q_#+04 +!Vu`qq#16n5J$marr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7]rrE&j!!",>rrD!V!;c]q_#+04 +!Vu`qq#16n5J$marr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7]rrDuh!!",>rrD!V!;c]q_#+04 +!Vu`qq#16n5J$marr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7]rrDid!!",>rrD!V!;c]q_#+04 +!Vu`qq#16n5J$marr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7]rrDQ\!!#7^rrD!V!;c]qi;-!WW-!!=/Pp!!+22rVutK_#4655Q1T^q""L`rrD!V!;c]qq"t*l&,Q;+q#(0m +5J$marr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7^rrDQ\!!!&trrD!V!;c]qr;6Np+8Z!;nGN=e +J%G[Lrr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7^rrD!L!!!&trrD!V!;c]qr;6Np+8Z!;i;EWU +J%G[Lrr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7^rrBk,!!!-!rrD!V!;c]qrql`r5PkB[_#48D +s7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q1T^JFigA#Q4T%i;N`Ps82isJ,90FJGfJYs7$$g +JDU>-!WW-!!=/Pp!!+22rVutK_#4655Q1WR!!!Q-rrD!V!;ZWpJGfKDs8;ot!P/7"rr@T,!!*-# +rVus(r:Bsi+7T70!Iqo`!!#7_rrE&i!!",=rrD!V!;ZWp_#=<6!W)frrqufs"1eI$rr@T,!!*-# +rVus(r:Bsi+7T70!Iqo`!!#7_rrDug!!#7]rrD!V!;ZWpi;N]V"8`#tr;?Tq#J'm(rr@T,!!*-# +rVus(r:Bsi+7T70!Iqo`!!#7_rrDic!!%NHrrD!V!;ZWpnGWCf#Q"H#q#(0m&%V`0rr@T,!!*-# +rVus(r:Bsi+7T70!Iqo`!!#7_rrDic!;lcri;N`PrrDin!!!Q+rrDQe!!"+Os7$$gJDU>-!WW-! +!=/Pp!!+22rVutK_#4655Q:Z_nFQ\\!W2lsi;N`PrrDur!!",;rrD!U!!#6os7$$gJDU>-!WW-! +!=/Pp!!+22rVutK_#4655Q:Z_nFQ\\#Q+N$i;N`Os8DuuJ,90F_#465J%>UKrr@T,!!*-#rVus( +r:Bsi+7T70!Iqo`!!#7_rrD!U!;lcuqu?^=qu6ZSrW)`n!l+d:q>UGFr;aA-nG`K=hZ*ZXs8E!! +#Q42o!?^h1!!.Sbr;Zg^rr2uVrVup!qZ$Qq!.XnG!9!hVq#:Eb!!i?"r;Zfu\Gu'u!.`r,!nG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sb +r;Zg^rr2uVrVup?nc&U)rW)Bd!:]pe!$A`NnG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sbr;Zg^rr2uV +rVup_nc&T>rW)Bd!9!eU!'e!nnG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sbr;Zg^rr2uVrVuqJnc/Of +mf*:&r;ZhIp\t9`#K6Z3rr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V!:g'hrquibrr@TJ +!;?Hm!!%Mfs7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`HrrDuq!:Kmc!!!&orr`0! +!$B2[nG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sbr;Zg^rr2uVrW)co!Up?krrDim!;HKo!.XnG!<2os +!!Duq"7Q9j#K?`4rr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V!;ZZp!!%NHrrDQe!;QQq +n,N^jrrDuq!!!8urr^%:!!1(=nG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sbr;Zg^rr2uVrW)fp"8i-! ++8l-=i;EZNrrTt9!W2lsq#(0m&,6)(JGoPfs7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_ +i;N`Qrr_`j!!iH%!5SR6!!2lprVuqJr;Qcdr;Zg>p](0l!.W#gnG`K=hZ*ZXs8E!!#Q42o!?^h1 +!!.Sbr;Zg^rr2uVrW)fp"2Fm:!W;rtJGoNK!Vu`qr;HZr+8l-=i;EWU5PY6Yrqufs5K<`mrr@T, +!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V!;c]qJGoQHs8;ot"8Vrsq#16n&,cG-_#465J,'$D +r;?Tq+3+?Mrr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V!;c`o!!%NJrrE&s!!!,srrDQf +!!!9%rr@TJ!;HKnq#(0m&'"Y=rr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V!;lcrrqufs +5Q:Z_r;?Tq#PnB"i;N]V"8r2t!!!&orrDQe!!!8Ds7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#465 +5Q:Z_i;N`RrrDuq!!",?rrDim!!!Q*rrBk6!!!&urrE&s!!!,qrrD!U!!!,@s7$$gJDU>-!WW-! +!=/Pp!!+22rVutK_#4655Q:Z_i;N`RrrDid!!",:rr@TA!!!8urrBk+!!%Mqs7$$gJDU>-!WW-! +!=/Pp!!+22rVutK_#4655Q:Z_i;N`RrrDQ\!!#7Zs763j&,6)(_".O++41&Wrr@T,!!*-#rVus( +r:Bsi+7T70!Iqo`!!#7_rrD!V!;lcri:I!LJ,90Frpp*i+8>d8JF`a@#LNM?rr@T,!!*-#rVus( +r:Bsi+7T70!Iqo`!!#7_rrD!V!;lcr_"7X&rrDug!!#7Xrr@T@!!!,Js7$$gJDU>-!WW-!!=/Pp +!!+22rVutK_#4655Q:Z_i;N`RrrBk-!!!&qrrDug!!%NCs7--i!RUl9rr@T,!!*-#rVus(r:Bsi ++7T70!Iqo`!!#7_rrD!V!;lcrJFrmB"8Vrsq""LZs7$*9s7$$gJDU>-!WW-!!=/Pp!!+22rVutK +_#4655Q:Z_i;N`Rrr@TB!!!9"rrDid!!!&orrE&g!!%Mrs7$$gJDU>-!WW-!!=/Pp!!+22rVutK +_#4655Q:Z_i;N`Rs7?9k&,H5*nFQ\\"8Dfqrp]sg5LKN#rr@T,!!*-#rVus(r:Bsi+7T70!Iqo` +!!#7_rrD!V!;lfg!!",:rrDQ\!!!8urrE&g!!"+gs7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#465 +5Q:Z_i;N`SrrE&j!!#7ZrrD!L!!!Q(rrE&g!!!PWs7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#465 +5Q:Z_i;N`SrrE&j!!%NErrD!L!!",8rrDue!!!8Os7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#465 +5Q:Z_i;N`SrrE&j!;QQoi:I!L5PP0Xr:'ae"4@/-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`S +rrDuj!!!&orrBk-!!%NBrrE&f!!!&Js7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`S +rrDuj!!!,qrrBk-!;6?lrpKj8s7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`SrrE&l +!!!8urrD!N!!!&mrrE&e!!%Mts7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`SrrE&l +!!!Q(rrD!N!!!,ns6fpf5L]Z%rr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V!;uisrq6d8i:[-N#PA&b!!"+is7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`SrrE&l!!#7X +rrD!N!!!Q%rr@T=!!!PYs7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`Rs7QEmJ+rsC +nFch^+8#R5JFEO=#Li_Brr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V!;lfj!!!&nrrDQ^ +!!%N@rrBk(!!!,Ms7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`Rrr@TE!!!8trrDig +!!!&krrBk(!!!&Ks7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`Rrr@TI!:g'hq"t*l +&+9Gti;EWU"8VrsJGfJss7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`RrrBk5!!!&i +rrDup!!",/rrDQe!!!9"rrBk5!!%Mus7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`R +rrBk5!!!&irrDup!!",/rrDim!!!Q*rrD!U!!#75s7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#465 +5Q:Z_i;N`RrrD!U!!!,krrE&r!!#7OrrDuq!!",:rrDQe!!#75s7$$gJDU>-!WW-!!=/Pp!!+22 +rVutK_#4655Q:Z_i;N`RrrDQe!!!8ns82isJ+!=:rqufs5Pb[rr@T,!!*-#rVus( +r:Bsi+7T70!Iqo`!!#7_rrD!V!;lcrq#(0m&+KT!JGfK7s8;otJ,0*Er;?Tq+4U>[rr@T,!!*-# +rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V!;lcrr;?Tq+7T:1_#=<6!UTgdJGoQDrrE&s!!!PZs7$$g +JDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`RrrE&s!!#7QrrD!V!!!,frr^%:!!2ior;Zg. +eGo%^Hp!.XG:!q60pli.(&!!!&orrDur!!!PZs7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_ +i;N`PrrMTom/I(dJ*[+:^]4?8p\t6mrVup/eGo%-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`!rr^%: +!!2io!<2rt!"[TZnG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sbr;Zg^rr2uVrW(+@"2Fm:!VcTorr)lt +&(LXKrr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V!6Y-!WW-!!=/Pp +!!+22rVutK_#4655Q:Z_i;N`!rr^%:!!2io!<2rt!"[TZnG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sb +r;Zg^rr2uVrW(+@"2Fm:!VcTorr)lt&(LXKrr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V +!;ZWqn-A=[!<@W8rr^%:!!2io!<2rt!"[TZnG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sbr;Zg^rr2uV +rW)corr<%Kmf*@X!!hii"2Fm:!VcTorr)lt&(LXKrr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_ +rrD!V!;c]tqu?^=mf*@(!!2Ec"2Fm:!VcTorr)lt&(LXKrr@T,!!*-#rVus(r:Bsi+7T70!Iqo` +!!#7_rrD!V!;c]tn,NFnmf37d!.XA8"2Fm:!VcTorr)lt&(LXKrr@T,!!*-#rVus(r:Bsi+7T70 +!Iqo`!!#7_rrD!V!;c]t^]4?8n,ECcrVup?m/I1'!!!&orrE&t!!!PZs7$$gJDU>-!WW-!!=/Pp +!!+22rVutK_#4655Q:Z_i;N`Qrr@TK!:Tpfq#16n&+';u^]4?8p\t6mrVup/eGo%nG`L(rVup!m/I1'!!!&o +rrE&t!!!PZs7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`RrrDim!!!Q+rrMU2q>UGF +r;c3a"2Fm:!VcTorr)lt&(LXKrr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V!;lcrnGN=e +#Q"H$^^']8qu?_HmJd:(!!!&orrE&t!!!PZs7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_ +i;N`RrrD!U!!!,trrE*#qYpQpqu?^]mJd:(!!!&orrE&t!!!PZs7$$gJDU>-!WW-!!=/Pp!!+22 +rVutK_#4655Q:Z_i;N`RrrBk+!;c]qr;6Np+79(1^]4?8p\t6mrVup/eGo%- +!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`Rrr@T@!!#7\rrDil!!!Psrr^%:!!2io!<2rt!"[TZ +nG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sbr;Zg^rr2uVrW)iq!.aY@!$D+-0!!!&orrE&t!!!PZs7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`SrrE&h!!!,u +rrD!L!!!,orr^%:!!2io!<2rt!"[TZnG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sbr;Zg^rr2uVrW)lr +!<2Nh!!2us!9!JL!!2cm"2Fm:!VcTorr)lt&(LXKrr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_ +rrD!V!;uisrp^!crrD!K!;6?o^]4?8p\t6mrVup/eGo%-!WW-!!=/Pp!!+22 +rVutK_#4655Q:Z_i;N`SrrDue!!#7]rrBk+!!#7Wrr^%:!!2io!<2rt!"[TZnG`K=hZ*ZXs8E!! +#Q42o!?^h1!!.Sbr;Zg^rr2uVrW)lr!;u?e!$D.=!5S1+!$Cq7"2Fm:!VcTorr)lt&(LXKrr@T, +!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V!;uisr:'ae&,cG-_".O+&,-#*^]4?8p\t6mrVup/ +eGo%-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`SrrDue!!!-!rrBk+!!!,p +rr^%:!!2io!<2rt!"[TZnG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sbr;Zg^rr2uVrW)lr!;u?e!!3#t +!5S1+!!2fn"2Fm:!VcTorr)lt&(LXKrr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V!;uis +r9s^arrBk*!;?Ep^]4?8p\t6mrVup/eGo%p\t?2!!!&orrE&t!!!PZs7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#465 +5Q:Z_i;N`SrrDud!!#7^rrBk*!!#7Xrr^%:!!2io!<2rt!"[TZnG`K=hZ*ZXs8E!!#Q42o!?^h1 +!!.Sbr;Zg^rr2uVrW)lr!<2Hf!$D1>!9!DJ!$Ct8"2Fm:!VcTorr)lt&(LXKrr@T,!!*-#rVus( +r:Bsi+7T70!Iqo`!!#7_rrD!V!;uisrpTmf&,lM.i:6jJ&,6)+^]4?8p\t6mrVup/eGo%-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`SrrE&f!!!-"rrD!J!!!,qrr^%:!!2io +!<2rt!"[TZnG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sbr;Zg^rr2uVrW)iqn,NFhrVllenc/Xlp\t?2 +!!!&orrE&t!!!PZs7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`Rs6fsdrrDQZ!!!&o +rr^%:!!2io!<2rt!"[TZnG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sbr;Zg^rr2uVrW)iq!.aP=!.Y"J +!;Q*b!!2io"2Fm:!VcTorr)lt&(LXKrr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V!;lcr +JFEO=5Q:Z_q!e@Yrr^%:!!2io!<2rt!"[TZnG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sbr;Zg^rr2uV +rW)iq!5S((!$D4?!;u?ep\t?2!!!&orrE&t!!!PZs7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#465 +5Q:Z_i;N`RrrBk(!!!Q/rrDue!;HKq^]4?8p\t6mrVup/eGo%^Bn!!3&u!.aV?p\t?2 +!!!&orrE&t!!!PZs7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`RrrDuq!!",:rr@TJ +!<)ot_#=<6!W)frJGoQCrr^%:!!2io!<2rt!"[TZnG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sbr;Zg^ +rr2uVrW)iq!<2os!'g;Z!5SO5!.Y"J!9!hV!!E)t!5SR6p\t?2!!!&orrE&t!!!PZs7$$gJDU>- +!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`Qs8;otJ,0*Ei;EWU5Q:Z_nGWCf#Q"H#i;N`Nrr^%: +!!2io!<2rt!"[TZnG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sbr;Zg^rr2uVrW)fp!.b%Kq#:?`r;Zg> +rr2unrVup/qYpQRrW)]m"2Fm:!VcTorr)lt&(LXKrr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_ +rrD!V!;c]t^]4?8q#:?hr;Zg.rr2urrVup?qYpQRrW)]m"2Fm:!VcTorr)lt&(LXKrr@T,!!*-# +rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V!;c]tn,NFnq#:?lr;Zg&rVuis!.XkF!9!hVp\t?2!!!&o +rrE&t!!!PZs7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`Qrr`0!!$D"9!<2os!!E3" +!l+d:q>UHQrW)]m"2Fm:!VcTor;HZr#LreCrr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V +!;ZZp!!%NCs8;ot!WE$"n,N^hrrD!V!;HKq^]4?8p\t6grVup#eGo%UKb#PS/tJGfKGrrE+Lq>UHQrW)]m"2Fm:!VcTonGWCf!S%/=rr@T, +!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V!:9^c_#465J+N[?i;N`Nrr^%:!!2io!9!eUeGo%< +!.`r,!-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`Bs8;ot +!V?-!WW-!!=/Pp!!+22rVutK +_#4655Q:Z_i;N`Ps8N'!J+imB_#46:J,fQ- +!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`Qrr`0!!$Cq7!9!eU"[E%e^]4E2rrD!V!;HKq^]4?8 +q#:?hqu?^!ec5.=!.`r,!rr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V!;c`o!!%NCrrE&s!!39&nGWCf#Q"H# +i;N`Nrr^%:!!2lp!:]md!!1XMnG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sbr;Zg^rr2uVrW)iq!<2os +!'g2Wr;Zm"s5-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`RrrDQe!!!8trrD!U!!#7]!!%NG +rrD!V!;HKq^]4?8q#:?PqZ,1HnG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sbr;Zg^rr2uVrW)iq!9!eU +!!Drp!:]pe!$;%-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`Rrr@TE!!!,urrE&m!!!Q,rrD!V!;HKq^]4?8 +q#:?PqZ,1HnG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sbr;Zg^rr2uVrW)iq!.ahE!!2rrpAb1(qu6ZS +rW)]m"2Fm:!VlZpi;3N)s7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`Rs7QHhrr@TE +!!!9$rrD!V!;HKq^]4?8q#:?`qu?]tec5.=!.`r,!-!WW-!!=/Pp!!+22rVutK +_#4655Q:Z_i;N`SrrE&l!!#7\rrD!P!!!,urrD!V!;HKq^]4?8q#:?`qu?]tec5.=!.`r,!rr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V!;uisrq6-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_ +i;N`SrrDuj!!!,urrE&n!!!&srrD!V!;HKq^]4?8q#:?lqu?^%ec5.=!.`r,!- +!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`SrrDui!;c]qJGB0F!W2lsi;N`Nrr^%:!!2lp!<2lr +!"[W[nG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sbr;Zg^rr2uVrW)lr!;uKi!.XnG!5SC1!!2us!9!hV +p\t?2!!!&prrE&r!!!P[s7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`SrrDui!!#7\ +rrD!Q!!!&srrD!V!;HKq^]4?8p](-k!$BbknG`K=hZ*ZXs8E!!#Q42o!?^h1!!.Sbr;Zg^rr2uV +rW)lr!;uKi!$D+-!WW-!!=/Pp!!+22 +rVutK_#4655Q:Z_i;N`SrrDui!!!Q,rrDii!!!&srrD!V!;HKq^]4?8p\t6/r;ZhIec5.=!.`r, +!-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`SrrDui!!!,urrE&o!!!&srrD!V +!;HKq^]4?8p\t6_rVup!eGo%-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_ +i;N`SrrE&j!;c]qJGK6G"8i)ui;N`Nrr^%:!!2io!;ufr!!h$RnG`K=hZ*ZXs8E!!#Q42o!?^h1 +!!.Sbr;Zg^rr2uVrW)lr!<2Tj!.XnG!5SF2!!E,u!9!hVp\t?2!!!&orrE&t!!!PZs7$$gJDU>- +!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`SrrE&j!!#7\rrD!R!!!,urrD!V!;HKq^]4?8pAY5F +!!#75s7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#4655Q:Z_i;N`Rs7?9k+8c'rr@T,!!*-#rVus(r:Bsi+7T70!Iqo`!!#7_rrD!V!;lcr +JFrmB#Q+N$r;$Bn&,ZA,i;N`Nrr^%:!!2cm!J!D`s7$$gJDU>-!WW-!!=/Pp!!+22rVutK_#465 +5Q:Z_i;N`Rrr@TB!!!,urrE&p!!!Q,rrD!V!;HKq^]4?8`W,H-!.`r,!rr2unr;Zg.q>UH1rVup!qYpQRrW)]m"2Fm:!QG*.rr@T,!!+2"r;Zj_i:R'N+7T70!Iqo` +!!#7_rrD!V!;lcrrqufs5Q:Z_r;?Tq#PnB"i;N]V"8`#ti;N`Nrr^%:!!1(=nG`K=hZ*[A_#466 ++7Sq'!?^h1!!.Sbr;Zg^rr2uVrW)fpr;ZhIrr2utr;Zg"q>UHarVup'qYpQRrW)]m"2Fm:!QG*. +rr@T,!!,<7r;Zj/nFZb^+7T70!Iqo`!!#7_rrD!V!;c]qJGoQHs8;ot!Vu`qq#16n&,Q;+i;N`N +rr^%:!!1(=nG`K=hZ*Y+qu?a&q"4Uf+7T70!Iqo`!!#7_rrD!V!;c]t^]4?8r;QbIr;cZn!;ufr +!$D(;!9!hVp\t?2!!!&=s7$$gJDU>,J,B9I#Pdrl!?^h1!!.Sbr;Zg^rr2uVrW)fp"7Q9j#Q4T% +_#465J,0-D!!%NFrrD!V!;HKq^]4?8`W,H-!.`r,!<2lr!<`8m!!+22rVutK_#4655Q:Z_i;N`Q +rr`0!!$D.=!9!eU!'g;Z!l+d:q>UHQrW)]m"2Fm:!QG*.rr@T,!!*#r!!*3"o`,"7nGWCgJ&)!_ +!'gJ_!9!hVq>^Hp!.XqH!:]pe!$D%:!q60pq>UHQrW)]m"2Fm:!QG*.rr@T,!!)rp!!*,uo`,"7 +nGWCgJ&)!_!'gJ_!9!hVq>UKb#Q+N$q#(0m&,?/*!.XhE!9!hVp\t?2!!!&=s7$$gJDU>,r;6Nq +!W;Tj!?^h1!!.Sbr;Zg^rr2uVrW)Kg!;ucq!!hrl!9!hVp\t?2!!!&=s7$$gJD^D.!VlNl!<2Wk +!?^h1!!.Sbr;Zg^rr2uVrW)Kg!<2os!!DZh!9!hVp\t?2!!!&=s7$$gJD^D.!VlNl!<2Wk!?^h1 +!!.Sbr;Zg^rr2uVrW)Hfr;Zfumf*:FrW)]m"2Fm:!QG*.rr@T-!!*,qqZ$Wqo`,"7nGWCgJ&)!_ +!'gJ_!9!hVnG`K=r;c9c!9!hVp\t?2!!!&=s7$$gJD^D.!VlNl!<2Wk!?^h1!!.Sbr;Zg^rr2uV +rW)Hf!5SO5!.XJ;!9!hVp\t?2!!!&=s7$$gJD^D.!V#sd!.OS@!?^h1!!.Sbr;Zg^rr2uVrW)Hf +!9!eU!'frP!9!hVp\t?2!!!&=s7$$gJD^D."7Z0f!.OS@!?^h1!!.Sbr;Zg^rr2uVrW)Hf!:]pe +!$C\0!9!hVp\t?2!!!&=s7$$gJD^D."7Z0f!.XYA!?^h1!!.Sbr;Zg^rr2uVrW)co!Up?jrrDim +!!!Q*rrE+Lq>UHQrW)]m"2Fm:!QG*.rr@T-!!*2kqZ$VGo`,"7nGWCgJ&)!_!'gJ_!9!hVq>^Hp +!.XnG!;ucq!!iB#!q60pq>UHQrW)]m"2Fm:!QG*.rr@T-!!*2kqZ$VGo`,"7nGWCgJ&)!_!'gJ_ +!9!hVqYpZq!!",,r;6Nq!W;Tj!?^h1!!.Sbr;Zg^rr2uVrW)iq!9!eU!!E)tnc/YSqu6ZSrW)]m"2Fm: +!QG*.rr@T,!!)rp!!*,uo`,"7nGWCgJ&)!_!'gJ_!9!hVqu6Z3q#CC*rr2tKo)Jb4qu6ZSrW)]m +"2Fm:!QG*.rr@T,!!*#r!!*3"o`,"7nGWCgJ&)!_!'gJ_!9!hVqu6Z3q#CBsrr2u6o)Jb4qu6ZS +rW)]m"2Fm:!QG*.rr@T,!!%KG!!*2so`,"7nGWCgJ&)!_!'gJ_!9!hVqu6YHp]1,J,B9I#Pdrl!?^h1!!.Sbr;Zg^rr2uVrW)iq!.ahE"+U@NnFHV[ +&,ZA,i;N`Nrr^%:!!1(=nG`K=hZ*X@qu?a&nFZb^+7T70!Iqo`!!#7_rrD!V!;lfj!!>Ics7l0c +!!iE$!9!hVp\t?2!!!&=s7$$gJDU>-5Ci\4!>"\m!!,=RrVutK_#4655Q:Z_i;N`Rs7ZKq+92B= +o)Jaqqu6ZSrW)]m"2Fm:!QG*.rr@T,!!+1Wr;Zj?i:R'NJ+3F;!Iqo`!!#7_rrD!V!;uisrq?Bp +&-)\/o)Jamqu6ZSrW)]m"2Fm:!QG*.rr@T,!!+2"r;Zj__"@[.s7$!f!Iqo`!!#7_rrD!V!;uis +rq?Bm#QFbp!!!,urrD!V!;HKq^]4?8`W,H-!.`r,!>"\u!!.Sbp&G-ps7$!f!Iqo`!!#7_rrD!V +!;uisrq?Bm"9/<#JFigA"8i)ui;N`Nrr^%:!!1(=nG`K=hZ*Z^q#(0ns+'eC!X&JlrVutK_#465 +5Q:Z_i;N`SrrE&m!!!'!rrBk,!!!,urrD!V!;HKq^]4?8`W,H-!.`r,!<`9!!!*-#o`,$us5d`Z +^]4?Vr:L$j5QCZ^!Is&+!!#7_rrD!V!;uisr:U*m+92B=oDejlqu6ZSrW)]m"2Fm:!QG*.rr@T+ +!!RlA!!%NDo`,#BrquftJ)L8*!'gJ_!9!hVr;Qcpp&G1*s8W)j!!!&srrD!V!;HKq^]4?8`W,H- +!.`o+"X!XB!WV*N!!3,tr;ZkJ_#4655Q:Z_i;N`SrrDuj!!!9's7?9k!W2lsi;N`Nrr^%:!!1(= +nG`K=h>d]is1f`V_"Ia0!WVrn!!.Sbr;Zg^rr2uVrW)lr!;uNj!!E6#!.a_B!!2us!9!hVp\t6/ +rW'q;nG`K=h>dN\rVlkJp&G-rs7#se!Iqo`!!#7_rrD!V!;uisr:U*j!WN*!_"@[-!W2lsi;N`N +rrBk6!!%Mgs7$$gJDL8+!WN*!rq-6m#QN`\!!3,8r;Zg^rr2uVrW)lr!;uKirr2ufo`+smqu6ZS +rW)]m!5SR6!'eL'nG`K=h#RHS!;uKi!Y>=Hr;ZluJGfHJ5Q:Z_i;N`SrrE&k!!@`Ns8;Ni!!E,u +!9!hVp\t6/rVup?`rGQ.!.`l*"$chci:R'O+9-lj!!33$JGfHJ5Q:Z_i;N`SrrE&k!!#7YrrD!T +!!!,urrD!V!;HKn_#=<6&'"Y=rr@T*!!p!C-V_!!33$q"t*l5Q:Z_i;N`RrrD!U!!p!It+I!!39&q"t*l5Q:Z_i;N`RrrDQe!!Er;c]o!9!hV!.XbC +r;Zfua8bZ/!.`Aq!Wi>rr;Zm0s1nO4!'gJ_!9!hVqu6Zor;ZpAs8W)s!!!,rrrBk6!!!&rrrD!V +!!#7Xrr@TJ!6>-/rr@Sq!!39&nGN=g+9-lh!!#7_rrD!V!;lcrrqufs5Q:]]!!!&prrD!V!!!,t +rrD!V!!",8rrBk5!!%Mis7$$gJBn2s#QN`\!!,=aqZ$U\rr2uVrW)fpr;ZhIrr2tKr;cWm!:]sf +!!iB#!9!hV!"\i(!9!eU!'eR)nG`K=cN""Ws1nR5!It+G!!#7_rrD!V!;c]qJGoQIrrBk5!!%NE +rrDin!!!Q+rrD!V!!!8urrDQe!!"+^s7$$gJBn2s+9-li!!3,tqZ$U\rr2uVrW)fp"2Fm:!WE#u +i;EWU5PbrrDim!!!Q)rrTt9!Vu`qi;EZMrrE&s!!!,Bs7$$gJBn2rs8;fq!XJb`qZ$U\rr2uV +rW)corr<%KrVllqr;Zg&q#:Eb!!i?"!:]pe!.XbCr;ZfuaT(c0!.`Dr!Wi>rr;Zm0s1nL3!'gJ_ +!9!hVq>UKb#Q4T%rqufs"8Dfr!.XhE!:]pe!'g5X!.b"JaT(c0!.`Dr!X&Jlr;Zm@s+'tH!'gJ_ +!9!hVnc/Of!!2Ke!;QKm!$Ct8!5SO5!.W,jnG`K=ci=+Ps5^L[rr2uVrW)Kg!5SO5!.XG:!;ucq!!i8u +!:]pe!$B>_nG`K=ci=+hs+(%J!WW)o!!#7_rrD!V!:g'hi;EWU5OSOOrqufs"8Dfqq#(0m&'=k@ +rr@Sr!!,=ar;Zm"s7lEj!'gJ_!9!hVnc&UYr;Zg>mJm+b!!2io!;ucq!!gXGnG`K=ci=)rrqufu +"97le!!#7_rrD!V!:g'hq#(0m&+0AsJGfKBrrE&s!!!,Cs7$$gJC"8ss8;fq!XJb`q>^L[rr2uV +rW)Kg!;ucq!!hok!5SO5!.XbCr;ZfuaoCl1!.`Gs!Wi>rr;Zm0s1nI2!'gJ_!9!hVq>UKb#Q+N$ +rqufs"8Mls!.XeD!9!eU!'g5X!.b"JaoCl1!.`Gs!X&Jlr;Zm@s+'qG!'gJ_!9!hVq>^Hp!.XnG +r;Zfuq>UNc!!i=Hr;ZkJrqQNo5Q:Z_i;N`Qrr_`j +!!iE$!5SO5!.XkFrVuqJq>UHmr;Zg&p\t6_r;Zg>b5^u2!.`Gs![%Gmr;Zlur:pUHm +q>^L[qYpQbqZ$U\c2[;5!.`Jt![%Gmr;Zlur:g6l5Q:Z_i;N`RrrBk5!!!&srrD!U!!#7^rrDup +!!",:rrE&p!!!Q+rrDik!!!PSs7$$gJC4Du5QCZ^!Wi>rp](:Yrr2uVrW)iq!5SO5!!2us!:]pe +!$D1>!;u`p!$D"9q>^KtqYpQnqZ$Tuc2[;5!.`Jt!It+I!!39&nFut`5Q:Z_i;N`Rrr@TI!;lcr +q#(0m&,lM.q"t*l&,?/)JGT^9kc2[;5!.`Mu!Wi>rr;Zm0s1nC0!'gJ_!9!hVqu?Nn +!.XqH!<2os!!E3"!:]md!!i[!5SI3!'ed/nG`K=df9FSs5rr2uVqu?^!p]('i!!E)t!;u]o +!!COHnG`K=df9Durqufu"97lb!!#7_rrD!V!;uisr;-Ho+8c'^!!#7_rrD!V!;uisr;-Ho+8c'g?k!9!_ScN!D6!.`Q!!XJb@r;ZkJrq6pnG`K=e,TO\s+(%J!WW)k!!#7_rrD!V!;uis +r;-Ho+8Z!;i;EWX5QCc!qu?]tp\t6mq>^MFqYpQjqZ$VGciIcs1nO4!!2fnq>^MFqYpQnqZ$VGciCs1nO4!!2fn!.aqH!.XkF!;u]o!.W>pnG`K=e,TN!r;?Ts +#QN`U!!#7_rrD!V!;uisrqcZq5PkB[r;?Tt+92B!qu?^!pAY-.qZ$U\qYpQjqZ$U\ci[!;QEk!'eg0 +nG`K=eGoXOs7#se![%Gmp&G(Wrr2uVrW)lr!<2iq!'g;Zr;Zp1s8V$T!!!,prrDQc!!#7[rrDik +!!#70s7$$gJCOW$"97=Ho`+tVrr2uVrW)iq +!5SO5!!2lp!<2rt!tYG3r;6Np+85^7r;-HoJ,90Fr;-HoJ'\/arr@T#!!33$nGN=g+9-la!!#7_ +rrD!V!;lcri;EWU"8Mlrrr)m"&-)\/qu?^]pAY-jqZ$VGqYpQnqZ$VGcipnG`K= +ec5a^s+(%J!WW)i!!#7_rrD!V!;lcrr;?Tq+8Gj9rr)lt&,uS/_#=<6!VQHmrqc]krrE&q!7(W6 +rr@T#!!+2Ar;Zm"s7l3d!'gJ_!9!hVqu6Zqr;Zg^q#:?nrVup/rr2uVrVup#p&>$kqZ-Hl!<2iq +cN!D6!.`W#!C-S^!!39&nFQ\\5Q:Z_i;N`Qs8;otJ,'$Drr)lt&,uS/nGWCf#PA&o!!!&ps82is +!RC`7rr@T#!!.TIr;Zm(s5Er;Zg"cN!D6!.`Z$!Wi>jr;Zm@s+'_A!'gJ_!9!hV!.XnG"7Q9j#P\5urr)lt&,lP-!!%N@ +rr@TJ!!!,rrr@TJ!!!,Hs7$$gJCac&"97!'gJ_!9!hV!$D(;rr<%Kp\t6m +rVup/rVlrg!!i,q!9!eU!"\l)!9!eU!"[BTnG`K=f)Pj_s+(%J!WW)h!!#7_rrD!V!!!Q+rrMTo +pAY-lrVup/r;QctJ+N[?nGN=e+8Gj9nGN=e+3soUrr@T$!!+2Ar;Zm"s7#U[!'gJ_!9!hV!!hok +!<2rt!"\Gr!;QKm!'g8Y!;QKm!'ed/nG`K=f)Ph9rqufu"97<]r;Zluq!nCb5Q:Z_q#(0m&+9Gtrr)lt +&*s5srVurkrrW0"!6kK4rr@T%!!+2Ar;Zm"s7#RZ!'gJ_!;ucq!!hrl!<2rt!"\Ap!T4L\rrM$g +bl@24!.`]%!C-S^!!39&i:6jJ5Q:Z_rqufs"7H0hrr)lt&#B6prr@T%!!.TIr;Zm(s1n1*!'gG^ +r;Zfumf*:drVup/V#Tra!.`]%!WVrn!!3]2JFW[?5Q1T^JGfK9rrE&t!!!P*s7$$gJCso(!WVZf +!!+2AnGiPRrVll5r;ZhIn,ECerVup/V#Tra!.``&!X&J\r;Zj_rp]sg5Q1T^i;EWU5O\UPrr)lt +&#B6prr@T&!!3E*_#466J,Jg:!'gG^!:]pe!$C\0!<2rt!"Yn*nG`K=f`2'as+(%J!WVrb!!#7^ +rrDim!!!PurrE&t!!!P*s7$$gJCso'+929>!Wi>jnGiPRrVllqr;Zg&n,ECerVup/V#Tra!.``& +!C-S^!!39&i:-dI5Q1T^rqufs"7Q6irr)lt&#B6prr@T&!!.TIr;Zm(s1n.)!'gD]r;Zfun,ECe +rVup/V#Tra!.``&!WVrn!!3]2JFNU>5Q(N]JGfK:rrE&t!!!P*s7$$gJD'u)!WVZf!!+2An,NGQ +r;Qc4r;ZhInG`LfrVup/V#Tra!.`c'!X&J\r;Zj_rpTmf5Q(N]i;EWU5Oe[Qrr)lt&#B6prr@T' +!!3E*_#466J,Jd9!'gD]!:]pe!$C_1!<2rt!"Yn*nG`K=g&M0bs+(%J!WVra!!#7]rrDim!!!Q! +rrE&t!!!P*s7$$gJD'u(+929>!Wi>jn,NGQr;Qcpr;Zg&nG`LfrVup/V#Tra!.`c'!C-S^!!39& +i:$^H5Q(N]rqufs"7ZPqu6Z3r;ZhI +nc&UgrVup/V#Tra!.`f(!X&J\r;Zj_rpKge5PtH\i;EWU5OnaRrr)lt&#B6prr@T(!!3E*_#466 +J,Ja8!'gA\!:]pe!$Cb2!<2rt!"Yn*nG`K=gAh9cs+(%J!WVr`!!#7\rrDim!!!Q"rrE&t!!!P* +s7$$gJD1&)+929>!Wi>jmf3>Pqu6Zor;Zg&nc&UgrVup/V#Tra!.`f(!C-S^!!39&i9pXG5PtH\ +rqufs"7cBkrr)lt&#B6prr@T(!!.TIr;Zm(s1n('!'g>[r;Zfunc&UgrVup/V#Tra!.`f(!WVrn +!!3]2JF,+8u3>nGN=f+91a/!'g>[!5SO5!.XS>!<2rt +!"Yn*nG`K=hZ*X@rVllUr;Zj_rpBad5PkB[i;EWU5P"gSrr)lt&#B6prr@T,!!%NIrrBk5!!.TI +mJm5OqYpQbr;Zg>o)A^hrVup/V#Tra!.`r,r;QbIr;Zluq!J+^5PkB[q#(0m&+]`#rr)lt&#B6p +rr@T-!!!&ts8;p!!WVZW!!#7[rrDuq!!!8prrE&t!!!P*s7$$gJD^D-!WE#urqufu"97^Bn!!2Zj!<2rt!"Yn*nG`K=huEcY +nG*%c&-%1J!!#7Zrr@TJ!:p-irr)lt&#B6prr@T-!!*,iq#CF;s6Tdd5Pb^Qts7#CU!'g;Z!;ucq!!i,q!<2rt!"Yn*nG`K=huEcYnG3+d"97^O^O\rp0Ub5PY6Yi;EWU5P4sUrpToms7$$gJD^D.!V#pc!It%6!!#7YrrDQe!!",5rrE&f!!#6h +s7$$gJD^D.!V#pc!WVr]!!#7YrrDim!!!Q%rrE&f!!"+Hs7$$gJD^D.!V#sd!Wi>jli7#Mq#:?l +r;Zg&o`"pjn,NG!ZN'Fo!.`u-!$VrpKgeJ$]1Err@T-!!*,iqZ$X]r9F=_5PP0XnGN=e+8,X6rpKge5I:CZrr@T-!!*,iqZ$X] +q!.n[5PP0Xq#(0m&,#r&rpKge+1)":rr@T-!!*,iqZ$X]nEU&S5PP0Xr;?Tq#PJ)srpKge&$u<* +rr@T-!!*,iqZ$X]i9L@C5PP0Xrqufs"82ZorpKge#IFI"rr@T-!!*,iqZ$X]_!:t#5PG-U!!!&m +rrE&e!!!,-s7$$gJD^D.!V#sd!C),#!!#7Wrr@TJ!;6?lrpKge!OMgqrr@T-!!*2kqZ$U\l2UfK +pAY-.r;ZhIpAY-lmJsTnnG`K=huEc[nG<1c53`+J5PG*Wi;EWU5PG*WrpBadJ$f7Frr@T-!!*2k +qZ$U[l2UfKpAY-^r;Zg>p&FF[!'djjnG`K=huEc[nG<1c53`+J5PG*Wq#(0m&,#tj!!"+Js7$$g +JD^D."7Z0f!']ZJ!'g2W!;ucq!!i2s!.aM$V +JGfK@rrD!G!!!&,s7$$gJD^D."7Z0f!']ZJ!'g/V!5SO5!.X_B!:]CV[/]Xq!.`u-!<_ig!!#4J +!!#7VrrD!U!!#7WrrDi^!!%MVs7$$gJD^D."7Z0f!']ZJ!'g/V!:]pe!$Cq7!;u6b!'dmknG`K= +huEc[nG<1c53`+J5P>$Vq#(0m&,#tj!!"+Ks7$$gJD^D."7Z0f!']ZJ!'g/V!;ucq!!i2s!5S%' +!"ZL;nG`K=huEc[nG<1c53`+J5P>$Vrqufs"6][ar;?Tq#IXU$rr@T-!!*2kqZ$U[l2UfKo`+ji +!!29_!<2os!!BY/nG`K=huEc[nG<1c53`+J5P4sUJGfK1s8;ot!O_ssrr@T-!!*2kqZ$U[l2UfK +o`"p,r;ZhIkPkO4r;a8*nG`K=huEc[nG<1c53`+J5P4sUi;EWU5Ni%H_#465J%#CHrr@T-!!*2k +qZ$U[l2UfKo`"p\r;Zg>kPkP?r;Zg^[f>js!.`u-!<_ig!!#4J!!#7UrrDim!!!PmrrDQe!!"+L +s7$$gJD^D."7Z0f!']ZJ!'g,U!;ucq!!h]e!;QKm!"ZOkPkP?r;Zg^\,Yst +!.`u-!,"8i,_!!#7SrrD!U!!#7HrrBk5!!%MYs7$$gJA;-b5P"gSnGN=e ++6WY(i;EWU5Iga_rr@Sb!!#7SrrDim!!!PmrrDQe!!"+Ns7$$gJA;-b5P"gSr;?Tq#Nu*eq#(0m +&%MZ/rr@Sb!!#7SrrE&s!!!,arrDuq!!!86s7$$gJA;-b5OndP!!!&_rrE&s!!!,2s7$$gJA;-b +5OnaRJGfK1s8;ot!P&1!rr@Sb!!#7RrrBk5!!%N3rr@TJ!4`'urr@Sb!!#7RrrD!U!!#7HrrBk5 +!!%MZs7$$gJA;-b5OnaRnGN=e+6WY(i;EWU5Ipg`rr@Sb!!#7RrrDim!!!PmrrDQe!!"+Os7$$g +JA;-b5OnaRr;?Tq#Nu*eq#(0m&%V`0rr@Sb!!#7RrrE&s!!!,arrDuq!!!87s7$$gJA;-b5Oe^O +!!!&_rrE&s!!!,3s7$$gJA;-b5Oe[QJGfK1s8;ot!P/7"rr@Sb!!#7QrrBk5!!%N3rr@TJ!4i.! +rr@Sb!!#7QrrD!U!!#7HrrBk5!!%M[s7$$gJA;-b5Oe[QnGN=e+6WY(i;EWU5J$marr@Sb!!#7Q +rrDim!!!PmrrDQe!!"+Ps7$$gJA;-b5Oe[Qr;?Tq#Nu*eq#(0m&%_f1rr@Sb!!#7QrrE&s!!!,a +rrDuq!!!88s7$$gJA;-b5O\XN!!!&_rrE&s!!!,4s7$$gJA;-b5O\UPJGfK1s8;ot!P8=#rr@Sb +!!#7PrrBk5!!%N3rr@TJ!4r4"rr@Sb!!#7PrrD!U!!#7HrrBk5!!%M\s7$$gJA;-b5O\UPnGN=e ++6WY(i;EWU5J-sbrr@Sb!!#7PrrDim!!!PmrrDQe!!"+Qs7$$gJA;-b5O\UPr;?Tq#Nu*eq#(0m +&%hl2rr@Sb!!#7PrrE&s!!!,arrDuq!!!89s7$$gJA;-b5OSRM!!!&_rrE&s!!!,5s7$$gJA;-b +5OSOOJGfK1s8;ot!PAC$rr@Sb!!#7OrrBk5!!%N3rr@TJ!5&:#rr@Sb!!#7OrrD!U!!#7HrrBk5 +!!%M]s7$$gJA;-b5OSOOnGN=e+6WY(i;EWU5J7$crr@Sb!!#7OrrDim!!!PmrrDQe!!"+Rs7$$g +JA;-b5OSOOr;?Tq#Nu*eq#(0m&%qr3rr@Sb!!#7OrrE&s!!!,arrDuq!!!8:s7$$gJA;-b5OJLL +!!!&_rrE&s!!!,6s7$$gJA;-b5OJINJGfK1s8;ot!PJI%rr@Sb!!#7NrrBk5!!%N3rr@TJ!5/@$ +rr@Sb!!#7NrrD!U!!#7HrrBk5!!%M^s7$$gJA;-b5OJINnGN=e+6WY(i;EWU5J@*drr@Sb!!#7N +rrDim!!!PmrrDQe!!"+Ss7$$gJA;-b5OJINr;?Tq#Nu*eq#(0m&&rr@Sb!!#7NrrE&s!!!,a +rrDuq!!!8;s7$$gJA;-b5OAFK!!!&_rrE&s!!!,7s7$$gJA;-b5OACMJGfK1s8;ot!PSO&rr@Sb +!!#7MrrBk5!!%N3rr@TJ!58F%rr@Sb!!#7MrrD!U!!#7HrrBk5!!%M_s7$$gJA;-b5OACMnFln_ +#OVNki;EWU5JI0err@Sb!!#7MrrDig!!!8krrDQe!!*o=^]3g'!._ib!'fiM!;uQk!!hok!;QEk +!'e:!nG`K=^]4@!m/I(bpAb0umJd1aqZ$U,_#Np(!._ib!'ffLpAb0umJd1cqZ$Tu_#Np(!._ib +!'ffL!.ahE!!hljq>e>2nG`K=^]4@!li-t#p](:!m/I'9qZ$VG_>j$)!._ib!'ffL!9!VP!!hlj +!5SI3!'e="nG`K=^]4@!li-tSp](:!m/I(DqZ$U<_>j$)!._ib!'ffL!;Qj$)!._ib!'ffL!<2`n!!hlj!;u]o!!C(;nG`K=^]4@! +lMpVZ!!hlj!<2iq!!0q9nG`K=^]4@!lMgj7q#CC"li6e]_>j$)!._ib!'fcK!5SC1!!hii!.aqH +_>j$)!._ib!'fcK!9!YQ!!hii!5SI3!.VlcnG`K=^]4@!lMgkRq#CC"li-tCqZ$VG_Z0-*!._ib +!'fcK!;Q?i!!hii!:]jc!'e@#nG`K=^]4@!lMgk^q#CC"li-t[qZ$U\_Z0-*!._ib!'fcK!<2co +!!hii!;u]o!$B)XnG`K=^]4@!l2UPZ!!hii!<2iq!$B)XnG`K=^]4@!l2La6q>^L#lMp_]!$B)X +nG`K=^]4@!l2Lb!q>^L#lMp_]!$B)XnG`K=^]4@!l2LbAq>^L#li-taqZ$U,_Z0-*!._ib!'f`J +!:]gb!!hii!<2iq!"ZsHnG`K=^]4@!l2LbYq>^L#li-taqZ$U,_Z0-*!._ib!'f`J!;uZn!!hii +!<2iq!"ZsHnG`K=^]4@!l2Lb_q>^L#li-taqZ$U,_Z0-*!._ib!'f]Iq>^L#li-taqZ$U,_Z0-* +!._ib!'f]I!.aqH!!hii!<2iq!"ZsHnG`K=^]4@!kl1XuqZ$U$li-taqZ$U,_Z0-*!._ib!'f]I +!9!_S!!hii!<2iq!"ZsHnG`K=^]4@!kl1YPqZ$U$lMp_]!$B)XnG`K=^]4@!kl1YXqZ$U$lMp_] +!$B)XnG`K=^]4@!kl1Y\qZ$U$lMp_]!$B)XnG`K=^]4@!kl1Y^qZ$U$lMp_]!$B)XnG`K=^]4@! +kl1Y^qZ$U$lMgj7qu?^]_Z0-*!._ib!'f]I!<2iq!!hfh!.atI!'e@#nG`K=^]4@!kl1Y^qZ$U$ +lMgk"qu?_H_Z0-*!._ib!'f]I!<2iq!!hfh!5SL4!.VlcnG`K=^]4@!kl1Y^qZ$U$lMgkBquFS5 +nG`K=^]4@!kl1Y^qZ$U$lMgkBquFS5nG`K=^]4@!kl1Y^qZ$U$lMgkRr;Zfu_>j$)!._ib!'f]I +!<2iq!!hfh!;QKm!!C(;nG`K=^]4@!kl1Y^qZ$U$lMgk^r;Zg&_>j$)!._ib!'f]I!<2iq!!hfh +!<2os!"ZpGnG`K=^]4@!kl1Y^qZ$U$l2U\^!$B&WnG`K=^]4@!kl1Y^qZ$U$l2La6rVup__>j$) +!._ib!'f]I!<2iq!!hcg!5SR6!.VibnG`K=^]4@!kl1Y^qZ$U$l2LbArW'b6nG`K=^]4@!kl1Y^ +qZ$U$l2Lk\!!!,:s7$$gJA;-b5Nr+IrqcZq#O26jrVup/_#Np(!._ib!'f]I!<2iq!!h`f!e:88 +_#Np(!._ib!'f]I!<2iq!!h`f!Vcc3s7$$gJA;-b5D/ues0)HRs0)HRs0)HRs0)HRs0)HRs0)HR +s0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HR +s0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HR +s0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HR +s0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HR +s0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HRs0)HQ~> +%%EndData +showpage +%%Trailer +end +%%EOF Index: 1.0.8/doc-orig/gcode_control_img.pdf =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-orig/gcode_control_img.pdf =================================================================== --- 1.0.8/doc-orig/gcode_control_img.pdf (nonexistent) +++ 1.0.8/doc-orig/gcode_control_img.pdf (revision 1136) Property changes on: 1.0.8/doc-orig/gcode_control_img.pdf ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-orig/gcode_control_img.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-orig/gcode_control_img.png =================================================================== --- 1.0.8/doc-orig/gcode_control_img.png (nonexistent) +++ 1.0.8/doc-orig/gcode_control_img.png (revision 1136) Property changes on: 1.0.8/doc-orig/gcode_control_img.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-orig/gcode_tool_path.eps =================================================================== --- 1.0.8/doc-orig/gcode_tool_path.eps (nonexistent) +++ 1.0.8/doc-orig/gcode_tool_path.eps (revision 1136) @@ -0,0 +1,415 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%Creator: cairo 1.8.10 (http://cairographics.org) +%%CreationDate: Mon May 30 02:27:10 2011 +%%Pages: 1 +%%BoundingBox: 0 0 403 230 +%%DocumentData: Clean7Bit +%%LanguageLevel: 2 +%%EndComments +%%BeginProlog +/cairo_eps_state save def +/dict_count countdictstack def +/op_count count 1 sub def +userdict begin +/q { gsave } bind def +/Q { grestore } bind def +/cm { 6 array astore concat } bind def +/w { setlinewidth } bind def +/J { setlinecap } bind def +/j { setlinejoin } bind def +/M { setmiterlimit } bind def +/d { setdash } bind def +/m { moveto } bind def +/l { lineto } bind def +/c { curveto } bind def +/h { closepath } bind def +/re { exch dup neg 3 1 roll 5 3 roll moveto 0 rlineto + 0 exch rlineto 0 rlineto closepath } bind def +/S { stroke } bind def +/f { fill } bind def +/f* { eofill } bind def +/B { fill stroke } bind def +/B* { eofill stroke } bind def +/n { newpath } bind def +/W { clip } bind def +/W* { eoclip } bind def +/BT { } bind def +/ET { } bind def +/pdfmark where { pop globaldict /?pdfmark /exec load put } + { globaldict begin /?pdfmark /pop load def /pdfmark + /cleartomark load def end } ifelse +/BDC { mark 3 1 roll /BDC pdfmark } bind def +/EMC { mark /EMC pdfmark } bind def +/cairo_store_point { /cairo_point_y exch def /cairo_point_x exch def } def +/Tj { show currentpoint cairo_store_point } bind def +/TJ { + { + dup + type /stringtype eq + { show } { -0.001 mul 0 cairo_font_matrix dtransform rmoveto } ifelse + } forall + currentpoint cairo_store_point +} bind def +/cairo_selectfont { cairo_font_matrix aload pop pop pop 0 0 6 array astore + cairo_font exch selectfont cairo_point_x cairo_point_y moveto } bind def +/Tf { pop /cairo_font exch def /cairo_font_matrix where + { pop cairo_selectfont } if } bind def +/Td { matrix translate cairo_font_matrix matrix concatmatrix dup + /cairo_font_matrix exch def dup 4 get exch 5 get cairo_store_point + /cairo_font where { pop cairo_selectfont } if } bind def +/Tm { 2 copy 8 2 roll 6 array astore /cairo_font_matrix exch def + cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def +/g { setgray } bind def +/rg { setrgbcolor } bind def +/d1 { setcachedevice } bind def +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +%%PageBoundingBox: 0 0 403 230 +%%EndPageSetup +q +1 g +0 0 403 230 rectfill +1 0 0 rg +0.5 w +0 J +0 j +[] 0.0 d +10 M q 1 0 0 1 0 230 cm +0 -230.398 m 32.879 -14.398 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +32.879 -14.398 m 32.879 -211.922 l 159.84 -211.922 l 159.84 -70.559 l +150.238 -70.559 l 148.32 -71.762 l 148.32 -72.238 l 150.238 -73.441 l +152.16 -76.32 l 152.641 -79.441 l 152.16 -81.84 l 150.961 -84 l 150.238 +-84.48 l 150.238 -142.801 l 149.762 -144.238 l 149.039 -145.922 l +114.961 -179.281 l 114.961 -186.238 l 114 -186.961 l 100.559 -186.961 l +99.602 -186 l 99.602 -172.559 l 100.559 -171.359 l 107.52 -171.359 l +138.961 -139.441 l 138.961 -84.48 l 138 -83.281 l 137.281 -81.84 l +136.801 -79.199 l 137.281 -76.559 l 138.238 -74.641 l 139.922 -72.961 l +141.121 -72 l 139.922 -71.039 l 138.238 -69.359 l 137.281 -67.441 l +136.801 -64.801 l 137.281 -62.16 l 138.238 -60.238 l 140.398 -58.078 l +137.762 -58.078 l 137.52 -57.602 l 121.922 -57.602 l 112.801 -66.238 l +112.801 -130.801 l 113.52 -131.281 l 114.719 -133.441 l 115.199 +-136.078 l 114.719 -138.961 l 112.801 -141.84 l 110.641 -143.281 l +109.441 -143.762 l 106.801 -144 l 104.16 -143.52 l 101.52 -141.602 l +100.078 -139.441 l 99.602 -137.52 l 99.602 -134.641 l 100.078 -132.719 +l 101.52 -130.801 l 101.52 -63.84 l 102.48 -60.719 l 116.16 -47.281 l +118.078 -46.32 l 137.039 -46.078 l 137.039 -43.441 l 138.238 -42.48 l +151.441 -42.48 l 152.398 -43.68 l 152.398 -57.359 l 151.441 -58.078 l +149.281 -58.078 l 149.281 -58.559 l 149.762 -59.039 l 157.68 -59.039 l +158.398 -58.32 l 158.398 -38.641 l 159.359 -35.52 l 159.84 -35.281 l +159.84 -14.398 l 32.879 -14.398 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +32.879 -14.398 m 46.078 -50.16 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +46.078 -50.16 m 43.441 -50.879 l 41.281 -51.84 l 38.16 -54 l 36 -56.641 +l 34.32 -60 l 33.602 -64.801 l 34.32 -69.602 l 36 -72.961 l 38.16 +-75.602 l 41.281 -77.762 l 43.441 -78.719 l 46.32 -79.441 l 50.16 +-79.441 l 53.039 -78.719 l 55.68 -77.52 l 58.559 -75.359 l 60.238 +-73.199 l 62.16 -69.602 l 62.879 -65.281 l 62.641 -62.641 l 62.16 -60 l +60.238 -56.398 l 58.559 -54.238 l 55.68 -52.078 l 53.039 -50.879 l +50.16 -50.16 l 46.078 -50.16 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +46.078 -50.16 m 217.922 -16.801 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +217.922 -16.801 m 217.199 -17.281 l 208.801 -25.441 l 208.078 -26.879 l +208.078 -49.199 l 205.441 -52.078 l 197.281 -52.078 l 195.84 -50.398 l +193.922 -49.441 l 190.32 -49.441 l 188.398 -50.398 l 186.719 -52.32 l +186 -53.762 l 186 -57.359 l 186.719 -58.801 l 188.398 -60.719 l 190.32 +-61.68 l 193.922 -61.68 l 195.84 -60.719 l 197.281 -59.039 l 207.121 +-59.039 l 208.559 -58.32 l 214.559 -52.078 l 215.039 -51.121 l 215.039 +-28.801 l 219.84 -23.762 l 263.039 -23.762 l 277.922 -38.879 l 277.922 +-46.801 l 290.879 -46.801 l 290.879 -33.84 l 282.238 -33.84 l 266.16 +-17.52 l 264.719 -16.801 l 217.922 -16.801 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +217.922 -16.801 m 332.879 -34.078 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +332.879 -34.078 m 331.68 -34.559 l 330.238 -35.281 l 328.559 -37.199 l +327.84 -38.641 l 327.84 -42 l 328.559 -43.922 l 302.641 -70.078 l +264.238 -70.078 l 263.281 -70.559 l 259.199 -74.398 l 258.48 -75.84 l +258.48 -85.441 l 249.121 -94.559 l 239.762 -94.559 l 239.039 -93.602 l +237.121 -92.641 l 233.52 -92.641 l 231.602 -93.602 l 229.922 -95.52 l +229.199 -96.961 l 229.199 -100.559 l 229.922 -102 l 231.602 -103.922 l +233.52 -104.879 l 237.121 -104.879 l 239.039 -103.922 l 241.199 -101.52 +l 251.039 -101.52 l 252 -101.039 l 264.719 -88.559 l 265.441 -87.121 l +265.441 -77.52 l 265.922 -77.039 l 304.32 -77.039 l 305.762 -76.32 l +335.039 -46.801 l 337.199 -45.84 l 339.121 -44.16 l 340.078 -42.238 l +340.078 -38.641 l 339.359 -37.199 l 337.68 -35.281 l 335.762 -34.32 l +332.879 -34.078 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +332.879 -34.078 m 228.961 -34.559 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +228.961 -34.559 m 228.961 -47.52 l 241.922 -47.52 l 241.922 -34.559 l +228.961 -34.559 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +228.961 -34.559 m 191.039 -34.801 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +191.039 -34.801 m 189.359 -35.52 l 163.199 -35.52 l 161.762 -36.719 l +160.559 -38.16 l 160.559 -59.52 l 158.398 -61.441 l 149.762 -61.441 l +148.32 -59.762 l 146.398 -58.801 l 142.801 -58.801 l 141.359 -59.52 l +139.441 -61.199 l 138.48 -63.121 l 138.48 -66.719 l 139.441 -68.641 l +141.359 -70.32 l 142.801 -71.039 l 146.398 -71.039 l 148.32 -70.078 l +149.762 -68.398 l 160.32 -68.398 l 161.281 -67.922 l 166.801 -62.641 l +167.52 -61.199 l 167.52 -42.48 l 186 -42.48 l 186.48 -44.16 l 188.398 +-46.32 l 190.32 -47.281 l 193.922 -47.281 l 195.84 -46.32 l 197.52 +-44.398 l 198.238 -42.961 l 198.238 -39.359 l 197.52 -37.922 l 195.84 +-36 l 193.922 -35.039 l 191.039 -34.801 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +191.039 -34.801 m 138.238 -43.922 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +138.238 -43.922 m 138.238 -48.48 l 118.801 -48.48 l 117.84 -48.961 l +104.398 -62.16 l 103.68 -63.602 l 103.68 -131.039 l 102 -132.48 l +101.039 -134.398 l 101.039 -138 l 101.762 -139.441 l 103.441 -141.359 l +105.359 -142.32 l 108.961 -142.32 l 110.879 -141.359 l 112.559 -139.441 +l 113.281 -138 l 113.281 -134.398 l 112.32 -132.48 l 110.641 -131.039 l +110.641 -65.52 l 120.48 -55.441 l 138.238 -55.441 l 138.238 -56.879 l +151.199 -56.879 l 151.199 -43.922 l 138.238 -43.922 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +138.238 -43.922 m 234.238 -49.199 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +234.238 -49.199 m 233.039 -49.68 l 231.602 -50.398 l 229.922 -52.32 l +229.199 -53.762 l 229.199 -57.359 l 230.16 -59.281 l 232.078 -60.961 l +233.52 -61.68 l 237.121 -61.68 l 239.039 -60.719 l 240.719 -58.801 l +241.441 -57.359 l 241.441 -53.762 l 240.719 -52.32 l 239.039 -50.398 l +237.121 -49.441 l 234.238 -49.199 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +234.238 -49.199 m 191.039 -63.602 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +191.039 -63.602 m 189.84 -64.078 l 188.398 -64.801 l 186.719 -66.719 l +186 -68.16 l 186 -71.762 l 186.961 -73.68 l 188.879 -75.359 l 190.32 +-76.078 l 193.922 -76.078 l 195.84 -75.121 l 197.52 -73.199 l 198.238 +-71.762 l 198.238 -68.16 l 197.52 -66.719 l 195.84 -64.801 l 193.922 +-63.84 l 191.039 -63.602 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +191.039 -63.602 m 234.238 -63.602 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +234.238 -63.602 m 233.039 -64.078 l 231.602 -64.801 l 230.16 -66.48 l +216 -66.48 l 215.039 -66.961 l 208.801 -72.961 l 208.078 -74.398 l +208.078 -90.961 l 204.719 -94.559 l 196.559 -94.559 l 195.84 -93.602 l +193.922 -92.641 l 190.32 -92.641 l 188.879 -93.359 l 186.961 -95.039 l +186 -96.961 l 186 -100.559 l 186.961 -102.48 l 188.879 -104.16 l 190.32 +-104.879 l 193.922 -104.879 l 195.84 -103.922 l 198 -101.52 l 206.398 +-101.52 l 207.84 -100.801 l 214.559 -93.84 l 215.039 -92.879 l 215.039 +-76.078 l 217.922 -73.441 l 230.16 -73.441 l 231.602 -75.121 l 233.52 +-76.078 l 237.121 -76.078 l 239.039 -75.121 l 240.719 -73.199 l 241.441 +-71.762 l 241.441 -68.16 l 240.719 -66.719 l 239.039 -64.801 l 237.121 +-63.84 l 234.238 -63.602 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +234.238 -63.602 m 143.52 -72.961 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +143.52 -72.961 m 142.32 -73.441 l 140.879 -74.16 l 139.199 -76.078 l +138.48 -77.52 l 138.48 -81.121 l 139.441 -83.039 l 141.121 -84.48 l +141.121 -140.879 l 108.961 -172.801 l 100.801 -172.801 l 100.801 +-185.762 l 113.762 -185.762 l 113.762 -177.359 l 147.359 -144 l 148.078 +-142.559 l 148.078 -84.48 l 149.762 -83.039 l 150.719 -81.121 l 150.719 +-77.52 l 150 -76.078 l 148.32 -74.16 l 146.398 -73.199 l 143.52 -72.961 +l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +143.52 -72.961 m 191.039 -78 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +191.039 -78 m 189.84 -78.48 l 188.398 -79.199 l 186.48 -81.359 l 186 +-83.039 l 174.961 -83.039 l 174 -83.52 l 168.48 -88.801 l 167.762 +-90.238 l 167.762 -163.441 l 168.48 -164.879 l 210.961 -207.121 l +210.961 -211.68 l 223.922 -211.68 l 223.922 -198.719 l 211.68 -198.719 +l 174.719 -161.52 l 174.719 -92.16 l 176.641 -90 l 189.359 -90 l +191.281 -90.719 l 193.922 -90.48 l 195.84 -89.52 l 197.52 -87.602 l +198.238 -86.16 l 198.238 -82.559 l 197.52 -81.121 l 195.84 -79.199 l +193.922 -78.238 l 191.039 -78 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +191.039 -78 m 234.238 -78 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +234.238 -78 m 233.039 -78.48 l 231.602 -79.199 l 229.922 -81.121 l +229.199 -82.559 l 229.199 -86.16 l 230.16 -88.078 l 232.078 -89.762 l +233.52 -90.48 l 237.121 -90.48 l 239.039 -89.52 l 240.719 -87.602 l +241.441 -86.16 l 241.441 -82.559 l 240.719 -81.121 l 239.039 -79.199 l +237.121 -78.238 l 234.238 -78 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +234.238 -78 m 283.199 -91.68 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +283.199 -91.68 m 282 -92.16 l 280.559 -92.879 l 278.879 -94.801 l +278.16 -96.238 l 278.16 -99.84 l 279.121 -101.762 l 280.801 -103.199 l +280.801 -144 l 281.281 -144.961 l 293.039 -156.961 l 293.281 -160.32 l +294.238 -162.238 l 296.16 -163.922 l 297.602 -164.641 l 301.199 +-164.641 l 303.121 -163.68 l 304.801 -161.762 l 305.52 -160.32 l 305.52 +-156.719 l 304.801 -155.281 l 303.121 -153.359 l 301.199 -152.398 l +297.84 -152.16 l 287.762 -142.32 l 287.762 -103.199 l 289.68 -101.52 l +305.52 -101.52 l 308.879 -105.121 l 308.879 -118.801 l 307.199 -120.238 +l 306.238 -122.16 l 306.238 -125.762 l 306.961 -127.199 l 308.641 +-129.121 l 310.559 -130.078 l 314.16 -130.078 l 316.078 -129.121 l +317.762 -127.199 l 318.48 -125.762 l 318.48 -122.16 l 317.52 -120.238 l +315.84 -118.801 l 315.84 -103.199 l 315.121 -101.762 l 308.16 -95.039 l +307.199 -94.559 l 289.441 -94.559 l 288 -92.879 l 286.078 -91.922 l +283.199 -91.68 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +283.199 -91.68 m 191.039 -106.801 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +191.039 -106.801 m 189.84 -107.281 l 188.398 -108 l 186.719 -109.922 l +186 -111.359 l 186 -114.961 l 186.961 -116.879 l 188.879 -118.559 l +190.32 -119.281 l 193.922 -119.281 l 195.84 -118.32 l 197.281 -116.641 +l 212.641 -116.641 l 226.078 -130.32 l 227.52 -131.039 l 230.16 +-131.039 l 231.602 -132.719 l 233.52 -133.68 l 237.121 -133.68 l +238.559 -132.961 l 240.48 -131.281 l 241.441 -129.359 l 241.441 +-125.762 l 240.48 -123.84 l 238.559 -122.16 l 237.121 -121.441 l 233.52 +-121.441 l 231.602 -122.398 l 230.16 -124.078 l 229.199 -124.078 l +215.039 -109.68 l 213.602 -108.961 l 212.16 -108.961 l 211.199 -109.68 +l 197.281 -109.68 l 195.84 -108 l 193.922 -107.039 l 191.039 -106.801 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +191.039 -106.801 m 234.238 -106.801 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +234.238 -106.801 m 233.039 -107.281 l 231.602 -108 l 229.922 -109.922 l +229.199 -111.359 l 229.199 -114.961 l 230.16 -116.879 l 232.078 +-118.559 l 233.52 -119.281 l 237.121 -119.281 l 239.039 -118.32 l +239.762 -117.359 l 253.68 -117.359 l 254.16 -117.84 l 254.16 -147.602 l +254.641 -148.559 l 264.238 -158.398 l 264.48 -160.32 l 265.199 -161.762 +l 266.879 -163.68 l 268.801 -164.641 l 272.398 -164.641 l 274.32 +-163.68 l 276 -161.762 l 276.719 -160.32 l 276.719 -156.719 l 276 +-155.281 l 274.32 -153.359 l 272.398 -152.398 l 270.238 -152.16 l +268.078 -152.641 l 261.121 -145.922 l 261.121 -116.16 l 260.398 +-114.719 l 256.32 -110.879 l 255.359 -110.398 l 241.199 -110.398 l +239.039 -108 l 237.121 -107.039 l 234.238 -106.801 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +234.238 -106.801 m 191.039 -121.199 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +191.039 -121.199 m 189.84 -121.68 l 188.398 -122.398 l 186.719 -124.32 +l 186 -125.762 l 186 -129.359 l 186.961 -131.281 l 188.879 -132.961 l +190.32 -133.68 l 193.922 -133.68 l 195.84 -132.719 l 197.281 -131.039 l +204 -131.039 l 215.281 -142.559 l 216.719 -143.281 l 229.199 -143.281 l +229.68 -144.961 l 231.602 -147.121 l 233.52 -148.078 l 237.121 -148.078 +l 238.559 -147.359 l 240.48 -145.68 l 241.441 -143.762 l 241.441 +-140.16 l 240.48 -138.238 l 238.559 -136.559 l 237.121 -135.84 l 234.48 +-135.602 l 232.559 -136.32 l 218.398 -136.32 l 207.121 -124.801 l +205.68 -124.078 l 197.281 -124.078 l 195.84 -122.398 l 193.922 -121.441 +l 191.039 -121.199 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +191.039 -121.199 m 191.039 -135.602 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +191.039 -135.602 m 189.84 -136.078 l 188.398 -136.801 l 186.719 +-138.719 l 186 -140.16 l 186 -143.762 l 186.961 -145.68 l 188.879 +-147.359 l 190.32 -148.078 l 193.922 -148.078 l 195.84 -147.121 l +197.281 -145.441 l 202.32 -145.441 l 216.719 -159.602 l 216.719 -179.52 +l 217.922 -180.961 l 219.359 -182.16 l 247.199 -182.16 l 268.559 +-203.762 l 268.801 -207.121 l 269.52 -208.559 l 271.199 -210.48 l +273.121 -211.441 l 276.719 -211.441 l 278.641 -210.48 l 280.32 -208.559 +l 281.039 -207.121 l 281.039 -203.52 l 280.32 -202.078 l 278.641 +-200.16 l 276.719 -199.199 l 273.359 -198.961 l 249.84 -175.68 l +248.879 -175.199 l 223.68 -175.199 l 223.68 -157.922 l 223.199 -156.961 +l 205.68 -139.199 l 204.238 -138.48 l 197.281 -138.48 l 195.84 -136.801 +l 193.922 -135.84 l 191.039 -135.602 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +191.039 -135.602 m 191.039 -150 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +191.039 -150 m 189.84 -150.48 l 188.398 -151.199 l 186.719 -153.121 l +186 -154.559 l 186 -158.16 l 186.961 -160.078 l 188.879 -161.762 l +190.32 -162.48 l 193.922 -162.48 l 195.84 -161.52 l 197.52 -159.602 l +198.238 -158.16 l 198.238 -154.559 l 197.52 -153.121 l 195.84 -151.199 +l 193.922 -150.238 l 191.039 -150 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +191.039 -150 m 234.238 -150 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +234.238 -150 m 233.039 -150.48 l 231.602 -151.199 l 229.922 -153.121 l +229.199 -154.559 l 229.199 -158.16 l 230.16 -160.078 l 232.078 -161.762 +l 233.52 -162.48 l 237.121 -162.48 l 239.039 -161.52 l 240.719 -159.602 +l 241.441 -158.16 l 241.441 -154.559 l 240.719 -153.121 l 239.039 +-151.199 l 237.121 -150.238 l 234.238 -150 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +234.238 -150 m 46.559 -51.84 l S Q +0 g +0.5 w +q 1 0 0 1 0 230 cm +46.559 -51.84 m 44.641 -52.32 l 42.238 -53.281 l 39.602 -54.961 l +37.441 -57.359 l 36 -60 l 35.281 -62.398 l 35.281 -67.441 l 36 -69.84 l +37.441 -72.48 l 39.602 -74.879 l 42.238 -76.559 l 45.359 -77.762 l +50.879 -77.762 l 54 -76.559 l 56.641 -74.879 l 58.801 -72.48 l 60.238 +-69.84 l 60.961 -67.441 l 60.961 -62.398 l 60.238 -60 l 58.801 -57.359 +l 56.641 -54.961 l 54 -53.281 l 50.879 -52.078 l 46.559 -51.84 l S Q +1 0 0 rg +0.5 w +q 1 0 0 1 0 230 cm +46.559 -51.84 m S Q +Q +showpage +%%Trailer +count op_count sub {pop} repeat +countdictstack dict_count sub {end} repeat +cairo_eps_state restore +%%EOF Index: 1.0.8/doc-orig/gcode_tool_path.pdf =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-orig/gcode_tool_path.pdf =================================================================== --- 1.0.8/doc-orig/gcode_tool_path.pdf (nonexistent) +++ 1.0.8/doc-orig/gcode_tool_path.pdf (revision 1136) Property changes on: 1.0.8/doc-orig/gcode_tool_path.pdf ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-orig/gcode_tool_path.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-orig/gcode_tool_path.png =================================================================== --- 1.0.8/doc-orig/gcode_tool_path.png (nonexistent) +++ 1.0.8/doc-orig/gcode_tool_path.png (revision 1136) Property changes on: 1.0.8/doc-orig/gcode_tool_path.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-orig/letter_size.tab =================================================================== --- 1.0.8/doc-orig/letter_size.tab (nonexistent) +++ 1.0.8/doc-orig/letter_size.tab (revision 1136) @@ -0,0 +1,30 @@ +# $Id$ +# + +A .2340 +B .2380 +C .2420 +D .2460 +E .2500 +F .2570 +G .2610 +H .2660 +I .2720 +J .2770 +K .2810 +L .2900 +M .2950 +N .3020 +O .3160 +P .3230 +Q .3320 +R .3390 +S .3480 +T .3580 +U .3680 +V .3770 +W .3860 +X .3970 +Y .4040 +Z .4130 + Index: 1.0.8/doc-orig/letter_size.texi =================================================================== --- 1.0.8/doc-orig/letter_size.texi (nonexistent) +++ 1.0.8/doc-orig/letter_size.texi (revision 1136) @@ -0,0 +1,16 @@ +@c Generated file. Do not edit directly +@c $Id$ +@multitable @columnfractions 0.167 0.167 0.167 0.167 0.167 0.167 +@item Drill @tab Diameter @tab Drill @tab Diameter @tab Drill @tab Diameter +@item Size @tab (inches) @tab Size @tab (inches) @tab Size @tab (inches) + +@item A @tab .2340 @tab B @tab .2380 @tab C @tab .2420 +@item D @tab .2460 @tab E @tab .2500 @tab F @tab .2570 +@item G @tab .2610 @tab H @tab .2660 @tab I @tab .2720 +@item J @tab .2770 @tab K @tab .2810 @tab L @tab .2900 +@item M @tab .2950 @tab N @tab .3020 @tab O @tab .3160 +@item P @tab .3230 @tab Q @tab .3320 @tab R @tab .3390 +@item S @tab .3480 @tab T @tab .3580 @tab U @tab .3680 +@item V @tab .3770 @tab W @tab .3860 @tab X @tab .3970 +@item Y @tab .4040 @tab Z @tab .4130 @tab @tab @end multitable + Index: 1.0.8/doc-orig/mdate-sh =================================================================== --- 1.0.8/doc-orig/mdate-sh (nonexistent) +++ 1.0.8/doc-orig/mdate-sh (revision 1136) @@ -0,0 +1,193 @@ +#!/bin/sh +# Get modification time of a file or directory and pretty-print it. + +scriptversion=2005-02-07.09 + +# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005 Free Software +# Foundation, Inc. +# written by Ulrich Drepper , June 1995 +# +# 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, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +case $1 in + '') + echo "$0: No file. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: mdate-sh [--help] [--version] FILE + +Pretty-print the modification time of FILE. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "mdate-sh $scriptversion" + exit $? + ;; +esac + +# Prevent date giving response in another language. +LANG=C +export LANG +LC_ALL=C +export LC_ALL +LC_TIME=C +export LC_TIME + +save_arg1="$1" + +# Find out how to get the extended ls output of a file or directory. +if ls -L /dev/null 1>/dev/null 2>&1; then + ls_command='ls -L -l -d' +else + ls_command='ls -l -d' +fi + +# A `ls -l' line looks as follows on OS/2. +# drwxrwx--- 0 Aug 11 2001 foo +# This differs from Unix, which adds ownership information. +# drwxrwx--- 2 root root 4096 Aug 11 2001 foo +# +# To find the date, we split the line on spaces and iterate on words +# until we find a month. This cannot work with files whose owner is a +# user named `Jan', or `Feb', etc. However, it's unlikely that `/' +# will be owned by a user whose name is a month. So we first look at +# the extended ls output of the root directory to decide how many +# words should be skipped to get the date. + +# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. +set x`ls -l -d /` + +# Find which argument is the month. +month= +command= +until test $month +do + shift + # Add another shift to the command. + command="$command shift;" + case $1 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; + esac +done + +# Get the extended ls output of the file or directory. +set dummy x`eval "$ls_command \"\$save_arg1\""` + +# Remove all preceding arguments +eval $command + +# Because of the dummy argument above, month is in $2. +# +# On a POSIX system, we should have +# +# $# = 5 +# $1 = file size +# $2 = month +# $3 = day +# $4 = year or time +# $5 = filename +# +# On Darwin 7.7.0 and 7.6.0, we have +# +# $# = 4 +# $1 = day +# $2 = month +# $3 = year or time +# $4 = filename + +# Get the month. +case $2 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; +esac + +case $3 in + ???*) day=$1;; + *) day=$3; shift;; +esac + +# Here we have to deal with the problem that the ls output gives either +# the time of day or the year. +case $3 in + *:*) set `date`; eval year=\$$# + case $2 in + Jan) nummonthtod=1;; + Feb) nummonthtod=2;; + Mar) nummonthtod=3;; + Apr) nummonthtod=4;; + May) nummonthtod=5;; + Jun) nummonthtod=6;; + Jul) nummonthtod=7;; + Aug) nummonthtod=8;; + Sep) nummonthtod=9;; + Oct) nummonthtod=10;; + Nov) nummonthtod=11;; + Dec) nummonthtod=12;; + esac + # For the first six month of the year the time notation can also + # be used for files modified in the last year. + if (expr $nummonth \> $nummonthtod) > /dev/null; + then + year=`expr $year - 1` + fi;; + *) year=$3;; +esac + +# The result. +echo $day $month $year + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: Index: 1.0.8/doc-orig/metric_size.tab =================================================================== --- 1.0.8/doc-orig/metric_size.tab (nonexistent) +++ 1.0.8/doc-orig/metric_size.tab (revision 1136) @@ -0,0 +1,192 @@ +# $Id$ +# + +0.20_mm .00787 +0.25_mm .00984 +0.30_mm .0118 +0.35_mm .0138 +0.40_mm .0158 +0.45_mm .0177 +0.50_mm .0197 +0.55_mm .0217 +0.60_mm .0236 +0.65_mm .0256 +0.70_mm .0276 +0.75_mm .0295 +0.80_mm .0315 +0.85_mm .0335 +0.90_mm .0354 +0.95_mm .0374 +1.00_mm .0394 +1.05_mm .0413 +1.10_mm .0433 +1.15_mm .0453 +1.20_mm .0472 +1.25_mm .0492 +1.30_mm .0512 +1.35_mm .0531 +1.40_mm .0551 +1.45_mm .0571 +1.50_mm .0591 +1.55_mm .0610 +1.60_mm .0630 +1.65_mm .0650 +1.70_mm .0669 +1.75_mm .0689 +1.80_mm .0709 +1.85_mm .0728 +1.90_mm .0748 +1.95_mm .0768 +2.00_mm .0787 +2.05_mm .0807 +2.10_mm .0827 +2.15_mm .0846 +2.20_mm .0866 +2.25_mm .0886 +2.30_mm .0906 +2.35_mm .0925 +2.40_mm .0945 +2.45_mm .0965 +2.50_mm .0984 +2.55_mm .1004 +2.60_mm .1024 +2.65_mm .1043 +2.70_mm .1063 +2.75_mm .1083 +2.80_mm .1102 +2.85_mm .1122 +2.90_mm .1142 +2.95_mm .1161 +3.00_mm .1181 +3.10_mm .1220 +3.15_mm .1240 +3.20_mm .1260 +3.25_mm .1280 +3.30_mm .1299 +3.40_mm .1339 +3.50_mm .1378 +3.60_mm .1417 +3.70_mm .1457 +3.75_mm .1476 +3.80_mm .1496 +3.90_mm .1535 +4.00_mm .1575 +4.10_mm .1614 +4.20_mm .1654 +4.25_mm .1673 +4.30_mm .1693 +4.40_mm .1732 +4.50_mm .1772 +4.60_mm .1811 +4.70_mm .1850 +4.75_mm .1870 +4.80_mm .1890 +4.90_mm .1929 +5.00_mm .1969 +5.10_mm .2008 +5.20_mm .2047 +5.25_mm .2067 +5.30_mm .2087 +5.40_mm .2126 +5.50_mm .2165 +5.60_mm .2205 +5.70_mm .2244 +5.75_mm .2264 +5.80_mm .2283 +5.90_mm .2323 +6.00_mm .2362 +6.10_mm .2402 +6.20_mm .2441 +6.25_mm .2461 +6.30_mm .2480 +6.40_mm .2520 +6.50_mm .2559 +6.60_mm .2598 +6.70_mm .2638 +6.75_mm .2657 +6.80_mm .2677 +6.90_mm .2717 +7.00_mm .2756 +7.10_mm .2795 +7.20_mm .2835 +7.25_mm .2854 +7.30_mm .2874 +7.40_mm .2914 +7.50_mm .2953 +7.60_mm .2992 +7.70_mm .3031 +8.00_mm .3150 +8.10_mm .3189 +8.20_mm .3228 +8.25_mm .3248 +8.30_mm .3268 +8.40_mm .3307 +8.50_mm .3346 +8.60_mm .3386 +8.70_mm .3425 +8.75_mm .3445 +8.80_mm .3465 +8.90_mm .3504 +9.00_mm .3543 +9.10_mm .3583 +9.20_mm .3622 +9.25_mm .3642 +9.30_mm .3661 +9.40_mm .3701 +9.50_mm .3740 +9.60_mm .3780 +9.70_mm .3819 +9.75_mm .3839 +9.80_mm .3858 +9.90_mm .3898 +10.00_mm .3937 +10.10_mm .3976 +10.20_mm .4016 +10.25_mm .4035 +10.30_mm .4055 +10.40_mm .4094 +10.50_mm .4134 +10.60_mm .4173 +10.70_mm .4213 +10.80_mm .4252 +10.90_mm .4291 +11.00_mm .4331 +11.10_mm .4370 +11.20_mm .4409 +11.25_mm .4429 +11.30_mm .4449 +11.40_mm .4488 +11.50_mm .4528 +11.60_mm .4567 +11.70_mm .4606 +11.75_mm .4626 +11.80_mm .4646 +11.90_mm .4685 +12.00_mm .4724 +12.50_mm .4921 +13.00_mm .5118 +13.50_mm .5315 +14.00_mm .5512 +14.50_mm .5709 +15.00_mm .5906 +15.50_mm .6102 +16.00_mm .6299 +16.50_mm .6496 +17.00_mm .6693 +17.50_mm .6890 +18.00_mm .7087 +18.50_mm .7283 +19.00_mm .7480 +19.50_mm .7677 +20.00_mm .7874 +20.50_mm .8071 +21.00_mm .8268 +21.50_mm .8465 +22.00_mm .8661 +22.50_mm .8858 +23.00_mm .9055 +23.50_mm .9252 +24.00_mm .9449 +24.50_mm .9646 +25.00_mm .9843 + Index: 1.0.8/doc-orig/metric_size.texi =================================================================== --- 1.0.8/doc-orig/metric_size.texi (nonexistent) +++ 1.0.8/doc-orig/metric_size.texi (revision 1136) @@ -0,0 +1,70 @@ +@c Generated file. Do not edit directly +@c $Id$ +@multitable @columnfractions 0.167 0.167 0.167 0.167 0.167 0.167 +@item Drill @tab Diameter @tab Drill @tab Diameter @tab Drill @tab Diameter +@item Size @tab (inches) @tab Size @tab (inches) @tab Size @tab (inches) + +@item 0.20 mm @tab .00787 @tab 0.25 mm @tab .00984 @tab 0.30 mm @tab .0118 +@item 0.35 mm @tab .0138 @tab 0.40 mm @tab .0158 @tab 0.45 mm @tab .0177 +@item 0.50 mm @tab .0197 @tab 0.55 mm @tab .0217 @tab 0.60 mm @tab .0236 +@item 0.65 mm @tab .0256 @tab 0.70 mm @tab .0276 @tab 0.75 mm @tab .0295 +@item 0.80 mm @tab .0315 @tab 0.85 mm @tab .0335 @tab 0.90 mm @tab .0354 +@item 0.95 mm @tab .0374 @tab 1.00 mm @tab .0394 @tab 1.05 mm @tab .0413 +@item 1.10 mm @tab .0433 @tab 1.15 mm @tab .0453 @tab 1.20 mm @tab .0472 +@item 1.25 mm @tab .0492 @tab 1.30 mm @tab .0512 @tab 1.35 mm @tab .0531 +@item 1.40 mm @tab .0551 @tab 1.45 mm @tab .0571 @tab 1.50 mm @tab .0591 +@item 1.55 mm @tab .0610 @tab 1.60 mm @tab .0630 @tab 1.65 mm @tab .0650 +@item 1.70 mm @tab .0669 @tab 1.75 mm @tab .0689 @tab 1.80 mm @tab .0709 +@item 1.85 mm @tab .0728 @tab 1.90 mm @tab .0748 @tab 1.95 mm @tab .0768 +@item 2.00 mm @tab .0787 @tab 2.05 mm @tab .0807 @tab 2.10 mm @tab .0827 +@item 2.15 mm @tab .0846 @tab 2.20 mm @tab .0866 @tab 2.25 mm @tab .0886 +@item 2.30 mm @tab .0906 @tab 2.35 mm @tab .0925 @tab 2.40 mm @tab .0945 +@item 2.45 mm @tab .0965 @tab 2.50 mm @tab .0984 @tab 2.55 mm @tab .1004 +@item 2.60 mm @tab .1024 @tab 2.65 mm @tab .1043 @tab 2.70 mm @tab .1063 +@item 2.75 mm @tab .1083 @tab 2.80 mm @tab .1102 @tab 2.85 mm @tab .1122 +@item 2.90 mm @tab .1142 @tab 2.95 mm @tab .1161 @tab 3.00 mm @tab .1181 +@item 3.10 mm @tab .1220 @tab 3.15 mm @tab .1240 @tab 3.20 mm @tab .1260 +@item 3.25 mm @tab .1280 @tab 3.30 mm @tab .1299 @tab 3.40 mm @tab .1339 +@item 3.50 mm @tab .1378 @tab 3.60 mm @tab .1417 @tab 3.70 mm @tab .1457 +@item 3.75 mm @tab .1476 @tab 3.80 mm @tab .1496 @tab 3.90 mm @tab .1535 +@item 4.00 mm @tab .1575 @tab 4.10 mm @tab .1614 @tab 4.20 mm @tab .1654 +@item 4.25 mm @tab .1673 @tab 4.30 mm @tab .1693 @tab 4.40 mm @tab .1732 +@item 4.50 mm @tab .1772 @tab 4.60 mm @tab .1811 @tab 4.70 mm @tab .1850 +@item 4.75 mm @tab .1870 @tab 4.80 mm @tab .1890 @tab 4.90 mm @tab .1929 +@item 5.00 mm @tab .1969 @tab 5.10 mm @tab .2008 @tab 5.20 mm @tab .2047 +@item 5.25 mm @tab .2067 @tab 5.30 mm @tab .2087 @tab 5.40 mm @tab .2126 +@item 5.50 mm @tab .2165 @tab 5.60 mm @tab .2205 @tab 5.70 mm @tab .2244 +@item 5.75 mm @tab .2264 @tab 5.80 mm @tab .2283 @tab 5.90 mm @tab .2323 +@item 6.00 mm @tab .2362 @tab 6.10 mm @tab .2402 @tab 6.20 mm @tab .2441 +@item 6.25 mm @tab .2461 @tab 6.30 mm @tab .2480 @tab 6.40 mm @tab .2520 +@item 6.50 mm @tab .2559 @tab 6.60 mm @tab .2598 @tab 6.70 mm @tab .2638 +@item 6.75 mm @tab .2657 @tab 6.80 mm @tab .2677 @tab 6.90 mm @tab .2717 +@item 7.00 mm @tab .2756 @tab 7.10 mm @tab .2795 @tab 7.20 mm @tab .2835 +@item 7.25 mm @tab .2854 @tab 7.30 mm @tab .2874 @tab 7.40 mm @tab .2914 +@item 7.50 mm @tab .2953 @tab 7.60 mm @tab .2992 @tab 7.70 mm @tab .3031 +@item 8.00 mm @tab .3150 @tab 8.10 mm @tab .3189 @tab 8.20 mm @tab .3228 +@item 8.25 mm @tab .3248 @tab 8.30 mm @tab .3268 @tab 8.40 mm @tab .3307 +@item 8.50 mm @tab .3346 @tab 8.60 mm @tab .3386 @tab 8.70 mm @tab .3425 +@item 8.75 mm @tab .3445 @tab 8.80 mm @tab .3465 @tab 8.90 mm @tab .3504 +@item 9.00 mm @tab .3543 @tab 9.10 mm @tab .3583 @tab 9.20 mm @tab .3622 +@item 9.25 mm @tab .3642 @tab 9.30 mm @tab .3661 @tab 9.40 mm @tab .3701 +@item 9.50 mm @tab .3740 @tab 9.60 mm @tab .3780 @tab 9.70 mm @tab .3819 +@item 9.75 mm @tab .3839 @tab 9.80 mm @tab .3858 @tab 9.90 mm @tab .3898 +@item 10.00 mm @tab .3937 @tab 10.10 mm @tab .3976 @tab 10.20 mm @tab .4016 +@item 10.25 mm @tab .4035 @tab 10.30 mm @tab .4055 @tab 10.40 mm @tab .4094 +@item 10.50 mm @tab .4134 @tab 10.60 mm @tab .4173 @tab 10.70 mm @tab .4213 +@item 10.80 mm @tab .4252 @tab 10.90 mm @tab .4291 @tab 11.00 mm @tab .4331 +@item 11.10 mm @tab .4370 @tab 11.20 mm @tab .4409 @tab 11.25 mm @tab .4429 +@item 11.30 mm @tab .4449 @tab 11.40 mm @tab .4488 @tab 11.50 mm @tab .4528 +@item 11.60 mm @tab .4567 @tab 11.70 mm @tab .4606 @tab 11.75 mm @tab .4626 +@item 11.80 mm @tab .4646 @tab 11.90 mm @tab .4685 @tab 12.00 mm @tab .4724 +@item 12.50 mm @tab .4921 @tab 13.00 mm @tab .5118 @tab 13.50 mm @tab .5315 +@item 14.00 mm @tab .5512 @tab 14.50 mm @tab .5709 @tab 15.00 mm @tab .5906 +@item 15.50 mm @tab .6102 @tab 16.00 mm @tab .6299 @tab 16.50 mm @tab .6496 +@item 17.00 mm @tab .6693 @tab 17.50 mm @tab .6890 @tab 18.00 mm @tab .7087 +@item 18.50 mm @tab .7283 @tab 19.00 mm @tab .7480 @tab 19.50 mm @tab .7677 +@item 20.00 mm @tab .7874 @tab 20.50 mm @tab .8071 @tab 21.00 mm @tab .8268 +@item 21.50 mm @tab .8465 @tab 22.00 mm @tab .8661 @tab 22.50 mm @tab .8858 +@item 23.00 mm @tab .9055 @tab 23.50 mm @tab .9252 @tab 24.00 mm @tab .9449 +@item 24.50 mm @tab .9646 @tab 25.00 mm @tab .9843 @tab @tab @end multitable + Index: 1.0.8/doc-orig/options.texi =================================================================== --- 1.0.8/doc-orig/options.texi (nonexistent) +++ 1.0.8/doc-orig/options.texi (revision 1136) @@ -0,0 +1,896 @@ +@c key options +@menu +* General Options:: +* General GUI Options:: +* GTK+ GUI Options:: +* lesstif GUI Options:: +* Colors:: +* Layer Names:: +* Paths:: +* Sizes:: +* Commands:: +* DRC Options:: +* BOM Creation:: +* Gerber Export:: +* Postscript Export:: +* Encapsulated Postscript Export:: +* PNG Options:: +* lpr Printing Options:: +* nelma Options:: +@end menu +@c options General Options +@node General Options +@section General Options +@c ./../src/main.c 434 +@ftable @code +@item --help +Show help on command line options. +@end ftable +@c ./../src/main.c 439 +@ftable @code +@item --version +Show version. +@end ftable +@c ./../src/main.c 443 +@ftable @code +@item --verbose +Be verbose on stdout. +@end ftable +@c ./../src/main.c 448 +@ftable @code +@item --copyright +Show copyright. +@end ftable +@c ./../src/main.c 453 +@ftable @code +@item --show-defaults +Show option defaults. +@end ftable +@c ./../src/main.c 458 +@ftable @code +@item --show-actions +Show available actions and exit. +@end ftable +@c ./../src/main.c 463 +@ftable @code +@item --dump-actions +Dump actions (for documentation). +@end ftable +@c ./../src/main.c 468 +@ftable @code +@item --grid-units-mm +Set default grid units. Can be mm or mil. Defaults to mil. +@end ftable +@c ./../src/main.c 686 +@ftable @code +@item --backup-interval +Time between automatic backups in seconds. Set to @code{0} to disable. +The default value is @code{60}. +@end ftable +@c ./../src/main.c 723 +@ftable @code +@item --groups +Layer group string. Defaults to @code{"1,c:2:3:4:5:6,s:7:8"}. +@end ftable +@c ./../src/main.c 788 +@ftable @code +@item --route-styles +A string that defines the route styles. Defaults to @* +@code{"Signal,1000,3600,2000,1000:Power,2500,6000,3500,1000 + :Fat,4000,6000,3500,1000:Skinny,600,2402,1181,600"} +@end ftable +@c ./../src/main.c 807 +@ftable @code +@item --element-path +A colon separated list of directories or commands (starts with '|'). +The path is passed to the program specified in @option{--element-command}. +@end ftable +@c ./../src/main.c 817 +@ftable @code +@item --action-script +If set, this file is executed at startup. +@end ftable +@c ./../src/main.c 822 +@ftable @code +@item --action-string +If set, this string of actions is executed at startup. +@end ftable +@c ./../src/main.c 827 +@ftable @code +@item --fab-author +Name of author to be put in the Gerber files. +@end ftable +@c ./../src/main.c 832 +@ftable @code +@item --layer-stack +Initial layer stackup, for setting up an export. A comma separated list of layer +names, layer numbers and layer groups. +@end ftable +@c ./../src/main.c 883 +@ftable @code +@item --save-last-command +If set, the last user command is saved. +@end ftable +@c ./../src/main.c 887 +@ftable @code +@item --save-in-tmp +If set, all data which would otherwise be lost are saved in a temporary file +@file{/tmp/PCB.%i.save} . Sequence @samp{%i} is replaced by the process ID. +@end ftable +@c ./../src/main.c 901 +@ftable @code +@item --reset-after-element +If set, all found connections are reset before a new component is scanned. +@end ftable +@c ./../src/main.c 906 +@ftable @code +@item --ring-bell-finished +Execute the bell command when all rats are routed. +@end ftable +@c options General GUI Options +@node General GUI Options +@section General GUI Options +@c ./../src/main.c 842 +@ftable @code +@item --pinout-offset-x +Horizontal offset of the pin number display. Defaults to @code{100mil}. +@end ftable +@c ./../src/main.c 847 +@ftable @code +@item --pinout-offset-y +Vertical offset of the pin number display. Defaults to @code{100mil}. +@end ftable +@c ./../src/main.c 852 +@ftable @code +@item --pinout-text-offset-x +Horizontal offset of the pin name display. Defaults to @code{800mil}. +@end ftable +@c ./../src/main.c 857 +@ftable @code +@item --pinout-text-offset-y +Vertical offset of the pin name display. Defaults to @code{-100mil}. +@end ftable +@c ./../src/main.c 862 +@ftable @code +@item --draw-grid +If set, draw the grid at start-up. +@end ftable +@c ./../src/main.c 866 +@ftable @code +@item --clear-line +If set, new lines clear polygons. +@end ftable +@c ./../src/main.c 870 +@ftable @code +@item --full-poly +If set, new polygons are full ones. +@end ftable +@c ./../src/main.c 874 +@ftable @code +@item --unique-names +If set, you will not be permitted to change the name of an component to match that +of another component. +@end ftable +@c ./../src/main.c 878 +@ftable @code +@item --snap-pin +If set, pin centers and pad end points are treated as additional grid points +that the cursor can snap to. +@end ftable +@c ./../src/main.c 892 +@ftable @code +@item --all-direction-lines +Allow all directions, when drawing new lines. +@end ftable +@c ./../src/main.c 897 +@ftable @code +@item --show-number +Pinout shows number. +@end ftable +@c options GTK+ GUI Options +@node GTK+ GUI Options +@section GTK+ GUI Options +@c ./../src/hid/gtk/gui-top-window.c 1615 +@ftable @code +@item --listen +Listen for actions on stdin. +@end ftable +@c ./../src/hid/gtk/gui-top-window.c 1621 +@ftable @code +@item --bg-image +File name of an image to put into the background of the GUI canvas. The image must +be a color PPM image, in binary (not ASCII) format. It can be any size, and will be +automatically scaled to fit the canvas. +@end ftable +@c ./../src/hid/gtk/gui-top-window.c 1627 +@ftable @code +@item --pcb-menu +Location of the @file{gpcb-menu.res} file which defines the menu for the GTK+ GUI. +@end ftable +@c options lesstif GUI Options +@node lesstif GUI Options +@section lesstif GUI Options +@c ./../src/hid/lesstif/main.c 201 +@ftable @code +@item --listen +Listen for actions on stdin. +@end ftable +@c ./../src/hid/lesstif/main.c 207 +@ftable @code +@item --bg-image +File name of an image to put into the background of the GUI canvas. The image must +be a color PPM image, in binary (not ASCII) format. It can be any size, and will be +automatically scaled to fit the canvas. +@end ftable +@c ./../src/hid/lesstif/main.c 213 +@ftable @code +@item --pcb-menu +Location of the @file{pcb-menu.res} file which defines the menu for the lesstif GUI. +@end ftable +@c options Colors +@node Colors +@section Colors +@c ./../src/main.c 473 +@ftable @code +@item --black-color +Color value for black. Default: @samp{#000000} +@end ftable +@c ./../src/main.c 477 +@ftable @code +@item --black-color +Color value for white. Default: @samp{#ffffff} +@end ftable +@c ./../src/main.c 481 +@ftable @code +@item --background-color +Background color of the canvas. Default: @samp{#e5e5e5} +@end ftable +@c ./../src/main.c 486 +@ftable @code +@item --crosshair-color +Color of the crosshair. Default: @samp{#ff0000} +@end ftable +@c ./../src/main.c 491 +@ftable @code +@item --cross-color +Color of the cross. Default: @samp{#cdcd00} +@end ftable +@c ./../src/main.c 495 +@ftable @code +@item --via-color +Color of vias. Default: @samp{#7f7f7f} +@end ftable +@c ./../src/main.c 499 +@ftable @code +@item --via-selected-color +Color of selected vias. Default: @samp{#00ffff} +@end ftable +@c ./../src/main.c 504 +@ftable @code +@item --pin-color +Color of pins. Default: @samp{#4d4d4d} +@end ftable +@c ./../src/main.c 508 +@ftable @code +@item --pin-selected-color +Color of selected pins. Default: @samp{#00ffff} +@end ftable +@c ./../src/main.c 513 +@ftable @code +@item --pin-name-color +Color of pin names and pin numbers. Default: @samp{#ff0000} +@end ftable +@c ./../src/main.c 518 +@ftable @code +@item --element-color +Color of components. Default: @samp{#000000} +@end ftable +@c ./../src/main.c 522 +@ftable @code +@item --rat-color +Color of ratlines. Default: @samp{#b8860b} +@end ftable +@c ./../src/main.c 526 +@ftable @code +@item --invisible-objects-color +Color of invisible objects. Default: @samp{#cccccc} +@end ftable +@c ./../src/main.c 531 +@ftable @code +@item --invisible-mark-color +Color of invisible marks. Default: @samp{#cccccc} +@end ftable +@c ./../src/main.c 536 +@ftable @code +@item --element-selected-color +Color of selected components. Default: @samp{#00ffff} +@end ftable +@c ./../src/main.c 541 +@ftable @code +@item --rat-selected-color +Color of selected rats. Default: @samp{#00ffff} +@end ftable +@c ./../src/main.c 546 +@ftable @code +@item --connected-color +Color to indicate connections. Default: @samp{#00ff00} +@end ftable +@c ./../src/main.c 551 +@ftable @code +@item --off-limit-color +Color of off-canvas area. Default: @samp{#cccccc} +@end ftable +@c ./../src/main.c 556 +@ftable @code +@item --grid-color +Color of the grid. Default: @samp{#ff0000} +@end ftable +@c ./../src/main.c 560 +@ftable @code +@item --layer-color- +Color of layer @code{}, where @code{} is an integer from 1 to 16. +@end ftable +@c ./../src/main.c 578 +@ftable @code +@item --layer-selected-color- +Color of layer @code{}, when selected. @code{} is an integer from 1 to 16. +@end ftable +@c ./../src/main.c 597 +@ftable @code +@item --warn-color +Color of offending objects during DRC. Default value is @code{"#ff8000"} +@end ftable +@c ./../src/main.c 601 +@ftable @code +@item --mask-color +Color of the mask layer. Default value is @code{"#ff0000"} +@end ftable +@c options Layer Names +@node Layer Names +@section Layer Names +@c ./../src/main.c 691 +@ftable @code +@item --layer-name-1 +Name of the 1st Layer. Default is @code{"top"}. +@end ftable +@c ./../src/main.c 695 +@ftable @code +@item --layer-name-2 +Name of the 2nd Layer. Default is @code{"ground"}. +@end ftable +@c ./../src/main.c 699 +@ftable @code +@item --layer-name-3 +Name of the 3nd Layer. Default is @code{"signal2"}. +@end ftable +@c ./../src/main.c 703 +@ftable @code +@item --layer-name-4 +Name of the 4rd Layer. Default is @code{"signal3"}. +@end ftable +@c ./../src/main.c 707 +@ftable @code +@item --layer-name-5 +Name of the 5rd Layer. Default is @code{"power"}. +@end ftable +@c ./../src/main.c 711 +@ftable @code +@item --layer-name-6 +Name of the 6rd Layer. Default is @code{"bottom"}. +@end ftable +@c ./../src/main.c 715 +@ftable @code +@item --layer-name-7 +Name of the 7rd Layer. Default is @code{"outline"}. +@end ftable +@c ./../src/main.c 719 +@ftable @code +@item --layer-name-8 +Name of the 8rd Layer. Default is @code{"spare"}. +@end ftable +@c options Paths +@node Paths +@section Paths +@c ./../src/main.c 769 +@ftable @code +@item --lib-newlib +Top level directory for the newlib style library. +@end ftable +@c ./../src/main.c 778 +@ftable @code +@item --lib-name +The default filename for the library. +@end ftable +@c ./../src/main.c 783 +@ftable @code +@item --default-font +The name of the default font. +@end ftable +@c ./../src/main.c 794 +@ftable @code +@item --file-path +A colon separated list of directories or commands (starts with '|'). The path +is passed to the program specified in @option{--file-command} together with the selected +filename. +@end ftable +@c ./../src/main.c 802 +@ftable @code +@item --font-path +A colon separated list of directories to search the default font. Defaults to +the default library path. +@end ftable +@c ./../src/main.c 812 +@ftable @code +@item --lib-path +A colon separated list of directories that will be passed to the commands specified +by @option{--element-command} and @option{--element-contents-command}. +@end ftable +@c options Sizes +@node Sizes +@section Sizes +@c ./../src/main.c 606 +All parameters should be given with an unit. If no unit is given, 1/100 mil +(cmil) will be used. Write units without space to the +number like @code{3mm}, not @code{3 mm}. +Valid Units are: + @table @samp + @item km + Kilometer + @item m + Meter + @item cm + Centimeter + @item mm + Millimeter + @item um + Micrometer + @item nm + Nanometer + @item in + Inch (1in = 0.0254m) + @item mil + Mil (1000mil = 1in) + @item cmil + Centimil (1/100 mil) +@end table + +@ftable @code +@item --via-thickness +Default diameter of vias. Default value is @code{60mil}. +@end ftable +@c ./../src/main.c 611 +@ftable @code +@item --via-drilling-hole +Default diameter of holes. Default value is @code{28mil}. +@end ftable +@c ./../src/main.c 616 +@ftable @code +@item --line-thickness +Default thickness of new lines. Default value is @code{10mil}. +@end ftable +@c ./../src/main.c 621 +@ftable @code +@item --rat-thickness +Thickness of rats. Values from 1 to 19 are fixed width in screen pixels. +Anything larger means PCB units (i.e. 100 means "1 mil"). Default value +is @code{10mil}. +@end ftable +@c ./../src/main.c 625 +@ftable @code +@item --keepaway +Default minimum distance between a track and adjacent copper. +Default value is @code{10mil}. +@end ftable +@c ./../src/main.c 629 +@ftable @code +@item --default-PCB-width +Default width of the canvas. Default value is @code{6000mil}. +@end ftable +@c ./../src/main.c 634 +@ftable @code +@item --default-PCB-height +Default height of the canvas. Default value is @code{5000mil}. +@end ftable +@c ./../src/main.c 639 +@ftable @code +@item --text-scale +Default text scale. This value is in percent. Default value is @code{100}. +@end ftable +@c ./../src/main.c 643 +@ftable @code +@item --alignment-distance +Specifies the distance between the board outline and alignment targets. +Default value is @code{2mil}. +@end ftable +@c ./../src/main.c 677 +@ftable @code +@item --grid +Initial grid size. Default value is @code{10mil}. +@end ftable +@c ./../src/main.c 681 +@ftable @code +@item --minimum polygon area +Minimum polygon area. +@end ftable +@c options Commands +@node Commands +@section Commands +@c ./../src/main.c 728 +pcb uses external commands for input output operations. These commands can be +configured at start-up to meet local requirements. The command string may include +special sequences @code{%f}, @code{%p} or @code{%a}. These are replaced when the +command is called. The sequence @code{%f} is replaced by the file name, +@code{%p} gets the path and @code{%a} indicates a package name. +@c ./../src/main.c 731 +@ftable @code +@item --font-command +Command to load a font. +@end ftable +@c ./../src/main.c 735 +@ftable @code +@item --file-command +Command to read a file. +@end ftable +@c ./../src/main.c 739 +@ftable @code +@item --element-command +Command to read a footprint. @* +Defaults to @code{"M4PATH='%p';export M4PATH;echo 'include(%f)' | m4"} +@end ftable +@c ./../src/main.c 745 +@ftable @code +@item --print-file +Command to print to a file. +@end ftable +@c ./../src/main.c 749 +@ftable @code +@item --lib-command-dir +Path to the command that queries the library. +@end ftable +@c ./../src/main.c 754 +@ftable @code +@item --lib-command +Command to query the library. @* +Defaults to @code{"QueryLibrary.sh '%p' '%f' %a"} +@end ftable +@c ./../src/main.c 759 +@ftable @code +@item --lib-contents-command +Command to query the contents of the library. @* +Defaults to @code{"ListLibraryContents.sh %p %f"} or, +on Windows builds, an empty string (to disable this feature). +@end ftable +@c ./../src/main.c 774 +@ftable @code +@item --save-command +Command to save to a file. +@end ftable +@c ./../src/main.c 798 +@ftable @code +@item --rat-command +Command for reading a netlist. Sequence @code{%f} is replaced by the netlist filename. +@end ftable +@c options DRC Options +@node DRC Options +@section DRC Options +@c ./../src/main.c 648 +All parameters should be given with an unit. If no unit is given, 1/100 mil +(cmil) will be used for backward compability. Valid units are given in section +@ref{Sizes}. +@c ./../src/main.c 652 +@ftable @code +@item --bloat +Minimum spacing. Default value is @code{10mil}. +@end ftable +@c ./../src/main.c 656 +@ftable @code +@item --shrink +Minimum touching overlap. Default value is @code{10mil}. +@end ftable +@c ./../src/main.c 660 +@ftable @code +@item --min-width +Minimum width of copper. Default value is @code{10mil}. +@end ftable +@c ./../src/main.c 664 +@ftable @code +@item --min-silk +Minimum width of lines in silk. Default value is @code{10mil}. +@end ftable +@c ./../src/main.c 668 +@ftable @code +@item --min-drill +Minimum diameter of holes. Default value is @code{15mil}. +@end ftable +@c ./../src/main.c 672 +@ftable @code +@item --min-ring +Minimum width of annular ring. Default value is @code{10mil}. +@end ftable +@c options BOM Creation +@node BOM Creation +@section BOM Creation +@c ./../src/hid/bom/bom.c 30 +@ftable @code +@item --bomfile +Name of the BOM output file. +@end ftable +@c ./../src/hid/bom/bom.c 35 +@ftable @code +@item --xyfile +Name of the XY output file. +@end ftable +@c ./../src/hid/bom/bom.c 41 +@ftable @code +@item --xy-unit +Unit of XY dimensions. Defaults to mil. +@end ftable +@c options Gerber Export +@node Gerber Export +@section Gerber Export +@c ./../src/hid/gerber/gerber.c 338 +@ftable @code +@item --gerberfile +Gerber output file prefix. Can include a path. +@end ftable +@c ./../src/hid/gerber/gerber.c 344 +@ftable @code +@item --all-layers +Output contains all layers, even empty ones. +@end ftable +@c ./../src/hid/gerber/gerber.c 350 +@ftable @code +@item --verbose +Print file names and aperture counts on stdout. +@end ftable +@c options Postscript Export +@node Postscript Export +@section Postscript Export +@c ./../src/hid/ps/ps.c 149 +@ftable @code +@item --psfile +Name of the postscript output file. Can contain a path. +@end ftable +@c ./../src/hid/ps/ps.c 155 +@ftable @code +@cindex drill-helper +@item --drill-helper +Print a centering target in large drill holes. +@end ftable +@c ./../src/hid/ps/ps.c 161 +@ftable @code +@cindex align-marks +@item --align-marks +Print alignment marks on each sheet. This is meant to ease alignment during exposure. +@end ftable +@c ./../src/hid/ps/ps.c 167 +@ftable @code +@item --outline +Print the contents of the outline layer on each sheet. +@end ftable +@c ./../src/hid/ps/ps.c 172 +@ftable @code +@item --mirror +Print mirror image. +@end ftable +@c ./../src/hid/ps/ps.c 178 +@ftable @code +@item --fill-page +Scale output to make the board fit the page. +@end ftable +@c ./../src/hid/ps/ps.c 184 +@ftable @code +@item --auto-mirror +Print mirror image of appropriate layers. +@end ftable +@c ./../src/hid/ps/ps.c 190 +@ftable @code +@item --ps-color +Postscript output in color. +@end ftable +@c ./../src/hid/ps/ps.c 196 +@ftable @code +@cindex ps-bloat +@item --ps-bloat +Amount to add to trace/pad/pin edges. +@end ftable +@c ./../src/hid/ps/ps.c 202 +@ftable @code +@cindex ps-invert +@item --ps-invert +Draw objects as white-on-black. +@end ftable +@c ./../src/hid/ps/ps.c 208 +@ftable @code +@item --media +Size of the media, the postscript is fitted to. The parameter +@code{} can be any of the standard names for paper size: @samp{A0} +to @samp{A10}, @samp{B0} to @samp{B10}, @samp{Letter}, @samp{11x17}, +@samp{Ledger}, @samp{Legal}, @samp{Executive}, @samp{A-Size}, @samp{B-size}, +@samp{C-Size}, @samp{D-size}, @samp{E-size}, @samp{US-Business_Card}, +@samp{Intl-Business_Card}. +@end ftable +@c ./../src/hid/ps/ps.c 214 +@ftable @code +@cindex psfade +@item --psfade +Fade amount for assembly drawings (0.0=missing, 1.0=solid). +@end ftable +@c ./../src/hid/ps/ps.c 220 +@ftable @code +@item --scale +Scale value to compensate for printer sizing errors (1.0 = full scale). +@end ftable +@c ./../src/hid/ps/ps.c 226 +@ftable @code +@cindex multi-file +@item --multi-file +Produce multiple files, one per page, instead of a single multi page file. +@end ftable +@c ./../src/hid/ps/ps.c 232 +@ftable @code +@item --xcalib +Paper width. Used for x-Axis calibration. +@end ftable +@c ./../src/hid/ps/ps.c 238 +@ftable @code +@item --ycalib +Paper height. Used for y-Axis calibration. +@end ftable +@c ./../src/hid/ps/ps.c 244 +@ftable @code +@item --drill-copper +Draw drill holes in pins / vias, instead of leaving solid copper. +@end ftable +@c ./../src/hid/ps/ps.c 250 +@ftable @code +@cindex show-legend +@item --show-legend +Print file name and scale on printout. +@end ftable +@c options Encapsulated Postscript Export +@node Encapsulated Postscript Export +@section Encapsulated Postscript Export +@c ./../src/hid/ps/eps.c 78 +@ftable @code +@item --eps-file +Name of the encapsulated postscript output file. Can contain a path. +@end ftable +@c ./../src/hid/ps/eps.c 84 +@ftable @code +@item --eps-scale +Scale EPS output by the parameter @samp{num}. +@end ftable +@c ./../src/hid/ps/eps.c 90 +@ftable @code +@cindex as-shown (EPS) +@item --as-shown +Export layers as shown on screen. +@end ftable +@c ./../src/hid/ps/eps.c 96 +@ftable @code +@item --monochrome +Convert output to monochrome. +@end ftable +@c ./../src/hid/ps/eps.c 102 +@ftable @code +@cindex only-visible +@item --only-visible +Limit the bounds of the EPS file to the visible items. +@end ftable +@c options PNG Options +@node PNG Options +@section PNG Options +@c ./../src/hid/png/png.c 168 +@ftable @code +@item --outfile +Name of the file to be exported to. Can contain a path. +@end ftable +@c ./../src/hid/png/png.c 174 +@ftable @code +@item --dpi +Scale factor in pixels/inch. Set to 0 to scale to size specified in the layout. +@end ftable +@c ./../src/hid/png/png.c 180 +@ftable @code +@item --x-max +Width of the png image in pixels. No constraint, when set to 0. +@end ftable +@c ./../src/hid/png/png.c 186 +@ftable @code +@item --y-max +Height of the png output in pixels. No constraint, when set to 0. +@end ftable +@c ./../src/hid/png/png.c 192 +@ftable @code +@item --xy-max +Maximum width and height of the PNG output in pixels. No constraint, when set to 0. +@end ftable +@c ./../src/hid/png/png.c 198 +@ftable @code +@item --as-shown +Export layers as shown on screen. +@end ftable +@c ./../src/hid/png/png.c 204 +@ftable @code +@item --monochrome +Convert output to monochrome. +@end ftable +@c ./../src/hid/png/png.c 210 +@ftable @code +@item --only-vivible +Limit the bounds of the exported PNG image to the visible items. +@end ftable +@c ./../src/hid/png/png.c 216 +@ftable @code +@item --use-alpha +Make the background and any holes transparent. +@end ftable +@c ./../src/hid/png/png.c 222 +@ftable @code +@item --format +File format to be exported. Parameter @code{} can be @samp{PNG}, +@samp{GIF}, or @samp{JPEG}. +@end ftable +@c ./../src/hid/png/png.c 228 +@ftable @code +@item --png-bloat +Amount of extra thickness to add to traces, pads, or pin edges. The parameter +@samp{} is a number, appended by a dimension @samp{mm}, @samp{mil}, or +@samp{pix}. If no dimension is given, the default dimension is 1/100 mil. +@end ftable +@c ./../src/hid/png/png.c 234 +@ftable @code +@cindex photo-mode +@item --photo-mode +Export a photo realistic image of the layout. +@end ftable +@c ./../src/hid/png/png.c 240 +@ftable @code +@item --photo-flip-x +In photo-realistic mode, export the reverse side of the layout. Left-right flip. +@end ftable +@c ./../src/hid/png/png.c 246 +@ftable @code +@item --photo-flip-y +In photo-realistic mode, export the reverse side of the layout. Up-down flip. +@end ftable +@c options lpr Printing Options +@node lpr Printing Options +@section lpr Printing Options +@c ./../src/hid/lpr/lpr.c 33 +@ftable @code +@item --lprcommand +Command to use for printing. Defaults to @code{lpr}. This can be used to produce +PDF output with a virtual PDF printer. Example: @* +@code{--lprcommand "lp -d CUPS-PDF-Printer"}. +@end ftable +@noindent In addition, all @ref{Postscript Export} options are valid. +@c options nelma Options +@node nelma Options +@section nelma Options +@c ./../src/hid/nelma/nelma.c 157 +@ftable @code +@item -- basename +File name prefix. +@end ftable +@c ./../src/hid/nelma/nelma.c 163 +@ftable @code +@item --dpi +Horizontal scale factor (grid points/inch). +@end ftable +@c ./../src/hid/nelma/nelma.c 169 +@ftable @code +@item --copper-height +Copper layer height (um). +@end ftable +@c ./../src/hid/nelma/nelma.c 175 +@ftable @code +@item --substrate-height +Substrate layer height (um). +@end ftable +@c ./../src/hid/nelma/nelma.c 181 +@ftable @code +@item --substrate-epsilon +Substrate relative epsilon. +@end ftable Index: 1.0.8/doc-orig/pad.pcb =================================================================== --- 1.0.8/doc-orig/pad.pcb (nonexistent) +++ 1.0.8/doc-orig/pad.pcb (revision 1136) @@ -0,0 +1,911 @@ +# release: pcb-bin 1.99q + +PCB["pad" 600000 500000] + +Grid[2000.00000000 0 0 1] +Cursor[88600 72400 2.000000] +Thermal[0.500000] +DRC[699 400 800 800 1000 750] +Flags(0x0000000000000840) +Groups("1,s:2,c:3:4:5:6:7:8") +Styles["Signal,1000,3600,2000,1000:Power,2500,6000,3500,1000:Fat,4000,6000,3500,1000:Skinny,200,2402,1181,600"] + +Symbol[' ' 1800] +( +) +Symbol['!' 1200] +( + SymbolLine[0 4500 0 5000 800] + SymbolLine[0 1000 0 3500 800] +) +Symbol['"' 1200] +( + SymbolLine[0 1000 0 2000 800] + SymbolLine[1000 1000 1000 2000 800] +) +Symbol['#' 1200] +( + SymbolLine[0 3500 2000 3500 800] + SymbolLine[0 2500 2000 2500 800] + SymbolLine[1500 2000 1500 4000 800] + SymbolLine[500 2000 500 4000 800] +) +Symbol['$' 1200] +( + SymbolLine[1500 1500 2000 2000 800] + SymbolLine[500 1500 1500 1500 800] + SymbolLine[0 2000 500 1500 800] + SymbolLine[0 2000 0 2500 800] + SymbolLine[0 2500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 4000 800] + SymbolLine[1500 4500 2000 4000 800] + SymbolLine[500 4500 1500 4500 800] + SymbolLine[0 4000 500 4500 800] + SymbolLine[1000 1000 1000 5000 800] +) +Symbol['%' 1200] +( + SymbolLine[0 1500 0 2000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1000 1000 800] + SymbolLine[1000 1000 1500 1500 800] + SymbolLine[1500 1500 1500 2000 800] + SymbolLine[1000 2500 1500 2000 800] + SymbolLine[500 2500 1000 2500 800] + SymbolLine[0 2000 500 2500 800] + SymbolLine[0 5000 4000 1000 800] + SymbolLine[3500 5000 4000 4500 800] + SymbolLine[4000 4000 4000 4500 800] + SymbolLine[3500 3500 4000 4000 800] + SymbolLine[3000 3500 3500 3500 800] + SymbolLine[2500 4000 3000 3500 800] + SymbolLine[2500 4000 2500 4500 800] + SymbolLine[2500 4500 3000 5000 800] + SymbolLine[3000 5000 3500 5000 800] +) +Symbol['&' 1200] +( + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 1500 0 2500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 3500 1500 2000 800] + SymbolLine[500 5000 1000 5000 800] + SymbolLine[1000 5000 2000 4000 800] + SymbolLine[0 2500 2500 5000 800] + SymbolLine[500 1000 1000 1000 800] + SymbolLine[1000 1000 1500 1500 800] + SymbolLine[1500 1500 1500 2000 800] + SymbolLine[0 3500 0 4500 800] +) +Symbol[''' 1200] +( + SymbolLine[0 2000 1000 1000 800] +) +Symbol['(' 1200] +( + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 4500 800] +) +Symbol[')' 1200] +( + SymbolLine[0 1000 500 1500 800] + SymbolLine[500 1500 500 4500 800] + SymbolLine[0 5000 500 4500 800] +) +Symbol['*' 1200] +( + SymbolLine[0 2000 2000 4000 800] + SymbolLine[0 4000 2000 2000 800] + SymbolLine[0 3000 2000 3000 800] + SymbolLine[1000 2000 1000 4000 800] +) +Symbol['+' 1200] +( + SymbolLine[0 3000 2000 3000 800] + SymbolLine[1000 2000 1000 4000 800] +) +Symbol[',' 1200] +( + SymbolLine[0 6000 1000 5000 800] +) +Symbol['-' 1200] +( + SymbolLine[0 3000 2000 3000 800] +) +Symbol['.' 1200] +( + SymbolLine[0 5000 500 5000 800] +) +Symbol['/' 1200] +( + SymbolLine[0 4500 3000 1500 800] +) +Symbol['0' 1200] +( + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4000 2000 2000 800] +) +Symbol['1' 1200] +( + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1000 1000 1000 5000 800] + SymbolLine[0 2000 1000 1000 800] +) +Symbol['2' 1200] +( + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 2000 1000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 2500 800] + SymbolLine[0 5000 2500 2500 800] + SymbolLine[0 5000 2500 5000 800] +) +Symbol['3' 1200] +( + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 3000 2000 3000 800] +) +Symbol['4' 1200] +( + SymbolLine[0 3000 2000 1000 800] + SymbolLine[0 3000 2500 3000 800] + SymbolLine[2000 1000 2000 5000 800] +) +Symbol['5' 1200] +( + SymbolLine[0 1000 2000 1000 800] + SymbolLine[0 1000 0 3000 800] + SymbolLine[0 3000 500 2500 800] + SymbolLine[500 2500 1500 2500 800] + SymbolLine[1500 2500 2000 3000 800] + SymbolLine[2000 3000 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['6' 1200] +( + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[0 3000 1500 3000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[2000 3500 2000 4500 800] +) +Symbol['7' 1200] +( + SymbolLine[0 5000 2500 2500 800] + SymbolLine[2500 1000 2500 2500 800] + SymbolLine[0 1000 2500 1000 800] +) +Symbol['8' 1200] +( + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 2500 500 3000 800] + SymbolLine[0 1500 0 2500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 2500 800] + SymbolLine[1500 3000 2000 2500 800] +) +Symbol['9' 1200] +( + SymbolLine[0 5000 2000 3000 800] + SymbolLine[2000 1500 2000 3000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 2500 800] + SymbolLine[0 2500 500 3000 800] + SymbolLine[500 3000 2000 3000 800] +) +Symbol[':' 1200] +( + SymbolLine[0 2500 500 2500 800] + SymbolLine[0 3500 500 3500 800] +) +Symbol[';' 1200] +( + SymbolLine[0 5000 1000 4000 800] + SymbolLine[1000 2500 1000 3000 800] +) +Symbol['<' 1200] +( + SymbolLine[0 3000 1000 2000 800] + SymbolLine[0 3000 1000 4000 800] +) +Symbol['=' 1200] +( + SymbolLine[0 2500 2000 2500 800] + SymbolLine[0 3500 2000 3500 800] +) +Symbol['>' 1200] +( + SymbolLine[0 2000 1000 3000 800] + SymbolLine[0 4000 1000 3000 800] +) +Symbol['?' 1200] +( + SymbolLine[1000 3000 1000 3500 800] + SymbolLine[1000 4500 1000 5000 800] + SymbolLine[0 1500 0 2000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 2000 800] + SymbolLine[1000 3000 2000 2000 800] +) +Symbol['@' 1200] +( + SymbolLine[0 1000 0 4000 800] + SymbolLine[0 4000 1000 5000 800] + SymbolLine[1000 5000 4000 5000 800] + SymbolLine[5000 3500 5000 1000 800] + SymbolLine[5000 1000 4000 0 800] + SymbolLine[4000 0 1000 0 800] + SymbolLine[1000 0 0 1000 800] + SymbolLine[1500 2000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 3000 3500 800] + SymbolLine[3000 3500 3500 3000 800] + SymbolLine[3500 3000 4000 3500 800] + SymbolLine[3500 3000 3500 1500 800] + SymbolLine[3500 2000 3000 1500 800] + SymbolLine[2000 1500 3000 1500 800] + SymbolLine[2000 1500 1500 2000 800] + SymbolLine[4000 3500 5000 3500 800] +) +Symbol['A' 1200] +( + SymbolLine[0 1500 0 5000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 2000 1000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 5000 800] + SymbolLine[0 3000 2500 3000 800] +) +Symbol['B' 1200] +( + SymbolLine[0 5000 2000 5000 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[2500 3500 2500 4500 800] + SymbolLine[2000 3000 2500 3500 800] + SymbolLine[500 3000 2000 3000 800] + SymbolLine[500 1000 500 5000 800] + SymbolLine[0 1000 2000 1000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 2500 800] + SymbolLine[2000 3000 2500 2500 800] +) +Symbol['C' 1200] +( + SymbolLine[500 5000 2000 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 2000 1000 800] +) +Symbol['D' 1200] +( + SymbolLine[500 1000 500 5000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 4500 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[0 5000 2000 5000 800] + SymbolLine[0 1000 2000 1000 800] +) +Symbol['E' 1200] +( + SymbolLine[0 3000 1500 3000 800] + SymbolLine[0 5000 2000 5000 800] + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 1000 2000 1000 800] +) +Symbol['F' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 1000 2000 1000 800] + SymbolLine[0 3000 1500 3000 800] +) +Symbol['G' 1200] +( + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[500 1000 2000 1000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 2000 5000 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[2500 3500 2500 4500 800] + SymbolLine[2000 3000 2500 3500 800] + SymbolLine[1000 3000 2000 3000 800] +) +Symbol['H' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[2500 1000 2500 5000 800] + SymbolLine[0 3000 2500 3000 800] +) +Symbol['I' 1200] +( + SymbolLine[0 1000 1000 1000 800] + SymbolLine[500 1000 500 5000 800] + SymbolLine[0 5000 1000 5000 800] +) +Symbol['J' 1200] +( + SymbolLine[0 1000 1500 1000 800] + SymbolLine[1500 1000 1500 4500 800] + SymbolLine[1000 5000 1500 4500 800] + SymbolLine[500 5000 1000 5000 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['K' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 3000 2000 1000 800] + SymbolLine[0 3000 2000 5000 800] +) +Symbol['L' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 5000 2000 5000 800] +) +Symbol['M' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 1000 1500 2500 800] + SymbolLine[1500 2500 3000 1000 800] + SymbolLine[3000 1000 3000 5000 800] +) +Symbol['N' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 1000 0 1500 800] + SymbolLine[0 1500 2500 4000 800] + SymbolLine[2500 1000 2500 5000 800] +) +Symbol['O' 1200] +( + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['P' 1200] +( + SymbolLine[500 1000 500 5000 800] + SymbolLine[0 1000 2000 1000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 2500 800] + SymbolLine[2000 3000 2500 2500 800] + SymbolLine[500 3000 2000 3000 800] +) +Symbol['Q' 1200] +( + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[1000 4000 2000 5000 800] +) +Symbol['R' 1200] +( + SymbolLine[0 1000 2000 1000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 2500 800] + SymbolLine[2000 3000 2500 2500 800] + SymbolLine[500 3000 2000 3000 800] + SymbolLine[500 1000 500 5000 800] + SymbolLine[500 3000 2500 5000 800] +) +Symbol['S' 1200] +( + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[500 1000 2000 1000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 2500 800] + SymbolLine[0 2500 500 3000 800] + SymbolLine[500 3000 2000 3000 800] + SymbolLine[2000 3000 2500 3500 800] + SymbolLine[2500 3500 2500 4500 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[500 5000 2000 5000 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['T' 1200] +( + SymbolLine[0 1000 2000 1000 800] + SymbolLine[1000 1000 1000 5000 800] +) +Symbol['U' 1200] +( + SymbolLine[0 1000 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[2000 1000 2000 4500 800] +) +Symbol['V' 1200] +( + SymbolLine[0 1000 0 4000 800] + SymbolLine[0 4000 1000 5000 800] + SymbolLine[1000 5000 2000 4000 800] + SymbolLine[2000 1000 2000 4000 800] +) +Symbol['W' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 5000 1500 3500 800] + SymbolLine[1500 3500 3000 5000 800] + SymbolLine[3000 1000 3000 5000 800] +) +Symbol['X' 1200] +( + SymbolLine[0 1000 0 1500 800] + SymbolLine[0 1500 2500 4000 800] + SymbolLine[2500 4000 2500 5000 800] + SymbolLine[0 4000 0 5000 800] + SymbolLine[0 4000 2500 1500 800] + SymbolLine[2500 1000 2500 1500 800] +) +Symbol['Y' 1200] +( + SymbolLine[0 1000 0 1500 800] + SymbolLine[0 1500 1000 2500 800] + SymbolLine[1000 2500 2000 1500 800] + SymbolLine[2000 1000 2000 1500 800] + SymbolLine[1000 2500 1000 5000 800] +) +Symbol['Z' 1200] +( + SymbolLine[0 1000 2500 1000 800] + SymbolLine[2500 1000 2500 1500 800] + SymbolLine[0 4000 2500 1500 800] + SymbolLine[0 4000 0 5000 800] + SymbolLine[0 5000 2500 5000 800] +) +Symbol['[' 1200] +( + SymbolLine[0 1000 500 1000 800] + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 5000 500 5000 800] +) +Symbol['\' 1200] +( + SymbolLine[0 1500 3000 4500 800] +) +Symbol[']' 1200] +( + SymbolLine[0 1000 500 1000 800] + SymbolLine[500 1000 500 5000 800] + SymbolLine[0 5000 500 5000 800] +) +Symbol['^' 1200] +( + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1000 1500 800] +) +Symbol['_' 1200] +( + SymbolLine[0 5000 2000 5000 800] +) +Symbol['a' 1200] +( + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[2000 3000 2000 4500 800] + SymbolLine[2000 4500 2500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] +) +Symbol['b' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[2000 3500 2000 4500 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[0 3500 500 3000 800] +) +Symbol['c' 1200] +( + SymbolLine[500 3000 2000 3000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 2000 5000 800] +) +Symbol['d' 1200] +( + SymbolLine[2000 1000 2000 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] +) +Symbol['e' 1200] +( + SymbolLine[500 5000 2000 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[0 4000 2000 4000 800] + SymbolLine[2000 4000 2000 3500 800] +) +Symbol['f' 1000] +( + SymbolLine[500 1500 500 5000 800] + SymbolLine[500 1500 1000 1000 800] + SymbolLine[1000 1000 1500 1000 800] + SymbolLine[0 3000 1000 3000 800] +) +Symbol['g' 1200] +( + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[0 6000 500 6500 800] + SymbolLine[500 6500 1500 6500 800] + SymbolLine[1500 6500 2000 6000 800] + SymbolLine[2000 3000 2000 6000 800] +) +Symbol['h' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 5000 800] +) +Symbol['i' 1000] +( + SymbolLine[0 2000 0 2500 800] + SymbolLine[0 3500 0 5000 800] +) +Symbol['j' 1000] +( + SymbolLine[500 2000 500 2500 800] + SymbolLine[500 3500 500 6000 800] + SymbolLine[0 6500 500 6000 800] +) +Symbol['k' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 3500 1500 5000 800] + SymbolLine[0 3500 1000 2500 800] +) +Symbol['l' 1000] +( + SymbolLine[0 1000 0 4500 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['m' 1200] +( + SymbolLine[500 3500 500 5000 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[1000 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 5000 800] + SymbolLine[2000 3500 2500 3000 800] + SymbolLine[2500 3000 3000 3000 800] + SymbolLine[3000 3000 3500 3500 800] + SymbolLine[3500 3500 3500 5000 800] + SymbolLine[0 3000 500 3500 800] +) +Symbol['n' 1200] +( + SymbolLine[500 3500 500 5000 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[1000 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 5000 800] + SymbolLine[0 3000 500 3500 800] +) +Symbol['o' 1200] +( + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['p' 1200] +( + SymbolLine[500 3500 500 6500 800] + SymbolLine[0 3000 500 3500 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[1000 3000 2000 3000 800] + SymbolLine[2000 3000 2500 3500 800] + SymbolLine[2500 3500 2500 4500 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[1000 5000 2000 5000 800] + SymbolLine[500 4500 1000 5000 800] +) +Symbol['q' 1200] +( + SymbolLine[2000 3500 2000 6500 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] +) +Symbol['r' 1200] +( + SymbolLine[500 3500 500 5000 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[1000 3000 2000 3000 800] + SymbolLine[0 3000 500 3500 800] +) +Symbol['s' 1200] +( + SymbolLine[500 5000 2000 5000 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[2000 4000 2500 4500 800] + SymbolLine[500 4000 2000 4000 800] + SymbolLine[0 3500 500 4000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 2000 3000 800] + SymbolLine[2000 3000 2500 3500 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['t' 1000] +( + SymbolLine[500 1000 500 4500 800] + SymbolLine[500 4500 1000 5000 800] + SymbolLine[0 2500 1000 2500 800] +) +Symbol['u' 1200] +( + SymbolLine[0 3000 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[2000 3000 2000 4500 800] +) +Symbol['v' 1200] +( + SymbolLine[0 3000 0 4000 800] + SymbolLine[0 4000 1000 5000 800] + SymbolLine[1000 5000 2000 4000 800] + SymbolLine[2000 3000 2000 4000 800] +) +Symbol['w' 1200] +( + SymbolLine[0 3000 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1000 5000 800] + SymbolLine[1000 5000 1500 4500 800] + SymbolLine[1500 3000 1500 4500 800] + SymbolLine[1500 4500 2000 5000 800] + SymbolLine[2000 5000 2500 5000 800] + SymbolLine[2500 5000 3000 4500 800] + SymbolLine[3000 3000 3000 4500 800] +) +Symbol['x' 1200] +( + SymbolLine[0 3000 2000 5000 800] + SymbolLine[0 5000 2000 3000 800] +) +Symbol['y' 1200] +( + SymbolLine[0 3000 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[2000 3000 2000 6000 800] + SymbolLine[1500 6500 2000 6000 800] + SymbolLine[500 6500 1500 6500 800] + SymbolLine[0 6000 500 6500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] +) +Symbol['z' 1200] +( + SymbolLine[0 3000 2000 3000 800] + SymbolLine[0 5000 2000 3000 800] + SymbolLine[0 5000 2000 5000 800] +) +Symbol['{' 1200] +( + SymbolLine[500 1500 1000 1000 800] + SymbolLine[500 1500 500 2500 800] + SymbolLine[0 3000 500 2500 800] + SymbolLine[0 3000 500 3500 800] + SymbolLine[500 3500 500 4500 800] + SymbolLine[500 4500 1000 5000 800] +) +Symbol['|' 1200] +( + SymbolLine[0 1000 0 5000 800] +) +Symbol['}' 1200] +( + SymbolLine[0 1000 500 1500 800] + SymbolLine[500 1500 500 2500 800] + SymbolLine[500 2500 1000 3000 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[500 3500 500 4500 800] + SymbolLine[0 5000 500 4500 800] +) +Symbol['~' 1200] +( + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1000 3000 800] + SymbolLine[1000 3000 1500 3500 800] + SymbolLine[1500 3500 2000 3500 800] + SymbolLine[2000 3500 2500 3000 800] +) +Layer(1 "component") +( + Line[106000 144000 262000 144000 1000 2000 "clearline"] + Line[106000 144000 106000 84000 1000 2000 "clearline"] + Line[106000 84000 262000 84000 1000 2000 "clearline"] + Line[262000 84000 262000 144000 1000 2000 "clearline"] +) +Layer(2 "solder") +( + Line[256000 90000 256000 138000 1000 2000 "clearline"] + Line[112000 138000 112000 90000 1000 2000 "clearline"] + Line[112000 90000 256000 90000 1000 2000 "clearline"] + Line[112000 138000 256000 138000 1000 2000 "clearline"] +) +Layer(3 "GND") +( +) +Layer(4 "power") +( +) +Layer(5 "signal1") +( + Polygon("clearpoly") + ( + [118000 96000] [250000 96000] [250000 132000] [118000 132000] + ) +) +Layer(6 "signal2") +( +) +Layer(7 "unused") +( +) +Layer(8 "unused") +( +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( + Line[118000 96000 118000 132000 500 2000 "clearline"] + Line[118000 132000 154000 132000 500 2000 "clearline"] + Line[154000 132000 154000 96000 500 2000 "clearline"] + Line[154000 96000 118000 96000 500 2000 "clearline"] + Line[136000 152000 136000 120000 500 1200 "clearline"] + Line[136000 120000 132000 124000 500 1200 "clearline"] + Line[132000 114000 140000 114000 1010 1200 "clearline"] + Line[140000 124000 136000 120000 500 1200 "clearline"] + Line[98000 90000 94000 94000 500 1200 "clearline"] + Line[214000 76000 250000 76000 500 1200 "clearline"] + Line[98000 138000 98000 90000 500 1200 "clearline"] + Line[270000 96000 266000 100000 500 1200 "clearline"] + Line[136000 110000 136000 118000 1010 1200 "clearline"] + Line[214000 96000 214000 132000 500 2000 "clearline"] + Line[252000 132000 276000 132000 500 1200 "clearline"] + Line[218000 72000 214000 76000 500 1200 "clearline"] + Line[214000 76000 218000 80000 500 1200 "clearline"] + Line[270000 96000 274000 100000 500 1200 "clearline"] + Line[252000 96000 276000 96000 500 1200 "clearline"] + Line[214000 132000 250000 132000 500 2000 "clearline"] + Line[136000 90000 140000 86000 500 1200 "clearline"] + Line[232000 150000 232000 120000 500 1200 "clearline"] + Line[236000 124000 232000 120000 500 1200 "clearline"] + Line[232000 110000 232000 118000 1010 1200 "clearline"] + Line[232000 120000 228000 124000 500 1200 "clearline"] + Line[204000 114000 212000 114000 500 1200 "clearline"] + Line[212000 114000 208000 110000 500 1200 "clearline"] + Line[212000 114000 208000 118000 500 1200 "clearline"] + Line[214000 94000 214000 70000 500 1200 "clearline"] + Line[250000 94000 250000 70000 500 1200 "clearline"] + Line[204000 114000 204000 48000 500 1200 "clearline"] + Line[136000 90000 132000 86000 500 1200 "clearline"] + Line[270000 132000 266000 128000 500 1200 "clearline"] + Line[250000 132000 250000 96000 500 2000 "clearline"] + Line[250000 96000 214000 96000 500 2000 "clearline"] + Line[160000 90000 112000 90000 500 2000 "clearline"] + Line[160000 138000 112000 138000 500 2000 "clearline"] + Line[112000 90000 112000 138000 500 2000 "clearline"] + Line[160000 90000 160000 138000 500 2000 "clearline"] + Line[136000 74000 136000 90000 500 1200 "clearline"] + Line[270000 132000 274000 128000 500 1200 "clearline"] + Line[228000 114000 236000 114000 1010 1200 "clearline"] + Line[270000 132000 270000 96000 500 1200 "clearline"] + Line[250000 76000 246000 72000 500 1200 "clearline"] + Line[250000 76000 246000 80000 500 1200 "clearline"] + Line[92000 90000 110000 90000 500 1200 "clearline"] + Line[186000 96000 190000 92000 500 1200 "clearline"] + Line[186000 96000 182000 92000 500 1200 "clearline"] + Line[186000 64000 186000 96000 500 1200 "clearline"] + Line[98000 138000 94000 134000 500 1200 "clearline"] + Line[98000 138000 102000 134000 500 1200 "clearline"] + Line[98000 90000 102000 94000 500 1200 "clearline"] + Line[92000 138000 110000 138000 500 1200 "clearline"] + Line[214000 138000 210000 142000 500 1200 "clearline"] + Line[218000 142000 214000 138000 500 1200 "clearline"] + Line[214000 168000 214000 138000 500 1200 "clearline"] + Line[192000 144000 188000 148000 500 1200 "clearline"] + Line[196000 148000 192000 144000 500 1200 "clearline"] + Line[192000 184000 192000 144000 500 1200 "clearline"] + Line[168000 144000 164000 148000 500 1200 "clearline"] + Line[172000 148000 168000 144000 500 1200 "clearline"] + Line[168000 176000 168000 144000 500 1200 "clearline"] + Line[168000 132000 172000 128000 500 1200 "clearline"] + Line[168000 132000 164000 128000 500 1200 "clearline"] + Line[168000 120000 168000 132000 500 1200 "clearline"] + Text[106000 152000 0 200 "(X0,Y0)" ""] + Text[224000 150000 0 200 "(X1,Y1)" ""] + Text[226000 72000 1 200 "SIZE" ""] + Text[41000 106000 0 200 "Mask Size" ""] + Text[56000 62000 0 200 "Mask Aperture" ""] + Text[130000 52000 0 200 "Pad Shape" ""] + Text[272000 110000 0 200 "SIZE" ""] + Text[132000 36000 0 200 "Pad Aperture" ""] + Text[210000 168000 0 200 "Soldermask Opening" ""] + Text[188000 186000 0 200 "Clearance to non-connecting" ""] + Text[188000 198000 0 200 "polygons" ""] + Text[102000 176000 0 200 "Clearance/2" ""] +) Index: 1.0.8/doc-orig/pad.pdf =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-orig/pad.pdf =================================================================== --- 1.0.8/doc-orig/pad.pdf (nonexistent) +++ 1.0.8/doc-orig/pad.pdf (revision 1136) Property changes on: 1.0.8/doc-orig/pad.pdf ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-orig/pad.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-orig/pad.png =================================================================== --- 1.0.8/doc-orig/pad.png (nonexistent) +++ 1.0.8/doc-orig/pad.png (revision 1136) Property changes on: 1.0.8/doc-orig/pad.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-orig/pcb.1 =================================================================== --- 1.0.8/doc-orig/pcb.1 (nonexistent) +++ 1.0.8/doc-orig/pcb.1 (revision 1136) @@ -0,0 +1,45 @@ +.\" +.\" 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. +.\" + +.TH PCB 1 + +.SH NAME +.B pcb +\- Printed circuit board layout tool + +.SH SYNOPSIS +.B pcb [options] [pcb file] + +.SH DESCRIPTION +The +.B pcb +program is a tool for the layout of printed circuit boards. +The complete manual for +.B pcb +is provided in a GNU texinfo format as well as HTML and PDF. +The texinfo version of the manual is typically viewed with the +.B info +program or alternatively with +.B emacs +or a graphical info viewer such as +.B tkinfo. +The PDF and HTML documentation is typically installed as +/usr/local/share/pcb/pcb.html and /usr/local/share/pcb/pcb.pdf. +The prefix "/usr/local" may vary at your site. + + + + Index: 1.0.8/doc-orig/pcb.css =================================================================== --- 1.0.8/doc-orig/pcb.css (nonexistent) +++ 1.0.8/doc-orig/pcb.css (revision 1136) @@ -0,0 +1,11 @@ +table.cartouche { + border-collapse: collapse; + border: 1px solid #800000; + width: 100%; +} +table.cartouche td { + padding: 4px; +} +pre.format { + font-family: monospace; +} Index: 1.0.8/doc-orig/pcb.html =================================================================== --- 1.0.8/doc-orig/pcb.html (nonexistent) +++ 1.0.8/doc-orig/pcb.html (revision 1136) @@ -0,0 +1,13072 @@ + + +Pcb + + + + + + + + + +

Pcb

+
+ +


+Next: , +Up: (dir) + +
+ +

Pcb

+ +

This document is a manual for Pcb, the open source, interactive printed circuit +board layout system. + +

+ + +
+ +


+Next: , +Previous: Top, +Up: Top + +
+ +

Copying

+ +

Copyright © 1994,1995,1996,1997 Thomas Nau + +

Copyright © 1998,1999,2000,2001,2002 harry eaton + +

This program is free software; you may 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 +MERCHANT-ABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + + +

+ +


+Next: , +Previous: Copying, +Up: Top + +
+ +

History

+ +

Pcb is a handy tool for laying out printed circuit +boards. + +

Pcb was first written by Thomas Nau for an Atari ST in 1990 and +ported to UNIX and X11 in 1994. +It was not intended as a professional layout system, +but as a tool which supports people who do some +home-developing of hardware. + +

The second release 1.2 included menus for the first time. This made +Pcb easier to use and thus a more important tool. + +

Release 1.3 introduced undo for highly-destructive commands, +more straightforward action handling and scalable fonts. Layer-groups +were introduced to group signal-layers together. + +

Release 1.4 provided support for add-on device drivers. +Two layers (the solder and the component side) +were added to support SMD elements. The handling of libraries +was also improved in 1.4.1. Support for additional devices like +GERBER plotters started in 1.4.4. The undo feature was expanded +and the redo-feature added in 1.4.5. + +

harry eaton took over pcb development beginning with Release 1.5, +although he contributed some code beginning with Release 1.4.3 + +

Release 1.5 provides support for rats-nest generation from simple net +lists. It also allows for automatic clearances around pins that pierce +a polygon. A variety of other enhancements including a Gerber RS-274X +driver and NC drill file generation have also been added. + +

Release 1.6 provides automatic screen updates of changed regions. +This should eliminate most of the need for the redraw ((R key). +Also some changes to what order items under the cursor are selected +were made for better consistency - it is no longer possible to +accidentally move a line or line point that is completely obscured +by a polygon laying over top of it. Larger objects on the upper +most layers can be selected ahead of smaller objects on lower layers. +These changes make operations more intuitive. A new mode of line +creation was added that creates two line on 45 degree angles +with a single click. The actual outline of the prospective line(s) are +now shown during line creation. An arc creation mode was added. +Drawn arcs are quarter circles and can be useful for high frequency +controlled impedance lines. (You can have eighth circle arc if the +source is compiled with -DARC45, but be aware that the ends of such +arcs can never intersect a grid point). Two new flags for pins and +vias were created - one indicates that the pin or via is purely a +drill hole and has no copper annulus. You can only toggle this flag +for vias - for elements, it must be an integral part of the element +definition. The other flag controls whether the pad will be round +or octagonal. There is also now a feature for converting the contents +of a buffer into an element. + +

Release 1.6.1 added the ability to make groups of action commands bound to +a single X11 event to be undone by a single undo. Also a simple design rule +checker was added - it checks for minimum spacing and overlap rules. Plus +many fixes for bugs introduced with the many changes of 1.6 + +

Release 1.7 added support for routing tracks through polygons without touching +them. It also added support for unplated drill files, and drawing directly +on the silk layer. A Netlist window for easily working with netlist was also added. + +

Release 2.0 adds an auto-router, a new simpler library mechanism, much improved +support for graphically creating (and editing) elements, viewable solder-mask +layers (and editing), snap to pins and pads, netlist entry by drawing rats, element +files (and libraries) that can contain whole sub-layouts, metric grids, improved +user interface, a GNU autoconf/automake based build system, and a host +of other improvements. + +

Special thanks goes to: +

     Thomas Nau (who started the project and wrote the early versions).
+     C. Scott Ananian (who wrote the auto-router code).
+     Bernhard Daeubler (Bernhard.Daeubler@physik.uni-ulm.de)
+     Harald Daeubler (Harald.Daeubler@physik.uni-ulm.de)
+     DJ Delorie (djdelorie@users.sourceforge.net)
+     Larry Doolittle (ldoolitt@recycle.lbl.gov)
+     Dan McMahill (danmc@users.sourceforge.net)
+     Roland Merk (merk@faw.uni-ulm.de)
+     Erland Unruh (Erland.Unruh@malmo.trab.se)
+     Albert John FitzPatrick III (ajf_nylorac@acm.org)
+     Boerge Strand (borges@ifi.uio.no)
+     Andre M. Hedrick (hedrick@Astro.Dyer.Vanderbilt.Edu)
+
+

who provided all sorts of help including porting Pcb to +several operating systems and platforms, bug fixes, library enhancement, +user interface suggestions and more. In addition to these people, +many others donated time for bug-fixing and +other important work. Some of them can be identified in the source code +files. Thanks to all of them. If you feel left out of this list, I +apologize; please send me an e-mail and I'll try to correct the omission. + + +

+ +


+Next: , +Previous: History, +Up: Top + +
+ +

1 Overview

+ +

+Pcb is an open source printed circuit board editor. +Pcb includes many professional features such as: +

    +
  • Up to 16 copper layer designs by default. By changing a compile time setting, this +can be set as high as needed. +
  • RS-274X (Gerber) output +
  • NC Drill output +
  • Centroid (X-Y) data output +
  • Postscript and Encapsulated Postscript output +
  • Autorouter +
  • Trace optimizer +
  • Rats nest +
  • Design Rule Checker (DRC) +
  • Connectivity verification +
  • Pcb is Free Software +
  • Can interoperate with free schematic capture tools such as gEDA and + xcircuit +
  • Runs under Linux, NetBSD, Solaris, and other similar operating +systems. +
  • Windows version is available +
+ + +
+ +


+Next: , +Previous: Overview, +Up: Top + +
+ +

2 Introduction

+ +

+Each layout consists of several, mostly independent, objects. This chapter +gives an overview of the object types and their relationship to each other. +For a complete description of how to use Pcb, refer to +Getting Started. +The layout is generated on-screen on a grid that can have its origin +at any desired location. +The X coordinate increases to the right, Y increases down to the bottom. +All distances and sizes in Pcb are measured in mils +(0.001 inch). One unit on the coordinate display is one mil in +distance on the board. +The grid may be set on a metric pitch, but is only correct to within +the nearest +/- 0.01 mil because Pcb stores all dimensions as +integer multiples of 1/100 of a mil or 0.00001 inch. + +

The sections in this chapter are sorted by the +order of appearance of the objects within a layout file. + +

+ +
+ +


+Next: , +Up: Intro + +
+ +

2.1 Symbols

+ +

+The top object is the layout itself. It uses a set of symbols +that resides at the first logical level. Each symbol is uniquely identified +by a seven bit ASCII code. All layout objects share the same set of +symbols. These symbols are used to form text objects on the silkscreen +and copper layers. Undefined symbols are drawn as filled rectangles. + +

Every font file is preprocessed by a user-defined command when it is loaded. +For details see ‘fontCommand’, Resources. + +

+ +


+Next: , +Previous: Symbol Objects, +Up: Intro + +
+ +

2.2 Vias

+ +

+Vias provide through-hole connectivity across all layers. +While vias look a lot like element pins, don't use vias +for adding elements to the layout, even if that seems +easier than creating a new element. The default solder-mask +will cover over vias, so you won't be able to solder to them. +Of course, you can change this so that vias also have +solder-mask cut-outs, but it is not the default. +Vias are also useful for defining arbitrary drill points such as +those used for mounting a board. Vias used in this way have +a special flag set so that they have no annular copper ring, +and also appear in the unplated drill file. Ctrl-H key over +a via switches it between being a pure-mounting hole and a regular via. +You can assign a name to a via, which is useful during the creation +of new element definitions. +Each via exists on all copper layers. (i.e. +blind and buried vias are not supported) + +

+ +


+Next: , +Previous: Via Objects, +Up: Intro + +
+ +

2.3 Elements

+ +

+Elements represent the components on a board. +Elements are loaded from ASCII coded files in a +similar manner to the layout file itself, or from the +library selector window. +An element is composed of lines and arcs on the silk-screen +layer (used to define the package outline), pins +(or pads for SMD) and three labels that define the +description, the element's layout-name (which also +appears on the silk-screen layer) and its value. You +can choose which of the names are displayed on the screen +with the Screen menu; however, the silk screen in +the printout will always show the layout-name. +Element pins are contained on the first logical level +and so reside on all layers, but the pads of surface-mount +elements reside on only the component or solder +layers. An element can have a mixture of pins, pads +(on one or both sides), and mounting holes. + +

A mark is used to position the element with +respect to the cross hair during pasting. +The mark will lie on a grid point when the element +is positioned. The mark is drawn as a small diamond +shape, but is only visible when both the silk +and pins/pads layers are visible. +All parts of an element are treated as one unit, except for +the name. +It is not possible to delete a single pin or move +only part of an element on the layout. +You can resize separate pieces of an element, +but doing so is usually a bad idea. You can move/rotate +the element name independently of the element it belongs +to. When you move an element name, a line is draw from +the cursor to the element mark so it is easy to tell +which element the name belongs to. + +

Each pin and pad has two string identifiers, one is the +"name" which is a functional description of the pin +(e.g. "clock in") and the other is the "number" of the +pin which is used to identify it in a netlist. The "number" +is usually an integer, but it can be any string. You +can edit the "name" of each pin of an element, but the +"number" is embedded in the element definition and is +determined when the new element is first created. +Pads are similar to lines on a layer but they must be oriented +either vertically or horizontally. +Pads can have either rounded or square ends. Pins +can be round, square, or octagonal. + +

Elements are supported by several special layers: silk, pins/pads and +far-side. The silk layer shows the package outline and +also holds legend text and element names. The pins/pads layer is used to toggle +whether the element's pins and pads are displayed. The far-side layer controls visibility +of objects (silkscreen and pads) that are on the far (i.e. not currently viewed) side +of the board. + +

The “oldlib” style of footprint libraries distributed with +Pcb rely upon the M4 macro processor. M4 is typically +installed under the name m4 on most unix-like operating +systems. It is recommended that you use the GNU version of M4 to +avoid limitations found in some vendor implementations. See the m4 +man page on your system for more information. +Every element file is preprocessed by a user-defined command when the file is read. +For details see ‘elementCommand’, Resources. m4, the default +value of ‘elementCommand’, allows you to create libraries for +package definitions that are shared by all elements. +The old element libraries distributed with Pcb expect m4 or an +equivalent to be the elementCommand. The new library scheme simply has +each element stored in a self-contained file, so there is no need to learn +m4 to add to the libraries. + +

Pcb can create a list of +all connections from one (or all) elements to the others or a list of +unconnected pins. +It can also verify the layout connections against a netlist file. +The element's ‘layout-name’ is the name used to identify the element +in a netlist file (see Netlist File). + +

The old libraries, or very old (pre-1.6) layout files may have +incorrect pin numbering since there was no concept of pin numbers +when they were created. Pcb uses the order of appearance of +the pin definitions in the layout or library file if it uses the +old format, but there is no guarantee that it will be correct for +these old objects. + +

Be aware that a few of the old library parts may still be incorrectly +implemented regarding pin-numbering. All of the DIL (Dual- +Inline-Pins) parts are correct and most of the others are too, +but you should verify the pin numbering +of any non-DIL part before using an old library part. +(use the ‘generate object report’ in the Info menu +to see what Pcb thinks a pin's number is) +All of the old +library names begin with a ~, so you can easily identify them. +The old libraries also may contain other sorts of errors, +including incorrect pin spacing, silkscreen overlapping solder areas, etc. +Check carefully any element in the old library before using it! +As the new library grows, the old library will be pared down to +at least remove all of the elements with errors, but this will +take time. + +

You can make your own element definitions graphically now. +Simply draw vias for the pins, lines on the solder and/or +component layers for surface-mount pads (they must be either horizontal +or vertical), +and lines and arcs on the silkscreen layer for the silkscreen +outline. You should name (N key) each via and copper line with the pin number. +Once you are happy with the geometry, select everything that is to become part of +the element, then choose ‘convert selection to element’ from the Select menu. +Afterwords you can make pin (or pad) one +square if you like, and give the element its various names. You can also give +the pins and pads their functional names. Note that the +element mark corresponds to the position you click after choosing the +conversion from the menu, so decide where the mark goes and make +sure it falls on a grid point before you request the conversion. +If the vias/lines are not named, then the pin numbering will correspond to the +order in which they were placed. + +

When you create a new element, remember that silkscreen lines +should never overlap the copper part of the +pins or pads, as this can interfere with soldering. The silkscreen +should identify the maximum extent of the element package so it +is easy to see how close elements can be placed together. + +

If you want to make an element similar to an existing one, you can +break an element into constituent pieces from the Buffer menu. +Paste the pieces to the layout, make the necessary changes, then +convert it back into an element. If the pin numbers haven't changed, +there is no need to name each via/line as they are pre-named when +the element was broken apart. When you create a new element, you +can save it to a file in order to have easy access to it the next +time you run Pcb. + +

+ +


+Next: , +Previous: Element Objects, +Up: Intro + +
+ +

2.4 Layers

+ +

+Every layout consists of several layers that can be used independently +or treated as a group. +Layer groups can be used to logically separate (and color-code) +different traces (e.g. power and signal); however, all +layers within a group reside on the same physical +copper layer of a board, so using different layers within the same +group won't provide electrical separation where they touch or overlap. +For details, see ‘layerGroups’, Resources. +Each layer is drawn in a color defined in the resource file +and identified by a name that you can change (for details +see ‘layerColor’, Resources.) +Layers are really just containers for line, arc, polygon, and text objects. The +component and solder layers contain SMD elements as well, but the +file structure doesn't reflect that fact directly. + +

Each layer group +represents a physical layer on the printed circuit board. If you want to make +a four layer board, you'll need to have at least four layer groups. +Connections between layer groups are established only through element pins and vias. +The relationship between a specific layer and the board itself is configurable from +the ‘Edit layer groups’ option in the Settings menu. +The layer groups corresponding to the physical layers: component-side +and solder-side are always defined and you must map at least one +logical layer to each, even if you plan to make a single-sided board. +You are not obligated to put tracks on either of them. +Surface mount elements always reside on either the component-side or the +solder-side layer group. When you paste an element from the buffer, +it will go onto whichever side of the board you are viewing. +You can swap which side of the board you are viewing by pressing +the Tab key, or by selecting ‘view solder side’ from the +Screen menu. +The layer groups just have a name or number associated with them - where +they are sandwiched in the board is left for you to tell the +manufacturer. + +

The silkscreen layer is special because there are actually two silkscreen +layers, one for the top (component) and one for the bottom (solder) side +of the board. Which silk layer you draw on is determined by the side of the +board that you are viewing. If you are viewing the component side, then +drawing on the silk layer draws to the component-side silk layer. + +

The netlist layer is another special layer. It shows rat's-nest lines +(i.e. guides that show how the netlist expects the element to interconnect). +If you make this the active layer, you can use the Line tool to add +entries into the netlist, or to delete connections from the netlist +window. Except for these two purposes, you should not +make the netlist layer the active layer. Usually there is no need to +do this because a separate schematic package should be used to create the +netlist. Pcb can automatically draw all of the rats from +the netlist. In some cases you may want to make a small change without +going to the trouble of modifying the schematic, which is why this +facility is provided. + +

+ +


+Next: , +Previous: Layer Objects, +Up: Intro + +
+ +

2.5 Lines

+ +

+Lines are used to draw tracks on the pc board. +When in the line mode, each Btn1 +press establishes one end of a line. +Once the second point is defined, the line is drawn +and a new line started where the first one ended. +You can abandon the new starting point in favor +of another by pressing Ctrl-Btn1, or +Btn3, but don't use Btn2. +The undo function (U key or ‘undo last operation’ +from the Edit menu) will take you back +point by point if you use it while in the line mode. + +

New lines can be restricted to 45 degree angles if desired. You can toggle this +restriction on and off while creating lines by pressing the period key. +If the 45 degree restriction is turned on, then the / (forward slash) key +can be used to cycle through three different modes of 45 degree line creation. +One mode just creates a single line forced to the nearest 45 degree vector. The next +mode creates two lines from the start to end points such that the first line leaves the +start point at a 90 degree vector, and the second line enters the end point on a 45 +degree vector. The last mode creates two lines such that the first line leaves the +start point on a 45 degree vector and arrives at the end point on a 90 degree vector. +You can temporarily swap between the last two modes by holding the Shift key down. + +

It is simple to edit a line object by breaking it into pieces (insert point mode), +moving an end point or the whole line (Arrow tool), +or changing the layer it resides on (M key moves the line under the pointer +to the active layer). +In the case when two line segments meet at exactly the same +point you can delete the intermediate point, otherwise the delete tool removes an entire line. +Feel free to experiment +since Pcb will allow you to undo and redo anything that materially affects your work. +If you switch active layers in the midst of placing lines a via will automatically be +placed, when necessary, in order to continue the connection. + +

If you draw a line inside a polygon, it will either plow through the +polygon creating a clearance, or touch the polygon. This behavior is +selectable in the Settings menu for new lines. To change the +behavior of an existing line, hit the J key with the cross hair +over the line. You can increase the size of the clearance by 2 mils on +each edge with the with the +K key. Shift-K will decrease the clearance by 2 mils. +The increment may be changed from 2 mils through the application +resource file. +The clearance can be also increased, decreased and set +by the ChangeClearSize action. + +

Lines do not need to intersect the center of a pin, pad, via, or other +line for Pcb to understand that they make electrical connection. +If the connection is too tenuous, running the design rule checker will report +that the connection may break if the line width shrinks slightly. + +

+ +


+Next: , +Previous: Line Objects, +Up: Intro + +
+ +

2.6 Arcs

+ +

+Pcb can handle arcs of any angular extent, but when you +create an arc with the Arc tool, it will +be a quarter circle (this means they always bend a right angle). Arcs are very similar +to lines otherwise. They are created on the active layer and have the same thickness +that new lines will have. The various clicks for creating lines work pretty much the +same way for creating arcs. +In order to make the arc curve in the desired direction, drag the mouse along +the tangent line from the starting position towards the end position. If the grid is +too coarse, it may not be possible to distinguish whether you've moved over then up, +or up then over, so if you can't seem to make the arc go in the direction you want, try pressing +the Shift key while drawing the arc. Decreasing the grid spacing may also help. +Alternatively you can draw the wrong arc, then +rotate and move it where you want. Like the Line tool, after an arc is drawn a new +starting point is established at the end point. + +

Whenever a starting point is established +by either the Line or Arc tools it will be retained if you switch directly between the +tools (e.g. F2 key for Lines, F8 key for Arcs. Arcs can either touch or +clear polygons just like lines do. Of course connection +searches, undo and all the other features you'd expect work with arcs too. + +

+ +


+Next: , +Previous: Arc Objects, +Up: Intro + +
+ +

2.7 Polygons

+ +

+Sometimes it's useful to fill large areas with solid copper. +The way to do this is with polygons. +Polygons can be created in either the polygon mode or the rectangle mode. +In the polygon mode, you'll have to define each corner of the polygon +with a mouse click (Btn1). When the last point is clicked +exactly on top of the starting point, the polygon is finished. +Since this can be hard to do, the Shift-P key will enter the +final point for you, closing the polygon. +If the 45 degree angle restriction is turned on +and you try to close the polygon when it is not possible, you'll get a +warning instead. If you haven't finished entering a polygon, but want to +undo one (or more) of the points that you've already defined, use the +undo command (U key). + +

With the rectangle tool, defining +the two diagonally opposite corners is sufficient, but of course the resulting +polygon is a rectangle. +Like lines, a polygon can by edited by deleting, inserting and moving the points +that define it. Pins and vias always clear through polygons without +touching them when first positioned. You must add a thermal with the thermal +tool in order to connect pins and vias to polygons. Thermals can be added and removed by +clicking Btn1 with the thermal tool over the pin or via. +The thermal tool always +places a thermal to polygons on the active layer, so if the tool doesn't +seem to work, it's probably because the polygon you want to touch is not +on the active layer. You can change the style of thermal used or make +a solid connection by holding down Shift while clicking +Btn1 with the thermal tool over the pin or via. + +

Pcb is capable of handling complex polygons, but +using a number of simpler ones improves performance of the connection tracing code. +You also must be careful not to create polygons that touch or overlap themselves. +The fabricated board may not look the way you expect if you violate this +principle. It is always ok to have two (or more) polygons touch or overlap +each other, but not for points within the same polygon to do so. + +

The great advantage to this new polygon behavior is that simple or complex ground +and/or power planes can be easily made with polygons and seen on the screen. +If you don't want this auto-clearance behavior, or you load a layout created by +an early version of Pcb, the old behavior +(shorts to all piercing pins and vias) is available. A ‘ChangeSize’ +operation (S key) toggles a polygon between the new and old polygon/pin +behavior. + +

+ +


+Next: , +Previous: Polygon Objects, +Up: Intro + +
+ +

2.8 Text

+ +

+Text objects should be used to label a layout or to put additional +information on the board. Elements have their ‘layout-name’ labels on the +silk-screen layer. If you are making a board without a silkscreen, +you can use copper text to label the elements, but you have to do +this manually. + +

Text is always horizontal when first created, but the +rotate mode can align it along 0, 90, 180 and 270 degree angles. +Text on the far side of the board will automatically appear mirror-imaged. + +

Warning: TEXT OBJECTS ON A COPPER LAYER CREATE COPPER LINES BUT THEY ARE NOT SCANNED FOR +CONNECTIONS OR TESTED FOR CREATING SHORTS VS. THE NETLIST. NEITHER ARE TEXT OBJECTS TESTED AGAINST ANY DESIGN RULES. + +

+ +


+Previous: Text Objects, +Up: Intro + +
+ +

2.9 Nets

+ +

+Layout files also contain the netlist that describes how the elements +are supposed to be interconnected. This list of connections can be +loaded from a netlist file (see Netlist File), or +entered by drawing rat-lines as described +previously. Each net has a name and routing style associated with it. +The net contains a list of all element layout-name names and +pin numbers that should +be connected to the net. Loading a netlist file will replace all +existing nets with the ones from the file. +The Netlist window provides an easy way to +browse through the net list. You can display the rat's-nest by selecting +‘optimize rats-nest’ from the Connects menu. If you move or rotate elements, +the rat's-nest will automatically follow the movements, but they won't +necessarily show the shortest paths until you optimize them again. + + +

+ +


+Next: , +Previous: Intro, +Up: Top + +
+ +

3 Getting Started

+ +

+The goal of this chapter is to give you enough information to learn how +Pcb works and how to develop your layouts to make the best use of Pcb's +features. All event translations (i.e. the buttons and keys you +press) refer to the default application resource file shipped with Pcb. +There is probably no need to change this unless your window +manager uses some of the button events itself; however, if you want +to customize the behavior of Pcb then changing the resource file +is usually the best way to do it. + +

Get yourself a printout of this chapter and User Commands, if you +haven't already done so, and follow the examples. + +

Start Pcb (the actual command will use all lower-case letters) +without any additional options. +If you get the error message: + +

         can't find default font-symbol-file 'default_font'
+
+

then the font searchpath or filename in the application resource +file is wrong. Be sure that your m4 program supports search paths. +If not, get GNU m4. +For other messages, see problems. +Another quick-start is provided by pcbtest.sh in the src +directory. If some features don't seem to work, try running pcbtest.sh, +if that works, then Pcb hasn't been installed properly. + +

+ +
+ +


+Next: , +Up: Getting Started + +
+ +

3.1 The Application Window

+ +

The main window consists of five areas: +the menu at the top, the layer control in the upper left, the tool buttons +located below the layer controls, the Layout area to the right of these, and the +status line at the bottom of the window. + +

+ + + +

3.1.1 Menus

+ +

+The menus are located at the top of the Layout area. Most, but not all, +of their functions are also available from the keyboard. Similarly, some +functions are only achievable through the keyboard or command entry. +Some menu entries such as ‘center layout’ in the Screen menu require a certain cross hair position. +In this case a prompt message will popup at the bottom of the screen +with wording similar to the following: +

     move pointer to the appropriate screen position and press a button
+
+

Any mouse button will do the job, whereas any key except the arrow (cursor) keys +will cancel the operation. If it seems like the menu hasn't done what you +expected, check to see if it is waiting for the position click. For details see Actions. + +

Pressing Btn3 in the Layout area also pops up a menu with many of the most common operations (except +when you're in the midst of drawing a line or arc). When +a choice in the Btn3 popup menu needs a cross hair position, it uses the position +where the cross hair was when Btn3 was pressed. For example, to get detailed +information on an object, place the cross hair over the object, press Btn3, then +choose ‘object report’. If you pop up the Btn3 menu but don't want to +take any of the actions, click on one of the headers in the menu. + + + +

File
This menu offers a choice of loading, saving and printing data, saving +connection information to a file or quitting the application. Most +of the entries in the File menu are self explanatory. +Selecting +‘print layout’ pops up a printer control dialog. +A selection of several device drivers is available from the printer control +dialog. Presently PostScript, encapsulated PostScript, +and GerberX are supported. The GerberX driver produces +all of the files necessary to have the board professionally manufactured. +The connection saving features in the File menu produce outputs in an +arcane format that is not too useful. They do not produce netlist +files. + +


Edit
The Edit menu provides the usual cut, copy, paste +which work on selections. To learn how to +create complex selections, see Arrow Tool. +The Edit menu also +provides access to Undo and Redo of the last operation. These +can also be accomplished with the U key and Shift-R +key. Finally, the Edit menu allows you to change the names +of: the layout, the active layer, or text objects on the layout. + +


Screen
The Screen menu supports most functions related to +the whole Layout area. There are various entries to change the grid to some popular +values, the zoom factor, and which kind of element name is displayed. +You can also re-align the grid origin and turn on and off the display +of the grid. +Before changing the grid alignment, I recommend that you zoom in as close as +possible so that you're sure the grid +points appear exactly where you want them. + +

The Screen menu also allows you to turn on and off the +visibility of the solder-mask layer. When the solder-mask layer +is made visible it obscures most of the layout, so only turn +this on when you really want to know what the solder-mask will +look like. The solder-mask that you see belongs to the +side of the board you are viewing, which can be changed with +the ‘view solder side’ option, also found in the Screen menu. +When the solder-mask is displayed, the pin and pad clearance adjustments +(see Line Objects) alter the size of mask cut-outs. + +


Sizes
The Sizes menu allows you to select a group of line thickness, via diameter, via drill +size, and clearance (keepaway) (collectively called a "routing style") to be copied to the "active" sizes. +You can also change the names given to the routing styles and adjust their values from +this menu. The "active" sizes are also adjustable from this menu. +The "active" sizes are shown in the status-line and control the initial size of new vias, +drilling holes, lines, clearances, text-objects and also the maximum dimensions of the +board layout. + +


Settings
The Settings menu controls several operating configuration +parameters. The ‘edit layer groups’ entry brings up a dialog +that allows you to change the way layers are grouped. Layer grouping +is described in Layer Objects. The ‘all-direction lines’ +entry controls +the clipping of lines to 45-degree angles. You can also control +whether moving individual objects causes the attached lines to +"rubber band" with the move or not from the Settings menu. Another +entry controls whether the starting clip angle for the two-line +mode (see Line Objects) alternates every other line. You can +also control whether element names must be unique from the Settings +menu. When unique element names are enforced, copying a new element +will automatically create a unique ‘layout-name’ name for it +provided that the name originally ended with a digit (e.g. +U7 or R6). The Settings menu allows you to control +whether the cross hair will snap to pins and pads even when they +are off-grid. Finally you can control whether new lines and +arcs touch or clear intersecting polygons from this menu. + +


Select
This menu covers most of the operations that work with selected objects. +You may either (un)select all visible objects on a layout or only the ones +which have been found by the last connection scan see + + +. +You can delete all selected objects from this menu. +Other entries in the Select menu change the sizes of selected objects. +Note that a select action only affects those objects that are +selected and have their visibility turned on in the Layer Control +panel. The Select menu also provides a means for selecting objects +by name using unix Regular Expressions. + +


Buffer
From the Buffer menu you may select one out of five +buffers to use, rotate or clear its contents or save the buffer contents +to a file. You can also use the ‘break buffer element to pieces’ entry +to de-compose an element into pieces for editing. +Note: only objects with visibility turned on are pasted to the layout. If +you have something in a buffer, then change which side of the board you +are viewing, the contents of the buffer will automatically be mirrored +for pasting on the side you are viewing. It is not necessary to clear +a buffer before cutting or copying something into it - it will automatically +be cleared first. + +


Connects
The entries available through the Connects menu allow you to find +connections from objects and to manipulate these. +You can also optimize or erase rat's nests from this menu. Finally, +the ‘auto-route all rats’ entry allows you to auto-route +all connections show by the rat's nest. The auto-router will use +any visible copper layer for routing, so turn off the visibility of any +layers you don't want it to use. The auto-router will automatically +understand and avoid any traces that are already on the board, but +it is not restricted to the grid. Finally, +the auto-router routes using the active sizes (except for nets that +have a route-style defined). Pcb always knows which tracks +were routed by the auto-router, and you can selectively remove them +without fear of changing tracks that you have manually routed +with the ‘rip-up all auto-routed tracks’ entry in the Connects +menu. The ‘design rule checker’ entry runs a check for copper +areas that are too close together, or connections that touch too +tenuously for reliable production. The DRC stops when the first +problem is encountered so after fixing a problem be sure to +run it again until no problems are found. +
          Warning: COPPER TEXT IS IGNORED BY THE DRC CHECKER.
+
+


Info
The ‘generate object report’ entry from the Info menu +provides a way to get detailed information +about an object, such as its coordinates, dimensions, etc. +You can also get a report summarizing all of the drills +used on the board with ‘generate drill summary’. Lastly, +you can get a list of all pins, pads and vias that were +found during a connection search. + +


Window
The Window menu provides a way to bring each of Pcb's +windows to the front. The Library window is used to +bring elements from the library into the paste-buffer. The +Message Log window holds the various messages that +Pcb sends to the user. The Netlist window shows +the list of connections desired. + +
+ +

Now that you're familiar with the various menus, it's time +to try some things out. From the File menu choose +‘load layout’, navigate to the tutorial folder, then +load the file ‘tut1.pcb’. + +

+ + +


+Next: , +Previous: Menu, +Up: Application Window + +
+ +

3.1.2 The Status-line and Input-field

+ +

+The status-line is located at the bottom edge of the main window. +During normal operation the status information is visible there. +When a selected menu operation requires an additional button click, the +status-line is replaced by a message telling you to position the cursor +and click. +When a text input is required, the status-line is replaced by the +Input-field which has a prompt for typing the input. + +

The status-line shows, from left to right, the side of the board that you +are viewing (Tab key changes this), the current grid values, +if new lines are restricted to 45 degrees, +which type of 45 degree line mode is active, whether rubberband move and +rotate mode is on (R), and the zoom factor. +This information is followed by the active line-width, via-size +and drilling hole, keepaway spacing, and text scaling. Last is the active buffer number and the +name of the layout. An asterisk appearing at the far left indicates that the +layout has been modified since the last save. +Note that the name of the layout is not the same +thing as the filename of the layout. +Change the grid factor to 1.0 mm from the Screen menu. Observe how the +status line shows the new grid setting. Except for the case of the metric +grid, all dimensions in the status line are in units of 0.001 inch (1 mil). + +

The input-field pops up (temporarily replacing the status-line) whenever user input +is required. Two keys are bound to the input field: the Escape key +aborts the input, Return accepts it. Let's change the name of a component +on the board to see how the input-field works. Position the cross hair over +R5, and press the N key. The input field pops-up showing the name +for you to edit. Go ahead and change the name, then hit return. Notice the name +of the element changed. Now undo the change by pressing the U key. You can +position the cross hair over the name, or the element before pressing the +N key. + +

Now select ‘realign grid’ from the Screen menu. Notice that the +status line has been replaced with an instruction to position the cursor +where you want a grid point to fall. In this case, since the cross hair +can only fall on a grid point, you must move the tip of the finger cursor +to the place where you want a grid point to appear. Do not worry that +the cross hair is not coincident with the cursor. Click Btn1 at +your chosen location. See how the grid has shifted, and the status line +has returned. + +

The present cross hair position is displayed in the upper right corner of the window. +Normally this position is an absolute coordinate, but you can anchor a marker at +the cross hair location by pressing Ctrl-M (try it now) and then the +display will read both the absolute cross hair position as well as the difference +between it and the marker. The numbers enclosed in < > are the X and Y distances +between the cross hair and the mark, while the numbers enclosed in parenthesis +are the distance and angle from the mark to the cross hair. The values displayed +are always in units of 0.001 inch (1 mil). +Pressing Ctrl-M again turns the marker off. + +

+ +

3.1.3 The Layer Controls

+ +

+The layer control panel, located in the upper left, is used to turn on +and off the display of layer groups and to select the active drawing layer. +If a layer hasn't been named, the label "(unknown)" is used as the default. +If this happens, it probably means the application resources are not installed +properly. + +

The upper buttons are used to switch layers on and off. Click +<Btn1> on one or more of them. Each click toggles the setting. +If you turn off the currently active layer, another one that is visible +will become active. If there are no others visible, you will not be +able to turn off the active layer. +When the layers are grouped, clicking on these buttons will toggle +the visibility of all layers in the same group. This is a good idea because +layers in the same group reside on the same physical layer of +the actual board. Notice that this example has 2 groups each having +3 layers, plus two other layers named ‘unused’. +Use the ‘Edit layer groups’ option in the ‘Settings’ menu to +change the layer groupings in the lesstif GUI or the ‘Preferences’ +dialog from the ‘File’ menu in the GTK+ GUI. Note that changing the +groupings can radically alter the connectivity on the board. +Grouping layers is only useful for helping you to color-code +signals in your layout. Note that grouping layers actually reduces the number +of different physical layers available for your board, so to make an eight +layer board, you cannot group any layers. + +

The far side button turns on and off the visibility of elements +(including SMD pads) on the opposite (to the side you're viewing) +board side, as well as silk screening on that side. It does not +hide the x-ray view of the other copper layers, these must be turned off +separately if desired. Use the tab key to view the entire board from the other +side. To see a view of what the back side of the board will actually look like, +make the solder layer the active layer then press tab until the status +line says "solder" on the right, then turn off the visibility of all layers +except solder, pins/pads, vias, and silk. Now turn them all back on. + +

The lowest button, named active, is used to change the active +drawing layer. Pressing <Btn1> on it pops up a menu to select which +layer should be active. +Each entry is labeled with the layer's name and drawn in its color. +The active layer is automatically made visible. The active layer is +always drawn on top of the other layers, so the ordering of layers +on the screen does not generally reflect the ordering of the manufactured +board. Only the solder, component, silkscreen, and solder-mask layers +are always drawn in their physical order. Bringing the active layer +to the top makes it easier to select and change objects on the active layer. +Try changing the active layer's name to ABC by selecting +‘edit name of active layer’ from the ‘Edit’ menu. +Changing the active layer can also be done by pressing keys +1..MAX_LAYER. + +

Turn off the visibility of the component layer. +Now make the component layer the active layer. Notice that it +automatically became visible. Try setting a few +other layers as the active layer. You should also experiment +with turning on and off each of the layers to see what happens. + +

The netlist layer is a special layer for adding connections to +the netlist by drawing rat lines. This is not the recommended +way to add to the netlist, but occasionally may be convenient. +To learn how to use the netlist layer see Net Objects. + +

+ +


+Next: , +Previous: Layer Controls, +Up: Application Window + +
+ +

3.1.4 The Tool Selectors

+ +

+The tool selector buttons reside below the layer controls. +They are used to select which layout tool to use in the drawing +area. Each tool performs its function when Btn1 is pressed. +Every tool gives the cursor a unique shape that identifies it. +The tool selector buttons themselves are icons that illustrate their function. +Each layout tool can also be selected from the keyboard: +

         F1 key       Via tool
+         F2 key       Line tool
+         F3 key       Arc tool
+         F4 key       Text tool
+         F5 key       Rectangle tool
+         F6 key       Polygon tool
+         F7 key       Buffer tool
+         F8 key       Delete tool
+         F9 key       Rotate tool
+         Insert key   Insert-point tool
+         F10 key      Thermal tool
+         F11 key      Arrow tool
+         F12 key      Lock tool
+
+

Some of the tools are very simple, such as the Via tool. Clicking +Btn1 with the Via tool creates a via at the cross hair position. +The via will have the diameter and drill sizes that are active, +as shown in the status line. +The Buffer tool is similar. With it, <Btn1> copies +the contents of the active buffer to the layout, but only +those parts that reside on visible layers are copied. +The Rotate tool allows you to rotate elements, arcs, and text objects +90 degrees counter-clockwise with each click. Holding the Shift +key down changes the Rotate tool to clockwise operation. +Anything including groups of objects +can be rotated inside a buffer using the rotate buffer menu option. + +

The Line tool is explained in detail in Line Objects. Go read +that section if you haven't already. +Activate the Line tool. Set the active layer to the solder layer. +Try drawing some lines. Use the U key to undo some of the +lines you just created. Zoom in a bit closer with the Z key. +Draw some more lines. Be sure to draw some separate lines by starting +a new anchor point with Ctrl-Btn1. Change the ‘crosshair snaps to pin/pads’ +behavior in the Settings menu. Now draw a line. Notice that +the new line points must now always be on a grid point. It might not +be able to reach some pins or pads with this setting. Increase the active line thickness +by pressing the L key. Note that the status line updates +to reflect the new active line thickness. Now draw another line. Before completing the +next line, make the component layer active by pressing the 4 key. +Now finish the line. Notice that a via was automatically placed where +you switched layers. Pcb does not do any checks to make sure that +the via could safely be placed there. Neither does it interfere with +your desire to place lines haphazardly. It is up to you to place +things properly when doing manual routing with the Line tool. + +

The Arc tool is explained in detail in Arc Objects. Its +use is very similar to the Line tool. + +

The Rectangle tool, Polygon tool and Thermal tool are explained in detail in +Polygon Objects. Go read that section. +Remember that the Thermal tool will only create and destroy thermals +to polygons on the active layer. Use the Rectangle tool to make a +small copper plane on the component layer. Now place a via in the +middle of the plane. Notice that it does not touch the plane, and +they are not electrically connected. Use the Thermal tool to make +the via connect to the plane. Thermals allow the via or pin to +be heated by a soldering iron without having to heat the entire +plane. If solid connections were made to the plane, it could be +nearly impossible to solder. Shift-click on the via with the Thermal +tool to change the style of thermal used or to make the connection +solid. Click on the via again with the Thermal tool to remove the +connection to the plane. + +

The Insert-point tool is an editing tool that allows you to add +points into lines and polygons. The +Insert-point tool enforces the 45 degree line +rule. You can force only the shorter line segment to 45 +degrees by holding the Shift key down while inserting the point. +Try adding a point into one of the lines you created. Since line +clipping is turned on, you may need to move the cross hair quite far +from the point where you first clicked on the line. Turn off the +line clipping by selecting ‘all-direction lines’ from the +Settings menu (or hit +the Period key). Now you can place an inserted point anywhere. +Try adding a point to the rectangle you made earlier. Start by clicking +somewhere along an edge of the rectangle, then move the pointer to +a new location and click again. + +

The delete-mode deletes the object beneath the cursor with each +Btn1 click. +If you click at an end-point that two lines have in common, it will replace the two lines with a single line +spanning the two remaining points. This can be used to delete an "inserted" +point in a line, restoring the previous line. Now delete one of the original corner +points of the polygon you were just playing with. To do this, place the cross hair over the +corner and click on it with the Delete tool. You could also use the Backspace key +if some other tool is active. Try deleting some of +the lines and intermediate points that you created earlier. Use undo +repeatedly to undo all the changes that you've made. Use redo +a few times to see what happens. Now add a new line. Notice that +you can no longer use redo since the layout has changed since +the last undo happened. The undo/redo tree is always pruned in this +way (i.e. it has a root, but no branches). + +

The Arrow tool is so important, it has its own section: Arrow Tool. +Go read it now. + +

The Lock tool allows you to lock objects on the layout. When an object +is locked, it can't be selected, moved, rotated, or resized. This is +useful for very large objects like ground planes, or board-outlines that +are defined as an element. With such large objects, nearly anywhere you +click with the Arrow tool will be on the large object, so it could be +hard to draw box selections. If you lock an object, the Arrow tool will +behave as if it didn't exist. You cannot unlock an object with undo. +You must click on it again with the Lock tool. If an object is locked, +previous changes to it cannot be undone either. When you lock +an object, a report message about it is popped up and will always tell +you what object it is, and that it is locked if you just locked it. +Other than noticing your inability to manipulate something, the only +way to tell an object is locked is with a report from the Info +menu. Use the Lock tool sparingly. + +

+ +


+Previous: Tool Selectors, +Up: Application Window + +
+ +

3.1.5 Layout Area

+ +

+The layout area is where you see the layout. The cursor shape depends +on the active tool when the pointer is moved into the layout area. +A cross hair follows the mouse pointer with respect to the grid setting. +Select a new grid from the Screen menu. +The new value is updated in the status line. +A different way to change the grid is +Shift<Key>g to decrease or <Key>g to increase +it, but this only works for English (integer mil) grids. +The grid setting is saved along with the data when you save a pcb layout. +For homemade layouts a value around 50 is a good setting. +The cursor can also be moved in the layout area with the cursor (arrow) keys or, for larger +distances, by pressing the Shift modifier together with a cursor key. + +

+ +


+Next: , +Previous: Application Window, +Up: Getting Started + +
+ +

3.2 Log Window

+ +

+This optional window is used to display all kind of messages including +the ones written to stderr by external commands. The main advantage +of using it is +that its contents are saved in a scrolling list until the +program exits. Disabling this feature by setting the resource +useLogWindow to false will generate popup windows to display +messages. The stderr of external commands will appear on Pcbs +stderr which normally is the parent shell. I suggest you iconify +the log window after startup for example by setting *log.iconic to +true in the resource file. If raiseLogWindow is set true, +the window will deiconify and raise itself whenever new messages are to be +displayed. + +

+ +


+Next: , +Previous: Log Window, +Up: Getting Started + +
+ +

3.3 Library Window

+ +

+The library window makes loading elements (or even partial layouts) easy. +Just click the appropriate library from the list on the left. A list +of its elements then appears on the right. Select an element +from the list by clicking on its description. Selecting an element from the +library will also automatically copy the element into +the active buffer, then invoke the Buffer tool so +you can paste it to the layout. Elements in the old library should be +taken with a grain of salt (i.e. check them carefully before +using). The old library names all begin with ~ so you can easily distinguish between +the old and new libraries. All of the elements in the new library +should be thoroughly vetted, so you +can use them with confidence. The new libraries are stored simply +as directories full of element files, so making additions to the +new library is easy since there is no need to learn m4. +For details on the old libraries, +check-out Library File and Library Contents File. For +details on the format of an element file used for the new libraries, +see Element File. + +

+ +


+Next: , +Previous: Library Window, +Up: Getting Started + +
+ +

3.4 Netlist Window

+ +

+The netlist window is very similar to the library window. On the left +is a list of all of the nets, on the right is the list of connections +belonging to the chosen net. The chosen net is highlighted in the +list and also shown on the second line of the window in red. If the +net name has a star to the left of it then it is "disabled". A disabled +net is treated as if it were not in the net list. This is useful, for +example, if you plan to use a ground plane and don't want the ground +net showing up in the rat's nest. You can enable/disable individual +nets by double-clicking the net name. If you want to enable or disable +all nets at once, there are two buttons at the top of the netlist +window for this purpose. + +

The button labeled ‘Sel Net On Layout’ +can be used to select (on the layout) everything that is connected +(or is supposed to be connected) to the net. If you click on a +connection in the connection list, it will select/deselect +the corresponding pin or pad in the layout and also center the layout +window where it is located. If you "Find" (‘lookup connection +to object’ in the Connects menu [also F key]), a pin +or pad it will also choose the net and connection in the netlist window +if it exists in the netlist. + +

If no netlist exists for the layout, then the netlist window does not +appear. You can load a netlist from a file from the File menu. The +format for netlist files is described in Netlist File. + +

+ +


+Next: , +Previous: Netlist Window, +Up: Getting Started + +
+ +

3.5 Drawing and Removing Basic Objects

+ +

+hace begging gutting here, and do a real-world tutorial example. + +

There are several ways of creating new objects: you can draw them yourself, +you can copy an existing object (or selection), or you can load an element from a file or +from the Library window. Each type of object has a particular tool for creating it. + +

The active tool can be selected from the tool selectors in the bottom +left corner or by one of the function keys listed earlier in this chapter. +Each <Btn1> press with the tool tells the application to create +or change the appropriate object or at least take +the first step to do so. Each tools causes the cursor to take +on a unique shape and also causes the corresponding +tool selector button to be highlighted. You can use either cue +to see which tool is active. + +

Insert mode provides the capability of inserting new points into existing +polygons or lines. The 45 degree line clipping is now enforced when selected. +Press and hold the shift key while positioning the new point to only clip +the line segment to the nearer of the two existing points to 45 degrees. +You can also toggle the 45-degree clipping in the middle of a point +insertion by pressing the <Key>. +If the shift key is not depressed and the 45 degree line clipping mode +is on, both new line segments must be on 45 degree angles - greatly +restricting where the new point may be placed. In some cases this can cause +confusion as to whether an insertion has been started since the two new +lines may be forced to lie parallel on top of the original line until the +pointer is moved far from the end points. + +

Removing objects, changing their size or moving them only applies to objects +that are visible when the command is executed. + +

+ +
+ +


+Next: , +Up: Drawing and Removing + +
+ +

3.5.1 Common Drawing and Removing Methods

+ +

+There are several keystrokes and button events referring to an object +without identifying its type. Here's a list of them: + +

<Btn1> creates (or deletes) an object depending on the +current mode. + +

<Key>BackSpace or <Key>Delete removes the visible +object at the cursor location. When more than one object exists at the +location, the order of removal is: via, line, text, polygon and +element. The drawn layer order also affects the search - whatever is +top - most (except elements) is affected before lower items. Basically +all this means that what is removed is probably just what you expect. +If for some reason it isn't, undo and try again. +Only one object is removed for each keystroke. If two or more +of the same type match, the newest one is removed. + +

Use <Key>s and Shift<Key>s to change the size (width) +of lines, arcs, text objects, pins, pads and vias, or to toggle the style +of polygons (whether pins and vias automatically have clearances). + +

<Key>n changes the name of pins, pads, vias, the +string of a text object, or the currently displayed label of an element. + +

<Key>m moves the line, arc, or polygon under the cross hair to the +active layer if it wasn't on that layer already. + +

<Key>u (undo) recovers from an unlimited number of operations +such as creating, removing, moving, copying, selecting etc. It works like +you'd expect even if you're in the midst of creating something. + +

Shift<Key>r restores the last undone operation provided no other +changes have been made since the undo was performed. + +

<Key>tab changes the board side you are viewing. + +

For a complete list of keystrokes and button events see Translations. + +

+ +


+Next: , +Previous: Common, +Up: Drawing and Removing + +
+ +

3.5.2 Lines

+ +

+To draw new lines you have to be in line-mode. Get there either by +selecting it from the Tool palette or by pressing <Key>F2. +Each successive notify event creates a new line. The +adjustment to 45 degree lines is done automatically if it is selected from the +Display menu. You can toggle the 45 degree mode setting by +pressing the <Key>. (That is the period key). When 45 degree enforcement +is turned on there are three distinct modes of line creation: a single +line on the closest 45 degree vector towards the cross hair (but not necessarily +actually ending at the cross hair), two lines created such that the first leaves +the start point on a 90 degree vector and the second arrives at the cross hair +on a 45 degree vector, and finally two lines created such that the first leaves +the start point on a 45 degree vector and the second arrives at the cross hair +on a 90 degree vector. These last two modes always connect all the way from +the start and end points, and all lines have angles in 45 degree multiples. +The <Key>/ cycles through the three modes. The status line shows a +text icon to indicate which of the modes is active and the lines following +the cross hair motion show the outline of the line(s) that will actually be created. +Press <Key>Escape to leave line-mode. + +

<Key>l, Shift<Key>l and the entries in the +Sizes menu change the initial width of new lines. This width is also +displayed in the status line. + +

+ +


+Next: , +Previous: Lines, +Up: Drawing and Removing + +
+ +

3.5.3 Arcs

+ +

+An Arc is drawn with the arc-tool. Get there either by selecting it +from the Tool palette or by pressing <Key>F8. Press Btn1 to +define the starting point for the arc. Drag the mouse towards the desired +end point along the path you want the arc to follow. The outline of the arc that +will be created is shown on the screen as you move the mouse. Arcs are always +forced to be 90 degrees and have symmetrical length and width ( i.e. they are +a quarter circle). The next Btn1 click creates the arc. It will have +the same width as new lines (displayed in the status line) and appear on the +active layer. The arc leaves the starting point towards the cross hair along +the axis whose distance from the cross hair is largest. Normally this means that +if you drag along the path you want the arc to follow, you'll get what you +want. If the grid is set to the arc radius, then the two distances will be +equal and you won't be able to get all of the possible directions. If this +is thwarting your desires, reduce the grid spacing (!Shift<Key>G) and +try again. + +

+ +


+Next: , +Previous: Arcs, +Up: Drawing and Removing + +
+ +

3.5.4 Polygons and Rectangles

+ +

+A polygon is drawn by defining all of its segments as a series of +consecutive line segments. If the first point matches a new one and if +the number of points is greater than two, then the polygon is closed. +Since matching up with the first point may be difficult, you may use +Shift<Key>p to close the polygon. The Shift<Key>p won't +work if clipping to 45 degree lines is selected +and the final segment cannot match this condition. +I suggest you create simple convex polygons in order to avoid a strong +negative impact on the performance of the connection scanning routines. +The rectangle-mode is just an easy way to generate rectangular polygons. +Polygon-mode also is selected by <Key>F6 whereas +rectangle-mode uses <Key>F4. +Pressing a <Btn1> at two locations creates a rectangle by +defining two of its corners. +<Key>Insert brings you to insert-point-mode which lets you +add additional points to an already existing polygon. +Single points may be removed by moving the cross hair to them and selecting +one of the delete actions (remove-mode, BackSpace, or Delete. This only works +if the remaining polygon will still have three or more corners. +Pressing <Key>u or <Key>p while entering a new polygon +brings you back to the previous corner. Removing a point does not +force clipping to 45 degree angles (because it's not generally possible). +Newly created polygons will not connect to pins or vias +that pierce it unless you create a thermal (using the thermal mode) to make +the connection. If the edge of a polygon gets too close to a pin or via that +lies outside of it, a warning will be issued and the pin will be given a +special color. Increasing the distance between them will remove the warning +color. + +

+ +


+Next: , +Previous: Polygons, +Up: Drawing and Removing + +
+ +

3.5.5 Text

+ +

+Pressing <Key>F5 or clicking one of the text selector buttons +changes to text-mode. +Each successive notify event (<Btn1>) +pops up the input line at the bottom and queries for a string. +Enter it and press <Key>Return to confirm or +<Key>Escape to abort. +The text object is created with its upper left corner at the current pointer +location. +The initial scaling is changed by <Key>t and +Shift<Key>t or from the Sizes menu. + +

Now switch to rotate-mode and press +<Btn1> at the text-objects location. Text objects +on the solder side of the layout are automatically mirrored and +flipped so that they are seen correctly when viewing the solder-side. + +

Use <Key>n to edit the string. + +

TEXT OBJECTS ON COPPER LAYERS CREATE COPPER LINES BUT THEY ARE NOT SCANNED FOR +CONNECTIONS. If they are moved to the silkscreen layer, they +no longer create copper. + +

+ +


+Next: , +Previous: Text, +Up: Drawing and Removing + +
+ +

3.5.6 Vias

+ +

+The initial size of new vias may be changed by <Key>v and +Shift<Key>v or by selecting the appropriate entry from the +Sizes menu. Mod1<Key>v and Mod1 Shift<Key>v do +the same for the drilling hole of the via. +The statusline is updated with the new values. +Creating a via is similar to the other objects. Switch to via-mode +by using either the selector button or <Key>F1 then press +<Key>] or <Btn1> to create one. +<Key>n changes the name of a via. If you want to create a mounting +hole for your board, then you can place a via where you want the hole to +be then convert the via into a hole. The conversion is done by pressing +!Ctrl<Key>h with the cross hair over the via. Conceptually it is +still a via, but it has no copper annulus. If you create such a hole in +the middle of two polygons on different layers, it will short the layers. +Theoretically you could arrange for such a hole not to be plated, but a +metal screw inserted in the hole would still risk shorting the layers. +A good rule is to realize that holes in the board really are vias between +the layers and so place them where they won't interfere with connectivity. +You can convert a hole back into a normal via with the same keystroke used +to convert it in the first place. + +

+ +


+Next: , +Previous: Vias, +Up: Drawing and Removing + +
+ +

3.5.7 Elements

+ +

+Some of the functions related to elements only work if both the package +layer and the pin layer are switched on. + +

Now that you're familiar with many of the basic commands, it is +time to put the first element on the layout. +First of all, you have to load data into the paste buffer. +There are four ways to do this: +

        1) load the data from a library
+        2) load the data from a file
+        3) copy data from an already existing element
+        4) convert objects in the buffer into an element
+
+

We don't have any elements on the screen yet nor anything in the +buffer, so we use number one. + +

Select lsi from the menu in the library window press +<Btn1> twice at the appropriate text-line to get +the MC68030 CPU. +The data is loaded and the mode is switched to pastebuffer-mode. +Each notify event now creates one of these beasts. Leave the mode +by selecting a different one or by <Key>Escape which resets +all modes.. +The cross hair is located at the mark position as defined by +the data file. Rotating the buffer contents is done by selecting +the rotate entry of the Buffer menu or by pressing +Shift<Key>F3. The contents of the buffer +are valid until new data is loaded into it either by a cut-to-buffer +operation, copy-to-buffer operation or by loading a new data file. +There are 5 buffers +available (possibly more or less if changed at compile time +with the MAX_BUFFER variable in globalconfig.h). +Switching between them is done by selecting a menu entry or +by Shift<Key>1..MAX_BUFFER. +Each of the two board sides has its own buffers. + +

The release includes all data files for the circuits that are used +by the demo layout. The elements in the LED example are not found in the library, +but you can lift them from the example itself if you want. +If you have problems with the color of the cross hair, change the resource +cross hairColor setting to a different one. + +

Now load a second circuit, the MC68882 FPU for example. +Create the circuit as explained above. You now have two different unnamed +elements. Unnamed means that the layout-name of the element +hasn't been set yet. Selecting description from the Display +menu displays the description string of the two circuits which +are CPU and FPU. The values of the circuits are set to MC68030 and MC68882. +Each of the names of an element may be changed +by <Key>n at the elements location and editing the old name in +the bottom input line. Naming pins and vias is similar to elements. +You can hide the element name so that it won't appear on the board +silkscreen by pressing <key>h with the cursor over the element. +Doing so again un-hides the element name. + +

Entering :le and selecting an element data file is +the second way to load circuits. + +

The third way to create a new element is to copy an existing one. +Please refer to Moving and Copying. + +

The fourth way to create a new element is to convert a buffer's contents +into an element. Here's how it's done: Select the Via-tool from the +Tool pallet. Set the grid spacing to something appropriate for +the element pin spacing. Now create a series of vias where the pins +go. Create them in pin number order. It is often handy to place a reference +point (!Ctrl<Key>m) in the center of the first pin in order to measure +the location of the other pins. Next make a solder-side layer the active +layer from the active-layer popup menu. Now draw the outline of +the element using lines and arcs. When you're done, select everything that +makes up the element with a box selection (<Btn3Down> drag, +<Btn3Up>). Now select "cut selection to buffer" from the Buffer +menu. Position the cursor over the center of pin 1 and press the left +button to load the data into the buffer. +Finally select "convert buffer to element" from the Buffer menu. +You'll only want to create elements this way if they aren't already in the +library. It's also probably a good idea to do this before starting any of +the other aspects of a layout, but it isn't necessary. + +

To display the pinout of a circuit move to it and press Shift<Key>d +or select show pinout from the Objects menu. A new window +pops up and displays the complete pinout of the element. This display can +be difficult to read if the component has been rotated 90 degrees :-( +therefore, the new window will show an un-rotated view so the pin names +are readable. +<Key>d displays the name of one or all pins/pads inside the +Layout area, this is only for display on-screen, it has no effect on any +printing of the layout. + +

You also may want to change a pin's or pad's current size by pressing +<Key>s to increase or Shift<Key>s to decrease it. While +this is possible, it is not recommended since care was probably taken +to define the element structure in the first place. You can also change the thickness +of the element's silkscreen outline with the same keys. You can +change whether a pin or SMD pad is rounded or square with the <Key>q. +SMD pads should usually have squared ends. Finally, you can change whether +the non-square pins are round or octagonal with the !Ctrl<Key>o. + +

SMD elements and silkscreen objects are drawn in the "invisible object" +color if they are located on the opposite side of the board. + +

For information on element connections refer to Connection Lists. + +

+ +


+Previous: Elements, +Up: Drawing and Removing + +
+ +

3.5.8 Pastebuffer

+ +

+The line-stack and element-buffer of former releases have been replaced +by 5 (possibly more or less if changed at compile time +with the MAX_BUFFER variable in globalconfig.h) +multi-purpose buffers that are selected by +Shift<Key>1..MAX_BUFFER. The status line shows which buffer is +the active one. +You may load data from a file or layout into them. +Cut-and-paste works too. +If you followed the instructions earlier in this chapter you should +now have several objects on the screen. Move the cross hair to one of them +and press <Btn3Down> to toggle its selection flag. (If you drag the +mouse while the button is down, a box selection will be attempted instead +of toggling the selection.) The object +is redrawn in a different color. You also may want to try +moving the pointer while holding the third button down and +release it on a different location. This selects all objects inside the +rectangle and unselects everything else. If you want to add a box selection +to an existing selection, drag with Mod1<Btn3Down> instead. +Dragging Shift Mod1<Btn3Down> unselects objects in a box. +Now change to pastebuffer-mode and select some operations from the +Buffer menu. Copying objects to the buffer is available as +Mod1<Key>c while cutting them uses Mod1<Key>x as +shortcut. Both clear the buffer before new data is added. +If you use the menu entries, you have to supply a cross hair position by +pressing a mouse button. The objects are attached to the pastebuffer +relative to that cross hair location. +Element data or PCB data may be merged into an existing layout by loading +the datafiles into the pastebuffer. Both operations are available from +the File menu or as user commands. + +

+ +


+Next: , +Previous: Drawing and Removing, +Up: Getting Started + +
+ +

3.6 Moving and Copying

+ +

+All objects can be moved including element-names, by +<Btn2Down>, dragging the pointer while holding the button down +and releasing it at the new location of the object. If you use +Mod1<Btn2Down> instead, the object is copied. Copying does not work for +element-names of course. You can move all selected objects with +Shift <Btn1>. This uses the Pastebuffer, so +it will remove whatever was previously in the Pastebuffer. +Please refer to Pastebuffer. +If you want to give a small nudge to an object, but you don't think +that the mouse will give you the fine level of control that you want, +you can position the cursor over the object, press <Key>[, +move it with the arrow keys, then press <Key>] when it's at the +desired position. Remember that all movements are forced onto grid coordinates, so +you may want to change the grid spacing first. + +

To move a trace or group of traces to a different layer, first select +the tracks to be moved. It's easiest to do this if you shut off everything +but that layer first (i.e. silk, pins, other layers, etc). +Now set the current layer to be the new layer. +Press Shift-M to move all the selected tracks to the current layer. +See the MoveToCurrentLayer action for more details. + +

+ +


+Next: , +Previous: Moving and Copying, +Up: Getting Started + +
+ +

3.7 Loading and Saving

+ +

+After your first experience with Pcb you will probably want to save +your work. :s name passes the data to an external program which +is responsible for saving it. For details see saveCommand in +Resources. +Saving also is available from the File menu, either with or +without supplying a filename. Pcb reuses the last +filename if you do not pass a new one to the save routine. + +

To load an existing layout either select load layout data from the +File menu or use :l filename. A file select box pops up if you +don't specify a filename. Merging existing layouts into the new one is +supported either by the File menu or by :m filename. + +

Pcb saves a backup of the current layout at a user specified interval. +The backup filename is created by appending a dash, "-", to the .pcb filename. +For example, if you are editing the layout in projects/board.pcb then the +backup file name will be projects/board.pcb-. If the layout is new and +has not been saved yet, then the backup file name is PCB.####.backup where the "####" +will be replaced by the process ID of the currenting running copy of Pcb. +This default backup file name may be changed at compilation time via the +BACKUP_NAME +variable in globalconfig.h). During critical +sections of the program or when data would be lost it is saved as +PCB.%i.save. This file name may be changed at compile time +with the SAVE_NAME variable in globalconfig.h. + +

+ +


+Next: , +Previous: Loading and Saving, +Up: Getting Started + +
+ +

3.8 Printing

+ +

+Pcb now has support for device drivers, +PostScript, encapsulated PostScript, +and Gerber RS-274X drivers are +available so far. The Gerber RS-274X +driver additionally generates a numerical control (NC) drill file for +automated drilling, +a bill of materials file to assist in materials procurement and +inventory control, and a centroid (X-Y) file which includes the +centroid data needed +by automatic assembly (pick and place) machines. + I recommend the use of GhostScript if you +don't have a PostScript printer for handling the PostScript +output. Printing always generates +a complete set of files for a specified driver. +See the page about +the Print() action for additional information about the filenames. +The control panel offers a number of options. Most of them are not available +for Gerber output because it wouldn't make sense, for example, to scale the gerber output +(you'd get an incorrectly made board!) The options are: + + + + +

device
The top menu button selects from the available device drivers. + +


rotate
Rotate layout 90 degrees counter-clockwise before printing (default). + +


mirror
Mirror layout before printing. Use this option depending +on your production line. + +


color
Created colored output. All colors will be converted to black if this option +is inactive. + +


outline
Add a board outline to the output file. The size is determined by the +maximum board size changeable from the sizes menu. The outline appears +on the top and bottom sides of the board, but not on the internal layers. +An outline can be useful for determining where to shear the board from the +panel, but be aware that it creates a copper line. Thus it has the potential +to cause short circuits if you don't leave enough room from your wiring +to the board edge. Use a viewer to see what the output outline looks like +if you want to know what it looks like. + +


alignment
Additional alignment targets are added to the output. The distances between +the board outline is set by the resource alignmentDistance. Alignment +targets should only be used if you know for certain that YOU WILL BE USING +THEM YOURSELF. It is extremely unlikely that you will want to have alignment +targets if you send gerber files to a commercial pcb manufacture to be made. + +


scaling
It's quite useful to enlarge your printout for checking the layout. +Use the scrollbar to adjust the scaling factor to your needs. + +


media
Select the size of the output media from this menu. The user defined size +may be set by the resource media either from one of the well known +paper sizes or by a X11 geometry specification. +This entry is only available if you use X11R5 or later. +For earlier releases the user defined size or, if not available, A4 +is used. +Well known size are: +
          	A3
+          	A4
+          	A5
+          	letter
+          	tabloid
+          	ledger
+          	legal
+          	executive
+
+


offset
Adjust the offsets of the printout by using the panner at the right side +of the dialog box. +This entry is only available if you use X11R5 or later. A zero +offset is used for earlier releases. + +


8.3 filenames
Select this button to generate DOS compatible filenames for the output files. +The command input area will disappear if selected. + +


commandline
Use this line to enter a command (starts with |) or a filename. +A %f is replaced by the current filename. +The default is set by the resource printCommand. + +
+ +

The created file includes some labels which are guaranteed to stay unchanged +

+
PCBMIN
identifies the lowest x and y coordinates in mil. + +
PCBMAX
identifies the highest x and y coordinates in mil. + +
PCBOFFSET
is set to the x and y offset in mil. + +
PCBSCALE
is a floating point value which identifies the scaling factor. + +
PCBSTARTDATA
PCBENDDATA
all layout data is included between these two marks. You may use them with an +awk script to produce several printouts on one piece of paper by +duplicating the code and putting some translate commands in front. +Note, the normal PostScript units are 1/72 inch. +
+ +
+ +


+Next: , +Previous: Printing, +Up: Getting Started + +
+ +

3.9 Exporting a layout

+ +

+To export a layout choose Export layout from the File menu, then +select the desired exporter. + +

+ +
+ +


+Next: , +Up: Exporting + +
+ +

3.9.1 Bill of materials (bom)

+ +

+Produces a bill of materials (BOM) file and a centroid (XY) file. + +

+ +


+Next: , +Previous: bom, +Up: Exporting + +
+ +

3.9.2 G-code (gcode)

+ +

+The gcode exporter can generate RS274/NGC G-CODE files to be used with a CNC mill to +produce pcb's by mechanically removing copper from the perimeter of all elements. + +

The elements are enlarged in order to compensate for the cutting tool size so +that the remaining copper corresponds to the original size; however all +polygons are left unchanged and will end up being a little smaller; this is not a +problem because the electrical connection is done with traces, which are correctly +enlarged. + +

A .cnc file is generated for every copper layer, with the bottom layer mirrored so +that the milling is done right; of course it's not possible to produce directly +multi-layer (more than 2) pcb's with this method, but the cnc files for +intermediate layers are generated anyways. + +

A drill file is also generated, and it contains all drills regardless of the hole +size; the drilling sequence is optimized in order to require the least amount of +movement. + +

The export function generates an intermediate raster image before extracting the contour +of copper elements, and this image is saved as well (in .png format) for inspection. + +

When the spacing between two elements is less than the tool diameter they will merge +and no isolation will be cut between them; the control image should be checked for +this behaviour. + +

Possible workarounds are: increasing spacing, decreasing the tool size, increasing +the intermediate image resolution. + +

To maximize the chance of producing correct pcb's it would be better to increase +the DRC clearance to at least the tool diameter and use traces as thick as possible; +the rule is: use the largest element that will not prevent the isolation cut. + +

The exporter parameters are: + +

+
basename
base name for generated files + +
dpi
intermediate image resolution; affects precision when extracting contours + +
mill depth
should be the copper depth + +
safe z
Z value when moving between polygons + +
tool radius
copper elements are enlarged by this amount + +
drill depth
depth of drills + +
measurement unit
for all parameters above, can be mm,um,inch,mil; g-code is always mm or inch +
+ +

All .cnc files specify Z values as parameters, so that it's easy to +change them without the need to run the exporter again. + +

Operation was verified with the EMC2 g-code interpreter. + +

Following is a sample layout that is converted with default settings: +

Sample Layout
+ +

The control image shows that the spacing is sufficient: +

Control Image
+ +

The final tool path follows the perimeter of all elements: +

Resulting Tool Path
+ +
+ +


+Next: , +Previous: gcode, +Up: Exporting + +
+ +

3.9.3 Gerber (gerber)

+ +

+Produces RS274-X (a.k.a. gerber) photo plot files and Excellon drill files. + +

+ +


+Next: , +Previous: gerber, +Up: Exporting + +
+ +

3.9.4 Nelma (nelma)

+ +

+Numerical analysis package export. + +

+ +


+Next: , +Previous: nelma, +Up: Exporting + +
+ +

3.9.5 Image (png)

+ +

+Produces GIF/JPEG/PNG image files. + +

+ +


+Next: , +Previous: png, +Up: Exporting + +
+ +

3.9.6 Postscript (ps)

+ +

+Export as postscript. +Can be later converted to pdf. + +

+ +


+Previous: ps, +Up: Exporting + +
+ +

3.9.7 Encapsulated Postscript (eps)

+ +

+Export as eps (encapsulated postscript) for inclusion in other documents. +Can be later converted to pdf. + +

+ +


+Previous: Vendor drill mapping, +Up: Getting Started + +
+ +

3.10 Connection Lists

+ +

+After completing parts of your layout you may want to check if all drawn +connections match the ones you have in mind. This is probably best done +in conjunction with a net-list file: see Rats Nest. +The following examples give more rudimentary ways to examine +the connections. +

         1) create at least two elements and name them
+         2) create some connections between their pins
+         3) optionally add some vias and connections to them
+
+

Now select lookup connection from the Connections menu, +move the cursor to a pin or via and press any mouse button. Pcb +will look for all other pins and/or vias connected to the one you have +selected and display the objects in a different color. +Now try some of the reset options available from the same menu. + +

There also is a way to scan all connections of one element. Select +a single element from the menu and press any button at the +element's location. All connections of this element will be saved +to the specified file. +Either the layout name of the element or its canonical name is used to +identify pins depending on the one which is displayed on the screen +(may be changed by Display menu). + +

An automatic scan of all elements is initiated by choosing +all elements. It behaves in a similar fashion to scanning a single +element except the resource resetAfterElement +is used to determine if connections should be reset before a new element is +scanned. Doing so will produce very long lists because the power lines are +rescanned for every element. By default the resource is set to false +for this reason. + +

To scan for unconnected pins select unused pins from the same +menu. + +

+ +


+Next: , +Previous: Exporting, +Up: Getting Started + +
+ +

3.11 Arrow Tool

+ +

+Some commands mentioned earlier in this chapter also are able to operate on all +selected and visible objects. The Arrow tool is used to select/deselect +objects and also to move objects or selections. If you click and release +on an object with the Arrow tool, it will unselect everything else and +select the object. Selected objects change color to reflect that +they are selected. If you Shift click, it will add the object to +(or remove) the object from the existing selection. If you drag with +the mouse button down with the Arrow tool, one of several things could +happen: if you first pressed the button on a selected object, you +will be moving the selection to where you release the button. If you +first pressed the button on an unselected object, you will be moving +that object. If you first pressed the button over empty space, you +will be drawing a box to select everything inside the box. The Shift +key works the same way with box selections as it does with single objects. + +

Moving a single un-selected object is different from moving a selection. +First of all, you can move the end of line, or a point in a polygon this +way which is impossible by moving selections. Secondly, if rubber banding +is turned on, moving a single object will rubber-band the attached lines. +Finally, it is faster to move a single object this way since there is no need +to select it first. + +

You can select any visible object unless it is locked. If you select an +object, then turn off its visibility with the Layer controls, it won't +be moved if you move the remaining visible selection. + +

If you have not configured to use strokes in the Pcb user interface, then +the middle mouse button is automatically bound to the arrow tool, regardless +of the active tool (which is bound to the first mouse button). So using +the middle button any time is just like using the first mouse button +with the Arrow tool active. + +

The entries of the Selection menu are hopefully self-explanatory. +Many of the Action Commands can take various key words that make +them function on all or some of the selected items. + +

+ +


+Next: , +Previous: Arrow Tool, +Up: Getting Started + +
+ +

3.12 Rats Nest

+ +

+If you have a netlist that corresponds to the layout you are working on, you +can use the rats-nest feature to add rat-lines to the layout. +First you will need to load a netlist file (see :rn, +User Commands). +<Key>w adds rat-lines on the active layer using the current +line thickness shown in the status line (usually you'll want them to be thin lines). +Only those rat-lines that fill in missing connectivity (since you have +probably routed some connections already) are added. +If the layout is already completely wired, nothing will be added, and you will +get a message that the wiring is complete. + +

Rat-lines are lines having the special property that they only connect to pins and +pads at their end points. Rat-lines may be drawn differently to other lines +to make them easier to identify since they have special behavior and cannot +remain in a completed layout. +Rat-lines are added in the minimum length straight-line tree pattern +(always ending on pins or pads) that satisfies the missing connectivity in the circuit. +Used in connection with moves and rotates of the elements, they are extremely useful for +deciding where to place elements on the board. The rat-lines will always automatically +rubberband to the elements whether or not the rubberband mode is on. The only way for +you to move them is by moving the parts they connect to. +This is because it is never desirable to have the rat-lines disconnected from +their element pins. Rat-lines will normally criss-cross +all over which gives rise to the name "rats nest" describing a layout connected with +them. If a SMD pad is unreachable on the active layer, a warning will be issued +about it and the rat-line to that pad will not be generated. + +

A common way to use rats nests is to place some +elements on the board, add the rat-lines, and then use a series of moves/rotates of the +elements until the rats nest appears to have minimum tangling. You may want to iterate this step +several times. Don't worry if the layout looks messy - as long as you can get a sense for whether +the criss-crossing is better or worse as you move things, you're fine. +After moving some elements around, you may want to optimize the rats nest <Key>o +so that the lines are drawn between the closest points (this can change once you've moved components). +Adding rat-lines only to selected pads/pins (Shift<Key>w) +is often useful to layout a circuit a little bit at a time. +Sometimes you'll want to delete all the rat-lines (<Key>e) or +selected rat-lines (Shift<Key>e) in order to reduce confusion. +With a little practice you'll be able to achieve a near optimal component placement with +the use of a rats nest. + +

Rat-lines are not only used for assisting your element placement, they can also help +you to route traces on the board. +Use the <Key>m to convert a rat-line under the cursor into +a normal line on the active layer. +Inserting a point into a rat-line will also cause the two new lines to be normal lines +on the board. +Another way that you can use rat-lines is to +use the <Key>f with the cursor over a pad or pin. All of the pins and +pads and rat-lines belonging to that net will be highlighted. This is a helpful way to +distinguish one net from the rest of the rats nest. You can then route those tracks, +turn off the highlighting (Shift<Key>f) and repeat the process. This will work even +if the layer that the rat-lines reside on is made invisible - so only the pins and pads +are highlighted. +Be sure to erase the rat-lines (<Key>e erases them all) once you've +duplicated their connectivity by adding your own lines. +When in doubt, the <Key>o will delete only those +rat-lines that are no longer needed. + +

If connections exist on the board that are not listed in the netlist when +<Key>w is pressed, warning messages are issued and the affected pins and +pads are drawn in a special warnColor until the next Notify() event. +If the entire layout agrees completely with the netlist, a message informs you that +the layout is complete and no rat-lines will be added (since none are needed). +If the layout is complete, but still has rat-lines then you will be warned +that rat-lines remain. If you get no message at all it's probably because some +elements listed in the net list can't be found and where reported in an earlier +message. +There shouldn't be any rat-lines left in a completed layout, only normal lines. + +

The Shift<Key>w is used to add rat-lines to only those missing connections among +the selected pins and pads. This can be used to add rat-lines in an incremental +manner, or to force a rat-line to route between two points that are not the +closest points within the net. Often it is best to add the rats nest in an incremental fashion, laying +out a sub-section of the board before going further. This is easy to accomplish since +new rat-lines are never added where routed connectivity already makes the necessary +connections. + +

+ +


+Next: , +Previous: Rats Nest, +Up: Getting Started + +
+ +

3.13 Design Rule Checking

+ +

+After you've finished laying out a board, you may want to check +to be certain that none of your interconnections are too closely +spaced or too tenuously touching to be reliably fabricated. The design +rule checking (DRC) function does this for you. Use the command ":DRC()" (without +the quotes of course) to invoke the checker. If there are no problem areas, +you'll get a message to that effect. If any problem is encountered, you will get +a message about it and the affected traces will be highlighted. One part of the +tracks of concern will be selected, while the other parts of concern will have the +"FindConnection" highlighting. The screen will automatically be centered in the +middle of the object having the "FindConnection" (Green) highlighting. The middle of +the object is also the coordinates reported to be "near" the problem. The actual trouble +region will be somewhere on the boundary of this object. If the two parts are +from different nets then there is some place where they approach each +other closer than the minimum rule. If the parts are from the same net, then +there is place where they are only barely connected. Find that place and connect +them better. + +

After a DRC error is found and corrected you must run the DRC again because +the search for errors is halted as soon as the first problem is found. Unless you've +been extremely careless there should be no more than a few design rule errors +in your layout. The DRC checker does not check for minimum spacing rules to +copper text, so always be very careful when adding copper text to a layout. +The rules for the DRC are specified in the application resource file. The minimum +spacing value (in mils) is given by the Settings.Bloat value. The default +is 7 mils. The minimum touching overlap (in mils) is given by the +Settings.Shrink value. This value defaults to 5 mils. Check with your +fabrication process people to determine the values that are right for you. + +

If you want to turn off the highlighting produced by the DRC, perform an +undo (assuming no other changes have been made). To restore the highlighting, +use redo. The redo will restore the highlighting quickly without re-running +the DRC checker. + +

+ +


+Next: , +Previous: Design Rule Checking, +Up: Getting Started + +
+ +

3.14 Trace Optimizer

+ +

+PCB includes a flexible trace optimizer. The trace optimizer can be run +after auto routing or hand routing to clean up the traces. + +

+
Auto-Optimize
Performs debumpify, unjaggy, orthopull, vianudge, and viatrim, in that +order, repeating until no further optimizations are performed. + +
Debumpify
Looks for U shaped traces that can be shortened or eliminated. + +
Unjaggy
Looks for corners which could be flipped to eliminate one or more +corners (i.e. jaggy lines become simpler). + +
Vianudge
Looks for vias where all traces leave in the same direction. Tries to +move via in that direction to eliminate one of the traces (and thus a +corner). + +
Viatrim
Looks for traces that go from via to via, where moving that trace to a +different layer eliminates one or both vias. + +
Orthopull
Looks for chains of traces all going in one direction, with more traces +orthogonal on one side than on the other. Moves the chain in that +direction, causing a net reduction in trace length, possibly eliminating +traces and/or corners. + +
SimpleOpts
Removing unneeded vias, replacing two or more trace segments in a row +with a single segment. This is usually performed automatically after +other optimizations. + +
Miter
Replaces 90 degree corners with a pair of 45 degree corners, to reduce +RF losses and trace length. + +
+ +
+ +


+Next: , +Previous: Trace Optimizer, +Up: Getting Started + +
+ +

3.15 Searching for elements

+ +

+To locate text or a specific element or grouping of similar elements +choose ‘Select by name’ from the Select menu, then choose the +appropriate subsection. At the bottom of the screen the prompt +pattern: appears. Enter the text or Regular Expressions +of the text to be found. Found text will be highlighted. + +

+ +


+Next: , +Previous: Searching for elements, +Up: Getting Started + +
+ +

3.16 Measuring distances

+ +

+To measure distances, for example the pin-to-pin pitch of a part to +validate a footprint, place the cursor at the starting +measurement point, then press !Ctrl<Key>m. This marks the +current location with a X. The X mark is now the zero point +origin for the relative cursor position display. The cursor display +shows both absolute position and position relative to the mark as +the mouse is moved away from the mark. If a mark is already present, +the mark is removed and the cursor display stops displaying relative +cursor coordinates. + +

+ +


+Next: , +Previous: Measuring distances, +Up: Getting Started + +
+ +

3.17 Vendor Drill Mapping

+ +

+Pcb includes support for mapping drill holes to a specified set +of sizes used by a particular vendor. Many PCB manufacturers have a +prefered set of drill sizes and charge extra when others are used. +The mapping can be performed on an existing design and can also be +enabled to automatically map drill holes as vias and elements are +instantiated. + +

The first step in using the vendor drill mapping feature is to create +a resource file describing the capabilities of your vendor. The file +format is the resource file format described in Resource Syntax. +A complete example is given below. + +

     # Optional name of the vendor
+     vendor = "Vendor Name"
+     
+     # units for dimensions in this file.
+     # Allowed values:  mil/inch/mm
+     units = mil
+     
+     # drill table
+     drillmap = {
+        # When mapping drill sizes, select the nearest size
+        # or always round up.  Allowed values:  up/nearest
+        round = up
+     
+        # The list of vendor drill sizes.  Units are as specified
+        # above.
+        20
+        28
+        35
+        38
+        42
+        52
+        59.5
+        86
+       125
+       152
+     
+        # optional section for skipping mapping of certain elements
+        # based on reference designator, value, or description
+        # this is useful for critical parts where you may not
+        # want to change the drill size.  Note that the strings
+        # are regular expressions.
+        skips = {
+           {refdes "^J3$"}  # Skip J3.
+           {refdes "J3"}  # Skip anything with J3 as part of the refdes.
+           {refdes "^U[1-3]$" "^X.*"} # Skip U1, U2, U3, and anything starting with X.
+           {value "^JOHNSTECH_.*"} # Skip all Johnstech footprints based on the value of a part.
+           {descr "^AMP_MICTOR_767054_1$"} # Skip based on the description.
+        }
+     }
+     
+     # If specified, this section will change the current DRC
+     # settings for the design.  Units are as specified above.
+     drc = {
+        copper_space = 7
+        copper_width = 7
+        silk_width = 10
+        copper_overlap = 4
+     }
+
+

The vendor resource is loaded using the LoadVendor action. +This is invoked by entering: +

     :LoadVendor(vendorfile)
+
+

from within Pcb. Substitute the file name of your vendor +resource file for ‘vendorfile’. This action will load the vendor +resource and modify all the drill holes in the design as well as the +default via hole size for the various routing styles. + +

Once a vendor drill map has been loaded, new vias and elements will +automatically have their drill hole sizes mapped to the vendor drill +table. Automatic drill mapping may be disabled under the “Settings” +menu. To re-apply an already loaded vendor drill table to a design, +choose “Apply vendor drill mapping” from the “Connects” menu. + +

See Actions for a complete description of the actions associated +with vendor drill mapping. + +

Note that the expressions used in the skips section are regular +expressions. See Regular Expressions for an introduction to +regular expressions. + + +

+ +


+Next: , +Previous: Getting Started, +Up: Top + +
+ +

4 Autorouter

+ +

+Pcb includes an autorouter which can greatly speed up the +layout of a circuit board. The autorouter is a rectangle-expansion +type of autorouter based on +“A Method for Gridless Routing of Printed Circuit Boards” by +A. C. Finch, K. J. Mackenzie, G. J. Balsdon, and G. Symonds in the +1985 Proceedings of the 22nd ACM/IEEE Design Automation Conference. +This reference is available from the ACM Digital Library at +http://www.acm.org/dl for those with institutional or personal +access to it. It's also available from your local engineering +library. The reference paper is not needed for using the autorouter. + +

Before using the autorouter, all elements need to be loaded into the +layout and placed and the connectivity netlist must be loaded. Once +the elements have been placed and the netlist loaded, the following +steps will autoroute your design. + +

    +
  1. Turn off visibility of any layers that you don't want the router +to use. + +
  2. Turn of via visibility if you don't want the router to use any +new vias. + +
  3. Use only plain rectangles for power/ground planes that you want + the router to use [use the rectangle tool!] + +
  4. Make at least one connection from any plane you want the router to + use to the net you want it to connect to. + +
  5. Draw continuous lines (on all routing layers) to outline keep-out + zones if desired. + +
  6. Use routing styles in the netlist to have per-net routing styles. + Note that the routing style will be used for an entire net. This means + if you have a wide metal setting for a power net you will need to manually + route breakouts from any fine pitch parts on their power pins because + the router will not be able to change to a narrow trace to connect + to the part. + +
  7. Set the current routing style to whatever you'd like the router to + use for any nets not having a defined route style in the netlist. + +
  8. Disable any nets that you don't want the autorouter to route + (double-click them in the netlist window to add/remove the *) + +

    NOTE: If you will be manually routing these later not using + planes, it is usually better to let the autorouter route them then rip + them up yourself afterwards. If you plan to use a ground/power plane + manually, consider making it from one or more pure rectangles and + letting the autorouter have a go at it. + +

  9. Create a fresh rat's nest. ('E' the 'W') + +
  10. Select “show autorouter trials” in the settings menu if you want + to watch what's happening + +
  11. Choose “autoroute all rats” in the connection menu. + +
  12. If you really want to muck with the router because you have a + special design, e.g. all through-hole components you can mess with + layer directional costs by editing the autoroute.c source file and + changing the directional costs in lines 929-940. and try again. Even + more mucking about with costs is possible in lines 4540-4569, but it's + probably not such a good idea unless you really just want to + experiment. + +
+ +

After the design has been autorouted, you may want to run the trace +optimizer. See section Trace Optimizer for more information on +the trace optimizer. + + +

+ +


+Next: , +Previous: Autorouter, +Up: Top + +
+ +

5 User Commands

+ +

The entering of user-commands is initiated by the action routine +Command() (normally bound to the (":") character) which +replaces the bottom statusline with an input area or opens a separate +command window. It is finished by either <Key>Return or +<Key>Escape to confirm or to abort. These two key-bindings +cannot be changed from the resource file. The triggering event, +normally a key press, is ignored. + +

Commands can be entered in one of two styles, command entry syntax: +“Command arg1 arg2” or action script syntax “Action1(arg1, +arg2); Action2(arg1, arg2);”. Quoting arguments works similar to +bash quoting: + +

    +
  • A backslash (\) is the escape character. It preserves the literal +value of the next character that follows. To get a literal '\' use +"\\". + +
  • Enclosing characters in single quotes preserves the literal value of +each character within the quotes. A single quote may not occur +between single quotes, even when preceded by a blackslash. + +
  • Enclosing characters in double quotes preserves the literal value of +all characters within the quotes, with the exception of '\' which +maintains its special meaning as an escape character. +
+ +

There are simple usage dialogs for each command and one for the +complete set of commands. + + + + + +

l [filename]
Loads a new datafile (layout) and, if confirmed, overwrites any existing unsaved data. +The filename and the searchpath (filePath) are passed to the +command defined by fileCommand. +If no filename is specified a file select box will popup. + +


le [filename]
Loads an element description into the paste buffer. +The filename and the searchpath (elementPath) are passed to the +command defined by elementCommand. +If no filename is specified a file select box will popup. + +


m [filename]
Loads an layout file into the paste buffer. +The filename and the searchpath (filePath) are passed to the +command defined by fileCommand. +If no filename is specified a file select box will popup. + +


q[!]
Quits the program without saving any data (after confirmation). +q! doesn't ask for confirmation, it just quits. + +


s [filename]
Data and the filename are passed to the command defined by the resource +saveCommand. It must read the layout data from stdin. +If no filename is entered, either the last one is used +again or, if it is not available, a file select box will pop up. + +


rn [filename]
Reads in a netlist file. If no filename is given +a file select box will pop up. +The file is read via the command defined by the +RatCommand resource. The command must send its output to stdout. + +

Netlists are used for generating rat's nests (see Rats Nest) and for +verifying the board layout (which is also accomplished by the Ratsnest +command). + +


w[q] [filename]
These commands have been added for the convenience of vi users and +have the same functionality as s combined with q. + +


actionCommand
Causes the actionCommand to be executed. This allows you to initiate actions +for which no bindings exist in the resource file. It can be used to initiate any +action with whatever arguments you enter. This makes it possible to do things +that otherwise would be extremely tedious. For example, to change the drilling +hole diameter of all vias in the layout to 32 mils, you could select everything using the +selection menu, then type ":ChangeDrillSize(SelectedVias, 32)". (This will +only work provided the via's diameter is sufficiently large to accommodate a 32 mil hole). +Another example might be to set the grid to 1 mil by typing ":SetValue(Grid, 1)". +Note that some actions use the current cursor location, so be sure to place the cursor +where you want before entering the command. This is one of my favorite new +features in 1.5 and can be a powerful tool. Study the Actions section to +see what actions are available. + +
+ + +
+ + +


+Next: , +Previous: User Commands, +Up: Top + +
+ +

6 Command-Line Options

+ +

+The synopsis of the pcb command is: + +

pcb [OPTION ...] [LAYOUT-FILE.pcb] to start the application in GUI mode, + +

or + +

pcb [-h | -V | --copyright] for a list of options, version, and copyright, + +

or + +

pcb -p [OPTION ...] [LAYOUT-FILE.pcb] to print a layout, + +

or + +

pcb -x HID [OPTION ...] [LAYOUT-FILE.pcb] to export. + +

Possible values for the parameter ‘HID’ are: +

+
bom
Export a bill of materials +
gcode
Export to G-Code +
gerber
Export RS-274X (Gerber) +
nelma
Numerical analysis package export +
png
export GIF/JPEG/PNG +
ps
export postscript +
eps
export encapsulated postscript +
+ +

There are several resources which may be set or reset in addition to the +standard toolkit command-line options. For a complete list refer to +Resources. + + +

+ + + +

6.1 General Options

+ + +
+
--help
Show help on command line options. +
+ +
+
--version
Show version. +
+ +
+
--verbose
Be verbose on stdout. +
+ +
+
--copyright
Show copyright. +
+ +
+
--show-defaults
Show option defaults. +
+ +
+
--show-actions
Show available actions and exit. +
+ +
+
--dump-actions
Dump actions (for documentation). +
+ +
+
--grid-units-mm <string>
Set default grid units. Can be mm or mil. Defaults to mil. +
+ +
+
--backup-interval
Time between automatic backups in seconds. Set to 0 to disable. +The default value is 60. +
+ +
+
--groups <string>
Layer group string. Defaults to "1,c:2:3:4:5:6,s:7:8". +
+ +
+
--route-styles <string>
A string that defines the route styles. Defaults to
+"Signal,1000,3600,2000,1000:Power,2500,6000,3500,1000 + :Fat,4000,6000,3500,1000:Skinny,600,2402,1181,600" +
+ +
+
--element-path <string>
A colon separated list of directories or commands (starts with '|'). +The path is passed to the program specified in --element-command. +
+ +
+
--action-script <string>
If set, this file is executed at startup. +
+ +
+
--action-string <string>
If set, this string of actions is executed at startup. +
+ +
+
--fab-author <string>
Name of author to be put in the Gerber files. +
+ +
+
--layer-stack <string>
Initial layer stackup, for setting up an export. A comma separated list of layer +names, layer numbers and layer groups. +
+ +
+
--save-last-command
If set, the last user command is saved. +
+ +
+
--save-in-tmp
If set, all data which would otherwise be lost are saved in a temporary file +/tmp/PCB.%i.save . Sequence ‘%i’ is replaced by the process ID. +
+ +
+
--reset-after-element
If set, all found connections are reset before a new component is scanned. +
+ +
+
--ring-bell-finished
Execute the bell command when all rats are routed. +
+ +
+ +


+Next: , +Previous: General Options, +Up: Command-Line Options + +
+ +

6.2 General GUI Options

+ + +
+
--pinout-offset-x <num>
Horizontal offset of the pin number display. Defaults to 100mil. +
+ +
+
--pinout-offset-y <num>
Vertical offset of the pin number display. Defaults to 100mil. +
+ +
+
--pinout-text-offset-x <num>
Horizontal offset of the pin name display. Defaults to 800mil. +
+ +
+
--pinout-text-offset-y <num>
Vertical offset of the pin name display. Defaults to -100mil. +
+ +
+
--draw-grid
If set, draw the grid at start-up. +
+ +
+
--clear-line
If set, new lines clear polygons. +
+ +
+
--full-poly
If set, new polygons are full ones. +
+ +
+
--unique-names
If set, you will not be permitted to change the name of an component to match that +of another component. +
+ +
+
--snap-pin
If set, pin centers and pad end points are treated as additional grid points +that the cursor can snap to. +
+ +
+
--all-direction-lines
Allow all directions, when drawing new lines. +
+ +
+
--show-number
Pinout shows number. +
+ +
+ + +


+Next: , +Previous: General GUI Options, +Up: Command-Line Options + +
+ +

6.3 GTK+ GUI Options

+ + +
+
--listen
Listen for actions on stdin. +
+ +
+
--bg-image <string>
File name of an image to put into the background of the GUI canvas. The image must +be a color PPM image, in binary (not ASCII) format. It can be any size, and will be +automatically scaled to fit the canvas. +
+ +
+
--pcb-menu <string>
Location of the gpcb-menu.res file which defines the menu for the GTK+ GUI. +
+ +
+ +


+Next: , +Previous: GTK+ GUI Options, +Up: Command-Line Options + +
+ +

6.4 lesstif GUI Options

+ + +
+
--listen
Listen for actions on stdin. +
+ +
+
--bg-image <string>
File name of an image to put into the background of the GUI canvas. The image must +be a color PPM image, in binary (not ASCII) format. It can be any size, and will be +automatically scaled to fit the canvas. +
+ +
+
--pcb-menu <string>
Location of the pcb-menu.res file which defines the menu for the lesstif GUI. +
+ +
+ +


+Next: , +Previous: lesstif GUI Options, +Up: Command-Line Options + +
+ +

6.5 Colors

+ + +
+
--black-color <string>
Color value for black. Default: ‘#000000’ +
+ +
+
--black-color <string>
Color value for white. Default: ‘#ffffff’ +
+ +
+
--background-color <string>
Background color of the canvas. Default: ‘#e5e5e5’ +
+ +
+
--crosshair-color <string>
Color of the crosshair. Default: ‘#ff0000’ +
+ +
+
--cross-color <string>
Color of the cross. Default: ‘#cdcd00’ +
+ +
+
--via-color <string>
Color of vias. Default: ‘#7f7f7f’ +
+ +
+
--via-selected-color <string>
Color of selected vias. Default: ‘#00ffff’ +
+ +
+
--pin-color <string>
Color of pins. Default: ‘#4d4d4d’ +
+ +
+
--pin-selected-color <string>
Color of selected pins. Default: ‘#00ffff’ +
+ +
+
--pin-name-color <string>
Color of pin names and pin numbers. Default: ‘#ff0000’ +
+ +
+
--element-color <string>
Color of components. Default: ‘#000000’ +
+ +
+
--rat-color <string>
Color of ratlines. Default: ‘#b8860b’ +
+ +
+
--invisible-objects-color <string>
Color of invisible objects. Default: ‘#cccccc’ +
+ +
+
--invisible-mark-color <string>
Color of invisible marks. Default: ‘#cccccc’ +
+ +
+
--element-selected-color <string>
Color of selected components. Default: ‘#00ffff’ +
+ +
+
--rat-selected-color <string>
Color of selected rats. Default: ‘#00ffff’ +
+ +
+
--connected-color <string>
Color to indicate connections. Default: ‘#00ff00’ +
+ +
+
--off-limit-color <string>
Color of off-canvas area. Default: ‘#cccccc’ +
+ +
+
--grid-color <string>
Color of the grid. Default: ‘#ff0000’ +
+ +
+
--layer-color-<n> <string>
Color of layer <n>, where <n> is an integer from 1 to 16. +
+ +
+
--layer-selected-color-<n> <string>
Color of layer <n>, when selected. <n> is an integer from 1 to 16. +
+ +
+
--warn-color <string>
Color of offending objects during DRC. Default value is "#ff8000" +
+ +
+
--mask-color <string>
Color of the mask layer. Default value is "#ff0000" +
+ +
+ +


+Next: , +Previous: Colors, +Up: Command-Line Options + +
+ +

6.6 Layer Names

+ + +
+
--layer-name-1 <string>
Name of the 1st Layer. Default is "top". +
+ +
+
--layer-name-2 <string>
Name of the 2nd Layer. Default is "ground". +
+ +
+
--layer-name-3 <string>
Name of the 3nd Layer. Default is "signal2". +
+ +
+
--layer-name-4 <string>
Name of the 4rd Layer. Default is "signal3". +
+ +
+
--layer-name-5 <string>
Name of the 5rd Layer. Default is "power". +
+ +
+
--layer-name-6 <string>
Name of the 6rd Layer. Default is "bottom". +
+ +
+
--layer-name-7 <string>
Name of the 7rd Layer. Default is "outline". +
+ +
+
--layer-name-8 <string>
Name of the 8rd Layer. Default is "spare". +
+ +
+ +


+Next: , +Previous: Layer Names, +Up: Command-Line Options + +
+ +

6.7 Paths

+ + +
+
--lib-newlib <string>
Top level directory for the newlib style library. +
+ +
+
--lib-name <string>
The default filename for the library. +
+ +
+
--default-font <string>
The name of the default font. +
+ +
+
--file-path <string>
A colon separated list of directories or commands (starts with '|'). The path +is passed to the program specified in --file-command together with the selected +filename. +
+ +
+
--font-path <string>
A colon separated list of directories to search the default font. Defaults to +the default library path. +
+ +
+
--lib-path <string>
A colon separated list of directories that will be passed to the commands specified +by --element-command and --element-contents-command. +
+ +
+ +


+Next: , +Previous: Paths, +Up: Command-Line Options + +
+ +

6.8 Sizes

+ + +

All parameters should be given with an unit. If no unit is given, 1/100 mil +(cmil) will be used. Write units without space to the +number like 3mm, not 3 mm. +Valid Units are: +

+
km
Kilometer +
m
Meter +
cm
Centimeter +
mm
Millimeter +
um
Micrometer +
nm
Nanometer +
in
Inch (1in = 0.0254m) +
mil
Mil (1000mil = 1in) +
cmil
Centimil (1/100 mil) +
+ +
+
--via-thickness <num>
Default diameter of vias. Default value is 60mil. +
+ +
+
--via-drilling-hole <num>
Default diameter of holes. Default value is 28mil. +
+ +
+
--line-thickness <num>
Default thickness of new lines. Default value is 10mil. +
+ +
+
--rat-thickness <num>
Thickness of rats. Values from 1 to 19 are fixed width in screen pixels. +Anything larger means PCB units (i.e. 100 means "1 mil"). Default value +is 10mil. +
+ +
+
--keepaway <num>
Default minimum distance between a track and adjacent copper. +Default value is 10mil. +
+ +
+
--default-PCB-width <num>
Default width of the canvas. Default value is 6000mil. +
+ +
+
--default-PCB-height <num>
Default height of the canvas. Default value is 5000mil. +
+ +
+
--text-scale <num>
Default text scale. This value is in percent. Default value is 100. +
+ +
+
--alignment-distance <num>
Specifies the distance between the board outline and alignment targets. +Default value is 2mil. +
+ +
+
--grid <num>
Initial grid size. Default value is 10mil. +
+ +
+
--minimum polygon area <num>
Minimum polygon area. +
+ +
+ +


+Next: , +Previous: Sizes, +Up: Command-Line Options + +
+ +

6.9 Commands

+ + +

pcb uses external commands for input output operations. These commands can be +configured at start-up to meet local requirements. The command string may include +special sequences %f, %p or %a. These are replaced when the +command is called. The sequence %f is replaced by the file name, +%p gets the path and %a indicates a package name. + +

+
--font-command <string>
Command to load a font. +
+ +
+
--file-command <string>
Command to read a file. +
+ +
+
--element-command <string>
Command to read a footprint.
+Defaults to "M4PATH='%p';export M4PATH;echo 'include(%f)' | m4" +
+ +
+
--print-file <string>
Command to print to a file. +
+ +
+
--lib-command-dir <string>
Path to the command that queries the library. +
+ +
+
--lib-command <string>
Command to query the library.
+Defaults to "QueryLibrary.sh '%p' '%f' %a" +
+ +
+
--lib-contents-command <string>
Command to query the contents of the library.
+Defaults to "ListLibraryContents.sh %p %f" or, +on Windows builds, an empty string (to disable this feature). +
+ +
+
--save-command <string>
Command to save to a file. +
+ +
+
--rat-command <string>
Command for reading a netlist. Sequence %f is replaced by the netlist filename. +
+ +
+ +


+Next: , +Previous: Commands, +Up: Command-Line Options + +
+ +

6.10 DRC Options

+ + +

All parameters should be given with an unit. If no unit is given, 1/100 mil +(cmil) will be used for backward compability. Valid units are given in section +Sizes. + +

+
--bloat <num>
Minimum spacing. Default value is 10mil. +
+ +
+
--shrink <num>
Minimum touching overlap. Default value is 10mil. +
+ +
+
--min-width <num>
Minimum width of copper. Default value is 10mil. +
+ +
+
--min-silk <num>
Minimum width of lines in silk. Default value is 10mil. +
+ +
+
--min-drill <num>
Minimum diameter of holes. Default value is 15mil. +
+ +
+
--min-ring <num>
Minimum width of annular ring. Default value is 10mil. +
+ +
+ +


+Next: , +Previous: DRC Options, +Up: Command-Line Options + +
+ +

6.11 BOM Creation

+ + +
+
--bomfile <string>
Name of the BOM output file. +
+ +
+
--xyfile <string>
Name of the XY output file. +
+ +
+
--xy-unit <unit>
Unit of XY dimensions. Defaults to mil. +
+ +
+ +


+Next: , +Previous: BOM Creation, +Up: Command-Line Options + +
+ +

6.12 Gerber Export

+ + +
+
--gerberfile <string>
Gerber output file prefix. Can include a path. +
+ +
+
--all-layers
Output contains all layers, even empty ones. +
+ +
+
--verbose
Print file names and aperture counts on stdout. +
+ + + +

6.13 Postscript Export

+ + +
+
--psfile <string>
Name of the postscript output file. Can contain a path. +
+ + + +
--drill-helper
Print a centering target in large drill holes. +
+ + + +
--align-marks
Print alignment marks on each sheet. This is meant to ease alignment during exposure. +
+ +
+
--outline
Print the contents of the outline layer on each sheet. +
+ +
+
--mirror
Print mirror image. +
+ +
+
--fill-page
Scale output to make the board fit the page. +
+ +
+
--auto-mirror
Print mirror image of appropriate layers. +
+ +
+
--ps-color
Postscript output in color. +
+ + + +
--ps-bloat <num>
Amount to add to trace/pad/pin edges. +
+ + + +
--ps-invert
Draw objects as white-on-black. +
+ +
+
--media <media-name>
Size of the media, the postscript is fitted to. The parameter +<media-name> can be any of the standard names for paper size: ‘A0’ +to ‘A10’, ‘B0’ to ‘B10’, ‘Letter’, ‘11x17’, +‘Ledger’, ‘Legal’, ‘Executive’, ‘A-Size’, ‘B-size’, +‘C-Size’, ‘D-size’, ‘E-size’, ‘US-Business_Card’, +‘Intl-Business_Card’. +
+ + + +
--psfade <num>
Fade amount for assembly drawings (0.0=missing, 1.0=solid). +
+ +
+
--scale <num>
Scale value to compensate for printer sizing errors (1.0 = full scale). +
+ + + +
--multi-file
Produce multiple files, one per page, instead of a single multi page file. +
+ +
+
--xcalib <num>
Paper width. Used for x-Axis calibration. +
+ +
+
--ycalib <num>
Paper height. Used for y-Axis calibration. +
+ +
+
--drill-copper
Draw drill holes in pins / vias, instead of leaving solid copper. +
+ + + +
--show-legend
Print file name and scale on printout. +
+ +
+ +


+Next: , +Previous: Postscript Export, +Up: Command-Line Options + +
+ +

6.14 Encapsulated Postscript Export

+ + +
+
--eps-file <string>
Name of the encapsulated postscript output file. Can contain a path. +
+ +
+
--eps-scale <num>
Scale EPS output by the parameter ‘num’. +
+ + + +
--as-shown
Export layers as shown on screen. +
+ +
+
--monochrome
Convert output to monochrome. +
+ + + +
--only-visible
Limit the bounds of the EPS file to the visible items. +
+ + + +

6.15 PNG Options

+ + +
+
--outfile <string>
Name of the file to be exported to. Can contain a path. +
+ +
+
--dpi
Scale factor in pixels/inch. Set to 0 to scale to size specified in the layout. +
+ +
+
--x-max
Width of the png image in pixels. No constraint, when set to 0. +
+ +
+
--y-max
Height of the png output in pixels. No constraint, when set to 0. +
+ +
+
--xy-max
Maximum width and height of the PNG output in pixels. No constraint, when set to 0. +
+ +
+
--as-shown
Export layers as shown on screen. +
+ +
+
--monochrome
Convert output to monochrome. +
+ +
+
--only-vivible
Limit the bounds of the exported PNG image to the visible items. +
+ +
+
--use-alpha
Make the background and any holes transparent. +
+ +
+
--format <string>
File format to be exported. Parameter <string> can be ‘PNG’, +‘GIF’, or ‘JPEG’. +
+ +
+
--png-bloat <num><dim>
Amount of extra thickness to add to traces, pads, or pin edges. The parameter +‘<num><dim>’ is a number, appended by a dimension ‘mm’, ‘mil’, or +‘pix’. If no dimension is given, the default dimension is 1/100 mil. +
+ + + +
--photo-mode
Export a photo realistic image of the layout. +
+ +
+
--photo-flip-x
In photo-realistic mode, export the reverse side of the layout. Left-right flip. +
+ +
+
--photo-flip-y
In photo-realistic mode, export the reverse side of the layout. Up-down flip. +
+ +
+ +


+Next: , +Previous: PNG Options, +Up: Command-Line Options + +
+ +

6.16 lpr Printing Options

+ + +
+
--lprcommand <string>
Command to use for printing. Defaults to lpr. This can be used to produce +PDF output with a virtual PDF printer. Example:
+--lprcommand "lp -d CUPS-PDF-Printer". +
+In addition, all Postscript Export options are valid. + +
+ +


+Previous: lpr Printing Options, +Up: Command-Line Options + +
+ +

6.17 nelma Options

+ + +
+
-- basename <string>
File name prefix. +
+ +
+
--dpi <num>
Horizontal scale factor (grid points/inch). +
+ +
+
--copper-height <num>
Copper layer height (um). +
+ +
+
--substrate-height <num>
Substrate layer height (um). +
+ +
+
--substrate-epsilon <num>
Substrate relative epsilon. +
+ + +
+ +


+Next: , +Previous: Command-Line Options, +Up: Top + +
+ +

7 X11 Interface

+ +

+This chapter gives an overview about the additional X11 resources which +are defined by Pcb as well as the defined action routines. + +

+ +
+ +


+Next: , +Up: X11 Interface + +
+ +

7.1 Non-Standard X11 Application Resources

+ +

+In addition to the toolkit resources, Pcb defines the +following resources: + + + + +

absoluteGrid (boolean)
Selects if either the grid is relative to the position where it has changed +last or absolute, the default, to the origin (0,0). + +


alignmentDistance (dimension)
Specifies the distance between the boards outline to the alignment targets. + +


allDirectionLines (boolean)
Enables (default) or disables clipping of new lines to 45 degree angles. + +


backgroundImage (string)
If specified, this image will be drawn as the background for the +board. The purpose of this option is to allow you to use a scan of an +existing layout as a prototype for your new layout. To do this, there +are some limitations as to what this image must be. The image must be +a PPM binary image (magic number ‘P6’). It must have a maximum +pixel value of 255 or less (i.e. no 16-bit images). It must represent +the entire board, as it will be scaled to fit the board dimensions +exactly. Note that it may be scaled unevenly if the image doesn't +have the same aspect ratio of your board. You must ensure that the +image does not use more colors than are available on your system +(mostly this is for pseudo-color displays, like old 8-bit displays). +For best results, I suggest the following procedure using The Gimp: +Load your image (any type). Image->Scale if needed. +Image->Colors->Curves and for each of Red, Green, and Blue channel +move the lower left point up to about the 3/4 line (value 192). This +will make your image pale so it doesn't interfere with the traces +you'll be adding. Image->Mode->Indexed and select, say, 32 colors +with Normal F-S dithering. File->Save As, file type by extension, +use .ppm as the extension. Select Raw formatting. + +


backupInterval (int)
Pcb has an automatic backup feature which saves the current data +every n seconds. The default is 300 seconds. A value of zero disables +the feature. The backup file is named /tmp/PCB.%i.backup by +default (this may have been changed at compilation time via the +BACKUP_NAME +variable in globalconfig.h). +%i is replaced by the process ID. +See also, the command-line option –backup-interval. + +


Bloat (dimension)
Specifies the minimum spacing design rule in mils. + +


connectedColor (color)
All pins, vias, lines and rectangles which are selected during a connection +search are drawn with this color. The default value is determined by +XtDefaultForeground. + +


cross hairColor (color)
This color is used to draw the cross hair cursor. The color is a result of +a XOR operation with the contents of the Layout area. The result +also depends on the default colormap of the X11 server because only +the colormap index is used in the boolean operation and Pcb doesn't +create its own colormap. The default setting is XtDefaultForeground. + +


elementColor (color)
elementSelectedColor (color)
The elements package part is drawn in these colors, for normal and selected +mode, respectively, which both default to XtDefaultForeground. + +


elementCommand (string)
Pcb uses a user defined command to read element files. This resources +is used to set the command which is executed by the users default shell. +Two escape sequences are defined to pass the selected filename (%f) and the +current search path (%p). The command must write the element data +to its standard output. The default value is +
              M4PATH="%p";export M4PATH;echo 'include(%f)' | m4
+
+

Using the GNU version of m4 is highly recommended. +See also, the command-line option –element-command. + +


elementPath (string)
A colon separated list of directories or commands (starts with '|'). +The path is passed to the program specified in elementCommand together +with the selected element name. A specified command will be executed in order +to create entries for the fileselect box. It must write its results to +stdout one entry per line. +See also, the user-command le[!]. + +


fileCommand (string)
The command is executed by the user's default shell whenever existing layout +files are loaded. Data is read from the command's standard output. +Two escape sequences may be specified to pass the selected filename (%f) +and the current search path (%p). The default value is: +
              cat %f
+
+

See also, the command-line option –file-command. + +


filePath (string)
A colon separated list of directories or commands (starts with '|'). +The path is passed to the program specified in fileCommand together +with the selected filename. A specified command will be executed in order +to create entries for the fileselect box. It must write its results to +stdout one entry per line. +See also, the user-command l[!]. + +


fontCommand (string)
Loading new symbol sets also is handled by an external command. You again +may pass the selected filename and the current search path by passing +%f and %p in the command string. Data is read from the commands standard +output. This command defaults to +
              cat %f
+
+

See also, the command-line option –font-command. + +


fontFile (string)
The default font for new layouts is read from this file which is searched +in the directories as defined by the resource fontPath. +Searching is only performed if the filename does not contain a directory +component. +The default filename is default_font. + +


fontPath (string)
This resource, a colon separated list of directories, defines the searchpath +for font files. See also, the resource fontFile. + +


grid (int)
This resources defines the initial value of one cursor step. It defaults +to 100 mil and any changes are saved together with the layout data. + +


gridColor (color)
This color is used to draw the grid. The color is a result of +a INVERT operation with the contents of the Layout area. The result +also depends on the default colormap of the X11 server because only +the colormap index is used in the boolean operation and Pcb doesn't +create its own colormap. The default setting is XtDefaultForeground. + +


invisibleObjectsColor (color)
Elements located on the opposite side of the board are drawn in this color. +The default is XtDefaultForeground. + +


layerColor1..MAX_LAYER (color)
layerSelectedColor1..MAX_LAYER (color)
These resources define the drawing colors of the different layers in +normal and selected state. All values are preset to XtDefaultForeground. + +


layerGroups (string)
The argument to this resource is a colon separated list of comma separated +layer numbers (1..MAX_LAYER). All layers within one group are switched on/off +together. The default setting is 1:2:3:...:MAX_LAYER which means +all layers are handled separately. Grouping layers one to three looks like +1,2,3:4:...:MAX_LAYER + +


layerName1..MAX_LAYER (string)
The default name of the layers in a new layout are determined by these +resources. The defaults are empty strings. + +


libraryCommand (string)
Pcb uses a command to read element data from libraries. +The resources is used to set the command which is executed by the users +default shell. Three escape sequences are defined to pass the selected +filename (%f), the current search path (%p) as well (%a) as the three +parameters template, value and package to the command. +It must write the element data to its standard output. The default value is +
              NONE/share/pcb/oldlib/QueryLibrary.sh %p %f %a
+
+


libraryContentsCommand (string)
Similar to libraryCommand, Pcb uses the command specified +by this resource to list the contents of a library. +
          	NONE/share/pcb/oldlib/ListLibraryContents.sh %p %f
+
+

is the default. + +


libraryFilename (string)
The resource specifies the name of the library. The default value is +pcblib unless changed at compile time +with the LIBRARYFILENAME variable in globalconfig.h. + +


libraryPath (string)
A colon separated list of directories that will be passed to the commands +specified by elementCommand and elementContentsCommand. + +


lineThickness (dimension)
The value, in the range [1..250] (the range may be changed at compile +time with the MIN_LINESIZE and MAX_LINESIZE variables in +globalconfig.h), defines the +initial thickness of new lines. The value is preset to ten mil. + +


media (<predefined> | <width>x<height>+-<left_margin>+-<top_margin>)
The default (user defined) media of the PostScript device. Predefined +values are a3, a4, a5, letter, tabloit, +ledger, legal, and executive. +The second way is to specify the medias width, height and margins in mil. +The resource defaults to a4 size unless changed at compile time +with the DEFAULT_MEDIASIZE variable in globalconfig.h. + +


offLimitColor (color)
The area outside the current maximum settings for width and height is drawn +with this color. The default value is determined by XtDefaultBackground. + +


pinColor (color)
pinSelectedColor(color)
This resource defines the drawing color of pins and pads in both states. +The values are preset to XtDefaultForeground. + +


pinoutFont (string)
This fonts are used to display pin names. There is one font for each zoom +value. The values are preset to XtdefaultFont. + +


pinoutNameLength (int)
This resource limits the number of characters which are displayed for +pin names in the pinout window. By default the string length is limited +to eight characters per name. + +


pinoutOffsetX (int)
pinoutOffsetY (int)
These resources determine the offset in mil of the circuit from the +upper left corner of the window when displaying pinout information. +Both default to 100 mil. + +


pinoutTextOffsetX (int)
pinoutTextOffsetY (int)
The resources determine the distance in mil between the drilling hole of a pin +to the location where its name is displayed in the pinout window. +They default to X:50 and Y:0. + +


pinoutZoom (int)
Sets the zoom factor for the pinout window according to the formula: +scale = 1:(2 power value). Its default value is two which results in +a 1:4 scale. + +


printCommand (string)
Default file for printouts. If the name starts with a '|' the output +is piped through the command. A %f is replaced by the current filename. +There is no default file or command. + +


raiseLogWindow (boolean)
The log window will be raised when new messages arrive if this resource +is set true, the default. + +


ratCommand (string)
Default command for reading a netlist. A %f is replaced by the netlist +filename. Its default value is "cat %f". + +


ratPath (string)
Default path to look for netlist files. It's default value is "." + +


resetAfterElement (boolean)
If set to true, all found connections will be reset before a new +element is scanned. This will produce long lists when scanning the whole +layout for connections. The resource is set to false by default. +The feature is only used while looking up connections of all elements. + +


ringBellWhenFinished (boolean)
Whether to ring the bell (the default) when a possibly lengthy operation +has finished or not. +See also, the command-line option –ring-bell-finished. + +


routeStyle (string)
Default values for the menu of routing styles (seen in the sizes menu). +The string is a comma separated list of name, line thickness, +via diameter, and via drill size. +e.g. "Fat,50,100,40:Skinny,8,35,20:75Ohm,110,110,20" +See also, the command-line option –route-styles and Sizes Menu + +


rubberBandMode (boolean)
Whether rubberband move and rotate (attached lines stretch like +rubberbands) is enabled (the default). + +


saveCommand (string)
This command is used to save data to a layout file. The filename may be +indicated by placing %f in the string. It must read the data from +its standard input. The default command is: +
              cat - > %f
+
+

See also, the command-line option –save-command. + +


saveInTMP (boolean)
Enabling this resource will save all data which would otherwise be lost +in a temporary file /tmp/PCB.%i.save. The file name may +be changed at compile time +with the EMERGENCY_NAME variable in globalconfig.h. +. +%i is replaced by the process ID. +As an example, loading a new layout when the old one hasn't been saved would +use this resource. +See also, the command-line option –save-in-tmp. + +


saveLastCommand (boolean)
Enables the saving of the last entered user command. The option is +disabled by default. +See also, the command-line option –save-last-command. + +


Shrink (dimension)
Specifies the minimum overlap (touching) design rule in mils. + +


size (<width>x<height>)
Defines the width and height of a new layout. The default is +7000x5000 unless changed at compile time +with the DEFAULT_SIZE variable in globalconfig.h. + +


stipllePolygons (boolean)
Determines whether to display polygons on the screen with a stippled +pattern. Stippling can create some amount of transparency so that +you can still (to some extent) see layers beneath polygons. +It defaults to False. + +


textScale (dimension)
The font scaling in percent is defined by this resource. The default is +100 percent. + +


useLogWindow (boolean)
Several subroutines send messages to the user if an error occurs. +This resource determines if they appear inside the log window or as a separate +dialog box. See also, the resource raiseLogWindow and the command line +option -loggeometry. +The default value is true. + +


viaColor (color)
viaSelectedColor (color)
This resource defines the drawing color of vias in both states. +The values are preset to XtDefaultForeground. + +


viaThickness (dimension)
viaDrillingHole (dimension)
The initial thickness and drilling hole of new vias. The values must be in the +range [30..400] (the range may be changed at compile +time with the MIN_PINORVIASIZE and MAX_PINEORVIASIZE variables in +globalconfig.h), with at least 20 +mil of copper. +The default thickness is 40 mil and the default drilling hole is +20 mil. + +


volume (int)
The value is passed to XBell() which sets the volume of the X +speaker. +The value lies in the range -100..100 and it defaults to the maximum volume of +100. + +


warnColor (color)
This resources defines the color to be used for drawing pins and pads when +a warning has been issued about them. + +


zoom (int)
The initial value for output scaling is set according to the following +formula: scale = 1:(2 power value). It defaults to three which results +in an output scale of 1:8. + +
+ +

Refer also to Command-Line Options. + +

+ +


+Next: , +Previous: Resources, +Up: X11 Interface + +
+ +

7.2 Actions

+ +

+All user accessible commands may be bound to almost any X event. Almost +no default binding for commands is done in the binaries, so it is vital for the +application that at least a system-wide application resource file exists. +This file normally resides in the share/pcb directory and +is called Pcb. The bindings to which the manual refers to are the +ones as defined by the shipped resource file. Besides binding an action to +an X11 event, you can also execute any action command using a ":" command +(see User Commands). + +

Take special care about translations related to the functions keys and the +pointer buttons because most of the window managers use them too. +Change the file according to your hardware/software environment. +You may have to replace all occurances of baseTranslations to +translations if you use a X11R4 server. + +

Passing Object as an argument to an action routine causes the object +at the cursor location to be changed, removed or whatever. If more than +one object is located at the cross hair position the smallest type is used. +If there are two of the same type the newer one is taken. +SelectedObjects will handle all selected and visible objects. + + + + + + +

AddRats(AllRats|SelectedRats)
Adds rat-lines to the layout using the loaded netlist file (see the :rn, +User Commands.). Rat lines are added on the active layer using the current +line thickness shown in the status line. +Only missing connectivity is added by the +AddRats command so if, for example, the layout is complete nothing will be added. +Rat lines may be drawn different to other lines on the screen +to make them easier to identify since they cannot appear in a completed layout. +The rat-lines are added in the minimum length straight-line tree pattern +(always ending on pins or pads) that satisfies the missing connectivity in the circuit. +If a SMD pad is unreachable on the active layer, a warning will be issued +about it and the rat-line to that pad will not be generated. +If connections exist on the board which are not listed in the netlist while +AllRats are being added, warning messages will be issued and the affected pins and +pads will be drawn in a special warnColor until the next Notify() event. +If the entire layout agrees completely with the net-list a message informs you that +the layout is complete and no rat-lines are added (since none are needed). +If SelectedRats +is passed as the argument, only those missing connections that might connect among +the selected pins and pads are drawn. +Default: +
          None<Key>w:	AddRats(AllRats)
+          !Shift<Key>w:	AddRats(SelectedRats)
+          None<Key>o:	DeleteRats(AllRats) AddRats(AllRats)
+          !Shift<Key>o:	DeleteRats(SelectedRats) AddRats(SelectedRats)
+
+


ApplyVendor()
Applies an already loaded vendor drill map to the design. +
          ApplyVendor()
+
+


Atomic(Save|Restore|Block|Close)
Controls the undo grouping of sequences of actions. Before the first action +in a group, Atomic(Save) should be issued. After each action that might +be undoable, Atomic(Restore) should be issued. Atomic(Block) concludes +and save the undo grouping if there was anything in the group to undo. +Atomic(Close) concludes and save the undo grouping even if nothing was +actually done. Thus it might produce an "empty" undo. This can be useful +when you want to use undo in a group of actions. + +


Bell([-100..100])
Rings the bell of your display. If no value is passed the setting +of the resource volume will be used. + +


ChangeClearSize(Object, value[, unit])
ChangeClearSize(SelectedPins|SelectedVias, value[, unit])
The effect of this action depends on if the soldermask display is presently +turned on or off. If soldermask is displayed, then the soldermask +relief size will be changed. If soldermask display is turned off, +then the clearance to polygons will be changed. +unit is "mil" or "mm". If not specified the units will default +to the internal unit of 0.01 mil. +
          !Mod1<Key>k:      ChangeClearSize(Object, +2, mil)
+          !Mod1 Shift<Key>k: ChangeClearSize(Object, -2, mil)
+
+


ChangeDrillSize(Object, value[, unit])
ChangeDrillSize(SelectedPins|SelectedVias, value[, unit])
This action routine changes the drilling hole of pins and vias. +If value starts with + or -, then it adds (or subtracts) +value from the current hole diameter, otherwise it sets the +diameter to the value. +unit is "mil" or "mm". If not specified the units will default +to the internal unit of 0.01 mil. +Default: +
          !Mod1<Key>s:       Change2ndSize(Object, +5, mil)
+          !Mod1 Shift<Key>s: Change2ndSize(Object, -5, mil)
+
+

ChangeFlag(Object|SelectElements|SelectedPins|SelectedVias|Selected,thermal|octagon|square,0|1)
Sets/clears the indicated flag. This adds/removes thermals, adds/removes the flag +which indicates a pin/pad should be square, or adds/removes the flag which +indicates a pin/pad should be octagonal. +
          :ChangeFlag(SelectedVias,thermal,1)
+          :ChangeFlag(SelectedPads,square,0)
+
+


ChangeHole(Object|SelectedVias)
This action routine converts a via to and from a hole. A hole is +a via that has no copper annulus. The drill size for the via +determines the hole diameter. +
          !Ctrl<Key>h:	ChangeHole(Object)
+
+


ChangeName(Object)
ChangeName(Layer|Layout)
Changes the name of the visible object at the cursor location. A text object +doesn't have a name therefore the text string itself is changed. +The element name currently used for display is always the one changed with this +command. +See Display(Description|NameOnPCB|Value) for details. +Passing Layer changes the current layers name. +Default: +
          None<Key>n: ChangeName(Object)
+
+

ChangeOctagon(Object|SelectElements|SelectedPins|SelectedVias|Selected)
Toggles what shape the affected pin(s) or via(s) will be drawn when they +are not square. The shape will either be round or octagonal. +Default: +
          !Ctrl<Key>o: ChangeOctagon(Object)
+
+


ChangePinName(ElementName, PinNumber, PinName)
Changes the name for a specified pin or pad number on a specified element. +This action is typically used to forward annotate pin/pad names from a schematic +to the layout. +
          ChangePinName(U1, 14, VDD)
+
+


ChangeSize(Object, value[, unit])
ChangeSize(SelectedLines|SelectedPins|SelectedVias, value[, unit])
ChangeSize(SelectedPads|SelectedTexts|SelectedNames, value[, unit])
ChangeSize(SelectedElements, value[, unit])
To change the size of an object you have to bind these action to some +X event (or use :ChangeSize(...)). If value begins with +a + or - then the value will be added (or subtracted) from the current +size, otherwise the size is set equal to value. Range checking is +done to insure that none of the maximum/minimums of any size are violated. +If Object is passed then a single object at the cursor location is +changed. If any of the Selected arguments are passed then all selected +and visible objects of that type are changed. If the type being modified is +an element, then the thickness of the silkscreen lines defining the element +is changed. +unit is "mil" or "mm". If not specified the units will default +to the internal unit of 0.01 mil. +Default: +
          None<Key>s:   ChangeSize(Object, +5)
+          !Shift<Key>s: ChangeSize(Object, -5)
+
+


ChangeSquare(Object|SelectedElements|SelectedPins)
Toggles the setting of the square flag. The flag is used to identify a +certain pin, normally the first one, of circuits. It is also used to +make SMD pads have square ends. +
          None<Key>q:   ChangeSquare(Object)
+
+

ClrFlag(Object|SelectElements|SelectedPins|SelectedVias|Selected,thermal|octagon|square)
Clears the indicated flag. This removes thermals, removes the flag +which indicates a pin/pad should be square, or removes the flag which +indicates a pin/pad should be octagonal. +
          :ClrFlag(SelectedVias,thermal)
+
+


Command()
Calling Command() pops up an input line at the bottom of the window +which allows you to enter commands. Including all action commands! +The dialog ends when None<Key>Return +to confirm or None<Key>Escape to abort is entered. +Default: +
          <Key>colon: Command()
+
+


Connection(Find)
Connection(ResetFoundLinesAndRectangles|ResetPinsViasAndPads|Reset)
The Connection() action is used to mark all connections from one pin, +line or via to others. +The ResetFoundLinesAndRectangles, ResetFoundPinsAndVias and +Reset arguments may be used to reset all marked lines and rectangles, +vias and pins or all of them. The search starts with the pin or via +at the cursor position. All found objects are drawn with the color +defined by the resource connectedColor. +See also, Display(Description|NameOnPCB|Value). +Default: +
          !Shift<Key>c: Connection(Reset)
+          None<Key>f:   Connection(Find)
+          !Shift<Key>f: Connection(Reset)
+
+


DeleteRats(AllRats|SelectedRats)
This routine deletes either all rat-lines in the layout, or only +the selected and visible ones. Non-rat-lines and other layout +objects are unaffected. +Default: +
          None<Key>e:   DeleteRats(AllRats)
+          !Shift<Key>e: DeleteRats(SelectedRats)
+
+


DisableVendor()
Disables automatic drill size mapping to the loaded vendor drill table. +
          DisableVendor()
+
+


DisperseElements(All|Selected)
Disperses either all elements or only the selected elements in the +layout. This action should be used at the +start of a design to spread out all footprints before any placement or +routing is done. +
          DisperseElements(All)
+
+


Display(Description|NameOnPCB|Value)
Display(Toggle45Degree|CycleClip)
Display(Grid|ToggleGrid)
Display(ToggleRubberBandMode)
Display(Center|ClearAndRedraw|Redraw)
Display(Pinout|PinOrPadName)
This action routines handles some output related settings. It is +used to center the display around the cursor location and to redraw the +output area optionally after clearing the window. +Centering is done with respect to the grid setting. Displaying the +grid itself may be switched on and off by Grid but only if +the distance between two pixels exceeds 4 pixels. +Pcb is able to handle several labels of an element. One of them +is a description of the functionality (eg resistor), the second should be +a unique identifier (R1) whereas the last one is a value (100k). +The Display() action selects which of the names is displayed. +It also controls which name will be affected by the ChangeName command. +If ToggleGrid is passed, Pcb changes between relative +('rel' in the statusline) and absolute grid (an 'abs' in the statusline). +Relative grid means the pointer position when the command is issued is +used as the grid origin; while (0,0) is used in the absolute grid case. +Passing Pinout displays the pinout of the element at the current +cursor location whereas PinOrPadName toggles displaying of the +pins or pads name under the cursor. If none of them matches but the cursor +is inside of an element, the flags is toggled for all of its pins and pads. +For details about rubberbands see also the details about Mode. +Default: +
          None<Key>c:  Display(Center)
+          None<Key>d:  Display(PinOrPadName)
+          !Shift<Key>d: Display(Pinout)
+          None<Key>r:  Display(ClearAndRedraw)
+          None<Key>.:  Display(Toggle45Degree)
+          None<Key>/:  Display(CycleClip)
+
+


DRC()
Initiates design rule checking of the entire layout. Must be repeated +until no errors are found. + +

ExecuteFile(filename)
Executes the PCB actions contained in the specified file. +This can be used to automate a complex sequence of operations. +
          :ExecuteFile(custom.cmd)
+
+

The command file contains a list of PCB actions. Blank lines +are ignored and lines starting with a # are treated as comment +lines. For example +

          # This is a comment line
+          Display(Grid)
+          SetValue(Zoom,2)
+          DRC()
+
+


EditLayerGroups()
Pops up a dialog box to edit the layergroup setting. The function is also +available from the Objects menu. +There are no defaults. + +


EnableVendor()
Enables automatic drill size mapping to the loaded vendor drill table. +
          EnableVendor()
+
+


Load(ElementToBuffer|Layout|LayoutToBuffer|Nelist)
This routine pops up a fileselect box to load layout, element data, +or netlist. +The passed filename for layout data is saved and may be reused. +ElementToBuffer and LayoutToBuffer load the data into the +current buffer. +There are no defaults. + +


LoadVendor(vendorfile)
Loads the specified vendor resource file. +
          LoadVendor(myvendor.res)
+
+


MarkCrosshair()
This routine marks the current cursor location with an X, and then +the cursor display shows both absolute position and position relative to +the mark. If a mark is already present, this routine removes it and +stops displaying relative cursor coordinates. +Defaults: +
          !Ctrl<key>m:	MarkCrosshair()
+
+


Mode(Copy|InsertPoint|Line|Move|None|PasteBuffer|Polygon|Thermal)
Mode(Remove|Rectangle|RubberbandMove|Text|Via)
Mode(Cycle)
Mode(Notify)
Mode(Save|Restore)
Switches to a new mode of operation. The active mode is displayed by a thick +line around the matching mode selector button. +Most of the functionality of Pcb is implemented by selecting a mode +and calling Mode(Notify). The arguments Line, Polygon, +Rectangle, Text and Via are used to create the +appropriate object whenever Mode(Notify) is called. Some of them, +such as Polygon, need more than one call for one object to be created. +InsertPoint adds points to existing polygons or lines. +Save and Restore are used to temporarily save the mode, switch +to another one, call Mode(Notify) and restore the saved one. Have +a look at the application resource file for examples. +Copy and Move modes are used to change an object's location and, +optionally, to create a new one. The first call of Mode(Notify) attaches +the object at the pointer location to the cross hair whereas the second +one drops it to the layout. The rubberband version of move performs the +move while overriding the current rubberband mode. +Passing PasteBuffer attaches the contents of the currently selected +buffer to the cross hair. Each call to Mode(Notify) pastes this contents +to the layout. Mode(Cycle) cycles through the modes available in the +mode-button pallet. +Mode(None) switches all modes off. +Default: +
          <Key>Escape:             Mode(None)
+          <Key>space:              Mode(Cycle)
+          None<Key>BackSpace:      Mode(Save) Mode(Remove) Mode(Notify) Mode(Restore)
+          None<Key>Delete:         Mode(Save) Mode(Remove) Mode(Notify) Mode(Restore)
+          None<Key>F1:             Mode(Via)
+          None<Key>F2:             Mode(Line)
+          None<Key>F3:             Mode(PasteBuffer)
+          None<Key>F4:             Mode(Rectangle)
+          None<Key>F5:             Mode(Text)
+          None<Key>F6:             Mode(Polygon)
+          None<Key>F7:             Mode(Thermal)
+          None<Key>F8:		 Mode(Arc)
+          None<Key>Insert:         Mode(InsertPoint)
+          None<Key>[:              Mode(Save) Mode(Move) Mode(Notify)
+          None<Key>]:              Mode(Notify) Mode(Restore)
+          None<Btn1>:          Mode(Notify)
+          !Shift Ctrl<Btn1>:   Mode(Save) Mode(Remove) Mode(Notify) Mode(Restore)
+          None<Btn2Down>:          Mode(Save) Mode(Move) Mode(Notify)
+          None<Btn2Up>:            Mode(Notify) Mode(Restore)
+          !Mod1<Btn2Down>:       Mode(Save) Mode(Copy) Mode(Notify)
+          !Mod1<Btn2Up>:         Mode(Notify) Mode(Restore)
+          Shift BTNMOD<Btn2Down>: Mode(Save) Mode(RubberbandMove) Mode(Notify)
+
+


MovePointer(delta_x, delta_y)
With this function it is possible to move the cross hair cursor by using the +cursor keys. The X server's pointer follows because the necessary +events are generated by Pcb. All movements are performed with respect +to the currently set grid value. +Default: +
          None<Key>Up:      MovePointer(0, -1)
+          !Shift<Key>Up:    MovePointer(0, -10)
+          None<Key>Down:    MovePointer(0, 1)
+          !Shift<Key>Down:  MovePointer(0, 10)
+          None<Key>Right:   MovePointer(1, 0)
+          !Shift<Key>Right: MovePointer(10, 0)
+          None<Key>Left:    MovePointer(-1, 0)
+          !Shift<Key>Left:  MovePointer(-10, 0)
+
+


MoveToCurrentLayer(Object|SelectedObjects)
The function moves a single object at the cross hair location or all selected +objects to the current layer. Elements are not movable by this function. +They have to be deleted and replaced on the other side. +If a line segment is moved and the movement would result in a loss of +connectivity to another segment then via(s) are automatically added to +maintain the connectivity. +
          None<Key>m:       MoveToCurrentLayer(Object)
+          !Shift<Key>m:     MoveToCurrentLayer(SelectedObjects)
+
+


New()
Clear the current layout and starts a new one after entering its name. +Refer to the resource backup for more information. +No defaults. + +


PasteBuffer(AddSelected|Clear|1..5)
PasteBuffer(Rotate, 1..3)
PasteBuffer(Convert)
This action routine controls and selects the pastebuffer as well as all +cut-and-paste operations. Passing a buffer number selects one in of the +range 1..5. The statusline is updated with the new number. +Rotate performs a number of 90 degree counter clockwise rotations +of the buffer contents. AddSelected as first argument copies all +selected and visible objects into the buffer. Passing Clear removes +all objects from the currently selected buffer. Convert causes +the contents of the buffer (lines, arc, vias) to be converted into an +element definition. Refer to Pastebuffer +for examples. +Default: +
          !Ctrl<Key>x:       PasteBuffer(Clear) PasteBuffer(AddSelected)
+          		   Mode(PasteBuffer)
+          !Shift Ctrl<Key>x: PasteBuffer(Clear) PasteBuffer(AddSelected)
+          		   RemoveSelected() Mode(PasteBuffer)
+          !Mod1<Key>c:       PasteBuffer(Clear) PasteBuffer(AddSelected)
+          !Mod1<key>x:       PasteBuffer(Clear) PasteBuffer(AddSelected)
+          		   RemoveSelected()
+          !Shift<Key>1:      PasteBuffer(1)
+          !Shift<Key>2:      PasteBuffer(2)
+          !Shift<Key>3:      PasteBuffer(3)
+          !Shift<Key>4:      PasteBuffer(4)
+          !Shift<Key>5:      PasteBuffer(5)
+          None<Key>F3:       Mode(PasteBuffer)
+
+


Polygon((Close|PreviousPoint)
Polygons need a special action routine to make life easier. Calling +Polygon(PreviousPoint) resets the newly entered corner to the +previous one. The Undo action will call Polygon(PreviousPoint) +when appropriate to do so. Close creates the final +segment of the polygon. This may fail if clipping to 45 degree +lines is switched on, in which case a warning is issued. +Default: +
          None<Key>p:             Polygon(Close)
+          !Shift<Key>p:           Polygon(Close)
+
+


Print()
Pops up a print control box that lets you select the output +device, scaling and many more options. Each run creates all +files that are supported by the selected device. These are +mask files as well as drilling files, silk screens and so on. The table +shows the filenames for all possible files: +
          	POSIX (extension)             8.3 filename
+          		---------------------------------------------
+          		*_componentmask.*             cmsk.*
+          		*_componentsilk.*             cslk.*
+          		*_soldermask.*                smsk.*
+          		*_soldersilk.*                sslk.*
+          		*_drill.*                     dril.*
+          		*_groundplane.*               gpl.*
+          		*_group[1..8].*     [..8].*
+
+

The output may be sent to a post-processor by starting the filename with the +pipe ("|") character. Any "%f" in a command is replaced +with the current filename. The function is available from the file menu. +There are no defaults. + +


Quit()
Quits the application after confirming the operation. +Default: +
          <Message>WM_PROTOCOLS: Quit()
+
+


Redo()
This routine allows you to recover from the last undo command. +You might want to do this if you thought that undo was going to +revert something other than what it actually did (in case you +are confused about which operations are un-doable), or if you +have been backing up through a long undo list and over-shoot +your stopping point. Any change that is made since the undo +in question will trim the redo list. For example if you add +ten lines, then undo three of them you could use redo to put +them back, but if you move a line on the board before performing +the redo, you will lose the ability to "redo" the three "undone" lines. +Default: +
          !Shift<Key>r:	Redo()
+
+


RemoveSelected()
This routine removes all visible and selected objects. +There are no defaults. + +


Report(Object|DrillReport)
This routine pops up a dialog box describing the various +characteristics of an object (or piece of an object such as a pad or pin) +in the layout at the cursor position, or a report about all of the +drill holes in the layout. +There are no defaults. + +


RouteStyle(1|2|3|4)
This routine copies the sizes corresponding to the numbered route style +into the active line thickens, via diameter, and via drill size. +Defaults: +
          !Ctrl<Key>1: RouteStyle(1)
+          ...
+          !Ctrl<Key>NUM_STYLES: RouteStyle(NUM_STYLES)
+
+

The variable NUM_STYLES is set at compile time in +globalconfig.h. + +


Save(Layout|LayoutAs)
Save(AllConnections|AllUnusedPins|ElementConnections)
Passing Layout saves the layout using the file from which it was +loaded or, if it is a new layout, calls Save(LayoutAs) which queries +the user for a filename. +The values: AllConnections, AllUnusedPins and +ElementConnections start a connection scan and save all connections, +all unused pins or the connections of a single element to a file. +There are no defaults. + +


Select(All|Block|Connection|ToggleObject)
Select(ElementByName|ObjectByName|PadByName|PinByName)
Select(TextByName|ViaByName)
Toggles either the selection flag of the object at the cross hair position +(ToggleObject) or selects all visible objects, all inside a +rectangle or all objects which have been found during the last connection +scan. The ByName functions use a Regular Expressions search, +always case insensitive, to select the objects. +Default: +
          None<Btn3Down>:  Select(ToggleObject)
+          None<Btn3Down>,None<Btn3Motion>: See resource file - this is complex
+
+

SetFlag(Object|SelectElements|SelectedPins|SelectedVias|Selected,thermal|octagon|square)
Sets the indicated flag. This adds thermals, sets the flag +which indicates a pin/pad should be square, or sets the flag which +indicates a pin/pad should be octagonal. +
          :SetFlag(Selected,thermal)
+
+


SetValue(Grid|LineSize|TextScale|ViaDrillingHole|ViaSize|Zoom, value)
Some internal values may be changed online by this function. +The first parameter specifies which data has to be changed. The other one +determines if the resource is set to the passed value, if value is +specified without sign, or increments/decrements if it is specified with +a plus or minus sign. +The function doesn't change any existing object only the initial values of +new objects. Use the ChangeSize() and ChangeDrillSize() +to change existing objects. +Default: +
          None<Key>g:        SetValue(Grid, +5)
+          !Shift<Key>g:      SetValue(Grid, -5)
+          None<Key>l:        SetValue(LineSize, +5)
+          !Shift<Key>l:      SetValue(LineSize, -5)
+          None<Key>t:        SetValue(TextScale, +10)
+          !Shift<Key>t:      SetValue(TextScale, -10)
+          None<Key>v:        SetValue(ViaSize, +5)
+          !Shift<Key>v:      SetValue(ViaSize, -5)
+          !Mod1<Key>v:       SetValue(ViaDrillingHole, +5)
+          !Mod1 Shift<Key>v: SetValue(ViaDrillingHole, -5)
+          None<Key>z:        SetValue(Zoom, -1)
+          !Shift<Key>z:      SetValue(Zoom, +1)
+
+


SwapSides()
This routine changes the board side you are viewing. +Default: +
          None<Key>Tab:      SwapSides()
+
+


SwitchDrawingLayer(value)
Makes layer number 1..MAX_LAYER the current one. +Default: +
          None<Key>1:        SwitchDrawingLayer(1)
+          ...
+          None<Key>MAX_LAYER:        SwitchDrawingLayer(MAX_LAYER)
+
+


ToggleHideName(Object|SelectedElements)
Toggles whether the element's name is displayed or hidden. If it +is hidden you won't see it on the screen and it will not appear +on the silk layer when you print the layout. +
          None<Key>h:	ToggleHideName(Object)
+          !Shift<Key>h:	ToggleHideName(SelectedElements)
+
+


ToggleVendor()
Toggles automatic drill size mapping to the loaded vendor drill table. +
          ToggleVendor()
+
+


ToggleVisibility(Layer)
Toggles the visibility of the layer. +
          Mod1<Key>1:	ToggleVisibility(1)
+          Mod1<Key>2:	ToggleVisibility(2)
+          Mod1<Key>3:	ToggleVisibility(3)
+          Mod1<Key>4:	ToggleVisibility(4)
+
+


Undo()
Undo(ClearList)
The unlimited undo feature of Pcb allows you to recover +from most operations that materially affect you work. +Calling Undo() without any parameter recovers +from the last (non-undo) operation. ClearList is used to release the +allocated memory. ClearList is called whenever a new layout is started +or loaded. See also Redo. +Default: +
          None<Key>u:        Undo()
+          !Shift Ctrl<Key>u: Undo(ClearList)
+
+


UnloadVendor()
Unloads the loaded vendor drill table. +
          UnloadVendor()
+
+


Unselect(All|Block|Connection)
Unselects all visible objects, all inside a rectangle or all objects which +have been found during the last connection scan. +Default: +
          !Shift <Btn3Down>: Mode(Save) Mode(None) Unselect(Block)
+          !Shift <Btn3Up>:   Unselect(Block) Mode(Restore)
+
+
+ +
+ +


+Previous: Actions, +Up: X11 Interface + +
+ +

7.3 Default Translations

+ +

+This section covers some default translations of key and button events as +defined in the shipped default application resource file. Most of them have +already been listed in Actions. Pcb makes use of a nice X11 +feature; calling several action routines for one event. + + + + + + +

None<Key>BackSpace:
None<key>Delete:
!Shift<Key>BackSpace:
!Shift Ctrl<Btn1>:
The object at the cursor location is removed by None<Key>BackSpace or +Shift Ctrl<Btn1> whereas Shift<Key>BackSpace also removes +all other objects that are fully-connected to the one at the cursor location. + +


!Mod1 Ctrl<Key>Left:
!Mod1 Ctrl<Key>Right:
!Mod1 Ctrl<Key>Up:
!Mod1 Ctrl<Key>Down:
Scroll one page in one of the four directions. + +


None<Key>Left:, !Shift<Key>Left:
None<Key>Right:, !Shift<Key>Right:
None<Key>Up:, !Shift<Key>Up:
None<Key>Down:, !Shift<Key>Down:
Move cross hair either one or ten points in grid. + +


None<Key>Return:
Finished user input, selects the 'default' button of dialogs. + +


None<Key>Escape:
Mode(Reset), aborts user input, selects the 'abort' button of +dialogs or resets all modes. + +


None<Btn2Down>, Btn2<Motion>, None<Btn2Up>:
!Mod1<Btn2Down>, Btn2<Motion>, !Mod1<Btn2Up>:
The first sequence moves the object or element name at the cursor location. +The second one copies the objects. Copying isn't available for +element names. + +
+ + +
+ +


+Next: , +Previous: X11 Interface, +Up: Top + +
+ +

8 File Formats

+ +

+All files used by Pcb are read from the standard output of a command +or written to the standard input of one as plain seven bit ASCII. This +makes it possible to use any editor to change the contents of a layout file. +It is the only way for element or font description files to be created. +To do so you'll need to study the example files example/* and +default_font which are shipped with Pcb. +For an overview refer to Intro. + +

The following sections provide the necessary information about the syntax of +the files. +Netlist files are not created by Pcb, but it does use them. For information +on the format of a netlist file see the :rn, +User Commands. +The commands described allow you to add almost any additional +functionality you may need. Examples are compressed read and write access as +well as archives. The commands themselves are defined by the resources +elementCommand, fileCommand, fontCommand, +libraryCommand, libraryContentsCommand and saveCommand. +Note that the commands are not saved along with the data. +It is considered an advantage to have the layout file contain all necessary +information, independent of any other files. + +

One thing common to all files is they may include comments, newlines, +and carriage returns at any place except within quoted strings. + +

+ +
+ +


+Next: , +Up: File Formats + +
+ +

8.1 Pad and Line Representation

+ +

+Pads and lines (copper traces, silk screen lines, etc) are represented by the +line end points and the aperture used to draw the line. It is important to +understand this when creating the pads for a new footprint. The following figure +illustrates a pad or line which is drawn using a square aperture. The end +points (X0,Y0), (X1,Y1) specify the center of the aperture. The size parameter +specifies the size of the aperture. + +

Pad Layout
+ +

Pads and lines are represented in this way because this is how lines are +specified in RS-274X (Gerber) files which are used for creating +the masks used in board manufacturing. In fact, older mask making +equipment created lines in precisely this fashion. A physical aperture was +used to pass light through onto a photosensitive film. + +

+ +


+Next: , +Previous: Pad and Line Representation, +Up: File Formats + +
+ +

8.2 Layout File Format

+ +

+The layout file describes a complete layout including symbols, vias, +elements and layers with lines, rectangles and text. This is the most +complex file of all. As Pcb has evolved, the file format has +changed several times to accommodate new features. Pcb has +always been able to read all older versions of the .pcb file. +This allows the migration of older designs to newer versions of the +program. Obviously older versions of Pcb will not be able +to properly read layout files stored in newer versions of the file +format. + +

In practice it is very common for footprint libraries to contain +elements which have been defined in various versions of the Pcb +file format. When faced with trying to understand an element file or +layout file which includes syntax not defined here, the best approach +is to examine the file src/parse_y.y which is the definitive +definition of the file format. + +

The PCB layout file contains the following contents, in this order (individual items +are defined in File Syntax: + +

+
PCB
This names the board and sets its size + +
Grid
Optional. + +
Cursor
Optional. + +
Flags
Optional. + +
Groups
Optional. + +
Styles
Optional. + +
Symbols
Optional. + +
Vias, Rats, Layers, and Elements
These may occur in any order, at this point in the file. + +
Netlists
Optional. + +
+ +
+ +


+Next: , +Previous: Layout File, +Up: File Formats + +
+ +

8.3 Element File Format

+ +

+Element files are used to describe one component which then may be used +several times within one or more layouts. You will normally split the +file into two parts, one for the pinout and one for the package description. +Using m4 allows you to define pin names as macros in one file and +include a package description file which evaluates the macros. See +the resource elementCommand for more information. The pins (and pads) +must appear in sequential order in the element file (new in 1.5) so that +pin 1 must be the first PIN(...) in the file. + +

Doing things this way makes it possible to use one package file for several +different circuits. See the sample files dil*. + +

The lowest x and y coordinates of all sub-objects of an element are +used as an attachment point for the cross hair cursor of the main +window, unless the element has a mark, in which case that's the +attachment point. + +

+ +


+Next: , +Previous: Element File, +Up: File Formats + +
+ +

8.4 Font File Format

+ +

+A number of user defined Symbols are called a font. There is only one per +layout. All symbols are made of lines. See the file default_font +as an example. + +

The lowest x and y coordinates of all lines of a font are transformed to (0,0). + +

+ +


+Next: , +Previous: Font File, +Up: File Formats + +
+ +

8.5 Netlist File Format

+ +

+Netlists read by Pcb must have this simple text form: + +

     netname [style] NAME-PINNUM NAME2-PINNUM2 NAME3-PINNUM3 ... [\]
+
+

for each net on the layout. +where "netname" is the name of the net which must be unique for each +net, [style] is an optional route-style name, +NAME is the layout-name name given to an element, +and PINNUM is the (usually numeric) +pin number of the element that connects to the net +(for details on pin numbering see Element Objects). +Spaces or tabs separate the fields. +If the line ends with a "\" the +net continues on the next line and the "\" is treated exactly as if it +were a space. If a NAME ends with a lower-case letter, +all lower-case letters are stripped from the end of the NAME to determine the +matching layout-name name. For example: + +

          Data U1-3 U2abc-4 FLOP1a-7 Uabc3-A9
+
+

specifies that the net called "Data" should have +pin 3 of U1 connected to pin 4 of U2, to pin 7 of +FLOP1 and to pin A9 of Uabc3. Note that element name and +pin number strings are case-sensitive. +It is up to you to name the elements so that their layout-name names +agrees with the netlist. + +

+ +


+Next: , +Previous: Netlist File, +Up: File Formats + +
+ +

8.6 Library Contents File Format

+ +

+There is nothing like a special library format. The ones that have been +introduced in 1.4.1 just use some nice (and time consuming) features of GNU +m4. The only predefined format is the one of the contents file +which is read during startup. It is made up of two basic line types: + +

     menu entry      = "TYPE="name
+     contents line   = template":"package":"value":"description
+     name            = String
+     template        = String
+     package         = String
+     value           = String
+     description     = String
+     String          = <anything except ":", "\n" and "\r">
+
+

No leading white spaces or comments are allowed in this file. If you need +either one, define a command that removes them before loading. Have a look +to the libraryContentsCommand resource. + +

The menu entry will appear in the selection menu at the top and of the +library window. + +

+ +


+Next: , +Previous: Library Contents File, +Up: File Formats + +
+ +

8.7 Library File Format

+ +

+This section provides an overview about the existing m4 definitions +of the elements. There are basically two different types of files. One +to define element specific data like the pinout, package and so on, the +other to define the values. For example the static RAM circuits 43256 and +62256 are very similar. They therefore share a common definition in the +macro file but are defined with two different value labels. + +

The macro file entry: +

     define(`Description_43256_dil', `SRAM 32Kx8')
+     define(`Param1_43256_dil', 28)
+     define(`Param2_43256_dil', 600)
+     define(`PinList_43256_dil', ``pin1', `pin2', ...')
+
+

And the list file: +

     43256_dil:N:43256:62256
+
+

The macro must define a description, the pin list and up to two additional +parameters that are passed to the package definitions. The first one is +the number of pins whereas the second one defines for example the width +of a package. + +

It is very important to select a unique identifier for each macro. In +the example this would be 43256_dil which is also the templates name. +It is required by some low-level macros that +Description_, Param1_, Param2_ and PinList_ are perpended. + +

The list file uses a syntax: +

     template:package:value[:more values]
+
+

This means that the shown example will create two element entries with the +same package and pinout but with different names. + +

A number of packages are defined in common.m4. Included are: + +

     DIL packages with suffix D, DW, J, JD, JG, N, NT, P
+     PLCC
+     TO3
+     generic connectors
+     DIN 41.612 connectors
+     zick-zack (SD suffix)
+     15 pin multiwatt
+
+

If you are going to start your own library please take care about m4 +functions. Be aware of quoting and so on and, most important check your +additional entry by calling the macro: + +

     CreateObject(`template', `value', `package suffix')
+
+

If quoting is incorrect an endless loop may occur (broken by a out-of-memory +message). + +

The scripts in the lib directory handle the creation of libraries +as well as of their contents files. Querying is also supported. + +

I know quite well that this description of the library implementation is +not what some out there expect. But in my opinion it's much more useful to +look at the comments and follow the macros step by step. + +

+ +


+Next: , +Previous: Library File, +Up: File Formats + +
+ +

8.8 File Syntax

+ +

+ + + +

A special note about units: Older versions of pcb used mils +(1/1000 inch) as the base unit; a value of 500 in the file meant +half an inch. Newer versions uses a "high resolution" syntax, +where the base unit is 1/100 of a mil (0.000010 inch); a value of 500 in +the file means 5 mils. As a general rule, the variants of each entry +listed below which use square brackets are the high resolution formats +and use the 1/100 mil units, and the ones with parentheses are the older +variants and use 1 mil units. Note that when multiple variants +are listed, the most recent (and most preferred) format is the first +listed. + +

Symbolic and numeric flags (SFlags and NFlags) are described in +Object Flags. + +

+ +
+ +


+Next: , +Up: File Syntax + +
+ +

8.8.1 Arc

+ + +

+
Arc [X Y Width Height Thickness Clearance StartAngle DeltaAngle SFlags]
+Arc (X Y Width Height Thickness Clearance StartAngle DeltaAngle NFlags)
+Arc (X Y Width Height Thickness StartAngle DeltaAngle NFlags)
+
+
+ +

+
X Y
Coordinates of the center of the arc. +
Width Height
The width and height, from the center to the edge. The bounds of the +circle of which this arc is a segment, is thus 2*Width by +2*Height. +
Thickness
The width of the copper trace which forms the arc. +
Clearance
The amount of space cleared around the arc when the line passes +through a polygon. The clearance is added to the thickness to get the +thickness of the clear; thus the space between the arc and the polygon +is Clearance/2 wide. +
StartAngle
The angle of one end of the arc, in degrees. In PCB, an angle of zero +points left (negative X direction), and 90 degrees points down +(positive Y direction). +
DeltaAngle
The sweep of the arc. This may be negative. Positive angles sweep +counterclockwise. +
SFlags
Symbolic or numeric flags. +
NFlags
Numeric flags. +
+ + +
+ +


+Next: , +Previous: Arc syntax, +Up: File Syntax + +
+ +

8.8.2 Attribute

+ + +

+
Attribute ("Name" "Value")
+
+
+ +

Attributes allow boards and elements to have arbitrary data attached +to them, which is not directly used by PCB itself but may be of use by +other programs or users. + +

+
Name
The name of the attribute + +
Value
The value of the attribute. Values are always stored as strings, even +if the value is interpreted as, for example, a number. + +
+ + +
+ +


+Next: , +Previous: Attribute syntax, +Up: File Syntax + +
+ +

8.8.3 Connect

+ + +

+
Connect ("PinPad")
+
+
+ +

+
PinPad
The name of a pin or pad which is included in this net. Pin and Pad +names are named by the refdes and pin name, like "U14-7" for +pin 7 of U14, or "T4-E" for pin E of T4. +
+ + +
+ +


+Next: , +Previous: Connect syntax, +Up: File Syntax + +
+ +

8.8.4 Cursor

+ + +

+
Cursor [X Y Zoom]
+Cursor (X Y Zoom)
+
+
+ +

+
X Y
Location of the cursor when the board was saved. +
Zoom
The current zoom factor. Note that a zoom factor of "0" means 1 mil +per screen pixel, N means 2^N mils per screen pixel, etc. The +first variant accepts floating point numbers. The special value +"1000" means "zoom to fit" +
+ + +
+ +


+Next: , +Previous: Cursor syntax, +Up: File Syntax + +
+ +

8.8.5 DRC

+ + +

+
DRC [Bloat Shrink Line Silk Drill Ring]
+DRC [Bloat Shrink Line Silk]
+DRC [Bloat Shrink Line]
+
+
+ +

+
Bloat
Minimum spacing between copper. +
Shrink
Minimum copper overlap to guarantee connectivity. +
Line
Minimum line thickness. +
Silk
Minimum silk thickness. +
Drill
Minimum drill size. +
Ring
Minimum width of the annular ring around pins and vias. +
+ + +
+ +


+Next: , +Previous: DRC syntax, +Up: File Syntax + +
+ +

8.8.6 Element

+ + +

+
Element [SFlags "Desc" "Name" "Value" MX MY TX TY TDir TScale TSFlags] (
+Element (NFlags "Desc" "Name" "Value" MX MY TX TY TDir TScale TNFlags) (
+Element (NFlags "Desc" "Name" "Value" TX TY TDir TScale TNFlags) (
+Element (NFlags "Desc" "Name" TX TY TDir TScale TNFlags) (
+Element ("Desc" "Name" TX TY TDir TScale TNFlags) (
+   ... contents ...
+)
+
+
+ +

+
SFlags
Symbolic or numeric flags, for the element as a whole. +
NFlags
Numeric flags, for the element as a whole. +
Desc
The description of the element. This is one of the three strings +which can be displayed on the screen. +
Name
The name of the element, usually the reference designator. +
Value
The value of the element. +
MX MY
The location of the element's mark. This is the reference point +for placing the element and its pins and pads. +
TX TY
The upper left corner of the text (one of the three strings). +
TDir
The relative direction of the text. 0 means left to right for +an unrotated element, 1 means up, 2 left, 3 down. +
TScale
Size of the text, as a percentage of the “default” size of of the +font (the default font is about 40 mils high). Default is 100 (40 +mils). +
TSFlags
Symbolic or numeric flags, for the text. +
TNFlags
Numeric flags, for the text. +
+ +

Elements may contain pins, pads, element lines, element arcs, +attributes, and (for older elements) an optional mark. Note that +element definitions that have the mark coordinates in the element +line, only support pins and pads which use relative coordinates. The +pin and pad coordinates are relative to the mark. Element definitions +which do not include the mark coordinates in the element line, may +have a Mark definition in their contents, and only use pin and pad +definitions which use absolute coordinates. + + +

+ +


+Next: , +Previous: Element syntax, +Up: File Syntax + +
+ +

8.8.7 ElementArc

+ + +

+
ElementArc [X Y Width Height StartAngle DeltaAngle Thickness]
+ElementArc (X Y Width Height StartAngle DeltaAngle Thickness)
+
+
+ +

+
X Y
Coordinates of the center of the arc. These are relative to the +Element's mark point for new element formats, or absolute for older +formats. +
Width Height
The width and height, from the center to the edge. The bounds of the +circle of which this arc is a segment, is thus 2*Width by +2*Height. +
StartAngle
The angle of one end of the arc, in degrees. In PCB, an angle of zero +points left (negative X direction), and 90 degrees points down +(positive Y direction). +
DeltaAngle
The sweep of the arc. This may be negative. Positive angles sweep +counterclockwise. +
Thickness
The width of the silk line which forms the arc. +
+ + +
+ +


+Next: , +Previous: ElementArc syntax, +Up: File Syntax + +
+ +

8.8.8 ElementLine

+ + +

+
ElementLine [X1 Y1 X2 Y2 Thickness]
+ElementLine (X1 Y1 X2 Y2 Thickness)
+
+
+ +

+
X1 Y1 X2 Y2
Coordinates of the endpoints of the line. These are relative to the +Element's mark point for new element formats, or absolute for older +formats. +
Thickness
The width of the silk for this line. +
+ + +
+ +


+Next: , +Previous: ElementLine syntax, +Up: File Syntax + +
+ +

8.8.9 FileVersion

+ + +

+
FileVersion[Version]
+
+
+ +

+
Version
File format version. This version number represents the date when the pcb file +format was last changed. +
+ +

Any version of pcb build from sources equal to or newer +than this number should be able to read the file. If this line is not present +in the input file then file format compatibility is not checked. + + +

+ +


+Next: , +Previous: FileVersion syntax, +Up: File Syntax + +
+ +

8.8.10 Flags

+ + +

+
Flags(Number)
+
+
+ +

+
Number
A number, whose value is normally given in hex, individual bits of which +represent pcb-wide flags as defined in PCBFlags. + +
+ + +
+ +


+Next: , +Previous: Flags syntax, +Up: File Syntax + +
+ +

8.8.11 Grid

+ + +

+
Grid [Step OffsetX OffsetY Visible]
+Grid (Step OffsetX OffsetY Visible)
+Grid (Step OffsetX OffsetY)
+
+
+ +

+
Step
Distance from one grid point to adjacent points. This value may be a +floating point number for the first two variants. +
OffsetX OffsetY
The "origin" of the grid. Normally zero. +
Visible
If non-zero, the grid will be visible on the screen. +
+ + +
+ +


+Next: , +Previous: Grid syntax, +Up: File Syntax + +
+ +

8.8.12 Groups

+ + +

+
Groups("String")
+
+
+ +

+
String
+Encodes the layer grouping information. Each group is separated by a +colon, each member of each group is separated by a comma. Group +members are either numbers from 1..N for each layer, and +the letters c or s representing the component side and +solder side of the board. Including c or s marks that +group as being the top or bottom side of the board. + +
          Groups("1,2,c:3:4:5,6,s:7,8")
+
+
+ + +
+ +


+Next: , +Previous: Groups syntax, +Up: File Syntax + +
+ +

8.8.13 Layer

+ + +

+
Layer (LayerNum "Name") (
+   ... contents ...
+)
+
+
+ +

+
LayerNum
The layer number. Layers are numbered sequentially, starting with 1. +The last two layers (9 and 10 by default) are solder-side silk and +component-side silk, in that order. +
Name
The layer name. +
contents
The contents of the layer, which may include attributes, lines, arcs, rectangles, +text, and polygons. +
+ + +
+ +


+Next: , +Previous: Layer syntax, +Up: File Syntax + +
+ +

8.8.14 Line

+ + +

+
Line [X1 Y1 X2 Y2 Thickness Clearance SFlags]
+Line (X1 Y1 X2 Y2 Thickness Clearance NFlags)
+Line (X1 Y1 X2 Y2 Thickness NFlags)
+
+
+ +

+
X1 Y1 X2 Y2
The end points of the line +
Thickness
The width of the line +
Clearance
The amount of space cleared around the line when the line passes +through a polygon. The clearance is added to the thickness to get the +thickness of the clear; thus the space between the line and the +polygon is Clearance/2 wide. +
SFlags
Symbolic or numeric flags +
NFlags
Numeric flags. +
+ + +
+ +


+Next: , +Previous: Line syntax, +Up: File Syntax + +
+ +

8.8.15 Mark

+ + +

+
Mark [X Y]
+Mark (X Y)
+
+
+ +

+
X Y
Coordinates of the Mark, for older element formats that don't have +the mark as part of the Element line. +
+ + +
+ +


+Next: , +Previous: Mark syntax, +Up: File Syntax + +
+ +

8.8.16 Net

+ + +

+
Net ("Name" "Style") (
+   ... connects ...
+)
+
+
+ +

+
Name
The name of this net. +
Style
The routing style that should be used when autorouting this net. +
+ + +
+ +


+Next: , +Previous: Net syntax, +Up: File Syntax + +
+ +

8.8.17 Netlist

+ + +

+
Netlist ( ) (
+   ... nets ...
+)
+
+
+ + +

+ +


+Next: , +Previous: Netlist syntax, +Up: File Syntax + +
+ +

8.8.18 Pad

+ + +

+
Pad [rX1 rY1 rX2 rY2 Thickness Clearance Mask "Name" "Number" SFlags]
+Pad (rX1 rY1 rX2 rY2 Thickness Clearance Mask "Name" "Number" NFlags)
+Pad (aX1 aY1 aX2 aY2 Thickness "Name" "Number" NFlags)
+Pad (aX1 aY1 aX2 aY2 Thickness "Name" NFlags)
+
+
+ +

+
rX1 rY1 rX2 rY2
Coordinates of the endpoints of the pad, relative to the element's +mark. Note that the copper extends beyond these coordinates by half +the thickness. To make a square or round pad, specify the same +coordinate twice. +
aX1 aY1 aX2 aY2
Same, but absolute coordinates of the endpoints of the pad. +
Thickness
width of the pad. +
Clearance
add to thickness to get clearance width. +
Mask
width of solder mask opening. +
Name
name of pin +
Number
number of pin +
SFlags
symbolic or numerical flags +
NFlags
numerical flags only +
+ + +
+ +


+Next: , +Previous: Pad syntax, +Up: File Syntax + +
+ +

8.8.19 PCB

+ + +

+
PCB ["Name" Width Height]
+PCB ("Name" Width Height]
+PCB ("Name")
+
+
+ +

+
Name
Name of the PCB project +
Width Height
Size of the board +
+ +

If you don't specify the size of the board, a very large default is +chosen. + + +

+ +


+Next: , +Previous: PCB syntax, +Up: File Syntax + +
+ +

8.8.20 Pin

+ + +

+
Pin [rX rY Thickness Clearance Mask Drill "Name" "Number" SFlags]
+Pin (rX rY Thickness Clearance Mask Drill "Name" "Number" NFlags)
+Pin (aX aY Thickness Drill "Name" "Number" NFlags)
+Pin (aX aY Thickness Drill "Name" NFlags)
+Pin (aX aY Thickness "Name" NFlags)
+
+
+ +

+
rX rY
coordinates of center, relative to the element's mark +
aX aY
absolute coordinates of center. +
Thickness
outer diameter of copper annulus +
Clearance
add to thickness to get clearance diameter +
Mask
diameter of solder mask opening +
Drill
diameter of drill +
Name
name of pin +
Number
number of pin +
SFlags
symbolic or numerical flags +
NFlags
numerical flags only +
+ + +
+ +


+Next: , +Previous: Pin syntax, +Up: File Syntax + +
+ +

8.8.21 PolyArea

+ + +

+
PolyArea [Area]
+
+
+ +

+
Area
Minimum area of polygon island to retain. If a polygon has clearances that cause an isolated island to be created, then will only be retained if the area exceeds this minimum area. +
+ + +
+ +


+Next: , +Previous: PolyArea syntax, +Up: File Syntax + +
+ +

8.8.22 Polygon

+ + +

+
Polygon (SFlags) (
+   ... (X Y) ...
+   ... [X Y] ...
+   Hole (
+      ... (X Y) ...
+      ... [X Y] ...
+   )
+   ...
+)
+
+
+ +

+
SFlags
Symbolic or numeric flags. +
X Y
Coordinates of each vertex. You must list at least three coordinates. +
Hole (...)
Defines a hole within the polygon's outer contour. There may be zero or more such sections. +
+ + +
+ +


+Next: , +Previous: Polygon syntax, +Up: File Syntax + +
+ +

8.8.23 Rat

+ + +

+
Rat [X1 Y1 Group1 X2 Y2 Group2 SFlags]
+Rat (X1 Y1 Group1 X2 Y2 Group2 NFlags)
+
+
+ +

+
X1 Y1 X2 Y2
The endpoints of the rat line. +
Group1 Group2
The layer group each end is connected on. +
SFlags
Symbolic or numeric flags. +
NFlags
Numeric flags. +
+ + +
+ +


+Next: , +Previous: Rat syntax, +Up: File Syntax + +
+ +

8.8.24 Styles

+ + +

+
Styles("String")
+
+
+ +

+
String
+Encodes the four routing styles pcb knows about. The four styles +are separated by colons. Each style consists of five parameters as follows: + +
+
Name
The name of the style. +
Thickness
Width of lines and arcs. +
Diameter
Copper diameter of pins and vias. +
Drill
Drill diameter of pins and vias. +
Keepaway
Minimum spacing to other nets. If omitted, 10 mils is the default. + +
+ +
+ +
     Styles("Signal,10,40,20:Power,25,60,35:Fat,40,60,35:Skinny,8,36,20")
+     Styles["Logic,1000,3600,2000,1000:Power,2500,6000,3500,1000:
+        Line,4000,6000,3500,1000:Breakout,600,2402,1181,600"]
+
+

Note that strings in actual files cannot span lines; the above example +is split across lines only to make it readable. + + +

+ +


+Next: , +Previous: Styles syntax, +Up: File Syntax + +
+ +

8.8.25 Symbol

+ + +

+
Symbol [Char Delta] (
+Symbol (Char Delta) (
+   ... symbol lines ...
+)
+
+
+ +

+
Char
The character or numerical character value this symbol represents. +Characters must be in single quotes. +
Delta
Additional space to allow after this character. +
+ + +
+ +


+Next: , +Previous: Symbol syntax, +Up: File Syntax + +
+ +

8.8.26 SymbolLine

+ + +

+
SymbolLine [X1 Y1 X2 Y1 Thickness]
+SymbolLine (X1 Y1 X2 Y1 Thickness)
+
+
+ +

+
X1 Y1 X2 Y2
The endpoints of this line. +
Thickness
The width of this line. +
+ + +
+ +


+Next: , +Previous: SymbolLine syntax, +Up: File Syntax + +
+ +

8.8.27 Text

+ + +

+
Text [X Y Direction Scale "String" SFlags]
+Text (X Y Direction Scale "String" NFlags)
+Text (X Y Direction "String" NFlags)
+
+
+ +

+
X Y
The location of the upper left corner of the text. +
Direction
0 means text is drawn left to right, 1 means up, 2 means right to left +(i.e. upside down), and 3 means down. +
Scale
Size of the text, as a percentage of the “default” size of of the +font (the default font is about 40 mils high). Default is 100 (40 +mils). +
String
The string to draw. +
SFlags
Symbolic or numeric flags. +
NFlags
Numeric flags. +
+ + +
+ +


+Next: , +Previous: Text syntax, +Up: File Syntax + +
+ +

8.8.28 Thermal

+ + +

+
Thermal [Scale]
+
+
+ +

+
Scale
Relative size of thermal fingers. A value of 1.0 makes the finger +width twice the clearance gap width (measured across the gap, not +diameter). The normal value is 0.5, which results in a finger width +the same as the clearance gap width. +
+ + +
+ +


+Previous: Thermal syntax, +Up: File Syntax + +
+ +

8.8.29 Via

+ + +

+
Via [X Y Thickness Clearance Mask Drill "Name" SFlags]
+Via (X Y Thickness Clearance Mask Drill "Name" NFlags)
+Via (X Y Thickness Clearance Drill "Name" NFlags)
+Via (X Y Thickness Drill "Name" NFlags)
+Via (X Y Thickness "Name" NFlags)
+
+
+ +

+
X Y
coordinates of center +
Thickness
outer diameter of copper annulus +
Clearance
add to thickness to get clearance diameter +
Mask
diameter of solder mask opening +
Drill
diameter of drill +
Name
string, name of via (vias have names?) +
SFlags
symbolic or numerical flags +
NFlags
numerical flags only +
+ + + +
+ +


+Next: , +Previous: File Syntax, +Up: File Formats + +
+ +

8.9 Object Flags

+ +

Note that object flags can be given numerically (like 0x0147) +or symbolically (like "found,showname,square". Some numeric +values are reused for different object types. The table below lists +the numeric value followed by the symbolic name. + +

+
0x0001 pin
If set, this object is a pin. This flag is for internal use only. +
0x0002 via
Likewise, for vias. +
0x0004 found
If set, this object has been found by FindConnection(). +
0x0008 hole
For pins and vias, this flag means that the pin or via is a hole +without a copper annulus. +
0x0010 rat
If set for a line, indicates that this line is a rat line instead of a +copper trace. +
0x0010 pininpoly
For pins and pads, this flag is used internally to indicate that the +pin or pad overlaps a polygon on some layer. +
0x0010 clearpoly
For polygons, this flag means that pins and vias will normally clear +these polygons (thus, thermals are required for electrical +connection). When clear, polygons will solidly connect to pins and +vias. +
0x0010 hidename
For elements, when set the name of the element is hidden. +
0x0020 showname
For elements, when set the names of pins are shown. +
0x0020 clearline
For lines and arcs, the line/arc will clear polygons instead of +connecting to them. +
0x0020 fullpoly
For polygons, the full polygon is drawn (i.e. all parts instead of only the biggest one). +
0x0040 selected
Set when the object is selected. +
0x0080 onsolder
For elements and pads, indicates that they are on the solder side. +
0x0080 auto
For lines and vias, indicates that these were created by the +autorouter. +
0x0100 square
For pins and pads, indicates a square (vs round) pin/pad. +
0x0200 rubberend
For lines, used internally for rubber band moves. +
0x0200 warn
For pins, vias, and pads, set to indicate a warning. +
0x0400 usetherm
Obsolete, indicates that pins/vias should be drawn with thermal +fingers. +
0x0400
Obsolete, old files used this to indicate lines drawn on silk. +
0x0800 octagon
Draw pins and vias as octagons. +
0x1000 drc
Set for objects that fail DRC. +
0x2000 lock
Set for locked objects. +
0x4000 edge2
For pads, indicates that the second point is closer to the edge. For +pins, indicates that the pin is closer to a horizontal edge and thus +pinout text should be vertical. +
0x8000 marker
Marker used internally to avoid revisiting an object. +
0x10000 nopaste
For pads, set to prevent a solderpaste stencil opening for the +pad. Primarily used for pads used as fiducials. +
+ + +
+ +


+Previous: Object Flags, +Up: File Formats + +
+ +

8.10 PCBFlags

+ +
+
0x00001
Pinout displays pin numbers instead of pin names. +
0x00002
Use local reference for moves, by setting the mark at the beginning of +each move. +
0x00004
When set, only polygons and their clearances are drawn, to see if +polygons have isolated regions. +
0x00008
Display DRC region on crosshair. +
0x00010
Do all move, mirror, rotate with rubberband connections. +
0x00020
Display descriptions of elements, instead of refdes. +
0x00040
Display names of elements, instead of refdes. +
0x00080
Auto-DRC flag. When set, PCB doesn't let you place copper that +violates DRC. +
0x00100
Enable 'all-direction' lines. +
0x00200
Switch starting angle after each click. +
0x00400
Force unique names on board. +
0x00800
New lines/arc clear polygons. +
0x01000
Crosshair snaps to pins and pads. +
0x02000
Show the solder mask layer. +
0x04000
Draw with thin lines. +
0x08000
Move items orthogonally. +
0x10000
Draw autoroute paths real-time. +
0x20000
New polygons are full ones. +
0x40000
Names are locked, the mouse cannot select them. +
0x80000
Everything but names are locked, the mouse cannot select anything else. +
0x100000
New polygons are full polygons. +
0x200000
When set, element names are not drawn. +
+ + +
+ +


+Next: , +Previous: File Formats, +Up: Top + +
+ +

9 Library Creation

+ +

+This chapter provides a detailed look at how footprint libraries are +created and used. The chapter is split into two section, the first +section covers the "old" style libraries which use the m4 macro +processor and the second section covers the "new" style libraries. + +

Despite the names "old" and "new", both styles of libraries are useful +and the "old" style should not be discounted because of its name. The +advantage of the old style libraries is that one can define a family of +footprints, say a DIP package, and then quickly produce all the members +of that family. Because the individual packages make use of a base +definition, corrections made to the base definition propagate to all the +members of a family. The primary drawback to using this library +approach is that the effort to create a single footprint is more than a +graphical interface and may take even longer if the user has not used +the m4 macro language previously. + +

The new style of footprint libraries stores each footprint in its own +file. The footprints are created graphically by placing pads and then +converting a group of pads to a component. This library method has the +advantage of being quick to learn and it is easily to build single +footprints quickly. If you are building a family of parts, however, the +additional effort in creating each one individually makes this approach +undesirable. In addition, creating a part with a large pin count +can be quite tedious when done by hand. + +

9.1 Old Style (m4) Libraries

+ +

The old style libraries for pcb use the m4 macro processor to +allow the definition of a family of parts. There are several files +associated with the old style library. The file common.m4 is the +top level file associated with the library. common.m4 defines a +few utility macros which are used by other portions of the library, +and then includes a predefined set of library files (the lines like +include(geda.inc)). + +

9.1.1 Overview of Oldlib Operation

+ +

The big picture view of the old style library system is that the library +is simply a collection of macro definitions. The macros are written in +the m4 macro language. An example of a macro and what it expands +to is the following. One of the predefined footprints in the library +which comes with PCB is the PKG_SO8 macro. Note that all the +footprint macros begin with PKG_. For this particular example, +PKG_SO8 is a macro for an 8-pin small outline surface mount +package. All of the footprint macros take 3 arguments. The first is the +canonical name of the footprint on the board. In this case "SO8" is an +appropriate name. The second argument is the reference designator on +the board such as "U1" or "U23". The third and final argument is the +value. For an integrated circuit this is usually the part number such +as "MAX4107" or "78L05" and for a component such as a resistor or +capacitor it is the resistance or capacitance. The complete call to the +macro in our example is ‘PKG_SO8(SO8, U1, MAX4107)’. When +processed by m4 using the macros defined in the PCB library, this +macro expands to +

     Element(0x00 "SO8" "U1" "MAX4107" 146 50 3 100 0x00)
+     (
+     	Pad(10 25 38 25 20 "1" 0x00)
+     	Pad(10 75 38 75 20 "2" 0x100)
+     	Pad(10 125 38 125 20 "3" 0x100)
+     	Pad(10 175 38 175 20 "4" 0x100)
+     	Pad(214 175 242 175 20 "5" 0x100)
+     	Pad(214 125 242 125 20 "6" 0x100)
+     	Pad(214 75 242 75 20 "7" 0x100)
+     	Pad(214 25 242 25 20 "8" 0x100)
+     	ElementLine(0 0 151 0 10)
+     	ElementArc(126 0 25 25 0 180 10)
+     	ElementLine(101 0 252 0 10)
+     	ElementLine(252 0 252 200 10)
+     	ElementLine(252 200 0 200 10)
+     	ElementLine(0 200 0 0 10)
+     	Mark(29 25)
+     )
+
+

which is the actual definition of the footprint that the PCB program +works with. As a user of PCB the only time you will need or want to run +m4 directly is when you are debugging a new library addition. In +normal operation, the calls to m4 are made by helper scripts that +come with PCB. + +

Tools such as gsch2pcb (used to interface the gEDA schematic +capture program to PCB layout) will call m4 to produce an initial +PCB layout that includes all the components on a schematic. In +addition, when manually instantiating parts from within PCB, m4 +will be called by PCB's helper scripts to produce the footprints. + +

9.1.2 The Library Scripts

+ +

There are several scripts that are used for processing the m4 +libraries. This section briefly describes these scripts and details how +they are used by PCB. + +

9.1.2.1 Scripts Used During Compilation
+ +

The scripts described in this section are used during compilation of +PCB. They are run automatically by the build system, but are described +here to help document the complete library processing that occurs. +During the build of PCB, the following actions are taken. The +CreateLibrary.sh script is run to produce an M4 "frozen file". +This frozen file is simply a partially processed M4 input file which can +be loaded by M4 more quickly than the original input file. + +

A typical call to CreateLibrary.sh used during the compilation of +PCB is: +

     ./CreateLibrary.sh -I . pcblib ./common.m4 TTL_74xx_DIL.m4
+     connector.m4 crystal.m4 generic.m4 genericsmt.m4 gtag.m4
+     jerry.m4 linear.m4 logic.m4 lsi.m4 memory.m4 optical.m4 pci.m4
+     resistor_0.25W.m4 resistor_adjust.m4 resistor_array.m4
+     texas_inst_amplifier.m4 texas_inst_voltage_reg.m4
+     transistor.m4 geda.m4
+
+

The ‘-I .’ says to search in the current directory for the +.m4 files. The output frozen file is pcblib. The main +common.m4 file is listed as well as all of the *.m4 files +which define the components in the library. + +

In addition, a library contents file is created during the build with +the CreateLibraryContents.sh script. +A typical call to CreateLibrary.sh used during the compilation of +PCB is: +

     ./CreateLibraryContents.sh -I . ./common.m4 TTL_74xx_DIL.list
+     connector.list crystal.list generic.list genericsmt.list gtag.list
+     jerry.list linear.list logic.list lsi.list memory.list optical.list
+     pci.list resistor_0.25W.list resistor_adjust.list resistor_array.list
+     texas_inst_amplifier.list texas_inst_voltage_reg.list transistor.list
+     geda.list > pcblib.contents
+
+

The pcblib.contents file is used by the PCB program to define the +libraries and components which will be displayed when you bring up +the library window from within PCB. An example of part of the +pcblib.contents file is: +

     TYPE=~TTL 74xx DIL
+     7400_dil:N:7400:4 dual-NAND
+     7401_dil:N:7401:4 dual-NAND OC
+     7402_dil:N:7402:4 dual-NOR
+     TYPE=~geda
+     geda_DIP6:DIP6:DIP6:Dual in-line package, narrow (300 mil)
+     geda_DIP8:DIP8:DIP8:Dual in-line package, narrow (300 mil)
+     geda_DIP14:DIP14:DIP14:Dual in-line package, narrow (300 mil)
+     geda_ACY300:ACY300:ACY300:Axial non-polar component,
+
+

The TYPE= lines define the library name that will show up in the +library window in PCB. The other lines define the actual components in +the library. + +

9.1.2.2 Scripts Used by PCB at Runtime
+ +

When PCB is first executed, it makes a call to the +ListLibraryContents.sh script. This script provides the PCB +program with the contents of the library contents file created when PCB +was compiled. A typical call to ListLibraryContents.sh is +

     ../lib/ListLibraryContents.sh .:/tmp/pcb-20030903/src/../lib pcblib
+
+

This command says to search the path +‘.:/tmp/pcb-20030903/src/../lib’ for a file called +pcblib.contents (the .contents part is added +automatically) and display the contents of the file. +PCB parses this output and generates the library window entries. + +

When you pick a library component from the library window, PCB calls the +QueryLibrary.sh script to actually pull the footprint into the +layout. For example, when the ACY300 component is selected from the +~geda library, the generated call may be: + +

     /tmp/pcb-20030903/src/../lib/QueryLibrary.sh
+     .:/tmp/pcb-20030903/src/../lib pcblib geda_ACY300 ACY300
+     ACY300
+
+

If you were to run this command by hand you would see the PCB code for +the element: +

     Element(0x00 "Axial non-polar component," "" "ACY300" 245 70 0 100 0x00)
+     (
+     	Pin(0 25 50 20 "1" 0x101)
+     	Pin(300 25 50 20 "2" 0x01)
+     
+     	ElementLine(0 25 75 25 10)
+     	ElementLine(225 25 300 25 10)
+     
+     	ElementLine(75 0 225 0 10)
+     	ElementLine(225 0 225 50 10)
+     	ElementLine(225 50 75 50 10)
+     	ElementLine(75 50 75 0 10)
+     
+     #       ElementArc(X1 Y 50 50 270 180 10)
+     #       ElementArc(X2 Y 50 50 90 180 10)
+     
+     	Mark(75 25)
+     )
+
+

9.1.3 Creating an Oldlib Footprint

+ +

This section provides a complete example of defining a family of +footprints using the M4 style library. As a vehicle for this example, a +family of footprints for surface mount resistors and capacitors will be +developed. The file example.inc should have been installed on +your system as $prefix/share/examples/oldlib/example.inc where +$prefix is often times /usr/local. + +

The example.inc file defines a macro called +COMMON_PKG_RCSMT which is a generic definition for a surface +mount footprint with two identical, rectangular pads. This macro will +be called with different parameters to fill out the family of parts. +The arguments to the COMMON_PKG_RCSMT are: +

     # -------------------------------------------------------------------
+     # the definition for surface mount resistors and capacitors
+     # $1: canonical name
+     # $2: name on PCB
+     # $3: value
+     # $4: pad width   (in direction perpendicular to part)
+     # $5: pad length  (in direction parallel with part)
+     # $6: pad spacing (center to center)
+     # $7: distance from edge of pad to silk (in direction
+     #     perpendicular to part)
+     # $8: distance from edge of pad to silk (in direction parallel
+     #     with part)
+     # $9: Set to "no" to skip silk screen on the sides of the part
+
+
     define(`COMMON_PKG_RCSMT',
+     	`define(`XMIN', `eval( -1*`$6'/2 - `$5'/2 - `$8')')
+     	define(`XMAX', `eval(  `$6'/2 + `$5'/2 + `$8')')
+     	define(`YMIN', `eval(-1*`$4'/2 - `$7')')
+     	define(`YMAX', `eval(   `$4'/2 + `$7')')
+     Element(0x00 "$1" "$2" "$3" eval(XMIN+20) eval(YMAX+20) 0 100 0x00)
+     (
+     	ifelse(0, eval($4>$5),
+     	# Pads which have the perpendicular pad dimension less
+     	# than or equal to the parallel pad dimension
+     	Pad(eval(-1*(   $6 + $5 - $4)/2) 0
+     	    eval((-1*$6 + $5 - $4)/2) 0 eval($4) "1" 0x100)
+     	Pad(eval(-1*(-1*$6 + $5 - $4)/2) 0
+     	    eval((   $6 + $5 - $4)/2) 0 eval($4) "2" 0x100)
+     	,
+     	# Pads which have the perpendicular pad dimension greater
+     	# than or equal to the parallel pad dimension
+     	Pad(eval(-1*$6/2) eval(-1*($4 - $5)/2)
+     	    eval(-1*$6/2)  eval(($4 - $5)/2) eval($5) "1" 0x100)
+     	Pad(eval(   $6/2) eval(-1*($4 - $5)/2)
+     	    eval(   $6/2)  eval(($4 - $5)/2) eval($5) "2" 0x100)
+     	)
+     
+     	# silk screen
+     	# ends
+     	ElementLine(XMIN YMIN XMIN YMAX 10)
+     	ElementLine(XMAX YMAX XMAX YMIN 10)
+     	# sides
+     ifelse($9,"no",
+     	#skip side silk
+     	,
+     	ElementLine(XMIN YMIN XMAX YMIN 10)
+     	ElementLine(XMAX YMAX XMIN YMAX 10)
+     )
+     	Mark(0 0)
+     )')
+
+

Note that the part has been defined with the mark located at +(0,0) and that the pads have been placed with the mark at the +common centroid of the footprint. While not a requirement, this is +highly desirable when developing a library that will need to interface +with a pick and place machine used for factory assembly of a board. + +

The final part of example.inc defines particular versions of the +generic footprint we have created. These particular versions correspond +to various industry standard package sizes. +

     # 0402 package
+     #
+     # 30x30 mil pad, 15 mil metal-metal spacing=>
+     # 15 + 15 + 15 = 45 center-to-center
+     define(`PKG_RC0402',
+       `COMMON_PKG_RCSMT(`$1', `$2', `$3', 30, 30, 45, 0, 10, "no")')
+     
+     # 0603 package
+     #
+     # 40x40 mil pad, 30 mil metal-metal spacing=>
+     #  30 + 20 + 20 = 70 center-to-center
+     define(`PKG_RC0603',
+       `COMMON_PKG_RCSMT(`$1', `$2', `$3', 40, 40, 70, 10, 10)')
+     
+     # 1206 package
+     #
+     # 40x60 mil pad, 90 mil metal-metal spacing=>
+     #  90 + 20 + 20 = 130 center-to-center
+     define(`PKG_RC1206',
+       `COMMON_PKG_RCSMT(`$1', `$2', `$3', 60, 40, 130, 10, 10)')
+
+

At this point, the example.inc file could be used by third party +tools such as gsch2pcb. However to fully integrate our +footprints into PCB we need to create the example.m4 and +example.list files. The example.m4 file defines +descriptions for the new footprints. +

     define(`Description_my_RC0402',
+       ``Standard SMT resistor/capacitor (0402)'')
+     define(`Description_my_RC0603',
+       ``Standard SMT resistor/capacitor (0603)'')
+     define(`Description_my_RC1206',
+       ``Standard SMT resistor/capacitor (1206)'')
+
+

Finally we need to create the example.list file. +

     my_RC0402:RC0402:RES0402
+     my_RC0402:RC0402:CAP0402
+     my_RC0603:RC0603:RES0603
+     my_RC0603:RC0603:CAP0603
+     my_RC1206:RC1206:RES1206
+     my_RC1206:RC1206:CAP1206
+
+

The first field in the list file has the name corresponding to the +Description definitions in example.m4. The second field is the +template name which corresponds to the macros PKG_* we defined in +example.inc with the leading PKG_ removed. It is the +second field which controls what footprint will actually appear on the +board. The final +field is the name of the part type on the board. The first line in our +example.list file will produce a menu entry in the library window +that reads: +

     CAP0402, Standard SMT resistor/capacitor (0402)
+
+

The CAP0402 portion comes directly from the third field in +example.list and the longer description comes from descriptions +macros in example.m4. Please note that any extra white space +at the end of a line in the .list files will cause them to +not work properly. + +

9.1.4 Troubleshooting Old Style Libraries

+ +

A powerful technique to help debug problems with libraries is to invoke +the m4 processor directly. This approach will provide error +output which is not visible from within PCB. The following example +shows how one might try to debug an 8 pin small outline (SO8) package. The +macro name for the package is PKG_SO8. In this example, the +canonical name that is to be associated with the part is SO8, the +reference designator is U1, and the value is MAX4107 (the part number). + +

     echo "PKG_SO8(SO8, U1, MAX4107)" | \
+        gm4 common.m4 - | \
+        awk '/^[ \t]*$/ {next} {print}' | \
+        more
+
+

The awk call simply removes blank lines which make the output +hard to read. + +

For this particular example, the output is: +

     Element(0x00 "SO8" "U1" "MAX4107" 146 50 3 100 0x00)
+     (
+     	Pad(10 25 38 25 20 "1" 0x00)
+     	Pad(10 75 38 75 20 "2" 0x100)
+     	Pad(10 125 38 125 20 "3" 0x100)
+     	Pad(10 175 38 175 20 "4" 0x100)
+     	Pad(214 175 242 175 20 "5" 0x100)
+     	Pad(214 125 242 125 20 "6" 0x100)
+     	Pad(214 75 242 75 20 "7" 0x100)
+     	Pad(214 25 242 25 20 "8" 0x100)
+     	ElementLine(0 0 151 0 10)
+     	ElementArc(126 0 25 25 0 180 10)
+     	ElementLine(101 0 252 0 10)
+     	ElementLine(252 0 252 200 10)
+     	ElementLine(252 200 0 200 10)
+     	ElementLine(0 200 0 0 10)
+     	Mark(29 25)
+     )
+
+

9.2 New Style Libraries

+ +

Footprints for the new style library are created graphically using the +PCB program. A single footprint is saved in each file. + +

9.2.1 Creating Newlib Footprints

+ +

To create +

    +
  1. Start PCB with an empty layout. +
  2. Make the component layer active. +
  3. For a leaded part, select the via tool and place vias where the +pads for the part should go. For surface mount pads, draw line +segments. Note that until the footprint is completed, the surface +mount pads will remain rounded. Currently a rectangle or polygon +may not be used as a pad. +
  4. For each via and line segment which will become a pad, select it +and press 'n' to be able to enter a name. Enter +the pin number and press enter. +
  5. Make the silk layer active. +
  6. Using the line and arc tools, draw a silk screen outline for the +part. +
  7. Using the selection tool, select all of the pins and silk screen +for the part. +
  8. Place the pointer above the reference point for the part. This is +typically the common centroid. Keeping the pointer there, shift-right-click +to bring up the popup menu and choose "convert +selection to element". +
  9. At this point, the vias, line segments, and silk screen will have +been converted to an element. To change any of the line segments to +have square ends rather than round ends, select the pads by holding +down the shift key and clicking each pad with the center mouse button. +Now under the Select menu, "Change square-flag of selected objects" +section, choose "Pins". +
  10. Select the element, shift-right-click to bring up the popup menu, and +choose "Copy Selection to Buffer". Now left-click on the center of +the new element. +
  11. Under the buffer menu, choose "save buffer elements to file" to +save the new footprint to a file. +
  12. Press ESC to exit from buffer mode. +
+ +

9.2.2 Modifying Newlib Footprints

+ +
    +
  1. In the Pcb program, instantiate the footprint you wish to modify. +
  2. Using the selection tool, select the footprint. +
  3. Now left-click on the selected element, this brings up a popup menu, choose +"Cut Selection to Buffer" from the popup menu. +
  4. Under the buffer menu, choose "break buffer element to pieces", +and then left-click to place the broken apart footprint to an open area of +the layout. Note that you must use the items under the buffer menu, the +items with the same names in the popup menu do not work. +
  5. Make your desired modifications to the footprint and then convert +the pieces back to an element using the same procedure as when starting +from scratch on a new footprint. +
+ + +
+ +


+Next: , +Previous: Library Creation, +Up: Top + +
+ +

10 Schematic Capture for PCB

+ +

+When designing a circuit board of any complexity, a schematic capture +front-end for the design is highly desired. Any schematic capture +program which is able to generate a netlist in a user defined format as +well as a bill of materials can be made to work with PCB. Currently, we +are aware of two freely available schematic capture programs which can +interface with PCB. This chapter shows how a design can be taken from +start to finish using either of these two tools for schematic capture +and PCB for layout. + +

+ +
+ +


+Next: , +Up: Schematic Frontends + +
+ +

10.1 gEDA

+ +

+This section shows how to use gEDA as the schematic capture front-end for +a PCB design. This section is not intended to be complete documentation +on gEDA and it is assumed that the user has at least some familiarity +with the gEDA suite of programs. + +

The basic steps in a gEDA + PCB design flow are: +

    +
  1. Set up project directories +
  2. Set up gEDA (gschem/gnetlist) config files +
  3. Set up gsch2pcb config files +
  4. Capture schematics using gschem (part of gEDA) +
  5. Create any unique PCB footprints needed for the design +
  6. Generate initial PCB design using gsch2pcb (part of gEDA) +
  7. Layout circuit board using pcb +
  8. Make any additional schematic changes with gschem and +forward annotate to PCB with gsch2pcb +
  9. Generate photoplot files (RS-274X, also known as "Gerber") for +board vendor +
+ +

10.1.1 Set Up Project Directories

+ +

Although not required, a typical project directory will contain the +schematics and board layout at the top level. +Schematic symbols and circuit board footprints which are unique to this +project are stored in subdirectories. For this example, sym +contains the project specific schematic symbols and pkg contains +the project specific footprints. Set up the project subdirectory and +subdirectories by executing: +

     mkdir ~/myproj
+     cd ~/myproj
+     mkdir sym
+     mkdir pkg
+     mkdir pkg/newlib
+     mkdir pkg/m4
+
+

10.1.2 Set Up gEDA Config Files

+ +

The gEDA tools, specifically gschem and gnetlist, use +configuration files to set the search path for symbol libraries in +addition to other user preferences. Create a file in the top level +project directory called gschemrc. Add the following lines to +that file: +

     
+     ;; list libraries here.  Order matters as it sets the
+     ;; search order
+     (component-library "./sym")
+     
+
+

This sets the local search path for the schematic capture program +gschem. Now the netlister, gnetlist, must also be +configured. This can be done by copying the file gschemrc to +gnetlistrc by running ‘cp gschemrc gnetlistrc’. +Alternatively, you can create a soft link so only a single file needs to +be updated if additional symbol paths are added. The link is created by +running ‘ln -s gschemrc gnetlistrc’. + +

10.1.3 Set Up gsch2pcb Config Files

+ +

The program gsch2pcb, not to be confused with the older +gschem2pcb script, is used to link the schematic to layout. +gsch2pcb is responsible for creating the netlist used to provide +connectivity information to PCB as well creating an initial layout with +all components instantiated in the design. Forward annotation of +schematic changes to the layout is also done using gsch2pcb. +gsch2pcb uses a project file to set up the schematic file names, +PCB library locations, and output file names. Create a project file +called project using the following as an example: +

     
+     # List all the schematics to be netlisted
+     # and laid out on the pc board.
+     schematics      first.sch second.sch third.sch
+     
+     # For an output-name of foo, gsch2pcb generates files
+     # foo.net, foo.pcb, and foo.new.pcb.  If there is no
+     # output-name specified, the file names are derived from
+     # the first listed schematic, i.e. first.net, etc.
+     output-name  preamp
+     
+
+

10.1.4 Capture Schematics Using gschem

+ +

This section is fairly brief and assumes familiarity with using the +gschem schematic capture program. As you are creating your +schematics, be sure to observe the following rules: +

    +
  • Make sure that each component in the schematic has a +footprint attribute that corresponds to a footprint in the PCB +library or a footprint you plan on creating. +
  • Make sure all reference designators are unique. One way to ensure +this is to run the refdes_renum script (part of gEDA) after the +schematics are created. +
+ +

10.1.5 Create Any Unique PCB Footprints

+ +

Create the new footprints you design needs using either the m4 style or +newlib style of PCB libraries. Refer to Library Creation for details on this +process. For m4 style footprints, store them in the pkg/m4 +subdirectory and for newlib footprints, store them in the +pkg/newlib subdirectory. + +

10.1.6 Generate Initial PCB Design Using gsch2pcb

+ +

The gsch2pcb program connects the schematic and layout. It basic +operation is to call gnetlist to generate the connectivity +netlist that PCB used to verify connectivity and to instantiate all +elements found in the schematic to a new layout. +The default, as of gsch2pcb version 0.9, is to use any found m4 +style parts first and then search for newlib style if no old style part +was found. By using the --use-files or -f flag to gsch2pcb +priority is given to newlib style parts even if m4 style are found. You +may wish to verify this in the gsch2pcb documentation in case +this changes in the future. +To start your layout, +run ‘gsch2pcb project’ where project is the project file +created previously. This will create a new netlist file, +preamp.net, and a new layout file, preamp.pcb. + +

10.1.7 Layout Circuit Board

+ +

Run PCB on the new layout by running ‘pcb preamp.pcb’. +Load the netlist file by selecting "load netlist file" from the "file" +menu. In the file selection dialog box, choose preamp.net. This +loads connectivity information into PCB. + +

Using the selection tool, grab and move apart the various footprints +with the middle mouse button. Once the parts are moved apart from each +other, choose "optimize rats-nest" from the "Connects" menu. This menu +choice will display and optimize the rats nest. Use the rats nest to +help guide placement of the parts. You may wish to re-run the "optimize +rats-nest" command after moving parts around. + +

After the placement is complete, use the line tool to add traces to the +board. As traces are added, the corresponding rats line will disappear. + +

10.1.8 Forward Annotation of Schematic Changes

+ +

If schematic changes are made after the layout has started, +gsch2pcb can be used to forward annotate these changes to the +layout. To forward annotate schematic changes, run ‘gsch2pcb +project’. This command will create the files preamp.new.pcb, +preamp.net, and modify the file preamp.pcb. The +modifications to preamp.pcb include forward annotation of +schematic component value changes, adds any new components, and removes +any deleted components. + +

10.1.9 Generate Photoplot Files (RS-274X)

+ +

After the layout is complete, choose "edit layer-groupings" from the +"Settings" menu. The LayerGroups form lets you specify which layers +will appear in each output layer group. For example, in the default +form, layer group 1 has "front" and "front side" in it. The +output file 1.gbr if DOS file names are used, or +somename_front.gbr if long file names are used will contain the +"front" and "front side" layers in it. Usually the defaults are +sufficient, but this form is still a useful reference. + +

Choose "print layout..." from the "File" menu. In the print dialog box, +select "Gerber/RS-274X" for the device +driver. Select the "outline", "alignment", and "drillhelper" options. +To get DOS compatible file names, select the "DOS (8.3) names" option, +otherwise enter "preamp" for the filename. Press "OK". + +

The following output files should have been created in the project directory. +The names in parentheses correspond to the DOS compatible output file names. +

+
preamp_frontsilk.gbr (csilk.gbr)
Top side silk screen. +
preamp_frontmask.gbr (cmask.gbr)
Top side soldermask relief. +
preamp_front.gbr (1.gbr)
Top copper. +
preamp_backmask.gbr (smask.gbr)
Bottom side soldermask relief. +
preamp_back.gbr (2.gbr)
Bottom Copper. +
preamp_fab.gbr (fab.gbr)
Fabrication drawing. Also known as the drill drawing. This drawing is +used for reference by the board vendor but is not directly used in the +fabrication process. +
preamp_plated-drill.cnc (pdrill.cnc)
NC Drill format file for the plated through holes. +
preamp_unplated-drill.cnc (udrill.cnc)
NC Drill format file for the unplated through holes. +
preamp_bom.txt (bom.txt)
A bill of materials for the layout. +
preamp_xy.txt (xy.txt)
Centroid (X-Y) data for driving automated assembly equipment. +
+ + + +
+ +


+Previous: gEDA, +Up: Schematic Frontends + +
+ +

10.2 xcircuit

+ +

+If anyone cares to contribute this section, it will get added. Please +submit changes to the bug tracking system for PCB which can be found from +the PCB homepage at http://pcb.gpleda.org. + + +

+ +


+Next: , +Previous: Schematic Frontends, +Up: Top + +
+ +

Appendix A Installation and Troubleshooting

+ +

Compiling and installing the package should be straightforward. If any problems +occur, please contact the author Thomas.Nau@rz.uni-ulm.de, or the +current maintainer haceaton@aplcomm.jhuapl.edu to find +a solution and include it into the next release. + +

+ +
+ +


+Next: , +Up: Installation + +
+ +

A.1 Compiling and Installing

+ +

+This section covers the steps which are necessary to compile the package. + +

+ +
+ +


+Next: , +Up: compiling + +
+ +

A.1.1 Quick Start

+ +

+Starting with version 2.0, Pcb has switched to a GNU +autoconf/automake build system. Installation of Pcb consists of +three steps: configuration, building, and installing. +In a typical installation, these steps are as simple as +

     ./configure
+     make
+     make install
+
+
+ +


+Previous: quickstart, +Up: compiling + +
+ +

A.1.2 Running the configure Script

+ +

+The configure script accepts all of the standard GNU configure +options. For a complete list of configuration options, run +./configure --help. + + + +

INFOLIBDIR
must be set to the directory where your GNU info files are located. + +


PCBLIBDIR
is the path of a directory where the font files will be installed. + +


DEFAULTFONT
the name of the default font file. + +


DEFAULTLIBRARY
the name of the default library. + +


GNUM4
the name of GNUs m4 version. + +


BTNMOD
If your window manager has already bound Mod1 together with some +function keys you may want to change this setting. This is true for HP-VUE. + +
+ +

If you find things which must be changed to compile on your system, +please add the appropriate autoconf tests (if you are familiar with +that) and mail a copy to the maintainer, harry eaton, at +haceaton@aplcomm.jhuapl.edu. + +

If you do not have the appropriate permissions you should run +./pcbtest.sh in the src directory to run Pcb from +the installation directory. + +

+ +


+Previous: compiling, +Up: Installation + +
+ +

A.2 Troubleshooting

+ +

+There are some known problems. Most of them are related to +missing parts of a standard X11 distribution. Some others are caused by +third party applications such as X servers. To make this list more +complete please mail your problems and, if available, solutions to the author. +The mail address may be found at the beginning of this chapter. +In any case, read X11. + +

By the way, you MUST HAVE AN ANSI COMPILER to make Pcb work. + +

Another source of problems are older versions of flex and bison. +Pcb definitely works with flex-2.4.7 and bison-1.22 or +later. The problems will result in a syntax error while parsing files. +This should only be a problem if you have modified the flex or +bison input files. + +

The following list gives you just an idea because I'm not able to test +all Pcb releases on all platforms. + +

+ +
+ +


+Next: , +Up: problems + +
+ +

A.2.1 HP Series 700 and 800

+ +

+You have to install several X11 include files +or, better, install a complete X11R5 release. Hewlett-Packard doesn't +support the Athena Widgets. So the header files and libraries are missing +from the application media, but they are available as a patch. +They also do not ship the ANSI compiler with the normal operating +system release so you have to buy one or use GCC. +Some of the tools are available as patches. + +

In addition, Pcb has been successfully tested on these platforms with +HPUX 9.*, 10.* running self-compiled X11R5. + +

+ +


+Next: , +Previous: HP, +Up: problems + +
+ +

A.2.2 Sun SPARC architecture

+ +

+There are no known problems with Sun machines if they use X11R5 instead +of OpenWindows. Pcb compiled successfully with all kinds of +SPARCstations Solaris-2.[345]. + +

For problems with OpenWindows refer to X11. + +

+ +


+Next: , +Previous: Sun, +Up: problems + +
+ +

A.2.3 Silicon Graphics

+ +

+Pcb has been tested on some boxes running either IRIX-4.0.5 or +IRIX-5.3. The former one uses a X11R4 server. +There are no problems. +For known problems +with X11R4, see X11. + +

+ +


+Next: , +Previous: SGI, +Up: problems + +
+ +

A.2.4 DEC Alpha

+ +

+Pcb compiled and runs without problems on DEC UNIX V3.2c. + +

+ +


+Next: , +Previous: DEC Alpha, +Up: problems + +
+ +

A.2.5 SCO Unix

+ +

+John DuBois <spcecdt@deeptht.armory.com> wrote: +

     SCO-ODT-3.0 requires the latest version of tls003, the Athena
+     widget library (available from sosco.sco.com). The main problems
+     I have encountered are it core dumps fairly often, especially
+     while loading/dropping elements...
+
+

I'll see what I am able to do as soon as I have access to an SCO system. + +

+ +


+Next: , +Previous: SCO, +Up: problems + +
+ +

A.2.6 Linux

+ +

+Since the X11 version of Pcb has been developed on a Linux +system here are no known problems. + +

+ +


+Next: , +Previous: Linux, +Up: problems + +
+ +

A.2.7 FreeBSD and NetBSD

+ +

+Pcb has been tested on NetBSD and works without any problems. +You may also be able to find a NetBSD package at +ftp://ftp.netbsd.org/pub/NetBSD/packages/cad/pcb/README.html or a +FreeBSD port at +http://www.freebsd.org/cgi/url.cgi?ports/cad/pcb/pkg-descr. + +

+ +


+Next: , +Previous: BSD, +Up: problems + +
+ +

A.2.8 Problems related to X11

+ +

+There are a some problems related to X11R4 or systems derived from +X11 such as OpenWindows. See Sun. You at least have to change +all occurances of baseTranslations in the resource files to +translations if you are using a X11R4 server. Look at the +X11R5 Intrinsics manual for details. + +

The panner widget (print dialog box) appears only in release X11R5 and +later. It really simplifies adjusting the offsets. +With earlier releases the printout will always appear in the center of the +page. + +

You may have some problems in a mixed X11-OpenWindows +environment. + +

Pcb has been tested successfully with X11R6 under Linux 1.1.59 +and later. + +

+ +


+Previous: X11, +Up: problems + +
+ +

A.2.9 Problems related to TeX

+ +

+If your TeX installation complains about a missing texinfo.tex +file copy the one included in this release (directory doc +to your TeX macro directory. +Note, there are probably newer versions of this file available from some +FTP sites. +TeX-3.0 failed, TeX-3.14 worked just fine. Check our FTP server +ftp.uni-ulm.de for ready-to-print versions of the manuals. + + +

+ +


+Next: , +Previous: Installation, +Up: Top + +
+ +

Appendix B Customizing the Menus

+ +

The menu system is driven off a data file that contains +resources. A resource is a hierarchical description of a data +tree which, in this case, is mapped to the hierarchical menus used by +Pcb. + +

+ +
+ +


+Next: , +Up: Custom Menus + +
+ +

B.1 Resource Syntax

+ +

A resource file is a simple text file. It contains curly braces to +group things, spaces between things, and double quotes when strings +need to include spaces. There are four fundamental ways of adding +data to a resource. + +

First, a string (either a single word or a quoted string with spaces, +we call both “strings” in this appendix) can be added all by itself, +to add a string resource to the current resource. This is used, for +example, to define the string printed on a menu button. In this +example, four strings are added to the File resource: + +

     File = {
+       Sample
+       "longer sample"
+       some text
+     }
+
+

Second, a named string may be added by giving two strings separated by +an equals sign. This is used to specify X resources and a few other +optional parameters of menus, for example. Note that a string all by +itself is thus an “unnamed” string. + +

     {"Layer groups" foreground=red sensitive=false}
+
+

Third, an unnamed subresource may be added. This is used to create +submenus and menu buttons. To add a subresource, simply group other +things in curly braces. This example describes a resource containing +one string and three subresources: + +

     {File
+       {New do_new()}
+       {Save do_save()}
+       {Quit do_quit()}
+     }
+
+

Lastly, a named subresource may be added by prefixing an unnamed +subresource with a string and an equals sign, just as when naming +strings. This syntax is used to name the resources used for the main +menu and popup menus: + +

     MainMenu = {
+       ...
+       }
+
+

Additionally, the menu parser allows for “hooks” whereby portions of +the menu system can be programmatically created at runtime by the +application. These hooks are invoked by a single word proceeded by an +at sign, such as this example where most of the Sizes menu is created +automatically: + +

     {Sizes
+         @sizes
+         {"Adjust active sizes ..." AdjustStyle(0)}
+         }
+
+

In addition to all that, any unquoted pound sign (#) begins a +comment. Commented text continues until the end of the containing +line. Comments may begin at the beginning of a line, or after other +text on the line: + +

     # This is a comment
+     MainMenu = { # This is also a comment
+
+
+ +


+Next: , +Previous: Resource Syntax, +Up: Custom Menus + +
+ +

B.2 Menu Definitions

+ +

To best understand this section, you should find the +pcb-menu.res file that your Pcb uses and refer to it for +examples (see Menu Files and Defaults). Note that the lesstif +GUI uses pcb-menu.res and the GTK+ GUI uses gpcb-menu.res. +The file format is identical however and if so desired, one can make +one file be a soft link to the other. + +

A resource defines a menu when it meets certain semantic requirements. +The menu hierarchy is reflected as a hierarchy of unnamed +subresources, with the first string of each subresource defining the +label used for the menu button. A subresource that itself contains +subresources becomes a submenu, a subresource that does not becomes a +button. + +

A submenu should only contain subresources for the buttons or submenus +within that submenu. Two exceptions are allowed: an initial string +sets the label, and the string “-” (a single dash) will create a +separator. + +

A button should not contain subresources, but will contain many +strings, named and unnamed. The first member shall be an unnamed +string which is the label for the button. Any other unnamed strings +within the button's resource will be used as actions (much like the +.Xdefaults action strings), which are functions that will be called +when the button is pressed (or popped up, or created, depending on the +action). As a convenience, if a left parenthesis is seen, the current +“word” will continue at least until the matching right parenthesis. +This allows you to pass strings with spaces as arguments to actions +without needing to quote the action. + +

Named resources in button resources will be used as X resources. Such +resources can be used to set the font, color, and spacing of buttons. +As a convenience, “fg” can be used as an abbreviation for “foreground”. + +

Within the menu's resource file, Pcb will look for a few key named +subresources. At the moment, the only one it looks for is one called +MainMenu. This will be used for the main menu bar. In the +future, other named subresources will be used for popup resources. + +

Given all this, a small sample pcb-menu.res would be: + +

     MainMenu = {
+       {File
+         {"Load layout" Load(Layout)}
+         -
+         {"Quit Program" Quit() fg=red font=10x20}
+       }
+     }
+
+

Within the Pcb sources are specially crafted comments that mark all +the actions, flags, menu hooks, and whatnot that Pcb offers. Read the +file src/gather-actions in the Pcb source tree for +documentation for these comments. + +

+ +


+Previous: Menu Definitions, +Up: Custom Menus + +
+ +

B.3 Menu Files and Defaults

+ +

Pcb will look for a file which defines its menus, trying the following +names (the example is for the lesstif GUI, the GTK+ GUI has “gpcb-menu.res” +in place of “pcb-menu.res”): + +

     ./pcb-menu.res
+     $HOME/.pcb-menu.res
+     $PCBLIBDIR/pcb-menu.res
+     <internal>
+
+

Note that pcblibdir defaults to /usr/local/share/pcb +(hence, /usr/local/share/pcb/pcb-menu.res). The +<internal> entry refers to a menu definition within the Pcb +application itself. The master file for all this is the file +src/pcb-menu.res in the Pcb source tree. This master source is +used to create the internal menu definition as well as being installed +in $pcblibdir. + + +

+ +


+Next: , +Previous: Custom Menus, +Up: Top + +
+ +

Appendix C Element Search/Regular Expressions

+ +

+ +

C.1 Element Search/Regular Expressions

+ +

Pcb's search is based on POSIX 1003.2 Regular Expressions. Full POSIX +Regular Expressions are supported by Pcb if the regex library was +available when Pcb was built. One difference from the regular +expressions found in tools like awk or grep is that PCB implicitly +adds a “^” to the begining of a regular expression and “$” to the +end of the regular expression. For example, if you enter “C1”, the +actual regular expression used internally is “^C1$”. Another difference +is that search patterns in pcb are not case sensitive. That is, “CON” is +treated the same as “con”. + +

It is easier to show by example how to search than explain +POSIX 1003.2. With regular expressions most characters are just +themselves, but some are special: + +

+
*
Matches 0 or more instances of preceding character. + +
+
Matches 1 or more instances of preceding character. + +
?
Matches 0 or 1 instances of preceding character. + +
.
Matches any single character other than the newline character. + +
|
The vertical bar is the alternation operator. It combines two +regular expressions. The result matches if either of them matches. + +
\
A backslash indicates the next character should not be interpreted literally +if it normally is, and should be interpreted literally if it normally isn't. + +
{n}
An integer n enclosed in curly brackets matches the preceding item if +it occurs exactly n times. + +
[ ]
A pair of square brackets matches every character they contain. Characters +may be given explicitly, or as ranges. + +
-
A hyphen in the context of square brackets denotes the range between the +preceding and the following character. E.g., the range of digits is +“0-9” . The range of letters from C to K is “C-K” . + +
\^ inside square brackets
Inside square brackets the caret is an anti operator. Its presence makes +the square prackets match anything except the contents of the brackets. + +
( )
Round parenthesis group parts of a regular expression. This is very much +like they do in math formulars. + +
+ +

If you need a special character literally, you can escape it with a +backslash. + +

The following examples illustrate how regular expressions can be used to +specify element names (reference designators) to search for. +

+
C5
Select the element whose name is exactly “C5”. + +
C5 | R3
Select C5 and R3. + +
C.*
Select all elements whose name start with the letter “C”, such as C5, or +C42, or CF1. + +
C.*1
Select all elements that start with “C” and end with “1”, such as C1, +or C51 or C5/9B71. + +
R10?
Search for R1 or R10, but will not select R100 or R105. The question mark +is a quantifier for the character “0”. + +
R128+
Selects R128, R1288, R12888, etc. + +
TB.
Select all terminal blocks having exactly one character designator after +“TB” such as TB1, TBA, or TBx but not TB. + +
TB..
Select all terminal blocks having a two character designator such as TB21 or +TB1a. + +
TB.*
Select all terminal blocks with any designator. + +
.*31
Select all items, whose name ends with “31” such as Q31, or R31, or R531. + +
Q[12]
Select Q1 and Q2. + +
[A-D].*
Select all items, whose name starts with “A”, “B”, “C”, or “D”. + +
.*N{2}.*
Select all items, whose name contains two “N” in a row such as +CONN23, or connA, but not CON5 + +
[^D].*
Select all items that do not start with the letter “D”, such as C2, or +R34, but not D34 + +
+ + +
+ +


+Next: , +Previous: Regular Expressions, +Up: Top + +
+ +

Appendix D Standard Drill Size Tables

+ +

+ +

D.1 American Standard Wire Size Drills

+ + + +

Drill Diameter Drill Diameter Drill Diameter +
Size (inches) Size (inches) Size (inches) + +


97 .0059 96 .0063 95 .0067 +
94 .0071 93 .0075 92 .0079 +
91 .0083 90 .0087 89 .0091 +
88 .0095 87 .0100 86 .0105 +
85 .0110 84 .0115 83 .0120 +
82 .0125 81 .0130 80 .0135 +
79 .0145 78 .0160 77 .0180 +
76 .0200 75 .0210 74 .0225 +
73 .0240 72 .0250 71 .0260 +
70 .0280 69 .0292 68 .0310 +
67 .0320 66 .0330 65 .0350 +
64 .0360 63 .0370 62 .0380 +
61 .0390 60 .0400 59 .0410 +
58 .0420 57 .0430 56 .0465 +
55 .0520 54 .0550 53 .0595 +
52 .0635 51 .0670 50 .0700 +
49 .0730 48 .0760 47 .0785 +
46 .0810 45 .0820 44 .0860 +
43 .0890 42 .0935 41 .0960 +
40 .0980 39 .0995 38 .1015 +
37 .1040 36 .1065 35 .1100 +
34 .1110 33 .1130 32 .1160 +
31 .1200 30 .1285 29 .1360 +
28 .1405 27 .1440 26 .1470 +
25 .1495 24 .1520 23 .1540 +
22 .1570 21 .1590 20 .1610 +
19 .1660 18 .1695 17 .1730 +
16 .1770 15 .1800 14 .1820 +
13 .1850 12 .1890 11 .1910 +
10 .1935 9 .1960 8 .1990 +
7 .2010 6 .2040 5 .2055 +
4 .2090 3 .2130 2 .2210 +
1 .2280 +
+ +

D.2 American Standard Letter Size Drills

+ + + +

Drill Diameter Drill Diameter Drill Diameter +
Size (inches) Size (inches) Size (inches) + +


A .2340 B .2380 C .2420 +
D .2460 E .2500 F .2570 +
G .2610 H .2660 I .2720 +
J .2770 K .2810 L .2900 +
M .2950 N .3020 O .3160 +
P .3230 Q .3320 R .3390 +
S .3480 T .3580 U .3680 +
V .3770 W .3860 X .3970 +
Y .4040 Z .4130 +
+ +

D.3 Fractional Inch Size Drills

+ + + +

Drill Diameter Drill Diameter Drill Diameter +
Size (inches) Size (inches) Size (inches) + +


1/64 .0156 1/32 .0313 3/64 .0469 +
1/16 .0625 5/64 .0781 3/32 .0938 +
7/64 .1094 1/8 .1250 9/64 .1406 +
5/32 .1562 11/64 .1719 3/16 .1875 +
13/64 .2031 7/32 .2188 15/64 .2344 +
1/4 .2500 17/64 .2656 9/32 .2812 +
19/64 .2969 5/16 .3125 21/64 .3281 +
11/32 .3438 23/64 .3594 3/8 .3750 +
25/64 .3906 13/32 .4062 27/64 .4219 +
7/16 .4375 29/64 .4531 15/32 .4688 +
31/64 .4844 1/2 .5000 33/64 .5156 +
17/32 .5313 35/64 .5469 9/16 .5625 +
37/64 .5781 19/32 .5938 39/64 .6094 +
5/8 .6250 41/64 .6406 21/32 .6562 +
43/64 .6719 11/16 .6875 45/64 .7031 +
23/32 .7188 47/64 .7344 3/4 .7500 +
49/64 .7656 25/32 .7812 51/64 .7969 +
13/16 .8125 53/64 .8281 27/32 .8438 +
55/64 .8594 7/8 .8750 57/64 .8906 +
29/32 .9062 59/64 .9219 15/16 .9375 +
61/64 .9531 31/32 .9688 63/64 .9844 +
1 1.0000 +
+ +

D.4 Metric Drills

+ + + +

Drill Diameter Drill Diameter Drill Diameter +
Size (inches) Size (inches) Size (inches) + +


0.20 mm .00787 0.25 mm .00984 0.30 mm .0118 +
0.35 mm .0138 0.40 mm .0158 0.45 mm .0177 +
0.50 mm .0197 0.55 mm .0217 0.60 mm .0236 +
0.65 mm .0256 0.70 mm .0276 0.75 mm .0295 +
0.80 mm .0315 0.85 mm .0335 0.90 mm .0354 +
0.95 mm .0374 1.00 mm .0394 1.05 mm .0413 +
1.10 mm .0433 1.15 mm .0453 1.20 mm .0472 +
1.25 mm .0492 1.30 mm .0512 1.35 mm .0531 +
1.40 mm .0551 1.45 mm .0571 1.50 mm .0591 +
1.55 mm .0610 1.60 mm .0630 1.65 mm .0650 +
1.70 mm .0669 1.75 mm .0689 1.80 mm .0709 +
1.85 mm .0728 1.90 mm .0748 1.95 mm .0768 +
2.00 mm .0787 2.05 mm .0807 2.10 mm .0827 +
2.15 mm .0846 2.20 mm .0866 2.25 mm .0886 +
2.30 mm .0906 2.35 mm .0925 2.40 mm .0945 +
2.45 mm .0965 2.50 mm .0984 2.55 mm .1004 +
2.60 mm .1024 2.65 mm .1043 2.70 mm .1063 +
2.75 mm .1083 2.80 mm .1102 2.85 mm .1122 +
2.90 mm .1142 2.95 mm .1161 3.00 mm .1181 +
3.10 mm .1220 3.15 mm .1240 3.20 mm .1260 +
3.25 mm .1280 3.30 mm .1299 3.40 mm .1339 +
3.50 mm .1378 3.60 mm .1417 3.70 mm .1457 +
3.75 mm .1476 3.80 mm .1496 3.90 mm .1535 +
4.00 mm .1575 4.10 mm .1614 4.20 mm .1654 +
4.25 mm .1673 4.30 mm .1693 4.40 mm .1732 +
4.50 mm .1772 4.60 mm .1811 4.70 mm .1850 +
4.75 mm .1870 4.80 mm .1890 4.90 mm .1929 +
5.00 mm .1969 5.10 mm .2008 5.20 mm .2047 +
5.25 mm .2067 5.30 mm .2087 5.40 mm .2126 +
5.50 mm .2165 5.60 mm .2205 5.70 mm .2244 +
5.75 mm .2264 5.80 mm .2283 5.90 mm .2323 +
6.00 mm .2362 6.10 mm .2402 6.20 mm .2441 +
6.25 mm .2461 6.30 mm .2480 6.40 mm .2520 +
6.50 mm .2559 6.60 mm .2598 6.70 mm .2638 +
6.75 mm .2657 6.80 mm .2677 6.90 mm .2717 +
7.00 mm .2756 7.10 mm .2795 7.20 mm .2835 +
7.25 mm .2854 7.30 mm .2874 7.40 mm .2914 +
7.50 mm .2953 7.60 mm .2992 7.70 mm .3031 +
8.00 mm .3150 8.10 mm .3189 8.20 mm .3228 +
8.25 mm .3248 8.30 mm .3268 8.40 mm .3307 +
8.50 mm .3346 8.60 mm .3386 8.70 mm .3425 +
8.75 mm .3445 8.80 mm .3465 8.90 mm .3504 +
9.00 mm .3543 9.10 mm .3583 9.20 mm .3622 +
9.25 mm .3642 9.30 mm .3661 9.40 mm .3701 +
9.50 mm .3740 9.60 mm .3780 9.70 mm .3819 +
9.75 mm .3839 9.80 mm .3858 9.90 mm .3898 +
10.00 mm .3937 10.10 mm .3976 10.20 mm .4016 +
10.25 mm .4035 10.30 mm .4055 10.40 mm .4094 +
10.50 mm .4134 10.60 mm .4173 10.70 mm .4213 +
10.80 mm .4252 10.90 mm .4291 11.00 mm .4331 +
11.10 mm .4370 11.20 mm .4409 11.25 mm .4429 +
11.30 mm .4449 11.40 mm .4488 11.50 mm .4528 +
11.60 mm .4567 11.70 mm .4606 11.75 mm .4626 +
11.80 mm .4646 11.90 mm .4685 12.00 mm .4724 +
12.50 mm .4921 13.00 mm .5118 13.50 mm .5315 +
14.00 mm .5512 14.50 mm .5709 15.00 mm .5906 +
15.50 mm .6102 16.00 mm .6299 16.50 mm .6496 +
17.00 mm .6693 17.50 mm .6890 18.00 mm .7087 +
18.50 mm .7283 19.00 mm .7480 19.50 mm .7677 +
20.00 mm .7874 20.50 mm .8071 21.00 mm .8268 +
21.50 mm .8465 22.00 mm .8661 22.50 mm .8858 +
23.00 mm .9055 23.50 mm .9252 24.00 mm .9449 +
24.50 mm .9646 25.00 mm .9843 +
+ + +

+ +


+Next: , +Previous: Standard Drill Sizes, +Up: Top + +
+ +

Appendix E Centroid (X-Y) File Format

+ +

+ +

E.1 Overview

+ +

E.2 File Format

+ +

The centroid output file is in a standard comma seperated values (CSV) +format. Comment lines begin with a “#”. The output file contains a +header with an RCS Id tag (useful for those who will check the file +into a version control system), a version number for the file format, +some comments containing the author and title of the board, and a +comment describing the remainder of the file format. + +

An example centroid file is shown below. + +

     
+     # $Id$
+     # PcbXY Version 1.0
+     # Date: Fri Jul 22 03:40:08 2005 UTC
+     # Author: PCB User
+     # Title: MyBoard - PCB X-Y
+     # RefDes, Description, Value, X, Y, rotation, top/bottom
+     # X,Y in mils.  rotation in degrees.
+     # --------------------------------------------
+     R61,"0603","10",2610.00,3560.00,90,top
+     J5,"AMPHENOL_ARFX1231","unknown",2390.00,4220.00,180,top
+     C13,"0402","0.01u",2340.00,3014.00,270,top
+     
+
+

E.3 Computation of Centroid and Rotation

+ +

The center of each element is found by averaging the (X,Y) coordinates +for the center of each pin and pad in the element. For example if an +element has 2 pins, 1 at (1,0) and another at (1,4) then the centroid +will be at (1,2). + +

The calculation of rotation is a bit more complex. Currently a +rotation is not stored for each element but rather the rotated element +is stored. In other words if the element from the library has a pin +at (0,0) and (0,2) and it has been rotated by 90 degrees, then the +.pcb file will store (0,0) and (2,0) for the pin locations with +no indication that they have been rotated from the original. + +

In the event that the element has only 1 pin, then the rotation is set +to zero. If the element has only one pad (as opposed to a +through-hole pin), then the rotation of the pad is used. + +

When the element has multiple pins, the location of pin #1 is placed +in the coordinate system which has the centroid of the part at (0,0). +Then which quadrant pin #1 falls in determines the rotation. Zero +degrees of rotation is defined as pin #1 being in the upper left +quadrant. Increasing angles correspond to counterclockwise rotation so a +rotation of 90 degrees places pin #1 in the lower left quadrant. +Currently, the only allowed rotations are 0, 90, 180, and 270 degrees. + +

If pin #1 happens to be at the centroid of the part, then pin #2 is +examined to see which quadrant it is located in. The same rules apply +for the definitions of rotation. In other words, when pin #1 is at +the centroid of the part and pin #2 is in the upper left quadrant, the +rotation is declared to be zero degrees. + + +

+ +


+Next: , +Previous: Centroid File Format, +Up: Top + +
+ +

Appendix F Action Reference

+ +

+ + + +

Many actions take a delta parameter as the last parameter, +which is an amount to change something. That delta may include +units, as an additional parameter, such as Action(Object,5,mm). +If no units are specified, the default is PCB's native units +(currently 1/100 mil). Also, if the delta is prefixed by + or +-, the size is increased or decreased by that amount. +Otherwise, the size size is set to the given amount. + +

     Action(Object,5,mil)
+     Action(Object,+0.5,mm)
+     Action(Object,-1)
+
+

Actions which take a delta parameter which do not accept all +these options will specify what they do take. + + + + +

Many actions act on indicated objects on the board. They will have +parameters like ToggleObject or SelectedVias to indicate +what group of objects they act on. Unless otherwise specified, these +parameters are defined as follows: + +

+
Object
ToggleObject
Affects the object under the mouse pointer. If this action is invoked +from a menu or script, the user will be prompted to click on an +object, which is then the object affected. + +
Selected
SelectedObjects
+Affects all objects which are currently selected. At least, all +selected objects for which the given action makes sense. + +
SelectedPins
SelectedVias
SelectedType
etc
Affects all objects which are both selected and of the Type specified. + +
+ + + +
+ +


+Next: , +Up: Action Reference + +
+ +

F.1 Core actions

+ + +
+ +


+Next: , +Up: core actions + +
+ +

F.1.1 AddRats

+ + +

+
AddRats(AllRats|SelectedRats|Close)
+
+ +

Add one or more rat lines to the board. + + +

+
AllRats
Create rat lines for all loaded nets that aren't already connected on +with copper. + +
SelectedRats
Similarly, but only add rat lines for nets connected to selected pins +and pads. + +
Close
Selects the shortest unselected rat on the board. + +
+ +
+ +


+Next: , +Previous: AddRats Action, +Up: core actions + +
+ +

F.1.2 ApplyVendor

+ + +

+
ApplyVendor()
+
+ +

Applies the currently loaded vendor drill table to the current design. + + +This will modify all of your drill holes to match the list of allowed +sizes for your vendor. + +

+ +


+Next: , +Previous: ApplyVendor Action, +Up: core actions + +
+ +

F.1.3 Atomic

+ + +

+
Atomic(Save|Restore|Close|Block)
+
+ +

Save or restore the undo serial number. + + +

This action allows making multiple-action bindings into an atomic +operation that will be undone by a single Undo command. For example, +to optimize rat lines, you'd delete the rats and re-add them. To +group these into a single undo, you'd want the deletions and the +additions to have the same undo serial number. So, you Save, +delete the rats, Restore, add the rats - using the same serial +number as the deletes, then Block, which checks to see if the +deletions or additions actually did anything. If not, the serial +number is set to the saved number, as there's nothing to undo. If +something did happen, the serial number is incremented so that these +actions are counted as a single undo step. + +

+
Save
Saves the undo serial number. + +
Restore
Returns it to the last saved number. + +
Close
Sets it to 1 greater than the last save. + +
Block
Does a Restore if there was nothing to undo, else does a Close. + +
+ +
+ +


+Next: , +Previous: Atomic Action, +Up: core actions + +
+ +

F.1.4 Attributes

+ + +

+
Attributes(Layout|Layer|Element)
+Attributes(Layer,layername)
+
+ +

Let the user edit the attributes of the layout, current or given +layer, or selected element. + + +

This just pops up a dialog letting the user edit the attributes of the +pcb, an element, or a layer. + +

+ +


+Next: , +Previous: Attributes Action, +Up: core actions + +
+ +

F.1.5 AutoPlaceSelected

+ + +

+
AutoPlaceSelected()
+
+ +

Auto-place selected components. + + +

Attempts to re-arrange the selected components such that the nets +connecting them are minimized. Note that you cannot undo this. + +

+ +


+Next: , +Previous: AutoPlaceSelected Action, +Up: core actions + +
+ +

F.1.6 AutoRoute

+ + +

+
AutoRoute(AllRats|SelectedRats)
+
+ +

Auto-route some or all rat lines. + + +

+
AllRats
Attempt to autoroute all rats. + +
SelectedRats
Attempt to autoroute the selected rats. + +
+ +

Before autorouting, it's important to set up a few things. First, +make sure any layers you aren't using are disabled, else the +autorouter may use them. Next, make sure the current line and via +styles are set accordingly. Last, make sure "new lines clear +polygons" is set, in case you eventually want to add a copper pour. + +

Autorouting takes a while. During this time, the program may not be +responsive. + +

+ +


+Next: , +Previous: AutoRoute Action, +Up: core actions + +
+ +

F.1.7 ChangeClearSize

+ + +

+
ChangeClearSize(Object, delta)
+ChangeClearSize(SelectedPins|SelectedPads|SelectedVias, delta)
+ChangeClearSize(SelectedLines|SelectedArcs, delta
+ChangeClearSize(Selected|SelectedObjects, delta)
+
+ +

Changes the clearance size of objects. + + +

If the solder mask is currently showing, this action changes the +solder mask clearance. If the mask is not showing, this action +changes the polygon clearance. + +

+ +


+Next: , +Previous: ChangeClearSize Action, +Up: core actions + +
+ +

F.1.8 ChangeDrillSize

+ + +

+
ChangeDrillSize(Object, delta)
+ChangeDrillSize(SelectedPins|SelectedVias|Selected|SelectedObjects, delta)
+
+ +

Changes the drilling hole size of objects. + + +

+ +


+Next: , +Previous: ChangeDrillSize Action, +Up: core actions + +
+ +

F.1.9 ChangeFlag

+ + +

+
ChangeFlag(Object|Selected|SelectedObjects, flag, value)
+ChangeFlag(SelectedLines|SelectedPins|SelectedVias, flag, value)
+ChangeFlag(SelectedPads|SelectedTexts|SelectedNames, flag, value)
+ChangeFlag(SelectedElements, flag, value)
+flag = square | octagon | thermal | join
+value = 0 | 1
+
+ +

Sets or clears flags on objects. + + +

Toggles the given flag on the indicated object(s). The flag may be +one of the flags listed above (square, octagon, thermal, join). The +value may be the number 0 or 1. If the value is 0, the flag is +cleared. If the value is 1, the flag is set. + +

+ +


+Next: , +Previous: ChangeFlag Action, +Up: core actions + +
+ +

F.1.10 ChangeHole

+ + +

+
ChangeHole(ToggleObject|Object|SelectedVias|Selected)
+
+ +

Changes the hole flag of objects. + + +

The "hole flag" of a via determines whether the via is a +plated-through hole (not set), or an unplated hole (set). + +

+ +


+Next: , +Previous: ChangeHole Action, +Up: core actions + +
+ +

F.1.11 ChangeJoin

+ + +

+
ChangeJoin(ToggleObject|SelectedLines|SelectedArcs|Selected)
+
+ +

Changes the join (clearance through polygons) of objects. + + +

The join flag determines whether a line or arc, drawn to intersect a +polygon, electrically connects to the polygon or not. When joined, +the line/arc is simply drawn over the polygon, making an electrical +connection. When not joined, a gap is drawn between the line and the +polygon, insulating them from each other. + +

+ +


+Next: , +Previous: ChangeJoin Action, +Up: core actions + +
+ +

F.1.12 ChangeName

+ + +

+
ChangeName(Object)
+ChangeName(Layout|Layer)
+
+ +

Sets the name of objects. + + +

+
Object
Changes the name of the element under the cursor. + +
Layout
Changes the name of the layout. This is printed on the fab drawings. + +
Layer
Changes the name of the currently active layer. + +
+ +
+ +


+Next: , +Previous: ChangeName Action, +Up: core actions + +
+ +

F.1.13 ChangeOctagon

+ + +

+
ChangeOctagon(Object|ToggleObject|SelectedObjects|Selected)
+ChangeOctagon(SelectedElements|SelectedPins|SelectedVias)
+
+ +

Changes the octagon-flag of pins and vias. + + +

Pins, pads, and vias can have various shapes. All may be round. Pins +and pads may be square (obviously "square" pads are usually +rectangular). Pins and vias may be octagonal. When you change a +shape flag of an element, you actually change all of its pins and +pads. + +

Note that the square flag takes precedence over the octagon flag, +thus, if both the square and octagon flags are set, the object is +square. When the square flag is cleared, the pins and pads will be +either round or, if the octagon flag is set, octagonal. + +

+ +


+Next: , +Previous: ChangeOctagon Action, +Up: core actions + +
+ +

F.1.14 ChangePaste

+ + +

+
ChangePaste(ToggleObject|Object|SelectedPads|Selected)
+
+ +

Changes the no paste flag of objects. + + +

The "no paste flag" of a pad determines whether the solderpaste + stencil will have an opening for the pad (no set) or if there wil be + no solderpaste on the pad (set). This is used for things such as + fiducial pads. + +

+ +


+Next: , +Previous: ChangePaste Action, +Up: core actions + +
+ +

F.1.15 ChangePinName

+ + +

+
ChangePinName(ElementName,PinNumber,PinName)
+
+ +

Sets the name of a specific pin on a specific element. + + +

This can be especially useful for annotating pin names from a +schematic to the layout without requiring knowledge of the pcb file +format. + +

     ChangePinName(U3, 7, VCC)
+
+
+ +


+Next: , +Previous: ChangePinName Action, +Up: core actions + +
+ +

F.1.16 ChangeSize

+ + +

+
ChangeSize(Object, delta)
+ChangeSize(SelectedObjects|Selected, delta)
+ChangeSize(SelectedLines|SelectedPins|SelectedVias, delta)
+ChangeSize(SelectedPads|SelectedTexts|SelectedNames, delta)
+ChangeSize(SelectedElements, delta)
+
+ +

Changes the size of objects. + + +

For lines and arcs, this changes the width. For pins and vias, this +changes the overall diameter of the copper annulus. For pads, this +changes the width and, indirectly, the length. For texts and names, +this changes the scaling factor. For elements, this changes the width +of the silk layer lines and arcs for this element. + +

+ +


+Next: , +Previous: ChangeSize Action, +Up: core actions + +
+ +

F.1.17 ChangeSquare

+ + +

+
ChangeSquare(ToggleObject)
+ChangeSquare(SelectedElements|SelectedPins)
+ChangeSquare(Selected|SelectedObjects)
+
+ +

Changes the square flag of pins and pads. + + +

Note that Pins means both pins and pads. + +

Pins, pads, and vias can have various shapes. All may be round. Pins +and pads may be square (obviously "square" pads are usually +rectangular). Pins and vias may be octagonal. When you change a +shape flag of an element, you actually change all of its pins and +pads. + +

Note that the square flag takes precedence over the octagon flag, +thus, if both the square and octagon flags are set, the object is +square. When the square flag is cleared, the pins and pads will be +either round or, if the octagon flag is set, octagonal. + +

+ +


+Next: , +Previous: ChangeSquare Action, +Up: core actions + +
+ +

F.1.18 ClearOctagon

+ + +

+
ClearOctagon(ToggleObject|Object|SelectedObjects|Selected)
+ClearOctagon(SelectedElements|SelectedPins|SelectedVias)
+
+ +

Clears the octagon-flag of pins and vias. + + +

Pins, pads, and vias can have various shapes. All may be round. Pins +and pads may be square (obviously "square" pads are usually +rectangular). Pins and vias may be octagonal. When you change a +shape flag of an element, you actually change all of its pins and +pads. + +

Note that the square flag takes precedence over the octagon flag, +thus, if both the square and octagon flags are set, the object is +square. When the square flag is cleared, the pins and pads will be +either round or, if the octagon flag is set, octagonal. + +

+ +


+Next: , +Previous: ClearOctagon Action, +Up: core actions + +
+ +

F.1.19 ClearSquare

+ + +

+
ClearSquare(ToggleObject|SelectedElements|SelectedPins)
+
+ +

Clears the square-flag of pins and pads. + + +

Note that Pins means pins and pads. + +

Pins, pads, and vias can have various shapes. All may be round. Pins +and pads may be square (obviously "square" pads are usually +rectangular). Pins and vias may be octagonal. When you change a +shape flag of an element, you actually change all of its pins and +pads. + +

Note that the square flag takes precedence over the octagon flag, +thus, if both the square and octagon flags are set, the object is +square. When the square flag is cleared, the pins and pads will be +either round or, if the octagon flag is set, octagonal. + +

+ +


+Next: , +Previous: ClearSquare Action, +Up: core actions + +
+ +

F.1.20 ClrFlag

+ + +

+
ClrFlag(Object|Selected|SelectedObjects, flag)
+ClrFlag(SelectedLines|SelectedPins|SelectedVias, flag)
+ClrFlag(SelectedPads|SelectedTexts|SelectedNames, flag)
+ClrFlag(SelectedElements, flag)
+flag = square | octagon | thermal | join
+
+ +

Clears flags on objects. + + +

Turns the given flag off, regardless of its previous setting. See +ChangeFlag. + +

     ClrFlag(SelectedLines,join)
+
+
+ +


+Next: , +Previous: ClrFlag Action, +Up: core actions + +
+ +

F.1.21 Connection

+ + +

+
Connection(Find|ResetLinesAndPolygons|ResetPinsAndVias|Reset)
+
+ +

Searches connections of the object at the cursor position. + + +

Connections found with this action will be highlighted in the +“connected-color” color and will have the “found” flag set. + +

+
Find
The net under the cursor is “found”. + +
ResetLinesAndPolygons
Any “found” lines and polygons are marked “not found”. + +
ResetPinsAndVias
Any “found” pins and vias are marked “not found”. + +
Reset
All “found” objects are marked “not found”. + +
+ +
+ +


+Next: , +Previous: Connection Action, +Up: core actions + +
+ +

F.1.22 Delete

+ + +

+
Delete(Object|Selected)
+Delete(AllRats|SelectedRats)
+
+ +

Delete stuff. + + +

+ +


+Next: , +Previous: Delete Action, +Up: core actions + +
+ +

F.1.23 DeleteRats

+ + +

+
DeleteRats(AllRats|Selected|SelectedRats)
+
+ +

Delete rat lines. + + +

+ +


+Next: , +Previous: DeleteRats Action, +Up: core actions + +
+ +

F.1.24 DisableVendor

+ + +

+
DisableVendor()
+
+ +

Disables automatic drill size mapping. + + +

+When drill mapping is enabled, new instances of pins and vias will +have their drill holes mapped to one of the allowed drill sizes +specified in the currently loaded vendor drill table. + +

+ +


+Next: , +Previous: DisableVendor Action, +Up: core actions + +
+ +

F.1.25 DisperseElements

+ + +

+
DisperseElements(All|Selected)
+
+ +

Disperses elements. + + +

Normally this is used when starting a board, by selecting all elements +and then dispersing them. This scatters the elements around the board +so that you can pick individual ones, rather than have all the +elements at the same 0,0 coordinate and thus impossible to choose +from. + +

+ +


+Next: , +Previous: DisperseElements Action, +Up: core actions + +
+ +

F.1.26 Display

+ + +

+
Display(NameOnPCB|Description|Value)
+Display(Grid|Redraw)
+Display(CycleClip|CycleCrosshair|Toggle45Degree|ToggleStartDirection)
+Display(ToggleGrid|ToggleRubberBandMode|ToggleUniqueNames)
+Display(ToggleMask|ToggleName|ToggleClearLine|ToggleFullPoly|ToggleSnapPin)
+Display(ToggleThindraw|ToggleThindrawPoly|ToggleOrthoMove|ToggleLocalRef)
+Display(ToggleCheckPlanes|ToggleShowDRC|ToggleAutoDRC)
+Display(ToggleLiveRoute|LockNames|OnlyNames)
+Display(Pinout|PinOrPadName)
+
+ +

Several display-related actions. + + +

+
NameOnPCB
Description
Value
Specify whether all elements show their name, description, or value. + +
Redraw
Redraw the whole board. + +
Toggle45Degree
When clear, lines can be drawn at any angle. When set, lines are +restricted to multiples of 45 degrees and requested lines may be +broken up according to the clip setting. + +
CycleClip
Changes the way lines are restricted to 45 degree increments. The +various settings are: straight only, orthogonal then angled, and angled +then orthogonal. If AllDirections is set, this action disables it. + +
CycleCrosshair
Changes crosshair drawing. Crosshair may accept form of 4-ray, +8-ray and 12-ray cross. + +
ToggleRubberBandMode
If set, moving an object moves all the lines attached to it too. + +
ToggleStartDirection
If set, each time you set a point in a line, the Clip toggles between +orth-angle and angle-ortho. + +
ToggleUniqueNames
If set, you will not be permitted to change the name of an element to +match that of another element. + +
ToggleSnapPin
If set, pin centers and pad end points are treated as additional grid +points that the cursor can snap to. + +
ToggleLocalRef
If set, the mark is automatically set to the beginning of any move, so +you can see the relative distance you've moved. + +
ToggleThindraw
If set, objects on the screen are drawn as outlines (lines are drawn +as center-lines). This lets you see line endpoints hidden under pins, +for example. + +
ToggleThindrawPoly
If set, polygons on the screen are drawn as outlines. + +
ToggleShowDRC
If set, pending objects (i.e. lines you're in the process of drawing) +will be drawn with an outline showing how far away from other copper +you need to be. + +
ToggleLiveRoute
If set, the progress of the autorouter will be visible on the screen. + +
ToggleAutoDRC
If set, you will not be permitted to make connections which violate +the current DRC and netlist settings. + +
ToggleCheckPlanes
If set, lines and arcs aren't drawn, which usually leaves just the +polygons. If you also disable all but the layer you're interested in, +this allows you to check for isolated regions. + +
ToggleOrthoMove
If set, the crosshair is only allowed to move orthogonally from its +previous position. I.e. you can move an element or line up, down, +left, or right, but not up+left or down+right. + +
ToggleName
Selects whether the pinouts show the pin names or the pin numbers. + +
ToggleLockNames
If set, text will ignore left mouse clicks and actions that work on +objects under the mouse. You can still select text with a lasso (left +mouse drag) and perform actions on the selection. + +
ToggleOnlyNames
If set, only text will be sensitive for mouse clicks and actions that +work on objects under the mouse. You can still select other objects +with a lasso (left mouse drag) and perform actions on the selection. + +
ToggleMask
Turns the solder mask on or off. + +
ToggleClearLine
When set, the clear-line flag causes new lines and arcs to have their +“clear polygons” flag set, so they won't be electrically connected +to any polygons they overlap. + +
ToggleFullPoly
When set, the full-poly flag causes new polygons to have their +“full polygon” flag set, so all parts of them will be displayed +instead of only the biggest one. + +
ToggleGrid
Resets the origin of the current grid to be wherever the mouse pointer +is (not where the crosshair currently is). If you provide two numbers +after this, the origin is set to that coordinate. + +
Grid
Toggles whether the grid is displayed or not. + +
Pinout
Causes the pinout of the element indicated by the cursor to be +displayed, usually in a separate window. + +
PinOrPadName
Toggles whether the names of pins, pads, or (yes) vias will be +displayed. If the cursor is over an element, all of its pins and pads +are affected. + +
+ +
+ +


+Next: , +Previous: Display Action, +Up: core actions + +
+ +

F.1.27 djopt

+ + +

+
djopt(debumpify|unjaggy|simple|vianudge|viatrim|orthopull)
+djopt(auto) - all of the above
+djopt(miter)
+
+ +

Perform various optimizations on the current board. + + +

The different types of optimizations change your board in order to +reduce the total trace length and via count. + +

+
debumpify
Looks for U-shaped traces that can be shortened or eliminated. + +
unjaggy
Looks for corners which could be flipped to eliminate one or more +corners (i.e. jaggy lines become simpler). + +
simple
Removing uneeded vias, replacing two or more trace segments in a row +with a single segment. This is usually performed automatically after +other optimizations. + +
vianudge
Looks for vias where all traces leave in the same direction. Tries to +move via in that direction to eliminate one of the traces (and thus a +corner). + +
viatrim
Looks for traces that go from via to via, where moving that trace to a +different layer eliminates one or both vias. + +
orthopull
Looks for chains of traces all going in one direction, with more +traces orthogonal on one side than on the other. Moves the chain in +that direction, causing a net reduction in trace length, possibly +eliminating traces and/or corners. + +
splitlines
Looks for lines that pass through vias, pins, or pads, and splits them +into separate lines so they can be managed separately. + +
auto
Performs the above options, repeating until no further optimizations +can be made. + +
miter
Replaces 90 degree corners with a pair of 45 degree corners, to reduce +RF losses and trace length. + +
+ +
+ +


+Next: , +Previous: djopt Action, +Up: core actions + +
+ +

F.1.28 DRC

+ + +

+
DRC()
+
+ +

Invoke the DRC check. + + +

Note that the design rule check uses the current board rule settings, +not the current style settings. + +

+ +


+Next: , +Previous: DRC Action, +Up: core actions + +
+ +

F.1.29 DumpLibrary

+ + +

+
DumpLibrary()
+
+ +

Display the entire contents of the libraries. + + +

+ +


+Next: , +Previous: DumpLibrary Action, +Up: core actions + +
+ +

F.1.30 elementlist

+ + +

+
ElementList(Start|Done|Need,<refdes>,<footprint>,<value>)
+
+ +

Adds the given element if it doesn't already exist. + + +

+
Start
Indicates the start of an element list; call this before any Need +actions. + +
Need
Searches the board for an element with a matching refdes. + +

If found, the value and footprint are updated. + +

If not found, a new element is created with the given footprint and value. + +

Done
Compares the list of elements needed since the most recent +start with the list of elements actually on the board. Any +elements that weren't listed are selected, so that the user may delete +them. + +
+ +
+ +


+Next: , +Previous: elementlist Action, +Up: core actions + +
+ +

F.1.31 elementsetattr

+ + +

+
ElementSetAttr(refdes,name[,value])
+
+ +

Sets or clears an element-specific attribute. + + +

If a value is specified, the named attribute is added (if not already +present) or changed (if it is) to the given value. If the value is +not specified, the given attribute is removed if present. + +

+ +


+Next: , +Previous: elementsetattr Action, +Up: core actions + +
+ +

F.1.32 EnableVendor

+ + +

+
EnableVendor()
+
+ +

Enables automatic drill size mapping. + + +

+When drill mapping is enabled, new instances of pins and vias will +have their drill holes mapped to one of the allowed drill sizes +specified in the currently loaded vendor drill table. To enable drill +mapping, a vendor resource file containing a drill table must be +loaded first. + +

+ +


+Next: , +Previous: EnableVendor Action, +Up: core actions + +
+ +

F.1.33 execcommand

+ + +

+
ExecCommand(command)
+
+ +

Runs a command. + + +

Runs the given command, which is a system executable. + +

+ +


+Next: , +Previous: execcommand Action, +Up: core actions + +
+ +

F.1.34 ExecuteFile

+ + +

+
ExecuteFile(filename)
+
+ +

Run actions from the given file. + + +

Lines starting with # are ignored. + +

+ +


+Next: , +Previous: ExecuteFile Action, +Up: core actions + +
+ +

F.1.35 Flip

+ + +

+
Flip(Object|Selected|SelectedElements)
+
+ +

Flip an element to the opposite side of the board. + + +

Note that the location of the element will be symmetric about the +cursor location; i.e. if the part you are pointing at will still be at +the same spot once the element is on the other side. When flipping +multiple elements, this retains their positions relative to each +other, not their absolute positions on the board. + +

+ +


+Next: , +Previous: Flip Action, +Up: core actions + +
+ +

F.1.36 FontEdit

+ + +

+
FontEdit()
+
+ +

Convert the current font to a PCB for editing. + + +

+ +


+Next: , +Previous: FontEdit Action, +Up: core actions + +
+ +

F.1.37 FontSave

+ + +

+
FontSave()
+
+ +

Convert the current PCB back to a font. + + +

+ +


+Next: , +Previous: FontSave Action, +Up: core actions + +
+ +

F.1.38 FreeRotateBuffer

+ + +

+
FreeRotateBuffer([Angle])
+
+ +

Rotates the current paste buffer contents by the specified angle. The +angle is given in degrees. If no angle is given, the user is prompted +for one. + + +

Rotates the contents of the pastebuffer by an arbitrary angle. If no +angle is given, the user is prompted for one. + +

+ +


+Next: , +Previous: FreeRotateBuffer Action, +Up: core actions + +
+ +

F.1.39 GlobalPuller

+ + +

+
GlobalPuller()
+
+ +

Pull all traces tight. + + +

+ +


+Next: , +Previous: GlobalPuller Action, +Up: core actions + +
+ +

F.1.40 h

+ + +

+
h
+
+ +

Print a help message for commands. + + +

This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (:) and thus the syntax +is documented for that purpose. + +

+ +


+Next: , +Previous: h Action, +Up: core actions + +
+ +

F.1.41 Import

+ + +

+
Import()
+Import([gnetlist|make[,source,source,...]])
+Import(setnewpoint[,(mark|center|X,Y)])
+Import(setdisperse,D,units)
+
+
+ +

Import schematics. + + +

Imports element and netlist data from the schematics (or some other +source). The first parameter, which is optional, is the mode. If not +specified, the import::mode attribute in the PCB is used. +gnetlist means gnetlist is used to obtain the information from +the schematics. make invokes make, assuming the user +has a Makefile in the current directory. The Makefile +will be invoked with the following variables set: + +

+
PCB
The name of the .pcb file + +
SRCLIST
A space-separated list of source files + +
OUT
The name of the file in which to put the command script, which may +contain any Pcb actions. By default, this is a temporary file +selected by Pcb, but if you specify an import::outfile +attribute, that file name is used instead (and not automatically +deleted afterwards). + +
+ +

The target specified to be built is the first of these that apply: + +

    +
  • The target specified by an import::target attribute. + +
  • The output file specified by an import::outfile attribute. + +
  • If nothing else is specified, the target is pcb_import. + +
+ +

If you specify an import::makefile attribute, then "-f <that +file>" will be added to the command line. + +

If you specify the mode, you may also specify the source files +(schematics). If you do not specify any, the list of schematics is +obtained by reading the import::srcN attributes (like +import::src0, import::src1, etc). + +

For compatibility with future extensions to the import file format, +the generated file must not start with the two characters +#%. + +

If a temporary file is needed the TMPDIR environment variable +is used to select its location. + +

Note that the programs gnetlist and make may be +overridden by the user via the make-program and gnetlist +pcb settings (i.e. in ~/.pcb/settings or on the command +line). + +

If Pcb cannot determine which schematic(s) to import from, the GUI +is called to let user choose (see ImportGUI()). + +

Note that Import() doesn't delete anything - after an Import, elements +which shouldn't be on the board are selected and may be removed once +it's determined that the deletion is appropriate. + +

If Import() is called with setnewpoint, then the location +of new components can be specified. This is where parts show up when +they're added to the board. The default is the center of the board. + +

+
Import(setnewpoint)
+Prompts the user to click on the board somewhere, uses that point. If +called by a hotkey, uses the current location of the crosshair. + +
Import(setnewpoint,mark)
+Uses the location of the mark. If no mark is present, the point is +not changed. + +
Import(setnewpoint,center)
+Resets the point to the center of the board. + +
Import(setnewpoint,X,Y,units)
+Sets the point to the specific coordinates given. Example: +Import(setnewpoint,50,25,mm) + +
+ +

Note that the X and Y locations are stored in attributes named +import::newX and import::newY so you could change them +manually if you wished. + +

Calling Import(setdisperse,D,units) sets how much the newly +placed elements are dispersed relative to the set point. For example, +Import(setdisperse,10,mm) will offset each part randomly up to +10mm away from the point. The default dispersion is 1/10th of the +smallest board dimension. Dispersion is saved in the +import::disperse attribute. + +

+ +


+Next: , +Previous: Import Action, +Up: core actions + +
+ +

F.1.42 l

+ + +

+
l [name]
+
+ +

Loads layout data. + + +

Loads a new datafile (layout) and, if confirmed, overwrites any +existing unsaved data. The filename and the searchpath +(filePath) are passed to the command defined by +fileCommand. If no filename is specified a file select box +will popup. + +

This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (:) and thus the syntax +is documented for that purpose. + +

+ +


+Next: , +Previous: l Action, +Up: core actions + +
+ +

F.1.43 le

+ + +

+
le [name]
+
+ +

Loads an element into the current buffer. + + +

The filename and the searchpath (elementPath) are passed to the +command defined by elementCommand. If no filename is specified +a file select box will popup. + +

This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (:) and thus the syntax +is documented for that purpose. + +

+ +


+Next: , +Previous: le Action, +Up: core actions + +
+ +

F.1.44 LoadFootprint

+ + +

+
LoadFootprint(filename[,refdes,value])
+
+ +

Loads a single footprint by name. + + +

Loads a single footprint by name, rather than by reference or through +the library. If a refdes and value are specified, those are inserted +into the footprint as well. The footprint remains in the paste buffer. + +

+ +


+Next: , +Previous: LoadFootprint Action, +Up: core actions + +
+ +

F.1.45 LoadFrom

+ + +

+
LoadFrom(Layout|LayoutToBuffer|ElementToBuffer|Netlist|Revert,filename)
+
+ +

Load layout data from a file. + + +

This action assumes you know what the filename is. The various GUIs +should have a similar Load action where the filename is +optional, and will provide their own file selection mechanism to let +you choose the file name. + +

+
Layout
Loads an entire PCB layout, replacing the current one. + +
LayoutToBuffer
Loads an entire PCB layout to the paste buffer. + +
ElementToBuffer
Loads the given element file into the paste buffer. Element files +contain only a single Element definition, such as the +“newlib” library uses. + +
Netlist
Loads a new netlist, replacing any current netlist. + +
Revert
Re-loads the current layout from its disk file, reverting any changes +you may have made. + +
+ +
+ +


+Next: , +Previous: LoadFrom Action, +Up: core actions + +
+ +

F.1.46 LoadVendorFrom

+ + +

+
LoadVendorFrom(filename)
+
+ +

Loads the specified vendor resource file. + + +

+

+
filename
Name of the vendor resource file. If not specified, the user will +be prompted to enter one. +
+ +
+ +


+Next: , +Previous: LoadVendorFrom Action, +Up: core actions + +
+ +

F.1.47 m

+ + +

+
m [name]
+
+ +

Loads a layout into the current buffer. + + +

The filename and the searchpath (filePath) are passed to the +command defined by fileCommand. +If no filename is specified a file select box will popup. + +

This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (:) and thus the syntax +is documented for that purpose. + +

+ +


+Next: , +Previous: m Action, +Up: core actions + +
+ +

F.1.48 MarkCrosshair

+ + +

+
MarkCrosshair()
+MarkCrosshair(Center)
+
+ +

Set/Reset the Crosshair mark. + + +

The “mark” is a small X-shaped target on the display which is +treated like a second origin (the normal origin is the upper let +corner of the board). The GUI will display a second set of +coordinates for this mark, which tells you how far you are from it. + +

If no argument is given, the mark is toggled - disabled if it was +enabled, or enabled at the current cursor position of disabled. If +the Center argument is given, the mark is moved to the current +cursor location. + +

+ +


+Next: , +Previous: MarkCrosshair Action, +Up: core actions + +
+ +

F.1.49 Message

+ + +

+
Message(message)
+
+ +

Writes a message to the log window. + + +

This action displays a message to the log window. This action is primarily +provided for use by other programs which may interface with PCB. If +multiple arguments are given, each one is sent to the log window +followed by a newline. + +

+ +


+Next: , +Previous: Message Action, +Up: core actions + +
+ +

F.1.50 MinClearGap

+ + +

+
MinClearGap(delta)
+MinClearGap(Selected, delta)
+
+ +

Ensures that polygons are a minimum distance from objects. + + +

Checks all specified objects, and increases the polygon clearance if +needed to ensure a minimum distance between their edges and the +polygon edges. + +

+ +


+Next: , +Previous: MinClearGap Action, +Up: core actions + +
+ +

F.1.51 MinMaskGap

+ + +

+
MinMaskGap(delta)
+MinMaskGap(Selected, delta)
+
+ +

Ensures the mask is a minimum distance from pins and pads. + + +

Checks all specified pins and/or pads, and increases the mask if +needed to ensure a minimum distance between the pin or pad edge and +the mask edge. + +

+ +


+Next: , +Previous: MinMaskGap Action, +Up: core actions + +
+ +

F.1.52 Mode

+ + +

+
Mode(Arc|Arrow|Copy|InsertPoint|Line|Lock|Move|None|PasteBuffer)
+Mode(Polygon|Rectangle|Remove|Rotate|Text|Thermal|Via)
+Mode(Notify|Release|Cancel|Stroke)
+Mode(Save|Restore)
+
+ +

Change or use the tool mode. + + +

+
Arc
Arrow
Copy
InsertPoint
Line
Lock
Move
None
PasteBuffer
Polygon
Rectangle
Remove
Rotate
Text
Thermal
Via
Select the indicated tool. + +
Notify
Called when you press the mouse button, or move the mouse. + +
Release
Called when you release the mouse button. + +
Cancel
Cancels any pending tool activity, allowing you to restart elsewhere. +For example, this allows you to start a new line rather than attach a +line to the previous line. + +
Escape
Similar to Cancel but calling this action a second time will return +to the Arrow tool. + +
Stroke
If your pcb was built with libstroke, this invokes the stroke +input method. If not, this will restart a drawing mode if you were +drawing, else it will select objects. + +
Save
Remembers the current tool. + +
Restore
Restores the tool to the last saved tool. + +
+ +
+ +


+Next: , +Previous: Mode Action, +Up: core actions + +
+ +

F.1.53 MorphPolygon

+ + +

+
MorphPolygon(Object|Selected)
+
+ +

Converts dead polygon islands into separate polygons. + + +

If a polygon is divided into unconnected "islands", you can use +this command to convert the otherwise disappeared islands into +separate polygons. Be sure the cursor is over a portion of the +polygon that remains visible. Very small islands that may flake +off are automatically deleted. + +

+ +


+Next: , +Previous: MorphPolygon Action, +Up: core actions + +
+ +

F.1.54 MoveLayer

+ + +

+
MoveLayer(old,new)
+
+ +

Moves/Creates/Deletes Layers. + + +

Moves a layer, creates a new layer, or deletes a layer. + +

+
old
The is the layer number to act upon. Allowed values are: +
+
c
Currently selected layer. + +
-1
Create a new layer. + +
number
An existing layer number. + +
+ +
new
Specifies where to move the layer to. Allowed values are: +
+
-1
Deletes the layer. + +
up
Moves the layer up. + +
down
Moves the layer down. + +
c
Creates a new layer. + +
+ +
+ +
+ +


+Next: , +Previous: MoveLayer Action, +Up: core actions + +
+ +

F.1.55 MoveObject

+ + +

+
MoveObject(X,Y,dim)
+
+ +

Moves the object under the crosshair. + + +

The X and Y are treated like delta is for many +other objects. For each, if it's prefixed by + or -, +then that amount is relative. Otherwise, it's absolute. Units can be +mil or mm; if unspecified, units are PCB's internal +units, currently 1/100 mil. + +

+ +


+Next: , +Previous: MoveObject Action, +Up: core actions + +
+ +

F.1.56 MoveToCurrentLayer

+ + +

+
MoveToCurrentLayer(Object|SelectedObjects)
+
+ +

Moves objects to the current layer. + + +

Note that moving an element from a component layer to a solder layer, +or from solder to component, won't automatically flip it. Use the +Flip() action to do that. + +

+ +


+Next: , +Previous: MoveToCurrentLayer Action, +Up: core actions + +
+ +

F.1.57 Netlist

+ + +

+
Net(find|select|rats|norats|clear[,net[,pin]])
+Net(freeze|thaw|forcethaw)
+Net(add,net,pin)
+
+ +

Perform various actions on netlists. + + +

Each of these actions apply to a specified set of nets. net and +pin are patterns which match one or more nets or pins; these +patterns may be full names or regular expressions. If an exact match +is found, it is the only match; if no exact match is found, +then the pattern is tried as a regular expression. + +

If neither net nor pin are specified, all nets apply. If +net is specified but not pin, all nets matching net +apply. If both are specified, nets which match net and contain +a pin matching pin apply. + +

+
find
Nets which apply are marked found and are drawn in the +connected-color color. + +
select
Nets which apply are selected. + +
rats
Nets which apply are marked as available for the rats nest. + +
norats
Nets which apply are marked as not available for the rats nest. + +
clear
Clears the netlist. + +
add
Add the given pin to the given netlist, creating either if needed. + +
sort
Called after a list of add's, this sorts the netlist. + +
freeze
thaw
forcethaw
Temporarily prevents changes to the netlist from being reflected in +the GUI. For example, if you need to make multiple changes, you +freeze the netlist, make the changes, then thaw it. Note that +freeze/thaw requests may nest, with the netlist being fully thawed +only when all pending freezes are thawed. You can bypass the nesting +by using forcethaw, which resets the freeze count and immediately +updates the GUI. + +
+ +
+ +


+Next: , +Previous: Netlist Action, +Up: core actions + +
+ +

F.1.58 New

+ + +

+
New([name])
+
+ +

Starts a new layout. + + +

If a name is not given, one is prompted for. + +

+ +


+Next: , +Previous: New Action, +Up: core actions + +
+ +

F.1.59 OptAutoOnly

+ + +

+
OptAutoOnly()
+
+ +

Toggles the optimize-only-autorouted flag. + + +

The original purpose of the trace optimizer was to clean up the traces +created by the various autorouters that have been used with PCB. When +a board has a mix of autorouted and carefully hand-routed traces, you +don't normally want the optimizer to move your hand-routed traces. +But, sometimes you do. By default, the optimizer only optimizes +autorouted traces. This action toggles that setting, so that you can +optimize hand-routed traces also. + +

+ +


+Next: , +Previous: OptAutoOnly Action, +Up: core actions + +
+ +

F.1.60 PasteBuffer

+ + +

+
PasteBuffer(AddSelected|Clear|1..MAX_BUFFER)
+PasteBuffer(Rotate, 1..3)
+PasteBuffer(Convert|Save|Restore|Mirror)
+PasteBuffer(ToLayout, X, Y, units)
+
+ +

Various operations on the paste buffer. + + +

There are a number of paste buffers; the actual limit is a +compile-time constant MAX_BUFFER in globalconst.h. It +is currently 5. One of these is the “current” paste buffer, +often referred to as “the” paste buffer. + +

+
AddSelected
Copies the selected objects to the current paste buffer. + +
Clear
Remove all objects from the current paste buffer. + +
Convert
Convert the current paste buffer to an element. Vias are converted to +pins, lines are converted to pads. + +
Restore
Convert any elements in the paste buffer back to vias and lines. + +
Mirror
Flip all objects in the paste buffer vertically (up/down flip). To mirror +horizontally, combine this with rotations. + +
Rotate
Rotates the current buffer. The number to pass is 1..3, where 1 means +90 degrees counter clockwise, 2 means 180 degrees, and 3 means 90 +degrees clockwise (270 CCW). + +
Save
Saves any elements in the current buffer to the indicated file. + +
ToLayout
Pastes any elements in the current buffer to the indicated X, Y +coordinates in the layout. The X and Y are treated like +delta is for many other objects. For each, if it's prefixed by ++ or -, then that amount is relative to the last +location. Otherwise, it's absolute. Units can be +mil or mm; if unspecified, units are PCB's internal +units, currently 1/100 mil. + +
1..MAX_BUFFER
Selects the given buffer to be the current paste buffer. + +
+ +
+ +


+Next: , +Previous: PasteBuffer Action, +Up: core actions + +
+ +

F.1.61 Polygon

+ + +

+
Polygon(Close|PreviousPoint)
+
+ +

Some polygon related stuff. + + +

Polygons need a special action routine to make life easier. + +

+
Close
Creates the final segment of the polygon. This may fail if clipping +to 45 degree lines is switched on, in which case a warning is issued. + +
PreviousPoint
Resets the newly entered corner to the previous one. The Undo action +will call Polygon(PreviousPoint) when appropriate to do so. + +
+ +
+ +


+Next: , +Previous: Polygon Action, +Up: core actions + +
+ +

F.1.62 Puller

+ + +

+
Puller()
+
+ +

Pull an arc-line junction tight. + + +

The Puller() action is a special-purpose optimization. When +invoked while the crosshair is over the junction of an arc and a line, +it will adjust the arc's angle and the connecting line's endpoint such +that the line intersects the arc at a tangent. In the example below, +the left side is “before” with the black target marking where to put +the crosshair: + +

Example of how puller works
+ +

The right side is “after” with the black target marking where the +arc-line intersection was moved to. + +

+ +


+Next: , +Previous: Puller Action, +Up: core actions + +
+ +

F.1.63 q

+ + +

+
q
+
+ +

Quits the application after confirming. + + +

If you have unsaved changes, you will be prompted to confirm (or +save) before quitting. + +

This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (:) and thus the syntax +is documented for that purpose. + +

+ + +


+Next: , +Previous: q Action, +Up: core actions + +
+ +

F.1.64 q!

+ + +

+
q!
+
+ +

Quits the application without confirming. + + +

Note that this command neither saves your data nor prompts for +confirmation. + +

This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (:) and thus the syntax +is documented for that purpose. + +

+ +


+Next: , +Previous: q! Action, +Up: core actions + +
+ +

F.1.65 Quit

+ + +

+
Quit()
+
+ +

Quits the application after confirming. + + +

If you have unsaved changes, you will be prompted to confirm (or +save) before quitting. + +

+ +


+Next: , +Previous: Quit Action, +Up: core actions + +
+ +

F.1.66 Redo

+ + +

+
Redo()
+
+ +

Redo recent“undo”operations. + + +

This routine allows you to recover from the last undo command. You +might want to do this if you thought that undo was going to revert +something other than what it actually did (in case you are confused +about which operations are un-doable), or if you have been backing up +through a long undo list and over-shoot your stopping point. Any +change that is made since the undo in question will trim the redo +list. For example if you add ten lines, then undo three of them you +could use redo to put them back, but if you move a line on the board +before performing the redo, you will lose the ability to "redo" the +three "undone" lines. + +

+ +


+Next: , +Previous: Redo Action, +Up: core actions + +
+ +

F.1.67 RemoveSelected

+ + +

+
RemoveSelected()
+
+ +

Removes any selected objects. + + +

+ +


+Next: , +Previous: RemoveSelected Action, +Up: core actions + +
+ +

F.1.68 Renumber

+ + +

+
Renumber()
+Renumber(filename)
+
+ +

Renumber all elements. The changes will be recorded to filename +for use in backannotating these changes to the schematic. + + +

+ +


+Next: , +Previous: Renumber Action, +Up: core actions + +
+ +

F.1.69 Report

+ + +

+
Report(Object|DrillReport|FoundPins|NetLength|AllNetLengths|[,name])
+
+ +

Produce various report. + + +

+
Object
The object under the crosshair will be reported, describing various +aspects of the object. + +
DrillReport
A report summarizing the number of drill sizes used, and how many of +each, will be produced. + +
FoundPins
A report listing all pins and pads which are marked as “found” will +be produced. + +
NetLength
The name and length of the net under the crosshair will be reported to +the message log. + +
AllNetLengths
The name and length of the net under the crosshair will be reported to +the message log. An optional parameter specifies mm, mil, pcb, or in +units + +
+ +
+ +


+Next: , +Previous: Report Action, +Up: core actions + +
+ +

F.1.70 ReportDialog

+ + +

+
ReportDialog()
+
+ +

Report on the object under the crosshair + + +

This is a shortcut for Report(Object). + +

+ +


+Next: , +Previous: ReportDialog Action, +Up: core actions + +
+ +

F.1.71 RipUp

+ + +

+
RipUp(All|Selected|Element)
+
+ +

Ripup auto-routed tracks, or convert an element to parts. + + +

+
All
Removes all lines and vias which were created by the autorouter. + +
Selected
Removes all selected lines and vias which were created by the +autorouter. + +
Element
Converts the element under the cursor to parts (vias and lines). Note +that this uses the highest numbered paste buffer. + +
+ +
+ +


+Next: , +Previous: RipUp Action, +Up: core actions + +
+ +

F.1.72 rn

+ + +

+
rn [name]
+
+ +

Reads netlist. + + +

If no filename is given a file select box will pop up. The file is +read via the command defined by the RatCommand resource. The +command must send its output to stdout. + +

Netlists are used for generating rat's nests (see Rats Nest) and +for verifying the board layout (which is also accomplished by the +Ratsnest command). + +

This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (:) and thus the syntax +is documented for that purpose. + +

+ +


+Next: , +Previous: rn Action, +Up: core actions + +
+ +

F.1.73 RouteStyle

+ + +

+
RouteStyle(1|2|3|4)
+
+ +

Copies the indicated routing style into the current sizes. + + +

+ +


+Next: , +Previous: RouteStyle Action, +Up: core actions + +
+ +

F.1.74 s

+ + +

+
s [name]
+
+ +

Saves layout data. + + +

Data and the filename are passed to the command defined by the +resource saveCommand. It must read the layout data from +stdin. If no filename is entered, either the last one is used +again or, if it is not available, a file select box will pop up. + +

This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (:) and thus the syntax +is documented for that purpose. + +

+ +


+Next: , +Previous: s Action, +Up: core actions + +
+ +

F.1.75 SaveSettings

+ + +

+
SaveSettings()
+SaveSettings(local)
+
+ +

Saves settings. + + +

If you pass no arguments, the settings are stored in +$HOME/.pcb/settings. If you pass the word local they're +saved in ./pcb.settings. + +

+ +


+Next: , +Previous: SaveSettings Action, +Up: core actions + +
+ +

F.1.76 SaveTo

+ + +

+
SaveTo(Layout|LayoutAs,filename)
+SaveTo(AllConnections|AllUnusedPins|ElementConnections,filename)
+SaveTo(PasteBuffer,filename)
+
+ +

Saves data to a file. + + +

+
Layout
Saves the current layout. + +
LayoutAs
Saves the current layout, and remembers the filename used. + +
AllConnections
Save all connections to a file. + +
AllUnusedPins
List all unused pins to a file. + +
ElementConnections
Save connections to the element at the cursor to a file. + +
PasteBuffer
Save the content of the active Buffer to a file. This is the graphical way to create a footprint. + +
+ +
+ +


+Next: , +Previous: SaveTo Action, +Up: core actions + +
+ +

F.1.77 Select

+ + +

+
Select(Object|ToggleObject)
+Select(All|Block|Connection)
+Select(ElementByName|ObjectByName|PadByName|PinByName)
+Select(ElementByName|ObjectByName|PadByName|PinByName, Name)
+Select(TextByName|ViaByName|NetByName)
+Select(TextByName|ViaByName|NetByName, Name)
+Select(Convert)
+
+ +

Toggles or sets the selection. + + +

+
ElementByName
ObjectByName
PadByName
PinByName
TextByName
ViaByName
NetByName
+These all rely on having a regular expression parser built into +pcb. If the name is not specified then the user is prompted +for a pattern, and all objects that match the pattern and are of the +type specified are selected. + +
Object
ToggleObject
Selects the object under the cursor. + +
Block
Selects all objects in a rectangle indicated by the cursor. + +
All
Selects all objects on the board. + +
Connection
Selects all connections with the “found” flag set. + +
Convert
Converts the selected objects to an element. This uses the highest +numbered paste buffer. + +
+ +
+ +


+Next: , +Previous: Select Action, +Up: core actions + +
+ +

F.1.78 SetFlag

+ + +

+
SetFlag(Object|Selected|SelectedObjects, flag)
+SetFlag(SelectedLines|SelectedPins|SelectedVias, flag)
+SetFlag(SelectedPads|SelectedTexts|SelectedNames, flag)
+SetFlag(SelectedElements, flag)
+flag = square | octagon | thermal | join
+
+ +

Sets flags on objects. + + +

Turns the given flag on, regardless of its previous setting. See +ChangeFlag. + +

     SetFlag(SelectedPins,thermal)
+
+
+ +


+Next: , +Previous: SetFlag Action, +Up: core actions + +
+ +

F.1.79 SetOctagon

+ + +

+
SetOctagon(Object|ToggleObject|SelectedElements|Selected)
+
+ +

Sets the octagon-flag of objects. + + +

Pins, pads, and vias can have various shapes. All may be round. Pins +and pads may be square (obviously "square" pads are usually +rectangular). Pins and vias may be octagonal. When you change a +shape flag of an element, you actually change all of its pins and +pads. + +

Note that the square flag takes precedence over the octagon flag, +thus, if both the square and octagon flags are set, the object is +square. When the square flag is cleared, the pins and pads will be +either round or, if the octagon flag is set, octagonal. + +

+ +


+Next: , +Previous: SetOctagon Action, +Up: core actions + +
+ +

F.1.80 SetSame

+ + +

+
SetSame()
+
+ +

Sets current layer and sizes to match indicated item. + + +

When invoked over any line, arc, polygon, or via, this changes the +current layer to be the layer that item is on, and changes the current +sizes (thickness, keepaway, drill, etc) according to that item. + +

+ +


+Next: , +Previous: SetSame Action, +Up: core actions + +
+ +

F.1.81 SetSquare

+ + +

+
SetSquare(ToggleObject|SelectedElements|SelectedPins)
+
+ +

sets the square-flag of objects. + + +

Note that Pins means pins and pads. + +

Pins, pads, and vias can have various shapes. All may be round. Pins +and pads may be square (obviously "square" pads are usually +rectangular). Pins and vias may be octagonal. When you change a +shape flag of an element, you actually change all of its pins and +pads. + +

Note that the square flag takes precedence over the octagon flag, +thus, if both the square and octagon flags are set, the object is +square. When the square flag is cleared, the pins and pads will be +either round or, if the octagon flag is set, octagonal. + +

+ +


+Next: , +Previous: SetSquare Action, +Up: core actions + +
+ +

F.1.82 SetThermal

+ + +

+
SetThermal(Object|SelectedPins|SelectedVias|Selected, Style)
+
+ +

Set the thermal (on the current layer) of pins or vias to the given style. +Style = 0 means no thermal. +Style = 1 has diagonal fingers with sharp edges. +Style = 2 has horizontal and vertical fingers with sharp edges. +Style = 3 is a solid connection to the plane.Style = 4 has diagonal fingers with rounded edges. +Style = 5 has horizontal and vertical fingers with rounded edges. + + +

This changes how/whether pins or vias connect to any rectangle or polygon +on the current layer. The first argument can specify one object, or all +selected pins, or all selected vias, or all selected pins and vias. +The second argument specifies the style of connection. +There are 5 possibilities: +0 - no connection, +1 - 45 degree fingers with sharp edges, +2 - horizontal & vertical fingers with sharp edges, +3 - solid connection, +4 - 45 degree fingers with rounded corners, +5 - horizontal & vertical fingers with rounded corners. + +

Pins and Vias may have thermals whether or not there is a polygon available +to connect with. However, they will have no effect without the polygon. + +

+ +


+Next: , +Previous: SetThermal Action, +Up: core actions + +
+ +

F.1.83 SetValue

+ + +

+
SetValue(Grid|Line|LineSize|Text|TextScale|ViaDrillingHole|Via|ViaSize, delta)
+
+ +

Change various board-wide values and sizes. + + +

+
ViaDrillingHole
Changes the diameter of the drill for new vias. + +
Grid
Sets the grid spacing. + +
Line
LineSize
Changes the thickness of new lines. + +
Via
ViaSize
Changes the diameter of new vias. + +
Text
TextScale
Changes the size of new text. + +
+ +
+ +


+Next: , +Previous: SetValue Action, +Up: core actions + +
+ +

F.1.84 ToggleHideName

+ + +

+
ToggleHideName(Object|SelectedElements)
+
+ +

Toggles the visibility of element names. + + +

If names are hidden you won't see them on the screen and they will not +appear on the silk layer when you print the layout. + +

+ +


+Next: , +Previous: ToggleHideName Action, +Up: core actions + +
+ +

F.1.85 ToggleVendor

+ + +

+
ToggleVendor()
+
+ +

Toggles the state of automatic drill size mapping. + + +

+When drill mapping is enabled, new instances of pins and vias will +have their drill holes mapped to one of the allowed drill sizes +specified in the currently loaded vendor drill table. To enable drill +mapping, a vendor resource file containing a drill table must be +loaded first. + +

+ +


+Next: , +Previous: ToggleVendor Action, +Up: core actions + +
+ +

F.1.86 Undo

+ + +

+
Undo()
+Undo(ClearList)
+
+ +

Undo recent changes. + + +

The unlimited undo feature of Pcb allows you to recover from +most operations that materially affect you work. Calling +Undo() without any parameter recovers from the last (non-undo) +operation. ClearList is used to release the allocated +memory. ClearList is called whenever a new layout is started or +loaded. See also Redo and Atomic. + +

Note that undo groups operations by serial number; changes with the +same serial number will be undone (or redone) as a group. See +Atomic. + +

+ +


+Next: , +Previous: Undo Action, +Up: core actions + +
+ +

F.1.87 UnloadVendor

+ + +

+
UnloadVendor()
+
+ +

Unloads the current vendor drill mapping table. + + +

+ +

+ +


+Next: , +Previous: UnloadVendor Action, +Up: core actions + +
+ +

F.1.88 Unselect

+ + +

+
Unselect(All|Block|Connection)
+Unselect(ElementByName|ObjectByName|PadByName|PinByName)
+Unselect(ElementByName|ObjectByName|PadByName|PinByName, Name)
+Unselect(TextByName|ViaByName)
+Unselect(TextByName|ViaByName, Name)
+
+
+ +

Unselects the object at the pointer location or the specified objects. + + +

+
All
Unselect all objects. + +
Block
Unselect all objects in a rectangle given by the cursor. + +
Connection
Unselect all connections with the “found” flag set. + +
ElementByName
ObjectByName
PadByName
PinByName
TextByName
ViaByName
+These all rely on having a regular expression parser built into +pcb. If the name is not specified then the user is prompted +for a pattern, and all objects that match the pattern and are of the +type specified are unselected. + +
+ +
+ +


+Next: , +Previous: Unselect Action, +Up: core actions + +
+ +

F.1.89 w

+ + +

+
w [name]
+
+ +

Saves layout data. + + +

This commands has been added for the convenience of vi users +and has the same functionality as s. + +

This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (:) and thus the syntax +is documented for that purpose. + +

+ +


+Previous: w Action, +Up: core actions + +
+ +

F.1.90 wq

+ + +

+
wq
+
+ +

Saves the layout data and quits. + + +

This command has been added for the convenience of vi users and +has the same functionality as s combined with q. + +

This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (:) and thus the syntax +is documented for that purpose. + +

+ +


+Next: , +Previous: core actions, +Up: Action Reference + +
+ +

F.2 common actions

+ + + +
+ +


+Next: , +Up: common actions + +
+ +

F.2.1 LayersChanged

+ + +

+
LayersChanged()
+
+ +

Tells the GUI that the layers have changed. + + +

This includes layer names, colors, stacking order, visibility, etc. + +

This is one of a number of actions which are part of the HID +interface. The core functions use these actions to tell the current +GUI when to change the presented information in response to changes +that the GUI may not know about. The user normally does not invoke +these directly. + +

+ +


+Next: , +Previous: LayersChanged Action, +Up: common actions + +
+ +

F.2.2 LibraryChanged

+ + +

+
LibraryChanged()
+
+ +

Tells the GUI that the libraries have changed. + + +

This is one of a number of actions which are part of the HID +interface. The core functions use these actions to tell the current +GUI when to change the presented information in response to changes +that the GUI may not know about. The user normally does not invoke +these directly. + +

+ +


+Next: , +Previous: LibraryChanged Action, +Up: common actions + +
+ +

F.2.3 NetlistChanged

+ + +

+
NetlistChanged()
+
+ +

Tells the GUI that the netlist has changed. + + +

This is one of a number of actions which are part of the HID +interface. The core functions use these actions to tell the current +GUI when to change the presented information in response to changes +that the GUI may not know about. The user normally does not invoke +these directly. + +

+ +

F.2.4 PCBChanged

+ + +

+
PCBChanged([revert])
+
+ +

Tells the GUI that the whole PCB has changed. The optional“revert"parameter can be used as a hint to the GUI that the same design is beingreloaded, and that it might keep some viewport settings + + +

This is one of a number of actions which are part of the HID +interface. The core functions use these actions to tell the current +GUI when to change the presented information in response to changes +that the GUI may not know about. The user normally does not invoke +these directly. + +

+ +


+Previous: PCBChanged Action, +Up: common actions + +
+ +

F.2.5 RouteStylesChanged

+ + +

+
RouteStylesChanged()
+
+ +

Tells the GUI that the routing styles have changed. + + +

This is one of a number of actions which are part of the HID +interface. The core functions use these actions to tell the current +GUI when to change the presented information in response to changes +that the GUI may not know about. The user normally does not invoke +these directly. + +

+ +


+Next: , +Previous: common actions, +Up: Action Reference + +
+ +

F.3 gtk actions

+ + +
+ +


+Next: , +Up: gtk actions + +
+ +

F.3.1 gtk About

+ + +

+
About()
+
+ +

N_("Tell the user about this version of PCB."); + + +

This just pops up a dialog telling the user which version of +pcb they're running. + +

+ +


+Next: , +Previous: gtk About Action, +Up: gtk actions + +
+ +

F.3.2 gtk AdjustStyle

+ + +

+
AdjustStyle()
+
+
+ +

Open the window which allows editing of the route styles. + + +

Opens the window which allows editing of the route styles. + +

+ +


+Next: , +Previous: gtk AdjustStyle Action, +Up: gtk actions + +
+ +

F.3.3 gtk Center

+ + +

+
Center()
+
+
+ +

N_("Moves the pointer to the center of the window."); + + +

Move the pointer to the center of the window, but only if it's +currently within the window already. + +

+ +


+Next: , +Previous: gtk Center Action, +Up: gtk actions + +
+ +

F.3.4 gtk Cursor

+ + +

+
Cursor(Type,DeltaUp,DeltaRight,Units)
+
+ +

N_("Move the cursor."); + + +

This action moves the mouse cursor. Unlike other actions which take +coordinates, this action's coordinates are always relative to the +user's view of the board. Thus, a positive DeltaUp may move the +cursor towards the board origin if the board is inverted. + +

Type is one of ‘Pan’ or ‘Warp’. ‘Pan’ causes the +viewport to move such that the crosshair is under the mouse cursor. +‘Warp’ causes the mouse cursor to move to be above the crosshair. + +

Units can be one of the following: + +

+
mil
mm
The cursor is moved by that amount, in board units. + +
grid
The cursor is moved by that many grid points. + +
view
The values are percentages of the viewport's view. Thus, a pan of +‘100’ would scroll the viewport by exactly the width of the +current view. + +
board
The values are percentages of the board size. Thus, a move of +‘50,50’ moves you halfway across the board. + +
+ +
+ +


+Next: , +Previous: gtk Cursor Action, +Up: gtk actions + +
+ +

F.3.5 gtk DoWindows

+ + +

+
DoWindows(1|2|3|4|5|6)
+DoWindows(Layout|Library|Log|Netlist|Preferences|DRC)
+
+ +

N_("Open various GUI windows."); + + +

+
1
Layout
Open the layout window. Since the layout window is always shown +anyway, this has no effect. + +
2
Library
Open the library window. + +
3
Log
Open the log window. + +
4
Netlist
Open the netlist window. + +
5
Preferences
Open the preferences window. + +
6
DRC
Open the DRC violations window. + +
+ +
+ +


+Next: , +Previous: gtk DoWindows Action, +Up: gtk actions + +
+ +

F.3.6 gtk EditLayerGroups

+ + +

+
EditLayerGroups()
+
+
+ +

Open the preferences window which allows editing of the layer groups. + + +

Opens the preferences window which is where the layer groups +are edited. This action is primarily provides to provide menu +resource compatibility with the lesstif HID. + +

+ +


+Next: , +Previous: gtk EditLayerGroups Action, +Up: gtk actions + +
+ +

F.3.7 gtk GetXY

+ + +

+
GetXY()
+
+ +

N_("Get a coordinate."); + + +

Prompts the user for a coordinate, if one is not already selected. + +

+ +


+Next: , +Previous: gtk GetXY Action, +Up: gtk actions + +
+ +

F.3.8 gtk ImportGUI

+ + +

+
ImportGUI()
+
+ +

N_("Asks user which schematics to import into PCB. +"); + + +

Asks user which schematics to import into PCB. + +

+ +


+Next: , +Previous: gtk ImportGUI Action, +Up: gtk actions + +
+ +

F.3.9 gtk Pan

+ + +

+
Pan([thumb], Mode)
+
+ +

N_("Start or stop panning (Mode = 1 to start, 0 to stop) +Optional thumb argument is ignored for now in gtk hid. +"); + + +

Start or stop panning. To start call with Mode = 1, to stop call with +Mode = 0. + +

+ +


+Next: , +Previous: gtk Pan Action, +Up: gtk actions + +
+ +

F.3.10 gtk Popup

+ + +

+
Popup(MenuName, [Button])
+
+ +

N_("Bring up the popup menu specified by MenuName. +If called by a mouse event then the mouse button number +must be specified as the optional second argument."); + + +

This just pops up the specified menu. The menu must have been defined +as a named subresource of the Popups resource in the menu resource +file. + +

+ +


+Next: , +Previous: gtk Popup Action, +Up: gtk actions + +
+ +

F.3.11 gtk Print

+ + +

+
Print()
+
+ +

N_("Print the layout."); + + +

This will find the default printing HID, prompt the user for its +options, and print the layout. + +

+ +


+Next: , +Previous: gtk Print Action, +Up: gtk actions + +
+ +

F.3.12 gtk PrintCalibrate

+ + +

+
PrintCalibrate()
+
+ +

N_("Calibrate the printer."); + + +

This will print a calibration page, which you would measure and type +the measurements in, so that future printouts will be more precise. + +

+ +


+Next: , +Previous: gtk PrintCalibrate Action, +Up: gtk actions + +
+ +

F.3.13 gtk Save

+ + +

+
Save()
+Save(Layout|LayoutAs)
+Save(AllConnections|AllUnusedPins|ElementConnections)
+Save(PasteBuffer)
+
+ +

N_("Save layout and/or element data to a user-selected file."); + + +

This action is a GUI front-end to the core's SaveTo action +(see SaveTo Action). If you happen to pass a filename, like +SaveTo, then SaveTo is called directly. Else, the +user is prompted for a filename to save, and then SaveTo is +called with that filename. + +

+ +


+Next: , +Previous: gtk Save Action, +Up: gtk actions + +
+ +

F.3.14 gtk SelectLayer

+ + +

+
SelectLayer(1..MAXLAYER|Silk|Rats)
+
+ +

Select which layer is the current layer. + + +

The specified layer becomes the currently active layer. It is made +visible if it is not already visible + +

+ +


+Next: , +Previous: gtk SelectLayer Action, +Up: gtk actions + +
+ +

F.3.15 gtk SetUnits

+ + +

+
SetUnits(mm|mil)
+
+ +

N_("Set the default measurement units."); + + +

+
mil
Sets the display units to mils (1/1000 inch). + +
mm
Sets the display units to millimeters. + +
+ +
+ +


+Next: , +Previous: gtk SetUnits Action, +Up: gtk actions + +
+ +

F.3.16 gtk SwapSides

+ + +

+
SwapSides(|v|h|r)
+
+ +

N_("Swaps the side of the board you're looking at."); + + +

This action changes the way you view the board. + +

+
v
Flips the board over vertically (up/down). + +
h
Flips the board over horizontally (left/right), like flipping pages in +a book. + +
r
Rotates the board 180 degrees without changing sides. + +
+ +

If no argument is given, the board isn't moved but the opposite side +is shown. + +

Normally, this action changes which pads and silk layer are drawn as +true silk, and which are drawn as the "invisible" layer. It also +determines which solder mask you see. + +

As a special case, if the layer group for the side you're looking at +is visible and currently active, and the layer group for the opposite +is not visible (i.e. disabled), then this action will also swap which +layer group is visible and active, effectively swapping the “working +side” of the board. + +

+ +


+Next: , +Previous: gtk SwapSides Action, +Up: gtk actions + +
+ +

F.3.17 gtk ToggleView

+ + +

+
ToggleView(1..MAXLAYER)
+ToggleView(layername)
+ToggleView(Silk|Rats|Pins|Vias|Mask|BackSide)
+
+ +

Toggle the visibility of the specified layer or layer group. + + +

If you pass an integer, that layer is specified by index (the first +layer is 1, etc). If you pass a layer name, that layer is +specified by name. When a layer is specified, the visibility of the +layer group containing that layer is toggled. + +

If you pass a special layer name, the visibility of those components +(silk, rats, etc) is toggled. Note that if you have a layer named +the same as a special layer, the layer is chosen over the special layer. + +

+ +


+Previous: gtk ToggleView Action, +Up: gtk actions + +
+ +

F.3.18 gtk Zoom

+ + +

+
Zoom()
+Zoom(factor)
+
+ +

N_("Various zoom factor changes."); + +Changes the zoom (magnification) of the view of the board. If no +arguments are passed, the view is scaled such that the board just fits +inside the visible window (i.e. “view all”). Otherwise, +factor specifies a change in zoom factor. It may be prefixed by ++, -, or = to change how the zoom factor is +modified. The factor is a floating point number, such as +1.5 or 0.75. + +

+ +
+factor
Values greater than 1.0 cause the board to be drawn smaller; more of +the board will be visible. Values between 0.0 and 1.0 cause the board +to be drawn bigger; less of the board will be visible. + +
-factor
Values greater than 1.0 cause the board to be drawn bigger; less of +the board will be visible. Values between 0.0 and 1.0 cause the board +to be drawn smaller; more of the board will be visible. + +
=factor
+The factor is an absolute zoom factor; the unit for this value +is "PCB units per screen pixel". Since PCB units are 0.01 mil, a +factor of 1000 means 10 mils (0.01 in) per pixel, or 100 DPI, +about the actual resolution of most screens - resulting in an "actual +size" board. Similarly, a factor of 100 gives you a 10x actual +size. + +
+ +

Note that zoom factors of zero are silently ignored. + +

+ +


+Previous: gtk actions, +Up: Action Reference + +
+ +

F.4 lesstif actions

+ + + + +

F.4.1 lesstif About

+ + +

+
About()
+
+ +

Tell the user about this version of PCB. + + +

This just pops up a dialog telling the user which version of +pcb they're running. + +

+ +

F.4.2 lesstif AdjustSizes

+ + +

+
AdjustSizes()
+
+ +

Let the user change the board size, DRC parameters, etc + + +

Displays a dialog box that lets the user change the board +size, DRC parameters, and text scale. + +

The units are determined by the default display units. + +

+ +

F.4.3 lesstif AdjustStyle

+ + +

+
AdjustStyle()
+
+ +

Displays the route style adjustment window. + + +

+ +

F.4.4 lesstif Benchmark

+ + +

+
Benchmark()
+
+ +

Benchmark the GUI speed. + + +

This action is used to speed-test the Lesstif graphics subsystem. It +redraws the current screen as many times as possible in ten seconds. +It reports the amount of time needed to draw the screen once. + +

+ +

F.4.5 lesstif Command

+ + +

+
Command()
+
+ +

Displays the command line input window. + + +

The command window allows the user to manually enter actions to be +executed. Action syntax can be done one of two ways: + +

+
Follow the action name by an open parenthesis, arguments separated by +commas, end with a close parenthesis. Example: Abc(1,2,3) + +
Separate the action name and arguments by spaces. Example: Abc +1 2 3. + +
+ +

The first option allows you to have arguments with spaces in them, +but the second is more “natural” to type for most people. + +

Note that action names are not case sensitive, but arguments normally +are. However, most actions will check for “keywords” in a case +insensitive way. + +

There are three ways to finish with the command window. If you press +the Enter key, the command is invoked, the window goes away, +and the next time you bring up the command window it's empty. If you +press the Esc key, the window goes away without invoking +anything, and the next time you bring up the command window it's +empty. If you change focus away from the command window (i.e. click +on some other window), the command window goes away but the next time +you bring it up it resumes entering the command you were entering +before. + +

+ +


+Next: , +Previous: lesstif Command Action, +Up: lesstif actions + +
+ +

F.4.6 lesstif Cursor

+ + +

+
Cursor(Type,DeltaUp,DeltaRight,Units)
+
+ +

Move the cursor. + + +

This action moves the mouse cursor. Unlike other actions which take +coordinates, this action's coordinates are always relative to the +user's view of the board. Thus, a positive DeltaUp may move the +cursor towards the board origin if the board is inverted. + +

Type is one of ‘Pan’ or ‘Warp’. ‘Pan’ causes the +viewport to move such that the crosshair is under the mouse cursor. +‘Warp’ causes the mouse cursor to move to be above the crosshair. + +

Units can be one of the following: + +

+
mil
mm
The cursor is moved by that amount, in board units. + +
grid
The cursor is moved by that many grid points. + +
view
The values are percentages of the viewport's view. Thus, a pan of +‘100’ would scroll the viewport by exactly the width of the +current view. + +
board
The values are percentages of the board size. Thus, a move of +‘50,50’ moves you halfway across the board. + +
+ +
+ +


+Next: , +Previous: lesstif Cursor Action, +Up: lesstif actions + +
+ +

F.4.7 lesstif Debug

+ + +

+
Debug(...)
+
+ +

Debug action. + + +

This action exists to help debug scripts; it simply prints all its +arguments to stdout. + +

+ +

F.4.8 lesstif DebugXY

+ + +

+
DebugXY(...)
+
+ +

Debug action, with coordinates + + +

Like Debug, but requires a coordinate. If the user hasn't yet +indicated a location on the board, the user will be prompted to click +on one. + +

+ +

F.4.9 lesstif DoWindows

+ + +

+
DoWindows(1|2|3|4)
+DoWindows(Layout|Library|Log|Netlist)
+
+ +

Open various GUI windows. + + +

+
1
Layout
Open the layout window. Since the layout window is always shown +anyway, this has no effect. + +
2
Library
Open the library window. + +
3
Log
Open the log window. + +
4
Netlist
Open the netlist window. + +
+ + + +

F.4.10 lesstif DumpKeys

+ + +

+
DumpKeys()
+
+ +

Dump Lesstif key bindings. + + +

Causes the list of key bindings (from pcb-menu.res) to be +dumped to stdout. This is most useful when invoked from the command +line like this: + +

     pcb --action-string DumpKeys
+
+ + +

F.4.11 lesstif EditLayerGroups

+ + +

+
EditLayerGroups()
+
+ +

Let the user change the layer groupings + + +

Displays a dialog that lets the user view and change the layer +groupings. Each layer (row) can be a member of any one layer group +(column). Note the special layers solder and component +allow you to specify which groups represent the top and bottom of the +board. + +

See ChangeName Action. + +

+ +

F.4.12 lesstif Export

+ + +

+
Export()
+
+ +

Export the layout. + + +

Prompts the user for an exporter to use. Then, prompts the user for +that exporter's options, and exports the layout. + +

+ +

F.4.13 lesstif GetXY

+ + +

+
GetXY()
+
+ +

Get a coordinate. + + +

Prompts the user for a coordinate, if one is not already selected. + +

+ +

F.4.14 lesstif ImportGUI

+ + +

+
ImportGUI()
+
+ +

Lets the user choose the schematics to import from + + +

Displays a dialog that lets the user select the schematic(s) to import +from, then saves that information in the layout's attributes for +future imports. + +

+ +


+Next: , +Previous: lesstif ImportGUI Action, +Up: lesstif actions + +
+ +

F.4.15 lesstif LibraryShow

+ + +

+
LibraryShow()
+
+ +

Displays the library window. + + +

+ +

F.4.16 lesstif Load

+ + +

+
Load()
+Load(Layout|LayoutToBuffer|ElementToBuffer|Netlist|Revert)
+
+ +

Load layout data from a user-selected file. + + +

This action is a GUI front-end to the core's LoadFrom action +(see LoadFrom Action). If you happen to pass a filename, like +LoadFrom, then LoadFrom is called directly. Else, the +user is prompted for a filename to load, and then LoadFrom is +called with that filename. + +

+ +

F.4.17 lesstif LoadVendor

+ + +

+
LoadVendor()
+
+ +

Loads a user-selected vendor resource file. + + +

The user is prompted for a file to load, and then +LoadVendorFrom is called (see LoadVendorFrom Action) to +load that vendor file. + +

+ +

F.4.18 lesstif NetlistShow

+ + +

+
NetlistShow(pinname|netname)
+
+ +

Selects the given pinname or netname in the netlist window. + + +

+ +

F.4.19 lesstif Print

+ + +

+
Print()
+
+ +

Print the layout. + + +

This will find the default printing HID, prompt the user for its +options, and print the layout. + +

+ +

F.4.20 lesstif PrintCalibrate

+ + +

+
PrintCalibrate()
+
+ +

Calibrate the printer. + + +

This will print a calibration page, which you would measure and type +the measurements in, so that future printouts will be more precise. + +

+ +

F.4.21 lesstif PromptFor

+ + +

+
PromptFor([message[,default]])
+
+ +

Prompt for a response. + + +

This is mostly for testing the lesstif HID interface. The parameters +are passed to the prompt_for() HID function, causing the user +to be prompted for a response. The respose is simply printed to the +user's stdout. + +

+ +


+Next: , +Previous: lesstif PromptFor Action, +Up: lesstif actions + +
+ +

F.4.22 lesstif Return

+ + +

+
Return(0|1)
+
+ +

Simulate a passing or failing action. + + +

This is for testing. If passed a 0, does nothing and succeeds. If +passed a 1, does nothing but pretends to fail. + +

+ +

F.4.23 lesstif Save

+ + +

+
Save()
+Save(Layout|LayoutAs)
+Save(AllConnections|AllUnusedPins|ElementConnections)
+Save(PasteBuffer)
+
+ +

Save layout data to a user-selected file. + + +

This action is a GUI front-end to the core's SaveTo action +(see SaveTo Action). If you happen to pass a filename, like +SaveTo, then SaveTo is called directly. Else, the +user is prompted for a filename to save, and then SaveTo is +called with that filename. + +

+ +


+Next: , +Previous: lesstif Save Action, +Up: lesstif actions + +
+ +

F.4.24 lesstif SelectLayer

+ + +

+
SelectLayer(1..MAXLAYER|Silk|Rats)
+
+ +

Select which layer is the current layer. + + +

The specified layer becomes the currently active layer. It is made +visible if it is not already visible + +

+ +

F.4.25 lesstif SetUnits

+ + +

+
SetUnits(mm|mil)
+
+ +

Set the default measurement units. + + +

+
mil
Sets the display units to mils (1/1000 inch). + +
mm
Sets the display units to millimeters. + +
+ + + +

F.4.26 lesstif SwapSides

+ + +

+
SwapSides(|v|h|r)
+
+ +

Swaps the side of the board you're looking at. + + +

This action changes the way you view the board. + +

+
v
Flips the board over vertically (up/down). + +
h
Flips the board over horizontally (left/right), like flipping pages in +a book. + +
r
Rotates the board 180 degrees without changing sides. + +
+ +

If no argument is given, the board isn't moved but the opposite side +is shown. + +

Normally, this action changes which pads and silk layer are drawn as +true silk, and which are drawn as the "invisible" layer. It also +determines which solder mask you see. + +

As a special case, if the layer group for the side you're looking at +is visible and currently active, and the layer group for the opposite +is not visible (i.e. disabled), then this action will also swap which +layer group is visible and active, effectively swapping the “working +side” of the board. + +

+ +


+Next: , +Previous: lesstif SwapSides Action, +Up: lesstif actions + +
+ +

F.4.27 lesstif ToggleView

+ + +

+
ToggleView(1..MAXLAYER)
+ToggleView(layername)
+ToggleView(Silk|Rats|Pins|Vias|Mask|BackSide)
+
+ +

Toggle the visibility of the specified layer or layer group. + + +

If you pass an integer, that layer is specified by index (the first +layer is 1, etc). If you pass a layer name, that layer is +specified by name. When a layer is specified, the visibility of the +layer group containing that layer is toggled. + +

If you pass a special layer name, the visibility of those components +(silk, rats, etc) is toggled. Note that if you have a layer named +the same as a special layer, the layer is chosen over the special layer. + +

+ +


+Previous: lesstif ToggleView Action, +Up: lesstif actions + +
+ +

F.4.28 lesstif Zoom

+ + +

+
Zoom()
+Zoom(factor)
+
+ +

Various zoom factor changes. + + +

Changes the zoom (magnification) of the view of the board. If no +arguments are passed, the view is scaled such that the board just fits +inside the visible window (i.e. “view all”). Otherwise, +factor specifies a change in zoom factor. It may be prefixed by ++, -, or = to change how the zoom factor is +modified. The factor is a floating point number, such as +1.5 or 0.75. + +

+
+factor
Values greater than 1.0 cause the board to be drawn smaller; more of +the board will be visible. Values between 0.0 and 1.0 cause the board +to be drawn bigger; less of the board will be visible. + +
-factor
Values greater than 1.0 cause the board to be drawn bigger; less of +the board will be visible. Values between 0.0 and 1.0 cause the board +to be drawn smaller; more of the board will be visible. + +
=factor
+The factor is an absolute zoom factor; the unit for this value +is "PCB units per screen pixel". Since PCB units are 0.01 mil, a +factor of 1000 means 10 mils (0.01 in) per pixel, or 100 DPI, +about the actual resolution of most screens - resulting in an "actual +size" board. Similarly, a factor of 100 gives you a 10x actual +size. + +
+ +

Note that zoom factors of zero are silently ignored. + + +

+ +


+Next: , +Previous: Action Reference, +Up: Top + +
+ +

Appendix G Glossary

+ +

+

+
Footprint
The pattern of metal, silkscreen, soldermask relief, and drills which +defines where you place a component on a circuit board. +Footprints are the placed by the user onto the PC board during the +placement phase of PCB layout. + +
Gerber File
The file format used in the industry to convey a board database to the +manufacturer is RS-274X (which replaces the now obsolete RS-274D +format). This file format was originally developed by Gerber for +their photo plotters and thus RS-274D and RS-274X format files +are often times refered to as “Gerber” files. + +
Thermal, Thermal Relief
A thermal relief is a way of connecting a pin to a ground +or power plane. Instead of directly connecting to the plane, small "spokes" +are used to increase the thermal resistance between the pin and the plane. +Often times these connections are refered to as simply a thermal. By increasing +the thermal resistance to the plane, it becomes easier to solder to the +pin. In the drawing below, the pin on the left is connected to the +polygon using a solid connection with no thermal relief, the middle +pin is connected using a thermal, while the pin on the right has no +connection to the polygon. In PCB, the “Thermal” Tool is used to +make both a solid connection and one with thermal relief (see Polygon Objects). + +
Example of a thermal relief
+ +
+ + +
+ +


+Previous: Glossary, +Up: Top + +
+ +

Index of Resources

+ +

Index of Actions, Commands and Options

+ + + +

Index of Concepts

+ + + + +
+

Table of Contents

+ +
+ + + Index: 1.0.8/doc-orig/pcb.info =================================================================== --- 1.0.8/doc-orig/pcb.info (nonexistent) +++ 1.0.8/doc-orig/pcb.info (revision 1136) @@ -0,0 +1,326 @@ +This is pcb.info, produced by makeinfo version 4.13 from pcb.texi. + +INFO-DIR-SECTION Miscellaneous +START-INFO-DIR-ENTRY +* pcb: (pcb). An interactive printed circuit board editor. +END-INFO-DIR-ENTRY + + This file documents how to use Pcb, the open source, interactive +printed circuit board layout system. + + Copyright (C) 1994,1995,1996, 2004 Thomas Nau + + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 harry eaton + + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009 Dan McMahill + + Copyright (C) 2004 DJ Delorie + + This program is free software; you may 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 +MERCHANT-ABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + + +Indirect: +pcb.info-1: 1021 +pcb.info-2: 300750 + +Tag Table: +(Indirect) +Node: Top1021 +Node: Copying2396 +Node: History3068 +Node: Overview7954 +Node: Intro8775 +Node: Symbol Objects10256 +Node: Via Objects10836 +Node: Element Objects11854 +Node: Layer Objects18737 +Node: Line Objects21889 +Node: Arc Objects24857 +Node: Polygon Objects26305 +Node: Text Objects28934 +Node: Net Objects29749 +Node: Getting Started30679 +Node: Application Window32927 +Node: Menu33576 +Node: Status-line and Input-field42616 +Node: Layer Controls45891 +Node: Tool Selectors49569 +Node: Layout Area56271 +Node: Log Window57139 +Node: Library Window57973 +Node: Netlist Window59217 +Node: Drawing and Removing60811 +Node: Common62955 +Node: Lines64804 +Node: Arcs66368 +Node: Polygons67551 +Node: Text69438 +Node: Vias70423 +Node: Elements71799 +Node: Pastebuffer77269 +Node: Moving and Copying79091 +Node: Loading and Saving80502 +Node: Printing82110 +Node: Exporting86518 +Node: bom86973 +Node: gcode87161 +Node: gerber90012 +Node: nelma90212 +Node: png90364 +Node: ps90508 +Node: eps90677 +Node: Connection Lists90914 +Node: Arrow Tool92720 +Node: Rats Nest94951 +Node: Design Rule Checking100036 +Node: Trace Optimizer102401 +Node: Searching for elements103945 +Node: Measuring distances104446 +Node: Vendor drill mapping105169 +Node: Autorouter108407 +Node: User Commands111745 +Node: Command-Line Options115952 +Node: General Options117224 +Node: General GUI Options119187 +Node: GTK+ GUI Options120305 +Node: lesstif GUI Options120881 +Node: Colors121452 +Node: Layer Names123460 +Node: Paths124209 +Node: Sizes125057 +Node: Commands126692 +Node: DRC Options128043 +Node: BOM Creation128812 +Node: Gerber Export129132 +Node: Postscript Export129494 +Node: Encapsulated Postscript Export131251 +Node: PNG Options131805 +Node: lpr Printing Options133335 +Node: nelma Options133771 +Node: X11 Interface134197 +Node: Resources134665 +Node: Actions150194 +Node: Translations177398 +Node: File Formats178937 +Node: Pad and Line Representation180586 +Node: Layout File181568 +Node: Element File183083 +Node: Font File184124 +Node: Netlist File184505 +Node: Library Contents File185786 +Node: Library File186841 +Node: File Syntax189295 +Node: Arc syntax190661 +Node: Attribute syntax191870 +Node: Connect syntax192381 +Node: Cursor syntax192734 +Node: DRC syntax193207 +Node: Element syntax193698 +Node: ElementArc syntax195640 +Node: ElementLine syntax196598 +Node: FileVersion syntax197051 +Node: Flags syntax197549 +Node: Grid syntax197844 +Node: Groups syntax198336 +Node: Layer syntax198925 +Node: Line syntax199448 +Node: Mark syntax200109 +Node: Net syntax200372 +Node: Netlist syntax200649 +Node: Pad syntax200810 +Node: PCB syntax201766 +Node: Pin syntax202100 +Node: PolyArea syntax202899 +Node: Polygon syntax203253 +Node: Rat syntax203744 +Node: Styles syntax204125 +Node: Symbol syntax205071 +Node: SymbolLine syntax205457 +Node: Text syntax205755 +Node: Thermal syntax206463 +Node: Via syntax206875 +Node: Object Flags207549 +Node: PCBFlags210352 +Node: Library Creation211816 +Node: Schematic Frontends230358 +Node: gEDA231140 +Node: xcircuit239834 +Node: Installation240128 +Node: compiling240659 +Node: quickstart240981 +Node: running configure241377 +Node: problems242549 +Node: HP243984 +Node: Sun244645 +Node: SGI245002 +Node: DEC Alpha245317 +Node: SCO245488 +Node: Linux245969 +Node: BSD246164 +Node: X11246547 +Node: TeX and Manuals247359 +Node: Custom Menus247863 +Node: Resource Syntax248429 +Node: Menu Definitions250770 +Node: Menu Files and Defaults253429 +Node: Regular Expressions254235 +Node: Standard Drill Sizes258031 +Node: Centroid File Format268079 +Node: Action Reference270931 +Node: core actions272542 +Node: AddRats Action278476 +Node: ApplyVendor Action278945 +Node: Atomic Action279277 +Node: Attributes Action280430 +Node: AutoPlaceSelected Action280843 +Node: AutoRoute Action281201 +Node: ChangeClearSize Action281951 +Node: ChangeDrillSize Action282518 +Node: ChangeFlag Action282839 +Node: ChangeHole Action283565 +Node: ChangeJoin Action283926 +Node: ChangeName Action284520 +Node: ChangeOctagon Action284965 +Node: ChangePaste Action285822 +Node: ChangePinName Action286296 +Node: ChangeSize Action286734 +Node: ChangeSquare Action287479 +Node: ClearOctagon Action288372 +Node: ClearSquare Action289225 +Node: ClrFlag Action290052 +Node: Connection Action290573 +Node: Delete Action291236 +Node: DeleteRats Action291445 +Node: DisableVendor Action291658 +Node: DisperseElements Action292071 +Node: Display Action292575 +Node: djopt Action297281 +Node: DRC Action299027 +Node: DumpLibrary Action299290 +Node: elementlist Action299501 +Node: elementsetattr Action300299 +Node: EnableVendor Action300750 +Node: execcommand Action301253 +Node: ExecuteFile Action301508 +Node: Flip Action301756 +Node: FontEdit Action302305 +Node: FontSave Action302503 +Node: FreeRotateBuffer Action302706 +Node: GlobalPuller Action303175 +Node: h Action303370 +Node: Import Action303773 +Node: l Action307425 +Node: le Action308057 +Node: LoadFootprint Action308640 +Node: LoadFrom Action309082 +Node: LoadVendorFrom Action310064 +Node: m Action310399 +Node: MarkCrosshair Action310983 +Node: Message Action311681 +Node: MinClearGap Action312120 +Node: MinMaskGap Action312533 +Node: Mode Action312939 +Node: MorphPolygon Action314180 +Node: MoveLayer Action314706 +Node: MoveObject Action315408 +Node: MoveToCurrentLayer Action315895 +Node: Netlist Action316318 +Node: New Action318068 +Node: OptAutoOnly Action318281 +Node: PasteBuffer Action318940 +Node: Polygon Action320762 +Node: Puller Action321345 +Node: q Action322053 +Node: q! Action322543 +Node: Quit Action323025 +Node: Redo Action323286 +Node: RemoveSelected Action324092 +Node: Renumber Action324297 +Node: Report Action324598 +Node: ReportDialog Action325457 +Node: RipUp Action325709 +Node: rn Action326243 +Node: RouteStyle Action326975 +Node: s Action327191 +Node: SaveSettings Action327844 +Node: SaveTo Action328187 +Node: Select Action328910 +Node: SetFlag Action330064 +Node: SetOctagon Action330579 +Node: SetSame Action331351 +Node: SetSquare Action331765 +Node: SetThermal Action332574 +Node: SetValue Action333855 +Node: ToggleHideName Action334413 +Node: ToggleVendor Action334787 +Node: Undo Action335296 +Node: UnloadVendor Action335975 +Node: Unselect Action336190 +Node: w Action337131 +Node: wq Action337623 +Node: common actions338118 +Node: LayersChanged Action338783 +Node: LibraryChanged Action339342 +Node: NetlistChanged Action339865 +Node: PCBChanged Action340382 +Node: RouteStylesChanged Action341049 +Node: gtk actions341560 +Node: gtk About Action343137 +Node: gtk AdjustStyle Action343408 +Node: gtk Center Action343708 +Node: gtk Cursor Action344031 +Node: gtk DoWindows Action345156 +Node: gtk EditLayerGroups Action345781 +Node: gtk GetXY Action346222 +Node: gtk ImportGUI Action346486 +Node: gtk Pan Action346761 +Node: gtk Popup Action347126 +Node: gtk Print Action347610 +Node: gtk PrintCalibrate Action347900 +Node: gtk Save Action348262 +Node: gtk SelectLayer Action348861 +Node: gtk SetUnits Action349214 +Node: gtk SwapSides Action349549 +Node: gtk ToggleView Action350615 +Node: gtk Zoom Action351395 +Node: lesstif actions352831 +Node: lesstif About Action354739 +Node: lesstif AdjustSizes Action355023 +Node: lesstif AdjustStyle Action355446 +Node: lesstif Benchmark Action355702 +Node: lesstif Command Action356134 +Node: lesstif Cursor Action357551 +Node: lesstif Debug Action358690 +Node: lesstif DebugXY Action358980 +Node: lesstif DoWindows Action359351 +Node: lesstif DumpKeys Action359866 +Node: lesstif EditLayerGroups Action360283 +Node: lesstif Export Action360854 +Node: lesstif GetXY Action361189 +Node: lesstif ImportGUI Action361463 +Node: lesstif LibraryShow Action361872 +Node: lesstif Load Action362108 +Node: lesstif LoadVendor Action362682 +Node: lesstif NetlistShow Action363070 +Node: lesstif Print Action363354 +Node: lesstif PrintCalibrate Action363667 +Node: lesstif PromptFor Action364051 +Node: lesstif Return Action364521 +Node: lesstif Save Action364868 +Node: lesstif SelectLayer Action365461 +Node: lesstif SetUnits Action365838 +Node: lesstif SwapSides Action366190 +Node: lesstif ToggleView Action367273 +Node: lesstif Zoom Action368077 +Node: Glossary369531 +Node: Index371140 + +End Tag Table Index: 1.0.8/doc-orig/pcb.info-1 =================================================================== --- 1.0.8/doc-orig/pcb.info-1 (nonexistent) +++ 1.0.8/doc-orig/pcb.info-1 (revision 1136) @@ -0,0 +1,7585 @@ +This is pcb.info, produced by makeinfo version 4.13 from pcb.texi. + +INFO-DIR-SECTION Miscellaneous +START-INFO-DIR-ENTRY +* pcb: (pcb). An interactive printed circuit board editor. +END-INFO-DIR-ENTRY + + This file documents how to use Pcb, the open source, interactive +printed circuit board layout system. + + Copyright (C) 1994,1995,1996, 2004 Thomas Nau + + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 harry eaton + + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009 Dan McMahill + + Copyright (C) 2004 DJ Delorie + + This program is free software; you may 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 +MERCHANT-ABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + + +File: pcb.info, Node: Top, Next: Copying, Up: (dir) + +Pcb +*** + +This document is a manual for `Pcb', the open source, interactive +printed circuit board layout system. + +* Menu: + +* Copying:: `Pcb' is freely redistributable! +* History:: How it all began. +* Overview:: An overview of `Pcb'. +* Intro:: A short description of the basic objects. +* Getting Started:: Introduction to `Pcb'. +* Autorouter:: Using the autorouter. +* User Commands:: User commands of `Pcb'. +* Command-Line Options:: Calling `Pcb' from a shell. +* X11 Interface:: Action routines, resources and default translation. +* File Formats:: Description of `ASCII' files used by `Pcb'. +* Library Creation:: Detailed description of symbol library creation. +* Schematic Frontends:: Schematic capture programs that work with PCB. +* Installation:: Compiling, installing and troubleshooting. +* Custom Menus:: Customizing the menu bar. +* Regular Expressions:: Searching for elements with regular expressions +* Standard Drill Sizes:: Tables of standard drill sizes +* Centroid File Format:: Details of the centroid (x-y) output file +* Action Reference:: Documentation for all available actions +* Glossary:: Glossary +* Index:: The Index. + + +File: pcb.info, Node: Copying, Next: History, Prev: Top, Up: Top + +Copying +******* + +Copyright (C) 1994,1995,1996,1997 Thomas Nau + + Copyright (C) 1998,1999,2000,2001,2002 harry eaton + + This program is free software; you may 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 +MERCHANT-ABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + + +File: pcb.info, Node: History, Next: Overview, Prev: Copying, Up: Top + +History +******* + +`Pcb' is a handy tool for laying out printed circuit boards. + + `Pcb' was first written by Thomas Nau for an Atari ST in 1990 and +ported to `UNIX' and `X11' in 1994. It was not intended as a +professional layout system, but as a tool which supports people who do +some home-developing of hardware. + + The second release 1.2 included menus for the first time. This made +`Pcb' easier to use and thus a more important tool. + + Release 1.3 introduced undo for highly-destructive commands, more +straightforward action handling and scalable fonts. Layer-groups were +introduced to group signal-layers together. + + Release 1.4 provided support for add-on device drivers. Two layers +(the solder and the component side) were added to support SMD elements. +The handling of libraries was also improved in 1.4.1. Support for +additional devices like GERBER plotters started in 1.4.4. The undo +feature was expanded and the redo-feature added in 1.4.5. + + harry eaton took over pcb development beginning with Release 1.5, +although he contributed some code beginning with Release 1.4.3 + + Release 1.5 provides support for rats-nest generation from simple net +lists. It also allows for automatic clearances around pins that pierce +a polygon. A variety of other enhancements including a Gerber RS-274X +driver and NC drill file generation have also been added. + + Release 1.6 provides automatic screen updates of changed regions. +This should eliminate most of the need for the redraw ((_R_ key). Also +some changes to what order items under the cursor are selected were +made for better consistency - it is no longer possible to accidentally +move a line or line point that is completely obscured by a polygon +laying over top of it. Larger objects on the upper most layers can be +selected ahead of smaller objects on lower layers. These changes make +operations more intuitive. A new mode of line creation was added that +creates two line on 45 degree angles with a single click. The actual +outline of the prospective line(s) are now shown during line creation. +An arc creation mode was added. Drawn arcs are quarter circles and can +be useful for high frequency controlled impedance lines. (You can have +eighth circle arc if the source is compiled with -DARC45, but be aware +that the ends of such arcs can never intersect a grid point). Two new +flags for pins and vias were created - one indicates that the pin or +via is purely a drill hole and has no copper annulus. You can only +toggle this flag for vias - for elements, it must be an integral part +of the element definition. The other flag controls whether the pad +will be round or octagonal. There is also now a feature for converting +the contents of a buffer into an element. + + Release 1.6.1 added the ability to make groups of action commands +bound to a single X11 event to be undone by a single undo. Also a +simple design rule checker was added - it checks for minimum spacing +and overlap rules. Plus many fixes for bugs introduced with the many +changes of 1.6 + + Release 1.7 added support for routing tracks through polygons +without touching them. It also added support for unplated drill files, +and drawing directly on the silk layer. A Netlist window for easily +working with netlist was also added. + + Release 2.0 adds an auto-router, a new simpler library mechanism, +much improved support for graphically creating (and editing) elements, +viewable solder-mask layers (and editing), snap to pins and pads, +netlist entry by drawing rats, element files (and libraries) that can +contain whole sub-layouts, metric grids, improved user interface, a GNU +autoconf/automake based build system, and a host of other improvements. + + Special thanks goes to: + Thomas Nau (who started the project and wrote the early versions). + C. Scott Ananian (who wrote the auto-router code). + Bernhard Daeubler (Bernhard.Daeubler@physik.uni-ulm.de) + Harald Daeubler (Harald.Daeubler@physik.uni-ulm.de) + DJ Delorie (djdelorie@users.sourceforge.net) + Larry Doolittle (ldoolitt@recycle.lbl.gov) + Dan McMahill (danmc@users.sourceforge.net) + Roland Merk (merk@faw.uni-ulm.de) + Erland Unruh (Erland.Unruh@malmo.trab.se) + Albert John FitzPatrick III (ajf_nylorac@acm.org) + Boerge Strand (borges@ifi.uio.no) + Andre M. Hedrick (hedrick@Astro.Dyer.Vanderbilt.Edu) + +who provided all sorts of help including porting `Pcb' to several +operating systems and platforms, bug fixes, library enhancement, user +interface suggestions and more. In addition to these people, many +others donated time for bug-fixing and other important work. Some of +them can be identified in the source code files. Thanks to all of +them. If you feel left out of this list, I apologize; please send me an +e-mail and I'll try to correct the omission. + + +File: pcb.info, Node: Overview, Next: Intro, Prev: History, Up: Top + +1 Overview +********** + +`Pcb' is an open source printed circuit board editor. `Pcb' includes +many professional features such as: + * Up to 16 copper layer designs by default. By changing a compile + time setting, this can be set as high as needed. + + * RS-274X (Gerber) output + + * NC Drill output + + * Centroid (X-Y) data output + + * Postscript and Encapsulated Postscript output + + * Autorouter + + * Trace optimizer + + * Rats nest + + * Design Rule Checker (DRC) + + * Connectivity verification + + * `Pcb' is Free Software + + * Can interoperate with free schematic capture tools such as gEDA and + xcircuit + + * Runs under Linux, NetBSD, Solaris, and other similar operating + systems. + + * Windows version is available + + +File: pcb.info, Node: Intro, Next: Getting Started, Prev: Overview, Up: Top + +2 Introduction +************** + +Each layout consists of several, mostly independent, objects. This +chapter gives an overview of the object types and their relationship to +each other. For a complete description of how to use `Pcb', refer to +*note Getting Started::. The layout is generated on-screen on a grid +that can have its origin at any desired location. The X coordinate +increases to the right, Y increases down to the bottom. All distances +and sizes in `Pcb' are measured in mils (0.001 inch). One unit on the +coordinate display is one mil in distance on the board. The grid may +be set on a metric pitch, but is only correct to within the nearest +/- +0.01 mil because `Pcb' stores all dimensions as integer multiples of +1/100 of a mil or 0.00001 inch. + + The sections in this chapter are sorted by the order of appearance +of the objects within a layout file. + +* Menu: + +* Symbol Objects:: Information about fonts and symbols. +* Via Objects:: Vias and pins connect layers. +* Element Objects:: Element, the basic type of circuits. +* Layer Objects:: A `container' for lines, text... +* Line Objects:: Tracks on the board +* Arc Objects:: Curved tracks +* Polygon Objects:: Planes and such +* Text Objects:: Objects to add symbols to your board. +* Net Objects:: Describes the desired connections on the board. + + +File: pcb.info, Node: Symbol Objects, Next: Via Objects, Up: Intro + +2.1 Symbols +=========== + +The top object is the layout itself. It uses a set of symbols that +resides at the first logical level. Each symbol is uniquely identified +by a seven bit `ASCII' code. All layout objects share the same set of +symbols. These symbols are used to form text objects on the silkscreen +and copper layers. Undefined symbols are drawn as filled rectangles. + + Every font file is preprocessed by a user-defined command when it is +loaded. For details see `fontCommand', *note Resources::. + + +File: pcb.info, Node: Via Objects, Next: Element Objects, Prev: Symbol Objects, Up: Intro + +2.2 Vias +======== + +Vias provide through-hole connectivity across all layers. While vias +look a lot like element pins, don't use vias for adding elements to the +layout, even if that seems easier than creating a new element. The +default solder-mask will cover over vias, so you won't be able to +solder to them. Of course, you can change this so that vias also have +solder-mask cut-outs, but it is not the default. Vias are also useful +for defining arbitrary drill points such as those used for mounting a +board. Vias used in this way have a special flag set so that they have +no annular copper ring, and also appear in the unplated drill file. +_Ctrl-H_ key over a via switches it between being a pure-mounting hole +and a regular via. You can assign a name to a via, which is useful +during the creation of new element definitions. Each via exists on all +copper layers. (_i.e._ blind and buried vias are not supported) + + +File: pcb.info, Node: Element Objects, Next: Layer Objects, Prev: Via Objects, Up: Intro + +2.3 Elements +============ + +Elements represent the components on a board. Elements are loaded from +`ASCII' coded files in a similar manner to the layout file itself, or +from the library selector window. An element is composed of lines and +arcs on the silk-screen layer (used to define the package outline), pins +(or pads for SMD) and three labels that define the description, the +element's layout-name (which also appears on the silk-screen layer) and +its value. You can choose which of the names are displayed on the screen +with the Screen menu; however, the silk screen in the printout will +always show the layout-name. Element pins are contained on the first +logical level and so reside on all layers, but the pads of surface-mount +elements reside on only the component or solder layers. An element can +have a mixture of pins, pads (on one or both sides), and mounting holes. + + A mark is used to position the element with respect to the cross +hair during pasting. The mark will lie on a grid point when the element +is positioned. The mark is drawn as a small diamond shape, but is only +visible when _both_ the `silk' and `pins/pads' layers are visible. All +parts of an element are treated as one unit, except for the name. It +is not possible to delete a single pin or move only part of an element +on the layout. You can resize separate pieces of an element, but doing +so is usually a bad idea. You can move/rotate the element name +independently of the element it belongs to. When you move an element +name, a line is draw from the cursor to the element mark so it is easy +to tell which element the name belongs to. + + Each pin and pad has two string identifiers, one is the "name" which +is a functional description of the pin (_e.g._ "clock in") and the +other is the "number" of the pin which is used to identify it in a +netlist. The "number" is usually an integer, but it can be any string. +You can edit the "name" of each pin of an element, but the "number" is +embedded in the element definition and is determined when the new +element is first created. Pads are similar to lines on a layer but +they must be oriented either vertically or horizontally. Pads can have +either rounded or square ends. Pins can be round, square, or octagonal. + + Elements are supported by several special layers: `silk', +`pins/pads' and `far-side'. The `silk' layer shows the package outline +and also holds legend text and element names. The `pins/pads' layer is +used to toggle whether the element's pins and pads are displayed. The +`far-side' layer controls visibility of objects (silkscreen and pads) +that are on the far (_i.e._ not currently viewed) side of the board. + + The "oldlib" style of footprint libraries distributed with `Pcb' +rely upon the M4 macro processor. M4 is typically installed under the +name `m4' on most unix-like operating systems. It is recommended that +you use the GNU version of M4 to avoid limitations found in some vendor +implementations. See the m4 man page on your system for more +information. Every element file is preprocessed by a user-defined +command when the file is read. For details see `elementCommand', *note +Resources::. `m4', the default value of `elementCommand', allows you to +create libraries for package definitions that are shared by all +elements. The old element libraries distributed with `Pcb' expect `m4' +or an equivalent to be the _elementCommand_. The new library scheme +simply has each element stored in a self-contained file, so there is no +need to learn `m4' to add to the libraries. + + `Pcb' can create a list of all connections from one (or all) +elements to the others or a list of unconnected pins. It can also +verify the layout connections against a netlist file. The element's +`layout-name' is the name used to identify the element in a netlist +file (see *note Netlist File::). + + The old libraries, or very old (pre-1.6) layout files may have +incorrect pin numbering since there was no concept of pin numbers when +they were created. `Pcb' uses the order of appearance of the pin +definitions in the layout or library file if it uses the old format, +but there is no guarantee that it will be correct for these old objects. + + Be aware that a few of the old library parts may still be incorrectly +implemented regarding pin-numbering. All of the DIL (Dual- +Inline-Pins) parts are correct and most of the others are too, but you +should verify the pin numbering of any non-DIL part before using an old +library part. (use the `generate object report' in the Info menu to +see what `Pcb' thinks a pin's number is) All of the old library names +begin with a ~, so you can easily identify them. The old libraries +also _may_ contain other sorts of errors, including incorrect pin +spacing, silkscreen overlapping solder areas, etc. Check carefully any +element in the old library before using it! As the new library grows, +the old library will be pared down to at least remove all of the +elements with errors, but this will take time. + + You can make your own element definitions graphically now. Simply +draw vias for the pins, lines on the solder and/or component layers for +surface-mount pads (they must be either horizontal or vertical), and +lines and arcs on the silkscreen layer for the silkscreen outline. You +should _name_ (_N_ key) each via and copper line with the pin _number_. +Once you are happy with the geometry, select everything that is to +become part of the element, then choose `convert selection to element' +from the Select menu. Afterwords you can make pin (or pad) one square +if you like, and give the element its various names. You can also give +the pins and pads their functional names. Note that the element mark +corresponds to the position you click after choosing the conversion +from the menu, so decide where the mark goes and make sure it falls on +a grid point before you request the conversion. If the vias/lines are +not named, then the pin numbering will correspond to the order in which +they were placed. + + When you create a new element, remember that silkscreen lines should +_never_ overlap the copper part of the pins or pads, as this can +interfere with soldering. The silkscreen should identify the maximum +extent of the element package so it is easy to see how close elements +can be placed together. + + If you want to make an element similar to an existing one, you can +break an element into constituent pieces from the Buffer menu. Paste +the pieces to the layout, make the necessary changes, then convert it +back into an element. If the pin numbers haven't changed, there is no +need to name each via/line as they are pre-named when the element was +broken apart. When you create a new element, you can save it to a file +in order to have easy access to it the next time you run `Pcb'. + + +File: pcb.info, Node: Layer Objects, Next: Line Objects, Prev: Element Objects, Up: Intro + +2.4 Layers +========== + +Every layout consists of several layers that can be used independently +or treated as a group. Layer groups can be used to logically separate +(and color-code) different traces (_e.g._ power and signal); however, +all layers within a group reside on the same physical copper layer of a +board, so using different layers within the same group won't provide +electrical separation where they touch or overlap. For details, see +`layerGroups', *note Resources::. Each layer is drawn in a color +defined in the resource file and identified by a name that you can +change (for details see `layerColor', *note Resources::.) Layers are +really just containers for line, arc, polygon, and text objects. The +component and solder layers contain SMD elements as well, but the file +structure doesn't reflect that fact directly. + + Each layer group represents a physical layer on the printed circuit +board. If you want to make a four layer board, you'll need to have at +least four layer groups. Connections between layer groups are +established only through element pins and vias. The relationship +between a specific layer and the board itself is configurable from the +`Edit layer groups' option in the Settings menu. The layer groups +corresponding to the physical layers: _component-side_ and +_solder-side_ are always defined and you must map at least one logical +layer to each, even if you plan to make a single-sided board. You are +not obligated to put tracks on either of them. Surface mount elements +always reside on either the component-side or the solder-side layer +group. When you paste an element from the buffer, it will go onto +whichever side of the board you are viewing. You can swap which side +of the board you are viewing by pressing the _Tab_ key, or by selecting +`view solder side' from the Screen menu. The layer groups just have a +name or number associated with them - where they are sandwiched in the +board is left for you to tell the manufacturer. + + The silkscreen layer is special because there are actually two +silkscreen layers, one for the top (component) and one for the bottom +(solder) side of the board. Which silk layer you draw on is determined +by the side of the board that you are viewing. If you are viewing the +component side, then drawing on the silk layer draws to the +component-side silk layer. + + The netlist layer is another special layer. It shows rat's-nest lines +(_i.e._ guides that show how the netlist expects the element to +interconnect). If you make this the active layer, you can use the Line +tool to add entries into the netlist, or to delete connections from the +netlist window. Except for these two purposes, you should not make the +netlist layer the active layer. Usually there is no need to do this +because a separate schematic package should be used to create the +netlist. `Pcb' can automatically draw all of the rats from the netlist. +In some cases you may want to make a small change without going to the +trouble of modifying the schematic, which is why this facility is +provided. + + +File: pcb.info, Node: Line Objects, Next: Arc Objects, Prev: Layer Objects, Up: Intro + +2.5 Lines +========= + +Lines are used to draw tracks on the pc board. When in the line mode, +each _Btn1_ press establishes one end of a line. Once the second point +is defined, the line is drawn and a new line started where the first +one ended. You can abandon the new starting point in favor of another +by pressing _Ctrl-Btn1_, or _Btn3_, but don't use _Btn2_. The undo +function (_U_ key or `undo last operation' from the Edit menu) will +take you back point by point if you use it while in the line mode. + + New lines can be restricted to 45 degree angles if desired. You can +toggle this restriction on and off while creating lines by pressing the +_period_ key. If the 45 degree restriction is turned on, then the _/_ +(forward slash) key can be used to cycle through three different modes +of 45 degree line creation. One mode just creates a single line forced +to the nearest 45 degree vector. The next mode creates two lines from +the start to end points such that the first line leaves the start point +at a 90 degree vector, and the second line enters the end point on a 45 +degree vector. The last mode creates two lines such that the first line +leaves the start point on a 45 degree vector and arrives at the end +point on a 90 degree vector. You can temporarily swap between the last +two modes by holding the _Shift_ key down. + + It is simple to edit a line object by breaking it into pieces +(insert point mode), moving an end point or the whole line (_Arrow +tool_), or changing the layer it resides on (_M_ key moves the line +under the pointer to the active layer). In the case when two line +segments meet at exactly the same point you can delete the intermediate +point, otherwise the delete tool removes an entire line. Feel free to +experiment since `Pcb' will allow you to undo and redo anything that +materially affects your work. If you switch active layers in the midst +of placing lines a via will automatically be placed, when necessary, in +order to continue the connection. + + If you draw a line inside a polygon, it will either plow through the +polygon creating a clearance, or touch the polygon. This behavior is +selectable in the Settings menu for new lines. To change the behavior +of an existing line, hit the _J_ key with the cross hair over the line. +You can increase the size of the clearance by 2 mils on each edge with +the with the _K_ key. _Shift-K_ will decrease the clearance by 2 mils. +The increment may be changed from 2 mils through the application +resource file. The clearance can be also increased, decreased and set +by the _ChangeClearSize_ action. + + Lines do not need to intersect the center of a pin, pad, via, or +other line for `Pcb' to understand that they make electrical connection. +If the connection is too tenuous, running the design rule checker will +report that the connection may break if the line width shrinks slightly. + + +File: pcb.info, Node: Arc Objects, Next: Polygon Objects, Prev: Line Objects, Up: Intro + +2.6 Arcs +======== + +`Pcb' can handle arcs of any angular extent, but when you create an arc +with the Arc tool, it will be a quarter circle (this means they always +bend a right angle). Arcs are very similar to lines otherwise. They +are created on the active layer and have the same thickness that new +lines will have. The various clicks for creating lines work pretty +much the same way for creating arcs. In order to make the arc curve in +the desired direction, drag the mouse along the tangent line from the +starting position towards the end position. If the grid is too coarse, +it may not be possible to distinguish whether you've moved over then up, +or up then over, so if you can't seem to make the arc go in the +direction you want, try pressing the _Shift_ key while drawing the arc. +Decreasing the grid spacing may also help. Alternatively you can draw +the wrong arc, then rotate and move it where you want. Like the Line +tool, after an arc is drawn a new starting point is established at the +end point. + + Whenever a starting point is established by either the Line or Arc +tools it will be retained if you switch directly between the tools +(e.g. _F2_ key for Lines, _F8_ key for Arcs. Arcs can either touch or +clear polygons just like lines do. Of course connection searches, undo +and all the other features you'd expect work with arcs too. + + +File: pcb.info, Node: Polygon Objects, Next: Text Objects, Prev: Arc Objects, Up: Intro + +2.7 Polygons +============ + +Sometimes it's useful to fill large areas with solid copper. The way +to do this is with polygons. Polygons can be created in either the +polygon mode or the rectangle mode. In the polygon mode, you'll have +to define each corner of the polygon with a mouse click (_Btn1_). When +the last point is clicked exactly on top of the starting point, the +polygon is finished. Since this can be hard to do, the _Shift-P_ key +will enter the final point for you, closing the polygon. If the 45 +degree angle restriction is turned on and you try to close the polygon +when it is not possible, you'll get a warning instead. If you haven't +finished entering a polygon, but want to undo one (or more) of the +points that you've already defined, use the undo command (_U_ key). + + With the rectangle tool, defining the two diagonally opposite +corners is sufficient, but of course the resulting polygon is a +rectangle. Like lines, a polygon can by edited by deleting, inserting +and moving the points that define it. Pins and vias _always_ clear +through polygons without touching them when first positioned. You must +add a thermal with the thermal tool in order to connect pins and vias +to polygons. Thermals can be added and removed by clicking _Btn1_ with +the thermal tool over the pin or via. The thermal tool always places a +thermal to polygons on the active layer, so if the tool doesn't seem to +work, it's probably because the polygon you want to touch is not on the +active layer. You can change the style of thermal used or make a solid +connection by holding down _Shift_ while clicking _Btn1_ with the +thermal tool over the pin or via. + + `Pcb' is capable of handling complex polygons, but using a number of +simpler ones improves performance of the connection tracing code. You +also must be careful not to create polygons that touch or overlap +themselves. The fabricated board may not look the way you expect if +you violate this principle. It is always ok to have two (or more) +polygons touch or overlap each other, but not for points within the +same polygon to do so. + + The great advantage to this new polygon behavior is that simple or +complex ground and/or power planes can be easily made with polygons and +seen on the screen. If you don't want this auto-clearance behavior, or +you load a layout created by an early version of `Pcb', the old behavior +(shorts to all piercing pins and vias) is available. A `ChangeSize' +operation (_S_ key) toggles a polygon between the new and old +polygon/pin behavior. + + +File: pcb.info, Node: Text Objects, Next: Net Objects, Prev: Polygon Objects, Up: Intro + +2.8 Text +======== + +Text objects should be used to label a layout or to put additional +information on the board. Elements have their `layout-name' labels on +the silk-screen layer. If you are making a board without a silkscreen, +you can use copper text to label the elements, but you have to do this +manually. + + Text is always horizontal when first created, but the rotate mode +can align it along 0, 90, 180 and 270 degree angles. Text on the far +side of the board will automatically appear mirror-imaged. + + _Warning:_ TEXT OBJECTS ON A COPPER LAYER CREATE COPPER LINES BUT +THEY ARE NOT SCANNED FOR CONNECTIONS OR TESTED FOR CREATING SHORTS VS. +THE NETLIST. NEITHER ARE TEXT OBJECTS TESTED AGAINST ANY DESIGN RULES. + + +File: pcb.info, Node: Net Objects, Prev: Text Objects, Up: Intro + +2.9 Nets +======== + +Layout files also contain the netlist that describes how the elements +are supposed to be interconnected. This list of connections can be +loaded from a netlist file (see *note Netlist File::), or entered by +drawing rat-lines as described previously. Each net has a name and +routing style associated with it. The net contains a list of all +element _layout-name_ names and pin _numbers_ that should be connected +to the net. Loading a netlist file will replace all existing nets with +the ones from the file. The _Netlist_ window provides an easy way to +browse through the net list. You can display the rat's-nest by selecting +`optimize rats-nest' from the Connects menu. If you move or rotate +elements, the rat's-nest will automatically follow the movements, but +they won't necessarily show the shortest paths until you optimize them +again. + + +File: pcb.info, Node: Getting Started, Next: Autorouter, Prev: Intro, Up: Top + +3 Getting Started +***************** + +The goal of this chapter is to give you enough information to learn how +`Pcb' works and how to develop your layouts to make the best use of +`Pcb''s features. All event translations (_i.e._ the buttons and keys +you press) refer to the default application resource file shipped with +`Pcb'. There is probably no need to change this unless your window +manager uses some of the button events itself; however, if you _want_ +to customize the behavior of `Pcb' then changing the resource file is +usually the best way to do it. + + Get yourself a printout of this chapter and _User Commands_, if you +haven't already done so, and follow the examples. + + Start `Pcb' (the actual command will use all lower-case letters) +without any additional options. If you get the error message: + + can't find default font-symbol-file 'default_font' + then the font searchpath or filename in the application resource +file is wrong. Be sure that your `m4' program supports search paths. +If not, get `GNU m4'. For other messages, see *note problems::. +Another quick-start is provided by `pcbtest.sh' in the `src' directory. +If some features don't seem to work, try running `pcbtest.sh', if that +works, then `Pcb' hasn't been installed properly. + +* Menu: + +* Application Window:: The elements of the main window. +* Log Window:: The optional logging window +* Library Window:: The circuit selection window +* Netlist Window:: The desired connections window +* Drawing and Removing:: +* Moving and Copying:: +* Loading and Saving:: +* Printing:: Creating Gerber files or postscript files +* Exporting:: Exporting a layout. +* Arrow Tool:: Selecting/Moving objects. +* Rats Nest:: Helps you place and route tracks against a netlist. +* Design Rule Checking:: Check for manufactureability +* Trace Optimizer:: Optimization of layouts +* Searching for elements:: Searching for elements +* Measuring distances:: Measuring distances +* Vendor drill mapping:: Mapping drills to a vendor specified list +* Connection Lists:: How to get a list of all or some connections. + + +File: pcb.info, Node: Application Window, Next: Log Window, Up: Getting Started + +3.1 The Application Window +========================== + +The main window consists of five areas: the menu at the top, the layer +control in the upper left, the tool buttons located below the layer +controls, the Layout area to the right of these, and the status line at +the bottom of the window. + +* Menu: + +* Menu:: +* Status-line and Input-field:: What is the program configuration. +* Layer Controls:: Switch layers on/off; change current one. +* Tool Selectors:: Select a layout tool. +* Layout Area:: Where the layout is drawn. + + +File: pcb.info, Node: Menu, Next: Status-line and Input-field, Up: Application Window + +3.1.1 Menus +----------- + +The menus are located at the top of the Layout area. Most, but not all, +of their functions are also available from the keyboard. Similarly, some +functions are only achievable through the keyboard or command entry. +Some menu entries such as `center layout' in the Screen menu require a +certain cross hair position. In this case a prompt message will popup +at the bottom of the screen with wording similar to the following: + move pointer to the appropriate screen position and press a button + Any mouse button will do the job, whereas any key except the arrow +(cursor) keys will cancel the operation. If it seems like the menu +hasn't done what you expected, check to see if it is waiting for the +position click. For details see *note Actions::. + + Pressing _Btn3_ in the Layout area also pops up a menu with many of +the most common operations (except when you're in the midst of drawing +a line or arc). When a choice in the _Btn3_ popup menu needs a cross +hair position, it uses the position where the cross hair was when +_Btn3_ was pressed. For example, to get detailed information on an +object, place the cross hair over the object, press _Btn3_, then choose +`object report'. If you pop up the _Btn3_ menu but don't want to take +any of the actions, click on one of the headers in the menu. + +File + This menu offers a choice of loading, saving and printing data, + saving connection information to a file or quitting the + application. Most of the entries in the File menu are self + explanatory. Selecting `print layout' pops up a printer control + dialog. A selection of several device drivers is available from + the printer control dialog. Presently _PostScript_, _encapsulated + PostScript_, and _GerberX_ are supported. The _GerberX_ driver + produces all of the files necessary to have the board + professionally manufactured. The connection saving features in + the File menu produce outputs in an arcane format that is not too + useful. They do _not_ produce netlist files. + +Edit + The Edit menu provides the usual cut, copy, paste which work on + selections. To learn how to create complex selections, see *note + Arrow Tool::. The Edit menu also provides access to Undo and Redo + of the last operation. These can also be accomplished with the _U_ + key and _Shift-R_ key. Finally, the Edit menu allows you to + change the names of: the layout, the active layer, or text objects + on the layout. + +Screen + The Screen menu supports most functions related to the whole + Layout area. There are various entries to change the grid to some + popular values, the zoom factor, and which kind of element name is + displayed. You can also re-align the grid origin and turn on and + off the display of the grid. Before changing the grid alignment, + I recommend that you zoom in as close as possible so that you're + sure the grid points appear exactly where you want them. + + The Screen menu also allows you to turn on and off the visibility + of the solder-mask layer. When the solder-mask layer is made + visible it obscures most of the layout, so only turn this on when + you really want to know what the solder-mask will look like. The + solder-mask that you see belongs to the side of the board you are + viewing, which can be changed with the `view solder side' option, + also found in the Screen menu. When the solder-mask is displayed, + the pin and pad clearance adjustments (*note Line Objects::) alter + the size of mask cut-outs. + +Sizes + The Sizes menu allows you to select a group of line thickness, via + diameter, via drill size, and clearance (keepaway) (collectively + called a "routing style") to be copied to the "active" sizes. You + can also change the names given to the routing styles and adjust + their values from this menu. The "active" sizes are also + adjustable from this menu. The "active" sizes are shown in the + status-line and control the initial size of new vias, drilling + holes, lines, clearances, text-objects and also the maximum + dimensions of the board layout. + +Settings + The Settings menu controls several operating configuration + parameters. The `edit layer groups' entry brings up a dialog that + allows you to change the way layers are grouped. Layer grouping is + described in *note Layer Objects::. The `all-direction lines' + entry controls the clipping of lines to 45-degree angles. You can + also control whether moving individual objects causes the attached + lines to "rubber band" with the move or not from the Settings + menu. Another entry controls whether the starting clip angle for + the two-line mode (*note Line Objects::) alternates every other + line. You can also control whether element names must be unique + from the Settings menu. When unique element names are enforced, + copying a new element will automatically create a unique + `layout-name' name for it provided that the name originally ended + with a digit (_e.g._ U7 or R6). The Settings menu allows you to + control whether the cross hair will snap to pins and pads even + when they are off-grid. Finally you can control whether new lines + and arcs touch or clear intersecting polygons from this menu. + +Select + This menu covers most of the operations that work with selected + objects. You may either (un)select all visible objects on a + layout or only the ones which have been found by the last + connection scan see . You can delete all selected objects from + this menu. Other entries in the Select menu change the sizes of + selected objects. Note that a select action only affects those + objects that are selected _and_ have their visibility turned on in + the Layer Control panel. The Select menu also provides a means for + selecting objects by name using unix *note Regular Expressions::. + +Buffer + From the Buffer menu you may select one out of five buffers to + use, rotate or clear its contents or save the buffer contents to a + file. You can also use the `break buffer element to pieces' entry + to de-compose an element into pieces for editing. Note: only + objects with visibility turned on are pasted to the layout. If you + have something in a buffer, then change which side of the board you + are viewing, the contents of the buffer will automatically be + mirrored for pasting on the side you are viewing. It is not + necessary to clear a buffer before cutting or copying something + into it - it will automatically be cleared first. + +Connects + The entries available through the Connects menu allow you to find + connections from objects and to manipulate these. You can also + optimize or erase rat's nests from this menu. Finally, the + `auto-route all rats' entry allows you to auto-route all + connections show by the rat's nest. The auto-router will use any + visible copper layer for routing, so turn off the visibility of any + layers you don't want it to use. The auto-router will automatically + understand and avoid any traces that are already on the board, but + it is not restricted to the grid. Finally, the auto-router routes + using the active sizes (except for nets that have a route-style + defined). `Pcb' always knows which tracks were routed by the + auto-router, and you can selectively remove them without fear of + changing tracks that you have manually routed with the `rip-up all + auto-routed tracks' entry in the Connects menu. The `design rule + checker' entry runs a check for copper areas that are too close + together, or connections that touch too tenuously for reliable + production. The DRC stops when the first problem is encountered so + after fixing a problem be sure to run it again until no problems + are found. + _Warning:_ COPPER TEXT IS IGNORED BY THE DRC CHECKER. + +Info + The `generate object report' entry from the Info menu provides a + way to get detailed information about an object, such as its + coordinates, dimensions, etc. You can also get a report + summarizing all of the drills used on the board with `generate + drill summary'. Lastly, you can get a list of all pins, pads and + vias that were found during a connection search. + +Window + The Window menu provides a way to bring each of `Pcb's' windows to + the front. The _Library_ window is used to bring elements from the + library into the paste-buffer. The _Message Log_ window holds the + various messages that `Pcb' sends to the user. The _Netlist_ + window shows the list of connections desired. + + + Now that you're familiar with the various menus, it's time to try +some things out. From the File menu choose `load layout', navigate to +the tutorial folder, then load the file `tut1.pcb'. + + +File: pcb.info, Node: Status-line and Input-field, Next: Layer Controls, Prev: Menu, Up: Application Window + +3.1.2 The Status-line and Input-field +------------------------------------- + +The status-line is located at the bottom edge of the main window. +During normal operation the status information is visible there. When +a selected menu operation requires an additional button click, the +status-line is replaced by a message telling you to position the cursor +and click. When a text input is required, the status-line is replaced +by the Input-field which has a prompt for typing the input. + + The status-line shows, from left to right, the side of the board +that you are viewing (_Tab_ key changes this), the current grid values, +if new lines are restricted to 45 degrees, which type of 45 degree line +mode is active, whether rubberband move and rotate mode is on (R), and +the zoom factor. This information is followed by the active +line-width, via-size and drilling hole, keepaway spacing, and text +scaling. Last is the active buffer number and the name of the layout. +An asterisk appearing at the far left indicates that the layout has +been modified since the last save. Note that the name of the layout is +not the same thing as the filename of the layout. Change the grid +factor to 1.0 mm from the Screen menu. Observe how the status line +shows the new grid setting. Except for the case of the metric grid, all +dimensions in the status line are in units of 0.001 inch (1 mil). + + The input-field pops up (temporarily replacing the status-line) +whenever user input is required. Two keys are bound to the input field: +the _Escape_ key aborts the input, _Return_ accepts it. Let's change +the name of a component on the board to see how the input-field works. +Position the cross hair over R5, and press the _N_ key. The input field +pops-up showing the name for you to edit. Go ahead and change the name, +then hit return. Notice the name of the element changed. Now undo the +change by pressing the _U_ key. You can position the cross hair over +the name, or the element before pressing the _N_ key. + + Now select `realign grid' from the Screen menu. Notice that the +status line has been replaced with an instruction to position the cursor +where you want a grid point to fall. In this case, since the cross hair +can only fall on a grid point, you must move the tip of the finger +cursor to the place where you want a grid point to appear. Do not worry +that the cross hair is not coincident with the cursor. Click _Btn1_ at +your chosen location. See how the grid has shifted, and the status line +has returned. + + The present cross hair position is displayed in the upper right +corner of the window. Normally this position is an absolute +coordinate, but you can anchor a marker at the cross hair location by +pressing _Ctrl-M_ (try it now) and then the display will read both the +absolute cross hair position as well as the difference between it and +the marker. The numbers enclosed in < > are the X and Y distances +between the cross hair and the mark, while the numbers enclosed in +parenthesis are the distance and angle from the mark to the cross hair. +The values displayed are always in units of 0.001 inch (1 mil). +Pressing _Ctrl-M_ again turns the marker off. + + +File: pcb.info, Node: Layer Controls, Next: Tool Selectors, Prev: Status-line and Input-field, Up: Application Window + +3.1.3 The Layer Controls +------------------------ + +The layer control panel, located in the upper left, is used to turn on +and off the display of layer groups and to select the active drawing +layer. If a layer hasn't been named, the label "_(unknown)_" is used +as the default. If this happens, it probably means the application +resources are not installed properly. + + The upper buttons are used to switch layers on and off. Click +__ on one or more of them. Each click toggles the setting. If +you turn off the currently active layer, another one that is visible +will become active. If there are no others visible, you will not be +able to turn off the active layer. When the layers are grouped, +clicking on these buttons will toggle the visibility of all layers in +the same group. This is a good idea because layers in the same group +reside on the same physical layer of the actual board. Notice that this +example has 2 groups each having 3 layers, plus two other layers named +`unused'. Use the `Edit layer groups' option in the `Settings' menu to +change the layer groupings in the lesstif GUI or the `Preferences' +dialog from the `File' menu in the GTK+ GUI. Note that changing the +groupings can radically alter the connectivity on the board. Grouping +layers is only useful for helping you to color-code signals in your +layout. Note that grouping layers actually reduces the number of +different physical layers available for your board, so to make an eight +layer board, you cannot group any layers. + + The _far side_ button turns on and off the visibility of elements +(including SMD pads) on the opposite (to the side you're viewing) board +side, as well as silk screening on that side. It does not hide the +x-ray view of the other copper layers, these must be turned off +separately if desired. Use the _tab_ key to view the entire board from +the other side. To see a view of what the back side of the board will +actually look like, make the solder layer the active layer then press +_tab_ until the status line says "solder" on the right, then turn off +the visibility of all layers except solder, pins/pads, vias, and silk. +Now turn them all back on. + + The lowest button, named _active_, is used to change the active +drawing layer. Pressing __ on it pops up a menu to select which +layer should be active. Each entry is labeled with the layer's name +and drawn in its color. The active layer is automatically made +visible. The active layer is always drawn on top of the other layers, +so the ordering of layers on the screen does not generally reflect the +ordering of the manufactured board. Only the solder, component, +silkscreen, and solder-mask layers are always drawn in their physical +order. Bringing the active layer to the top makes it easier to select +and change objects on the active layer. Try changing the active +layer's name to _ABC_ by selecting `edit name of active layer' from the +`Edit' menu. Changing the active layer can also be done by pressing +keys _1..MAX_LAYER_. + + Turn off the visibility of the component layer. Now make the +component layer the active layer. Notice that it automatically became +visible. Try setting a few other layers as the active layer. You should +also experiment with turning on and off each of the layers to see what +happens. + + The netlist layer is a special layer for adding connections to the +netlist by drawing rat lines. This is not the recommended way to add to +the netlist, but occasionally may be convenient. To learn how to use +the netlist layer see *note Net Objects::. + + +File: pcb.info, Node: Tool Selectors, Next: Layout Area, Prev: Layer Controls, Up: Application Window + +3.1.4 The Tool Selectors +------------------------ + +The tool selector buttons reside below the layer controls. They are +used to select which layout tool to use in the drawing area. Each tool +performs its function when _Btn1_ is pressed. Every tool gives the +cursor a unique shape that identifies it. The tool selector buttons +themselves are icons that illustrate their function. Each layout tool +can also be selected from the keyboard: + _F1_ key Via tool + _F2_ key Line tool + _F3_ key Arc tool + _F4_ key Text tool + _F5_ key Rectangle tool + _F6_ key Polygon tool + _F7_ key Buffer tool + _F8_ key Delete tool + _F9_ key Rotate tool + _Insert_ key Insert-point tool + _F10_ key Thermal tool + _F11_ key Arrow tool + _F12_ key Lock tool + + Some of the tools are very simple, such as the Via tool. Clicking +_Btn1_ with the Via tool creates a via at the cross hair position. The +via will have the diameter and drill sizes that are active, as shown in +the status line. The Buffer tool is similar. With it, __ copies +the contents of the active buffer to the layout, but only those parts +that reside on visible layers are copied. The Rotate tool allows you +to rotate elements, arcs, and text objects 90 degrees counter-clockwise +with each click. Holding the _Shift_ key down changes the Rotate tool +to clockwise operation. Anything including groups of objects can be +rotated inside a buffer using the rotate buffer menu option. + + The Line tool is explained in detail in *note Line Objects::. Go read +that section if you haven't already. Activate the Line tool. Set the +active layer to the solder layer. Try drawing some lines. Use the _U_ +key to undo some of the lines you just created. Zoom in a bit closer +with the _Z_ key. Draw some more lines. Be sure to draw some separate +lines by starting a new anchor point with _Ctrl-Btn1_. Change the +`crosshair snaps to pin/pads' behavior in the Settings menu. Now draw a +line. Notice that the new line points must now always be on a grid +point. It might not be able to reach some pins or pads with this +setting. Increase the active line thickness by pressing the _L_ key. +Note that the status line updates to reflect the new active line +thickness. Now draw another line. Before completing the next line, make +the component layer active by pressing the _4_ key. Now finish the +line. Notice that a via was automatically placed where you switched +layers. `Pcb' does not do any checks to make sure that the via could +safely be placed there. Neither does it interfere with your desire to +place lines haphazardly. It is up to you to place things properly when +doing manual routing with the Line tool. + + The Arc tool is explained in detail in *note Arc Objects::. Its use +is very similar to the Line tool. + + The Rectangle tool, Polygon tool and Thermal tool are explained in +detail in *note Polygon Objects::. Go read that section. Remember that +the Thermal tool will only create and destroy thermals to polygons on +the active layer. Use the Rectangle tool to make a small copper plane +on the component layer. Now place a via in the middle of the plane. +Notice that it does not touch the plane, and they are not electrically +connected. Use the Thermal tool to make the via connect to the plane. +Thermals allow the via or pin to be heated by a soldering iron without +having to heat the entire plane. If solid connections were made to the +plane, it could be nearly impossible to solder. Shift-click on the via +with the Thermal tool to change the style of thermal used or to make +the connection solid. Click on the via again with the Thermal tool to +remove the connection to the plane. + + The Insert-point tool is an editing tool that allows you to add +points into lines and polygons. The Insert-point tool enforces the 45 +degree line rule. You can force only the shorter line segment to 45 +degrees by holding the _Shift_ key down while inserting the point. Try +adding a point into one of the lines you created. Since line clipping +is turned on, you may need to move the cross hair quite far from the +point where you first clicked on the line. Turn off the line clipping +by selecting `all-direction lines' from the Settings menu (or hit the +_Period_ key). Now you can place an inserted point anywhere. Try +adding a point to the rectangle you made earlier. Start by clicking +somewhere along an edge of the rectangle, then move the pointer to a +new location and click again. + + The delete-mode deletes the object beneath the cursor with each +_Btn1_ click. If you click at an end-point that two lines have in +common, it will replace the two lines with a single line spanning the +two remaining points. This can be used to delete an "inserted" point +in a line, restoring the previous line. Now delete one of the original +corner points of the polygon you were just playing with. To do this, +place the cross hair over the corner and click on it with the Delete +tool. You could also use the _Backspace_ key if some other tool is +active. Try deleting some of the lines and intermediate points that you +created earlier. Use undo repeatedly to undo all the changes that +you've made. Use redo a few times to see what happens. Now add a new +line. Notice that you can no longer use redo since the layout has +changed since the last undo happened. The undo/redo tree is always +pruned in this way (_i.e._ it has a root, but no branches). + + The Arrow tool is so important, it has its own section: *note Arrow +Tool::. Go read it now. + + The Lock tool allows you to lock objects on the layout. When an +object is locked, it can't be selected, moved, rotated, or resized. +This is useful for very large objects like ground planes, or +board-outlines that are defined as an element. With such large objects, +nearly anywhere you click with the Arrow tool will be on the large +object, so it could be hard to draw box selections. If you lock an +object, the Arrow tool will behave as if it didn't exist. You cannot +unlock an object with undo. You must click on it again with the Lock +tool. If an object is locked, previous changes to it cannot be undone +either. When you lock an object, a report message about it is popped up +and will always tell you what object it is, and that it is locked if +you just locked it. Other than noticing your inability to manipulate +something, the only way to tell an object is locked is with a report +from the Info menu. Use the Lock tool sparingly. + + +File: pcb.info, Node: Layout Area, Prev: Tool Selectors, Up: Application Window + +3.1.5 Layout Area +----------------- + +The layout area is where you see the layout. The cursor shape depends +on the active tool when the pointer is moved into the layout area. A +cross hair follows the mouse pointer with respect to the grid setting. +Select a new grid from the _Screen_ menu. The new value is updated in +the status line. A different way to change the grid is _Shiftg_ +to decrease or _g_ to increase it, but this only works for English +(integer mil) grids. The grid setting is saved along with the data +when you save a pcb layout. For homemade layouts a value around 50 is +a good setting. The cursor can also be moved in the layout area with +the cursor (arrow) keys or, for larger distances, by pressing the +_Shift_ modifier together with a cursor key. + + +File: pcb.info, Node: Log Window, Next: Library Window, Prev: Application Window, Up: Getting Started + +3.2 Log Window +============== + +This optional window is used to display all kind of messages including +the ones written to _stderr_ by external commands. The main advantage +of using it is that its contents are saved in a scrolling list until the +program exits. Disabling this feature by setting the resource +_useLogWindow_ to _false_ will generate popup windows to display +messages. The _stderr_ of external commands will appear on `Pcb's +_stderr_ which normally is the parent shell. I suggest you iconify the +log window after startup for example by setting _*log.iconic_ to _true_ +in the resource file. If _raiseLogWindow_ is set _true_, the window +will deiconify and raise itself whenever new messages are to be +displayed. + + +File: pcb.info, Node: Library Window, Next: Netlist Window, Prev: Log Window, Up: Getting Started + +3.3 Library Window +================== + +The library window makes loading elements (or even partial layouts) +easy. Just click the appropriate library from the list on the left. A +list of its elements then appears on the right. Select an element from +the list by clicking on its description. Selecting an element from the +library will also automatically copy the element into the active +buffer, then invoke the _Buffer_ tool so you can paste it to the +layout. Elements in the old library should be taken with a grain of +salt (_i.e._ check them carefully before using). The old library names +all begin with ~ so you can easily distinguish between the old and new +libraries. All of the elements in the new library should be +thoroughly vetted, so you can use them with confidence. The new +libraries are stored simply as directories full of element files, so +making additions to the new library is easy since there is no need to +learn `m4'. For details on the old libraries, check-out *note Library +File:: and *note Library Contents File::. For details on the format of +an element file used for the new libraries, see *note Element File::. + + +File: pcb.info, Node: Netlist Window, Next: Drawing and Removing, Prev: Library Window, Up: Getting Started + +3.4 Netlist Window +================== + +The netlist window is very similar to the library window. On the left +is a list of all of the nets, on the right is the list of connections +belonging to the chosen net. The chosen net is highlighted in the list +and also shown on the second line of the window in red. If the net name +has a star to the left of it then it is "disabled". A disabled net is +treated as if it were not in the net list. This is useful, for example, +if you plan to use a ground plane and don't want the ground net showing +up in the rat's nest. You can enable/disable individual nets by +double-clicking the net name. If you want to enable or disable all nets +at once, there are two buttons at the top of the netlist window for +this purpose. + + The button labeled `Sel Net On Layout' can be used to select (on the +layout) everything that is connected (or is supposed to be connected) +to the net. If you click on a connection in the connection list, it +will select/deselect the corresponding pin or pad in the layout and +also center the layout window where it is located. If you "Find" +(`lookup connection to object' in the Connects menu [also _F_ key]), a +pin or pad it will also choose the net and connection in the netlist +window if it exists in the netlist. + + If no netlist exists for the layout, then the netlist window does not +appear. You can load a netlist from a file from the File menu. The +format for netlist files is described in *note Netlist File::. + + +File: pcb.info, Node: Drawing and Removing, Next: Moving and Copying, Prev: Netlist Window, Up: Getting Started + +3.5 Drawing and Removing Basic Objects +====================================== + +hace begging gutting here, and do a real-world tutorial example. + + There are several ways of creating new objects: you can draw them +yourself, you can copy an existing object (or selection), or you can +load an element from a file or from the Library window. Each type of +object has a particular tool for creating it. + + The active tool can be selected from the tool selectors in the bottom +left corner or by one of the function keys listed earlier in this +chapter. Each __ press with the tool tells the application to +create or change the appropriate object or at least take the first step +to do so. Each tools causes the cursor to take on a unique shape and +also causes the corresponding tool selector button to be highlighted. +You can use either cue to see which tool is active. + + Insert mode provides the capability of inserting new points into +existing polygons or lines. The 45 degree line clipping is now enforced +when selected. Press and hold the shift key while positioning the new +point to only clip the line segment to the nearer of the two existing +points to 45 degrees. You can also toggle the 45-degree clipping in +the middle of a point insertion by pressing the _._ If the shift +key is not depressed and the 45 degree line clipping mode is on, both +new line segments must be on 45 degree angles - greatly restricting +where the new point may be placed. In some cases this can cause +confusion as to whether an insertion has been started since the two new +lines may be forced to lie parallel on top of the original line until +the pointer is moved far from the end points. + + Removing objects, changing their size or moving them only applies to +objects that are visible when the command is executed. + +* Menu: + +* Common:: Keystrokes common to some objects. +* Lines:: +* Arcs:: +* Polygons:: Drawing polygons and rectangles. +* Text:: +* Vias:: +* Elements:: +* Pastebuffer:: A multi-purpose buffer. + + +File: pcb.info, Node: Common, Next: Lines, Up: Drawing and Removing + +3.5.1 Common Drawing and Removing Methods +----------------------------------------- + +There are several keystrokes and button events referring to an _object_ +without identifying its type. Here's a list of them: + + __ creates (or deletes) an object depending on the current +mode. + + _BackSpace_ or _Delete_ removes the visible object at the +cursor location. When more than one object exists at the location, the +order of removal is: via, line, text, polygon and element. The drawn +layer order also affects the search - whatever is top - most (except +elements) is affected before lower items. Basically all this means +that what is removed is probably just what you expect. If for some +reason it isn't, undo and try again. Only one object is removed for +each keystroke. If two or more of the same type match, the newest one +is removed. + + Use _s_ and _Shifts_ to change the size (width) of lines, +arcs, text objects, pins, pads and vias, or to toggle the style of +polygons (whether pins and vias automatically have clearances). + + _n_ changes the name of pins, pads, vias, the string of a text +object, or the currently displayed label of an element. + + _m_ moves the line, arc, or polygon under the cross hair to the +active layer if it wasn't on that layer already. + + _u_ (undo) recovers from an unlimited number of operations such +as creating, removing, moving, copying, selecting etc. It works like +you'd expect even if you're in the midst of creating something. + + _Shiftr_ restores the last undone operation provided no other +changes have been made since the undo was performed. + + _tab_ changes the board side you are viewing. + + For a complete list of keystrokes and button events see *note +Translations::. + + +File: pcb.info, Node: Lines, Next: Arcs, Prev: Common, Up: Drawing and Removing + +3.5.2 Lines +----------- + +To draw new lines you have to be in _line-mode_. Get there either by +selecting it from the _Tool palette_ or by pressing _F2_. Each +successive _notify_ event creates a new line. The adjustment to 45 +degree lines is done automatically if it is selected from the _Display_ +menu. You can toggle the 45 degree mode setting by pressing the +_._ (That is the period key). When 45 degree enforcement is turned +on there are three distinct modes of line creation: a single line on +the closest 45 degree vector towards the cross hair (but not necessarily +actually ending at the cross hair), two lines created such that the +first leaves the start point on a 90 degree vector and the second +arrives at the cross hair on a 45 degree vector, and finally two lines +created such that the first leaves the start point on a 45 degree +vector and the second arrives at the cross hair on a 90 degree vector. +These last two modes always connect all the way from the start and end +points, and all lines have angles in 45 degree multiples. The _/_ +cycles through the three modes. The status line shows a text icon to +indicate which of the modes is active and the lines following the cross +hair motion show the outline of the line(s) that will actually be +created. Press _Escape_ to leave line-mode. + + _l_, _Shiftl_ and the entries in the _Sizes_ menu change +the initial width of new lines. This width is also displayed in the +status line. + + +File: pcb.info, Node: Arcs, Next: Polygons, Prev: Lines, Up: Drawing and Removing + +3.5.3 Arcs +---------- + +An Arc is drawn with the _arc-tool_. Get there either by selecting it +from the _Tool palette_ or by pressing _F8_. Press _Btn1_ to +define the starting point for the arc. Drag the mouse towards the +desired end point along the path you want the arc to follow. The +outline of the arc that will be created is shown on the screen as you +move the mouse. Arcs are always forced to be 90 degrees and have +symmetrical length and width ( i.e. they are a quarter circle). The +next _Btn1_ click creates the arc. It will have the same width as new +lines (displayed in the status line) and appear on the active layer. +The arc leaves the starting point towards the cross hair along the axis +whose distance from the cross hair is largest. Normally this means that +if you drag along the path you want the arc to follow, you'll get what +you want. If the grid is set to the arc radius, then the two distances +will be equal and you won't be able to get all of the possible +directions. If this is thwarting your desires, reduce the grid spacing +(_!ShiftG_) and try again. + + +File: pcb.info, Node: Polygons, Next: Text, Prev: Arcs, Up: Drawing and Removing + +3.5.4 Polygons and Rectangles +----------------------------- + +A polygon is drawn by defining all of its segments as a series of +consecutive line segments. If the first point matches a new one and if +the number of points is greater than two, then the polygon is closed. +Since matching up with the first point may be difficult, you may use +_Shiftp_ to close the polygon. The _Shiftp_ won't work if +clipping to 45 degree lines is selected and the final segment cannot +match this condition. I suggest you create simple convex polygons in +order to avoid a strong negative impact on the performance of the +connection scanning routines. The _rectangle-mode_ is just an easy way +to generate rectangular polygons. _Polygon-mode_ also is selected by +_F6_ whereas _rectangle-mode_ uses _F4_. Pressing a __ +at two locations creates a rectangle by defining two of its corners. +_Insert_ brings you to _insert-point-mode_ which lets you add +additional points to an already existing polygon. Single points may be +removed by moving the cross hair to them and selecting one of the +delete actions _(remove-mode, BackSpace, or Delete_. This only works if +the remaining polygon will still have three or more corners. Pressing +_u_ or _p_ while entering a new polygon brings you back to +the previous corner. Removing a point does not force clipping to 45 +degree angles (because it's not generally possible). Newly created +polygons will not connect to pins or vias that pierce it unless you +create a thermal (using the thermal mode) to make the connection. If +the edge of a polygon gets too close to a pin or via that lies outside +of it, a warning will be issued and the pin will be given a special +color. Increasing the distance between them will remove the warning +color. + + +File: pcb.info, Node: Text, Next: Vias, Prev: Polygons, Up: Drawing and Removing + +3.5.5 Text +---------- + +Pressing _F5_ or clicking one of the text selector buttons changes +to _text-mode_. Each successive notify event (__) pops up the +input line at the bottom and queries for a string. Enter it and press +_Return_ to confirm or _Escape_ to abort. The text object is +created with its upper left corner at the current pointer location. +The initial scaling is changed by _t_ and _Shiftt_ or from +the _Sizes_ menu. + + Now switch to _rotate-mode_ and press __ at the text-objects +location. Text objects on the solder side of the layout are +automatically mirrored and flipped so that they are seen correctly when +viewing the solder-side. + + Use _n_ to edit the string. + + TEXT OBJECTS ON COPPER LAYERS CREATE COPPER LINES BUT THEY ARE NOT +SCANNED FOR CONNECTIONS. If they are moved to the silkscreen layer, they +no longer create copper. + + +File: pcb.info, Node: Vias, Next: Elements, Prev: Text, Up: Drawing and Removing + +3.5.6 Vias +---------- + +The initial size of new vias may be changed by _v_ and +_Shiftv_ or by selecting the appropriate entry from the _Sizes_ +menu. _Mod1v_ and _Mod1 Shiftv_ do the same for the drilling +hole of the via. The statusline is updated with the new values. +Creating a via is similar to the other objects. Switch to _via-mode_ by +using either the selector button or _F1_ then press _]_ or +__ to create one. _n_ changes the name of a via. If you +want to create a mounting hole for your board, then you can place a via +where you want the hole to be then convert the via into a hole. The +conversion is done by pressing _!Ctrlh_ with the cross hair over +the via. Conceptually it is still a via, but it has no copper annulus. +If you create such a hole in the middle of two polygons on different +layers, it will short the layers. Theoretically you could arrange for +such a hole not to be plated, but a metal screw inserted in the hole +would still risk shorting the layers. A good rule is to realize that +holes in the board really are vias between the layers and so place them +where they won't interfere with connectivity. You can convert a hole +back into a normal via with the same keystroke used to convert it in +the first place. + + +File: pcb.info, Node: Elements, Next: Pastebuffer, Prev: Vias, Up: Drawing and Removing + +3.5.7 Elements +-------------- + +Some of the functions related to elements only work if both the package +layer and the pin layer are switched on. + + Now that you're familiar with many of the basic commands, it is time +to put the first element on the layout. First of all, you have to load +data into the paste buffer. There are four ways to do this: + 1) load the data from a library + 2) load the data from a file + 3) copy data from an already existing element + 4) convert objects in the buffer into an element + We don't have any elements on the screen yet nor anything in the +buffer, so we use number one. + + Select _lsi_ from the menu in the library window press __ +twice at the appropriate text-line to get the MC68030 CPU. The data is +loaded and the mode is switched to _pastebuffer-mode_. Each notify +event now creates one of these beasts. Leave the mode by selecting a +different one or by _Escape_ which resets all modes.. The cross +hair is located at the _mark_ position as defined by the data file. +Rotating the buffer contents is done by selecting the _rotate_ entry of +the _Buffer_ menu or by pressing _ShiftF3_. The contents of the +buffer are valid until new data is loaded into it either by a +cut-to-buffer operation, copy-to-buffer operation or by loading a new +data file. There are 5 buffers available (possibly more or less if +changed at compile time with the `MAX_BUFFER' variable in +`globalconfig.h'). Switching between them is done by selecting a menu +entry or by _Shift1..MAX_BUFFER_. Each of the two board sides has +its own buffers. + + The release includes all data files for the circuits that are used +by the demo layout. The elements in the LED example are not found in +the library, but you can lift them from the example itself if you want. +If you have problems with the color of the cross hair, change the +resource _cross hairColor_ setting to a different one. + + Now load a second circuit, the MC68882 FPU for example. Create the +circuit as explained above. You now have two different unnamed +elements. Unnamed means that the layout-name of the element hasn't been +set yet. Selecting _description_ from the _Display_ menu displays the +description string of the two circuits which are CPU and FPU. The +values of the circuits are set to MC68030 and MC68882. Each of the +names of an element may be changed by _n_ at the elements location +and editing the old name in the bottom input line. Naming pins and vias +is similar to elements. You can hide the element name so that it won't +appear on the board silkscreen by pressing _h_ with the cursor +over the element. Doing so again un-hides the element name. + + Entering `:le' and selecting an element data file is the second way +to load circuits. + + The third way to create a new element is to copy an existing one. +Please refer to *note Moving and Copying::. + + The fourth way to create a new element is to convert a buffer's +contents into an element. Here's how it's done: Select the Via-tool +from the _Tool pallet_. Set the grid spacing to something appropriate +for the element pin spacing. Now create a series of vias where the pins +go. Create them in pin number order. It is often handy to place a +reference point (_!Ctrlm_) in the center of the first pin in order +to measure the location of the other pins. Next make a solder-side +layer the active layer from the _active-layer_ popup menu. Now draw +the outline of the element using lines and arcs. When you're done, +select everything that makes up the element with a box selection +(_ drag, _). Now select "cut selection to buffer" +from the _Buffer_ menu. Position the cursor over the center of pin 1 +and press the left button to load the data into the buffer. Finally +select "convert buffer to element" from the _Buffer_ menu. You'll only +want to create elements this way if they aren't already in the library. +It's also probably a good idea to do this before starting any of the +other aspects of a layout, but it isn't necessary. + + To display the pinout of a circuit move to it and press _Shiftd_ +or select _show pinout_ from the _Objects_ menu. A new window pops up +and displays the complete pinout of the element. This display can be +difficult to read if the component has been rotated 90 degrees :-( +therefore, the new window will show an un-rotated view so the pin names +are readable. _d_ displays the name of one or all pins/pads +inside the Layout area, this is only for display on-screen, it has no +effect on any printing of the layout. + + You also may want to change a pin's or pad's current size by pressing +_s_ to increase or _Shifts_ to decrease it. While this is +possible, it is not recommended since care was probably taken to define +the element structure in the first place. You can also change the +thickness of the element's silkscreen outline with the same keys. You +can change whether a pin or SMD pad is rounded or square with the +_q_. SMD pads should usually have squared ends. Finally, you can +change whether the non-square pins are round or octagonal with the +_!Ctrlo_. + + SMD elements and silkscreen objects are drawn in the "invisible +object" color if they are located on the opposite side of the board. + + For information on element connections refer to *note Connection +Lists::. + + +File: pcb.info, Node: Pastebuffer, Prev: Elements, Up: Drawing and Removing + +3.5.8 Pastebuffer +----------------- + +The line-stack and element-buffer of former releases have been replaced +by 5 (possibly more or less if changed at compile time with the +`MAX_BUFFER' variable in `globalconfig.h') multi-purpose buffers that +are selected by _Shift1..MAX_BUFFER_. The status line shows which +buffer is the active one. You may load data from a file or layout into +them. Cut-and-paste works too. If you followed the instructions +earlier in this chapter you should now have several objects on the +screen. Move the cross hair to one of them and press __ to +toggle its selection flag. (If you drag the mouse while the button is +down, a box selection will be attempted instead of toggling the +selection.) The object is redrawn in a different color. You also may +want to try moving the pointer while holding the third button down and +release it on a different location. This selects all objects inside the +rectangle and unselects everything else. If you want to add a box +selection to an existing selection, drag with _Mod1_ instead. +Dragging _Shift Mod1_ unselects objects in a box. Now change +to _pastebuffer-mode_ and select some operations from the _Buffer_ +menu. Copying objects to the buffer is available as _Mod1c_ while +cutting them uses _Mod1x_ as shortcut. Both clear the buffer +before new data is added. If you use the menu entries, you have to +supply a cross hair position by pressing a mouse button. The objects +are attached to the pastebuffer relative to that cross hair location. +Element data or PCB data may be merged into an existing layout by +loading the datafiles into the pastebuffer. Both operations are +available from the _File_ menu or as user commands. + + +File: pcb.info, Node: Moving and Copying, Next: Loading and Saving, Prev: Drawing and Removing, Up: Getting Started + +3.6 Moving and Copying +====================== + +All objects can be moved including element-names, by __, +dragging the pointer while holding the button down and releasing it at +the new location of the object. If you use _Mod1_ instead, +the object is copied. Copying does not work for element-names of +course. You can move all selected objects with _Shift _. This +uses the Pastebuffer, so it will remove whatever was previously in the +Pastebuffer. Please refer to *note Pastebuffer::. If you want to give +a small nudge to an object, but you don't think that the mouse will +give you the fine level of control that you want, you can position the +cursor over the object, press _[_, move it with the arrow keys, +then press _]_ when it's at the desired position. Remember that +all movements are forced onto grid coordinates, so you may want to +change the grid spacing first. + + To move a trace or group of traces to a different layer, first select +the tracks to be moved. It's easiest to do this if you shut off +everything but that layer first (i.e. silk, pins, other layers, etc). +Now set the current layer to be the new layer. Press Shift-M to move +all the selected tracks to the current layer. See the +_MoveToCurrentLayer_ action for more details. + + +File: pcb.info, Node: Loading and Saving, Next: Printing, Prev: Moving and Copying, Up: Getting Started + +3.7 Loading and Saving +====================== + +After your first experience with `Pcb' you will probably want to save +your work. `:s name' passes the data to an external program which is +responsible for saving it. For details see _saveCommand_ in *note +Resources::. Saving also is available from the _File_ menu, either +with or without supplying a filename. `Pcb' reuses the last filename if +you do not pass a new one to the save routine. + + To load an existing layout either select _load layout data_ from the +_File_ menu or use `:l filename'. A file select box pops up if you +don't specify a filename. Merging existing layouts into the new one is +supported either by the _File_ menu or by `:m filename'. + + `Pcb' saves a backup of the current layout at a user specified +interval. The backup filename is created by appending a dash, "-", to +the `.pcb' filename. For example, if you are editing the layout in +`projects/board.pcb' then the backup file name will be +`projects/board.pcb-'. If the layout is new and has not been saved +yet, then the backup file name is `PCB.####.backup' where the "####" +will be replaced by the process ID of the currenting running copy of +`Pcb'. This default backup file name may be changed at compilation +time via the `BACKUP_NAME' variable in `globalconfig.h'). During +critical sections of the program or when data would be lost it is saved +as `PCB.%i.save'. This file name may be changed at compile time with +the `SAVE_NAME' variable in `globalconfig.h'. + + +File: pcb.info, Node: Printing, Next: Exporting, Prev: Loading and Saving, Up: Getting Started + +3.8 Printing +============ + +`Pcb' now has support for device drivers, `PostScript', _encapsulated +PostScript_, and _Gerber RS-274X_ drivers are available so far. The +_Gerber RS-274X_ driver additionally generates a numerical control (NC) +drill file for automated drilling, a bill of materials file to assist +in materials procurement and inventory control, and a centroid (X-Y) +file which includes the centroid data needed by automatic assembly +(pick and place) machines. I recommend the use of `GhostScript' if you +don't have a `PostScript' printer for handling the PostScript output. +Printing always generates a complete set of files for a specified +driver. See the page about the _Print()_ action for additional +information about the filenames. The control panel offers a number of +options. Most of them are not available for Gerber output because it +wouldn't make sense, for example, to scale the gerber output (you'd +get an incorrectly made board!) The options are: + +`device' + The top menu button selects from the available device drivers. + +`rotate' + Rotate layout 90 degrees counter-clockwise before printing + (default). + +`mirror' + Mirror layout before printing. Use this option depending on your + production line. + +`color' + Created colored output. All colors will be converted to black if + this option is inactive. + +`outline' + Add a board outline to the output file. The size is determined by + the maximum board size changeable from the _sizes_ menu. The + outline appears on the top and bottom sides of the board, but not + on the internal layers. An outline can be useful for determining + where to shear the board from the panel, but be aware that it + creates a copper line. Thus it has the potential to cause short + circuits if you don't leave enough room from your wiring to the + board edge. Use a viewer to see what the output outline looks like + if you want to know what it looks like. + +`alignment' + Additional alignment targets are added to the output. The + distances between the board outline is set by the resource + _alignmentDistance_. Alignment targets should only be used if you + know for certain that YOU WILL BE USING THEM YOURSELF. It is + extremely unlikely that you will want to have alignment targets if + you send gerber files to a commercial pcb manufacture to be made. + +`scaling' + It's quite useful to enlarge your printout for checking the layout. + Use the scrollbar to adjust the scaling factor to your needs. + +`media' + Select the size of the output media from this menu. The user + defined size may be set by the resource _media_ either from one of + the well known paper sizes or by a `X11' geometry specification. + This entry is only available if you use `X11R5' or later. For + earlier releases the user defined size or, if not available, _A4_ + is used. Well known size are: + A3 + A4 + A5 + letter + tabloid + ledger + legal + executive + +`offset' + Adjust the offsets of the printout by using the panner at the + right side of the dialog box. This entry is only available if you + use `X11R5' or later. A zero offset is used for earlier releases. + +`8.3 filenames' + Select this button to generate DOS compatible filenames for the + output files. The _command_ input area will disappear if selected. + +`commandline' + Use this line to enter a command (starts with `|') or a filename. + A %f is replaced by the current filename. The default is set by + the resource _printCommand_. + + + The created file includes some labels which are guaranteed to stay +unchanged +`PCBMIN' + identifies the lowest x and y coordinates in mil. + +`PCBMAX' + identifies the highest x and y coordinates in mil. + +`PCBOFFSET' + is set to the x and y offset in mil. + +`PCBSCALE' + is a floating point value which identifies the scaling factor. + +`PCBSTARTDATA' +`PCBENDDATA' + all layout data is included between these two marks. You may use + them with an `awk' script to produce several printouts on one + piece of paper by duplicating the code and putting some + `translate' commands in front. Note, the normal `PostScript' + units are 1/72 inch. + + +File: pcb.info, Node: Exporting, Next: Arrow Tool, Prev: Printing, Up: Getting Started + +3.9 Exporting a layout +====================== + +To export a layout choose _Export layout_ from the _File_ menu, then +select the desired exporter. + +* Menu: + +* bom:: Bill of materials. +* gcode:: G-code. +* gerber:: Gerber. +* nelma:: Nelma. +* png:: Image. +* ps:: Postscript. +* eps:: Eps. + + +File: pcb.info, Node: bom, Next: gcode, Up: Exporting + +3.9.1 Bill of materials (bom) +----------------------------- + +Produces a bill of materials (BOM) file and a centroid (XY) file. + + +File: pcb.info, Node: gcode, Next: gerber, Prev: bom, Up: Exporting + +3.9.2 G-code (gcode) +-------------------- + +The gcode exporter can generate RS274/NGC G-CODE files to be used with +a CNC mill to produce pcb's by mechanically removing copper from the +perimeter of all elements. + + The elements are enlarged in order to compensate for the cutting +tool size so that the remaining copper corresponds to the original +size; however all polygons are left unchanged and will end up being a +little smaller; this is not a problem because the electrical connection +is done with traces, which are correctly enlarged. + + A .cnc file is generated for every copper layer, with the bottom +layer mirrored so that the milling is done right; of course it's not +possible to produce directly multi-layer (more than 2) pcb's with this +method, but the cnc files for intermediate layers are generated anyways. + + A drill file is also generated, and it contains all drills +regardless of the hole size; the drilling sequence is optimized in +order to require the least amount of movement. + + The export function generates an intermediate raster image before +extracting the contour of copper elements, and this image is saved as +well (in .png format) for inspection. + + When the spacing between two elements is less than the tool diameter +they will merge and no isolation will be cut between them; the control +image should be checked for this behaviour. + + Possible workarounds are: increasing spacing, decreasing the tool +size, increasing the intermediate image resolution. + + To maximize the chance of producing correct pcb's it would be better +to increase the DRC clearance to at least the tool diameter and use +traces as thick as possible; the rule is: use the largest element that +will not prevent the isolation cut. + + The exporter parameters are: + +basename + base name for generated files + +dpi + intermediate image resolution; affects precision when extracting + contours + +mill depth + should be the copper depth + +safe z + Z value when moving between polygons + +tool radius + copper elements are enlarged by this amount + +drill depth + depth of drills + +measurement unit + for all parameters above, can be mm,um,inch,mil; g-code is always + mm or inch + + All .cnc files specify Z values as parameters, so that it's easy to +change them without the need to run the exporter again. + + Operation was verified with the EMC2 g-code interpreter. + + Following is a sample layout that is converted with default settings: [image src="gcode.png" alt="Sample Layout"] + +The control image shows that the spacing is sufficient: [image src="gcode_control_img.png" alt="Control Image"] + +The final tool path follows the perimeter of all elements: [image src="gcode_tool_path.png" alt="Resulting Tool Path"] + + +File: pcb.info, Node: gerber, Next: nelma, Prev: gcode, Up: Exporting + +3.9.3 Gerber (gerber) +--------------------- + +Produces RS274-X (a.k.a. gerber) photo plot files and Excellon drill +files. + + +File: pcb.info, Node: nelma, Next: png, Prev: gerber, Up: Exporting + +3.9.4 Nelma (nelma) +------------------- + +Numerical analysis package export. + + +File: pcb.info, Node: png, Next: ps, Prev: nelma, Up: Exporting + +3.9.5 Image (png) +----------------- + +Produces GIF/JPEG/PNG image files. + + +File: pcb.info, Node: ps, Next: eps, Prev: png, Up: Exporting + +3.9.6 Postscript (ps) +--------------------- + +Export as postscript. Can be later converted to pdf. + + +File: pcb.info, Node: eps, Prev: ps, Up: Exporting + +3.9.7 Encapsulated Postscript (eps) +----------------------------------- + +Export as eps (encapsulated postscript) for inclusion in other +documents. Can be later converted to pdf. + + +File: pcb.info, Node: Connection Lists, Prev: Vendor drill mapping, Up: Getting Started + +3.10 Connection Lists +===================== + +After completing parts of your layout you may want to check if all drawn +connections match the ones you have in mind. This is probably best done +in conjunction with a net-list file: see *note Rats Nest::. The +following examples give more rudimentary ways to examine the +connections. + 1) create at least two elements and name them + 2) create some connections between their pins + 3) optionally add some vias and connections to them + + Now select _lookup connection_ from the _Connections_ menu, move the +cursor to a pin or via and press any mouse button. `Pcb' will look for +all other pins and/or vias connected to the one you have selected and +display the objects in a different color. Now try some of the reset +options available from the same menu. + + There also is a way to scan all connections of one element. Select +_a single element_ from the menu and press any button at the element's +location. All connections of this element will be saved to the +specified file. Either the layout name of the element or its canonical +name is used to identify pins depending on the one which is displayed +on the screen (may be changed by _Display_ menu). + + An automatic scan of all elements is initiated by choosing _all +elements_. It behaves in a similar fashion to scanning a single element +except the resource _resetAfterElement_ is used to determine if +connections should be reset before a new element is scanned. Doing so +will produce very long lists because the power lines are rescanned for +every element. By default the resource is set to _false_ for this +reason. + + To scan for unconnected pins select _unused pins_ from the same menu. + + +File: pcb.info, Node: Arrow Tool, Next: Rats Nest, Prev: Exporting, Up: Getting Started + +3.11 Arrow Tool +=============== + +Some commands mentioned earlier in this chapter also are able to +operate on all selected and visible objects. The Arrow tool is used to +select/deselect objects and also to move objects or selections. If you +click and release on an object with the Arrow tool, it will unselect +everything else and select the object. Selected objects change color to +reflect that they are selected. If you _Shift_ click, it will add the +object to (or remove) the object from the existing selection. If you +drag with the mouse button down with the Arrow tool, one of several +things could happen: if you first pressed the button on a selected +object, you will be moving the selection to where you release the +button. If you first pressed the button on an unselected object, you +will be moving that object. If you first pressed the button over empty +space, you will be drawing a box to select everything inside the box. +The _Shift_ key works the same way with box selections as it does with +single objects. + + Moving a single un-selected object is different from moving a +selection. First of all, you can move the end of line, or a point in a +polygon this way which is impossible by moving selections. Secondly, if +rubber banding is turned on, moving a single object will rubber-band +the attached lines. Finally, it is faster to move a single object this +way since there is no need to select it first. + + You can select any visible object unless it is locked. If you select +an object, then turn off its visibility with the Layer controls, it +won't be moved if you move the remaining visible selection. + + If you have not configured to use strokes in the `Pcb' user +interface, then the middle mouse button is automatically bound to the +arrow tool, regardless of the active tool (which is bound to the first +mouse button). So using the middle button any time is just like using +the first mouse button with the Arrow tool active. + + The entries of the _Selection_ menu are hopefully self-explanatory. +Many of the _Action Commands_ can take various key words that make them +function on all or some of the selected items. + + +File: pcb.info, Node: Rats Nest, Next: Design Rule Checking, Prev: Arrow Tool, Up: Getting Started + +3.12 Rats Nest +============== + +If you have a netlist that corresponds to the layout you are working +on, you can use the rats-nest feature to add rat-lines to the layout. +First you will need to load a netlist file (see _:rn_, *note User +Commands::). _w_ adds rat-lines on the active layer using the +current line thickness shown in the status line (usually you'll want +them to be thin lines). Only those rat-lines that fill in missing +connectivity (since you have probably routed some connections already) +are added. If the layout is already completely wired, nothing will be +added, and you will get a message that the wiring is complete. + + Rat-lines are lines having the special property that they only +connect to pins and pads at their end points. Rat-lines may be drawn +differently to other lines to make them easier to identify since they +have special behavior and cannot remain in a completed layout. +Rat-lines are added in the minimum length straight-line tree pattern +(always ending on pins or pads) that satisfies the missing connectivity +in the circuit. Used in connection with moves and rotates of the +elements, they are extremely useful for deciding where to place +elements on the board. The rat-lines will always automatically +rubberband to the elements whether or not the rubberband mode is on. +The only way for you to move them is by moving the parts they connect +to. This is because it is never desirable to have the rat-lines +disconnected from their element pins. Rat-lines will normally +criss-cross all over which gives rise to the name "rats nest" +describing a layout connected with them. If a SMD pad is unreachable +on the active layer, a warning will be issued about it and the rat-line +to that pad will not be generated. + + A common way to use rats nests is to place some elements on the +board, add the rat-lines, and then use a series of moves/rotates of the +elements until the rats nest appears to have minimum tangling. You may +want to iterate this step several times. Don't worry if the layout +looks messy - as long as you can get a sense for whether the +criss-crossing is better or worse as you move things, you're fine. +After moving some elements around, you may want to optimize the rats +nest _o_ so that the lines are drawn between the closest points +(this can change once you've moved components). Adding rat-lines only +to selected pads/pins (_Shiftw_) is often useful to layout a +circuit a little bit at a time. Sometimes you'll want to delete all +the rat-lines (_e_) or selected rat-lines (_Shifte_) in order +to reduce confusion. With a little practice you'll be able to achieve +a near optimal component placement with the use of a rats nest. + + Rat-lines are not only used for assisting your element placement, +they can also help you to route traces on the board. Use the _m_ +to convert a rat-line under the cursor into a normal line on the active +layer. Inserting a point into a rat-line will also cause the two new +lines to be normal lines on the board. Another way that you can use +rat-lines is to use the _f_ with the cursor over a pad or pin. +All of the pins and pads and rat-lines belonging to that net will be +highlighted. This is a helpful way to distinguish one net from the rest +of the rats nest. You can then route those tracks, turn off the +highlighting (_Shiftf_) and repeat the process. This will work even +if the layer that the rat-lines reside on is made invisible - so only +the pins and pads are highlighted. Be sure to erase the rat-lines +(_e_ erases them all) once you've duplicated their connectivity by +adding your own lines. When in doubt, the _o_ will delete only +those rat-lines that are no longer needed. + + If connections exist on the board that are not listed in the netlist +when _w_ is pressed, warning messages are issued and the affected +pins and pads are drawn in a special _warnColor_ until the next +_Notify()_ event. If the entire layout agrees completely with the +netlist, a message informs you that the layout is complete and no +rat-lines will be added (since none are needed). If the layout is +complete, but still has rat-lines then you will be warned that +rat-lines remain. If you get no message at all it's probably because +some elements listed in the net list can't be found and where reported +in an earlier message. There shouldn't be any rat-lines left in a +completed layout, only normal lines. + + The _Shiftw_ is used to add rat-lines to only those missing +connections among the selected pins and pads. This can be used to add +rat-lines in an incremental manner, or to force a rat-line to route +between two points that are not the closest points within the net. +Often it is best to add the rats nest in an incremental fashion, laying +out a sub-section of the board before going further. This is easy to +accomplish since new rat-lines are never added where routed +connectivity already makes the necessary connections. + + +File: pcb.info, Node: Design Rule Checking, Next: Trace Optimizer, Prev: Rats Nest, Up: Getting Started + +3.13 Design Rule Checking +========================= + +After you've finished laying out a board, you may want to check to be +certain that none of your interconnections are too closely spaced or +too tenuously touching to be reliably fabricated. The design rule +checking (DRC) function does this for you. Use the command ":DRC()" +(without the quotes of course) to invoke the checker. If there are no +problem areas, you'll get a message to that effect. If any problem is +encountered, you will get a message about it and the affected traces +will be highlighted. One part of the tracks of concern will be +selected, while the other parts of concern will have the +"FindConnection" highlighting. The screen will automatically be +centered in the middle of the object having the "FindConnection" +(Green) highlighting. The middle of the object is also the coordinates +reported to be "near" the problem. The actual trouble region will be +somewhere on the boundary of this object. If the two parts are from +different nets then there is some place where they approach each other +closer than the minimum rule. If the parts are from the same net, then +there is place where they are only barely connected. Find that place +and connect them better. + + After a DRC error is found and corrected you must run the DRC again +because the search for errors is halted as soon as the first problem is +found. Unless you've been extremely careless there should be no more +than a few design rule errors in your layout. The DRC checker does not +check for minimum spacing rules to copper text, so always be very +careful when adding copper text to a layout. The rules for the DRC are +specified in the application resource file. The minimum spacing value +(in mils) is given by the _Settings.Bloat_ value. The default is 7 +mils. The minimum touching overlap (in mils) is given by the +_Settings.Shrink_ value. This value defaults to 5 mils. Check with your +fabrication process people to determine the values that are right for +you. + + If you want to turn off the highlighting produced by the DRC, +perform an undo (assuming no other changes have been made). To restore +the highlighting, use redo. The redo will restore the highlighting +quickly without re-running the DRC checker. + + +File: pcb.info, Node: Trace Optimizer, Next: Searching for elements, Prev: Design Rule Checking, Up: Getting Started + +3.14 Trace Optimizer +==================== + +PCB includes a flexible trace optimizer. The trace optimizer can be run +after auto routing or hand routing to clean up the traces. + +Auto-Optimize + Performs debumpify, unjaggy, orthopull, vianudge, and viatrim, in + that order, repeating until no further optimizations are performed. + +Debumpify + Looks for U shaped traces that can be shortened or eliminated. + +Unjaggy + Looks for corners which could be flipped to eliminate one or more + corners (i.e. jaggy lines become simpler). + +Vianudge + Looks for vias where all traces leave in the same direction. Tries + to move via in that direction to eliminate one of the traces (and + thus a corner). + +Viatrim + Looks for traces that go from via to via, where moving that trace + to a different layer eliminates one or both vias. + +Orthopull + Looks for chains of traces all going in one direction, with more + traces orthogonal on one side than on the other. Moves the chain + in that direction, causing a net reduction in trace length, + possibly eliminating traces and/or corners. + +SimpleOpts + Removing unneeded vias, replacing two or more trace segments in a + row with a single segment. This is usually performed automatically + after other optimizations. + +Miter + Replaces 90 degree corners with a pair of 45 degree corners, to + reduce RF losses and trace length. + + + +File: pcb.info, Node: Searching for elements, Next: Measuring distances, Prev: Trace Optimizer, Up: Getting Started + +3.15 Searching for elements +=========================== + +To locate text or a specific element or grouping of similar elements +choose `Select by name' from the Select menu, then choose the +appropriate subsection. At the bottom of the screen the prompt +_pattern:_ appears. Enter the text or *note Regular Expressions:: of +the text to be found. Found text will be highlighted. + + +File: pcb.info, Node: Measuring distances, Next: Vendor drill mapping, Prev: Searching for elements, Up: Getting Started + +3.16 Measuring distances +======================== + +To measure distances, for example the pin-to-pin pitch of a part to +validate a footprint, place the cursor at the starting measurement +point, then press _!Ctrlm_. This marks the current location with +a _X_. The _X_ mark is now the zero point origin for the relative +cursor position display. The cursor display shows both absolute +position and position relative to the mark as the mouse is moved away +from the mark. If a mark is already present, the mark is removed and +the cursor display stops displaying relative cursor coordinates. + + +File: pcb.info, Node: Vendor drill mapping, Next: Connection Lists, Prev: Measuring distances, Up: Getting Started + +3.17 Vendor Drill Mapping +========================= + +`Pcb' includes support for mapping drill holes to a specified set of +sizes used by a particular vendor. Many PCB manufacturers have a +prefered set of drill sizes and charge extra when others are used. The +mapping can be performed on an existing design and can also be enabled +to automatically map drill holes as vias and elements are instantiated. + + The first step in using the vendor drill mapping feature is to create +a resource file describing the capabilities of your vendor. The file +format is the resource file format described in *note Resource Syntax::. +A complete example is given below. + + # Optional name of the vendor + vendor = "Vendor Name" + + # units for dimensions in this file. + # Allowed values: mil/inch/mm + units = mil + + # drill table + drillmap = { + # When mapping drill sizes, select the nearest size + # or always round up. Allowed values: up/nearest + round = up + + # The list of vendor drill sizes. Units are as specified + # above. + 20 + 28 + 35 + 38 + 42 + 52 + 59.5 + 86 + 125 + 152 + + # optional section for skipping mapping of certain elements + # based on reference designator, value, or description + # this is useful for critical parts where you may not + # want to change the drill size. Note that the strings + # are regular expressions. + skips = { + {refdes "^J3$"} # Skip J3. + {refdes "J3"} # Skip anything with J3 as part of the refdes. + {refdes "^U[1-3]$" "^X.*"} # Skip U1, U2, U3, and anything starting with X. + {value "^JOHNSTECH_.*"} # Skip all Johnstech footprints based on the value of a part. + {descr "^AMP_MICTOR_767054_1$"} # Skip based on the description. + } + } + + # If specified, this section will change the current DRC + # settings for the design. Units are as specified above. + drc = { + copper_space = 7 + copper_width = 7 + silk_width = 10 + copper_overlap = 4 + } + + The vendor resource is loaded using the _LoadVendor_ action. This +is invoked by entering: + :LoadVendor(vendorfile) + from within `Pcb'. Substitute the file name of your vendor resource +file for `vendorfile'. This action will load the vendor resource and +modify all the drill holes in the design as well as the default via +hole size for the various routing styles. + + Once a vendor drill map has been loaded, new vias and elements will +automatically have their drill hole sizes mapped to the vendor drill +table. Automatic drill mapping may be disabled under the "Settings" +menu. To re-apply an already loaded vendor drill table to a design, +choose "Apply vendor drill mapping" from the "Connects" menu. + + See *note Actions:: for a complete description of the actions +associated with vendor drill mapping. + + Note that the expressions used in the `skips' section are regular +expressions. See *note Regular Expressions:: for an introduction to +regular expressions. + + +File: pcb.info, Node: Autorouter, Next: User Commands, Prev: Getting Started, Up: Top + +4 Autorouter +************ + +`Pcb' includes an autorouter which can greatly speed up the layout of a +circuit board. The autorouter is a rectangle-expansion type of +autorouter based on "A Method for Gridless Routing of Printed Circuit +Boards" by A. C. Finch, K. J. Mackenzie, G. J. Balsdon, and G. Symonds +in the 1985 Proceedings of the 22nd ACM/IEEE Design Automation +Conference. This reference is available from the ACM Digital Library at +`http://www.acm.org/dl' for those with institutional or personal access +to it. It's also available from your local engineering library. The +reference paper is not needed for using the autorouter. + + Before using the autorouter, all elements need to be loaded into the +layout and placed and the connectivity netlist must be loaded. Once +the elements have been placed and the netlist loaded, the following +steps will autoroute your design. + + 1. Turn off visibility of any layers that you don't want the router + to use. + + 2. Turn of via visibility if you don't want the router to use any new + vias. + + 3. Use only plain rectangles for power/ground planes that you want + the router to use [use the rectangle tool!] + + 4. Make at least one connection from any plane you want the router to + use to the net you want it to connect to. + + 5. Draw continuous lines (on all routing layers) to outline keep-out + zones if desired. + + 6. Use routing styles in the netlist to have per-net routing styles. + Note that the routing style will be used for an entire net. This + means if you have a wide metal setting for a power net you will + need to manually route breakouts from any fine pitch parts on + their power pins because the router will not be able to change + to a narrow trace to connect to the part. + + 7. Set the current routing style to whatever you'd like the router to + use for any nets not having a defined route style in the netlist. + + 8. Disable any nets that you don't want the autorouter to route + (double-click them in the netlist window to add/remove the *) + + NOTE: If you will be manually routing these later not using + planes, it is usually better to let the autorouter route them then + rip them up yourself afterwards. If you plan to use a + ground/power plane manually, consider making it from one or + more pure rectangles and letting the autorouter have a go at it. + + 9. Create a fresh rat's nest. ('E' the 'W') + + 10. Select "show autorouter trials" in the settings menu if you want + to watch what's happening + + 11. Choose "autoroute all rats" in the connection menu. + + 12. If you really want to muck with the router because you have a + special design, e.g. all through-hole components you can mess with + layer directional costs by editing the autoroute.c source file + and changing the directional costs in lines 929-940. and try + again. Even more mucking about with costs is possible in lines + 4540-4569, but it's probably not such a good idea unless you + really just want to experiment. + + + After the design has been autorouted, you may want to run the trace +optimizer. See section *note Trace Optimizer:: for more information on +the trace optimizer. + + +File: pcb.info, Node: User Commands, Next: Command-Line Options, Prev: Autorouter, Up: Top + +5 User Commands +*************** + +The entering of user-commands is initiated by the action routine +_Command()_ (normally bound to the `(":")' character) which replaces +the bottom statusline with an input area or opens a separate command +window. It is finished by either _Return_ or _Escape_ to +confirm or to abort. These two key-bindings cannot be changed from the +resource file. The triggering event, normally a key press, is ignored. + + Commands can be entered in one of two styles, command entry syntax: +"_Command arg1 arg2_" or action script syntax "_Action1(arg1, arg2); +Action2(arg1, arg2);_". Quoting arguments works similar to bash +quoting: + + * A backslash (\) is the escape character. It preserves the literal + value of the next character that follows. To get a literal '\' use + "\\". + + * Enclosing characters in single quotes preserves the literal value + of each character within the quotes. A single quote may not occur + between single quotes, even when preceded by a blackslash. + + * Enclosing characters in double quotes preserves the literal value + of all characters within the quotes, with the exception of '\' + which maintains its special meaning as an escape character. + + There are simple _usage_ dialogs for each command and one for the +complete set of commands. + +`l [filename]' + Loads a new datafile (layout) and, if confirmed, overwrites any + existing unsaved data. The filename and the searchpath + (_filePath_) are passed to the command defined by _fileCommand_. + If no filename is specified a file select box will popup. + +`le [filename]' + Loads an element description into the paste buffer. The filename + and the searchpath (_elementPath_) are passed to the command + defined by _elementCommand_. If no filename is specified a file + select box will popup. + +`m [filename]' + Loads an layout file into the paste buffer. The filename and the + searchpath (_filePath_) are passed to the command defined by + _fileCommand_. If no filename is specified a file select box will + popup. + +`q[!]' + Quits the program without saving any data (after confirmation). + q! doesn't ask for confirmation, it just quits. + +`s [filename]' + Data and the filename are passed to the command defined by the + resource _saveCommand_. It must read the layout data from _stdin_. + If no filename is entered, either the last one is used again or, + if it is not available, a file select box will pop up. + +`rn [filename]' + Reads in a netlist file. If no filename is given a file select + box will pop up. The file is read via the command defined by the + _RatCommand_ resource. The command must send its output to + _stdout_. + + Netlists are used for generating rat's nests (see *note Rats + Nest::) and for verifying the board layout (which is also + accomplished by the _Ratsnest_ command). + +`w[q] [filename]' + These commands have been added for the convenience of `vi' users + and have the same functionality as _s_ combined with _q_. + +`actionCommand' + Causes the actionCommand to be executed. This allows you to + initiate actions for which no bindings exist in the resource file. + It can be used to initiate any action with whatever arguments you + enter. This makes it possible to do things that otherwise would + be extremely tedious. For example, to change the drilling hole + diameter of all vias in the layout to 32 mils, you could select + everything using the selection menu, then type + "_:ChangeDrillSize(SelectedVias, 32)_". (This will only work + provided the via's diameter is sufficiently large to accommodate a + 32 mil hole). Another example might be to set the grid to 1 mil + by typing "_:SetValue(Grid, 1)_". Note that some actions use the + current cursor location, so be sure to place the cursor where you + want before entering the command. This is one of my favorite new + features in 1.5 and can be a powerful tool. Study the *note + Actions:: section to see what actions are available. + + + +File: pcb.info, Node: Command-Line Options, Next: X11 Interface, Prev: User Commands, Up: Top + +6 Command-Line Options +********************** + +The synopsis of the pcb command is: + + `pcb [OPTION ...] [LAYOUT-FILE.pcb]' to start the application in GUI +mode, + +or + + `pcb [-h | -V | --copyright]' for a list of options, version, and +copyright, + +or + + `pcb -p [OPTION ...] [LAYOUT-FILE.pcb]' to print a layout, + +or + + `pcb -x HID [OPTION ...] [LAYOUT-FILE.pcb]' to export. + +Possible values for the parameter `HID' are: +`bom' + Export a bill of materials + +`gcode' + Export to G-Code + +`gerber' + Export RS-274X (Gerber) + +`nelma' + Numerical analysis package export + +`png' + export GIF/JPEG/PNG + +`ps' + export postscript + +`eps' + export encapsulated postscript + +There are several resources which may be set or reset in addition to the +standard toolkit command-line options. For a complete list refer to +*note Resources::. + +* Menu: + +* General Options:: +* General GUI Options:: +* GTK+ GUI Options:: +* lesstif GUI Options:: +* Colors:: +* Layer Names:: +* Paths:: +* Sizes:: +* Commands:: +* DRC Options:: +* BOM Creation:: +* Gerber Export:: +* Postscript Export:: +* Encapsulated Postscript Export:: +* PNG Options:: +* lpr Printing Options:: +* nelma Options:: + + +File: pcb.info, Node: General Options, Next: General GUI Options, Up: Command-Line Options + +6.1 General Options +=================== + +`--help' + Show help on command line options. + +`--version' + Show version. + +`--verbose' + Be verbose on stdout. + +`--copyright' + Show copyright. + +`--show-defaults' + Show option defaults. + +`--show-actions' + Show available actions and exit. + +`--dump-actions' + Dump actions (for documentation). + +`--grid-units-mm ' + Set default grid units. Can be mm or mil. Defaults to mil. + +`--backup-interval' + Time between automatic backups in seconds. Set to `0' to disable. + The default value is `60'. + +`--groups ' + Layer group string. Defaults to `"1,c:2:3:4:5:6,s:7:8"'. + +`--route-styles ' + A string that defines the route styles. Defaults to + `"Signal,1000,3600,2000,1000:Power,2500,6000,3500,1000 + :Fat,4000,6000,3500,1000:Skinny,600,2402,1181,600"' + +`--element-path ' + A colon separated list of directories or commands (starts with + '|'). The path is passed to the program specified in + `--element-command'. + +`--action-script ' + If set, this file is executed at startup. + +`--action-string ' + If set, this string of actions is executed at startup. + +`--fab-author ' + Name of author to be put in the Gerber files. + +`--layer-stack ' + Initial layer stackup, for setting up an export. A comma separated + list of layer names, layer numbers and layer groups. + +`--save-last-command' + If set, the last user command is saved. + +`--save-in-tmp' + If set, all data which would otherwise be lost are saved in a + temporary file `/tmp/PCB.%i.save' . Sequence `%i' is replaced by + the process ID. + +`--reset-after-element' + If set, all found connections are reset before a new component is + scanned. + +`--ring-bell-finished' + Execute the bell command when all rats are routed. + + +File: pcb.info, Node: General GUI Options, Next: GTK+ GUI Options, Prev: General Options, Up: Command-Line Options + +6.2 General GUI Options +======================= + +`--pinout-offset-x ' + Horizontal offset of the pin number display. Defaults to `100mil'. + +`--pinout-offset-y ' + Vertical offset of the pin number display. Defaults to `100mil'. + +`--pinout-text-offset-x ' + Horizontal offset of the pin name display. Defaults to `800mil'. + +`--pinout-text-offset-y ' + Vertical offset of the pin name display. Defaults to `-100mil'. + +`--draw-grid' + If set, draw the grid at start-up. + +`--clear-line' + If set, new lines clear polygons. + +`--full-poly' + If set, new polygons are full ones. + +`--unique-names' + If set, you will not be permitted to change the name of an + component to match that of another component. + +`--snap-pin' + If set, pin centers and pad end points are treated as additional + grid points that the cursor can snap to. + +`--all-direction-lines' + Allow all directions, when drawing new lines. + +`--show-number' + Pinout shows number. + + +File: pcb.info, Node: GTK+ GUI Options, Next: lesstif GUI Options, Prev: General GUI Options, Up: Command-Line Options + +6.3 GTK+ GUI Options +==================== + +`--listen' + Listen for actions on stdin. + +`--bg-image ' + File name of an image to put into the background of the GUI + canvas. The image must be a color PPM image, in binary (not ASCII) + format. It can be any size, and will be automatically scaled to + fit the canvas. + +`--pcb-menu ' + Location of the `gpcb-menu.res' file which defines the menu for + the GTK+ GUI. + + +File: pcb.info, Node: lesstif GUI Options, Next: Colors, Prev: GTK+ GUI Options, Up: Command-Line Options + +6.4 lesstif GUI Options +======================= + +`--listen' + Listen for actions on stdin. + +`--bg-image ' + File name of an image to put into the background of the GUI + canvas. The image must be a color PPM image, in binary (not ASCII) + format. It can be any size, and will be automatically scaled to + fit the canvas. + +`--pcb-menu ' + Location of the `pcb-menu.res' file which defines the menu for the + lesstif GUI. + + +File: pcb.info, Node: Colors, Next: Layer Names, Prev: lesstif GUI Options, Up: Command-Line Options + +6.5 Colors +========== + +`--black-color ' + Color value for black. Default: `#000000' + +`--black-color ' + Color value for white. Default: `#ffffff' + +`--background-color ' + Background color of the canvas. Default: `#e5e5e5' + +`--crosshair-color ' + Color of the crosshair. Default: `#ff0000' + +`--cross-color ' + Color of the cross. Default: `#cdcd00' + +`--via-color ' + Color of vias. Default: `#7f7f7f' + +`--via-selected-color ' + Color of selected vias. Default: `#00ffff' + +`--pin-color ' + Color of pins. Default: `#4d4d4d' + +`--pin-selected-color ' + Color of selected pins. Default: `#00ffff' + +`--pin-name-color ' + Color of pin names and pin numbers. Default: `#ff0000' + +`--element-color ' + Color of components. Default: `#000000' + +`--rat-color ' + Color of ratlines. Default: `#b8860b' + +`--invisible-objects-color ' + Color of invisible objects. Default: `#cccccc' + +`--invisible-mark-color ' + Color of invisible marks. Default: `#cccccc' + +`--element-selected-color ' + Color of selected components. Default: `#00ffff' + +`--rat-selected-color ' + Color of selected rats. Default: `#00ffff' + +`--connected-color ' + Color to indicate connections. Default: `#00ff00' + +`--off-limit-color ' + Color of off-canvas area. Default: `#cccccc' + +`--grid-color ' + Color of the grid. Default: `#ff0000' + +`--layer-color- ' + Color of layer `', where `' is an integer from 1 to 16. + +`--layer-selected-color- ' + Color of layer `', when selected. `' is an integer from 1 to + 16. + +`--warn-color ' + Color of offending objects during DRC. Default value is `"#ff8000"' + +`--mask-color ' + Color of the mask layer. Default value is `"#ff0000"' + + +File: pcb.info, Node: Layer Names, Next: Paths, Prev: Colors, Up: Command-Line Options + +6.6 Layer Names +=============== + +`--layer-name-1 ' + Name of the 1st Layer. Default is `"top"'. + +`--layer-name-2 ' + Name of the 2nd Layer. Default is `"ground"'. + +`--layer-name-3 ' + Name of the 3nd Layer. Default is `"signal2"'. + +`--layer-name-4 ' + Name of the 4rd Layer. Default is `"signal3"'. + +`--layer-name-5 ' + Name of the 5rd Layer. Default is `"power"'. + +`--layer-name-6 ' + Name of the 6rd Layer. Default is `"bottom"'. + +`--layer-name-7 ' + Name of the 7rd Layer. Default is `"outline"'. + +`--layer-name-8 ' + Name of the 8rd Layer. Default is `"spare"'. + + +File: pcb.info, Node: Paths, Next: Sizes, Prev: Layer Names, Up: Command-Line Options + +6.7 Paths +========= + +`--lib-newlib ' + Top level directory for the newlib style library. + +`--lib-name ' + The default filename for the library. + +`--default-font ' + The name of the default font. + +`--file-path ' + A colon separated list of directories or commands (starts with + '|'). The path is passed to the program specified in + `--file-command' together with the selected filename. + +`--font-path ' + A colon separated list of directories to search the default font. + Defaults to the default library path. + +`--lib-path ' + A colon separated list of directories that will be passed to the + commands specified by `--element-command' and + `--element-contents-command'. + + +File: pcb.info, Node: Sizes, Next: Commands, Prev: Paths, Up: Command-Line Options + +6.8 Sizes +========= + +All parameters should be given with an unit. If no unit is given, 1/100 +mil (cmil) will be used. Write units without space to the number like +`3mm', not `3 mm'. Valid Units are: +`km' + Kilometer + +`m' + Meter + +`cm' + Centimeter + +`mm' + Millimeter + +`um' + Micrometer + +`nm' + Nanometer + +`in' + Inch (1in = 0.0254m) + +`mil' + Mil (1000mil = 1in) + +`cmil' + Centimil (1/100 mil) + +`--via-thickness ' + Default diameter of vias. Default value is `60mil'. + +`--via-drilling-hole ' + Default diameter of holes. Default value is `28mil'. + +`--line-thickness ' + Default thickness of new lines. Default value is `10mil'. + +`--rat-thickness ' + Thickness of rats. Values from 1 to 19 are fixed width in screen + pixels. Anything larger means PCB units (i.e. 100 means "1 mil"). + Default value is `10mil'. + +`--keepaway ' + Default minimum distance between a track and adjacent copper. + Default value is `10mil'. + +`--default-PCB-width ' + Default width of the canvas. Default value is `6000mil'. + +`--default-PCB-height ' + Default height of the canvas. Default value is `5000mil'. + +`--text-scale ' + Default text scale. This value is in percent. Default value is + `100'. + +`--alignment-distance ' + Specifies the distance between the board outline and alignment + targets. Default value is `2mil'. + +`--grid ' + Initial grid size. Default value is `10mil'. + +`--minimum polygon area ' + Minimum polygon area. + + +File: pcb.info, Node: Commands, Next: DRC Options, Prev: Sizes, Up: Command-Line Options + +6.9 Commands +============ + +pcb uses external commands for input output operations. These commands +can be configured at start-up to meet local requirements. The command +string may include special sequences `%f', `%p' or `%a'. These are +replaced when the command is called. The sequence `%f' is replaced by +the file name, `%p' gets the path and `%a' indicates a package name. +`--font-command ' + Command to load a font. + +`--file-command ' + Command to read a file. + +`--element-command ' + Command to read a footprint. + Defaults to `"M4PATH='%p';export M4PATH;echo 'include(%f)' | m4"' + +`--print-file ' + Command to print to a file. + +`--lib-command-dir ' + Path to the command that queries the library. + +`--lib-command ' + Command to query the library. + Defaults to `"QueryLibrary.sh '%p' '%f' %a"' + +`--lib-contents-command ' + Command to query the contents of the library. + Defaults to `"ListLibraryContents.sh %p %f"' or, on Windows + builds, an empty string (to disable this feature). + +`--save-command ' + Command to save to a file. + +`--rat-command ' + Command for reading a netlist. Sequence `%f' is replaced by the + netlist filename. + + +File: pcb.info, Node: DRC Options, Next: BOM Creation, Prev: Commands, Up: Command-Line Options + +6.10 DRC Options +================ + +All parameters should be given with an unit. If no unit is given, 1/100 +mil (cmil) will be used for backward compability. Valid units are given +in section *note Sizes::. +`--bloat ' + Minimum spacing. Default value is `10mil'. + +`--shrink ' + Minimum touching overlap. Default value is `10mil'. + +`--min-width ' + Minimum width of copper. Default value is `10mil'. + +`--min-silk ' + Minimum width of lines in silk. Default value is `10mil'. + +`--min-drill ' + Minimum diameter of holes. Default value is `15mil'. + +`--min-ring ' + Minimum width of annular ring. Default value is `10mil'. + + +File: pcb.info, Node: BOM Creation, Next: Gerber Export, Prev: DRC Options, Up: Command-Line Options + +6.11 BOM Creation +================= + +`--bomfile ' + Name of the BOM output file. + +`--xyfile ' + Name of the XY output file. + +`--xy-unit ' + Unit of XY dimensions. Defaults to mil. + + +File: pcb.info, Node: Gerber Export, Next: Postscript Export, Prev: BOM Creation, Up: Command-Line Options + +6.12 Gerber Export +================== + +`--gerberfile ' + Gerber output file prefix. Can include a path. + +`--all-layers' + Output contains all layers, even empty ones. + +`--verbose' + Print file names and aperture counts on stdout. + + +File: pcb.info, Node: Postscript Export, Next: Encapsulated Postscript Export, Prev: Gerber Export, Up: Command-Line Options + +6.13 Postscript Export +====================== + +`--psfile ' + Name of the postscript output file. Can contain a path. + +`--drill-helper' + Print a centering target in large drill holes. + +`--align-marks' + Print alignment marks on each sheet. This is meant to ease + alignment during exposure. + +`--outline' + Print the contents of the outline layer on each sheet. + +`--mirror' + Print mirror image. + +`--fill-page' + Scale output to make the board fit the page. + +`--auto-mirror' + Print mirror image of appropriate layers. + +`--ps-color' + Postscript output in color. + +`--ps-bloat ' + Amount to add to trace/pad/pin edges. + +`--ps-invert' + Draw objects as white-on-black. + +`--media ' + Size of the media, the postscript is fitted to. The parameter + `' can be any of the standard names for paper size: + `A0' to `A10', `B0' to `B10', `Letter', `11x17', `Ledger', + `Legal', `Executive', `A-Size', `B-size', `C-Size', `D-size', + `E-size', `US-Business_Card', `Intl-Business_Card'. + +`--psfade ' + Fade amount for assembly drawings (0.0=missing, 1.0=solid). + +`--scale ' + Scale value to compensate for printer sizing errors (1.0 = full + scale). + +`--multi-file' + Produce multiple files, one per page, instead of a single multi + page file. + +`--xcalib ' + Paper width. Used for x-Axis calibration. + +`--ycalib ' + Paper height. Used for y-Axis calibration. + +`--drill-copper' + Draw drill holes in pins / vias, instead of leaving solid copper. + +`--show-legend' + Print file name and scale on printout. + + +File: pcb.info, Node: Encapsulated Postscript Export, Next: PNG Options, Prev: Postscript Export, Up: Command-Line Options + +6.14 Encapsulated Postscript Export +=================================== + +`--eps-file ' + Name of the encapsulated postscript output file. Can contain a + path. + +`--eps-scale ' + Scale EPS output by the parameter `num'. + +`--as-shown' + Export layers as shown on screen. + +`--monochrome' + Convert output to monochrome. + +`--only-visible' + Limit the bounds of the EPS file to the visible items. + + +File: pcb.info, Node: PNG Options, Next: lpr Printing Options, Prev: Encapsulated Postscript Export, Up: Command-Line Options + +6.15 PNG Options +================ + +`--outfile ' + Name of the file to be exported to. Can contain a path. + +`--dpi' + Scale factor in pixels/inch. Set to 0 to scale to size specified + in the layout. + +`--x-max' + Width of the png image in pixels. No constraint, when set to 0. + +`--y-max' + Height of the png output in pixels. No constraint, when set to 0. + +`--xy-max' + Maximum width and height of the PNG output in pixels. No + constraint, when set to 0. + +`--as-shown' + Export layers as shown on screen. + +`--monochrome' + Convert output to monochrome. + +`--only-vivible' + Limit the bounds of the exported PNG image to the visible items. + +`--use-alpha' + Make the background and any holes transparent. + +`--format ' + File format to be exported. Parameter `' can be `PNG', + `GIF', or `JPEG'. + +`--png-bloat ' + Amount of extra thickness to add to traces, pads, or pin edges. + The parameter `' is a number, appended by a dimension + `mm', `mil', or `pix'. If no dimension is given, the default + dimension is 1/100 mil. + +`--photo-mode' + Export a photo realistic image of the layout. + +`--photo-flip-x' + In photo-realistic mode, export the reverse side of the layout. + Left-right flip. + +`--photo-flip-y' + In photo-realistic mode, export the reverse side of the layout. + Up-down flip. + + +File: pcb.info, Node: lpr Printing Options, Next: nelma Options, Prev: PNG Options, Up: Command-Line Options + +6.16 lpr Printing Options +========================= + +`--lprcommand ' + Command to use for printing. Defaults to `lpr'. This can be used + to produce PDF output with a virtual PDF printer. Example: + `--lprcommand "lp -d CUPS-PDF-Printer"'. +In addition, all *note Postscript Export:: options are valid. + + +File: pcb.info, Node: nelma Options, Prev: lpr Printing Options, Up: Command-Line Options + +6.17 nelma Options +================== + +`-- basename ' + File name prefix. + +`--dpi ' + Horizontal scale factor (grid points/inch). + +`--copper-height ' + Copper layer height (um). + +`--substrate-height ' + Substrate layer height (um). + +`--substrate-epsilon ' + Substrate relative epsilon. + + +File: pcb.info, Node: X11 Interface, Next: File Formats, Prev: Command-Line Options, Up: Top + +7 X11 Interface +*************** + +This chapter gives an overview about the additional `X11' resources +which are defined by `Pcb' as well as the defined action routines. + +* Menu: + +* Resources:: Non-standard `X11' application resources. +* Actions:: A list of available action routines. +* Translations:: A list of the default key translations (as shipped). + + +File: pcb.info, Node: Resources, Next: Actions, Up: X11 Interface + +7.1 Non-Standard X11 Application Resources +========================================== + +In addition to the toolkit resources, `Pcb' defines the following +resources: + +`absoluteGrid (boolean)' + Selects if either the grid is relative to the position where it + has changed last or absolute, the default, to the origin (0,0). + +`alignmentDistance (dimension)' + Specifies the distance between the boards outline to the alignment + targets. + +`allDirectionLines (boolean)' + Enables (default) or disables clipping of new lines to 45 degree + angles. + +`backgroundImage (string)' + If specified, this image will be drawn as the background for the + board. The purpose of this option is to allow you to use a scan + of an existing layout as a prototype for your new layout. To do + this, there are some limitations as to what this image must be. + The image must be a PPM binary image (magic number `P6'). It must + have a maximum pixel value of 255 or less (i.e. no 16-bit images). + It must represent the entire board, as it will be scaled to fit + the board dimensions exactly. Note that it may be scaled unevenly + if the image doesn't have the same aspect ratio of your board. + You must ensure that the image does not use more colors than are + available on your system (mostly this is for pseudo-color + displays, like old 8-bit displays). For best results, I suggest + the following procedure using The Gimp: Load your image (any + type). Image->Scale if needed. Image->Colors->Curves and for + each of Red, Green, and Blue channel move the lower left point up + to about the 3/4 line (value 192). This will make your image pale + so it doesn't interfere with the traces you'll be adding. + Image->Mode->Indexed and select, say, 32 colors with Normal F-S + dithering. File->Save As, file type by extension, use `.ppm' as + the extension. Select Raw formatting. + +`backupInterval (int)' + `Pcb' has an automatic backup feature which saves the current data + every n seconds. The default is _300_ seconds. A value of zero + disables the feature. The backup file is named + `/tmp/PCB.%i.backup' by default (this may have been changed at + compilation time via the `BACKUP_NAME' variable in + `globalconfig.h'). _%i_ is replaced by the process ID. See also, + the command-line option _-backup-interval_. + +`Bloat (dimension)' + Specifies the minimum spacing design rule in mils. + +`connectedColor (color)' + All pins, vias, lines and rectangles which are selected during a + connection search are drawn with this color. The default value is + determined by _XtDefaultForeground_. + +`cross hairColor (color)' + This color is used to draw the cross hair cursor. The color is a + result of a _XOR_ operation with the contents of the Layout area. + The result also depends on the default colormap of the `X11' + server because only the colormap index is used in the boolean + operation and `Pcb' doesn't create its own colormap. The default + setting is _XtDefaultForeground_. + +`elementColor (color)' +`elementSelectedColor (color)' + The elements package part is drawn in these colors, for normal and + selected mode, respectively, which both default to + _XtDefaultForeground_. + +`elementCommand (string)' + `Pcb' uses a user defined command to read element files. This + resources is used to set the command which is executed by the + users default shell. Two escape sequences are defined to pass the + selected filename (%f) and the current search path (%p). The + command must write the element data to its standard output. The + default value is + M4PATH="%p";export M4PATH;echo 'include(%f)' | m4 + Using the GNU version of `m4' is highly recommended. See also, + the command-line option _-element-command_. + +`elementPath (string)' + A colon separated list of directories or commands (starts with + '|'). The path is passed to the program specified in + _elementCommand_ together with the selected element name. A + specified command will be executed in order to create entries for + the fileselect box. It must write its results to _stdout_ one + entry per line. See also, the user-command _le[!]_. + +`fileCommand (string)' + The command is executed by the user's default shell whenever + existing layout files are loaded. Data is read from the command's + standard output. Two escape sequences may be specified to pass + the selected filename (%f) and the current search path (%p). The + default value is: + cat %f + See also, the command-line option _-file-command_. + +`filePath (string)' + A colon separated list of directories or commands (starts with + '|'). The path is passed to the program specified in + _fileCommand_ together with the selected filename. A specified + command will be executed in order to create entries for the + fileselect box. It must write its results to _stdout_ one entry + per line. See also, the user-command _l[!]_. + +`fontCommand (string)' + Loading new symbol sets also is handled by an external command. + You again may pass the selected filename and the current search + path by passing %f and %p in the command string. Data is read from + the commands standard output. This command defaults to + cat %f + See also, the command-line option _-font-command_. + +`fontFile (string)' + The default font for new layouts is read from this file which is + searched in the directories as defined by the resource _fontPath_. + Searching is only performed if the filename does not contain a + directory component. The default filename is `default_font'. + +`fontPath (string)' + This resource, a colon separated list of directories, defines the + searchpath for font files. See also, the resource _fontFile_. + +`grid (int)' + This resources defines the initial value of one cursor step. It + defaults to _100 mil_ and any changes are saved together with the + layout data. + +`gridColor (color)' + This color is used to draw the grid. The color is a result of a + _INVERT_ operation with the contents of the Layout area. The result + also depends on the default colormap of the `X11' server because + only the colormap index is used in the boolean operation and `Pcb' + doesn't create its own colormap. The default setting is + _XtDefaultForeground_. + +`invisibleObjectsColor (color)' + Elements located on the opposite side of the board are drawn in + this color. The default is _XtDefaultForeground_. + +`layerColor1..MAX_LAYER (color)' +`layerSelectedColor1..MAX_LAYER (color)' + These resources define the drawing colors of the different layers + in normal and selected state. All values are preset to + _XtDefaultForeground_. + +`layerGroups (string)' + The argument to this resource is a colon separated list of comma + separated layer numbers (1..MAX_LAYER). All layers within one + group are switched on/off together. The default setting is + _1:2:3:...:MAX_LAYER_ which means all layers are handled + separately. Grouping layers one to three looks like + _1,2,3:4:...:MAX_LAYER_ + +`layerName1..MAX_LAYER (string)' + The default name of the layers in a new layout are determined by + these resources. The defaults are empty strings. + +`libraryCommand (string)' + `Pcb' uses a command to read element data from libraries. The + resources is used to set the command which is executed by the users + default shell. Three escape sequences are defined to pass the + selected filename (%f), the current search path (%p) as well (%a) + as the three parameters _template_, _value_ and _package_ to the + command. It must write the element data to its standard output. + The default value is + NONE/share/pcb/oldlib/QueryLibrary.sh %p %f %a + +`libraryContentsCommand (string)' + Similar to _libraryCommand_, `Pcb' uses the command specified by + this resource to list the contents of a library. + NONE/share/pcb/oldlib/ListLibraryContents.sh %p %f + is the default. + +`libraryFilename (string)' + The resource specifies the name of the library. The default value + is _pcblib_ unless changed at compile time with the + `LIBRARYFILENAME' variable in `globalconfig.h'. + +`libraryPath (string)' + A colon separated list of directories that will be passed to the + commands specified by _elementCommand_ and + _elementContentsCommand_. + +`lineThickness (dimension)' + The value, in the range [1..250] (the range may be changed at + compile time with the `MIN_LINESIZE' and `MAX_LINESIZE' variables + in `globalconfig.h'), defines the initial thickness of new lines. + The value is preset to _ten mil_. + +`media ( | x+-+-)' + The default (user defined) media of the `PostScript' device. + Predefined values are _a3_, _a4_, _a5_, _letter_, _tabloit_, + _ledger_, _legal_, and _executive_. The second way is to specify + the medias width, height and margins in mil. The resource + defaults to _a4_ size unless changed at compile time with the + `DEFAULT_MEDIASIZE' variable in `globalconfig.h'. + +`offLimitColor (color)' + The area outside the current maximum settings for width and height + is drawn with this color. The default value is determined by + _XtDefaultBackground_. + +`pinColor (color)' +`pinSelectedColor(color)' + This resource defines the drawing color of pins and pads in both + states. The values are preset to _XtDefaultForeground_. + +`pinoutFont (string)' + This fonts are used to display pin names. There is one font for + each zoom value. The values are preset to _XtdefaultFont_. + +`pinoutNameLength (int)' + This resource limits the number of characters which are displayed + for pin names in the pinout window. By default the string length + is limited to _eight_ characters per name. + +`pinoutOffsetX (int)' +`pinoutOffsetY (int)' + These resources determine the offset in _mil_ of the circuit from + the upper left corner of the window when displaying pinout + information. Both default to _100 mil_. + +`pinoutTextOffsetX (int)' +`pinoutTextOffsetY (int)' + The resources determine the distance in mil between the drilling + hole of a pin to the location where its name is displayed in the + pinout window. They default to _X:50_ and _Y:0_. + +`pinoutZoom (int)' + Sets the zoom factor for the pinout window according to the + formula: scale = 1:(2 power value). Its default value is _two_ + which results in a _1:4_ scale. + +`printCommand (string)' + Default file for printouts. If the name starts with a '|' the + output is piped through the command. A %f is replaced by the + current filename. There is no default file or command. + +`raiseLogWindow (boolean)' + The log window will be raised when new messages arrive if this + resource is set _true_, the default. + +`ratCommand (string)' + Default command for reading a netlist. A %f is replaced by the + netlist filename. Its default value is "_cat %f_". + +`ratPath (string)' + Default path to look for netlist files. It's default value is "." + +`resetAfterElement (boolean)' + If set to _true_, all found connections will be reset before a new + element is scanned. This will produce long lists when scanning the + whole layout for connections. The resource is set to _false_ by + default. The feature is only used while looking up connections of + all elements. + +`ringBellWhenFinished (boolean)' + Whether to ring the bell (the default) when a possibly lengthy + operation has finished or not. See also, the command-line option + _-ring-bell-finished_. + +`routeStyle (string)' + Default values for the menu of routing styles (seen in the sizes + menu). The string is a comma separated list of name, line + thickness, via diameter, and via drill size. e.g. + "Fat,50,100,40:Skinny,8,35,20:75Ohm,110,110,20" See also, the + command-line option _-route-styles_ and _Sizes Menu_ + +`rubberBandMode (boolean)' + Whether rubberband move and rotate (attached lines stretch like + rubberbands) is enabled (the default). + +`saveCommand (string)' + This command is used to save data to a layout file. The filename + may be indicated by placing `%f' in the string. It must read the + data from its standard input. The default command is: + cat - > %f + See also, the command-line option _-save-command_. + +`saveInTMP (boolean)' + Enabling this resource will save all data which would otherwise be + lost in a temporary file `/tmp/PCB.%i.save'. The file name may be + changed at compile time with the `EMERGENCY_NAME' variable in + `globalconfig.h'. . _%i_ is replaced by the process ID. As an + example, loading a new layout when the old one hasn't been saved + would use this resource. See also, the command-line option + _-save-in-tmp_. + +`saveLastCommand (boolean)' + Enables the saving of the last entered user command. The option is + _disabled_ by default. See also, the command-line option + _-save-last-command_. + +`Shrink (dimension)' + Specifies the minimum overlap (touching) design rule in mils. + +`size (x)' + Defines the width and height of a new layout. The default is + _7000x5000_ unless changed at compile time with the `DEFAULT_SIZE' + variable in `globalconfig.h'. + +`stipllePolygons (boolean)' + Determines whether to display polygons on the screen with a + stippled pattern. Stippling can create some amount of + transparency so that you can still (to some extent) see layers + beneath polygons. It defaults to False. + +`textScale (dimension)' + The font scaling in percent is defined by this resource. The + default is _100_ percent. + +`useLogWindow (boolean)' + Several subroutines send messages to the user if an error occurs. + This resource determines if they appear inside the log window or + as a separate dialog box. See also, the resource _raiseLogWindow_ + and the command line option _-loggeometry_. The default value is + _true_. + +`viaColor (color)' + +`viaSelectedColor (color)' + This resource defines the drawing color of vias in both states. + The values are preset to _XtDefaultForeground_. + +`viaThickness (dimension)' +`viaDrillingHole (dimension)' + The initial thickness and drilling hole of new vias. The values + must be in the range [30..400] (the range may be changed at compile + time with the `MIN_PINORVIASIZE' and `MAX_PINEORVIASIZE' variables + in `globalconfig.h'), with at least 20 mil of copper. The default + thickness is _40 mil_ and the default drilling hole is _20 mil_. + +`volume (int)' + The value is passed to `XBell()' which sets the volume of the `X' + speaker. The value lies in the range -100..100 and it defaults to + the maximum volume of _100_. + +`warnColor (color)' + This resources defines the color to be used for drawing pins and + pads when a warning has been issued about them. + +`zoom (int)' + The initial value for output scaling is set according to the + following formula: scale = 1:(2 power value). It defaults to + _three_ which results in an output scale of _1:8_. + + + Refer also to *note Command-Line Options::. + + +File: pcb.info, Node: Actions, Next: Translations, Prev: Resources, Up: X11 Interface + +7.2 Actions +=========== + +All user accessible commands may be bound to almost any `X' event. +Almost no default binding for commands is done in the binaries, so it +is vital for the application that at least a system-wide application +resource file exists. This file normally resides in the `share/pcb' +directory and is called `Pcb'. The bindings to which the manual refers +to are the ones as defined by the shipped resource file. Besides +binding an action to an X11 event, you can also execute any action +command using a ":" command (see *note User Commands::). + + Take special care about translations related to the functions keys +and the pointer buttons because most of the window managers use them +too. Change the file according to your hardware/software environment. +You may have to replace all occurances of _baseTranslations_ to +_translations_ if you use a `X11R4' server. + + Passing _Object_ as an argument to an action routine causes the +object at the cursor location to be changed, removed or whatever. If +more than one object is located at the cross hair position the smallest +type is used. If there are two of the same type the newer one is taken. +_SelectedObjects_ will handle all selected and visible objects. + +`AddRats(AllRats|SelectedRats)' + Adds rat-lines to the layout using the loaded netlist file (see + the _:rn_, *note User Commands::.). Rat lines are added on the + active layer using the current line thickness shown in the status + line. Only missing connectivity is added by the AddRats command + so if, for example, the layout is complete nothing will be added. + Rat lines may be drawn different to other lines on the screen to + make them easier to identify since they cannot appear in a + completed layout. The rat-lines are added in the minimum length + straight-line tree pattern (always ending on pins or pads) that + satisfies the missing connectivity in the circuit. If a SMD pad + is unreachable on the active layer, a warning will be issued about + it and the rat-line to that pad will not be generated. If + connections exist on the board which are not listed in the netlist + while AllRats are being added, warning messages will be issued and + the affected pins and pads will be drawn in a special _warnColor_ + until the next _Notify()_ event. If the entire layout agrees + completely with the net-list a message informs you that the layout + is complete and no rat-lines are added (since none are needed). + If _SelectedRats_ is passed as the argument, only those missing + connections that might connect among the selected pins and pads + are drawn. Default: + Nonew: AddRats(AllRats) + !Shiftw: AddRats(SelectedRats) + Noneo: DeleteRats(AllRats) AddRats(AllRats) + !Shifto: DeleteRats(SelectedRats) AddRats(SelectedRats) + +`ApplyVendor()' + Applies an already loaded vendor drill map to the design. + ApplyVendor() + +`Atomic(Save|Restore|Block|Close)' + Controls the undo grouping of sequences of actions. Before the + first action in a group, Atomic(Save) should be issued. After + each action that might be undoable, Atomic(Restore) should be + issued. Atomic(Block) concludes and save the undo grouping if + there was anything in the group to undo. Atomic(Close) concludes + and save the undo grouping even if nothing was actually done. + Thus it might produce an "empty" undo. This can be useful when + you want to use undo in a group of actions. + +`Bell([-100..100])' + Rings the bell of your display. If no value is passed the setting + of the resource _volume_ will be used. + +`ChangeClearSize(Object, value[, unit])' +`ChangeClearSize(SelectedPins|SelectedVias, value[, unit])' + The effect of this action depends on if the soldermask display is + presently turned on or off. If soldermask is displayed, then the + soldermask relief size will be changed. If soldermask display is + turned off, then the clearance to polygons will be changed. + _unit_ is "mil" or "mm". If not specified the units will default + to the internal unit of 0.01 mil. + !Mod1k: ChangeClearSize(Object, +2, mil) + !Mod1 Shiftk: ChangeClearSize(Object, -2, mil) + +`ChangeDrillSize(Object, value[, unit])' +`ChangeDrillSize(SelectedPins|SelectedVias, value[, unit])' + This action routine changes the drilling hole of pins and vias. + If _value_ starts with + or -, then it adds (or subtracts) _value_ + from the current hole diameter, otherwise it sets the diameter to + the value. _unit_ is "mil" or "mm". If not specified the units + will default to the internal unit of 0.01 mil. Default: + !Mod1s: Change2ndSize(Object, +5, mil) + !Mod1 Shifts: Change2ndSize(Object, -5, mil) + +`ChangeFlag(Object|SelectElements|SelectedPins|SelectedVias|Selected,thermal|octagon|square,0|1)' + Sets/clears the indicated flag. This adds/removes thermals, + adds/removes the flag which indicates a pin/pad should be square, + or adds/removes the flag which indicates a pin/pad should be + octagonal. + :ChangeFlag(SelectedVias,thermal,1) + :ChangeFlag(SelectedPads,square,0) + +`ChangeHole(Object|SelectedVias)' + This action routine converts a via to and from a hole. A hole is + a via that has no copper annulus. The drill size for the via + determines the hole diameter. + !Ctrlh: ChangeHole(Object) + +`ChangeName(Object)' +`ChangeName(Layer|Layout)' + Changes the name of the visible object at the cursor location. A + text object doesn't have a name therefore the text string itself + is changed. The element name currently used for display is always + the one changed with this command. See + _Display(Description|NameOnPCB|Value)_ for details. Passing + _Layer_ changes the current layers name. Default: + Nonen: ChangeName(Object) + +`ChangeOctagon(Object|SelectElements|SelectedPins|SelectedVias|Selected)' + Toggles what shape the affected pin(s) or via(s) will be drawn + when they are not square. The shape will either be round or + octagonal. Default: + !Ctrlo: ChangeOctagon(Object) + +`ChangePinName(ElementName, PinNumber, PinName)' + Changes the name for a specified pin or pad number on a specified + element. This action is typically used to forward annotate + pin/pad names from a schematic to the layout. + ChangePinName(U1, 14, VDD) + +`ChangeSize(Object, value[, unit])' +`ChangeSize(SelectedLines|SelectedPins|SelectedVias, value[, unit])' +`ChangeSize(SelectedPads|SelectedTexts|SelectedNames, value[, unit])' +`ChangeSize(SelectedElements, value[, unit])' + To change the size of an object you have to bind these action to + some `X' event (or use :ChangeSize(...)). If _value_ begins with + a + or - then the value will be added (or subtracted) from the + current size, otherwise the size is set equal to _value_. Range + checking is done to insure that none of the maximum/minimums of + any size are violated. If _Object_ is passed then a single object + at the cursor location is changed. If any of the _Selected_ + arguments are passed then all selected and visible objects of that + type are changed. If the type being modified is an element, then + the thickness of the silkscreen lines defining the element is + changed. _unit_ is "mil" or "mm". If not specified the units + will default to the internal unit of 0.01 mil. Default: + Nones: ChangeSize(Object, +5) + !Shifts: ChangeSize(Object, -5) + +`ChangeSquare(Object|SelectedElements|SelectedPins)' + Toggles the setting of the square flag. The flag is used to + identify a certain pin, normally the first one, of circuits. It is + also used to make SMD pads have square ends. + Noneq: ChangeSquare(Object) + +`ClrFlag(Object|SelectElements|SelectedPins|SelectedVias|Selected,thermal|octagon|square)' + Clears the indicated flag. This removes thermals, removes the flag + which indicates a pin/pad should be square, or removes the flag + which indicates a pin/pad should be octagonal. + :ClrFlag(SelectedVias,thermal) + +`Command()' + Calling _Command()_ pops up an input line at the bottom of the + window which allows you to enter commands. Including all action + commands! The dialog ends when _NoneReturn_ to confirm or + _NoneEscape_ to abort is entered. Default: + colon: Command() + +`Connection(Find)' +`Connection(ResetFoundLinesAndRectangles|ResetPinsViasAndPads|Reset)' + The _Connection()_ action is used to mark all connections from one + pin, line or via to others. The _ResetFoundLinesAndRectangles, + ResetFoundPinsAndVias_ and _Reset_ arguments may be used to reset + all marked lines and rectangles, vias and pins or all of them. The + search starts with the pin or via at the cursor position. All + found objects are drawn with the color defined by the resource + _connectedColor_. See also, + _Display(Description|NameOnPCB|Value)_. Default: + !Shiftc: Connection(Reset) + Nonef: Connection(Find) + !Shiftf: Connection(Reset) + +`DeleteRats(AllRats|SelectedRats)' + This routine deletes either all rat-lines in the layout, or only + the selected and visible ones. Non-rat-lines and other layout + objects are unaffected. Default: + Nonee: DeleteRats(AllRats) + !Shifte: DeleteRats(SelectedRats) + +`DisableVendor()' + Disables automatic drill size mapping to the loaded vendor drill + table. + DisableVendor() + +`DisperseElements(All|Selected)' + Disperses either all elements or only the selected elements in the + layout. This action should be used at the start of a design to + spread out all footprints before any placement or routing is done. + DisperseElements(All) + +`Display(Description|NameOnPCB|Value)' +`Display(Toggle45Degree|CycleClip)' +`Display(Grid|ToggleGrid)' +`Display(ToggleRubberBandMode)' +`Display(Center|ClearAndRedraw|Redraw)' +`Display(Pinout|PinOrPadName)' + This action routines handles some output related settings. It is + used to center the display around the cursor location and to + redraw the output area optionally after clearing the window. + Centering is done with respect to the _grid_ setting. Displaying + the grid itself may be switched on and off by _Grid_ but only if + the distance between two pixels exceeds 4 pixels. `Pcb' is able + to handle several labels of an element. One of them is a + description of the functionality (eg resistor), the second should + be a unique identifier (R1) whereas the last one is a value (100k). + The _Display()_ action selects which of the names is displayed. + It also controls which name will be affected by the _ChangeName_ + command. If _ToggleGrid_ is passed, `Pcb' changes between relative + ('rel' in the statusline) and absolute grid (an 'abs' in the + statusline). Relative grid means the pointer position when the + command is issued is used as the grid origin; while (0,0) is used + in the absolute grid case. Passing _Pinout_ displays the pinout + of the element at the current cursor location whereas + _PinOrPadName_ toggles displaying of the pins or pads name under + the cursor. If none of them matches but the cursor is inside of an + element, the flags is toggled for all of its pins and pads. For + details about rubberbands see also the details about _Mode_. + Default: + Nonec: Display(Center) + Noned: Display(PinOrPadName) + !Shiftd: Display(Pinout) + Noner: Display(ClearAndRedraw) + None.: Display(Toggle45Degree) + None/: Display(CycleClip) + +`DRC()' + Initiates design rule checking of the entire layout. Must be + repeated until no errors are found. + +`ExecuteFile(filename)' + Executes the PCB actions contained in the specified file. This + can be used to automate a complex sequence of operations. + :ExecuteFile(custom.cmd) + The command file contains a list of PCB actions. Blank lines are + ignored and lines starting with a # are treated as comment lines. + For example + # This is a comment line + Display(Grid) + SetValue(Zoom,2) + DRC() + +`EditLayerGroups()' + Pops up a dialog box to edit the layergroup setting. The function + is also available from the _Objects_ menu. There are no defaults. + +`EnableVendor()' + Enables automatic drill size mapping to the loaded vendor drill + table. + EnableVendor() + +`Load(ElementToBuffer|Layout|LayoutToBuffer|Nelist)' + This routine pops up a fileselect box to load layout, element data, + or netlist. The passed filename for layout data is saved and may + be reused. _ElementToBuffer_ and _LayoutToBuffer_ load the data + into the current buffer. There are no defaults. + +`LoadVendor(vendorfile)' + Loads the specified vendor resource file. + LoadVendor(myvendor.res) + +`MarkCrosshair()' + This routine marks the current cursor location with an X, and then + the cursor display shows both absolute position and position + relative to the mark. If a mark is already present, this routine + removes it and stops displaying relative cursor coordinates. + Defaults: + !Ctrlm: MarkCrosshair() + +`Mode(Copy|InsertPoint|Line|Move|None|PasteBuffer|Polygon|Thermal)' +`Mode(Remove|Rectangle|RubberbandMove|Text|Via)' +`Mode(Cycle)' +`Mode(Notify)' +`Mode(Save|Restore)' + Switches to a new mode of operation. The active mode is displayed + by a thick line around the matching mode selector button. Most of + the functionality of `Pcb' is implemented by selecting a mode and + calling _Mode(Notify)_. The arguments _Line_, _Polygon_, + _Rectangle_, _Text_ and _Via_ are used to create the appropriate + object whenever _Mode(Notify)_ is called. Some of them, such as + _Polygon_, need more than one call for one object to be created. + _InsertPoint_ adds points to existing polygons or lines. _Save_ + and _Restore_ are used to temporarily save the mode, switch to + another one, call _Mode(Notify)_ and restore the saved one. Have a + look at the application resource file for examples. _Copy_ and + _Move_ modes are used to change an object's location and, + optionally, to create a new one. The first call of _Mode(Notify)_ + attaches the object at the pointer location to the cross hair + whereas the second one drops it to the layout. The _rubberband_ + version of move performs the move while overriding the current + rubberband mode. Passing _PasteBuffer_ attaches the contents of + the currently selected buffer to the cross hair. Each call to + _Mode(Notify)_ pastes this contents to the layout. _Mode(Cycle)_ + cycles through the modes available in the mode-button pallet. + _Mode(None)_ switches all modes off. Default: + Escape: Mode(None) + space: Mode(Cycle) + NoneBackSpace: Mode(Save) Mode(Remove) Mode(Notify) Mode(Restore) + NoneDelete: Mode(Save) Mode(Remove) Mode(Notify) Mode(Restore) + NoneF1: Mode(Via) + NoneF2: Mode(Line) + NoneF3: Mode(PasteBuffer) + NoneF4: Mode(Rectangle) + NoneF5: Mode(Text) + NoneF6: Mode(Polygon) + NoneF7: Mode(Thermal) + NoneF8: Mode(Arc) + NoneInsert: Mode(InsertPoint) + None[: Mode(Save) Mode(Move) Mode(Notify) + None]: Mode(Notify) Mode(Restore) + None: Mode(Notify) + !Shift Ctrl: Mode(Save) Mode(Remove) Mode(Notify) Mode(Restore) + None: Mode(Save) Mode(Move) Mode(Notify) + None: Mode(Notify) Mode(Restore) + !Mod1: Mode(Save) Mode(Copy) Mode(Notify) + !Mod1: Mode(Notify) Mode(Restore) + Shift BTNMOD: Mode(Save) Mode(RubberbandMove) Mode(Notify) + +`MovePointer(delta_x, delta_y)' + With this function it is possible to move the cross hair cursor by + using the cursor keys. The `X' server's pointer follows because + the necessary events are generated by `Pcb'. All movements are + performed with respect to the currently set grid value. Default: + NoneUp: MovePointer(0, -1) + !ShiftUp: MovePointer(0, -10) + NoneDown: MovePointer(0, 1) + !ShiftDown: MovePointer(0, 10) + NoneRight: MovePointer(1, 0) + !ShiftRight: MovePointer(10, 0) + NoneLeft: MovePointer(-1, 0) + !ShiftLeft: MovePointer(-10, 0) + +`MoveToCurrentLayer(Object|SelectedObjects)' + The function moves a single object at the cross hair location or + all selected objects to the current layer. Elements are not + movable by this function. They have to be deleted and replaced on + the other side. If a line segment is moved and the movement would + result in a loss of connectivity to another segment then via(s) + are automatically added to maintain the connectivity. + Nonem: MoveToCurrentLayer(Object) + !Shiftm: MoveToCurrentLayer(SelectedObjects) + +`New()' + Clear the current layout and starts a new one after entering its + name. Refer to the resource _backup_ for more information. No + defaults. + +`PasteBuffer(AddSelected|Clear|1..5)' +`PasteBuffer(Rotate, 1..3)' +`PasteBuffer(Convert)' + This action routine controls and selects the pastebuffer as well + as all cut-and-paste operations. Passing a buffer number selects + one in of the range 1..5. The statusline is updated with the new + number. _Rotate_ performs a number of 90 degree counter clockwise + rotations of the buffer contents. _AddSelected_ as first argument + copies all selected and visible objects into the buffer. Passing + _Clear_ removes all objects from the currently selected buffer. + _Convert_ causes the contents of the buffer (lines, arc, vias) to + be converted into an element definition. Refer to *note + Pastebuffer:: for examples. Default: + !Ctrlx: PasteBuffer(Clear) PasteBuffer(AddSelected) + Mode(PasteBuffer) + !Shift Ctrlx: PasteBuffer(Clear) PasteBuffer(AddSelected) + RemoveSelected() Mode(PasteBuffer) + !Mod1c: PasteBuffer(Clear) PasteBuffer(AddSelected) + !Mod1x: PasteBuffer(Clear) PasteBuffer(AddSelected) + RemoveSelected() + !Shift1: PasteBuffer(1) + !Shift2: PasteBuffer(2) + !Shift3: PasteBuffer(3) + !Shift4: PasteBuffer(4) + !Shift5: PasteBuffer(5) + NoneF3: Mode(PasteBuffer) + +`Polygon((Close|PreviousPoint)' + Polygons need a special action routine to make life easier. Calling + _Polygon(PreviousPoint)_ resets the newly entered corner to the + previous one. The Undo action will call Polygon(PreviousPoint) + when appropriate to do so. _Close_ creates the final segment of + the polygon. This may fail if clipping to 45 degree lines is + switched on, in which case a warning is issued. Default: + Nonep: Polygon(Close) + !Shiftp: Polygon(Close) + +`Print()' + Pops up a print control box that lets you select the output + device, scaling and many more options. Each run creates all files + that are supported by the selected device. These are mask files as + well as drilling files, silk screens and so on. The table shows + the filenames for all possible files: + POSIX (extension) 8.3 filename + --------------------------------------------- + *_componentmask.* cmsk.* + *_componentsilk.* cslk.* + *_soldermask.* smsk.* + *_soldersilk.* sslk.* + *_drill.* dril.* + *_groundplane.* gpl.* + *_group[1..8].* [..8].* + The output may be sent to a post-processor by starting the + filename with the _pipe_ `("|")' character. Any `"%f"' in a + command is replaced with the current filename. The function is + available from the _file_ menu. There are no defaults. + +`Quit()' + Quits the application after confirming the operation. Default: + WM_PROTOCOLS: Quit() + +`Redo()' + This routine allows you to recover from the last undo command. + You might want to do this if you thought that undo was going to + revert something other than what it actually did (in case you are + confused about which operations are un-doable), or if you have + been backing up through a long undo list and over-shoot your + stopping point. Any change that is made since the undo in + question will trim the redo list. For example if you add ten + lines, then undo three of them you could use redo to put them + back, but if you move a line on the board before performing the + redo, you will lose the ability to "redo" the three "undone" lines. + Default: + !Shiftr: Redo() + +`RemoveSelected()' + This routine removes all visible and selected objects. There are + no defaults. + +`Report(Object|DrillReport)' + This routine pops up a dialog box describing the various + characteristics of an object (or piece of an object such as a pad + or pin) in the layout at the cursor position, or a report about + all of the drill holes in the layout. There are no defaults. + +`RouteStyle(1|2|3|4)' + This routine copies the sizes corresponding to the numbered route + style into the active line thickens, via diameter, and via drill + size. Defaults: + !Ctrl1: RouteStyle(1) + ... + !CtrlNUM_STYLES: RouteStyle(NUM_STYLES) + The variable `NUM_STYLES' is set at compile time in + `globalconfig.h'. + +`Save(Layout|LayoutAs)' +`Save(AllConnections|AllUnusedPins|ElementConnections)' + Passing _Layout_ saves the layout using the file from which it was + loaded or, if it is a new layout, calls _Save(LayoutAs)_ which + queries the user for a filename. The values: _AllConnections_, + _AllUnusedPins_ and _ElementConnections_ start a connection scan + and save all connections, all unused pins or the connections of a + single element to a file. There are no defaults. + +`Select(All|Block|Connection|ToggleObject)' +`Select(ElementByName|ObjectByName|PadByName|PinByName)' +`Select(TextByName|ViaByName)' + Toggles either the selection flag of the object at the cross hair + position (_ToggleObject_) or selects all visible objects, all + inside a rectangle or all objects which have been found during the + last connection scan. The _ByName_ functions use a *note Regular + Expressions:: search, always case insensitive, to select the + objects. Default: + None: Select(ToggleObject) + None,None: See resource file - this is complex + +`SetFlag(Object|SelectElements|SelectedPins|SelectedVias|Selected,thermal|octagon|square)' + Sets the indicated flag. This adds thermals, sets the flag which + indicates a pin/pad should be square, or sets the flag which + indicates a pin/pad should be octagonal. + :SetFlag(Selected,thermal) + +`SetValue(Grid|LineSize|TextScale|ViaDrillingHole|ViaSize|Zoom, value)' + Some internal values may be changed online by this function. The + first parameter specifies which data has to be changed. The other + one determines if the resource is set to the passed value, if + _value_ is specified without sign, or increments/decrements if it + is specified with a plus or minus sign. The function doesn't + change any existing object only the initial values of new objects. + Use the _ChangeSize()_ and _ChangeDrillSize()_ to change existing + objects. Default: + Noneg: SetValue(Grid, +5) + !Shiftg: SetValue(Grid, -5) + Nonel: SetValue(LineSize, +5) + !Shiftl: SetValue(LineSize, -5) + Nonet: SetValue(TextScale, +10) + !Shiftt: SetValue(TextScale, -10) + Nonev: SetValue(ViaSize, +5) + !Shiftv: SetValue(ViaSize, -5) + !Mod1v: SetValue(ViaDrillingHole, +5) + !Mod1 Shiftv: SetValue(ViaDrillingHole, -5) + Nonez: SetValue(Zoom, -1) + !Shiftz: SetValue(Zoom, +1) + +`SwapSides()' + This routine changes the board side you are viewing. Default: + NoneTab: SwapSides() + +`SwitchDrawingLayer(value)' + Makes layer number 1..MAX_LAYER the current one. Default: + None1: SwitchDrawingLayer(1) + ... + NoneMAX_LAYER: SwitchDrawingLayer(MAX_LAYER) + +`ToggleHideName(Object|SelectedElements)' + Toggles whether the element's name is displayed or hidden. If it + is hidden you won't see it on the screen and it will not appear on + the silk layer when you print the layout. + Noneh: ToggleHideName(Object) + !Shifth: ToggleHideName(SelectedElements) + +`ToggleVendor()' + Toggles automatic drill size mapping to the loaded vendor drill + table. + ToggleVendor() + +`ToggleVisibility(Layer)' + Toggles the visibility of the layer. + Mod11: ToggleVisibility(1) + Mod12: ToggleVisibility(2) + Mod13: ToggleVisibility(3) + Mod14: ToggleVisibility(4) + +`Undo()' +`Undo(ClearList)' + The unlimited undo feature of `Pcb' allows you to recover from + most operations that materially affect you work. Calling _Undo()_ + without any parameter recovers from the last (non-undo) operation. + _ClearList_ is used to release the allocated memory. _ClearList_ + is called whenever a new layout is started or loaded. See also + _Redo_. Default: + Noneu: Undo() + !Shift Ctrlu: Undo(ClearList) + +`UnloadVendor()' + Unloads the loaded vendor drill table. + UnloadVendor() + +`Unselect(All|Block|Connection)' + Unselects all visible objects, all inside a rectangle or all + objects which have been found during the last connection scan. + Default: + !Shift : Mode(Save) Mode(None) Unselect(Block) + !Shift : Unselect(Block) Mode(Restore) + + + +File: pcb.info, Node: Translations, Prev: Actions, Up: X11 Interface + +7.3 Default Translations +======================== + +This section covers some default translations of key and button events +as defined in the shipped default application resource file. Most of +them have already been listed in *note Actions::. `Pcb' makes use of a +nice `X11' feature; calling several action routines for one event. + +`NoneBackSpace:' + +`NoneDelete:' +`!ShiftBackSpace:' +`!Shift Ctrl:' + The object at the cursor location is removed by + _NoneBackSpace_ or _Shift Ctrl_ whereas + _ShiftBackSpace_ also removes all other objects that are + fully-connected to the one at the cursor location. + +`!Mod1 CtrlLeft:' +`!Mod1 CtrlRight:' +`!Mod1 CtrlUp:' +`!Mod1 CtrlDown:' + Scroll one page in one of the four directions. + +`NoneLeft:, !ShiftLeft:' +`NoneRight:, !ShiftRight:' +`NoneUp:, !ShiftUp:' +`NoneDown:, !ShiftDown:' + Move cross hair either one or ten points in grid. + +`NoneReturn:' + Finished user input, selects the 'default' button of dialogs. + +`NoneEscape:' + _Mode(Reset)_, aborts user input, selects the 'abort' button of + dialogs or resets all modes. + +`None, Btn2, None:' +`!Mod1, Btn2, !Mod1:' + The first sequence moves the object or element name at the cursor + location. The second one copies the objects. Copying isn't + available for element names. + + + +File: pcb.info, Node: File Formats, Next: Library Creation, Prev: X11 Interface, Up: Top + +8 File Formats +************** + +All files used by `Pcb' are read from the standard output of a command +or written to the standard input of one as plain seven bit `ASCII'. This +makes it possible to use any editor to change the contents of a layout +file. It is the only way for element or font description files to be +created. To do so you'll need to study the example files `example/*' +and `default_font' which are shipped with `Pcb'. For an overview refer +to *note Intro::. + + The following sections provide the necessary information about the +syntax of the files. Netlist files are not created by `Pcb', but it +does use them. For information on the format of a netlist file see the +_:rn_, *note User Commands::. The commands described allow you to add +almost any additional functionality you may need. Examples are +compressed read and write access as well as archives. The commands +themselves are defined by the resources _elementCommand_, +_fileCommand_, _fontCommand_, _libraryCommand_, +_libraryContentsCommand_ and _saveCommand_. Note that the commands are +not saved along with the data. It is considered an advantage to have +the layout file contain all necessary information, independent of any +other files. + + One thing common to all files is they may include comments, newlines, +and carriage returns at any place except within quoted strings. + +* Menu: + +* Pad and Line Representation:: +* Layout File:: +* Element File:: +* Font File:: +* Netlist File:: +* Library Contents File:: +* Library File:: +* File Syntax:: +* Object Flags:: +* PCBFlags:: + + +File: pcb.info, Node: Pad and Line Representation, Next: Layout File, Up: File Formats + +8.1 Pad and Line Representation +=============================== + +Pads and lines (copper traces, silk screen lines, etc) are represented +by the line end points and the aperture used to draw the line. It is +important to understand this when creating the pads for a new +footprint. The following figure illustrates a pad or line which is +drawn using a square aperture. The end points (X0,Y0), (X1,Y1) specify +the center of the aperture. The size parameter specifies the size of +the aperture. + + [image src="pad.png" alt="Pad Layout"] + +Pads and lines are represented in this way because this is how lines are +specified in RS-274X (Gerber) files which are used for creating the +masks used in board manufacturing. In fact, older mask making +equipment created lines in precisely this fashion. A physical aperture +was used to pass light through onto a photosensitive film. + + +File: pcb.info, Node: Layout File, Next: Element File, Prev: Pad and Line Representation, Up: File Formats + +8.2 Layout File Format +====================== + +The layout file describes a complete layout including symbols, vias, +elements and layers with lines, rectangles and text. This is the most +complex file of all. As `Pcb' has evolved, the file format has changed +several times to accommodate new features. `Pcb' has always been able +to read all older versions of the `.pcb' file. This allows the +migration of older designs to newer versions of the program. Obviously +older versions of `Pcb' will not be able to properly read layout files +stored in newer versions of the file format. + + In practice it is very common for footprint libraries to contain +elements which have been defined in various versions of the `Pcb' file +format. When faced with trying to understand an element file or layout +file which includes syntax not defined here, the best approach is to +examine the file `src/parse_y.y' which is the definitive definition of +the file format. + + The PCB layout file contains the following contents, in this order +(individual items are defined in *note File Syntax::: + +`PCB' + This names the board and sets its size + +`Grid' + Optional. + +`Cursor' + Optional. + +`Flags' + Optional. + +`Groups' + Optional. + +`Styles' + Optional. + +`Symbols' + Optional. + +`Vias, Rats, Layers, and Elements' + These may occur in any order, at this point in the file. + +`Netlists' + Optional. + + + +File: pcb.info, Node: Element File, Next: Font File, Prev: Layout File, Up: File Formats + +8.3 Element File Format +======================= + +Element files are used to describe one component which then may be used +several times within one or more layouts. You will normally split the +file into two parts, one for the pinout and one for the package +description. Using `m4' allows you to define pin names as macros in +one file and include a package description file which evaluates the +macros. See the resource _elementCommand_ for more information. The +pins (and pads) must appear in sequential order in the element file +(new in 1.5) so that pin 1 must be the first PIN(...) in the file. + + Doing things this way makes it possible to use one package file for +several different circuits. See the sample files `dil*'. + + The lowest x and y coordinates of all sub-objects of an element are +used as an attachment point for the cross hair cursor of the main +window, unless the element has a mark, in which case that's the +attachment point. + + +File: pcb.info, Node: Font File, Next: Netlist File, Prev: Element File, Up: File Formats + +8.4 Font File Format +==================== + +A number of user defined Symbols are called a font. There is only one +per layout. All symbols are made of lines. See the file `default_font' +as an example. + + The lowest x and y coordinates of all lines of a font are +transformed to (0,0). + + +File: pcb.info, Node: Netlist File, Next: Library Contents File, Prev: Font File, Up: File Formats + +8.5 Netlist File Format +======================= + +Netlists read by `Pcb' must have this simple text form: + + netname [style] NAME-PINNUM NAME2-PINNUM2 NAME3-PINNUM3 ... [\] + +for each net on the layout. where "netname" is the name of the net +which must be unique for each net, [style] is an optional route-style +name, NAME is the layout-name name given to an element, and PINNUM is +the (usually numeric) pin number of the element that connects to the net +(for details on pin numbering see *note Element Objects::). Spaces or +tabs separate the fields. If the line ends with a "\" the net +continues on the next line and the "\" is treated exactly as if it were +a space. If a NAME ends with a lower-case letter, all lower-case +letters are stripped from the end of the NAME to determine the matching +layout-name name. For example: + + Data U1-3 U2abc-4 FLOP1a-7 Uabc3-A9 + + specifies that the net called "Data" should have pin 3 of U1 +connected to pin 4 of U2, to pin 7 of FLOP1 and to pin A9 of Uabc3. +Note that element name and pin number strings are case-sensitive. It +is up to you to name the elements so that their layout-name names +agrees with the netlist. + + +File: pcb.info, Node: Library Contents File, Next: Library File, Prev: Netlist File, Up: File Formats + +8.6 Library Contents File Format +================================ + +There is nothing like a special library format. The ones that have been +introduced in 1.4.1 just use some nice (and time consuming) features of +GNU `m4'. The only predefined format is the one of the contents file +which is read during startup. It is made up of two basic line types: + + menu entry = "TYPE="name + contents line = template":"package":"value":"description + name = String + template = String + package = String + value = String + description = String + String = + + No leading white spaces or comments are allowed in this file. If you +need either one, define a command that removes them before loading. +Have a look to the _libraryContentsCommand_ resource. + + The menu entry will appear in the selection menu at the top and of +the library window. + + +File: pcb.info, Node: Library File, Next: File Syntax, Prev: Library Contents File, Up: File Formats + +8.7 Library File Format +======================= + +This section provides an overview about the existing `m4' definitions +of the elements. There are basically two different types of files. One +to define element specific data like the pinout, package and so on, the +other to define the values. For example the static RAM circuits 43256 +and 62256 are very similar. They therefore share a common definition in +the macro file but are defined with two different value labels. + + The macro file entry: + define(`Description_43256_dil', `SRAM 32Kx8') + define(`Param1_43256_dil', 28) + define(`Param2_43256_dil', 600) + define(`PinList_43256_dil', ``pin1', `pin2', ...') + + And the list file: + 43256_dil:N:43256:62256 + + The macro must define a description, the pin list and up to two +additional parameters that are passed to the package definitions. The +first one is the number of pins whereas the second one defines for +example the width of a package. + + It is very important to select a unique identifier for each macro. In +the example this would be _43256_dil_ which is also the templates name. +It is required by some low-level macros that _Description_, Param1_, +Param2__ and _PinList__ are perpended. + + The list file uses a syntax: + template:package:value[:more values] + + This means that the shown example will create two element entries +with the same package and pinout but with different names. + + A number of packages are defined in `common.m4'. Included are: + + DIL packages with suffix D, DW, J, JD, JG, N, NT, P + PLCC + TO3 + generic connectors + DIN 41.612 connectors + zick-zack (SD suffix) + 15 pin multiwatt + + If you are going to start your own library please take care about +`m4' functions. Be aware of quoting and so on and, most important check +your additional entry by calling the macro: + + CreateObject(`template', `value', `package suffix') + + If quoting is incorrect an endless loop may occur (broken by a +out-of-memory message). + + The scripts in the `lib' directory handle the creation of libraries +as well as of their contents files. Querying is also supported. + + I know quite well that this description of the library +implementation is not what some out there expect. But in my opinion +it's much more useful to look at the comments and follow the macros +step by step. + + +File: pcb.info, Node: File Syntax, Next: Object Flags, Prev: Library File, Up: File Formats + +8.8 File Syntax +=============== + +A special note about units: Older versions of `pcb' used mils (1/1000 +inch) as the base unit; a value of 500 in the file meant half an inch. +Newer versions uses a "high resolution" syntax, where the base unit is +1/100 of a mil (0.000010 inch); a value of 500 in the file means 5 +mils. As a general rule, the variants of each entry listed below which +use square brackets are the high resolution formats and use the 1/100 +mil units, and the ones with parentheses are the older variants and use +1 mil units. Note that when multiple variants are listed, the most +recent (and most preferred) format is the first listed. + + Symbolic and numeric flags (SFlags and NFlags) are described in +*note Object Flags::. + +* Menu: + +* Arc syntax:: +* Attribute syntax:: +* Connect syntax:: +* Cursor syntax:: +* DRC syntax:: +* Element syntax:: +* ElementArc syntax:: +* ElementLine syntax:: +* FileVersion syntax:: +* Flags syntax:: +* Grid syntax:: +* Groups syntax:: +* Layer syntax:: +* Line syntax:: +* Mark syntax:: +* Net syntax:: +* Netlist syntax:: +* Pad syntax:: +* PCB syntax:: +* Pin syntax:: +* PolyArea syntax:: +* Polygon syntax:: +* Rat syntax:: +* Styles syntax:: +* Symbol syntax:: +* SymbolLine syntax:: +* Text syntax:: +* Thermal syntax:: +* Via syntax:: + + +File: pcb.info, Node: Arc syntax, Next: Attribute syntax, Up: File Syntax + +8.8.1 Arc +--------- + +Arc [X Y Width Height Thickness Clearance StartAngle DeltaAngle SFlags] +Arc (X Y Width Height Thickness Clearance StartAngle DeltaAngle NFlags) +Arc (X Y Width Height Thickness StartAngle DeltaAngle NFlags) + +X Y + Coordinates of the center of the arc. + +WIDTH HEIGHT + The width and height, from the center to the edge. The bounds of + the circle of which this arc is a segment, is thus 2*Width by + 2*Height. + +THICKNESS + The width of the copper trace which forms the arc. + +CLEARANCE + The amount of space cleared around the arc when the line passes + through a polygon. The clearance is added to the thickness to get + the thickness of the clear; thus the space between the arc and the + polygon is Clearance/2 wide. + +STARTANGLE + The angle of one end of the arc, in degrees. In PCB, an angle of + zero points left (negative X direction), and 90 degrees points down + (positive Y direction). + +DELTAANGLE + The sweep of the arc. This may be negative. Positive angles sweep + counterclockwise. + +SFLAGS + Symbolic or numeric flags. + +NFLAGS + Numeric flags. + + +File: pcb.info, Node: Attribute syntax, Next: Connect syntax, Prev: Arc syntax, Up: File Syntax + +8.8.2 Attribute +--------------- + +Attribute ("Name" "Value") + +Attributes allow boards and elements to have arbitrary data attached to +them, which is not directly used by PCB itself but may be of use by +other programs or users. + +NAME + The name of the attribute + +VALUE + The value of the attribute. Values are always stored as strings, + even if the value is interpreted as, for example, a number. + + + +File: pcb.info, Node: Connect syntax, Next: Cursor syntax, Prev: Attribute syntax, Up: File Syntax + +8.8.3 Connect +------------- + +Connect ("PinPad") + +PINPAD + The name of a pin or pad which is included in this net. Pin and + Pad names are named by the refdes and pin name, like `"U14-7"' for + pin 7 of U14, or `"T4-E"' for pin E of T4. + + +File: pcb.info, Node: Cursor syntax, Next: DRC syntax, Prev: Connect syntax, Up: File Syntax + +8.8.4 Cursor +------------ + +Cursor [X Y Zoom] +Cursor (X Y Zoom) + +X Y + Location of the cursor when the board was saved. + +ZOOM + The current zoom factor. Note that a zoom factor of "0" means 1 + mil per screen pixel, N means 2^N mils per screen pixel, etc. The + first variant accepts floating point numbers. The special value + "1000" means "zoom to fit" + + +File: pcb.info, Node: DRC syntax, Next: Element syntax, Prev: Cursor syntax, Up: File Syntax + +8.8.5 DRC +--------- + +DRC [Bloat Shrink Line Silk Drill Ring] +DRC [Bloat Shrink Line Silk] +DRC [Bloat Shrink Line] + +BLOAT + Minimum spacing between copper. + +SHRINK + Minimum copper overlap to guarantee connectivity. + +LINE + Minimum line thickness. + +SILK + Minimum silk thickness. + +DRILL + Minimum drill size. + +RING + Minimum width of the annular ring around pins and vias. + + +File: pcb.info, Node: Element syntax, Next: ElementArc syntax, Prev: DRC syntax, Up: File Syntax + +8.8.6 Element +------------- + +Element [SFlags "Desc" "Name" "Value" MX MY TX TY TDir TScale TSFlags] ( +Element (NFlags "Desc" "Name" "Value" MX MY TX TY TDir TScale TNFlags) ( +Element (NFlags "Desc" "Name" "Value" TX TY TDir TScale TNFlags) ( +Element (NFlags "Desc" "Name" TX TY TDir TScale TNFlags) ( +Element ("Desc" "Name" TX TY TDir TScale TNFlags) ( + ... contents ... +) + +SFLAGS + Symbolic or numeric flags, for the element as a whole. + +NFLAGS + Numeric flags, for the element as a whole. + +DESC + The description of the element. This is one of the three strings + which can be displayed on the screen. + +NAME + The name of the element, usually the reference designator. + +VALUE + The value of the element. + +MX MY + The location of the element's mark. This is the reference point + for placing the element and its pins and pads. + +TX TY + The upper left corner of the text (one of the three strings). + +TDIR + The relative direction of the text. 0 means left to right for an + unrotated element, 1 means up, 2 left, 3 down. + +TSCALE + Size of the text, as a percentage of the "default" size of of the + font (the default font is about 40 mils high). Default is 100 (40 + mils). + +TSFLAGS + Symbolic or numeric flags, for the text. + +TNFLAGS + Numeric flags, for the text. + + Elements may contain pins, pads, element lines, element arcs, +attributes, and (for older elements) an optional mark. Note that +element definitions that have the mark coordinates in the element line, +only support pins and pads which use relative coordinates. The pin and +pad coordinates are relative to the mark. Element definitions which do +not include the mark coordinates in the element line, may have a Mark +definition in their contents, and only use pin and pad definitions +which use absolute coordinates. + + +File: pcb.info, Node: ElementArc syntax, Next: ElementLine syntax, Prev: Element syntax, Up: File Syntax + +8.8.7 ElementArc +---------------- + +ElementArc [X Y Width Height StartAngle DeltaAngle Thickness] +ElementArc (X Y Width Height StartAngle DeltaAngle Thickness) + +X Y + Coordinates of the center of the arc. These are relative to the + Element's mark point for new element formats, or absolute for older + formats. + +WIDTH HEIGHT + The width and height, from the center to the edge. The bounds of + the circle of which this arc is a segment, is thus 2*Width by + 2*Height. + +STARTANGLE + The angle of one end of the arc, in degrees. In PCB, an angle of + zero points left (negative X direction), and 90 degrees points down + (positive Y direction). + +DELTAANGLE + The sweep of the arc. This may be negative. Positive angles sweep + counterclockwise. + +THICKNESS + The width of the silk line which forms the arc. + + +File: pcb.info, Node: ElementLine syntax, Next: FileVersion syntax, Prev: ElementArc syntax, Up: File Syntax + +8.8.8 ElementLine +----------------- + +ElementLine [X1 Y1 X2 Y2 Thickness] +ElementLine (X1 Y1 X2 Y2 Thickness) + +X1 Y1 X2 Y2 + Coordinates of the endpoints of the line. These are relative to + the Element's mark point for new element formats, or absolute for + older formats. + +THICKNESS + The width of the silk for this line. + + +File: pcb.info, Node: FileVersion syntax, Next: Flags syntax, Prev: ElementLine syntax, Up: File Syntax + +8.8.9 FileVersion +----------------- + +FileVersion[Version] + +VERSION + File format version. This version number represents the date when + the pcb file format was last changed. + + Any version of pcb build from sources equal to or newer than this +number should be able to read the file. If this line is not present in +the input file then file format compatibility is not checked. + + +File: pcb.info, Node: Flags syntax, Next: Grid syntax, Prev: FileVersion syntax, Up: File Syntax + +8.8.10 Flags +------------ + +Flags(Number) + +NUMBER + A number, whose value is normally given in hex, individual bits of + which represent pcb-wide flags as defined in *note PCBFlags::. + + + +File: pcb.info, Node: Grid syntax, Next: Groups syntax, Prev: Flags syntax, Up: File Syntax + +8.8.11 Grid +----------- + +Grid [Step OffsetX OffsetY Visible] +Grid (Step OffsetX OffsetY Visible) +Grid (Step OffsetX OffsetY) + +STEP + Distance from one grid point to adjacent points. This value may + be a floating point number for the first two variants. + +OFFSETX OFFSETY + The "origin" of the grid. Normally zero. + +VISIBLE + If non-zero, the grid will be visible on the screen. + + +File: pcb.info, Node: Groups syntax, Next: Layer syntax, Prev: Grid syntax, Up: File Syntax + +8.8.12 Groups +------------- + +Groups("String") + +STRING + Encodes the layer grouping information. Each group is separated + by a colon, each member of each group is separated by a comma. + Group members are either numbers from `1'..N for each layer, and + the letters `c' or `s' representing the component side and solder + side of the board. Including `c' or `s' marks that group as being + the top or bottom side of the board. + + Groups("1,2,c:3:4:5,6,s:7,8") + + + +File: pcb.info, Node: Layer syntax, Next: Line syntax, Prev: Groups syntax, Up: File Syntax + +8.8.13 Layer +------------ + +Layer (LayerNum "Name") ( + ... contents ... +) + +LAYERNUM + The layer number. Layers are numbered sequentially, starting with + 1. The last two layers (9 and 10 by default) are solder-side silk + and component-side silk, in that order. + +NAME + The layer name. + +CONTENTS + The contents of the layer, which may include attributes, lines, + arcs, rectangles, text, and polygons. + + +File: pcb.info, Node: Line syntax, Next: Mark syntax, Prev: Layer syntax, Up: File Syntax + +8.8.14 Line +----------- + +Line [X1 Y1 X2 Y2 Thickness Clearance SFlags] +Line (X1 Y1 X2 Y2 Thickness Clearance NFlags) +Line (X1 Y1 X2 Y2 Thickness NFlags) + +X1 Y1 X2 Y2 + The end points of the line + +THICKNESS + The width of the line + +CLEARANCE + The amount of space cleared around the line when the line passes + through a polygon. The clearance is added to the thickness to get + the thickness of the clear; thus the space between the line and the + polygon is Clearance/2 wide. + +SFLAGS + Symbolic or numeric flags + +NFLAGS + Numeric flags. + + +File: pcb.info, Node: Mark syntax, Next: Net syntax, Prev: Line syntax, Up: File Syntax + +8.8.15 Mark +----------- + +Mark [X Y] +Mark (X Y) + +X Y + Coordinates of the Mark, for older element formats that don't have + the mark as part of the Element line. + + +File: pcb.info, Node: Net syntax, Next: Netlist syntax, Prev: Mark syntax, Up: File Syntax + +8.8.16 Net +---------- + +Net ("Name" "Style") ( + ... connects ... +) + +NAME + The name of this net. + +STYLE + The routing style that should be used when autorouting this net. + + +File: pcb.info, Node: Netlist syntax, Next: Pad syntax, Prev: Net syntax, Up: File Syntax + +8.8.17 Netlist +-------------- + +Netlist ( ) ( + ... nets ... +) + + +File: pcb.info, Node: Pad syntax, Next: PCB syntax, Prev: Netlist syntax, Up: File Syntax + +8.8.18 Pad +---------- + +Pad [rX1 rY1 rX2 rY2 Thickness Clearance Mask "Name" "Number" SFlags] +Pad (rX1 rY1 rX2 rY2 Thickness Clearance Mask "Name" "Number" NFlags) +Pad (aX1 aY1 aX2 aY2 Thickness "Name" "Number" NFlags) +Pad (aX1 aY1 aX2 aY2 Thickness "Name" NFlags) + +RX1 RY1 RX2 RY2 + Coordinates of the endpoints of the pad, relative to the element's + mark. Note that the copper extends beyond these coordinates by + half the thickness. To make a square or round pad, specify the + same coordinate twice. + +AX1 AY1 AX2 AY2 + Same, but absolute coordinates of the endpoints of the pad. + +THICKNESS + width of the pad. + +CLEARANCE + add to thickness to get clearance width. + +MASK + width of solder mask opening. + +NAME + name of pin + +NUMBER + number of pin + +SFLAGS + symbolic or numerical flags + +NFLAGS + numerical flags only + + +File: pcb.info, Node: PCB syntax, Next: Pin syntax, Prev: Pad syntax, Up: File Syntax + +8.8.19 PCB +---------- + +PCB ["Name" Width Height] +PCB ("Name" Width Height] +PCB ("Name") + +NAME + Name of the PCB project + +WIDTH HEIGHT + Size of the board + + If you don't specify the size of the board, a very large default is +chosen. + + +File: pcb.info, Node: Pin syntax, Next: PolyArea syntax, Prev: PCB syntax, Up: File Syntax + +8.8.20 Pin +---------- + +Pin [rX rY Thickness Clearance Mask Drill "Name" "Number" SFlags] +Pin (rX rY Thickness Clearance Mask Drill "Name" "Number" NFlags) +Pin (aX aY Thickness Drill "Name" "Number" NFlags) +Pin (aX aY Thickness Drill "Name" NFlags) +Pin (aX aY Thickness "Name" NFlags) + +RX RY + coordinates of center, relative to the element's mark + +AX AY + absolute coordinates of center. + +THICKNESS + outer diameter of copper annulus + +CLEARANCE + add to thickness to get clearance diameter + +MASK + diameter of solder mask opening + +DRILL + diameter of drill + +NAME + name of pin + +NUMBER + number of pin + +SFLAGS + symbolic or numerical flags + +NFLAGS + numerical flags only + + +File: pcb.info, Node: PolyArea syntax, Next: Polygon syntax, Prev: Pin syntax, Up: File Syntax + +8.8.21 PolyArea +--------------- + +PolyArea [Area] + +AREA + Minimum area of polygon island to retain. If a polygon has + clearances that cause an isolated island to be created, then will + only be retained if the area exceeds this minimum area. + + +File: pcb.info, Node: Polygon syntax, Next: Rat syntax, Prev: PolyArea syntax, Up: File Syntax + +8.8.22 Polygon +-------------- + +Polygon (SFlags) ( + ... (X Y) ... + ... [X Y] ... + Hole ( + ... (X Y) ... + ... [X Y] ... + ) + ... +) + +SFLAGS + Symbolic or numeric flags. + +X Y + Coordinates of each vertex. You must list at least three + coordinates. + +HOLE (...) + Defines a hole within the polygon's outer contour. There may be + zero or more such sections. + + +File: pcb.info, Node: Rat syntax, Next: Styles syntax, Prev: Polygon syntax, Up: File Syntax + +8.8.23 Rat +---------- + +Rat [X1 Y1 Group1 X2 Y2 Group2 SFlags] +Rat (X1 Y1 Group1 X2 Y2 Group2 NFlags) + +X1 Y1 X2 Y2 + The endpoints of the rat line. + +GROUP1 GROUP2 + The layer group each end is connected on. + +SFLAGS + Symbolic or numeric flags. + +NFLAGS + Numeric flags. + + +File: pcb.info, Node: Styles syntax, Next: Symbol syntax, Prev: Rat syntax, Up: File Syntax + +8.8.24 Styles +------------- + +Styles("String") + +STRING + Encodes the four routing styles `pcb' knows about. The four styles + are separated by colons. Each style consists of five parameters + as follows: + + NAME + The name of the style. + + THICKNESS + Width of lines and arcs. + + DIAMETER + Copper diameter of pins and vias. + + DRILL + Drill diameter of pins and vias. + + KEEPAWAY + Minimum spacing to other nets. If omitted, 10 mils is the + default. + + + + Styles("Signal,10,40,20:Power,25,60,35:Fat,40,60,35:Skinny,8,36,20") + Styles["Logic,1000,3600,2000,1000:Power,2500,6000,3500,1000: + Line,4000,6000,3500,1000:Breakout,600,2402,1181,600"] + +Note that strings in actual files cannot span lines; the above example +is split across lines only to make it readable. + + +File: pcb.info, Node: Symbol syntax, Next: SymbolLine syntax, Prev: Styles syntax, Up: File Syntax + +8.8.25 Symbol +------------- + +Symbol [Char Delta] ( +Symbol (Char Delta) ( + ... symbol lines ... +) + +CHAR + The character or numerical character value this symbol represents. + Characters must be in single quotes. + +DELTA + Additional space to allow after this character. + + +File: pcb.info, Node: SymbolLine syntax, Next: Text syntax, Prev: Symbol syntax, Up: File Syntax + +8.8.26 SymbolLine +----------------- + +SymbolLine [X1 Y1 X2 Y1 Thickness] +SymbolLine (X1 Y1 X2 Y1 Thickness) + +X1 Y1 X2 Y2 + The endpoints of this line. + +THICKNESS + The width of this line. + + +File: pcb.info, Node: Text syntax, Next: Thermal syntax, Prev: SymbolLine syntax, Up: File Syntax + +8.8.27 Text +----------- + +Text [X Y Direction Scale "String" SFlags] +Text (X Y Direction Scale "String" NFlags) +Text (X Y Direction "String" NFlags) + +X Y + The location of the upper left corner of the text. + +DIRECTION + 0 means text is drawn left to right, 1 means up, 2 means right to + left (i.e. upside down), and 3 means down. + +SCALE + Size of the text, as a percentage of the "default" size of of the + font (the default font is about 40 mils high). Default is 100 (40 + mils). + +STRING + The string to draw. + +SFLAGS + Symbolic or numeric flags. + +NFLAGS + Numeric flags. + + +File: pcb.info, Node: Thermal syntax, Next: Via syntax, Prev: Text syntax, Up: File Syntax + +8.8.28 Thermal +-------------- + +Thermal [Scale] + +SCALE + Relative size of thermal fingers. A value of 1.0 makes the finger + width twice the clearance gap width (measured across the gap, not + diameter). The normal value is 0.5, which results in a finger + width the same as the clearance gap width. + + +File: pcb.info, Node: Via syntax, Prev: Thermal syntax, Up: File Syntax + +8.8.29 Via +---------- + +Via [X Y Thickness Clearance Mask Drill "Name" SFlags] +Via (X Y Thickness Clearance Mask Drill "Name" NFlags) +Via (X Y Thickness Clearance Drill "Name" NFlags) +Via (X Y Thickness Drill "Name" NFlags) +Via (X Y Thickness "Name" NFlags) + +X Y + coordinates of center + +THICKNESS + outer diameter of copper annulus + +CLEARANCE + add to thickness to get clearance diameter + +MASK + diameter of solder mask opening + +DRILL + diameter of drill + +NAME + string, name of via (vias have names?) + +SFLAGS + symbolic or numerical flags + +NFLAGS + numerical flags only + + +File: pcb.info, Node: Object Flags, Next: PCBFlags, Prev: File Syntax, Up: File Formats + +8.9 Object Flags +================ + +Note that object flags can be given numerically (like `0x0147') or +symbolically (like `"found,showname,square"'. Some numeric values are +reused for different object types. The table below lists the numeric +value followed by the symbolic name. + +`0x0001 pin' + If set, this object is a pin. This flag is for internal use only. + +`0x0002 via' + Likewise, for vias. + +`0x0004 found' + If set, this object has been found by `FindConnection()'. + +`0x0008 hole' + For pins and vias, this flag means that the pin or via is a hole + without a copper annulus. + +`0x0010 rat' + If set for a line, indicates that this line is a rat line instead + of a copper trace. + +`0x0010 pininpoly' + For pins and pads, this flag is used internally to indicate that + the pin or pad overlaps a polygon on some layer. + +`0x0010 clearpoly' + For polygons, this flag means that pins and vias will normally + clear these polygons (thus, thermals are required for electrical + connection). When clear, polygons will solidly connect to pins and + vias. + +`0x0010 hidename' + For elements, when set the name of the element is hidden. + +`0x0020 showname' + For elements, when set the names of pins are shown. + +`0x0020 clearline' + For lines and arcs, the line/arc will clear polygons instead of + connecting to them. + +`0x0020 fullpoly' + For polygons, the full polygon is drawn (i.e. all parts instead of + only the biggest one). + +`0x0040 selected' + Set when the object is selected. + +`0x0080 onsolder' + For elements and pads, indicates that they are on the solder side. + +`0x0080 auto' + For lines and vias, indicates that these were created by the + autorouter. + +`0x0100 square' + For pins and pads, indicates a square (vs round) pin/pad. + +`0x0200 rubberend' + For lines, used internally for rubber band moves. + +`0x0200 warn' + For pins, vias, and pads, set to indicate a warning. + +`0x0400 usetherm' + Obsolete, indicates that pins/vias should be drawn with thermal + fingers. + +`0x0400' + Obsolete, old files used this to indicate lines drawn on silk. + +`0x0800 octagon' + Draw pins and vias as octagons. + +`0x1000 drc' + Set for objects that fail DRC. + +`0x2000 lock' + Set for locked objects. + +`0x4000 edge2' + For pads, indicates that the second point is closer to the edge. + For pins, indicates that the pin is closer to a horizontal edge + and thus pinout text should be vertical. + +`0x8000 marker' + Marker used internally to avoid revisiting an object. + +`0x10000 nopaste' + For pads, set to prevent a solderpaste stencil opening for the + pad. Primarily used for pads used as fiducials. + + +File: pcb.info, Node: PCBFlags, Prev: Object Flags, Up: File Formats + +8.10 PCBFlags +============= + +`0x00001' + Pinout displays pin numbers instead of pin names. + +`0x00002' + Use local reference for moves, by setting the mark at the + beginning of each move. + +`0x00004' + When set, only polygons and their clearances are drawn, to see if + polygons have isolated regions. + +`0x00008' + Display DRC region on crosshair. + +`0x00010' + Do all move, mirror, rotate with rubberband connections. + +`0x00020' + Display descriptions of elements, instead of refdes. + +`0x00040' + Display names of elements, instead of refdes. + +`0x00080' + Auto-DRC flag. When set, PCB doesn't let you place copper that + violates DRC. + +`0x00100' + Enable 'all-direction' lines. + +`0x00200' + Switch starting angle after each click. + +`0x00400' + Force unique names on board. + +`0x00800' + New lines/arc clear polygons. + +`0x01000' + Crosshair snaps to pins and pads. + +`0x02000' + Show the solder mask layer. + +`0x04000' + Draw with thin lines. + +`0x08000' + Move items orthogonally. + +`0x10000' + Draw autoroute paths real-time. + +`0x20000' + New polygons are full ones. + +`0x40000' + Names are locked, the mouse cannot select them. + +`0x80000' + Everything but names are locked, the mouse cannot select anything + else. + +`0x100000' + New polygons are full polygons. + +`0x200000' + When set, element names are not drawn. + + +File: pcb.info, Node: Library Creation, Next: Schematic Frontends, Prev: File Formats, Up: Top + +9 Library Creation +****************** + +This chapter provides a detailed look at how footprint libraries are +created and used. The chapter is split into two section, the first +section covers the "old" style libraries which use the `m4' macro +processor and the second section covers the "new" style libraries. + + Despite the names "old" and "new", both styles of libraries are +useful and the "old" style should not be discounted because of its +name. The advantage of the old style libraries is that one can define +a family of footprints, say a DIP package, and then quickly produce all +the members of that family. Because the individual packages make use +of a base definition, corrections made to the base definition propagate +to all the members of a family. The primary drawback to using this +library approach is that the effort to create a single footprint is +more than a graphical interface and may take even longer if the user +has not used the `m4' macro language previously. + + The new style of footprint libraries stores each footprint in its own +file. The footprints are created graphically by placing pads and then +converting a group of pads to a component. This library method has the +advantage of being quick to learn and it is easily to build single +footprints quickly. If you are building a family of parts, however, the +additional effort in creating each one individually makes this approach +undesirable. In addition, creating a part with a large pin count can +be quite tedious when done by hand. + +9.1 Old Style (m4) Libraries +============================ + +The old style libraries for pcb use the `m4' macro processor to allow +the definition of a family of parts. There are several files +associated with the old style library. The file `common.m4' is the top +level file associated with the library. `common.m4' defines a few +utility macros which are used by other portions of the library, and +then includes a predefined set of library files (the lines like +`include(geda.inc)'). + +9.1.1 Overview of Oldlib Operation +---------------------------------- + +The big picture view of the old style library system is that the library +is simply a collection of macro definitions. The macros are written in +the `m4' macro language. An example of a macro and what it expands to +is the following. One of the predefined footprints in the library +which comes with PCB is the `PKG_SO8' macro. Note that all the +footprint macros begin with `PKG_'. For this particular example, +`PKG_SO8' is a macro for an 8-pin small outline surface mount package. +All of the footprint macros take 3 arguments. The first is the +canonical name of the footprint on the board. In this case "SO8" is an +appropriate name. The second argument is the reference designator on +the board such as "U1" or "U23". The third and final argument is the +value. For an integrated circuit this is usually the part number such +as "MAX4107" or "78L05" and for a component such as a resistor or +capacitor it is the resistance or capacitance. The complete call to the +macro in our example is `PKG_SO8(SO8, U1, MAX4107)'. When processed by +`m4' using the macros defined in the PCB library, this macro expands to + Element(0x00 "SO8" "U1" "MAX4107" 146 50 3 100 0x00) + ( + Pad(10 25 38 25 20 "1" 0x00) + Pad(10 75 38 75 20 "2" 0x100) + Pad(10 125 38 125 20 "3" 0x100) + Pad(10 175 38 175 20 "4" 0x100) + Pad(214 175 242 175 20 "5" 0x100) + Pad(214 125 242 125 20 "6" 0x100) + Pad(214 75 242 75 20 "7" 0x100) + Pad(214 25 242 25 20 "8" 0x100) + ElementLine(0 0 151 0 10) + ElementArc(126 0 25 25 0 180 10) + ElementLine(101 0 252 0 10) + ElementLine(252 0 252 200 10) + ElementLine(252 200 0 200 10) + ElementLine(0 200 0 0 10) + Mark(29 25) + ) + which is the actual definition of the footprint that the PCB program +works with. As a user of PCB the only time you will need or want to run +`m4' directly is when you are debugging a new library addition. In +normal operation, the calls to `m4' are made by helper scripts that +come with PCB. + + Tools such as `gsch2pcb' (used to interface the gEDA schematic +capture program to PCB layout) will call `m4' to produce an initial PCB +layout that includes all the components on a schematic. In addition, +when manually instantiating parts from within PCB, `m4' will be called +by PCB's helper scripts to produce the footprints. + +9.1.2 The Library Scripts +------------------------- + +There are several scripts that are used for processing the m4 +libraries. This section briefly describes these scripts and details how +they are used by PCB. + +9.1.2.1 Scripts Used During Compilation +....................................... + +The scripts described in this section are used during compilation of +PCB. They are run automatically by the build system, but are described +here to help document the complete library processing that occurs. +During the build of PCB, the following actions are taken. The +`CreateLibrary.sh' script is run to produce an M4 "frozen file". This +frozen file is simply a partially processed M4 input file which can be +loaded by M4 more quickly than the original input file. + + A typical call to `CreateLibrary.sh' used during the compilation of +PCB is: + ./CreateLibrary.sh -I . pcblib ./common.m4 TTL_74xx_DIL.m4 + connector.m4 crystal.m4 generic.m4 genericsmt.m4 gtag.m4 + jerry.m4 linear.m4 logic.m4 lsi.m4 memory.m4 optical.m4 pci.m4 + resistor_0.25W.m4 resistor_adjust.m4 resistor_array.m4 + texas_inst_amplifier.m4 texas_inst_voltage_reg.m4 + transistor.m4 geda.m4 + The `-I .' says to search in the current directory for the `.m4' +files. The output frozen file is `pcblib'. The main `common.m4' file +is listed as well as all of the `*.m4' files which define the +components in the library. + + In addition, a library contents file is created during the build with +the `CreateLibraryContents.sh' script. A typical call to +`CreateLibrary.sh' used during the compilation of PCB is: + ./CreateLibraryContents.sh -I . ./common.m4 TTL_74xx_DIL.list + connector.list crystal.list generic.list genericsmt.list gtag.list + jerry.list linear.list logic.list lsi.list memory.list optical.list + pci.list resistor_0.25W.list resistor_adjust.list resistor_array.list + texas_inst_amplifier.list texas_inst_voltage_reg.list transistor.list + geda.list > pcblib.contents + + The `pcblib.contents' file is used by the PCB program to define the +libraries and components which will be displayed when you bring up the +library window from within PCB. An example of part of the +`pcblib.contents' file is: + TYPE=~TTL 74xx DIL + 7400_dil:N:7400:4 dual-NAND + 7401_dil:N:7401:4 dual-NAND OC + 7402_dil:N:7402:4 dual-NOR + TYPE=~geda + geda_DIP6:DIP6:DIP6:Dual in-line package, narrow (300 mil) + geda_DIP8:DIP8:DIP8:Dual in-line package, narrow (300 mil) + geda_DIP14:DIP14:DIP14:Dual in-line package, narrow (300 mil) + geda_ACY300:ACY300:ACY300:Axial non-polar component, + The `TYPE=' lines define the library name that will show up in the +library window in PCB. The other lines define the actual components in +the library. + +9.1.2.2 Scripts Used by PCB at Runtime +...................................... + +When PCB is first executed, it makes a call to the +`ListLibraryContents.sh' script. This script provides the PCB program +with the contents of the library contents file created when PCB was +compiled. A typical call to `ListLibraryContents.sh' is + ../lib/ListLibraryContents.sh .:/tmp/pcb-20030903/src/../lib pcblib + This command says to search the path +`.:/tmp/pcb-20030903/src/../lib' for a file called `pcblib.contents' +(the `.contents' part is added automatically) and display the contents +of the file. PCB parses this output and generates the library window +entries. + + When you pick a library component from the library window, PCB calls +the `QueryLibrary.sh' script to actually pull the footprint into the +layout. For example, when the ACY300 component is selected from the +`~geda' library, the generated call may be: + + /tmp/pcb-20030903/src/../lib/QueryLibrary.sh + .:/tmp/pcb-20030903/src/../lib pcblib geda_ACY300 ACY300 + ACY300 + If you were to run this command by hand you would see the PCB code +for the element: + Element(0x00 "Axial non-polar component," "" "ACY300" 245 70 0 100 0x00) + ( + Pin(0 25 50 20 "1" 0x101) + Pin(300 25 50 20 "2" 0x01) + + ElementLine(0 25 75 25 10) + ElementLine(225 25 300 25 10) + + ElementLine(75 0 225 0 10) + ElementLine(225 0 225 50 10) + ElementLine(225 50 75 50 10) + ElementLine(75 50 75 0 10) + + # ElementArc(X1 Y 50 50 270 180 10) + # ElementArc(X2 Y 50 50 90 180 10) + + Mark(75 25) + ) + +9.1.3 Creating an Oldlib Footprint +---------------------------------- + +This section provides a complete example of defining a family of +footprints using the M4 style library. As a vehicle for this example, a +family of footprints for surface mount resistors and capacitors will be +developed. The file `example.inc' should have been installed on your +system as `$prefix/share/examples/oldlib/example.inc' where `$prefix' +is often times `/usr/local'. + + The `example.inc' file defines a macro called `COMMON_PKG_RCSMT' +which is a generic definition for a surface mount footprint with two +identical, rectangular pads. This macro will be called with different +parameters to fill out the family of parts. The arguments to the +`COMMON_PKG_RCSMT' are: + # ------------------------------------------------------------------- + # the definition for surface mount resistors and capacitors + # $1: canonical name + # $2: name on PCB + # $3: value + # $4: pad width (in direction perpendicular to part) + # $5: pad length (in direction parallel with part) + # $6: pad spacing (center to center) + # $7: distance from edge of pad to silk (in direction + # perpendicular to part) + # $8: distance from edge of pad to silk (in direction parallel + # with part) + # $9: Set to "no" to skip silk screen on the sides of the part + + define(`COMMON_PKG_RCSMT', + `define(`XMIN', `eval( -1*`$6'/2 - `$5'/2 - `$8')') + define(`XMAX', `eval( `$6'/2 + `$5'/2 + `$8')') + define(`YMIN', `eval(-1*`$4'/2 - `$7')') + define(`YMAX', `eval( `$4'/2 + `$7')') + Element(0x00 "$1" "$2" "$3" eval(XMIN+20) eval(YMAX+20) 0 100 0x00) + ( + ifelse(0, eval($4>$5), + # Pads which have the perpendicular pad dimension less + # than or equal to the parallel pad dimension + Pad(eval(-1*( $6 + $5 - $4)/2) 0 + eval((-1*$6 + $5 - $4)/2) 0 eval($4) "1" 0x100) + Pad(eval(-1*(-1*$6 + $5 - $4)/2) 0 + eval(( $6 + $5 - $4)/2) 0 eval($4) "2" 0x100) + , + # Pads which have the perpendicular pad dimension greater + # than or equal to the parallel pad dimension + Pad(eval(-1*$6/2) eval(-1*($4 - $5)/2) + eval(-1*$6/2) eval(($4 - $5)/2) eval($5) "1" 0x100) + Pad(eval( $6/2) eval(-1*($4 - $5)/2) + eval( $6/2) eval(($4 - $5)/2) eval($5) "2" 0x100) + ) + + # silk screen + # ends + ElementLine(XMIN YMIN XMIN YMAX 10) + ElementLine(XMAX YMAX XMAX YMIN 10) + # sides + ifelse($9,"no", + #skip side silk + , + ElementLine(XMIN YMIN XMAX YMIN 10) + ElementLine(XMAX YMAX XMIN YMAX 10) + ) + Mark(0 0) + )') + Note that the part has been defined with the mark located at `(0,0)' +and that the pads have been placed with the mark at the common centroid +of the footprint. While not a requirement, this is highly desirable +when developing a library that will need to interface with a pick and +place machine used for factory assembly of a board. + + The final part of `example.inc' defines particular versions of the +generic footprint we have created. These particular versions correspond +to various industry standard package sizes. + # 0402 package + # + # 30x30 mil pad, 15 mil metal-metal spacing=> + # 15 + 15 + 15 = 45 center-to-center + define(`PKG_RC0402', + `COMMON_PKG_RCSMT(`$1', `$2', `$3', 30, 30, 45, 0, 10, "no")') + + # 0603 package + # + # 40x40 mil pad, 30 mil metal-metal spacing=> + # 30 + 20 + 20 = 70 center-to-center + define(`PKG_RC0603', + `COMMON_PKG_RCSMT(`$1', `$2', `$3', 40, 40, 70, 10, 10)') + + # 1206 package + # + # 40x60 mil pad, 90 mil metal-metal spacing=> + # 90 + 20 + 20 = 130 center-to-center + define(`PKG_RC1206', + `COMMON_PKG_RCSMT(`$1', `$2', `$3', 60, 40, 130, 10, 10)') + + At this point, the `example.inc' file could be used by third party +tools such as `gsch2pcb'. However to fully integrate our footprints +into PCB we need to create the `example.m4' and `example.list' files. +The `example.m4' file defines descriptions for the new footprints. + define(`Description_my_RC0402', + ``Standard SMT resistor/capacitor (0402)'') + define(`Description_my_RC0603', + ``Standard SMT resistor/capacitor (0603)'') + define(`Description_my_RC1206', + ``Standard SMT resistor/capacitor (1206)'') + Finally we need to create the `example.list' file. + my_RC0402:RC0402:RES0402 + my_RC0402:RC0402:CAP0402 + my_RC0603:RC0603:RES0603 + my_RC0603:RC0603:CAP0603 + my_RC1206:RC1206:RES1206 + my_RC1206:RC1206:CAP1206 + The first field in the list file has the name corresponding to the +Description definitions in `example.m4'. The second field is the +template name which corresponds to the macros `PKG_*' we defined in +`example.inc' with the leading `PKG_' removed. It is the second field +which controls what footprint will actually appear on the board. The +final field is the name of the part type on the board. The first line +in our `example.list' file will produce a menu entry in the library +window that reads: + CAP0402, Standard SMT resistor/capacitor (0402) + The `CAP0402' portion comes directly from the third field in +`example.list' and the longer description comes from descriptions +macros in `example.m4'. Please note that any extra white space at the +end of a line in the `.list' files will cause them to not work properly. + +9.1.4 Troubleshooting Old Style Libraries +----------------------------------------- + +A powerful technique to help debug problems with libraries is to invoke +the `m4' processor directly. This approach will provide error output +which is not visible from within PCB. The following example shows how +one might try to debug an 8 pin small outline (SO8) package. The macro +name for the package is PKG_SO8. In this example, the canonical name +that is to be associated with the part is SO8, the reference designator +is U1, and the value is MAX4107 (the part number). + + echo "PKG_SO8(SO8, U1, MAX4107)" | \ + gm4 common.m4 - | \ + awk '/^[ \t]*$/ {next} {print}' | \ + more + The `awk' call simply removes blank lines which make the output hard +to read. + + For this particular example, the output is: + Element(0x00 "SO8" "U1" "MAX4107" 146 50 3 100 0x00) + ( + Pad(10 25 38 25 20 "1" 0x00) + Pad(10 75 38 75 20 "2" 0x100) + Pad(10 125 38 125 20 "3" 0x100) + Pad(10 175 38 175 20 "4" 0x100) + Pad(214 175 242 175 20 "5" 0x100) + Pad(214 125 242 125 20 "6" 0x100) + Pad(214 75 242 75 20 "7" 0x100) + Pad(214 25 242 25 20 "8" 0x100) + ElementLine(0 0 151 0 10) + ElementArc(126 0 25 25 0 180 10) + ElementLine(101 0 252 0 10) + ElementLine(252 0 252 200 10) + ElementLine(252 200 0 200 10) + ElementLine(0 200 0 0 10) + Mark(29 25) + ) + +9.2 New Style Libraries +======================= + +Footprints for the new style library are created graphically using the +PCB program. A single footprint is saved in each file. + +9.2.1 Creating Newlib Footprints +-------------------------------- + +To create + 1. Start PCB with an empty layout. + + 2. Make the component layer active. + + 3. For a leaded part, select the via tool and place vias where the + pads for the part should go. For surface mount pads, draw line + segments. Note that until the footprint is completed, the surface + mount pads will remain rounded. Currently a rectangle or polygon + may not be used as a pad. + + 4. For each via and line segment which will become a pad, select it + and press 'n' to be able to enter a name. Enter the pin number + and press enter. + + 5. Make the silk layer active. + + 6. Using the line and arc tools, draw a silk screen outline for the + part. + + 7. Using the selection tool, select all of the pins and silk screen + for the part. + + 8. Place the pointer above the reference point for the part. This is + typically the common centroid. Keeping the pointer there, + shift-right-click to bring up the popup menu and choose "convert + selection to element". + + 9. At this point, the vias, line segments, and silk screen will have + been converted to an element. To change any of the line segments + to have square ends rather than round ends, select the pads by + holding down the shift key and clicking each pad with the center + mouse button. Now under the Select menu, "Change square-flag of + selected objects" section, choose "Pins". + + 10. Select the element, shift-right-click to bring up the popup menu, + and choose "Copy Selection to Buffer". Now left-click on the + center of the new element. + + 11. Under the buffer menu, choose "save buffer elements to file" to + save the new footprint to a file. + + 12. Press ESC to exit from buffer mode. + +9.2.2 Modifying Newlib Footprints +--------------------------------- + + 1. In the `Pcb' program, instantiate the footprint you wish to modify. + + 2. Using the selection tool, select the footprint. + + 3. Now left-click on the selected element, this brings up a popup + menu, choose "Cut Selection to Buffer" from the popup menu. + + 4. Under the buffer menu, choose "break buffer element to pieces", + and then left-click to place the broken apart footprint to an open + area of the layout. Note that you must use the items under the + buffer menu, the items with the same names in the popup menu do + not work. + + 5. Make your desired modifications to the footprint and then convert + the pieces back to an element using the same procedure as when + starting from scratch on a new footprint. + + +File: pcb.info, Node: Schematic Frontends, Next: Installation, Prev: Library Creation, Up: Top + +10 Schematic Capture for PCB +**************************** + +When designing a circuit board of any complexity, a schematic capture +front-end for the design is highly desired. Any schematic capture +program which is able to generate a netlist in a user defined format as +well as a bill of materials can be made to work with PCB. Currently, we +are aware of two freely available schematic capture programs which can +interface with PCB. This chapter shows how a design can be taken from +start to finish using either of these two tools for schematic capture +and PCB for layout. + +* Menu: + +* gEDA:: Interfacing with GNU EDA (gEDA). +* xcircuit:: Interfacing with xcircuit. + + +File: pcb.info, Node: gEDA, Next: xcircuit, Up: Schematic Frontends + +10.1 gEDA +========= + +This section shows how to use gEDA as the schematic capture front-end +for a PCB design. This section is not intended to be complete +documentation on gEDA and it is assumed that the user has at least some +familiarity with the gEDA suite of programs. + + The basic steps in a gEDA + PCB design flow are: + 1. Set up project directories + + 2. Set up gEDA (gschem/gnetlist) config files + + 3. Set up gsch2pcb config files + + 4. Capture schematics using `gschem' (part of gEDA) + + 5. Create any unique PCB footprints needed for the design + + 6. Generate initial PCB design using `gsch2pcb' (part of gEDA) + + 7. Layout circuit board using `pcb' + + 8. Make any additional schematic changes with `gschem' and forward + annotate to PCB with `gsch2pcb' + + 9. Generate photoplot files (RS-274X, also known as "Gerber") for + board vendor + +10.1.1 Set Up Project Directories +--------------------------------- + +Although not required, a typical project directory will contain the +schematics and board layout at the top level. Schematic symbols and +circuit board footprints which are unique to this project are stored in +subdirectories. For this example, `sym' contains the project specific +schematic symbols and `pkg' contains the project specific footprints. +Set up the project subdirectory and subdirectories by executing: + mkdir ~/myproj + cd ~/myproj + mkdir sym + mkdir pkg + mkdir pkg/newlib + mkdir pkg/m4 + +10.1.2 Set Up gEDA Config Files +------------------------------- + +The gEDA tools, specifically `gschem' and `gnetlist', use configuration +files to set the search path for symbol libraries in addition to other +user preferences. Create a file in the top level project directory +called `gschemrc'. Add the following lines to that file: + + ;; list libraries here. Order matters as it sets the + ;; search order + (component-library "./sym") + This sets the local search path for the schematic capture program +`gschem'. Now the netlister, `gnetlist', must also be configured. +This can be done by copying the file `gschemrc' to `gnetlistrc' by +running `cp gschemrc gnetlistrc'. Alternatively, you can create a soft +link so only a single file needs to be updated if additional symbol +paths are added. The link is created by running `ln -s gschemrc +gnetlistrc'. + +10.1.3 Set Up `gsch2pcb' Config Files +------------------------------------- + +The program `gsch2pcb', not to be confused with the older `gschem2pcb' +script, is used to link the schematic to layout. `gsch2pcb' is +responsible for creating the netlist used to provide connectivity +information to PCB as well creating an initial layout with all +components instantiated in the design. Forward annotation of schematic +changes to the layout is also done using `gsch2pcb'. `gsch2pcb' uses a +project file to set up the schematic file names, PCB library locations, +and output file names. Create a project file called `project' using +the following as an example: + + # List all the schematics to be netlisted + # and laid out on the pc board. + schematics first.sch second.sch third.sch + + # For an output-name of foo, gsch2pcb generates files + # foo.net, foo.pcb, and foo.new.pcb. If there is no + # output-name specified, the file names are derived from + # the first listed schematic, i.e. first.net, etc. + output-name preamp + +10.1.4 Capture Schematics Using `gschem' +---------------------------------------- + +This section is fairly brief and assumes familiarity with using the +`gschem' schematic capture program. As you are creating your +schematics, be sure to observe the following rules: + * Make sure that each component in the schematic has a `footprint' + attribute that corresponds to a footprint in the PCB library or a + footprint you plan on creating. + + * Make sure all reference designators are unique. One way to ensure + this is to run the `refdes_renum' script (part of gEDA) after the + schematics are created. + +10.1.5 Create Any Unique PCB Footprints +--------------------------------------- + +Create the new footprints you design needs using either the m4 style or +newlib style of PCB libraries. Refer to *note Library Creation:: for +details on this process. For m4 style footprints, store them in the +`pkg/m4' subdirectory and for newlib footprints, store them in the +`pkg/newlib' subdirectory. + +10.1.6 Generate Initial PCB Design Using `gsch2pcb' +--------------------------------------------------- + +The `gsch2pcb' program connects the schematic and layout. It basic +operation is to call `gnetlist' to generate the connectivity netlist +that PCB used to verify connectivity and to instantiate all elements +found in the schematic to a new layout. The default, as of `gsch2pcb' +version 0.9, is to use any found m4 style parts first and then search +for newlib style if no old style part was found. By using the +`--use-files' or `-f' flag to `gsch2pcb' priority is given to newlib +style parts even if m4 style are found. You may wish to verify this in +the `gsch2pcb' documentation in case this changes in the future. To +start your layout, run `gsch2pcb project' where `project' is the +project file created previously. This will create a new netlist file, +`preamp.net', and a new layout file, `preamp.pcb'. + +10.1.7 Layout Circuit Board +--------------------------- + +Run PCB on the new layout by running `pcb preamp.pcb'. Load the +netlist file by selecting "load netlist file" from the "file" menu. In +the file selection dialog box, choose `preamp.net'. This loads +connectivity information into PCB. + + Using the selection tool, grab and move apart the various footprints +with the middle mouse button. Once the parts are moved apart from each +other, choose "optimize rats-nest" from the "Connects" menu. This menu +choice will display and optimize the rats nest. Use the rats nest to +help guide placement of the parts. You may wish to re-run the "optimize +rats-nest" command after moving parts around. + + After the placement is complete, use the line tool to add traces to +the board. As traces are added, the corresponding rats line will +disappear. + +10.1.8 Forward Annotation of Schematic Changes +---------------------------------------------- + +If schematic changes are made after the layout has started, `gsch2pcb' +can be used to forward annotate these changes to the layout. To +forward annotate schematic changes, run `gsch2pcb project'. This +command will create the files `preamp.new.pcb', `preamp.net', and +modify the file `preamp.pcb'. The modifications to `preamp.pcb' +include forward annotation of schematic component value changes, adds +any new components, and removes any deleted components. + +10.1.9 Generate Photoplot Files (RS-274X) +----------------------------------------- + +After the layout is complete, choose "edit layer-groupings" from the +"Settings" menu. The LayerGroups form lets you specify which layers +will appear in each output layer group. For example, in the default +form, layer group 1 has "front" and "front side" in it. The output +file `1.gbr' if DOS file names are used, or `somename_front.gbr' if +long file names are used will contain the "front" and "front side" +layers in it. Usually the defaults are sufficient, but this form is +still a useful reference. + + Choose "print layout..." from the "File" menu. In the print dialog +box, select "Gerber/RS-274X" for the device driver. Select the +"outline", "alignment", and "drillhelper" options. To get DOS +compatible file names, select the "DOS (8.3) names" option, otherwise +enter "preamp" for the filename. Press "OK". + + The following output files should have been created in the project +directory. The names in parentheses correspond to the DOS compatible +output file names. +`preamp_frontsilk.gbr (csilk.gbr)' + Top side silk screen. + +`preamp_frontmask.gbr (cmask.gbr)' + Top side soldermask relief. + +`preamp_front.gbr (1.gbr)' + Top copper. + +`preamp_backmask.gbr (smask.gbr)' + Bottom side soldermask relief. + +`preamp_back.gbr (2.gbr)' + Bottom Copper. + +`preamp_fab.gbr (fab.gbr)' + Fabrication drawing. Also known as the drill drawing. This + drawing is used for reference by the board vendor but is not + directly used in the fabrication process. + +`preamp_plated-drill.cnc (pdrill.cnc)' + NC Drill format file for the plated through holes. + +`preamp_unplated-drill.cnc (udrill.cnc)' + NC Drill format file for the unplated through holes. + +`preamp_bom.txt (bom.txt)' + A bill of materials for the layout. + +`preamp_xy.txt (xy.txt)' + Centroid (X-Y) data for driving automated assembly equipment. + + +File: pcb.info, Node: xcircuit, Prev: gEDA, Up: Schematic Frontends + +10.2 xcircuit +============= + +If anyone cares to contribute this section, it will get added. Please +submit changes to the bug tracking system for PCB which can be found +from the PCB homepage at `http://pcb.gpleda.org'. + + +File: pcb.info, Node: Installation, Next: Custom Menus, Prev: Schematic Frontends, Up: Top + +Appendix A Installation and Troubleshooting +******************************************* + +Compiling and installing the package should be straightforward. If any +problems occur, please contact the author , +or the current maintainer to find a +solution and include it into the next release. + +* Menu: + +* compiling:: Compiling and installing. +* problems:: Troubleshooting. + + +File: pcb.info, Node: compiling, Next: problems, Up: Installation + +A.1 Compiling and Installing +============================ + +This section covers the steps which are necessary to compile the +package. + +* Menu: + +* quickstart:: Quick start. +* running configure:: Customizing Pcb with Configure + + +File: pcb.info, Node: quickstart, Next: running configure, Up: compiling + +A.1.1 Quick Start +----------------- + +Starting with version 2.0, `Pcb' has switched to a GNU +autoconf/automake build system. Installation of `Pcb' consists of +three steps: configuration, building, and installing. In a typical +installation, these steps are as simple as + ./configure + make + make install + + +File: pcb.info, Node: running configure, Prev: quickstart, Up: compiling + +A.1.2 Running the configure Script +---------------------------------- + +The `configure' script accepts all of the standard GNU configure +options. For a complete list of configuration options, run +`./configure --help'. + +`INFOLIBDIR' + must be set to the directory where your GNU info files are located. + +`PCBLIBDIR' + is the path of a directory where the font files will be installed. + +`DEFAULTFONT' + the name of the default font file. + +`DEFAULTLIBRARY' + the name of the default library. + +`GNUM4' + the name of GNUs m4 version. + +`BTNMOD' + If your window manager has already bound _Mod1_ together with some + function keys you may want to change this setting. This is true + for HP-VUE. + + + If you find things which must be changed to compile on your system, +please add the appropriate autoconf tests (if you are familiar with +that) and mail a copy to the maintainer, harry eaton, at +. + + If you do not have the appropriate permissions you should run +`./pcbtest.sh' in the `src' directory to run `Pcb' from the +installation directory. + + +File: pcb.info, Node: problems, Prev: compiling, Up: Installation + +A.2 Troubleshooting +=================== + +There are some known problems. Most of them are related to missing +parts of a standard `X11' distribution. Some others are caused by third +party applications such as `X' servers. To make this list more complete +please mail your problems and, if available, solutions to the author. +The mail address may be found at the beginning of this chapter. In any +case, read *note X11::. + + By the way, you `MUST HAVE AN ANSI COMPILER' to make `Pcb' work. + + Another source of problems are older versions of `flex' and `bison'. +`Pcb' definitely works with `flex-2.4.7' and `bison-1.22' or later. The +problems will result in a _syntax error_ while parsing files. This +should only be a problem if you have modified the `flex' or `bison' +input files. + + The following list gives you just an idea because I'm not able to +test all `Pcb' releases on all platforms. + +* Menu: + +* HP:: Hewlett-Packard series 700 and 800 running HP-UX 10.* +* Sun:: Sun, Solaris 2.5 +* SGI:: SGI, IRIX 5.3 and 6.* +* DEC Alpha:: DEC Alpha, DEC UNIX 3.2c and 4.0 +* SCO:: SCO Unix ODT 3.0, PC hardware +* Linux:: Linux 0.99pl14 and later +* BSD:: FreeBSD, NetBSD ... +* X11:: Refers to `X11R4', `X11R5', and `OpenWindows' +* TeX and Manuals:: Problems creating the `pcb.dvi' + + +File: pcb.info, Node: HP, Next: Sun, Up: problems + +A.2.1 HP Series 700 and 800 +--------------------------- + +You have to install several `X11' include files or, better, install a +complete `X11R5' release. Hewlett-Packard doesn't support the Athena +Widgets. So the header files and libraries are missing from the +application media, but they are available as a patch. They also do not +ship the `ANSI' compiler with the normal operating system release so +you have to buy one or use `GCC'. Some of the tools are available as +patches. + + In addition, `Pcb' has been successfully tested on these platforms +with `HPUX 9.*, 10.*' running self-compiled `X11R5'. + + +File: pcb.info, Node: Sun, Next: SGI, Prev: HP, Up: problems + +A.2.2 Sun SPARC architecture +---------------------------- + +There are no known problems with Sun machines if they use `X11R5' +instead of `OpenWindows'. `Pcb' compiled successfully with all kinds of +SPARCstations `Solaris-2.[345]'. + + For problems with `OpenWindows' refer to *note X11::. + + +File: pcb.info, Node: SGI, Next: DEC Alpha, Prev: Sun, Up: problems + +A.2.3 Silicon Graphics +---------------------- + +`Pcb' has been tested on some boxes running either `IRIX-4.0.5' or +`IRIX-5.3'. The former one uses a `X11R4' server. There are no +problems. For known problems with `X11R4', see *note X11::. + + +File: pcb.info, Node: DEC Alpha, Next: SCO, Prev: SGI, Up: problems + +A.2.4 DEC Alpha +--------------- + +`Pcb' compiled and runs without problems on `DEC UNIX V3.2c'. + + +File: pcb.info, Node: SCO, Next: Linux, Prev: DEC Alpha, Up: problems + +A.2.5 SCO Unix +-------------- + +John DuBois wrote: + `SCO-ODT-3.0' requires the latest version of tls003, the Athena + widget library (available from sosco.sco.com). The main problems + I have encountered are it core dumps fairly often, especially + while loading/dropping elements... + I'll see what I am able to do as soon as I have access to an `SCO' +system. + + +File: pcb.info, Node: Linux, Next: BSD, Prev: SCO, Up: problems + +A.2.6 Linux +----------- + +Since the `X11' version of `Pcb' has been developed on a Linux system +here are no known problems. + + +File: pcb.info, Node: BSD, Next: X11, Prev: Linux, Up: problems + +A.2.7 FreeBSD and NetBSD +------------------------ + +`Pcb' has been tested on NetBSD and works without any problems. You +may also be able to find a NetBSD package at +`ftp://ftp.netbsd.org/pub/NetBSD/packages/cad/pcb/README.html' or a +FreeBSD port at +`http://www.freebsd.org/cgi/url.cgi?ports/cad/pcb/pkg-descr'. + + +File: pcb.info, Node: X11, Next: TeX and Manuals, Prev: BSD, Up: problems + +A.2.8 Problems related to X11 +----------------------------- + +There are a some problems related to `X11R4' or systems derived from +`X11' such as `OpenWindows'. *Note Sun::. You at least have to change +all occurances of _baseTranslations_ in the resource files to +_translations_ if you are using a `X11R4' server. Look at the `X11R5' +_Intrinsics_ manual for details. + + The panner widget (print dialog box) appears only in release `X11R5' +and later. It really simplifies adjusting the offsets. With earlier +releases the printout will always appear in the center of the page. + + You may have some problems in a mixed `X11-OpenWindows' environment. + + `Pcb' has been tested successfully with `X11R6' under Linux 1.1.59 +and later. + + +File: pcb.info, Node: TeX and Manuals, Prev: X11, Up: problems + +A.2.9 Problems related to TeX +----------------------------- + +If your `TeX' installation complains about a missing `texinfo.tex' file +copy the one included in this release (directory `doc' to your `TeX' +macro directory. Note, there are probably newer versions of this file +available from some FTP sites. `TeX-3.0' failed, `TeX-3.14' worked +just fine. Check our FTP server _ftp.uni-ulm.de_ for ready-to-print +versions of the manuals. + + +File: pcb.info, Node: Custom Menus, Next: Regular Expressions, Prev: Installation, Up: Top + +Appendix B Customizing the Menus +******************************** + +The menu system is driven off a data file that contains "resources". A +resource is a hierarchical description of a data tree which, in this +case, is mapped to the hierarchical menus used by Pcb. + +* Menu: + +* Resource Syntax:: What a resource file looks like. +* Menu Definitions:: Using a resource to define a menu. +* Menu Files and Defaults:: Where Pcb looks for its menu resource. + + +File: pcb.info, Node: Resource Syntax, Next: Menu Definitions, Up: Custom Menus + +B.1 Resource Syntax +=================== + +A resource file is a simple text file. It contains curly braces to +group things, spaces between things, and double quotes when strings +need to include spaces. There are four fundamental ways of adding data +to a resource. + + First, a string (either a single word or a quoted string with spaces, +we call both "strings" in this appendix) can be added all by itself, to +add a string resource to the current resource. This is used, for +example, to define the string printed on a menu button. In this +example, four strings are added to the FILE resource: + + File = { + Sample + "longer sample" + some text + } + + Second, a named string may be added by giving two strings separated +by an equals sign. This is used to specify X resources and a few other +optional parameters of menus, for example. Note that a string all by +itself is thus an "unnamed" string. + + {"Layer groups" foreground=red sensitive=false} + + Third, an unnamed subresource may be added. This is used to create +submenus and menu buttons. To add a subresource, simply group other +things in curly braces. This example describes a resource containing +one string and three subresources: + + {File + {New do_new()} + {Save do_save()} + {Quit do_quit()} + } + + Lastly, a named subresource may be added by prefixing an unnamed +subresource with a string and an equals sign, just as when naming +strings. This syntax is used to name the resources used for the main +menu and popup menus: + + MainMenu = { + ... + } + + Additionally, the menu parser allows for "hooks" whereby portions of +the menu system can be programmatically created at runtime by the +application. These hooks are invoked by a single word proceeded by an +at sign, such as this example where most of the Sizes menu is created +automatically: + + {Sizes + @sizes + {"Adjust active sizes ..." AdjustStyle(0)} + } + + In addition to all that, any unquoted pound sign (`#') begins a +comment. Commented text continues until the end of the containing +line. Comments may begin at the beginning of a line, or after other +text on the line: + + # This is a comment + MainMenu = { # This is also a comment + + +File: pcb.info, Node: Menu Definitions, Next: Menu Files and Defaults, Prev: Resource Syntax, Up: Custom Menus + +B.2 Menu Definitions +==================== + +To best understand this section, you should find the `pcb-menu.res' +file that your Pcb uses and refer to it for examples (*note Menu Files +and Defaults::). Note that the lesstif GUI uses `pcb-menu.res' and the +GTK+ GUI uses `gpcb-menu.res'. The file format is identical however +and if so desired, one can make one file be a soft link to the other. + + A resource defines a menu when it meets certain semantic +requirements. The menu hierarchy is reflected as a hierarchy of unnamed +subresources, with the first string of each subresource defining the +label used for the menu button. A subresource that itself contains +subresources becomes a submenu, a subresource that does not becomes a +button. + + A submenu should only contain subresources for the buttons or +submenus within that submenu. Two exceptions are allowed: an initial +string sets the label, and the string "-" (a single dash) will create a +separator. + + A button should not contain subresources, but will contain many +strings, named and unnamed. The first member shall be an unnamed +string which is the label for the button. Any other unnamed strings +within the button's resource will be used as actions (much like the +.Xdefaults action strings), which are functions that will be called +when the button is pressed (or popped up, or created, depending on the +action). As a convenience, if a left parenthesis is seen, the current +"word" will continue at least until the matching right parenthesis. +This allows you to pass strings with spaces as arguments to actions +without needing to quote the action. + + Named resources in button resources will be used as X resources. +Such resources can be used to set the font, color, and spacing of +buttons. As a convenience, "fg" can be used as an abbreviation for +"foreground". + + Within the menu's resource file, Pcb will look for a few key named +subresources. At the moment, the only one it looks for is one called +`MainMenu'. This will be used for the main menu bar. In the future, +other named subresources will be used for popup resources. + + Given all this, a small sample `pcb-menu.res' would be: + + MainMenu = { + {File + {"Load layout" Load(Layout)} + - + {"Quit Program" Quit() fg=red font=10x20} + } + } + + Within the Pcb sources are specially crafted comments that mark all +the actions, flags, menu hooks, and whatnot that Pcb offers. Read the +file `src/gather-actions' in the Pcb source tree for documentation for +these comments. + + +File: pcb.info, Node: Menu Files and Defaults, Prev: Menu Definitions, Up: Custom Menus + +B.3 Menu Files and Defaults +=========================== + +Pcb will look for a file which defines its menus, trying the following +names (the example is for the lesstif GUI, the GTK+ GUI has +"gpcb-menu.res" in place of "pcb-menu.res"): + + ./pcb-menu.res + $HOME/.pcb-menu.res + $PCBLIBDIR/pcb-menu.res + + + Note that PCBLIBDIR defaults to `/usr/local/share/pcb' (hence, +`/usr/local/share/pcb/pcb-menu.res'). The `' entry refers to +a menu definition within the Pcb application itself. The master file +for all this is the file `src/pcb-menu.res' in the Pcb source tree. +This master source is used to create the internal menu definition as +well as being installed in `$pcblibdir'. + + +File: pcb.info, Node: Regular Expressions, Next: Standard Drill Sizes, Prev: Custom Menus, Up: Top + +Appendix C Element Search/Regular Expressions +********************************************* + +C.1 Element Search/Regular Expressions +====================================== + +`Pcb''s search is based on POSIX 1003.2 Regular Expressions. Full POSIX +Regular Expressions are supported by `Pcb' if the regex library was +available when `Pcb' was built. One difference from the regular +expressions found in tools like awk or grep is that PCB implicitly adds +a "^" to the begining of a regular expression and "$" to the end of the +regular expression. For example, if you enter "C1", the actual regular +expression used internally is "^C1$". Another difference is that +search patterns in pcb are not case sensitive. That is, "CON" is +treated the same as "con". + + It is easier to show by example how to search than explain POSIX +1003.2. With regular expressions most characters are just themselves, +but some are special: + +`*' + Matches 0 or more instances of preceding character. + +`+' + Matches 1 or more instances of preceding character. + +`?' + Matches 0 or 1 instances of preceding character. + +`.' + Matches any single character other than the newline character. + +`|' + The vertical bar is the alternation operator. It combines two + regular expressions. The result matches if either of them matches. + +`\' + A backslash indicates the next character should not be interpreted + literally if it normally is, and should be interpreted literally + if it normally isn't. + +`{n}' + An integer n enclosed in curly brackets matches the preceding item + if it occurs exactly n times. + +`[ ]' + A pair of square brackets matches every character they contain. + Characters may be given explicitly, or as ranges. + +`-' + A hyphen in the context of square brackets denotes the range + between the preceding and the following character. E.g., the + range of digits is "0-9" . The range of letters from C to K is + "C-K" . + +`\^ inside square brackets' + Inside square brackets the caret is an anti operator. Its presence + makes the square prackets match anything except the contents of + the brackets. + +`( )' + Round parenthesis group parts of a regular expression. This is + very much like they do in math formulars. + + + If you need a special character literally, you can escape it with a +backslash. + + The following examples illustrate how regular expressions can be +used to specify element names (reference designators) to search for. +`C5' + Select the element whose name is exactly "C5". + +`C5 | R3' + Select C5 and R3. + +`C.*' + Select all elements whose name start with the letter "C", such as + C5, or C42, or CF1. + +`C.*1' + Select all elements that start with "C" and end with "1", such as + C1, or C51 or C5/9B71. + +`R10?' + Search for R1 or R10, but will not select R100 or R105. The + question mark is a quantifier for the character "0". + +`R128+' + Selects R128, R1288, R12888, etc. + +`TB.' + Select all terminal blocks having exactly one character designator + after "TB" such as TB1, TBA, or TBx but not TB. + +`TB..' + Select all terminal blocks having a two character designator such + as TB21 or TB1a. + +`TB.*' + Select all terminal blocks with any designator. + +`.*31' + Select all items, whose name ends with "31" such as Q31, or R31, + or R531. + +`Q[12]' + Select Q1 and Q2. + +`[A-D].*' + Select all items, whose name starts with "A", "B", "C", or "D". + +`.*N{2}.*' + Select all items, whose name contains two "N" in a row such as + CONN23, or connA, but not CON5 + +`[^D].*' + Select all items that do not start with the letter "D", such as + C2, or R34, but not D34 + + + +File: pcb.info, Node: Standard Drill Sizes, Next: Centroid File Format, Prev: Regular Expressions, Up: Top + +Appendix D Standard Drill Size Tables +************************************* + +D.1 American Standard Wire Size Drills +====================================== + +Drill Diameter Drill Diameter Drill Diameter +Size (inches) Size (inches) Size (inches) +97 .0059 96 .0063 95 .0067 +94 .0071 93 .0075 92 .0079 +91 .0083 90 .0087 89 .0091 +88 .0095 87 .0100 86 .0105 +85 .0110 84 .0115 83 .0120 +82 .0125 81 .0130 80 .0135 +79 .0145 78 .0160 77 .0180 +76 .0200 75 .0210 74 .0225 +73 .0240 72 .0250 71 .0260 +70 .0280 69 .0292 68 .0310 +67 .0320 66 .0330 65 .0350 +64 .0360 63 .0370 62 .0380 +61 .0390 60 .0400 59 .0410 +58 .0420 57 .0430 56 .0465 +55 .0520 54 .0550 53 .0595 +52 .0635 51 .0670 50 .0700 +49 .0730 48 .0760 47 .0785 +46 .0810 45 .0820 44 .0860 +43 .0890 42 .0935 41 .0960 +40 .0980 39 .0995 38 .1015 +37 .1040 36 .1065 35 .1100 +34 .1110 33 .1130 32 .1160 +31 .1200 30 .1285 29 .1360 +28 .1405 27 .1440 26 .1470 +25 .1495 24 .1520 23 .1540 +22 .1570 21 .1590 20 .1610 +19 .1660 18 .1695 17 .1730 +16 .1770 15 .1800 14 .1820 +13 .1850 12 .1890 11 .1910 +10 .1935 9 .1960 8 .1990 +7 .2010 6 .2040 5 .2055 +4 .2090 3 .2130 2 .2210 +1 .2280 + +D.2 American Standard Letter Size Drills +======================================== + +Drill Diameter Drill Diameter Drill Diameter +Size (inches) Size (inches) Size (inches) +A .2340 B .2380 C .2420 +D .2460 E .2500 F .2570 +G .2610 H .2660 I .2720 +J .2770 K .2810 L .2900 +M .2950 N .3020 O .3160 +P .3230 Q .3320 R .3390 +S .3480 T .3580 U .3680 +V .3770 W .3860 X .3970 +Y .4040 Z .4130 + +D.3 Fractional Inch Size Drills +=============================== + +Drill Diameter Drill Diameter Drill Diameter +Size (inches) Size (inches) Size (inches) +1/64 .0156 1/32 .0313 3/64 .0469 +1/16 .0625 5/64 .0781 3/32 .0938 +7/64 .1094 1/8 .1250 9/64 .1406 +5/32 .1562 11/64 .1719 3/16 .1875 +13/64 .2031 7/32 .2188 15/64 .2344 +1/4 .2500 17/64 .2656 9/32 .2812 +19/64 .2969 5/16 .3125 21/64 .3281 +11/32 .3438 23/64 .3594 3/8 .3750 +25/64 .3906 13/32 .4062 27/64 .4219 +7/16 .4375 29/64 .4531 15/32 .4688 +31/64 .4844 1/2 .5000 33/64 .5156 +17/32 .5313 35/64 .5469 9/16 .5625 +37/64 .5781 19/32 .5938 39/64 .6094 +5/8 .6250 41/64 .6406 21/32 .6562 +43/64 .6719 11/16 .6875 45/64 .7031 +23/32 .7188 47/64 .7344 3/4 .7500 +49/64 .7656 25/32 .7812 51/64 .7969 +13/16 .8125 53/64 .8281 27/32 .8438 +55/64 .8594 7/8 .8750 57/64 .8906 +29/32 .9062 59/64 .9219 15/16 .9375 +61/64 .9531 31/32 .9688 63/64 .9844 +1 1.0000 + +D.4 Metric Drills +================= + +Drill Diameter Drill Diameter Drill Diameter +Size (inches) Size (inches) Size (inches) +0.20 mm .00787 0.25 mm .00984 0.30 mm .0118 +0.35 mm .0138 0.40 mm .0158 0.45 mm .0177 +0.50 mm .0197 0.55 mm .0217 0.60 mm .0236 +0.65 mm .0256 0.70 mm .0276 0.75 mm .0295 +0.80 mm .0315 0.85 mm .0335 0.90 mm .0354 +0.95 mm .0374 1.00 mm .0394 1.05 mm .0413 +1.10 mm .0433 1.15 mm .0453 1.20 mm .0472 +1.25 mm .0492 1.30 mm .0512 1.35 mm .0531 +1.40 mm .0551 1.45 mm .0571 1.50 mm .0591 +1.55 mm .0610 1.60 mm .0630 1.65 mm .0650 +1.70 mm .0669 1.75 mm .0689 1.80 mm .0709 +1.85 mm .0728 1.90 mm .0748 1.95 mm .0768 +2.00 mm .0787 2.05 mm .0807 2.10 mm .0827 +2.15 mm .0846 2.20 mm .0866 2.25 mm .0886 +2.30 mm .0906 2.35 mm .0925 2.40 mm .0945 +2.45 mm .0965 2.50 mm .0984 2.55 mm .1004 +2.60 mm .1024 2.65 mm .1043 2.70 mm .1063 +2.75 mm .1083 2.80 mm .1102 2.85 mm .1122 +2.90 mm .1142 2.95 mm .1161 3.00 mm .1181 +3.10 mm .1220 3.15 mm .1240 3.20 mm .1260 +3.25 mm .1280 3.30 mm .1299 3.40 mm .1339 +3.50 mm .1378 3.60 mm .1417 3.70 mm .1457 +3.75 mm .1476 3.80 mm .1496 3.90 mm .1535 +4.00 mm .1575 4.10 mm .1614 4.20 mm .1654 +4.25 mm .1673 4.30 mm .1693 4.40 mm .1732 +4.50 mm .1772 4.60 mm .1811 4.70 mm .1850 +4.75 mm .1870 4.80 mm .1890 4.90 mm .1929 +5.00 mm .1969 5.10 mm .2008 5.20 mm .2047 +5.25 mm .2067 5.30 mm .2087 5.40 mm .2126 +5.50 mm .2165 5.60 mm .2205 5.70 mm .2244 +5.75 mm .2264 5.80 mm .2283 5.90 mm .2323 +6.00 mm .2362 6.10 mm .2402 6.20 mm .2441 +6.25 mm .2461 6.30 mm .2480 6.40 mm .2520 +6.50 mm .2559 6.60 mm .2598 6.70 mm .2638 +6.75 mm .2657 6.80 mm .2677 6.90 mm .2717 +7.00 mm .2756 7.10 mm .2795 7.20 mm .2835 +7.25 mm .2854 7.30 mm .2874 7.40 mm .2914 +7.50 mm .2953 7.60 mm .2992 7.70 mm .3031 +8.00 mm .3150 8.10 mm .3189 8.20 mm .3228 +8.25 mm .3248 8.30 mm .3268 8.40 mm .3307 +8.50 mm .3346 8.60 mm .3386 8.70 mm .3425 +8.75 mm .3445 8.80 mm .3465 8.90 mm .3504 +9.00 mm .3543 9.10 mm .3583 9.20 mm .3622 +9.25 mm .3642 9.30 mm .3661 9.40 mm .3701 +9.50 mm .3740 9.60 mm .3780 9.70 mm .3819 +9.75 mm .3839 9.80 mm .3858 9.90 mm .3898 +10.00 mm .3937 10.10 mm .3976 10.20 mm .4016 +10.25 mm .4035 10.30 mm .4055 10.40 mm .4094 +10.50 mm .4134 10.60 mm .4173 10.70 mm .4213 +10.80 mm .4252 10.90 mm .4291 11.00 mm .4331 +11.10 mm .4370 11.20 mm .4409 11.25 mm .4429 +11.30 mm .4449 11.40 mm .4488 11.50 mm .4528 +11.60 mm .4567 11.70 mm .4606 11.75 mm .4626 +11.80 mm .4646 11.90 mm .4685 12.00 mm .4724 +12.50 mm .4921 13.00 mm .5118 13.50 mm .5315 +14.00 mm .5512 14.50 mm .5709 15.00 mm .5906 +15.50 mm .6102 16.00 mm .6299 16.50 mm .6496 +17.00 mm .6693 17.50 mm .6890 18.00 mm .7087 +18.50 mm .7283 19.00 mm .7480 19.50 mm .7677 +20.00 mm .7874 20.50 mm .8071 21.00 mm .8268 +21.50 mm .8465 22.00 mm .8661 22.50 mm .8858 +23.00 mm .9055 23.50 mm .9252 24.00 mm .9449 +24.50 mm .9646 25.00 mm .9843 + + +File: pcb.info, Node: Centroid File Format, Next: Action Reference, Prev: Standard Drill Sizes, Up: Top + +Appendix E Centroid (X-Y) File Format +************************************* + +E.1 Overview +============ + +E.2 File Format +=============== + +The centroid output file is in a standard comma seperated values (CSV) +format. Comment lines begin with a "#". The output file contains a +header with an RCS Id tag (useful for those who will check the file +into a version control system), a version number for the file format, +some comments containing the author and title of the board, and a +comment describing the remainder of the file format. + + An example centroid file is shown below. + + + # $Id$ + # PcbXY Version 1.0 + # Date: Fri Jul 22 03:40:08 2005 UTC + # Author: PCB User + # Title: MyBoard - PCB X-Y + # RefDes, Description, Value, X, Y, rotation, top/bottom + # X,Y in mils. rotation in degrees. + # -------------------------------------------- + R61,"0603","10",2610.00,3560.00,90,top + J5,"AMPHENOL_ARFX1231","unknown",2390.00,4220.00,180,top + C13,"0402","0.01u",2340.00,3014.00,270,top + +E.3 Computation of Centroid and Rotation +======================================== + +The center of each element is found by averaging the (X,Y) coordinates +for the center of each pin and pad in the element. For example if an +element has 2 pins, 1 at (1,0) and another at (1,4) then the centroid +will be at (1,2). + + The calculation of rotation is a bit more complex. Currently a +rotation is not stored for each element but rather the rotated element +is stored. In other words if the element from the library has a pin at +(0,0) and (0,2) and it has been rotated by 90 degrees, then the `.pcb' +file will store (0,0) and (2,0) for the pin locations with no +indication that they have been rotated from the original. + + In the event that the element has only 1 pin, then the rotation is +set to zero. If the element has only one pad (as opposed to a +through-hole pin), then the rotation of the pad is used. + + When the element has multiple pins, the location of pin #1 is placed +in the coordinate system which has the centroid of the part at (0,0). +Then which quadrant pin #1 falls in determines the rotation. Zero +degrees of rotation is defined as pin #1 being in the upper left +quadrant. Increasing angles correspond to counterclockwise rotation so +a rotation of 90 degrees places pin #1 in the lower left quadrant. +Currently, the only allowed rotations are 0, 90, 180, and 270 degrees. + + If pin #1 happens to be at the centroid of the part, then pin #2 is +examined to see which quadrant it is located in. The same rules apply +for the definitions of rotation. In other words, when pin #1 is at the +centroid of the part and pin #2 is in the upper left quadrant, the +rotation is declared to be zero degrees. + + +File: pcb.info, Node: Action Reference, Next: Glossary, Prev: Centroid File Format, Up: Top + +Appendix F Action Reference +*************************** + +Many actions take a `delta' parameter as the last parameter, which is +an amount to change something. That `delta' may include units, as an +additional parameter, such as `Action(Object,5,mm)'. If no units are +specified, the default is PCB's native units (currently 1/100 mil). +Also, if the delta is prefixed by `+' or `-', the size is increased or +decreased by that amount. Otherwise, the size size is set to the given +amount. + + Action(Object,5,mil) + Action(Object,+0.5,mm) + Action(Object,-1) + + Actions which take a `delta' parameter which do not accept all these +options will specify what they do take. + + Many actions act on indicated objects on the board. They will have +parameters like `ToggleObject' or `SelectedVias' to indicate what group +of objects they act on. Unless otherwise specified, these parameters +are defined as follows: + +`Object' +`ToggleObject' + Affects the object under the mouse pointer. If this action is + invoked from a menu or script, the user will be prompted to click + on an object, which is then the object affected. + +`Selected' +`SelectedObjects' + Affects all objects which are currently selected. At least, all + selected objects for which the given action makes sense. + +`SelectedPins' +`SelectedVias' +`SelectedTYPE' +`etc' + Affects all objects which are both selected and of the TYPE + specified. + + +* Menu: + +* core actions:: +* common actions:: +* gtk actions:: +* lesstif actions:: + + +File: pcb.info, Node: core actions, Next: common actions, Up: Action Reference + +F.1 Core actions +================ + +* Menu: + +* AddRats Action:: Add one or more rat lines to the board. +* ApplyVendor Action:: Applies the currently loaded vendor drill table to the current design. +* Atomic Action:: Save or restore the undo serial number. +* Attributes Action:: Let the user edit the attributes of the layout, current or given +layer, or selected element. +* AutoPlaceSelected Action:: Auto-place selected components. +* AutoRoute Action:: Auto-route some or all rat lines. +* ChangeClearSize Action:: Changes the clearance size of objects. +* ChangeDrillSize Action:: Changes the drilling hole size of objects. +* ChangeFlag Action:: Sets or clears flags on objects. +* ChangeHole Action:: Changes the hole flag of objects. +* ChangeJoin Action:: Changes the join (clearance through polygons) of objects. +* ChangeName Action:: Sets the name of objects. +* ChangeOctagon Action:: Changes the octagon-flag of pins and vias. +* ChangePaste Action:: Changes the no paste flag of objects. +* ChangePinName Action:: Sets the name of a specific pin on a specific element. +* ChangeSize Action:: Changes the size of objects. +* ChangeSquare Action:: Changes the square flag of pins and pads. +* ClearOctagon Action:: Clears the octagon-flag of pins and vias. +* ClearSquare Action:: Clears the square-flag of pins and pads. +* ClrFlag Action:: Clears flags on objects. +* Connection Action:: Searches connections of the object at the cursor position. +* Delete Action:: Delete stuff. +* DeleteRats Action:: Delete rat lines. +* DisableVendor Action:: Disables automatic drill size mapping. +* DisperseElements Action:: Disperses elements. +* Display Action:: Several display-related actions. +* djopt Action:: Perform various optimizations on the current board. +* DRC Action:: Invoke the DRC check. +* DumpLibrary Action:: Display the entire contents of the libraries. +* elementlist Action:: Adds the given element if it doesn't already exist. +* elementsetattr Action:: Sets or clears an element-specific attribute. +* EnableVendor Action:: Enables automatic drill size mapping. +* execcommand Action:: Runs a command. +* ExecuteFile Action:: Run actions from the given file. +* Flip Action:: Flip an element to the opposite side of the board. +* FontEdit Action:: Convert the current font to a PCB for editing. +* FontSave Action:: Convert the current PCB back to a font. +* FreeRotateBuffer Action:: Rotates the current paste buffer contents by the specified angle. The +angle is given in degrees. If no angle is given, the user is prompted +for one. + +* GlobalPuller Action:: Pull all traces tight. +* h Action:: Print a help message for commands. +* Import Action:: Import schematics. +* l Action:: Loads layout data. +* le Action:: Loads an element into the current buffer. +* LoadFootprint Action:: Loads a single footprint by name. +* LoadFrom Action:: Load layout data from a file. +* LoadVendorFrom Action:: Loads the specified vendor resource file. +* m Action:: Loads a layout into the current buffer. +* MarkCrosshair Action:: Set/Reset the Crosshair mark. +* Message Action:: Writes a message to the log window. +* MinClearGap Action:: Ensures that polygons are a minimum distance from objects. +* MinMaskGap Action:: Ensures the mask is a minimum distance from pins and pads. +* Mode Action:: Change or use the tool mode. +* MorphPolygon Action:: Converts dead polygon islands into separate polygons. +* MoveLayer Action:: Moves/Creates/Deletes Layers. +* MoveObject Action:: Moves the object under the crosshair. +* MoveToCurrentLayer Action:: Moves objects to the current layer. +* Netlist Action:: Perform various actions on netlists. +* New Action:: Starts a new layout. +* OptAutoOnly Action:: Toggles the optimize-only-autorouted flag. +* PasteBuffer Action:: Various operations on the paste buffer. +* Polygon Action:: Some polygon related stuff. +* Puller Action:: Pull an arc-line junction tight. +* q Action:: Quits the application after confirming. +* q! Action:: Quits the application without confirming. +* Quit Action:: Quits the application after confirming. +* Redo Action:: Redo recent``undo''operations. +* RemoveSelected Action:: Removes any selected objects. +* Renumber Action:: Renumber all elements. The changes will be recorded to filename +for use in backannotating these changes to the schematic. +* Report Action:: Produce various report. +* ReportDialog Action:: Report on the object under the crosshair +* RipUp Action:: Ripup auto-routed tracks, or convert an element to parts. +* rn Action:: Reads netlist. +* RouteStyle Action:: Copies the indicated routing style into the current sizes. +* s Action:: Saves layout data. +* SaveSettings Action:: Saves settings. +* SaveTo Action:: Saves data to a file. +* Select Action:: Toggles or sets the selection. +* SetFlag Action:: Sets flags on objects. +* SetOctagon Action:: Sets the octagon-flag of objects. +* SetSame Action:: Sets current layer and sizes to match indicated item. +* SetSquare Action:: sets the square-flag of objects. +* SetThermal Action:: Set the thermal (on the current layer) of pins or vias to the given style. +Style = 0 means no thermal. +Style = 1 has diagonal fingers with sharp edges. +Style = 2 has horizontal and vertical fingers with sharp edges. +Style = 3 is a solid connection to the plane.Style = 4 has diagonal fingers with rounded edges. +Style = 5 has horizontal and vertical fingers with rounded edges. + +* SetValue Action:: Change various board-wide values and sizes. +* ToggleHideName Action:: Toggles the visibility of element names. +* ToggleVendor Action:: Toggles the state of automatic drill size mapping. +* Undo Action:: Undo recent changes. +* UnloadVendor Action:: Unloads the current vendor drill mapping table. +* Unselect Action:: Unselects the object at the pointer location or the specified objects. +* w Action:: Saves layout data. +* wq Action:: Saves the layout data and quits. + + +File: pcb.info, Node: AddRats Action, Next: ApplyVendor Action, Up: core actions + +F.1.1 AddRats +------------- + +AddRats(AllRats|SelectedRats|Close) + +Add one or more rat lines to the board. + +`AllRats' + Create rat lines for all loaded nets that aren't already connected + on with copper. + +`SelectedRats' + Similarly, but only add rat lines for nets connected to selected + pins and pads. + +`Close' + Selects the shortest unselected rat on the board. + + + +File: pcb.info, Node: ApplyVendor Action, Next: Atomic Action, Prev: AddRats Action, Up: core actions + +F.1.2 ApplyVendor +----------------- + +ApplyVendor() + +Applies the currently loaded vendor drill table to the current design. + + This will modify all of your drill holes to match the list of allowed +sizes for your vendor. + + +File: pcb.info, Node: Atomic Action, Next: Attributes Action, Prev: ApplyVendor Action, Up: core actions + +F.1.3 Atomic +------------ + +Atomic(Save|Restore|Close|Block) + +Save or restore the undo serial number. + + This action allows making multiple-action bindings into an atomic +operation that will be undone by a single Undo command. For example, +to optimize rat lines, you'd delete the rats and re-add them. To group +these into a single undo, you'd want the deletions and the additions to +have the same undo serial number. So, you `Save', delete the rats, +`Restore', add the rats - using the same serial number as the deletes, +then `Block', which checks to see if the deletions or additions +actually did anything. If not, the serial number is set to the saved +number, as there's nothing to undo. If something did happen, the +serial number is incremented so that these actions are counted as a +single undo step. + +`Save' + Saves the undo serial number. + +`Restore' + Returns it to the last saved number. + +`Close' + Sets it to 1 greater than the last save. + +`Block' + Does a Restore if there was nothing to undo, else does a Close. + + + +File: pcb.info, Node: Attributes Action, Next: AutoPlaceSelected Action, Prev: Atomic Action, Up: core actions + +F.1.4 Attributes +---------------- + +Attributes(Layout|Layer|Element) +Attributes(Layer,layername) + +Let the user edit the attributes of the layout, current or given layer, +or selected element. + + This just pops up a dialog letting the user edit the attributes of +the pcb, an element, or a layer. + + +File: pcb.info, Node: AutoPlaceSelected Action, Next: AutoRoute Action, Prev: Attributes Action, Up: core actions + +F.1.5 AutoPlaceSelected +----------------------- + +AutoPlaceSelected() + +Auto-place selected components. + + Attempts to re-arrange the selected components such that the nets +connecting them are minimized. Note that you cannot undo this. + + +File: pcb.info, Node: AutoRoute Action, Next: ChangeClearSize Action, Prev: AutoPlaceSelected Action, Up: core actions + +F.1.6 AutoRoute +--------------- + +AutoRoute(AllRats|SelectedRats) + +Auto-route some or all rat lines. + +`AllRats' + Attempt to autoroute all rats. + +`SelectedRats' + Attempt to autoroute the selected rats. + + + Before autorouting, it's important to set up a few things. First, +make sure any layers you aren't using are disabled, else the autorouter +may use them. Next, make sure the current line and via styles are set +accordingly. Last, make sure "new lines clear polygons" is set, in +case you eventually want to add a copper pour. + + Autorouting takes a while. During this time, the program may not be +responsive. + + +File: pcb.info, Node: ChangeClearSize Action, Next: ChangeDrillSize Action, Prev: AutoRoute Action, Up: core actions + +F.1.7 ChangeClearSize +--------------------- + +ChangeClearSize(Object, delta) +ChangeClearSize(SelectedPins|SelectedPads|SelectedVias, delta) +ChangeClearSize(SelectedLines|SelectedArcs, delta +ChangeClearSize(Selected|SelectedObjects, delta) + +Changes the clearance size of objects. + + If the solder mask is currently showing, this action changes the +solder mask clearance. If the mask is not showing, this action changes +the polygon clearance. + + +File: pcb.info, Node: ChangeDrillSize Action, Next: ChangeFlag Action, Prev: ChangeClearSize Action, Up: core actions + +F.1.8 ChangeDrillSize +--------------------- + +ChangeDrillSize(Object, delta) +ChangeDrillSize(SelectedPins|SelectedVias|Selected|SelectedObjects, delta) + +Changes the drilling hole size of objects. + + +File: pcb.info, Node: ChangeFlag Action, Next: ChangeHole Action, Prev: ChangeDrillSize Action, Up: core actions + +F.1.9 ChangeFlag +---------------- + +ChangeFlag(Object|Selected|SelectedObjects, flag, value) +ChangeFlag(SelectedLines|SelectedPins|SelectedVias, flag, value) +ChangeFlag(SelectedPads|SelectedTexts|SelectedNames, flag, value) +ChangeFlag(SelectedElements, flag, value) +flag = square | octagon | thermal | join +value = 0 | 1 + +Sets or clears flags on objects. + + Toggles the given flag on the indicated object(s). The flag may be +one of the flags listed above (square, octagon, thermal, join). The +value may be the number 0 or 1. If the value is 0, the flag is +cleared. If the value is 1, the flag is set. + + +File: pcb.info, Node: ChangeHole Action, Next: ChangeJoin Action, Prev: ChangeFlag Action, Up: core actions + +F.1.10 ChangeHole +----------------- + +ChangeHole(ToggleObject|Object|SelectedVias|Selected) + +Changes the hole flag of objects. + + The "hole flag" of a via determines whether the via is a +plated-through hole (not set), or an unplated hole (set). + + +File: pcb.info, Node: ChangeJoin Action, Next: ChangeName Action, Prev: ChangeHole Action, Up: core actions + +F.1.11 ChangeJoin +----------------- + +ChangeJoin(ToggleObject|SelectedLines|SelectedArcs|Selected) + +Changes the join (clearance through polygons) of objects. + + The join flag determines whether a line or arc, drawn to intersect a +polygon, electrically connects to the polygon or not. When joined, the +line/arc is simply drawn over the polygon, making an electrical +connection. When not joined, a gap is drawn between the line and the +polygon, insulating them from each other. + + +File: pcb.info, Node: ChangeName Action, Next: ChangeOctagon Action, Prev: ChangeJoin Action, Up: core actions + +F.1.12 ChangeName +----------------- + +ChangeName(Object) +ChangeName(Layout|Layer) + +Sets the name of objects. + +`Object' + Changes the name of the element under the cursor. + +`Layout' + Changes the name of the layout. This is printed on the fab + drawings. + +`Layer' + Changes the name of the currently active layer. + + + +File: pcb.info, Node: ChangeOctagon Action, Next: ChangePaste Action, Prev: ChangeName Action, Up: core actions + +F.1.13 ChangeOctagon +-------------------- + +ChangeOctagon(Object|ToggleObject|SelectedObjects|Selected) +ChangeOctagon(SelectedElements|SelectedPins|SelectedVias) + +Changes the octagon-flag of pins and vias. + + Pins, pads, and vias can have various shapes. All may be round. +Pins and pads may be square (obviously "square" pads are usually +rectangular). Pins and vias may be octagonal. When you change a shape +flag of an element, you actually change all of its pins and pads. + + Note that the square flag takes precedence over the octagon flag, +thus, if both the square and octagon flags are set, the object is +square. When the square flag is cleared, the pins and pads will be +either round or, if the octagon flag is set, octagonal. + + +File: pcb.info, Node: ChangePaste Action, Next: ChangePinName Action, Prev: ChangeOctagon Action, Up: core actions + +F.1.14 ChangePaste +------------------ + +ChangePaste(ToggleObject|Object|SelectedPads|Selected) + +Changes the no paste flag of objects. + + The "no paste flag" of a pad determines whether the solderpaste +stencil will have an opening for the pad (no set) or if there wil be +no solderpaste on the pad (set). This is used for things such as +fiducial pads. + + +File: pcb.info, Node: ChangePinName Action, Next: ChangeSize Action, Prev: ChangePaste Action, Up: core actions + +F.1.15 ChangePinName +-------------------- + +ChangePinName(ElementName,PinNumber,PinName) + +Sets the name of a specific pin on a specific element. + + This can be especially useful for annotating pin names from a +schematic to the layout without requiring knowledge of the pcb file +format. + + ChangePinName(U3, 7, VCC) + + +File: pcb.info, Node: ChangeSize Action, Next: ChangeSquare Action, Prev: ChangePinName Action, Up: core actions + +F.1.16 ChangeSize +----------------- + +ChangeSize(Object, delta) +ChangeSize(SelectedObjects|Selected, delta) +ChangeSize(SelectedLines|SelectedPins|SelectedVias, delta) +ChangeSize(SelectedPads|SelectedTexts|SelectedNames, delta) +ChangeSize(SelectedElements, delta) + +Changes the size of objects. + + For lines and arcs, this changes the width. For pins and vias, this +changes the overall diameter of the copper annulus. For pads, this +changes the width and, indirectly, the length. For texts and names, +this changes the scaling factor. For elements, this changes the width +of the silk layer lines and arcs for this element. + + +File: pcb.info, Node: ChangeSquare Action, Next: ClearOctagon Action, Prev: ChangeSize Action, Up: core actions + +F.1.17 ChangeSquare +------------------- + +ChangeSquare(ToggleObject) +ChangeSquare(SelectedElements|SelectedPins) +ChangeSquare(Selected|SelectedObjects) + +Changes the square flag of pins and pads. + + Note that `Pins' means both pins and pads. + + Pins, pads, and vias can have various shapes. All may be round. +Pins and pads may be square (obviously "square" pads are usually +rectangular). Pins and vias may be octagonal. When you change a shape +flag of an element, you actually change all of its pins and pads. + + Note that the square flag takes precedence over the octagon flag, +thus, if both the square and octagon flags are set, the object is +square. When the square flag is cleared, the pins and pads will be +either round or, if the octagon flag is set, octagonal. + + +File: pcb.info, Node: ClearOctagon Action, Next: ClearSquare Action, Prev: ChangeSquare Action, Up: core actions + +F.1.18 ClearOctagon +------------------- + +ClearOctagon(ToggleObject|Object|SelectedObjects|Selected) +ClearOctagon(SelectedElements|SelectedPins|SelectedVias) + +Clears the octagon-flag of pins and vias. + + Pins, pads, and vias can have various shapes. All may be round. +Pins and pads may be square (obviously "square" pads are usually +rectangular). Pins and vias may be octagonal. When you change a shape +flag of an element, you actually change all of its pins and pads. + + Note that the square flag takes precedence over the octagon flag, +thus, if both the square and octagon flags are set, the object is +square. When the square flag is cleared, the pins and pads will be +either round or, if the octagon flag is set, octagonal. + + +File: pcb.info, Node: ClearSquare Action, Next: ClrFlag Action, Prev: ClearOctagon Action, Up: core actions + +F.1.19 ClearSquare +------------------ + +ClearSquare(ToggleObject|SelectedElements|SelectedPins) + +Clears the square-flag of pins and pads. + + Note that `Pins' means pins and pads. + + Pins, pads, and vias can have various shapes. All may be round. +Pins and pads may be square (obviously "square" pads are usually +rectangular). Pins and vias may be octagonal. When you change a shape +flag of an element, you actually change all of its pins and pads. + + Note that the square flag takes precedence over the octagon flag, +thus, if both the square and octagon flags are set, the object is +square. When the square flag is cleared, the pins and pads will be +either round or, if the octagon flag is set, octagonal. + + +File: pcb.info, Node: ClrFlag Action, Next: Connection Action, Prev: ClearSquare Action, Up: core actions + +F.1.20 ClrFlag +-------------- + +ClrFlag(Object|Selected|SelectedObjects, flag) +ClrFlag(SelectedLines|SelectedPins|SelectedVias, flag) +ClrFlag(SelectedPads|SelectedTexts|SelectedNames, flag) +ClrFlag(SelectedElements, flag) +flag = square | octagon | thermal | join + +Clears flags on objects. + + Turns the given flag off, regardless of its previous setting. See +`ChangeFlag'. + + ClrFlag(SelectedLines,join) + + +File: pcb.info, Node: Connection Action, Next: Delete Action, Prev: ClrFlag Action, Up: core actions + +F.1.21 Connection +----------------- + +Connection(Find|ResetLinesAndPolygons|ResetPinsAndVias|Reset) + +Searches connections of the object at the cursor position. + + Connections found with this action will be highlighted in the +"connected-color" color and will have the "found" flag set. + +`Find' + The net under the cursor is "found". + +`ResetLinesAndPolygons' + Any "found" lines and polygons are marked "not found". + +`ResetPinsAndVias' + Any "found" pins and vias are marked "not found". + +`Reset' + All "found" objects are marked "not found". + + + +File: pcb.info, Node: Delete Action, Next: DeleteRats Action, Prev: Connection Action, Up: core actions + +F.1.22 Delete +------------- + +Delete(Object|Selected) +Delete(AllRats|SelectedRats) + +Delete stuff. + + +File: pcb.info, Node: DeleteRats Action, Next: DisableVendor Action, Prev: Delete Action, Up: core actions + +F.1.23 DeleteRats +----------------- + +DeleteRats(AllRats|Selected|SelectedRats) + +Delete rat lines. + + +File: pcb.info, Node: DisableVendor Action, Next: DisperseElements Action, Prev: DeleteRats Action, Up: core actions + +F.1.24 DisableVendor +-------------------- + +DisableVendor() + +Disables automatic drill size mapping. + + When drill mapping is enabled, new instances of pins and vias will +have their drill holes mapped to one of the allowed drill sizes +specified in the currently loaded vendor drill table. + + +File: pcb.info, Node: DisperseElements Action, Next: Display Action, Prev: DisableVendor Action, Up: core actions + +F.1.25 DisperseElements +----------------------- + +DisperseElements(All|Selected) + +Disperses elements. + + Normally this is used when starting a board, by selecting all +elements and then dispersing them. This scatters the elements around +the board so that you can pick individual ones, rather than have all the +elements at the same 0,0 coordinate and thus impossible to choose from. + + +File: pcb.info, Node: Display Action, Next: djopt Action, Prev: DisperseElements Action, Up: core actions + +F.1.26 Display +-------------- + +Display(NameOnPCB|Description|Value) +Display(Grid|Redraw) +Display(CycleClip|CycleCrosshair|Toggle45Degree|ToggleStartDirection) +Display(ToggleGrid|ToggleRubberBandMode|ToggleUniqueNames) +Display(ToggleMask|ToggleName|ToggleClearLine|ToggleFullPoly|ToggleSnapPin) +Display(ToggleThindraw|ToggleThindrawPoly|ToggleOrthoMove|ToggleLocalRef) +Display(ToggleCheckPlanes|ToggleShowDRC|ToggleAutoDRC) +Display(ToggleLiveRoute|LockNames|OnlyNames) +Display(Pinout|PinOrPadName) + +Several display-related actions. + +`NameOnPCB' + +`Description' + +`Value' + Specify whether all elements show their name, description, or + value. + +`Redraw' + Redraw the whole board. + +`Toggle45Degree' + When clear, lines can be drawn at any angle. When set, lines are + restricted to multiples of 45 degrees and requested lines may be + broken up according to the clip setting. + +`CycleClip' + Changes the way lines are restricted to 45 degree increments. The + various settings are: straight only, orthogonal then angled, and + angled then orthogonal. If AllDirections is set, this action + disables it. + +`CycleCrosshair' + Changes crosshair drawing. Crosshair may accept form of 4-ray, + 8-ray and 12-ray cross. + +`ToggleRubberBandMode' + If set, moving an object moves all the lines attached to it too. + +`ToggleStartDirection' + If set, each time you set a point in a line, the Clip toggles + between orth-angle and angle-ortho. + +`ToggleUniqueNames' + If set, you will not be permitted to change the name of an element + to match that of another element. + +`ToggleSnapPin' + If set, pin centers and pad end points are treated as additional + grid points that the cursor can snap to. + +`ToggleLocalRef' + If set, the mark is automatically set to the beginning of any + move, so you can see the relative distance you've moved. + +`ToggleThindraw' + If set, objects on the screen are drawn as outlines (lines are + drawn as center-lines). This lets you see line endpoints hidden + under pins, for example. + +`ToggleThindrawPoly' + If set, polygons on the screen are drawn as outlines. + +`ToggleShowDRC' + If set, pending objects (i.e. lines you're in the process of + drawing) will be drawn with an outline showing how far away from + other copper you need to be. + +`ToggleLiveRoute' + If set, the progress of the autorouter will be visible on the + screen. + +`ToggleAutoDRC' + If set, you will not be permitted to make connections which violate + the current DRC and netlist settings. + +`ToggleCheckPlanes' + If set, lines and arcs aren't drawn, which usually leaves just the + polygons. If you also disable all but the layer you're interested + in, this allows you to check for isolated regions. + +`ToggleOrthoMove' + If set, the crosshair is only allowed to move orthogonally from its + previous position. I.e. you can move an element or line up, down, + left, or right, but not up+left or down+right. + +`ToggleName' + Selects whether the pinouts show the pin names or the pin numbers. + +`ToggleLockNames' + If set, text will ignore left mouse clicks and actions that work on + objects under the mouse. You can still select text with a lasso + (left mouse drag) and perform actions on the selection. + +`ToggleOnlyNames' + If set, only text will be sensitive for mouse clicks and actions + that work on objects under the mouse. You can still select other + objects with a lasso (left mouse drag) and perform actions on the + selection. + +`ToggleMask' + Turns the solder mask on or off. + +`ToggleClearLine' + When set, the clear-line flag causes new lines and arcs to have + their "clear polygons" flag set, so they won't be electrically + connected to any polygons they overlap. + +`ToggleFullPoly' + When set, the full-poly flag causes new polygons to have their + "full polygon" flag set, so all parts of them will be displayed + instead of only the biggest one. + +`ToggleGrid' + Resets the origin of the current grid to be wherever the mouse + pointer is (not where the crosshair currently is). If you provide + two numbers after this, the origin is set to that coordinate. + +`Grid' + Toggles whether the grid is displayed or not. + +`Pinout' + Causes the pinout of the element indicated by the cursor to be + displayed, usually in a separate window. + +`PinOrPadName' + Toggles whether the names of pins, pads, or (yes) vias will be + displayed. If the cursor is over an element, all of its pins and + pads are affected. + + + +File: pcb.info, Node: djopt Action, Next: DRC Action, Prev: Display Action, Up: core actions + +F.1.27 djopt +------------ + +djopt(debumpify|unjaggy|simple|vianudge|viatrim|orthopull) +djopt(auto) - all of the above +djopt(miter) + +Perform various optimizations on the current board. + + The different types of optimizations change your board in order to +reduce the total trace length and via count. + +`debumpify' + Looks for U-shaped traces that can be shortened or eliminated. + +`unjaggy' + Looks for corners which could be flipped to eliminate one or more + corners (i.e. jaggy lines become simpler). + +`simple' + Removing uneeded vias, replacing two or more trace segments in a + row with a single segment. This is usually performed + automatically after other optimizations. + +`vianudge' + Looks for vias where all traces leave in the same direction. + Tries to move via in that direction to eliminate one of the traces + (and thus a corner). + +`viatrim' + Looks for traces that go from via to via, where moving that trace + to a different layer eliminates one or both vias. + +`orthopull' + Looks for chains of traces all going in one direction, with more + traces orthogonal on one side than on the other. Moves the chain + in that direction, causing a net reduction in trace length, + possibly eliminating traces and/or corners. + +`splitlines' + Looks for lines that pass through vias, pins, or pads, and splits + them into separate lines so they can be managed separately. + +`auto' + Performs the above options, repeating until no further + optimizations can be made. + +`miter' + Replaces 90 degree corners with a pair of 45 degree corners, to + reduce RF losses and trace length. + + + +File: pcb.info, Node: DRC Action, Next: DumpLibrary Action, Prev: djopt Action, Up: core actions + +F.1.28 DRC +---------- + +DRC() + +Invoke the DRC check. + + Note that the design rule check uses the current board rule settings, +not the current style settings. + + +File: pcb.info, Node: DumpLibrary Action, Next: elementlist Action, Prev: DRC Action, Up: core actions + +F.1.29 DumpLibrary +------------------ + +DumpLibrary() + +Display the entire contents of the libraries. + + +File: pcb.info, Node: elementlist Action, Next: elementsetattr Action, Prev: DumpLibrary Action, Up: core actions + +F.1.30 elementlist +------------------ + +ElementList(Start|Done|Need,,,) + +Adds the given element if it doesn't already exist. + +`Start' + Indicates the start of an element list; call this before any Need + actions. + +`Need' + Searches the board for an element with a matching refdes. + + If found, the value and footprint are updated. + + If not found, a new element is created with the given footprint + and value. + +`Done' + Compares the list of elements needed since the most recent `start' + with the list of elements actually on the board. Any elements + that weren't listed are selected, so that the user may delete them. + + + +File: pcb.info, Node: elementsetattr Action, Next: EnableVendor Action, Prev: elementlist Action, Up: core actions + +F.1.31 elementsetattr +--------------------- + +ElementSetAttr(refdes,name[,value]) + +Sets or clears an element-specific attribute. + + If a value is specified, the named attribute is added (if not already +present) or changed (if it is) to the given value. If the value is not +specified, the given attribute is removed if present. + Index: 1.0.8/doc-orig/pcb.info-2 =================================================================== --- 1.0.8/doc-orig/pcb.info-2 (nonexistent) +++ 1.0.8/doc-orig/pcb.info-2 (revision 1136) @@ -0,0 +1,3304 @@ +This is pcb.info, produced by makeinfo version 4.13 from pcb.texi. + +INFO-DIR-SECTION Miscellaneous +START-INFO-DIR-ENTRY +* pcb: (pcb). An interactive printed circuit board editor. +END-INFO-DIR-ENTRY + + This file documents how to use Pcb, the open source, interactive +printed circuit board layout system. + + Copyright (C) 1994,1995,1996, 2004 Thomas Nau + + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 harry eaton + + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009 Dan McMahill + + Copyright (C) 2004 DJ Delorie + + This program is free software; you may 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 +MERCHANT-ABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + + +File: pcb.info, Node: EnableVendor Action, Next: execcommand Action, Prev: elementsetattr Action, Up: core actions + +F.1.32 EnableVendor +------------------- + +EnableVendor() + +Enables automatic drill size mapping. + + When drill mapping is enabled, new instances of pins and vias will +have their drill holes mapped to one of the allowed drill sizes +specified in the currently loaded vendor drill table. To enable drill +mapping, a vendor resource file containing a drill table must be loaded +first. + + +File: pcb.info, Node: execcommand Action, Next: ExecuteFile Action, Prev: EnableVendor Action, Up: core actions + +F.1.33 execcommand +------------------ + +ExecCommand(command) + +Runs a command. + + Runs the given command, which is a system executable. + + +File: pcb.info, Node: ExecuteFile Action, Next: Flip Action, Prev: execcommand Action, Up: core actions + +F.1.34 ExecuteFile +------------------ + +ExecuteFile(filename) + +Run actions from the given file. + + Lines starting with `#' are ignored. + + +File: pcb.info, Node: Flip Action, Next: FontEdit Action, Prev: ExecuteFile Action, Up: core actions + +F.1.35 Flip +----------- + +Flip(Object|Selected|SelectedElements) + +Flip an element to the opposite side of the board. + + Note that the location of the element will be symmetric about the +cursor location; i.e. if the part you are pointing at will still be at +the same spot once the element is on the other side. When flipping +multiple elements, this retains their positions relative to each other, +not their absolute positions on the board. + + +File: pcb.info, Node: FontEdit Action, Next: FontSave Action, Prev: Flip Action, Up: core actions + +F.1.36 FontEdit +--------------- + +FontEdit() + +Convert the current font to a PCB for editing. + + +File: pcb.info, Node: FontSave Action, Next: FreeRotateBuffer Action, Prev: FontEdit Action, Up: core actions + +F.1.37 FontSave +--------------- + +FontSave() + +Convert the current PCB back to a font. + + +File: pcb.info, Node: FreeRotateBuffer Action, Next: GlobalPuller Action, Prev: FontSave Action, Up: core actions + +F.1.38 FreeRotateBuffer +----------------------- + +FreeRotateBuffer([Angle]) + +Rotates the current paste buffer contents by the specified angle. The +angle is given in degrees. If no angle is given, the user is prompted +for one. + + Rotates the contents of the pastebuffer by an arbitrary angle. If no +angle is given, the user is prompted for one. + + +File: pcb.info, Node: GlobalPuller Action, Next: h Action, Prev: FreeRotateBuffer Action, Up: core actions + +F.1.39 GlobalPuller +------------------- + +GlobalPuller() + +Pull all traces tight. + + +File: pcb.info, Node: h Action, Next: Import Action, Prev: GlobalPuller Action, Up: core actions + +F.1.40 h +-------- + +h + +Print a help message for commands. + + This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (`:') and thus the syntax is +documented for that purpose. + + +File: pcb.info, Node: Import Action, Next: l Action, Prev: h Action, Up: core actions + +F.1.41 Import +------------- + +Import() +Import([gnetlist|make[,source,source,...]]) +Import(setnewpoint[,(mark|center|X,Y)]) +Import(setdisperse,D,units) + +Import schematics. + + Imports element and netlist data from the schematics (or some other +source). The first parameter, which is optional, is the mode. If not +specified, the `import::mode' attribute in the PCB is used. `gnetlist' +means gnetlist is used to obtain the information from the schematics. +`make' invokes `make', assuming the user has a `Makefile' in the +current directory. The `Makefile' will be invoked with the following +variables set: + +`PCB' + The name of the .pcb file + +`SRCLIST' + A space-separated list of source files + +`OUT' + The name of the file in which to put the command script, which may + contain any `Pcb' actions. By default, this is a temporary file + selected by `Pcb', but if you specify an `import::outfile' + attribute, that file name is used instead (and not automatically + deleted afterwards). + + + The target specified to be built is the first of these that apply: + + * The target specified by an `import::target' attribute. + + * The output file specified by an `import::outfile' attribute. + + * If nothing else is specified, the target is `pcb_import'. + + + If you specify an `import::makefile' attribute, then "-f " will be added to the command line. + + If you specify the mode, you may also specify the source files +(schematics). If you do not specify any, the list of schematics is +obtained by reading the `import::srcN' attributes (like `import::src0', +`import::src1', etc). + + For compatibility with future extensions to the import file format, +the generated file _must not_ start with the two characters `#%'. + + If a temporary file is needed the `TMPDIR' environment variable is +used to select its location. + + Note that the programs `gnetlist' and `make' may be overridden by +the user via the `make-program' and `gnetlist' `pcb' settings (i.e. in +`~/.pcb/settings' or on the command line). + + If `Pcb' cannot determine which schematic(s) to import from, the GUI +is called to let user choose (see `ImportGUI()'). + + Note that Import() doesn't delete anything - after an Import, +elements which shouldn't be on the board are selected and may be +removed once it's determined that the deletion is appropriate. + + If `Import()' is called with `setnewpoint', then the location of new +components can be specified. This is where parts show up when they're +added to the board. The default is the center of the board. + +`Import(setnewpoint)' + Prompts the user to click on the board somewhere, uses that point. + If called by a hotkey, uses the current location of the crosshair. + +`Import(setnewpoint,mark)' + Uses the location of the mark. If no mark is present, the point is + not changed. + +`Import(setnewpoint,center)' + Resets the point to the center of the board. + +`Import(setnewpoint,X,Y,units)' + Sets the point to the specific coordinates given. Example: + `Import(setnewpoint,50,25,mm)' + + + Note that the X and Y locations are stored in attributes named +`import::newX' and `import::newY' so you could change them manually if +you wished. + + Calling `Import(setdisperse,D,units)' sets how much the newly placed +elements are dispersed relative to the set point. For example, +`Import(setdisperse,10,mm)' will offset each part randomly up to 10mm +away from the point. The default dispersion is 1/10th of the smallest +board dimension. Dispersion is saved in the `import::disperse' +attribute. + + +File: pcb.info, Node: l Action, Next: le Action, Prev: Import Action, Up: core actions + +F.1.42 l +-------- + +l [name] + +Loads layout data. + + Loads a new datafile (layout) and, if confirmed, overwrites any +existing unsaved data. The filename and the searchpath (_filePath_) +are passed to the command defined by _fileCommand_. If no filename is +specified a file select box will popup. + + This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (`:') and thus the syntax is +documented for that purpose. + + +File: pcb.info, Node: le Action, Next: LoadFootprint Action, Prev: l Action, Up: core actions + +F.1.43 le +--------- + +le [name] + +Loads an element into the current buffer. + + The filename and the searchpath (_elementPath_) are passed to the +command defined by _elementCommand_. If no filename is specified a +file select box will popup. + + This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (`:') and thus the syntax is +documented for that purpose. + + +File: pcb.info, Node: LoadFootprint Action, Next: LoadFrom Action, Prev: le Action, Up: core actions + +F.1.44 LoadFootprint +-------------------- + +LoadFootprint(filename[,refdes,value]) + +Loads a single footprint by name. + + Loads a single footprint by name, rather than by reference or through +the library. If a refdes and value are specified, those are inserted +into the footprint as well. The footprint remains in the paste buffer. + + +File: pcb.info, Node: LoadFrom Action, Next: LoadVendorFrom Action, Prev: LoadFootprint Action, Up: core actions + +F.1.45 LoadFrom +--------------- + +LoadFrom(Layout|LayoutToBuffer|ElementToBuffer|Netlist|Revert,filename) + +Load layout data from a file. + + This action assumes you know what the filename is. The various GUIs +should have a similar `Load' action where the filename is optional, and +will provide their own file selection mechanism to let you choose the +file name. + +`Layout' + Loads an entire PCB layout, replacing the current one. + +`LayoutToBuffer' + Loads an entire PCB layout to the paste buffer. + +`ElementToBuffer' + Loads the given element file into the paste buffer. Element files + contain only a single `Element' definition, such as the "newlib" + library uses. + +`Netlist' + Loads a new netlist, replacing any current netlist. + +`Revert' + Re-loads the current layout from its disk file, reverting any + changes you may have made. + + + +File: pcb.info, Node: LoadVendorFrom Action, Next: m Action, Prev: LoadFrom Action, Up: core actions + +F.1.46 LoadVendorFrom +--------------------- + +LoadVendorFrom(filename) + +Loads the specified vendor resource file. + +FILENAME + Name of the vendor resource file. If not specified, the user will + be prompted to enter one. + + +File: pcb.info, Node: m Action, Next: MarkCrosshair Action, Prev: LoadVendorFrom Action, Up: core actions + +F.1.47 m +-------- + +m [name] + +Loads a layout into the current buffer. + + The filename and the searchpath (_filePath_) are passed to the +command defined by _fileCommand_. If no filename is specified a file +select box will popup. + + This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (`:') and thus the syntax is +documented for that purpose. + + +File: pcb.info, Node: MarkCrosshair Action, Next: Message Action, Prev: m Action, Up: core actions + +F.1.48 MarkCrosshair +-------------------- + +MarkCrosshair() +MarkCrosshair(Center) + +Set/Reset the Crosshair mark. + + The "mark" is a small X-shaped target on the display which is +treated like a second origin (the normal origin is the upper let corner +of the board). The GUI will display a second set of coordinates for +this mark, which tells you how far you are from it. + + If no argument is given, the mark is toggled - disabled if it was +enabled, or enabled at the current cursor position of disabled. If the +`Center' argument is given, the mark is moved to the current cursor +location. + + +File: pcb.info, Node: Message Action, Next: MinClearGap Action, Prev: MarkCrosshair Action, Up: core actions + +F.1.49 Message +-------------- + +Message(message) + +Writes a message to the log window. + + This action displays a message to the log window. This action is +primarily provided for use by other programs which may interface with +PCB. If multiple arguments are given, each one is sent to the log +window followed by a newline. + + +File: pcb.info, Node: MinClearGap Action, Next: MinMaskGap Action, Prev: Message Action, Up: core actions + +F.1.50 MinClearGap +------------------ + +MinClearGap(delta) +MinClearGap(Selected, delta) + +Ensures that polygons are a minimum distance from objects. + + Checks all specified objects, and increases the polygon clearance if +needed to ensure a minimum distance between their edges and the polygon +edges. + + +File: pcb.info, Node: MinMaskGap Action, Next: Mode Action, Prev: MinClearGap Action, Up: core actions + +F.1.51 MinMaskGap +----------------- + +MinMaskGap(delta) +MinMaskGap(Selected, delta) + +Ensures the mask is a minimum distance from pins and pads. + + Checks all specified pins and/or pads, and increases the mask if +needed to ensure a minimum distance between the pin or pad edge and the +mask edge. + + +File: pcb.info, Node: Mode Action, Next: MorphPolygon Action, Prev: MinMaskGap Action, Up: core actions + +F.1.52 Mode +----------- + +Mode(Arc|Arrow|Copy|InsertPoint|Line|Lock|Move|None|PasteBuffer) +Mode(Polygon|Rectangle|Remove|Rotate|Text|Thermal|Via) +Mode(Notify|Release|Cancel|Stroke) +Mode(Save|Restore) + +Change or use the tool mode. + +`Arc' +`Arrow' +`Copy' +`InsertPoint' +`Line' +`Lock' +`Move' +`None' +`PasteBuffer' +`Polygon' +`Rectangle' +`Remove' +`Rotate' +`Text' +`Thermal' +`Via' + Select the indicated tool. + +`Notify' + Called when you press the mouse button, or move the mouse. + +`Release' + Called when you release the mouse button. + +`Cancel' + Cancels any pending tool activity, allowing you to restart + elsewhere. For example, this allows you to start a new line + rather than attach a line to the previous line. + +`Escape' + Similar to Cancel but calling this action a second time will return + to the Arrow tool. + +`Stroke' + If your `pcb' was built with libstroke, this invokes the stroke + input method. If not, this will restart a drawing mode if you were + drawing, else it will select objects. + +`Save' + Remembers the current tool. + +`Restore' + Restores the tool to the last saved tool. + + + +File: pcb.info, Node: MorphPolygon Action, Next: MoveLayer Action, Prev: Mode Action, Up: core actions + +F.1.53 MorphPolygon +------------------- + +MorphPolygon(Object|Selected) + +Converts dead polygon islands into separate polygons. + + If a polygon is divided into unconnected "islands", you can use this +command to convert the otherwise disappeared islands into separate +polygons. Be sure the cursor is over a portion of the polygon that +remains visible. Very small islands that may flake off are +automatically deleted. + + +File: pcb.info, Node: MoveLayer Action, Next: MoveObject Action, Prev: MorphPolygon Action, Up: core actions + +F.1.54 MoveLayer +---------------- + +MoveLayer(old,new) + +Moves/Creates/Deletes Layers. + + Moves a layer, creates a new layer, or deletes a layer. + +`old' + The is the layer number to act upon. Allowed values are: + `c' + Currently selected layer. + + `-1' + Create a new layer. + + `number' + An existing layer number. + + +`new' + Specifies where to move the layer to. Allowed values are: + `-1' + Deletes the layer. + + `up' + Moves the layer up. + + `down' + Moves the layer down. + + `c' + Creates a new layer. + + + + +File: pcb.info, Node: MoveObject Action, Next: MoveToCurrentLayer Action, Prev: MoveLayer Action, Up: core actions + +F.1.55 MoveObject +----------------- + +MoveObject(X,Y,dim) + +Moves the object under the crosshair. + + The `X' and `Y' are treated like `delta' is for many other objects. +For each, if it's prefixed by `+' or `-', then that amount is relative. +Otherwise, it's absolute. Units can be `mil' or `mm'; if unspecified, +units are PCB's internal units, currently 1/100 mil. + + +File: pcb.info, Node: MoveToCurrentLayer Action, Next: Netlist Action, Prev: MoveObject Action, Up: core actions + +F.1.56 MoveToCurrentLayer +------------------------- + +MoveToCurrentLayer(Object|SelectedObjects) + +Moves objects to the current layer. + + Note that moving an element from a component layer to a solder layer, +or from solder to component, won't automatically flip it. Use the +`Flip()' action to do that. + + +File: pcb.info, Node: Netlist Action, Next: New Action, Prev: MoveToCurrentLayer Action, Up: core actions + +F.1.57 Netlist +-------------- + +Net(find|select|rats|norats|clear[,net[,pin]]) +Net(freeze|thaw|forcethaw) +Net(add,net,pin) + +Perform various actions on netlists. + + Each of these actions apply to a specified set of nets. NET and PIN +are patterns which match one or more nets or pins; these patterns may +be full names or regular expressions. If an exact match is found, it +is the only match; if no exact match is found, _then_ the pattern is +tried as a regular expression. + + If neither NET nor PIN are specified, all nets apply. If NET is +specified but not PIN, all nets matching NET apply. If both are +specified, nets which match NET and contain a pin matching PIN apply. + +`find' + Nets which apply are marked _found_ and are drawn in the + `connected-color' color. + +`select' + Nets which apply are selected. + +`rats' + Nets which apply are marked as available for the rats nest. + +`norats' + Nets which apply are marked as not available for the rats nest. + +`clear' + Clears the netlist. + +`add' + Add the given pin to the given netlist, creating either if needed. + +`sort' + Called after a list of add's, this sorts the netlist. + +`freeze' +`thaw' +`forcethaw' + Temporarily prevents changes to the netlist from being reflected in + the GUI. For example, if you need to make multiple changes, you + freeze the netlist, make the changes, then thaw it. Note that + freeze/thaw requests may nest, with the netlist being fully thawed + only when all pending freezes are thawed. You can bypass the + nesting by using forcethaw, which resets the freeze count and + immediately updates the GUI. + + + +File: pcb.info, Node: New Action, Next: OptAutoOnly Action, Prev: Netlist Action, Up: core actions + +F.1.58 New +---------- + +New([name]) + +Starts a new layout. + + If a name is not given, one is prompted for. + + +File: pcb.info, Node: OptAutoOnly Action, Next: PasteBuffer Action, Prev: New Action, Up: core actions + +F.1.59 OptAutoOnly +------------------ + +OptAutoOnly() + +Toggles the optimize-only-autorouted flag. + + The original purpose of the trace optimizer was to clean up the +traces created by the various autorouters that have been used with PCB. +When a board has a mix of autorouted and carefully hand-routed traces, +you don't normally want the optimizer to move your hand-routed traces. +But, sometimes you do. By default, the optimizer only optimizes +autorouted traces. This action toggles that setting, so that you can +optimize hand-routed traces also. + + +File: pcb.info, Node: PasteBuffer Action, Next: Polygon Action, Prev: OptAutoOnly Action, Up: core actions + +F.1.60 PasteBuffer +------------------ + +PasteBuffer(AddSelected|Clear|1..MAX_BUFFER) +PasteBuffer(Rotate, 1..3) +PasteBuffer(Convert|Save|Restore|Mirror) +PasteBuffer(ToLayout, X, Y, units) + +Various operations on the paste buffer. + + There are a number of paste buffers; the actual limit is a +compile-time constant `MAX_BUFFER' in `globalconst.h'. It is currently +`5'. One of these is the "current" paste buffer, often referred to as +"the" paste buffer. + +`AddSelected' + Copies the selected objects to the current paste buffer. + +`Clear' + Remove all objects from the current paste buffer. + +`Convert' + Convert the current paste buffer to an element. Vias are + converted to pins, lines are converted to pads. + +`Restore' + Convert any elements in the paste buffer back to vias and lines. + +`Mirror' + Flip all objects in the paste buffer vertically (up/down flip). + To mirror horizontally, combine this with rotations. + +`Rotate' + Rotates the current buffer. The number to pass is 1..3, where 1 + means 90 degrees counter clockwise, 2 means 180 degrees, and 3 + means 90 degrees clockwise (270 CCW). + +`Save' + Saves any elements in the current buffer to the indicated file. + +`ToLayout' + Pastes any elements in the current buffer to the indicated X, Y + coordinates in the layout. The `X' and `Y' are treated like + `delta' is for many other objects. For each, if it's prefixed by + `+' or `-', then that amount is relative to the last location. + Otherwise, it's absolute. Units can be `mil' or `mm'; if + unspecified, units are PCB's internal units, currently 1/100 mil. + +`1..MAX_BUFFER' + Selects the given buffer to be the current paste buffer. + + + +File: pcb.info, Node: Polygon Action, Next: Puller Action, Prev: PasteBuffer Action, Up: core actions + +F.1.61 Polygon +-------------- + +Polygon(Close|PreviousPoint) + +Some polygon related stuff. + + Polygons need a special action routine to make life easier. + +`Close' + Creates the final segment of the polygon. This may fail if + clipping to 45 degree lines is switched on, in which case a + warning is issued. + +`PreviousPoint' + Resets the newly entered corner to the previous one. The Undo + action will call Polygon(PreviousPoint) when appropriate to do so. + + + +File: pcb.info, Node: Puller Action, Next: q Action, Prev: Polygon Action, Up: core actions + +F.1.62 Puller +------------- + +Puller() + +Pull an arc-line junction tight. + + The `Puller()' action is a special-purpose optimization. When +invoked while the crosshair is over the junction of an arc and a line, +it will adjust the arc's angle and the connecting line's endpoint such +that the line intersects the arc at a tangent. In the example below, +the left side is "before" with the black target marking where to put +the crosshair: + + [image src="puller.png" alt="Example of how puller works"] + +The right side is "after" with the black target marking where the +arc-line intersection was moved to. + + +File: pcb.info, Node: q Action, Next: q! Action, Prev: Puller Action, Up: core actions + +F.1.63 q +-------- + +q + +Quits the application after confirming. + + If you have unsaved changes, you will be prompted to confirm (or +save) before quitting. + + This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (`:') and thus the syntax is +documented for that purpose. + + +File: pcb.info, Node: q! Action, Next: Quit Action, Prev: q Action, Up: core actions + +F.1.64 q! +--------- + +q! + +Quits the application without confirming. + + Note that this command neither saves your data nor prompts for +confirmation. + + This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (`:') and thus the syntax is +documented for that purpose. + + +File: pcb.info, Node: Quit Action, Next: Redo Action, Prev: q! Action, Up: core actions + +F.1.65 Quit +----------- + +Quit() + +Quits the application after confirming. + + If you have unsaved changes, you will be prompted to confirm (or +save) before quitting. + + +File: pcb.info, Node: Redo Action, Next: RemoveSelected Action, Prev: Quit Action, Up: core actions + +F.1.66 Redo +----------- + +Redo() + +Redo recent"undo"operations. + + This routine allows you to recover from the last undo command. You +might want to do this if you thought that undo was going to revert +something other than what it actually did (in case you are confused +about which operations are un-doable), or if you have been backing up +through a long undo list and over-shoot your stopping point. Any +change that is made since the undo in question will trim the redo list. +For example if you add ten lines, then undo three of them you could use +redo to put them back, but if you move a line on the board before +performing the redo, you will lose the ability to "redo" the three +"undone" lines. + + +File: pcb.info, Node: RemoveSelected Action, Next: Renumber Action, Prev: Redo Action, Up: core actions + +F.1.67 RemoveSelected +--------------------- + +RemoveSelected() + +Removes any selected objects. + + +File: pcb.info, Node: Renumber Action, Next: Report Action, Prev: RemoveSelected Action, Up: core actions + +F.1.68 Renumber +--------------- + +Renumber() +Renumber(filename) + +Renumber all elements. The changes will be recorded to filename for +use in backannotating these changes to the schematic. + + +File: pcb.info, Node: Report Action, Next: ReportDialog Action, Prev: Renumber Action, Up: core actions + +F.1.69 Report +------------- + +Report(Object|DrillReport|FoundPins|NetLength|AllNetLengths|[,name]) + +Produce various report. + +`Object' + The object under the crosshair will be reported, describing various + aspects of the object. + +`DrillReport' + A report summarizing the number of drill sizes used, and how many + of each, will be produced. + +`FoundPins' + A report listing all pins and pads which are marked as "found" will + be produced. + +`NetLength' + The name and length of the net under the crosshair will be + reported to the message log. + +`AllNetLengths' + The name and length of the net under the crosshair will be + reported to the message log. An optional parameter specifies mm, + mil, pcb, or in units + + + +File: pcb.info, Node: ReportDialog Action, Next: RipUp Action, Prev: Report Action, Up: core actions + +F.1.70 ReportDialog +------------------- + +ReportDialog() + +Report on the object under the crosshair + + This is a shortcut for `Report(Object)'. + + +File: pcb.info, Node: RipUp Action, Next: rn Action, Prev: ReportDialog Action, Up: core actions + +F.1.71 RipUp +------------ + +RipUp(All|Selected|Element) + +Ripup auto-routed tracks, or convert an element to parts. + +`All' + Removes all lines and vias which were created by the autorouter. + +`Selected' + Removes all selected lines and vias which were created by the + autorouter. + +`Element' + Converts the element under the cursor to parts (vias and lines). + Note that this uses the highest numbered paste buffer. + + + +File: pcb.info, Node: rn Action, Next: RouteStyle Action, Prev: RipUp Action, Up: core actions + +F.1.72 rn +--------- + +rn [name] + +Reads netlist. + + If no filename is given a file select box will pop up. The file is +read via the command defined by the _RatCommand_ resource. The command +must send its output to _stdout_. + + Netlists are used for generating rat's nests (see *note Rats Nest::) +and for verifying the board layout (which is also accomplished by the +_Ratsnest_ command). + + This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (`:') and thus the syntax is +documented for that purpose. + + +File: pcb.info, Node: RouteStyle Action, Next: s Action, Prev: rn Action, Up: core actions + +F.1.73 RouteStyle +----------------- + +RouteStyle(1|2|3|4) + +Copies the indicated routing style into the current sizes. + + +File: pcb.info, Node: s Action, Next: SaveSettings Action, Prev: RouteStyle Action, Up: core actions + +F.1.74 s +-------- + +s [name] + +Saves layout data. + + Data and the filename are passed to the command defined by the +resource _saveCommand_. It must read the layout data from _stdin_. If +no filename is entered, either the last one is used again or, if it is +not available, a file select box will pop up. + + This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (`:') and thus the syntax is +documented for that purpose. + + +File: pcb.info, Node: SaveSettings Action, Next: SaveTo Action, Prev: s Action, Up: core actions + +F.1.75 SaveSettings +------------------- + +SaveSettings() +SaveSettings(local) + +Saves settings. + + If you pass no arguments, the settings are stored in +`$HOME/.pcb/settings'. If you pass the word `local' they're saved in +`./pcb.settings'. + + +File: pcb.info, Node: SaveTo Action, Next: Select Action, Prev: SaveSettings Action, Up: core actions + +F.1.76 SaveTo +------------- + +SaveTo(Layout|LayoutAs,filename) +SaveTo(AllConnections|AllUnusedPins|ElementConnections,filename) +SaveTo(PasteBuffer,filename) + +Saves data to a file. + +`Layout' + Saves the current layout. + +`LayoutAs' + Saves the current layout, and remembers the filename used. + +`AllConnections' + Save all connections to a file. + +`AllUnusedPins' + List all unused pins to a file. + +`ElementConnections' + Save connections to the element at the cursor to a file. + +`PasteBuffer' + Save the content of the active Buffer to a file. This is the + graphical way to create a footprint. + + + +File: pcb.info, Node: Select Action, Next: SetFlag Action, Prev: SaveTo Action, Up: core actions + +F.1.77 Select +------------- + +Select(Object|ToggleObject) +Select(All|Block|Connection) +Select(ElementByName|ObjectByName|PadByName|PinByName) +Select(ElementByName|ObjectByName|PadByName|PinByName, Name) +Select(TextByName|ViaByName|NetByName) +Select(TextByName|ViaByName|NetByName, Name) +Select(Convert) + +Toggles or sets the selection. + +`ElementByName' + +`ObjectByName' + +`PadByName' + +`PinByName' + +`TextByName' + +`ViaByName' + +`NetByName' + These all rely on having a regular expression parser built into + `pcb'. If the name is not specified then the user is prompted for + a pattern, and all objects that match the pattern and are of the + type specified are selected. + +`Object' + +`ToggleObject' + Selects the object under the cursor. + +`Block' + Selects all objects in a rectangle indicated by the cursor. + +`All' + Selects all objects on the board. + +`Connection' + Selects all connections with the "found" flag set. + +`Convert' + Converts the selected objects to an element. This uses the highest + numbered paste buffer. + + + +File: pcb.info, Node: SetFlag Action, Next: SetOctagon Action, Prev: Select Action, Up: core actions + +F.1.78 SetFlag +-------------- + +SetFlag(Object|Selected|SelectedObjects, flag) +SetFlag(SelectedLines|SelectedPins|SelectedVias, flag) +SetFlag(SelectedPads|SelectedTexts|SelectedNames, flag) +SetFlag(SelectedElements, flag) +flag = square | octagon | thermal | join + +Sets flags on objects. + + Turns the given flag on, regardless of its previous setting. See +`ChangeFlag'. + + SetFlag(SelectedPins,thermal) + + +File: pcb.info, Node: SetOctagon Action, Next: SetSame Action, Prev: SetFlag Action, Up: core actions + +F.1.79 SetOctagon +----------------- + +SetOctagon(Object|ToggleObject|SelectedElements|Selected) + +Sets the octagon-flag of objects. + + Pins, pads, and vias can have various shapes. All may be round. +Pins and pads may be square (obviously "square" pads are usually +rectangular). Pins and vias may be octagonal. When you change a shape +flag of an element, you actually change all of its pins and pads. + + Note that the square flag takes precedence over the octagon flag, +thus, if both the square and octagon flags are set, the object is +square. When the square flag is cleared, the pins and pads will be +either round or, if the octagon flag is set, octagonal. + + +File: pcb.info, Node: SetSame Action, Next: SetSquare Action, Prev: SetOctagon Action, Up: core actions + +F.1.80 SetSame +-------------- + +SetSame() + +Sets current layer and sizes to match indicated item. + + When invoked over any line, arc, polygon, or via, this changes the +current layer to be the layer that item is on, and changes the current +sizes (thickness, keepaway, drill, etc) according to that item. + + +File: pcb.info, Node: SetSquare Action, Next: SetThermal Action, Prev: SetSame Action, Up: core actions + +F.1.81 SetSquare +---------------- + +SetSquare(ToggleObject|SelectedElements|SelectedPins) + +sets the square-flag of objects. + + Note that `Pins' means pins and pads. + + Pins, pads, and vias can have various shapes. All may be round. +Pins and pads may be square (obviously "square" pads are usually +rectangular). Pins and vias may be octagonal. When you change a shape +flag of an element, you actually change all of its pins and pads. + + Note that the square flag takes precedence over the octagon flag, +thus, if both the square and octagon flags are set, the object is +square. When the square flag is cleared, the pins and pads will be +either round or, if the octagon flag is set, octagonal. + + +File: pcb.info, Node: SetThermal Action, Next: SetValue Action, Prev: SetSquare Action, Up: core actions + +F.1.82 SetThermal +----------------- + +SetThermal(Object|SelectedPins|SelectedVias|Selected, Style) + +Set the thermal (on the current layer) of pins or vias to the given +style. Style = 0 means no thermal. Style = 1 has diagonal fingers +with sharp edges. Style = 2 has horizontal and vertical fingers with +sharp edges. Style = 3 is a solid connection to the plane.Style = 4 +has diagonal fingers with rounded edges. Style = 5 has horizontal and +vertical fingers with rounded edges. + + This changes how/whether pins or vias connect to any rectangle or +polygon on the current layer. The first argument can specify one +object, or all selected pins, or all selected vias, or all selected +pins and vias. The second argument specifies the style of connection. +There are 5 possibilities: 0 - no connection, 1 - 45 degree fingers +with sharp edges, 2 - horizontal & vertical fingers with sharp edges, 3 +- solid connection, 4 - 45 degree fingers with rounded corners, 5 - +horizontal & vertical fingers with rounded corners. + + Pins and Vias may have thermals whether or not there is a polygon +available to connect with. However, they will have no effect without +the polygon. + + +File: pcb.info, Node: SetValue Action, Next: ToggleHideName Action, Prev: SetThermal Action, Up: core actions + +F.1.83 SetValue +--------------- + +SetValue(Grid|Line|LineSize|Text|TextScale|ViaDrillingHole|Via|ViaSize, delta) + +Change various board-wide values and sizes. + +`ViaDrillingHole' + Changes the diameter of the drill for new vias. + +`Grid' + Sets the grid spacing. + +`Line' + +`LineSize' + Changes the thickness of new lines. + +`Via' + +`ViaSize' + Changes the diameter of new vias. + +`Text' + +`TextScale' + Changes the size of new text. + + + +File: pcb.info, Node: ToggleHideName Action, Next: ToggleVendor Action, Prev: SetValue Action, Up: core actions + +F.1.84 ToggleHideName +--------------------- + +ToggleHideName(Object|SelectedElements) + +Toggles the visibility of element names. + + If names are hidden you won't see them on the screen and they will +not appear on the silk layer when you print the layout. + + +File: pcb.info, Node: ToggleVendor Action, Next: Undo Action, Prev: ToggleHideName Action, Up: core actions + +F.1.85 ToggleVendor +------------------- + +ToggleVendor() + +Toggles the state of automatic drill size mapping. + + When drill mapping is enabled, new instances of pins and vias will +have their drill holes mapped to one of the allowed drill sizes +specified in the currently loaded vendor drill table. To enable drill +mapping, a vendor resource file containing a drill table must be loaded +first. + + +File: pcb.info, Node: Undo Action, Next: UnloadVendor Action, Prev: ToggleVendor Action, Up: core actions + +F.1.86 Undo +----------- + +Undo() +Undo(ClearList) + +Undo recent changes. + + The unlimited undo feature of `Pcb' allows you to recover from most +operations that materially affect you work. Calling `Undo()' without +any parameter recovers from the last (non-undo) operation. `ClearList' +is used to release the allocated memory. `ClearList' is called whenever +a new layout is started or loaded. See also `Redo' and `Atomic'. + + Note that undo groups operations by serial number; changes with the +same serial number will be undone (or redone) as a group. See `Atomic'. + + +File: pcb.info, Node: UnloadVendor Action, Next: Unselect Action, Prev: Undo Action, Up: core actions + +F.1.87 UnloadVendor +------------------- + +UnloadVendor() + +Unloads the current vendor drill mapping table. + + +File: pcb.info, Node: Unselect Action, Next: w Action, Prev: UnloadVendor Action, Up: core actions + +F.1.88 Unselect +--------------- + +Unselect(All|Block|Connection) +Unselect(ElementByName|ObjectByName|PadByName|PinByName) +Unselect(ElementByName|ObjectByName|PadByName|PinByName, Name) +Unselect(TextByName|ViaByName) +Unselect(TextByName|ViaByName, Name) + +Unselects the object at the pointer location or the specified objects. + +`All' + Unselect all objects. + +`Block' + Unselect all objects in a rectangle given by the cursor. + +`Connection' + Unselect all connections with the "found" flag set. + +`ElementByName' + +`ObjectByName' + +`PadByName' + +`PinByName' + +`TextByName' + +`ViaByName' + These all rely on having a regular expression parser built into + `pcb'. If the name is not specified then the user is prompted for + a pattern, and all objects that match the pattern and are of the + type specified are unselected. + + + +File: pcb.info, Node: w Action, Next: wq Action, Prev: Unselect Action, Up: core actions + +F.1.89 w +-------- + +w [name] + +Saves layout data. + + This commands has been added for the convenience of `vi' users and +has the same functionality as `s'. + + This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (`:') and thus the syntax is +documented for that purpose. + + +File: pcb.info, Node: wq Action, Prev: w Action, Up: core actions + +F.1.90 wq +--------- + +wq + +Saves the layout data and quits. + + This command has been added for the convenience of `vi' users and +has the same functionality as `s' combined with `q'. + + This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (`:') and thus the syntax is +documented for that purpose. + + +File: pcb.info, Node: common actions, Next: gtk actions, Prev: core actions, Up: Action Reference + +F.2 common actions +================== + +* Menu: + +* LayersChanged Action:: Tells the GUI that the layers have changed. +* LibraryChanged Action:: Tells the GUI that the libraries have changed. +* NetlistChanged Action:: Tells the GUI that the netlist has changed. +* PCBChanged Action:: Tells the GUI that the whole PCB has changed. The optional``revert"parameter can be used as a hint to the GUI that the same design is beingreloaded, and that it might keep some viewport settings +* RouteStylesChanged Action:: Tells the GUI that the routing styles have changed. + + +File: pcb.info, Node: LayersChanged Action, Next: LibraryChanged Action, Up: common actions + +F.2.1 LayersChanged +------------------- + +LayersChanged() + +Tells the GUI that the layers have changed. + + This includes layer names, colors, stacking order, visibility, etc. + + This is one of a number of actions which are part of the HID +interface. The core functions use these actions to tell the current +GUI when to change the presented information in response to changes +that the GUI may not know about. The user normally does not invoke +these directly. + + +File: pcb.info, Node: LibraryChanged Action, Next: NetlistChanged Action, Prev: LayersChanged Action, Up: common actions + +F.2.2 LibraryChanged +-------------------- + +LibraryChanged() + +Tells the GUI that the libraries have changed. + + This is one of a number of actions which are part of the HID +interface. The core functions use these actions to tell the current +GUI when to change the presented information in response to changes +that the GUI may not know about. The user normally does not invoke +these directly. + + +File: pcb.info, Node: NetlistChanged Action, Next: PCBChanged Action, Prev: LibraryChanged Action, Up: common actions + +F.2.3 NetlistChanged +-------------------- + +NetlistChanged() + +Tells the GUI that the netlist has changed. + + This is one of a number of actions which are part of the HID +interface. The core functions use these actions to tell the current +GUI when to change the presented information in response to changes +that the GUI may not know about. The user normally does not invoke +these directly. + + +File: pcb.info, Node: PCBChanged Action, Next: RouteStylesChanged Action, Prev: NetlistChanged Action, Up: common actions + +F.2.4 PCBChanged +---------------- + +PCBChanged([revert]) + +Tells the GUI that the whole PCB has changed. The +optional"revert"parameter can be used as a hint to the GUI that the +same design is beingreloaded, and that it might keep some viewport +settings + + This is one of a number of actions which are part of the HID +interface. The core functions use these actions to tell the current +GUI when to change the presented information in response to changes +that the GUI may not know about. The user normally does not invoke +these directly. + + +File: pcb.info, Node: RouteStylesChanged Action, Prev: PCBChanged Action, Up: common actions + +F.2.5 RouteStylesChanged +------------------------ + +RouteStylesChanged() + +Tells the GUI that the routing styles have changed. + + This is one of a number of actions which are part of the HID +interface. The core functions use these actions to tell the current +GUI when to change the presented information in response to changes +that the GUI may not know about. The user normally does not invoke +these directly. + + +File: pcb.info, Node: gtk actions, Next: lesstif actions, Prev: common actions, Up: Action Reference + +F.3 gtk actions +=============== + +* Menu: + +* gtk About Action:: N_("Tell the user about this version of PCB."); +* gtk AdjustStyle Action:: Open the window which allows editing of the route styles. +* gtk Center Action:: N_("Moves the pointer to the center of the window."); +* gtk Cursor Action:: N_("Move the cursor."); +* gtk DoWindows Action:: N_("Open various GUI windows."); +* gtk EditLayerGroups Action:: Open the preferences window which allows editing of the layer groups. +* gtk GetXY Action:: N_("Get a coordinate."); +* gtk ImportGUI Action:: N_("Asks user which schematics to import into PCB. +"); +* gtk Pan Action:: N_("Start or stop panning (Mode = 1 to start, 0 to stop) +Optional thumb argument is ignored for now in gtk hid. +"); +* gtk Popup Action:: N_("Bring up the popup menu specified by `MenuName'. +If called by a mouse event then the mouse button number +must be specified as the optional second argument."); +* gtk Print Action:: N_("Print the layout."); +* gtk PrintCalibrate Action:: N_("Calibrate the printer."); +* gtk Save Action:: N_("Save layout and/or element data to a user-selected file."); +* gtk SelectLayer Action:: Select which layer is the current layer. +* gtk SetUnits Action:: N_("Set the default measurement units."); +* gtk SwapSides Action:: N_("Swaps the side of the board you're looking at."); +* gtk ToggleView Action:: Toggle the visibility of the specified layer or layer group. +* gtk Zoom Action:: N_("Various zoom factor changes."); + + +File: pcb.info, Node: gtk About Action, Next: gtk AdjustStyle Action, Up: gtk actions + +F.3.1 gtk About +--------------- + +About() + +N_("Tell the user about this version of PCB."); + + This just pops up a dialog telling the user which version of `pcb' +they're running. + + +File: pcb.info, Node: gtk AdjustStyle Action, Next: gtk Center Action, Prev: gtk About Action, Up: gtk actions + +F.3.2 gtk AdjustStyle +--------------------- + +AdjustStyle() + +Open the window which allows editing of the route styles. + + Opens the window which allows editing of the route styles. + + +File: pcb.info, Node: gtk Center Action, Next: gtk Cursor Action, Prev: gtk AdjustStyle Action, Up: gtk actions + +F.3.3 gtk Center +---------------- + +Center() + +N_("Moves the pointer to the center of the window."); + + Move the pointer to the center of the window, but only if it's +currently within the window already. + + +File: pcb.info, Node: gtk Cursor Action, Next: gtk DoWindows Action, Prev: gtk Center Action, Up: gtk actions + +F.3.4 gtk Cursor +---------------- + +Cursor(Type,DeltaUp,DeltaRight,Units) + +N_("Move the cursor."); + + This action moves the mouse cursor. Unlike other actions which take +coordinates, this action's coordinates are always relative to the +user's view of the board. Thus, a positive DELTAUP may move the cursor +towards the board origin if the board is inverted. + + Type is one of `Pan' or `Warp'. `Pan' causes the viewport to move +such that the crosshair is under the mouse cursor. `Warp' causes the +mouse cursor to move to be above the crosshair. + + UNITS can be one of the following: + +`mil' +`mm' + The cursor is moved by that amount, in board units. + +`grid' + The cursor is moved by that many grid points. + +`view' + The values are percentages of the viewport's view. Thus, a pan of + `100' would scroll the viewport by exactly the width of the + current view. + +`board' + The values are percentages of the board size. Thus, a move of + `50,50' moves you halfway across the board. + + + +File: pcb.info, Node: gtk DoWindows Action, Next: gtk EditLayerGroups Action, Prev: gtk Cursor Action, Up: gtk actions + +F.3.5 gtk DoWindows +------------------- + +DoWindows(1|2|3|4|5|6) +DoWindows(Layout|Library|Log|Netlist|Preferences|DRC) + +N_("Open various GUI windows."); + +`1' +`Layout' + Open the layout window. Since the layout window is always shown + anyway, this has no effect. + +`2' +`Library' + Open the library window. + +`3' +`Log' + Open the log window. + +`4' +`Netlist' + Open the netlist window. + +`5' +`Preferences' + Open the preferences window. + +`6' +`DRC' + Open the DRC violations window. + + + +File: pcb.info, Node: gtk EditLayerGroups Action, Next: gtk GetXY Action, Prev: gtk DoWindows Action, Up: gtk actions + +F.3.6 gtk EditLayerGroups +------------------------- + +EditLayerGroups() + +Open the preferences window which allows editing of the layer groups. + + Opens the preferences window which is where the layer groups are +edited. This action is primarily provides to provide menu resource +compatibility with the lesstif HID. + + +File: pcb.info, Node: gtk GetXY Action, Next: gtk ImportGUI Action, Prev: gtk EditLayerGroups Action, Up: gtk actions + +F.3.7 gtk GetXY +--------------- + +GetXY() + +N_("Get a coordinate."); + + Prompts the user for a coordinate, if one is not already selected. + + +File: pcb.info, Node: gtk ImportGUI Action, Next: gtk Pan Action, Prev: gtk GetXY Action, Up: gtk actions + +F.3.8 gtk ImportGUI +------------------- + +ImportGUI() + +N_("Asks user which schematics to import into PCB. "); + + Asks user which schematics to import into PCB. + + +File: pcb.info, Node: gtk Pan Action, Next: gtk Popup Action, Prev: gtk ImportGUI Action, Up: gtk actions + +F.3.9 gtk Pan +------------- + +Pan([thumb], Mode) + +N_("Start or stop panning (Mode = 1 to start, 0 to stop) Optional thumb +argument is ignored for now in gtk hid. "); + + Start or stop panning. To start call with Mode = 1, to stop call +with Mode = 0. + + +File: pcb.info, Node: gtk Popup Action, Next: gtk Print Action, Prev: gtk Pan Action, Up: gtk actions + +F.3.10 gtk Popup +---------------- + +Popup(MenuName, [Button]) + +N_("Bring up the popup menu specified by `MenuName'. If called by a +mouse event then the mouse button number must be specified as the +optional second argument."); + + This just pops up the specified menu. The menu must have been +defined as a named subresource of the Popups resource in the menu +resource file. + + +File: pcb.info, Node: gtk Print Action, Next: gtk PrintCalibrate Action, Prev: gtk Popup Action, Up: gtk actions + +F.3.11 gtk Print +---------------- + +Print() + +N_("Print the layout."); + + This will find the default printing HID, prompt the user for its +options, and print the layout. + + +File: pcb.info, Node: gtk PrintCalibrate Action, Next: gtk Save Action, Prev: gtk Print Action, Up: gtk actions + +F.3.12 gtk PrintCalibrate +------------------------- + +PrintCalibrate() + +N_("Calibrate the printer."); + + This will print a calibration page, which you would measure and type +the measurements in, so that future printouts will be more precise. + + +File: pcb.info, Node: gtk Save Action, Next: gtk SelectLayer Action, Prev: gtk PrintCalibrate Action, Up: gtk actions + +F.3.13 gtk Save +--------------- + +Save() +Save(Layout|LayoutAs) +Save(AllConnections|AllUnusedPins|ElementConnections) +Save(PasteBuffer) + +N_("Save layout and/or element data to a user-selected file."); + + This action is a GUI front-end to the core's `SaveTo' action (*note +SaveTo Action::). If you happen to pass a filename, like `SaveTo', +then `SaveTo' is called directly. Else, the user is prompted for a +filename to save, and then `SaveTo' is called with that filename. + + +File: pcb.info, Node: gtk SelectLayer Action, Next: gtk SetUnits Action, Prev: gtk Save Action, Up: gtk actions + +F.3.14 gtk SelectLayer +---------------------- + +SelectLayer(1..MAXLAYER|Silk|Rats) + +Select which layer is the current layer. + + The specified layer becomes the currently active layer. It is made +visible if it is not already visible + + +File: pcb.info, Node: gtk SetUnits Action, Next: gtk SwapSides Action, Prev: gtk SelectLayer Action, Up: gtk actions + +F.3.15 gtk SetUnits +------------------- + +SetUnits(mm|mil) + +N_("Set the default measurement units."); + +`mil' + Sets the display units to mils (1/1000 inch). + +`mm' + Sets the display units to millimeters. + + + +File: pcb.info, Node: gtk SwapSides Action, Next: gtk ToggleView Action, Prev: gtk SetUnits Action, Up: gtk actions + +F.3.16 gtk SwapSides +-------------------- + +SwapSides(|v|h|r) + +N_("Swaps the side of the board you're looking at."); + + This action changes the way you view the board. + +`v' + Flips the board over vertically (up/down). + +`h' + Flips the board over horizontally (left/right), like flipping + pages in a book. + +`r' + Rotates the board 180 degrees without changing sides. + + + If no argument is given, the board isn't moved but the opposite side +is shown. + + Normally, this action changes which pads and silk layer are drawn as +true silk, and which are drawn as the "invisible" layer. It also +determines which solder mask you see. + + As a special case, if the layer group for the side you're looking at +is visible and currently active, and the layer group for the opposite +is not visible (i.e. disabled), then this action will also swap which +layer group is visible and active, effectively swapping the "working +side" of the board. + + +File: pcb.info, Node: gtk ToggleView Action, Next: gtk Zoom Action, Prev: gtk SwapSides Action, Up: gtk actions + +F.3.17 gtk ToggleView +--------------------- + +ToggleView(1..MAXLAYER) +ToggleView(layername) +ToggleView(Silk|Rats|Pins|Vias|Mask|BackSide) + +Toggle the visibility of the specified layer or layer group. + + If you pass an integer, that layer is specified by index (the first +layer is `1', etc). If you pass a layer name, that layer is specified +by name. When a layer is specified, the visibility of the layer group +containing that layer is toggled. + + If you pass a special layer name, the visibility of those components +(silk, rats, etc) is toggled. Note that if you have a layer named the +same as a special layer, the layer is chosen over the special layer. + + +File: pcb.info, Node: gtk Zoom Action, Prev: gtk ToggleView Action, Up: gtk actions + +F.3.18 gtk Zoom +--------------- + +Zoom() +Zoom(factor) + +N_("Various zoom factor changes."); Changes the zoom (magnification) of +the view of the board. If no arguments are passed, the view is scaled +such that the board just fits inside the visible window (i.e. "view +all"). Otherwise, FACTOR specifies a change in zoom factor. It may be +prefixed by `+', `-', or `=' to change how the zoom factor is modified. +The FACTOR is a floating point number, such as `1.5' or `0.75'. + +`+FACTOR' + Values greater than 1.0 cause the board to be drawn smaller; more + of the board will be visible. Values between 0.0 and 1.0 cause + the board to be drawn bigger; less of the board will be visible. + +`-FACTOR' + Values greater than 1.0 cause the board to be drawn bigger; less of + the board will be visible. Values between 0.0 and 1.0 cause the + board to be drawn smaller; more of the board will be visible. + +`=FACTOR' + The FACTOR is an absolute zoom factor; the unit for this value is + "PCB units per screen pixel". Since PCB units are 0.01 mil, a + FACTOR of 1000 means 10 mils (0.01 in) per pixel, or 100 DPI, + about the actual resolution of most screens - resulting in an + "actual size" board. Similarly, a FACTOR of 100 gives you a 10x + actual size. + + + Note that zoom factors of zero are silently ignored. + + +File: pcb.info, Node: lesstif actions, Prev: gtk actions, Up: Action Reference + +F.4 lesstif actions +=================== + +* Menu: + +* lesstif About Action:: Tell the user about this version of PCB. +* lesstif AdjustSizes Action:: Let the user change the board size, DRC parameters, etc +* lesstif AdjustStyle Action:: Displays the route style adjustment window. +* lesstif Benchmark Action:: Benchmark the GUI speed. +* lesstif Command Action:: Displays the command line input window. +* lesstif Cursor Action:: Move the cursor. +* lesstif Debug Action:: Debug action. +* lesstif DebugXY Action:: Debug action, with coordinates +* lesstif DoWindows Action:: Open various GUI windows. +* lesstif DumpKeys Action:: Dump Lesstif key bindings. +* lesstif EditLayerGroups Action:: Let the user change the layer groupings +* lesstif Export Action:: Export the layout. +* lesstif GetXY Action:: Get a coordinate. +* lesstif ImportGUI Action:: Lets the user choose the schematics to import from +* lesstif LibraryShow Action:: Displays the library window. +* lesstif Load Action:: Load layout data from a user-selected file. +* lesstif LoadVendor Action:: Loads a user-selected vendor resource file. +* lesstif NetlistShow Action:: Selects the given pinname or netname in the netlist window. +* lesstif Print Action:: Print the layout. +* lesstif PrintCalibrate Action:: Calibrate the printer. +* lesstif PromptFor Action:: Prompt for a response. +* lesstif Return Action:: Simulate a passing or failing action. +* lesstif Save Action:: Save layout data to a user-selected file. +* lesstif SelectLayer Action:: Select which layer is the current layer. +* lesstif SetUnits Action:: Set the default measurement units. +* lesstif SwapSides Action:: Swaps the side of the board you're looking at. +* lesstif ToggleView Action:: Toggle the visibility of the specified layer or layer group. +* lesstif Zoom Action:: Various zoom factor changes. + + +File: pcb.info, Node: lesstif About Action, Next: lesstif AdjustSizes Action, Up: lesstif actions + +F.4.1 lesstif About +------------------- + +About() + +Tell the user about this version of PCB. + + This just pops up a dialog telling the user which version of `pcb' +they're running. + + +File: pcb.info, Node: lesstif AdjustSizes Action, Next: lesstif AdjustStyle Action, Prev: lesstif About Action, Up: lesstif actions + +F.4.2 lesstif AdjustSizes +------------------------- + +AdjustSizes() + +Let the user change the board size, DRC parameters, etc + + Displays a dialog box that lets the user change the board size, DRC +parameters, and text scale. + + The units are determined by the default display units. + + +File: pcb.info, Node: lesstif AdjustStyle Action, Next: lesstif Benchmark Action, Prev: lesstif AdjustSizes Action, Up: lesstif actions + +F.4.3 lesstif AdjustStyle +------------------------- + +AdjustStyle() + +Displays the route style adjustment window. + + +File: pcb.info, Node: lesstif Benchmark Action, Next: lesstif Command Action, Prev: lesstif AdjustStyle Action, Up: lesstif actions + +F.4.4 lesstif Benchmark +----------------------- + +Benchmark() + +Benchmark the GUI speed. + + This action is used to speed-test the Lesstif graphics subsystem. It +redraws the current screen as many times as possible in ten seconds. +It reports the amount of time needed to draw the screen once. + + +File: pcb.info, Node: lesstif Command Action, Next: lesstif Cursor Action, Prev: lesstif Benchmark Action, Up: lesstif actions + +F.4.5 lesstif Command +--------------------- + +Command() + +Displays the command line input window. + + The command window allows the user to manually enter actions to be +executed. Action syntax can be done one of two ways: + +`' + Follow the action name by an open parenthesis, arguments separated + by commas, end with a close parenthesis. Example: `Abc(1,2,3)' + +`' + Separate the action name and arguments by spaces. Example: `Abc 1 + 2 3'. + + + The first option allows you to have arguments with spaces in them, +but the second is more "natural" to type for most people. + + Note that action names are not case sensitive, but arguments normally +are. However, most actions will check for "keywords" in a case +insensitive way. + + There are three ways to finish with the command window. If you press +the `Enter' key, the command is invoked, the window goes away, and the +next time you bring up the command window it's empty. If you press the +`Esc' key, the window goes away without invoking anything, and the next +time you bring up the command window it's empty. If you change focus +away from the command window (i.e. click on some other window), the +command window goes away but the next time you bring it up it resumes +entering the command you were entering before. + + +File: pcb.info, Node: lesstif Cursor Action, Next: lesstif Debug Action, Prev: lesstif Command Action, Up: lesstif actions + +F.4.6 lesstif Cursor +-------------------- + +Cursor(Type,DeltaUp,DeltaRight,Units) + +Move the cursor. + + This action moves the mouse cursor. Unlike other actions which take +coordinates, this action's coordinates are always relative to the +user's view of the board. Thus, a positive DELTAUP may move the cursor +towards the board origin if the board is inverted. + + Type is one of `Pan' or `Warp'. `Pan' causes the viewport to move +such that the crosshair is under the mouse cursor. `Warp' causes the +mouse cursor to move to be above the crosshair. + + UNITS can be one of the following: + +`mil' +`mm' + The cursor is moved by that amount, in board units. + +`grid' + The cursor is moved by that many grid points. + +`view' + The values are percentages of the viewport's view. Thus, a pan of + `100' would scroll the viewport by exactly the width of the + current view. + +`board' + The values are percentages of the board size. Thus, a move of + `50,50' moves you halfway across the board. + + + +File: pcb.info, Node: lesstif Debug Action, Next: lesstif DebugXY Action, Prev: lesstif Cursor Action, Up: lesstif actions + +F.4.7 lesstif Debug +------------------- + +Debug(...) + +Debug action. + + This action exists to help debug scripts; it simply prints all its +arguments to stdout. + + +File: pcb.info, Node: lesstif DebugXY Action, Next: lesstif DoWindows Action, Prev: lesstif Debug Action, Up: lesstif actions + +F.4.8 lesstif DebugXY +--------------------- + +DebugXY(...) + +Debug action, with coordinates + + Like `Debug', but requires a coordinate. If the user hasn't yet +indicated a location on the board, the user will be prompted to click +on one. + + +File: pcb.info, Node: lesstif DoWindows Action, Next: lesstif DumpKeys Action, Prev: lesstif DebugXY Action, Up: lesstif actions + +F.4.9 lesstif DoWindows +----------------------- + +DoWindows(1|2|3|4) +DoWindows(Layout|Library|Log|Netlist) + +Open various GUI windows. + +`1' +`Layout' + Open the layout window. Since the layout window is always shown + anyway, this has no effect. + +`2' +`Library' + Open the library window. + +`3' +`Log' + Open the log window. + +`4' +`Netlist' + Open the netlist window. + + + +File: pcb.info, Node: lesstif DumpKeys Action, Next: lesstif EditLayerGroups Action, Prev: lesstif DoWindows Action, Up: lesstif actions + +F.4.10 lesstif DumpKeys +----------------------- + +DumpKeys() + +Dump Lesstif key bindings. + + Causes the list of key bindings (from `pcb-menu.res') to be dumped +to stdout. This is most useful when invoked from the command line like +this: + + pcb --action-string DumpKeys + + +File: pcb.info, Node: lesstif EditLayerGroups Action, Next: lesstif Export Action, Prev: lesstif DumpKeys Action, Up: lesstif actions + +F.4.11 lesstif EditLayerGroups +------------------------------ + +EditLayerGroups() + +Let the user change the layer groupings + + Displays a dialog that lets the user view and change the layer +groupings. Each layer (row) can be a member of any one layer group +(column). Note the special layers `solder' and `component' allow you +to specify which groups represent the top and bottom of the board. + + See *note ChangeName Action::. + + +File: pcb.info, Node: lesstif Export Action, Next: lesstif GetXY Action, Prev: lesstif EditLayerGroups Action, Up: lesstif actions + +F.4.12 lesstif Export +--------------------- + +Export() + +Export the layout. + + Prompts the user for an exporter to use. Then, prompts the user for +that exporter's options, and exports the layout. + + +File: pcb.info, Node: lesstif GetXY Action, Next: lesstif ImportGUI Action, Prev: lesstif Export Action, Up: lesstif actions + +F.4.13 lesstif GetXY +-------------------- + +GetXY() + +Get a coordinate. + + Prompts the user for a coordinate, if one is not already selected. + + +File: pcb.info, Node: lesstif ImportGUI Action, Next: lesstif LibraryShow Action, Prev: lesstif GetXY Action, Up: lesstif actions + +F.4.14 lesstif ImportGUI +------------------------ + +ImportGUI() + +Lets the user choose the schematics to import from + + Displays a dialog that lets the user select the schematic(s) to +import from, then saves that information in the layout's attributes for +future imports. + + +File: pcb.info, Node: lesstif LibraryShow Action, Next: lesstif Load Action, Prev: lesstif ImportGUI Action, Up: lesstif actions + +F.4.15 lesstif LibraryShow +-------------------------- + +LibraryShow() + +Displays the library window. + + +File: pcb.info, Node: lesstif Load Action, Next: lesstif LoadVendor Action, Prev: lesstif LibraryShow Action, Up: lesstif actions + +F.4.16 lesstif Load +------------------- + +Load() +Load(Layout|LayoutToBuffer|ElementToBuffer|Netlist|Revert) + +Load layout data from a user-selected file. + + This action is a GUI front-end to the core's `LoadFrom' action +(*note LoadFrom Action::). If you happen to pass a filename, like +`LoadFrom', then `LoadFrom' is called directly. Else, the user is +prompted for a filename to load, and then `LoadFrom' is called with +that filename. + + +File: pcb.info, Node: lesstif LoadVendor Action, Next: lesstif NetlistShow Action, Prev: lesstif Load Action, Up: lesstif actions + +F.4.17 lesstif LoadVendor +------------------------- + +LoadVendor() + +Loads a user-selected vendor resource file. + + The user is prompted for a file to load, and then `LoadVendorFrom' +is called (*note LoadVendorFrom Action::) to load that vendor file. + + +File: pcb.info, Node: lesstif NetlistShow Action, Next: lesstif Print Action, Prev: lesstif LoadVendor Action, Up: lesstif actions + +F.4.18 lesstif NetlistShow +-------------------------- + +NetlistShow(pinname|netname) + +Selects the given pinname or netname in the netlist window. + + +File: pcb.info, Node: lesstif Print Action, Next: lesstif PrintCalibrate Action, Prev: lesstif NetlistShow Action, Up: lesstif actions + +F.4.19 lesstif Print +-------------------- + +Print() + +Print the layout. + + This will find the default printing HID, prompt the user for its +options, and print the layout. + + +File: pcb.info, Node: lesstif PrintCalibrate Action, Next: lesstif PromptFor Action, Prev: lesstif Print Action, Up: lesstif actions + +F.4.20 lesstif PrintCalibrate +----------------------------- + +PrintCalibrate() + +Calibrate the printer. + + This will print a calibration page, which you would measure and type +the measurements in, so that future printouts will be more precise. + + +File: pcb.info, Node: lesstif PromptFor Action, Next: lesstif Return Action, Prev: lesstif PrintCalibrate Action, Up: lesstif actions + +F.4.21 lesstif PromptFor +------------------------ + +PromptFor([message[,default]]) + +Prompt for a response. + + This is mostly for testing the lesstif HID interface. The parameters +are passed to the `prompt_for()' HID function, causing the user to be +prompted for a response. The respose is simply printed to the user's +stdout. + + +File: pcb.info, Node: lesstif Return Action, Next: lesstif Save Action, Prev: lesstif PromptFor Action, Up: lesstif actions + +F.4.22 lesstif Return +--------------------- + +Return(0|1) + +Simulate a passing or failing action. + + This is for testing. If passed a 0, does nothing and succeeds. If +passed a 1, does nothing but pretends to fail. + + +File: pcb.info, Node: lesstif Save Action, Next: lesstif SelectLayer Action, Prev: lesstif Return Action, Up: lesstif actions + +F.4.23 lesstif Save +------------------- + +Save() +Save(Layout|LayoutAs) +Save(AllConnections|AllUnusedPins|ElementConnections) +Save(PasteBuffer) + +Save layout data to a user-selected file. + + This action is a GUI front-end to the core's `SaveTo' action (*note +SaveTo Action::). If you happen to pass a filename, like `SaveTo', +then `SaveTo' is called directly. Else, the user is prompted for a +filename to save, and then `SaveTo' is called with that filename. + + +File: pcb.info, Node: lesstif SelectLayer Action, Next: lesstif SetUnits Action, Prev: lesstif Save Action, Up: lesstif actions + +F.4.24 lesstif SelectLayer +-------------------------- + +SelectLayer(1..MAXLAYER|Silk|Rats) + +Select which layer is the current layer. + + The specified layer becomes the currently active layer. It is made +visible if it is not already visible + + +File: pcb.info, Node: lesstif SetUnits Action, Next: lesstif SwapSides Action, Prev: lesstif SelectLayer Action, Up: lesstif actions + +F.4.25 lesstif SetUnits +----------------------- + +SetUnits(mm|mil) + +Set the default measurement units. + +`mil' + Sets the display units to mils (1/1000 inch). + +`mm' + Sets the display units to millimeters. + + + +File: pcb.info, Node: lesstif SwapSides Action, Next: lesstif ToggleView Action, Prev: lesstif SetUnits Action, Up: lesstif actions + +F.4.26 lesstif SwapSides +------------------------ + +SwapSides(|v|h|r) + +Swaps the side of the board you're looking at. + + This action changes the way you view the board. + +`v' + Flips the board over vertically (up/down). + +`h' + Flips the board over horizontally (left/right), like flipping + pages in a book. + +`r' + Rotates the board 180 degrees without changing sides. + + + If no argument is given, the board isn't moved but the opposite side +is shown. + + Normally, this action changes which pads and silk layer are drawn as +true silk, and which are drawn as the "invisible" layer. It also +determines which solder mask you see. + + As a special case, if the layer group for the side you're looking at +is visible and currently active, and the layer group for the opposite +is not visible (i.e. disabled), then this action will also swap which +layer group is visible and active, effectively swapping the "working +side" of the board. + + +File: pcb.info, Node: lesstif ToggleView Action, Next: lesstif Zoom Action, Prev: lesstif SwapSides Action, Up: lesstif actions + +F.4.27 lesstif ToggleView +------------------------- + +ToggleView(1..MAXLAYER) +ToggleView(layername) +ToggleView(Silk|Rats|Pins|Vias|Mask|BackSide) + +Toggle the visibility of the specified layer or layer group. + + If you pass an integer, that layer is specified by index (the first +layer is `1', etc). If you pass a layer name, that layer is specified +by name. When a layer is specified, the visibility of the layer group +containing that layer is toggled. + + If you pass a special layer name, the visibility of those components +(silk, rats, etc) is toggled. Note that if you have a layer named the +same as a special layer, the layer is chosen over the special layer. + + +File: pcb.info, Node: lesstif Zoom Action, Prev: lesstif ToggleView Action, Up: lesstif actions + +F.4.28 lesstif Zoom +------------------- + +Zoom() +Zoom(factor) + +Various zoom factor changes. + + Changes the zoom (magnification) of the view of the board. If no +arguments are passed, the view is scaled such that the board just fits +inside the visible window (i.e. "view all"). Otherwise, FACTOR +specifies a change in zoom factor. It may be prefixed by `+', `-', or +`=' to change how the zoom factor is modified. The FACTOR is a +floating point number, such as `1.5' or `0.75'. + +`+FACTOR' + Values greater than 1.0 cause the board to be drawn smaller; more + of the board will be visible. Values between 0.0 and 1.0 cause + the board to be drawn bigger; less of the board will be visible. + +`-FACTOR' + Values greater than 1.0 cause the board to be drawn bigger; less of + the board will be visible. Values between 0.0 and 1.0 cause the + board to be drawn smaller; more of the board will be visible. + +`=FACTOR' + The FACTOR is an absolute zoom factor; the unit for this value is + "PCB units per screen pixel". Since PCB units are 0.01 mil, a + FACTOR of 1000 means 10 mils (0.01 in) per pixel, or 100 DPI, + about the actual resolution of most screens - resulting in an + "actual size" board. Similarly, a FACTOR of 100 gives you a 10x + actual size. + + + Note that zoom factors of zero are silently ignored. + + +File: pcb.info, Node: Glossary, Next: Index, Prev: Action Reference, Up: Top + +Appendix G Glossary +******************* + +Footprint + The pattern of metal, silkscreen, soldermask relief, and drills + which defines where you place a component on a circuit board. + Footprints are the placed by the user onto the PC board during the + placement phase of PCB layout. + +Gerber File + The file format used in the industry to convey a board database to + the manufacturer is RS-274X (which replaces the now obsolete + RS-274D format). This file format was originally developed by + Gerber for their photo plotters and thus RS-274D and RS-274X + format files are often times refered to as "Gerber" files. + +Thermal, Thermal Relief + A thermal relief is a way of connecting a pin to a ground or power + plane. Instead of directly connecting to the plane, small "spokes" + are used to increase the thermal resistance between the pin and + the plane. Often times these connections are refered to as simply + a thermal. By increasing the thermal resistance to the plane, it + becomes easier to solder to the pin. In the drawing below, the + pin on the left is connected to the polygon using a solid + connection with no thermal relief, the middle pin is connected + using a thermal, while the pin on the right has no connection to + the polygon. In PCB, the "Thermal" Tool is used to make both a + solid connection and one with thermal relief (see *note Polygon + Objects::). + + [image src="thermal.png" alt="Example of a thermal relief"] + + +File: pcb.info, Node: Index, Prev: Glossary, Up: Top + +Index of Resources +****************** + +[index] +* Menu: + +* absoluteGrid: Resources. (line 9) +* alignmentDistance: Resources. (line 13) +* allDirectionLines: Resources. (line 17) +* backgroundImage: Resources. (line 21) +* backupInterval: Resources. (line 43) +* bloat: Resources. (line 52) +* BTNMOD: running configure. (line 25) +* connectedColor: Resources. (line 55) +* cross hairColor: Resources. (line 60) +* DEFAULTFONT: running configure. (line 16) +* DEFAULTLIBRARY: running configure. (line 19) +* Element Search: Regular Expressions. (line 6) +* elementColor: Resources. (line 68) +* elementCommand <1>: File Formats. (line 14) +* elementCommand: Resources. (line 74) +* elementContentsCommand: Resources. (line 173) +* elementPath: Resources. (line 85) +* elementSelectedColor: Resources. (line 68) +* Exporting a layout: Exporting. (line 6) +* fileCommand <1>: File Formats. (line 14) +* fileCommand: Resources. (line 93) +* filePath: Resources. (line 102) +* fontCommand <1>: File Formats. (line 14) +* fontCommand: Resources. (line 110) +* fontFile: Resources. (line 118) +* fontPath: Resources. (line 124) +* GNUM4: running configure. (line 22) +* grid: Resources. (line 128) +* gridColor: Resources. (line 133) +* INFOLIBDIR: running configure. (line 10) +* invisibleObjectsColor: Resources. (line 141) +* layerColor: Resources. (line 145) +* layerGroups: Resources. (line 151) +* layerName: Resources. (line 159) +* layerSelectedColor: Resources. (line 145) +* libraryCommand <1>: File Formats. (line 14) +* libraryCommand: Resources. (line 163) +* libraryContentsCommand: File Formats. (line 14) +* libraryFilename: Resources. (line 179) +* libraryPath: Resources. (line 184) +* lineThickness: Resources. (line 189) +* Measuring distances: Measuring distances. (line 6) +* media: Resources. (line 195) +* offLimitColor: Resources. (line 203) +* PCBLIBDIR: running configure. (line 13) +* pinColor: Resources. (line 208) +* pinoutFont0..6: Resources. (line 213) +* pinoutNameLength: Resources. (line 217) +* pinoutOffsetX: Resources. (line 222) +* pinoutOffsetY: Resources. (line 222) +* pinoutTextOffsetX: Resources. (line 228) +* pinoutTextOffsetY: Resources. (line 228) +* pinoutZoom: Resources. (line 234) +* pinSelectedColor: Resources. (line 208) +* printCommand: Resources. (line 239) +* raiseLogWindow: Resources. (line 244) +* ratCommand: Resources. (line 248) +* ratPath: Resources. (line 252) +* Regular Expressions: Regular Expressions. (line 6) +* resetAfterElement: Resources. (line 255) +* ringBellWhenFinished: Resources. (line 262) +* routeStyle: Resources. (line 267) +* rubberBandMode: Resources. (line 274) +* saveCommand <1>: File Formats. (line 14) +* saveCommand: Resources. (line 278) +* saveInTMP: Resources. (line 285) +* saveLastCommand: Resources. (line 294) +* Searching for elements: Searching for elements. + (line 6) +* shrink: Resources. (line 299) +* size: Resources. (line 302) +* stipplePolygons: Resources. (line 307) +* textScale: Resources. (line 313) +* useLogWindow: Resources. (line 317) +* viaColor: Resources. (line 324) +* viaDrillingHole: Resources. (line 330) +* viaSelectedColor: Resources. (line 324) +* viaThickness: Resources. (line 330) +* volume: Resources. (line 338) +* warnColor: Resources. (line 343) +* zoom: Resources. (line 347) + +Index of Actions, Commands and Options +************************************** + +[index] +* Menu: + +* -- basename : nelma Options. (line 6) +* --action-script : General Options. (line 47) +* --action-string : General Options. (line 50) +* --align-marks: Postscript Export. (line 12) +* --alignment-distance : Sizes. (line 64) +* --all-direction-lines: General GUI Options. (line 35) +* --all-layers: Gerber Export. (line 9) +* --as-shown <1>: PNG Options. (line 23) +* --as-shown: Encapsulated Postscript Export. + (line 13) +* --auto-mirror: Postscript Export. (line 25) +* --background-color : Colors. (line 12) +* --backup-interval: General Options. (line 30) +* --bg-image <1>: lesstif GUI Options. (line 9) +* --bg-image : GTK+ GUI Options. (line 9) +* --black-color : Colors. (line 6) +* --bloat : DRC Options. (line 9) +* --bomfile : BOM Creation. (line 6) +* --clear-line: General GUI Options. (line 21) +* --connected-color : Colors. (line 54) +* --copper-height : nelma Options. (line 12) +* --copyright: General Options. (line 15) +* --cross-color : Colors. (line 18) +* --crosshair-color : Colors. (line 15) +* --default-font : Paths. (line 12) +* --default-PCB-height : Sizes. (line 57) +* --default-PCB-width : Sizes. (line 54) +* --dpi: PNG Options. (line 9) +* --dpi : nelma Options. (line 9) +* --draw-grid: General GUI Options. (line 18) +* --drill-copper: Postscript Export. (line 61) +* --drill-helper: Postscript Export. (line 9) +* --dump-actions: General Options. (line 24) +* --element-color : Colors. (line 36) +* --element-command : Commands. (line 17) +* --element-path : General Options. (line 42) +* --element-selected-color : Colors. (line 48) +* --eps-file : Encapsulated Postscript Export. + (line 6) +* --eps-scale : Encapsulated Postscript Export. + (line 10) +* --fab-author : General Options. (line 53) +* --file-command : Commands. (line 14) +* --file-path : Paths. (line 15) +* --fill-page: Postscript Export. (line 22) +* --font-command : Commands. (line 11) +* --font-path : Paths. (line 20) +* --format : PNG Options. (line 35) +* --full-poly: General GUI Options. (line 24) +* --gerberfile : Gerber Export. (line 6) +* --grid : Sizes. (line 68) +* --grid-color : Colors. (line 60) +* --grid-units-mm : General Options. (line 27) +* --groups : General Options. (line 34) +* --help: General Options. (line 6) +* --invisible-mark-color : Colors. (line 45) +* --invisible-objects-color : Colors. (line 42) +* --keepaway : Sizes. (line 50) +* --layer-color- : Colors. (line 63) +* --layer-name-1 : Layer Names. (line 6) +* --layer-name-2 : Layer Names. (line 9) +* --layer-name-3 : Layer Names. (line 12) +* --layer-name-4 : Layer Names. (line 15) +* --layer-name-5 : Layer Names. (line 18) +* --layer-name-6 : Layer Names. (line 21) +* --layer-name-7 : Layer Names. (line 24) +* --layer-name-8 : Layer Names. (line 27) +* --layer-selected-color- : Colors. (line 66) +* --layer-stack : General Options. (line 56) +* --lib-command : Commands. (line 27) +* --lib-command-dir : Commands. (line 24) +* --lib-contents-command : Commands. (line 31) +* --lib-name : Paths. (line 9) +* --lib-newlib : Paths. (line 6) +* --lib-path : Paths. (line 24) +* --line-thickness : Sizes. (line 42) +* --listen <1>: lesstif GUI Options. (line 6) +* --listen: GTK+ GUI Options. (line 6) +* --lprcommand : lpr Printing Options. + (line 6) +* --mask-color : Colors. (line 73) +* --media : Postscript Export. (line 37) +* --min-drill : DRC Options. (line 21) +* --min-ring : DRC Options. (line 24) +* --min-silk : DRC Options. (line 18) +* --min-width : DRC Options. (line 15) +* --minimum polygon area : Sizes. (line 71) +* --mirror: Postscript Export. (line 19) +* --monochrome <1>: PNG Options. (line 26) +* --monochrome: Encapsulated Postscript Export. + (line 16) +* --multi-file: Postscript Export. (line 51) +* --off-limit-color : Colors. (line 57) +* --only-visible: Encapsulated Postscript Export. + (line 19) +* --only-vivible: PNG Options. (line 29) +* --outfile : PNG Options. (line 6) +* --outline: Postscript Export. (line 16) +* --pcb-menu <1>: lesstif GUI Options. (line 15) +* --pcb-menu : GTK+ GUI Options. (line 15) +* --photo-flip-x: PNG Options. (line 48) +* --photo-flip-y: PNG Options. (line 52) +* --photo-mode: PNG Options. (line 45) +* --pin-color : Colors. (line 27) +* --pin-name-color : Colors. (line 33) +* --pin-selected-color : Colors. (line 30) +* --pinout-offset-x : General GUI Options. (line 6) +* --pinout-offset-y : General GUI Options. (line 9) +* --pinout-text-offset-x : General GUI Options. (line 12) +* --pinout-text-offset-y : General GUI Options. (line 15) +* --png-bloat : PNG Options. (line 39) +* --print-file : Commands. (line 21) +* --ps-bloat : Postscript Export. (line 31) +* --ps-color: Postscript Export. (line 28) +* --ps-invert: Postscript Export. (line 34) +* --psfade : Postscript Export. (line 44) +* --psfile : Postscript Export. (line 6) +* --rat-color : Colors. (line 39) +* --rat-command : Commands. (line 39) +* --rat-selected-color : Colors. (line 51) +* --rat-thickness : Sizes. (line 45) +* --reset-after-element: General Options. (line 68) +* --ring-bell-finished: General Options. (line 72) +* --route-styles : General Options. (line 37) +* --save-command : Commands. (line 36) +* --save-in-tmp: General Options. (line 63) +* --save-last-command: General Options. (line 60) +* --scale : Postscript Export. (line 47) +* --show-actions: General Options. (line 21) +* --show-defaults: General Options. (line 18) +* --show-legend: Postscript Export. (line 64) +* --show-number: General GUI Options. (line 38) +* --shrink : DRC Options. (line 12) +* --snap-pin: General GUI Options. (line 31) +* --substrate-epsilon : nelma Options. (line 18) +* --substrate-height : nelma Options. (line 15) +* --text-scale : Sizes. (line 60) +* --unique-names: General GUI Options. (line 27) +* --use-alpha: PNG Options. (line 32) +* --verbose <1>: Gerber Export. (line 12) +* --verbose: General Options. (line 12) +* --version: General Options. (line 9) +* --via-color : Colors. (line 21) +* --via-drilling-hole : Sizes. (line 39) +* --via-selected-color : Colors. (line 24) +* --via-thickness : Sizes. (line 36) +* --warn-color : Colors. (line 70) +* --x-max: PNG Options. (line 13) +* --xcalib : Postscript Export. (line 55) +* --xy-max: PNG Options. (line 19) +* --xy-unit : BOM Creation. (line 12) +* --xyfile : BOM Creation. (line 9) +* --y-max: PNG Options. (line 16) +* --ycalib : Postscript Export. (line 58) +* :actionCommand(): User Commands. (line 75) +* :l: User Commands. (line 33) +* :le: User Commands. (line 39) +* :m: User Commands. (line 45) +* :q: User Commands. (line 51) +* :rn: User Commands. (line 61) +* :s: User Commands. (line 55) +* :w[q]: User Commands. (line 71) +* AddRats(): Actions. (line 27) +* ApplyVendor() <1>: ApplyVendor Action. (line 8) +* ApplyVendor(): Actions. (line 54) +* Atomic(): Actions. (line 58) +* Bell(): Actions. (line 68) +* ChangeClearSize(): Actions. (line 72) +* ChangeDrillSize(): Actions. (line 83) +* ChangeFlag(): Actions. (line 93) +* ChangeHole(): Actions. (line 101) +* ChangeName(): Actions. (line 107) +* ChangeOctagon(): Actions. (line 117) +* ChangePinName(): Actions. (line 123) +* ChangeSize(): Actions. (line 129) +* ChangeSquare(): Actions. (line 148) +* ClrFlag(): Actions. (line 154) +* Command(): Actions. (line 160) +* Connection(): Actions. (line 167) +* DeleteRats(): Actions. (line 181) +* DisableVendor() <1>: DisableVendor Action. + (line 10) +* DisableVendor(): Actions. (line 188) +* DisperseElements(): Actions. (line 193) +* Display(): Actions. (line 199) +* DRC(): Actions. (line 234) +* EditLayerGroups(): Actions. (line 250) +* EnableVendor() <1>: EnableVendor Action. (line 10) +* EnableVendor(): Actions. (line 254) +* ExecuteFile(): Actions. (line 238) +* Load(): Actions. (line 259) +* LoadVendor(): Actions. (line 265) +* LoadVendorFrom(): LoadVendorFrom Action. + (line 10) +* MarkCrosshair(): Actions. (line 269) +* Mode(): Actions. (line 277) +* MovePointer(): Actions. (line 326) +* MoveToCurrentLayer(): Actions. (line 340) +* New(): Actions. (line 350) +* PasteBuffer(): Actions. (line 355) +* Polygon(): Actions. (line 382) +* Print(): Actions. (line 392) +* Quit(): Actions. (line 412) +* Redo(): Actions. (line 416) +* RemoveSelected(): Actions. (line 430) +* Report(): Actions. (line 434) +* RouteStyle(): Actions. (line 440) +* Save(): Actions. (line 450) +* Select(): Actions. (line 459) +* SetFlag(): Actions. (line 471) +* SetValue(): Actions. (line 477) +* SwapSides(): Actions. (line 499) +* SwitchDrawingLayer(): Actions. (line 503) +* ToggleHideName(): Actions. (line 509) +* ToggleVendor() <1>: ToggleVendor Action. (line 10) +* ToggleVendor(): Actions. (line 516) +* ToggleVisibility(): Actions. (line 521) +* Undo(): Actions. (line 528) +* UnloadVendor() <1>: UnloadVendor Action. (line 10) +* UnloadVendor(): Actions. (line 539) +* Unselect(): Actions. (line 543) + +Index of Concepts +***************** + +[index] +* Menu: + +* /tmp <1>: Resources. (line 285) +* /tmp: Loading and Saving. (line 18) +* action command: User Commands. (line 75) +* action reference: Action Reference. (line 6) +* actions: Actions. (line 6) +* actions file, executing: Actions. (line 238) +* Actions, initiating: User Commands. (line 75) +* align-marks: Postscript Export. (line 12) +* alignment: Resources. (line 13) +* alignment targets: Printing. (line 47) +* Alpha: DEC Alpha. (line 6) +* arc: Arc Objects. (line 6) +* arc, an example: Arcs. (line 6) +* architecture <1>: Linux. (line 6) +* architecture <2>: SCO. (line 6) +* architecture <3>: DEC Alpha. (line 6) +* architecture <4>: SGI. (line 6) +* architecture <5>: Sun. (line 6) +* architecture: HP. (line 6) +* arrow tool: Arrow Tool. (line 6) +* as-shown (EPS): Encapsulated Postscript Export. + (line 13) +* ASCII files, format of: File Formats. (line 6) +* Atari version: History. (line 6) +* atomic: Actions. (line 58) +* auto-router: Menu. (line 121) +* autorouter: Autorouter. (line 6) +* background: Resources. (line 21) +* backup <1>: Resources. (line 43) +* backup: Loading and Saving. (line 18) +* bell: Actions. (line 68) +* bill of materials: bom. (line 6) +* bloat: Resources. (line 52) +* bom: bom. (line 6) +* buffer, an example: Pastebuffer. (line 6) +* buffer, convert contents to element: Elements. (line 59) +* Buffer, popup menu: Menu. (line 109) +* buffer, selecting a: Actions. (line 355) +* button translations: Actions. (line 6) +* cat: Resources. (line 93) +* centering: Actions. (line 199) +* centroid file format: Centroid File Format. + (line 6) +* centroid file, algorithms: Centroid File Format. + (line 37) +* change active layer: Layer Controls. (line 6) +* change drawing layer: Actions. (line 503) +* change object name: Actions. (line 107) +* change settings: Actions. (line 477) +* change sizes: Actions. (line 72) +* change square flag: Actions. (line 148) +* change viewing side: Actions. (line 499) +* changing layers: Moving and Copying. (line 20) +* changing pin/pad names: Actions. (line 123) +* clearance: Line Objects. (line 38) +* clearance, changing of objects: Actions. (line 72) +* clearance, for new lines: Menu. (line 79) +* clipping lines to 45 degree <1>: Actions. (line 199) +* clipping lines to 45 degree: Resources. (line 17) +* closing a polygon: Actions. (line 382) +* cnc: gcode. (line 6) +* color printout: Printing. (line 32) +* color, warning: Resources. (line 343) +* colors: Resources. (line 55) +* command-line options: Command-Line Options. + (line 6) +* compile, how to: compiling. (line 6) +* configure: running configure. (line 6) +* connection, removing an: Translations. (line 11) +* connections, colors: Resources. (line 55) +* connections, creating list of: Connection Lists. (line 6) +* connections, reseting: Actions. (line 167) +* connections, reseting after element: Resources. (line 255) +* connections, searching for: Actions. (line 167) +* Connects, popup menu: Menu. (line 121) +* copy an object: Translations. (line 40) +* copying objects: Actions. (line 355) +* copying, an example: Moving and Copying. (line 6) +* creating objects: Common. (line 6) +* cursor color: Resources. (line 60) +* cursor movements: Actions. (line 326) +* cursor position: Actions. (line 269) +* cursor steps: Resources. (line 128) +* cutting objects: Actions. (line 355) +* DEC: DEC Alpha. (line 6) +* default font: Resources. (line 118) +* default layout size: Resources. (line 302) +* default library: Resources. (line 179) +* default text scaling: Resources. (line 313) +* default translations: Translations. (line 6) +* design rule checker, invoking: Menu. (line 121) +* design rule checking <1>: Actions. (line 234) +* design rule checking: Design Rule Checking. + (line 6) +* device, selecting an output: Printing. (line 21) +* directory /tmp <1>: Resources. (line 285) +* directory /tmp: Loading and Saving. (line 18) +* dispersing elements: Actions. (line 193) +* display: Resources. (line 307) +* displaying element names <1>: Actions. (line 199) +* displaying element names: Menu. (line 49) +* displaying pinout: Actions. (line 199) +* displaying status information: Status-line and Input-field. + (line 6) +* distributing elements: Actions. (line 193) +* DOS filenames: Printing. (line 80) +* drawing objects: Drawing and Removing. + (line 6) +* drc <1>: Actions. (line 234) +* drc <2>: Resources. (line 52) +* drc: Design Rule Checking. + (line 6) +* drill: Actions. (line 434) +* drill report: Menu. (line 143) +* drill sizes, list of standard: Standard Drill Sizes. + (line 6) +* Drill table: Vendor drill mapping. + (line 6) +* drill-helper: Postscript Export. (line 9) +* drilling hole, changing of objects: Actions. (line 83) +* drilling hole, setting of initial size: Actions. (line 477) +* Edit, popup menu: Menu. (line 40) +* element name, hiding: Actions. (line 509) +* element name, removing from silk-screen: Actions. (line 509) +* Element Search: Regular Expressions. (line 6) +* element, an example: Elements. (line 6) +* element, an overview: Element Objects. (line 6) +* element, color: Resources. (line 68) +* element, command: Resources. (line 74) +* element, creating a new package: Elements. (line 59) +* element, display names of <1>: Actions. (line 199) +* element, display names of: Menu. (line 49) +* element, editing: Menu. (line 109) +* element, file format: Element File. (line 6) +* element, files: Resources. (line 74) +* element, loading to buffer: User Commands. (line 39) +* element, move name of: Translations. (line 40) +* elements, dispersing: Actions. (line 193) +* elements, distributing: Actions. (line 193) +* encapsulated postscript: eps. (line 6) +* entering user commands: User Commands. (line 6) +* eps: eps. (line 6) +* erasing objects: Drawing and Removing. + (line 6) +* example files: Elements. (line 19) +* example of buffer handling: Pastebuffer. (line 6) +* example of connection lists: Connection Lists. (line 6) +* example of copying: Moving and Copying. (line 6) +* example of creating an element: Elements. (line 59) +* example of element handling: Elements. (line 6) +* example of line handling: Lines. (line 6) +* example of loading: Loading and Saving. (line 6) +* example of loading an element file: Elements. (line 41) +* example of moving: Moving and Copying. (line 6) +* example of pastebuffer handling: Pastebuffer. (line 6) +* example of pin handling: Elements. (line 41) +* example of polygon handling: Polygons. (line 6) +* example of printing: Printing. (line 6) +* example of rectangle handling: Polygons. (line 6) +* example of saving: Loading and Saving. (line 6) +* example of text handling: Text. (line 6) +* example of via handling: Vias. (line 6) +* exit <1>: Actions. (line 412) +* exit: User Commands. (line 51) +* Exporting a layout: Exporting. (line 6) +* file format, element data: Element File. (line 6) +* file format, font data: Font File. (line 6) +* file format, layout data: Layout File. (line 6) +* file format, libraries: Library File. (line 6) +* file format, library contents: Library Contents File. + (line 6) +* file formats: File Formats. (line 6) +* file formats, pads and lines: Pad and Line Representation. + (line 6) +* file load command: Resources. (line 93) +* file save command: Resources. (line 278) +* File sytax: File Syntax. (line 6) +* File, popup menu: Menu. (line 27) +* flags, changing: Actions. (line 93) +* flags, clearing: Actions. (line 154) +* flags, setting: Actions. (line 471) +* font command: Resources. (line 110) +* font file, format of: Font File. (line 6) +* font files: Resources. (line 110) +* font, an overview: Symbol Objects. (line 6) +* font, used for pin names: Resources. (line 213) +* format of element files: Element File. (line 6) +* format of font files: Font File. (line 6) +* format of layout files: Layout File. (line 6) +* format of libraries: Library File. (line 6) +* format of library contents: Library Contents File. + (line 6) +* FreeBSD: BSD. (line 6) +* g-code: gcode. (line 6) +* gcode: gcode. (line 6) +* gEDA, how to interface with: gEDA. (line 6) +* gerber: gerber. (line 7) +* glossary: Glossary. (line 6) +* GNU build system: quickstart. (line 6) +* GNU configure script: running configure. (line 6) +* grid <1>: Resources. (line 9) +* grid: Layout Area. (line 6) +* grid color: Resources. (line 133) +* grid, absolute and relative: Actions. (line 199) +* grid, alignment: Menu. (line 49) +* grid, display <1>: Actions. (line 199) +* grid, display: Menu. (line 49) +* grid, setting of: Actions. (line 477) +* groups: Resources. (line 151) +* groups, editing of: Actions. (line 250) +* gschem, how to interface with: gEDA. (line 6) +* Hewlett Packard: HP. (line 6) +* hide element name: Actions. (line 509) +* how to start: Getting Started. (line 6) +* HP: HP. (line 6) +* image export: png. (line 6) +* index of terms: Glossary. (line 6) +* Info, popup menu: Menu. (line 143) +* information about objects: Actions. (line 434) +* input-field, position of: Status-line and Input-field. + (line 6) +* inputfield, saving entered command-line: Resources. (line 294) +* inputfield, start user input: Actions. (line 160) +* install, how to: compiling. (line 6) +* key translations: Actions. (line 6) +* keyboard bell: Resources. (line 262) +* layer controls: Layer Controls. (line 6) +* layer groups: Layer Objects. (line 19) +* layer visibility, toggling: Actions. (line 521) +* layer, change active: Actions. (line 503) +* layer, name of: Resources. (line 159) +* layers, an overview: Layer Objects. (line 6) +* layers, changing which is active: Layer Controls. (line 6) +* layers, colors: Resources. (line 145) +* layers, editing of groups: Actions. (line 250) +* layers, groups: Resources. (line 151) +* layers, switching on/off: Layer Controls. (line 6) +* layout files: Resources. (line 93) +* layout files, format of: Layout File. (line 6) +* layout files, saving of: User Commands. (line 55) +* layout objects, an overview: Intro. (line 6) +* layout, default size of: Resources. (line 302) +* layout, loading a: User Commands. (line 33) +* layout, loading to buffer: User Commands. (line 45) +* layout, merging a: User Commands. (line 45) +* layout, printing a: Actions. (line 392) +* layout, start a new: Actions. (line 350) +* layout-name <1>: User Commands. (line 61) +* layout-name: Element Objects. (line 6) +* length of a pin name: Resources. (line 217) +* library accuracy: Element Objects. (line 74) +* library command: Resources. (line 163) +* library contents command: Resources. (line 173) +* library contents file, format of: Library Contents File. + (line 6) +* library creation: Library Creation. (line 6) +* library file, format of: Library File. (line 6) +* library name: Resources. (line 179) +* library searchpath: Resources. (line 184) +* library window: Library Window. (line 6) +* lines, an example: Lines. (line 6) +* lines, an overview: Line Objects. (line 6) +* lines, clipping to 45 degree <1>: Actions. (line 199) +* lines, clipping to 45 degree: Resources. (line 17) +* lines, setting of initial size: Actions. (line 477) +* lines, size: Resources. (line 189) +* Linux: Linux. (line 6) +* listing library contents: Resources. (line 173) +* loading a layout to buffer: User Commands. (line 45) +* loading elements: Resources. (line 74) +* loading elements to buffer: User Commands. (line 39) +* loading files: Actions. (line 259) +* loading fonts: Resources. (line 110) +* loading layouts <1>: Resources. (line 93) +* loading layouts: User Commands. (line 33) +* loading symbols: Resources. (line 110) +* loading, an example: Loading and Saving. (line 6) +* log window <1>: Resources. (line 244) +* log window: Log Window. (line 6) +* m4: Resources. (line 74) +* m4, preprocessing example files: Elements. (line 19) +* mark: Actions. (line 269) +* Measuring distances: Measuring distances. (line 6) +* media: Resources. (line 195) +* media margin: Resources. (line 195) +* media, size of: Printing. (line 59) +* menus: Menu. (line 6) +* merging layouts: User Commands. (line 45) +* messages <1>: Resources. (line 244) +* messages: Log Window. (line 6) +* mirroring printout: Printing. (line 28) +* mode selection: Tool Selectors. (line 6) +* mode, selecting of: Actions. (line 277) +* mounting holes: Actions. (line 101) +* move: Resources. (line 274) +* move an object: Translations. (line 40) +* moving objects: Arrow Tool. (line 6) +* moving objects to current layer: Actions. (line 340) +* moving, an example: Moving and Copying. (line 6) +* moving, traces to a different layer: Moving and Copying. (line 20) +* multi-file: Postscript Export. (line 51) +* name of an element: Actions. (line 199) +* name, change an objects: Actions. (line 107) +* namelength of pins: Resources. (line 217) +* nelma: nelma. (line 6) +* NetBSD: BSD. (line 6) +* netlist <1>: Actions. (line 27) +* netlist <2>: Resources. (line 248) +* netlist <3>: Rats Nest. (line 6) +* netlist: Net Objects. (line 6) +* Netlist Window: Netlist Window. (line 6) +* netlist, file format: Netlist File. (line 6) +* netlist, reading: Netlist File. (line 6) +* object report: Menu. (line 143) +* object, change name of: Actions. (line 107) +* object, changing the size of an: Common. (line 6) +* object, copy an: Translations. (line 40) +* object, creating an: Common. (line 6) +* object, drawing and removing: Drawing and Removing. + (line 6) +* object, move an: Translations. (line 40) +* object, removing an <1>: Translations. (line 11) +* object, removing an: Common. (line 6) +* objects, moving to current layer: Actions. (line 340) +* octagonal flag, changing: Actions. (line 93) +* octagonal flag, clearing: Actions. (line 154) +* octagonal flag, setting: Actions. (line 471) +* octagonal pins and vias: Actions. (line 117) +* off limit color: Resources. (line 203) +* offset of pinnames: Resources. (line 228) +* offset of pinout: Resources. (line 222) +* offset of printout: Printing. (line 75) +* old library: Element Objects. (line 74) +* only-visible: Encapsulated Postscript Export. + (line 19) +* OpenWindows: Sun. (line 6) +* operation modes, selecting of: Actions. (line 277) +* optimizer: Trace Optimizer. (line 6) +* outline printout: Printing. (line 36) +* output device: Printing. (line 21) +* overlap, minimum: Design Rule Checking. + (line 6) +* pad specification: Pad and Line Representation. + (line 6) +* pastebuffer, an example: Pastebuffer. (line 6) +* pastebuffer, convert contents to element: Elements. (line 59) +* pastebuffer, popup menu: Menu. (line 109) +* pastebuffer, selecting a: Actions. (line 355) +* path for element files: Resources. (line 85) +* path for font files: Resources. (line 124) +* path for layout files: Resources. (line 102) +* path for libraries: Resources. (line 184) +* PC UNIX <1>: BSD. (line 6) +* PC UNIX <2>: Linux. (line 6) +* PC UNIX: SCO. (line 6) +* PCB, an overview: Overview. (line 6) +* photo-mode: PNG Options. (line 45) +* pin color: Resources. (line 208) +* pin, name of: Resources. (line 217) +* pin/pad names, changing: Actions. (line 123) +* pinout, display of: Actions. (line 199) +* pinout, font to display pin names: Resources. (line 213) +* pinout, zoomfactor of display: Resources. (line 234) +* pins, an example: Elements. (line 41) +* pins, changing shape of: Actions. (line 117) +* png: png. (line 6) +* pointer, moving of: Actions. (line 326) +* polygon: Resources. (line 307) +* polygon point, go back to previous: Actions. (line 382) +* polygon, an example: Polygons. (line 6) +* polygon, an overview: Polygon Objects. (line 6) +* polygon, closing a: Actions. (line 382) +* popping up menus: Menu. (line 6) +* postprocessing layout data: Resources. (line 278) +* postscript: ps. (line 6) +* preprocessing element data: Resources. (line 74) +* preprocessing font data: Resources. (line 110) +* preprocessing layout data: Resources. (line 93) +* preventing loss of data <1>: Resources. (line 285) +* preventing loss of data: Loading and Saving. (line 18) +* print command: Printing. (line 84) +* print media <1>: Resources. (line 195) +* print media: Printing. (line 59) +* print offset: Printing. (line 75) +* printing: Resources. (line 239) +* printing a layout: Actions. (line 392) +* printing, an example: Printing. (line 6) +* problems: problems. (line 6) +* ps: ps. (line 6) +* ps-bloat: Postscript Export. (line 31) +* ps-invert: Postscript Export. (line 34) +* psfade: Postscript Export. (line 44) +* quit <1>: Actions. (line 412) +* quit: User Commands. (line 51) +* rat's nest: User Commands. (line 61) +* rat-line <1>: Actions. (line 27) +* rat-line: Rats Nest. (line 6) +* rats nest <1>: Actions. (line 27) +* rats nest <2>: Resources. (line 248) +* rats nest: Rats Nest. (line 6) +* rats-nest: Net Objects. (line 6) +* recover: Actions. (line 416) +* rectangle, an example: Polygons. (line 6) +* redo <1>: Actions. (line 416) +* redo: Menu. (line 40) +* redrawing layout: Actions. (line 199) +* refreshing layout: Actions. (line 199) +* Regular Expressions: Regular Expressions. (line 6) +* removing connections: Translations. (line 11) +* removing objects <1>: Translations. (line 11) +* removing objects <2>: Common. (line 6) +* removing objects: Drawing and Removing. + (line 6) +* removing selected objects: Actions. (line 430) +* report <1>: Actions. (line 434) +* report: Menu. (line 143) +* reseting found connections <1>: Actions. (line 167) +* reseting found connections: Resources. (line 255) +* resources: Resources. (line 6) +* rotate: Resources. (line 274) +* rotating a buffer: Actions. (line 355) +* rotating printout: Printing. (line 24) +* routing style <1>: Actions. (line 440) +* routing style: Resources. (line 267) +* rubber band: Menu. (line 79) +* rubberband <1>: Actions. (line 199) +* rubberband: Resources. (line 274) +* saving connections: Actions. (line 450) +* saving files: Actions. (line 450) +* saving found connections: Actions. (line 167) +* saving last entered user command: Resources. (line 294) +* saving layouts <1>: Resources. (line 278) +* saving layouts <2>: User Commands. (line 55) +* saving layouts: Loading and Saving. (line 18) +* saving, an example: Loading and Saving. (line 6) +* scaling a printout: Printing. (line 55) +* scanning connections: Actions. (line 167) +* schematic capture: Schematic Frontends. (line 6) +* schematic frontend: Schematic Frontends. (line 6) +* SCO: SCO. (line 6) +* Screen, popup menu: Menu. (line 49) +* script file, executing: Actions. (line 238) +* scrolling: Translations. (line 21) +* searching connections: Actions. (line 167) +* Searching for elements: Searching for elements. + (line 6) +* searchpath for element files: Resources. (line 85) +* searchpath for font files: Resources. (line 124) +* searchpath for layout files: Resources. (line 102) +* searchpath for libraries: Resources. (line 184) +* Select, popup menu: Menu. (line 98) +* selected object, removing an: Actions. (line 430) +* selected objects, changing sizes: Menu. (line 98) +* selected objects, removing: Menu. (line 98) +* selecting a buffer: Actions. (line 355) +* selecting a new tool: Tool Selectors. (line 6) +* selecting objects: Actions. (line 459) +* selecting, using the arrow tool: Arrow Tool. (line 6) +* selection: Actions. (line 459) +* Settings, popup menu: Menu. (line 79) +* SGI: SGI. (line 6) +* show-legend: Postscript Export. (line 64) +* shrink: Resources. (line 299) +* signal: Actions. (line 68) +* Silicon Graphics: SGI. (line 6) +* size of lines: Resources. (line 189) +* size of lines and vias: Actions. (line 440) +* size of vias: Resources. (line 330) +* sizes, changing of objects: Actions. (line 72) +* Sizes, popup menu: Menu. (line 68) +* snap to pins: Menu. (line 79) +* Solaris: Sun. (line 6) +* solder mask, viewing and editing: Menu. (line 58) +* spacing, minimum: Design Rule Checking. + (line 6) +* speaker volume: Resources. (line 338) +* square flag, changing: Actions. (line 93) +* square flag, changing of objects: Actions. (line 148) +* square flag, clearing: Actions. (line 154) +* square flag, setting: Actions. (line 471) +* standard drill sizes: Standard Drill Sizes. + (line 6) +* start user input: Actions. (line 160) +* starting a new layout: Actions. (line 350) +* starting Pcb: Command-Line Options. + (line 6) +* status information: Status-line and Input-field. + (line 6) +* strings, an example: Text. (line 6) +* strings, an overview: Text Objects. (line 6) +* Sun: Sun. (line 6) +* symbols: Resources. (line 118) +* symbols, an overview: Symbol Objects. (line 6) +* Syntax, file: File Syntax. (line 6) +* temporary files <1>: Resources. (line 285) +* temporary files: Loading and Saving. (line 18) +* terminology: Glossary. (line 6) +* TeX, problems: TeX and Manuals. (line 6) +* text, an example: Text. (line 6) +* text, an overview: Text Objects. (line 6) +* text, default scaling: Resources. (line 313) +* thermal flag, changing: Actions. (line 93) +* thermal flag, clearing: Actions. (line 154) +* thermal flag, setting: Actions. (line 471) +* thickness of lines: Resources. (line 189) +* thickness of objects: Common. (line 6) +* thickness of vias: Resources. (line 330) +* thickness, changing of objects: Actions. (line 129) +* toggle layer visibility: Actions. (line 521) +* tool selection: Tool Selectors. (line 6) +* tool, arrow: Arrow Tool. (line 6) +* trace optimizer: Trace Optimizer. (line 6) +* translations <1>: Translations. (line 6) +* translations: Actions. (line 6) +* troubleshooting: problems. (line 6) +* two line mode: Line Objects. (line 14) +* undo <1>: Actions. (line 528) +* undo: Menu. (line 40) +* undo, multi-action resources: Actions. (line 58) +* unique names: Menu. (line 79) +* unix command: Resources. (line 74) +* unselect objects: Actions. (line 543) +* user commands: User Commands. (line 6) +* user input: Translations. (line 33) +* vendor drill table <1>: UnloadVendor Action. (line 10) +* vendor drill table <2>: ToggleVendor Action. (line 10) +* vendor drill table <3>: LoadVendorFrom Action. + (line 10) +* vendor drill table <4>: EnableVendor Action. (line 10) +* vendor drill table <5>: DisableVendor Action. + (line 10) +* vendor drill table <6>: ApplyVendor Action. (line 8) +* vendor drill table: Actions. (line 54) +* Vendor drill table: Vendor drill mapping. + (line 6) +* vendor drill table, disabling: Actions. (line 188) +* vendor drill table, enabling: Actions. (line 254) +* vendor drill table, loading: Actions. (line 265) +* vendor drill table, toggling: Actions. (line 516) +* vendor drill table, unloading: Actions. (line 539) +* vendor map <1>: UnloadVendor Action. (line 10) +* vendor map <2>: ToggleVendor Action. (line 10) +* vendor map <3>: LoadVendorFrom Action. + (line 10) +* vendor map <4>: EnableVendor Action. (line 10) +* vendor map <5>: DisableVendor Action. + (line 10) +* vendor map <6>: ApplyVendor Action. (line 8) +* vendor map: Actions. (line 54) +* vendor map, disabling: Actions. (line 188) +* vendor map, enabling: Actions. (line 254) +* vendor map, loading: Actions. (line 265) +* vendor map, toggling: Actions. (line 516) +* vendor map, unloading: Actions. (line 539) +* Vendor mapping: Vendor drill mapping. + (line 6) +* Vendor rules: Vendor drill mapping. + (line 6) +* vias, an example: Vias. (line 6) +* vias, an overview: Via Objects. (line 6) +* vias, changing shape of: Actions. (line 117) +* vias, color: Resources. (line 324) +* vias, converting to mounting hole: Actions. (line 101) +* vias, setting of initial size: Actions. (line 477) +* vias, size: Resources. (line 330) +* viewing side, changing of: Actions. (line 499) +* volume of speaker: Resources. (line 338) +* Window, popup menu: Menu. (line 151) +* x-y file format: Centroid File Format. + (line 6) +* x-y file, algorithms: Centroid File Format. + (line 37) +* X11: X11 Interface. (line 6) +* X11 default translations: Translations. (line 6) +* X11 resources: Resources. (line 6) +* X11 translations: Actions. (line 6) +* X11, problems: X11. (line 6) +* xcircuit, how to interface with: xcircuit. (line 6) +* zoom of Layout area: Resources. (line 347) +* zoom of pinout window: Resources. (line 234) +* zoom, setting: Menu. (line 49) +* zoom, setting of: Actions. (line 477) + + Index: 1.0.8/doc-orig/pcb.pdf =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-orig/pcb.pdf =================================================================== --- 1.0.8/doc-orig/pcb.pdf (nonexistent) +++ 1.0.8/doc-orig/pcb.pdf (revision 1136) Property changes on: 1.0.8/doc-orig/pcb.pdf ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-orig/pcb.texi =================================================================== --- 1.0.8/doc-orig/pcb.texi (nonexistent) +++ 1.0.8/doc-orig/pcb.texi (revision 1136) @@ -0,0 +1,5829 @@ +\input texinfo @c -*-texinfo-*- +@comment RCS: $Id$ +@comment %**start of header +@setfilename pcb.info +@settitle Pcb +@setcontentsaftertitlepage +@macro pcb{} +@code{Pcb} +@end macro +@comment %**end of header + +@include version.texi + +@ifinfo +@format +INFO-DIR-SECTION Miscellaneous +START-INFO-DIR-ENTRY +* pcb: (pcb). An interactive printed circuit board editor. +END-INFO-DIR-ENTRY +@end format +@end ifinfo + +@iftex +@finalout +@end iftex + +@ifinfo +This file documents how to use Pcb, +the open source, interactive printed circuit board layout system. + +Copyright (C) 1994,1995,1996, 2004 Thomas Nau + +Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 harry eaton + +Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009 Dan McMahill + +Copyright (C) 2004 DJ Delorie + +This program is free software; you may 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 +MERCHANT-ABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +@b{GNU General Public License} for more details. + +@end ifinfo + +@setchapternewpage on +@headings single + +@titlepage +@title Pcb-@value{VERSION} +@subtitle an open source, interactive +@subtitle printed circuit board +@subtitle layout system +@author harry eaton +@end titlepage + +@ifnottex +@node Top +@top Pcb + +This document is a manual for @pcb{}, the open source, interactive printed circuit +board layout system. +@end ifnottex + +@menu +* Copying:: @pcb{} is freely redistributable! +* History:: How it all began. +* Overview:: An overview of @pcb{}. +* Intro:: A short description of the basic objects. +* Getting Started:: Introduction to @pcb{}. +* Autorouter:: Using the autorouter. +* User Commands:: User commands of @pcb{}. +* Command-Line Options:: Calling @pcb{} from a shell. +* X11 Interface:: Action routines, resources and default translation. +* File Formats:: Description of @code{ASCII} files used by @pcb{}. +* Library Creation:: Detailed description of symbol library creation. +* Schematic Frontends:: Schematic capture programs that work with PCB. +* Installation:: Compiling, installing and troubleshooting. +* Custom Menus:: Customizing the menu bar. +* Regular Expressions:: Searching for elements with regular expressions +* Standard Drill Sizes:: Tables of standard drill sizes +* Centroid File Format:: Details of the centroid (x-y) output file +* Action Reference:: Documentation for all available actions +* Glossary:: Glossary +* Index:: The Index. +@end menu + +@c --------------------------------------------------------------------- +@node Copying +@unnumbered Copying + +Copyright @copyright{} 1994,1995,1996,1997 Thomas Nau + +Copyright @copyright{} 1998,1999,2000,2001,2002 harry eaton + +This program is free software; you may 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 +MERCHANT-ABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +@b{GNU General Public License} for more details. + + +@c --------------------------- chapter 0 ------------------------------- +@node History +@unnumbered History + +@cindex Atari version +@pcb{} is a handy tool for laying out printed circuit +boards. + +@pcb{} was first written by Thomas Nau for an Atari ST in 1990 and +ported to @code{UNIX} and @code{X11} in 1994. +It was not intended as a professional layout system, +but as a tool which supports people who do some +home-developing of hardware. + +The second release 1.2 included menus for the first time. This made +@pcb{} easier to use and thus a more important tool. + +Release 1.3 introduced undo for highly-destructive commands, +more straightforward action handling and scalable fonts. Layer-groups +were introduced to group signal-layers together. + +Release 1.4 provided support for add-on device drivers. +Two layers (the solder and the component side) +were added to support SMD elements. The handling of libraries +was also improved in 1.4.1. Support for additional devices like +GERBER plotters started in 1.4.4. The undo feature was expanded +and the redo-feature added in 1.4.5. + +harry eaton took over pcb development beginning with Release 1.5, +although he contributed some code beginning with Release 1.4.3 + +Release 1.5 provides support for rats-nest generation from simple net +lists. It also allows for automatic clearances around pins that pierce +a polygon. A variety of other enhancements including a Gerber RS-274X +driver and NC drill file generation have also been added. + +Release 1.6 provides automatic screen updates of changed regions. +This should eliminate most of the need for the redraw ((@emph{R} key). +Also some changes to what order items under the cursor are selected +were made for better consistency - it is no longer possible to +accidentally move a line or line point that is completely obscured +by a polygon laying over top of it. Larger objects on the upper +most layers can be selected ahead of smaller objects on lower layers. +These changes make operations more intuitive. A new mode of line +creation was added that creates two line on 45 degree angles +with a single click. The actual outline of the prospective line(s) are +now shown during line creation. An arc creation mode was added. +Drawn arcs are quarter circles and can be useful for high frequency +controlled impedance lines. (You can have eighth circle arc if the +source is compiled with -DARC45, but be aware that the ends of such +arcs can never intersect a grid point). Two new flags for pins and +vias were created - one indicates that the pin or via is purely a +drill hole and has no copper annulus. You can only toggle this flag +for vias - for elements, it must be an integral part of the element +definition. The other flag controls whether the pad will be round +or octagonal. There is also now a feature for converting the contents +of a buffer into an element. + +Release 1.6.1 added the ability to make groups of action commands bound to +a single X11 event to be undone by a single undo. Also a simple design rule +checker was added - it checks for minimum spacing and overlap rules. Plus +many fixes for bugs introduced with the many changes of 1.6 + +Release 1.7 added support for routing tracks through polygons without touching +them. It also added support for unplated drill files, and drawing directly +on the silk layer. A Netlist window for easily working with netlist was also added. + +Release 2.0 adds an auto-router, a new simpler library mechanism, much improved +support for graphically creating (and editing) elements, viewable solder-mask +layers (and editing), snap to pins and pads, netlist entry by drawing rats, element +files (and libraries) that can contain whole sub-layouts, metric grids, improved +user interface, a GNU autoconf/automake based build system, and a host +of other improvements. + +Special thanks goes to: +@display +Thomas Nau (who started the project and wrote the early versions). +C. Scott Ananian (who wrote the auto-router code). +Bernhard Daeubler (Bernhard.Daeubler@@physik.uni-ulm.de) +Harald Daeubler (Harald.Daeubler@@physik.uni-ulm.de) +DJ Delorie (djdelorie@@users.sourceforge.net) +Larry Doolittle (ldoolitt@@recycle.lbl.gov) +Dan McMahill (danmc@@users.sourceforge.net) +Roland Merk (merk@@faw.uni-ulm.de) +Erland Unruh (Erland.Unruh@@malmo.trab.se) +Albert John FitzPatrick III (ajf_nylorac@@acm.org) +Boerge Strand (borges@@ifi.uio.no) +Andre M. Hedrick (hedrick@@Astro.Dyer.Vanderbilt.Edu) +@end display + +@noindent +who provided all sorts of help including porting @pcb{} to +several operating systems and platforms, bug fixes, library enhancement, +user interface suggestions and more. In addition to these people, +many others donated time for bug-fixing and +other important work. Some of them can be identified in the source code +files. Thanks to all of them. If you feel left out of this list, I +apologize; please send me an e-mail and I'll try to correct the omission. + + +@c --------------------------- overview chapter ------------------------------- +@node Overview +@chapter Overview +@cindex PCB, an overview + +@pcb{} is an open source printed circuit board editor. +@pcb{} includes many professional features such as: +@itemize @bullet +@item Up to 16 copper layer designs by default. By changing a compile time setting, this +can be set as high as needed. +@item RS-274X (Gerber) output +@item NC Drill output +@item Centroid (X-Y) data output +@item Postscript and Encapsulated Postscript output +@item Autorouter +@item Trace optimizer +@item Rats nest +@item Design Rule Checker (DRC) +@item Connectivity verification +@item @pcb{} is Free Software +@item Can interoperate with free schematic capture tools such as gEDA and + xcircuit +@item Runs under Linux, NetBSD, Solaris, and other similar operating +systems. +@item Windows version is available +@end itemize + +@c --------------------------- chapter 1 ------------------------------- +@node Intro +@chapter Introduction +@cindex layout objects, an overview + +Each layout consists of several, mostly independent, objects. This chapter +gives an overview of the object types and their relationship to each other. +For a complete description of how to use @pcb{}, refer to +@ref{Getting Started}. +The layout is generated on-screen on a grid that can have its origin +at any desired location. +The X coordinate increases to the right, Y increases down to the bottom. +All distances and sizes in @pcb{} are measured in mils +(0.001 inch). One unit on the coordinate display is one mil in +distance on the board. +The grid may be set on a metric pitch, but is only correct to within +the nearest +/- 0.01 mil because @pcb{} stores all dimensions as +integer multiples of 1/100 of a mil or 0.00001 inch. + +The sections in this chapter are sorted by the +order of appearance of the objects within a layout file. + +@menu +* Symbol Objects:: Information about fonts and symbols. +* Via Objects:: Vias and pins connect layers. +* Element Objects:: Element, the basic type of circuits. +* Layer Objects:: A @samp{container} for lines, text... +* Line Objects:: Tracks on the board +* Arc Objects:: Curved tracks +* Polygon Objects:: Planes and such +* Text Objects:: Objects to add symbols to your board. +* Net Objects:: Describes the desired connections on the board. +@end menu + +@node Symbol Objects +@section Symbols +@cindex symbols, an overview +@cindex font, an overview + +The top object is the layout itself. It uses a set of symbols +that resides at the first logical level. Each symbol is uniquely identified +by a seven bit @code{ASCII} code. All layout objects share the same set of +symbols. These symbols are used to form text objects on the silkscreen +and copper layers. Undefined symbols are drawn as filled rectangles. + +Every font file is preprocessed by a user-defined command when it is loaded. +For details see @samp{fontCommand}, @ref{Resources}. + + +@node Via Objects +@section Vias +@cindex vias, an overview + +Vias provide through-hole connectivity across all layers. +While vias look a lot like element pins, don't use vias +for adding elements to the layout, even if that seems +easier than creating a new element. The default solder-mask +will cover over vias, so you won't be able to solder to them. +Of course, you can change this so that vias also have +solder-mask cut-outs, but it is not the default. +Vias are also useful for defining arbitrary drill points such as +those used for mounting a board. Vias used in this way have +a special flag set so that they have no annular copper ring, +and also appear in the unplated drill file. @emph{Ctrl-H} key over +a via switches it between being a pure-mounting hole and a regular via. +You can assign a name to a via, which is useful during the creation +of new element definitions. +Each via exists on all copper layers. (@emph{i.e.} +blind and buried vias are not supported) + + +@node Element Objects +@section Elements +@cindex element, an overview +@cindex layout-name + +Elements represent the components on a board. +Elements are loaded from @code{ASCII} coded files in a +similar manner to the layout file itself, or from the +library selector window. +An element is composed of lines and arcs on the silk-screen +layer (used to define the package outline), pins +(or pads for SMD) and three labels that define the +description, the element's layout-name (which also +appears on the silk-screen layer) and its value. You +can choose which of the names are displayed on the screen +with the @b{Screen} menu; however, the silk screen in +the printout will always show the layout-name. +Element pins are contained on the first logical level +and so reside on all layers, but the pads of surface-mount +elements reside on only the component or solder +layers. An element can have a mixture of pins, pads +(on one or both sides), and mounting holes. + +A mark is used to position the element with +respect to the cross hair during pasting. +The mark will lie on a grid point when the element +is positioned. The mark is drawn as a small diamond +shape, but is only visible when @emph{both} the @code{silk} +and @code{pins/pads} layers are visible. +All parts of an element are treated as one unit, except for +the name. +It is not possible to delete a single pin or move +only part of an element on the layout. +You can resize separate pieces of an element, +but doing so is usually a bad idea. You can move/rotate +the element name independently of the element it belongs +to. When you move an element name, a line is draw from +the cursor to the element mark so it is easy to tell +which element the name belongs to. + + +Each pin and pad has two string identifiers, one is the +"name" which is a functional description of the pin +(@emph{e.g.} "clock in") and the other is the "number" of the +pin which is used to identify it in a netlist. The "number" +is usually an integer, but it can be any string. You +can edit the "name" of each pin of an element, but the +"number" is embedded in the element definition and is +determined when the new element is first created. +Pads are similar to lines on a layer but they must be oriented +either vertically or horizontally. +Pads can have either rounded or square ends. Pins +can be round, square, or octagonal. + + +Elements are supported by several special layers: @code{silk}, @code{pins/pads} and +@code{far-side}. The @code{silk} layer shows the package outline and +also holds legend text and element names. The @code{pins/pads} layer is used to toggle +whether the element's pins and pads are displayed. The @code{far-side} layer controls visibility +of objects (silkscreen and pads) that are on the far (@emph{i.e.} not currently viewed) side +of the board. + +The ``oldlib'' style of footprint libraries distributed with +@pcb{} rely upon the M4 macro processor. M4 is typically +installed under the name @code{m4} on most unix-like operating +systems. It is recommended that you use the GNU version of M4 to +avoid limitations found in some vendor implementations. See the m4 +man page on your system for more information. +Every element file is preprocessed by a user-defined command when the file is read. +For details see @samp{elementCommand}, @ref{Resources}. @code{m4}, the default +value of @samp{elementCommand}, allows you to create libraries for +package definitions that are shared by all elements. +The old element libraries distributed with @pcb{} expect @code{m4} or an +equivalent to be the @emph{elementCommand}. The new library scheme simply has +each element stored in a self-contained file, so there is no need to learn +@code{m4} to add to the libraries. + +@pcb{} can create a list of +all connections from one (or all) elements to the others or a list of +unconnected pins. +It can also verify the layout connections against a netlist file. +The element's @samp{layout-name} is the name used to identify the element +in a netlist file (see @ref{Netlist File}). + +The old libraries, or very old (pre-1.6) layout files may have +incorrect pin numbering since there was no concept of pin numbers +when they were created. @pcb{} uses the order of appearance of +the pin definitions in the layout or library file if it uses the +old format, but there is no guarantee that it will be correct for +these old objects. + +@cindex old library +@cindex library accuracy +@b{Be aware that a few of the old library parts may still be incorrectly +implemented regarding pin-numbering.} All of the DIL (Dual- +Inline-Pins) parts are correct and most of the others are too, +but you should verify the pin numbering +of any non-DIL part before using an old library part. +(use the @samp{generate object report} in the @b{Info} menu +to see what @pcb{} thinks a pin's number is) +All of the old +library names begin with a ~, so you can easily identify them. +The old libraries also @emph{may} contain other sorts of errors, +including incorrect pin spacing, silkscreen overlapping solder areas, etc. +@b{Check carefully any element in the old library before using it!} +As the new library grows, the old library will be pared down to +at least remove all of the elements with errors, but this will +take time. + +You can make your own element definitions graphically now. +Simply draw vias for the pins, lines on the solder and/or +component layers for surface-mount pads (they must be either horizontal +or vertical), +and lines and arcs on the silkscreen layer for the silkscreen +outline. You should @emph{name} (@emph{N} key) each via and copper line with the pin @emph{number}. +Once you are happy with the geometry, select everything that is to become part of +the element, then choose @samp{convert selection to element} from the @b{Select} menu. +Afterwords you can make pin (or pad) one +square if you like, and give the element its various names. You can also give +the pins and pads their functional names. Note that the +element mark corresponds to the position you click after choosing the +conversion from the menu, so decide where the mark goes and make +sure it falls on a grid point before you request the conversion. +If the vias/lines are not named, then the pin numbering will correspond to the +order in which they were placed. + +When you create a new element, remember that silkscreen lines +should @emph{never} overlap the copper part of the +pins or pads, as this can interfere with soldering. The silkscreen +should identify the maximum extent of the element package so it +is easy to see how close elements can be placed together. + +If you want to make an element similar to an existing one, you can +break an element into constituent pieces from the @b{Buffer} menu. +Paste the pieces to the layout, make the necessary changes, then +convert it back into an element. If the pin numbers haven't changed, +there is no need to name each via/line as they are pre-named when +the element was broken apart. When you create a new element, you +can save it to a file in order to have easy access to it the next +time you run @pcb{}. + + +@node Layer Objects +@section Layers +@cindex layers, an overview + +Every layout consists of several layers that can be used independently +or treated as a group. +Layer groups can be used to logically separate (and color-code) +different traces (@emph{e.g.} power and signal); however, all +layers within a group reside on the same physical +copper layer of a board, so using different layers within the same +group won't provide electrical separation where they touch or overlap. +For details, see @samp{layerGroups}, @ref{Resources}. +Each layer is drawn in a color defined in the resource file +and identified by a name that you can change (for details +see @samp{layerColor}, @ref{Resources}.) +Layers are really just containers for line, arc, polygon, and text objects. The +component and solder layers contain SMD elements as well, but the +file structure doesn't reflect that fact directly. + +@cindex layer groups +Each layer group +represents a physical layer on the printed circuit board. If you want to make +a four layer board, you'll need to have at least four layer groups. +Connections between layer groups are established only through element pins and vias. +The relationship between a specific layer and the board itself is configurable from +the @samp{Edit layer groups} option in the @b{Settings} menu. +The layer groups corresponding to the physical layers: @emph{component-side} +and @emph{solder-side} are always defined and you must map at least one +logical layer to each, even if you plan to make a single-sided board. +You are not obligated to put tracks on either of them. +Surface mount elements always reside on either the component-side or the +solder-side layer group. When you paste an element from the buffer, +it will go onto whichever side of the board you are viewing. +You can swap which side of the board you are viewing by pressing +the @emph{Tab} key, or by selecting @samp{view solder side} from the +@b{Screen} menu. +The layer groups just have a name or number associated with them - where +they are sandwiched in the board is left for you to tell the +manufacturer. + +The silkscreen layer is special because there are actually two silkscreen +layers, one for the top (component) and one for the bottom (solder) side +of the board. Which silk layer you draw on is determined by the side of the +board that you are viewing. If you are viewing the component side, then +drawing on the silk layer draws to the component-side silk layer. + +The netlist layer is another special layer. It shows rat's-nest lines +(@emph{i.e.} guides that show how the netlist expects the element to interconnect). +If you make this the active layer, you can use the Line tool to add +entries into the netlist, or to delete connections from the netlist +window. Except for these two purposes, you should not +make the netlist layer the active layer. Usually there is no need to +do this because a separate schematic package should be used to create the +netlist. @pcb{} can automatically draw all of the rats from +the netlist. In some cases you may want to make a small change without +going to the trouble of modifying the schematic, which is why this +facility is provided. + + +@node Line Objects +@section Lines +@cindex lines, an overview + +Lines are used to draw tracks on the pc board. +When in the line mode, each @emph{Btn1} +press establishes one end of a line. +Once the second point is defined, the line is drawn +and a new line started where the first one ended. +You can abandon the new starting point in favor +of another by pressing @emph{Ctrl-Btn1}, or +@emph{Btn3}, but don't use @emph{Btn2}. +The undo function (@emph{U} key or @samp{undo last operation} +from the @b{Edit} menu) will take you back +point by point if you use it while in the line mode. + +@cindex two line mode +New lines can be restricted to 45 degree angles if desired. You can toggle this +restriction on and off while creating lines by pressing the @emph{period} key. +If the 45 degree restriction is turned on, then the @emph{/} (forward slash) key +can be used to cycle through three different modes of 45 degree line creation. +One mode just creates a single line forced to the nearest 45 degree vector. The next +mode creates two lines from the start to end points such that the first line leaves the +start point at a 90 degree vector, and the second line enters the end point on a 45 +degree vector. The last mode creates two lines such that the first line leaves the +start point on a 45 degree vector and arrives at the end point on a 90 degree vector. +You can temporarily swap between the last two modes by holding the @emph{Shift} key down. + +It is simple to edit a line object by breaking it into pieces (insert point mode), +moving an end point or the whole line (@emph{Arrow tool}), +or changing the layer it resides on (@emph{M} key moves the line under the pointer +to the active layer). +In the case when two line segments meet at exactly the same +point you can delete the intermediate point, otherwise the delete tool removes an entire line. +Feel free to experiment +since @pcb{} will allow you to undo and redo anything that materially affects your work. +If you switch active layers in the midst of placing lines a via will automatically be +placed, when necessary, in order to continue the connection. + +@cindex clearance +If you draw a line inside a polygon, it will either plow through the +polygon creating a clearance, or touch the polygon. This behavior is +selectable in the @b{Settings} menu for new lines. To change the +behavior of an existing line, hit the @emph{J} key with the cross hair +over the line. You can increase the size of the clearance by 2 mils on +each edge with the with the +@emph{K} key. @emph{Shift-K} will decrease the clearance by 2 mils. +The increment may be changed from 2 mils through the application +resource file. +The clearance can be also increased, decreased and set +by the @emph{ChangeClearSize} action. + +Lines do not need to intersect the center of a pin, pad, via, or other +line for @pcb{} to understand that they make electrical connection. +If the connection is too tenuous, running the design rule checker will report +that the connection may break if the line width shrinks slightly. + + +@node Arc Objects +@section Arcs +@cindex arc + +@pcb{} can handle arcs of any angular extent, but when you +create an arc with the Arc tool, it will +be a quarter circle (this means they always bend a right angle). Arcs are very similar +to lines otherwise. They are created on the active layer and have the same thickness +that new lines will have. The various clicks for creating lines work pretty much the +same way for creating arcs. +In order to make the arc curve in the desired direction, drag the mouse along +the tangent line from the starting position towards the end position. If the grid is +too coarse, it may not be possible to distinguish whether you've moved over then up, +or up then over, so if you can't seem to make the arc go in the direction you want, try pressing +the @emph{Shift} key while drawing the arc. Decreasing the grid spacing may also help. +Alternatively you can draw the wrong arc, then +rotate and move it where you want. Like the Line tool, after an arc is drawn a new +starting point is established at the end point. + +Whenever a starting point is established +by either the Line or Arc tools it will be retained if you switch directly between the +tools (e.g. @emph{F2} key for Lines, @emph{F8} key for Arcs. Arcs can either touch or +clear polygons just like lines do. Of course connection +searches, undo and all the other features you'd expect work with arcs too. + + +@node Polygon Objects +@section Polygons +@cindex polygon, an overview + +Sometimes it's useful to fill large areas with solid copper. +The way to do this is with polygons. +Polygons can be created in either the polygon mode or the rectangle mode. +In the polygon mode, you'll have to define each corner of the polygon +with a mouse click (@emph{Btn1}). When the last point is clicked +exactly on top of the starting point, the polygon is finished. +Since this can be hard to do, the @emph{Shift-P} key will enter the +final point for you, closing the polygon. +If the 45 degree angle restriction is turned on +and you try to close the polygon when it is not possible, you'll get a +warning instead. If you haven't finished entering a polygon, but want to +undo one (or more) of the points that you've already defined, use the +undo command (@emph{U} key). + +With the rectangle tool, defining +the two diagonally opposite corners is sufficient, but of course the resulting +polygon is a rectangle. +Like lines, a polygon can by edited by deleting, inserting and moving the points +that define it. Pins and vias @emph{always} clear through polygons without +touching them when first positioned. You must add a thermal with the thermal +tool in order to connect pins and vias to polygons. Thermals can be added and removed by +clicking @emph{Btn1} with the thermal tool over the pin or via. +The thermal tool always +places a thermal to polygons on the active layer, so if the tool doesn't +seem to work, it's probably because the polygon you want to touch is not +on the active layer. You can change the style of thermal used or make +a solid connection by holding down @emph{Shift} while clicking +@emph{Btn1} with the thermal tool over the pin or via. + +@pcb{} is capable of handling complex polygons, but +using a number of simpler ones improves performance of the connection tracing code. +You also must be careful not to create polygons that touch or overlap themselves. +The fabricated board may not look the way you expect if you violate this +principle. It is always ok to have two (or more) polygons touch or overlap +each other, but not for points within the same polygon to do so. + +The great advantage to this new polygon behavior is that simple or complex ground +and/or power planes can be easily made with polygons and seen on the screen. +If you don't want this auto-clearance behavior, or you load a layout created by +an early version of @pcb{}, the old behavior +(shorts to all piercing pins and vias) is available. A @samp{ChangeSize} +operation (@emph{S} key) toggles a polygon between the new and old polygon/pin +behavior. + + +@node Text Objects +@section Text +@cindex text, an overview +@cindex strings, an overview + +Text objects should be used to label a layout or to put additional +information on the board. Elements have their @samp{layout-name} labels on the +silk-screen layer. If you are making a board without a silkscreen, +you can use copper text to label the elements, but you have to do +this manually. + +Text is always horizontal when first created, but the +rotate mode can align it along 0, 90, 180 and 270 degree angles. +Text on the far side of the board will automatically appear mirror-imaged. + +@emph{Warning:} @b{TEXT OBJECTS ON A COPPER LAYER CREATE COPPER LINES BUT THEY ARE NOT SCANNED FOR +CONNECTIONS OR TESTED FOR CREATING SHORTS VS. THE NETLIST. NEITHER ARE TEXT OBJECTS TESTED AGAINST ANY DESIGN RULES}. + + +@node Net Objects +@section Nets +@cindex rats-nest +@cindex netlist + +Layout files also contain the netlist that describes how the elements +are supposed to be interconnected. This list of connections can be +loaded from a netlist file (see @ref{Netlist File}), or +entered by drawing rat-lines as described +previously. Each net has a name and routing style associated with it. +The net contains a list of all element @emph{layout-name} names and +pin @emph{numbers} that should +be connected to the net. Loading a netlist file will replace all +existing nets with the ones from the file. +The @emph{Netlist} window provides an easy way to +browse through the net list. You can display the rat's-nest by selecting +@samp{optimize rats-nest} from the @b{Connects} menu. If you move or rotate elements, +the rat's-nest will automatically follow the movements, but they won't +necessarily show the shortest paths until you optimize them again. + +@c --------------------------- chapter 2 ------------------------------- +@node Getting Started +@chapter Getting Started +@cindex how to start + +The goal of this chapter is to give you enough information to learn how +@pcb{} works and how to develop your layouts to make the best use of @pcb{}'s +features. All event translations (@emph{i.e.} the buttons and keys you +press) refer to the default application resource file shipped with @pcb{}. +There is probably no need to change this unless your window +manager uses some of the button events itself; however, if you @emph{want} +to customize the behavior of @pcb{} then changing the resource file +is usually the best way to do it. + +Get yourself a printout of this chapter and @emph{User Commands}, if you +haven't already done so, and follow the examples. + +Start @pcb{} (the actual command will use all lower-case letters) +without any additional options. +If you get the error message: + +@display + can't find default font-symbol-file 'default_font' +@end display +@noindent +then the font searchpath or filename in the application resource +file is wrong. Be sure that your @code{m4} program supports search paths. +If not, get @code{GNU m4}. +For other messages, see @ref{problems}. +Another quick-start is provided by @code{pcbtest.sh} in the @file{src} +directory. If some features don't seem to work, try running @code{pcbtest.sh}, +if that works, then @pcb{} hasn't been installed properly. + +@menu +* Application Window:: The elements of the main window. +* Log Window:: The optional logging window +* Library Window:: The circuit selection window +* Netlist Window:: The desired connections window +* Drawing and Removing:: +* Moving and Copying:: +* Loading and Saving:: +* Printing:: Creating Gerber files or postscript files +* Exporting:: Exporting a layout. +* Arrow Tool:: Selecting/Moving objects. +* Rats Nest:: Helps you place and route tracks against a netlist. +* Design Rule Checking:: Check for manufactureability +* Trace Optimizer:: Optimization of layouts +* Searching for elements:: Searching for elements +* Measuring distances:: Measuring distances +* Vendor drill mapping:: Mapping drills to a vendor specified list +* Connection Lists:: How to get a list of all or some connections. +@end menu + + +@node Application Window +@section The Application Window + +The main window consists of five areas: +the menu at the top, the layer control in the upper left, the tool buttons +located below the layer controls, the Layout area to the right of these, and the +status line at the bottom of the window. + +@menu +* Menu:: +* Status-line and Input-field:: What is the program configuration. +* Layer Controls:: Switch layers on/off; change current one. +* Tool Selectors:: Select a layout tool. +* Layout Area:: Where the layout is drawn. +@end menu + +@node Menu +@subsection Menus +@cindex menus +@cindex popping up menus + +The menus are located at the top of the Layout area. Most, but not all, +of their functions are also available from the keyboard. Similarly, some +functions are only achievable through the keyboard or command entry. +Some menu entries such as @samp{center layout} in the @b{Screen} menu require a certain cross hair position. +In this case a prompt message will popup at the bottom of the screen +with wording similar to the following: +@example +move pointer to the appropriate screen position and press a button +@end example +Any mouse button will do the job, whereas any key except the arrow (cursor) keys +will cancel the operation. If it seems like the menu hasn't done what you +expected, check to see if it is waiting for the position click. For details see @ref{Actions}. + +Pressing @emph{Btn3} in the Layout area also pops up a menu with many of the most common operations (except +when you're in the midst of drawing a line or arc). When +a choice in the @emph{Btn3} popup menu needs a cross hair position, it uses the position +where the cross hair was when @emph{Btn3} was pressed. For example, to get detailed +information on an object, place the cross hair over the object, press @emph{Btn3}, then +choose @samp{object report}. If you pop up the @emph{Btn3} menu but don't want to +take any of the actions, click on one of the headers in the menu. + +@table @b + +@cindex File, popup menu +@item File +This menu offers a choice of loading, saving and printing data, saving +connection information to a file or quitting the application. Most +of the entries in the @b{File} menu are self explanatory. +Selecting +@samp{print layout} pops up a printer control dialog. +A selection of several device drivers is available from the printer control +dialog. Presently @emph{PostScript}, @emph{encapsulated PostScript}, +and @emph{GerberX} are supported. The @emph{GerberX} driver produces +all of the files necessary to have the board professionally manufactured. +The connection saving features in the @b{File} menu produce outputs in an +arcane format that is not too useful. They do @emph{not} produce netlist +files. + +@cindex Edit, popup menu +@cindex undo +@cindex redo +@item Edit +The @b{Edit} menu provides the usual cut, copy, paste +which work on selections. To learn how to +create complex selections, see @ref{Arrow Tool}. +The @b{Edit} menu also +provides access to Undo and Redo of the last operation. These +can also be accomplished with the @emph{U} key and @emph{Shift-R} +key. Finally, the @b{Edit} menu allows you to change the names +of: the layout, the active layer, or text objects on the layout. + +@cindex Screen, popup menu +@cindex displaying element names +@cindex element, display names of +@cindex grid, display +@cindex grid, alignment +@cindex zoom, setting +@item Screen +The @b{Screen} menu supports most functions related to +the whole Layout area. There are various entries to change the grid to some popular +values, the zoom factor, and which kind of element name is displayed. +You can also re-align the grid origin and turn on and off the display +of the grid. +Before changing the grid alignment, I recommend that you zoom in as close as +possible so that you're sure the grid +points appear exactly where you want them. + +@cindex solder mask, viewing and editing +The @b{Screen} menu also allows you to turn on and off the +visibility of the solder-mask layer. When the solder-mask layer +is made visible it obscures most of the layout, so only turn +this on when you really want to know what the solder-mask will +look like. The solder-mask that you see belongs to the +side of the board you are viewing, which can be changed with +the @samp{view solder side} option, also found in the @b{Screen} menu. +When the solder-mask is displayed, the pin and pad clearance adjustments +(@pxref{Line Objects}) alter the size of mask cut-outs. + +@cindex Sizes, popup menu +@item Sizes +The @b{Sizes} menu allows you to select a group of line thickness, via diameter, via drill +size, and clearance (keepaway) (collectively called a "routing style") to be copied to the "active" sizes. +You can also change the names given to the routing styles and adjust their values from +this menu. The "active" sizes are also adjustable from this menu. +The "active" sizes are shown in the status-line and control the initial size of new vias, +drilling holes, lines, clearances, text-objects and also the maximum dimensions of the +board layout. + +@cindex Settings, popup menu +@cindex unique names +@cindex rubber band +@cindex snap to pins +@cindex clearance, for new lines +@item Settings +The @b{Settings} menu controls several operating configuration +parameters. The @samp{edit layer groups} entry brings up a dialog +that allows you to change the way layers are grouped. Layer grouping +is described in @ref{Layer Objects}. The @samp{all-direction lines} +entry controls +the clipping of lines to 45-degree angles. You can also control +whether moving individual objects causes the attached lines to +"rubber band" with the move or not from the @b{Settings} menu. Another +entry controls whether the starting clip angle for the two-line +mode (@pxref{Line Objects}) alternates every other line. You can +also control whether element names must be unique from the @b{Settings} +menu. When unique element names are enforced, copying a new element +will automatically create a unique @samp{layout-name} name for it +provided that the name originally ended with a digit (@emph{e.g.} +U7 or R6). The @b{Settings} menu allows you to control +whether the cross hair will snap to pins and pads even when they +are off-grid. Finally you can control whether new lines and +arcs touch or clear intersecting polygons from this menu. + +@cindex Select, popup menu +@cindex selected objects, removing +@cindex selected objects, changing sizes +@item Select +This menu covers most of the operations that work with selected objects. +You may either (un)select all visible objects on a layout or only the ones +which have been found by the last connection scan see +@c DRM: not sure where this was suppose to xfef to. +@c @ref{find connections} +. +You can delete all selected objects from this menu. +Other entries in the @b{Select} menu change the sizes of selected objects. +Note that a select action only affects those objects that are +selected @emph{and} have their visibility turned on in the Layer Control +panel. The @b{Select} menu also provides a means for selecting objects +by name using unix @ref{Regular Expressions}. + +@cindex Buffer, popup menu +@cindex pastebuffer, popup menu +@cindex element, editing +@item Buffer +From the @b{Buffer} menu you may select one out of five +buffers to use, rotate or clear its contents or save the buffer contents +to a file. You can also use the @samp{break buffer element to pieces} entry +to de-compose an element into pieces for editing. +Note: only objects with visibility turned on are pasted to the layout. If +you have something in a buffer, then change which side of the board you +are viewing, the contents of the buffer will automatically be mirrored +for pasting on the side you are viewing. It is not necessary to clear +a buffer before cutting or copying something into it - it will automatically +be cleared first. + +@cindex Connects, popup menu +@cindex auto-router +@cindex design rule checker, invoking +@item Connects +The entries available through the @b{Connects} menu allow you to find +connections from objects and to manipulate these. +You can also optimize or erase rat's nests from this menu. Finally, +the @samp{auto-route all rats} entry allows you to auto-route +all connections show by the rat's nest. The auto-router will use +any visible copper layer for routing, so turn off the visibility of any +layers you don't want it to use. The auto-router will automatically +understand and avoid any traces that are already on the board, but +it is not restricted to the grid. Finally, +the auto-router routes using the active sizes (except for nets that +have a route-style defined). @pcb{} always knows which tracks +were routed by the auto-router, and you can selectively remove them +without fear of changing tracks that you have manually routed +with the @samp{rip-up all auto-routed tracks} entry in the @b{Connects} +menu. The @samp{design rule checker} entry runs a check for copper +areas that are too close together, or connections that touch too +tenuously for reliable production. The DRC stops when the first +problem is encountered so after fixing a problem be sure to +run it again until no problems are found. +@display +@emph{Warning:} @b{COPPER TEXT IS IGNORED BY THE DRC CHECKER}. +@end display + +@cindex Info, popup menu +@cindex report +@cindex object report +@cindex drill report +@item Info +The @samp{generate object report} entry from the @b{Info} menu +provides a way to get detailed information +about an object, such as its coordinates, dimensions, etc. +You can also get a report summarizing all of the drills +used on the board with @samp{generate drill summary}. Lastly, +you can get a list of all pins, pads and vias that were +found during a connection search. + +@cindex Window, popup menu +@item Window +The @b{Window} menu provides a way to bring each of @code{Pcb's} +windows to the front. The @emph{Library} window is used to +bring elements from the library into the paste-buffer. The +@emph{Message Log} window holds the various messages that +@pcb{} sends to the user. The @emph{Netlist} window shows +the list of connections desired. + +@end table + +Now that you're familiar with the various menus, it's time +to try some things out. From the @b{File} menu choose +@samp{load layout}, navigate to the tutorial folder, then +load the file @samp{tut1.pcb}. + + +@node Status-line and Input-field +@subsection The Status-line and Input-field +@cindex status information +@cindex displaying status information +@cindex input-field, position of + +The status-line is located at the bottom edge of the main window. +During normal operation the status information is visible there. +When a selected menu operation requires an additional button click, the +status-line is replaced by a message telling you to position the cursor +and click. +When a text input is required, the status-line is replaced by the +Input-field which has a prompt for typing the input. + +The status-line shows, from left to right, the side of the board that you +are viewing (@emph{Tab} key changes this), the current grid values, +if new lines are restricted to 45 degrees, +which type of 45 degree line mode is active, whether rubberband move and +rotate mode is on (R), and the zoom factor. +This information is followed by the active line-width, via-size +and drilling hole, keepaway spacing, and text scaling. Last is the active buffer number and the +name of the layout. An asterisk appearing at the far left indicates that the +layout has been modified since the last save. +Note that the name of the layout is not the same +thing as the filename of the layout. +Change the grid factor to 1.0 mm from the @b{Screen} menu. Observe how the +status line shows the new grid setting. Except for the case of the metric +grid, all dimensions in the status line are in units of 0.001 inch (1 mil). + +The input-field pops up (temporarily replacing the status-line) whenever user input +is required. Two keys are bound to the input field: the @emph{Escape} key +aborts the input, @emph{Return} accepts it. Let's change the name of a component +on the board to see how the input-field works. Position the cross hair over +R5, and press the @emph{N} key. The input field pops-up showing the name +for you to edit. Go ahead and change the name, then hit return. Notice the name +of the element changed. Now undo the change by pressing the @emph{U} key. You can +position the cross hair over the name, or the element before pressing the +@emph{N} key. + +Now select @samp{realign grid} from the @b{Screen} menu. Notice that the +status line has been replaced with an instruction to position the cursor +where you want a grid point to fall. In this case, since the cross hair +can only fall on a grid point, you must move the tip of the finger cursor +to the place where you want a grid point to appear. Do not worry that +the cross hair is not coincident with the cursor. Click @emph{Btn1} at +your chosen location. See how the grid has shifted, and the status line +has returned. + +The present cross hair position is displayed in the upper right corner of the window. +Normally this position is an absolute coordinate, but you can anchor a marker at +the cross hair location by pressing @emph{Ctrl-M} (try it now) and then the +display will read both the absolute cross hair position as well as the difference +between it and the marker. The numbers enclosed in < > are the X and Y distances +between the cross hair and the mark, while the numbers enclosed in parenthesis +are the distance and angle from the mark to the cross hair. The values displayed +are always in units of 0.001 inch (1 mil). +Pressing @emph{Ctrl-M} again turns the marker off. + +@node Layer Controls +@subsection The Layer Controls +@cindex layer controls +@cindex layers, switching on/off +@cindex layers, changing which is active +@cindex change active layer + +The layer control panel, located in the upper left, is used to turn on +and off the display of layer groups and to select the active drawing layer. +If a layer hasn't been named, the label "@emph{(unknown)}" is used as the default. +If this happens, it probably means the application resources are not installed +properly. + +The upper buttons are used to switch layers on and off. Click +@emph{} on one or more of them. Each click toggles the setting. +If you turn off the currently active layer, another one that is visible +will become active. If there are no others visible, you will not be +able to turn off the active layer. +When the layers are grouped, clicking on these buttons will toggle +the visibility of all layers in the same group. This is a good idea because +layers in the same group reside on the same physical layer of +the actual board. Notice that this example has 2 groups each having +3 layers, plus two other layers named @samp{unused}. +Use the @samp{Edit layer groups} option in the @samp{Settings} menu to +change the layer groupings in the lesstif GUI or the @samp{Preferences} +dialog from the @samp{File} menu in the GTK+ GUI. Note that changing the +groupings can radically alter the connectivity on the board. +Grouping layers is only useful for helping you to color-code +signals in your layout. Note that grouping layers actually reduces the number +of different physical layers available for your board, so to make an eight +layer board, you cannot group any layers. + +The @emph{far side} button turns on and off the visibility of elements +(including SMD pads) on the opposite (to the side you're viewing) +board side, as well as silk screening on that side. It does not +hide the x-ray view of the other copper layers, these must be turned off +separately if desired. Use the @emph{tab} key to view the entire board from the other +side. To see a view of what the back side of the board will actually look like, +make the solder layer the active layer then press @emph{tab} until the status +line says "solder" on the right, then turn off the visibility of all layers +except solder, pins/pads, vias, and silk. Now turn them all back on. + +The lowest button, named @emph{active}, is used to change the active +drawing layer. Pressing @emph{} on it pops up a menu to select which +layer should be active. +Each entry is labeled with the layer's name and drawn in its color. +The active layer is automatically made visible. The active layer is +always drawn on top of the other layers, so the ordering of layers +on the screen does not generally reflect the ordering of the manufactured +board. Only the solder, component, silkscreen, and solder-mask layers +are always drawn in their physical order. Bringing the active layer +to the top makes it easier to select and change objects on the active layer. +Try changing the active layer's name to @emph{ABC} by selecting +@samp{edit name of active layer} from the @samp{Edit} menu. +Changing the active layer can also be done by pressing keys +@emph{1..MAX_LAYER}. + +Turn off the visibility of the component layer. +Now make the component layer the active layer. Notice that it +automatically became visible. Try setting a few +other layers as the active layer. You should also experiment +with turning on and off each of the layers to see what happens. + +The netlist layer is a special layer for adding connections to +the netlist by drawing rat lines. This is not the recommended +way to add to the netlist, but occasionally may be convenient. +To learn how to use the netlist layer see @ref{Net Objects}. + + +@node Tool Selectors +@subsection The Tool Selectors +@cindex mode selection +@cindex tool selection +@cindex selecting a new tool + +The tool selector buttons reside below the layer controls. +They are used to select which layout tool to use in the drawing +area. Each tool performs its function when @emph{Btn1} is pressed. +Every tool gives the cursor a unique shape that identifies it. +The tool selector buttons themselves are icons that illustrate their function. +Each layout tool can also be selected from the keyboard: +@example + @emph{F1} key Via tool + @emph{F2} key Line tool + @emph{F3} key Arc tool + @emph{F4} key Text tool + @emph{F5} key Rectangle tool + @emph{F6} key Polygon tool + @emph{F7} key Buffer tool + @emph{F8} key Delete tool + @emph{F9} key Rotate tool + @emph{Insert} key Insert-point tool + @emph{F10} key Thermal tool + @emph{F11} key Arrow tool + @emph{F12} key Lock tool +@end example + +Some of the tools are very simple, such as the Via tool. Clicking +@emph{Btn1} with the Via tool creates a via at the cross hair position. +The via will have the diameter and drill sizes that are active, +as shown in the status line. +The Buffer tool is similar. With it, @emph{} copies +the contents of the active buffer to the layout, but only +those parts that reside on visible layers are copied. +The Rotate tool allows you to rotate elements, arcs, and text objects +90 degrees counter-clockwise with each click. Holding the @emph{Shift} +key down changes the Rotate tool to clockwise operation. +Anything including groups of objects +can be rotated inside a buffer using the rotate buffer menu option. + +The Line tool is explained in detail in @ref{Line Objects}. Go read +that section if you haven't already. +Activate the Line tool. Set the active layer to the solder layer. +Try drawing some lines. Use the @emph{U} key to undo some of the +lines you just created. Zoom in a bit closer with the @emph{Z} key. +Draw some more lines. Be sure to draw some separate lines by starting +a new anchor point with @emph{Ctrl-Btn1}. Change the @samp{crosshair snaps to pin/pads} +behavior in the @b{Settings} menu. Now draw a line. Notice that +the new line points must now always be on a grid point. It might not +be able to reach some pins or pads with this setting. Increase the active line thickness +by pressing the @emph{L} key. Note that the status line updates +to reflect the new active line thickness. Now draw another line. Before completing the +next line, make the component layer active by pressing the @emph{4} key. +Now finish the line. Notice that a via was automatically placed where +you switched layers. @pcb{} does not do any checks to make sure that +the via could safely be placed there. Neither does it interfere with +your desire to place lines haphazardly. It is up to you to place +things properly when doing manual routing with the Line tool. + +The Arc tool is explained in detail in @ref{Arc Objects}. Its +use is very similar to the Line tool. + +The Rectangle tool, Polygon tool and Thermal tool are explained in detail in +@ref{Polygon Objects}. Go read that section. +Remember that the Thermal tool will only create and destroy thermals +to polygons on the active layer. Use the Rectangle tool to make a +small copper plane on the component layer. Now place a via in the +middle of the plane. Notice that it does not touch the plane, and +they are not electrically connected. Use the Thermal tool to make +the via connect to the plane. Thermals allow the via or pin to +be heated by a soldering iron without having to heat the entire +plane. If solid connections were made to the plane, it could be +nearly impossible to solder. Shift-click on the via with the Thermal +tool to change the style of thermal used or to make the connection +solid. Click on the via again with the Thermal tool to remove the +connection to the plane. + +The Insert-point tool is an editing tool that allows you to add +points into lines and polygons. The +Insert-point tool enforces the 45 degree line +rule. You can force only the shorter line segment to 45 +degrees by holding the @emph{Shift} key down while inserting the point. +Try adding a point into one of the lines you created. Since line +clipping is turned on, you may need to move the cross hair quite far +from the point where you first clicked on the line. Turn off the +line clipping by selecting @samp{all-direction lines} from the +@b{Settings} menu (or hit +the @emph{Period} key). Now you can place an inserted point anywhere. +Try adding a point to the rectangle you made earlier. Start by clicking +somewhere along an edge of the rectangle, then move the pointer to +a new location and click again. + +The delete-mode deletes the object beneath the cursor with each +@emph{Btn1} click. +If you click at an end-point that two lines have in common, it will replace the two lines with a single line +spanning the two remaining points. This can be used to delete an "inserted" +point in a line, restoring the previous line. Now delete one of the original corner +points of the polygon you were just playing with. To do this, place the cross hair over the +corner and click on it with the Delete tool. You could also use the @emph{Backspace} key +if some other tool is active. Try deleting some of +the lines and intermediate points that you created earlier. Use undo +repeatedly to undo all the changes that you've made. Use redo +a few times to see what happens. Now add a new line. Notice that +you can no longer use redo since the layout has changed since +the last undo happened. The undo/redo tree is always pruned in this +way (@emph{i.e.} it has a root, but no branches). + +The Arrow tool is so important, it has its own section: @ref{Arrow Tool}. +Go read it now. + +The Lock tool allows you to lock objects on the layout. When an object +is locked, it can't be selected, moved, rotated, or resized. This is +useful for very large objects like ground planes, or board-outlines that +are defined as an element. With such large objects, nearly anywhere you +click with the Arrow tool will be on the large object, so it could be +hard to draw box selections. If you lock an object, the Arrow tool will +behave as if it didn't exist. You cannot unlock an object with undo. +You must click on it again with the Lock tool. If an object is locked, +previous changes to it cannot be undone either. When you lock +an object, a report message about it is popped up and will always tell +you what object it is, and that it is locked if you just locked it. +Other than noticing your inability to manipulate something, the only +way to tell an object is locked is with a report from the @b{Info} +menu. Use the Lock tool sparingly. + + +@node Layout Area +@subsection Layout Area +@cindex grid + +The layout area is where you see the layout. The cursor shape depends +on the active tool when the pointer is moved into the layout area. +A cross hair follows the mouse pointer with respect to the grid setting. +Select a new grid from the @emph{Screen} menu. +The new value is updated in the status line. +A different way to change the grid is +@emph{Shiftg} to decrease or @emph{g} to increase +it, but this only works for English (integer mil) grids. +The grid setting is saved along with the data when you save a pcb layout. +For homemade layouts a value around 50 is a good setting. +The cursor can also be moved in the layout area with the cursor (arrow) keys or, for larger +distances, by pressing the @emph{Shift} modifier together with a cursor key. + + +@node Log Window +@section Log Window +@cindex log window +@cindex messages + +This optional window is used to display all kind of messages including +the ones written to @emph{stderr} by external commands. The main advantage +of using it is +that its contents are saved in a scrolling list until the +program exits. Disabling this feature by setting the resource +@emph{useLogWindow} to @emph{false} will generate popup windows to display +messages. The @emph{stderr} of external commands will appear on @pcb{}s +@emph{stderr} which normally is the parent shell. I suggest you iconify +the log window after startup for example by setting @emph{*log.iconic} to +@emph{true} in the resource file. If @emph{raiseLogWindow} is set @emph{true}, +the window will deiconify and raise itself whenever new messages are to be +displayed. + + +@node Library Window +@section Library Window +@cindex library window + +The library window makes loading elements (or even partial layouts) easy. +Just click the appropriate library from the list on the left. A list +of its elements then appears on the right. Select an element +from the list by clicking on its description. Selecting an element from the +library will also automatically copy the element into +the active buffer, then invoke the @emph{Buffer} tool so +you can paste it to the layout. Elements in the old library should be +taken with a grain of salt (@emph{i.e.} check them carefully before +using). The old library names all begin with ~ so you can easily distinguish between +the old and new libraries. All of the elements in the new library +should be thoroughly vetted, so you +can use them with confidence. The new libraries are stored simply +as directories full of element files, so making additions to the +new library is easy since there is no need to learn @code{m4}. +For details on the old libraries, +check-out @ref{Library File} and @ref{Library Contents File}. For +details on the format of an element file used for the new libraries, +see @ref{Element File}. + + +@node Netlist Window +@section Netlist Window +@cindex Netlist Window + +The netlist window is very similar to the library window. On the left +is a list of all of the nets, on the right is the list of connections +belonging to the chosen net. The chosen net is highlighted in the +list and also shown on the second line of the window in red. If the +net name has a star to the left of it then it is "disabled". A disabled +net is treated as if it were not in the net list. This is useful, for +example, if you plan to use a ground plane and don't want the ground +net showing up in the rat's nest. You can enable/disable individual +nets by double-clicking the net name. If you want to enable or disable +all nets at once, there are two buttons at the top of the netlist +window for this purpose. + +The button labeled @samp{Sel Net On Layout} +can be used to select (on the layout) everything that is connected +(or is supposed to be connected) to the net. If you click on a +connection in the connection list, it will select/deselect +the corresponding pin or pad in the layout and also center the layout +window where it is located. If you "Find" (@samp{lookup connection +to object} in the @b{Connects} menu [also @emph{F} key]), a pin +or pad it will also choose the net and connection in the netlist window +if it exists in the netlist. + +If no netlist exists for the layout, then the netlist window does not +appear. You can load a netlist from a file from the @b{File} menu. The +format for netlist files is described in @ref{Netlist File}. + + +@node Drawing and Removing +@section Drawing and Removing Basic Objects +@cindex drawing objects +@cindex removing objects +@cindex erasing objects +@cindex object, drawing and removing + +hace begging gutting here, and do a real-world tutorial example. + +There are several ways of creating new objects: you can draw them yourself, +you can copy an existing object (or selection), or you can load an element from a file or +from the Library window. Each type of object has a particular tool for creating it. + +The active tool can be selected from the tool selectors in the bottom +left corner or by one of the function keys listed earlier in this chapter. +Each @emph{} press with the tool tells the application to create +or change the appropriate object or at least take +the first step to do so. Each tools causes the cursor to take +on a unique shape and also causes the corresponding +tool selector button to be highlighted. You can use either cue +to see which tool is active. + +Insert mode provides the capability of inserting new points into existing +polygons or lines. The 45 degree line clipping is now enforced when selected. +Press and hold the shift key while positioning the new point to only clip +the line segment to the nearer of the two existing points to 45 degrees. +You can also toggle the 45-degree clipping in the middle of a point +insertion by pressing the @emph{.} +If the shift key is not depressed and the 45 degree line clipping mode +is on, both new line segments must be on 45 degree angles - greatly +restricting where the new point may be placed. In some cases this can cause +confusion as to whether an insertion has been started since the two new +lines may be forced to lie parallel on top of the original line until the +pointer is moved far from the end points. + +Removing objects, changing their size or moving them only applies to objects +that are visible when the command is executed. + +@menu +* Common:: Keystrokes common to some objects. +* Lines:: +* Arcs:: +* Polygons:: Drawing polygons and rectangles. +* Text:: +* Vias:: +* Elements:: +* Pastebuffer:: A multi-purpose buffer. +@end menu + +@node Common +@subsection Common Drawing and Removing Methods +@cindex creating objects +@cindex object, creating an +@cindex removing objects +@cindex object, removing an +@cindex thickness of objects +@cindex object, changing the size of an + +There are several keystrokes and button events referring to an @emph{object} +without identifying its type. Here's a list of them: + +@emph{} creates (or deletes) an object depending on the +current mode. + +@emph{BackSpace} or @emph{Delete} removes the visible +object at the cursor location. When more than one object exists at the +location, the order of removal is: via, line, text, polygon and +element. The drawn layer order also affects the search - whatever is +top - most (except elements) is affected before lower items. Basically +all this means that what is removed is probably just what you expect. +If for some reason it isn't, undo and try again. +Only one object is removed for each keystroke. If two or more +of the same type match, the newest one is removed. + +Use @emph{s} and @emph{Shifts} to change the size (width) +of lines, arcs, text objects, pins, pads and vias, or to toggle the style +of polygons (whether pins and vias automatically have clearances). + +@emph{n} changes the name of pins, pads, vias, the +string of a text object, or the currently displayed label of an element. + +@emph{m} moves the line, arc, or polygon under the cross hair to the +active layer if it wasn't on that layer already. + +@emph{u} (undo) recovers from an unlimited number of operations +such as creating, removing, moving, copying, selecting etc. It works like +you'd expect even if you're in the midst of creating something. + +@emph{Shiftr} restores the last undone operation provided no other +changes have been made since the undo was performed. + +@emph{tab} changes the board side you are viewing. + +For a complete list of keystrokes and button events see @ref{Translations}. + + +@node Lines +@subsection Lines +@cindex lines, an example +@cindex example of line handling + +To draw new lines you have to be in @emph{line-mode}. Get there either by +selecting it from the @emph{Tool palette} or by pressing @emph{F2}. +Each successive @emph{notify} event creates a new line. The +adjustment to 45 degree lines is done automatically if it is selected from the +@emph{Display} menu. You can toggle the 45 degree mode setting by +pressing the @emph{.} (That is the period key). When 45 degree enforcement +is turned on there are three distinct modes of line creation: a single +line on the closest 45 degree vector towards the cross hair (but not necessarily +actually ending at the cross hair), two lines created such that the first leaves +the start point on a 90 degree vector and the second arrives at the cross hair +on a 45 degree vector, and finally two lines created such that the first leaves +the start point on a 45 degree vector and the second arrives at the cross hair +on a 90 degree vector. These last two modes always connect all the way from +the start and end points, and all lines have angles in 45 degree multiples. +The @emph{/} cycles through the three modes. The status line shows a +text icon to indicate which of the modes is active and the lines following +the cross hair motion show the outline of the line(s) that will actually be created. +Press @emph{Escape} to leave line-mode. + +@emph{l}, @emph{Shiftl} and the entries in the +@emph{Sizes} menu change the initial width of new lines. This width is also +displayed in the status line. + + +@node Arcs +@subsection Arcs +@cindex arc, an example + +An Arc is drawn with the @emph{arc-tool}. Get there either by selecting it +from the @emph{Tool palette} or by pressing @emph{F8}. Press @emph{Btn1} to +define the starting point for the arc. Drag the mouse towards the desired +end point along the path you want the arc to follow. The outline of the arc that +will be created is shown on the screen as you move the mouse. Arcs are always +forced to be 90 degrees and have symmetrical length and width ( i.e. they are +a quarter circle). The next @emph{Btn1} click creates the arc. It will have +the same width as new lines (displayed in the status line) and appear on the +active layer. The arc leaves the starting point towards the cross hair along +the axis whose distance from the cross hair is largest. Normally this means that +if you drag along the path you want the arc to follow, you'll get what you +want. If the grid is set to the arc radius, then the two distances will be +equal and you won't be able to get all of the possible directions. If this +is thwarting your desires, reduce the grid spacing (@emph{!ShiftG}) and +try again. + + +@node Polygons +@subsection Polygons and Rectangles +@cindex polygon, an example +@cindex example of polygon handling +@cindex rectangle, an example +@cindex example of rectangle handling + +A polygon is drawn by defining all of its segments as a series of +consecutive line segments. If the first point matches a new one and if +the number of points is greater than two, then the polygon is closed. +Since matching up with the first point may be difficult, you may use +@emph{Shiftp} to close the polygon. The @emph{Shiftp} won't +work if clipping to 45 degree lines is selected +and the final segment cannot match this condition. +I suggest you create simple convex polygons in order to avoid a strong +negative impact on the performance of the connection scanning routines. +The @emph{rectangle-mode} is just an easy way to generate rectangular polygons. +@emph{Polygon-mode} also is selected by @emph{F6} whereas +@emph{rectangle-mode} uses @emph{F4}. +Pressing a @emph{} at two locations creates a rectangle by +defining two of its corners. +@emph{Insert} brings you to @emph{insert-point-mode} which lets you +add additional points to an already existing polygon. +Single points may be removed by moving the cross hair to them and selecting +one of the delete actions @emph{(remove-mode, BackSpace, or Delete}. This only works +if the remaining polygon will still have three or more corners. +Pressing @emph{u} or @emph{p} while entering a new polygon +brings you back to the previous corner. Removing a point does not +force clipping to 45 degree angles (because it's not generally possible). +Newly created polygons will not connect to pins or vias +that pierce it unless you create a thermal (using the thermal mode) to make +the connection. If the edge of a polygon gets too close to a pin or via that +lies outside of it, a warning will be issued and the pin will be given a +special color. Increasing the distance between them will remove the warning +color. + + +@node Text +@subsection Text +@cindex text, an example +@cindex strings, an example +@cindex example of text handling + +Pressing @emph{F5} or clicking one of the text selector buttons +changes to @emph{text-mode}. +Each successive notify event (@emph{}) +pops up the input line at the bottom and queries for a string. +Enter it and press @emph{Return} to confirm or +@emph{Escape} to abort. +The text object is created with its upper left corner at the current pointer +location. +The initial scaling is changed by @emph{t} and +@emph{Shiftt} or from the @emph{Sizes} menu. + +Now switch to @emph{rotate-mode} and press +@emph{} at the text-objects location. Text objects +on the solder side of the layout are automatically mirrored and +flipped so that they are seen correctly when viewing the solder-side. + +Use @emph{n} to edit the string. + +@b{TEXT OBJECTS ON COPPER LAYERS CREATE COPPER LINES BUT THEY ARE NOT SCANNED FOR +CONNECTIONS}. If they are moved to the silkscreen layer, they +no longer create copper. + + +@node Vias +@subsection Vias +@cindex vias, an example +@cindex example of via handling + +The initial size of new vias may be changed by @emph{v} and +@emph{Shiftv} or by selecting the appropriate entry from the +@emph{Sizes} menu. @emph{Mod1v} and @emph{Mod1 Shiftv} do +the same for the drilling hole of the via. +The statusline is updated with the new values. +Creating a via is similar to the other objects. Switch to @emph{via-mode} +by using either the selector button or @emph{F1} then press +@emph{]} or @emph{} to create one. +@emph{n} changes the name of a via. If you want to create a mounting +hole for your board, then you can place a via where you want the hole to +be then convert the via into a hole. The conversion is done by pressing +@emph{!Ctrlh} with the cross hair over the via. Conceptually it is +still a via, but it has no copper annulus. If you create such a hole in +the middle of two polygons on different layers, it will short the layers. +Theoretically you could arrange for such a hole not to be plated, but a +metal screw inserted in the hole would still risk shorting the layers. +A good rule is to realize that holes in the board really are vias between +the layers and so place them where they won't interfere with connectivity. +You can convert a hole back into a normal via with the same keystroke used +to convert it in the first place. + +@node Elements +@subsection Elements +@cindex element, an example +@cindex example of element handling + +Some of the functions related to elements only work if both the package +layer and the pin layer are switched on. + +Now that you're familiar with many of the basic commands, it is +time to put the first element on the layout. +First of all, you have to load data into the paste buffer. +There are four ways to do this: +@example + 1) load the data from a library + 2) load the data from a file + 3) copy data from an already existing element + 4) convert objects in the buffer into an element +@end example +We don't have any elements on the screen yet nor anything in the +buffer, so we use number one. + +@cindex example files +@cindex m4, preprocessing example files +Select @emph{lsi} from the menu in the library window press +@emph{} twice at the appropriate text-line to get +the MC68030 CPU. +The data is loaded and the mode is switched to @emph{pastebuffer-mode}. +Each notify event now creates one of these beasts. Leave the mode +by selecting a different one or by @emph{Escape} which resets +all modes.. +The cross hair is located at the @emph{mark} position as defined by +the data file. Rotating the buffer contents is done by selecting +the @emph{rotate} entry of the @emph{Buffer} menu or by pressing +@emph{ShiftF3}. The contents of the buffer +are valid until new data is loaded into it either by a cut-to-buffer +operation, copy-to-buffer operation or by loading a new data file. +There are 5 buffers +available (possibly more or less if changed at compile time +with the @code{MAX_BUFFER} variable in @file{globalconfig.h}). +Switching between them is done by selecting a menu entry or +by @emph{Shift1..MAX_BUFFER}. +Each of the two board sides has its own buffers. + +The release includes all data files for the circuits that are used +by the demo layout. The elements in the LED example are not found in the library, +but you can lift them from the example itself if you want. +If you have problems with the color of the cross hair, change the resource +@emph{cross hairColor} setting to a different one. + +@cindex example of loading an element file +@cindex pins, an example +@cindex example of pin handling +Now load a second circuit, the MC68882 FPU for example. +Create the circuit as explained above. You now have two different unnamed +elements. Unnamed means that the layout-name of the element +hasn't been set yet. Selecting @emph{description} from the @emph{Display} +menu displays the description string of the two circuits which +are CPU and FPU. The values of the circuits are set to MC68030 and MC68882. +Each of the names of an element may be changed +by @emph{n} at the elements location and editing the old name in +the bottom input line. Naming pins and vias is similar to elements. +You can hide the element name so that it won't appear on the board +silkscreen by pressing @emph{h} with the cursor over the element. +Doing so again un-hides the element name. + +Entering @kbd{:le} and selecting an element data file is +the second way to load circuits. + +The third way to create a new element is to copy an existing one. +Please refer to @ref{Moving and Copying}. + +@cindex example of creating an element +@cindex element, creating a new package +@cindex pastebuffer, convert contents to element +@cindex buffer, convert contents to element +The fourth way to create a new element is to convert a buffer's contents +into an element. Here's how it's done: Select the Via-tool from the +@emph{Tool pallet}. Set the grid spacing to something appropriate for +the element pin spacing. Now create a series of vias where the pins +go. Create them in pin number order. It is often handy to place a reference +point (@emph{!Ctrlm}) in the center of the first pin in order to measure +the location of the other pins. Next make a solder-side layer the active +layer from the @emph{active-layer} popup menu. Now draw the outline of +the element using lines and arcs. When you're done, select everything that +makes up the element with a box selection (@emph{ drag, +}). Now select "cut selection to buffer" from the @emph{Buffer} +menu. Position the cursor over the center of pin 1 and press the left +button to load the data into the buffer. +Finally select "convert buffer to element" from the @emph{Buffer} menu. +You'll only want to create elements this way if they aren't already in the +library. It's also probably a good idea to do this before starting any of +the other aspects of a layout, but it isn't necessary. + +To display the pinout of a circuit move to it and press @emph{Shiftd} +or select @emph{show pinout} from the @emph{Objects} menu. A new window +pops up and displays the complete pinout of the element. This display can +be difficult to read if the component has been rotated 90 degrees :-( +therefore, the new window will show an un-rotated view so the pin names +are readable. +@emph{d} displays the name of one or all pins/pads inside the +Layout area, this is only for display on-screen, it has no effect on any +printing of the layout. + +You also may want to change a pin's or pad's current size by pressing +@emph{s} to increase or @emph{Shifts} to decrease it. While +this is possible, it is not recommended since care was probably taken +to define the element structure in the first place. You can also change the thickness +of the element's silkscreen outline with the same keys. You can +change whether a pin or SMD pad is rounded or square with the @emph{q}. +SMD pads should usually have squared ends. Finally, you can change whether +the non-square pins are round or octagonal with the @emph{!Ctrlo}. + +SMD elements and silkscreen objects are drawn in the "invisible object" +color if they are located on the opposite side of the board. + +For information on element connections refer to @ref{Connection Lists}. + + +@node Pastebuffer +@subsection Pastebuffer +@cindex pastebuffer, an example +@cindex example of pastebuffer handling +@cindex buffer, an example +@cindex example of buffer handling + +The line-stack and element-buffer of former releases have been replaced +by 5 (possibly more or less if changed at compile time +with the @code{MAX_BUFFER} variable in @file{globalconfig.h}) +multi-purpose buffers that are selected by +@emph{Shift1..MAX_BUFFER}. The status line shows which buffer is +the active one. +You may load data from a file or layout into them. +Cut-and-paste works too. +If you followed the instructions earlier in this chapter you should +now have several objects on the screen. Move the cross hair to one of them +and press @emph{} to toggle its selection flag. (If you drag the +mouse while the button is down, a box selection will be attempted instead +of toggling the selection.) The object +is redrawn in a different color. You also may want to try +moving the pointer while holding the third button down and +release it on a different location. This selects all objects inside the +rectangle and unselects everything else. If you want to add a box selection +to an existing selection, drag with @emph{Mod1} instead. +Dragging @emph{Shift Mod1} unselects objects in a box. +Now change to @emph{pastebuffer-mode} and select some operations from the +@emph{Buffer} menu. Copying objects to the buffer is available as +@emph{Mod1c} while cutting them uses @emph{Mod1x} as +shortcut. Both clear the buffer before new data is added. +If you use the menu entries, you have to supply a cross hair position by +pressing a mouse button. The objects are attached to the pastebuffer +relative to that cross hair location. +Element data or PCB data may be merged into an existing layout by loading +the datafiles into the pastebuffer. Both operations are available from +the @emph{File} menu or as user commands. + +@node Moving and Copying +@section Moving and Copying +@cindex moving, an example +@cindex copying, an example +@cindex example of moving +@cindex example of copying + +All objects can be moved including element-names, by +@emph{}, dragging the pointer while holding the button down +and releasing it at the new location of the object. If you use +@emph{Mod1} instead, the object is copied. Copying does not work for +element-names of course. You can move all selected objects with +@emph{Shift }. This uses the Pastebuffer, so +it will remove whatever was previously in the Pastebuffer. +Please refer to @ref{Pastebuffer}. +If you want to give a small nudge to an object, but you don't think +that the mouse will give you the fine level of control that you want, +you can position the cursor over the object, press @emph{[}, +move it with the arrow keys, then press @emph{]} when it's at the +desired position. Remember that all movements are forced onto grid coordinates, so +you may want to change the grid spacing first. + +@cindex moving, traces to a different layer +@cindex changing layers +To move a trace or group of traces to a different layer, first select +the tracks to be moved. It's easiest to do this if you shut off everything +but that layer first (i.e. silk, pins, other layers, etc). +Now set the current layer to be the new layer. +Press Shift-M to move all the selected tracks to the current layer. +See the @emph{MoveToCurrentLayer} action for more details. + +@node Loading and Saving +@section Loading and Saving +@cindex loading, an example +@cindex saving, an example +@cindex example of saving +@cindex example of loading + +After your first experience with @pcb{} you will probably want to save +your work. @kbd{:s name} passes the data to an external program which +is responsible for saving it. For details see @emph{saveCommand} in +@ref{Resources}. +Saving also is available from the @emph{File} menu, either with or +without supplying a filename. @pcb{} reuses the last +filename if you do not pass a new one to the save routine. + +To load an existing layout either select @emph{load layout data} from the +@emph{File} menu or use @kbd{:l filename}. A file select box pops up if you +don't specify a filename. Merging existing layouts into the new one is +supported either by the @emph{File} menu or by @kbd{:m filename}. + +@cindex backup +@cindex saving layouts +@cindex preventing loss of data +@cindex /tmp +@cindex directory /tmp +@cindex temporary files +@pcb{} saves a backup of the current layout at a user specified interval. +The backup filename is created by appending a dash, "-", to the @file{.pcb} filename. +For example, if you are editing the layout in @file{projects/board.pcb} then the +backup file name will be @file{projects/board.pcb-}. If the layout is new and +has not been saved yet, then the backup file name is @file{PCB.####.backup} where the "####" +will be replaced by the process ID of the currenting running copy of @pcb{}. +This default backup file name may be changed at compilation time via the +@code{BACKUP_NAME} +variable in @file{globalconfig.h}). During critical +sections of the program or when data would be lost it is saved as +@file{PCB.%i.save}. This file name may be changed at compile time +with the @code{SAVE_NAME} variable in @file{globalconfig.h}. + + +@node Printing +@section Printing +@cindex printing, an example +@cindex example of printing + +@pcb{} now has support for device drivers, +@code{PostScript}, @emph{encapsulated PostScript}, +and @emph{Gerber RS-274X} drivers are +available so far. The @emph{Gerber RS-274X} +driver additionally generates a numerical control (NC) drill file for +automated drilling, +a bill of materials file to assist in materials procurement and +inventory control, and a centroid (X-Y) file which includes the +centroid data needed +by automatic assembly (pick and place) machines. + I recommend the use of @code{GhostScript} if you +don't have a @code{PostScript} printer for handling the PostScript +output. Printing always generates +a complete set of files for a specified driver. +See the page about +the @emph{Print()} action for additional information about the filenames. +The control panel offers a number of options. Most of them are not available +for Gerber output because it wouldn't make sense, for example, to scale the gerber output +(you'd get an incorrectly made board!) The options are: + +@table @samp +@cindex device, selecting an output +@cindex output device +@item device +The top menu button selects from the available device drivers. + +@cindex rotating printout +@item rotate +Rotate layout 90 degrees counter-clockwise before printing (default). + +@cindex mirroring printout +@item mirror +Mirror layout before printing. Use this option depending +on your production line. + +@cindex color printout +@item color +Created colored output. All colors will be converted to black if this option +is inactive. + +@cindex outline printout +@item outline +Add a board outline to the output file. The size is determined by the +maximum board size changeable from the @emph{sizes} menu. The outline appears +on the top and bottom sides of the board, but not on the internal layers. +An outline can be useful for determining where to shear the board from the +panel, but be aware that it creates a copper line. Thus it has the potential +to cause short circuits if you don't leave enough room from your wiring +to the board edge. Use a viewer to see what the output outline looks like +if you want to know what it looks like. + +@cindex alignment targets +@item alignment +Additional alignment targets are added to the output. The distances between +the board outline is set by the resource @emph{alignmentDistance}. Alignment +targets should only be used if you know for certain that YOU WILL BE USING +THEM YOURSELF. It is extremely unlikely that you will want to have alignment +targets if you send gerber files to a commercial pcb manufacture to be made. + +@cindex scaling a printout +@item scaling +It's quite useful to enlarge your printout for checking the layout. +Use the scrollbar to adjust the scaling factor to your needs. + +@cindex print media +@cindex media, size of +@item media +Select the size of the output media from this menu. The user defined size +may be set by the resource @emph{media} either from one of the well known +paper sizes or by a @code{X11} geometry specification. +This entry is only available if you use @code{X11R5} or later. +For earlier releases the user defined size or, if not available, @emph{A4} +is used. +Well known size are: +@display + A3 + A4 + A5 + letter + tabloid + ledger + legal + executive +@end display + +@cindex offset of printout +@cindex print offset +@item offset +Adjust the offsets of the printout by using the panner at the right side +of the dialog box. +This entry is only available if you use @code{X11R5} or later. A zero +offset is used for earlier releases. + +@cindex DOS filenames +@item 8.3 filenames +Select this button to generate DOS compatible filenames for the output files. +The @emph{command} input area will disappear if selected. + +@cindex print command +@item commandline +Use this line to enter a command (starts with @kbd{|}) or a filename. +A %f is replaced by the current filename. +The default is set by the resource @emph{printCommand}. + +@end table + +The created file includes some labels which are guaranteed to stay unchanged +@table @samp +@item PCBMIN +identifies the lowest x and y coordinates in mil. + +@item PCBMAX +identifies the highest x and y coordinates in mil. + +@item PCBOFFSET +is set to the x and y offset in mil. + +@item PCBSCALE +is a floating point value which identifies the scaling factor. + +@item PCBSTARTDATA +@itemx PCBENDDATA +all layout data is included between these two marks. You may use them with an +@code{awk} script to produce several printouts on one piece of paper by +duplicating the code and putting some @code{translate} commands in front. +Note, the normal @code{PostScript} units are 1/72 inch. +@end table + +@node Exporting +@section Exporting a layout +@cindex Exporting a layout +@vindex Exporting a layout + +To export a layout choose @emph{Export layout} from the @emph{File} menu, then +select the desired exporter. + +@menu +* bom:: Bill of materials. +* gcode:: G-code. +* gerber:: Gerber. +* nelma:: Nelma. +* png:: Image. +* ps:: Postscript. +* eps:: Eps. +@end menu + +@node bom +@subsection Bill of materials (bom) +@cindex bom +@cindex bill of materials + +Produces a bill of materials (BOM) file and a centroid (XY) file. + +@node gcode +@subsection G-code (gcode) +@cindex gcode +@cindex g-code +@cindex cnc + +The gcode exporter can generate RS274/NGC G-CODE files to be used with a CNC mill to +produce pcb's by mechanically removing copper from the perimeter of all elements. + +The elements are enlarged in order to compensate for the cutting tool size so +that the remaining copper corresponds to the original size; however all +polygons are left unchanged and will end up being a little smaller; this is not a +problem because the electrical connection is done with traces, which are correctly +enlarged. + +A .cnc file is generated for every copper layer, with the bottom layer mirrored so +that the milling is done right; of course it's not possible to produce directly +multi-layer (more than 2) pcb's with this method, but the cnc files for +intermediate layers are generated anyways. + +A drill file is also generated, and it contains all drills regardless of the hole +size; the drilling sequence is optimized in order to require the least amount of +movement. + +The export function generates an intermediate raster image before extracting the contour +of copper elements, and this image is saved as well (in .png format) for inspection. + +When the spacing between two elements is less than the tool diameter they will merge +and no isolation will be cut between them; the control image should be checked for +this behaviour. + +Possible workarounds are: increasing spacing, decreasing the tool size, increasing +the intermediate image resolution. + +To maximize the chance of producing correct pcb's it would be better to increase +the DRC clearance to at least the tool diameter and use traces as thick as possible; +the rule is: use the largest element that will not prevent the isolation cut. + +The exporter parameters are: + +@table @b +@item basename +base name for generated files + +@item dpi +intermediate image resolution; affects precision when extracting contours + +@item mill depth +should be the copper depth + +@item safe z +Z value when moving between polygons + +@item tool radius +copper elements are enlarged by this amount + +@item drill depth +depth of drills + +@item measurement unit +for all parameters above, can be mm,um,inch,mil; g-code is always mm or inch +@end table + +All .cnc files specify Z values as parameters, so that it's easy to +change them without the need to run the exporter again. + +Operation was verified with the EMC2 g-code interpreter. + +Following is a sample layout that is converted with default settings: +@center @image{gcode,,,Sample Layout,png} + +The control image shows that the spacing is sufficient: +@center @image{gcode_control_img,,,Control Image,png} + +The final tool path follows the perimeter of all elements: +@center @image{gcode_tool_path,,,Resulting Tool Path,png} + +@node gerber +@subsection Gerber (gerber) +@cindex gerber + +Produces RS274-X (a.k.a. gerber) photo plot files and Excellon drill files. + +@node nelma +@subsection Nelma (nelma) +@cindex nelma + +Numerical analysis package export. + +@node png +@subsection Image (png) +@cindex png +@cindex image export + +Produces GIF/JPEG/PNG image files. + +@node ps +@subsection Postscript (ps) +@cindex ps +@cindex postscript + +Export as postscript. +Can be later converted to pdf. + +@node eps +@subsection Encapsulated Postscript (eps) +@cindex eps +@cindex encapsulated postscript + +Export as eps (encapsulated postscript) for inclusion in other documents. +Can be later converted to pdf. + + +@node Connection Lists +@section Connection Lists +@cindex example of connection lists +@cindex connections, creating list of + +After completing parts of your layout you may want to check if all drawn +connections match the ones you have in mind. This is probably best done +in conjunction with a net-list file: see @ref{Rats Nest}. +The following examples give more rudimentary ways to examine +the connections. +@example + 1) create at least two elements and name them + 2) create some connections between their pins + 3) optionally add some vias and connections to them +@end example + +Now select @emph{lookup connection} from the @emph{Connections} menu, +move the cursor to a pin or via and press any mouse button. @pcb{} +will look for all other pins and/or vias connected to the one you have +selected and display the objects in a different color. +Now try some of the reset options available from the same menu. + +There also is a way to scan all connections of one element. Select +@emph{a single element} from the menu and press any button at the +element's location. All connections of this element will be saved +to the specified file. +Either the layout name of the element or its canonical name is used to +identify pins depending on the one which is displayed on the screen +(may be changed by @emph{Display} menu). + +An automatic scan of all elements is initiated by choosing +@emph{all elements}. It behaves in a similar fashion to scanning a single +element except the resource @emph{resetAfterElement} +is used to determine if connections should be reset before a new element is +scanned. Doing so will produce very long lists because the power lines are +rescanned for every element. By default the resource is set to @emph{false} +for this reason. + +To scan for unconnected pins select @emph{unused pins} from the same +menu. + + +@node Arrow Tool +@section Arrow Tool +@cindex selecting, using the arrow tool +@cindex moving objects +@cindex arrow tool +@cindex tool, arrow + +Some commands mentioned earlier in this chapter also are able to operate on all +selected and visible objects. The Arrow tool is used to select/deselect +objects and also to move objects or selections. If you click and release +on an object with the Arrow tool, it will unselect everything else and +select the object. Selected objects change color to reflect that +they are selected. If you @emph{Shift} click, it will add the object to +(or remove) the object from the existing selection. If you drag with +the mouse button down with the Arrow tool, one of several things could +happen: if you first pressed the button on a selected object, you +will be moving the selection to where you release the button. If you +first pressed the button on an unselected object, you will be moving +that object. If you first pressed the button over empty space, you +will be drawing a box to select everything inside the box. The @emph{Shift} +key works the same way with box selections as it does with single objects. + +Moving a single un-selected object is different from moving a selection. +First of all, you can move the end of line, or a point in a polygon this +way which is impossible by moving selections. Secondly, if rubber banding +is turned on, moving a single object will rubber-band the attached lines. +Finally, it is faster to move a single object this way since there is no need +to select it first. + +You can select any visible object unless it is locked. If you select an +object, then turn off its visibility with the Layer controls, it won't +be moved if you move the remaining visible selection. + +If you have not configured to use strokes in the @pcb{} user interface, then +the middle mouse button is automatically bound to the arrow tool, regardless +of the active tool (which is bound to the first mouse button). So using +the middle button any time is just like using the first mouse button +with the Arrow tool active. + +The entries of the @emph{Selection} menu are hopefully self-explanatory. +Many of the @emph{Action Commands} can take various key words that make +them function on all or some of the selected items. + +@node Rats Nest +@section Rats Nest +@cindex rats nest +@cindex netlist +@cindex rat-line + +If you have a netlist that corresponds to the layout you are working on, you +can use the rats-nest feature to add rat-lines to the layout. +First you will need to load a netlist file (see @emph{:rn}, +@ref{User Commands}). +@emph{w} adds rat-lines on the active layer using the current +line thickness shown in the status line (usually you'll want them to be thin lines). +Only those rat-lines that fill in missing connectivity (since you have +probably routed some connections already) are added. +If the layout is already completely wired, nothing will be added, and you will +get a message that the wiring is complete. + +Rat-lines are lines having the special property that they only connect to pins and +pads at their end points. Rat-lines may be drawn differently to other lines +to make them easier to identify since they have special behavior and cannot +remain in a completed layout. +Rat-lines are added in the minimum length straight-line tree pattern +(always ending on pins or pads) that satisfies the missing connectivity in the circuit. +Used in connection with moves and rotates of the elements, they are extremely useful for +deciding where to place elements on the board. The rat-lines will always automatically +rubberband to the elements whether or not the rubberband mode is on. The only way for +you to move them is by moving the parts they connect to. +This is because it is never desirable to have the rat-lines disconnected from +their element pins. Rat-lines will normally criss-cross +all over which gives rise to the name "rats nest" describing a layout connected with +them. If a SMD pad is unreachable on the active layer, a warning will be issued +about it and the rat-line to that pad will not be generated. + +A common way to use rats nests is to place some +elements on the board, add the rat-lines, and then use a series of moves/rotates of the +elements until the rats nest appears to have minimum tangling. You may want to iterate this step +several times. Don't worry if the layout looks messy - as long as you can get a sense for whether +the criss-crossing is better or worse as you move things, you're fine. +After moving some elements around, you may want to optimize the rats nest @emph{o} +so that the lines are drawn between the closest points (this can change once you've moved components). +Adding rat-lines only to selected pads/pins (@emph{Shiftw}) +is often useful to layout a circuit a little bit at a time. +Sometimes you'll want to delete all the rat-lines (@emph{e}) or +selected rat-lines (@emph{Shifte}) in order to reduce confusion. +With a little practice you'll be able to achieve a near optimal component placement with +the use of a rats nest. + +Rat-lines are not only used for assisting your element placement, they can also help +you to route traces on the board. +Use the @emph{m} to convert a rat-line under the cursor into +a normal line on the active layer. +Inserting a point into a rat-line will also cause the two new lines to be normal lines +on the board. +Another way that you can use rat-lines is to +use the @emph{f} with the cursor over a pad or pin. All of the pins and +pads and rat-lines belonging to that net will be highlighted. This is a helpful way to +distinguish one net from the rest of the rats nest. You can then route those tracks, +turn off the highlighting (@emph{Shiftf}) and repeat the process. This will work even +if the layer that the rat-lines reside on is made invisible - so only the pins and pads +are highlighted. +Be sure to erase the rat-lines (@emph{e} erases them all) once you've +duplicated their connectivity by adding your own lines. +When in doubt, the @emph{o} will delete only those +rat-lines that are no longer needed. + +If connections exist on the board that are not listed in the netlist when +@emph{w} is pressed, warning messages are issued and the affected pins and +pads are drawn in a special @emph{warnColor} until the next @emph{Notify()} event. +If the entire layout agrees completely with the netlist, a message informs you that +the layout is complete and no rat-lines will be added (since none are needed). +If the layout is complete, but still has rat-lines then you will be warned +that rat-lines remain. If you get no message at all it's probably because some +elements listed in the net list can't be found and where reported in an earlier +message. +There shouldn't be any rat-lines left in a completed layout, only normal lines. + +The @emph{Shiftw} is used to add rat-lines to only those missing connections among +the selected pins and pads. This can be used to add rat-lines in an incremental +manner, or to force a rat-line to route between two points that are not the +closest points within the net. Often it is best to add the rats nest in an incremental fashion, laying +out a sub-section of the board before going further. This is easy to accomplish since +new rat-lines are never added where routed connectivity already makes the necessary +connections. + +@node Design Rule Checking +@section Design Rule Checking +@cindex design rule checking +@cindex drc +@cindex spacing, minimum +@cindex overlap, minimum + +After you've finished laying out a board, you may want to check +to be certain that none of your interconnections are too closely +spaced or too tenuously touching to be reliably fabricated. The design +rule checking (DRC) function does this for you. Use the command ":DRC()" (without +the quotes of course) to invoke the checker. If there are no problem areas, +you'll get a message to that effect. If any problem is encountered, you will get +a message about it and the affected traces will be highlighted. One part of the +tracks of concern will be selected, while the other parts of concern will have the +"FindConnection" highlighting. The screen will automatically be centered in the +middle of the object having the "FindConnection" (Green) highlighting. The middle of +the object is also the coordinates reported to be "near" the problem. The actual trouble +region will be somewhere on the boundary of this object. If the two parts are +from different nets then there is some place where they approach each +other closer than the minimum rule. If the parts are from the same net, then +there is place where they are only barely connected. Find that place and connect +them better. + +After a DRC error is found and corrected you must run the DRC again because +the search for errors is halted as soon as the first problem is found. Unless you've +been extremely careless there should be no more than a few design rule errors +in your layout. The DRC checker does not check for minimum spacing rules to +copper text, so always be very careful when adding copper text to a layout. +The rules for the DRC are specified in the application resource file. The minimum +spacing value (in mils) is given by the @emph{Settings.Bloat} value. The default +is 7 mils. The minimum touching overlap (in mils) is given by the +@emph{Settings.Shrink} value. This value defaults to 5 mils. Check with your +fabrication process people to determine the values that are right for you. + +If you want to turn off the highlighting produced by the DRC, perform an +undo (assuming no other changes have been made). To restore the highlighting, +use redo. The redo will restore the highlighting quickly without re-running +the DRC checker. + +@node Trace Optimizer +@section Trace Optimizer +@cindex trace optimizer +@cindex optimizer + +PCB includes a flexible trace optimizer. The trace optimizer can be run +after auto routing or hand routing to clean up the traces. + +@table @b +@item Auto-Optimize +Performs debumpify, unjaggy, orthopull, vianudge, and viatrim, in that +order, repeating until no further optimizations are performed. + +@item Debumpify +Looks for U shaped traces that can be shortened or eliminated. + +@item Unjaggy +Looks for corners which could be flipped to eliminate one or more +corners (i.e. jaggy lines become simpler). + +@item Vianudge +Looks for vias where all traces leave in the same direction. Tries to +move via in that direction to eliminate one of the traces (and thus a +corner). + +@item Viatrim +Looks for traces that go from via to via, where moving that trace to a +different layer eliminates one or both vias. + +@item Orthopull +Looks for chains of traces all going in one direction, with more traces +orthogonal on one side than on the other. Moves the chain in that +direction, causing a net reduction in trace length, possibly eliminating +traces and/or corners. + +@item SimpleOpts +Removing unneeded vias, replacing two or more trace segments in a row +with a single segment. This is usually performed automatically after +other optimizations. + +@item Miter +Replaces 90 degree corners with a pair of 45 degree corners, to reduce +RF losses and trace length. + +@end table + +@node Searching for elements +@section Searching for elements +@cindex Searching for elements +@vindex Searching for elements + +To locate text or a specific element or grouping of similar elements +choose @samp{Select by name} from the @b{Select} menu, then choose the +appropriate subsection. At the bottom of the screen the prompt +@emph{pattern:} appears. Enter the text or @ref{Regular Expressions} +of the text to be found. Found text will be highlighted. + +@node Measuring distances +@section Measuring distances +@cindex Measuring distances +@vindex Measuring distances + +To measure distances, for example the pin-to-pin pitch of a part to +validate a footprint, place the cursor at the starting +measurement point, then press @emph{!Ctrlm}. This marks the +current location with a @emph{X}. The @emph{X} mark is now the zero point +origin for the relative cursor position display. The cursor display +shows both absolute position and position relative to the mark as +the mouse is moved away from the mark. If a mark is already present, +the mark is removed and the cursor display stops displaying relative +cursor coordinates. + +@node Vendor drill mapping +@section Vendor Drill Mapping +@cindex Vendor rules +@cindex Vendor mapping +@cindex Drill table +@cindex Vendor drill table + +@pcb{} includes support for mapping drill holes to a specified set +of sizes used by a particular vendor. Many PCB manufacturers have a +prefered set of drill sizes and charge extra when others are used. +The mapping can be performed on an existing design and can also be +enabled to automatically map drill holes as vias and elements are +instantiated. + +The first step in using the vendor drill mapping feature is to create +a resource file describing the capabilities of your vendor. The file +format is the resource file format described in @ref{Resource Syntax}. +A complete example is given below. + +@example +# Optional name of the vendor +vendor = "Vendor Name" + +# units for dimensions in this file. +# Allowed values: mil/inch/mm +units = mil + +# drill table +drillmap = @{ + # When mapping drill sizes, select the nearest size + # or always round up. Allowed values: up/nearest + round = up + + # The list of vendor drill sizes. Units are as specified + # above. + 20 + 28 + 35 + 38 + 42 + 52 + 59.5 + 86 + 125 + 152 + + # optional section for skipping mapping of certain elements + # based on reference designator, value, or description + # this is useful for critical parts where you may not + # want to change the drill size. Note that the strings + # are regular expressions. + skips = @{ + @{refdes "^J3$"@} # Skip J3. + @{refdes "J3"@} # Skip anything with J3 as part of the refdes. + @{refdes "^U[1-3]$" "^X.*"@} # Skip U1, U2, U3, and anything starting with X. + @{value "^JOHNSTECH_.*"@} # Skip all Johnstech footprints based on the value of a part. + @{descr "^AMP_MICTOR_767054_1$"@} # Skip based on the description. + @} +@} + +# If specified, this section will change the current DRC +# settings for the design. Units are as specified above. +drc = @{ + copper_space = 7 + copper_width = 7 + silk_width = 10 + copper_overlap = 4 +@} +@end example + +The vendor resource is loaded using the @emph{LoadVendor} action. +This is invoked by entering: +@example +:LoadVendor(vendorfile) +@end example +from within @pcb{}. Substitute the file name of your vendor +resource file for @samp{vendorfile}. This action will load the vendor +resource and modify all the drill holes in the design as well as the +default via hole size for the various routing styles. + +Once a vendor drill map has been loaded, new vias and elements will +automatically have their drill hole sizes mapped to the vendor drill +table. Automatic drill mapping may be disabled under the ``Settings'' +menu. To re-apply an already loaded vendor drill table to a design, +choose ``Apply vendor drill mapping'' from the ``Connects'' menu. + +See @ref{Actions} for a complete description of the actions associated +with vendor drill mapping. + +Note that the expressions used in the @code{skips} section are regular +expressions. See @ref{Regular Expressions} for an introduction to +regular expressions. + +@c --------------------------- Autorouter Chapter ------------------------------- +@node Autorouter +@chapter Autorouter +@cindex autorouter + +@pcb{} includes an autorouter which can greatly speed up the +layout of a circuit board. The autorouter is a rectangle-expansion +type of autorouter based on +``A Method for Gridless Routing of Printed Circuit Boards'' by +A. C. Finch, K. J. Mackenzie, G. J. Balsdon, and G. Symonds in the +1985 Proceedings of the 22nd ACM/IEEE Design Automation Conference. +This reference is available from the ACM Digital Library at +@url{http://www.acm.org/dl} for those with institutional or personal +access to it. It's also available from your local engineering +library. The reference paper is not needed for using the autorouter. + +Before using the autorouter, all elements need to be loaded into the +layout and placed and the connectivity netlist must be loaded. Once +the elements have been placed and the netlist loaded, the following +steps will autoroute your design. + +@enumerate +@item Turn off visibility of any layers that you don't want the router +to use. + +@item Turn of via visibility if you don't want the router to use any +new vias. + +@item Use only plain rectangles for power/ground planes that you want + the router to use [use the rectangle tool!] + +@item Make at least one connection from any plane you want the router to + use to the net you want it to connect to. + +@item Draw continuous lines (on all routing layers) to outline keep-out + zones if desired. + +@item Use routing styles in the netlist to have per-net routing styles. + Note that the routing style will be used for an entire net. This means + if you have a wide metal setting for a power net you will need to manually + route breakouts from any fine pitch parts on their power pins because + the router will not be able to change to a narrow trace to connect + to the part. + +@item Set the current routing style to whatever you'd like the router to + use for any nets not having a defined route style in the netlist. + +@item Disable any nets that you don't want the autorouter to route + (double-click them in the netlist window to add/remove the *) + + NOTE: If you will be manually routing these later not using + planes, it is usually better to let the autorouter route them then rip + them up yourself afterwards. If you plan to use a ground/power plane + manually, consider making it from one or more pure rectangles and + letting the autorouter have a go at it. + +@item Create a fresh rat's nest. ('E' the 'W') + +@item Select ``show autorouter trials'' in the settings menu if you want + to watch what's happening + +@item Choose ``autoroute all rats'' in the connection menu. + +@item If you really want to muck with the router because you have a + special design, e.g. all through-hole components you can mess with + layer directional costs by editing the autoroute.c source file and + changing the directional costs in lines 929-940. and try again. Even + more mucking about with costs is possible in lines 4540-4569, but it's + probably not such a good idea unless you really just want to + experiment. + +@end enumerate + +After the design has been autorouted, you may want to run the trace +optimizer. See section @ref{Trace Optimizer} for more information on +the trace optimizer. + + +@c --------------------------- User Commands chapter ------------------------------- +@node User Commands +@chapter User Commands + +@cindex user commands +@cindex entering user commands +The entering of user-commands is initiated by the action routine +@emph{Command()} (normally bound to the @code{(":")} character) which +replaces the bottom statusline with an input area or opens a separate +command window. It is finished by either @emph{Return} or +@emph{Escape} to confirm or to abort. These two key-bindings +cannot be changed from the resource file. The triggering event, +normally a key press, is ignored. + +Commands can be entered in one of two styles, command entry syntax: +``@emph{Command arg1 arg2}'' or action script syntax ``@emph{Action1(arg1, +arg2); Action2(arg1, arg2);}''. Quoting arguments works similar to +bash quoting: + +@itemize +@item A backslash (\) is the escape character. It preserves the literal +value of the next character that follows. To get a literal '\' use +"\\". + +@item Enclosing characters in single quotes preserves the literal value of +each character within the quotes. A single quote may not occur +between single quotes, even when preceded by a blackslash. + +@item Enclosing characters in double quotes preserves the literal value of +all characters within the quotes, with the exception of '\' which +maintains its special meaning as an escape character. +@end itemize + +There are simple @emph{usage} dialogs for each command and one for the +complete set of commands. + +@table @samp + +@findex :l +@cindex loading layouts +@cindex layout, loading a +@item l [filename] +Loads a new datafile (layout) and, if confirmed, overwrites any existing unsaved data. +The filename and the searchpath (@emph{filePath}) are passed to the +command defined by @emph{fileCommand}. +If no filename is specified a file select box will popup. + +@findex :le +@cindex loading elements to buffer +@cindex element, loading to buffer +@item le [filename] +Loads an element description into the paste buffer. +The filename and the searchpath (@emph{elementPath}) are passed to the +command defined by @emph{elementCommand}. +If no filename is specified a file select box will popup. + +@findex :m +@cindex loading a layout to buffer +@cindex merging layouts +@cindex layout, loading to buffer +@cindex layout, merging a +@item m [filename] +Loads an layout file into the paste buffer. +The filename and the searchpath (@emph{filePath}) are passed to the +command defined by @emph{fileCommand}. +If no filename is specified a file select box will popup. + +@findex :q +@cindex exit +@cindex quit +@item q[!] +Quits the program without saving any data (after confirmation). +q! doesn't ask for confirmation, it just quits. + +@findex :s +@cindex saving layouts +@cindex layout files, saving of +@item s [filename] +Data and the filename are passed to the command defined by the resource +@emph{saveCommand}. It must read the layout data from @emph{stdin}. +If no filename is entered, either the last one is used +again or, if it is not available, a file select box will pop up. + +@findex :rn +@cindex rat's nest +@cindex layout-name +@item rn [filename] +Reads in a netlist file. If no filename is given +a file select box will pop up. +The file is read via the command defined by the +@emph{RatCommand} resource. The command must send its output to @emph{stdout}. + +Netlists are used for generating rat's nests (see @ref{Rats Nest}) and for +verifying the board layout (which is also accomplished by the @emph{Ratsnest} +command). + +@findex :w[q] +@cindex saving layouts +@cindex layout files, saving of +@item w[q] [filename] +These commands have been added for the convenience of @code{vi} users and +have the same functionality as @emph{s} combined with @emph{q}. + +@findex :actionCommand() +@cindex action command +@cindex Actions, initiating +@item actionCommand +Causes the actionCommand to be executed. This allows you to initiate actions +for which no bindings exist in the resource file. It can be used to initiate any +action with whatever arguments you enter. This makes it possible to do things +that otherwise would be extremely tedious. For example, to change the drilling +hole diameter of all vias in the layout to 32 mils, you could select everything using the +selection menu, then type "@emph{:ChangeDrillSize(SelectedVias, 32)}". (This will +only work provided the via's diameter is sufficiently large to accommodate a 32 mil hole). +Another example might be to set the grid to 1 mil by typing "@emph{:SetValue(Grid, 1)}". +Note that some actions use the current cursor location, so be sure to place the cursor +where you want before entering the command. This is one of my favorite new +features in 1.5 and can be a powerful tool. Study the @ref{Actions} section to +see what actions are available. + +@end table + + +@c --------------------------- chapter 4 ------------------------------- +@node Command-Line Options +@chapter Command-Line Options +@cindex starting @pcb{} +@cindex command-line options + +The synopsis of the pcb command is: + +@code{pcb [OPTION ...] [LAYOUT-FILE.pcb]} to start the application in GUI mode, + +@noindent or + +@code{pcb [-h | -V | --copyright]} for a list of options, version, and copyright, + +@noindent or + +@code{pcb -p [OPTION ...] [LAYOUT-FILE.pcb]} to print a layout, + +@noindent or + +@code{pcb -x HID [OPTION ...] [LAYOUT-FILE.pcb]} to export. + +@noindent Possible values for the parameter @samp{HID} are: + @table @samp + @item bom + Export a bill of materials + @item gcode + Export to G-Code + @item gerber + Export RS-274X (Gerber) + @item nelma + Numerical analysis package export + @item png + export GIF/JPEG/PNG + @item ps + export postscript + @item eps + export encapsulated postscript +@end table + +@noindent There are several resources which may be set or reset in addition to the +standard toolkit command-line options. For a complete list refer to +@ref{Resources}. + + +@include options.texi + + + +@c --------------------------- chapter 5 ------------------------------- +@node X11 Interface +@chapter X11 Interface +@cindex X11 + +This chapter gives an overview about the additional @code{X11} resources which +are defined by @pcb{} as well as the defined action routines. + +@menu +* Resources:: Non-standard @code{X11} application resources. +* Actions:: A list of available action routines. +* Translations:: A list of the default key translations (as shipped). +@end menu + + +@node Resources +@section Non-Standard X11 Application Resources +@cindex resources +@cindex X11 resources + +In addition to the toolkit resources, @pcb{} defines the +following resources: + +@table @samp + +@vindex absoluteGrid +@cindex grid +@item absoluteGrid (boolean) +Selects if either the grid is relative to the position where it has changed +last or absolute, the default, to the origin (0,0). + +@vindex alignmentDistance +@cindex alignment +@item alignmentDistance (dimension) +Specifies the distance between the boards outline to the alignment targets. + +@vindex allDirectionLines +@cindex lines, clipping to 45 degree +@cindex clipping lines to 45 degree +@item allDirectionLines (boolean) +Enables (default) or disables clipping of new lines to 45 degree angles. + +@vindex backgroundImage +@cindex background +@item backgroundImage (string) +If specified, this image will be drawn as the background for the +board. The purpose of this option is to allow you to use a scan of an +existing layout as a prototype for your new layout. To do this, there +are some limitations as to what this image must be. The image must be +a PPM binary image (magic number @samp{P6}). It must have a maximum +pixel value of 255 or less (i.e. no 16-bit images). It must represent +the entire board, as it will be scaled to fit the board dimensions +exactly. Note that it may be scaled unevenly if the image doesn't +have the same aspect ratio of your board. You must ensure that the +image does not use more colors than are available on your system +(mostly this is for pseudo-color displays, like old 8-bit displays). +For best results, I suggest the following procedure using The Gimp: +Load your image (any type). Image->Scale if needed. +Image->Colors->Curves and for each of Red, Green, and Blue channel +move the lower left point up to about the 3/4 line (value 192). This +will make your image pale so it doesn't interfere with the traces +you'll be adding. Image->Mode->Indexed and select, say, 32 colors +with Normal F-S dithering. File->Save As, file type by extension, +use @file{.ppm} as the extension. Select Raw formatting. + +@vindex backupInterval +@cindex backup +@item backupInterval (int) +@pcb{} has an automatic backup feature which saves the current data +every n seconds. The default is @emph{300} seconds. A value of zero disables +the feature. The backup file is named @file{/tmp/PCB.%i.backup} by +default (this may have been changed at compilation time via the +@code{BACKUP_NAME} +variable in @file{globalconfig.h}). +@emph{%i} is replaced by the process ID. +See also, the command-line option @emph{--backup-interval}. + +@vindex bloat +@cindex bloat +@cindex drc +@item Bloat (dimension) +Specifies the minimum spacing design rule in mils. + +@vindex connectedColor +@cindex colors +@cindex connections, colors +@item connectedColor (color) +All pins, vias, lines and rectangles which are selected during a connection +search are drawn with this color. The default value is determined by +@emph{XtDefaultForeground}. + +@vindex cross hairColor +@cindex colors +@cindex cursor color +@item cross hairColor (color) +This color is used to draw the cross hair cursor. The color is a result of +a @emph{XOR} operation with the contents of the Layout area. The result +also depends on the default colormap of the @code{X11} server because only +the colormap index is used in the boolean operation and @pcb{} doesn't +create its own colormap. The default setting is @emph{XtDefaultForeground}. + +@vindex elementColor +@vindex elementSelectedColor +@cindex colors +@cindex element, color +@item elementColor (color) +@itemx elementSelectedColor (color) +The elements package part is drawn in these colors, for normal and selected +mode, respectively, which both default to @emph{XtDefaultForeground}. + +@vindex elementCommand +@cindex element, command +@cindex element, files +@cindex loading elements +@cindex preprocessing element data +@cindex unix command +@cindex m4 +@item elementCommand (string) +@pcb{} uses a user defined command to read element files. This resources +is used to set the command which is executed by the users default shell. +Two escape sequences are defined to pass the selected filename (%f) and the +current search path (%p). The command must write the element data +to its standard output. The default value is +@example + M4PATH="%p";export M4PATH;echo 'include(%f)' | m4 +@end example +Using the GNU version of @code{m4} is highly recommended. +See also, the command-line option @emph{--element-command}. + +@vindex elementPath +@cindex searchpath for element files +@cindex path for element files +@cindex element, files +@cindex loading elements +@item elementPath (string) +A colon separated list of directories or commands (starts with '|'). +The path is passed to the program specified in @emph{elementCommand} together +with the selected element name. A specified command will be executed in order +to create entries for the fileselect box. It must write its results to +@emph{stdout} one entry per line. +See also, the user-command @emph{le[!]}. + +@vindex fileCommand +@cindex file load command +@cindex layout files +@cindex loading layouts +@cindex preprocessing layout data +@cindex unix command +@cindex cat +@item fileCommand (string) +The command is executed by the user's default shell whenever existing layout +files are loaded. Data is read from the command's standard output. +Two escape sequences may be specified to pass the selected filename (%f) +and the current search path (%p). The default value is: +@example + cat %f +@end example +See also, the command-line option @emph{--file-command}. + +@vindex filePath +@cindex searchpath for layout files +@cindex path for layout files +@cindex layout files +@cindex loading layouts +@item filePath (string) +A colon separated list of directories or commands (starts with '|'). +The path is passed to the program specified in @emph{fileCommand} together +with the selected filename. A specified command will be executed in order +to create entries for the fileselect box. It must write its results to +@emph{stdout} one entry per line. +See also, the user-command @emph{l[!]}. + +@vindex fontCommand +@cindex font command +@cindex font files +@cindex loading fonts +@cindex loading symbols +@cindex preprocessing font data +@cindex unix command +@cindex cat +@item fontCommand (string) +Loading new symbol sets also is handled by an external command. You again +may pass the selected filename and the current search path by passing +%f and %p in the command string. Data is read from the commands standard +output. This command defaults to +@example + cat %f +@end example +See also, the command-line option @emph{--font-command}. + +@vindex fontFile +@cindex default font +@cindex symbols +@item fontFile (string) +The default font for new layouts is read from this file which is searched +in the directories as defined by the resource @emph{fontPath}. +Searching is only performed if the filename does not contain a directory +component. +The default filename is @file{default_font}. + +@vindex fontPath +@cindex searchpath for font files +@cindex path for font files +@cindex font files +@cindex loading fonts +@cindex loading symbols +@item fontPath (string) +This resource, a colon separated list of directories, defines the searchpath +for font files. See also, the resource @emph{fontFile}. + +@vindex grid +@cindex grid +@cindex cursor steps +@item grid (int) +This resources defines the initial value of one cursor step. It defaults +to @emph{100 mil} and any changes are saved together with the layout data. + +@vindex gridColor +@cindex colors +@cindex grid color +@item gridColor (color) +This color is used to draw the grid. The color is a result of +a @emph{INVERT} operation with the contents of the Layout area. The result +also depends on the default colormap of the @code{X11} server because only +the colormap index is used in the boolean operation and @pcb{} doesn't +create its own colormap. The default setting is @emph{XtDefaultForeground}. + +@vindex invisibleObjectsColor +@cindex colors +@cindex element, color +@item invisibleObjectsColor (color) +Elements located on the opposite side of the board are drawn in this color. +The default is @emph{XtDefaultForeground}. + +@vindex layerColor +@vindex layerSelectedColor +@cindex colors +@cindex layers, colors +@item layerColor1..MAX_LAYER (color) +@itemx layerSelectedColor1..MAX_LAYER (color) +These resources define the drawing colors of the different layers in +normal and selected state. All values are preset to @emph{XtDefaultForeground}. + +@vindex layerGroups +@cindex layers, groups +@cindex groups +@item layerGroups (string) +The argument to this resource is a colon separated list of comma separated +layer numbers (1..MAX_LAYER). All layers within one group are switched on/off +together. The default setting is @emph{1:2:3:...:MAX_LAYER} which means +all layers are handled separately. Grouping layers one to three looks like +@emph{1,2,3:4:...:MAX_LAYER} + +@vindex layerName +@cindex layer, name of +@item layerName1..MAX_LAYER (string) +The default name of the layers in a new layout are determined by these +resources. The defaults are empty strings. + +@vindex libraryCommand +@cindex library command +@cindex loading elements +@cindex unix command +@item libraryCommand (string) +@pcb{} uses a command to read element data from libraries. +The resources is used to set the command which is executed by the users +default shell. Three escape sequences are defined to pass the selected +filename (%f), the current search path (%p) as well (%a) as the three +parameters @emph{template}, @emph{value} and @emph{package} to the command. +It must write the element data to its standard output. The default value is +@example + NONE/share/pcb/oldlib/QueryLibrary.sh %p %f %a +@end example + +@vindex elementContentsCommand +@cindex library contents command +@cindex listing library contents +@cindex unix command +@item libraryContentsCommand (string) +Similar to @emph{libraryCommand}, @pcb{} uses the command specified +by this resource to list the contents of a library. +@example + NONE/share/pcb/oldlib/ListLibraryContents.sh %p %f +@end example +is the default. + +@vindex libraryFilename +@cindex default library +@cindex library name +@item libraryFilename (string) +The resource specifies the name of the library. The default value is +@emph{pcblib} unless changed at compile time +with the @code{LIBRARYFILENAME} variable in @file{globalconfig.h}. + +@vindex libraryPath +@cindex searchpath for libraries +@cindex path for libraries +@cindex library searchpath +@item libraryPath (string) +A colon separated list of directories that will be passed to the commands +specified by @emph{elementCommand} and @emph{elementContentsCommand}. + +@vindex lineThickness +@cindex lines, size +@cindex size of lines +@cindex thickness of lines +@item lineThickness (dimension) +The value, in the range [1..250] (the range may be changed at compile +time with the @code{MIN_LINESIZE} and @code{MAX_LINESIZE} variables in +@file{globalconfig.h}), defines the +initial thickness of new lines. The value is preset to @emph{ten mil}. + +@vindex media +@cindex media +@cindex media margin +@cindex print media +@item media ( | x+-+-) +The default (user defined) media of the @code{PostScript} device. Predefined +values are @emph{a3}, @emph{a4}, @emph{a5}, @emph{letter}, @emph{tabloit}, +@emph{ledger}, @emph{legal}, and @emph{executive}. +The second way is to specify the medias width, height and margins in mil. +The resource defaults to @emph{a4} size unless changed at compile time +with the @code{DEFAULT_MEDIASIZE} variable in @file{globalconfig.h}. + +@vindex offLimitColor +@cindex colors +@cindex off limit color +@item offLimitColor (color) +The area outside the current maximum settings for width and height is drawn +with this color. The default value is determined by @emph{XtDefaultBackground}. + +@vindex pinColor +@vindex pinSelectedColor +@cindex colors +@cindex pin color +@item pinColor (color) +@itemx pinSelectedColor(color) +This resource defines the drawing color of pins and pads in both states. +The values are preset to @emph{XtDefaultForeground}. + +@vindex pinoutFont0..6 +@cindex font, used for pin names +@cindex pinout, font to display pin names +@item pinoutFont (string) +This fonts are used to display pin names. There is one font for each zoom +value. The values are preset to @emph{XtdefaultFont}. + +@vindex pinoutNameLength +@cindex namelength of pins +@cindex pin, name of +@cindex length of a pin name +@item pinoutNameLength (int) +This resource limits the number of characters which are displayed for +pin names in the pinout window. By default the string length is limited +to @emph{eight} characters per name. + +@vindex pinoutOffsetX +@vindex pinoutOffsetY +@cindex offset of pinout +@item pinoutOffsetX (int) +@itemx pinoutOffsetY (int) +These resources determine the offset in @emph{mil} of the circuit from the +upper left corner of the window when displaying pinout information. +Both default to @emph{100 mil}. + +@vindex pinoutTextOffsetX +@vindex pinoutTextOffsetY +@cindex offset of pinnames +@item pinoutTextOffsetX (int) +@itemx pinoutTextOffsetY (int) +The resources determine the distance in mil between the drilling hole of a pin +to the location where its name is displayed in the pinout window. +They default to @emph{X:50} and @emph{Y:0}. + +@vindex pinoutZoom +@cindex pinout, zoomfactor of display +@cindex zoom of pinout window +@item pinoutZoom (int) +Sets the zoom factor for the pinout window according to the formula: +scale = 1:(2 power value). Its default value is @emph{two} which results in +a @emph{1:4} scale. + +@vindex printCommand +@cindex printing +@item printCommand (string) +Default file for printouts. If the name starts with a '|' the output +is piped through the command. A %f is replaced by the current filename. +There is no default file or command. + +@vindex raiseLogWindow +@cindex log window +@cindex messages +@item raiseLogWindow (boolean) +The log window will be raised when new messages arrive if this resource +is set @emph{true}, the default. + +@vindex ratCommand +@cindex rats nest +@cindex netlist +@item ratCommand (string) +Default command for reading a netlist. A %f is replaced by the netlist +filename. Its default value is "@emph{cat %f}". + +@vindex ratPath +@cindex rats nest +@cindex netlist +@item ratPath (string) +Default path to look for netlist files. It's default value is "." + +@vindex resetAfterElement +@cindex connections, reseting after element +@cindex reseting found connections +@item resetAfterElement (boolean) +If set to @emph{true}, all found connections will be reset before a new +element is scanned. This will produce long lists when scanning the whole +layout for connections. The resource is set to @emph{false} by default. +The feature is only used while looking up connections of all elements. + +@vindex ringBellWhenFinished +@cindex keyboard bell +@item ringBellWhenFinished (boolean) +Whether to ring the bell (the default) when a possibly lengthy operation +has finished or not. +See also, the command-line option @emph{--ring-bell-finished}. + +@vindex routeStyle +@cindex routing style +@item routeStyle (string) +Default values for the menu of routing styles (seen in the sizes menu). +The string is a comma separated list of name, line thickness, +via diameter, and via drill size. +e.g. "Fat,50,100,40:Skinny,8,35,20:75Ohm,110,110,20" +See also, the command-line option @emph{--route-styles} and @emph{Sizes Menu} + +@vindex rubberBandMode +@cindex move +@cindex rubberband +@cindex rotate +@item rubberBandMode (boolean) +Whether rubberband move and rotate (attached lines stretch like +rubberbands) is enabled (the default). + +@vindex saveCommand +@cindex file save command +@cindex layout files +@cindex saving layouts +@cindex postprocessing layout data +@cindex unix command +@cindex cat +@item saveCommand (string) +This command is used to save data to a layout file. The filename may be +indicated by placing @code{%f} in the string. It must read the data from +its standard input. The default command is: +@example + cat - > %f +@end example +See also, the command-line option @emph{--save-command}. + +@vindex saveInTMP +@cindex backup +@cindex saving layouts +@cindex preventing loss of data +@cindex temporary files +@cindex /tmp +@cindex directory /tmp +@item saveInTMP (boolean) +Enabling this resource will save all data which would otherwise be lost +in a temporary file @file{/tmp/PCB.%i.save}. The file name may +be changed at compile time +with the @code{EMERGENCY_NAME} variable in @file{globalconfig.h}. +. +@emph{%i} is replaced by the process ID. +As an example, loading a new layout when the old one hasn't been saved would +use this resource. +See also, the command-line option @emph{--save-in-tmp}. + +@vindex saveLastCommand +@cindex saving last entered user command +@cindex inputfield, saving entered command-line +@item saveLastCommand (boolean) +Enables the saving of the last entered user command. The option is +@emph{disabled} by default. +See also, the command-line option @emph{--save-last-command}. + +@vindex shrink +@cindex shrink +@cindex drc +@item Shrink (dimension) +Specifies the minimum overlap (touching) design rule in mils. + +@vindex size +@cindex default layout size +@cindex layout, default size of +@item size (x) +Defines the width and height of a new layout. The default is +@emph{7000x5000} unless changed at compile time +with the @code{DEFAULT_SIZE} variable in @file{globalconfig.h}. + + +@vindex stipplePolygons +@cindex polygon +@cindex display +@item stipllePolygons (boolean) +Determines whether to display polygons on the screen with a stippled +pattern. Stippling can create some amount of transparency so that +you can still (to some extent) see layers beneath polygons. +It defaults to False. + +@vindex textScale +@cindex text, default scaling +@cindex default text scaling +@item textScale (dimension) +The font scaling in percent is defined by this resource. The default is +@emph{100} percent. + +@vindex useLogWindow +@cindex log window +@cindex messages +@item useLogWindow (boolean) +Several subroutines send messages to the user if an error occurs. +This resource determines if they appear inside the log window or as a separate +dialog box. See also, the resource @emph{raiseLogWindow} and the command line +option @emph{-loggeometry}. +The default value is @emph{true}. + +@vindex viaColor +@vindex viaSelectedColor +@cindex colors +@cindex vias, color +@item viaColor (color) +@item viaSelectedColor (color) +This resource defines the drawing color of vias in both states. +The values are preset to @emph{XtDefaultForeground}. + +@vindex viaThickness +@vindex viaDrillingHole +@cindex vias, size +@cindex size of vias +@cindex thickness of vias +@item viaThickness (dimension) +@itemx viaDrillingHole (dimension) +The initial thickness and drilling hole of new vias. The values must be in the +range [30..400] (the range may be changed at compile +time with the @code{MIN_PINORVIASIZE} and @code{MAX_PINEORVIASIZE} variables in +@file{globalconfig.h}), with at least 20 +mil of copper. +The default thickness is @emph{40 mil} and the default drilling hole is +@emph{20 mil}. + +@vindex volume +@cindex speaker volume +@cindex volume of speaker +@item volume (int) +The value is passed to @code{XBell()} which sets the volume of the @code{X} +speaker. +The value lies in the range -100..100 and it defaults to the maximum volume of +@emph{100}. + +@vindex warnColor +@cindex colors +@cindex color, warning +@item warnColor (color) +This resources defines the color to be used for drawing pins and pads when +a warning has been issued about them. + +@vindex zoom +@cindex zoom of Layout area +@item zoom (int) +The initial value for output scaling is set according to the following +formula: scale = 1:(2 power value). It defaults to @emph{three} which results +in an output scale of @emph{1:8}. + +@end table + +Refer also to @ref{Command-Line Options}. + +@node Actions +@section Actions +@cindex actions +@cindex translations +@cindex key translations +@cindex button translations +@cindex X11 translations + +All user accessible commands may be bound to almost any @code{X} event. Almost +no default binding for commands is done in the binaries, so it is vital for the +application that at least a system-wide application resource file exists. +This file normally resides in the @file{share/pcb} directory and +is called @file{Pcb}. The bindings to which the manual refers to are the +ones as defined by the shipped resource file. Besides binding an action to +an X11 event, you can also execute any action command using a ":" command +(see @ref{User Commands}). + +Take special care about translations related to the functions keys and the +pointer buttons because most of the window managers use them too. +Change the file according to your hardware/software environment. +You may have to replace all occurances of @emph{baseTranslations} to +@emph{translations} if you use a @code{X11R4} server. + +Passing @emph{Object} as an argument to an action routine causes the object +at the cursor location to be changed, removed or whatever. If more than +one object is located at the cross hair position the smallest type is used. +If there are two of the same type the newer one is taken. +@emph{SelectedObjects} will handle all selected and visible objects. + + +@table @samp +@findex AddRats() +@cindex rats nest +@cindex netlist +@cindex rat-line +@item AddRats(AllRats|SelectedRats) +Adds rat-lines to the layout using the loaded netlist file (see the @emph{:rn}, +@ref{User Commands}.). Rat lines are added on the active layer using the current +line thickness shown in the status line. +Only missing connectivity is added by the +AddRats command so if, for example, the layout is complete nothing will be added. +Rat lines may be drawn different to other lines on the screen +to make them easier to identify since they cannot appear in a completed layout. +The rat-lines are added in the minimum length straight-line tree pattern +(always ending on pins or pads) that satisfies the missing connectivity in the circuit. +If a SMD pad is unreachable on the active layer, a warning will be issued +about it and the rat-line to that pad will not be generated. +If connections exist on the board which are not listed in the netlist while +AllRats are being added, warning messages will be issued and the affected pins and +pads will be drawn in a special @emph{warnColor} until the next @emph{Notify()} event. +If the entire layout agrees completely with the net-list a message informs you that +the layout is complete and no rat-lines are added (since none are needed). +If @emph{SelectedRats} +is passed as the argument, only those missing connections that might connect among +the selected pins and pads are drawn. +Default: +@example +Nonew: AddRats(AllRats) +!Shiftw: AddRats(SelectedRats) +Noneo: DeleteRats(AllRats) AddRats(AllRats) +!Shifto: DeleteRats(SelectedRats) AddRats(SelectedRats) +@end example + +@findex ApplyVendor() +@cindex vendor map +@cindex vendor drill table +@item ApplyVendor() +Applies an already loaded vendor drill map to the design. +@example +ApplyVendor() +@end example + +@findex Atomic() +@cindex undo, multi-action resources +@cindex atomic +@item Atomic(Save|Restore|Block|Close) +Controls the undo grouping of sequences of actions. Before the first action +in a group, Atomic(Save) should be issued. After each action that might +be undoable, Atomic(Restore) should be issued. Atomic(Block) concludes +and save the undo grouping if there was anything in the group to undo. +Atomic(Close) concludes and save the undo grouping even if nothing was +actually done. Thus it might produce an "empty" undo. This can be useful +when you want to use undo in a group of actions. + +@findex Bell() +@cindex signal +@cindex bell +@item Bell([-100..100]) +Rings the bell of your display. If no value is passed the setting +of the resource @emph{volume} will be used. + +@findex ChangeClearSize() +@cindex change sizes +@cindex sizes, changing of objects +@cindex clearance, changing of objects +@item ChangeClearSize(Object, value[, unit]) +@itemx ChangeClearSize(SelectedPins|SelectedVias, value[, unit]) +The effect of this action depends on if the soldermask display is presently +turned on or off. If soldermask is displayed, then the soldermask +relief size will be changed. If soldermask display is turned off, +then the clearance to polygons will be changed. +@emph{unit} is "mil" or "mm". If not specified the units will default +to the internal unit of 0.01 mil. +@example +!Mod1k: ChangeClearSize(Object, +2, mil) +!Mod1 Shiftk: ChangeClearSize(Object, -2, mil) +@end example + +@findex ChangeDrillSize() +@cindex change sizes +@cindex sizes, changing of objects +@cindex drilling hole, changing of objects +@item ChangeDrillSize(Object, value[, unit]) +@itemx ChangeDrillSize(SelectedPins|SelectedVias, value[, unit]) +This action routine changes the drilling hole of pins and vias. +If @emph{value} starts with + or -, then it adds (or subtracts) +@emph{value} from the current hole diameter, otherwise it sets the +diameter to the value. +@emph{unit} is "mil" or "mm". If not specified the units will default +to the internal unit of 0.01 mil. +Default: +@example +!Mod1s: Change2ndSize(Object, +5, mil) +!Mod1 Shifts: Change2ndSize(Object, -5, mil) +@end example + +@findex ChangeFlag() +@cindex flags, changing +@cindex octagonal flag, changing +@cindex square flag, changing +@cindex thermal flag, changing +@item ChangeFlag(Object|SelectElements|SelectedPins|SelectedVias|Selected,thermal|octagon|square,0|1) +Sets/clears the indicated flag. This adds/removes thermals, adds/removes the flag +which indicates a pin/pad should be square, or adds/removes the flag which +indicates a pin/pad should be octagonal. +@example +:ChangeFlag(SelectedVias,thermal,1) +:ChangeFlag(SelectedPads,square,0) +@end example + +@findex ChangeHole() +@cindex vias, converting to mounting hole +@cindex mounting holes +@item ChangeHole(Object|SelectedVias) +This action routine converts a via to and from a hole. A hole is +a via that has no copper annulus. The drill size for the via +determines the hole diameter. +@example +!Ctrlh: ChangeHole(Object) +@end example + +@findex ChangeName() +@cindex name, change an objects +@cindex change object name +@cindex object, change name of +@item ChangeName(Object) +@itemx ChangeName(Layer|Layout) +Changes the name of the visible object at the cursor location. A text object +doesn't have a name therefore the text string itself is changed. +The element name currently used for display is always the one changed with this +command. +See @emph{Display(Description|NameOnPCB|Value)} for details. +Passing @emph{Layer} changes the current layers name. +Default: +@example +Nonen: ChangeName(Object) +@end example + +@findex ChangeOctagon() +@cindex pins, changing shape of +@cindex vias, changing shape of +@cindex octagonal pins and vias +@item ChangeOctagon(Object|SelectElements|SelectedPins|SelectedVias|Selected) +Toggles what shape the affected pin(s) or via(s) will be drawn when they +are not square. The shape will either be round or octagonal. +Default: +@example +!Ctrlo: ChangeOctagon(Object) +@end example + +@findex ChangePinName() +@cindex changing pin/pad names +@cindex pin/pad names, changing +@item ChangePinName(ElementName, PinNumber, PinName) +Changes the name for a specified pin or pad number on a specified element. +This action is typically used to forward annotate pin/pad names from a schematic +to the layout. +@example +ChangePinName(U1, 14, VDD) +@end example + + +@findex ChangeSize() +@cindex change sizes +@cindex sizes, changing of objects +@cindex thickness, changing of objects +@item ChangeSize(Object, value[, unit]) +@itemx ChangeSize(SelectedLines|SelectedPins|SelectedVias, value[, unit]) +@itemx ChangeSize(SelectedPads|SelectedTexts|SelectedNames, value[, unit]) +@itemx ChangeSize(SelectedElements, value[, unit]) +To change the size of an object you have to bind these action to some +@code{X} event (or use :ChangeSize(...)). If @emph{value} begins with +a + or - then the value will be added (or subtracted) from the current +size, otherwise the size is set equal to @emph{value}. Range checking is +done to insure that none of the maximum/minimums of any size are violated. +If @emph{Object} is passed then a single object at the cursor location is +changed. If any of the @emph{Selected} arguments are passed then all selected +and visible objects of that type are changed. If the type being modified is +an element, then the thickness of the silkscreen lines defining the element +is changed. +@emph{unit} is "mil" or "mm". If not specified the units will default +to the internal unit of 0.01 mil. +Default: +@example +Nones: ChangeSize(Object, +5) +!Shifts: ChangeSize(Object, -5) +@end example + +@findex ChangeSquare() +@cindex change square flag +@cindex square flag, changing of objects +@cindex thickness, changing of objects +@item ChangeSquare(Object|SelectedElements|SelectedPins) +Toggles the setting of the square flag. The flag is used to identify a +certain pin, normally the first one, of circuits. It is also used to +make SMD pads have square ends. +@example +Noneq: ChangeSquare(Object) +@end example + +@findex ClrFlag() +@cindex flags, clearing +@cindex flags, clearing +@cindex octagonal flag, clearing +@cindex square flag, clearing +@cindex thermal flag, clearing +@item ClrFlag(Object|SelectElements|SelectedPins|SelectedVias|Selected,thermal|octagon|square) +Clears the indicated flag. This removes thermals, removes the flag +which indicates a pin/pad should be square, or removes the flag which +indicates a pin/pad should be octagonal. +@example +:ClrFlag(SelectedVias,thermal) +@end example + +@findex Command() +@cindex start user input +@cindex inputfield, start user input +@item Command() +Calling @emph{Command()} pops up an input line at the bottom of the window +which allows you to enter commands. Including all action commands! +The dialog ends when @emph{NoneReturn} +to confirm or @emph{NoneEscape} to abort is entered. +Default: +@example +colon: Command() +@end example + +@findex Connection() +@cindex scanning connections +@cindex searching connections +@cindex connections, reseting +@cindex reseting found connections +@cindex connections, searching for +@cindex saving found connections +@item Connection(Find) +@itemx Connection(ResetFoundLinesAndRectangles|ResetPinsViasAndPads|Reset) +The @emph{Connection()} action is used to mark all connections from one pin, +line or via to others. +The @emph{ResetFoundLinesAndRectangles, ResetFoundPinsAndVias} and +@emph{Reset} arguments may be used to reset all marked lines and rectangles, +vias and pins or all of them. The search starts with the pin or via +at the cursor position. All found objects are drawn with the color +defined by the resource @emph{connectedColor}. +See also, @emph{Display(Description|NameOnPCB|Value)}. +Default: +@example +!Shiftc: Connection(Reset) +Nonef: Connection(Find) +!Shiftf: Connection(Reset) +@end example + +@findex DeleteRats() +@cindex rats nest +@cindex rat-line +@cindex netlist +@item DeleteRats(AllRats|SelectedRats) +This routine deletes either all rat-lines in the layout, or only +the selected and visible ones. Non-rat-lines and other layout +objects are unaffected. +Default: +@example +Nonee: DeleteRats(AllRats) +!Shifte: DeleteRats(SelectedRats) +@end example + +@findex DisableVendor() +@cindex vendor map, disabling +@cindex vendor drill table, disabling +@item DisableVendor() +Disables automatic drill size mapping to the loaded vendor drill table. +@example +DisableVendor() +@end example + +@findex DisperseElements() +@cindex dispersing elements +@cindex distributing elements +@cindex elements, dispersing +@cindex elements, distributing +@item DisperseElements(All|Selected) +Disperses either all elements or only the selected elements in the +layout. This action should be used at the +start of a design to spread out all footprints before any placement or +routing is done. +@example +DisperseElements(All) +@end example + + +@findex Display() +@cindex centering +@cindex redrawing layout +@cindex refreshing layout +@cindex name of an element +@cindex displaying element names +@cindex element, display names of +@cindex grid, absolute and relative +@cindex grid, display +@cindex rubberband +@cindex pinout, display of +@cindex displaying pinout +@cindex lines, clipping to 45 degree +@cindex clipping lines to 45 degree +@item Display(Description|NameOnPCB|Value) +@itemx Display(Toggle45Degree|CycleClip) +@itemx Display(Grid|ToggleGrid) +@itemx Display(ToggleRubberBandMode) +@itemx Display(Center|ClearAndRedraw|Redraw) +@itemx Display(Pinout|PinOrPadName) +This action routines handles some output related settings. It is +used to center the display around the cursor location and to redraw the +output area optionally after clearing the window. +Centering is done with respect to the @emph{grid} setting. Displaying the +grid itself may be switched on and off by @emph{Grid} but only if +the distance between two pixels exceeds 4 pixels. +@pcb{} is able to handle several labels of an element. One of them +is a description of the functionality (eg resistor), the second should be +a unique identifier (R1) whereas the last one is a value (100k). +The @emph{Display()} action selects which of the names is displayed. +It also controls which name will be affected by the @emph{ChangeName} command. +If @emph{ToggleGrid} is passed, @pcb{} changes between relative +('rel' in the statusline) and absolute grid (an 'abs' in the statusline). +Relative grid means the pointer position when the command is issued is +used as the grid origin; while (0,0) is used in the absolute grid case. +Passing @emph{Pinout} displays the pinout of the element at the current +cursor location whereas @emph{PinOrPadName} toggles displaying of the +pins or pads name under the cursor. If none of them matches but the cursor +is inside of an element, the flags is toggled for all of its pins and pads. +For details about rubberbands see also the details about @emph{Mode}. +Default: +@example +Nonec: Display(Center) +Noned: Display(PinOrPadName) +!Shiftd: Display(Pinout) +Noner: Display(ClearAndRedraw) +None.: Display(Toggle45Degree) +None/: Display(CycleClip) +@end example + +@findex DRC() +@cindex design rule checking +@cindex drc +@item DRC() +Initiates design rule checking of the entire layout. Must be repeated +until no errors are found. + +@findex ExecuteFile() +@cindex actions file, executing +@cindex script file, executing +@item ExecuteFile(filename) +Executes the PCB actions contained in the specified file. +This can be used to automate a complex sequence of operations. +@example +:ExecuteFile(custom.cmd) +@end example +The command file contains a list of PCB actions. Blank lines +are ignored and lines starting with a # are treated as comment +lines. For example +@example +# This is a comment line +Display(Grid) +SetValue(Zoom,2) +DRC() +@end example + +@findex EditLayerGroups() +@cindex layers, editing of groups +@cindex groups, editing of +@item EditLayerGroups() +Pops up a dialog box to edit the layergroup setting. The function is also +available from the @emph{Objects} menu. +There are no defaults. + +@findex EnableVendor() +@cindex vendor map, enabling +@cindex vendor drill table, enabling +@item EnableVendor() +Enables automatic drill size mapping to the loaded vendor drill table. +@example +EnableVendor() +@end example + + +@findex Load() +@cindex loading files +@item Load(ElementToBuffer|Layout|LayoutToBuffer|Nelist) +This routine pops up a fileselect box to load layout, element data, +or netlist. +The passed filename for layout data is saved and may be reused. +@emph{ElementToBuffer} and @emph{LayoutToBuffer} load the data into the +current buffer. +There are no defaults. + +@findex LoadVendor() +@cindex vendor map, loading +@cindex vendor drill table, loading +@item LoadVendor(vendorfile) +Loads the specified vendor resource file. +@example +LoadVendor(myvendor.res) +@end example + +@findex MarkCrosshair() +@cindex mark +@cindex cursor position +@item MarkCrosshair() +This routine marks the current cursor location with an X, and then +the cursor display shows both absolute position and position relative to +the mark. If a mark is already present, this routine removes it and +stops displaying relative cursor coordinates. +Defaults: +@example +!Ctrlm: MarkCrosshair() +@end example + +@findex Mode() +@cindex mode, selecting of +@cindex operation modes, selecting of +@item Mode(Copy|InsertPoint|Line|Move|None|PasteBuffer|Polygon|Thermal) +@itemx Mode(Remove|Rectangle|RubberbandMove|Text|Via) +@itemx Mode(Cycle) +@itemx Mode(Notify) +@itemx Mode(Save|Restore) +Switches to a new mode of operation. The active mode is displayed by a thick +line around the matching mode selector button. +Most of the functionality of @pcb{} is implemented by selecting a mode +and calling @emph{Mode(Notify)}. The arguments @emph{Line}, @emph{Polygon}, +@emph{Rectangle}, @emph{Text} and @emph{Via} are used to create the +appropriate object whenever @emph{Mode(Notify)} is called. Some of them, +such as @emph{Polygon}, need more than one call for one object to be created. +@emph{InsertPoint} adds points to existing polygons or lines. +@emph{Save} and @emph{Restore} are used to temporarily save the mode, switch +to another one, call @emph{Mode(Notify)} and restore the saved one. Have +a look at the application resource file for examples. +@emph{Copy} and @emph{Move} modes are used to change an object's location and, +optionally, to create a new one. The first call of @emph{Mode(Notify)} attaches +the object at the pointer location to the cross hair whereas the second +one drops it to the layout. The @emph{rubberband} version of move performs the +move while overriding the current rubberband mode. +Passing @emph{PasteBuffer} attaches the contents of the currently selected +buffer to the cross hair. Each call to @emph{Mode(Notify)} pastes this contents +to the layout. @emph{Mode(Cycle)} cycles through the modes available in the +mode-button pallet. +@emph{Mode(None)} switches all modes off. +Default: +@example +Escape: Mode(None) +space: Mode(Cycle) +NoneBackSpace: Mode(Save) Mode(Remove) Mode(Notify) Mode(Restore) +NoneDelete: Mode(Save) Mode(Remove) Mode(Notify) Mode(Restore) +NoneF1: Mode(Via) +NoneF2: Mode(Line) +NoneF3: Mode(PasteBuffer) +NoneF4: Mode(Rectangle) +NoneF5: Mode(Text) +NoneF6: Mode(Polygon) +NoneF7: Mode(Thermal) +NoneF8: Mode(Arc) +NoneInsert: Mode(InsertPoint) +None[: Mode(Save) Mode(Move) Mode(Notify) +None]: Mode(Notify) Mode(Restore) +None: Mode(Notify) +!Shift Ctrl: Mode(Save) Mode(Remove) Mode(Notify) Mode(Restore) +None: Mode(Save) Mode(Move) Mode(Notify) +None: Mode(Notify) Mode(Restore) +!Mod1: Mode(Save) Mode(Copy) Mode(Notify) +!Mod1: Mode(Notify) Mode(Restore) +Shift BTNMOD: Mode(Save) Mode(RubberbandMove) Mode(Notify) +@end example + +@findex MovePointer() +@cindex pointer, moving of +@cindex cursor movements +@item MovePointer(delta_x, delta_y) +With this function it is possible to move the cross hair cursor by using the +cursor keys. The @code{X} server's pointer follows because the necessary +events are generated by @pcb{}. All movements are performed with respect +to the currently set grid value. +Default: +@example +NoneUp: MovePointer(0, -1) +!ShiftUp: MovePointer(0, -10) +NoneDown: MovePointer(0, 1) +!ShiftDown: MovePointer(0, 10) +NoneRight: MovePointer(1, 0) +!ShiftRight: MovePointer(10, 0) +NoneLeft: MovePointer(-1, 0) +!ShiftLeft: MovePointer(-10, 0) +@end example + +@findex MoveToCurrentLayer() +@cindex objects, moving to current layer +@cindex moving objects to current layer +@item MoveToCurrentLayer(Object|SelectedObjects) +The function moves a single object at the cross hair location or all selected +objects to the current layer. Elements are not movable by this function. +They have to be deleted and replaced on the other side. +If a line segment is moved and the movement would result in a loss of +connectivity to another segment then via(s) are automatically added to +maintain the connectivity. +@example +Nonem: MoveToCurrentLayer(Object) +!Shiftm: MoveToCurrentLayer(SelectedObjects) +@end example + +@findex New() +@cindex layout, start a new +@cindex starting a new layout +@item New() +Clear the current layout and starts a new one after entering its name. +Refer to the resource @emph{backup} for more information. +No defaults. + +@findex PasteBuffer() +@cindex buffer, selecting a +@cindex pastebuffer, selecting a +@cindex selecting a buffer +@cindex rotating a buffer +@cindex cutting objects +@cindex copying objects +@item PasteBuffer(AddSelected|Clear|1..5) +@itemx PasteBuffer(Rotate, 1..3) +@itemx PasteBuffer(Convert) +This action routine controls and selects the pastebuffer as well as all +cut-and-paste operations. Passing a buffer number selects one in of the +range 1..5. The statusline is updated with the new number. +@emph{Rotate} performs a number of 90 degree counter clockwise rotations +of the buffer contents. @emph{AddSelected} as first argument copies all +selected and visible objects into the buffer. Passing @emph{Clear} removes +all objects from the currently selected buffer. @emph{Convert} causes +the contents of the buffer (lines, arc, vias) to be converted into an +element definition. Refer to @ref{Pastebuffer} +for examples. +Default: +@example +!Ctrlx: PasteBuffer(Clear) PasteBuffer(AddSelected) + Mode(PasteBuffer) +!Shift Ctrlx: PasteBuffer(Clear) PasteBuffer(AddSelected) + RemoveSelected() Mode(PasteBuffer) +!Mod1c: PasteBuffer(Clear) PasteBuffer(AddSelected) +!Mod1x: PasteBuffer(Clear) PasteBuffer(AddSelected) + RemoveSelected() +!Shift1: PasteBuffer(1) +!Shift2: PasteBuffer(2) +!Shift3: PasteBuffer(3) +!Shift4: PasteBuffer(4) +!Shift5: PasteBuffer(5) +NoneF3: Mode(PasteBuffer) +@end example + +@findex Polygon() +@cindex polygon, closing a +@cindex polygon point, go back to previous +@cindex closing a polygon +@item Polygon((Close|PreviousPoint) +Polygons need a special action routine to make life easier. Calling +@emph{Polygon(PreviousPoint)} resets the newly entered corner to the +previous one. The Undo action will call Polygon(PreviousPoint) +when appropriate to do so. @emph{Close} creates the final +segment of the polygon. This may fail if clipping to 45 degree +lines is switched on, in which case a warning is issued. +Default: +@example +Nonep: Polygon(Close) +!Shiftp: Polygon(Close) +@end example + +@findex Print() +@cindex layout, printing a +@cindex printing a layout +@item Print() +Pops up a print control box that lets you select the output +device, scaling and many more options. Each run creates all +files that are supported by the selected device. These are +mask files as well as drilling files, silk screens and so on. The table +shows the filenames for all possible files: +@example + POSIX (extension) 8.3 filename + --------------------------------------------- + *_componentmask.* cmsk.* + *_componentsilk.* cslk.* + *_soldermask.* smsk.* + *_soldersilk.* sslk.* + *_drill.* dril.* + *_groundplane.* gpl.* + *_group[1..8].* [..8].* +@end example +The output may be sent to a post-processor by starting the filename with the +@emph{pipe} @code{("|")} character. Any @code{"%f"} in a command is replaced +with the current filename. The function is available from the @emph{file} menu. +There are no defaults. + +@findex Quit() +@cindex quit +@cindex exit +@item Quit() +Quits the application after confirming the operation. +Default: +@example +WM_PROTOCOLS: Quit() +@end example + +@findex Redo() +@cindex redo +@cindex recover +@item Redo() +This routine allows you to recover from the last undo command. +You might want to do this if you thought that undo was going to +revert something other than what it actually did (in case you +are confused about which operations are un-doable), or if you +have been backing up through a long undo list and over-shoot +your stopping point. Any change that is made since the undo +in question will trim the redo list. For example if you add +ten lines, then undo three of them you could use redo to put +them back, but if you move a line on the board before performing +the redo, you will lose the ability to "redo" the three "undone" lines. +Default: +@example +!Shiftr: Redo() +@end example + +@findex RemoveSelected() +@cindex removing selected objects +@cindex selected object, removing an +@item RemoveSelected() +This routine removes all visible and selected objects. +There are no defaults. + +@findex Report() +@cindex report +@cindex information about objects +@cindex drill +@item Report(Object|DrillReport) +This routine pops up a dialog box describing the various +characteristics of an object (or piece of an object such as a pad or pin) +in the layout at the cursor position, or a report about all of the +drill holes in the layout. +There are no defaults. + +@findex RouteStyle() +@cindex routing style +@cindex size of lines and vias +@item RouteStyle(1|2|3|4) +This routine copies the sizes corresponding to the numbered route style +into the active line thickens, via diameter, and via drill size. +Defaults: +@example +!Ctrl1: RouteStyle(1) +... +!CtrlNUM_STYLES: RouteStyle(NUM_STYLES) +@end example +The variable @code{NUM_STYLES} is set at compile time in +@file{globalconfig.h}. + +@findex Save() +@cindex saving files +@cindex saving connections +@item Save(Layout|LayoutAs) +@itemx Save(AllConnections|AllUnusedPins|ElementConnections) +Passing @emph{Layout} saves the layout using the file from which it was +loaded or, if it is a new layout, calls @emph{Save(LayoutAs)} which queries +the user for a filename. +The values: @emph{AllConnections}, @emph{AllUnusedPins} and +@emph{ElementConnections} start a connection scan and save all connections, +all unused pins or the connections of a single element to a file. +There are no defaults. + +@findex Select() +@cindex selection +@cindex selecting objects +@item Select(All|Block|Connection|ToggleObject) +@itemx Select(ElementByName|ObjectByName|PadByName|PinByName) +@itemx Select(TextByName|ViaByName) +Toggles either the selection flag of the object at the cross hair position +(@emph{ToggleObject}) or selects all visible objects, all inside a +rectangle or all objects which have been found during the last connection +scan. The @emph{ByName} functions use a @ref{Regular Expressions} search, +always case insensitive, to select the objects. +Default: +@example +None: Select(ToggleObject) +None,None: See resource file - this is complex +@end example + +@findex SetFlag() +@cindex flags, setting +@cindex octagonal flag, setting +@cindex square flag, setting +@cindex thermal flag, setting +@item SetFlag(Object|SelectElements|SelectedPins|SelectedVias|Selected,thermal|octagon|square) +Sets the indicated flag. This adds thermals, sets the flag +which indicates a pin/pad should be square, or sets the flag which +indicates a pin/pad should be octagonal. +@example +:SetFlag(Selected,thermal) +@end example + +@findex SetValue() +@cindex change settings +@cindex zoom, setting of +@cindex grid, setting of +@cindex drilling hole, setting of initial size +@cindex vias, setting of initial size +@cindex lines, setting of initial size +@item SetValue(Grid|LineSize|TextScale|ViaDrillingHole|ViaSize|Zoom, value) +Some internal values may be changed online by this function. +The first parameter specifies which data has to be changed. The other one +determines if the resource is set to the passed value, if @emph{value} is +specified without sign, or increments/decrements if it is specified with +a plus or minus sign. +The function doesn't change any existing object only the initial values of +new objects. Use the @emph{ChangeSize()} and @emph{ChangeDrillSize()} +to change existing objects. +Default: +@example +Noneg: SetValue(Grid, +5) +!Shiftg: SetValue(Grid, -5) +Nonel: SetValue(LineSize, +5) +!Shiftl: SetValue(LineSize, -5) +Nonet: SetValue(TextScale, +10) +!Shiftt: SetValue(TextScale, -10) +Nonev: SetValue(ViaSize, +5) +!Shiftv: SetValue(ViaSize, -5) +!Mod1v: SetValue(ViaDrillingHole, +5) +!Mod1 Shiftv: SetValue(ViaDrillingHole, -5) +Nonez: SetValue(Zoom, -1) +!Shiftz: SetValue(Zoom, +1) +@end example + +@findex SwapSides() +@cindex change viewing side +@cindex viewing side, changing of +@item SwapSides() +This routine changes the board side you are viewing. +Default: +@example +NoneTab: SwapSides() +@end example + +@findex SwitchDrawingLayer() +@cindex change drawing layer +@cindex layer, change active +@item SwitchDrawingLayer(value) +Makes layer number 1..MAX_LAYER the current one. +Default: +@example +None1: SwitchDrawingLayer(1) +... +NoneMAX_LAYER: SwitchDrawingLayer(MAX_LAYER) +@end example + +@findex ToggleHideName() +@cindex hide element name +@cindex element name, hiding +@cindex element name, removing from silk-screen +@item ToggleHideName(Object|SelectedElements) +Toggles whether the element's name is displayed or hidden. If it +is hidden you won't see it on the screen and it will not appear +on the silk layer when you print the layout. +@example +Noneh: ToggleHideName(Object) +!Shifth: ToggleHideName(SelectedElements) +@end example + +@findex ToggleVendor() +@cindex vendor map, toggling +@cindex vendor drill table, toggling +@item ToggleVendor() +Toggles automatic drill size mapping to the loaded vendor drill table. +@example +ToggleVendor() +@end example + +@findex ToggleVisibility() +@cindex toggle layer visibility +@cindex layer visibility, toggling +@item ToggleVisibility(Layer) +Toggles the visibility of the layer. +@example +Mod11: ToggleVisibility(1) +Mod12: ToggleVisibility(2) +Mod13: ToggleVisibility(3) +Mod14: ToggleVisibility(4) +@end example + +@findex Undo() +@cindex undo +@cindex recover +@item Undo() +@itemx Undo(ClearList) +The unlimited undo feature of @pcb{} allows you to recover +from most operations that materially affect you work. +Calling @emph{Undo()} without any parameter recovers +from the last (non-undo) operation. @emph{ClearList} is used to release the +allocated memory. @emph{ClearList} is called whenever a new layout is started +or loaded. See also @emph{Redo}. +Default: +@example +Noneu: Undo() +!Shift Ctrlu: Undo(ClearList) +@end example + +@findex UnloadVendor() +@cindex vendor map, unloading +@cindex vendor drill table, unloading +@item UnloadVendor() +Unloads the loaded vendor drill table. +@example +UnloadVendor() +@end example + +@findex Unselect() +@cindex selection +@cindex unselect objects +@item Unselect(All|Block|Connection) +Unselects all visible objects, all inside a rectangle or all objects which +have been found during the last connection scan. +Default: +@example +!Shift : Mode(Save) Mode(None) Unselect(Block) +!Shift : Unselect(Block) Mode(Restore) +@end example + +@end table + + +@node Translations +@section Default Translations +@cindex translations +@cindex default translations +@cindex X11 default translations + +This section covers some default translations of key and button events as +defined in the shipped default application resource file. Most of them have +already been listed in @ref{Actions}. @pcb{} makes use of a nice @code{X11} +feature; calling several action routines for one event. + +@table @samp + +@cindex removing objects +@cindex removing connections +@cindex object, removing an +@cindex connection, removing an +@item NoneBackSpace: +@item NoneDelete: +@itemx !ShiftBackSpace: +@itemx !Shift Ctrl: +The object at the cursor location is removed by @emph{NoneBackSpace} or +@emph{Shift Ctrl} whereas @emph{ShiftBackSpace} also removes +all other objects that are fully-connected to the one at the cursor location. + +@cindex scrolling +@item !Mod1 CtrlLeft: +@itemx !Mod1 CtrlRight: +@itemx !Mod1 CtrlUp: +@itemx !Mod1 CtrlDown: +Scroll one page in one of the four directions. + +@cindex scrolling +@item NoneLeft:, !ShiftLeft: +@itemx NoneRight:, !ShiftRight: +@itemx NoneUp:, !ShiftUp: +@itemx NoneDown:, !ShiftDown: +Move cross hair either one or ten points in grid. + +@cindex user input +@item NoneReturn: +Finished user input, selects the 'default' button of dialogs. + +@cindex user input +@item NoneEscape: +@emph{Mode(Reset)}, aborts user input, selects the 'abort' button of +dialogs or resets all modes. + +@cindex element, move name of +@cindex object, move an +@cindex object, copy an +@cindex move an object +@cindex copy an object +@item None, Btn2, None: +@itemx !Mod1, Btn2, !Mod1: +The first sequence moves the object or element name at the cursor location. +The second one copies the objects. Copying isn't available for +element names. + +@end table + + +@c --------------------------- chapter 6 ------------------------------- +@node File Formats +@chapter File Formats +@cindex file formats +@cindex ASCII files, format of + +All files used by @pcb{} are read from the standard output of a command +or written to the standard input of one as plain seven bit @code{ASCII}. This +makes it possible to use any editor to change the contents of a layout file. +It is the only way for element or font description files to be created. +To do so you'll need to study the example files @file{example/*} and +@file{default_font} which are shipped with @pcb{}. +For an overview refer to @ref{Intro}. + +@vindex elementCommand +@vindex fileCommand +@vindex fontCommand +@vindex libraryCommand +@vindex libraryContentsCommand +@vindex saveCommand +The following sections provide the necessary information about the syntax of +the files. +Netlist files are not created by @pcb{}, but it does use them. For information +on the format of a netlist file see the @emph{:rn}, +@ref{User Commands}. +The commands described allow you to add almost any additional +functionality you may need. Examples are compressed read and write access as +well as archives. The commands themselves are defined by the resources +@emph{elementCommand}, @emph{fileCommand}, @emph{fontCommand}, +@emph{libraryCommand}, @emph{libraryContentsCommand} and @emph{saveCommand}. +Note that the commands are not saved along with the data. +It is considered an advantage to have the layout file contain all necessary +information, independent of any other files. + +One thing common to all files is they may include comments, newlines, +and carriage returns at any place except within quoted strings. + +@menu +* Pad and Line Representation:: +* Layout File:: +* Element File:: +* Font File:: +* Netlist File:: +* Library Contents File:: +* Library File:: +* File Syntax:: +* Object Flags:: +* PCBFlags:: +@end menu + + + +@node Pad and Line Representation +@section Pad and Line Representation +@cindex pad specification +@cindex file formats, pads and lines + +Pads and lines (copper traces, silk screen lines, etc) are represented by the +line end points and the aperture used to draw the line. It is important to +understand this when creating the pads for a new footprint. The following figure +illustrates a pad or line which is drawn using a square aperture. The end +points (X0,Y0), (X1,Y1) specify the center of the aperture. The size parameter +specifies the size of the aperture. + +@center @image{pad,,,Pad Layout,png} + +Pads and lines are represented in this way because this is how lines are +specified in RS-274X (Gerber) files which are used for creating +the masks used in board manufacturing. In fact, older mask making +equipment created lines in precisely this fashion. A physical aperture was +used to pass light through onto a photosensitive film. + +@node Layout File +@section Layout File Format +@cindex layout files, format of +@cindex format of layout files +@cindex file format, layout data + +The layout file describes a complete layout including symbols, vias, +elements and layers with lines, rectangles and text. This is the most +complex file of all. As @pcb{} has evolved, the file format has +changed several times to accommodate new features. @pcb{} has +always been able to read all older versions of the @code{.pcb} file. +This allows the migration of older designs to newer versions of the +program. Obviously older versions of @pcb{} will not be able +to properly read layout files stored in newer versions of the file +format. + +In practice it is very common for footprint libraries to contain +elements which have been defined in various versions of the @pcb{} +file format. When faced with trying to understand an element file or +layout file which includes syntax not defined here, the best approach +is to examine the file @file{src/parse_y.y} which is the definitive +definition of the file format. + +The PCB layout file contains the following contents, in this order (individual items +are defined in @ref{File Syntax}: + +@table @code + +@item PCB +This names the board and sets its size + +@item Grid +Optional. + +@item Cursor +Optional. + +@item Flags +Optional. + +@item Groups +Optional. + +@item Styles +Optional. + +@item Symbols +Optional. + +@item Vias, Rats, Layers, and Elements +These may occur in any order, at this point in the file. + +@item Netlists +Optional. + +@end table + +@node Element File +@section Element File Format +@cindex element, file format +@cindex format of element files +@cindex file format, element data + +Element files are used to describe one component which then may be used +several times within one or more layouts. You will normally split the +file into two parts, one for the pinout and one for the package description. +Using @code{m4} allows you to define pin names as macros in one file and +include a package description file which evaluates the macros. See +the resource @emph{elementCommand} for more information. The pins (and pads) +must appear in sequential order in the element file (new in 1.5) so that +pin 1 must be the first PIN(...) in the file. + +Doing things this way makes it possible to use one package file for several +different circuits. See the sample files @file{dil*}. + +The lowest x and y coordinates of all sub-objects of an element are +used as an attachment point for the cross hair cursor of the main +window, unless the element has a mark, in which case that's the +attachment point. + + + +@node Font File +@section Font File Format +@cindex font file, format of +@cindex format of font files +@cindex file format, font data + +A number of user defined Symbols are called a font. There is only one per +layout. All symbols are made of lines. See the file @file{default_font} +as an example. + +The lowest x and y coordinates of all lines of a font are transformed to (0,0). + +@node Netlist File +@section Netlist File Format +@cindex netlist, file format +@cindex netlist, reading + +Netlists read by @pcb{} must have this simple text form: + +@example +netname [style] NAME-PINNUM NAME2-PINNUM2 NAME3-PINNUM3 ... [\] +@end example + +@noindent +for each net on the layout. +where "netname" is the name of the net which must be unique for each +net, [style] is an optional route-style name, +NAME is the layout-name name given to an element, +and PINNUM is the (usually numeric) +pin number of the element that connects to the net +(for details on pin numbering see @ref{Element Objects}). +Spaces or tabs separate the fields. +If the line ends with a "\" the +net continues on the next line and the "\" is treated exactly as if it +were a space. If a NAME ends with a lower-case letter, +all lower-case letters are stripped from the end of the NAME to determine the +matching layout-name name. For example: + +@example + Data U1-3 U2abc-4 FLOP1a-7 Uabc3-A9 +@end example + +specifies that the net called "Data" should have +pin 3 of U1 connected to pin 4 of U2, to pin 7 of +FLOP1 and to pin A9 of Uabc3. Note that element name and +pin number strings are case-sensitive. +It is up to you to name the elements so that their layout-name names +agrees with the netlist. + +@node Library Contents File +@section Library Contents File Format +@cindex library contents file, format of +@cindex format of library contents +@cindex file format, library contents + +There is nothing like a special library format. The ones that have been +introduced in 1.4.1 just use some nice (and time consuming) features of GNU +@code{m4}. The only predefined format is the one of the contents file +which is read during startup. It is made up of two basic line types: + +@example +menu entry = "TYPE="name +contents line = template":"package":"value":"description +name = String +template = String +package = String +value = String +description = String +String = +@end example + +No leading white spaces or comments are allowed in this file. If you need +either one, define a command that removes them before loading. Have a look +to the @emph{libraryContentsCommand} resource. + +The menu entry will appear in the selection menu at the top and of the +library window. + +@node Library File +@section Library File Format +@cindex library file, format of +@cindex format of libraries +@cindex file format, libraries + +This section provides an overview about the existing @code{m4} definitions +of the elements. There are basically two different types of files. One +to define element specific data like the pinout, package and so on, the +other to define the values. For example the static RAM circuits 43256 and +62256 are very similar. They therefore share a common definition in the +macro file but are defined with two different value labels. + +The macro file entry: +@example +define(`Description_43256_dil', `SRAM 32Kx8') +define(`Param1_43256_dil', 28) +define(`Param2_43256_dil', 600) +define(`PinList_43256_dil', ``pin1', `pin2', ...') +@end example + +And the list file: +@example +43256_dil:N:43256:62256 +@end example + +The macro must define a description, the pin list and up to two additional +parameters that are passed to the package definitions. The first one is +the number of pins whereas the second one defines for example the width +of a package. + +It is very important to select a unique identifier for each macro. In +the example this would be @emph{43256_dil} which is also the templates name. +It is required by some low-level macros that +@emph{Description_, Param1_, Param2_} and @emph{PinList_} are perpended. + +The list file uses a syntax: +@example +template:package:value[:more values] +@end example + +This means that the shown example will create two element entries with the +same package and pinout but with different names. + +A number of packages are defined in @file{common.m4}. Included are: + +@example +DIL packages with suffix D, DW, J, JD, JG, N, NT, P +PLCC +TO3 +generic connectors +DIN 41.612 connectors +zick-zack (SD suffix) +15 pin multiwatt +@end example + +If you are going to start your own library please take care about @code{m4} +functions. Be aware of quoting and so on and, most important check your +additional entry by calling the macro: + +@example +CreateObject(`template', `value', `package suffix') +@end example + +If quoting is incorrect an endless loop may occur (broken by a out-of-memory +message). + +The scripts in the @file{lib} directory handle the creation of libraries +as well as of their contents files. Querying is also supported. + +I know quite well that this description of the library implementation is +not what some out there expect. But in my opinion it's much more useful to +look at the comments and follow the macros step by step. + +@node File Syntax +@section File Syntax +@cindex File sytax +@cindex Syntax, file + +@include pcbfile.texi + +@c --------------------------- chapter 7 ------------------------------- +@node Library Creation +@chapter Library Creation +@cindex library creation + +This chapter provides a detailed look at how footprint libraries are +created and used. The chapter is split into two section, the first +section covers the "old" style libraries which use the @code{m4} macro +processor and the second section covers the "new" style libraries. + +Despite the names "old" and "new", both styles of libraries are useful +and the "old" style should not be discounted because of its name. The +advantage of the old style libraries is that one can define a family of +footprints, say a DIP package, and then quickly produce all the members +of that family. Because the individual packages make use of a base +definition, corrections made to the base definition propagate to all the +members of a family. The primary drawback to using this library +approach is that the effort to create a single footprint is more than a +graphical interface and may take even longer if the user has not used +the @code{m4} macro language previously. + +The new style of footprint libraries stores each footprint in its own +file. The footprints are created graphically by placing pads and then +converting a group of pads to a component. This library method has the +advantage of being quick to learn and it is easily to build single +footprints quickly. If you are building a family of parts, however, the +additional effort in creating each one individually makes this approach +undesirable. In addition, creating a part with a large pin count +can be quite tedious when done by hand. + + +@section Old Style (m4) Libraries +The old style libraries for pcb use the @code{m4} macro processor to +allow the definition of a family of parts. There are several files +associated with the old style library. The file @file{common.m4} is the +top level file associated with the library. @file{common.m4} defines a +few utility macros which are used by other portions of the library, +and then includes a predefined set of library files (the lines like +@code{include(geda.inc)}). + +@subsection Overview of Oldlib Operation +The big picture view of the old style library system is that the library +is simply a collection of macro definitions. The macros are written in +the @code{m4} macro language. An example of a macro and what it expands +to is the following. One of the predefined footprints in the library +which comes with PCB is the @code{PKG_SO8} macro. Note that all the +footprint macros begin with @code{PKG_}. For this particular example, +@code{PKG_SO8} is a macro for an 8-pin small outline surface mount +package. All of the footprint macros take 3 arguments. The first is the +canonical name of the footprint on the board. In this case "SO8" is an +appropriate name. The second argument is the reference designator on +the board such as "U1" or "U23". The third and final argument is the +value. For an integrated circuit this is usually the part number such +as "MAX4107" or "78L05" and for a component such as a resistor or +capacitor it is the resistance or capacitance. The complete call to the +macro in our example is @samp{PKG_SO8(SO8, U1, MAX4107)}. When +processed by @code{m4} using the macros defined in the PCB library, this +macro expands to +@example +Element(0x00 "SO8" "U1" "MAX4107" 146 50 3 100 0x00) +( + Pad(10 25 38 25 20 "1" 0x00) + Pad(10 75 38 75 20 "2" 0x100) + Pad(10 125 38 125 20 "3" 0x100) + Pad(10 175 38 175 20 "4" 0x100) + Pad(214 175 242 175 20 "5" 0x100) + Pad(214 125 242 125 20 "6" 0x100) + Pad(214 75 242 75 20 "7" 0x100) + Pad(214 25 242 25 20 "8" 0x100) + ElementLine(0 0 151 0 10) + ElementArc(126 0 25 25 0 180 10) + ElementLine(101 0 252 0 10) + ElementLine(252 0 252 200 10) + ElementLine(252 200 0 200 10) + ElementLine(0 200 0 0 10) + Mark(29 25) +) +@end example +which is the actual definition of the footprint that the PCB program +works with. As a user of PCB the only time you will need or want to run +@code{m4} directly is when you are debugging a new library addition. In +normal operation, the calls to @code{m4} are made by helper scripts that +come with PCB. + +Tools such as @code{gsch2pcb} (used to interface the gEDA schematic +capture program to PCB layout) will call @code{m4} to produce an initial +PCB layout that includes all the components on a schematic. In +addition, when manually instantiating parts from within PCB, @code{m4} +will be called by PCB's helper scripts to produce the footprints. + +@subsection The Library Scripts +There are several scripts that are used for processing the m4 +libraries. This section briefly describes these scripts and details how +they are used by PCB. + +@subsubsection Scripts Used During Compilation +The scripts described in this section are used during compilation of +PCB. They are run automatically by the build system, but are described +here to help document the complete library processing that occurs. +During the build of PCB, the following actions are taken. The +@code{CreateLibrary.sh} script is run to produce an M4 "frozen file". +This frozen file is simply a partially processed M4 input file which can +be loaded by M4 more quickly than the original input file. + +A typical call to @code{CreateLibrary.sh} used during the compilation of +PCB is: +@example +./CreateLibrary.sh -I . pcblib ./common.m4 TTL_74xx_DIL.m4 +connector.m4 crystal.m4 generic.m4 genericsmt.m4 gtag.m4 +jerry.m4 linear.m4 logic.m4 lsi.m4 memory.m4 optical.m4 pci.m4 +resistor_0.25W.m4 resistor_adjust.m4 resistor_array.m4 +texas_inst_amplifier.m4 texas_inst_voltage_reg.m4 +transistor.m4 geda.m4 +@end example +The @samp{-I .} says to search in the current directory for the +@file{.m4} files. The output frozen file is @file{pcblib}. The main +@file{common.m4} file is listed as well as all of the @file{*.m4} files +which define the components in the library. + +In addition, a library contents file is created during the build with +the @code{CreateLibraryContents.sh} script. +A typical call to @code{CreateLibrary.sh} used during the compilation of +PCB is: +@example +./CreateLibraryContents.sh -I . ./common.m4 TTL_74xx_DIL.list +connector.list crystal.list generic.list genericsmt.list gtag.list +jerry.list linear.list logic.list lsi.list memory.list optical.list +pci.list resistor_0.25W.list resistor_adjust.list resistor_array.list +texas_inst_amplifier.list texas_inst_voltage_reg.list transistor.list +geda.list > pcblib.contents +@end example + +The @file{pcblib.contents} file is used by the PCB program to define the +libraries and components which will be displayed when you bring up +the library window from within PCB. An example of part of the +@file{pcblib.contents} file is: +@example +TYPE=~TTL 74xx DIL +7400_dil:N:7400:4 dual-NAND +7401_dil:N:7401:4 dual-NAND OC +7402_dil:N:7402:4 dual-NOR +TYPE=~geda +geda_DIP6:DIP6:DIP6:Dual in-line package, narrow (300 mil) +geda_DIP8:DIP8:DIP8:Dual in-line package, narrow (300 mil) +geda_DIP14:DIP14:DIP14:Dual in-line package, narrow (300 mil) +geda_ACY300:ACY300:ACY300:Axial non-polar component, +@end example +The @code{TYPE=} lines define the library name that will show up in the +library window in PCB. The other lines define the actual components in +the library. + +@subsubsection Scripts Used by PCB at Runtime +When PCB is first executed, it makes a call to the +@code{ListLibraryContents.sh} script. This script provides the PCB +program with the contents of the library contents file created when PCB +was compiled. A typical call to @code{ListLibraryContents.sh} is +@example +../lib/ListLibraryContents.sh .:/tmp/pcb-20030903/src/../lib pcblib +@end example +This command says to search the path +@samp{.:/tmp/pcb-20030903/src/../lib} for a file called +@file{pcblib.contents} (the @file{.contents} part is added +automatically) and display the contents of the file. +PCB parses this output and generates the library window entries. + +When you pick a library component from the library window, PCB calls the +@code{QueryLibrary.sh} script to actually pull the footprint into the +layout. For example, when the ACY300 component is selected from the +@code{~geda} library, the generated call may be: + +@example +/tmp/pcb-20030903/src/../lib/QueryLibrary.sh +.:/tmp/pcb-20030903/src/../lib pcblib geda_ACY300 ACY300 +ACY300 +@end example +If you were to run this command by hand you would see the PCB code for +the element: +@example +Element(0x00 "Axial non-polar component," "" "ACY300" 245 70 0 100 0x00) +( + Pin(0 25 50 20 "1" 0x101) + Pin(300 25 50 20 "2" 0x01) + + ElementLine(0 25 75 25 10) + ElementLine(225 25 300 25 10) + + ElementLine(75 0 225 0 10) + ElementLine(225 0 225 50 10) + ElementLine(225 50 75 50 10) + ElementLine(75 50 75 0 10) + +# ElementArc(X1 Y 50 50 270 180 10) +# ElementArc(X2 Y 50 50 90 180 10) + + Mark(75 25) +) +@end example + +@subsection Creating an Oldlib Footprint +This section provides a complete example of defining a family of +footprints using the M4 style library. As a vehicle for this example, a +family of footprints for surface mount resistors and capacitors will be +developed. The file @file{example.inc} should have been installed on +your system as @file{$prefix/share/examples/oldlib/example.inc} where +@file{$prefix} is often times @file{/usr/local}. + +The @file{example.inc} file defines a macro called +@code{COMMON_PKG_RCSMT} which is a generic definition for a surface +mount footprint with two identical, rectangular pads. This macro will +be called with different parameters to fill out the family of parts. +The arguments to the @code{COMMON_PKG_RCSMT} are: +@example +# ------------------------------------------------------------------- +# the definition for surface mount resistors and capacitors +# $1: canonical name +# $2: name on PCB +# $3: value +# $4: pad width (in direction perpendicular to part) +# $5: pad length (in direction parallel with part) +# $6: pad spacing (center to center) +# $7: distance from edge of pad to silk (in direction +# perpendicular to part) +# $8: distance from edge of pad to silk (in direction parallel +# with part) +# $9: Set to "no" to skip silk screen on the sides of the part +@end example + +@example +define(`COMMON_PKG_RCSMT', + `define(`XMIN', `eval( -1*`$6'/2 - `$5'/2 - `$8')') + define(`XMAX', `eval( `$6'/2 + `$5'/2 + `$8')') + define(`YMIN', `eval(-1*`$4'/2 - `$7')') + define(`YMAX', `eval( `$4'/2 + `$7')') +Element(0x00 "$1" "$2" "$3" eval(XMIN+20) eval(YMAX+20) 0 100 0x00) +( + ifelse(0, eval($4>$5), + # Pads which have the perpendicular pad dimension less + # than or equal to the parallel pad dimension + Pad(eval(-1*( $6 + $5 - $4)/2) 0 + eval((-1*$6 + $5 - $4)/2) 0 eval($4) "1" 0x100) + Pad(eval(-1*(-1*$6 + $5 - $4)/2) 0 + eval(( $6 + $5 - $4)/2) 0 eval($4) "2" 0x100) + , + # Pads which have the perpendicular pad dimension greater + # than or equal to the parallel pad dimension + Pad(eval(-1*$6/2) eval(-1*($4 - $5)/2) + eval(-1*$6/2) eval(($4 - $5)/2) eval($5) "1" 0x100) + Pad(eval( $6/2) eval(-1*($4 - $5)/2) + eval( $6/2) eval(($4 - $5)/2) eval($5) "2" 0x100) + ) + + # silk screen + # ends + ElementLine(XMIN YMIN XMIN YMAX 10) + ElementLine(XMAX YMAX XMAX YMIN 10) + # sides +ifelse($9,"no", + #skip side silk + , + ElementLine(XMIN YMIN XMAX YMIN 10) + ElementLine(XMAX YMAX XMIN YMAX 10) +) + Mark(0 0) +)') +@end example +Note that the part has been defined with the mark located at +@code{(0,0)} and that the pads have been placed with the mark at the +common centroid of the footprint. While not a requirement, this is +highly desirable when developing a library that will need to interface +with a pick and place machine used for factory assembly of a board. + +The final part of @file{example.inc} defines particular versions of the +generic footprint we have created. These particular versions correspond +to various industry standard package sizes. +@example +# 0402 package +# +# 30x30 mil pad, 15 mil metal-metal spacing=> +# 15 + 15 + 15 = 45 center-to-center +define(`PKG_RC0402', + `COMMON_PKG_RCSMT(`$1', `$2', `$3', 30, 30, 45, 0, 10, "no")') + +# 0603 package +# +# 40x40 mil pad, 30 mil metal-metal spacing=> +# 30 + 20 + 20 = 70 center-to-center +define(`PKG_RC0603', + `COMMON_PKG_RCSMT(`$1', `$2', `$3', 40, 40, 70, 10, 10)') + +# 1206 package +# +# 40x60 mil pad, 90 mil metal-metal spacing=> +# 90 + 20 + 20 = 130 center-to-center +define(`PKG_RC1206', + `COMMON_PKG_RCSMT(`$1', `$2', `$3', 60, 40, 130, 10, 10)') +@end example + +At this point, the @file{example.inc} file could be used by third party +tools such as @code{gsch2pcb}. However to fully integrate our +footprints into PCB we need to create the @file{example.m4} and +@file{example.list} files. The @file{example.m4} file defines +descriptions for the new footprints. +@example +define(`Description_my_RC0402', + ``Standard SMT resistor/capacitor (0402)'') +define(`Description_my_RC0603', + ``Standard SMT resistor/capacitor (0603)'') +define(`Description_my_RC1206', + ``Standard SMT resistor/capacitor (1206)'') +@end example +Finally we need to create the @file{example.list} file. +@example +my_RC0402:RC0402:RES0402 +my_RC0402:RC0402:CAP0402 +my_RC0603:RC0603:RES0603 +my_RC0603:RC0603:CAP0603 +my_RC1206:RC1206:RES1206 +my_RC1206:RC1206:CAP1206 +@end example +The first field in the list file has the name corresponding to the +Description definitions in @file{example.m4}. The second field is the +template name which corresponds to the macros @code{PKG_*} we defined in +@file{example.inc} with the leading @code{PKG_} removed. It is the +second field which controls what footprint will actually appear on the +board. The final +field is the name of the part type on the board. The first line in our +@file{example.list} file will produce a menu entry in the library window +that reads: +@example +CAP0402, Standard SMT resistor/capacitor (0402) +@end example +The @code{CAP0402} portion comes directly from the third field in +@code{example.list} and the longer description comes from descriptions +macros in @code{example.m4}. Please note that any extra white space +at the end of a line in the @file{.list} files will cause them to +not work properly. + +@subsection Troubleshooting Old Style Libraries + +A powerful technique to help debug problems with libraries is to invoke +the @code{m4} processor directly. This approach will provide error +output which is not visible from within PCB. The following example +shows how one might try to debug an 8 pin small outline (SO8) package. The +macro name for the package is PKG_SO8. In this example, the +canonical name that is to be associated with the part is SO8, the +reference designator is U1, and the value is MAX4107 (the part number). + +@example +echo "PKG_SO8(SO8, U1, MAX4107)" | \ + gm4 common.m4 - | \ + awk '/^[ \t]*$/ @{next@} @{print@}' | \ + more +@end example +The @code{awk} call simply removes blank lines which make the output +hard to read. + +For this particular example, the output is: +@example +Element(0x00 "SO8" "U1" "MAX4107" 146 50 3 100 0x00) +( + Pad(10 25 38 25 20 "1" 0x00) + Pad(10 75 38 75 20 "2" 0x100) + Pad(10 125 38 125 20 "3" 0x100) + Pad(10 175 38 175 20 "4" 0x100) + Pad(214 175 242 175 20 "5" 0x100) + Pad(214 125 242 125 20 "6" 0x100) + Pad(214 75 242 75 20 "7" 0x100) + Pad(214 25 242 25 20 "8" 0x100) + ElementLine(0 0 151 0 10) + ElementArc(126 0 25 25 0 180 10) + ElementLine(101 0 252 0 10) + ElementLine(252 0 252 200 10) + ElementLine(252 200 0 200 10) + ElementLine(0 200 0 0 10) + Mark(29 25) +) +@end example + +@section New Style Libraries +Footprints for the new style library are created graphically using the +PCB program. A single footprint is saved in each file. + +@subsection Creating Newlib Footprints +To create +@enumerate +@item Start PCB with an empty layout. +@item Make the component layer active. +@item For a leaded part, select the via tool and place vias where the +pads for the part should go. For surface mount pads, draw line +segments. Note that until the footprint is completed, the surface +mount pads will remain rounded. Currently a rectangle or polygon +may not be used as a pad. +@item For each via and line segment which will become a pad, select it +and press 'n' to be able to enter a name. Enter +the pin number and press enter. +@item Make the silk layer active. +@item Using the line and arc tools, draw a silk screen outline for the +part. +@item Using the selection tool, select all of the pins and silk screen +for the part. +@item Place the pointer above the reference point for the part. This is +typically the common centroid. Keeping the pointer there, shift-right-click +to bring up the popup menu and choose "convert +selection to element". +@item At this point, the vias, line segments, and silk screen will have +been converted to an element. To change any of the line segments to +have square ends rather than round ends, select the pads by holding +down the shift key and clicking each pad with the center mouse button. +Now under the Select menu, "Change square-flag of selected objects" +section, choose "Pins". +@item Select the element, shift-right-click to bring up the popup menu, and +choose "Copy Selection to Buffer". Now left-click on the center of +the new element. +@item Under the buffer menu, choose "save buffer elements to file" to +save the new footprint to a file. +@item Press ESC to exit from buffer mode. +@end enumerate + +@subsection Modifying Newlib Footprints +@enumerate +@item In the @pcb{} program, instantiate the footprint you wish to modify. +@item Using the selection tool, select the footprint. +@item Now left-click on the selected element, this brings up a popup menu, choose +"Cut Selection to Buffer" from the popup menu. +@item Under the buffer menu, choose "break buffer element to pieces", +and then left-click to place the broken apart footprint to an open area of +the layout. Note that you must use the items under the buffer menu, the +items with the same names in the popup menu do not work. +@item Make your desired modifications to the footprint and then convert +the pieces back to an element using the same procedure as when starting +from scratch on a new footprint. +@end enumerate + + +@c --------------------------- chapter 8 ------------------------------- +@node Schematic Frontends +@chapter Schematic Capture for PCB +@cindex schematic capture +@cindex schematic frontend + +When designing a circuit board of any complexity, a schematic capture +front-end for the design is highly desired. Any schematic capture +program which is able to generate a netlist in a user defined format as +well as a bill of materials can be made to work with PCB. Currently, we +are aware of two freely available schematic capture programs which can +interface with PCB. This chapter shows how a design can be taken from +start to finish using either of these two tools for schematic capture +and PCB for layout. + +@menu +* gEDA:: Interfacing with GNU EDA (gEDA). +* xcircuit:: Interfacing with xcircuit. +@end menu + +@node gEDA +@section gEDA +@cindex gschem, how to interface with +@cindex gEDA, how to interface with + +This section shows how to use gEDA as the schematic capture front-end for +a PCB design. This section is not intended to be complete documentation +on gEDA and it is assumed that the user has at least some familiarity +with the gEDA suite of programs. + +The basic steps in a gEDA + PCB design flow are: +@enumerate +@item Set up project directories +@item Set up gEDA (gschem/gnetlist) config files +@item Set up gsch2pcb config files +@item Capture schematics using @code{gschem} (part of gEDA) +@item Create any unique PCB footprints needed for the design +@item Generate initial PCB design using @code{gsch2pcb} (part of gEDA) +@item Layout circuit board using @code{pcb} +@item Make any additional schematic changes with @code{gschem} and +forward annotate to PCB with @code{gsch2pcb} +@item Generate photoplot files (RS-274X, also known as "Gerber") for +board vendor +@end enumerate + +@subsection Set Up Project Directories +Although not required, a typical project directory will contain the +schematics and board layout at the top level. +Schematic symbols and circuit board footprints which are unique to this +project are stored in subdirectories. For this example, @file{sym} +contains the project specific schematic symbols and @file{pkg} contains +the project specific footprints. Set up the project subdirectory and +subdirectories by executing: +@example +mkdir ~/myproj +cd ~/myproj +mkdir sym +mkdir pkg +mkdir pkg/newlib +mkdir pkg/m4 +@end example + +@subsection Set Up gEDA Config Files +The gEDA tools, specifically @code{gschem} and @code{gnetlist}, use +configuration files to set the search path for symbol libraries in +addition to other user preferences. Create a file in the top level +project directory called @file{gschemrc}. Add the following lines to +that file: +@example + +;; list libraries here. Order matters as it sets the +;; search order +(component-library "./sym") + +@end example +This sets the local search path for the schematic capture program +@code{gschem}. Now the netlister, @code{gnetlist}, must also be +configured. This can be done by copying the file @file{gschemrc} to +@file{gnetlistrc} by running @samp{cp gschemrc gnetlistrc}. +Alternatively, you can create a soft link so only a single file needs to +be updated if additional symbol paths are added. The link is created by +running @samp{ln -s gschemrc gnetlistrc}. + +@subsection Set Up @code{gsch2pcb} Config Files +The program @code{gsch2pcb}, not to be confused with the older +@code{gschem2pcb} script, is used to link the schematic to layout. +@code{gsch2pcb} is responsible for creating the netlist used to provide +connectivity information to PCB as well creating an initial layout with +all components instantiated in the design. Forward annotation of +schematic changes to the layout is also done using @code{gsch2pcb}. +@code{gsch2pcb} uses a project file to set up the schematic file names, +PCB library locations, and output file names. Create a project file +called @file{project} using the following as an example: +@example + +# List all the schematics to be netlisted +# and laid out on the pc board. +schematics first.sch second.sch third.sch + +# For an output-name of foo, gsch2pcb generates files +# foo.net, foo.pcb, and foo.new.pcb. If there is no +# output-name specified, the file names are derived from +# the first listed schematic, i.e. first.net, etc. +output-name preamp + +@end example + + +@subsection Capture Schematics Using @code{gschem} +This section is fairly brief and assumes familiarity with using the +@code{gschem} schematic capture program. As you are creating your +schematics, be sure to observe the following rules: +@itemize +@item Make sure that each component in the schematic has a +@code{footprint} attribute that corresponds to a footprint in the PCB +library or a footprint you plan on creating. +@item Make sure all reference designators are unique. One way to ensure +this is to run the @code{refdes_renum} script (part of gEDA) after the +schematics are created. +@end itemize + +@subsection Create Any Unique PCB Footprints +Create the new footprints you design needs using either the m4 style or +newlib style of PCB libraries. Refer to @ref{Library Creation} for details on this +process. For m4 style footprints, store them in the @file{pkg/m4} +subdirectory and for newlib footprints, store them in the +@file{pkg/newlib} subdirectory. + +@subsection Generate Initial PCB Design Using @code{gsch2pcb} +The @code{gsch2pcb} program connects the schematic and layout. It basic +operation is to call @code{gnetlist} to generate the connectivity +netlist that PCB used to verify connectivity and to instantiate all +elements found in the schematic to a new layout. +The default, as of @code{gsch2pcb} version 0.9, is to use any found m4 +style parts first and then search for newlib style if no old style part +was found. By using the @code{--use-files} or @code{-f} flag to @code{gsch2pcb} +priority is given to newlib style parts even if m4 style are found. You +may wish to verify this in the @code{gsch2pcb} documentation in case +this changes in the future. +To start your layout, +run @samp{gsch2pcb project} where @file{project} is the project file +created previously. This will create a new netlist file, +@file{preamp.net}, and a new layout file, @file{preamp.pcb}. + + +@subsection Layout Circuit Board +Run PCB on the new layout by running @samp{pcb preamp.pcb}. +Load the netlist file by selecting "load netlist file" from the "file" +menu. In the file selection dialog box, choose @file{preamp.net}. This +loads connectivity information into PCB. + +Using the selection tool, grab and move apart the various footprints +with the middle mouse button. Once the parts are moved apart from each +other, choose "optimize rats-nest" from the "Connects" menu. This menu +choice will display and optimize the rats nest. Use the rats nest to +help guide placement of the parts. You may wish to re-run the "optimize +rats-nest" command after moving parts around. + +After the placement is complete, use the line tool to add traces to the +board. As traces are added, the corresponding rats line will disappear. + +@subsection Forward Annotation of Schematic Changes +If schematic changes are made after the layout has started, +@code{gsch2pcb} can be used to forward annotate these changes to the +layout. To forward annotate schematic changes, run @samp{gsch2pcb +project}. This command will create the files @file{preamp.new.pcb}, +@file{preamp.net}, and modify the file @file{preamp.pcb}. The +modifications to @file{preamp.pcb} include forward annotation of +schematic component value changes, adds any new components, and removes +any deleted components. + +@subsection Generate Photoplot Files (RS-274X) +After the layout is complete, choose "edit layer-groupings" from the +"Settings" menu. The LayerGroups form lets you specify which layers +will appear in each output layer group. For example, in the default +form, layer group 1 has "front" and "front side" in it. The +output file @file{1.gbr} if DOS file names are used, or +@file{somename_front.gbr} if long file names are used will contain the +"front" and "front side" layers in it. Usually the defaults are +sufficient, but this form is still a useful reference. + +Choose "print layout..." from the "File" menu. In the print dialog box, +select "Gerber/RS-274X" for the device +driver. Select the "outline", "alignment", and "drillhelper" options. +To get DOS compatible file names, select the "DOS (8.3) names" option, +otherwise enter "preamp" for the filename. Press "OK". + +The following output files should have been created in the project directory. +The names in parentheses correspond to the DOS compatible output file names. +@table @file +@item preamp_frontsilk.gbr (csilk.gbr) +Top side silk screen. +@item preamp_frontmask.gbr (cmask.gbr) +Top side soldermask relief. +@item preamp_front.gbr (1.gbr) +Top copper. +@item preamp_backmask.gbr (smask.gbr) +Bottom side soldermask relief. +@item preamp_back.gbr (2.gbr) +Bottom Copper. +@item preamp_fab.gbr (fab.gbr) +Fabrication drawing. Also known as the drill drawing. This drawing is +used for reference by the board vendor but is not directly used in the +fabrication process. +@item preamp_plated-drill.cnc (pdrill.cnc) +NC Drill format file for the plated through holes. +@item preamp_unplated-drill.cnc (udrill.cnc) +NC Drill format file for the unplated through holes. +@item preamp_bom.txt (bom.txt) +A bill of materials for the layout. +@item preamp_xy.txt (xy.txt) +Centroid (X-Y) data for driving automated assembly equipment. +@end table + +@comment to include an image: +@comment @image{geda1, 6in, 4in, geda schematic, png} + +@node xcircuit +@section xcircuit +@cindex xcircuit, how to interface with +@cindex xcircuit, how to interface with + +If anyone cares to contribute this section, it will get added. Please +submit changes to the bug tracking system for PCB which can be found from +the PCB homepage at @url{http://pcb.gpleda.org}. + +@c --------------------------- Appendix A ------------------------------- + +@node Installation +@appendix Installation and Troubleshooting + +Compiling and installing the package should be straightforward. If any problems +occur, please contact the author @email{Thomas.Nau@@rz.uni-ulm.de}, or the +current maintainer @email{haceaton@@aplcomm.jhuapl.edu} to find +a solution and include it into the next release. + +@menu +* compiling:: Compiling and installing. +* problems:: Troubleshooting. +@end menu + + +@node compiling +@section Compiling and Installing +@cindex install, how to +@cindex compile, how to + +This section covers the steps which are necessary to compile the package. + +@menu +* quickstart:: Quick start. +* running configure:: Customizing Pcb with Configure +@end menu + +@node quickstart +@subsection Quick Start +@cindex GNU build system + +Starting with version 2.0, @pcb{} has switched to a GNU +autoconf/automake build system. Installation of @pcb{} consists of +three steps: configuration, building, and installing. +In a typical installation, these steps are as simple as +@example +./configure +make +make install +@end example + +@node running configure +@subsection Running the configure Script +@cindex GNU configure script +@cindex configure + +The @code{configure} script accepts all of the standard GNU configure +options. For a complete list of configuration options, run +@code{./configure --help}. + + +@table @samp +@vindex INFOLIBDIR +@item INFOLIBDIR +must be set to the directory where your GNU info files are located. + +@vindex PCBLIBDIR +@item PCBLIBDIR +is the path of a directory where the font files will be installed. + +@vindex DEFAULTFONT +@item DEFAULTFONT +the name of the default font file. + +@vindex DEFAULTLIBRARY +@item DEFAULTLIBRARY +the name of the default library. + +@vindex GNUM4 +@item GNUM4 +the name of GNUs m4 version. + +@vindex BTNMOD +@item BTNMOD +If your window manager has already bound @emph{Mod1} together with some +function keys you may want to change this setting. This is true for HP-VUE. + + +@end table + +If you find things which must be changed to compile on your system, +please add the appropriate autoconf tests (if you are familiar with +that) and mail a copy to the maintainer, harry eaton, at +@email{haceaton@@aplcomm.jhuapl.edu}. + + +If you do not have the appropriate permissions you should run +@file{./pcbtest.sh} in the @file{src} directory to run @pcb{} from +the installation directory. + + +@node problems +@section Troubleshooting +@cindex problems +@cindex troubleshooting + +There are some known problems. Most of them are related to +missing parts of a standard @code{X11} distribution. Some others are caused by +third party applications such as @code{X} servers. To make this list more +complete please mail your problems and, if available, solutions to the author. +The mail address may be found at the beginning of this chapter. +In any case, read @ref{X11}. + +By the way, you @code{MUST HAVE AN ANSI COMPILER} to make @pcb{} work. + + +Another source of problems are older versions of @code{flex} and @code{bison}. +@pcb{} definitely works with @code{flex-2.4.7} and @code{bison-1.22} or +later. The problems will result in a @emph{syntax error} while parsing files. +This should only be a problem if you have modified the @code{flex} or +@code{bison} input files. + +The following list gives you just an idea because I'm not able to test +all @pcb{} releases on all platforms. + +@menu +* HP:: Hewlett-Packard series 700 and 800 running HP-UX 10.* +* Sun:: Sun, Solaris 2.5 +* SGI:: SGI, IRIX 5.3 and 6.* +* DEC Alpha:: DEC Alpha, DEC UNIX 3.2c and 4.0 +* SCO:: SCO Unix ODT 3.0, PC hardware +* Linux:: Linux 0.99pl14 and later +* BSD:: FreeBSD, NetBSD ... +* X11:: Refers to @code{X11R4}, @code{X11R5}, and @code{OpenWindows} +* TeX and Manuals:: Problems creating the @file{pcb.dvi} +@end menu + +@node HP +@subsection HP Series 700 and 800 +@cindex architecture +@cindex HP +@cindex Hewlett Packard + +You have to install several @code{X11} include files +or, better, install a complete @code{X11R5} release. Hewlett-Packard doesn't +support the Athena Widgets. So the header files and libraries are missing +from the application media, but they are available as a patch. +They also do not ship the @code{ANSI} compiler with the normal operating +system release so you have to buy one or use @code{GCC}. +Some of the tools are available as patches. + +In addition, @pcb{} has been successfully tested on these platforms with +@code{HPUX 9.*, 10.*} running self-compiled @code{X11R5}. + + +@node Sun +@subsection Sun SPARC architecture +@cindex architecture +@cindex Sun +@cindex Solaris +@cindex OpenWindows + +There are no known problems with Sun machines if they use @code{X11R5} instead +of @code{OpenWindows}. @pcb{} compiled successfully with all kinds of +SPARCstations @code{Solaris-2.[345]}. + +For problems with @code{OpenWindows} refer to @ref{X11}. + +@node SGI +@subsection Silicon Graphics +@cindex architecture +@cindex Silicon Graphics +@cindex SGI + +@pcb{} has been tested on some boxes running either @code{IRIX-4.0.5} or +@code{IRIX-5.3}. The former one uses a @code{X11R4} server. +There are no problems. +For known problems +with @code{X11R4}, see @ref{X11}. + + +@node DEC Alpha +@subsection DEC Alpha +@cindex architecture +@cindex DEC +@cindex Alpha + +@pcb{} compiled and runs without problems on @code{DEC UNIX V3.2c}. + + +@node SCO +@subsection SCO Unix +@cindex architecture +@cindex SCO +@cindex PC UNIX + +John DuBois wrote: +@example +@code{SCO-ODT-3.0} requires the latest version of tls003, the Athena +widget library (available from sosco.sco.com). The main problems +I have encountered are it core dumps fairly often, especially +while loading/dropping elements... +@end example +I'll see what I am able to do as soon as I have access to an @code{SCO} system. + + +@node Linux +@subsection Linux +@cindex architecture +@cindex Linux +@cindex PC UNIX + +Since the @code{X11} version of @pcb{} has been developed on a Linux +system here are no known problems. + + +@node BSD +@subsection FreeBSD and NetBSD +@cindex FreeBSD +@cindex NetBSD +@cindex PC UNIX + +@pcb{} has been tested on NetBSD and works without any problems. +You may also be able to find a NetBSD package at +@url{ftp://ftp.netbsd.org/pub/NetBSD/packages/cad/pcb/README.html} or a +FreeBSD port at +@url{http://www.freebsd.org/cgi/url.cgi?ports/cad/pcb/pkg-descr}. + +@node X11 +@subsection Problems related to X11 +@cindex X11, problems + +There are a some problems related to @code{X11R4} or systems derived from +@code{X11} such as @code{OpenWindows}. @xref{Sun}. You at least have to change +all occurances of @emph{baseTranslations} in the resource files to +@emph{translations} if you are using a @code{X11R4} server. Look at the +@code{X11R5} @emph{Intrinsics} manual for details. + +The panner widget (print dialog box) appears only in release @code{X11R5} and +later. It really simplifies adjusting the offsets. +With earlier releases the printout will always appear in the center of the +page. + +You may have some problems in a mixed @code{X11-OpenWindows} +environment. + +@pcb{} has been tested successfully with @code{X11R6} under Linux 1.1.59 +and later. + + +@node TeX and Manuals +@subsection Problems related to TeX +@cindex TeX, problems + +If your @code{TeX} installation complains about a missing @file{texinfo.tex} +file copy the one included in this release (directory @file{doc} +to your @code{TeX} macro directory. +Note, there are probably newer versions of this file available from some +FTP sites. +@code{TeX-3.0} failed, @code{TeX-3.14} worked just fine. Check our FTP server +@emph{ftp.uni-ulm.de} for ready-to-print versions of the manuals. + + +@c --------------------------- Appendix B ------------------------------- + +@node Custom Menus +@appendix Customizing the Menus + +The menu system is driven off a data file that contains +@dfn{resources}. A resource is a hierarchical description of a data +tree which, in this case, is mapped to the hierarchical menus used by +Pcb. + +@menu +* Resource Syntax:: What a resource file looks like. +* Menu Definitions:: Using a resource to define a menu. +* Menu Files and Defaults:: Where Pcb looks for its menu resource. +@end menu + +@node Resource Syntax +@section Resource Syntax + +A resource file is a simple text file. It contains curly braces to +group things, spaces between things, and double quotes when strings +need to include spaces. There are four fundamental ways of adding +data to a resource. + +First, a string (either a single word or a quoted string with spaces, +we call both ``strings'' in this appendix) can be added all by itself, +to add a string resource to the current resource. This is used, for +example, to define the string printed on a menu button. In this +example, four strings are added to the @var{File} resource: + +@example +File = @{ + Sample + "longer sample" + some text +@} +@end example + +Second, a named string may be added by giving two strings separated by +an equals sign. This is used to specify X resources and a few other +optional parameters of menus, for example. Note that a string all by +itself is thus an ``unnamed'' string. + +@example +@{"Layer groups" foreground=red sensitive=false@} +@end example + +Third, an unnamed subresource may be added. This is used to create +submenus and menu buttons. To add a subresource, simply group other +things in curly braces. This example describes a resource containing +one string and three subresources: + +@example +@{File + @{New do_new()@} + @{Save do_save()@} + @{Quit do_quit()@} +@} +@end example + +Lastly, a named subresource may be added by prefixing an unnamed +subresource with a string and an equals sign, just as when naming +strings. This syntax is used to name the resources used for the main +menu and popup menus: + +@example +MainMenu = @{ + @dots{} + @} +@end example + +Additionally, the menu parser allows for ``hooks'' whereby portions of +the menu system can be programmatically created at runtime by the +application. These hooks are invoked by a single word proceeded by an +at sign, such as this example where most of the Sizes menu is created +automatically: + +@example +@{Sizes + @@sizes + @{"Adjust active sizes ..." AdjustStyle(0)@} + @} +@end example + +In addition to all that, any unquoted pound sign (@code{#}) begins a +comment. Commented text continues until the end of the containing +line. Comments may begin at the beginning of a line, or after other +text on the line: + +@example +# This is a comment +MainMenu = @{ # This is also a comment +@end example + +@node Menu Definitions +@section Menu Definitions + +To best understand this section, you should find the +@file{pcb-menu.res} file that your Pcb uses and refer to it for +examples (@pxref{Menu Files and Defaults}). Note that the lesstif +GUI uses @file{pcb-menu.res} and the GTK+ GUI uses @file{gpcb-menu.res}. +The file format is identical however and if so desired, one can make +one file be a soft link to the other. + +A resource defines a menu when it meets certain semantic requirements. +The menu hierarchy is reflected as a hierarchy of unnamed +subresources, with the first string of each subresource defining the +label used for the menu button. A subresource that itself contains +subresources becomes a submenu, a subresource that does not becomes a +button. + +A submenu should only contain subresources for the buttons or submenus +within that submenu. Two exceptions are allowed: an initial string +sets the label, and the string ``-'' (a single dash) will create a +separator. + +A button should not contain subresources, but will contain many +strings, named and unnamed. The first member shall be an unnamed +string which is the label for the button. Any other unnamed strings +within the button's resource will be used as actions (much like the +.Xdefaults action strings), which are functions that will be called +when the button is pressed (or popped up, or created, depending on the +action). As a convenience, if a left parenthesis is seen, the current +``word'' will continue at least until the matching right parenthesis. +This allows you to pass strings with spaces as arguments to actions +without needing to quote the action. + +Named resources in button resources will be used as X resources. Such +resources can be used to set the font, color, and spacing of buttons. +As a convenience, ``fg'' can be used as an abbreviation for ``foreground''. + +Within the menu's resource file, Pcb will look for a few key named +subresources. At the moment, the only one it looks for is one called +@code{MainMenu}. This will be used for the main menu bar. In the +future, other named subresources will be used for popup resources. + +Given all this, a small sample @file{pcb-menu.res} would be: + +@example +MainMenu = @{ + @{File + @{"Load layout" Load(Layout)@} + - + @{"Quit Program" Quit() fg=red font=10x20@} + @} +@} +@end example + +Within the Pcb sources are specially crafted comments that mark all +the actions, flags, menu hooks, and whatnot that Pcb offers. Read the +file @file{src/gather-actions} in the Pcb source tree for +documentation for these comments. + +@node Menu Files and Defaults +@section Menu Files and Defaults + +Pcb will look for a file which defines its menus, trying the following +names (the example is for the lesstif GUI, the GTK+ GUI has ``gpcb-menu.res'' +in place of ``pcb-menu.res''): + +@example +./pcb-menu.res +$HOME/.pcb-menu.res +$PCBLIBDIR/pcb-menu.res + +@end example + +Note that @var{pcblibdir} defaults to @file{/usr/local/share/pcb} +(hence, @file{/usr/local/share/pcb/pcb-menu.res}). The +@file{} entry refers to a menu definition within the Pcb +application itself. The master file for all this is the file +@file{src/pcb-menu.res} in the Pcb source tree. This master source is +used to create the internal menu definition as well as being installed +in @file{$pcblibdir}. + +@c --------------------------- Appendix C ------------------------------- +@node Regular Expressions +@appendix Element Search/Regular Expressions +@cindex Element Search +@cindex Regular Expressions +@vindex Element Search +@vindex Regular Expressions + +@section Element Search/Regular Expressions +@pcb{}'s search is based on POSIX 1003.2 Regular Expressions. Full POSIX +Regular Expressions are supported by @pcb{} if the regex library was +available when @pcb{} was built. One difference from the regular +expressions found in tools like awk or grep is that PCB implicitly +adds a ``^'' to the begining of a regular expression and ``$'' to the +end of the regular expression. For example, if you enter ``C1'', the +actual regular expression used internally is ``^C1$''. Another difference +is that search patterns in pcb are not case sensitive. That is, ``CON'' is +treated the same as ``con''. + +It is easier to show by example how to search than explain +POSIX 1003.2. With regular expressions most characters are just +themselves, but some are special: + +@table @samp +@item * +Matches 0 or more instances of preceding character. + +@item + +Matches 1 or more instances of preceding character. + +@item ? +Matches 0 or 1 instances of preceding character. + +@item . +Matches any single character other than the newline character. + +@item | +The vertical bar is the alternation operator. It combines two +regular expressions. The result matches if either of them matches. + +@item \ +A backslash indicates the next character should not be interpreted literally +if it normally is, and should be interpreted literally if it normally isn't. + +@item @{n@} +An integer n enclosed in curly brackets matches the preceding item if +it occurs exactly n times. + +@item [ ] +A pair of square brackets matches every character they contain. Characters +may be given explicitly, or as ranges. + +@item - +A hyphen in the context of square brackets denotes the range between the +preceding and the following character. E.g., the range of digits is +``0-9'' . The range of letters from C to K is ``C-K'' . + +@item \^ inside square brackets +Inside square brackets the caret is an anti operator. Its presence makes +the square prackets match anything except the contents of the brackets. + +@item ( ) +Round parenthesis group parts of a regular expression. This is very much +like they do in math formulars. + +@end table + +If you need a special character literally, you can escape it with a +backslash. + +The following examples illustrate how regular expressions can be used to +specify element names (reference designators) to search for. +@table @samp + +@item C5 +Select the element whose name is exactly ``C5''. + +@item C5 | R3 +Select C5 and R3. + +@item C.* +Select all elements whose name start with the letter ``C'', such as C5, or +C42, or CF1. + +@item C.*1 +Select all elements that start with ``C'' and end with ``1'', such as C1, +or C51 or C5/9B71. + +@item R10? +Search for R1 or R10, but will not select R100 or R105. The question mark +is a quantifier for the character ``0''. + +@item R128+ +Selects R128, R1288, R12888, etc. + +@item TB. +Select all terminal blocks having exactly one character designator after +``TB'' such as TB1, TBA, or TBx but not TB. + +@item TB.. +Select all terminal blocks having a two character designator such as TB21 or +TB1a. + +@item TB.* +Select all terminal blocks with any designator. + +@item .*31 +Select all items, whose name ends with ``31'' such as Q31, or R31, or R531. + +@item Q[12] +Select Q1 and Q2. + +@item [A-D].* +Select all items, whose name starts with ``A'', ``B'', ``C'', or ``D''. + +@item .*N@{2@}.* +Select all items, whose name contains two ``N'' in a row such as +CONN23, or connA, but not CON5 + +@item [^D].* +Select all items that do not start with the letter ``D'', such as C2, or +R34, but not D34 + +@end table + + +@c --------------------------- Appendix -- drill sizes ------------------------------- +@node Standard Drill Sizes +@appendix Standard Drill Size Tables +@cindex drill sizes, list of standard +@cindex standard drill sizes + +@section American Standard Wire Size Drills +@include wire_size.texi + +@section American Standard Letter Size Drills +@include letter_size.texi + +@section Fractional Inch Size Drills +@include fractional_size.texi + +@section Metric Drills +@include metric_size.texi + +@c --------------------------- Appendix -- Centroid File Format ---------------------- +@node Centroid File Format +@appendix Centroid (X-Y) File Format +@cindex centroid file format +@cindex x-y file format + +@section Overview + +@section File Format +The centroid output file is in a standard comma seperated values (CSV) +format. Comment lines begin with a ``#''. The output file contains a +header with an RCS Id tag (useful for those who will check the file +into a version control system), a version number for the file format, +some comments containing the author and title of the board, and a +comment describing the remainder of the file format. + +An example centroid file is shown below. + +@example + +# @verb{ $ }Id@verb{ $ } +# PcbXY Version 1.0 +# Date: Fri Jul 22 03:40:08 2005 UTC +# Author: PCB User +# Title: MyBoard - PCB X-Y +# RefDes, Description, Value, X, Y, rotation, top/bottom +# X,Y in mils. rotation in degrees. +# -------------------------------------------- +R61,"0603","10",2610.00,3560.00,90,top +J5,"AMPHENOL_ARFX1231","unknown",2390.00,4220.00,180,top +C13,"0402","0.01u",2340.00,3014.00,270,top + +@end example + +@section Computation of Centroid and Rotation +@cindex centroid file, algorithms +@cindex x-y file, algorithms +The center of each element is found by averaging the (X,Y) coordinates +for the center of each pin and pad in the element. For example if an +element has 2 pins, 1 at (1,0) and another at (1,4) then the centroid +will be at (1,2). + +The calculation of rotation is a bit more complex. Currently a +rotation is not stored for each element but rather the rotated element +is stored. In other words if the element from the library has a pin +at (0,0) and (0,2) and it has been rotated by 90 degrees, then the +@file{.pcb} file will store (0,0) and (2,0) for the pin locations with +no indication that they have been rotated from the original. + +In the event that the element has only 1 pin, then the rotation is set +to zero. If the element has only one pad (as opposed to a +through-hole pin), then the rotation of the pad is used. + +When the element has multiple pins, the location of pin #1 is placed +in the coordinate system which has the centroid of the part at (0,0). +Then which quadrant pin #1 falls in determines the rotation. Zero +degrees of rotation is defined as pin #1 being in the upper left +quadrant. Increasing angles correspond to counterclockwise rotation so a +rotation of 90 degrees places pin #1 in the lower left quadrant. +Currently, the only allowed rotations are 0, 90, 180, and 270 degrees. + +If pin #1 happens to be at the centroid of the part, then pin #2 is +examined to see which quadrant it is located in. The same rules apply +for the definitions of rotation. In other words, when pin #1 is at +the centroid of the part and pin #2 is in the upper left quadrant, the +rotation is declared to be zero degrees. + +@c --------------------------- Appendix -- Actions ---------------------- +@node Action Reference +@appendix Action Reference +@cindex action reference + +@include actions.texi + +@c --------------------------- Appendix -- Glossary ---------------------- +@node Glossary +@appendix Glossary +@cindex glossary +@cindex terminology +@cindex index of terms + +@table @asis + +@item Footprint +The pattern of metal, silkscreen, soldermask relief, and drills which +defines where you place a component on a circuit board. +Footprints are the placed by the user onto the PC board during the +placement phase of PCB layout. + +@item Gerber File +The file format used in the industry to convey a board database to the +manufacturer is RS-274X (which replaces the now obsolete RS-274D +format). This file format was originally developed by Gerber for +their photo plotters and thus RS-274D and RS-274X format files +are often times refered to as ``Gerber'' files. + +@item Thermal, Thermal Relief +A thermal relief is a way of connecting a pin to a ground +or power plane. Instead of directly connecting to the plane, small "spokes" +are used to increase the thermal resistance between the pin and the plane. +Often times these connections are refered to as simply a thermal. By increasing +the thermal resistance to the plane, it becomes easier to solder to the +pin. In the drawing below, the pin on the left is connected to the +polygon using a solid connection with no thermal relief, the middle +pin is connected using a thermal, while the pin on the right has no +connection to the polygon. In PCB, the ``Thermal'' Tool is used to +make both a solid connection and one with thermal relief (see @ref{Polygon Objects}). + +@center @image{thermal,,,Example of a thermal relief,png} + +@end table + +@c --------------------------------------------------------------------- +@node Index +@unnumbered Index of Resources +@printindex vr + +@unnumbered Index of Actions, Commands and Options +@printindex fn + +@unnumbered Index of Concepts +@printindex cp + +@contents +@bye Index: 1.0.8/doc-orig/pcbfile.texi =================================================================== --- 1.0.8/doc-orig/pcbfile.texi (nonexistent) +++ 1.0.8/doc-orig/pcbfile.texi (revision 1136) @@ -0,0 +1,946 @@ +@c key pcbfile +@c ./../src/parse_y.y 143 + +A special note about units: Older versions of @code{pcb} used mils +(1/1000 inch) as the base unit; a value of 500 in the file meant +half an inch. Newer versions uses a "high resolution" syntax, +where the base unit is 1/100 of a mil (0.000010 inch); a value of 500 in +the file means 5 mils. As a general rule, the variants of each entry +listed below which use square brackets are the high resolution formats +and use the 1/100 mil units, and the ones with parentheses are the older +variants and use 1 mil units. Note that when multiple variants +are listed, the most recent (and most preferred) format is the first +listed. + +Symbolic and numeric flags (SFlags and NFlags) are described in +@ref{Object Flags}. + +@menu +* Arc syntax:: +* Attribute syntax:: +* Connect syntax:: +* Cursor syntax:: +* DRC syntax:: +* Element syntax:: +* ElementArc syntax:: +* ElementLine syntax:: +* FileVersion syntax:: +* Flags syntax:: +* Grid syntax:: +* Groups syntax:: +* Layer syntax:: +* Line syntax:: +* Mark syntax:: +* Net syntax:: +* Netlist syntax:: +* Pad syntax:: +* PCB syntax:: +* Pin syntax:: +* PolyArea syntax:: +* Polygon syntax:: +* Rat syntax:: +* Styles syntax:: +* Symbol syntax:: +* SymbolLine syntax:: +* Text syntax:: +* Thermal syntax:: +* Via syntax:: +@end menu +@c pcbfile Arc +@node Arc syntax +@subsection Arc +@c ./../src/parse_y.y 660 + +@cartouche +@format +Arc [X Y Width Height Thickness Clearance StartAngle DeltaAngle SFlags] +Arc (X Y Width Height Thickness Clearance StartAngle DeltaAngle NFlags) +Arc (X Y Width Height Thickness StartAngle DeltaAngle NFlags) +@end format +@end cartouche + +@table @var +@item X Y +Coordinates of the center of the arc. +@item Width Height +The width and height, from the center to the edge. The bounds of the +circle of which this arc is a segment, is thus @math{2*Width} by +@math{2*Height}. +@item Thickness +The width of the copper trace which forms the arc. +@item Clearance +The amount of space cleared around the arc when the line passes +through a polygon. The clearance is added to the thickness to get the +thickness of the clear; thus the space between the arc and the polygon +is @math{Clearance/2} wide. +@item StartAngle +The angle of one end of the arc, in degrees. In PCB, an angle of zero +points left (negative X direction), and 90 degrees points down +(positive Y direction). +@item DeltaAngle +The sweep of the arc. This may be negative. Positive angles sweep +counterclockwise. +@item SFlags +Symbolic or numeric flags. +@item NFlags +Numeric flags. +@end table + +@c pcbfile Attribute +@node Attribute syntax +@subsection Attribute +@c ./../src/parse_y.y 1268 + +@cartouche +@format +Attribute ("Name" "Value") +@end format +@end cartouche + +Attributes allow boards and elements to have arbitrary data attached +to them, which is not directly used by PCB itself but may be of use by +other programs or users. + +@table @var +@item Name +The name of the attribute + +@item Value +The value of the attribute. Values are always stored as strings, even +if the value is interpreted as, for example, a number. + +@end table + +@c pcbfile Connect +@node Connect syntax +@subsection Connect +@c ./../src/parse_y.y 1258 + +@cartouche +@format +Connect ("PinPad") +@end format +@end cartouche + +@table @var +@item PinPad +The name of a pin or pad which is included in this net. Pin and Pad +names are named by the refdes and pin name, like @code{"U14-7"} for +pin 7 of U14, or @code{"T4-E"} for pin E of T4. +@end table + +@c pcbfile Cursor +@node Cursor syntax +@subsection Cursor +@c ./../src/parse_y.y 335 + +@cartouche +@format +Cursor [X Y Zoom] +Cursor (X Y Zoom) +@end format +@end cartouche + +@table @var +@item X Y +Location of the cursor when the board was saved. +@item Zoom +The current zoom factor. Note that a zoom factor of "0" means 1 mil +per screen pixel, N means @math{2^N} mils per screen pixel, etc. The +first variant accepts floating point numbers. The special value +"1000" means "zoom to fit" +@end table + +@c pcbfile DRC +@node DRC syntax +@subsection DRC +@c ./../src/parse_y.y 376 + +@cartouche +@format +DRC [Bloat Shrink Line Silk Drill Ring] +DRC [Bloat Shrink Line Silk] +DRC [Bloat Shrink Line] +@end format +@end cartouche + +@table @var +@item Bloat +Minimum spacing between copper. +@item Shrink +Minimum copper overlap to guarantee connectivity. +@item Line +Minimum line thickness. +@item Silk +Minimum silk thickness. +@item Drill +Minimum drill size. +@item Ring +Minimum width of the annular ring around pins and vias. +@end table + +@c pcbfile Element +@node Element syntax +@subsection Element +@c ./../src/parse_y.y 816 + +@cartouche +@format +Element [SFlags "Desc" "Name" "Value" MX MY TX TY TDir TScale TSFlags] ( +Element (NFlags "Desc" "Name" "Value" MX MY TX TY TDir TScale TNFlags) ( +Element (NFlags "Desc" "Name" "Value" TX TY TDir TScale TNFlags) ( +Element (NFlags "Desc" "Name" TX TY TDir TScale TNFlags) ( +Element ("Desc" "Name" TX TY TDir TScale TNFlags) ( +@ @ @ @dots{} contents @dots{} +) +@end format +@end cartouche + +@table @var +@item SFlags +Symbolic or numeric flags, for the element as a whole. +@item NFlags +Numeric flags, for the element as a whole. +@item Desc +The description of the element. This is one of the three strings +which can be displayed on the screen. +@item Name +The name of the element, usually the reference designator. +@item Value +The value of the element. +@item MX MY +The location of the element's mark. This is the reference point +for placing the element and its pins and pads. +@item TX TY +The upper left corner of the text (one of the three strings). +@item TDir +The relative direction of the text. 0 means left to right for +an unrotated element, 1 means up, 2 left, 3 down. +@item TScale +Size of the text, as a percentage of the ``default'' size of of the +font (the default font is about 40 mils high). Default is 100 (40 +mils). +@item TSFlags +Symbolic or numeric flags, for the text. +@item TNFlags +Numeric flags, for the text. +@end table + +Elements may contain pins, pads, element lines, element arcs, +attributes, and (for older elements) an optional mark. Note that +element definitions that have the mark coordinates in the element +line, only support pins and pads which use relative coordinates. The +pin and pad coordinates are relative to the mark. Element definitions +which do not include the mark coordinates in the element line, may +have a Mark definition in their contents, and only use pin and pad +definitions which use absolute coordinates. + +@c pcbfile ElementArc +@node ElementArc syntax +@subsection ElementArc +@c ./../src/parse_y.y 927 + +@cartouche +@format +ElementArc [X Y Width Height StartAngle DeltaAngle Thickness] +ElementArc (X Y Width Height StartAngle DeltaAngle Thickness) +@end format +@end cartouche + +@table @var +@item X Y +Coordinates of the center of the arc. These are relative to the +Element's mark point for new element formats, or absolute for older +formats. +@item Width Height +The width and height, from the center to the edge. The bounds of the +circle of which this arc is a segment, is thus @math{2*Width} by +@math{2*Height}. +@item StartAngle +The angle of one end of the arc, in degrees. In PCB, an angle of zero +points left (negative X direction), and 90 degrees points down +(positive Y direction). +@item DeltaAngle +The sweep of the arc. This may be negative. Positive angles sweep +counterclockwise. +@item Thickness +The width of the silk line which forms the arc. +@end table + +@c pcbfile ElementLine +@node ElementLine syntax +@subsection ElementLine +@c ./../src/parse_y.y 925 + +@cartouche +@format +ElementLine [X1 Y1 X2 Y2 Thickness] +ElementLine (X1 Y1 X2 Y2 Thickness) +@end format +@end cartouche + +@table @var +@item X1 Y1 X2 Y2 +Coordinates of the endpoints of the line. These are relative to the +Element's mark point for new element formats, or absolute for older +formats. +@item Thickness +The width of the silk for this line. +@end table + +@c pcbfile FileVersion +@node FileVersion syntax +@subsection FileVersion +@c ./../src/parse_y.y 258 + +@cartouche +@format +FileVersion[Version] +@end format +@end cartouche + +@table @var +@item Version +File format version. This version number represents the date when the pcb file +format was last changed. +@end table + +Any version of pcb build from sources equal to or newer +than this number should be able to read the file. If this line is not present +in the input file then file format compatibility is not checked. + + +@c pcbfile Flags +@node Flags syntax +@subsection Flags +@c ./../src/parse_y.y 418 + +@cartouche +@format +Flags(Number) +@end format +@end cartouche + +@table @var +@item Number +A number, whose value is normally given in hex, individual bits of which +represent pcb-wide flags as defined in @ref{PCBFlags}. + +@end table + +@c pcbfile Grid +@node Grid syntax +@subsection Grid +@c ./../src/parse_y.y 294 + +@cartouche +@format +Grid [Step OffsetX OffsetY Visible] +Grid (Step OffsetX OffsetY Visible) +Grid (Step OffsetX OffsetY) +@end format +@end cartouche + +@table @var +@item Step +Distance from one grid point to adjacent points. This value may be a +floating point number for the first two variants. +@item OffsetX OffsetY +The "origin" of the grid. Normally zero. +@item Visible +If non-zero, the grid will be visible on the screen. +@end table + +@c pcbfile Groups +@node Groups syntax +@subsection Groups +@c ./../src/parse_y.y 432 + +@cartouche +@format +Groups("String") +@end format +@end cartouche + +@table @var +@item String + +Encodes the layer grouping information. Each group is separated by a +colon, each member of each group is separated by a comma. Group +members are either numbers from @code{1}..@var{N} for each layer, and +the letters @code{c} or @code{s} representing the component side and +solder side of the board. Including @code{c} or @code{s} marks that +group as being the top or bottom side of the board. + +@example +Groups("1,2,c:3:4:5,6,s:7,8") +@end example + +@end table + +@c pcbfile Layer +@node Layer syntax +@subsection Layer +@c ./../src/parse_y.y 573 + +@cartouche +@format +Layer (LayerNum "Name") ( +@ @ @ @dots{} contents @dots{} +) +@end format +@end cartouche + +@table @var +@item LayerNum +The layer number. Layers are numbered sequentially, starting with 1. +The last two layers (9 and 10 by default) are solder-side silk and +component-side silk, in that order. +@item Name +The layer name. +@item contents +The contents of the layer, which may include attributes, lines, arcs, rectangles, +text, and polygons. +@end table + +@c pcbfile Line +@node Line syntax +@subsection Line +@c ./../src/parse_y.y 629 + +@cartouche +@format +Line [X1 Y1 X2 Y2 Thickness Clearance SFlags] +Line (X1 Y1 X2 Y2 Thickness Clearance NFlags) +Line (X1 Y1 X2 Y2 Thickness NFlags) +@end format +@end cartouche + +@table @var +@item X1 Y1 X2 Y2 +The end points of the line +@item Thickness +The width of the line +@item Clearance +The amount of space cleared around the line when the line passes +through a polygon. The clearance is added to the thickness to get the +thickness of the clear; thus the space between the line and the +polygon is @math{Clearance/2} wide. +@item SFlags +Symbolic or numeric flags +@item NFlags +Numeric flags. +@end table + +@c pcbfile Mark +@node Mark syntax +@subsection Mark +@c ./../src/parse_y.y 929 + +@cartouche +@format +Mark [X Y] +Mark (X Y) +@end format +@end cartouche + +@table @var +@item X Y +Coordinates of the Mark, for older element formats that don't have +the mark as part of the Element line. +@end table + +@c pcbfile Net +@node Net syntax +@subsection Net +@c ./../src/parse_y.y 1235 + +@cartouche +@format +Net ("Name" "Style") ( +@ @ @ @dots{} connects @dots{} +) +@end format +@end cartouche + +@table @var +@item Name +The name of this net. +@item Style +The routing style that should be used when autorouting this net. +@end table + +@c pcbfile Netlist +@node Netlist syntax +@subsection Netlist +@c ./../src/parse_y.y 1214 + +@cartouche +@format +Netlist ( ) ( +@ @ @ @dots{} nets @dots{} +) +@end format +@end cartouche + +@c pcbfile Pad +@node Pad syntax +@subsection Pad +@c ./../src/parse_y.y 1086 + +@cartouche +@format +Pad [rX1 rY1 rX2 rY2 Thickness Clearance Mask "Name" "Number" SFlags] +Pad (rX1 rY1 rX2 rY2 Thickness Clearance Mask "Name" "Number" NFlags) +Pad (aX1 aY1 aX2 aY2 Thickness "Name" "Number" NFlags) +Pad (aX1 aY1 aX2 aY2 Thickness "Name" NFlags) +@end format +@end cartouche + +@table @var +@item rX1 rY1 rX2 rY2 +Coordinates of the endpoints of the pad, relative to the element's +mark. Note that the copper extends beyond these coordinates by half +the thickness. To make a square or round pad, specify the same +coordinate twice. +@item aX1 aY1 aX2 aY2 +Same, but absolute coordinates of the endpoints of the pad. +@item Thickness +width of the pad. +@item Clearance +add to thickness to get clearance width. +@item Mask +width of solder mask opening. +@item Name +name of pin +@item Number +number of pin +@item SFlags +symbolic or numerical flags +@item NFlags +numerical flags only +@end table + +@c pcbfile PCB +@node PCB syntax +@subsection PCB +@c ./../src/parse_y.y 271 + +@cartouche +@format +PCB ["Name" Width Height] +PCB ("Name" Width Height] +PCB ("Name") +@end format +@end cartouche + +@table @var +@item Name +Name of the PCB project +@item Width Height +Size of the board +@end table + +If you don't specify the size of the board, a very large default is +chosen. + +@c pcbfile Pin +@node Pin syntax +@subsection Pin +@c ./../src/parse_y.y 1013 + +@cartouche +@format +Pin [rX rY Thickness Clearance Mask Drill "Name" "Number" SFlags] +Pin (rX rY Thickness Clearance Mask Drill "Name" "Number" NFlags) +Pin (aX aY Thickness Drill "Name" "Number" NFlags) +Pin (aX aY Thickness Drill "Name" NFlags) +Pin (aX aY Thickness "Name" NFlags) +@end format +@end cartouche + +@table @var +@item rX rY +coordinates of center, relative to the element's mark +@item aX aY +absolute coordinates of center. +@item Thickness +outer diameter of copper annulus +@item Clearance +add to thickness to get clearance diameter +@item Mask +diameter of solder mask opening +@item Drill +diameter of drill +@item Name +name of pin +@item Number +number of pin +@item SFlags +symbolic or numerical flags +@item NFlags +numerical flags only +@end table + +@c pcbfile PolyArea +@node PolyArea syntax +@subsection PolyArea +@c ./../src/parse_y.y 353 + +@cartouche +@format +PolyArea [Area] +@end format +@end cartouche + +@table @var +@item Area +Minimum area of polygon island to retain. If a polygon has clearances that cause an isolated island to be created, then will only be retained if the area exceeds this minimum area. +@end table + +@c pcbfile Polygon +@node Polygon syntax +@subsection Polygon +@c ./../src/parse_y.y 743 + +@cartouche +@format +Polygon (SFlags) ( +@ @ @ @dots{} (X Y) @dots{} +@ @ @ @dots{} [X Y] @dots{} +@ @ @ Hole ( +@ @ @ @ @ @ @dots{} (X Y) @dots{} +@ @ @ @ @ @ @dots{} [X Y] @dots{} +@ @ @ ) +@ @ @ @dots{} +) +@end format +@end cartouche + +@table @var +@item SFlags +Symbolic or numeric flags. +@item X Y +Coordinates of each vertex. You must list at least three coordinates. +@item Hole (...) +Defines a hole within the polygon's outer contour. There may be zero or more such sections. +@end table + +@c pcbfile Rat +@node Rat syntax +@subsection Rat +@c ./../src/parse_y.y 558 + +@cartouche +@format +Rat [X1 Y1 Group1 X2 Y2 Group2 SFlags] +Rat (X1 Y1 Group1 X2 Y2 Group2 NFlags) +@end format +@end cartouche + +@table @var +@item X1 Y1 X2 Y2 +The endpoints of the rat line. +@item Group1 Group2 +The layer group each end is connected on. +@item SFlags +Symbolic or numeric flags. +@item NFlags +Numeric flags. +@end table + +@c pcbfile Styles +@node Styles syntax +@subsection Styles +@c ./../src/parse_y.y 442 + +@cartouche +@format +Styles("String") +@end format +@end cartouche + +@table @var +@item String + +Encodes the four routing styles @code{pcb} knows about. The four styles +are separated by colons. Each style consists of five parameters as follows: + +@table @var +@item Name +The name of the style. +@item Thickness +Width of lines and arcs. +@item Diameter +Copper diameter of pins and vias. +@item Drill +Drill diameter of pins and vias. +@item Keepaway +Minimum spacing to other nets. If omitted, 10 mils is the default. + +@end table + +@end table + +@example +Styles("Signal,10,40,20:Power,25,60,35:Fat,40,60,35:Skinny,8,36,20") +Styles["Logic,1000,3600,2000,1000:Power,2500,6000,3500,1000: +@ @ @ Line,4000,6000,3500,1000:Breakout,600,2402,1181,600"] +@end example + +@noindent +Note that strings in actual files cannot span lines; the above example +is split across lines only to make it readable. + +@c pcbfile Symbol +@node Symbol syntax +@subsection Symbol +@c ./../src/parse_y.y 1148 + +@cartouche +@format +Symbol [Char Delta] ( +Symbol (Char Delta) ( +@ @ @ @dots{} symbol lines @dots{} +) +@end format +@end cartouche + +@table @var +@item Char +The character or numerical character value this symbol represents. +Characters must be in single quotes. +@item Delta +Additional space to allow after this character. +@end table + +@c pcbfile SymbolLine +@node SymbolLine syntax +@subsection SymbolLine +@c ./../src/parse_y.y 1197 + +@cartouche +@format +SymbolLine [X1 Y1 X2 Y1 Thickness] +SymbolLine (X1 Y1 X2 Y1 Thickness) +@end format +@end cartouche + +@table @var +@item X1 Y1 X2 Y2 +The endpoints of this line. +@item Thickness +The width of this line. +@end table + +@c pcbfile Text +@node Text syntax +@subsection Text +@c ./../src/parse_y.y 689 + +@cartouche +@format +Text [X Y Direction Scale "String" SFlags] +Text (X Y Direction Scale "String" NFlags) +Text (X Y Direction "String" NFlags) +@end format +@end cartouche + +@table @var +@item X Y +The location of the upper left corner of the text. +@item Direction +0 means text is drawn left to right, 1 means up, 2 means right to left +(i.e. upside down), and 3 means down. +@item Scale +Size of the text, as a percentage of the ``default'' size of of the +font (the default font is about 40 mils high). Default is 100 (40 +mils). +@item String +The string to draw. +@item SFlags +Symbolic or numeric flags. +@item NFlags +Numeric flags. +@end table + +@c pcbfile Thermal +@node Thermal syntax +@subsection Thermal +@c ./../src/parse_y.y 365 + +@cartouche +@format +Thermal [Scale] +@end format +@end cartouche + +@table @var +@item Scale +Relative size of thermal fingers. A value of 1.0 makes the finger +width twice the clearance gap width (measured across the gap, not +diameter). The normal value is 0.5, which results in a finger width +the same as the clearance gap width. +@end table + +@c pcbfile Via +@node Via syntax +@subsection Via +@c ./../src/parse_y.y 498 + +@cartouche +@format +Via [X Y Thickness Clearance Mask Drill "Name" SFlags] +Via (X Y Thickness Clearance Mask Drill "Name" NFlags) +Via (X Y Thickness Clearance Drill "Name" NFlags) +Via (X Y Thickness Drill "Name" NFlags) +Via (X Y Thickness "Name" NFlags) +@end format +@end cartouche + +@table @var +@item X Y +coordinates of center +@item Thickness +outer diameter of copper annulus +@item Clearance +add to thickness to get clearance diameter +@item Mask +diameter of solder mask opening +@item Drill +diameter of drill +@item Name +string, name of via (vias have names?) +@item SFlags +symbolic or numerical flags +@item NFlags +numerical flags only +@end table + +@c pcbfile ~objectflags +@c ./../src/const.h 110 +@node Object Flags +@section Object Flags + +Note that object flags can be given numerically (like @code{0x0147}) +or symbolically (like @code{"found,showname,square"}. Some numeric +values are reused for different object types. The table below lists +the numeric value followed by the symbolic name. + +@table @code +@item 0x0001 pin +If set, this object is a pin. This flag is for internal use only. +@item 0x0002 via +Likewise, for vias. +@item 0x0004 found +If set, this object has been found by @code{FindConnection()}. +@item 0x0008 hole +For pins and vias, this flag means that the pin or via is a hole +without a copper annulus. +@item 0x0010 rat +If set for a line, indicates that this line is a rat line instead of a +copper trace. +@item 0x0010 pininpoly +For pins and pads, this flag is used internally to indicate that the +pin or pad overlaps a polygon on some layer. +@item 0x0010 clearpoly +For polygons, this flag means that pins and vias will normally clear +these polygons (thus, thermals are required for electrical +connection). When clear, polygons will solidly connect to pins and +vias. +@item 0x0010 hidename +For elements, when set the name of the element is hidden. +@item 0x0020 showname +For elements, when set the names of pins are shown. +@item 0x0020 clearline +For lines and arcs, the line/arc will clear polygons instead of +connecting to them. +@item 0x0020 fullpoly +For polygons, the full polygon is drawn (i.e. all parts instead of only the biggest one). +@item 0x0040 selected +Set when the object is selected. +@item 0x0080 onsolder +For elements and pads, indicates that they are on the solder side. +@item 0x0080 auto +For lines and vias, indicates that these were created by the +autorouter. +@item 0x0100 square +For pins and pads, indicates a square (vs round) pin/pad. +@item 0x0200 rubberend +For lines, used internally for rubber band moves. +@item 0x0200 warn +For pins, vias, and pads, set to indicate a warning. +@item 0x0400 usetherm +Obsolete, indicates that pins/vias should be drawn with thermal +fingers. +@item 0x0400 +Obsolete, old files used this to indicate lines drawn on silk. +@item 0x0800 octagon +Draw pins and vias as octagons. +@item 0x1000 drc +Set for objects that fail DRC. +@item 0x2000 lock +Set for locked objects. +@item 0x4000 edge2 +For pads, indicates that the second point is closer to the edge. For +pins, indicates that the pin is closer to a horizontal edge and thus +pinout text should be vertical. +@item 0x8000 marker +Marker used internally to avoid revisiting an object. +@item 0x10000 nopaste +For pads, set to prevent a solderpaste stencil opening for the +pad. Primarily used for pads used as fiducials. +@end table +@c pcbfile ~pcbflags +@c ./../src/const.h 149 +@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. +@end table Index: 1.0.8/doc-orig/puller.pcb =================================================================== --- 1.0.8/doc-orig/puller.pcb (nonexistent) +++ 1.0.8/doc-orig/puller.pcb (revision 1136) @@ -0,0 +1,848 @@ +# release: pcb 1.99s + +PCB["" 110000 30000] + +Grid[10000.00000000 0 0 1] +Cursor[0 0 0.000000] +Thermal[0.500000] +DRC[1000 1000 1000 1000 1500 1000] +Flags(0x0000000000001c40) +Groups("1,c:2,s:3:4:5:6:7:8") +Styles["Signal,1000,3600,2000,1000:Power,2500,6000,3500,1000:Fat,5000,10000,5000,1000:Skinny,600,2402,1181,600"] + +Symbol[' ' 1800] +( +) +Symbol['!' 1200] +( + SymbolLine[0 4500 0 5000 800] + SymbolLine[0 1000 0 3500 800] +) +Symbol['"' 1200] +( + SymbolLine[0 1000 0 2000 800] + SymbolLine[1000 1000 1000 2000 800] +) +Symbol['#' 1200] +( + SymbolLine[0 3500 2000 3500 800] + SymbolLine[0 2500 2000 2500 800] + SymbolLine[1500 2000 1500 4000 800] + SymbolLine[500 2000 500 4000 800] +) +Symbol['$' 1200] +( + SymbolLine[1500 1500 2000 2000 800] + SymbolLine[500 1500 1500 1500 800] + SymbolLine[0 2000 500 1500 800] + SymbolLine[0 2000 0 2500 800] + SymbolLine[0 2500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 4000 800] + SymbolLine[1500 4500 2000 4000 800] + SymbolLine[500 4500 1500 4500 800] + SymbolLine[0 4000 500 4500 800] + SymbolLine[1000 1000 1000 5000 800] +) +Symbol['%' 1200] +( + SymbolLine[0 1500 0 2000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1000 1000 800] + SymbolLine[1000 1000 1500 1500 800] + SymbolLine[1500 1500 1500 2000 800] + SymbolLine[1000 2500 1500 2000 800] + SymbolLine[500 2500 1000 2500 800] + SymbolLine[0 2000 500 2500 800] + SymbolLine[0 5000 4000 1000 800] + SymbolLine[3500 5000 4000 4500 800] + SymbolLine[4000 4000 4000 4500 800] + SymbolLine[3500 3500 4000 4000 800] + SymbolLine[3000 3500 3500 3500 800] + SymbolLine[2500 4000 3000 3500 800] + SymbolLine[2500 4000 2500 4500 800] + SymbolLine[2500 4500 3000 5000 800] + SymbolLine[3000 5000 3500 5000 800] +) +Symbol['&' 1200] +( + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 1500 0 2500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 3500 1500 2000 800] + SymbolLine[500 5000 1000 5000 800] + SymbolLine[1000 5000 2000 4000 800] + SymbolLine[0 2500 2500 5000 800] + SymbolLine[500 1000 1000 1000 800] + SymbolLine[1000 1000 1500 1500 800] + SymbolLine[1500 1500 1500 2000 800] + SymbolLine[0 3500 0 4500 800] +) +Symbol[''' 1200] +( + SymbolLine[0 2000 1000 1000 800] +) +Symbol['(' 1200] +( + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 4500 800] +) +Symbol[')' 1200] +( + SymbolLine[0 1000 500 1500 800] + SymbolLine[500 1500 500 4500 800] + SymbolLine[0 5000 500 4500 800] +) +Symbol['*' 1200] +( + SymbolLine[0 2000 2000 4000 800] + SymbolLine[0 4000 2000 2000 800] + SymbolLine[0 3000 2000 3000 800] + SymbolLine[1000 2000 1000 4000 800] +) +Symbol['+' 1200] +( + SymbolLine[0 3000 2000 3000 800] + SymbolLine[1000 2000 1000 4000 800] +) +Symbol[',' 1200] +( + SymbolLine[0 6000 1000 5000 800] +) +Symbol['-' 1200] +( + SymbolLine[0 3000 2000 3000 800] +) +Symbol['.' 1200] +( + SymbolLine[0 5000 500 5000 800] +) +Symbol['/' 1200] +( + SymbolLine[0 4500 3000 1500 800] +) +Symbol['0' 1200] +( + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4000 2000 2000 800] +) +Symbol['1' 1200] +( + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1000 1000 1000 5000 800] + SymbolLine[0 2000 1000 1000 800] +) +Symbol['2' 1200] +( + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 2000 1000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 2500 800] + SymbolLine[0 5000 2500 2500 800] + SymbolLine[0 5000 2500 5000 800] +) +Symbol['3' 1200] +( + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 3000 2000 3000 800] +) +Symbol['4' 1200] +( + SymbolLine[0 3000 2000 1000 800] + SymbolLine[0 3000 2500 3000 800] + SymbolLine[2000 1000 2000 5000 800] +) +Symbol['5' 1200] +( + SymbolLine[0 1000 2000 1000 800] + SymbolLine[0 1000 0 3000 800] + SymbolLine[0 3000 500 2500 800] + SymbolLine[500 2500 1500 2500 800] + SymbolLine[1500 2500 2000 3000 800] + SymbolLine[2000 3000 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['6' 1200] +( + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[0 3000 1500 3000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[2000 3500 2000 4500 800] +) +Symbol['7' 1200] +( + SymbolLine[0 5000 2500 2500 800] + SymbolLine[2500 1000 2500 2500 800] + SymbolLine[0 1000 2500 1000 800] +) +Symbol['8' 1200] +( + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 2500 500 3000 800] + SymbolLine[0 1500 0 2500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 2500 800] + SymbolLine[1500 3000 2000 2500 800] +) +Symbol['9' 1200] +( + SymbolLine[0 5000 2000 3000 800] + SymbolLine[2000 1500 2000 3000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 2500 800] + SymbolLine[0 2500 500 3000 800] + SymbolLine[500 3000 2000 3000 800] +) +Symbol[':' 1200] +( + SymbolLine[0 2500 500 2500 800] + SymbolLine[0 3500 500 3500 800] +) +Symbol[';' 1200] +( + SymbolLine[0 5000 1000 4000 800] + SymbolLine[1000 2500 1000 3000 800] +) +Symbol['<' 1200] +( + SymbolLine[0 3000 1000 2000 800] + SymbolLine[0 3000 1000 4000 800] +) +Symbol['=' 1200] +( + SymbolLine[0 2500 2000 2500 800] + SymbolLine[0 3500 2000 3500 800] +) +Symbol['>' 1200] +( + SymbolLine[0 2000 1000 3000 800] + SymbolLine[0 4000 1000 3000 800] +) +Symbol['?' 1200] +( + SymbolLine[1000 3000 1000 3500 800] + SymbolLine[1000 4500 1000 5000 800] + SymbolLine[0 1500 0 2000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 2000 800] + SymbolLine[1000 3000 2000 2000 800] +) +Symbol['@' 1200] +( + SymbolLine[0 1000 0 4000 800] + SymbolLine[0 4000 1000 5000 800] + SymbolLine[1000 5000 4000 5000 800] + SymbolLine[5000 3500 5000 1000 800] + SymbolLine[5000 1000 4000 0 800] + SymbolLine[4000 0 1000 0 800] + SymbolLine[1000 0 0 1000 800] + SymbolLine[1500 2000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 3000 3500 800] + SymbolLine[3000 3500 3500 3000 800] + SymbolLine[3500 3000 4000 3500 800] + SymbolLine[3500 3000 3500 1500 800] + SymbolLine[3500 2000 3000 1500 800] + SymbolLine[2000 1500 3000 1500 800] + SymbolLine[2000 1500 1500 2000 800] + SymbolLine[4000 3500 5000 3500 800] +) +Symbol['A' 1200] +( + SymbolLine[0 1500 0 5000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 2000 1000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 5000 800] + SymbolLine[0 3000 2500 3000 800] +) +Symbol['B' 1200] +( + SymbolLine[0 5000 2000 5000 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[2500 3500 2500 4500 800] + SymbolLine[2000 3000 2500 3500 800] + SymbolLine[500 3000 2000 3000 800] + SymbolLine[500 1000 500 5000 800] + SymbolLine[0 1000 2000 1000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 2500 800] + SymbolLine[2000 3000 2500 2500 800] +) +Symbol['C' 1200] +( + SymbolLine[500 5000 2000 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 2000 1000 800] +) +Symbol['D' 1200] +( + SymbolLine[500 1000 500 5000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 4500 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[0 5000 2000 5000 800] + SymbolLine[0 1000 2000 1000 800] +) +Symbol['E' 1200] +( + SymbolLine[0 3000 1500 3000 800] + SymbolLine[0 5000 2000 5000 800] + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 1000 2000 1000 800] +) +Symbol['F' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 1000 2000 1000 800] + SymbolLine[0 3000 1500 3000 800] +) +Symbol['G' 1200] +( + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[500 1000 2000 1000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 2000 5000 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[2500 3500 2500 4500 800] + SymbolLine[2000 3000 2500 3500 800] + SymbolLine[1000 3000 2000 3000 800] +) +Symbol['H' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[2500 1000 2500 5000 800] + SymbolLine[0 3000 2500 3000 800] +) +Symbol['I' 1200] +( + SymbolLine[0 1000 1000 1000 800] + SymbolLine[500 1000 500 5000 800] + SymbolLine[0 5000 1000 5000 800] +) +Symbol['J' 1200] +( + SymbolLine[0 1000 1500 1000 800] + SymbolLine[1500 1000 1500 4500 800] + SymbolLine[1000 5000 1500 4500 800] + SymbolLine[500 5000 1000 5000 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['K' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 3000 2000 1000 800] + SymbolLine[0 3000 2000 5000 800] +) +Symbol['L' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 5000 2000 5000 800] +) +Symbol['M' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 1000 1500 2500 800] + SymbolLine[1500 2500 3000 1000 800] + SymbolLine[3000 1000 3000 5000 800] +) +Symbol['N' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 1000 0 1500 800] + SymbolLine[0 1500 2500 4000 800] + SymbolLine[2500 1000 2500 5000 800] +) +Symbol['O' 1200] +( + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['P' 1200] +( + SymbolLine[500 1000 500 5000 800] + SymbolLine[0 1000 2000 1000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 2500 800] + SymbolLine[2000 3000 2500 2500 800] + SymbolLine[500 3000 2000 3000 800] +) +Symbol['Q' 1200] +( + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[1000 4000 2000 5000 800] +) +Symbol['R' 1200] +( + SymbolLine[0 1000 2000 1000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 2500 800] + SymbolLine[2000 3000 2500 2500 800] + SymbolLine[500 3000 2000 3000 800] + SymbolLine[500 1000 500 5000 800] + SymbolLine[500 3000 2500 5000 800] +) +Symbol['S' 1200] +( + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[500 1000 2000 1000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 2500 800] + SymbolLine[0 2500 500 3000 800] + SymbolLine[500 3000 2000 3000 800] + SymbolLine[2000 3000 2500 3500 800] + SymbolLine[2500 3500 2500 4500 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[500 5000 2000 5000 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['T' 1200] +( + SymbolLine[0 1000 2000 1000 800] + SymbolLine[1000 1000 1000 5000 800] +) +Symbol['U' 1200] +( + SymbolLine[0 1000 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[2000 1000 2000 4500 800] +) +Symbol['V' 1200] +( + SymbolLine[0 1000 0 4000 800] + SymbolLine[0 4000 1000 5000 800] + SymbolLine[1000 5000 2000 4000 800] + SymbolLine[2000 1000 2000 4000 800] +) +Symbol['W' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 5000 1500 3500 800] + SymbolLine[1500 3500 3000 5000 800] + SymbolLine[3000 1000 3000 5000 800] +) +Symbol['X' 1200] +( + SymbolLine[0 1000 0 1500 800] + SymbolLine[0 1500 2500 4000 800] + SymbolLine[2500 4000 2500 5000 800] + SymbolLine[0 4000 0 5000 800] + SymbolLine[0 4000 2500 1500 800] + SymbolLine[2500 1000 2500 1500 800] +) +Symbol['Y' 1200] +( + SymbolLine[0 1000 0 1500 800] + SymbolLine[0 1500 1000 2500 800] + SymbolLine[1000 2500 2000 1500 800] + SymbolLine[2000 1000 2000 1500 800] + SymbolLine[1000 2500 1000 5000 800] +) +Symbol['Z' 1200] +( + SymbolLine[0 1000 2500 1000 800] + SymbolLine[2500 1000 2500 1500 800] + SymbolLine[0 4000 2500 1500 800] + SymbolLine[0 4000 0 5000 800] + SymbolLine[0 5000 2500 5000 800] +) +Symbol['[' 1200] +( + SymbolLine[0 1000 500 1000 800] + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 5000 500 5000 800] +) +Symbol['\' 1200] +( + SymbolLine[0 1500 3000 4500 800] +) +Symbol[']' 1200] +( + SymbolLine[0 1000 500 1000 800] + SymbolLine[500 1000 500 5000 800] + SymbolLine[0 5000 500 5000 800] +) +Symbol['^' 1200] +( + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1000 1500 800] +) +Symbol['_' 1200] +( + SymbolLine[0 5000 2000 5000 800] +) +Symbol['a' 1200] +( + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[2000 3000 2000 4500 800] + SymbolLine[2000 4500 2500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] +) +Symbol['b' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[2000 3500 2000 4500 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[0 3500 500 3000 800] +) +Symbol['c' 1200] +( + SymbolLine[500 3000 2000 3000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 2000 5000 800] +) +Symbol['d' 1200] +( + SymbolLine[2000 1000 2000 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] +) +Symbol['e' 1200] +( + SymbolLine[500 5000 2000 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[0 4000 2000 4000 800] + SymbolLine[2000 4000 2000 3500 800] +) +Symbol['f' 1000] +( + SymbolLine[500 1500 500 5000 800] + SymbolLine[500 1500 1000 1000 800] + SymbolLine[1000 1000 1500 1000 800] + SymbolLine[0 3000 1000 3000 800] +) +Symbol['g' 1200] +( + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[0 6000 500 6500 800] + SymbolLine[500 6500 1500 6500 800] + SymbolLine[1500 6500 2000 6000 800] + SymbolLine[2000 3000 2000 6000 800] +) +Symbol['h' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 5000 800] +) +Symbol['i' 1000] +( + SymbolLine[0 2000 0 2500 800] + SymbolLine[0 3500 0 5000 800] +) +Symbol['j' 1000] +( + SymbolLine[500 2000 500 2500 800] + SymbolLine[500 3500 500 6000 800] + SymbolLine[0 6500 500 6000 800] +) +Symbol['k' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 3500 1500 5000 800] + SymbolLine[0 3500 1000 2500 800] +) +Symbol['l' 1000] +( + SymbolLine[0 1000 0 4500 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['m' 1200] +( + SymbolLine[500 3500 500 5000 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[1000 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 5000 800] + SymbolLine[2000 3500 2500 3000 800] + SymbolLine[2500 3000 3000 3000 800] + SymbolLine[3000 3000 3500 3500 800] + SymbolLine[3500 3500 3500 5000 800] + SymbolLine[0 3000 500 3500 800] +) +Symbol['n' 1200] +( + SymbolLine[500 3500 500 5000 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[1000 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 5000 800] + SymbolLine[0 3000 500 3500 800] +) +Symbol['o' 1200] +( + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['p' 1200] +( + SymbolLine[500 3500 500 6500 800] + SymbolLine[0 3000 500 3500 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[1000 3000 2000 3000 800] + SymbolLine[2000 3000 2500 3500 800] + SymbolLine[2500 3500 2500 4500 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[1000 5000 2000 5000 800] + SymbolLine[500 4500 1000 5000 800] +) +Symbol['q' 1200] +( + SymbolLine[2000 3500 2000 6500 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] +) +Symbol['r' 1200] +( + SymbolLine[500 3500 500 5000 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[1000 3000 2000 3000 800] + SymbolLine[0 3000 500 3500 800] +) +Symbol['s' 1200] +( + SymbolLine[500 5000 2000 5000 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[2000 4000 2500 4500 800] + SymbolLine[500 4000 2000 4000 800] + SymbolLine[0 3500 500 4000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 2000 3000 800] + SymbolLine[2000 3000 2500 3500 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['t' 1000] +( + SymbolLine[500 1000 500 4500 800] + SymbolLine[500 4500 1000 5000 800] + SymbolLine[0 2500 1000 2500 800] +) +Symbol['u' 1200] +( + SymbolLine[0 3000 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[2000 3000 2000 4500 800] +) +Symbol['v' 1200] +( + SymbolLine[0 3000 0 4000 800] + SymbolLine[0 4000 1000 5000 800] + SymbolLine[1000 5000 2000 4000 800] + SymbolLine[2000 3000 2000 4000 800] +) +Symbol['w' 1200] +( + SymbolLine[0 3000 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1000 5000 800] + SymbolLine[1000 5000 1500 4500 800] + SymbolLine[1500 3000 1500 4500 800] + SymbolLine[1500 4500 2000 5000 800] + SymbolLine[2000 5000 2500 5000 800] + SymbolLine[2500 5000 3000 4500 800] + SymbolLine[3000 3000 3000 4500 800] +) +Symbol['x' 1200] +( + SymbolLine[0 3000 2000 5000 800] + SymbolLine[0 5000 2000 3000 800] +) +Symbol['y' 1200] +( + SymbolLine[0 3000 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[2000 3000 2000 6000 800] + SymbolLine[1500 6500 2000 6000 800] + SymbolLine[500 6500 1500 6500 800] + SymbolLine[0 6000 500 6500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] +) +Symbol['z' 1200] +( + SymbolLine[0 3000 2000 3000 800] + SymbolLine[0 5000 2000 3000 800] + SymbolLine[0 5000 2000 5000 800] +) +Symbol['{' 1200] +( + SymbolLine[500 1500 1000 1000 800] + SymbolLine[500 1500 500 2500 800] + SymbolLine[0 3000 500 2500 800] + SymbolLine[0 3000 500 3500 800] + SymbolLine[500 3500 500 4500 800] + SymbolLine[500 4500 1000 5000 800] +) +Symbol['|' 1200] +( + SymbolLine[0 1000 0 5000 800] +) +Symbol['}' 1200] +( + SymbolLine[0 1000 500 1500 800] + SymbolLine[500 1500 500 2500 800] + SymbolLine[500 2500 1000 3000 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[500 3500 500 4500 800] + SymbolLine[0 5000 500 4500 800] +) +Symbol['~' 1200] +( + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1000 3000 800] + SymbolLine[1000 3000 1500 3500 800] + SymbolLine[1500 3500 2000 3500 800] + SymbolLine[2000 3500 2500 3000 800] +) +Via[30000 20000 10000 2000 0 5000 "" ""] +Via[80000 20000 10000 2000 0 5000 "" ""] +Layer(1 "component") +( + Line[10000 20000 20000 20000 2000 2000 "clearline"] + Line[40000 20000 50000 20000 2000 2000 "clearline"] + Line[60000 20000 70000 20000 2000 2000 "clearline"] + Line[100000 20000 84848 11254 2000 2000 "clearline"] + Arc[30000 20000 10000 10000 2000 2000 270 -90 "clearline"] + Arc[30000 20000 10000 10000 2000 2000 270 90 "clearline"] + Arc[80000 20000 10000 10000 2000 2000 270 -29 "clearline"] + Arc[80000 20000 10000 10000 2000 2000 270 90 "clearline"] +) +Layer(2 "solder") +( +) +Layer(3 "GND") +( +) +Layer(4 "power") +( +) +Layer(5 "signal1") +( +) +Layer(6 "signal2") +( +) +Layer(7 "signal3") +( +) +Layer(8 "signal4") +( +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( + Line[33000 20000 38000 20000 500 2000 "clearline"] + Line[40000 13000 40000 18000 500 2000 "clearline"] + Line[42000 20000 47000 20000 500 2000 "clearline"] + Line[40000 22000 40000 27000 500 2000 "clearline"] + Line[77848 11254 82848 11254 500 2000 "clearline"] + Line[84848 4254 84848 9254 500 2000 "clearline"] + Line[86848 11254 91848 11254 500 2000 "clearline"] + Line[84848 13254 84848 18254 500 2000 "clearline"] + Arc[40000 20000 2000 2000 500 2000 0 -90 "clearline"] + Arc[39999 20001 2001 2001 500 2000 270 -90 "clearline"] + Arc[40002 20002 1998 1998 500 2000 180 -90 "clearline"] + Arc[40002 19998 2002 2002 500 2000 90 -90 "clearline"] + Arc[84848 11254 2000 2000 500 2000 0 -90 "clearline"] + Arc[84847 11255 2001 2001 500 2000 270 -90 "clearline"] + Arc[84850 11256 1998 1998 500 2000 180 -90 "clearline"] + Arc[84850 11252 2002 2002 500 2000 90 -90 "clearline"] +) Index: 1.0.8/doc-orig/puller.pdf =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-orig/puller.pdf =================================================================== --- 1.0.8/doc-orig/puller.pdf (nonexistent) +++ 1.0.8/doc-orig/puller.pdf (revision 1136) Property changes on: 1.0.8/doc-orig/puller.pdf ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-orig/puller.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-orig/puller.png =================================================================== --- 1.0.8/doc-orig/puller.png (nonexistent) +++ 1.0.8/doc-orig/puller.png (revision 1136) Property changes on: 1.0.8/doc-orig/puller.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-orig/refcard.pdf =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-orig/refcard.pdf =================================================================== --- 1.0.8/doc-orig/refcard.pdf (nonexistent) +++ 1.0.8/doc-orig/refcard.pdf (revision 1136) Property changes on: 1.0.8/doc-orig/refcard.pdf ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-orig/refcard.tex =================================================================== --- 1.0.8/doc-orig/refcard.tex (nonexistent) +++ 1.0.8/doc-orig/refcard.tex (revision 1136) @@ -0,0 +1,258 @@ +% $Id$ +% +% COPYRIGHT +% +% PCB, interactive printed circuit board design +% Copyright (C) 1994, 1995 Thomas Nau +% Copyright (C) 1998, 1999, 2000, 2001 harry eaton +% Copyright (C) 2009 Chitlesh Goorah +% +% 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: +% Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany +% Thomas.Nau@rz.uni-ulm.de + + +\documentclass[11pt,landscape]{article} +\usepackage{multicol} +\usepackage{calc} +\usepackage{ifthen} +\usepackage[landscape,left=2.5cm,top=2cm,right=2cm,bottom=2cm,nohead]{geometry} + +% Turn off header and footer +\pagestyle{empty} + +% Redefine section commands to use less space +\makeatletter +\renewcommand{\section}{\@startsection{section}{1}{0mm}% + {-1ex plus -.5ex minus -.2ex}% + {0.5ex plus .2ex}%x + {\normalfont\large\bfseries}} +\renewcommand{\subsection}{\@startsection{subsection}{2}{0mm}% + {-1explus -.5ex minus -.2ex}% + {0.5ex plus .2ex}% + {\normalfont\normalsize\bfseries}} +\renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{0mm}% + {-1ex plus -.5ex minus -.2ex}% + {1ex plus .2ex}% + {\normalfont\small\bfseries}} +\makeatother + +% Define BibTeX command +\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em + T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}} + +% Don't print section numbers +\setcounter{secnumdepth}{0} + + +\setlength{\parindent}{0pt} +\setlength{\parskip}{0pt plus 0.5ex} + +%------------------------------------------------------------------ +% some new commands to define the modifier keys +% +\newcommand{\Shift}{{\it [S]}} +\newcommand{\Ctrl}{{\it [C]}} +\newcommand{\Mod}{{\it [M]}} +\newcommand{\Btn}{{\it Btn}} +\newcommand{\Fun}{{\it F}} + +\begin{document} +\raggedright +\footnotesize +\begin{multicols}{3} + + +% multicol parameters +% These lengths are set only within the two main columns +%\setlength{\columnseprule}{0.25pt} +\setlength{\premulticols}{1pt} +\setlength{\postmulticols}{1pt} +\setlength{\multicolsep}{1pt} +\setlength{\columnsep}{2pt} + +\begin{center} + \Large{\textbf{PCB Command reference}} + \footnote{http://pcb.gpleda.org/index.html} + \footnote{Obviously \Shift, \Ctrl, \Mod, \Fun \space and \Btn \space mean the shift, + control, modifier1 (BTNMOD for buttons), function key and mouse button.} \\ +\end{center} + +\section{Misc operations} +\begin{tabular}{@{}ll@{}} +backspace & remove object \\ +\Shift\Ctrl\Btn1 & remove object \\ +scroll wheel & vertical pan \\ +\Shift scroll wheel & horizontal pan \\ +\Btn1 & current mode action\\ +u & undo operation \\ +\Shift r & redo operation \\ +\Shift\Ctrl u & clear undo-list \\ +tab & switch viewing side \\ +cursor key & move crosshair 1 grid\\ +\Shift cursor key! & move crosshair 10 grid\\ +\end{tabular} + + +\section{Connections} +\begin{tabular}{@{}ll@{}} +\Shift f & reset found connections \\ +f & find connections \\ +\Shift backspace & remove connections \\ +\end{tabular} + + +\section{User (:) commands} +\begin{tabular}{@{}ll@{}} +:DRC() & check layout for rule violations \\ +:l [file] & load data file \\ +:le [file] & load element to buffer \\ +:m [file] & load layout to buffer \\ +:q & quit application \\ +:rn [file] & load netlist \\ +:s [file] & save data as file \\ +\end{tabular} + +\section{Display} +\begin{tabular}{@{}ll@{}} +c & center display \\ +g & increase grid spacing \\ +\Shift g & decrease grid spacing \\ +\Ctrl m & mark location \\ +r & clear and redraw output \\ +z & zoom in \\ +\Shift z & zoom out \\ +v & zoom extents \\ +\Shift\Btn3 & temporary zoom extents \\ +\end{tabular} + + +\section{Selections} +\begin{tabular}{@{}ll@{}} +\Btn2 & select/deselect object \\ +\Shift\Btn2 & toggle object to selection \\ +drag \Btn2 & select only objects in box \\ +drag \Shift\Btn2 & add box to selection \\ +\Shift m & move selected to current layer \\ +\end{tabular} + + +\section{Copy and move} +\begin{tabular}{@{}ll@{}} +drag \Btn2 & move object or selection\\ +drag \Mod\Btn2 & copy object \\ +drag \Shift\Mod\Btn2 & override rubberband \& move \\ +m & move to current layer \\ +\end{tabular} + + +\section{Pastebuffer} +\begin{tabular}{@{}ll@{}} +\Ctrl x & copy selected objects to buffer \\ + & and enter pastebuffer mode \\ +\Shift \Ctrl x & cut selected objects to buffer \\ + & and enter pastebuffer mode \\ +\Btn1 & in pastebuffer mode copy to layout \\ +\Shift \Fun7 & rotate 90 degree cc \\ +\Ctrl 1$\cdots$5 & select buffer \# 1$\cdots$5 \\ +\end{tabular} + + +\section{Sizing} +\begin{tabular}{@{}ll@{}} +s & increase size of TLAPV\footnotemark\\ +\Shift s & decrease size of TLAPV\\ +\Mod s & increase drill size of PV \\ +\Shift\Mod s & decrease drill size of PV \\ +k & increase clearance of LAPV\\ +\Shift\ k & decrease clearance of LAPV\\ +\end{tabular} +\footnotetext{TLAPV: text, line, arc, pin or via} + + +\section{Element} +\begin{tabular}{@{}ll@{}} +d & display pinout \\ +\Shift d & open pinout window \\ +h & hide/show element name \\ +n & change element name \\ +\end{tabular} + + +\section{Pin/pad} +\begin{tabular}{@{}ll@{}} +n & change name \\ +q & toggle square flag \\ +\end{tabular} + + +\section{Via} +\begin{tabular}{@{}ll@{}} +\Fun1 & enter via-mode \\ +\Ctrl v & increase initial size \\ +\Shift \Ctrl v & decrease initial size \\ +\Mod v & inc. initial drilling hole \\ +\Shift\Mod v & dec. initial drilling hole \\ +\Ctrl h & convert via to mounting hole \\ +\end{tabular} + + +\section{Lines and arcs} +\begin{tabular}{@{}ll@{}} +\Fun2 & enter line mode \\ +\Fun3 & enter arc mode \\ +l & increase initial line size \\ +\Shift l & decrease initial line size \\ +period & toggle 45 degree enforcement \\ +/ & cycle multiline mode \\ +\Shift & override multiline mode \\ +\end{tabular} + + +\section{Polygon} +\begin{tabular}{@{}ll@{}} +\Fun5 & enter rectangle-mode \\ +\Fun6 & enter polygon-mode \\ +\Shift p & close path \\ +insert & enter insert point mode \\ +\end{tabular} + + +\section{Text} +\begin{tabular}{@{}ll@{}} +\Fun4 & enter text-mode \\ +n & edit string \\ +t & increase initial text size \\ +\Shift t & decrease initial text size \\ +\end{tabular} + + +\section{Rats nest} +\begin{tabular}{@{}ll@{}} +w & add all rats \\ +\Shift w & add rats to selected pins/pads \\ +e & delete all rats \\ +\Shift e & delete selected rats \\ +o & optimize all rats \\ +\Shift o & optimize selected rats \\ +\end{tabular} + + +\end{multicols} + + +\end{document} Index: 1.0.8/doc-orig/stamp-vti =================================================================== --- 1.0.8/doc-orig/stamp-vti (nonexistent) +++ 1.0.8/doc-orig/stamp-vti (revision 1136) @@ -0,0 +1,4 @@ +@set UPDATED 17 September 2011 +@set UPDATED-MONTH September 2011 +@set EDITION 20110918 +@set VERSION 20110918 Index: 1.0.8/doc-orig/texinfo.tex =================================================================== --- 1.0.8/doc-orig/texinfo.tex (nonexistent) +++ 1.0.8/doc-orig/texinfo.tex (revision 1136) @@ -0,0 +1,7086 @@ +% texinfo.tex -- TeX macros to handle Texinfo files. +% +% Load plain if necessary, i.e., if running under initex. +\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi +% +\def\texinfoversion{2005-01-30.17} +% +% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software +% Foundation, Inc. +% +% This texinfo.tex file 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, or (at +% your option) any later version. +% +% This texinfo.tex file 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 texinfo.tex file; see the file COPYING. If not, write +% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +% Boston, MA 02111-1307, USA. +% +% As a special exception, when this file is read by TeX when processing +% a Texinfo source document, you may use the result without +% restriction. (This has been our intent since Texinfo was invented.) +% +% Please try the latest version of texinfo.tex before submitting bug +% reports; you can get the latest version from: +% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or +% ftp://tug.org/tex/texinfo.tex +% (and all CTAN mirrors, see http://www.ctan.org). +% The texinfo.tex in any given distribution could well be out +% of date, so if that's what you're using, please check. +% +% Send bug reports to bug-texinfo@gnu.org. Please include including a +% complete document in each bug report with which we can reproduce the +% problem. Patches are, of course, greatly appreciated. +% +% To process a Texinfo manual with TeX, it's most reliable to use the +% texi2dvi shell script that comes with the distribution. For a simple +% manual foo.texi, however, you can get away with this: +% tex foo.texi +% texindex foo.?? +% tex foo.texi +% tex foo.texi +% dvips foo.dvi -o # or whatever; this makes foo.ps. +% The extra TeX runs get the cross-reference information correct. +% Sometimes one run after texindex suffices, and sometimes you need more +% than two; texi2dvi does it as many times as necessary. +% +% It is possible to adapt texinfo.tex for other languages, to some +% extent. You can get the existing language-specific files from the +% full Texinfo distribution. +% +% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. + + +\message{Loading texinfo [version \texinfoversion]:} + +% If in a .fmt file, print the version number +% and turn on active characters that we couldn't do earlier because +% they might have appeared in the input file name. +\everyjob{\message{[Texinfo version \texinfoversion]}% + \catcode`+=\active \catcode`\_=\active} + +\message{Basics,} +\chardef\other=12 + +% We never want plain's \outer definition of \+ in Texinfo. +% For @tex, we can use \tabalign. +\let\+ = \relax + +% Save some plain tex macros whose names we will redefine. +\let\ptexb=\b +\let\ptexbullet=\bullet +\let\ptexc=\c +\let\ptexcomma=\, +\let\ptexdot=\. +\let\ptexdots=\dots +\let\ptexend=\end +\let\ptexequiv=\equiv +\let\ptexexclam=\! +\let\ptexfootnote=\footnote +\let\ptexgtr=> +\let\ptexhat=^ +\let\ptexi=\i +\let\ptexindent=\indent +\let\ptexinsert=\insert +\let\ptexlbrace=\{ +\let\ptexless=< +\let\ptexnewwrite\newwrite +\let\ptexnoindent=\noindent +\let\ptexplus=+ +\let\ptexrbrace=\} +\let\ptexslash=\/ +\let\ptexstar=\* +\let\ptext=\t + +% If this character appears in an error message or help string, it +% starts a new line in the output. +\newlinechar = `^^J + +% Use TeX 3.0's \inputlineno to get the line number, for better error +% messages, but if we're using an old version of TeX, don't do anything. +% +\ifx\inputlineno\thisisundefined + \let\linenumber = \empty % Pre-3.0. +\else + \def\linenumber{l.\the\inputlineno:\space} +\fi + +% Set up fixed words for English if not already set. +\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi +\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi +\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi +\ifx\putwordin\undefined \gdef\putwordin{in}\fi +\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi +\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi +\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi +\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi +\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi +\ifx\putwordof\undefined \gdef\putwordof{of}\fi +\ifx\putwordon\undefined \gdef\putwordon{on}\fi +\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi +\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi +\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi +\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi +\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi +\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi +\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi +% +\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi +\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi +\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi +\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi +\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi +\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi +\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi +\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi +\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi +\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi +\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi +\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi +% +\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi +\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi +\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi +\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi +\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi + +% In some macros, we cannot use the `\? notation---the left quote is +% in some cases the escape char. +\chardef\colonChar = `\: +\chardef\commaChar = `\, +\chardef\dotChar = `\. +\chardef\exclamChar= `\! +\chardef\questChar = `\? +\chardef\semiChar = `\; +\chardef\underChar = `\_ + +\chardef\spaceChar = `\ % +\chardef\spacecat = 10 +\def\spaceisspace{\catcode\spaceChar=\spacecat} + +% Ignore a token. +% +\def\gobble#1{} + +% The following is used inside several \edef's. +\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} + +% Hyphenation fixes. +\hyphenation{ + Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script + ap-pen-dix bit-map bit-maps + data-base data-bases eshell fall-ing half-way long-est man-u-script + man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm + par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces + spell-ing spell-ings + stand-alone strong-est time-stamp time-stamps which-ever white-space + wide-spread wrap-around +} + +% Margin to add to right of even pages, to left of odd pages. +\newdimen\bindingoffset +\newdimen\normaloffset +\newdimen\pagewidth \newdimen\pageheight + +% For a final copy, take out the rectangles +% that mark overfull boxes (in case you have decided +% that the text looks ok even though it passes the margin). +% +\def\finalout{\overfullrule=0pt} + +% @| inserts a changebar to the left of the current line. It should +% surround any changed text. This approach does *not* work if the +% change spans more than two lines of output. To handle that, we would +% have adopt a much more difficult approach (putting marks into the main +% vertical list for the beginning and end of each change). +% +\def\|{% + % \vadjust can only be used in horizontal mode. + \leavevmode + % + % Append this vertical mode material after the current line in the output. + \vadjust{% + % We want to insert a rule with the height and depth of the current + % leading; that is exactly what \strutbox is supposed to record. + \vskip-\baselineskip + % + % \vadjust-items are inserted at the left edge of the type. So + % the \llap here moves out into the left-hand margin. + \llap{% + % + % For a thicker or thinner bar, change the `1pt'. + \vrule height\baselineskip width1pt + % + % This is the space between the bar and the text. + \hskip 12pt + }% + }% +} + +% Sometimes it is convenient to have everything in the transcript file +% and nothing on the terminal. We don't just call \tracingall here, +% since that produces some useless output on the terminal. We also make +% some effort to order the tracing commands to reduce output in the log +% file; cf. trace.sty in LaTeX. +% +\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% +\def\loggingall{% + \tracingstats2 + \tracingpages1 + \tracinglostchars2 % 2 gives us more in etex + \tracingparagraphs1 + \tracingoutput1 + \tracingmacros2 + \tracingrestores1 + \showboxbreadth\maxdimen \showboxdepth\maxdimen + \ifx\eTeXversion\undefined\else % etex gives us more logging + \tracingscantokens1 + \tracingifs1 + \tracinggroups1 + \tracingnesting2 + \tracingassigns1 + \fi + \tracingcommands3 % 3 gives us more in etex + \errorcontextlines16 +}% + +% add check for \lastpenalty to plain's definitions. If the last thing +% we did was a \nobreak, we don't want to insert more space. +% +\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount + \removelastskip\penalty-50\smallskip\fi\fi} +\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount + \removelastskip\penalty-100\medskip\fi\fi} +\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount + \removelastskip\penalty-200\bigskip\fi\fi} + +% For @cropmarks command. +% Do @cropmarks to get crop marks. +% +\newif\ifcropmarks +\let\cropmarks = \cropmarkstrue +% +% Dimensions to add cropmarks at corners. +% Added by P. A. MacKay, 12 Nov. 1986 +% +\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines +\newdimen\cornerlong \cornerlong=1pc +\newdimen\cornerthick \cornerthick=.3pt +\newdimen\topandbottommargin \topandbottommargin=.75in + +% Main output routine. +\chardef\PAGE = 255 +\output = {\onepageout{\pagecontents\PAGE}} + +\newbox\headlinebox +\newbox\footlinebox + +% \onepageout takes a vbox as an argument. Note that \pagecontents +% does insertions, but you have to call it yourself. +\def\onepageout#1{% + \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi + % + \ifodd\pageno \advance\hoffset by \bindingoffset + \else \advance\hoffset by -\bindingoffset\fi + % + % Do this outside of the \shipout so @code etc. will be expanded in + % the headline as they should be, not taken literally (outputting ''code). + \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% + \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% + % + {% + % Have to do this stuff outside the \shipout because we want it to + % take effect in \write's, yet the group defined by the \vbox ends + % before the \shipout runs. + % + \escapechar = `\\ % use backslash in output files. + \indexdummies % don't expand commands in the output. + \normalturnoffactive % \ in index entries must not stay \, e.g., if + % the page break happens to be in the middle of an example. + \shipout\vbox{% + % Do this early so pdf references go to the beginning of the page. + \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi + % + \ifcropmarks \vbox to \outervsize\bgroup + \hsize = \outerhsize + \vskip-\topandbottommargin + \vtop to0pt{% + \line{\ewtop\hfil\ewtop}% + \nointerlineskip + \line{% + \vbox{\moveleft\cornerthick\nstop}% + \hfill + \vbox{\moveright\cornerthick\nstop}% + }% + \vss}% + \vskip\topandbottommargin + \line\bgroup + \hfil % center the page within the outer (page) hsize. + \ifodd\pageno\hskip\bindingoffset\fi + \vbox\bgroup + \fi + % + \unvbox\headlinebox + \pagebody{#1}% + \ifdim\ht\footlinebox > 0pt + % Only leave this space if the footline is nonempty. + % (We lessened \vsize for it in \oddfootingxxx.) + % The \baselineskip=24pt in plain's \makefootline has no effect. + \vskip 2\baselineskip + \unvbox\footlinebox + \fi + % + \ifcropmarks + \egroup % end of \vbox\bgroup + \hfil\egroup % end of (centering) \line\bgroup + \vskip\topandbottommargin plus1fill minus1fill + \boxmaxdepth = \cornerthick + \vbox to0pt{\vss + \line{% + \vbox{\moveleft\cornerthick\nsbot}% + \hfill + \vbox{\moveright\cornerthick\nsbot}% + }% + \nointerlineskip + \line{\ewbot\hfil\ewbot}% + }% + \egroup % \vbox from first cropmarks clause + \fi + }% end of \shipout\vbox + }% end of group with \normalturnoffactive + \advancepageno + \ifnum\outputpenalty>-20000 \else\dosupereject\fi +} + +\newinsert\margin \dimen\margin=\maxdimen + +\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} +{\catcode`\@ =11 +\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi +% marginal hacks, juha@viisa.uucp (Juha Takala) +\ifvoid\margin\else % marginal info is present + \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi +\dimen@=\dp#1 \unvbox#1 +\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi +\ifr@ggedbottom \kern-\dimen@ \vfil \fi} +} + +% Here are the rules for the cropmarks. Note that they are +% offset so that the space between them is truly \outerhsize or \outervsize +% (P. A. MacKay, 12 November, 1986) +% +\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} +\def\nstop{\vbox + {\hrule height\cornerthick depth\cornerlong width\cornerthick}} +\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} +\def\nsbot{\vbox + {\hrule height\cornerlong depth\cornerthick width\cornerthick}} + +% Parse an argument, then pass it to #1. The argument is the rest of +% the input line (except we remove a trailing comment). #1 should be a +% macro which expects an ordinary undelimited TeX argument. +% +\def\parsearg{\parseargusing{}} +\def\parseargusing#1#2{% + \def\next{#2}% + \begingroup + \obeylines + \spaceisspace + #1% + \parseargline\empty% Insert the \empty token, see \finishparsearg below. +} + +{\obeylines % + \gdef\parseargline#1^^M{% + \endgroup % End of the group started in \parsearg. + \argremovecomment #1\comment\ArgTerm% + }% +} + +% First remove any @comment, then any @c comment. +\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} +\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} + +% Each occurence of `\^^M' or `\^^M' is replaced by a single space. +% +% \argremovec might leave us with trailing space, e.g., +% @end itemize @c foo +% This space token undergoes the same procedure and is eventually removed +% by \finishparsearg. +% +\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} +\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} +\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% + \def\temp{#3}% + \ifx\temp\empty + % We cannot use \next here, as it holds the macro to run; + % thus we reuse \temp. + \let\temp\finishparsearg + \else + \let\temp\argcheckspaces + \fi + % Put the space token in: + \temp#1 #3\ArgTerm +} + +% If a _delimited_ argument is enclosed in braces, they get stripped; so +% to get _exactly_ the rest of the line, we had to prevent such situation. +% We prepended an \empty token at the very beginning and we expand it now, +% just before passing the control to \next. +% (Similarily, we have to think about #3 of \argcheckspacesY above: it is +% either the null string, or it ends with \^^M---thus there is no danger +% that a pair of braces would be stripped. +% +% But first, we have to remove the trailing space token. +% +\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}} + +% \parseargdef\foo{...} +% is roughly equivalent to +% \def\foo{\parsearg\Xfoo} +% \def\Xfoo#1{...} +% +% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my +% favourite TeX trick. --kasal, 16nov03 + +\def\parseargdef#1{% + \expandafter \doparseargdef \csname\string#1\endcsname #1% +} +\def\doparseargdef#1#2{% + \def#2{\parsearg#1}% + \def#1##1% +} + +% Several utility definitions with active space: +{ + \obeyspaces + \gdef\obeyedspace{ } + + % Make each space character in the input produce a normal interword + % space in the output. Don't allow a line break at this space, as this + % is used only in environments like @example, where each line of input + % should produce a line of output anyway. + % + \gdef\sepspaces{\obeyspaces\let =\tie} + + % If an index command is used in an @example environment, any spaces + % therein should become regular spaces in the raw index file, not the + % expansion of \tie (\leavevmode \penalty \@M \ ). + \gdef\unsepspaces{\let =\space} +} + + +\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} + +% Define the framework for environments in texinfo.tex. It's used like this: +% +% \envdef\foo{...} +% \def\Efoo{...} +% +% It's the responsibility of \envdef to insert \begingroup before the +% actual body; @end closes the group after calling \Efoo. \envdef also +% defines \thisenv, so the current environment is known; @end checks +% whether the environment name matches. The \checkenv macro can also be +% used to check whether the current environment is the one expected. +% +% Non-false conditionals (@iftex, @ifset) don't fit into this, so they +% are not treated as enviroments; they don't open a group. (The +% implementation of @end takes care not to call \endgroup in this +% special case.) + + +% At runtime, environments start with this: +\def\startenvironment#1{\begingroup\def\thisenv{#1}} +% initialize +\let\thisenv\empty + +% ... but they get defined via ``\envdef\foo{...}'': +\long\def\envdef#1#2{\def#1{\startenvironment#1#2}} +\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} + +% Check whether we're in the right environment: +\def\checkenv#1{% + \def\temp{#1}% + \ifx\thisenv\temp + \else + \badenverr + \fi +} + +% Evironment mismatch, #1 expected: +\def\badenverr{% + \errhelp = \EMsimple + \errmessage{This command can appear only \inenvironment\temp, + not \inenvironment\thisenv}% +} +\def\inenvironment#1{% + \ifx#1\empty + out of any environment% + \else + in environment \expandafter\string#1% + \fi +} + +% @end foo executes the definition of \Efoo. +% But first, it executes a specialized version of \checkenv +% +\parseargdef\end{% + \if 1\csname iscond.#1\endcsname + \else + % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 + \expandafter\checkenv\csname#1\endcsname + \csname E#1\endcsname + \endgroup + \fi +} + +\newhelp\EMsimple{Press RETURN to continue.} + + +%% Simple single-character @ commands + +% @@ prints an @ +% Kludge this until the fonts are right (grr). +\def\@{{\tt\char64}} + +% This is turned off because it was never documented +% and you can use @w{...} around a quote to suppress ligatures. +%% Define @` and @' to be the same as ` and ' +%% but suppressing ligatures. +%\def\`{{`}} +%\def\'{{'}} + +% Used to generate quoted braces. +\def\mylbrace {{\tt\char123}} +\def\myrbrace {{\tt\char125}} +\let\{=\mylbrace +\let\}=\myrbrace +\begingroup + % Definitions to produce \{ and \} commands for indices, + % and @{ and @} for the aux file. + \catcode`\{ = \other \catcode`\} = \other + \catcode`\[ = 1 \catcode`\] = 2 + \catcode`\! = 0 \catcode`\\ = \other + !gdef!lbracecmd[\{]% + !gdef!rbracecmd[\}]% + !gdef!lbraceatcmd[@{]% + !gdef!rbraceatcmd[@}]% +!endgroup + +% @comma{} to avoid , parsing problems. +\let\comma = , + +% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. +\let\, = \c +\let\dotaccent = \. +\def\ringaccent#1{{\accent23 #1}} +\let\tieaccent = \t +\let\ubaraccent = \b +\let\udotaccent = \d + +% Other special characters: @questiondown @exclamdown @ordf @ordm +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. +\def\questiondown{?`} +\def\exclamdown{!`} +\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} +\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} + +% Dotless i and dotless j, used for accents. +\def\imacro{i} +\def\jmacro{j} +\def\dotless#1{% + \def\temp{#1}% + \ifx\temp\imacro \ptexi + \else\ifx\temp\jmacro \j + \else \errmessage{@dotless can be used only with i or j}% + \fi\fi +} + +% The \TeX{} logo, as in plain, but resetting the spacing so that a +% period following counts as ending a sentence. (Idea found in latex.) +% +\edef\TeX{\TeX \spacefactor=1000 } + +% @LaTeX{} logo. Not quite the same results as the definition in +% latex.ltx, since we use a different font for the raised A; it's most +% convenient for us to use an explicitly smaller font, rather than using +% the \scriptstyle font (since we don't reset \scriptstyle and +% \scriptscriptstyle). +% +\def\LaTeX{% + L\kern-.36em + {\setbox0=\hbox{T}% + \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% + \kern-.15em + \TeX +} + +% Be sure we're in horizontal mode when doing a tie, since we make space +% equivalent to this in @example-like environments. Otherwise, a space +% at the beginning of a line will start with \penalty -- and +% since \penalty is valid in vertical mode, we'd end up putting the +% penalty on the vertical list instead of in the new paragraph. +{\catcode`@ = 11 + % Avoid using \@M directly, because that causes trouble + % if the definition is written into an index file. + \global\let\tiepenalty = \@M + \gdef\tie{\leavevmode\penalty\tiepenalty\ } +} + +% @: forces normal size whitespace following. +\def\:{\spacefactor=1000 } + +% @* forces a line break. +\def\*{\hfil\break\hbox{}\ignorespaces} + +% @/ allows a line break. +\let\/=\allowbreak + +% @. is an end-of-sentence period. +\def\.{.\spacefactor=3000 } + +% @! is an end-of-sentence bang. +\def\!{!\spacefactor=3000 } + +% @? is an end-of-sentence query. +\def\?{?\spacefactor=3000 } + +% @w prevents a word break. Without the \leavevmode, @w at the +% beginning of a paragraph, when TeX is still in vertical mode, would +% produce a whole line of output instead of starting the paragraph. +\def\w#1{\leavevmode\hbox{#1}} + +% @group ... @end group forces ... to be all on one page, by enclosing +% it in a TeX vbox. We use \vtop instead of \vbox to construct the box +% to keep its height that of a normal line. According to the rules for +% \topskip (p.114 of the TeXbook), the glue inserted is +% max (\topskip - \ht (first item), 0). If that height is large, +% therefore, no glue is inserted, and the space between the headline and +% the text is small, which looks bad. +% +% Another complication is that the group might be very large. This can +% cause the glue on the previous page to be unduly stretched, because it +% does not have much material. In this case, it's better to add an +% explicit \vfill so that the extra space is at the bottom. The +% threshold for doing this is if the group is more than \vfilllimit +% percent of a page (\vfilllimit can be changed inside of @tex). +% +\newbox\groupbox +\def\vfilllimit{0.7} +% +\envdef\group{% + \ifnum\catcode`\^^M=\active \else + \errhelp = \groupinvalidhelp + \errmessage{@group invalid in context where filling is enabled}% + \fi + \startsavinginserts + % + \setbox\groupbox = \vtop\bgroup + % Do @comment since we are called inside an environment such as + % @example, where each end-of-line in the input causes an + % end-of-line in the output. We don't want the end-of-line after + % the `@group' to put extra space in the output. Since @group + % should appear on a line by itself (according to the Texinfo + % manual), we don't worry about eating any user text. + \comment +} +% +% The \vtop produces a box with normal height and large depth; thus, TeX puts +% \baselineskip glue before it, and (when the next line of text is done) +% \lineskip glue after it. Thus, space below is not quite equal to space +% above. But it's pretty close. +\def\Egroup{% + % To get correct interline space between the last line of the group + % and the first line afterwards, we have to propagate \prevdepth. + \endgraf % Not \par, as it may have been set to \lisppar. + \global\dimen1 = \prevdepth + \egroup % End the \vtop. + % \dimen0 is the vertical size of the group's box. + \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox + % \dimen2 is how much space is left on the page (more or less). + \dimen2 = \pageheight \advance\dimen2 by -\pagetotal + % if the group doesn't fit on the current page, and it's a big big + % group, force a page break. + \ifdim \dimen0 > \dimen2 + \ifdim \pagetotal < \vfilllimit\pageheight + \page + \fi + \fi + \box\groupbox + \prevdepth = \dimen1 + \checkinserts +} +% +% TeX puts in an \escapechar (i.e., `@') at the beginning of the help +% message, so this ends up printing `@group can only ...'. +% +\newhelp\groupinvalidhelp{% +group can only be used in environments such as @example,^^J% +where each line of input produces a line of output.} + +% @need space-in-mils +% forces a page break if there is not space-in-mils remaining. + +\newdimen\mil \mil=0.001in + +% Old definition--didn't work. +%\parseargdef\need{\par % +%% This method tries to make TeX break the page naturally +%% if the depth of the box does not fit. +%{\baselineskip=0pt% +%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak +%\prevdepth=-1000pt +%}} + +\parseargdef\need{% + % Ensure vertical mode, so we don't make a big box in the middle of a + % paragraph. + \par + % + % If the @need value is less than one line space, it's useless. + \dimen0 = #1\mil + \dimen2 = \ht\strutbox + \advance\dimen2 by \dp\strutbox + \ifdim\dimen0 > \dimen2 + % + % Do a \strut just to make the height of this box be normal, so the + % normal leading is inserted relative to the preceding line. + % And a page break here is fine. + \vtop to #1\mil{\strut\vfil}% + % + % TeX does not even consider page breaks if a penalty added to the + % main vertical list is 10000 or more. But in order to see if the + % empty box we just added fits on the page, we must make it consider + % page breaks. On the other hand, we don't want to actually break the + % page after the empty box. So we use a penalty of 9999. + % + % There is an extremely small chance that TeX will actually break the + % page at this \penalty, if there are no other feasible breakpoints in + % sight. (If the user is using lots of big @group commands, which + % almost-but-not-quite fill up a page, TeX will have a hard time doing + % good page breaking, for example.) However, I could not construct an + % example where a page broke at this \penalty; if it happens in a real + % document, then we can reconsider our strategy. + \penalty9999 + % + % Back up by the size of the box, whether we did a page break or not. + \kern -#1\mil + % + % Do not allow a page break right after this kern. + \nobreak + \fi +} + +% @br forces paragraph break (and is undocumented). + +\let\br = \par + +% @page forces the start of a new page. +% +\def\page{\par\vfill\supereject} + +% @exdent text.... +% outputs text on separate line in roman font, starting at standard page margin + +% This records the amount of indent in the innermost environment. +% That's how much \exdent should take out. +\newskip\exdentamount + +% This defn is used inside fill environments such as @defun. +\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} + +% This defn is used inside nofill environments such as @example. +\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount + \leftline{\hskip\leftskip{\rm#1}}}} + +% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current +% paragraph. For more general purposes, use the \margin insertion +% class. WHICH is `l' or `r'. +% +\newskip\inmarginspacing \inmarginspacing=1cm +\def\strutdepth{\dp\strutbox} +% +\def\doinmargin#1#2{\strut\vadjust{% + \nobreak + \kern-\strutdepth + \vtop to \strutdepth{% + \baselineskip=\strutdepth + \vss + % if you have multiple lines of stuff to put here, you'll need to + % make the vbox yourself of the appropriate size. + \ifx#1l% + \llap{\ignorespaces #2\hskip\inmarginspacing}% + \else + \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% + \fi + \null + }% +}} +\def\inleftmargin{\doinmargin l} +\def\inrightmargin{\doinmargin r} +% +% @inmargin{TEXT [, RIGHT-TEXT]} +% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; +% else use TEXT for both). +% +\def\inmargin#1{\parseinmargin #1,,\finish} +\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \def\lefttext{#1}% have both texts + \def\righttext{#2}% + \else + \def\lefttext{#1}% have only one text + \def\righttext{#1}% + \fi + % + \ifodd\pageno + \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin + \else + \def\temp{\inleftmargin\lefttext}% + \fi + \temp +} + +% @include file insert text of that file as input. +% +\def\include{\parseargusing\filenamecatcodes\includezzz} +\def\includezzz#1{% + \pushthisfilestack + \def\thisfile{#1}% + {% + \makevalueexpandable + \def\temp{\input #1 }% + \expandafter + }\temp + \popthisfilestack +} +\def\filenamecatcodes{% + \catcode`\\=\other + \catcode`~=\other + \catcode`^=\other + \catcode`_=\other + \catcode`|=\other + \catcode`<=\other + \catcode`>=\other + \catcode`+=\other + \catcode`-=\other +} + +\def\pushthisfilestack{% + \expandafter\pushthisfilestackX\popthisfilestack\StackTerm +} +\def\pushthisfilestackX{% + \expandafter\pushthisfilestackY\thisfile\StackTerm +} +\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% + \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% +} + +\def\popthisfilestack{\errthisfilestackempty} +\def\errthisfilestackempty{\errmessage{Internal error: + the stack of filenames is empty.}} + +\def\thisfile{} + +% @center line +% outputs that line, centered. +% +\parseargdef\center{% + \ifhmode + \let\next\centerH + \else + \let\next\centerV + \fi + \next{\hfil \ignorespaces#1\unskip \hfil}% +} +\def\centerH#1{% + {% + \hfil\break + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + \line{#1}% + \break + }% +} +\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} + +% @sp n outputs n lines of vertical space + +\parseargdef\sp{\vskip #1\baselineskip} + +% @comment ...line which is ignored... +% @c is the same as @comment +% @ignore ... @end ignore is another way to write a comment + +\def\comment{\begingroup \catcode`\^^M=\other% +\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% +\commentxxx} +{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} + +\let\c=\comment + +% @paragraphindent NCHARS +% We'll use ems for NCHARS, close enough. +% NCHARS can also be the word `asis' or `none'. +% We cannot feasibly implement @paragraphindent asis, though. +% +\def\asisword{asis} % no translation, these are keywords +\def\noneword{none} +% +\parseargdef\paragraphindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \defaultparindent = 0pt + \else + \defaultparindent = #1em + \fi + \fi + \parindent = \defaultparindent +} + +% @exampleindent NCHARS +% We'll use ems for NCHARS like @paragraphindent. +% It seems @exampleindent asis isn't necessary, but +% I preserve it to make it similar to @paragraphindent. +\parseargdef\exampleindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \lispnarrowing = 0pt + \else + \lispnarrowing = #1em + \fi + \fi +} + +% @firstparagraphindent WORD +% If WORD is `none', then suppress indentation of the first paragraph +% after a section heading. If WORD is `insert', then do indent at such +% paragraphs. +% +% The paragraph indentation is suppressed or not by calling +% \suppressfirstparagraphindent, which the sectioning commands do. +% We switch the definition of this back and forth according to WORD. +% By default, we suppress indentation. +% +\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} +\def\insertword{insert} +% +\parseargdef\firstparagraphindent{% + \def\temp{#1}% + \ifx\temp\noneword + \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent + \else\ifx\temp\insertword + \let\suppressfirstparagraphindent = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @firstparagraphindent option `\temp'}% + \fi\fi +} + +% Here is how we actually suppress indentation. Redefine \everypar to +% \kern backwards by \parindent, and then reset itself to empty. +% +% We also make \indent itself not actually do anything until the next +% paragraph. +% +\gdef\dosuppressfirstparagraphindent{% + \gdef\indent{% + \restorefirstparagraphindent + \indent + }% + \gdef\noindent{% + \restorefirstparagraphindent + \noindent + }% + \global\everypar = {% + \kern -\parindent + \restorefirstparagraphindent + }% +} + +\gdef\restorefirstparagraphindent{% + \global \let \indent = \ptexindent + \global \let \noindent = \ptexnoindent + \global \everypar = {}% +} + + +% @asis just yields its argument. Used with @table, for example. +% +\def\asis#1{#1} + +% @math outputs its argument in math mode. +% +% One complication: _ usually means subscripts, but it could also mean +% an actual _ character, as in @math{@var{some_variable} + 1}. So make +% _ active, and distinguish by seeing if the current family is \slfam, +% which is what @var uses. +{ + \catcode\underChar = \active + \gdef\mathunderscore{% + \catcode\underChar=\active + \def_{\ifnum\fam=\slfam \_\else\sb\fi}% + } +} +% Another complication: we want \\ (and @\) to output a \ character. +% FYI, plain.tex uses \\ as a temporary control sequence (why?), but +% this is not advertised and we don't care. Texinfo does not +% otherwise define @\. +% +% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. +\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} +% +\def\math{% + \tex + \mathunderscore + \let\\ = \mathbackslash + \mathactive + $\finishmath +} +\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. + +% Some active characters (such as <) are spaced differently in math. +% We have to reset their definitions in case the @math was an argument +% to a command which sets the catcodes (such as @item or @section). +% +{ + \catcode`^ = \active + \catcode`< = \active + \catcode`> = \active + \catcode`+ = \active + \gdef\mathactive{% + \let^ = \ptexhat + \let< = \ptexless + \let> = \ptexgtr + \let+ = \ptexplus + } +} + +% @bullet and @minus need the same treatment as @math, just above. +\def\bullet{$\ptexbullet$} +\def\minus{$-$} + +% @dots{} outputs an ellipsis using the current font. +% We do .5em per period so that it has the same spacing in a typewriter +% font as three actual period characters. +% +\def\dots{% + \leavevmode + \hbox to 1.5em{% + \hskip 0pt plus 0.25fil + .\hfil.\hfil.% + \hskip 0pt plus 0.5fil + }% +} + +% @enddots{} is an end-of-sentence ellipsis. +% +\def\enddots{% + \dots + \spacefactor=3000 +} + +% @comma{} is so commas can be inserted into text without messing up +% Texinfo's parsing. +% +\let\comma = , + +% @refill is a no-op. +\let\refill=\relax + +% If working on a large document in chapters, it is convenient to +% be able to disable indexing, cross-referencing, and contents, for test runs. +% This is done with @novalidate (before @setfilename). +% +\newif\iflinks \linkstrue % by default we want the aux files. +\let\novalidate = \linksfalse + +% @setfilename is done at the beginning of every texinfo file. +% So open here the files we need to have open while reading the input. +% This makes it possible to make a .fmt file for texinfo. +\def\setfilename{% + \fixbackslash % Turn off hack to swallow `\input texinfo'. + \iflinks + \tryauxfile + % Open the new aux file. TeX will close it automatically at exit. + \immediate\openout\auxfile=\jobname.aux + \fi % \openindices needs to do some work in any case. + \openindices + \let\setfilename=\comment % Ignore extra @setfilename cmds. + % + % If texinfo.cnf is present on the system, read it. + % Useful for site-wide @afourpaper, etc. + \openin 1 texinfo.cnf + \ifeof 1 \else \input texinfo.cnf \fi + \closein 1 + % + \comment % Ignore the actual filename. +} + +% Called from \setfilename. +% +\def\openindices{% + \newindex{cp}% + \newcodeindex{fn}% + \newcodeindex{vr}% + \newcodeindex{tp}% + \newcodeindex{ky}% + \newcodeindex{pg}% +} + +% @bye. +\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} + + +\message{pdf,} +% adobe `portable' document format +\newcount\tempnum +\newcount\lnkcount +\newtoks\filename +\newcount\filenamelength +\newcount\pgn +\newtoks\toksA +\newtoks\toksB +\newtoks\toksC +\newtoks\toksD +\newbox\boxA +\newcount\countA +\newif\ifpdf +\newif\ifpdfmakepagedest + +% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 +% can be set). So we test for \relax and 0 as well as \undefined, +% borrowed from ifpdf.sty. +\ifx\pdfoutput\undefined +\else + \ifx\pdfoutput\relax + \else + \ifcase\pdfoutput + \else + \pdftrue + \fi + \fi +\fi +% +\ifpdf + \input pdfcolor + \pdfcatalog{/PageMode /UseOutlines}% + \def\dopdfimage#1#2#3{% + \def\imagewidth{#2}% + \def\imageheight{#3}% + % without \immediate, pdftex seg faults when the same image is + % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) + \ifnum\pdftexversion < 14 + \immediate\pdfimage + \else + \immediate\pdfximage + \fi + \ifx\empty\imagewidth\else width \imagewidth \fi + \ifx\empty\imageheight\else height \imageheight \fi + \ifnum\pdftexversion<13 + #1.pdf% + \else + {#1.pdf}% + \fi + \ifnum\pdftexversion < 14 \else + \pdfrefximage \pdflastximage + \fi} + \def\pdfmkdest#1{{% + % We have to set dummies so commands such as @code in a section title + % aren't expanded. + \atdummies + \normalturnoffactive + \pdfdest name{#1} xyz% + }} + \def\pdfmkpgn#1{#1} + \let\linkcolor = \Blue % was Cyan, but that seems light? + \def\endlink{\Black\pdfendlink} + % Adding outlines to PDF; macros for calculating structure of outlines + % come from Petr Olsak + \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% + \else \csname#1\endcsname \fi} + \def\advancenumber#1{\tempnum=\expnumber{#1}\relax + \advance\tempnum by 1 + \expandafter\xdef\csname#1\endcsname{\the\tempnum}} + % + % #1 is the section text. #2 is the pdf expression for the number + % of subentries (or empty, for subsubsections). #3 is the node + % text, which might be empty if this toc entry had no + % corresponding node. #4 is the page number. + % + \def\dopdfoutline#1#2#3#4{% + % Generate a link to the node text if that exists; else, use the + % page number. We could generate a destination for the section + % text in the case where a section has no node, but it doesn't + % seem worthwhile, since most documents are normally structured. + \def\pdfoutlinedest{#3}% + \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}\fi + % + \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{#1}% + } + % + \def\pdfmakeoutlines{% + \begingroup + % Thanh's hack / proper braces in bookmarks + \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace + \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace + % + % Read toc silently, to get counts of subentries for \pdfoutline. + \def\numchapentry##1##2##3##4{% + \def\thischapnum{##2}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + }% + \def\numsecentry##1##2##3##4{% + \advancenumber{chap\thischapnum}% + \def\thissecnum{##2}% + \def\thissubsecnum{0}% + }% + \def\numsubsecentry##1##2##3##4{% + \advancenumber{sec\thissecnum}% + \def\thissubsecnum{##2}% + }% + \def\numsubsubsecentry##1##2##3##4{% + \advancenumber{subsec\thissubsecnum}% + }% + \def\thischapnum{0}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + % + % use \def rather than \let here because we redefine \chapentry et + % al. a second time, below. + \def\appentry{\numchapentry}% + \def\appsecentry{\numsecentry}% + \def\appsubsecentry{\numsubsecentry}% + \def\appsubsubsecentry{\numsubsubsecentry}% + \def\unnchapentry{\numchapentry}% + \def\unnsecentry{\numsecentry}% + \def\unnsubsecentry{\numsubsecentry}% + \def\unnsubsubsecentry{\numsubsubsecentry}% + \input \jobname.toc + % + % Read toc second time, this time actually producing the outlines. + % The `-' means take the \expnumber as the absolute number of + % subentries, which we calculated on our first read of the .toc above. + % + % We use the node names as the destinations. + \def\numchapentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% + \def\numsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% + \def\numsubsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% + \def\numsubsubsecentry##1##2##3##4{% count is always zero + \dopdfoutline{##1}{}{##3}{##4}}% + % + % PDF outlines are displayed using system fonts, instead of + % document fonts. Therefore we cannot use special characters, + % since the encoding is unknown. For example, the eogonek from + % Latin 2 (0xea) gets translated to a | character. Info from + % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. + % + % xx to do this right, we have to translate 8-bit characters to + % their "best" equivalent, based on the @documentencoding. Right + % now, I guess we'll just let the pdf reader have its way. + \indexnofonts + \turnoffactive + \input \jobname.toc + \endgroup + } + % + \def\makelinks #1,{% + \def\params{#1}\def\E{END}% + \ifx\params\E + \let\nextmakelinks=\relax + \else + \let\nextmakelinks=\makelinks + \ifnum\lnkcount>0,\fi + \picknum{#1}% + \startlink attr{/Border [0 0 0]} + goto name{\pdfmkpgn{\the\pgn}}% + \linkcolor #1% + \advance\lnkcount by 1% + \endlink + \fi + \nextmakelinks + } + \def\picknum#1{\expandafter\pn#1} + \def\pn#1{% + \def\p{#1}% + \ifx\p\lbrace + \let\nextpn=\ppn + \else + \let\nextpn=\ppnn + \def\first{#1} + \fi + \nextpn + } + \def\ppn#1{\pgn=#1\gobble} + \def\ppnn{\pgn=\first} + \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,} + \def\skipspaces#1{\def\PP{#1}\def\D{|}% + \ifx\PP\D\let\nextsp\relax + \else\let\nextsp\skipspaces + \ifx\p\space\else\addtokens{\filename}{\PP}% + \advance\filenamelength by 1 + \fi + \fi + \nextsp} + \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} + \ifnum\pdftexversion < 14 + \let \startlink \pdfannotlink + \else + \let \startlink \pdfstartlink + \fi + \def\pdfurl#1{% + \begingroup + \normalturnoffactive\def\@{@}% + \makevalueexpandable + \leavevmode\Red + \startlink attr{/Border [0 0 0]}% + user{/Subtype /Link /A << /S /URI /URI (#1) >>}% + \endgroup} + \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} + \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} + \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} + \def\maketoks{% + \expandafter\poptoks\the\toksA|ENDTOKS|\relax + \ifx\first0\adn0 + \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 + \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 + \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 + \else + \ifnum0=\countA\else\makelink\fi + \ifx\first.\let\next=\done\else + \let\next=\maketoks + \addtokens{\toksB}{\the\toksD} + \ifx\first,\addtokens{\toksB}{\space}\fi + \fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \next} + \def\makelink{\addtokens{\toksB}% + {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} + \def\pdflink#1{% + \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} + \linkcolor #1\endlink} + \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} +\else + \let\pdfmkdest = \gobble + \let\pdfurl = \gobble + \let\endlink = \relax + \let\linkcolor = \relax + \let\pdfmakeoutlines = \relax +\fi % \ifx\pdfoutput + + +\message{fonts,} + +% Change the current font style to #1, remembering it in \curfontstyle. +% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in +% italics, not bold italics. +% +\def\setfontstyle#1{% + \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. + \csname ten#1\endcsname % change the current font +} + +% Select #1 fonts with the current style. +% +\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} + +\def\rm{\fam=0 \setfontstyle{rm}} +\def\it{\fam=\itfam \setfontstyle{it}} +\def\sl{\fam=\slfam \setfontstyle{sl}} +\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} +\def\tt{\fam=\ttfam \setfontstyle{tt}} + +% Texinfo sort of supports the sans serif font style, which plain TeX does not. +% So we set up a \sf. +\newfam\sffam +\def\sf{\fam=\sffam \setfontstyle{sf}} +\let\li = \sf % Sometimes we call it \li, not \sf. + +% We don't need math for this font style. +\def\ttsl{\setfontstyle{ttsl}} + +% Default leading. +\newdimen\textleading \textleading = 13.2pt + +% Set the baselineskip to #1, and the lineskip and strut size +% correspondingly. There is no deep meaning behind these magic numbers +% used as factors; they just match (closely enough) what Knuth defined. +% +\def\lineskipfactor{.08333} +\def\strutheightpercent{.70833} +\def\strutdepthpercent {.29167} +% +\def\setleading#1{% + \normalbaselineskip = #1\relax + \normallineskip = \lineskipfactor\normalbaselineskip + \normalbaselines + \setbox\strutbox =\hbox{% + \vrule width0pt height\strutheightpercent\baselineskip + depth \strutdepthpercent \baselineskip + }% +} + +% Set the font macro #1 to the font named #2, adding on the +% specified font prefix (normally `cm'). +% #3 is the font's design size, #4 is a scale factor +\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} + +% Use cm as the default font prefix. +% To specify the font prefix, you must define \fontprefix +% before you read in texinfo.tex. +\ifx\fontprefix\undefined +\def\fontprefix{cm} +\fi +% Support font families that don't use the same naming scheme as CM. +\def\rmshape{r} +\def\rmbshape{bx} %where the normal face is bold +\def\bfshape{b} +\def\bxshape{bx} +\def\ttshape{tt} +\def\ttbshape{tt} +\def\ttslshape{sltt} +\def\itshape{ti} +\def\itbshape{bxti} +\def\slshape{sl} +\def\slbshape{bxsl} +\def\sfshape{ss} +\def\sfbshape{ss} +\def\scshape{csc} +\def\scbshape{csc} + +% Text fonts (11.2pt, magstep1). +\def\textnominalsize{11pt} +\edef\mainmagstep{\magstephalf} +\setfont\textrm\rmshape{10}{\mainmagstep} +\setfont\texttt\ttshape{10}{\mainmagstep} +\setfont\textbf\bfshape{10}{\mainmagstep} +\setfont\textit\itshape{10}{\mainmagstep} +\setfont\textsl\slshape{10}{\mainmagstep} +\setfont\textsf\sfshape{10}{\mainmagstep} +\setfont\textsc\scshape{10}{\mainmagstep} +\setfont\textttsl\ttslshape{10}{\mainmagstep} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstep1} +\setfont\deftt\ttshape{10}{\magstep1} +\setfont\defttsl\ttslshape{10}{\magstep1} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000} +\setfont\smalltt\ttshape{9}{1000} +\setfont\smallbf\bfshape{10}{900} +\setfont\smallit\itshape{9}{1000} +\setfont\smallsl\slshape{9}{1000} +\setfont\smallsf\sfshape{9}{1000} +\setfont\smallsc\scshape{10}{900} +\setfont\smallttsl\ttslshape{10}{900} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000} +\setfont\smallertt\ttshape{8}{1000} +\setfont\smallerbf\bfshape{10}{800} +\setfont\smallerit\itshape{8}{1000} +\setfont\smallersl\slshape{8}{1000} +\setfont\smallersf\sfshape{8}{1000} +\setfont\smallersc\scshape{10}{800} +\setfont\smallerttsl\ttslshape{10}{800} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3} +\setfont\titleit\itbshape{10}{\magstep4} +\setfont\titlesl\slbshape{10}{\magstep4} +\setfont\titlett\ttbshape{12}{\magstep3} +\setfont\titlettsl\ttslshape{10}{\magstep4} +\setfont\titlesf\sfbshape{17}{\magstep1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\authorrm{\secrm} +\def\authortt{\sectt} + +% Chapter (and unnumbered) fonts (17.28pt). +\def\chapnominalsize{17pt} +\setfont\chaprm\rmbshape{12}{\magstep2} +\setfont\chapit\itbshape{10}{\magstep3} +\setfont\chapsl\slbshape{10}{\magstep3} +\setfont\chaptt\ttbshape{12}{\magstep2} +\setfont\chapttsl\ttslshape{10}{\magstep3} +\setfont\chapsf\sfbshape{17}{1000} +\let\chapbf=\chaprm +\setfont\chapsc\scbshape{10}{\magstep3} +\font\chapi=cmmi12 scaled \magstep2 +\font\chapsy=cmsy10 scaled \magstep3 + +% Section fonts (14.4pt). +\def\secnominalsize{14pt} +\setfont\secrm\rmbshape{12}{\magstep1} +\setfont\secit\itbshape{10}{\magstep2} +\setfont\secsl\slbshape{10}{\magstep2} +\setfont\sectt\ttbshape{12}{\magstep1} +\setfont\secttsl\ttslshape{10}{\magstep2} +\setfont\secsf\sfbshape{12}{\magstep1} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep2} +\font\seci=cmmi12 scaled \magstep1 +\font\secsy=cmsy10 scaled \magstep2 + +% Subsection fonts (13.15pt). +\def\ssecnominalsize{13pt} +\setfont\ssecrm\rmbshape{12}{\magstephalf} +\setfont\ssecit\itbshape{10}{1315} +\setfont\ssecsl\slbshape{10}{1315} +\setfont\ssectt\ttbshape{12}{\magstephalf} +\setfont\ssecttsl\ttslshape{10}{1315} +\setfont\ssecsf\sfbshape{12}{\magstephalf} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{1315} +\font\sseci=cmmi12 scaled \magstephalf +\font\ssecsy=cmsy10 scaled 1315 + +% Reduced fonts for @acro in text (10pt). +\def\reducednominalsize{10pt} +\setfont\reducedrm\rmshape{10}{1000} +\setfont\reducedtt\ttshape{10}{1000} +\setfont\reducedbf\bfshape{10}{1000} +\setfont\reducedit\itshape{10}{1000} +\setfont\reducedsl\slshape{10}{1000} +\setfont\reducedsf\sfshape{10}{1000} +\setfont\reducedsc\scshape{10}{1000} +\setfont\reducedttsl\ttslshape{10}{1000} +\font\reducedi=cmmi10 +\font\reducedsy=cmsy10 + +% In order for the font changes to affect most math symbols and letters, +% we have to define the \textfont of the standard families. Since +% texinfo doesn't allow for producing subscripts and superscripts except +% in the main text, we don't bother to reset \scriptfont and +% \scriptscriptfont (which would also require loading a lot more fonts). +% +\def\resetmathfonts{% + \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy + \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf + \textfont\ttfam=\tentt \textfont\sffam=\tensf +} + +% The font-changing commands redefine the meanings of \tenSTYLE, instead +% of just \STYLE. We do this because \STYLE needs to also set the +% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire +% \tenSTYLE to set the current font. +% +% Each font-changing command also sets the names \lsize (one size lower) +% and \lllsize (three sizes lower). These relative commands are used in +% the LaTeX logo and acronyms. +% +% This all needs generalizing, badly. +% +\def\textfonts{% + \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl + \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc + \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy + \let\tenttsl=\textttsl + \def\curfontsize{text}% + \def\lsize{reduced}\def\lllsize{smaller}% + \resetmathfonts \setleading{\textleading}} +\def\titlefonts{% + \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl + \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc + \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy + \let\tenttsl=\titlettsl + \def\curfontsize{title}% + \def\lsize{chap}\def\lllsize{subsec}% + \resetmathfonts \setleading{25pt}} +\def\titlefont#1{{\titlefonts\rm #1}} +\def\chapfonts{% + \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl + \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc + \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy + \let\tenttsl=\chapttsl + \def\curfontsize{chap}% + \def\lsize{sec}\def\lllsize{text}% + \resetmathfonts \setleading{19pt}} +\def\secfonts{% + \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl + \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc + \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy + \let\tenttsl=\secttsl + \def\curfontsize{sec}% + \def\lsize{subsec}\def\lllsize{reduced}% + \resetmathfonts \setleading{16pt}} +\def\subsecfonts{% + \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl + \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc + \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy + \let\tenttsl=\ssecttsl + \def\curfontsize{ssec}% + \def\lsize{text}\def\lllsize{small}% + \resetmathfonts \setleading{15pt}} +\let\subsubsecfonts = \subsecfonts +\def\reducedfonts{% + \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl + \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc + \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy + \let\tenttsl=\reducedttsl + \def\curfontsize{reduced}% + \def\lsize{small}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallfonts{% + \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl + \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc + \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy + \let\tenttsl=\smallttsl + \def\curfontsize{small}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallerfonts{% + \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl + \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc + \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy + \let\tenttsl=\smallerttsl + \def\curfontsize{smaller}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{9.5pt}} + +% Set the fonts to use with the @small... environments. +\let\smallexamplefonts = \smallfonts + +% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample +% can fit this many characters: +% 8.5x11=86 smallbook=72 a4=90 a5=69 +% If we use \scriptfonts (8pt), then we can fit this many characters: +% 8.5x11=90+ smallbook=80 a4=90+ a5=77 +% For me, subjectively, the few extra characters that fit aren't worth +% the additional smallness of 8pt. So I'm making the default 9pt. +% +% By the way, for comparison, here's what fits with @example (10pt): +% 8.5x11=71 smallbook=60 a4=75 a5=58 +% +% I wish the USA used A4 paper. +% --karl, 24jan03. + + +% Set up the default fonts, so we can use them for creating boxes. +% +\textfonts \rm + +% Define these so they can be easily changed for other fonts. +\def\angleleft{$\langle$} +\def\angleright{$\rangle$} + +% Count depth in font-changes, for error checks +\newcount\fontdepth \fontdepth=0 + +% Fonts for short table of contents. +\setfont\shortcontrm\rmshape{12}{1000} +\setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 +\setfont\shortcontsl\slshape{12}{1000} +\setfont\shortconttt\ttshape{12}{1000} + +%% Add scribe-like font environments, plus @l for inline lisp (usually sans +%% serif) and @ii for TeX italic + +% \smartitalic{ARG} outputs arg in italics, followed by an italic correction +% unless the following character is such as not to need one. +\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else + \ptexslash\fi\fi\fi} +\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} +\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} + +% like \smartslanted except unconditionally uses \ttsl. +% @var is set to this for defun arguments. +\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} + +% like \smartslanted except unconditionally use \sl. We never want +% ttsl for book titles, do we? +\def\cite#1{{\sl #1}\futurelet\next\smartitalicx} + +\let\i=\smartitalic +\let\slanted=\smartslanted +\let\var=\smartslanted +\let\dfn=\smartslanted +\let\emph=\smartitalic + +% @b, explicit bold. +\def\b#1{{\bf #1}} +\let\strong=\b + +% @sansserif, explicit sans. +\def\sansserif#1{{\sf #1}} + +% We can't just use \exhyphenpenalty, because that only has effect at +% the end of a paragraph. Restore normal hyphenation at the end of the +% group within which \nohyphenation is presumably called. +% +\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} +\def\restorehyphenation{\hyphenchar\font = `- } + +% Set sfcode to normal for the chars that usually have another value. +% Can't use plain's \frenchspacing because it uses the `\x notation, and +% sometimes \x has an active definition that messes things up. +% +\catcode`@=11 + \def\frenchspacing{% + \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m + \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m + } +\catcode`@=\other + +\def\t#1{% + {\tt \rawbackslash \frenchspacing #1}% + \null +} +\def\samp#1{`\tclose{#1}'\null} +\setfont\keyrm\rmshape{8}{1000} +\font\keysy=cmsy9 +\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% + \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% + \vbox{\hrule\kern-0.4pt + \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% + \kern-0.4pt\hrule}% + \kern-.06em\raise0.4pt\hbox{\angleright}}}} +% The old definition, with no lozenge: +%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} +\def\ctrl #1{{\tt \rawbackslash \hat}#1} + +% @file, @option are the same as @samp. +\let\file=\samp +\let\option=\samp + +% @code is a modification of @t, +% which makes spaces the same size as normal in the surrounding text. +\def\tclose#1{% + {% + % Change normal interword space to be same as for the current font. + \spaceskip = \fontdimen2\font + % + % Switch to typewriter. + \tt + % + % But `\ ' produces the large typewriter interword space. + \def\ {{\spaceskip = 0pt{} }}% + % + % Turn off hyphenation. + \nohyphenation + % + \rawbackslash + \frenchspacing + #1% + }% + \null +} + +% We *must* turn on hyphenation at `-' and `_' in @code. +% Otherwise, it is too hard to avoid overfull hboxes +% in the Emacs manual, the Library manual, etc. + +% Unfortunately, TeX uses one parameter (\hyphenchar) to control +% both hyphenation at - and hyphenation within words. +% We must therefore turn them both off (\tclose does that) +% and arrange explicitly to hyphenate at a dash. +% -- rms. +{ + \catcode`\-=\active + \catcode`\_=\active + % + \global\def\code{\begingroup + \catcode`\-=\active \let-\codedash + \catcode`\_=\active \let_\codeunder + \codex + } +} + +\def\realdash{-} +\def\codedash{-\discretionary{}{}{}} +\def\codeunder{% + % this is all so @math{@code{var_name}+1} can work. In math mode, _ + % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) + % will therefore expand the active definition of _, which is us + % (inside @code that is), therefore an endless loop. + \ifusingtt{\ifmmode + \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. + \else\normalunderscore \fi + \discretionary{}{}{}}% + {\_}% +} +\def\codex #1{\tclose{#1}\endgroup} + +% @kbd is like @code, except that if the argument is just one @key command, +% then @kbd has no effect. + +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), +% `example' (@kbd uses ttsl only inside of @example and friends), +% or `code' (@kbd uses normal tty font always). +\parseargdef\kbdinputstyle{% + \def\arg{#1}% + \ifx\arg\worddistinct + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% + \else\ifx\arg\wordexample + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% + \else\ifx\arg\wordcode + \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \else + \errhelp = \EMsimple + \errmessage{Unknown @kbdinputstyle option `\arg'}% + \fi\fi\fi +} +\def\worddistinct{distinct} +\def\wordexample{example} +\def\wordcode{code} + +% Default is `distinct.' +\kbdinputstyle distinct + +\def\xkey{\key} +\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% +\ifx\one\xkey\ifx\threex\three \key{#2}% +\else{\tclose{\kbdfont\look}}\fi +\else{\tclose{\kbdfont\look}}\fi} + +% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. +\let\indicateurl=\code +\let\env=\code +\let\command=\code + +% @uref (abbreviation for `urlref') takes an optional (comma-separated) +% second argument specifying the text to display and an optional third +% arg as text to display instead of (rather than in addition to) the url +% itself. First (mandatory) arg is the url. Perhaps eventually put in +% a hypertex \special here. +% +\def\uref#1{\douref #1,,,\finish} +\def\douref#1,#2,#3,#4\finish{\begingroup + \unsepspaces + \pdfurl{#1}% + \setbox0 = \hbox{\ignorespaces #3}% + \ifdim\wd0 > 0pt + \unhbox0 % third arg given, show only that + \else + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url + \fi + \else + \code{#1}% only url given, so show it + \fi + \fi + \endlink +\endgroup} + +% @url synonym for @uref, since that's how everyone uses it. +% +\let\url=\uref + +% rms does not like angle brackets --karl, 17may97. +% So now @email is just like @uref, unless we are pdf. +% +%\def\email#1{\angleleft{\tt #1}\angleright} +\ifpdf + \def\email#1{\doemail#1,,\finish} + \def\doemail#1,#2,#3\finish{\begingroup + \unsepspaces + \pdfurl{mailto:#1}% + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi + \endlink + \endgroup} +\else + \let\email=\uref +\fi + +% Check if we are currently using a typewriter font. Since all the +% Computer Modern typewriter fonts have zero interword stretch (and +% shrink), and it is reasonable to expect all typewriter fonts to have +% this property, we can check that font parameter. +% +\def\ifmonospace{\ifdim\fontdimen3\font=0pt } + +% Typeset a dimension, e.g., `in' or `pt'. The only reason for the +% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. +% +\def\dmn#1{\thinspace #1} + +\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} + +% @l was never documented to mean ``switch to the Lisp font'', +% and it is not used as such in any manual I can find. We need it for +% Polish suppressed-l. --karl, 22sep96. +%\def\l#1{{\li #1}\null} + +% Explicit font changes: @r, @sc, undocumented @ii. +\def\r#1{{\rm #1}} % roman font +\def\sc#1{{\smallcaps#1}} % smallcaps font +\def\ii#1{{\it #1}} % italic font + +% @acronym for "FBI", "NATO", and the like. +% We print this one point size smaller, since it's intended for +% all-uppercase. +% +\def\acronym#1{\doacronym #1,,\finish} +\def\doacronym#1,#2,#3\finish{% + {\selectfonts\lsize #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} + +% @abbr for "Comput. J." and the like. +% No font change, but don't do end-of-sentence spacing. +% +\def\abbr#1{\doabbr #1,,\finish} +\def\doabbr#1,#2,#3\finish{% + {\frenchspacing #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} + +% @pounds{} is a sterling sign, which Knuth put in the CM italic font. +% +\def\pounds{{\it\$}} + +% @euro{} comes from a separate font, depending on the current style. +% We use the free feym* fonts from the eurosym package by Henrik +% Theiling, which support regular, slanted, bold and bold slanted (and +% "outlined" (blackboard board, sort of) versions, which we don't need). +% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. +% +% Although only regular is the truly official Euro symbol, we ignore +% that. The Euro is designed to be slightly taller than the regular +% font height. +% +% feymr - regular +% feymo - slanted +% feybr - bold +% feybo - bold slanted +% +% There is no good (free) typewriter version, to my knowledge. +% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. +% Hmm. +% +% Also doesn't work in math. Do we need to do math with euro symbols? +% Hope not. +% +% +\def\euro{{\eurofont e}} +\def\eurofont{% + % We set the font at each command, rather than predefining it in + % \textfonts and the other font-switching commands, so that + % installations which never need the symbol don't have to have the + % font installed. + % + % There is only one designed size (nominal 10pt), so we always scale + % that to the current nominal size. + % + % By the way, simply using "at 1em" works for cmr10 and the like, but + % does not work for cmbx10 and other extended/shrunken fonts. + % + \def\eurosize{\csname\curfontsize nominalsize\endcsname}% + % + \ifx\curfontstyle\bfstylename + % bold: + \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize + \else + % regular: + \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize + \fi + \thiseurofont +} + +% @registeredsymbol - R in a circle. The font for the R should really +% be smaller yet, but lllsize is the best we can do for now. +% Adapted from the plain.tex definition of \copyright. +% +\def\registeredsymbol{% + $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% + \hfil\crcr\Orb}}% + }$% +} + +% Laurent Siebenmann reports \Orb undefined with: +% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 +% so we'll define it if necessary. +% +\ifx\Orb\undefined +\def\Orb{\mathhexbox20D} +\fi + + +\message{page headings,} + +\newskip\titlepagetopglue \titlepagetopglue = 1.5in +\newskip\titlepagebottomglue \titlepagebottomglue = 2pc + +% First the title page. Must do @settitle before @titlepage. +\newif\ifseenauthor +\newif\iffinishedtitlepage + +% Do an implicit @contents or @shortcontents after @end titlepage if the +% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. +% +\newif\ifsetcontentsaftertitlepage + \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue +\newif\ifsetshortcontentsaftertitlepage + \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue + +\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% + \endgroup\page\hbox{}\page} + +\envdef\titlepage{% + % Open one extra group, as we want to close it in the middle of \Etitlepage. + \begingroup + \parindent=0pt \textfonts + % Leave some space at the very top of the page. + \vglue\titlepagetopglue + % No rule at page bottom unless we print one at the top with @title. + \finishedtitlepagetrue + % + % Most title ``pages'' are actually two pages long, with space + % at the top of the second. We don't want the ragged left on the second. + \let\oldpage = \page + \def\page{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + \let\page = \oldpage + \page + \null + }% +} + +\def\Etitlepage{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + % It is important to do the page break before ending the group, + % because the headline and footline are only empty inside the group. + % If we use the new definition of \page, we always get a blank page + % after the title page, which we certainly don't want. + \oldpage + \endgroup + % + % Need this before the \...aftertitlepage checks so that if they are + % in effect the toc pages will come out with page numbers. + \HEADINGSon + % + % If they want short, they certainly want long too. + \ifsetshortcontentsaftertitlepage + \shortcontents + \contents + \global\let\shortcontents = \relax + \global\let\contents = \relax + \fi + % + \ifsetcontentsaftertitlepage + \contents + \global\let\contents = \relax + \global\let\shortcontents = \relax + \fi +} + +\def\finishtitlepage{% + \vskip4pt \hrule height 2pt width \hsize + \vskip\titlepagebottomglue + \finishedtitlepagetrue +} + +%%% Macros to be used within @titlepage: + +\let\subtitlerm=\tenrm +\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} + +\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines + \let\tt=\authortt} + +\parseargdef\title{% + \checkenv\titlepage + \leftline{\titlefonts\rm #1} + % print a rule at the page bottom also. + \finishedtitlepagefalse + \vskip4pt \hrule height 4pt width \hsize \vskip4pt +} + +\parseargdef\subtitle{% + \checkenv\titlepage + {\subtitlefont \rightline{#1}}% +} + +% @author should come last, but may come many times. +% It can also be used inside @quotation. +% +\parseargdef\author{% + \def\temp{\quotation}% + \ifx\thisenv\temp + \def\quotationauthor{#1}% printed in \Equotation. + \else + \checkenv\titlepage + \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi + {\authorfont \leftline{#1}}% + \fi +} + + +%%% Set up page headings and footings. + +\let\thispage=\folio + +\newtoks\evenheadline % headline on even pages +\newtoks\oddheadline % headline on odd pages +\newtoks\evenfootline % footline on even pages +\newtoks\oddfootline % footline on odd pages + +% Now make TeX use those variables +\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline + \else \the\evenheadline \fi}} +\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline + \else \the\evenfootline \fi}\HEADINGShook} +\let\HEADINGShook=\relax + +% Commands to set those variables. +% For example, this is what @headings on does +% @evenheading @thistitle|@thispage|@thischapter +% @oddheading @thischapter|@thispage|@thistitle +% @evenfooting @thisfile|| +% @oddfooting ||@thisfile + + +\def\evenheading{\parsearg\evenheadingxxx} +\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} +\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% +\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddheading{\parsearg\oddheadingxxx} +\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} +\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% +\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% + +\def\evenfooting{\parsearg\evenfootingxxx} +\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} +\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% +\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddfooting{\parsearg\oddfootingxxx} +\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} +\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% + \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% + % + % Leave some space for the footline. Hopefully ok to assume + % @evenfooting will not be used by itself. + \global\advance\pageheight by -\baselineskip + \global\advance\vsize by -\baselineskip +} + +\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} + + +% @headings double turns headings on for double-sided printing. +% @headings single turns headings on for single-sided printing. +% @headings off turns them off. +% @headings on same as @headings double, retained for compatibility. +% @headings after turns on double-sided headings after this page. +% @headings doubleafter turns on double-sided headings after this page. +% @headings singleafter turns on single-sided headings after this page. +% By default, they are off at the start of a document, +% and turned `on' after @end titlepage. + +\def\headings #1 {\csname HEADINGS#1\endcsname} + +\def\HEADINGSoff{% +\global\evenheadline={\hfil} \global\evenfootline={\hfil} +\global\oddheadline={\hfil} \global\oddfootline={\hfil}} +\HEADINGSoff +% When we turn headings on, set the page number to 1. +% For double-sided printing, put current file name in lower left corner, +% chapter name on inside top of right hand pages, document +% title on inside top of left hand pages, and page numbers on outside top +% edge of all pages. +\def\HEADINGSdouble{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} +\let\contentsalignmacro = \chappager + +% For single-sided printing, chapter title goes across top left of page, +% page number on top right. +\def\HEADINGSsingle{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} +\def\HEADINGSon{\HEADINGSdouble} + +\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} +\let\HEADINGSdoubleafter=\HEADINGSafter +\def\HEADINGSdoublex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} + +\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} +\def\HEADINGSsinglex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} + +% Subroutines used in generating headings +% This produces Day Month Year style of output. +% Only define if not already defined, in case a txi-??.tex file has set +% up a different format (e.g., txi-cs.tex does this). +\ifx\today\undefined +\def\today{% + \number\day\space + \ifcase\month + \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr + \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug + \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec + \fi + \space\number\year} +\fi + +% @settitle line... specifies the title of the document, for headings. +% It generates no output of its own. +\def\thistitle{\putwordNoTitle} +\def\settitle{\parsearg{\gdef\thistitle}} + + +\message{tables,} +% Tables -- @table, @ftable, @vtable, @item(x). + +% default indentation of table text +\newdimen\tableindent \tableindent=.8in +% default indentation of @itemize and @enumerate text +\newdimen\itemindent \itemindent=.3in +% margin between end of table item and start of table text. +\newdimen\itemmargin \itemmargin=.1in + +% used internally for \itemindent minus \itemmargin +\newdimen\itemmax + +% Note @table, @ftable, and @vtable define @item, @itemx, etc., with +% these defs. +% They also define \itemindex +% to index the item name in whatever manner is desired (perhaps none). + +\newif\ifitemxneedsnegativevskip + +\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} + +\def\internalBitem{\smallbreak \parsearg\itemzzz} +\def\internalBitemx{\itemxpar \parsearg\itemzzz} + +\def\itemzzz #1{\begingroup % + \advance\hsize by -\rightskip + \advance\hsize by -\tableindent + \setbox0=\hbox{\itemindicate{#1}}% + \itemindex{#1}% + \nobreak % This prevents a break before @itemx. + % + % If the item text does not fit in the space we have, put it on a line + % by itself, and do not allow a page break either before or after that + % line. We do not start a paragraph here because then if the next + % command is, e.g., @kindex, the whatsit would get put into the + % horizontal list on a line by itself, resulting in extra blank space. + \ifdim \wd0>\itemmax + % + % Make this a paragraph so we get the \parskip glue and wrapping, + % but leave it ragged-right. + \begingroup + \advance\leftskip by-\tableindent + \advance\hsize by\tableindent + \advance\rightskip by0pt plus1fil + \leavevmode\unhbox0\par + \endgroup + % + % We're going to be starting a paragraph, but we don't want the + % \parskip glue -- logically it's part of the @item we just started. + \nobreak \vskip-\parskip + % + % Stop a page break at the \parskip glue coming up. However, if + % what follows is an environment such as @example, there will be no + % \parskip glue; then the negative vskip we just inserted would + % cause the example and the item to crash together. So we use this + % bizarre value of 10001 as a signal to \aboveenvbreak to insert + % \parskip glue after all. Section titles are handled this way also. + % + \penalty 10001 + \endgroup + \itemxneedsnegativevskipfalse + \else + % The item text fits into the space. Start a paragraph, so that the + % following text (if any) will end up on the same line. + \noindent + % Do this with kerns and \unhbox so that if there is a footnote in + % the item text, it can migrate to the main vertical list and + % eventually be printed. + \nobreak\kern-\tableindent + \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 + \unhbox0 + \nobreak\kern\dimen0 + \endgroup + \itemxneedsnegativevskiptrue + \fi +} + +\def\item{\errmessage{@item while not in a list environment}} +\def\itemx{\errmessage{@itemx while not in a list environment}} + +% @table, @ftable, @vtable. +\envdef\table{% + \let\itemindex\gobble + \tablecheck{table}% +} +\envdef\ftable{% + \def\itemindex ##1{\doind {fn}{\code{##1}}}% + \tablecheck{ftable}% +} +\envdef\vtable{% + \def\itemindex ##1{\doind {vr}{\code{##1}}}% + \tablecheck{vtable}% +} +\def\tablecheck#1{% + \ifnum \the\catcode`\^^M=\active + \endgroup + \errmessage{This command won't work in this context; perhaps the problem is + that we are \inenvironment\thisenv}% + \def\next{\doignore{#1}}% + \else + \let\next\tablex + \fi + \next +} +\def\tablex#1{% + \def\itemindicate{#1}% + \parsearg\tabley +} +\def\tabley#1{% + {% + \makevalueexpandable + \edef\temp{\noexpand\tablez #1\space\space\space}% + \expandafter + }\temp \endtablez +} +\def\tablez #1 #2 #3 #4\endtablez{% + \aboveenvbreak + \ifnum 0#1>0 \advance \leftskip by #1\mil \fi + \ifnum 0#2>0 \tableindent=#2\mil \fi + \ifnum 0#3>0 \advance \rightskip by #3\mil \fi + \itemmax=\tableindent + \advance \itemmax by -\itemmargin + \advance \leftskip by \tableindent + \exdentamount=\tableindent + \parindent = 0pt + \parskip = \smallskipamount + \ifdim \parskip=0pt \parskip=2pt \fi + \let\item = \internalBitem + \let\itemx = \internalBitemx +} +\def\Etable{\endgraf\afterenvbreak} +\let\Eftable\Etable +\let\Evtable\Etable +\let\Eitemize\Etable +\let\Eenumerate\Etable + +% This is the counter used by @enumerate, which is really @itemize + +\newcount \itemno + +\envdef\itemize{\parsearg\doitemize} + +\def\doitemize#1{% + \aboveenvbreak + \itemmax=\itemindent + \advance\itemmax by -\itemmargin + \advance\leftskip by \itemindent + \exdentamount=\itemindent + \parindent=0pt + \parskip=\smallskipamount + \ifdim\parskip=0pt \parskip=2pt \fi + \def\itemcontents{#1}% + % @itemize with no arg is equivalent to @itemize @bullet. + \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi + \let\item=\itemizeitem +} + +% Definition of @item while inside @itemize and @enumerate. +% +\def\itemizeitem{% + \advance\itemno by 1 % for enumerations + {\let\par=\endgraf \smallbreak}% reasonable place to break + {% + % If the document has an @itemize directly after a section title, a + % \nobreak will be last on the list, and \sectionheading will have + % done a \vskip-\parskip. In that case, we don't want to zero + % parskip, or the item text will crash with the heading. On the + % other hand, when there is normal text preceding the item (as there + % usually is), we do want to zero parskip, or there would be too much + % space. In that case, we won't have a \nobreak before. At least + % that's the theory. + \ifnum\lastpenalty<10000 \parskip=0in \fi + \noindent + \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% + \vadjust{\penalty 1200}}% not good to break after first line of item. + \flushcr +} + +% \splitoff TOKENS\endmark defines \first to be the first token in +% TOKENS, and \rest to be the remainder. +% +\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% + +% Allow an optional argument of an uppercase letter, lowercase letter, +% or number, to specify the first label in the enumerated list. No +% argument is the same as `1'. +% +\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} +\def\enumeratey #1 #2\endenumeratey{% + % If we were given no argument, pretend we were given `1'. + \def\thearg{#1}% + \ifx\thearg\empty \def\thearg{1}\fi + % + % Detect if the argument is a single token. If so, it might be a + % letter. Otherwise, the only valid thing it can be is a number. + % (We will always have one token, because of the test we just made. + % This is a good thing, since \splitoff doesn't work given nothing at + % all -- the first parameter is undelimited.) + \expandafter\splitoff\thearg\endmark + \ifx\rest\empty + % Only one token in the argument. It could still be anything. + % A ``lowercase letter'' is one whose \lccode is nonzero. + % An ``uppercase letter'' is one whose \lccode is both nonzero, and + % not equal to itself. + % Otherwise, we assume it's a number. + % + % We need the \relax at the end of the \ifnum lines to stop TeX from + % continuing to look for a . + % + \ifnum\lccode\expandafter`\thearg=0\relax + \numericenumerate % a number (we hope) + \else + % It's a letter. + \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax + \lowercaseenumerate % lowercase letter + \else + \uppercaseenumerate % uppercase letter + \fi + \fi + \else + % Multiple tokens in the argument. We hope it's a number. + \numericenumerate + \fi +} + +% An @enumerate whose labels are integers. The starting integer is +% given in \thearg. +% +\def\numericenumerate{% + \itemno = \thearg + \startenumeration{\the\itemno}% +} + +% The starting (lowercase) letter is in \thearg. +\def\lowercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more lowercase letters in @enumerate; get a bigger + alphabet}% + \fi + \char\lccode\itemno + }% +} + +% The starting (uppercase) letter is in \thearg. +\def\uppercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more uppercase letters in @enumerate; get a bigger + alphabet} + \fi + \char\uccode\itemno + }% +} + +% Call \doitemize, adding a period to the first argument and supplying the +% common last two arguments. Also subtract one from the initial value in +% \itemno, since @item increments \itemno. +% +\def\startenumeration#1{% + \advance\itemno by -1 + \doitemize{#1.}\flushcr +} + +% @alphaenumerate and @capsenumerate are abbreviations for giving an arg +% to @enumerate. +% +\def\alphaenumerate{\enumerate{a}} +\def\capsenumerate{\enumerate{A}} +\def\Ealphaenumerate{\Eenumerate} +\def\Ecapsenumerate{\Eenumerate} + + +% @multitable macros +% Amy Hendrickson, 8/18/94, 3/6/96 +% +% @multitable ... @end multitable will make as many columns as desired. +% Contents of each column will wrap at width given in preamble. Width +% can be specified either with sample text given in a template line, +% or in percent of \hsize, the current width of text on page. + +% Table can continue over pages but will only break between lines. + +% To make preamble: +% +% Either define widths of columns in terms of percent of \hsize: +% @multitable @columnfractions .25 .3 .45 +% @item ... +% +% Numbers following @columnfractions are the percent of the total +% current hsize to be used for each column. You may use as many +% columns as desired. + + +% Or use a template: +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item ... +% using the widest term desired in each column. + +% Each new table line starts with @item, each subsequent new column +% starts with @tab. Empty columns may be produced by supplying @tab's +% with nothing between them for as many times as empty columns are needed, +% ie, @tab@tab@tab will produce two empty columns. + +% @item, @tab do not need to be on their own lines, but it will not hurt +% if they are. + +% Sample multitable: + +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item first col stuff @tab second col stuff @tab third col +% @item +% first col stuff +% @tab +% second col stuff +% @tab +% third col +% @item first col stuff @tab second col stuff +% @tab Many paragraphs of text may be used in any column. +% +% They will wrap at the width determined by the template. +% @item@tab@tab This will be in third column. +% @end multitable + +% Default dimensions may be reset by user. +% @multitableparskip is vertical space between paragraphs in table. +% @multitableparindent is paragraph indent in table. +% @multitablecolmargin is horizontal space to be left between columns. +% @multitablelinespace is space to leave between table items, baseline +% to baseline. +% 0pt means it depends on current normal line spacing. +% +\newskip\multitableparskip +\newskip\multitableparindent +\newdimen\multitablecolspace +\newskip\multitablelinespace +\multitableparskip=0pt +\multitableparindent=6pt +\multitablecolspace=12pt +\multitablelinespace=0pt + +% Macros used to set up halign preamble: +% +\let\endsetuptable\relax +\def\xendsetuptable{\endsetuptable} +\let\columnfractions\relax +\def\xcolumnfractions{\columnfractions} +\newif\ifsetpercent + +% #1 is the @columnfraction, usually a decimal number like .5, but might +% be just 1. We just use it, whatever it is. +% +\def\pickupwholefraction#1 {% + \global\advance\colcount by 1 + \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% + \setuptable +} + +\newcount\colcount +\def\setuptable#1{% + \def\firstarg{#1}% + \ifx\firstarg\xendsetuptable + \let\go = \relax + \else + \ifx\firstarg\xcolumnfractions + \global\setpercenttrue + \else + \ifsetpercent + \let\go\pickupwholefraction + \else + \global\advance\colcount by 1 + \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a + % separator; typically that is always in the input, anyway. + \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% + \fi + \fi + \ifx\go\pickupwholefraction + % Put the argument back for the \pickupwholefraction call, so + % we'll always have a period there to be parsed. + \def\go{\pickupwholefraction#1}% + \else + \let\go = \setuptable + \fi% + \fi + \go +} + +% multitable-only commands. +% +% @headitem starts a heading row, which we typeset in bold. +% Assignments have to be global since we are inside the implicit group +% of an alignment entry. Note that \everycr resets \everytab. +\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}% +% +% A \tab used to include \hskip1sp. But then the space in a template +% line is not enough. That is bad. So let's go back to just `&' until +% we encounter the problem it was intended to solve again. +% --karl, nathan@acm.org, 20apr99. +\def\tab{\checkenv\multitable &\the\everytab}% + +% @multitable ... @end multitable definitions: +% +\newtoks\everytab % insert after every tab. +% +\envdef\multitable{% + \vskip\parskip + \startsavinginserts + % + % @item within a multitable starts a normal row. + % We use \def instead of \let so that if one of the multitable entries + % contains an @itemize, we don't choke on the \item (seen as \crcr aka + % \endtemplate) expanding \doitemize. + \def\item{\crcr}% + % + \tolerance=9500 + \hbadness=9500 + \setmultitablespacing + \parskip=\multitableparskip + \parindent=\multitableparindent + \overfullrule=0pt + \global\colcount=0 + % + \everycr = {% + \noalign{% + \global\everytab={}% + \global\colcount=0 % Reset the column counter. + % Check for saved footnotes, etc. + \checkinserts + % Keeps underfull box messages off when table breaks over pages. + %\filbreak + % Maybe so, but it also creates really weird page breaks when the + % table breaks over pages. Wouldn't \vfil be better? Wait until the + % problem manifests itself, so it can be fixed for real --karl. + }% + }% + % + \parsearg\domultitable +} +\def\domultitable#1{% + % To parse everything between @multitable and @item: + \setuptable#1 \endsetuptable + % + % This preamble sets up a generic column definition, which will + % be used as many times as user calls for columns. + % \vtop will set a single line and will also let text wrap and + % continue for many paragraphs if desired. + \halign\bgroup &% + \global\advance\colcount by 1 + \multistrut + \vtop{% + % Use the current \colcount to find the correct column width: + \hsize=\expandafter\csname col\the\colcount\endcsname + % + % In order to keep entries from bumping into each other + % we will add a \leftskip of \multitablecolspace to all columns after + % the first one. + % + % If a template has been used, we will add \multitablecolspace + % to the width of each template entry. + % + % If the user has set preamble in terms of percent of \hsize we will + % use that dimension as the width of the column, and the \leftskip + % will keep entries from bumping into each other. Table will start at + % left margin and final column will justify at right margin. + % + % Make sure we don't inherit \rightskip from the outer environment. + \rightskip=0pt + \ifnum\colcount=1 + % The first column will be indented with the surrounding text. + \advance\hsize by\leftskip + \else + \ifsetpercent \else + % If user has not set preamble in terms of percent of \hsize + % we will advance \hsize by \multitablecolspace. + \advance\hsize by \multitablecolspace + \fi + % In either case we will make \leftskip=\multitablecolspace: + \leftskip=\multitablecolspace + \fi + % Ignoring space at the beginning and end avoids an occasional spurious + % blank line, when TeX decides to break the line at the space before the + % box from the multistrut, so the strut ends up on a line by itself. + % For example: + % @multitable @columnfractions .11 .89 + % @item @code{#} + % @tab Legal holiday which is valid in major parts of the whole country. + % Is automatically provided with highlighting sequences respectively + % marking characters. + \noindent\ignorespaces##\unskip\multistrut + }\cr +} +\def\Emultitable{% + \crcr + \egroup % end the \halign + \global\setpercentfalse +} + +\def\setmultitablespacing{% + \def\multistrut{\strut}% just use the standard line spacing + % + % Compute \multitablelinespace (if not defined by user) for use in + % \multitableparskip calculation. We used define \multistrut based on + % this, but (ironically) that caused the spacing to be off. + % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. +\ifdim\multitablelinespace=0pt +\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip +\global\advance\multitablelinespace by-\ht0 +\fi +%% Test to see if parskip is larger than space between lines of +%% table. If not, do nothing. +%% If so, set to same dimension as multitablelinespace. +\ifdim\multitableparskip>\multitablelinespace +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi% +\ifdim\multitableparskip=0pt +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi} + + +\message{conditionals,} + +% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, +% @ifnotxml always succeed. They currently do nothing; we don't +% attempt to check whether the conditionals are properly nested. But we +% have to remember that they are conditionals, so that @end doesn't +% attempt to close an environment group. +% +\def\makecond#1{% + \expandafter\let\csname #1\endcsname = \relax + \expandafter\let\csname iscond.#1\endcsname = 1 +} +\makecond{iftex} +\makecond{ifnotdocbook} +\makecond{ifnothtml} +\makecond{ifnotinfo} +\makecond{ifnotplaintext} +\makecond{ifnotxml} + +% Ignore @ignore, @ifhtml, @ifinfo, and the like. +% +\def\direntry{\doignore{direntry}} +\def\documentdescription{\doignore{documentdescription}} +\def\docbook{\doignore{docbook}} +\def\html{\doignore{html}} +\def\ifdocbook{\doignore{ifdocbook}} +\def\ifhtml{\doignore{ifhtml}} +\def\ifinfo{\doignore{ifinfo}} +\def\ifnottex{\doignore{ifnottex}} +\def\ifplaintext{\doignore{ifplaintext}} +\def\ifxml{\doignore{ifxml}} +\def\ignore{\doignore{ignore}} +\def\menu{\doignore{menu}} +\def\xml{\doignore{xml}} + +% Ignore text until a line `@end #1', keeping track of nested conditionals. +% +% A count to remember the depth of nesting. +\newcount\doignorecount + +\def\doignore#1{\begingroup + % Scan in ``verbatim'' mode: + \catcode`\@ = \other + \catcode`\{ = \other + \catcode`\} = \other + % + % Make sure that spaces turn into tokens that match what \doignoretext wants. + \spaceisspace + % + % Count number of #1's that we've seen. + \doignorecount = 0 + % + % Swallow text until we reach the matching `@end #1'. + \dodoignore{#1}% +} + +{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. + \obeylines % + % + \gdef\dodoignore#1{% + % #1 contains the command name as a string, e.g., `ifinfo'. + % + % Define a command to find the next `@end #1', which must be on a line + % by itself. + \long\def\doignoretext##1^^M@end #1{\doignoretextyyy##1^^M@#1\_STOP_}% + % And this command to find another #1 command, at the beginning of a + % line. (Otherwise, we would consider a line `@c @ifset', for + % example, to count as an @ifset for nesting.) + \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% + % + % And now expand that command. + \obeylines % + \doignoretext ^^M% + }% +} + +\def\doignoreyyy#1{% + \def\temp{#1}% + \ifx\temp\empty % Nothing found. + \let\next\doignoretextzzz + \else % Found a nested condition, ... + \advance\doignorecount by 1 + \let\next\doignoretextyyy % ..., look for another. + % If we're here, #1 ends with ^^M\ifinfo (for example). + \fi + \next #1% the token \_STOP_ is present just after this macro. +} + +% We have to swallow the remaining "\_STOP_". +% +\def\doignoretextzzz#1{% + \ifnum\doignorecount = 0 % We have just found the outermost @end. + \let\next\enddoignore + \else % Still inside a nested condition. + \advance\doignorecount by -1 + \let\next\doignoretext % Look for the next @end. + \fi + \next +} + +% Finish off ignored text. +\def\enddoignore{\endgroup\ignorespaces} + + +% @set VAR sets the variable VAR to an empty value. +% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. +% +% Since we want to separate VAR from REST-OF-LINE (which might be +% empty), we can't just use \parsearg; we have to insert a space of our +% own to delimit the rest of the line, and then take it out again if we +% didn't need it. +% We rely on the fact that \parsearg sets \catcode`\ =10. +% +\parseargdef\set{\setyyy#1 \endsetyyy} +\def\setyyy#1 #2\endsetyyy{% + {% + \makevalueexpandable + \def\temp{#2}% + \edef\next{\gdef\makecsname{SET#1}}% + \ifx\temp\empty + \next{}% + \else + \setzzz#2\endsetzzz + \fi + }% +} +% Remove the trailing space \setxxx inserted. +\def\setzzz#1 \endsetzzz{\next{#1}} + +% @clear VAR clears (i.e., unsets) the variable VAR. +% +\parseargdef\clear{% + {% + \makevalueexpandable + \global\expandafter\let\csname SET#1\endcsname=\relax + }% +} + +% @value{foo} gets the text saved in variable foo. +\def\value{\begingroup\makevalueexpandable\valuexxx} +\def\valuexxx#1{\expandablevalue{#1}\endgroup} +{ + \catcode`\- = \active \catcode`\_ = \active + % + \gdef\makevalueexpandable{% + \let\value = \expandablevalue + % We don't want these characters active, ... + \catcode`\-=\other \catcode`\_=\other + % ..., but we might end up with active ones in the argument if + % we're called from @code, as @code{@value{foo-bar_}}, though. + % So \let them to their normal equivalents. + \let-\realdash \let_\normalunderscore + } +} + +% We have this subroutine so that we can handle at least some @value's +% properly in indexes (we call \makevalueexpandable in \indexdummies). +% The command has to be fully expandable (if the variable is set), since +% the result winds up in the index file. This means that if the +% variable's value contains other Texinfo commands, it's almost certain +% it will fail (although perhaps we could fix that with sufficient work +% to do a one-level expansion on the result, instead of complete). +% +\def\expandablevalue#1{% + \expandafter\ifx\csname SET#1\endcsname\relax + {[No value for ``#1'']}% + \message{Variable `#1', used in @value, is not set.}% + \else + \csname SET#1\endcsname + \fi +} + +% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined +% with @set. +% +% To get special treatment of `@end ifset,' call \makeond and the redefine. +% +\makecond{ifset} +\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} +\def\doifset#1#2{% + {% + \makevalueexpandable + \let\next=\empty + \expandafter\ifx\csname SET#2\endcsname\relax + #1% If not set, redefine \next. + \fi + \expandafter + }\next +} +\def\ifsetfail{\doignore{ifset}} + +% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been +% defined with @set, or has been undefined with @clear. +% +% The `\else' inside the `\doifset' parameter is a trick to reuse the +% above code: if the variable is not set, do nothing, if it is set, +% then redefine \next to \ifclearfail. +% +\makecond{ifclear} +\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} +\def\ifclearfail{\doignore{ifclear}} + +% @dircategory CATEGORY -- specify a category of the dir file +% which this file should belong to. Ignore this in TeX. +\let\dircategory=\comment + +% @defininfoenclose. +\let\definfoenclose=\comment + + +\message{indexing,} +% Index generation facilities + +% Define \newwrite to be identical to plain tex's \newwrite +% except not \outer, so it can be used within macros and \if's. +\edef\newwrite{\makecsname{ptexnewwrite}} + +% \newindex {foo} defines an index named foo. +% It automatically defines \fooindex such that +% \fooindex ...rest of line... puts an entry in the index foo. +% It also defines \fooindfile to be the number of the output channel for +% the file that accumulates this index. The file's extension is foo. +% The name of an index should be no more than 2 characters long +% for the sake of vms. +% +\def\newindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 % Open the file + \fi + \expandafter\xdef\csname#1index\endcsname{% % Define @#1index + \noexpand\doindex{#1}} +} + +% @defindex foo == \newindex{foo} +% +\def\defindex{\parsearg\newindex} + +% Define @defcodeindex, like @defindex except put all entries in @code. +% +\def\defcodeindex{\parsearg\newcodeindex} +% +\def\newcodeindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 + \fi + \expandafter\xdef\csname#1index\endcsname{% + \noexpand\docodeindex{#1}}% +} + + +% @synindex foo bar makes index foo feed into index bar. +% Do this instead of @defindex foo if you don't want it as a separate index. +% +% @syncodeindex foo bar similar, but put all entries made for index foo +% inside @code. +% +\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} +\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} + +% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), +% #3 the target index (bar). +\def\dosynindex#1#2#3{% + % Only do \closeout if we haven't already done it, else we'll end up + % closing the target index. + \expandafter \ifx\csname donesynindex#2\endcsname \undefined + % The \closeout helps reduce unnecessary open files; the limit on the + % Acorn RISC OS is a mere 16 files. + \expandafter\closeout\csname#2indfile\endcsname + \expandafter\let\csname\donesynindex#2\endcsname = 1 + \fi + % redefine \fooindfile: + \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname + \expandafter\let\csname#2indfile\endcsname=\temp + % redefine \fooindex: + \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% +} + +% Define \doindex, the driver for all \fooindex macros. +% Argument #1 is generated by the calling \fooindex macro, +% and it is "foo", the name of the index. + +% \doindex just uses \parsearg; it calls \doind for the actual work. +% This is because \doind is more useful to call from other macros. + +% There is also \dosubind {index}{topic}{subtopic} +% which makes an entry in a two-level index such as the operation index. + +\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} +\def\singleindexer #1{\doind{\indexname}{#1}} + +% like the previous two, but they put @code around the argument. +\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} +\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} + +% Take care of Texinfo commands that can appear in an index entry. +% Since there are some commands we want to expand, and others we don't, +% we have to laboriously prevent expansion for those that we don't. +% +\def\indexdummies{% + \def\@{@}% change to @@ when we switch to @ as escape char in index files. + \def\ {\realbackslash\space }% + % Need these in case \tex is in effect and \{ is a \delimiter again. + % But can't use \lbracecmd and \rbracecmd because texindex assumes + % braces and backslashes are used only as delimiters. + \let\{ = \mylbrace + \let\} = \myrbrace + % + % \definedummyword defines \#1 as \realbackslash #1\space, thus + % effectively preventing its expansion. This is used only for control + % words, not control letters, because the \space would be incorrect + % for control characters, but is needed to separate the control word + % from whatever follows. + % + % For control letters, we have \definedummyletter, which omits the + % space. + % + % These can be used both for control words that take an argument and + % those that do not. If it is followed by {arg} in the input, then + % that will dutifully get written to the index (or wherever). + % + \def\definedummyword##1{% + \expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}% + }% + \def\definedummyletter##1{% + \expandafter\def\csname ##1\endcsname{\realbackslash ##1}% + }% + \let\definedummyaccent\definedummyletter + % + % Do the redefinitions. + \commondummies +} + +% For the aux file, @ is the escape character. So we want to redefine +% everything using @ instead of \realbackslash. When everything uses +% @, this will be simpler. +% +\def\atdummies{% + \def\@{@@}% + \def\ {@ }% + \let\{ = \lbraceatcmd + \let\} = \rbraceatcmd + % + % (See comments in \indexdummies.) + \def\definedummyword##1{% + \expandafter\def\csname ##1\endcsname{@##1\space}% + }% + \def\definedummyletter##1{% + \expandafter\def\csname ##1\endcsname{@##1}% + }% + \let\definedummyaccent\definedummyletter + % + % Do the redefinitions. + \commondummies +} + +% Called from \indexdummies and \atdummies. \definedummyword and +% \definedummyletter must be defined first. +% +\def\commondummies{% + % + \normalturnoffactive + % + \commondummiesnofonts + % + \definedummyletter{_}% + % + % Non-English letters. + \definedummyword{AA}% + \definedummyword{AE}% + \definedummyword{L}% + \definedummyword{OE}% + \definedummyword{O}% + \definedummyword{aa}% + \definedummyword{ae}% + \definedummyword{l}% + \definedummyword{oe}% + \definedummyword{o}% + \definedummyword{ss}% + \definedummyword{exclamdown}% + \definedummyword{questiondown}% + \definedummyword{ordf}% + \definedummyword{ordm}% + % + % Although these internal commands shouldn't show up, sometimes they do. + \definedummyword{bf}% + \definedummyword{gtr}% + \definedummyword{hat}% + \definedummyword{less}% + \definedummyword{sf}% + \definedummyword{sl}% + \definedummyword{tclose}% + \definedummyword{tt}% + % + \definedummyword{LaTeX}% + \definedummyword{TeX}% + % + % Assorted special characters. + \definedummyword{bullet}% + \definedummyword{comma}% + \definedummyword{copyright}% + \definedummyword{registeredsymbol}% + \definedummyword{dots}% + \definedummyword{enddots}% + \definedummyword{equiv}% + \definedummyword{error}% + \definedummyword{euro}% + \definedummyword{expansion}% + \definedummyword{minus}% + \definedummyword{pounds}% + \definedummyword{point}% + \definedummyword{print}% + \definedummyword{result}% + % + % Handle some cases of @value -- where it does not contain any + % (non-fully-expandable) commands. + \makevalueexpandable + % + % Normal spaces, not active ones. + \unsepspaces + % + % No macro expansion. + \turnoffmacros +} + +% \commondummiesnofonts: common to \commondummies and \indexnofonts. +% +% Better have this without active chars. +{ + \catcode`\~=\other + \gdef\commondummiesnofonts{% + % Control letters and accents. + \definedummyletter{!}% + \definedummyaccent{"}% + \definedummyaccent{'}% + \definedummyletter{*}% + \definedummyaccent{,}% + \definedummyletter{.}% + \definedummyletter{/}% + \definedummyletter{:}% + \definedummyaccent{=}% + \definedummyletter{?}% + \definedummyaccent{^}% + \definedummyaccent{`}% + \definedummyaccent{~}% + \definedummyword{u}% + \definedummyword{v}% + \definedummyword{H}% + \definedummyword{dotaccent}% + \definedummyword{ringaccent}% + \definedummyword{tieaccent}% + \definedummyword{ubaraccent}% + \definedummyword{udotaccent}% + \definedummyword{dotless}% + % + % Texinfo font commands. + \definedummyword{b}% + \definedummyword{i}% + \definedummyword{r}% + \definedummyword{sc}% + \definedummyword{t}% + % + % Commands that take arguments. + \definedummyword{acronym}% + \definedummyword{cite}% + \definedummyword{code}% + \definedummyword{command}% + \definedummyword{dfn}% + \definedummyword{emph}% + \definedummyword{env}% + \definedummyword{file}% + \definedummyword{kbd}% + \definedummyword{key}% + \definedummyword{math}% + \definedummyword{option}% + \definedummyword{samp}% + \definedummyword{strong}% + \definedummyword{tie}% + \definedummyword{uref}% + \definedummyword{url}% + \definedummyword{var}% + \definedummyword{verb}% + \definedummyword{w}% + } +} + +% \indexnofonts is used when outputting the strings to sort the index +% by, and when constructing control sequence names. It eliminates all +% control sequences and just writes whatever the best ASCII sort string +% would be for a given command (usually its argument). +% +\def\indexnofonts{% + % Accent commands should become @asis. + \def\definedummyaccent##1{% + \expandafter\let\csname ##1\endcsname\asis + }% + % We can just ignore other control letters. + \def\definedummyletter##1{% + \expandafter\def\csname ##1\endcsname{}% + }% + % Hopefully, all control words can become @asis. + \let\definedummyword\definedummyaccent + % + \commondummiesnofonts + % + % Don't no-op \tt, since it isn't a user-level command + % and is used in the definitions of the active chars like <, >, |, etc. + % Likewise with the other plain tex font commands. + %\let\tt=\asis + % + \def\ { }% + \def\@{@}% + % how to handle braces? + \def\_{\normalunderscore}% + % + % Non-English letters. + \def\AA{AA}% + \def\AE{AE}% + \def\L{L}% + \def\OE{OE}% + \def\O{O}% + \def\aa{aa}% + \def\ae{ae}% + \def\l{l}% + \def\oe{oe}% + \def\o{o}% + \def\ss{ss}% + \def\exclamdown{!}% + \def\questiondown{?}% + \def\ordf{a}% + \def\ordm{o}% + % + \def\LaTeX{LaTeX}% + \def\TeX{TeX}% + % + % Assorted special characters. + % (The following {} will end up in the sort string, but that's ok.) + \def\bullet{bullet}% + \def\comma{,}% + \def\copyright{copyright}% + \def\registeredsymbol{R}% + \def\dots{...}% + \def\enddots{...}% + \def\equiv{==}% + \def\error{error}% + \def\euro{euro}% + \def\expansion{==>}% + \def\minus{-}% + \def\pounds{pounds}% + \def\point{.}% + \def\print{-|}% + \def\result{=>}% + % + % Don't write macro names. + \emptyusermacros +} + +\let\indexbackslash=0 %overridden during \printindex. +\let\SETmarginindex=\relax % put index entries in margin (undocumented)? + +% Most index entries go through here, but \dosubind is the general case. +% #1 is the index name, #2 is the entry text. +\def\doind#1#2{\dosubind{#1}{#2}{}} + +% Workhorse for all \fooindexes. +% #1 is name of index, #2 is stuff to put there, #3 is subentry -- +% empty if called from \doind, as we usually are (the main exception +% is with most defuns, which call us directly). +% +\def\dosubind#1#2#3{% + \iflinks + {% + % Store the main index entry text (including the third arg). + \toks0 = {#2}% + % If third arg is present, precede it with a space. + \def\thirdarg{#3}% + \ifx\thirdarg\empty \else + \toks0 = \expandafter{\the\toks0 \space #3}% + \fi + % + \edef\writeto{\csname#1indfile\endcsname}% + % + \ifvmode + \dosubindsanitize + \else + \dosubindwrite + \fi + }% + \fi +} + +% Write the entry in \toks0 to the index file: +% +\def\dosubindwrite{% + % Put the index entry in the margin if desired. + \ifx\SETmarginindex\relax\else + \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% + \fi + % + % Remember, we are within a group. + \indexdummies % Must do this here, since \bf, etc expand at this stage + \escapechar=`\\ + \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now + % so it will be output as is; and it will print as backslash. + % + % Process the index entry with all font commands turned off, to + % get the string to sort by. + {\indexnofonts + \edef\temp{\the\toks0}% need full expansion + \xdef\indexsorttmp{\temp}% + }% + % + % Set up the complete index entry, with both the sort key and + % the original text, including any font commands. We write + % three arguments to \entry to the .?? file (four in the + % subentry case), texindex reduces to two when writing the .??s + % sorted result. + \edef\temp{% + \write\writeto{% + \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% + }% + \temp +} + +% Take care of unwanted page breaks: +% +% If a skip is the last thing on the list now, preserve it +% by backing up by \lastskip, doing the \write, then inserting +% the skip again. Otherwise, the whatsit generated by the +% \write will make \lastskip zero. The result is that sequences +% like this: +% @end defun +% @tindex whatever +% @defun ... +% will have extra space inserted, because the \medbreak in the +% start of the @defun won't see the skip inserted by the @end of +% the previous defun. +% +% But don't do any of this if we're not in vertical mode. We +% don't want to do a \vskip and prematurely end a paragraph. +% +% Avoid page breaks due to these extra skips, too. +% +% But wait, there is a catch there: +% We'll have to check whether \lastskip is zero skip. \ifdim is not +% sufficient for this purpose, as it ignores stretch and shrink parts +% of the skip. The only way seems to be to check the textual +% representation of the skip. +% +% The following is almost like \def\zeroskipmacro{0.0pt} except that +% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). +% +\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} +% +% ..., ready, GO: +% +\def\dosubindsanitize{% + % \lastskip and \lastpenalty cannot both be nonzero simultaneously. + \skip0 = \lastskip + \edef\lastskipmacro{\the\lastskip}% + \count255 = \lastpenalty + % + % If \lastskip is nonzero, that means the last item was a + % skip. And since a skip is discardable, that means this + % -\skip0 glue we're inserting is preceded by a + % non-discardable item, therefore it is not a potential + % breakpoint, therefore no \nobreak needed. + \ifx\lastskipmacro\zeroskipmacro + \else + \vskip-\skip0 + \fi + % + \dosubindwrite + % + \ifx\lastskipmacro\zeroskipmacro + % If \lastskip was zero, perhaps the last item was a penalty, and + % perhaps it was >=10000, e.g., a \nobreak. In that case, we want + % to re-insert the same penalty (values >10000 are used for various + % signals); since we just inserted a non-discardable item, any + % following glue (such as a \parskip) would be a breakpoint. For example: + % + % @deffn deffn-whatever + % @vindex index-whatever + % Description. + % would allow a break between the index-whatever whatsit + % and the "Description." paragraph. + \ifnum\count255>9999 \penalty\count255 \fi + \else + % On the other hand, if we had a nonzero \lastskip, + % this make-up glue would be preceded by a non-discardable item + % (the whatsit from the \write), so we must insert a \nobreak. + \nobreak\vskip\skip0 + \fi +} + +% The index entry written in the file actually looks like +% \entry {sortstring}{page}{topic} +% or +% \entry {sortstring}{page}{topic}{subtopic} +% The texindex program reads in these files and writes files +% containing these kinds of lines: +% \initial {c} +% before the first topic whose initial is c +% \entry {topic}{pagelist} +% for a topic that is used without subtopics +% \primary {topic} +% for the beginning of a topic that is used with subtopics +% \secondary {subtopic}{pagelist} +% for each subtopic. + +% Define the user-accessible indexing commands +% @findex, @vindex, @kindex, @cindex. + +\def\findex {\fnindex} +\def\kindex {\kyindex} +\def\cindex {\cpindex} +\def\vindex {\vrindex} +\def\tindex {\tpindex} +\def\pindex {\pgindex} + +\def\cindexsub {\begingroup\obeylines\cindexsub} +{\obeylines % +\gdef\cindexsub "#1" #2^^M{\endgroup % +\dosubind{cp}{#2}{#1}}} + +% Define the macros used in formatting output of the sorted index material. + +% @printindex causes a particular index (the ??s file) to get printed. +% It does not print any chapter heading (usually an @unnumbered). +% +\parseargdef\printindex{\begingroup + \dobreak \chapheadingskip{10000}% + % + \smallfonts \rm + \tolerance = 9500 + \everypar = {}% don't want the \kern\-parindent from indentation suppression. + % + % See if the index file exists and is nonempty. + % Change catcode of @ here so that if the index file contains + % \initial {@} + % as its first line, TeX doesn't complain about mismatched braces + % (because it thinks @} is a control sequence). + \catcode`\@ = 11 + \openin 1 \jobname.#1s + \ifeof 1 + % \enddoublecolumns gets confused if there is no text in the index, + % and it loses the chapter title and the aux file entries for the + % index. The easiest way to prevent this problem is to make sure + % there is some text. + \putwordIndexNonexistent + \else + % + % If the index file exists but is empty, then \openin leaves \ifeof + % false. We have to make TeX try to read something from the file, so + % it can discover if there is anything in it. + \read 1 to \temp + \ifeof 1 + \putwordIndexIsEmpty + \else + % Index files are almost Texinfo source, but we use \ as the escape + % character. It would be better to use @, but that's too big a change + % to make right now. + \def\indexbackslash{\backslashcurfont}% + \catcode`\\ = 0 + \escapechar = `\\ + \begindoublecolumns + \input \jobname.#1s + \enddoublecolumns + \fi + \fi + \closein 1 +\endgroup} + +% These macros are used by the sorted index file itself. +% Change them to control the appearance of the index. + +\def\initial#1{{% + % Some minor font changes for the special characters. + \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt + % + % Remove any glue we may have, we'll be inserting our own. + \removelastskip + % + % We like breaks before the index initials, so insert a bonus. + \nobreak + \vskip 0pt plus 3\baselineskip + \penalty 0 + \vskip 0pt plus -3\baselineskip + % + % Typeset the initial. Making this add up to a whole number of + % baselineskips increases the chance of the dots lining up from column + % to column. It still won't often be perfect, because of the stretch + % we need before each entry, but it's better. + % + % No shrink because it confuses \balancecolumns. + \vskip 1.67\baselineskip plus .5\baselineskip + \leftline{\secbf #1}% + % Do our best not to break after the initial. + \nobreak + \vskip .33\baselineskip plus .1\baselineskip +}} + +% \entry typesets a paragraph consisting of the text (#1), dot leaders, and +% then page number (#2) flushed to the right margin. It is used for index +% and table of contents entries. The paragraph is indented by \leftskip. +% +% A straightforward implementation would start like this: +% \def\entry#1#2{... +% But this frozes the catcodes in the argument, and can cause problems to +% @code, which sets - active. This problem was fixed by a kludge--- +% ``-'' was active throughout whole index, but this isn't really right. +% +% The right solution is to prevent \entry from swallowing the whole text. +% --kasal, 21nov03 +\def\entry{% + \begingroup + % + % Start a new paragraph if necessary, so our assignments below can't + % affect previous text. + \par + % + % Do not fill out the last line with white space. + \parfillskip = 0in + % + % No extra space above this paragraph. + \parskip = 0in + % + % Do not prefer a separate line ending with a hyphen to fewer lines. + \finalhyphendemerits = 0 + % + % \hangindent is only relevant when the entry text and page number + % don't both fit on one line. In that case, bob suggests starting the + % dots pretty far over on the line. Unfortunately, a large + % indentation looks wrong when the entry text itself is broken across + % lines. So we use a small indentation and put up with long leaders. + % + % \hangafter is reset to 1 (which is the value we want) at the start + % of each paragraph, so we need not do anything with that. + \hangindent = 2em + % + % When the entry text needs to be broken, just fill out the first line + % with blank space. + \rightskip = 0pt plus1fil + % + % A bit of stretch before each entry for the benefit of balancing + % columns. + \vskip 0pt plus1pt + % + % Swallow the left brace of the text (first parameter): + \afterassignment\doentry + \let\temp = +} +\def\doentry{% + \bgroup % Instead of the swallowed brace. + \noindent + \aftergroup\finishentry + % And now comes the text of the entry. +} +\def\finishentry#1{% + % #1 is the page number. + % + % The following is kludged to not output a line of dots in the index if + % there are no page numbers. The next person who breaks this will be + % cursed by a Unix daemon. + \def\tempa{{\rm }}% + \def\tempb{#1}% + \edef\tempc{\tempa}% + \edef\tempd{\tempb}% + \ifx\tempc\tempd + \ % + \else + % + % If we must, put the page number on a line of its own, and fill out + % this line with blank space. (The \hfil is overwhelmed with the + % fill leaders glue in \indexdotfill if the page number does fit.) + \hfil\penalty50 + \null\nobreak\indexdotfill % Have leaders before the page number. + % + % The `\ ' here is removed by the implicit \unskip that TeX does as + % part of (the primitive) \par. Without it, a spurious underfull + % \hbox ensues. + \ifpdf + \pdfgettoks#1.% + \ \the\toksA + \else + \ #1% + \fi + \fi + \par + \endgroup +} + +% Like \dotfill except takes at least 1 em. +\def\indexdotfill{\cleaders + \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} + +\def\primary #1{\line{#1\hfil}} + +\newskip\secondaryindent \secondaryindent=0.5cm +\def\secondary#1#2{{% + \parfillskip=0in + \parskip=0in + \hangindent=1in + \hangafter=1 + \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill + \ifpdf + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. + \else + #2 + \fi + \par +}} + +% Define two-column mode, which we use to typeset indexes. +% Adapted from the TeXbook, page 416, which is to say, +% the manmac.tex format used to print the TeXbook itself. +\catcode`\@=11 + +\newbox\partialpage +\newdimen\doublecolumnhsize + +\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns + % Grab any single-column material above us. + \output = {% + % + % Here is a possibility not foreseen in manmac: if we accumulate a + % whole lot of material, we might end up calling this \output + % routine twice in a row (see the doublecol-lose test, which is + % essentially a couple of indexes with @setchapternewpage off). In + % that case we just ship out what is in \partialpage with the normal + % output routine. Generally, \partialpage will be empty when this + % runs and this will be a no-op. See the indexspread.tex test case. + \ifvoid\partialpage \else + \onepageout{\pagecontents\partialpage}% + \fi + % + \global\setbox\partialpage = \vbox{% + % Unvbox the main output page. + \unvbox\PAGE + \kern-\topskip \kern\baselineskip + }% + }% + \eject % run that output routine to set \partialpage + % + % Use the double-column output routine for subsequent pages. + \output = {\doublecolumnout}% + % + % Change the page size parameters. We could do this once outside this + % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 + % format, but then we repeat the same computation. Repeating a couple + % of assignments once per index is clearly meaningless for the + % execution time, so we may as well do it in one place. + % + % First we halve the line length, less a little for the gutter between + % the columns. We compute the gutter based on the line length, so it + % changes automatically with the paper format. The magic constant + % below is chosen so that the gutter has the same value (well, +-<1pt) + % as it did when we hard-coded it. + % + % We put the result in a separate register, \doublecolumhsize, so we + % can restore it in \pagesofar, after \hsize itself has (potentially) + % been clobbered. + % + \doublecolumnhsize = \hsize + \advance\doublecolumnhsize by -.04154\hsize + \divide\doublecolumnhsize by 2 + \hsize = \doublecolumnhsize + % + % Double the \vsize as well. (We don't need a separate register here, + % since nobody clobbers \vsize.) + \vsize = 2\vsize +} + +% The double-column output routine for all double-column pages except +% the last. +% +\def\doublecolumnout{% + \splittopskip=\topskip \splitmaxdepth=\maxdepth + % Get the available space for the double columns -- the normal + % (undoubled) page height minus any material left over from the + % previous page. + \dimen@ = \vsize + \divide\dimen@ by 2 + \advance\dimen@ by -\ht\partialpage + % + % box0 will be the left-hand column, box2 the right. + \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ + \onepageout\pagesofar + \unvbox255 + \penalty\outputpenalty +} +% +% Re-output the contents of the output page -- any previous material, +% followed by the two boxes we just split, in box0 and box2. +\def\pagesofar{% + \unvbox\partialpage + % + \hsize = \doublecolumnhsize + \wd0=\hsize \wd2=\hsize + \hbox to\pagewidth{\box0\hfil\box2}% +} +% +% All done with double columns. +\def\enddoublecolumns{% + \output = {% + % Split the last of the double-column material. Leave it on the + % current page, no automatic page break. + \balancecolumns + % + % If we end up splitting too much material for the current page, + % though, there will be another page break right after this \output + % invocation ends. Having called \balancecolumns once, we do not + % want to call it again. Therefore, reset \output to its normal + % definition right away. (We hope \balancecolumns will never be + % called on to balance too much material, but if it is, this makes + % the output somewhat more palatable.) + \global\output = {\onepageout{\pagecontents\PAGE}}% + }% + \eject + \endgroup % started in \begindoublecolumns + % + % \pagegoal was set to the doubled \vsize above, since we restarted + % the current page. We're now back to normal single-column + % typesetting, so reset \pagegoal to the normal \vsize (after the + % \endgroup where \vsize got restored). + \pagegoal = \vsize +} +% +% Called at the end of the double column material. +\def\balancecolumns{% + \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. + \dimen@ = \ht0 + \advance\dimen@ by \topskip + \advance\dimen@ by-\baselineskip + \divide\dimen@ by 2 % target to split to + %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% + \splittopskip = \topskip + % Loop until we get a decent breakpoint. + {% + \vbadness = 10000 + \loop + \global\setbox3 = \copy0 + \global\setbox1 = \vsplit3 to \dimen@ + \ifdim\ht3>\dimen@ + \global\advance\dimen@ by 1pt + \repeat + }% + %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% + \setbox0=\vbox to\dimen@{\unvbox1}% + \setbox2=\vbox to\dimen@{\unvbox3}% + % + \pagesofar +} +\catcode`\@ = \other + + +\message{sectioning,} +% Chapters, sections, etc. + +% \unnumberedno is an oxymoron, of course. But we count the unnumbered +% sections so that we can refer to them unambiguously in the pdf +% outlines by their "section number". We avoid collisions with chapter +% numbers by starting them at 10000. (If a document ever has 10000 +% chapters, we're in trouble anyway, I'm sure.) +\newcount\unnumberedno \unnumberedno = 10000 +\newcount\chapno +\newcount\secno \secno=0 +\newcount\subsecno \subsecno=0 +\newcount\subsubsecno \subsubsecno=0 + +% This counter is funny since it counts through charcodes of letters A, B, ... +\newcount\appendixno \appendixno = `\@ +% +% \def\appendixletter{\char\the\appendixno} +% We do the following ugly conditional instead of the above simple +% construct for the sake of pdftex, which needs the actual +% letter in the expansion, not just typeset. +% +\def\appendixletter{% + \ifnum\appendixno=`A A% + \else\ifnum\appendixno=`B B% + \else\ifnum\appendixno=`C C% + \else\ifnum\appendixno=`D D% + \else\ifnum\appendixno=`E E% + \else\ifnum\appendixno=`F F% + \else\ifnum\appendixno=`G G% + \else\ifnum\appendixno=`H H% + \else\ifnum\appendixno=`I I% + \else\ifnum\appendixno=`J J% + \else\ifnum\appendixno=`K K% + \else\ifnum\appendixno=`L L% + \else\ifnum\appendixno=`M M% + \else\ifnum\appendixno=`N N% + \else\ifnum\appendixno=`O O% + \else\ifnum\appendixno=`P P% + \else\ifnum\appendixno=`Q Q% + \else\ifnum\appendixno=`R R% + \else\ifnum\appendixno=`S S% + \else\ifnum\appendixno=`T T% + \else\ifnum\appendixno=`U U% + \else\ifnum\appendixno=`V V% + \else\ifnum\appendixno=`W W% + \else\ifnum\appendixno=`X X% + \else\ifnum\appendixno=`Y Y% + \else\ifnum\appendixno=`Z Z% + % The \the is necessary, despite appearances, because \appendixletter is + % expanded while writing the .toc file. \char\appendixno is not + % expandable, thus it is written literally, thus all appendixes come out + % with the same letter (or @) in the toc without it. + \else\char\the\appendixno + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} + +% Each @chapter defines this as the name of the chapter. +% page headings and footings can use it. @section does likewise. +% However, they are not reliable, because we don't use marks. +\def\thischapter{} +\def\thissection{} + +\newcount\absseclevel % used to calculate proper heading level +\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count + +% @raisesections: treat @section as chapter, @subsection as section, etc. +\def\raisesections{\global\advance\secbase by -1} +\let\up=\raisesections % original BFox name + +% @lowersections: treat @chapter as section, @section as subsection, etc. +\def\lowersections{\global\advance\secbase by 1} +\let\down=\lowersections % original BFox name + +% we only have subsub. +\chardef\maxseclevel = 3 +% +% A numbered section within an unnumbered changes to unnumbered too. +% To achive this, remember the "biggest" unnum. sec. we are currently in: +\chardef\unmlevel = \maxseclevel +% +% Trace whether the current chapter is an appendix or not: +% \chapheadtype is "N" or "A", unnumbered chapters are ignored. +\def\chapheadtype{N} + +% Choose a heading macro +% #1 is heading type +% #2 is heading level +% #3 is text for heading +\def\genhead#1#2#3{% + % Compute the abs. sec. level: + \absseclevel=#2 + \advance\absseclevel by \secbase + % Make sure \absseclevel doesn't fall outside the range: + \ifnum \absseclevel < 0 + \absseclevel = 0 + \else + \ifnum \absseclevel > 3 + \absseclevel = 3 + \fi + \fi + % The heading type: + \def\headtype{#1}% + \if \headtype U% + \ifnum \absseclevel < \unmlevel + \chardef\unmlevel = \absseclevel + \fi + \else + % Check for appendix sections: + \ifnum \absseclevel = 0 + \edef\chapheadtype{\headtype}% + \else + \if \headtype A\if \chapheadtype N% + \errmessage{@appendix... within a non-appendix chapter}% + \fi\fi + \fi + % Check for numbered within unnumbered: + \ifnum \absseclevel > \unmlevel + \def\headtype{U}% + \else + \chardef\unmlevel = 3 + \fi + \fi + % Now print the heading: + \if \headtype U% + \ifcase\absseclevel + \unnumberedzzz{#3}% + \or \unnumberedseczzz{#3}% + \or \unnumberedsubseczzz{#3}% + \or \unnumberedsubsubseczzz{#3}% + \fi + \else + \if \headtype A% + \ifcase\absseclevel + \appendixzzz{#3}% + \or \appendixsectionzzz{#3}% + \or \appendixsubseczzz{#3}% + \or \appendixsubsubseczzz{#3}% + \fi + \else + \ifcase\absseclevel + \chapterzzz{#3}% + \or \seczzz{#3}% + \or \numberedsubseczzz{#3}% + \or \numberedsubsubseczzz{#3}% + \fi + \fi + \fi + \suppressfirstparagraphindent +} + +% an interface: +\def\numhead{\genhead N} +\def\apphead{\genhead A} +\def\unnmhead{\genhead U} + +% @chapter, @appendix, @unnumbered. Increment top-level counter, reset +% all lower-level sectioning counters to zero. +% +% Also set \chaplevelprefix, which we prepend to @float sequence numbers +% (e.g., figures), q.v. By default (before any chapter), that is empty. +\let\chaplevelprefix = \empty +% +\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz +\def\chapterzzz#1{% + % section resetting is \global in case the chapter is in a group, such + % as an @include file. + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\chapno by 1 + % + % Used for \float. + \gdef\chaplevelprefix{\the\chapno.}% + \resetallfloatnos + % + \message{\putwordChapter\space \the\chapno}% + % + % Write the actual heading. + \chapmacro{#1}{Ynumbered}{\the\chapno}% + % + % So @section and the like are numbered underneath this chapter. + \global\let\section = \numberedsec + \global\let\subsection = \numberedsubsec + \global\let\subsubsection = \numberedsubsubsec +} + +\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz +\def\appendixzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\appendixno by 1 + \gdef\chaplevelprefix{\appendixletter.}% + \resetallfloatnos + % + \def\appendixnum{\putwordAppendix\space \appendixletter}% + \message{\appendixnum}% + % + \chapmacro{#1}{Yappendix}{\appendixletter}% + % + \global\let\section = \appendixsec + \global\let\subsection = \appendixsubsec + \global\let\subsubsection = \appendixsubsubsec +} + +\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz +\def\unnumberedzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\unnumberedno by 1 + % + % Since an unnumbered has no number, no prefix for figures. + \global\let\chaplevelprefix = \empty + \resetallfloatnos + % + % This used to be simply \message{#1}, but TeX fully expands the + % argument to \message. Therefore, if #1 contained @-commands, TeX + % expanded them. For example, in `@unnumbered The @cite{Book}', TeX + % expanded @cite (which turns out to cause errors because \cite is meant + % to be executed, not expanded). + % + % Anyway, we don't want the fully-expanded definition of @cite to appear + % as a result of the \message, we just want `@cite' itself. We use + % \the to achieve this: TeX expands \the only once, + % simply yielding the contents of . (We also do this for + % the toc entries.) + \toks0 = {#1}% + \message{(\the\toks0)}% + % + \chapmacro{#1}{Ynothing}{\the\unnumberedno}% + % + \global\let\section = \unnumberedsec + \global\let\subsection = \unnumberedsubsec + \global\let\subsubsection = \unnumberedsubsubsec +} + +% @centerchap is like @unnumbered, but the heading is centered. +\outer\parseargdef\centerchap{% + % Well, we could do the following in a group, but that would break + % an assumption that \chapmacro is called at the outermost level. + % Thus we are safer this way: --kasal, 24feb04 + \let\centerparametersmaybe = \centerparameters + \unnmhead0{#1}% + \let\centerparametersmaybe = \relax +} + +% @top is like @unnumbered. +\let\top\unnumbered + +% Sections. +\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz +\def\seczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% +} + +\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz +\def\appendixsectionzzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% +} +\let\appendixsec\appendixsection + +\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz +\def\unnumberedseczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% +} + +% Subsections. +\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz +\def\numberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% +} + +\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz +\def\appendixsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno}% +} + +\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz +\def\unnumberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno}% +} + +% Subsubsections. +\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz +\def\numberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynumbered}% + {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz +\def\appendixsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz +\def\unnumberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +% These macros control what the section commands do, according +% to what kind of chapter we are in (ordinary, appendix, or unnumbered). +% Define them by default for a numbered chapter. +\let\section = \numberedsec +\let\subsection = \numberedsubsec +\let\subsubsection = \numberedsubsubsec + +% Define @majorheading, @heading and @subheading + +% NOTE on use of \vbox for chapter headings, section headings, and such: +% 1) We use \vbox rather than the earlier \line to permit +% overlong headings to fold. +% 2) \hyphenpenalty is set to 10000 because hyphenation in a +% heading is obnoxious; this forbids it. +% 3) Likewise, headings look best if no \parindent is used, and +% if justification is not attempted. Hence \raggedright. + + +\def\majorheading{% + {\advance\chapheadingskip by 10pt \chapbreak }% + \parsearg\chapheadingzzz +} + +\def\chapheading{\chapbreak \parsearg\chapheadingzzz} +\def\chapheadingzzz#1{% + {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}% + \bigskip \par\penalty 200\relax + \suppressfirstparagraphindent +} + +% @heading, @subheading, @subsubheading. +\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} + +% These macros generate a chapter, section, etc. heading only +% (including whitespace, linebreaking, etc. around it), +% given all the information in convenient, parsed form. + +%%% Args are the skip and penalty (usually negative) +\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} + +%%% Define plain chapter starts, and page on/off switching for it +% Parameter controlling skip before chapter headings (if needed) + +\newskip\chapheadingskip + +\def\chapbreak{\dobreak \chapheadingskip {-4000}} +\def\chappager{\par\vfill\supereject} +\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} + +\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} + +\def\CHAPPAGoff{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chapbreak +\global\let\pagealignmacro=\chappager} + +\def\CHAPPAGon{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chappager +\global\let\pagealignmacro=\chappager +\global\def\HEADINGSon{\HEADINGSsingle}} + +\def\CHAPPAGodd{% +\global\let\contentsalignmacro = \chapoddpage +\global\let\pchapsepmacro=\chapoddpage +\global\let\pagealignmacro=\chapoddpage +\global\def\HEADINGSon{\HEADINGSdouble}} + +\CHAPPAGon + +% Chapter opening. +% +% #1 is the text, #2 is the section type (Ynumbered, Ynothing, +% Yappendix, Yomitfromtoc), #3 the chapter number. +% +% To test against our argument. +\def\Ynothingkeyword{Ynothing} +\def\Yomitfromtockeyword{Yomitfromtoc} +\def\Yappendixkeyword{Yappendix} +% +\def\chapmacro#1#2#3{% + \pchapsepmacro + {% + \chapfonts \rm + % + % Have to define \thissection before calling \donoderef, because the + % xref code eventually uses it. On the other hand, it has to be called + % after \pchapsepmacro, or the headline will change too soon. + \gdef\thissection{#1}% + \gdef\thischaptername{#1}% + % + % Only insert the separating space if we have a chapter/appendix + % number, and don't print the unnumbered ``number''. + \def\temptype{#2}% + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unnchap}% + \gdef\thischapter{#1}% + \else\ifx\temptype\Yomitfromtockeyword + \setbox0 = \hbox{}% contents like unnumbered, but no toc entry + \def\toctype{omit}% + \gdef\thischapter{}% + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% + \def\toctype{app}% + % We don't substitute the actual chapter name into \thischapter + % because we don't want its macros evaluated now. And we don't + % use \thissection because that changes with each section. + % + \xdef\thischapter{\putwordAppendix{} \appendixletter: + \noexpand\thischaptername}% + \else + \setbox0 = \hbox{#3\enspace}% + \def\toctype{numchap}% + \xdef\thischapter{\putwordChapter{} \the\chapno: + \noexpand\thischaptername}% + \fi\fi\fi + % + % Write the toc entry for this chapter. Must come before the + % \donoderef, because we include the current node name in the toc + % entry, and \donoderef resets it to empty. + \writetocentry{\toctype}{#1}{#3}% + % + % For pdftex, we have to write out the node definition (aka, make + % the pdfdest) after any page break, but before the actual text has + % been typeset. If the destination for the pdf outline is after the + % text, then jumping from the outline may wind up with the text not + % being visible, for instance under high magnification. + \donoderef{#2}% + % + % Typeset the actual heading. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \hangindent=\wd0 \centerparametersmaybe + \unhbox0 #1\par}% + }% + \nobreak\bigskip % no page break after a chapter title + \nobreak +} + +% @centerchap -- centered and unnumbered. +\let\centerparametersmaybe = \relax +\def\centerparameters{% + \advance\rightskip by 3\rightskip + \leftskip = \rightskip + \parfillskip = 0pt +} + + +% I don't think this chapter style is supported any more, so I'm not +% updating it with the new noderef stuff. We'll see. --karl, 11aug03. +% +\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} +% +\def\unnchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}\bigskip \par\nobreak +} +\def\chfopen #1#2{\chapoddpage {\chapfonts +\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% +\par\penalty 5000 % +} +\def\centerchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt + \hfill {\rm #1}\hfill}}\bigskip \par\nobreak +} +\def\CHAPFopen{% + \global\let\chapmacro=\chfopen + \global\let\centerchapmacro=\centerchfopen} + + +% Section titles. These macros combine the section number parts and +% call the generic \sectionheading to do the printing. +% +\newskip\secheadingskip +\def\secheadingbreak{\dobreak \secheadingskip{-1000}} + +% Subsection titles. +\newskip\subsecheadingskip +\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} + +% Subsubsection titles. +\def\subsubsecheadingskip{\subsecheadingskip} +\def\subsubsecheadingbreak{\subsecheadingbreak} + + +% Print any size, any type, section title. +% +% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is +% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the +% section number. +% +\def\sectionheading#1#2#3#4{% + {% + % Switch to the right set of fonts. + \csname #2fonts\endcsname \rm + % + % Insert space above the heading. + \csname #2headingbreak\endcsname + % + % Only insert the space after the number if we have a section number. + \def\sectionlevel{#2}% + \def\temptype{#3}% + % + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unn}% + \gdef\thissection{#1}% + \else\ifx\temptype\Yomitfromtockeyword + % for @headings -- no section number, don't include in toc, + % and don't redefine \thissection. + \setbox0 = \hbox{}% + \def\toctype{omit}% + \let\sectionlevel=\empty + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{#4\enspace}% + \def\toctype{app}% + \gdef\thissection{#1}% + \else + \setbox0 = \hbox{#4\enspace}% + \def\toctype{num}% + \gdef\thissection{#1}% + \fi\fi\fi + % + % Write the toc entry (before \donoderef). See comments in \chfplain. + \writetocentry{\toctype\sectionlevel}{#1}{#4}% + % + % Write the node reference (= pdf destination for pdftex). + % Again, see comments in \chfplain. + \donoderef{#3}% + % + % Output the actual section heading. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \hangindent=\wd0 % zero if no section number + \unhbox0 #1}% + }% + % Add extra space after the heading -- half of whatever came above it. + % Don't allow stretch, though. + \kern .5 \csname #2headingskip\endcsname + % + % Do not let the kern be a potential breakpoint, as it would be if it + % was followed by glue. + \nobreak + % + % We'll almost certainly start a paragraph next, so don't let that + % glue accumulate. (Not a breakpoint because it's preceded by a + % discardable item.) + \vskip-\parskip + % + % This is purely so the last item on the list is a known \penalty > + % 10000. This is so \startdefun can avoid allowing breakpoints after + % section headings. Otherwise, it would insert a valid breakpoint between: + % + % @section sec-whatever + % @deffn def-whatever + \penalty 10001 +} + + +\message{toc,} +% Table of contents. +\newwrite\tocfile + +% Write an entry to the toc file, opening it if necessary. +% Called from @chapter, etc. +% +% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} +% We append the current node name (if any) and page number as additional +% arguments for the \{chap,sec,...}entry macros which will eventually +% read this. The node name is used in the pdf outlines as the +% destination to jump to. +% +% We open the .toc file for writing here instead of at @setfilename (or +% any other fixed time) so that @contents can be anywhere in the document. +% But if #1 is `omit', then we don't do anything. This is used for the +% table of contents chapter openings themselves. +% +\newif\iftocfileopened +\def\omitkeyword{omit}% +% +\def\writetocentry#1#2#3{% + \edef\writetoctype{#1}% + \ifx\writetoctype\omitkeyword \else + \iftocfileopened\else + \immediate\openout\tocfile = \jobname.toc + \global\tocfileopenedtrue + \fi + % + \iflinks + \toks0 = {#2}% + \toks2 = \expandafter{\lastnode}% + \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}{#3}% + {\the\toks2}{\noexpand\folio}}}% + \temp + \fi + \fi + % + % Tell \shipout to create a pdf destination on each page, if we're + % writing pdf. These are used in the table of contents. We can't + % just write one on every page because the title pages are numbered + % 1 and 2 (the page numbers aren't printed), and so are the first + % two pages of the document. Thus, we'd have two destinations named + % `1', and two named `2'. + \ifpdf \global\pdfmakepagedesttrue \fi +} + +\newskip\contentsrightmargin \contentsrightmargin=1in +\newcount\savepageno +\newcount\lastnegativepageno \lastnegativepageno = -1 + +% Prepare to read what we've written to \tocfile. +% +\def\startcontents#1{% + % If @setchapternewpage on, and @headings double, the contents should + % start on an odd page, unlike chapters. Thus, we maintain + % \contentsalignmacro in parallel with \pagealignmacro. + % From: Torbjorn Granlund + \contentsalignmacro + \immediate\closeout\tocfile + % + % Don't need to put `Contents' or `Short Contents' in the headline. + % It is abundantly clear what they are. + \def\thischapter{}% + \chapmacro{#1}{Yomitfromtoc}{}% + % + \savepageno = \pageno + \begingroup % Set up to handle contents files properly. + \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 + % We can't do this, because then an actual ^ in a section + % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. + %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi + \raggedbottom % Worry more about breakpoints than the bottom. + \advance\hsize by -\contentsrightmargin % Don't use the full line length. + % + % Roman numerals for page numbers. + \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi +} + + +% Normal (long) toc. +\def\contents{% + \startcontents{\putwordTOC}% + \openin 1 \jobname.toc + \ifeof 1 \else + \input \jobname.toc + \fi + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \ifeof 1 \else + \pdfmakeoutlines + \fi + \closein 1 + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} + +% And just the chapters. +\def\summarycontents{% + \startcontents{\putwordShortTOC}% + % + \let\numchapentry = \shortchapentry + \let\appentry = \shortchapentry + \let\unnchapentry = \shortunnchapentry + % We want a true roman here for the page numbers. + \secfonts + \let\rm=\shortcontrm \let\bf=\shortcontbf + \let\sl=\shortcontsl \let\tt=\shortconttt + \rm + \hyphenpenalty = 10000 + \advance\baselineskip by 1pt % Open it up a little. + \def\numsecentry##1##2##3##4{} + \let\appsecentry = \numsecentry + \let\unnsecentry = \numsecentry + \let\numsubsecentry = \numsecentry + \let\appsubsecentry = \numsecentry + \let\unnsubsecentry = \numsecentry + \let\numsubsubsecentry = \numsecentry + \let\appsubsubsecentry = \numsecentry + \let\unnsubsubsecentry = \numsecentry + \openin 1 \jobname.toc + \ifeof 1 \else + \input \jobname.toc + \fi + \closein 1 + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} +\let\shortcontents = \summarycontents + +% Typeset the label for a chapter or appendix for the short contents. +% The arg is, e.g., `A' for an appendix, or `3' for a chapter. +% +\def\shortchaplabel#1{% + % This space should be enough, since a single number is .5em, and the + % widest letter (M) is 1em, at least in the Computer Modern fonts. + % But use \hss just in case. + % (This space doesn't include the extra space that gets added after + % the label; that gets put in by \shortchapentry above.) + % + % We'd like to right-justify chapter numbers, but that looks strange + % with appendix letters. And right-justifying numbers and + % left-justifying letters looks strange when there is less than 10 + % chapters. Have to read the whole toc once to know how many chapters + % there are before deciding ... + \hbox to 1em{#1\hss}% +} + +% These macros generate individual entries in the table of contents. +% The first argument is the chapter or section name. +% The last argument is the page number. +% The arguments in between are the chapter number, section number, ... + +% Chapters, in the main contents. +\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} +% +% Chapters, in the short toc. +% See comments in \dochapentry re vbox and related settings. +\def\shortchapentry#1#2#3#4{% + \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% +} + +% Appendices, in the main contents. +% Need the word Appendix, and a fixed-size box. +% +\def\appendixbox#1{% + % We use M since it's probably the widest letter. + \setbox0 = \hbox{\putwordAppendix{} M}% + \hbox to \wd0{\putwordAppendix{} #1\hss}} +% +\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} + +% Unnumbered chapters. +\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} +\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} + +% Sections. +\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} +\let\appsecentry=\numsecentry +\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} + +% Subsections. +\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} +\let\appsubsecentry=\numsubsecentry +\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} + +% And subsubsections. +\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} +\let\appsubsubsecentry=\numsubsubsecentry +\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} + +% This parameter controls the indentation of the various levels. +% Same as \defaultparindent. +\newdimen\tocindent \tocindent = 15pt + +% Now for the actual typesetting. In all these, #1 is the text and #2 is the +% page number. +% +% If the toc has to be broken over pages, we want it to be at chapters +% if at all possible; hence the \penalty. +\def\dochapentry#1#2{% + \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip + \begingroup + \chapentryfonts + \tocentry{#1}{\dopageno\bgroup#2\egroup}% + \endgroup + \nobreak\vskip .25\baselineskip plus.1\baselineskip +} + +\def\dosecentry#1#2{\begingroup + \secentryfonts \leftskip=\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsecentry#1#2{\begingroup + \subsecentryfonts \leftskip=2\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsubsecentry#1#2{\begingroup + \subsubsecentryfonts \leftskip=3\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +% We use the same \entry macro as for the index entries. +\let\tocentry = \entry + +% Space between chapter (or whatever) number and the title. +\def\labelspace{\hskip1em \relax} + +\def\dopageno#1{{\rm #1}} +\def\doshortpageno#1{{\rm #1}} + +\def\chapentryfonts{\secfonts \rm} +\def\secentryfonts{\textfonts} +\def\subsecentryfonts{\textfonts} +\def\subsubsecentryfonts{\textfonts} + + +\message{environments,} +% @foo ... @end foo. + +% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. +% +% Since these characters are used in examples, it should be an even number of +% \tt widths. Each \tt character is 1en, so two makes it 1em. +% +\def\point{$\star$} +\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} +\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} +\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} +\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} + +% The @error{} command. +% Adapted from the TeXbook's \boxit. +% +\newbox\errorbox +% +{\tentt \global\dimen0 = 3em}% Width of the box. +\dimen2 = .55pt % Thickness of rules +% The text. (`r' is open on the right, `e' somewhat less so on the left.) +\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} +% +\setbox\errorbox=\hbox to \dimen0{\hfil + \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. + \advance\hsize by -2\dimen2 % Rules. + \vbox{% + \hrule height\dimen2 + \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. + \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. + \kern3pt\vrule width\dimen2}% Space to right. + \hrule height\dimen2} + \hfil} +% +\def\error{\leavevmode\lower.7ex\copy\errorbox} + +% @tex ... @end tex escapes into raw Tex temporarily. +% One exception: @ is still an escape character, so that @end tex works. +% But \@ or @@ will get a plain tex @ character. + +\envdef\tex{% + \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 + \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 + \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie + \catcode `\%=14 + \catcode `\+=\other + \catcode `\"=\other + \catcode `\|=\other + \catcode `\<=\other + \catcode `\>=\other + \escapechar=`\\ + % + \let\b=\ptexb + \let\bullet=\ptexbullet + \let\c=\ptexc + \let\,=\ptexcomma + \let\.=\ptexdot + \let\dots=\ptexdots + \let\equiv=\ptexequiv + \let\!=\ptexexclam + \let\i=\ptexi + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \let\{=\ptexlbrace + \let\+=\tabalign + \let\}=\ptexrbrace + \let\/=\ptexslash + \let\*=\ptexstar + \let\t=\ptext + % + \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% + \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% + \def\@{@}% +} +% There is no need to define \Etex. + +% Define @lisp ... @end lisp. +% @lisp environment forms a group so it can rebind things, +% including the definition of @end lisp (which normally is erroneous). + +% Amount to narrow the margins by for @lisp. +\newskip\lispnarrowing \lispnarrowing=0.4in + +% This is the definition that ^^M gets inside @lisp, @example, and other +% such environments. \null is better than a space, since it doesn't +% have any width. +\def\lisppar{\null\endgraf} + +% This space is always present above and below environments. +\newskip\envskipamount \envskipamount = 0pt + +% Make spacing and below environment symmetrical. We use \parskip here +% to help in doing that, since in @example-like environments \parskip +% is reset to zero; thus the \afterenvbreak inserts no space -- but the +% start of the next paragraph will insert \parskip. +% +\def\aboveenvbreak{{% + % =10000 instead of <10000 because of a special case in \itemzzz and + % \sectionheading, q.v. + \ifnum \lastpenalty=10000 \else + \advance\envskipamount by \parskip + \endgraf + \ifdim\lastskip<\envskipamount + \removelastskip + % it's not a good place to break if the last penalty was \nobreak + % or better ... + \ifnum\lastpenalty<10000 \penalty-50 \fi + \vskip\envskipamount + \fi + \fi +}} + +\let\afterenvbreak = \aboveenvbreak + +% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins. +\let\nonarrowing=\relax + +% @cartouche ... @end cartouche: draw rectangle w/rounded corners around +% environment contents. +\font\circle=lcircle10 +\newdimen\circthick +\newdimen\cartouter\newdimen\cartinner +\newskip\normbskip\newskip\normpskip\newskip\normlskip +\circthick=\fontdimen8\circle +% +\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth +\def\ctr{{\hskip 6pt\circle\char'010}} +\def\cbl{{\circle\char'012\hskip -6pt}} +\def\cbr{{\hskip 6pt\circle\char'011}} +\def\carttop{\hbox to \cartouter{\hskip\lskip + \ctl\leaders\hrule height\circthick\hfil\ctr + \hskip\rskip}} +\def\cartbot{\hbox to \cartouter{\hskip\lskip + \cbl\leaders\hrule height\circthick\hfil\cbr + \hskip\rskip}} +% +\newskip\lskip\newskip\rskip + +\envdef\cartouche{% + \ifhmode\par\fi % can't be in the midst of a paragraph. + \startsavinginserts + \lskip=\leftskip \rskip=\rightskip + \leftskip=0pt\rightskip=0pt % we want these *outside*. + \cartinner=\hsize \advance\cartinner by-\lskip + \advance\cartinner by-\rskip + \cartouter=\hsize + \advance\cartouter by 18.4pt % allow for 3pt kerns on either + % side, and for 6pt waste from + % each corner char, and rule thickness + \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip + % Flag to tell @lisp, etc., not to narrow margin. + \let\nonarrowing=\comment + \vbox\bgroup + \baselineskip=0pt\parskip=0pt\lineskip=0pt + \carttop + \hbox\bgroup + \hskip\lskip + \vrule\kern3pt + \vbox\bgroup + \kern3pt + \hsize=\cartinner + \baselineskip=\normbskip + \lineskip=\normlskip + \parskip=\normpskip + \vskip -\parskip + \comment % For explanation, see the end of \def\group. +} +\def\Ecartouche{% + \ifhmode\par\fi + \kern3pt + \egroup + \kern3pt\vrule + \hskip\rskip + \egroup + \cartbot + \egroup + \checkinserts +} + + +% This macro is called at the beginning of all the @example variants, +% inside a group. +\def\nonfillstart{% + \aboveenvbreak + \hfuzz = 12pt % Don't be fussy + \sepspaces % Make spaces be word-separators rather than space tokens. + \let\par = \lisppar % don't ignore blank lines + \obeylines % each line of input is a line of output + \parskip = 0pt + \parindent = 0pt + \emergencystretch = 0pt % don't try to avoid overfull boxes + % @cartouche defines \nonarrowing to inhibit narrowing + % at next level down. + \ifx\nonarrowing\relax + \advance \leftskip by \lispnarrowing + \exdentamount=\lispnarrowing + \fi + \let\exdent=\nofillexdent +} + +% If you want all examples etc. small: @set dispenvsize small. +% If you want even small examples the full size: @set dispenvsize nosmall. +% This affects the following displayed environments: +% @example, @display, @format, @lisp +% +\def\smallword{small} +\def\nosmallword{nosmall} +\let\SETdispenvsize\relax +\def\setnormaldispenv{% + \ifx\SETdispenvsize\smallword + \smallexamplefonts \rm + \fi +} +\def\setsmalldispenv{% + \ifx\SETdispenvsize\nosmallword + \else + \smallexamplefonts \rm + \fi +} + +% We often define two environments, @foo and @smallfoo. +% Let's do it by one command: +\def\makedispenv #1#2{ + \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} + \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} + \expandafter\let\csname E#1\endcsname \afterenvbreak + \expandafter\let\csname Esmall#1\endcsname \afterenvbreak +} + +% Define two synonyms: +\def\maketwodispenvs #1#2#3{ + \makedispenv{#1}{#3} + \makedispenv{#2}{#3} +} + +% @lisp: indented, narrowed, typewriter font; @example: same as @lisp. +% +% @smallexample and @smalllisp: use smaller fonts. +% Originally contributed by Pavel@xerox. +% +\maketwodispenvs {lisp}{example}{% + \nonfillstart + \tt + \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. + \gobble % eat return +} + +% @display/@smalldisplay: same as @lisp except keep current font. +% +\makedispenv {display}{% + \nonfillstart + \gobble +} + +% @format/@smallformat: same as @display except don't narrow margins. +% +\makedispenv{format}{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} + +% @flushleft: same as @format, but doesn't obey \SETdispenvsize. +\envdef\flushleft{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} +\let\Eflushleft = \afterenvbreak + +% @flushright. +% +\envdef\flushright{% + \let\nonarrowing = t% + \nonfillstart + \advance\leftskip by 0pt plus 1fill + \gobble +} +\let\Eflushright = \afterenvbreak + + +% @quotation does normal linebreaking (hence we can't use \nonfillstart) +% and narrows the margins. We keep \parskip nonzero in general, since +% we're doing normal filling. So, when using \aboveenvbreak and +% \afterenvbreak, temporarily make \parskip 0. +% +\envdef\quotation{% + {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip + \parindent=0pt + % + % @cartouche defines \nonarrowing to inhibit narrowing at next level down. + \ifx\nonarrowing\relax + \advance\leftskip by \lispnarrowing + \advance\rightskip by \lispnarrowing + \exdentamount = \lispnarrowing + \let\nonarrowing = \relax + \fi + \parsearg\quotationlabel +} + +% We have retained a nonzero parskip for the environment, since we're +% doing normal filling. +% +\def\Equotation{% + \par + \ifx\quotationauthor\undefined\else + % indent a bit. + \leftline{\kern 2\leftskip \sl ---\quotationauthor}% + \fi + {\parskip=0pt \afterenvbreak}% +} + +% If we're given an argument, typeset it in bold with a colon after. +\def\quotationlabel#1{% + \def\temp{#1}% + \ifx\temp\empty \else + {\bf #1: }% + \fi +} + + +% LaTeX-like @verbatim...@end verbatim and @verb{...} +% If we want to allow any as delimiter, +% we need the curly braces so that makeinfo sees the @verb command, eg: +% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org +% +% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. +% +% [Knuth] p.344; only we need to do the other characters Texinfo sets +% active too. Otherwise, they get lost as the first character on a +% verbatim line. +\def\dospecials{% + \do\ \do\\\do\{\do\}\do\$\do\&% + \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% + \do\<\do\>\do\|\do\@\do+\do\"% +} +% +% [Knuth] p. 380 +\def\uncatcodespecials{% + \def\do##1{\catcode`##1=\other}\dospecials} +% +% [Knuth] pp. 380,381,391 +% Disable Spanish ligatures ?` and !` of \tt font +\begingroup + \catcode`\`=\active\gdef`{\relax\lq} +\endgroup +% +% Setup for the @verb command. +% +% Eight spaces for a tab +\begingroup + \catcode`\^^I=\active + \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} +\endgroup +% +\def\setupverb{% + \tt % easiest (and conventionally used) font for verbatim + \def\par{\leavevmode\endgraf}% + \catcode`\`=\active + \tabeightspaces + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces +} + +% Setup for the @verbatim environment +% +% Real tab expansion +\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount +% +\def\starttabbox{\setbox0=\hbox\bgroup} +\begingroup + \catcode`\^^I=\active + \gdef\tabexpand{% + \catcode`\^^I=\active + \def^^I{\leavevmode\egroup + \dimen0=\wd0 % the width so far, or since the previous tab + \divide\dimen0 by\tabw + \multiply\dimen0 by\tabw % compute previous multiple of \tabw + \advance\dimen0 by\tabw % advance to next multiple of \tabw + \wd0=\dimen0 \box0 \starttabbox + }% + } +\endgroup +\def\setupverbatim{% + \nonfillstart + \advance\leftskip by -\defbodyindent + % Easiest (and conventionally used) font for verbatim + \tt + \def\par{\leavevmode\egroup\box0\endgraf}% + \catcode`\`=\active + \tabexpand + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces + \everypar{\starttabbox}% +} + +% Do the @verb magic: verbatim text is quoted by unique +% delimiter characters. Before first delimiter expect a +% right brace, after last delimiter expect closing brace: +% +% \def\doverb'{'#1'}'{#1} +% +% [Knuth] p. 382; only eat outer {} +\begingroup + \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other + \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] +\endgroup +% +\def\verb{\begingroup\setupverb\doverb} +% +% +% Do the @verbatim magic: define the macro \doverbatim so that +% the (first) argument ends when '@end verbatim' is reached, ie: +% +% \def\doverbatim#1@end verbatim{#1} +% +% For Texinfo it's a lot easier than for LaTeX, +% because texinfo's \verbatim doesn't stop at '\end{verbatim}': +% we need not redefine '\', '{' and '}'. +% +% Inspired by LaTeX's verbatim command set [latex.ltx] +% +\begingroup + \catcode`\ =\active + \obeylines % + % ignore everything up to the first ^^M, that's the newline at the end + % of the @verbatim input line itself. Otherwise we get an extra blank + % line in the output. + \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% + % We really want {...\end verbatim} in the body of the macro, but + % without the active space; thus we have to use \xdef and \gobble. +\endgroup +% +\envdef\verbatim{% + \setupverbatim\doverbatim +} +\let\Everbatim = \afterenvbreak + + +% @verbatiminclude FILE - insert text of file in verbatim environment. +% +\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} +% +\def\doverbatiminclude#1{% + {% + \makevalueexpandable + \setupverbatim + \input #1 + \afterenvbreak + }% +} + +% @copying ... @end copying. +% Save the text away for @insertcopying later. +% +% We save the uninterpreted tokens, rather than creating a box. +% Saving the text in a box would be much easier, but then all the +% typesetting commands (@smallbook, font changes, etc.) have to be done +% beforehand -- and a) we want @copying to be done first in the source +% file; b) letting users define the frontmatter in as flexible order as +% possible is very desirable. +% +\def\copying{\checkenv{}\begingroup\scanargctxt\docopying} +\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} +% +\def\insertcopying{% + \begingroup + \parindent = 0pt % paragraph indentation looks wrong on title page + \scanexp\copyingtext + \endgroup +} + +\message{defuns,} +% @defun etc. + +\newskip\defbodyindent \defbodyindent=.4in +\newskip\defargsindent \defargsindent=50pt +\newskip\deflastargmargin \deflastargmargin=18pt + +% Start the processing of @deffn: +\def\startdefun{% + \ifnum\lastpenalty<10000 + \medbreak + \else + % If there are two @def commands in a row, we'll have a \nobreak, + % which is there to keep the function description together with its + % header. But if there's nothing but headers, we need to allow a + % break somewhere. Check specifically for penalty 10002, inserted + % by \defargscommonending, instead of 10000, since the sectioning + % commands also insert a nobreak penalty, and we don't want to allow + % a break between a section heading and a defun. + % + \ifnum\lastpenalty=10002 \penalty2000 \fi + % + % Similarly, after a section heading, do not allow a break. + % But do insert the glue. + \medskip % preceded by discardable penalty, so not a breakpoint + \fi + % + \parindent=0in + \advance\leftskip by \defbodyindent + \exdentamount=\defbodyindent +} + +\def\dodefunx#1{% + % First, check whether we are in the right environment: + \checkenv#1% + % + % As above, allow line break if we have multiple x headers in a row. + % It's not a great place, though. + \ifnum\lastpenalty=10002 \penalty3000 \fi + % + % And now, it's time to reuse the body of the original defun: + \expandafter\gobbledefun#1% +} +\def\gobbledefun#1\startdefun{} + +% \printdefunline \deffnheader{text} +% +\def\printdefunline#1#2{% + \begingroup + % call \deffnheader: + #1#2 \endheader + % common ending: + \interlinepenalty = 10000 + \advance\rightskip by 0pt plus 1fil + \endgraf + \nobreak\vskip -\parskip + \penalty 10002 % signal to \startdefun and \dodefunx + % Some of the @defun-type tags do not enable magic parentheses, + % rendering the following check redundant. But we don't optimize. + \checkparencounts + \endgroup +} + +\def\Edefun{\endgraf\medbreak} + +% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; +% the only thing remainnig is to define \deffnheader. +% +\def\makedefun#1{% + \expandafter\let\csname E#1\endcsname = \Edefun + \edef\temp{\noexpand\domakedefun + \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% + \temp +} + +% \domakedefun \deffn \deffnx \deffnheader +% +% Define \deffn and \deffnx, without parameters. +% \deffnheader has to be defined explicitly. +% +\def\domakedefun#1#2#3{% + \envdef#1{% + \startdefun + \parseargusing\activeparens{\printdefunline#3}% + }% + \def#2{\dodefunx#1}% + \def#3% +} + +%%% Untyped functions: + +% @deffn category name args +\makedefun{deffn}{\deffngeneral{}} + +% @deffn category class name args +\makedefun{defop}#1 {\defopon{#1\ \putwordon}} + +% \defopon {category on}class name args +\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deffngeneral {subind}category name args +% +\def\deffngeneral#1#2 #3 #4\endheader{% + % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. + \dosubind{fn}{\code{#3}}{#1}% + \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% +} + +%%% Typed functions: + +% @deftypefn category type name args +\makedefun{deftypefn}{\deftypefngeneral{}} + +% @deftypeop category class type name args +\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} + +% \deftypeopon {category on}class type name args +\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deftypefngeneral {subind}category type name args +% +\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% + \dosubind{fn}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +%%% Typed variables: + +% @deftypevr category type var args +\makedefun{deftypevr}{\deftypecvgeneral{}} + +% @deftypecv category class type var args +\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} + +% \deftypecvof {category of}class type var args +\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } + +% \deftypecvgeneral {subind}category type var args +% +\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% + \dosubind{vr}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +%%% Untyped variables: + +% @defvr category var args +\makedefun{defvr}#1 {\deftypevrheader{#1} {} } + +% @defcv category class var args +\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} + +% \defcvof {category of}class var args +\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } + +%%% Type: +% @deftp category name args +\makedefun{deftp}#1 #2 #3\endheader{% + \doind{tp}{\code{#2}}% + \defname{#1}{}{#2}\defunargs{#3\unskip}% +} + +% Remaining @defun-like shortcuts: +\makedefun{defun}{\deffnheader{\putwordDeffunc} } +\makedefun{defmac}{\deffnheader{\putwordDefmac} } +\makedefun{defspec}{\deffnheader{\putwordDefspec} } +\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } +\makedefun{defvar}{\defvrheader{\putwordDefvar} } +\makedefun{defopt}{\defvrheader{\putwordDefopt} } +\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } +\makedefun{defmethod}{\defopon\putwordMethodon} +\makedefun{deftypemethod}{\deftypeopon\putwordMethodon} +\makedefun{defivar}{\defcvof\putwordInstanceVariableof} +\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} + +% \defname, which formats the name of the @def (not the args). +% #1 is the category, such as "Function". +% #2 is the return type, if any. +% #3 is the function name. +% +% We are followed by (but not passed) the arguments, if any. +% +\def\defname#1#2#3{% + % Get the values of \leftskip and \rightskip as they were outside the @def... + \advance\leftskip by -\defbodyindent + % + % How we'll format the type name. Putting it in brackets helps + % distinguish it from the body text that may end up on the next line + % just below it. + \def\temp{#1}% + \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} + % + % Figure out line sizes for the paragraph shape. + % The first line needs space for \box0; but if \rightskip is nonzero, + % we need only space for the part of \box0 which exceeds it: + \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip + % The continuations: + \dimen2=\hsize \advance\dimen2 by -\defargsindent + % (plain.tex says that \dimen1 should be used only as global.) + \parshape 2 0in \dimen0 \defargsindent \dimen2 + % + % Put the type name to the right margin. + \noindent + \hbox to 0pt{% + \hfil\box0 \kern-\hsize + % \hsize has to be shortened this way: + \kern\leftskip + % Intentionally do not respect \rightskip, since we need the space. + }% + % + % Allow all lines to be underfull without complaint: + \tolerance=10000 \hbadness=10000 + \exdentamount=\defbodyindent + {% + % defun fonts. We use typewriter by default (used to be bold) because: + % . we're printing identifiers, they should be in tt in principle. + % . in languages with many accents, such as Czech or French, it's + % common to leave accents off identifiers. The result looks ok in + % tt, but exceedingly strange in rm. + % . we don't want -- and --- to be treated as ligatures. + % . this still does not fix the ?` and !` ligatures, but so far no + % one has made identifiers using them :). + \df \tt + \def\temp{#2}% return value type + \ifx\temp\empty\else \tclose{\temp} \fi + #3% output function name + }% + {\rm\enskip}% hskip 0.5 em of \tenrm + % + \boldbrax + % arguments will be output next, if any. +} + +% Print arguments in slanted roman (not ttsl), inconsistently with using +% tt for the name. This is because literal text is sometimes needed in +% the argument list (groff manual), and ttsl and tt are not very +% distinguishable. Prevent hyphenation at `-' chars. +% +\def\defunargs#1{% + % use sl by default (not ttsl), + % tt for the names. + \df \sl \hyphenchar\font=0 + % + % On the other hand, if an argument has two dashes (for instance), we + % want a way to get ttsl. Let's try @var for that. + \let\var=\ttslanted + #1% + \sl\hyphenchar\font=45 +} + +% We want ()&[] to print specially on the defun line. +% +\def\activeparens{% + \catcode`\(=\active \catcode`\)=\active + \catcode`\[=\active \catcode`\]=\active + \catcode`\&=\active +} + +% Make control sequences which act like normal parenthesis chars. +\let\lparen = ( \let\rparen = ) + +% Be sure that we always have a definition for `(', etc. For example, +% if the fn name has parens in it, \boldbrax will not be in effect yet, +% so TeX would otherwise complain about undefined control sequence. +{ + \activeparens + \global\let(=\lparen \global\let)=\rparen + \global\let[=\lbrack \global\let]=\rbrack + \global\let& = \& + + \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} + \gdef\magicamp{\let&=\amprm} +} + +\newcount\parencount + +% If we encounter &foo, then turn on ()-hacking afterwards +\newif\ifampseen +\def\amprm#1 {\ampseentrue{\bf\ }} + +\def\parenfont{% + \ifampseen + % At the first level, print parens in roman, + % otherwise use the default font. + \ifnum \parencount=1 \rm \fi + \else + % The \sf parens (in \boldbrax) actually are a little bolder than + % the contained text. This is especially needed for [ and ] . + \sf + \fi +} +\def\infirstlevel#1{% + \ifampseen + \ifnum\parencount=1 + #1% + \fi + \fi +} +\def\bfafterword#1 {#1 \bf} + +\def\opnr{% + \global\advance\parencount by 1 + {\parenfont(}% + \infirstlevel \bfafterword +} +\def\clnr{% + {\parenfont)}% + \infirstlevel \sl + \global\advance\parencount by -1 +} + +\newcount\brackcount +\def\lbrb{% + \global\advance\brackcount by 1 + {\bf[}% +} +\def\rbrb{% + {\bf]}% + \global\advance\brackcount by -1 +} + +\def\checkparencounts{% + \ifnum\parencount=0 \else \badparencount \fi + \ifnum\brackcount=0 \else \badbrackcount \fi +} +\def\badparencount{% + \errmessage{Unbalanced parentheses in @def}% + \global\parencount=0 +} +\def\badbrackcount{% + \errmessage{Unbalanced square braces in @def}% + \global\brackcount=0 +} + + +\message{macros,} +% @macro. + +% To do this right we need a feature of e-TeX, \scantokens, +% which we arrange to emulate with a temporary file in ordinary TeX. +\ifx\eTeXversion\undefined + \newwrite\macscribble + \def\scantokens#1{% + \toks0={#1}% + \immediate\openout\macscribble=\jobname.tmp + \immediate\write\macscribble{\the\toks0}% + \immediate\closeout\macscribble + \input \jobname.tmp + } +\fi + +\def\scanmacro#1{% + \begingroup + \newlinechar`\^^M + \let\xeatspaces\eatspaces + % Undo catcode changes of \startcontents and \doprintindex + % When called from @insertcopying or (short)caption, we need active + % backslash to get it printed correctly. Previously, we had + % \catcode`\\=\other instead. We'll see whether a problem appears + % with macro expansion. --kasal, 19aug04 + \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ + % ... and \example + \spaceisspace + % + % Append \endinput to make sure that TeX does not see the ending newline. + % + % I've verified that it is necessary both for e-TeX and for ordinary TeX + % --kasal, 29nov03 + \scantokens{#1\endinput}% + \endgroup +} + +\def\scanexp#1{% + \edef\temp{\noexpand\scanmacro{#1}}% + \temp +} + +\newcount\paramno % Count of parameters +\newtoks\macname % Macro name +\newif\ifrecursive % Is it recursive? +\def\macrolist{} % List of all defined macros in the form + % \do\macro1\do\macro2... + +% Utility routines. +% This does \let #1 = #2, with \csnames; that is, +% \let \csname#1\endcsname = \csname#2\endcsname +% (except of course we have to play expansion games). +% +\def\cslet#1#2{% + \expandafter\let + \csname#1\expandafter\endcsname + \csname#2\endcsname +} + +% Trim leading and trailing spaces off a string. +% Concepts from aro-bend problem 15 (see CTAN). +{\catcode`\@=11 +\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} +\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} +\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} +\def\unbrace#1{#1} +\unbrace{\gdef\trim@@@ #1 } #2@{#1} +} + +% Trim a single trailing ^^M off a string. +{\catcode`\^^M=\other \catcode`\Q=3% +\gdef\eatcr #1{\eatcra #1Q^^MQ}% +\gdef\eatcra#1^^MQ{\eatcrb#1Q}% +\gdef\eatcrb#1Q#2Q{#1}% +} + +% Macro bodies are absorbed as an argument in a context where +% all characters are catcode 10, 11 or 12, except \ which is active +% (as in normal texinfo). It is necessary to change the definition of \. + +% It's necessary to have hard CRs when the macro is executed. This is +% done by making ^^M (\endlinechar) catcode 12 when reading the macro +% body, and then making it the \newlinechar in \scanmacro. + +\def\scanctxt{% + \catcode`\"=\other + \catcode`\+=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\@=\other + \catcode`\^=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\~=\other +} + +\def\scanargctxt{% + \scanctxt + \catcode`\\=\other + \catcode`\^^M=\other +} + +\def\macrobodyctxt{% + \scanctxt + \catcode`\{=\other + \catcode`\}=\other + \catcode`\^^M=\other + \usembodybackslash +} + +\def\macroargctxt{% + \scanctxt + \catcode`\\=\other +} + +% \mbodybackslash is the definition of \ in @macro bodies. +% It maps \foo\ => \csname macarg.foo\endcsname => #N +% where N is the macro parameter number. +% We define \csname macarg.\endcsname to be \realbackslash, so +% \\ in macro replacement text gets you a backslash. + +{\catcode`@=0 @catcode`@\=@active + @gdef@usembodybackslash{@let\=@mbodybackslash} + @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} +} +\expandafter\def\csname macarg.\endcsname{\realbackslash} + +\def\macro{\recursivefalse\parsearg\macroxxx} +\def\rmacro{\recursivetrue\parsearg\macroxxx} + +\def\macroxxx#1{% + \getargs{#1}% now \macname is the macname and \argl the arglist + \ifx\argl\empty % no arguments + \paramno=0% + \else + \expandafter\parsemargdef \argl;% + \fi + \if1\csname ismacro.\the\macname\endcsname + \message{Warning: redefining \the\macname}% + \else + \expandafter\ifx\csname \the\macname\endcsname \relax + \else \errmessage{Macro name \the\macname\space already defined}\fi + \global\cslet{macsave.\the\macname}{\the\macname}% + \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% + % Add the macroname to \macrolist + \toks0 = \expandafter{\macrolist\do}% + \xdef\macrolist{\the\toks0 + \expandafter\noexpand\csname\the\macname\endcsname}% + \fi + \begingroup \macrobodyctxt + \ifrecursive \expandafter\parsermacbody + \else \expandafter\parsemacbody + \fi} + +\parseargdef\unmacro{% + \if1\csname ismacro.#1\endcsname + \global\cslet{#1}{macsave.#1}% + \global\expandafter\let \csname ismacro.#1\endcsname=0% + % Remove the macro name from \macrolist: + \begingroup + \expandafter\let\csname#1\endcsname \relax + \let\do\unmacrodo + \xdef\macrolist{\macrolist}% + \endgroup + \else + \errmessage{Macro #1 not defined}% + \fi +} + +% Called by \do from \dounmacro on each macro. The idea is to omit any +% macro definitions that have been changed to \relax. +% +\def\unmacrodo#1{% + \ifx#1\relax + % remove this + \else + \noexpand\do \noexpand #1% + \fi +} + +% This makes use of the obscure feature that if the last token of a +% is #, then the preceding argument is delimited by +% an opening brace, and that opening brace is not consumed. +\def\getargs#1{\getargsxxx#1{}} +\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} +\def\getmacname #1 #2\relax{\macname={#1}} +\def\getmacargs#1{\def\argl{#1}} + +% Parse the optional {params} list. Set up \paramno and \paramlist +% so \defmacro knows what to do. Define \macarg.blah for each blah +% in the params list, to be ##N where N is the position in that list. +% That gets used by \mbodybackslash (above). + +% We need to get `macro parameter char #' into several definitions. +% The technique used is stolen from LaTeX: let \hash be something +% unexpandable, insert that wherever you need a #, and then redefine +% it to # just before using the token list produced. +% +% The same technique is used to protect \eatspaces till just before +% the macro is used. + +\def\parsemargdef#1;{\paramno=0\def\paramlist{}% + \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} +\def\parsemargdefxxx#1,{% + \if#1;\let\next=\relax + \else \let\next=\parsemargdefxxx + \advance\paramno by 1% + \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname + {\xeatspaces{\hash\the\paramno}}% + \edef\paramlist{\paramlist\hash\the\paramno,}% + \fi\next} + +% These two commands read recursive and nonrecursive macro bodies. +% (They're different since rec and nonrec macros end differently.) + +\long\def\parsemacbody#1@end macro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% +\long\def\parsermacbody#1@end rmacro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% + +% This defines the macro itself. There are six cases: recursive and +% nonrecursive macros of zero, one, and many arguments. +% Much magic with \expandafter here. +% \xdef is used so that macro definitions will survive the file +% they're defined in; @include reads the file inside a group. +\def\defmacro{% + \let\hash=##% convert placeholders to macro parameter chars + \ifrecursive + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\scanmacro{\temp}}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup\noexpand\scanmacro{\temp}}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \fi + \else + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \expandafter\noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \fi + \fi} + +\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} + +% \braceorline decides whether the next nonwhitespace character is a +% {. If so it reads up to the closing }, if not, it reads the whole +% line. Whatever was read is then fed to the next control sequence +% as an argument (by \parsebrace or \parsearg) +\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} +\def\braceorlinexxx{% + \ifx\nchar\bgroup\else + \expandafter\parsearg + \fi \next} + +% We want to disable all macros during \shipout so that they are not +% expanded by \write. +\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}% + \edef\next{\macrolist}\expandafter\endgroup\next} + +% For \indexnofonts, we need to get rid of all macros, leaving only the +% arguments (if present). Of course this is not nearly correct, but it +% is the best we can do for now. makeinfo does not expand macros in the +% argument to @deffn, which ends up writing an index entry, and texindex +% isn't prepared for an index sort entry that starts with \. +% +% Since macro invocations are followed by braces, we can just redefine them +% to take a single TeX argument. The case of a macro invocation that +% goes to end-of-line is not handled. +% +\def\emptyusermacros{\begingroup + \def\do##1{\let\noexpand##1=\noexpand\asis}% + \edef\next{\macrolist}\expandafter\endgroup\next} + + +% @alias. +% We need some trickery to remove the optional spaces around the equal +% sign. Just make them active and then expand them all to nothing. +\def\alias{\parseargusing\obeyspaces\aliasxxx} +\def\aliasxxx #1{\aliasyyy#1\relax} +\def\aliasyyy #1=#2\relax{% + {% + \expandafter\let\obeyedspace=\empty + \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% + }% + \next +} + + +\message{cross references,} + +\newwrite\auxfile + +\newif\ifhavexrefs % True if xref values are known. +\newif\ifwarnedxrefs % True if we warned once that they aren't known. + +% @inforef is relatively simple. +\def\inforef #1{\inforefzzz #1,,,,**} +\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, + node \samp{\ignorespaces#1{}}} + +% @node's only job in TeX is to define \lastnode, which is used in +% cross-references. The @node line might or might not have commas, and +% might or might not have spaces before the first comma, like: +% @node foo , bar , ... +% We don't want such trailing spaces in the node name. +% +\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} +% +% also remove a trailing comma, in case of something like this: +% @node Help-Cross, , , Cross-refs +\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} +\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} + +\let\nwnode=\node +\let\lastnode=\empty + +% Write a cross-reference definition for the current node. #1 is the +% type (Ynumbered, Yappendix, Ynothing). +% +\def\donoderef#1{% + \ifx\lastnode\empty\else + \setref{\lastnode}{#1}% + \global\let\lastnode=\empty + \fi +} + +% @anchor{NAME} -- define xref target at arbitrary point. +% +\newcount\savesfregister +% +\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} +\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} +\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} + +% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an +% anchor), which consists of three parts: +% 1) NAME-title - the current sectioning name taken from \thissection, +% or the anchor name. +% 2) NAME-snt - section number and type, passed as the SNT arg, or +% empty for anchors. +% 3) NAME-pg - the page number. +% +% This is called from \donoderef, \anchor, and \dofloat. In the case of +% floats, there is an additional part, which is not written here: +% 4) NAME-lof - the text as it should appear in a @listoffloats. +% +\def\setref#1#2{% + \pdfmkdest{#1}% + \iflinks + {% + \atdummies % preserve commands, but don't expand them + \turnoffactive + \otherbackslash + \edef\writexrdef##1##2{% + \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef + ##1}{##2}}% these are parameters of \writexrdef + }% + \toks0 = \expandafter{\thissection}% + \immediate \writexrdef{title}{\the\toks0 }% + \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. + \writexrdef{pg}{\folio}% will be written later, during \shipout + }% + \fi +} + +% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is +% the node name, #2 the name of the Info cross-reference, #3 the printed +% node name, #4 the name of the Info file, #5 the name of the printed +% manual. All but the node name can be omitted. +% +\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} +\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} +\def\ref#1{\xrefX[#1,,,,,,,]} +\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup + \unsepspaces + \def\printedmanual{\ignorespaces #5}% + \def\printedrefname{\ignorespaces #3}% + \setbox1=\hbox{\printedmanual\unskip}% + \setbox0=\hbox{\printedrefname\unskip}% + \ifdim \wd0 = 0pt + % No printed node name was explicitly given. + \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax + % Use the node name inside the square brackets. + \def\printedrefname{\ignorespaces #1}% + \else + % Use the actual chapter/section title appear inside + % the square brackets. Use the real section title if we have it. + \ifdim \wd1 > 0pt + % It is in another manual, so we don't have it. + \def\printedrefname{\ignorespaces #1}% + \else + \ifhavexrefs + % We know the real title if we have the xref values. + \def\printedrefname{\refx{#1-title}{}}% + \else + % Otherwise just copy the Info node name. + \def\printedrefname{\ignorespaces #1}% + \fi% + \fi + \fi + \fi + % + % Make link in pdf output. + \ifpdf + \leavevmode + \getfilename{#4}% + {\turnoffactive \otherbackslash + \ifnum\filenamelength>0 + \startlink attr{/Border [0 0 0]}% + goto file{\the\filename.pdf} name{#1}% + \else + \startlink attr{/Border [0 0 0]}% + goto name{\pdfmkpgn{#1}}% + \fi + }% + \linkcolor + \fi + % + % Float references are printed completely differently: "Figure 1.2" + % instead of "[somenode], p.3". We distinguish them by the + % LABEL-title being set to a magic string. + {% + % Have to otherify everything special to allow the \csname to + % include an _ in the xref name, etc. + \indexnofonts + \turnoffactive + \otherbackslash + \expandafter\global\expandafter\let\expandafter\Xthisreftitle + \csname XR#1-title\endcsname + }% + \iffloat\Xthisreftitle + % If the user specified the print name (third arg) to the ref, + % print it instead of our usual "Figure 1.2". + \ifdim\wd0 = 0pt + \refx{#1-snt}% + \else + \printedrefname + \fi + % + % if the user also gave the printed manual name (fifth arg), append + % "in MANUALNAME". + \ifdim \wd1 > 0pt + \space \putwordin{} \cite{\printedmanual}% + \fi + \else + % node/anchor (non-float) references. + % + % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not + % insert empty discretionaries after hyphens, which means that it will + % not find a line break at a hyphen in a node names. Since some manuals + % are best written with fairly long node names, containing hyphens, this + % is a loss. Therefore, we give the text of the node name again, so it + % is as if TeX is seeing it for the first time. + \ifdim \wd1 > 0pt + \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% + \else + % _ (for example) has to be the character _ for the purposes of the + % control sequence corresponding to the node, but it has to expand + % into the usual \leavevmode...\vrule stuff for purposes of + % printing. So we \turnoffactive for the \refx-snt, back on for the + % printing, back off for the \refx-pg. + {\turnoffactive \otherbackslash + % Only output a following space if the -snt ref is nonempty; for + % @unnumbered and @anchor, it won't be. + \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% + \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi + }% + % output the `[mynode]' via a macro so it can be overridden. + \xrefprintnodename\printedrefname + % + % But we always want a comma and a space: + ,\space + % + % output the `page 3'. + \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}% + \fi + \fi + \endlink +\endgroup} + +% This macro is called from \xrefX for the `[nodename]' part of xref +% output. It's a separate macro only so it can be changed more easily, +% since square brackets don't work well in some documents. Particularly +% one that Bob is working on :). +% +\def\xrefprintnodename#1{[#1]} + +% Things referred to by \setref. +% +\def\Ynothing{} +\def\Yomitfromtoc{} +\def\Ynumbered{% + \ifnum\secno=0 + \putwordChapter@tie \the\chapno + \else \ifnum\subsecno=0 + \putwordSection@tie \the\chapno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno + \else + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} +\def\Yappendix{% + \ifnum\secno=0 + \putwordAppendix@tie @char\the\appendixno{}% + \else \ifnum\subsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno + \else + \putwordSection@tie + @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} + +% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. +% If its value is nonempty, SUFFIX is output afterward. +% +\def\refx#1#2{% + {% + \indexnofonts + \otherbackslash + \expandafter\global\expandafter\let\expandafter\thisrefX + \csname XR#1\endcsname + }% + \ifx\thisrefX\relax + % If not defined, say something at least. + \angleleft un\-de\-fined\angleright + \iflinks + \ifhavexrefs + \message{\linenumber Undefined cross reference `#1'.}% + \else + \ifwarnedxrefs\else + \global\warnedxrefstrue + \message{Cross reference values unknown; you must run TeX again.}% + \fi + \fi + \fi + \else + % It's defined, so just use it. + \thisrefX + \fi + #2% Output the suffix in any case. +} + +% This is the macro invoked by entries in the aux file. Usually it's +% just a \def (we prepend XR to the control sequence name to avoid +% collisions). But if this is a float type, we have more work to do. +% +\def\xrdef#1#2{% + \expandafter\gdef\csname XR#1\endcsname{#2}% remember this xref value. + % + % Was that xref control sequence that we just defined for a float? + \expandafter\iffloat\csname XR#1\endcsname + % it was a float, and we have the (safe) float type in \iffloattype. + \expandafter\let\expandafter\floatlist + \csname floatlist\iffloattype\endcsname + % + % Is this the first time we've seen this float type? + \expandafter\ifx\floatlist\relax + \toks0 = {\do}% yes, so just \do + \else + % had it before, so preserve previous elements in list. + \toks0 = \expandafter{\floatlist\do}% + \fi + % + % Remember this xref in the control sequence \floatlistFLOATTYPE, + % for later use in \listoffloats. + \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0{#1}}% + \fi +} + +% Read the last existing aux file, if any. No error if none exists. +% +\def\tryauxfile{% + \openin 1 \jobname.aux + \ifeof 1 \else + \readauxfile + \global\havexrefstrue + \fi + \closein 1 +} + +\def\readauxfile{\begingroup + \catcode`\^^@=\other + \catcode`\^^A=\other + \catcode`\^^B=\other + \catcode`\^^C=\other + \catcode`\^^D=\other + \catcode`\^^E=\other + \catcode`\^^F=\other + \catcode`\^^G=\other + \catcode`\^^H=\other + \catcode`\^^K=\other + \catcode`\^^L=\other + \catcode`\^^N=\other + \catcode`\^^P=\other + \catcode`\^^Q=\other + \catcode`\^^R=\other + \catcode`\^^S=\other + \catcode`\^^T=\other + \catcode`\^^U=\other + \catcode`\^^V=\other + \catcode`\^^W=\other + \catcode`\^^X=\other + \catcode`\^^Z=\other + \catcode`\^^[=\other + \catcode`\^^\=\other + \catcode`\^^]=\other + \catcode`\^^^=\other + \catcode`\^^_=\other + % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. + % in xref tags, i.e., node names. But since ^^e4 notation isn't + % supported in the main text, it doesn't seem desirable. Furthermore, + % that is not enough: for node names that actually contain a ^ + % character, we would end up writing a line like this: 'xrdef {'hat + % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first + % argument, and \hat is not an expandable control sequence. It could + % all be worked out, but why? Either we support ^^ or we don't. + % + % The other change necessary for this was to define \auxhat: + % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter + % and then to call \auxhat in \setq. + % + \catcode`\^=\other + % + % Special characters. Should be turned off anyway, but... + \catcode`\~=\other + \catcode`\[=\other + \catcode`\]=\other + \catcode`\"=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\$=\other + \catcode`\#=\other + \catcode`\&=\other + \catcode`\%=\other + \catcode`+=\other % avoid \+ for paranoia even though we've turned it off + % + % This is to support \ in node names and titles, since the \ + % characters end up in a \csname. It's easier than + % leaving it active and making its active definition an actual \ + % character. What I don't understand is why it works in the *value* + % of the xrdef. Seems like it should be a catcode12 \, and that + % should not typeset properly. But it works, so I'm moving on for + % now. --karl, 15jan04. + \catcode`\\=\other + % + % Make the characters 128-255 be printing characters. + {% + \count 1=128 + \def\loop{% + \catcode\count 1=\other + \advance\count 1 by 1 + \ifnum \count 1<256 \loop \fi + }% + }% + % + % @ is our escape character in .aux files, and we need braces. + \catcode`\{=1 + \catcode`\}=2 + \catcode`\@=0 + % + \input \jobname.aux +\endgroup} + + +\message{insertions,} +% including footnotes. + +\newcount \footnoteno + +% The trailing space in the following definition for supereject is +% vital for proper filling; pages come out unaligned when you do a +% pagealignmacro call if that space before the closing brace is +% removed. (Generally, numeric constants should always be followed by a +% space to prevent strange expansion errors.) +\def\supereject{\par\penalty -20000\footnoteno =0 } + +% @footnotestyle is meaningful for info output only. +\let\footnotestyle=\comment + +{\catcode `\@=11 +% +% Auto-number footnotes. Otherwise like plain. +\gdef\footnote{% + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \global\advance\footnoteno by \@ne + \edef\thisfootno{$^{\the\footnoteno}$}% + % + % In case the footnote comes at the end of a sentence, preserve the + % extra spacing after we do the footnote number. + \let\@sf\empty + \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi + % + % Remove inadvertent blank space before typesetting the footnote number. + \unskip + \thisfootno\@sf + \dofootnote +}% + +% Don't bother with the trickery in plain.tex to not require the +% footnote text as a parameter. Our footnotes don't need to be so general. +% +% Oh yes, they do; otherwise, @ifset (and anything else that uses +% \parseargline) fails inside footnotes because the tokens are fixed when +% the footnote is read. --karl, 16nov96. +% +\gdef\dofootnote{% + \insert\footins\bgroup + % We want to typeset this text as a normal paragraph, even if the + % footnote reference occurs in (for example) a display environment. + % So reset some parameters. + \hsize=\pagewidth + \interlinepenalty\interfootnotelinepenalty + \splittopskip\ht\strutbox % top baseline for broken footnotes + \splitmaxdepth\dp\strutbox + \floatingpenalty\@MM + \leftskip\z@skip + \rightskip\z@skip + \spaceskip\z@skip + \xspaceskip\z@skip + \parindent\defaultparindent + % + \smallfonts \rm + % + % Because we use hanging indentation in footnotes, a @noindent appears + % to exdent this text, so make it be a no-op. makeinfo does not use + % hanging indentation so @noindent can still be needed within footnote + % text after an @example or the like (not that this is good style). + \let\noindent = \relax + % + % Hang the footnote text off the number. Use \everypar in case the + % footnote extends for more than one paragraph. + \everypar = {\hang}% + \textindent{\thisfootno}% + % + % Don't crash into the line above the footnote text. Since this + % expands into a box, it must come within the paragraph, lest it + % provide a place where TeX can split the footnote. + \footstrut + \futurelet\next\fo@t +} +}%end \catcode `\@=11 + +% In case a @footnote appears in a vbox, save the footnote text and create +% the real \insert just after the vbox finished. Otherwise, the insertion +% would be lost. +% Similarily, if a @footnote appears inside an alignment, save the footnote +% text to a box and make the \insert when a row of the table is finished. +% And the same can be done for other insert classes. --kasal, 16nov03. + +% Replace the \insert primitive by a cheating macro. +% Deeper inside, just make sure that the saved insertions are not spilled +% out prematurely. +% +\def\startsavinginserts{% + \ifx \insert\ptexinsert + \let\insert\saveinsert + \else + \let\checkinserts\relax + \fi +} + +% This \insert replacement works for both \insert\footins{foo} and +% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. +% +\def\saveinsert#1{% + \edef\next{\noexpand\savetobox \makeSAVEname#1}% + \afterassignment\next + % swallow the left brace + \let\temp = +} +\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} +\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} + +\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} + +\def\placesaveins#1{% + \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname + {\box#1}% +} + +% eat @SAVE -- beware, all of them have catcode \other: +{ + \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) + \gdef\gobblesave @SAVE{} +} + +% initialization: +\def\newsaveins #1{% + \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% + \next +} +\def\newsaveinsX #1{% + \csname newbox\endcsname #1% + \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts + \checksaveins #1}% +} + +% initialize: +\let\checkinserts\empty +\newsaveins\footins +\newsaveins\margin + + +% @image. We use the macros from epsf.tex to support this. +% If epsf.tex is not installed and @image is used, we complain. +% +% Check for and read epsf.tex up front. If we read it only at @image +% time, we might be inside a group, and then its definitions would get +% undone and the next image would fail. +\openin 1 = epsf.tex +\ifeof 1 \else + % Do not bother showing banner with epsf.tex v2.7k (available in + % doc/epsf.tex and on ctan). + \def\epsfannounce{\toks0 = }% + \input epsf.tex +\fi +\closein 1 +% +% We will only complain once about lack of epsf.tex. +\newif\ifwarnednoepsf +\newhelp\noepsfhelp{epsf.tex must be installed for images to + work. It is also included in the Texinfo distribution, or you can get + it from ftp://tug.org/tex/epsf.tex.} +% +\def\image#1{% + \ifx\epsfbox\undefined + \ifwarnednoepsf \else + \errhelp = \noepsfhelp + \errmessage{epsf.tex not found, images will be ignored}% + \global\warnednoepsftrue + \fi + \else + \imagexxx #1,,,,,\finish + \fi +} +% +% Arguments to @image: +% #1 is (mandatory) image filename; we tack on .eps extension. +% #2 is (optional) width, #3 is (optional) height. +% #4 is (ignored optional) html alt text. +% #5 is (ignored optional) extension. +% #6 is just the usual extra ignored arg for parsing this stuff. +\newif\ifimagevmode +\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup + \catcode`\^^M = 5 % in case we're inside an example + \normalturnoffactive % allow _ et al. in names + % If the image is by itself, center it. + \ifvmode + \imagevmodetrue + \nobreak\bigskip + % Usually we'll have text after the image which will insert + % \parskip glue, so insert it here too to equalize the space + % above and below. + \nobreak\vskip\parskip + \nobreak + \line\bgroup\hss + \fi + % + % Output the image. + \ifpdf + \dopdfimage{#1}{#2}{#3}% + \else + % \epsfbox itself resets \epsf?size at each figure. + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi + \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi + \epsfbox{#1.eps}% + \fi + % + \ifimagevmode \hss \egroup \bigbreak \fi % space after the image +\endgroup} + + +% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, +% etc. We don't actually implement floating yet, we always include the +% float "here". But it seemed the best name for the future. +% +\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} + +% There may be a space before second and/or third parameter; delete it. +\def\eatcommaspace#1, {#1,} + +% #1 is the optional FLOATTYPE, the text label for this float, typically +% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, +% this float will not be numbered and cannot be referred to. +% +% #2 is the optional xref label. Also must be present for the float to +% be referable. +% +% #3 is the optional positioning argument; for now, it is ignored. It +% will somehow specify the positions allowed to float to (here, top, bottom). +% +% We keep a separate counter for each FLOATTYPE, which we reset at each +% chapter-level command. +\let\resetallfloatnos=\empty +% +\def\dofloat#1,#2,#3,#4\finish{% + \let\thiscaption=\empty + \let\thisshortcaption=\empty + % + % don't lose footnotes inside @float. + % + % BEWARE: when the floats start float, we have to issue warning whenever an + % insert appears inside a float which could possibly float. --kasal, 26may04 + % + \startsavinginserts + % + % We can't be used inside a paragraph. + \par + % + \vtop\bgroup + \def\floattype{#1}% + \def\floatlabel{#2}% + \def\floatloc{#3}% we do nothing with this yet. + % + \ifx\floattype\empty + \let\safefloattype=\empty + \else + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + \fi + % + % If label is given but no type, we handle that as the empty type. + \ifx\floatlabel\empty \else + % We want each FLOATTYPE to be numbered separately (Figure 1, + % Table 1, Figure 2, ...). (And if no label, no number.) + % + \expandafter\getfloatno\csname\safefloattype floatno\endcsname + \global\advance\floatno by 1 + % + {% + % This magic value for \thissection is output by \setref as the + % XREFLABEL-title value. \xrefX uses it to distinguish float + % labels (which have a completely different output format) from + % node and anchor labels. And \xrdef uses it to construct the + % lists of floats. + % + \edef\thissection{\floatmagic=\safefloattype}% + \setref{\floatlabel}{Yfloat}% + }% + \fi + % + % start with \parskip glue, I guess. + \vskip\parskip + % + % Don't suppress indentation if a float happens to start a section. + \restorefirstparagraphindent +} + +% we have these possibilities: +% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap +% @float Foo,lbl & no caption: Foo 1.1 +% @float Foo & @caption{Cap}: Foo: Cap +% @float Foo & no caption: Foo +% @float ,lbl & Caption{Cap}: 1.1: Cap +% @float ,lbl & no caption: 1.1 +% @float & @caption{Cap}: Cap +% @float & no caption: +% +\def\Efloat{% + \let\floatident = \empty + % + % In all cases, if we have a float type, it comes first. + \ifx\floattype\empty \else \def\floatident{\floattype}\fi + % + % If we have an xref label, the number comes next. + \ifx\floatlabel\empty \else + \ifx\floattype\empty \else % if also had float type, need tie first. + \appendtomacro\floatident{\tie}% + \fi + % the number. + \appendtomacro\floatident{\chaplevelprefix\the\floatno}% + \fi + % + % Start the printed caption with what we've constructed in + % \floatident, but keep it separate; we need \floatident again. + \let\captionline = \floatident + % + \ifx\thiscaption\empty \else + \ifx\floatident\empty \else + \appendtomacro\captionline{: }% had ident, so need a colon between + \fi + % + % caption text. + \appendtomacro\captionline{\scanexp\thiscaption}% + \fi + % + % If we have anything to print, print it, with space before. + % Eventually this needs to become an \insert. + \ifx\captionline\empty \else + \vskip.5\parskip + \captionline + % + % Space below caption. + \vskip\parskip + \fi + % + % If have an xref label, write the list of floats info. Do this + % after the caption, to avoid chance of it being a breakpoint. + \ifx\floatlabel\empty \else + % Write the text that goes in the lof to the aux file as + % \floatlabel-lof. Besides \floatident, we include the short + % caption if specified, else the full caption if specified, else nothing. + {% + \atdummies \turnoffactive \otherbackslash + % since we read the caption text in the macro world, where ^^M + % is turned into a normal character, we have to scan it back, so + % we don't write the literal three characters "^^M" into the aux file. + \scanexp{% + \xdef\noexpand\gtemp{% + \ifx\thisshortcaption\empty + \thiscaption + \else + \thisshortcaption + \fi + }% + }% + \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident + \ifx\gtemp\empty \else : \gtemp \fi}}% + }% + \fi + \egroup % end of \vtop + % + % place the captured inserts + % + % BEWARE: when the floats start float, we have to issue warning whenever an + % insert appears inside a float which could possibly float. --kasal, 26may04 + % + \checkinserts +} + +% Append the tokens #2 to the definition of macro #1, not expanding either. +% +\def\appendtomacro#1#2{% + \expandafter\def\expandafter#1\expandafter{#1#2}% +} + +% @caption, @shortcaption +% +\def\caption{\docaption\thiscaption} +\def\shortcaption{\docaption\thisshortcaption} +\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} +\def\defcaption#1#2{\egroup \def#1{#2}} + +% The parameter is the control sequence identifying the counter we are +% going to use. Create it if it doesn't exist and assign it to \floatno. +\def\getfloatno#1{% + \ifx#1\relax + % Haven't seen this figure type before. + \csname newcount\endcsname #1% + % + % Remember to reset this floatno at the next chap. + \expandafter\gdef\expandafter\resetallfloatnos + \expandafter{\resetallfloatnos #1=0 }% + \fi + \let\floatno#1% +} + +% \setref calls this to get the XREFLABEL-snt value. We want an @xref +% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we +% first read the @float command. +% +\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% + +% Magic string used for the XREFLABEL-title value, so \xrefX can +% distinguish floats from other xref types. +\def\floatmagic{!!float!!} + +% #1 is the control sequence we are passed; we expand into a conditional +% which is true if #1 represents a float ref. That is, the magic +% \thissection value which we \setref above. +% +\def\iffloat#1{\expandafter\doiffloat#1==\finish} +% +% #1 is (maybe) the \floatmagic string. If so, #2 will be the +% (safe) float type for this float. We set \iffloattype to #2. +% +\def\doiffloat#1=#2=#3\finish{% + \def\temp{#1}% + \def\iffloattype{#2}% + \ifx\temp\floatmagic +} + +% @listoffloats FLOATTYPE - print a list of floats like a table of contents. +% +\parseargdef\listoffloats{% + \def\floattype{#1}% floattype + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + % + % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. + \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax + \ifhavexrefs + % if the user said @listoffloats foo but never @float foo. + \message{\linenumber No `\safefloattype' floats to list.}% + \fi + \else + \begingroup + \leftskip=\tocindent % indent these entries like a toc + \let\do=\listoffloatsdo + \csname floatlist\safefloattype\endcsname + \endgroup + \fi +} + +% This is called on each entry in a list of floats. We're passed the +% xref label, in the form LABEL-title, which is how we save it in the +% aux file. We strip off the -title and look up \XRLABEL-lof, which +% has the text we're supposed to typeset here. +% +% Figures without xref labels will not be included in the list (since +% they won't appear in the aux file). +% +\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} +\def\listoffloatsdoentry#1-title\finish{{% + % Can't fully expand XR#1-lof because it can contain anything. Just + % pass the control sequence. On the other hand, XR#1-pg is just the + % page number, and we want to fully expand that so we can get a link + % in pdf output. + \toksA = \expandafter{\csname XR#1-lof\endcsname}% + % + % use the same \entry macro we use to generate the TOC and index. + \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% + \writeentry +}} + +\message{localization,} +% and i18n. + +% @documentlanguage is usually given very early, just after +% @setfilename. If done too late, it may not override everything +% properly. Single argument is the language abbreviation. +% It would be nice if we could set up a hyphenation file here. +% +\parseargdef\documentlanguage{% + \tex % read txi-??.tex file in plain TeX. + % Read the file if it exists. + \openin 1 txi-#1.tex + \ifeof 1 + \errhelp = \nolanghelp + \errmessage{Cannot read language file txi-#1.tex}% + \else + \input txi-#1.tex + \fi + \closein 1 + \endgroup +} +\newhelp\nolanghelp{The given language definition file cannot be found or +is empty. Maybe you need to install it? In the current directory +should work if nowhere else does.} + + +% @documentencoding should change something in TeX eventually, most +% likely, but for now just recognize it. +\let\documentencoding = \comment + + +% Page size parameters. +% +\newdimen\defaultparindent \defaultparindent = 15pt + +\chapheadingskip = 15pt plus 4pt minus 2pt +\secheadingskip = 12pt plus 3pt minus 2pt +\subsecheadingskip = 9pt plus 2pt minus 2pt + +% Prevent underfull vbox error messages. +\vbadness = 10000 + +% Don't be so finicky about underfull hboxes, either. +\hbadness = 2000 + +% Following George Bush, just get rid of widows and orphans. +\widowpenalty=10000 +\clubpenalty=10000 + +% Use TeX 3.0's \emergencystretch to help line breaking, but if we're +% using an old version of TeX, don't do anything. We want the amount of +% stretch added to depend on the line length, hence the dependence on +% \hsize. We call this whenever the paper size is set. +% +\def\setemergencystretch{% + \ifx\emergencystretch\thisisundefined + % Allow us to assign to \emergencystretch anyway. + \def\emergencystretch{\dimen0}% + \else + \emergencystretch = .15\hsize + \fi +} + +% Parameters in order: 1) textheight; 2) textwidth; 3) voffset; +% 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8) +% physical page width. +% +% We also call \setleading{\textleading}, so the caller should define +% \textleading. The caller should also set \parskip. +% +\def\internalpagesizes#1#2#3#4#5#6#7#8{% + \voffset = #3\relax + \topskip = #6\relax + \splittopskip = \topskip + % + \vsize = #1\relax + \advance\vsize by \topskip + \outervsize = \vsize + \advance\outervsize by 2\topandbottommargin + \pageheight = \vsize + % + \hsize = #2\relax + \outerhsize = \hsize + \advance\outerhsize by 0.5in + \pagewidth = \hsize + % + \normaloffset = #4\relax + \bindingoffset = #5\relax + % + \ifpdf + \pdfpageheight #7\relax + \pdfpagewidth #8\relax + \fi + % + \setleading{\textleading} + % + \parindent = \defaultparindent + \setemergencystretch +} + +% @letterpaper (the default). +\def\letterpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % If page is nothing but text, make it come out even. + \internalpagesizes{46\baselineskip}{6in}% + {\voffset}{.25in}% + {\bindingoffset}{36pt}% + {11in}{8.5in}% +}} + +% Use @smallbook to reset parameters for 7x9.5 (or so) format. +\def\smallbook{{\globaldefs = 1 + \parskip = 2pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.5in}{5in}% + {\voffset}{.25in}% + {\bindingoffset}{16pt}% + {9.25in}{7in}% + % + \lispnarrowing = 0.3in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .5cm +}} + +% Use @afourpaper to print on European A4 paper. +\def\afourpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % Double-side printing via postscript on Laserjet 4050 + % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. + % To change the settings for a different printer or situation, adjust + % \normaloffset until the front-side and back-side texts align. Then + % do the same for \bindingoffset. You can set these for testing in + % your texinfo source file like this: + % @tex + % \global\normaloffset = -6mm + % \global\bindingoffset = 10mm + % @end tex + \internalpagesizes{51\baselineskip}{160mm} + {\voffset}{\hoffset}% + {\bindingoffset}{44pt}% + {297mm}{210mm}% + % + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = 5mm +}} + +% Use @afivepaper to print on European A5 paper. +% From romildo@urano.iceb.ufop.br, 2 July 2000. +% He also recommends making @example and @lisp be small. +\def\afivepaper{{\globaldefs = 1 + \parskip = 2pt plus 1pt minus 0.1pt + \textleading = 12.5pt + % + \internalpagesizes{160mm}{120mm}% + {\voffset}{\hoffset}% + {\bindingoffset}{8pt}% + {210mm}{148mm}% + % + \lispnarrowing = 0.2in + \tolerance = 800 + \hfuzz = 1.2pt + \contentsrightmargin = 0pt + \defbodyindent = 2mm + \tableindent = 12mm +}} + +% A specific text layout, 24x15cm overall, intended for A4 paper. +\def\afourlatex{{\globaldefs = 1 + \afourpaper + \internalpagesizes{237mm}{150mm}% + {\voffset}{4.6mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + % + % Must explicitly reset to 0 because we call \afourpaper. + \globaldefs = 0 +}} + +% Use @afourwide to print on A4 paper in landscape format. +\def\afourwide{{\globaldefs = 1 + \afourpaper + \internalpagesizes{241mm}{165mm}% + {\voffset}{-2.95mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + \globaldefs = 0 +}} + +% @pagesizes TEXTHEIGHT[,TEXTWIDTH] +% Perhaps we should allow setting the margins, \topskip, \parskip, +% and/or leading, also. Or perhaps we should compute them somehow. +% +\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} +\def\pagesizesyyy#1,#2,#3\finish{{% + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi + \globaldefs = 1 + % + \parskip = 3pt plus 2pt minus 1pt + \setleading{\textleading}% + % + \dimen0 = #1 + \advance\dimen0 by \voffset + % + \dimen2 = \hsize + \advance\dimen2 by \normaloffset + % + \internalpagesizes{#1}{\hsize}% + {\voffset}{\normaloffset}% + {\bindingoffset}{44pt}% + {\dimen0}{\dimen2}% +}} + +% Set default to letter. +% +\letterpaper + + +\message{and turning on texinfo input format.} + +% Define macros to output various characters with catcode for normal text. +\catcode`\"=\other +\catcode`\~=\other +\catcode`\^=\other +\catcode`\_=\other +\catcode`\|=\other +\catcode`\<=\other +\catcode`\>=\other +\catcode`\+=\other +\catcode`\$=\other +\def\normaldoublequote{"} +\def\normaltilde{~} +\def\normalcaret{^} +\def\normalunderscore{_} +\def\normalverticalbar{|} +\def\normalless{<} +\def\normalgreater{>} +\def\normalplus{+} +\def\normaldollar{$}%$ font-lock fix + +% This macro is used to make a character print one way in \tt +% (where it can probably be output as-is), and another way in other fonts, +% where something hairier probably needs to be done. +% +% #1 is what to print if we are indeed using \tt; #2 is what to print +% otherwise. Since all the Computer Modern typewriter fonts have zero +% interword stretch (and shrink), and it is reasonable to expect all +% typewriter fonts to have this, we can check that font parameter. +% +\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} + +% Same as above, but check for italic font. Actually this also catches +% non-italic slanted fonts since it is impossible to distinguish them from +% italic fonts. But since this is only used by $ and it uses \sl anyway +% this is not a problem. +\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} + +% Turn off all special characters except @ +% (and those which the user can use as if they were ordinary). +% Most of these we simply print from the \tt font, but for some, we can +% use math or other variants that look better in normal text. + +\catcode`\"=\active +\def\activedoublequote{{\tt\char34}} +\let"=\activedoublequote +\catcode`\~=\active +\def~{{\tt\char126}} +\chardef\hat=`\^ +\catcode`\^=\active +\def^{{\tt \hat}} + +\catcode`\_=\active +\def_{\ifusingtt\normalunderscore\_} +% Subroutine for the previous macro. +\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } + +\catcode`\|=\active +\def|{{\tt\char124}} +\chardef \less=`\< +\catcode`\<=\active +\def<{{\tt \less}} +\chardef \gtr=`\> +\catcode`\>=\active +\def>{{\tt \gtr}} +\catcode`\+=\active +\def+{{\tt \char 43}} +\catcode`\$=\active +\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix + +% If a .fmt file is being used, characters that might appear in a file +% name cannot be active until we have parsed the command line. +% So turn them off again, and have \everyjob (or @setfilename) turn them on. +% \otherifyactive is called near the end of this file. +\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} + +\catcode`\@=0 + +% \backslashcurfont outputs one backslash character in current font, +% as in \char`\\. +\global\chardef\backslashcurfont=`\\ +\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work + +% \rawbackslash defines an active \ to do \backslashcurfont. +% \otherbackslash defines an active \ to be a literal `\' character with +% catcode other. +{\catcode`\\=\active + @gdef@rawbackslash{@let\=@backslashcurfont} + @gdef@otherbackslash{@let\=@realbackslash} +} + +% \realbackslash is an actual character `\' with catcode other. +{\catcode`\\=\other @gdef@realbackslash{\}} + +% \normalbackslash outputs one backslash in fixed width font. +\def\normalbackslash{{\tt\backslashcurfont}} + +\catcode`\\=\active + +% Used sometimes to turn off (effectively) the active characters +% even after parsing them. +@def@turnoffactive{% + @let"=@normaldoublequote + @let\=@realbackslash + @let~=@normaltilde + @let^=@normalcaret + @let_=@normalunderscore + @let|=@normalverticalbar + @let<=@normalless + @let>=@normalgreater + @let+=@normalplus + @let$=@normaldollar %$ font-lock fix + @unsepspaces +} + +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of +% the literal character `\'. (Thus, \ is not expandable when this is in +% effect.) +% +@def@normalturnoffactive{@turnoffactive @let\=@normalbackslash} + +% Make _ and + \other characters, temporarily. +% This is canceled by @fixbackslash. +@otherifyactive + +% If a .fmt file is being used, we don't want the `\input texinfo' to show up. +% That is what \eatinput is for; after that, the `\' should revert to printing +% a backslash. +% +@gdef@eatinput input texinfo{@fixbackslash} +@global@let\ = @eatinput + +% On the other hand, perhaps the file did not have a `\input texinfo'. Then +% the first `\{ in the file would cause an error. This macro tries to fix +% that, assuming it is called before the first `\' could plausibly occur. +% Also back turn on active characters that might appear in the input +% file name, in case not using a pre-dumped format. +% +@gdef@fixbackslash{% + @ifx\@eatinput @let\ = @normalbackslash @fi + @catcode`+=@active + @catcode`@_=@active +} + +% Say @foo, not \foo, in error messages. +@escapechar = `@@ + +% These look ok in all fonts, so just make them not special. +@catcode`@& = @other +@catcode`@# = @other +@catcode`@% = @other + + +@c Local variables: +@c eval: (add-hook 'write-file-hooks 'time-stamp) +@c page-delimiter: "^\\\\message" +@c time-stamp-start: "def\\\\texinfoversion{" +@c time-stamp-format: "%:y-%02m-%02d.%02H" +@c time-stamp-end: "}" +@c End: + +@c vim:sw=2: + +@ignore + arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 +@end ignore Index: 1.0.8/doc-orig/thermal.pcb =================================================================== --- 1.0.8/doc-orig/thermal.pcb (nonexistent) +++ 1.0.8/doc-orig/thermal.pcb (revision 1136) @@ -0,0 +1,844 @@ +# release: pcb-bin 1.99q + +PCB["thermal" 300000 300000] + +Grid[5000.00000000 0 0 1] +Cursor[88600 72400 2.000000] +Thermal[0.500000] +DRC[699 400 800 800 1000 750] +Flags(0x0000000000000840) +Groups("1,s:2,c:3:4:5:6:7:8") +Styles["Signal,2500,30000,10000,0:Power,2500,6000,3500,1000:Fat,4000,6000,3500,1000:Skinny,200,2402,1181,600"] + +Symbol[' ' 1800] +( +) +Symbol['!' 1200] +( + SymbolLine[0 4500 0 5000 800] + SymbolLine[0 1000 0 3500 800] +) +Symbol['"' 1200] +( + SymbolLine[0 1000 0 2000 800] + SymbolLine[1000 1000 1000 2000 800] +) +Symbol['#' 1200] +( + SymbolLine[0 3500 2000 3500 800] + SymbolLine[0 2500 2000 2500 800] + SymbolLine[1500 2000 1500 4000 800] + SymbolLine[500 2000 500 4000 800] +) +Symbol['$' 1200] +( + SymbolLine[1500 1500 2000 2000 800] + SymbolLine[500 1500 1500 1500 800] + SymbolLine[0 2000 500 1500 800] + SymbolLine[0 2000 0 2500 800] + SymbolLine[0 2500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 4000 800] + SymbolLine[1500 4500 2000 4000 800] + SymbolLine[500 4500 1500 4500 800] + SymbolLine[0 4000 500 4500 800] + SymbolLine[1000 1000 1000 5000 800] +) +Symbol['%' 1200] +( + SymbolLine[0 1500 0 2000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1000 1000 800] + SymbolLine[1000 1000 1500 1500 800] + SymbolLine[1500 1500 1500 2000 800] + SymbolLine[1000 2500 1500 2000 800] + SymbolLine[500 2500 1000 2500 800] + SymbolLine[0 2000 500 2500 800] + SymbolLine[0 5000 4000 1000 800] + SymbolLine[3500 5000 4000 4500 800] + SymbolLine[4000 4000 4000 4500 800] + SymbolLine[3500 3500 4000 4000 800] + SymbolLine[3000 3500 3500 3500 800] + SymbolLine[2500 4000 3000 3500 800] + SymbolLine[2500 4000 2500 4500 800] + SymbolLine[2500 4500 3000 5000 800] + SymbolLine[3000 5000 3500 5000 800] +) +Symbol['&' 1200] +( + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 1500 0 2500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 3500 1500 2000 800] + SymbolLine[500 5000 1000 5000 800] + SymbolLine[1000 5000 2000 4000 800] + SymbolLine[0 2500 2500 5000 800] + SymbolLine[500 1000 1000 1000 800] + SymbolLine[1000 1000 1500 1500 800] + SymbolLine[1500 1500 1500 2000 800] + SymbolLine[0 3500 0 4500 800] +) +Symbol[''' 1200] +( + SymbolLine[0 2000 1000 1000 800] +) +Symbol['(' 1200] +( + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 4500 800] +) +Symbol[')' 1200] +( + SymbolLine[0 1000 500 1500 800] + SymbolLine[500 1500 500 4500 800] + SymbolLine[0 5000 500 4500 800] +) +Symbol['*' 1200] +( + SymbolLine[0 2000 2000 4000 800] + SymbolLine[0 4000 2000 2000 800] + SymbolLine[0 3000 2000 3000 800] + SymbolLine[1000 2000 1000 4000 800] +) +Symbol['+' 1200] +( + SymbolLine[0 3000 2000 3000 800] + SymbolLine[1000 2000 1000 4000 800] +) +Symbol[',' 1200] +( + SymbolLine[0 6000 1000 5000 800] +) +Symbol['-' 1200] +( + SymbolLine[0 3000 2000 3000 800] +) +Symbol['.' 1200] +( + SymbolLine[0 5000 500 5000 800] +) +Symbol['/' 1200] +( + SymbolLine[0 4500 3000 1500 800] +) +Symbol['0' 1200] +( + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4000 2000 2000 800] +) +Symbol['1' 1200] +( + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1000 1000 1000 5000 800] + SymbolLine[0 2000 1000 1000 800] +) +Symbol['2' 1200] +( + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 2000 1000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 2500 800] + SymbolLine[0 5000 2500 2500 800] + SymbolLine[0 5000 2500 5000 800] +) +Symbol['3' 1200] +( + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 3000 2000 3000 800] +) +Symbol['4' 1200] +( + SymbolLine[0 3000 2000 1000 800] + SymbolLine[0 3000 2500 3000 800] + SymbolLine[2000 1000 2000 5000 800] +) +Symbol['5' 1200] +( + SymbolLine[0 1000 2000 1000 800] + SymbolLine[0 1000 0 3000 800] + SymbolLine[0 3000 500 2500 800] + SymbolLine[500 2500 1500 2500 800] + SymbolLine[1500 2500 2000 3000 800] + SymbolLine[2000 3000 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['6' 1200] +( + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[0 3000 1500 3000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[2000 3500 2000 4500 800] +) +Symbol['7' 1200] +( + SymbolLine[0 5000 2500 2500 800] + SymbolLine[2500 1000 2500 2500 800] + SymbolLine[0 1000 2500 1000 800] +) +Symbol['8' 1200] +( + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 2500 500 3000 800] + SymbolLine[0 1500 0 2500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 2500 800] + SymbolLine[1500 3000 2000 2500 800] +) +Symbol['9' 1200] +( + SymbolLine[0 5000 2000 3000 800] + SymbolLine[2000 1500 2000 3000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 2500 800] + SymbolLine[0 2500 500 3000 800] + SymbolLine[500 3000 2000 3000 800] +) +Symbol[':' 1200] +( + SymbolLine[0 2500 500 2500 800] + SymbolLine[0 3500 500 3500 800] +) +Symbol[';' 1200] +( + SymbolLine[0 5000 1000 4000 800] + SymbolLine[1000 2500 1000 3000 800] +) +Symbol['<' 1200] +( + SymbolLine[0 3000 1000 2000 800] + SymbolLine[0 3000 1000 4000 800] +) +Symbol['=' 1200] +( + SymbolLine[0 2500 2000 2500 800] + SymbolLine[0 3500 2000 3500 800] +) +Symbol['>' 1200] +( + SymbolLine[0 2000 1000 3000 800] + SymbolLine[0 4000 1000 3000 800] +) +Symbol['?' 1200] +( + SymbolLine[1000 3000 1000 3500 800] + SymbolLine[1000 4500 1000 5000 800] + SymbolLine[0 1500 0 2000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 2000 800] + SymbolLine[1000 3000 2000 2000 800] +) +Symbol['@' 1200] +( + SymbolLine[0 1000 0 4000 800] + SymbolLine[0 4000 1000 5000 800] + SymbolLine[1000 5000 4000 5000 800] + SymbolLine[5000 3500 5000 1000 800] + SymbolLine[5000 1000 4000 0 800] + SymbolLine[4000 0 1000 0 800] + SymbolLine[1000 0 0 1000 800] + SymbolLine[1500 2000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 3000 3500 800] + SymbolLine[3000 3500 3500 3000 800] + SymbolLine[3500 3000 4000 3500 800] + SymbolLine[3500 3000 3500 1500 800] + SymbolLine[3500 2000 3000 1500 800] + SymbolLine[2000 1500 3000 1500 800] + SymbolLine[2000 1500 1500 2000 800] + SymbolLine[4000 3500 5000 3500 800] +) +Symbol['A' 1200] +( + SymbolLine[0 1500 0 5000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 2000 1000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 5000 800] + SymbolLine[0 3000 2500 3000 800] +) +Symbol['B' 1200] +( + SymbolLine[0 5000 2000 5000 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[2500 3500 2500 4500 800] + SymbolLine[2000 3000 2500 3500 800] + SymbolLine[500 3000 2000 3000 800] + SymbolLine[500 1000 500 5000 800] + SymbolLine[0 1000 2000 1000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 2500 800] + SymbolLine[2000 3000 2500 2500 800] +) +Symbol['C' 1200] +( + SymbolLine[500 5000 2000 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 2000 1000 800] +) +Symbol['D' 1200] +( + SymbolLine[500 1000 500 5000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 4500 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[0 5000 2000 5000 800] + SymbolLine[0 1000 2000 1000 800] +) +Symbol['E' 1200] +( + SymbolLine[0 3000 1500 3000 800] + SymbolLine[0 5000 2000 5000 800] + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 1000 2000 1000 800] +) +Symbol['F' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 1000 2000 1000 800] + SymbolLine[0 3000 1500 3000 800] +) +Symbol['G' 1200] +( + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[500 1000 2000 1000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 2000 5000 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[2500 3500 2500 4500 800] + SymbolLine[2000 3000 2500 3500 800] + SymbolLine[1000 3000 2000 3000 800] +) +Symbol['H' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[2500 1000 2500 5000 800] + SymbolLine[0 3000 2500 3000 800] +) +Symbol['I' 1200] +( + SymbolLine[0 1000 1000 1000 800] + SymbolLine[500 1000 500 5000 800] + SymbolLine[0 5000 1000 5000 800] +) +Symbol['J' 1200] +( + SymbolLine[0 1000 1500 1000 800] + SymbolLine[1500 1000 1500 4500 800] + SymbolLine[1000 5000 1500 4500 800] + SymbolLine[500 5000 1000 5000 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['K' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 3000 2000 1000 800] + SymbolLine[0 3000 2000 5000 800] +) +Symbol['L' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 5000 2000 5000 800] +) +Symbol['M' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 1000 1500 2500 800] + SymbolLine[1500 2500 3000 1000 800] + SymbolLine[3000 1000 3000 5000 800] +) +Symbol['N' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 1000 0 1500 800] + SymbolLine[0 1500 2500 4000 800] + SymbolLine[2500 1000 2500 5000 800] +) +Symbol['O' 1200] +( + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['P' 1200] +( + SymbolLine[500 1000 500 5000 800] + SymbolLine[0 1000 2000 1000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 2500 800] + SymbolLine[2000 3000 2500 2500 800] + SymbolLine[500 3000 2000 3000 800] +) +Symbol['Q' 1200] +( + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[1000 4000 2000 5000 800] +) +Symbol['R' 1200] +( + SymbolLine[0 1000 2000 1000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 2500 800] + SymbolLine[2000 3000 2500 2500 800] + SymbolLine[500 3000 2000 3000 800] + SymbolLine[500 1000 500 5000 800] + SymbolLine[500 3000 2500 5000 800] +) +Symbol['S' 1200] +( + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[500 1000 2000 1000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 2500 800] + SymbolLine[0 2500 500 3000 800] + SymbolLine[500 3000 2000 3000 800] + SymbolLine[2000 3000 2500 3500 800] + SymbolLine[2500 3500 2500 4500 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[500 5000 2000 5000 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['T' 1200] +( + SymbolLine[0 1000 2000 1000 800] + SymbolLine[1000 1000 1000 5000 800] +) +Symbol['U' 1200] +( + SymbolLine[0 1000 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[2000 1000 2000 4500 800] +) +Symbol['V' 1200] +( + SymbolLine[0 1000 0 4000 800] + SymbolLine[0 4000 1000 5000 800] + SymbolLine[1000 5000 2000 4000 800] + SymbolLine[2000 1000 2000 4000 800] +) +Symbol['W' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 5000 1500 3500 800] + SymbolLine[1500 3500 3000 5000 800] + SymbolLine[3000 1000 3000 5000 800] +) +Symbol['X' 1200] +( + SymbolLine[0 1000 0 1500 800] + SymbolLine[0 1500 2500 4000 800] + SymbolLine[2500 4000 2500 5000 800] + SymbolLine[0 4000 0 5000 800] + SymbolLine[0 4000 2500 1500 800] + SymbolLine[2500 1000 2500 1500 800] +) +Symbol['Y' 1200] +( + SymbolLine[0 1000 0 1500 800] + SymbolLine[0 1500 1000 2500 800] + SymbolLine[1000 2500 2000 1500 800] + SymbolLine[2000 1000 2000 1500 800] + SymbolLine[1000 2500 1000 5000 800] +) +Symbol['Z' 1200] +( + SymbolLine[0 1000 2500 1000 800] + SymbolLine[2500 1000 2500 1500 800] + SymbolLine[0 4000 2500 1500 800] + SymbolLine[0 4000 0 5000 800] + SymbolLine[0 5000 2500 5000 800] +) +Symbol['[' 1200] +( + SymbolLine[0 1000 500 1000 800] + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 5000 500 5000 800] +) +Symbol['\' 1200] +( + SymbolLine[0 1500 3000 4500 800] +) +Symbol[']' 1200] +( + SymbolLine[0 1000 500 1000 800] + SymbolLine[500 1000 500 5000 800] + SymbolLine[0 5000 500 5000 800] +) +Symbol['^' 1200] +( + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1000 1500 800] +) +Symbol['_' 1200] +( + SymbolLine[0 5000 2000 5000 800] +) +Symbol['a' 1200] +( + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[2000 3000 2000 4500 800] + SymbolLine[2000 4500 2500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] +) +Symbol['b' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[2000 3500 2000 4500 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[0 3500 500 3000 800] +) +Symbol['c' 1200] +( + SymbolLine[500 3000 2000 3000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 2000 5000 800] +) +Symbol['d' 1200] +( + SymbolLine[2000 1000 2000 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] +) +Symbol['e' 1200] +( + SymbolLine[500 5000 2000 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[0 4000 2000 4000 800] + SymbolLine[2000 4000 2000 3500 800] +) +Symbol['f' 1000] +( + SymbolLine[500 1500 500 5000 800] + SymbolLine[500 1500 1000 1000 800] + SymbolLine[1000 1000 1500 1000 800] + SymbolLine[0 3000 1000 3000 800] +) +Symbol['g' 1200] +( + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[0 6000 500 6500 800] + SymbolLine[500 6500 1500 6500 800] + SymbolLine[1500 6500 2000 6000 800] + SymbolLine[2000 3000 2000 6000 800] +) +Symbol['h' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 5000 800] +) +Symbol['i' 1000] +( + SymbolLine[0 2000 0 2500 800] + SymbolLine[0 3500 0 5000 800] +) +Symbol['j' 1000] +( + SymbolLine[500 2000 500 2500 800] + SymbolLine[500 3500 500 6000 800] + SymbolLine[0 6500 500 6000 800] +) +Symbol['k' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 3500 1500 5000 800] + SymbolLine[0 3500 1000 2500 800] +) +Symbol['l' 1000] +( + SymbolLine[0 1000 0 4500 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['m' 1200] +( + SymbolLine[500 3500 500 5000 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[1000 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 5000 800] + SymbolLine[2000 3500 2500 3000 800] + SymbolLine[2500 3000 3000 3000 800] + SymbolLine[3000 3000 3500 3500 800] + SymbolLine[3500 3500 3500 5000 800] + SymbolLine[0 3000 500 3500 800] +) +Symbol['n' 1200] +( + SymbolLine[500 3500 500 5000 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[1000 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 5000 800] + SymbolLine[0 3000 500 3500 800] +) +Symbol['o' 1200] +( + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['p' 1200] +( + SymbolLine[500 3500 500 6500 800] + SymbolLine[0 3000 500 3500 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[1000 3000 2000 3000 800] + SymbolLine[2000 3000 2500 3500 800] + SymbolLine[2500 3500 2500 4500 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[1000 5000 2000 5000 800] + SymbolLine[500 4500 1000 5000 800] +) +Symbol['q' 1200] +( + SymbolLine[2000 3500 2000 6500 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] +) +Symbol['r' 1200] +( + SymbolLine[500 3500 500 5000 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[1000 3000 2000 3000 800] + SymbolLine[0 3000 500 3500 800] +) +Symbol['s' 1200] +( + SymbolLine[500 5000 2000 5000 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[2000 4000 2500 4500 800] + SymbolLine[500 4000 2000 4000 800] + SymbolLine[0 3500 500 4000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 2000 3000 800] + SymbolLine[2000 3000 2500 3500 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['t' 1000] +( + SymbolLine[500 1000 500 4500 800] + SymbolLine[500 4500 1000 5000 800] + SymbolLine[0 2500 1000 2500 800] +) +Symbol['u' 1200] +( + SymbolLine[0 3000 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[2000 3000 2000 4500 800] +) +Symbol['v' 1200] +( + SymbolLine[0 3000 0 4000 800] + SymbolLine[0 4000 1000 5000 800] + SymbolLine[1000 5000 2000 4000 800] + SymbolLine[2000 3000 2000 4000 800] +) +Symbol['w' 1200] +( + SymbolLine[0 3000 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1000 5000 800] + SymbolLine[1000 5000 1500 4500 800] + SymbolLine[1500 3000 1500 4500 800] + SymbolLine[1500 4500 2000 5000 800] + SymbolLine[2000 5000 2500 5000 800] + SymbolLine[2500 5000 3000 4500 800] + SymbolLine[3000 3000 3000 4500 800] +) +Symbol['x' 1200] +( + SymbolLine[0 3000 2000 5000 800] + SymbolLine[0 5000 2000 3000 800] +) +Symbol['y' 1200] +( + SymbolLine[0 3000 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[2000 3000 2000 6000 800] + SymbolLine[1500 6500 2000 6000 800] + SymbolLine[500 6500 1500 6500 800] + SymbolLine[0 6000 500 6500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] +) +Symbol['z' 1200] +( + SymbolLine[0 3000 2000 3000 800] + SymbolLine[0 5000 2000 3000 800] + SymbolLine[0 5000 2000 5000 800] +) +Symbol['{' 1200] +( + SymbolLine[500 1500 1000 1000 800] + SymbolLine[500 1500 500 2500 800] + SymbolLine[0 3000 500 2500 800] + SymbolLine[0 3000 500 3500 800] + SymbolLine[500 3500 500 4500 800] + SymbolLine[500 4500 1000 5000 800] +) +Symbol['|' 1200] +( + SymbolLine[0 1000 0 5000 800] +) +Symbol['}' 1200] +( + SymbolLine[0 1000 500 1500 800] + SymbolLine[500 1500 500 2500 800] + SymbolLine[500 2500 1000 3000 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[500 3500 500 4500 800] + SymbolLine[0 5000 500 4500 800] +) +Symbol['~' 1200] +( + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1000 3000 800] + SymbolLine[1000 3000 1500 3500 800] + SymbolLine[1500 3500 2000 3500 800] + SymbolLine[2000 3500 2500 3000 800] +) +Via[45000 135000 30000 10000 0 10000 "" "thermal(0S)"] +Via[255000 135000 30000 10000 0 10000 "" ""] +Via[150000 135000 30000 10000 0 10000 "" "thermal(0)"] +Layer(1 "component") +( + Polygon("clearpoly") + ( + [5000 95000] [290000 95000] [290000 175000] [5000 175000] + ) +) +Layer(2 "solder") +( +) +Layer(3 "GND") +( +) +Layer(4 "power") +( +) +Layer(5 "signal1") +( +) +Layer(6 "signal2") +( +) +Layer(7 "unused") +( +) +Layer(8 "unused") +( +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( + Line[255000 180000 255000 160000 2500 10000 "clearline"] + Line[255000 160000 260000 165000 2500 10000 "clearline"] + Line[45000 160000 50000 165000 2500 10000 "clearline"] + Line[45000 160000 40000 165000 2500 10000 "clearline"] + Line[45000 180000 45000 160000 2500 10000 "clearline"] + Line[255000 160000 250000 165000 2500 10000 "clearline"] + Line[150000 160000 155000 165000 2500 10000 "clearline"] + Line[150000 160000 145000 165000 2500 10000 "clearline"] + Line[150000 180000 150000 160000 2500 10000 "clearline"] + Text[220000 190000 0 200 "no connection" ""] + Text[15000 180000 0 200 "Via/Pin with " ""] + Text[5000 190000 0 200 "solid connection " ""] + Text[225000 180000 0 200 "Via/Pin with" ""] + Text[120000 180000 0 200 "Via/Pin with " ""] + Text[130000 190000 0 200 "thermal" ""] +) Index: 1.0.8/doc-orig/thermal.pdf =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-orig/thermal.pdf =================================================================== --- 1.0.8/doc-orig/thermal.pdf (nonexistent) +++ 1.0.8/doc-orig/thermal.pdf (revision 1136) Property changes on: 1.0.8/doc-orig/thermal.pdf ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-orig/thermal.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-orig/thermal.png =================================================================== --- 1.0.8/doc-orig/thermal.png (nonexistent) +++ 1.0.8/doc-orig/thermal.png (revision 1136) Property changes on: 1.0.8/doc-orig/thermal.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-orig/version.texi =================================================================== --- 1.0.8/doc-orig/version.texi (nonexistent) +++ 1.0.8/doc-orig/version.texi (revision 1136) @@ -0,0 +1,4 @@ +@set UPDATED 17 September 2011 +@set UPDATED-MONTH September 2011 +@set EDITION 20110918 +@set VERSION 20110918 Index: 1.0.8/doc-orig/wire_size.tab =================================================================== --- 1.0.8/doc-orig/wire_size.tab (nonexistent) +++ 1.0.8/doc-orig/wire_size.tab (revision 1136) @@ -0,0 +1,102 @@ +# $Id$ +# + +97 .0059 +96 .0063 +95 .0067 +94 .0071 +93 .0075 +92 .0079 +91 .0083 +90 .0087 +89 .0091 +88 .0095 +87 .0100 +86 .0105 +85 .0110 +84 .0115 +83 .0120 +82 .0125 +81 .0130 +80 .0135 +79 .0145 +78 .0160 +77 .0180 +76 .0200 +75 .0210 +74 .0225 +73 .0240 +72 .0250 +71 .0260 +70 .0280 +69 .0292 +68 .0310 +67 .0320 +66 .0330 +65 .0350 +64 .0360 +63 .0370 +62 .0380 +61 .0390 +60 .0400 +59 .0410 +58 .0420 +57 .0430 +56 .0465 +55 .0520 +54 .0550 +53 .0595 +52 .0635 +51 .0670 +50 .0700 +49 .0730 +48 .0760 +47 .0785 +46 .0810 +45 .0820 +44 .0860 +43 .0890 +42 .0935 +41 .0960 +40 .0980 +39 .0995 +38 .1015 +37 .1040 +36 .1065 +35 .1100 +34 .1110 +33 .1130 +32 .1160 +31 .1200 +30 .1285 +29 .1360 +28 .1405 +27 .1440 +26 .1470 +25 .1495 +24 .1520 +23 .1540 +22 .1570 +21 .1590 +20 .1610 +19 .1660 +18 .1695 +17 .1730 +16 .1770 +15 .1800 +14 .1820 +13 .1850 +12 .1890 +11 .1910 +10 .1935 +9 .1960 +8 .1990 +7 .2010 +6 .2040 +5 .2055 +4 .2090 +3 .2130 +2 .2210 +1 .2280 + + Index: 1.0.8/doc-orig/wire_size.texi =================================================================== --- 1.0.8/doc-orig/wire_size.texi (nonexistent) +++ 1.0.8/doc-orig/wire_size.texi (revision 1136) @@ -0,0 +1,40 @@ +@c Generated file. Do not edit directly +@c $Id$ +@multitable @columnfractions 0.167 0.167 0.167 0.167 0.167 0.167 +@item Drill @tab Diameter @tab Drill @tab Diameter @tab Drill @tab Diameter +@item Size @tab (inches) @tab Size @tab (inches) @tab Size @tab (inches) + +@item 97 @tab .0059 @tab 96 @tab .0063 @tab 95 @tab .0067 +@item 94 @tab .0071 @tab 93 @tab .0075 @tab 92 @tab .0079 +@item 91 @tab .0083 @tab 90 @tab .0087 @tab 89 @tab .0091 +@item 88 @tab .0095 @tab 87 @tab .0100 @tab 86 @tab .0105 +@item 85 @tab .0110 @tab 84 @tab .0115 @tab 83 @tab .0120 +@item 82 @tab .0125 @tab 81 @tab .0130 @tab 80 @tab .0135 +@item 79 @tab .0145 @tab 78 @tab .0160 @tab 77 @tab .0180 +@item 76 @tab .0200 @tab 75 @tab .0210 @tab 74 @tab .0225 +@item 73 @tab .0240 @tab 72 @tab .0250 @tab 71 @tab .0260 +@item 70 @tab .0280 @tab 69 @tab .0292 @tab 68 @tab .0310 +@item 67 @tab .0320 @tab 66 @tab .0330 @tab 65 @tab .0350 +@item 64 @tab .0360 @tab 63 @tab .0370 @tab 62 @tab .0380 +@item 61 @tab .0390 @tab 60 @tab .0400 @tab 59 @tab .0410 +@item 58 @tab .0420 @tab 57 @tab .0430 @tab 56 @tab .0465 +@item 55 @tab .0520 @tab 54 @tab .0550 @tab 53 @tab .0595 +@item 52 @tab .0635 @tab 51 @tab .0670 @tab 50 @tab .0700 +@item 49 @tab .0730 @tab 48 @tab .0760 @tab 47 @tab .0785 +@item 46 @tab .0810 @tab 45 @tab .0820 @tab 44 @tab .0860 +@item 43 @tab .0890 @tab 42 @tab .0935 @tab 41 @tab .0960 +@item 40 @tab .0980 @tab 39 @tab .0995 @tab 38 @tab .1015 +@item 37 @tab .1040 @tab 36 @tab .1065 @tab 35 @tab .1100 +@item 34 @tab .1110 @tab 33 @tab .1130 @tab 32 @tab .1160 +@item 31 @tab .1200 @tab 30 @tab .1285 @tab 29 @tab .1360 +@item 28 @tab .1405 @tab 27 @tab .1440 @tab 26 @tab .1470 +@item 25 @tab .1495 @tab 24 @tab .1520 @tab 23 @tab .1540 +@item 22 @tab .1570 @tab 21 @tab .1590 @tab 20 @tab .1610 +@item 19 @tab .1660 @tab 18 @tab .1695 @tab 17 @tab .1730 +@item 16 @tab .1770 @tab 15 @tab .1800 @tab 14 @tab .1820 +@item 13 @tab .1850 @tab 12 @tab .1890 @tab 11 @tab .1910 +@item 10 @tab .1935 @tab 9 @tab .1960 @tab 8 @tab .1990 +@item 7 @tab .2010 @tab 6 @tab .2040 @tab 5 @tab .2055 +@item 4 @tab .2090 @tab 3 @tab .2130 @tab 2 @tab .2210 +@item 1 @tab .2280 @tab @tab @tab @tab @end multitable + Index: 1.0.8/doc-rnd/Makefile =================================================================== --- 1.0.8/doc-rnd/Makefile (nonexistent) +++ 1.0.8/doc-rnd/Makefile (revision 1136) @@ -0,0 +1,7 @@ +MENU_RES=../src/gpcb-menu.res ../src/pcb-menu.res +KEYLIST=../util/keylist.sh + +all: keys.html + +keys.html: $(MENU_RES) $(KEYLIST) + $(KEYLIST) $(MENU_RES) > keys.html \ No newline at end of file Index: 1.0.8/doc-rnd/README =================================================================== --- 1.0.8/doc-rnd/README (nonexistent) +++ 1.0.8/doc-rnd/README (revision 1136) @@ -0,0 +1,4 @@ +pcb-rnd "diff" documentation: this directory contains documentation +on the features that differ from the original pcb version it was forked from. + +Documentation of the original version can be found in ../doc-orig Index: 1.0.8/doc-rnd/TODO =================================================================== --- 1.0.8/doc-rnd/TODO (nonexistent) +++ 1.0.8/doc-rnd/TODO (revision 1136) @@ -0,0 +1,51 @@ +BUGS +- gpmi (and other buildings/plugins) not showing up in the about box + + +CLEANUP #3 +- scconfig: detect libstroke +- libstroke: zoom +- cleanup resources: + - better tree structs with less hidden properties (minor change in the res format: always require key=val pairs) + - gtk, lesstif: reorganize the code so that: + - menus are always created using a path (ghid_main_menu_real_add_resource) + - res->menu should be a common code + - dynamic menus for plugins + - gpmi: + - hid: hid_destroy (pair of hid_create) + - cleanup on unload: remove menus +- check whether local copy of gts is needed, bisect when toporouter broke + + + +FEATURES +- UI: trace length calculation {small} +- UI: be able to manually change text line width {small} +- CORE: clear poly should be a per layer flag (on each objects) {?} +- CORE: inverse text {medium} +- BUILD: menuconfig and a config file for scconfig +- split line segment into two (insert line point in the middle) + +Low prio: +- display net names on pins, vias (and maybe tracks?) when zoomed in enough +- DRC should warn for thin poly hair +- prev grid size, next grid size +- rotate shaped vias don't rotate the shape (is via rotated at all?) +- new examples + - blinking led with parametric footprints + - example of nonetlist: 1206 jumpers and logos +- decide what to do with old doc - texi doesn't seem to work at all +- rethink/rewrite the action/change infrastructure - too many void *ptr1 + pointers, too many code duplication +- double sided board, poly on both layers; grab existing lines on one layer and + move then around. If all layers are visible, redraw of the far side layer + is slow and causes flickering elements from that layer until the front is + redrawn. Maybe we should have less flushes? +- gpmi: + - dialog: attribute dialog: mini parser from text + - fix debug draw in the gtk hid + - ACTE_action(): coords should not be int but Coord + - get timers to work +- win32 port {large} + - clean up central Makefile.in rules: + - remove cat, sed, grep where possible, use scconfig instead Index: 1.0.8/doc-rnd/ba.html =================================================================== --- 1.0.8/doc-rnd/ba.html (nonexistent) +++ 1.0.8/doc-rnd/ba.html (revision 1136) @@ -0,0 +1,50 @@ + + +

pcb-rnd - the [ba] patches

+Back annotation was a long standing missing functionality. There has been +different suggestions, including: +
    +
  • back annotation is not needed at all, the user can do it manually +
  • pcb should generate a new netlist, the user should run diff on the netlists and manually edit the schematics +
  • gschem should be able to load netlists emitted by PCB; or gnetlist could reverse-process such a netlist +
+

+The current implementation allows pcb-rnd users to make deliberate pin +swapping and footprint replacement. The changes can be saved in a +"netlist patch" format. A modified gschem can load these and present them +as search results pointing to parts of the schematics that need to be changed. +There is a +demo video about how this happens in practice. +

+The modified gschem can be checked out from svn://repo.hu/geda-gaf-ba/trunk +

+The underlying mechanism is versatile and potentially allows more changes +to be back annotated. These are not yet accessible due to the lack of PCB +actions and GUI. + +

Design decisions

+This devlog entry functions +as a design decision document. + Another entry is a summary +on how the feature ended up in a private feature-fork of gschem. + +

save/load and compatibility

+Deliberate changes are tracked so that a new forward annotation from +the old schematics won't break them. To do this, pcb-rnd saves a +NetListPatch() section in the file. Mainline PCB can not handle this section. +Compatibility, by use case: +
    +
  • 1. No back annotation is made in pcb-rnd: the file stays compatible +
  • 2. Back annotation is made in pcb-rnd, then the changes are done on the schematics and a forward annotation is also done: the netlist patch in pcb-rnd becomes empty so the pcb file is again compatible with mainline pcb; this is called resolution of netlist patches +
  • 3. There are unresolved netlist patches saved in pcb-rnd and the user attempts to load the pcb file in mainline pcb: syntax error (but no data loss); solution: resolve the netlist patch as described in point 2. +
  • 4. Cheat for situation 3.: manually remove the NetListPatch() section from the save file. This way the back annotation info is lost, but mainline pcb can load the file again. This action is sort of "revert back annotation". +
  • 5. Any file saved by mainline PCB can be opened by pcb-rnd, back annotation does not affect that. + +
+ + +

plans

+Back annotation for further changes, e.g. value change, naming/renaming nets, +etc. + + Index: 1.0.8/doc-rnd/cycdrag.html =================================================================== --- 1.0.8/doc-rnd/cycdrag.html (nonexistent) +++ 1.0.8/doc-rnd/cycdrag.html (revision 1136) @@ -0,0 +1,28 @@ + + +

pcb-rnd - the [cycdrag] patches

+ +A long standing misfeature of pcb (and pcb-rnd) has been that when dragging the +end of connected traces, pcb chosen one of the traces "randomly". It often +didn't pick the one the user wanted to move. The workaround was to move the +one that pcb picked and then return and move the target trace then +move the other trace back. This gets even more annoying if there are more than +two objects connected in the given point: 3 traces and a via for example. +

+The cycdrag patch addresses this issue by defining an action that can cycle +through objects that could be dragged in the given point while the left mouse +button is pressed. This lets the user explicitly select the one object to +work on. +

+This demo video +demonstrates how it works with three lines and a via. + +

save/load and compatibility

+Not affected. + +

plans

+It does not work with the lesstif HID. It does not work with the rubber band +mode. + + + Index: 1.0.8/doc-rnd/debian.html =================================================================== --- 1.0.8/doc-rnd/debian.html (nonexistent) +++ 1.0.8/doc-rnd/debian.html (revision 1136) @@ -0,0 +1,18 @@ + + +

pcb-rnd - the [debian] patch

+ +The name of the package has been changed to pcb-rnd; a conflict with the +vanilla pcb is set. +

+The lesstif variant and pcb documentation are not compiled or packaged +- I don't need them. The possibility is still there to compile them, tho. +

+The gtk variant (pcb-rnd-gtk) has both dbus and gl disabled. +

+Versioning scheme changed to match svn revisions and tags of pcb-rnd. + +

plans

+No plans - this feature is fully implemented. + + Index: 1.0.8/doc-rnd/devlog/20150731a_menu.html =================================================================== --- 1.0.8/doc-rnd/devlog/20150731a_menu.html (nonexistent) +++ 1.0.8/doc-rnd/devlog/20150731a_menu.html (revision 1136) @@ -0,0 +1,59 @@ + + +

pcb-rnd devlog

+

Dynamic menus

+

Background

+Before integrating gpmi scripting, pcb-rnd needs to be prepared to +interface with the scripts. The engine is pretty much ready since ages: +the action interface is ideal for scripts to register their actions or +execute existing actions. This also means the command line and batch +UI are instantly connected with scripts. +

+The only largely visible remaining portion is the GUI. pcb-gpmi supports +building dialog boxes using the current HID (so called attribute dialogs, +originally invented for exporter settings) and calling some simpler predefined +dialogs like a progress bar or alert. +

+What's really missing is a way to create new menus on the fly. The user +loads a script and the script makes up a menu with submenus, all bound to +the proper actions. +

+This introduces a nice dilemma, tho: there is a real cool menu configuration +file that makes the user able to reconfigure the menu system, hot keys, tool +tips and whatnot (I wish more applications had this feature!). What if a script +comes in and trolls the whole thing creating random menus at surprising +places in the menu system? How the user can control what the script could do +with his preciously crafted menu setup tailored to his own preferences? +

+I believe in sharp tools and careful users. I indeed plan to allow scripts to +do whatever they want with the menu system but I invent some conventions too. +As long as scripts stick to these conventions, the user retain control over +the menu layout. + +

How it works

+ +PCB reads *menu.res and builds the gui on startup; the menu system is +static after that point. pcb-rnd does the same on startup but also +stores all menus (referenced by their paths, like "/File/Save as") in a +hash table. Later on a call to a new hid function (create_menu()) can +create new menus or submenus, extending the menu tree at any point. +

+When a new menu "/File/foo" is created, using the hash create_menu() +finds out that /File already exists and doesn't create it but use the +existing widget from the hash. This means if the user creates menus from +the res file that are also created by the script, the res file sort of +overrides the script's later actions as all those menus will already exist +by the time the script tries to create them. +

+And here comes the conventions part: +

    +
  • there will be a new menu, called "/Plugins" +
  • each plugin should have its own submenu there (gpmi for scripting: "/Plugins/GPMI scripting") +
  • each script is just a child of the gpmi plugin so it should have its submenus under "Plugins/GPMI scripting/scriptname" +
+ +As long as plugins and scripts stick to this convention, the user can +create all the menus for all the plugins and scripts in advance. Stock +menu res files will have the /Plugin menu at least, so its place is fixed. + + Index: 1.0.8/doc-rnd/devlog/20150731b_gtk.html =================================================================== --- 1.0.8/doc-rnd/devlog/20150731b_gtk.html (nonexistent) +++ 1.0.8/doc-rnd/devlog/20150731b_gtk.html (revision 1136) @@ -0,0 +1,36 @@ + + +

pcb-rnd devlog

+

dynamic gtk menus

+As described in the previous post, +pcb-rnd will feature dynamic menus. I first implemented this in the +gtk hid. +

+It turned out gtk was way too OOP for my taste1. It took about 6 +hours total, to implement and debug the feature. (As a comparison, it +took about 90 minutes to make the research related to +the resource structs in PCB and implement the HID modifications for +the new hid command). The trickiest part was +to figure the need of calling a show() on the menubar after adding +the new items. +

+When I didn't have that, only plain action menu/submenus showed up +(in already existing menu/ widgets), but +new (main) menus and menu/submenu/submenus didn't. After many hours of gdb +sessions I finally made sure (by printing all the widgets to stderr +recursively) that: +

    +
  • I am really adding the new widgets... +
  • ... under the right parent +
  • ... with the right properties +
+Then I also printed allocated dimensions and coordinates - but the values +were misleading. Finally I figured there was different flags like realization +and visibility, so printed them too. This revealed that all my new menus were +there in an invisible state. +
+

Footnotes

+1: not because of the show() call, but because of the way objects +are stored in memory: too many generic pointers casted forth and back, makes it +really hard to print all properties of a menu item (including its label) +with gdb. Index: 1.0.8/doc-rnd/devlog/20150801a_events.html =================================================================== --- 1.0.8/doc-rnd/devlog/20150801a_events.html (nonexistent) +++ 1.0.8/doc-rnd/devlog/20150801a_events.html (revision 1136) @@ -0,0 +1,22 @@ + + +

pcb-rnd devlog

+

events

+PCB has a nice action infrastructure: most user actions are +implemented in smallish functions taking (int argc, char *argv[]). Menu +items, hotkeys, the command line and batch processing just call these +actions. This is the user->pcb_core direction of commands. +

+Before adding scripting to pcb-rnd, the other direction (pcb_core->user) has +to be implemented: an event infrastructure. Random parts of the core +or the HID code will yield events using a simple vararg event() function. +Other parts of PCB, especially plugins, can bind (sign up to) events with +function pointers. When an event is triggered, all functions signed up to +the event are called (in random order). +

+Passing arguments to events is similar to the arguments of actions, except +argv[] is not a char *[], but an event_arg_t *[]. event_arg_t has an enum +field for argument type and an union for the argument value. This means the +API is binary: integers are passed as integers, not as strings. + + Index: 1.0.8/doc-rnd/devlog/20150803a_scriptig.html =================================================================== --- 1.0.8/doc-rnd/devlog/20150803a_scriptig.html (nonexistent) +++ 1.0.8/doc-rnd/devlog/20150803a_scriptig.html (revision 1136) @@ -0,0 +1,36 @@ + + +

pcb-rnd devlog

+

scripting

+Most of the infrastructure for a scriptable pcb had been there in pcb-gpmi. +I had also finished some gpmi cleanup and pcb +(menu and + events ) subprojects last week. +These made it easier to get to reach the current status after a weekend +coding marathon: +
    +
  • dialog boxes for managing (loading/unloading) scripts -- check out the videos: + list scripts and get details or + load a new script + + +
  • import, test, extend the glue layer; scripts can: +
      +
    • register new actions +
    • create new menus and submenus +
    • execute existing actions +
    • pop up simple dialog boxes (message, report, progress bar, file selection) -- check out the video +
    • build and pop up custom dialog boxes (so called attribute dialogs) +
    • search for objects (lines, arc, polys, vias, etc.) on the layout +
    • create new objects on the layout +
    • change "page" properties (dimensions of the board) +
    • debug draw on the gui (slightly broken on gtk due to some gtk hid bugs) +
    +
+

+My example scripts are written in awk, lua and tcl +at this point, but gpmi supports 7 other languages +(scheme, stutter (lisp), pascal, perl +php, python, ruby) which are also available in +pcb-rnd. + Index: 1.0.8/doc-rnd/devlog/20150816a_scriptig.html =================================================================== --- 1.0.8/doc-rnd/devlog/20150816a_scriptig.html (nonexistent) +++ 1.0.8/doc-rnd/devlog/20150816a_scriptig.html (revision 1136) @@ -0,0 +1,28 @@ + + +

pcb-rnd devlog

+

scripting, 2

+I've been working on the documentation for pcb-rnd scripting lately. +Proof reading and comments would be appreciated. The documents are +work-in-progress. +

+I have a Rosetta stone +of examples demonstrating how to write simple scripts. +It doesn't explain how the system works, but shows easy-to-understand +practical examples. Useful for those who like learn by doing and look up +the "theoretical" background only after seeing things in practice. +

+Another document, the +scripting intro focuses on explaining how things are built up. This +one is useful for those who first want to understand the design and then +look at how to do things in practice. +

+As a next step I plan to reorganize the package documentation and split +them all into a high level "what's the concept" doc and a low level +reference manual. +

+I also plan to improve the links between the docs and write more rosetta +examples. I plan to have a few more all-language examples on the most +basic things. The more complex examples would be written in awk, lua and +maybe ruby. + Index: 1.0.8/doc-rnd/devlog/20150820a_dimensions.html =================================================================== --- 1.0.8/doc-rnd/devlog/20150820a_dimensions.html (nonexistent) +++ 1.0.8/doc-rnd/devlog/20150820a_dimensions.html (revision 1136) @@ -0,0 +1,24 @@ + + +

pcb-rnd devlog

+

fp2anim dimensions

+After attacking the qfn()/qfp() parametric footprint problem today, +I realized fp2anim lacked a very important feature: dimension lines. +The footprint being generated is to match the datasheet. Checking the match +requires visible dimensions. +

+The new feature of fp2anim is to optionally display custom dimensions on +the preview. Generator scripts print #dimension comments in the footprint +file (not breaking the file format). The generator passes on a dimension +name along with the value. As a first attempt my conventions are: +

    +
  • add dimension lines for dimension type input parameters +
  • add dimension lines for calculated dimensions if they are likely to be informative and be included in the datasheet +
+ +

fp2anim vector font

+While working on the dimensions, I realized I had to switch to vector fonts: +the built-in pixel font of animator can not be rotated. The size of a vector +font text can be calculated, which also enables fp2anim to optionally place +semi-transparent bars behind the text to make it more visible on dark background +(like pads). Index: 1.0.8/doc-rnd/devlog/20150820b_qf.html =================================================================== --- 1.0.8/doc-rnd/devlog/20150820b_qf.html (nonexistent) +++ 1.0.8/doc-rnd/devlog/20150820b_qf.html (revision 1136) @@ -0,0 +1,27 @@ + + +

pcb-rnd devlog

+

qf()

+The next group of footprints I decided to generate are qfn(), tqfp(), lqfp(). +The generic set of rules for these footprints is: +
    +
  • there is a virtual rectangle that forms rows of pads +
  • pads are evenly spaced among the edges of that rectangle +
  • pin numbering is counter-clockwise +
  • the body of the part may be inside of the rectangle or may extend over the pads +
+ +

low level flexibility vs. high level comfort

+qf() currently has 14 arguments. It is flexible enough to generate qfn, tqfp, +lqfp, and anything similar I've seen in the package datasheet of a major +vendor. However, it is not straight forward to convert datasheet tables +into qf() parameters. +

+On the other hand, in practice we need qfn() and tqfp(), which are special +cases of qf(). To nail the common use cases, qfn() and tqfp() narrows down +the number of parameters to 3..4. Even better, these parameters are exactly +those that are in the name of a typical QFN or TQFP footprint or in the first +few lines of the dimensions table. I call these scripts frontends to qf(). +

+This makes the common footprints very easy to produce using frontends while +leaves a (bit more complicated) plan B, qf(), for special cases. Index: 1.0.8/doc-rnd/devlog/20150821a_parametric_requirements.html =================================================================== --- 1.0.8/doc-rnd/devlog/20150821a_parametric_requirements.html (nonexistent) +++ 1.0.8/doc-rnd/devlog/20150821a_parametric_requirements.html (revision 1136) @@ -0,0 +1,32 @@ + + +

pcb-rnd devlog

+

requirements for parametric footprint generation

+ +It's appealing to write parametric footprint generators for new footprint +families: invest some time once, and have a tool that can spit out +dozens of footprints. However, it is not always worth having a generator +instead of static footprints. The minimal requirements for a generator are: + +
    + +
  • the footprint family is a series of footprints that can be generated +using the same code, with changing some base properties (e.g. number of +pins) + +
  • dimensions and other properties can be calculated from the base +properties with reasonable formulas and conditional code; e.g. sot* is not +a good candidate for generation, as sot23 or sot89 can not be generated +from some common anestor by varying one or two parameters, but would need +a large table that translates package name to a pattern - easier to keep +those in static footprint files + +
  • has a reasonable amount of existing variations; e.g. it is not worth +writing a generator for the dsub family because there are only a few of +them in common use (db9, db15, db25, and maybe db37). + +
  • preferably a link to a datasheet that shows at least 3 members of the +family; if that's not possible, separate datasheets describing at least 3 +members of the family. + +
Index: 1.0.8/doc-rnd/devlog/20150830a_fork_faq.html =================================================================== --- 1.0.8/doc-rnd/devlog/20150830a_fork_faq.html (nonexistent) +++ 1.0.8/doc-rnd/devlog/20150830a_fork_faq.html (revision 1136) @@ -0,0 +1,234 @@ + + +

pcb-rnd devlog

+ +

Fork FAQ

+ +This document contains my short answers to questions commonly popping up +in endless flamewars on the geda mailing list. The purpose of this +document is not to convince anyone about any of the questions, only +to save me some time typing the same answers when someone asks me +one these questions for the 100th time. As I don't want to convince you +that my answers are the best ones, please don't try to convince me that +they are bad. Been there, done that, never worked in either way: e.g. +I never convinced any git fanboy to switch to svn, and they never +convince me to switch to git. + +

1. Why did you fork?

+ +

1.1. Fragmentation is bad, your fork is harmful!

+I agree that fragmentation is bad. I believe the some aspects of +the current project management and especially the choice of VCS inevitably +leads to forks (just look at how many git forks are out there!). Such +fragmentation of developer and user resources may be bad for a project. +However, these decisions are not mine: the project is set up like +that, I can't change it +

+My fork is just a fork, just like any of the other forks. My fork happens to +be in an svn repository. I don't think it changes anything important from the +mainline's point of view. + +

1.2. ... but how will you get all these merged with mainline?

+I won't. I haven't really used the official, current mainline since like +2011. I don't really care in what directions it evolves or whether it +takes features, code or ideas from pcb-rnd or not. + +

1.3. ... but you are in the best position for a merge!

+I don't think so. I know my changes, but I don't know the changes happened +in the mainline since ages. I am also not efficient with git. It wouldn't +take me any less time than for mainline developers. Also please read point 1.2.: +I have no motivation in spending any time on a merge. + +

1.4. Ok then, but you won't have too many users.

+Fine. My main intention was to produce a pcb editor for my own use. I am +happy if it's also useful for others, so I publish it. Having users +may increase code quality - but other than that, I don't get paid for having +more users, the project doesn't die if I code it alone, so I am not worried +about this. + +

1.5. I'd like to merge something from pcb-rnd to mainline

+Go ahead. I can help you by explaining my code. I won't generate +patches, make changes to get my code compatible with the mainline or +test how it performs in mainline versions. + +

1.6. I'd like to merge something from mainline to pcb-rnd

+If the feature is in line with the goals of pcb-rnd, fine, I'll give +you svn commit access from day 0. + +

1.7. Would you abandon the development of pcb-rnd and join the mainline, if...

+Unlikely. There are many things I have in pcb-rnd which I believe won't ever +happen in mainline. There are a few which I find critical: if I'd need to +give up any single item from this list, that would be a deal-breaker for me: +
    +
  • simple, centralized VCS (not just the UI, the whole thing) +
  • VCS based, zero-administration release and publish interface +
  • a sane build system instead of autotools +
  • the code won't switch to C++ +
+ + +

1.8. Would you join the development of gschem?

+Unlikely. See point 1.7. Gschem is not aiming to a C++ transition AFAIK, +but has a lot of scheme. I don't consider joining or contributing to +gschem until those points listed in 1.7. are fixed and a new scheme +policy is introduced. The new policy should be: "from now on +do not write new code in scheme, use C; while making changes and fixes, +convert affected scheme code to C. Long term, explicit plan: convert all +scheme code to C and remove the guile dependency." +

+I don't expect any of this to happen. + + + +

2. git: did you know...

+
+Preface: I don't try to convince you not to use git in your project; in +return, please don't try to convince me I should use git in mine. + +

2.1. ... that there was an svn frontend to git?

+Yes. 2/3 of my problems with git and DVCS in general are not of technical +nature. I know the concepts of DVCS and I find them suboptimal in +case of small teams. A different UI or a good document won't help in that. + +

2.2. ... that there was this great document about git?

+See 2.1. + +

2.3. ... that DVCS is the future, anything centralized is bad, svn is obsolete?

+These are not facts, but slogans I don't believe in. + +

2.4. What if someone has to develop offline for long?

+In the 21th century, when we have cheap mobile internet even in eastern +Europe? + +

2.5. But feature X is harder with svn!

+Almost all those features are bad for team work in my experience. They +are not even needed. Yes, some aspects of the development have to be +done differently without those - but this is good for the project. + +

2.6. But there are no local repositories and you have to commit unfinished stuff and worry if anything breaks! And branching is hard

+This is the point. I do not branch. I do not attempt to work offline for long, +whatever technical support the VCS may provide for that. I try to work in +a team, on a common code base. +

+I commit small things. I make sure I do a big transition using +these small commits in a way that the code stays compilable in between any +two commits. It rarely breaks trunk/ for longer than a few minutes. I +need a real branch once a decade. + +

2.7. But that's extra effort and makes life harder!

+Yes and no. It's certainly harder to design and carry out a big +reorganization in small steps. This is an extra cost. However, the +benefits outweight this: everyone working in the same repo, +other developers see and comment what you are working on, if done right, +merging is nearly never needed and conflicts are as rare as bugfree +release of a multi-million line proprietary software. + +

2.8. I don't agree with any of this, git is better!

+Cool, so go on using git. I didn't try to convince you not to, I just +explained why I won't. + +

3. opengl

+
+

3.1. But I need opengl!

+Use the mainline then. Or contribute the code for sane opengl support +in pcb-rnd. I can live with a solution where opengl is a separate HID and +is not the default one. + +

3.2. ... good, then please make that opengl hid!

+No, thanks. I don't need it, I wouldn't use it, there's no point in spending +my time on it. If you need it, I invite you to do it. + +

3.3. Did you know that opengl can be turned off in mainline?

+Yes. If I have a fork, I want its defaults to reflect my preferences. + +

3.4. But transparent renders are so good on a board with many layers!

+Not for me: transparency made even a 2 layer board cryptic when I tried. See +3.1. + + +

4. programming languages, file formats

+
+

4.1. switch to C++, it is so much better

+Nope. I prefer C. + +

4.2. but pcb-rnd doesn't compile with a C++ compiled

+Correct: pcb-rnd is written in C. It also doesn't compile with a Pascal +compiler. + +

4.3. but mainline already invested in preparing a C++ transition

+Good for them. If I didn't have a fork, I'd fork the day when the first +C++ class is committed. + +

4.4. we need SQL for the file format

+No, we don't. I prefer human readable text formats. No, converters won't +solve that. No, I don't care if python has support for loading SQL files. + +

4.3. we need to switch to xml/json (or python or perl arrays)

+No, we don't need to. + +

4.4. ... but they are easier to parse because of existing libs

+Yup, but in any real life task that part of the parsing is like 5%. The +rest 95% needs to be programmed anyway. The costs of such a file format change +is not justified by this minor gain. + +

4.5. ... but the current file format doesn't support feature X

+True. And that's because the internal model (the in-core representation +and all the code handling that) doesn't support the feature either. +Changing the file format won't help that. It's similar to point 4.4.: 95% +of the effort is needed to get the code to support the feature, and by that +time the cost of getting it into the file format is very small. Costs +are not justified. + +

4.6. ... but I can't build a database of the current lib

+Too bad. Either figure how to do it, or just don't do it. pcb-rnd +offers scripting, even in languages that have SQL support. In theory +it wouldn't be that hard to write scripts running in PCB manipulating +the buffer or even the in-core footprints on one end and connecting +an SQL database on the other end. + + +

5. scconfig, autotools, build systems

+
+

5.1. scconfig doesn't support feature X that autotools does

+Are you sure? Maybe it does, just uses a different syntax. If not, did +you try to send me a feature request? + +

5.2. scconfig's syntax is different

+Yes. Scconfig has a totally different internal model thus the UI differs +too. Same as vim has a different UI than emacs, while they are both text +editors and the two communities are not trying too hard to unify the UIs. + +

5.3. But ./configure has to have the same UI as autotools

+False. + +

5.4. Most people know autotools, there are merits in supporting the same features or UI

+I do realize that. I've been working on scconfig since 2008. I've invested +a lot of time in it. Believe me, I did think it over before I decided that +the benefits would overweight the drawbacks of developing/using a custom +config/build system. + +

5.5. But autotools is so much better!

+No, it isn't. My experience is that with random open source projects +on anything different from Linux, modern BSD, and sometimes windows, it +just breaks at least 8 times out of 10. Try it once on IRIX or minix. + +

5.6. So why don't you rather fix autotools?

+I believe there are multiple design problems in autotools and most of +the practical problems I faced when using it were directly caused by those. +In a sense, I did fix these design problems by using a different design. +The different design is called scconfig and it was much easier to +write it from scratch. + +

5.7. But scconfig doesn't do cross compilation!

+False. It does. It's been supported since May 2008. It's been added +about 1.5 months after the very first file. + +

5.8. I just don't like scconfig.

+If you have something particular that makes you dislike scconfig, +a missing feature for example, please let me know. +

+Else maybe you don't like using anything else than autotools. It's your +choice; mine is that I do keep on using scconfig in my projects. + + + Index: 1.0.8/doc-rnd/devlog/20150830b_back_ann.html =================================================================== --- 1.0.8/doc-rnd/devlog/20150830b_back_ann.html (nonexistent) +++ 1.0.8/doc-rnd/devlog/20150830b_back_ann.html (revision 1136) @@ -0,0 +1,304 @@ + + +

pcb-rnd devlog

+ +

back annotation

+ +

netlists, annotations

+ +Pcb-rnd (and mainline pcb) maintains a netlist as part of the design. Pcb +doesn't modify the netlist. The netlist is imported from an external source, +typically from gschem. This process is called forward annotation. +

+Sometimes there are a set of connections which contain pin pairs that could +be swapped. For example the data lines of an external parallel SRAM interface +to an MCU: it doesn't matter if data bit 1 at the MCU is wired to data bit +1 or 5 of the SRAM, as there is an 1:1 mapping and no one else is using the +same bus wires. In this case connections should be swapped during pcb routing +and annotated back to gschem so that the schematics can be updated. Both +paths are illustrated below. +

+annotation paths +

+Forward annotation passes on complete netlists along arrows forward1 and +forward2. Back annotation would pass back netlists, changes or modification +requests on the back1, back2 path. Gnetlist takes sch files to extract +and build a netlist in whatever format the receiver needs. There should be a +glue layer, called foo on the drawing, that does the reverse: receives +whatever format the sender has and generates something that gschem will +understand. + +

Support in pcb-rnd: core

+Pcb-rnd gets a complete netlist. If the user could change the netlist directly, +there should be some sort of diff tool in foo that can explain the +changes to gschem, or a diff tool in gschem. What is worse, forward annotation +happens much more often than back annotation and pcb-rnd would need to be able +to merge a new netlist with local changes. The simple "gsch2pcb overwrites the +netlist in pcb from whatever gnetlist produced" approach would not work. +

+An alternative is to keep the netlist as-is, and maintain a separate list of +changes. The form proposed hereby is a table of "operation,pinID,net" or +"operation,args...". Netlist operation is one of "del_conn", "add_conn" and "net_info". The table is called the netlist patch. +

+For example assume two components with pins A1, A2 and B1, B2, with connections +n1=A1-B1 and n2=A2-B2. While routing the designer decides changing them to +n1=A1-B2 and n2=A2-B1 would be easier and is acceptable by the design. The +table of changes would contain this: + +
op pinID net +
del_conn B1 n1 +
del_conn B2 n2 +
add_conn B2 n1 +
add_conn B1 n2 +
+The first two lines would remove pins B1 and B2 from n1 and n2. The last +two would put them back, swapped. New nets could be created or unused nets +could be removed using the add_net and del_net commands that have empty pinID. +The table is ordered, rows are strictly executed from top to bottom. +

+Pcb-rnd would store this table in memory. When some code calls the netlist +code to find out the members of a net, or which net a given pin is connected to, +after running the original netlist code, the result would be adjusted by the table. +

+The table would be normalized after operations. For example: + +
op pinID net +
del_conn B1 n1 +
add_conn B1 n2 +
add_conn B1 n3 +
del_conn B1 n2 +
+would be reduced to + +
op pinID net +
del_conn B1 n1 +
add_conn B1 n3 +
+Simple linear crawls on the table seems sufficient: it is expected that +pcb designers will make netlist modifications rarely and they will back +annotate them ASAP. In extreme cases there may be 64 bit wide bus systems that +need total reordering; even a 4 such reorders will introduce about 1024 items +on the list which seems not too big for O(1) algorithms. See section TODO +for better approaches. +

+Pcb-rnd would save the normalized table in the pcb file in a new section. +Upon a netlist change in pcb (import/load netlist or load the pcb), pcb-rnd +would check each row of the table: it is easy to decide whether that row +has been implemented in the netlist or not. Obsolete rows of the table would +be deleted. +

+A corner case is when B1 is removed from n1 and then added to n2 by the table, +while a new forward annotation removes B1 from n1 and adds it to n3. In this +case the first row of the table is deleted, as B1 is already removed from n1, +but pcb-rnd has no chance to decide if netlist adding B1 to n3 should affect +the table adding B1 to n2, so that rule is kept. +

+net_info is used to describe the original members of a net, in +the state they were before any change on the netlist occured. + +

Support in pcb-rnd: GUI

+A trivial idea is to extend the netlist window so that pins can be moved in +between nets or deleted or assigned to nets. Changes should be marked. This +is not the preferred way of editing the netlist, tho: not much more convenient +than making changes in gschem and doing forward annotation. +

+There should be a separate dialog box or a separate region of the netlist box +showing the netlist patch with edit capabilities. +

+Finally, the most important feature would be new actions resolving shorts. +Using the above example (n1=A1-B1 and n2=A2-B2 changed to n1=A1-B2 and n2=A2-B1), +I believe the user would: + +
action screenshot patch list after the actions +
  • look at initial rats
(empty) +
  • first connect A1 to B1
(empty) + +
    +
  • then realize it's very hard to connect A2 to B2 while the previous connection is there +
  • he would then revert the first connection +
  • and connect A1 to B2 +
  • which would cause shorts +
+ (empty) + +
    +
  • then he would use the "approve netlist change" hotkey/action on the network; + this would add netlist patch commands for the A1-B2 connection, + but would also keep the A1-B1 connection, which remains a rat; because + of the new connection there'd be a rat between A1 and A2 or B1 and B2 too + (all 4 pins connected together on the patched netlist at the moment!) +
+ +
+net_info n1 A1 B1
+net_info n2 A2 B2
+del_conn B1 n1
+add_conn B1 n2
+
+ +
    +
  • the user would then use an action (maybe the same one?) on the rat line + so that pcb-rnd would understand that rat is not needed anymore and + would add a patch to remove the A1-B1 connection +
  • the same thing would need to happen to the A2-B2 rat +
+ +
+net_info n1 A1 B1
+net_info n2 A2 B2
+del_conn B1 n1
+add_conn B1 n2
+del_conn B2 n2
+
+ + +
  • the user then would connect A2 to B1, which again is a short
+
    +
  • the user would approve it as a new connection +
  • we have exactly 2 del_conn and 2 add_conn patches. +
+ +
+net_info n1 A1 B1
+net_info n2 A2 B2
+del_conn B1 n1
+add_conn B1 n2
+del_conn B2 n2
+add_conn B2 n1
+
+ +
+An experienced user may think a few steps in advance and +chose to first remove the A1-B1 and A2-B2 rats and then create the A1-B2 +and A2-B1 connections and then approve the two new connections. +

+An alternative is drag&drop ratline endpoint onto snap points; it may +be tricky to convert that to net/pin relations if a rat line is between two +line segments, tho. +

+These changes would live immediately, leaving the board free of shorts and +rats. There should be, however, some warning in the "congratulation" message +that tells the user a back annotation is still required. + +

Support in gschem

+Ideally there should be a very small change in gschem and an optional +plugin script could do the rest. The plugin script would be in contant +with foo. +

+There are multiple ways pins can be connected to a net in gschem. It's +probably not a good idea to have too much automatism in the gschem's side, +trying to actually removing connections and adding new ones using the patch +(or whatever info foo converted the patch into). +

+However, gschem should support four things natively: +

    +
  • it should have a concept of an unwanted pin-network connection; a connection + becomes unwanted only when the back annotation says so +
  • it should be able to mark unwanted connections on the active schematic page +
  • it should be able to tell the user if there are unwanted connections on + any of the pages open +
  • it should be able to refresh its idea of unwanted connections while + schematic pages are open +
+

+Displaying unwanted connections happen at: +

    +
  • a pin of a component is connected to a net using a "blue line" net: mark the pin-net connection point +
  • a pin is directly connected to another pin, no net line in between: mark the connection point +
  • a pin is connected to a net using a pin attribute: mark the pin +
  • TODO: are there more? +
+

+TODO: there are a lot to think over about special cases related to +multipage schematics, hierarchies, slots, split symbols. + +

What foo does exactly

+... is not clear yet. It depends on what sort of support gschem would provide. + +

Amendment 1: other parameters (1st sep)

+I originally forgot to mention my other intentions in the above document: +back annotate non-netlist properites. It probably happened because netlist +related stuff are the hardest to solve. +

+There are other parameters that sometimes change during routing. A common case +for my 1 or 2 layer boards is when I originally intend to use 0603 parts but +during routing I figure I need to pass a trace between the pads. I need to +change the part to 0805 or 1206 (for two traces). I'd like to be able to +do this in-place in pcb with an action that replaces the footprint +but keeps the origin in place. This obviously still requires some manual +fiddling afterwards, but would remove the long, tedious chain I have now: +

    +
  • 1. remember or note down which parts to change footprints for +
  • 2. go back to gschem and change them +
  • 3. get the changes in pcb (I use gsch2pcb and Makefiles, one step; the import menu is one step too, just another one) +
  • 4. disperse the new elements +
  • 5. find where they used to be +
  • 6. and then do the fiddling to fit them in +
+

+The new process would be: +

    +
  • 1. get the footprint replaced, in-place; this would already approve the + change and there'd be a command for it in the patch table +
  • 2. do the fiddling to fit the new part in +
  • 3. do a back annotation +
  • (4. optionally, if we go for non-automatic change of attributes in gschem, + change them manually in gschem, cycling through the affected + items using some UI feature) +
+

+The same thing could work for values, which is the other attribute PCB also +sees. The same mechanism could work from other programs as well, e.g. tuning +the values of some parts in a simulator and then back annotating the changes +to the schematics. The patch table format foo handles would be in the +simplest plain text form. + + +

Amendment 2: examples from gschem's point of view (3rd Sep)

+

netlist change

+
    +
  • The user creates the schematics and imports it in pcb; the original + netlist contains a line "netname1 U1-1 CONN1-2" +
  • The user, as part of some pin swapping, decides that U1-1 should be + connected to net "netname2" instead of "netname1". Changes are + done in pcb-rnd as described above. +
  • The netlist patch generated for this single change by pcb-rnd would be: +
    +del_conn netname1 U1-1
    +add_conn netname2 U1-1
    +	
    +
  • the user may need to load the netlist patch in ghscem +
  • In gschem there would be an indication that highlights any U1-1 pin or + U1 symbol that makes a connection to netname 1, graphically or using + attributes. When asked, gschem UI would also tell the user that U1-1 is + now connected to netname1 but should be connected to netname2 instead. +
  • The user would find this indication and would resolve the situation + by whatever changes he finds appropriate +
  • gschem would rerun the patch commands and would figure that the del_conn + fails to run because U1-1 is no longer connected to netname1 and the add_conn + fails too because U1-1 is connected to netname2. This leaves U1-1 without + any known issue, so the indication on U1-1 would be gone. +
+ +

attribute change: footprint change

+
    +
  • The user creates the schematics and imports it in pcb; originally + U1 has an attribute footprint=DIP(8). +
  • during the layout the user figures using the footpritn SO(8) is + more appropriate. He does the change in pcb-rnd. +
  • pcb-rnd emits the following netlist patch for this: +
    +change_attrib U1 footprint=DIP(8) footprint=SO(8)
    +	
    +

    + (or it could be a del_attrib and add_attrib pair, like with connections) +

  • the user may need to load the netlist patch in ghscem +
  • In gschem there would be an indication that highlights any U1 instances + that has footprint=DIP(8) +
  • The user would find this indication and would resolve the situation + by whatever changes he finds appropriate (e.g. change the attribute) +
  • gschem would rerun the patch commands and would figure the change is + no longer requred and would remove the indication +
+ Index: 1.0.8/doc-rnd/devlog/20150901a_back_ann.html =================================================================== --- 1.0.8/doc-rnd/devlog/20150901a_back_ann.html (nonexistent) +++ 1.0.8/doc-rnd/devlog/20150901a_back_ann.html (revision 1136) @@ -0,0 +1,87 @@ + + +

pcb-rnd devlog

+ +

back annotation

+ + +

Conclusions of the first thread

+DJ has another
model +where back annotation is only a subset of a bigger mechanism. +

+Many other users commented the thread, but no one else presented a +plan that formed a complete system. +

+While there were some useful feedback about some details, no one explicitly +said he'd be contributing the gschem part (... for any of the ideas floating +around). +

+The thread is swamped in a chaotic set of random ideas and opinions - the +same way as previous related threads usually did. + + +

Second thread

+In the second thread I will focus on actual contribution. For this, +I'm narrowing down what exactly needs to be contributed: + + +
    +
  • 1. minor UI changes, most probably in the C part of the gschem code. +somehow ending up in the official repo; I'd prefer to avoid maintaining a +fork of gschem (no, having the fork in git doesn't help). + +
  • 2. a scheme script that can be plugged into gschem and do real simple +things like toggling flags for point 1, counting how many flags are +toggled, warn the user about the counter is being non-zero; this script +doesn't need to get into the official repo + +
  • 3. depending on whether we (me and my actual contributor who contributes +code) go for push or pull, we need: a new action or menu or whatever that +can trigger a pull or some means that can collect a change list pushed and +then indicate that something's happened. It's not really a third piece of +code, just a third piece of concept that is spread across 1 and 2. +
+

+First, I seek a contributor for exactly these 3 things. Alternatively if +there's someone who is really willing to contribute actual code and spend +time on this, I'm open to change parts of my plan if he has better ideas +as long as the new approach still solves the actual problems I have. + + +

Preparing for the third phase (3rd sep)

+Options are being eliminated slowly. I couldn't find out who are currently the +maintainers of gschem, so I couldn't ask their opinion about my back annotation +plan directly. Last stable release is about 2 years old, last unstable is more +than a year old. +

+The main options currently are: +

    +
  • 1. Evan offered contribution on the gschem side; Markus offered him write + access to the official git repo. We could have a branch there. We'd + aim for a merge, so minimal changes and a lot of scheme hacking (... + that still none of us want to do, afaik). + Without positive feedback from maintainers, I believe this branch + has a very low chance to get merged in mainline. If it doesn't get + merged, all the extra effort on scheme, git, and trying to + do things in the gschem-way are just energy wasted. + +
  • 2. I start an svn repo and implement the stuff the better way (no + scheme, bigger change, no worries about whether it gets merged). Keep + changes on-topic and small, so later on if someone wants to merge, + there's a chance to get it into a branch in the git repo first then + do the merge. Has even lower chance to get merged, but certainly + speeds up development and is much easier to work on, distribute and + use than a bitrotting git branch. If it doesn't get merged, + only a small amount of efforts wasted on trying to keep changes + merge-friendly. + +
  • 3. I start an svn repo and implement the stuff the best I can - without + considering any merging aspects. This is the option that'd grant + the most development speed and efficiency. It doesn't get merged, + but no energy is wasted at all and the resulting code is better. +
+There are some other options, but those are just variants of the above three. +Currently I think option 1 is unlikely to work, for I don't touch git, +and noone wants to touch scheme. Both 2 or 3 could work, but the total lack +of gschem maintainer feedback doesn't make option 2 look too good. + Index: 1.0.8/doc-rnd/devlog/20151028_glib.html =================================================================== --- 1.0.8/doc-rnd/devlog/20151028_glib.html (nonexistent) +++ 1.0.8/doc-rnd/devlog/20151028_glib.html (revision 1136) @@ -0,0 +1,65 @@ + + +

pcb-rnd devlog

+ +

why glib is a bad idea

+ +Levente tried to compile pcb-rnd on bsd and used a different c compiler +than gcc. For this in the first step I fixed the build system so that it +doesn't have gcc --std=gnu99 but gcc --std=c99. +

+And then everything broke. A minilib I use for hashing, +genht, failed to +link against hid/common/action.c. I first thought it was a bug in genht: +genht was compiled without --std while the rest of the code compiled with +--std=gnu99 or --std=c99. Genht heavily depends on static inline +functions for performance, maybe that's why. +

+So I tried to reproduce the situation in a hello-world like program and +tried all combinaton of --std, -DNDEBUG, -rdynamic and all build flags +used in pcb-rnd for the genht lib and the test program, but all combination +worked. It looked like it broke only in pcb-rnd. +

+I gave up on the minimal test case and went back to pcb-rnd. I realized if +the build is the same, the only way it may break is that some header +included before genht's headers change some global state. I started to +shuffle the #includes. Long story short, it turned out if <glib.h> is +included before genht's headers, it breaks. +

+Some more tracing showed it was because glib over-#defines the keyword +inline in a public header that gets included from glib.h. It's all wrapped +in a complicated tree of #ifdefs, so it behaves differently depending on +the --std setting. +

+The morale of the story is... Well, I have multiple conclusions. +

    +
  • glib is not a lib that tries to solve something, it is a prorgamming +environment that tries to supersede C. + +
  • As such, it feels free to mess with the environment, redefine C +keywords as it sees fit, because once you use glib, why would you use +anything else? And once you use glib, you are programming in glib, not in +"plain C". + +
  • Grepping through the pcb-rnd code, I see that pcb-rnd does not try to +use glib as a programming environment, but needs only 2 and a half +features: hash, list and rarely dynamic strings. Any other glib call is +just a must that had to be done that way to get hashes and lists working. + +
  • genht is 510 sloc. I have a generic list implementation (which, by the +way, is more efficient than glib's) It costs 256 sloc. So having +type-independent hashes and lists in C89 costs less than 800 lines of code +if you pick the right libs. Glib's include/ alone is over 24000 sloc! +And in return glib breaks inline... +
+ +

+In a nuthsell this is why I don't believe in glib-like solve-all megalibs. I +don't say size alone determines this, but size is a good indication of +potential problems. +

+If I need hash and lists and the offer is longer than 5k sloc, I know it +will bring a lot of unneeded bloat that likely to break things. + + + \ No newline at end of file Index: 1.0.8/doc-rnd/devlog/20160101_cschem.html =================================================================== --- 1.0.8/doc-rnd/devlog/20160101_cschem.html (nonexistent) +++ 1.0.8/doc-rnd/devlog/20160101_cschem.html (revision 1136) @@ -0,0 +1,68 @@ + + +

pcb-rnd devlog

+ +

cschem

+ +Cschem is a project I plan to start within the next few years. It's goals +and some design concepts are similar to gschem's and geda's, while it +also breaks some traditions to fix shortcomings in the design of geda. It's +named after gschem, not after geda, to emphasize that the editor needs to +be connected more to the rest of the system (see details later). +

+Some concepts cschem will try to follow (marking with * where there's major +difference to geda): +

    +
  • 1. design +
      +
    • 1.1. modularity, aka. toolkit approach +
    • 1.2. flexibility (trough attributes) +
    • 1.3. one schematics file is one sheet +
    • 1.4. multi page projects (hierarchic, flat) +
    • 1.5. data is in structured text files (no builtin sql support in core) +
    • 1.6. * the concept of a "project"; it's optional, tools can work on a set of schematics files _or_ on a complete project +
    • 1.7. * nets and components are uniquely identifiable using the same identifiers by all projects +
    • 1.8. * no excess "smartness" in the GUI editor: no slotting, no pin numbering, no auto renumbering, etc; these all should be done in the netlist layer and results fed back to the editor +
    • 1.9. * direct, bidirectional communication between the editor (GUI) and the netlist layer without any integration of the two, through simple and clean API, keeping both parts replaceable; attributes cschem got back from the netlister are "volatile": not saved, do not override attributes provided by the user +
    • 1.10. * less format-specific tricks built into the GUI code, more generic approaches (e.g. a search is a search, not a search-for-text-attribute and results on the result lists are any object of the design) +
    • 1.11. * slotting, pin mapping, device mapping are in backends +
    • 1.12. * back annotation should not be any harder than forward annotation +
    • 1.13. * since a lot of info is invented in backends, not in the GUI (e.g. pin numbers, when slotting), the GUI needs to be able to switch between "views": what (combination of) backend(s) to get these info from; Note: this would also provide an interactive DRC on the GUI with the DRC still implemented in the netlister! +
    • 1.14. * the scriptable plugin system is based on GPMI from the start to guarantee the tool is not tied to any one specific scripting engine or scripting language +
    +
  • 2. implementation +
      +
    • 2.1. a core library that does common things like figuring what objects are connected with net lines +
    • 2.2. the simple GUI editor should provide the frame; exotic functions should come from user plugins +
    • 2.3. a simple netlister that provides only generic (* absolutely no backend specific) queries; actual backends are implemented as plugins +
    • 2.4. * the core library and the netlister and the GUI core are all implemented in plain C: +
        +
      • 2.4.1. * no dependency on any specific scripting engine or scripting language; no core functionality implemented in anything else but C +
      • 2.4.2. * no dependency on big "solves-everything" libraries (e.g. no glib or cairo dependency) +
      • 2.4.3. * the actual GUI is behind the plugin system (like PCB's HIDs) +
      • 2.4.4. * the first gui, in accordance with the no big libraries, will not be gtk or qt but sdl2 based; this would guarantee to have a front end that doesn't need to be rewritten every 5 years just for the sake of the rewrite +
      • 2.4.5. * scconfig instead of autotools: smaller, easier to maintain, works better outside of the gnu-win32 world +
      +
    +
  • 3. project management +
      +
    • 3.1. automatic tests wherever possible, as early as possible +
    • 3.2. * VCS: simple, centralized svn with straight linear developement, actively trying to avoid branching +
    • 3.3. * near-zero-administration releases with svn commits +
    • 3.4. * users should be able to submit bug reports anonymously, without having to register, without having to run javascript, java applet, flash, etc. +
    +
+ + +

+There are a lot of open questions: +

    +
  • q1. how buses should work +
  • q2. how slotting should work (but at least we can have alternatives here) +
  • q3. how hierarchical design should work +
  • q4. * how the GUI should display large amount of attributes without making the whole page an unreadable mess +
  • q5. flat vs. non-flat netlists - if turns out it's not just an implementation detail in a netlister backend +
  • q6. * whether project file format is a custom format or just a top sch page referencing other sch pages +
  • q7. attribute conventions +
+ Index: 1.0.8/doc-rnd/devlog/20162601/gencsv.sh =================================================================== --- 1.0.8/doc-rnd/devlog/20162601/gencsv.sh (nonexistent) +++ 1.0.8/doc-rnd/devlog/20162601/gencsv.sh (revision 1136) @@ -0,0 +1,3 @@ +#!/bin/sh +sed "s@\t@,@g" < poll.tsv > poll.csv +tr "\n" "," < header > header.csv Property changes on: 1.0.8/doc-rnd/devlog/20162601/gencsv.sh ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/doc-rnd/devlog/20162601/genhtml.sh =================================================================== --- 1.0.8/doc-rnd/devlog/20162601/genhtml.sh (nonexistent) +++ 1.0.8/doc-rnd/devlog/20162601/genhtml.sh (revision 1136) @@ -0,0 +1,9 @@ +#!/bin/sh +( +echo '' +echo "" +sed "s@^@
@" < header +sed "s@^@
@;s@\t@@g" < poll.tsv +echo '
' +) > poll.html + Property changes on: 1.0.8/doc-rnd/devlog/20162601/genhtml.sh ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/doc-rnd/devlog/20162601/header =================================================================== --- 1.0.8/doc-rnd/devlog/20162601/header (nonexistent) +++ 1.0.8/doc-rnd/devlog/20162601/header (revision 1136) @@ -0,0 +1,11 @@ +1. How many of your boards REQUIRE burried or blind vias? [percentage] +2. How many of your boards could BENEFIT burried or blind vias? [percentage] +3. When your board REQUIRED them, do you more often find a workaround to stick with pcb instead of switching to another design tool? [yes/no] +4. When your board could BENEFIT using them, do you more often find a workaround to stick with pcb instead of switching to another design tool? [yes/no] +5. Have you ever tried pcb-rnd? [yes/no] +6. Would you try pcb-rnd if it offered blind/burried vias? [yes/no] +7. Would you consider switching to pcb-rnd if it offered blind/burried vias? [yes/no] +8. Approximately how many boards have you done so far with pcb (pcb mainline/branches/forks included, using gschem/gnetlist not required)? "1 board done" means you had one or more physical copies of the board. [rough estimation, positive integer] +9. Approximately how many boards have you done with other packages? [rough estimation, positive integer] +10. What OS would you prefer to do your pcb layouts on (assuming your favorite layout tool is/would be available on it)? [one of: (GNU/)Linux, *BSD, OSX, windows, other; if you like more, select the one you would spend most time on!] + Index: 1.0.8/doc-rnd/devlog/20162601/header.csv =================================================================== --- 1.0.8/doc-rnd/devlog/20162601/header.csv (nonexistent) +++ 1.0.8/doc-rnd/devlog/20162601/header.csv (revision 1136) @@ -0,0 +1 @@ +1. How many of your boards REQUIRE burried or blind vias? [percentage],2. How many of your boards could BENEFIT burried or blind vias? [percentage],3. When your board REQUIRED them, do you more often find a workaround to stick with pcb instead of switching to another design tool? [yes/no],4. When your board could BENEFIT using them, do you more often find a workaround to stick with pcb instead of switching to another design tool? [yes/no],5. Have you ever tried pcb-rnd? [yes/no],6. Would you try pcb-rnd if it offered blind/burried vias? [yes/no],7. Would you consider switching to pcb-rnd if it offered blind/burried vias? [yes/no],8. Approximately how many boards have you done so far with pcb (pcb mainline/branches/forks included, using gschem/gnetlist not required)? "1 board done" means you had one or more physical copies of the board. [rough estimation, positive integer],9. Approximately how many boards have you done with other packages? [rough estimation, positive integer],10. What OS would you prefer to do your pcb layouts on (assuming your favorite layout tool is/would be available on it)? [one of: (GNU/)Linux, *BSD, OSX, windows, other; if you like more, select the one you would spend most time on!],, \ No newline at end of file Index: 1.0.8/doc-rnd/devlog/20162601/poll.csv =================================================================== --- 1.0.8/doc-rnd/devlog/20162601/poll.csv (nonexistent) +++ 1.0.8/doc-rnd/devlog/20162601/poll.csv (revision 1136) @@ -0,0 +1,10 @@ +0,50,yes,yes,no,no,no,1,2,Linux +10,40,no,n/a,no,yes,n/a,20,2,Linux +0,5,n/a,no,no,no,no,20,4,Linux +5,20,no,no,no,yes,no,5,20,Linux +0,0,n/a,n/a,no,no,no,10,0,Linux +0,80,yes,yes,no,no,no,15,0,Linux +50,80,no,no,no,yes,n/a,30,100,OSX +20,75,no,no,no,yes,yes,15,3,Linux +0,8,yes,yes,yes,yes,no,2,1,Linux +0,2,yes,yes,no,no,no,8,4,Linux Index: 1.0.8/doc-rnd/devlog/20162601/poll.html =================================================================== --- 1.0.8/doc-rnd/devlog/20162601/poll.html (nonexistent) +++ 1.0.8/doc-rnd/devlog/20162601/poll.html (revision 1136) @@ -0,0 +1,24 @@ + + +
1. How many of your boards REQUIRE burried or blind vias? [percentage] +2. How many of your boards could BENEFIT burried or blind vias? [percentage] +3. When your board REQUIRED them, do you more often find a workaround to stick with pcb instead of switching to another design tool? [yes/no] +4. When your board could BENEFIT using them, do you more often find a workaround to stick with pcb instead of switching to another design tool? [yes/no] +5. Have you ever tried pcb-rnd? [yes/no] +6. Would you try pcb-rnd if it offered blind/burried vias? [yes/no] +7. Would you consider switching to pcb-rnd if it offered blind/burried vias? [yes/no] +8. Approximately how many boards have you done so far with pcb (pcb mainline/branches/forks included, using gschem/gnetlist not required)? "1 board done" means you had one or more physical copies of the board. [rough estimation, positive integer] +9. Approximately how many boards have you done with other packages? [rough estimation, positive integer] +10. What OS would you prefer to do your pcb layouts on (assuming your favorite layout tool is/would be available on it)? [one of: (GNU/)Linux, *BSD, OSX, windows, other; if you like more, select the one you would spend most time on!] + +
050yesyesnonono12Linux +
1040non/anoyesn/a202Linux +
05n/anononono204Linux +
520nononoyesno520Linux +
00n/an/anonono100Linux +
080yesyesnonono150Linux +
5080nononoyesn/a30100OSX +
2075nononoyesyes153Linux +
08yesyesyesyesno21Linux +
02yesyesnonono84Linux +
Index: 1.0.8/doc-rnd/devlog/20162601/poll.tsv =================================================================== --- 1.0.8/doc-rnd/devlog/20162601/poll.tsv (nonexistent) +++ 1.0.8/doc-rnd/devlog/20162601/poll.tsv (revision 1136) @@ -0,0 +1,10 @@ +0 50 yes yes no no no 1 2 Linux +10 40 no n/a no yes n/a 20 2 Linux +0 5 n/a no no no no 20 4 Linux +5 20 no no no yes no 5 20 Linux +0 0 n/a n/a no no no 10 0 Linux +0 80 yes yes no no no 15 0 Linux +50 80 no no no yes n/a 30 100 OSX +20 75 no no no yes yes 15 3 Linux +0 8 yes yes yes yes no 2 1 Linux +0 2 yes yes no no no 8 4 Linux Index: 1.0.8/doc-rnd/devlog/20162601.html =================================================================== --- 1.0.8/doc-rnd/devlog/20162601.html (nonexistent) +++ 1.0.8/doc-rnd/devlog/20162601.html (revision 1136) @@ -0,0 +1,59 @@ + + +

pcb-rnd devlog

+ +

Burried/blind via poll

+ +

Results

+ +I received 10 full answers to the poll - thanks everyone who +answered. This is a small sample, but this is the best I could get +(I can't reach more pcb users). +

+Raw results are available in html, tsv and +csv format. + +

My interpretation

+ +(User obviously means "those users who answered the poll") + +
    +
  • 1. only half of the users would consider even trying pcb-rnd for blind/burried vias +
  • 2. there was only one user who'd consider switching to pcb-rnd for blind-burried vias - this feature doesn't seem to be valuable enough to attract users (details below) +
  • 3. about half of the users need blind/burried via; when they do, they don't use pcb +
  • 4. 9 out of 10 users runs PCB on Linux +
+ +

My conclusions

+Because of 1. and 2., pcb-rnd doesn't seem to need blind/burried vias. The +purpose of question 7 was to find out whether users value this feature high +enough to actually consider investing time/effort in return, compared to +question 6. This pair of questions was designed to avoid noise that comes +from the fact that we, on the list tend to express our opinions in vast +crowds while only a few invest more time than talking and do actual work. +According to the result of line 7, my conclusion is that it's absolutely +not blind/burried vias that potential pcb-rnd users need. Thus +my decision is that I won't spend time on this feature in the near future. +

+The situation for pcb might be different, tho. I worded the first 4 questions +to find out how strong the need is among the users of mainline pcb and whether +they are devoted to pcb or choose the tool according to the design requirements. +There seems to be a correlation between having to use blind/burried vias +and using other layout tools. Or in other words: those who are happy with pcb +usually don't need or want blind/burried vias anyway and those who do have +already switched to another tool. +

+This suggests mainline pcb could benefit from burried/blind vias. However, +the demand is much lower than "every new design needs this" or "no new +user would consider pcb because of this missing feature". +

+Linux: it seems pcb power users mostly use Linux. I am not sure if it's +because PCB works well on Linux and is a bit harder to compile on +anything else - or the other way around (Linux users are more attracted +to PCB). + + + + + + Index: 1.0.8/doc-rnd/devlog/res/20150830b_annot.dot =================================================================== --- 1.0.8/doc-rnd/devlog/res/20150830b_annot.dot (nonexistent) +++ 1.0.8/doc-rnd/devlog/res/20150830b_annot.dot (revision 1136) @@ -0,0 +1,19 @@ +digraph annot { + + + gnetlist [shape=box] + + {rank=same pcb gschem spacer1} + + spacer1 [style=invisible] + + foo [shape=box] + + gschem -> gnetlist [label="forward1"] + pcb -> foo [label="back1"] + + gschem->spacer1->pcb [style=invisible arrowhead=none] + + gnetlist -> pcb [label="forward2"] + foo -> gschem [label="back2"] +} Index: 1.0.8/doc-rnd/devlog/res/20150830b_annot.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/devlog/res/20150830b_annot.png =================================================================== --- 1.0.8/doc-rnd/devlog/res/20150830b_annot.png (nonexistent) +++ 1.0.8/doc-rnd/devlog/res/20150830b_annot.png (revision 1136) Property changes on: 1.0.8/doc-rnd/devlog/res/20150830b_annot.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/devlog/res/20150830b_s0.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/devlog/res/20150830b_s0.png =================================================================== --- 1.0.8/doc-rnd/devlog/res/20150830b_s0.png (nonexistent) +++ 1.0.8/doc-rnd/devlog/res/20150830b_s0.png (revision 1136) Property changes on: 1.0.8/doc-rnd/devlog/res/20150830b_s0.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/devlog/res/20150830b_s1.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/devlog/res/20150830b_s1.png =================================================================== --- 1.0.8/doc-rnd/devlog/res/20150830b_s1.png (nonexistent) +++ 1.0.8/doc-rnd/devlog/res/20150830b_s1.png (revision 1136) Property changes on: 1.0.8/doc-rnd/devlog/res/20150830b_s1.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/devlog/res/20150830b_s2.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/devlog/res/20150830b_s2.png =================================================================== --- 1.0.8/doc-rnd/devlog/res/20150830b_s2.png (nonexistent) +++ 1.0.8/doc-rnd/devlog/res/20150830b_s2.png (revision 1136) Property changes on: 1.0.8/doc-rnd/devlog/res/20150830b_s2.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/devlog/res/20150830b_s3.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/devlog/res/20150830b_s3.png =================================================================== --- 1.0.8/doc-rnd/devlog/res/20150830b_s3.png (nonexistent) +++ 1.0.8/doc-rnd/devlog/res/20150830b_s3.png (revision 1136) Property changes on: 1.0.8/doc-rnd/devlog/res/20150830b_s3.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/devlog/res/20150830b_s4.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/devlog/res/20150830b_s4.png =================================================================== --- 1.0.8/doc-rnd/devlog/res/20150830b_s4.png (nonexistent) +++ 1.0.8/doc-rnd/devlog/res/20150830b_s4.png (revision 1136) Property changes on: 1.0.8/doc-rnd/devlog/res/20150830b_s4.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/devlog/res/20150830b_s5.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/devlog/res/20150830b_s5.png =================================================================== --- 1.0.8/doc-rnd/devlog/res/20150830b_s5.png (nonexistent) +++ 1.0.8/doc-rnd/devlog/res/20150830b_s5.png (revision 1136) Property changes on: 1.0.8/doc-rnd/devlog/res/20150830b_s5.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/devlog/res/20150830b_s6.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/devlog/res/20150830b_s6.png =================================================================== --- 1.0.8/doc-rnd/devlog/res/20150830b_s6.png (nonexistent) +++ 1.0.8/doc-rnd/devlog/res/20150830b_s6.png (revision 1136) Property changes on: 1.0.8/doc-rnd/devlog/res/20150830b_s6.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/devlog/res/Makefile =================================================================== --- 1.0.8/doc-rnd/devlog/res/Makefile (nonexistent) +++ 1.0.8/doc-rnd/devlog/res/Makefile (revision 1136) @@ -0,0 +1,4 @@ +all: 20150830b_annot.png + +%.png: %.dot + dot -Tpng < $^ > $@ Index: 1.0.8/doc-rnd/djopt/Makefile =================================================================== --- 1.0.8/doc-rnd/djopt/Makefile (nonexistent) +++ 1.0.8/doc-rnd/djopt/Makefile (revision 1136) @@ -0,0 +1,50 @@ +PCB=../../src/pcb-rnd +HTML=index.html +CASES = \ + debumpify.$(TARGET) \ + miter.$(TARGET) \ + orthopull.$(TARGET) \ + unjaggy.$(TARGET) \ + vianudge.$(TARGET) \ + viatrim.$(TARGET) + +all: + make conv TARGET=out.png + make conv TARGET=png + make index + +index: + make index.html TARGET=txt + +index.html: Pre.html Post.html $(CASES) Makefile + cat Pre.html > $(HTML) + make conv TARGET=tbl + cat Post.html >>$(HTML) + +conv: $(CASES) + +.SUFFIXES: .pcb .out.pcb .png .out.png .tbl +.PRECIOUS: %.pcb %.out.pcb %.png %.out.png + +.pcb.out.pcb: + echo "OptAutoOnly(); djopt($*); SaveTo(LayoutAs, $*.out.pcb.tmp);"| $(PCB) --gui batch $*.pcb + awk '/Symbol.. . 1800./,/^Attribute/ { next } { print $$0 }' < $*.out.pcb.tmp > $*.out.pcb + rm $*.out.pcb.tmp + +.pcb.tbl: + echo '$*'>>$(HTML) + cat $*.txt >>$(HTML) + echo ' '>>$(HTML) + +.pcb.png: + $(PCB) -x png --dpi 300 $*.pcb + +out.pcb.out.png: + $(PCB) -x png --dpi 300 $*.out.pcb + +clean: + rm *.out.pcb *.png index.html 2>/dev/null; true + + + + Index: 1.0.8/doc-rnd/djopt/Post.html =================================================================== --- 1.0.8/doc-rnd/djopt/Post.html (nonexistent) +++ 1.0.8/doc-rnd/djopt/Post.html (revision 1136) @@ -0,0 +1,4 @@ +autorun all the above except miter; run them multiple times until there's no more change possible     + + + Index: 1.0.8/doc-rnd/djopt/Pre.html =================================================================== --- 1.0.8/doc-rnd/djopt/Pre.html (nonexistent) +++ 1.0.8/doc-rnd/djopt/Pre.html (revision 1136) @@ -0,0 +1,14 @@ + + +

Action djopt()

+ +The different types of optimizations change your board in order to +reduce the total trace length and via count. Each optimization is accessible +using an argument, e.g. djopt(miter). The basic actions have to be run multiple +times as each iteration will change the design making new changes possible for +subsequent iterations with the same or other actions. +

+Click on the images to download the example .pcb design. + + +
argument name description example in example out after 1st iteration Index: 1.0.8/doc-rnd/djopt/debumpify.out.pcb =================================================================== --- 1.0.8/doc-rnd/djopt/debumpify.out.pcb (nonexistent) +++ 1.0.8/doc-rnd/djopt/debumpify.out.pcb (revision 1136) @@ -0,0 +1,88 @@ +# release: pcb-rnd 1.0.7 + +# To read pcb files, the pcb version (or the git source date) must be >= the file version +FileVersion[20070407] + +PCB["" 140000 67500] + +Grid[2500.0 0 0 1] +Cursor[0 5000 0.000000] +PolyArea[3100.006200] +Thermal[0.500000] +DRC[1200 900 1000 700 1500 1000] +Flags("nameonpcb,clearnew,snappin") +Groups("1,3,4,c:2,5,6,s:7:8") +Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] + + +Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 17500 32500 -5650 4350 0 100 ""] +( + Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] + Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] + ElementLine [-2362 3740 2362 3740 800] + ElementLine [-2362 -3740 2362 -3740 800] + + ) + +Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 117500 32500 -5650 4350 0 100 ""] +( + Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] + Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] + ElementLine [-2362 3740 2362 3740 800] + ElementLine [-2362 -3740 2362 -3740 800] + + ) +Layer(1 "component") +( + Line[23405 32500 30000 32500 1000 4000 "clearline"] + Line[92500 32500 111595 32500 1000 4000 "clearline"] + Line[30000 32500 30000 32500 1000 4000 "clearline"] + Line[30000 32500 37500 32500 1000 4000 "clearline"] + Line[37500 32500 37500 32500 1000 4000 "clearline"] + Line[37500 32500 47500 32500 1000 4000 "clearline"] + Line[47500 32500 57500 22500 1000 4000 "clearline"] + Line[57500 22500 67500 22500 1000 4000 "clearline"] + Line[67500 22500 77500 32500 1000 4000 "clearline"] + Line[77500 32500 82500 32500 1000 4000 "clearline"] + Line[82500 32500 85000 22500 1000 4000 "clearline"] + Line[90000 22500 92500 32500 1000 4000 "clearline"] + Line[85000 22500 90000 22500 1000 4000 "clearline"] +) +Layer(2 "solder") +( +) +Layer(3 "comp-GND") +( +) +Layer(4 "comp-power") +( +) +Layer(5 "sold-GND") +( +) +Layer(6 "sold-power") +( +) +Layer(7 "signal3") +( +) +Layer(8 "outline") +( +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( + Text[30000 5000 0 105 "90" "clearline"] + Text[60000 5000 0 105 "45" "clearline"] + Text[82500 5000 0 105 "rand" "clearline"] +) +NetList() +( + Net("GND" "(unknown)") + ( + Connect("R101-1") + Connect("R102-2") + ) +) Index: 1.0.8/doc-rnd/djopt/debumpify.out.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/djopt/debumpify.out.png =================================================================== --- 1.0.8/doc-rnd/djopt/debumpify.out.png (nonexistent) +++ 1.0.8/doc-rnd/djopt/debumpify.out.png (revision 1136) Property changes on: 1.0.8/doc-rnd/djopt/debumpify.out.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/djopt/debumpify.pcb =================================================================== --- 1.0.8/doc-rnd/djopt/debumpify.pcb (nonexistent) +++ 1.0.8/doc-rnd/djopt/debumpify.pcb (revision 1136) @@ -0,0 +1,89 @@ +# release: pcb-rnd 1.0.7 + +# To read pcb files, the pcb version (or the git source date) must be >= the file version +FileVersion[20070407] + +PCB["" 140000 67500] + +Grid[2500.0 0 0 1] +Cursor[0 5000 0.000000] +PolyArea[3100.006200] +Thermal[0.500000] +DRC[1200 900 1000 700 1500 1000] +Flags("nameonpcb,clearnew,snappin") +Groups("1,3,4,c:2,5,6,s:7:8") +Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] + +Attribute("PCB::grid::unit" "mm") + +Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 17500 32500 -5650 4350 0 100 ""] +( + Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] + Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] + ElementLine [-2362 3740 2362 3740 800] + ElementLine [-2362 -3740 2362 -3740 800] + + ) + +Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 117500 32500 -5650 4350 0 100 ""] +( + Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] + Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] + ElementLine [-2362 3740 2362 3740 800] + ElementLine [-2362 -3740 2362 -3740 800] + + ) +Layer(1 "component") +( + Line[23405 32500 30000 32500 1000 4000 "clearline"] + Line[92500 32500 111595 32500 1000 4000 "clearline"] + Line[30000 32500 30000 22500 1000 4000 "clearline"] + Line[30000 22500 37500 22500 1000 4000 "clearline"] + Line[37500 22500 37500 32500 1000 4000 "clearline"] + Line[37500 32500 47500 32500 1000 4000 "clearline"] + Line[47500 32500 57500 22500 1000 4000 "clearline"] + Line[57500 22500 67500 22500 1000 4000 "clearline"] + Line[67500 22500 77500 32500 1000 4000 "clearline"] + Line[77500 32500 82500 32500 1000 4000 "clearline"] + Line[82500 32500 85000 22500 1000 4000 "clearline"] + Line[90000 22500 92500 32500 1000 4000 "clearline"] + Line[85000 22500 90000 22500 1000 4000 "clearline"] +) +Layer(2 "solder") +( +) +Layer(3 "comp-GND") +( +) +Layer(4 "comp-power") +( +) +Layer(5 "sold-GND") +( +) +Layer(6 "sold-power") +( +) +Layer(7 "signal3") +( +) +Layer(8 "outline") +( +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( + Text[30000 5000 0 105 "90" "clearline"] + Text[60000 5000 0 105 "45" "clearline"] + Text[82500 5000 0 105 "rand" "clearline"] +) +NetList() +( + Net("GND" "(unknown)") + ( + Connect("R101-1") + Connect("R102-2") + ) +) Index: 1.0.8/doc-rnd/djopt/debumpify.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/djopt/debumpify.png =================================================================== --- 1.0.8/doc-rnd/djopt/debumpify.png (nonexistent) +++ 1.0.8/doc-rnd/djopt/debumpify.png (revision 1136) Property changes on: 1.0.8/doc-rnd/djopt/debumpify.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/djopt/debumpify.txt =================================================================== --- 1.0.8/doc-rnd/djopt/debumpify.txt (nonexistent) +++ 1.0.8/doc-rnd/djopt/debumpify.txt (revision 1136) @@ -0,0 +1,2 @@ +Looks for U-shaped traces (with 90 degree corners) that can be shortened +or eliminated. Index: 1.0.8/doc-rnd/djopt/index.html =================================================================== --- 1.0.8/doc-rnd/djopt/index.html (nonexistent) +++ 1.0.8/doc-rnd/djopt/index.html (revision 1136) @@ -0,0 +1,45 @@ + + +

Action djopt()

+ +The different types of optimizations change your board in order to +reduce the total trace length and via count. Each optimization is accessible +using an argument, e.g. djopt(miter). The basic actions have to be run multiple +times as each iteration will change the design making new changes possible for +subsequent iterations with the same or other actions. +

+Click on the images to download the example .pcb design. + + +
argument name description example in example out after 1st iteration +
debumpify +Looks for U-shaped traces (with 90 degree corners) that can be shortened +or eliminated. + +
miter +Replaces 90 degree corners with a pair of 45 degree corners, to reduce +RF losses and trace length. + +
orthopull +Looks for chains of traces all going in one direction, with more +traces orthogonal on one side than on the other. Moves the chain in +that direction, causing a net reduction in trace length, possibly +eliminating traces and/or corners. + +
unjaggy +Looks for corners which could be flipped to eliminate one or more +corners (i.e. jaggy lines become simpler). + +
vianudge +Looks for vias where all traces leave in the same direction. Tries to +move via in that direction to eliminate one of the traces (and thus a +corner). + +
viatrim +Looks for traces that go from via to via, where moving that trace to a +different layer eliminates one or both vias. + +
autorun all the above except miter; run them multiple times until there's no more change possible     +
+ + Index: 1.0.8/doc-rnd/djopt/miter.out.pcb =================================================================== --- 1.0.8/doc-rnd/djopt/miter.out.pcb (nonexistent) +++ 1.0.8/doc-rnd/djopt/miter.out.pcb (revision 1136) @@ -0,0 +1,75 @@ +# release: pcb-rnd 1.0.7 + +# To read pcb files, the pcb version (or the git source date) must be >= the file version +FileVersion[20070407] + +PCB["" 140000 67500] + +Grid[500.0 0 0 1] +Cursor[500 0 0.000000] +PolyArea[3100.006200] +Thermal[0.500000] +DRC[1200 900 1000 700 1500 1000] +Flags("nameonpcb,clearnew,snappin") +Groups("1,3,4,c:2,5,6,s:7:8") +Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] + + +Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 45000 15000 -5650 4350 0 100 ""] +( + Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] + Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] + ElementLine [-2362 3740 2362 3740 800] + ElementLine [-2362 -3740 2362 -3740 800] + + ) + +Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 80000 47500 -4350 -5650 3 100 ""] +( + Pad[-1181 5905 1181 5905 5118 2000 5718 "1" "1" "square"] + Pad[-1181 -5905 1181 -5905 5118 2000 5718 "2" "2" "square"] + ElementLine [-3740 -2362 -3740 2362 800] + ElementLine [3740 -2362 3740 2362 800] + + ) +Layer(1 "component") +( + Line[50905 15000 53405 15000 1000 4000 "clearline"] + Line[80000 41595 80000 41595 1000 4000 "clearline"] + Line[53405 15000 80000 41595 1000 4000 "clearline"] +) +Layer(2 "solder") +( +) +Layer(3 "comp-GND") +( +) +Layer(4 "comp-power") +( +) +Layer(5 "sold-GND") +( +) +Layer(6 "sold-power") +( +) +Layer(7 "signal3") +( +) +Layer(8 "outline") +( +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( +) +NetList() +( + Net("GND" "(unknown)") + ( + Connect("R101-1") + Connect("R102-2") + ) +) Index: 1.0.8/doc-rnd/djopt/miter.out.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/djopt/miter.out.png =================================================================== --- 1.0.8/doc-rnd/djopt/miter.out.png (nonexistent) +++ 1.0.8/doc-rnd/djopt/miter.out.png (revision 1136) Property changes on: 1.0.8/doc-rnd/djopt/miter.out.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/djopt/miter.pcb =================================================================== --- 1.0.8/doc-rnd/djopt/miter.pcb (nonexistent) +++ 1.0.8/doc-rnd/djopt/miter.pcb (revision 1136) @@ -0,0 +1,80 @@ +# release: pcb-rnd 1.0.7 + +# To read pcb files, the pcb version (or the git source date) must be >= the file version +FileVersion[20070407] + +PCB["" 140000 67500] + +Grid[500.0 0 0 1] +Cursor[500 0 0.000000] +PolyArea[3100.006200] +Thermal[0.500000] +DRC[1200 900 1000 700 1500 1000] +Flags("nameonpcb,clearnew,snappin") +Groups("1,3,4,c:2,5,6,s:7:8") +Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] + + +Attribute("PCB::grid::unit" "mil") + +Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 45000 15000 -5650 4350 0 100 ""] +( + Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] + Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] + ElementLine [-2362 3740 2362 3740 800] + ElementLine [-2362 -3740 2362 -3740 800] + + ) + +Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 80000 47500 -4350 -5650 3 100 ""] +( + Pad[-1181 5905 1181 5905 5118 2000 5718 "1" "1" "square"] + Pad[-1181 -5905 1181 -5905 5118 2000 5718 "2" "2" "square"] + ElementLine [-3740 -2362 -3740 2362 800] + ElementLine [3740 -2362 3740 2362 800] + + ) +Layer(1 "component") +( + Line[50905 15000 80000 15000 1000 4000 "clearline"] + Line[80000 15000 80000 41595 1000 4000 "clearline"] + Line[81181 41595 80000 41595 1000 4000 "clearline"] + Line[80000 41595 78819 41595 1000 4000 "clearline"] + Line[50905 16181 50905 15000 1000 4000 "clearline"] + Line[50905 15000 50905 13819 1000 4000 "clearline"] +) +Layer(2 "solder") +( +) +Layer(3 "comp-GND") +( +) +Layer(4 "comp-power") +( +) +Layer(5 "sold-GND") +( +) +Layer(6 "sold-power") +( +) +Layer(7 "signal3") +( +) +Layer(8 "outline") +( +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( +) +NetList() +( + Net("GND" "(unknown)") + ( + Connect("R101-1") + Connect("R102-2") + ) +) Index: 1.0.8/doc-rnd/djopt/miter.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/djopt/miter.png =================================================================== --- 1.0.8/doc-rnd/djopt/miter.png (nonexistent) +++ 1.0.8/doc-rnd/djopt/miter.png (revision 1136) Property changes on: 1.0.8/doc-rnd/djopt/miter.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/djopt/miter.txt =================================================================== --- 1.0.8/doc-rnd/djopt/miter.txt (nonexistent) +++ 1.0.8/doc-rnd/djopt/miter.txt (revision 1136) @@ -0,0 +1,2 @@ +Replaces 90 degree corners with a pair of 45 degree corners, to reduce +RF losses and trace length. Index: 1.0.8/doc-rnd/djopt/orthopull.out.pcb =================================================================== --- 1.0.8/doc-rnd/djopt/orthopull.out.pcb (nonexistent) +++ 1.0.8/doc-rnd/djopt/orthopull.out.pcb (revision 1136) @@ -0,0 +1,99 @@ +# release: pcb-rnd 1.0.7 + +# To read pcb files, the pcb version (or the git source date) must be >= the file version +FileVersion[20070407] + +PCB["" 140000 67500] + +Grid[2500.0 0 0 1] +Cursor[47500 32500 0.000000] +PolyArea[3100.006200] +Thermal[0.500000] +DRC[1200 900 1000 700 1500 1000] +Flags("nameonpcb,clearnew,snappin") +Groups("1,3,4,c:2,5,6,s:7:8") +Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] + + +Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 52500 10000 4350 5650 1 100 ""] +( + Pad[-1181 -5905 1181 -5905 5118 2000 5718 "1" "1" "square"] + Pad[-1181 5905 1181 5905 5118 2000 5718 "2" "2" "square"] + ElementLine [3740 -2362 3740 2362 800] + ElementLine [-3740 -2362 -3740 2362 800] + + ) + +Element["" "Standard SMT resistor, capacitor etc" "R103" "1206" 72500 10000 4350 5650 1 100 ""] +( + Pad[-1181 -5905 1181 -5905 5118 2000 5718 "1" "1" "square"] + Pad[-1181 5905 1181 5905 5118 2000 5718 "2" "2" "square"] + ElementLine [3740 -2362 3740 2362 800] + ElementLine [-3740 -2362 -3740 2362 800] + + ) + +Element["" "Standard SMT resistor, capacitor etc" "R104" "1206" 62500 52500 -4350 -5650 3 100 ""] +( + Pad[-1181 5905 1181 5905 5118 2000 5718 "1" "1" "square"] + Pad[-1181 -5905 1181 -5905 5118 2000 5718 "2" "2" "square"] + ElementLine [-3740 -2362 -3740 2362 800] + ElementLine [3740 -2362 3740 2362 800] + + ) + +Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 35000 10000 -4350 -5650 3 100 ""] +( + Pad[-1181 5905 1181 5905 5118 2000 5718 "1" "1" "square"] + Pad[-1181 -5905 1181 -5905 5118 2000 5718 "2" "2" "square"] + ElementLine [-3740 -2362 -3740 2362 800] + ElementLine [3740 -2362 3740 2362 800] + + ) +Layer(1 "component") +( + Line[52500 15905 52500 22500 1000 4000 "clearline"] + Line[72500 15905 72500 22500 1000 4000 "clearline"] + Line[62500 46595 62500 22500 1000 4000 "clearline"] + Line[35000 22500 52500 22500 1000 4000 "clearline"] + Line[35000 22500 35000 15905 1000 4000 "clearline"] + Line[62500 22500 72500 22500 1000 4000 "clearline"] + Line[52500 22500 62500 22500 1000 4000 "clearline"] +) +Layer(2 "solder") +( +) +Layer(3 "comp-GND") +( +) +Layer(4 "comp-power") +( +) +Layer(5 "sold-GND") +( +) +Layer(6 "sold-power") +( +) +Layer(7 "signal3") +( +) +Layer(8 "outline") +( +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( +) +NetList() +( + Net("GND" "(unknown)") + ( + Connect("R101-1") + Connect("R102-2") + Connect("R103-2") + Connect("R104-2") + ) +) Index: 1.0.8/doc-rnd/djopt/orthopull.out.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/djopt/orthopull.out.png =================================================================== --- 1.0.8/doc-rnd/djopt/orthopull.out.png (nonexistent) +++ 1.0.8/doc-rnd/djopt/orthopull.out.png (revision 1136) Property changes on: 1.0.8/doc-rnd/djopt/orthopull.out.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/djopt/orthopull.pcb =================================================================== --- 1.0.8/doc-rnd/djopt/orthopull.pcb (nonexistent) +++ 1.0.8/doc-rnd/djopt/orthopull.pcb (revision 1136) @@ -0,0 +1,98 @@ +# release: pcb-rnd 1.0.7 + +# To read pcb files, the pcb version (or the git source date) must be >= the file version +FileVersion[20070407] + +PCB["" 140000 67500] + +Grid[2500.0 0 0 1] +Cursor[47500 32500 0.000000] +PolyArea[3100.006200] +Thermal[0.500000] +DRC[1200 900 1000 700 1500 1000] +Flags("nameonpcb,clearnew,snappin") +Groups("1,3,4,c:2,5,6,s:7:8") +Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] + +Attribute("PCB::grid::unit" "mm") + +Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 52500 10000 4350 5650 1 100 ""] +( + Pad[-1181 -5905 1181 -5905 5118 2000 5718 "1" "1" "square"] + Pad[-1181 5905 1181 5905 5118 2000 5718 "2" "2" "square"] + ElementLine [3740 -2362 3740 2362 800] + ElementLine [-3740 -2362 -3740 2362 800] + + ) + +Element["" "Standard SMT resistor, capacitor etc" "R103" "1206" 72500 10000 4350 5650 1 100 ""] +( + Pad[-1181 -5905 1181 -5905 5118 2000 5718 "1" "1" "square"] + Pad[-1181 5905 1181 5905 5118 2000 5718 "2" "2" "square"] + ElementLine [3740 -2362 3740 2362 800] + ElementLine [-3740 -2362 -3740 2362 800] + + ) + +Element["" "Standard SMT resistor, capacitor etc" "R104" "1206" 62500 52500 -4350 -5650 3 100 ""] +( + Pad[-1181 5905 1181 5905 5118 2000 5718 "1" "1" "square"] + Pad[-1181 -5905 1181 -5905 5118 2000 5718 "2" "2" "square"] + ElementLine [-3740 -2362 -3740 2362 800] + ElementLine [3740 -2362 3740 2362 800] + + ) + +Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 35000 10000 -4350 -5650 3 100 ""] +( + Pad[-1181 5905 1181 5905 5118 2000 5718 "1" "1" "square"] + Pad[-1181 -5905 1181 -5905 5118 2000 5718 "2" "2" "square"] + ElementLine [-3740 -2362 -3740 2362 800] + ElementLine [3740 -2362 3740 2362 800] + + ) +Layer(1 "component") +( + Line[52500 15905 52500 37500 1000 4000 "clearline"] + Line[72500 15905 72500 37500 1000 4000 "clearline"] + Line[62500 46595 62500 37500 1000 4000 "clearline"] + Line[35000 37500 72500 37500 1000 4000 "clearline"] + Line[35000 37500 35000 15905 1000 4000 "clearline"] +) +Layer(2 "solder") +( +) +Layer(3 "comp-GND") +( +) +Layer(4 "comp-power") +( +) +Layer(5 "sold-GND") +( +) +Layer(6 "sold-power") +( +) +Layer(7 "signal3") +( +) +Layer(8 "outline") +( +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( +) +NetList() +( + Net("GND" "(unknown)") + ( + Connect("R101-1") + Connect("R102-2") + Connect("R103-2") + Connect("R104-2") + ) +) Index: 1.0.8/doc-rnd/djopt/orthopull.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/djopt/orthopull.png =================================================================== --- 1.0.8/doc-rnd/djopt/orthopull.png (nonexistent) +++ 1.0.8/doc-rnd/djopt/orthopull.png (revision 1136) Property changes on: 1.0.8/doc-rnd/djopt/orthopull.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/djopt/orthopull.txt =================================================================== --- 1.0.8/doc-rnd/djopt/orthopull.txt (nonexistent) +++ 1.0.8/doc-rnd/djopt/orthopull.txt (revision 1136) @@ -0,0 +1,4 @@ +Looks for chains of traces all going in one direction, with more +traces orthogonal on one side than on the other. Moves the chain in +that direction, causing a net reduction in trace length, possibly +eliminating traces and/or corners. Index: 1.0.8/doc-rnd/djopt/unjaggy.out.pcb =================================================================== --- 1.0.8/doc-rnd/djopt/unjaggy.out.pcb (nonexistent) +++ 1.0.8/doc-rnd/djopt/unjaggy.out.pcb (revision 1136) @@ -0,0 +1,79 @@ +# release: pcb-rnd 1.0.7 + +# To read pcb files, the pcb version (or the git source date) must be >= the file version +FileVersion[20070407] + +PCB["" 140000 67500] + +Grid[2500.0 0 0 1] +Cursor[12500 10000 0.000000] +PolyArea[3100.006200] +Thermal[0.500000] +DRC[1200 900 1000 700 1500 1000] +Flags("nameonpcb,clearnew,snappin") +Groups("1,3,4,c:2,5,6,s:7:8") +Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] + + +Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 17500 32500 -5650 4350 0 100 ""] +( + Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] + Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] + ElementLine [-2362 3740 2362 3740 800] + ElementLine [-2362 -3740 2362 -3740 800] + + ) + +Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 65000 12500 -5650 4350 0 100 ""] +( + Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] + Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] + ElementLine [-2362 3740 2362 3740 800] + ElementLine [-2362 -3740 2362 -3740 800] + + ) +Layer(1 "component") +( + Line[23405 32500 37500 32500 1000 4000 "clearline"] + Line[37500 32500 37500 15000 1000 4000 "clearline"] + Line[37500 15000 37500 15000 1000 4000 "clearline"] + Line[37500 32500 37500 32500 1000 4000 "clearline"] + Line[37500 15000 45000 15000 1000 4000 "clearline"] + Line[45000 15000 45000 10000 1000 4000 "clearline"] + Line[45000 10000 59095 10000 1000 4000 "clearline"] +) +Layer(2 "solder") +( +) +Layer(3 "comp-GND") +( +) +Layer(4 "comp-power") +( +) +Layer(5 "sold-GND") +( +) +Layer(6 "sold-power") +( +) +Layer(7 "signal3") +( +) +Layer(8 "outline") +( +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( +) +NetList() +( + Net("GND" "(unknown)") + ( + Connect("R101-1") + Connect("R102-2") + ) +) Index: 1.0.8/doc-rnd/djopt/unjaggy.out.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/djopt/unjaggy.out.png =================================================================== --- 1.0.8/doc-rnd/djopt/unjaggy.out.png (nonexistent) +++ 1.0.8/doc-rnd/djopt/unjaggy.out.png (revision 1136) Property changes on: 1.0.8/doc-rnd/djopt/unjaggy.out.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/djopt/unjaggy.pcb =================================================================== --- 1.0.8/doc-rnd/djopt/unjaggy.pcb (nonexistent) +++ 1.0.8/doc-rnd/djopt/unjaggy.pcb (revision 1136) @@ -0,0 +1,81 @@ +# release: pcb-rnd 1.0.7 + +# To read pcb files, the pcb version (or the git source date) must be >= the file version +FileVersion[20070407] + +PCB["" 140000 67500] + +Grid[2500.0 0 0 1] +Cursor[12500 10000 0.000000] +PolyArea[3100.006200] +Thermal[0.500000] +DRC[1200 900 1000 700 1500 1000] +Flags("nameonpcb,clearnew,snappin") +Groups("1,3,4,c:2,5,6,s:7:8") +Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] + + +Attribute("PCB::grid::unit" "mm") + +Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 17500 32500 -5650 4350 0 100 ""] +( + Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] + Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] + ElementLine [-2362 3740 2362 3740 800] + ElementLine [-2362 -3740 2362 -3740 800] + + ) + +Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 65000 12500 -5650 4350 0 100 ""] +( + Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] + Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] + ElementLine [-2362 3740 2362 3740 800] + ElementLine [-2362 -3740 2362 -3740 800] + + ) +Layer(1 "component") +( + Line[23405 32500 30000 32500 1000 4000 "clearline"] + Line[30000 22500 37500 22500 1000 4000 "clearline"] + Line[37500 22500 37500 15000 1000 4000 "clearline"] + Line[30000 32500 30000 22500 1000 4000 "clearline"] + Line[37500 15000 45000 15000 1000 4000 "clearline"] + Line[45000 15000 45000 10000 1000 4000 "clearline"] + Line[45000 10000 56595 10000 1000 4000 "clearline"] +) +Layer(2 "solder") +( +) +Layer(3 "comp-GND") +( +) +Layer(4 "comp-power") +( +) +Layer(5 "sold-GND") +( +) +Layer(6 "sold-power") +( +) +Layer(7 "signal3") +( +) +Layer(8 "outline") +( +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( +) +NetList() +( + Net("GND" "(unknown)") + ( + Connect("R101-1") + Connect("R102-2") + ) +) Index: 1.0.8/doc-rnd/djopt/unjaggy.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/djopt/unjaggy.png =================================================================== --- 1.0.8/doc-rnd/djopt/unjaggy.png (nonexistent) +++ 1.0.8/doc-rnd/djopt/unjaggy.png (revision 1136) Property changes on: 1.0.8/doc-rnd/djopt/unjaggy.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/djopt/unjaggy.txt =================================================================== --- 1.0.8/doc-rnd/djopt/unjaggy.txt (nonexistent) +++ 1.0.8/doc-rnd/djopt/unjaggy.txt (revision 1136) @@ -0,0 +1,2 @@ +Looks for corners which could be flipped to eliminate one or more +corners (i.e. jaggy lines become simpler). Index: 1.0.8/doc-rnd/djopt/vianudge.out.pcb =================================================================== --- 1.0.8/doc-rnd/djopt/vianudge.out.pcb (nonexistent) +++ 1.0.8/doc-rnd/djopt/vianudge.out.pcb (revision 1136) @@ -0,0 +1,79 @@ +# release: pcb-rnd 1.0.7 + +# To read pcb files, the pcb version (or the git source date) must be >= the file version +FileVersion[20070407] + +PCB["" 140000 67500] + +Grid[2500.0 0 0 1] +Cursor[17500 22500 0.000000] +PolyArea[3100.006200] +Thermal[0.500000] +DRC[1200 900 1000 700 1500 1000] +Flags("nameonpcb,clearnew,snappin") +Groups("1,3,4,c:2,5,6,s:7:8") +Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] + +Via[85000 27500 8661 4000 0 3937 "" ""] + +Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 57500 10000 -5650 4350 0 100 ""] +( + Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] + Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] + ElementLine [-2362 3740 2362 3740 800] + ElementLine [-2362 -3740 2362 -3740 800] + + ) + +Element["onsolder" "Standard SMT resistor, capacitor etc" "R102" "1206" 10000 10000 5650 4350 2 100 "auto"] +( + Pad[-5905 -1181 -5905 1181 5118 2000 5718 "1" "1" "onsolder,square"] + Pad[5905 -1181 5905 1181 5118 2000 5718 "2" "2" "onsolder,square"] + ElementLine [-2362 3740 2362 3740 800] + ElementLine [-2362 -3740 2362 -3740 800] + + ) +Layer(1 "component") +( + Line[63405 10000 85000 10000 1000 4000 "clearline"] + Line[85000 10000 85000 27500 1000 4000 "clearline"] +) +Layer(2 "solder") +( + Line[15905 10000 30000 10000 2000 4000 "clearline"] + Line[30000 10000 30000 27500 2000 4000 "clearline"] + Line[30000 27500 85000 27500 2000 4000 "clearline"] + Line[85000 27500 85000 27500 2000 4000 "clearline"] +) +Layer(3 "comp-GND") +( +) +Layer(4 "comp-power") +( +) +Layer(5 "sold-GND") +( +) +Layer(6 "sold-power") +( +) +Layer(7 "signal3") +( +) +Layer(8 "outline") +( +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( +) +NetList() +( + Net("GND" "(unknown)") + ( + Connect("R101-1") + Connect("R102-2") + ) +) Index: 1.0.8/doc-rnd/djopt/vianudge.out.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/djopt/vianudge.out.png =================================================================== --- 1.0.8/doc-rnd/djopt/vianudge.out.png (nonexistent) +++ 1.0.8/doc-rnd/djopt/vianudge.out.png (revision 1136) Property changes on: 1.0.8/doc-rnd/djopt/vianudge.out.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/djopt/vianudge.pcb =================================================================== --- 1.0.8/doc-rnd/djopt/vianudge.pcb (nonexistent) +++ 1.0.8/doc-rnd/djopt/vianudge.pcb (revision 1136) @@ -0,0 +1,81 @@ +# release: pcb-rnd 1.0.7 + +# To read pcb files, the pcb version (or the git source date) must be >= the file version +FileVersion[20070407] + +PCB["" 140000 67500] + +Grid[2500.0 0 0 1] +Cursor[17500 22500 0.000000] +PolyArea[3100.006200] +Thermal[0.500000] +DRC[1200 900 1000 700 1500 1000] +Flags("nameonpcb,clearnew,snappin") +Groups("1,3,4,c:2,5,6,s:7:8") +Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] + + +Attribute("PCB::grid::unit" "mm") +Via[85000 50000 8661 4000 0 3937 "" ""] + +Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 57500 10000 -5650 4350 0 100 ""] +( + Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] + Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] + ElementLine [-2362 3740 2362 3740 800] + ElementLine [-2362 -3740 2362 -3740 800] + + ) + +Element["onsolder" "Standard SMT resistor, capacitor etc" "R102" "1206" 10000 10000 5650 4350 2 100 "auto"] +( + Pad[-5905 -1181 -5905 1181 5118 2000 5718 "1" "1" "onsolder,square"] + Pad[5905 -1181 5905 1181 5118 2000 5718 "2" "2" "onsolder,square"] + ElementLine [-2362 3740 2362 3740 800] + ElementLine [-2362 -3740 2362 -3740 800] + + ) +Layer(1 "component") +( + Line[63405 10000 85000 10000 1000 4000 "clearline"] + Line[85000 10000 85000 50000 1000 4000 "clearline"] +) +Layer(2 "solder") +( + Line[15905 10000 30000 10000 2000 4000 "clearline"] + Line[30000 10000 30000 27500 2000 4000 "clearline"] + Line[30000 27500 85000 27500 2000 4000 "clearline"] + Line[85000 50000 85000 27500 2000 4000 "clearline"] +) +Layer(3 "comp-GND") +( +) +Layer(4 "comp-power") +( +) +Layer(5 "sold-GND") +( +) +Layer(6 "sold-power") +( +) +Layer(7 "signal3") +( +) +Layer(8 "outline") +( +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( +) +NetList() +( + Net("GND" "(unknown)") + ( + Connect("R101-1") + Connect("R102-2") + ) +) Index: 1.0.8/doc-rnd/djopt/vianudge.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/djopt/vianudge.png =================================================================== --- 1.0.8/doc-rnd/djopt/vianudge.png (nonexistent) +++ 1.0.8/doc-rnd/djopt/vianudge.png (revision 1136) Property changes on: 1.0.8/doc-rnd/djopt/vianudge.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/djopt/vianudge.txt =================================================================== --- 1.0.8/doc-rnd/djopt/vianudge.txt (nonexistent) +++ 1.0.8/doc-rnd/djopt/vianudge.txt (revision 1136) @@ -0,0 +1,3 @@ +Looks for vias where all traces leave in the same direction. Tries to +move via in that direction to eliminate one of the traces (and thus a +corner). Index: 1.0.8/doc-rnd/djopt/viatrim.out.pcb =================================================================== --- 1.0.8/doc-rnd/djopt/viatrim.out.pcb (nonexistent) +++ 1.0.8/doc-rnd/djopt/viatrim.out.pcb (revision 1136) @@ -0,0 +1,80 @@ +# release: pcb-rnd 1.0.7 + +# To read pcb files, the pcb version (or the git source date) must be >= the file version +FileVersion[20070407] + +PCB["" 140000 67500] + +Grid[2500.0 0 0 1] +Cursor[37500 10000 0.000000] +PolyArea[3100.006200] +Thermal[0.500000] +DRC[1200 900 1000 700 1500 1000] +Flags("nameonpcb,clearnew,snappin") +Groups("1,3,4,c:2,5,6,s:7:8") +Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] + +Via[60000 32500 7874 4000 0 3150 "" ""] +Via[92500 32500 7874 4000 0 3150 "" ""] +Via[75000 32500 7874 4000 0 3150 "" ""] + +Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 17500 32500 -5650 4350 0 100 ""] +( + Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] + Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] + ElementLine [-2362 3740 2362 3740 800] + ElementLine [-2362 -3740 2362 -3740 800] + + ) + +Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 117500 32500 -5650 4350 0 100 ""] +( + Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] + Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] + ElementLine [-2362 3740 2362 3740 800] + ElementLine [-2362 -3740 2362 -3740 800] + + ) +Layer(1 "component") +( + Line[23405 32500 60000 32500 1000 4000 "clearline"] + Line[92500 32500 111595 32500 1000 4000 "clearline"] + Line[60000 32500 60000 32500 1000 4000 "clearline"] + Line[60000 32500 75000 32500 1000 4000 "clearline"] +) +Layer(2 "solder") +( + Line[75000 32500 92500 32500 1000 4000 "clearline"] +) +Layer(3 "comp-GND") +( +) +Layer(4 "comp-power") +( +) +Layer(5 "sold-GND") +( +) +Layer(6 "sold-power") +( +) +Layer(7 "signal3") +( +) +Layer(8 "outline") +( +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( +) +NetList() +( + Net("GND" "(unknown)") + ( + Connect("R101-1") + Connect("R102-2") + ) +) Index: 1.0.8/doc-rnd/djopt/viatrim.out.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/djopt/viatrim.out.png =================================================================== --- 1.0.8/doc-rnd/djopt/viatrim.out.png (nonexistent) +++ 1.0.8/doc-rnd/djopt/viatrim.out.png (revision 1136) Property changes on: 1.0.8/doc-rnd/djopt/viatrim.out.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/djopt/viatrim.pcb =================================================================== --- 1.0.8/doc-rnd/djopt/viatrim.pcb (nonexistent) +++ 1.0.8/doc-rnd/djopt/viatrim.pcb (revision 1136) @@ -0,0 +1,87 @@ +# release: pcb-rnd 1.0.7 + +# To read pcb files, the pcb version (or the git source date) must be >= the file version +FileVersion[20070407] + +PCB["" 140000 67500] + +Grid[2500.0 0 0 1] +Cursor[37500 10000 0.000000] +PolyArea[3100.006200] +Thermal[0.500000] +DRC[1200 900 1000 700 1500 1000] +Flags("nameonpcb,clearnew,snappin") +Groups("1,3,4,c:2,5,6,s:7:8") +Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] + + +Attribute("PCB::grid::unit" "mm") +Via[60000 32500 7874 4000 0 3150 "" ""] +Via[92500 32500 7874 4000 0 3150 "" ""] +Via[75000 32500 7874 4000 0 3150 "" ""] +Via[40000 32500 7874 4000 0 3150 "" ""] + +Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 17500 32500 -5650 4350 0 100 ""] +( + Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] + Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] + ElementLine [-2362 3740 2362 3740 800] + ElementLine [-2362 -3740 2362 -3740 800] + + ) + +Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 117500 32500 -5650 4350 0 100 ""] +( + Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] + Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] + ElementLine [-2362 3740 2362 3740 800] + ElementLine [-2362 -3740 2362 -3740 800] + + ) +Layer(1 "component") +( + Line[23405 32500 40000 32500 1000 4000 "clearline"] + Line[92500 32500 111595 32500 1000 4000 "clearline"] + Line[111595 33681 111595 32500 1000 4000 "clearline"] + Line[111595 32500 111595 31319 1000 4000 "clearline"] + Line[23405 33681 23405 32500 1000 4000 "clearline"] + Line[23405 32500 23405 31319 1000 4000 "clearline"] + Line[40000 32500 60000 32500 1000 4000 "clearline"] +) +Layer(2 "solder") +( + Line[60000 32500 75000 32500 1000 4000 "clearline"] + Line[75000 32500 92500 32500 1000 4000 "clearline"] +) +Layer(3 "comp-GND") +( +) +Layer(4 "comp-power") +( +) +Layer(5 "sold-GND") +( +) +Layer(6 "sold-power") +( +) +Layer(7 "signal3") +( +) +Layer(8 "outline") +( +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( +) +NetList() +( + Net("GND" "(unknown)") + ( + Connect("R101-1") + Connect("R102-2") + ) +) Index: 1.0.8/doc-rnd/djopt/viatrim.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/djopt/viatrim.png =================================================================== --- 1.0.8/doc-rnd/djopt/viatrim.png (nonexistent) +++ 1.0.8/doc-rnd/djopt/viatrim.png (revision 1136) Property changes on: 1.0.8/doc-rnd/djopt/viatrim.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/djopt/viatrim.txt =================================================================== --- 1.0.8/doc-rnd/djopt/viatrim.txt (nonexistent) +++ 1.0.8/doc-rnd/djopt/viatrim.txt (revision 1136) @@ -0,0 +1,2 @@ +Looks for traces that go from via to via, where moving that trace to a +different layer eliminates one or both vias. Index: 1.0.8/doc-rnd/flagcomp.html =================================================================== --- 1.0.8/doc-rnd/flagcomp.html (nonexistent) +++ 1.0.8/doc-rnd/flagcomp.html (revision 1136) @@ -0,0 +1,23 @@ + + +

pcb-rnd - the [flagcomp] patch

+ +Many of the patches in this fork, and in possible future branches/forks +may introduce new pin, pad or element flags. PCB loads and saves flags +by converting the text representation to an in-memory binary format. Any +flag not understood is lost. +

+This patch adds a linked list of string flags, filled in with the unknown +flags while loading a PCB. On save, these flags are appended to the normal +flag list. This preserves all unknown flags (but not order of flags) in +a load/save cycle. + +

save/load and compatibility

+This patch ensures compatibility in save/load cycles with flags introduced +by later versions of vanilla PCB or different branches/forks of PCB by +not removing flags they introduced. + +

plans

+No plans - this feature is fully implemented. + + Index: 1.0.8/doc-rnd/gpmi/Credits =================================================================== --- 1.0.8/doc-rnd/gpmi/Credits (nonexistent) +++ 1.0.8/doc-rnd/gpmi/Credits (revision 1136) @@ -0,0 +1,11 @@ +2006...2009 +~~~~~~~~~~~ +Big thanks to DJ Delorie who added external HID support in PCB and commited +many small patches needed to get this project working in the period +when the whole project was a plugin to vanilla pcb. + +The following people helped the project with their valuable feedbacks +in the early stage: + John Griessen + Carlos Nieves Onega + Index: 1.0.8/doc-rnd/gpmi/History =================================================================== --- 1.0.8/doc-rnd/gpmi/History (nonexistent) +++ 1.0.8/doc-rnd/gpmi/History (revision 1136) @@ -0,0 +1,32 @@ +History +~~~~~~~ +As of October 2006, PCB has native support for external (or dynamic +loadable) HIDs. This project is plugin that provides scripting features. + +For a long time I believe that good applications should be scriptable, +and real good ones should not restrict scripting to one or two languages. +For this reason I have been working on GPMI with various other developers +for years. GPMI provides a general way to split up big applications in +smaller, usually dynamic loadable parts, and encourages that some of these +parts should be written in a script language. For me, the ideal model +of an application is a small core that knows how to manipulate the +internal representation of the task and a lot of dynamic functionality +plugins and support plugins that do all the high-level job for the user. + +PCB is an old and big software, with a stable user base. Restructuring the +whole source to "GPMIize" it is no option. Instead, a nice compromise is +implementing this functionality in a plugin that pcb can load for the users +who are interested in such extras. + +From 2006 to 2009 spring the project was on hold, because I was nagging +PCB developers to add support for customizable dialog boxes. In late March +2009, PCB developers pointed out that the interface I was waiting for had been +there for who-knows-how-long. With the help of DJ Delorie I extended the +action handling of PCB to remember action contexts, which was another showstopper. +After all obstacles removed, I allocated a 24 hour coding session where I +finished the exporter functionality, added action binding, dialog box handling +and layout manipulation functions. + +During the summer of 2015 I merged pcb-gpmi into pcb-rnd and made it +the default scirpting engine for pcb-rnd. + Index: 1.0.8/doc-rnd/gpmi/Makefile =================================================================== --- 1.0.8/doc-rnd/gpmi/Makefile (nonexistent) +++ 1.0.8/doc-rnd/gpmi/Makefile (revision 1136) @@ -0,0 +1,20 @@ +DPI_BIG=-Gsize=8,8 -Gdpi=166 +DPI=-Gsize=8,8 -Gdpi=100 + +all: gpmi_flow.png gpmi_flow_load.png gpmi_flow_reg.png gpmi_flow_menu.png gpmi_flow_exp.png + cd rosetta && make + +gpmi_flow.png: gpmi_flow.dot Makefile + dot $(DPI_BIG) -Tpng gpmi_flow.dot >$@ + +gpmi_flow_load.png: gpmi_flow_load.dot Makefile + dot $(DPI) -Tpng gpmi_flow_load.dot >$@ + +gpmi_flow_reg.png: gpmi_flow_reg.dot Makefile + dot $(DPI) -Tpng gpmi_flow_reg.dot >$@ + +gpmi_flow_menu.png: gpmi_flow_menu.dot Makefile + dot $(DPI) -Tpng gpmi_flow_menu.dot >$@ + +gpmi_flow_exp.png: gpmi_flow_exp.dot Makefile + dot $(DPI) -Tpng gpmi_flow_exp.dot >$@ Index: 1.0.8/doc-rnd/gpmi/Porting =================================================================== --- 1.0.8/doc-rnd/gpmi/Porting (nonexistent) +++ 1.0.8/doc-rnd/gpmi/Porting (revision 1136) @@ -0,0 +1,5 @@ +Currently the project works on Linux only. GPMI is portable, so we need +only Makefile tweakings on pcb-gpmi to be able to compile it anywhere +where GPMI compiles. However, first I want to see some test results +from Linux users. + Index: 1.0.8/doc-rnd/gpmi/gpmi_flow.dot =================================================================== --- 1.0.8/doc-rnd/gpmi/gpmi_flow.dot (nonexistent) +++ 1.0.8/doc-rnd/gpmi/gpmi_flow.dot (revision 1136) @@ -0,0 +1,63 @@ +digraph g { + rankdir=LR + splines="polyline" +# nodesep=1 +# ranksep=1.5 + + subgraph cluster_0 { + label="pcb-rnd" +# core [label="pcb-rnd core|{{HID system|plugin system}}" shape=record] + core [label="core" shape=box] + hids [label="HID system" shape=box height=2] + plugins [label="plugin system" shape=box height=2] + } + + subgraph cluster_1 { + label="GPMI" + gpmi_hid [label="gpmi HID"] + gpmi_pkg [label="gpmi package\n(host glue layer)"] + gpmi_mod1 [label="gpmi lua module\n(script glue layer)"] + gpmi_scr1 [label="lua script"] + gpmi_mod2 [label="gpmi mawk module\n(script glue layer)"] + gpmi_scr2 [label="awk script"] + } + + + + gui [label="the active\nGUI HID\n(e.g. gtk)"] + exp1 [label="PS exporer"] + exp2 [label="PNG exporer"] + + + exp1 -> hids [label="register"] + exp2 -> hids [label="register"] + + hids -> exp1 [label="drawing"] + hids -> exp2 [label="drawing"] + hids -> gui [label="drawing"] + + plugins -> gpmi_hid [label="load plugin"] + gpmi_hid -> hids [label="register"] + hids -> gpmi_hid [label="drawing"] + core -> gpmi_hid [label="event"] + + gpmi_pkg -> core [label="calls & variables"] + gpmi_pkg -> hids [label="calls & variables"] + gpmi_pkg -> gpmi_hid [label="calls & variables"] + gpmi_pkg -> plugins [label="calls & variables"] + + + gpmi_hid -> gpmi_mod1 [label="load script"] + gpmi_hid -> gpmi_mod1 [label="event"] + gpmi_hid -> gpmi_mod2 [label="load script"] + gpmi_hid -> gpmi_mod2 [label="event"] + + gpmi_mod1 -> gpmi_scr1 [label="load and exec"] + gpmi_mod1 -> gpmi_scr1 [label="event" style=dashed] + gpmi_scr1 -> gpmi_pkg [label="function calls" style=dashed] + + gpmi_mod2 -> gpmi_scr2 [label="load and exec"] + gpmi_mod2 -> gpmi_scr2 [label="event" style=dashed] + gpmi_scr2 -> gpmi_pkg [label="function calls" style=dashed] + +} \ No newline at end of file Index: 1.0.8/doc-rnd/gpmi/gpmi_flow.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/gpmi/gpmi_flow.png =================================================================== --- 1.0.8/doc-rnd/gpmi/gpmi_flow.png (nonexistent) +++ 1.0.8/doc-rnd/gpmi/gpmi_flow.png (revision 1136) Property changes on: 1.0.8/doc-rnd/gpmi/gpmi_flow.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/gpmi/gpmi_flow_exp.dot =================================================================== --- 1.0.8/doc-rnd/gpmi/gpmi_flow_exp.dot (nonexistent) +++ 1.0.8/doc-rnd/gpmi/gpmi_flow_exp.dot (revision 1136) @@ -0,0 +1,65 @@ +digraph g { + rankdir=LR + splines="polyline" +# nodesep=1 +# ranksep=1.5 + + subgraph cluster_0 { + label="pcb-rnd" +# core [label="pcb-rnd core|{{HID system|plugin system}}" shape=record] + core [label="core" shape=box] + hids [label="HID system" shape=box height=2] + plugins [label="plugin system" shape=box height=2] + } + + subgraph cluster_1 { + label="GPMI" + gpmi_hid [label="gpmi HID"] + gpmi_pkg [label="gpmi package\n(host glue layer)"] + gpmi_mod1 [label="gpmi lua module\n(script glue layer)"] + gpmi_scr1 [label="lua script"] + gpmi_mod2 [label="gpmi mawk module\n(script glue layer)"] + gpmi_scr2 [label="awk script"] + outfile [label="export\noutput file" color=green] + } + + + + gui [label="the active\nGUI HID\n(e.g. gtk)"] + exp1 [label="PS exporer"] + exp2 [label="PNG exporer"] + + + exp1 -> hids [label="register"] + exp2 -> hids [label="register"] + + hids -> exp1 [label="drawing"] + hids -> exp2 [label="drawing"] + hids -> gui [label="drawing"] + + plugins -> gpmi_hid [label="load plugin"] + gpmi_hid -> hids [label="register"] + hids -> gpmi_hid [label="drawing" color=green] + core -> gpmi_hid [label="event"] + + gpmi_pkg -> core [label="calls & variables"] + gpmi_pkg -> hids [label="calls & variables" color=red] + gpmi_pkg -> gpmi_hid [label="calls & variables"] + gpmi_pkg -> plugins [label="calls & variables"] + + + gpmi_hid -> gpmi_mod1 [label="load script"] + gpmi_hid -> gpmi_mod1 [label="event" color=green] + gpmi_hid -> gpmi_mod2 [label="load script"] + gpmi_hid -> gpmi_mod2 [label="event"] + + gpmi_mod1 -> gpmi_scr1 [label="load and exec"] + gpmi_mod1 -> gpmi_scr1 [label="event" style=dashed color=green] + gpmi_scr1 -> gpmi_pkg [label="function calls" style=dashed color=red] + gpmi_scr1 -> outfile [label="write" color=green] + + gpmi_mod2 -> gpmi_scr2 [label="load and exec"] + gpmi_mod2 -> gpmi_scr2 [label="event" style=dashed] + gpmi_scr2 -> gpmi_pkg [label="function calls" style=dashed] + +} \ No newline at end of file Index: 1.0.8/doc-rnd/gpmi/gpmi_flow_exp.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/gpmi/gpmi_flow_exp.png =================================================================== --- 1.0.8/doc-rnd/gpmi/gpmi_flow_exp.png (nonexistent) +++ 1.0.8/doc-rnd/gpmi/gpmi_flow_exp.png (revision 1136) Property changes on: 1.0.8/doc-rnd/gpmi/gpmi_flow_exp.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/gpmi/gpmi_flow_load.dot =================================================================== --- 1.0.8/doc-rnd/gpmi/gpmi_flow_load.dot (nonexistent) +++ 1.0.8/doc-rnd/gpmi/gpmi_flow_load.dot (revision 1136) @@ -0,0 +1,63 @@ +digraph g { + rankdir=LR + splines="polyline" +# nodesep=1 +# ranksep=1.5 + + subgraph cluster_0 { + label="pcb-rnd" +# core [label="pcb-rnd core|{{HID system|plugin system}}" shape=record] + core [label="core" shape=box] + hids [label="HID system" shape=box height=2] + plugins [label="plugin system" shape=box height=2] + } + + subgraph cluster_1 { + label="GPMI" + gpmi_hid [label="gpmi HID"] + gpmi_pkg [label="gpmi package\n(host glue layer)"] + gpmi_mod1 [label="gpmi lua module\n(script glue layer)"] + gpmi_scr1 [label="lua script"] + gpmi_mod2 [label="gpmi mawk module\n(script glue layer)"] + gpmi_scr2 [label="awk script"] + } + + + + gui [label="the active\nGUI HID\n(e.g. gtk)"] + exp1 [label="PS exporer"] + exp2 [label="PNG exporer"] + + + exp1 -> hids [label="register"] + exp2 -> hids [label="register"] + + hids -> exp1 [label="drawing"] + hids -> exp2 [label="drawing"] + hids -> gui [label="drawing"] + + plugins -> gpmi_hid [label="load plugin" color=red] + gpmi_hid -> hids [label="register"] + hids -> gpmi_hid [label="drawing"] + core -> gpmi_hid [label="event"] + + gpmi_pkg -> core [label="calls & variables"] + gpmi_pkg -> hids [label="calls & variables"] + gpmi_pkg -> gpmi_hid [label="calls & variables" color=green] + gpmi_pkg -> plugins [label="calls & variables"] + + + gpmi_hid -> gpmi_mod1 [label="load script" color=red] + gpmi_hid -> gpmi_mod1 [label="event"] + gpmi_hid -> gpmi_mod2 [label="load script"] + gpmi_hid -> gpmi_mod2 [label="event"] + + gpmi_mod1 -> gpmi_scr1 [label="load and exec" color=red] + gpmi_mod1 -> gpmi_scr1 [label="event" style=dashed] + gpmi_scr1 -> gpmi_pkg [label="function calls" style=dashed color=green] + + gpmi_mod2 -> gpmi_scr2 [label="load and exec"] + gpmi_mod2 -> gpmi_scr2 [label="event" style=dashed] + gpmi_scr2 -> gpmi_pkg [label="function calls" style=dashed] + +} \ No newline at end of file Index: 1.0.8/doc-rnd/gpmi/gpmi_flow_load.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/gpmi/gpmi_flow_load.png =================================================================== --- 1.0.8/doc-rnd/gpmi/gpmi_flow_load.png (nonexistent) +++ 1.0.8/doc-rnd/gpmi/gpmi_flow_load.png (revision 1136) Property changes on: 1.0.8/doc-rnd/gpmi/gpmi_flow_load.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/gpmi/gpmi_flow_menu.dot =================================================================== --- 1.0.8/doc-rnd/gpmi/gpmi_flow_menu.dot (nonexistent) +++ 1.0.8/doc-rnd/gpmi/gpmi_flow_menu.dot (revision 1136) @@ -0,0 +1,63 @@ +digraph g { + rankdir=LR + splines="polyline" +# nodesep=1 +# ranksep=1.5 + + subgraph cluster_0 { + label="pcb-rnd" +# core [label="pcb-rnd core|{{HID system|plugin system}}" shape=record] + core [label="core" shape=box] + hids [label="HID system" shape=box height=2] + plugins [label="plugin system" shape=box height=2] + } + + subgraph cluster_1 { + label="GPMI" + gpmi_hid [label="gpmi HID"] + gpmi_pkg [label="gpmi package\n(host glue layer)"] + gpmi_mod1 [label="gpmi lua module\n(script glue layer)"] + gpmi_scr1 [label="lua script"] + gpmi_mod2 [label="gpmi mawk module\n(script glue layer)"] + gpmi_scr2 [label="awk script"] + } + + + + gui [label="the active\nGUI HID\n(e.g. gtk)"] + exp1 [label="PS exporer"] + exp2 [label="PNG exporer"] + + + exp1 -> hids [label="register"] + exp2 -> hids [label="register"] + + hids -> exp1 [label="drawing"] + hids -> exp2 [label="drawing"] + hids -> gui [label="drawing" color=green] + + plugins -> gpmi_hid [label="load plugin"] + gpmi_hid -> hids [label="register"] + hids -> gpmi_hid [label="drawing"] + core -> gpmi_hid [label="event" color=red] + + gpmi_pkg -> core [label="calls & variables"] + gpmi_pkg -> hids [label="calls & variables" color=green] + gpmi_pkg -> gpmi_hid [label="calls & variables"] + gpmi_pkg -> plugins [label="calls & variables"] + + + gpmi_hid -> gpmi_mod1 [label="load script"] + gpmi_hid -> gpmi_mod1 [label="event" color=red] + gpmi_hid -> gpmi_mod2 [label="load script"] + gpmi_hid -> gpmi_mod2 [label="event"] + + gpmi_mod1 -> gpmi_scr1 [label="load and exec"] + gpmi_mod1 -> gpmi_scr1 [label="event" style=dashed color=red] + gpmi_scr1 -> gpmi_pkg [label="function calls" style=dashed color=green] + + gpmi_mod2 -> gpmi_scr2 [label="load and exec"] + gpmi_mod2 -> gpmi_scr2 [label="event" style=dashed] + gpmi_scr2 -> gpmi_pkg [label="function calls" style=dashed] + +} \ No newline at end of file Index: 1.0.8/doc-rnd/gpmi/gpmi_flow_menu.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/gpmi/gpmi_flow_menu.png =================================================================== --- 1.0.8/doc-rnd/gpmi/gpmi_flow_menu.png (nonexistent) +++ 1.0.8/doc-rnd/gpmi/gpmi_flow_menu.png (revision 1136) Property changes on: 1.0.8/doc-rnd/gpmi/gpmi_flow_menu.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/gpmi/gpmi_flow_reg.dot =================================================================== --- 1.0.8/doc-rnd/gpmi/gpmi_flow_reg.dot (nonexistent) +++ 1.0.8/doc-rnd/gpmi/gpmi_flow_reg.dot (revision 1136) @@ -0,0 +1,64 @@ +digraph g { + rankdir=LR + splines="polyline" +# nodesep=1 +# ranksep=1.5 + + subgraph cluster_0 { + label="pcb-rnd" +# core [label="pcb-rnd core|{{HID system|plugin system}}" shape=record] + core [label="core" shape=box] + hids [label="HID system" shape=box height=2] + plugins [label="plugin system" shape=box height=2] + } + + subgraph cluster_1 { + label="GPMI" + gpmi_hid [label="gpmi HID"] + gpmi_pkg [label="gpmi package\n(host glue layer)"] + gpmi_mod1 [label="gpmi lua module\n(script glue layer)"] + gpmi_scr1 [label="lua script"] + gpmi_mod2 [label="gpmi mawk module\n(script glue layer)"] + gpmi_scr2 [label="awk script"] + } + + + + gui [label="the active\nGUI HID\n(e.g. gtk)"] + exp1 [label="PS exporer"] + exp2 [label="PNG exporer"] + + + exp1 -> hids [label="register"] + exp2 -> hids [label="register"] + + hids -> exp1 [label="drawing"] + hids -> exp2 [label="drawing"] + hids -> gui [label="drawing"] + + plugins -> gpmi_hid [label="load plugin"] + gpmi_hid -> hids [label="register"] + hids -> gpmi_hid [label="drawing"] + core -> gpmi_hid [label="event"] + + gpmi_pkg -> core [label="calls & variables" color=green] + gpmi_pkg -> hids [label="calls & variables"] + gpmi_pkg -> gpmi_hid [label="calls & variables" color=red] + gpmi_pkg -> plugins [label="calls & variables"] + + + gpmi_hid -> gpmi_mod1 [label="load script"] + gpmi_hid -> gpmi_mod1 [label="event"] + gpmi_hid -> gpmi_mod2 [label="load script"] + gpmi_hid -> gpmi_mod2 [label="event"] + + gpmi_mod1 -> gpmi_scr1 [label="load and exec"] + gpmi_mod1 -> gpmi_scr1 [label="event" style=dashed] + gpmi_scr1 -> gpmi_pkg [label="function calls" style=dashed color=red] + gpmi_scr1 -> gpmi_pkg [label="function calls" style=dashed color=green] + + gpmi_mod2 -> gpmi_scr2 [label="load and exec"] + gpmi_mod2 -> gpmi_scr2 [label="event" style=dashed] + gpmi_scr2 -> gpmi_pkg [label="function calls" style=dashed] + +} \ No newline at end of file Index: 1.0.8/doc-rnd/gpmi/gpmi_flow_reg.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/gpmi/gpmi_flow_reg.png =================================================================== --- 1.0.8/doc-rnd/gpmi/gpmi_flow_reg.png (nonexistent) +++ 1.0.8/doc-rnd/gpmi/gpmi_flow_reg.png (revision 1136) Property changes on: 1.0.8/doc-rnd/gpmi/gpmi_flow_reg.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/gpmi/index.html =================================================================== --- 1.0.8/doc-rnd/gpmi/index.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/index.html (revision 1136) @@ -0,0 +1,32 @@ + + +

pcb-rnd GPMI scripting - TOC

+ +

Installation, configuration

+ + + +

High level docs

+ + +

Glue layer documentation

+ + +

Authors, credits, misc

+ + + + Index: 1.0.8/doc-rnd/gpmi/packages/Makefile =================================================================== --- 1.0.8/doc-rnd/gpmi/packages/Makefile (nonexistent) +++ 1.0.8/doc-rnd/gpmi/packages/Makefile (revision 1136) @@ -0,0 +1,14 @@ +ROOT=../../.. +ALL= actions dialogs hid layout + +all: XREF $(ALL:%=%_ref.html) + +include $(ROOT)/src/pcb-gpmi/Makefile.config + +%_ref.html REF.% : $(ROOT)/src/pcb-gpmi/gpmi_plugin/gpmi_pkg/%.h + $(ROOT)/util/genref.sh "$^" "$(ROOT)" "../packages/$@" $(PCB_CFLAGS) >$*_ref.html + +XREF: $(ALL:%=REF.%) + cat $^ > $@ + + Index: 1.0.8/doc-rnd/gpmi/packages/XREF =================================================================== --- 1.0.8/doc-rnd/gpmi/packages/XREF (nonexistent) +++ 1.0.8/doc-rnd/gpmi/packages/XREF (revision 1136) @@ -0,0 +1,84 @@ +event ACTE_action ../packages/actions_ref.html#ACTE_action +event ACTE_gui_init ../packages/actions_ref.html#ACTE_gui_init +event ACTE_unload ../packages/actions_ref.html#ACTE_unload +function action_register ../packages/actions_ref.html#action_register +function action_arg ../packages/actions_ref.html#action_arg +function action ../packages/actions_ref.html#action +function create_menu ../packages/actions_ref.html#create_menu +enum dialog_fileselect_e ../packages/dialogs_ref.html#dialog_fileselect_e +function dialog_log ../packages/dialogs_ref.html#dialog_log +function dialog_confirm ../packages/dialogs_ref.html#dialog_confirm +function dialog_report ../packages/dialogs_ref.html#dialog_report +function dialog_prompt ../packages/dialogs_ref.html#dialog_prompt +function dialog_fileselect ../packages/dialogs_ref.html#dialog_fileselect +function dialog_beep ../packages/dialogs_ref.html#dialog_beep +function dialog_progress ../packages/dialogs_ref.html#dialog_progress +function dialog_attribute ../packages/dialogs_ref.html#dialog_attribute +enum hid_attr_type_e ../packages/hid_ref.html#hid_attr_type_e +enum EndCapStyle_e ../packages/hid_ref.html#EndCapStyle_e +event HIDE_get_export_options ../packages/hid_ref.html#HIDE_get_export_options +event HIDE_do_export_start ../packages/hid_ref.html#HIDE_do_export_start +event HIDE_do_export_finish ../packages/hid_ref.html#HIDE_do_export_finish +event HIDE_set_layer ../packages/hid_ref.html#HIDE_set_layer +event HIDE_set_color ../packages/hid_ref.html#HIDE_set_color +event HIDE_set_line_cap ../packages/hid_ref.html#HIDE_set_line_cap +event HIDE_set_line_width ../packages/hid_ref.html#HIDE_set_line_width +event HIDE_set_draw_xor ../packages/hid_ref.html#HIDE_set_draw_xor +event HIDE_set_draw_faded ../packages/hid_ref.html#HIDE_set_draw_faded +event HIDE_draw_line ../packages/hid_ref.html#HIDE_draw_line +event HIDE_draw_arc ../packages/hid_ref.html#HIDE_draw_arc +event HIDE_draw_rect ../packages/hid_ref.html#HIDE_draw_rect +event HIDE_fill_circle ../packages/hid_ref.html#HIDE_fill_circle +event HIDE_fill_polygon ../packages/hid_ref.html#HIDE_fill_polygon +event HIDE_fill_rect ../packages/hid_ref.html#HIDE_fill_rect +event HIDE_use_mask ../packages/hid_ref.html#HIDE_use_mask +event HIDE_make_gc ../packages/hid_ref.html#HIDE_make_gc +event HIDE_destroy_gc ../packages/hid_ref.html#HIDE_destroy_gc +event HIDE_fill_pcb_pv ../packages/hid_ref.html#HIDE_fill_pcb_pv +function hid_create ../packages/hid_ref.html#hid_create +function hid_add_attribute ../packages/hid_ref.html#hid_add_attribute +function hid_get_attribute ../packages/hid_ref.html#hid_get_attribute +function hid_register ../packages/hid_ref.html#hid_register +function hid_gpmi_data_set ../packages/hid_ref.html#hid_gpmi_data_set +function hid_gpmi_data_get ../packages/hid_ref.html#hid_gpmi_data_get +function hid_string2val ../packages/hid_ref.html#hid_string2val +enum layout_object_mask_e ../packages/layout_ref.html#layout_object_mask_e +enum layout_object_coord_e ../packages/layout_ref.html#layout_object_coord_e +enum layout_flag_e ../packages/layout_ref.html#layout_flag_e +enum layer_field_e ../packages/layout_ref.html#layer_field_e +function layout_search_box ../packages/layout_ref.html#layout_search_box +function layout_search_selected ../packages/layout_ref.html#layout_search_selected +function layout_search_found ../packages/layout_ref.html#layout_search_found +function layout_search_get ../packages/layout_ref.html#layout_search_get +function layout_search_free ../packages/layout_ref.html#layout_search_free +function layout_obj_coord ../packages/layout_ref.html#layout_obj_coord +function layout_obj_type ../packages/layout_ref.html#layout_obj_type +function layout_obj_move ../packages/layout_ref.html#layout_obj_move +function layout_arc_angles ../packages/layout_ref.html#layout_arc_angles +function layout_create_line ../packages/layout_ref.html#layout_create_line +function layout_create_via ../packages/layout_ref.html#layout_create_via +function layout_create_arc ../packages/layout_ref.html#layout_create_arc +function layout_switch_to_layer ../packages/layout_ref.html#layout_switch_to_layer +function layout_get_current_layer ../packages/layout_ref.html#layout_get_current_layer +function layout_resolve_layer ../packages/layout_ref.html#layout_resolve_layer +function layout_get_max_possible_layer ../packages/layout_ref.html#layout_get_max_possible_layer +function layout_get_max_copper_layer ../packages/layout_ref.html#layout_get_max_copper_layer +function layout_get_max_layer ../packages/layout_ref.html#layout_get_max_layer +function layout_layer_name ../packages/layout_ref.html#layout_layer_name +function layout_layer_color ../packages/layout_ref.html#layout_layer_color +function layout_layer_field ../packages/layout_ref.html#layout_layer_field +function layout_get_page_width ../packages/layout_ref.html#layout_get_page_width +function layout_get_page_height ../packages/layout_ref.html#layout_get_page_height +function layout_set_page_size ../packages/layout_ref.html#layout_set_page_size +function mil2pcb_multiplier ../packages/layout_ref.html#mil2pcb_multiplier +function mm2pcb_multiplier ../packages/layout_ref.html#mm2pcb_multiplier +function current_grid_unit ../packages/layout_ref.html#current_grid_unit +function debug_draw_request ../packages/layout_ref.html#debug_draw_request +function debug_draw_flush ../packages/layout_ref.html#debug_draw_flush +function debug_draw_finish ../packages/layout_ref.html#debug_draw_finish +function debug_draw_dctx ../packages/layout_ref.html#debug_draw_dctx +function draw_set_color ../packages/layout_ref.html#draw_set_color +function draw_set_line_width ../packages/layout_ref.html#draw_set_line_width +function draw_set_draw_xor ../packages/layout_ref.html#draw_set_draw_xor +function draw_set_draw_faded ../packages/layout_ref.html#draw_set_draw_faded +function draw_line ../packages/layout_ref.html#draw_line Index: 1.0.8/doc-rnd/gpmi/packages/actions.html =================================================================== --- 1.0.8/doc-rnd/gpmi/packages/actions.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/packages/actions.html (revision 1136) @@ -0,0 +1,106 @@ + + +

The actions package

+ +The action package is used to register actions and menus in PCB and +to execute existing actions. In PCB actions +are generated when the user selects a menu, presses a key or issues a +command on the PCB command line. + +

Registration of new actions

+The script may register new actions +using arbitrary action names. If any of the registered actions is +detected, an ACTE_action event is sent to the script. If multiple +actions are used in a script, argument name of the event handler +can be used to identify the triggering action. (This may be time consuming +in scripting languages (a series of string comparison) - those scripts +binding to frequent actions should not bind to too many different actions.) +pcb-gpmi guarantees that the event handler of a script is triggered only +when an action is caught that previously was registered by the same script. +

+The process of binding an action: +

    +
  1. create an event handler for event ACTE_action +
  2. register one or more actions using function action_register +
  3. optional: when the event handler is triggered, check argument name (for scripts with multiple actions registered) +
  4. optional: use argument argc and function action_arg to fetch action arguments +
  5. optional: use arguments x, y to learn the cursor position on the layout. +
+ +Example (written in lua): +
+-- load the package
+PkgLoad("pcb-gpmi/actions", 0);
+
+-- action callback
+function ev_action(id, name, argc, x, y)
+	if name == "cake" then
+		size = action_arg(1);
+		-- put cake drawing code here
+	else
+		-- must be candy
+		amount = action_arg(1);
+		-- put candy drawing code here
+	end
+end
+
+-- register and bind action
+action_register("cake",  "cake center xy?", "cake service", "cake(size)", "");
+action_register("candy", "candy cloud center xy?", "cake service", "candy(amount)", "");
+Bind("ACTE_action", "ev_action");
+
+

+When the script is unloaded all actions the script registered +are removed from pcb-rnd automatically. + +

Executing actions

+An existing action can be executed using the action() call. The only one +argument is a command line string. The syntyax is the same as in pcb +command line. + +Example (written in lua): +
+PkgLoad("pcb-rnd-gpmi/actions", 0);
+
+function ev_action1(id, name, argc, x, y)
+	action("undo()")
+	action("undo()")
+end
+
+-- register and bind action
+action_register("untwo", "", "undo twice", "untwo()", "CONTEXT!");
+
+

+The above script registers a new action called untwo(). When untwo() is executed, +it exectues action undo() twice. + + +

Creating menus

+It is possible to insert menus and submenus runtime, using the call +create_menu(). The script should do this only after the gui has been initialized. +The most common way is to create all menus from the ACTE_gui_init event, +which is called after the gui finished setting up. +

+The first argument of create_menu() is the menu path. The path is a list +of visible menu names separated by slashes (e.g. "File/Save as..." means +"File" menu, "Save as..." submenu). By convention, scripts should +create new menu items under the "Plugins/" menu. +

+The following example lua script registers a new menu item +

+PkgLoad("pcb-rnd-gpmi/actions", 0);
+
+function ev_gui_init(argc, argv)
+	create_menu("Plugins/foo", "undo()", "o", "Ctrl<Key>o", "tooltip for foo");
+end
+
+-- register and bind action
+Bind("ACTE_gui_init", "ev_gui_init");
+
+

+When the user clicks on the menu, the action script specified in the second argument +of create_menu() is executed. Thus the script usually registers a new action +first then registers one or more menu items executing those actions. + + + Index: 1.0.8/doc-rnd/gpmi/packages/actions_ref.html =================================================================== --- 1.0.8/doc-rnd/gpmi/packages/actions_ref.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/packages/actions_ref.html (revision 1136) @@ -0,0 +1,82 @@ + + +

PCB GPMI

+

Reference manual for package actions

+Automatically generated from actions.h + +

Events

+
+

Events do not have return value. The first argument is always the even id. Event handlers defined in scripts get all event arguments converted to string (types below are informational). + +

ACTE_action(int event_id, const char* name, int argc, int x, int y)

+
+ Generated when an action registered by the script is executed.
+   Arguments:
+    name: name of the action (as registed using function action_register())
+    argc: number of arguments. Arguments can be accessed using function action_arg
+    x, y: optional coords, if need_xy was not empty at action_register 
+
+
+

ACTE_gui_init(int event_id, int argc, char** argv)

+
+ Generated right after gui initialization, before the gui main loop.
+   Arguments:
+    argc: number of arguments the gui was initialized with.
+    argv[]: arguments the gui was initialized with - unaccessible for the scripts. 
+
+
+

ACTE_unload(int event_id, const char* conffile)

+
+ Generated right before unloading a script to give the script a chance
+   to clean up.
+   Arguments:
+    conffile: the name of the config file that originally triggered laoding the script, or empty if the script was loaded from the gui. 
+
+
+

Functions

+
+

The following functions are registered in script context. + +

int action_register(const char* name, const char* need_xy, const char* description, const char* syntax)

+
+ Register an action in PCB - when the action is executed, event
+   ACTE_action is generated with the action name.
+   Multiple actions can be registered. Any action registered by the script
+   will trigger an ACTE_event sent to the script.
+   Arguments:
+    name: name of the action
+    need_xy: the question the user is asked when he needs to choose a coordinate; if empty, no coordinate is asked
+    description: description of the action (for the help)
+    syntax: syntax of the action (for the help)
+   Returns 0 on success.
+ 
+
+
+

const char* action_arg(int argn)

+
+ extract the (argn)th event argument for the current action (makes sense only in an ACTE_action event handler 
+
+
+

int action(const char* cmdline)

+
+ call an existing action using PCB syntax (e.g. foo(1, 2, 3))
+   Returns non-zero on error; generally returns value of the action
+   (which is also non-zero on error). 
+
+
+

void create_menu(const char* path, const char* action, const char* mnemonic, const char* hotkey, const char* tooltip)

+
+ Create a new menu or submenu at path. Missing parents are created
+   automatically with empty action, mnemonic, hotkey and tooltip.
+   Arguments:
+    path: the full path of the new menu
+    action: this action is executed when the user clicks on the menu
+    mnemonic: which letter to underline in the menu text (will be the fast-jump-there key once the menu is open)
+    hotkey: when this key is pressed in the main gui, the action is also triggered; the format is modifiers<Key>letter, where modifiers is Alt, Shift or Ctrl. This is the same syntax that is used in the .res files.
+    tooltip: short help text 
+
+
+ + + + Index: 1.0.8/doc-rnd/gpmi/packages/dialogs.html =================================================================== --- 1.0.8/doc-rnd/gpmi/packages/dialogs.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/packages/dialogs.html (revision 1136) @@ -0,0 +1,47 @@ + + +

dialogs package

+ The purpose of this package is to expose the dialog box handling interface + of the active GUI hid. Using this package scripts can pop up dialog boxes + to inform or ask the user. If there is no active GUI, call logs are dumped + on stderr. Note: message arguments usually may contain newline (\n) characters + to split the message. + +

Common conventions

+ Dialog boxes are blocking calls to the GUI HID: when the script + calls a dialog box, the script is suspended until the dialog box + is closed by the user. In other words, dialog boxes behave + as regular function calls from the scripts: when they return, + the dialog is over and the result is known. +

+ The only exception is dialog_progress(), which opens or + updates or closes the already open progress dialog box, and + returns immediately (even when the box is left open). + +

Simple dialogs vs. custom dialogs

+ Most of the calls will pop up a static dialog box. Static means + that widgets are predefined by the GUI HID. The script + is free to fill in data, but can not change the basic structure of + the dialog box. For example dialog_confirm(), dialog_prompt(), + dialog_fileselect() are static. +

+ When the script needs a custom, dynamic dialog box, it needs to + create an attribute dialog. The script sets up a HID + structure using the hid package, builds up all the input fields + then calls dialog_attribute() with the hid. + +

Progress dialogs

+ + The script should call dialog_progress() periodicly from a process that + runs time consuming calculations and check the return value and break + the loop on cancel. The process should have an idea of how long it + will take. This is passed on in argument total. As long as + argument so_far is less than total, the dialog is + open. +

+ After the process has finished, a call with so_far=total+1 should be + made to make sure the window is closed. If the call returns non-zero, + the process should be cancelled. + + + Index: 1.0.8/doc-rnd/gpmi/packages/dialogs_ref.html =================================================================== --- 1.0.8/doc-rnd/gpmi/packages/dialogs_ref.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/packages/dialogs_ref.html (revision 1136) @@ -0,0 +1,105 @@ + + +

PCB GPMI

+

Reference manual for package dialogs

+Automatically generated from dialogs.h + +

Enums

+
+

Enum values should be passed on as strings. + +

dialog_fileselect_e

+
+ Filter on what files a file select dialog should list 
+
+ +
value meaning +
FS_NONE none of the below +
FS_READ when the selected file will be read, not written (HID_FILESELECT_READ) +
FS_NOT_EXIST the function calling hid->fileselect will deal with the case when the selected file already exists. If not given, then the gui will prompt with an "overwrite?" prompt. Only used when writing. (HID_FILESELECT_MAY_NOT_EXIST) +
FS_TEMPLATE the call is supposed to return a file template (for gerber output for example) instead of an actual file. Only used when writing. (HID_FILESELECT_IS_TEMPLATE) +
+
+

Functions

+
+

The following functions are registered in script context. + +

void dialog_log(const char* msg)

+
+ Append a msg to the log (log window and/or stderr). 
+
+
+

int dialog_confirm(const char* msg, const char* ok, const char* cancel)

+
+ Ask the user for confirmation (usually using a popup). Returns 0 for
+   cancel and 1 for ok.
+   Arguments:
+     msg: message to the user
+     ok: label of the OK button
+     cancel: label of the cancel button
+  Arguments "ok" and "cancel" may be empty (or NULL) in which
+  case the GUI will use the default (perhaps localized) labels for
+  those buttons. 
+
+
+

void dialog_report(const char* title, const char* msg)

+
+ Pop up a report dialog.
+   Arguments:
+     title: title of the window
+     msg: message 
+
+
+

char* dialog_prompt(const char* msg, const char* default_)

+
+ Ask the user to input a string (usually in a popup).
+   Arguments:
+     msg: message or question text
+     default_: default answer (this may be filled in on start)
+   Returns the answer. 
+
+
+

char* dialog_fileselect(const char* title, const char* descr, char* default_file_, char* default_ext, const char* history_tag, dialog_fileselect_t flags)

+
+ Pops up a file selection dialog.
+   Arguments:
+     title: window title
+     descr: description
+     default_file_
+     default_ext: default file name extension
+     history_tag
+     flags: one or more flags (see below)
+   Returns the selected file or NULL (empty). 
+
+
+

void dialog_beep(void)

+
+ Audible beep 
+
+
+

int dialog_progress(int so_far, int total, const char* message)

+
+ Request the GUI hid to draw a progress bar.
+   Arguments:
+     int so_far: achieved state
+     int total: maximum state
+     const char *message: informs the users what they are waiting for
+   If so_far is bigger than total, the progress bar is closed.
+   Returns nonzero if the user wishes to cancel the operation.
+
+
+
+

int dialog_attribute(hid_t* hid, const char* title, const char* descr)

+
+ Pop up an attribute dialog; content (widgets) of the dialog box are coming
+   from hid (see the hid package).
+   Arguments:
+     hid: widgets
+     title: title of the window
+     descr: descripting printed in the dialog 
+
+
+ + + + Index: 1.0.8/doc-rnd/gpmi/packages/event_id.html =================================================================== --- 1.0.8/doc-rnd/gpmi/packages/event_id.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/packages/event_id.html (revision 1136) @@ -0,0 +1,20 @@ + + +

event_id

+ +The first argument passed to an event handler is always the event ID. +It is useful if there are several GPMI events with the same arguments and +the script wants to bind them all to the same event handler. In that case +using event_id the event handler can determine which event triggered the +call. This design is similar to the signal handler documented in +signal(2). + +

+ +The case described above (dispatcher in the event handler) is rare. +Most users will bind one event to one function and can safely ignore this +argument. Nevertheless it must present as the first argument +on the event handler's argument list. + + + Index: 1.0.8/doc-rnd/gpmi/packages/hid.html =================================================================== --- 1.0.8/doc-rnd/gpmi/packages/hid.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/packages/hid.html (revision 1136) @@ -0,0 +1,76 @@ + + +

hid package

+ +The hid package has two purposes: +
    +
  • it is glue layer for exporter dialog boxes and attribute dialog boxes; +
  • it can register exporter HIDs in PCB +
+ +

Building a custom dialog box

+First hid_create() needs to be called. It returns a new hid_t, which is +an opaq structure for the package that is used to describe attributes of +an attribute dialog or an exporter hid. Attributes are added using +hid_add_attribute(), which returns an unique ID of the attribute. The +attribute ID can be used later for querying attribute value set by the +user using hid_get_attribute(). +

+The process of building a dialog box is closed by a call to +

    +
  • hid_register(), which registers a new exporter hid using the + attributes of the dialog box; or +
  • dialog_attribute() (of the dialog package) which pops up a custom + dialog box immediately. +
+ +

Registering an exporter

+ Function hid_register() registers the hid as an exporter. Should be + called after all attributes have been added using hid_add_atrtibute(). + The export is coordinated by pcb core; when the user request an export + using the exporter, a series of events are delivered to the script: +
    +
  1. envelope events to set up exporting +
  2. many draw events to actually export the objects +
  3. an envelope event to finish exporting +
+ +

Envelope: events generated before or after exporting

+
    +
  • HIDE_get_export_options(void *hid): Generated before get_exporter_options returns the option list to the GUI hid +
  • HIDE_do_export_start(void *hid): Generated before export redraw starts +
  • HIDE_do_export_finish(void *hid): Generated after export redraw finihsed +
+ +

Drawing: events generated during exporting

+ Note: there may be multiple gcs (graphic contexts), each having its own color, line + properties, xor drawing and faded state. Graphic contexts are created + and destroyed by the following events: +
    +
  • HIDE_make_gc(void *hid, void *gc); +
  • HIDE_destroy_gc(void *hid, void *gc); +
+ + Gc properties are changed by the following events: +
    +
  • HIDE_set_layer(void *hid, const char *name, int group); +
  • HIDE_set_color(void *hid, void *gc, const char *name); +
  • HIDE_set_line_cap(void *hid, void *gc, EndCapStyle style); +
  • HIDE_set_line_width(void *hid, void *gc, int width); +
  • HIDE_set_draw_xor(void *hid, void *gc, int xor); +
  • HIDE_set_draw_faded(void *hid, void *gc, int faded); +
+ + Finally, the actual drawing operations: +
    +
  • HIDE_draw_line(void *hid, void *gc, int x1, int y1, int x2, int y2); +
  • HIDE_draw_arc(void *hid, void *gc, int cx, int cy, int xradius, int yradius, int start_angle, int delta_angle); +
  • HIDE_draw_rect(void *hid, void *gc, int x1, int y1, int x2, int y2); +
  • HIDE_fill_circle(void *hid, void *gc, int cx, int cy, int radius); +
  • HIDE_fill_polygon(void *hid, void *gc, int n_coords, int *x, int *y); +
  • HIDE_fill_rect(void *hid, void *gc, int x1, int y1, int x2, int y2); +
  • HIDE_use_mask(void *hid, int use_it); [TODO] +
+ + + Index: 1.0.8/doc-rnd/gpmi/packages/hid_ref.html =================================================================== --- 1.0.8/doc-rnd/gpmi/packages/hid_ref.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/packages/hid_ref.html (revision 1136) @@ -0,0 +1,200 @@ + + +

PCB GPMI

+

Reference manual for package hid

+Automatically generated from hid.h + +

Enums

+
+

Enum values should be passed on as strings. + +

hid_attr_type_e

+
+ Type of an HID attribute (usually a widget on an attribute dialog box) 
+
+ +
value meaning +
HIDA_Label non-editable label displayed on the GUI +
HIDA_Integer a sugned integer value +
HIDA_Real a floating point value +
HIDA_String one line textual input +
HIDA_Boolean true/false boolean value +
HIDA_Enum select an item of a predefined list +
HIDA_Mixed TODO +
HIDA_Path path to a file or directory +
HIDA_Unit select a dimension unit +
HIDA_Coord enter a coordinate +
+
+

EndCapStyle_e

+
+ Line or arc ending style 
+
+ +
value meaning +
Trace_Cap filled circle (trace drawing) +
Square_Cap rectangular lines (square pad) +
Round_Cap round pins or round-ended pads, thermals +
Beveled_Cap octagon pins or bevel-cornered pads +
+
+

Events

+
+

Events do not have return value. The first argument is always the even id. Event handlers defined in scripts get all event arguments converted to string (types below are informational). + +

HIDE_get_export_options(int event_id, void* hid)

+
+ Called before get_exporter_options returns the option list to the GUI hid 
+
+
+

HIDE_do_export_start(int event_id, void* hid)

+
+ Called before export redraw starts 
+
+
+

HIDE_do_export_finish(int event_id, void* hid)

+
+ Called after export redraw finihsed 
+
+
+

HIDE_set_layer(int event_id, void* hid, const char* name, int group, int empty)

+
+ PCB callback events for drawing: change layer 
+
+
+

HIDE_set_color(int event_id, void* hid, void* gc, const char* name)

+
+ PCB callback events for drawing: change drawing color 
+
+
+

HIDE_set_line_cap(int event_id, void* hid, void* gc, EndCapStyle style)

+
+ PCB callback events for drawing: change drawing line cap style
+
+
+

HIDE_set_line_width(int event_id, void* hid, void* gc, int width)

+
+ PCB callback events for drawing: change drawing line width 
+
+
+

HIDE_set_draw_xor(int event_id, void* hid, void* gc, int xor)

+
+ PCB callback events for drawing: toggle xor drawing method 
+
+
+

HIDE_set_draw_faded(int event_id, void* hid, void* gc, int faded)

+
+ PCB callback events for drawing: toggle faded drawing method 
+
+
+

HIDE_draw_line(int event_id, void* hid, void* gc, int x1, int y1, int x2, int y2)

+
+ PCB callback events for drawing: draw a line 
+
+
+

HIDE_draw_arc(int event_id, void* hid, void* gc, int cx, int cy, int xradius, int yradius, double start_angle, double delta_angle)

+
+ PCB callback events for drawing: draw an arc from center cx;cy 
+
+
+

HIDE_draw_rect(int event_id, void* hid, void* gc, int x1, int y1, int x2, int y2)

+
+ PCB callback events for drawing: draw a rectangle 
+
+
+

HIDE_fill_circle(int event_id, void* hid, void* gc, int cx, int cy, int radius)

+
+ PCB callback events for drawing: draw a filled circle 
+
+
+

HIDE_fill_polygon(int event_id, void* hid, void* gc, int n_coords, int* x, int* y)

+
+ PCB callback events for drawing: draw a filled ploygon 
+
+
+

HIDE_fill_rect(int event_id, void* hid, void* gc, int x1, int y1, int x2, int y2)

+
+ PCB callback events for drawing: draw a filled rectangle 
+
+
+

HIDE_use_mask(int event_id, void* hid, int use_it)

+
+ PCB callback events for drawing: TODO 
+
+
+

HIDE_make_gc(int event_id, void* hid, void* gc)

+
+ PCB callback events for drawing: create a new graphical context 
+
+
+

HIDE_destroy_gc(int event_id, void* hid, void* gc)

+
+ PCB callback events for drawing: destroy a graphical context 
+
+
+

HIDE_fill_pcb_pv(int event_id, void* hid, void* fg_gc, void* bg_gc, void* pad, int drawHole, int mask)

+
+ PCB callback events for drawing: TODO 
+
+
+

Functions

+
+

The following functions are registered in script context. + +

hid_t* hid_create(char* hid_name, char* description)

+
+ Creates a new hid context. Name and description matters only if the hid is
+registered as an exporter later. 
+
+
+

int hid_add_attribute(hid_t* hid, char* attr_name, char* help, hid_attr_type_t type, int min, int max, char* default_val)

+
+ Append an attribute in a hid previously created using hid_create().
+   Arguments:
+     hid: hid_t previously created using hid_create()
+     attr_name: name of the attribute
+     help: help text for the attribute
+     type: type of the attribute (input widget type)
+     min: minimum value of the attribute, if type is integer or real)
+     max: maximum value of the attribute, if type is integer or real)
+     default_val: default value of the attribute
+  Returns an unique ID of the attribute the caller should store for
+  later reference. For example this ID is used when retrieving the
+  value of the attribute after the user finished entering data in
+  the dialog. 
+
+
+

char* hid_get_attribute(hid_t* hid, int attr_id)

+
+ Query an attribute from the hid after dialog_attributes() returned.
+   Arguments:
+     hid: hid_t previously created using hid_create()
+     attr_id: the unique ID of the attribute (returned by hid_add_attribute())
+   Returns the value (converted to string) set by the user. 
+
+
+

int hid_register(hid_t* hid)

+
+ Register the hid; call it after a hid is created and its attributes
+   are all set up 
+
+
+

void hid_gpmi_data_set(hid_t* h, void* data)

+
+ For internal use 
+
+
+

hid_t* hid_gpmi_data_get(HID* h)

+
+ For internal use 
+
+
+

HID_Attr_Val hid_string2val(const hid_attr_type_t type, const char* str)

+
+ For internal use 
+
+
+ + + + Index: 1.0.8/doc-rnd/gpmi/packages/layout.html =================================================================== --- 1.0.8/doc-rnd/gpmi/packages/layout.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/packages/layout.html (revision 1136) @@ -0,0 +1,58 @@ + + +

layout package

+ +Layout package searches and manipulates the current layout. Dimension units +are in nanometer unless otherwise mentioned. + +

Page: board dimensions

+ Functions used to query or set width and height of the drawing: +
    +
  • int layout_get_page_width(); +
  • int layout_get_page_height(); +
  • void layout_set_page_size(int width, int height); +
+ +

Layer manipulation

+Most functions perform operations similar to user commands affecting +the current layer. +The following few calls can change the current layer. Warning: this is the +same current layer as the user's; the script most probably wants to save +the current layer before changing it and then restore it after the operation. +
    +
  • int layout_resolve_layer(const char *name): resolve layer number by name (case sensitive); returns negative number if not found +
  • int layout_get_current_layer(): returns the number of the current layer +
  • void layout_switch_to_layer(int layer): switch to layer (further actions will take place there) +
+

+ +

Object searches

+ Search results are collected on lists identified by their name (search_ID). + If a new search is done with the same name, old search results for that + name are discarded. + Search functions return the number of objects found (size of the list) that can + be then used while querying the results using layout_search_get(). + Results should be freed using layout_search_free() when they are no + longer needed. +

+ TODO: validity of a list in time +

+Once the search list is ready, the script can iterate over it and resolve +the object handle of each object found, using layout_search_get(). Having +an object handle, The layout_obj_*() functions may be used by the script +to access fields of an object structure. + +

Create new objects

+ The layour_create_*() calls are used to create new objects on the current + layer (set by layout_switch_to_layer()). + + +

API reference - page, untis and coordinates

+(angles are in radian) +TODO + +

API reference - debug draw

+TODO + + + Index: 1.0.8/doc-rnd/gpmi/packages/layout_ref.html =================================================================== --- 1.0.8/doc-rnd/gpmi/packages/layout_ref.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/packages/layout_ref.html (revision 1136) @@ -0,0 +1,305 @@ + + +

PCB GPMI

+

Reference manual for package layout

+Automatically generated from layout.h + +

Enums

+
+

Enum values should be passed on as strings. + +

layout_object_mask_e

+
+ Object type search mask bits 
+
+ +
value meaning +
OM_LINE lines (traces, silk lines, not font) +
OM_TEXT text written using the font +
OM_POLYGON polygons, including rectangles +
OM_ARC arcs, circles +
OM_VIA vias and holes which are not part of a footprint +
OM_PIN pins/pads of a footprint +
OM_ANY shorthand for "find anything" +
+
+

layout_object_coord_e

+
+ Which coordinate of the object is referenced 
+
+ +
value meaning +
OC_BX1 bounding box X1 +
OC_BX2 bounding box X2 +
OC_BY1 bounding box Y1 +
OC_BY2 bounding box Y2 +
OC_P1X point 1 X +
OC_P2X point 2 X +
OC_P1Y point 1 Y +
OC_P2Y point 2 Y +
OC_OBJ the whole object +
OC_P1 point 1 is P1X +
OC_P2 point 2 is P2X +
+
+

layout_flag_e

+
+ of layout_object_coord_t 
+
+ +
value meaning +
FL_NONE <comment missing in the header> +
FL_SHOWNUMBER <comment missing in the header> +
FL_LOCALREF <comment missing in the header> +
FL_CHECKPLANS <comment missing in the header> +
FL_SHOWDRC <comment missing in the header> +
FL_RUBBERBAND <comment missing in the header> +
FL_DESCRIPTION <comment missing in the header> +
FL_NAMEONPCB <comment missing in the header> +
FL_AUTODRC <comment missing in the header> +
FL_ALLDIRECTION <comment missing in the header> +
FL_SWAPSTARTDIR <comment missing in the header> +
FL_UNIQUENAME <comment missing in the header> +
FL_CLEARNEW <comment missing in the header> +
FL_SNAPPIN <comment missing in the header> +
FL_SHOWMASK <comment missing in the header> +
FL_THINDRAW <comment missing in the header> +
FL_ORTHOMOVE <comment missing in the header> +
FL_LIVEROUTE <comment missing in the header> +
FL_THINDRAWPOLY <comment missing in the header> +
FL_LOCKNAMES <comment missing in the header> +
FL_ONLYNAMES <comment missing in the header> +
FL_NEWFULLPOLY <comment missing in the header> +
FL_HIDENAMES <comment missing in the header> +
FL_THERMALSTYLE1 <comment missing in the header> +
FL_THERMALSTYLE2 <comment missing in the header> +
FL_THERMALSTYLE3 <comment missing in the header> +
FL_THERMALSTYLE4 <comment missing in the header> +
FL_THERMALSTYLE5 <comment missing in the header> +
+
+

layer_field_e

+
+ Field name of the layer structure 
+
+ +
value meaning +
LFLD_NUM_LINES number of lines on the layer +
LFLD_NUM_TEXTS number of texts on the layer +
LFLD_NUM_POLYS number of polygons on the layer +
LFLD_NUM_ARCS number of arcs on the layer +
LFLD_VISIBLE non-zero if the layer is visible +
LFLD_NODRC non-zero if the layer doesn't use DRC +
+
+

Functions

+
+

The following functions are registered in script context. + +

int layout_search_box(const char* search_ID, layout_object_mask_t obj_types, int x1, int y1, int x2, int y2)

+
+ creates a new search and adds all objects that matches obj_types mask within the given rectangle on the current layer
+   Arguments:
+     search_ID: unique name of the search (overwrites existing search on the same name)
+     obj_types: on or more object types
+     x1, y1, x2, y2: box the search is done within (PCB coords)
+   Returns the number of object on the search list. 
+
+
+

int layout_search_selected(const char* search_ID, layout_object_mask_t obj_types)

+
+ creates a new search and adds all selected objects
+   Arguments:
+     search_ID: unique name of the search (overwrites existing search on the same name)
+     obj_types: on or more object types
+   Returns the number of object on the search list. 
+
+
+

int layout_search_found(const char* search_ID, layout_object_mask_t obj_types)

+
+ creates a new search and adds all found objects (the green highlight)
+   Arguments:
+     search_ID: unique name of the search (overwrites existing search on the same name)
+     obj_types: on or more object types
+   Returns the number of object on the search list. 
+
+
+

layout_object_t* layout_search_get(const char* search_ID, int n)

+
+ Returns the nth object from a search list (or NULL pointer if n is beyond the list) 
+
+
+

int layout_search_free(const char* search_ID)

+
+ Frees all memory related to a search. Returns 0 on success.
+   Argument:
+     search_ID: unique name of the search (requires an existing search) 
+
+
+

int layout_obj_coord(layout_object_t* obj, layout_object_coord_t coord)

+
+ Return the requested coord of an object; except for the bounding box
+    coordinates, the meaning of coordinates are object-specific.
+    Point 1 and point 2 are usually endpoints of the object (line, arc),
+    "the whole object" coordinate is a central point. 
+
+
+

layout_object_mask_t layout_obj_type(layout_object_t* obj)

+
+ Return the type of an object (always a single bit) 
+
+
+

int layout_obj_move(layout_object_t* obj, layout_object_coord_t coord, int dx, int dy)

+
+ Change location of an object or parts of the object (like move endpoint of a line);
+   Arguments:
+     obj: the object
+     coord: which coordinate to drag (e.g. move only the endpoint)
+     dx, dy: relative x and y coordinates the selected coordinate is displaced by
+   Returns 0 on success 
+
+
+

int layout_arc_angles(layout_object_t* obj, int relative, int start, int delta)

+
+ change angles of an arc; start and delate are relative if relative is non-zero; returns 0 on success 
+
+
+

int layout_create_line(int x1, int y1, int x2, int y2, int thickness, int clearance, layout_flag_t flags)

+
+ create a line 
+
+
+

int layout_create_via(int x, int y, int thickness, int clearance, int mask, int hole, const char* name, layout_flag_t flags)

+
+ create a named via 
+
+
+

int layout_create_arc(int x, int y, int width, int height, int sa, int dir, int thickness, int clearance, layout_flag_t flags)

+
+ create a new arc; sa is start angle, dir is delta angle 
+
+
+

void layout_switch_to_layer(int layer)

+
+ switch to layer (further layer-specific actions will take place there) 
+
+
+

int layout_get_current_layer()

+
+ returns the number of the current layer 
+
+
+

int layout_resolve_layer(const char* name)

+
+ resolve layer number by name (case sensitive); returns negative number if not found 
+
+
+

int layout_get_max_possible_layer()

+
+ return the theoretical number of layers supported by PCB 
+
+
+

int layout_get_max_copper_layer()

+
+ return the actual number of copper layers on the current design 
+
+
+

int layout_get_max_layer()

+
+ return the actual number of layers on the current design 
+
+
+

const char* layout_layer_name(int layer)

+
+ return the name of a layer 
+
+
+

const char* layout_layer_color(int layer)

+
+ return the color of a layer 
+
+
+

int layout_layer_field(int layer, layer_field_t fld)

+
+ return an integer field of a layer 
+
+
+

int layout_get_page_width()

+
+ query or set width and height of the drawing 
+
+
+

int layout_get_page_height()

+
+<comment missing in the header>
+
+
+

void layout_set_page_size(int width, int height)

+
+<comment missing in the header>
+
+
+

double mil2pcb_multiplier()

+
+ -- coordinate system -- (coord.c) 
+
+
+

double mm2pcb_multiplier()

+
+<comment missing in the header>
+
+
+

const char* current_grid_unit()

+
+<comment missing in the header>
+
+
+

int debug_draw_request(void)

+
+ Initialize debug drawing; returns 1 if worked, 0 if denied 
+
+
+

void debug_draw_flush(void)

+
+ Flush the drawing 
+
+
+

void debug_draw_finish(dctx_t* ctx)

+
+ Finish (close) drawing 
+
+
+

dctx_t* debug_draw_dctx(void)

+
+ Get the draw context of debug draw 
+
+
+

void draw_set_color(dctx_t* ctx, const char* name)

+
+ Debug draw style: set drawing color 
+
+
+

void draw_set_line_width(dctx_t* ctx, int width)

+
+ Debug draw style: set line width 
+
+
+

void draw_set_draw_xor(dctx_t* ctx, int xor)

+
+ Debug draw style: set whether drawing should happen in xor 
+
+
+

void draw_set_draw_faded(dctx_t* ctx, int faded)

+
+ Debug draw style: set whether drawing should happen in faded mode  
+
+
+

void draw_line(dctx_t* ctx, int x1_, int y1_, int x2_, int y2_)

+
+ Debug draw: draw a line using the current style settings 
+
+
+ + + + Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ID.desc =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ID.desc (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ID.desc (revision 1136) @@ -0,0 +1,2 @@ +Create a new action hello() that prints "Hello world!" in the message log. + Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ID.name =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ID.name (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ID.name (revision 1136) @@ -0,0 +1 @@ +hello world (text, log) Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.awk =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.awk (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.awk (revision 1136) @@ -0,0 +1,14 @@ +BEGIN { + PkgLoad("pcb-rnd-gpmi/actions", 0); + PkgLoad("pcb-rnd-gpmi/dialogs", 0); +} + +function ev_action(id, name, argc, x, y) +{ + dialog_log("Hello world!\n"); +} + +BEGIN { + Bind("ACTE_action", "ev_action"); + action_register("hello", "", "log hello world", "hello()"); +} Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.bash =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.bash (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.bash (revision 1136) @@ -0,0 +1,18 @@ +#!/bin/bash + +function load_packages() +{ + GPMI PkgLoad "pcb-rnd-gpmi/actions" 0 + GPMI PkgLoad "pcb-rnd-gpmi/dialogs" 0 +} + +function ev_action() { + GPMI dialog_log "Hello world!\n" +} + +function main() +{ + load_packages + GPMI Bind "ACTE_action" "ev_action" + GPMI action_register "hello" "" "log hello world" "hello()" +} Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.html =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.html (revision 1136) @@ -0,0 +1,25 @@ +Load packages the script depends on: +
    +
  • actions for registering the new action; +
  • dialogs for printing in the message log. +
+

+Create a function ev_action that will be called when any of +the actions registered by the script is executed. The script registers +only one action, so it does not need to check which action caused +the function to be called. +

+When the action event is called, use dialog_log to append +a log message. +

+In the "main" section of the script, bind event ACTE_action to +our local function ev_action - this gets ev_action to +be called when any of the actions registered by this script is executed. +

+Finally use action_register to register the action: +

    +
  • first argument is the name of the action +
  • second is the xy query string; it is empty since this action won't need coordinates to operate on +
  • third is the description that shows up in dumps and helps +
  • fourth is the syntax description (also for helps) +
Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.lua =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.lua (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.lua (revision 1136) @@ -0,0 +1,9 @@ +PkgLoad("pcb-rnd-gpmi/actions", 0); +PkgLoad("pcb-rnd-gpmi/dialogs", 0); + +function ev_action(id, name, argc, x, y) + dialog_log("Hello world!\n"); +end + +Bind("ACTE_action", "ev_action"); +action_register("hello", "", "log hello world", "hello()"); Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.pl =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.pl (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.pl (revision 1136) @@ -0,0 +1,10 @@ +PkgLoad("pcb-rnd-gpmi/actions", 0); +PkgLoad("pcb-rnd-gpmi/dialogs", 0); + +sub ev_action { + my($id, $name, $argc, $x, $y) = @_; + dialog_log("Hello world!\n"); +} + +Bind("ACTE_action", "ev_action"); +action_register("hello", "", "log hello world", "hello()"); Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.py =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.py (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.py (revision 1136) @@ -0,0 +1,8 @@ +PkgLoad("pcb-rnd-gpmi/actions", 0); +PkgLoad("pcb-rnd-gpmi/dialogs", 0); + +def ev_action(id, name, argc, x, y): + dialog_log("Hello world!\n"); + +Bind("ACTE_action", "ev_action"); +action_register("hello", "", "log hello world", "hello()"); Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.rb =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.rb (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.rb (revision 1136) @@ -0,0 +1,9 @@ +PkgLoad("pcb-rnd-gpmi/actions", 0); +PkgLoad("pcb-rnd-gpmi/dialogs", 0); + +def ev_action(id, name, argc, x, y) + dialog_log("Hello world!\n"); +end + +Bind("ACTE_action", "ev_action"); +action_register("hello", "", "log hello world", "hello()"); Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.scm =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.scm (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.scm (revision 1136) @@ -0,0 +1,9 @@ +(PkgLoad "pcb-rnd-gpmi/actions" 0) +(PkgLoad "pcb-rnd-gpmi/dialogs" 0) + +(define ev_action (lambda (id name argc x y) + (dialog_log "Hello world!\n"))) + +(Bind "ACTE_action" "ev_action") +(action_register "hello" "" "log hello world" "hello()") + Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.stt =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.stt (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.stt (revision 1136) @@ -0,0 +1,10 @@ +(PkgLoad "pcb-rnd-gpmi/actions" 0) +(PkgLoad "pcb-rnd-gpmi/dialogs" 0) + +(defun ev_action (id name argc x y) + (dialog_log "Hello world!\n")) + +(Bind "ACTE_action" "ev_action") +(action_register "hello" "" "log hello world" "hello()") + + Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.tcl =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.tcl (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello/ex.tcl (revision 1136) @@ -0,0 +1,10 @@ +PkgLoad pcb-rnd-gpmi/actions 0 +PkgLoad pcb-rnd-gpmi/dialogs 0 + +proc ev_action {id, name, argc, x, y} { + dialog_log "Hello world!\n" +} + +Bind ACTE_action ev_action +action_register "hello" "" "log hello world" "hello()" + Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello/index.html =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello/index.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello/index.html (revision 1136) @@ -0,0 +1,55 @@ + + +<-- back to the
index of Rosetta examples +

hello world (text, log)

+Create a new action hello() that prints "Hello world!" in the message log. +

Example implementations

+awk + | +bash + | +lua + | +pl + | +py + | +rb + | +scm + | +stt + | +tcl +

Explanation, step by step

+Load packages the script depends on: +
    +
  • +actions + for registering the new action; +
  • +dialogs + for printing in the message log.
+ +

Create a function +ev_action + that will be called when any of the actions registered by the script is executed. The script registers only one action, so it does not need to check which action caused the function to be called. +

When the action event is called, use +dialog_log + to append a log message. +

In the "main" section of the script, bind event +ACTE_action + to our local function +ev_action + - this gets +ev_action + to be called when any of the actions registered by this script is executed. +

Finally use +action_register + to register the action: +

    +
  • first argument is the name of the action +
  • second is the xy query string; it is empty since this action won't need coordinates to operate on +
  • third is the description that shows up in dumps and helps +
  • fourth is the syntax description (also for helps)
+ Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ID.desc =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ID.desc (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ID.desc (revision 1136) @@ -0,0 +1,3 @@ +Create a new action hello() that prints "Hello world!" in a popup window. + + Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ID.name =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ID.name (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ID.name (revision 1136) @@ -0,0 +1 @@ +hello world (popup window) Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.awk =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.awk (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.awk (revision 1136) @@ -0,0 +1,14 @@ +BEGIN { + PkgLoad("pcb-rnd-gpmi/actions", 0); + PkgLoad("pcb-rnd-gpmi/dialogs", 0); +} + +function ev_action(id, name, argc, x, y) +{ + dialog_report("Greeting window", "Hello world!"); +} + +BEGIN { + Bind("ACTE_action", "ev_action"); + action_register("hello", "", "log hello world", "hello()"); +} Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.bash =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.bash (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.bash (revision 1136) @@ -0,0 +1,18 @@ +#!/bin/bash + +function load_packages() +{ + GPMI PkgLoad "pcb-rnd-gpmi/actions" 0 + GPMI PkgLoad "pcb-rnd-gpmi/dialogs" 0 +} + +function ev_action() { + GPMI dialog_report "Greeting window" "Hello world!" +} + +function main() +{ + load_packages + GPMI Bind "ACTE_action" "ev_action" + GPMI action_register "hello" "" "log hello world" "hello()" +} Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.html =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.html (revision 1136) @@ -0,0 +1,26 @@ +Load packages the script depends on: +
    +
  • actions for registering the new action; +
  • dialogs for creating a dialog box. +
+

+Create a function ev_action that will be called when any of +the actions registered by the script is executed. The script registers +only one action, so it does not need to check which action caused +the function to be called. +

+When the action event is called, use dialog_report to pop +up a report dialog. First argument donates the name (title) of the window, +the second is the text printed in the window. +

+In the "main" section of the script, bind event ACTE_action to +our local function ev_action - this gets ev_action to +be called when any of the actions registered by this script is executed. +

+Finally use action_register to register the action: +

    +
  • first argument is the name of the action +
  • second is the xy query string; it is empty since this action won't need coordinates to operate on +
  • third is the description that shows up in dumps and helps +
  • fourth is the syntax description (also for helps) +
Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.lua =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.lua (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.lua (revision 1136) @@ -0,0 +1,9 @@ +PkgLoad("pcb-rnd-gpmi/actions", 0); +PkgLoad("pcb-rnd-gpmi/dialogs", 0); + +function ev_action(id, name, argc, x, y) + dialog_report("Greeting window", "Hello world!"); +end + +Bind("ACTE_action", "ev_action"); +action_register("hello", "", "log hello world", "hello()"); Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.pl =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.pl (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.pl (revision 1136) @@ -0,0 +1,10 @@ +PkgLoad("pcb-rnd-gpmi/actions", 0); +PkgLoad("pcb-rnd-gpmi/dialogs", 0); + +sub ev_action { + my($id, $name, $argc, $x, $y) = @_; + dialog_report("Greeting window", "Hello world!"); +} + +Bind("ACTE_action", "ev_action"); +action_register("hello", "", "log hello world", "hello()"); Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.py =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.py (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.py (revision 1136) @@ -0,0 +1,8 @@ +PkgLoad("pcb-rnd-gpmi/actions", 0); +PkgLoad("pcb-rnd-gpmi/dialogs", 0); + +def ev_action(id, name, argc, x, y): + dialog_report("Greeting window", "Hello world!"); + +Bind("ACTE_action", "ev_action"); +action_register("hello", "", "log hello world", "hello()"); Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.rb =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.rb (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.rb (revision 1136) @@ -0,0 +1,9 @@ +PkgLoad("pcb-rnd-gpmi/actions", 0); +PkgLoad("pcb-rnd-gpmi/dialogs", 0); + +def ev_action(id, name, argc, x, y) + dialog_report("Greeting window", "Hello world!"); +end + +Bind("ACTE_action", "ev_action"); +action_register("hello", "", "log hello world", "hello()"); Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.scm =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.scm (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.scm (revision 1136) @@ -0,0 +1,9 @@ +(PkgLoad "pcb-rnd-gpmi/actions" 0) +(PkgLoad "pcb-rnd-gpmi/dialogs" 0) + +(define ev_action (lambda (id name argc x y) + (dialog_report "Greeting window" "Hello world!"))) + +(Bind "ACTE_action" "ev_action") +(action_register "hello" "" "log hello world" "hello()") + Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.stt =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.stt (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.stt (revision 1136) @@ -0,0 +1,10 @@ +(PkgLoad "pcb-rnd-gpmi/actions" 0) +(PkgLoad "pcb-rnd-gpmi/dialogs" 0) + +(defun ev_action (id name argc x y) + (dialog_report "Greeting window" "Hello world!")) + +(Bind "ACTE_action" "ev_action") +(action_register "hello" "" "log hello world" "hello()") + + Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.tcl =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.tcl (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/ex.tcl (revision 1136) @@ -0,0 +1,10 @@ +PkgLoad pcb-rnd-gpmi/actions 0 +PkgLoad pcb-rnd-gpmi/dialogs 0 + +proc ev_action {id, name, argc, x, y} { + dialog_report "Greeting window" "Hello world!" +} + +Bind ACTE_action ev_action +action_register "hello" "" "log hello world" "hello()" + Index: 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/index.html =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/index.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/10_hello_gui/index.html (revision 1136) @@ -0,0 +1,55 @@ + + +<-- back to the index of Rosetta examples +

hello world (popup window)

+Create a new action hello() that prints "Hello world!" in a popup window. +

Example implementations

+awk + | +bash + | +lua + | +pl + | +py + | +rb + | +scm + | +stt + | +tcl +

Explanation, step by step

+Load packages the script depends on: +
    +
  • +actions + for registering the new action; +
  • +dialogs + for creating a dialog box.
+ +

Create a function +ev_action + that will be called when any of the actions registered by the script is executed. The script registers only one action, so it does not need to check which action caused the function to be called. +

When the action event is called, use +dialog_report + to pop up a report dialog. First argument donates the name (title) of the window, the second is the text printed in the window. +

In the "main" section of the script, bind event +ACTE_action + to our local function +ev_action + - this gets +ev_action + to be called when any of the actions registered by this script is executed. +

Finally use +action_register + to register the action: +

    +
  • first argument is the name of the action +
  • second is the xy query string; it is empty since this action won't need coordinates to operate on +
  • third is the description that shows up in dumps and helps +
  • fourth is the syntax description (also for helps)
+ Index: 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ID.desc =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ID.desc (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ID.desc (revision 1136) @@ -0,0 +1,3 @@ +Create a new action hello() that prints "Hello world!" in a popup window, create a menu (under "Plugins/GPMI scripting/") that executes the action. + + Index: 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ID.name =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ID.name (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ID.name (revision 1136) @@ -0,0 +1 @@ +hello world (popup window + submenu) Index: 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.awk =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.awk (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.awk (revision 1136) @@ -0,0 +1,20 @@ +BEGIN { + PkgLoad("pcb-rnd-gpmi/actions", 0); + PkgLoad("pcb-rnd-gpmi/dialogs", 0); +} + +function ev_action(id, name, argc, x, y) +{ + dialog_report("Greeting window", "Hello world!"); +} + +function ev_gui_init(id, argc, argv) +{ + create_menu("Plugins/GPMI scripting/hello", "hello()", "h", "Ctrlw", "tooltip for hello"); +} + +BEGIN { + Bind("ACTE_action", "ev_action"); + Bind("ACTE_gui_init", "ev_gui_init"); + action_register("hello", "", "log hello world", "hello()"); +} Index: 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.bash =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.bash (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.bash (revision 1136) @@ -0,0 +1,24 @@ +#!/bin/bash + +function load_packages() +{ + GPMI PkgLoad "pcb-rnd-gpmi/actions" 0 + GPMI PkgLoad "pcb-rnd-gpmi/dialogs" 0 +} + +function ev_action() { + GPMI dialog_report "Greeting window" "Hello world!" +} + +function ev_gui_init() +{ + GPMI create_menu "Plugins/GPMI scripting/hello" "hello()" "h" "Ctrlw" "tooltip for hello" +} + +function main() +{ + load_packages + GPMI Bind "ACTE_action" "ev_action" + GPMI Bind "ACTE_gui_init" "ev_gui_init" + GPMI action_register "hello" "" "log hello world" "hello()" +} Index: 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.html =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.html (revision 1136) @@ -0,0 +1,33 @@ +Load packages the script depends on: +
    +
  • actions for registering the new action; +
  • dialogs for creating a dialog box. +
+

+Create a function ev_action that will be called when any of +the actions registered by the script is executed. The script registers +only one action, so it does not need to check which action caused +the function to be called. +

+When the action event is called, use dialog_report to pop +up a report dialog. First argument donates the name (title) of the window, +the second is the text printed in the window. +

+Create a function ev_gui_init that will be called when the +gui has been initialized - this is the right moment to register +new menus in the GUI. Put the new menu item in the +"Plugins/GPMI scripting/" menu by convention, and set hot key to ctrl+w. +The menu should execute action hello(). +

+In the "main" section of the script, bind event ACTE_action to +our local function ev_action - this gets ev_action to +be called when any of the actions registered by this script is executed. +Also bind ev_gui_init so that the new menu can be safely created. +

+Finally use action_register to register the action: +

    +
  • first argument is the name of the action +
  • second is the xy query string; it is empty since this action won't need coordinates to operate on +
  • third is the description that shows up in dumps and helps +
  • fourth is the syntax description (also for helps) +
Index: 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.lua =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.lua (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.lua (revision 1136) @@ -0,0 +1,14 @@ +PkgLoad("pcb-rnd-gpmi/actions", 0); +PkgLoad("pcb-rnd-gpmi/dialogs", 0); + +function ev_action(id, name, argc, x, y) + dialog_report("Greeting window", "Hello world!"); +end + +function ev_gui_init(id, argc, argv) + create_menu("Plugins/GPMI scripting/hello", "hello()", "h", "Ctrlw", "tooltip for hello"); +end + +Bind("ACTE_action", "ev_action"); +Bind("ACTE_gui_init", "ev_gui_init"); +action_register("hello", "", "log hello world", "hello()"); Index: 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.pl =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.pl (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.pl (revision 1136) @@ -0,0 +1,17 @@ +PkgLoad("pcb-rnd-gpmi/actions", 0); +PkgLoad("pcb-rnd-gpmi/dialogs", 0); + +sub ev_action { + my($id, $name, $argc, $x, $y) = @_; + dialog_report("Greeting window", "Hello world!"); +} + +sub ev_gui_init +{ + my($id, $name, $argc, $argv) = @_; + create_menu("Plugins/GPMI scripting/hello", "hello()", "h", "Ctrlw", "tooltip for hello"); +} + +Bind("ACTE_action", "ev_action"); +Bind("ACTE_gui_init", "ev_gui_init"); +action_register("hello", "", "log hello world", "hello()"); Index: 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.py =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.py (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.py (revision 1136) @@ -0,0 +1,12 @@ +PkgLoad("pcb-rnd-gpmi/actions", 0); +PkgLoad("pcb-rnd-gpmi/dialogs", 0); + +def ev_action(id, name, argc, x, y): + dialog_report("Greeting window", "Hello world!"); + +def ev_gui_init(id, argc, argv): + create_menu("Plugins/GPMI scripting/hello", "hello()", "h", "Ctrlw", "tooltip for hello"); + +Bind("ACTE_action", "ev_action"); +Bind("ACTE_gui_init", "ev_gui_init"); +action_register("hello", "", "log hello world", "hello()"); Index: 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.rb =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.rb (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.rb (revision 1136) @@ -0,0 +1,14 @@ +PkgLoad("pcb-rnd-gpmi/actions", 0); +PkgLoad("pcb-rnd-gpmi/dialogs", 0); + +def ev_action(id, name, argc, x, y) + dialog_report("Greeting window", "Hello world!"); +end + +def ev_gui_init(id, argc, argv) + create_menu("Plugins/GPMI scripting/hello", "hello()", "h", "Ctrlw", "tooltip for hello"); +end + +Bind("ACTE_action", "ev_action"); +Bind("ACTE_gui_init", "ev_gui_init"); +action_register("hello", "", "log hello world", "hello()"); Index: 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.scm =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.scm (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.scm (revision 1136) @@ -0,0 +1,12 @@ +(PkgLoad "pcb-rnd-gpmi/actions" 0) +(PkgLoad "pcb-rnd-gpmi/dialogs" 0) + +(define ev_action (lambda (id name argc x y) + (dialog_report "Greeting window" "Hello world!"))) + +(define ev_gui_init (lambda (id argc argv) + (create_menu "Plugins/GPMI scripting/hello" "hello()" "h" "Ctrlw" "tooltip for hello"))) + +(Bind "ACTE_action" "ev_action") +(Bind "ACTE_gui_init" "ev_gui_init") +(action_register "hello" "" "log hello world" "hello()") Index: 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.stt =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.stt (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.stt (revision 1136) @@ -0,0 +1,12 @@ +(PkgLoad "pcb-rnd-gpmi/actions" 0) +(PkgLoad "pcb-rnd-gpmi/dialogs" 0) + +(defun ev_action (id name argc x y) + (dialog_report "Greeting window" "Hello world!")) + +(defun ev_gui_init (id argc argv) + (create_menu "Plugins/GPMI scripting/hello" "hello()" "h" "Ctrlw" "tooltip for hello")) + +(Bind "ACTE_action" "ev_action") +(Bind "ACTE_gui_init" "ev_gui_init") +(action_register "hello" "" "log hello world" "hello()") Index: 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.tcl =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.tcl (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/ex.tcl (revision 1136) @@ -0,0 +1,15 @@ +PkgLoad pcb-rnd-gpmi/actions 0 +PkgLoad pcb-rnd-gpmi/dialogs 0 + +proc ev_action {id, name, argc, x, y} { + dialog_report "Greeting window" "Hello world!" +} + +proc ev_gui_init {id, argc, argv} { + create_menu "Plugins/GPMI scripting/hello" "hello()" "h" "Ctrlw" "tooltip for hello" +} + +Bind ACTE_action ev_action +Bind ACTE_gui_init ev_gui_init +action_register "hello" "" "log hello world" "hello()" + Index: 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/index.html =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/index.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/12_hello_menu/index.html (revision 1136) @@ -0,0 +1,58 @@ + + +<-- back to the index of Rosetta examples +

hello world (popup window + submenu)

+Create a new action hello() that prints "Hello world!" in a popup window, create a menu (under "Plugins/GPMI scripting/") that executes the action. +

Example implementations

+awk + | +bash + | +lua + | +pl + | +py + | +rb + | +scm + | +stt + | +tcl +

Explanation, step by step

+Load packages the script depends on: +
    +
  • +actions + for registering the new action; +
  • +dialogs + for creating a dialog box.
+ +

Create a function +ev_action + that will be called when any of the actions registered by the script is executed. The script registers only one action, so it does not need to check which action caused the function to be called. +

When the action event is called, use +dialog_report + to pop up a report dialog. First argument donates the name (title) of the window, the second is the text printed in the window. +

Create a function +ev_gui_init + that will be called when the gui has been initialized - this is the right moment to register new menus in the GUI. Put the new menu item in the "Plugins/GPMI scripting/" menu by convention, and set hot key to ctrl+w. The menu should execute action hello(). +

In the "main" section of the script, bind event +ACTE_action + to our local function +ev_action + - this gets +ev_action + to be called when any of the actions registered by this script is executed. Also bind ev_gui_init so that the new menu can be safely created. +

Finally use +action_register + to register the action: +

    +
  • first argument is the name of the action +
  • second is the xy query string; it is empty since this action won't need coordinates to operate on +
  • third is the description that shows up in dumps and helps +
  • fourth is the syntax description (also for helps)
+ Index: 1.0.8/doc-rnd/gpmi/rosetta/30_move/ID.desc =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/30_move/ID.desc (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/30_move/ID.desc (revision 1136) @@ -0,0 +1,3 @@ +Create a new action mv(dx,dy) that moves selected objects relative by dx and dy mm. + + Index: 1.0.8/doc-rnd/gpmi/rosetta/30_move/ID.name =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/30_move/ID.name (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/30_move/ID.name (revision 1136) @@ -0,0 +1 @@ +action: move selected objects Index: 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.awk =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.awk (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.awk (revision 1136) @@ -0,0 +1,22 @@ +BEGIN { + PkgLoad("pcb-rnd-gpmi/actions", 0); + PkgLoad("pcb-rnd-gpmi/layout", 0); +} + +function ev_action(id, name, argc, x, y ,dx,dy,n,num_objs,obj_ptr) +{ + dx = action_arg(0) * mm2pcb_multiplier() + dy = action_arg(1) * mm2pcb_multiplier() + + num_objs = layout_search_selected("mv_search", "OM_ANY") + for(n = 0; n < num_objs; n++) { + obj_ptr = layout_search_get("mv_search", n) + layout_obj_move(obj_ptr, "OC_OBJ", dx, dy) + } + layout_search_free("mv_search") +} + +BEGIN { + Bind("ACTE_action", "ev_action"); + action_register("mv", "", "move selected objects by dx and dy mm", "mv(dx,dy)"); +} Index: 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.bash =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.bash (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.bash (revision 1136) @@ -0,0 +1,41 @@ +#!/bin/bash + +function load_packages() +{ + GPMI PkgLoad "pcb-rnd-gpmi/actions" 0 + GPMI PkgLoad "pcb-rnd-gpmi/layout" 0 +} + +function ev_action() { + local dx dy n num_objs + + GPMI action_arg 0 + a0=`bash_int "$result"` + + GPMI action_arg 1 + a1=`bash_int "$result"` + + GPMI mm2pcb_multiplier + conv=`bash_int "$result"` + + dx=$(($a0 * $conv)) + dy=$(($a1 * $conv)) + + GPMI layout_search_selected "mv_search" "OM_ANY" + num_objs=`bash_int "$result"` + + for n in `seq 0 $(($num_objs-1))` + do + GPMI layout_search_get "mv_search" $n + obj_ptr="$result" + GPMI layout_obj_move $obj_ptr "OC_OBJ" $dx $dy + done + GPMI layout_search_free "mv_search" +} + +function main() +{ + load_packages + GPMI Bind "ACTE_action" "ev_action" + GPMI action_register "mv" "" "move selected objects by dx and dy mm" "mv(dx,dy)" +} Index: 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.html =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.html (revision 1136) @@ -0,0 +1,36 @@ +Load packages the script depends on: +
    +
  • actions for registering the new action; +
  • layout for searching selected objects and moving objects. +
+

+Create a function ev_action that will be called when any of +the actions registered by the script is executed. The script registers +only one action, so it does not need to check which action caused +the function to be called. +

+When the action event is called, first set up: +

    +
  • fetch event argument 0 and 1 using action_arg; +
  • resolve the conversion rate from mm to PCB's units using mm2pcb_multiplier; +
  • perform a search for all selected object using layout_search_selected (return value is the number of objects found), name the resulting list "mv_search" +
+A loop then iterates over the objects on the list: +
    +
  • resolve the Nth element of the list using layout_search_get, referecing the list by name ("mv_search") and specifying which element to get (the Nth); the result is an object pointer; +
  • move the object using layout_obj_move; specify the object pointer, then which part of the object should be moved ("OC_OBJ" means the whole object) and relative offsets (dx and dy calculated earlier) +
+Finally the search list shall be destroyed to reclaim memory, using layout_search_free. +

+ +In the "main" section of the script, bind event ACTE_action to +our local function ev_action - this gets ev_action to +be called when any of the actions registered by this script is executed. +

+Finally use action_register to register the action: +

    +
  • first argument is the name of the action +
  • second is the xy query string; it is empty since this action won't need coordinates to operate on +
  • third is the description that shows up in dumps and helps +
  • fourth is the syntax description (also for helps) +
Index: 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.lua =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.lua (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.lua (revision 1136) @@ -0,0 +1,18 @@ +PkgLoad("pcb-rnd-gpmi/actions", 0); +PkgLoad("pcb-rnd-gpmi/layout", 0); + +function ev_action(id, name, argc, x, y) + local dx = action_arg(0) * mm2pcb_multiplier() + local dy = action_arg(1) * mm2pcb_multiplier() + + local num_objs = layout_search_selected("mv_search", "OM_ANY") + for n=0,num_objs+1 + do + obj_ptr = layout_search_get("mv_search", n) + layout_obj_move(obj_ptr, "OC_OBJ", dx, dy) + end + layout_search_free("mv_search") +end + +Bind("ACTE_action", "ev_action"); +action_register("mv", "", "move selected objects by dx and dy mm", "mv(dx,dy)"); \ No newline at end of file Index: 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.pl =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.pl (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.pl (revision 1136) @@ -0,0 +1,20 @@ +PkgLoad("pcb-rnd-gpmi/actions", 0); +PkgLoad("pcb-rnd-gpmi/layout", 0); + +sub ev_action { + my($id, $name, $argc, $x, $y) = @_; + + my $dx = action_arg(0) * mm2pcb_multiplier(); + my $dy = action_arg(1) * mm2pcb_multiplier(); + + my $num_objs = layout_search_selected("mv_search", "OM_ANY"); + for(my $n = 0; $n < $num_objs; $n++) { + $obj_ptr = layout_search_get("mv_search", $n); + layout_obj_move($obj_ptr, "OC_OBJ", $dx, $dy); + } + layout_search_free("mv_search"); + +} + +Bind("ACTE_action", "ev_action"); +action_register("mv", "", "move selected objects by dx and dy mm", "mv(dx,dy)"); Index: 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.py =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.py (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.py (revision 1136) @@ -0,0 +1,15 @@ +PkgLoad("pcb-rnd-gpmi/actions", 0); +PkgLoad("pcb-rnd-gpmi/layout", 0); + +def ev_action(id, name, argc, x, y): + dx = int(action_arg(0)) * float(mm2pcb_multiplier()) + dy = int(action_arg(1)) * float(mm2pcb_multiplier()) + num_objs = int(layout_search_selected("mv_search", "OM_ANY")) + for n in xrange(0, num_objs): + obj_ptr = layout_search_get("mv_search", n) + layout_obj_move(obj_ptr, "OC_OBJ", dx, dy) + layout_search_free("mv_search") + +Bind("ACTE_action", "ev_action"); +action_register("hello", "", "log hello world", "hello()"); +action_register("mv", "", "move selected objects by dx and dy mm", "mv(dx,dy)"); Index: 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.rb =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.rb (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.rb (revision 1136) @@ -0,0 +1,25 @@ +PkgLoad("pcb-rnd-gpmi/actions", 0); +PkgLoad("pcb-rnd-gpmi/layout", 0); + +def ev_action(id, name, argc, x, y) +# TODO: how to convert 1e+06 in ruby? +# conv = mm2pcb_multiplier().to_i + conv = 1000000 + + + dx = action_arg(0).to_i * conv.to_i; + dy = action_arg(1).to_i * conv.to_i; + + num_objs = layout_search_selected("mv_search", "OM_ANY").to_i; + + for n in 0..(num_objs-1) + obj_ptr = layout_search_get("mv_search", n); + layout_obj_move(obj_ptr, "OC_OBJ", dx, dy); + n += 1; + end + layout_search_free("mv_search"); + +end + +Bind("ACTE_action", "ev_action"); +action_register("mv", "", "move selected objects by dx and dy mm", "mv(dx,dy)"); Index: 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.scm =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.scm (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.scm (revision 1136) @@ -0,0 +1,20 @@ +(PkgLoad "pcb-rnd-gpmi/actions" 0) +(PkgLoad "pcb-rnd-gpmi/layout" 0) + +(define ev_action (lambda (id name argc x y) +(let + ( + (dx (* (string->number (action_arg 0)) (string->number (mm2pcb_multiplier)))) + (dy (* (string->number (action_arg 1)) (string->number (mm2pcb_multiplier)))) + (num_objs (string->number (layout_search_selected "mv_search" "OM_ANY"))) + (obj_ptr 0) + ) + (do ((n 0 (1+ n))) + ((> n num_objs)) + (set! obj_ptr (layout_search_get "mv_search" n)) + (layout_obj_move obj_ptr "OC_OBJ" (inexact->exact dx) (inexact->exact dy)) + ) +))) + +(Bind "ACTE_action" "ev_action") +(action_register "mv" "" "move selected objects by dx and dy mm" "mv(dx,dy)") Index: 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.stt =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.stt (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.stt (revision 1136) @@ -0,0 +1,24 @@ +(PkgLoad "pcb-rnd-gpmi/actions" 0) +(PkgLoad "pcb-rnd-gpmi/layout" 0) + +(defun ev_action (id name argc x y) +(let + ( + (dx (* (->num (action_arg 0)) (->num (mm2pcb_multiplier)))) + (dy (* (->num (action_arg 1)) (->num (mm2pcb_multiplier)))) + (num_objs (->num (layout_search_selected "mv_search" "OM_ANY"))) + (obj_ptr 0) + ) + (do ((n 0 (1+ n))) + ((> n num_objs)) + (set! obj_ptr (layout_search_get "mv_search" n)) + (layout_obj_move obj_ptr "OC_OBJ" (->int dx) (->int dy)) + ) +) +) + +(Bind "ACTE_action" "ev_action") +(action_register "mv" "" "move selected objects by dx and dy mm" "mv(dx,dy)") + + + Index: 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.tcl =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.tcl (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/30_move/ex.tcl (revision 1136) @@ -0,0 +1,17 @@ +PkgLoad pcb-rnd-gpmi/actions 0 +PkgLoad pcb-rnd-gpmi/layout 0 + +proc ev_action {id, name, argc, x, y} { + set dx [expr round([action_arg 0] * [mm2pcb_multiplier])] + set dy [expr round([action_arg 1] * [mm2pcb_multiplier])] + + set num_objs [layout_search_selected mv_search OM_ANY] + for {set n 0} {$n < $num_objs} {incr n} { + set obj_ptr [layout_search_get mv_search $n] + layout_obj_move $obj_ptr OC_OBJ $dx $dy + } + layout_search_free mv_search +} + +Bind ACTE_action ev_action +action_register "mv" "" "move selected objects by dx and dy mm" "mv(dx,dy)" Index: 1.0.8/doc-rnd/gpmi/rosetta/30_move/index.html =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/30_move/index.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/30_move/index.html (revision 1136) @@ -0,0 +1,74 @@ + + +<-- back to the index of Rosetta examples +

action: move selected objects

+Create a new action mv(dx,dy) that moves selected objects relative by dx and dy mm. +

Example implementations

+awk + | +bash + | +lua + | +pl + | +py + | +rb + | +scm + | +stt + | +tcl +

Explanation, step by step

+Load packages the script depends on: +
    +
  • +actions + for registering the new action; +
  • +layout + for searching selected objects and moving objects.
+ +

Create a function +ev_action + that will be called when any of the actions registered by the script is executed. The script registers only one action, so it does not need to check which action caused the function to be called. +

When the action event is called, first set up: +

    +
  • fetch event argument 0 and 1 using +action_arg +; +
  • resolve the conversion rate from mm to PCB's units using +mm2pcb_multiplier +; +
  • perform a search for all selected object using +layout_search_selected + (return value is the number of objects found), name the resulting list "mv_search"
+ A loop then iterates over the objects on the list: +
    +
  • resolve the Nth element of the list using +layout_search_get +, referecing the list by name ("mv_search") and specifying which element to get (the Nth); the result is an object pointer; +
  • move the object using +layout_obj_move +; specify the object pointer, then which part of the object should be moved ("OC_OBJ" means the whole object) and relative offsets (dx and dy calculated earlier)
+ Finally the search list shall be destroyed to reclaim memory, using +layout_search_free +. +

In the "main" section of the script, bind event +ACTE_action + to our local function +ev_action + - this gets +ev_action + to be called when any of the actions registered by this script is executed. +

Finally use +action_register + to register the action: +

    +
  • first argument is the name of the action +
  • second is the xy query string; it is empty since this action won't need coordinates to operate on +
  • third is the description that shows up in dumps and helps +
  • fourth is the syntax description (also for helps)
+ Index: 1.0.8/doc-rnd/gpmi/rosetta/35_export_drill/ID.desc =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/35_export_drill/ID.desc (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/35_export_drill/ID.desc (revision 1136) @@ -0,0 +1 @@ +Create a new exporter that prints a list of drills in x,y,dia table in CSV, TSV or text format Index: 1.0.8/doc-rnd/gpmi/rosetta/35_export_drill/ID.name =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/35_export_drill/ID.name (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/35_export_drill/ID.name (revision 1136) @@ -0,0 +1 @@ +drill list exporter Index: 1.0.8/doc-rnd/gpmi/rosetta/35_export_drill/ex.awk =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/35_export_drill/ex.awk (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/35_export_drill/ex.awk (revision 1136) @@ -0,0 +1,60 @@ +BEGIN { + PkgLoad("pcb-rnd-gpmi/hid", 0) + PkgLoad("pcb-rnd-gpmi/layout", 0) + PkgLoad("pcb-rnd-gpmi/dialogs", 0) + + hid = hid_create("drill", "drill list export") + attr_path = hid_add_attribute(hid, "filename", "name of the output file", "HIDA_Path", 0, 0, "drill.txt") + attr_format = hid_add_attribute(hid, "format", "file format", "HIDA_Enum", 0, 0, "CSV|TSV|text") + hid_register(hid) + + fmt = 0 + conv = mm2pcb_multiplier() + channel = "" + green_light = 0 +} + +function make_gc(event_id, hid, gc) { + if (channel == "") { + channel = hid_get_attribute(hid, attr_path) +# awk: can't check whether the file can be open here + fmt = hid_get_attribute(hid, attr_format) + } +} + +function destroy_gc(event_id, hid, gc) { + if (channel != "") { + close(channel) + channel = "" + } +} + +function set_layer(event_id, hid, name, group, empty) { + if (name == "topassembly") + green_light = 1 + else + green_light = 0 +} + +function fill_circle(event_id, hid, gc, cx, cy, r ,dia) { + if (green_light) { + cx = cx / conv + cy = cy / conv + dia = r / conv * 2 + + if (fmt == "CSV") { + print cx "," cy "," dia > channel + } else if (fmt == "TSV") { + print cx "\t" cy "\t" dia > channel + } else if (fmt == "text") { + print cx " " cy " " dia > channel + } + } +} + +BEGIN { + Bind("HIDE_make_gc", "make_gc") + Bind("HIDE_destroy_gc", "destroy_gc") + Bind("HIDE_set_layer", "set_layer") + Bind("HIDE_fill_circle", "fill_circle") +} Index: 1.0.8/doc-rnd/gpmi/rosetta/35_export_drill/ex.html =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/35_export_drill/ex.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/35_export_drill/ex.html (revision 1136) @@ -0,0 +1,60 @@ + +An exporter is a hid registered. During the export +process, pcb-rnd calls the exporter to draw objects on layers. The GPMI +layer converts these calls to bindable events. An exporter script catches +the drawing events relevant to the output format and draws everything from +event handlers. +

+An exporter is sort of a drawing backend: pcb-rnd sets up graphic contexts +(gc for short) and draws on them. The first gc set up should open the +output file, the last gc closed should flush/close the file. +

+


+ +

Theory of operation

+Assume only filled circles on the +top assembly layer are holes. Emit a line for each of these +and ignore everything else. + +

Implementation

+Load packages the script depends on: +
    +
  • hid for registering the new exporter; +
  • layout for unit conversion; +
  • dialogs for error reporting. +
+

+Set up an exporter hid, storing the handle of each object created in +a global variable: +

    +
  • create a hid using hid_create +
  • add two attributes (fields) to the dialog using hid_add_attribute +
  • register the new hid using hid_register - this makes it an exporter +
+

+Set up global state variables: +

    +
  • fmt will be a cache for the format selected by the user +
  • conv is the conversion scale between mm and PCB internal coordinate unit +
  • channel specifies a file handle or indicates that the output file is open +
  • green_light indicates that the exporter is drawing the relevant layer +
+

+Define a make_gc callback. It is called when a new graphic +context is created (e.g. for layers). An exporter is sort of a drawing +backend: pcb-rnd sets up gc's and draws on them. The first gc set up +should open the output file, the last gc closed should flush/close the file. +Define a destroy_gc callback for the latter. GCs are +destroyed at the end of the export process. Use global variable channel +to make sure the file is open/close only once (see TODO script context). +

+Define a set_layer callback that sets green_light to true if +layer name is "topasssembly", false otherwise. +

+Callback fill_circle is the workhorse: check if we have the green +light to emit lines, then convert coordinates and diameter to mm and +decide what format to use for printing a line for each filled circle. +

+Finally, bind all four callbacks to exporter events. + + Index: 1.0.8/doc-rnd/gpmi/rosetta/35_export_drill/ex.lua =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/35_export_drill/ex.lua (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/35_export_drill/ex.lua (revision 1136) @@ -0,0 +1,65 @@ +PkgLoad("pcb-rnd-gpmi/hid", 0) +PkgLoad("pcb-rnd-gpmi/layout", 0) +PkgLoad("pcb-rnd-gpmi/dialogs", 0) + +hid = hid_create("drill", "drill list export") +attr_path = hid_add_attribute(hid, "filename", "name of the output file", "HIDA_Path", 0, 0, "drill.txt") +attr_format = hid_add_attribute(hid, "format", "file format", "HIDA_Enum", 0, 0, "CSV|TSV|text") +hid_register(hid) + +fmt = 0 +conv = mm2pcb_multiplier() +channel = nil +green_light = 0 + +function make_gc(event_id, hid, gc) + if channel == nil + then + channel = io.open(hid_get_attribute(hid, attr_path), "w") + if channel == nil + then + dialog_report("Error exporting drill", "Could not open file [hid_get_attribute $hid $attr_path] for\nwriting, exporting drill failed.") + return + end + fmt = hid_get_attribute(hid, attr_format) + end +end + +function destroy_gc(event_id, hid, gc) + if channel ~= nil + then + channel:close() + channel = nil + end +end + +function set_layer(event_id, hid, name, group, empty) + if name == "topassembly" + then + green_light = 1 + else + green_light = 0 + end +end + +function fill_circle(event_id, hid, gc, cx, cy, r) + if green_light + then + cx = cx / conv + cy = cy / conv + local dia = r / conv * 2 + + if fmt == "CSV" then + channel:write(cx .. "," .. cy .. "," .. dia .. "\n") + elseif (fmt == "TSV") then + channel:write(cx .. "\t" .. cy .. "\t" .. dia .. "\n") + elseif (fmt == "text") then + channel:write(cx .. " " .. cy .. " " .. dia .. "\n") + end + end +end + +Bind("HIDE_make_gc", "make_gc") +Bind("HIDE_destroy_gc", "destroy_gc") +Bind("HIDE_set_layer", "set_layer") +Bind("HIDE_fill_circle", "fill_circle") Index: 1.0.8/doc-rnd/gpmi/rosetta/35_export_drill/ex.tcl =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/35_export_drill/ex.tcl (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/35_export_drill/ex.tcl (revision 1136) @@ -0,0 +1,63 @@ +PkgLoad pcb-rnd-gpmi/hid 0 +PkgLoad pcb-rnd-gpmi/layout 0 +PkgLoad pcb-rnd-gpmi/dialogs 0 + +set hid [hid_create "drill" "drill list export"] +set attr_path [hid_add_attribute $hid "filename" "name of the output file" "HIDA_Path" 0 0 "drill.txt"] +set attr_format [hid_add_attribute $hid "format" "file format" "HIDA_Enum" 0 0 "CSV|TSV|text"] +hid_register $hid + +set fmt 0 +set conv [mm2pcb_multiplier] +set channel -1 +set green_light 0 + +proc make_gc {event_id hid gc} { + global channel attr_path attr_format fmt + + if {$channel == -1} { + if {[catch {open [hid_get_attribute $hid $attr_path] "w"} channel]} { + dialog_report "Error exporting drill" "Could not open file [hid_get_attribute $hid $attr_path] for\nwriting, exporting drill failed." + return + } + set fmt [hid_get_attribute $hid $attr_format] + } +} + +proc destroy_gc {event_id hid gc} { + global channel + + if {$channel > -1} { + close $channel + set channel -1 + } +} + +proc set_layer {event_id hid name group empty} { + global green_light + + if { $name eq "topassembly" } { set green_light 1 } { set green_light 0 } +} + +proc fill_circle {event_id hid gc cx cy r} { + global channel conv fmt green_light + + if {$green_light} { + set cx [expr $cx / $conv] + set cy [expr $cy / $conv] + set dia [expr $r / $conv * 2] + + if {$fmt eq "CSV"} { + puts $channel "$cx,$cy,$dia" + } elseif {$fmt eq "TSV"} { + puts $channel "$cx $cy $dia" + } elseif {$fmt eq "text"} { + puts $channel "$cx $cy $dia" + } + } +} + +Bind HIDE_make_gc make_gc +Bind HIDE_destroy_gc destroy_gc +Bind HIDE_set_layer set_layer +Bind HIDE_fill_circle fill_circle Index: 1.0.8/doc-rnd/gpmi/rosetta/index.html =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/index.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/index.html (revision 1136) @@ -0,0 +1,58 @@ + + + +

pcb-rnd scripting - Rosetta

+The Rosetta Stone +of pcb-rnd scripting is a collection of example scripts implemented in +various scripting languages. Rosetta has multiple purposes: +
    +
  • to provide examples of using the pcb-rnd API; +
  • to not scare away newcomers by showing the first examples in an unfamiliar language; +
  • to help the user to decide which language to use for a specific task; +
  • to provide examples on how to convert idioms of pcb-rnd scripts from one language to another. +
+

+Each example comes with an explanation, written in plain English about what the +scripts do, step by step. Instead of trying to exploit powerful features +of the language, example implementations try to be simple. +

+The list below is ordered from the least complex to the most complex examples. +Column lvl is the complexity score. The less the score is, the simpler +the example is. + + +

Index of examples

+ + + + + + + + +
lvlexample languages description +
10 + hello world (text, log) + awk bash lua perl python ruby scheme stutter tcl + Create a new action hello() that prints "Hello world!" in the message log. +
10 + hello world (popup window) + awk bash lua perl python ruby scheme stutter tcl + Create a new action hello() that prints "Hello world!" in a popup window. +
12 + hello world (popup window + submenu) + awk bash lua perl python ruby scheme stutter tcl + Create a new action hello() that prints "Hello world!" in a popup window, create a menu (under "Plugins/GPMI scripting/") that executes the action. +
30 + action: move selected objects + awk bash lua perl python ruby scheme stutter tcl + Create a new action mv(dx,dy) that moves selected objects relative by dx and dy mm. +
35 + drill list exporter + awk lua tcl + Create a new exporter that prints a list of drills in x,y,dia table in CSV, TSV or text format +
+ + + + Index: 1.0.8/doc-rnd/gpmi/rosetta/index.templ.html =================================================================== --- 1.0.8/doc-rnd/gpmi/rosetta/index.templ.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/rosetta/index.templ.html (revision 1136) @@ -0,0 +1,29 @@ + + + +

pcb-rnd scripting - Rosetta

+The Rosetta Stone +of pcb-rnd scripting is a collection of example scripts implemented in +various scripting languages. Rosetta has multiple purposes: +
    +
  • to provide examples of using the pcb-rnd API; +
  • to not scare away newcomers by showing the first examples in an unfamiliar language; +
  • to help the user to decide which language to use for a specific task; +
  • to provide examples on how to convert idioms of pcb-rnd scripts from one language to another. +
+

+Each example comes with an explanation, written in plain English about what the +scripts do, step by step. Instead of trying to exploit powerful features +of the language, example implementations try to be simple. +

+The list below is ordered from the least complex to the most complex examples. +Column lvl is the complexity score. The less the score is, the simpler +the example is. + + +

Index of examples

+ + + + + Index: 1.0.8/doc-rnd/gpmi/scripting_intro.html =================================================================== --- 1.0.8/doc-rnd/gpmi/scripting_intro.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi/scripting_intro.html (revision 1136) @@ -0,0 +1,226 @@ + + +

Scripting intro

+This document is an introduction to GPMI for pcb-rnd users. It focuses on +scripting pcb-rnd and doesn't discusses GPMI deeper than the minimum necessary. +GPMI is more generic than shown here. +

+The scope of the document is to describe the relations between pcb-rnd, +hids, GPMI, glue packages and scripts. Details on how specific glue +packages access pcb-rnd internals (or how those internals work) are +described in other documents. + +

1. pcb-rnd internals

+ +Since scripts are glued to pcb-rnd internals, scripters need to know +the basic concepts of how pcb-rnd is structured. + +

1.1 pcb-rnd, HIDs, plugins and GPMI

+pcb-rnd consists of: +
    +
  • a core that handles the file format, data structures, UI and exporter logics +
  • a hid system that is a layer between core and the HIDs +
  • a set of GUI HIDs which are responsible for interactive graphical display of the current design +
  • a set of exporter HIDs which are responsible for exporting offline representation of the current design +
  • a plugin system that can load HIDs from on the fly, from dynamic loadable libraries (.so or .dll) +
  • a buildin system which is the "static link" variant of the plugin system: some plugins can be selected to be statically linked into the pcb-rnd executable so they are "always loaded" +
+

+Note 1: at the moment GUI hids can not be plugins or buildins. +
+Note 2: plugins/buildins are always exporter HIDs technically, but in practice +they do not have to offer exporting. This means such a HID plugin is loaded +and registered as an exporter on paper, but it doesn't really create a +new export facility, just sits there, interacting with pcb-rnd (creating +menus, actions, etc). Most script plugins do this. +

+When pcb-rnd executable is compiled, the core, the default GUI and exporter HIDs +and buildins are compiled into the executable. Later on +

+The GPMI hid is an optional plugin that, by compile-time choice +of the user, can be: +

    +
  • left out all-together - pcb-rnd does not have scripting +
  • compiled as a plugin - when the .so (or .dll) is put in the right directory, pcb-rnd loads it during startup and has scripting +
  • compiled as buildin - becomes part of the pcb-rnd executable so that scripting is always available +
+ +

1.2. Actions, menus, exporters

+The core implements actions. An action is a command with custom arguments, +e.g. Delete(Selected). These actions are the commands on the default command +line in pcb-rnd. In batch mode the command language uses these actions as well. +Remote controlling pcb-rnd using the --listen switch will read these actions +on the standard input. +

+GUI menus are configured to execute actions too. This also means it is impossible +to realize an user-accessible functionality that can be triggered from +the GUI command line, menu or batch input without making it an action. +

+The only exception, where new functionality is not behind a new action is +exporters. An exporter is a structured dialog box of options and a set of +callback functions implementing a drawing API. Exporting works by the following +steps: +

    +
  1. An exporter HID may register one or more exporters. +
  2. When the user tries to export the design, pcb-rnd lists all + registered exporters. +
  3. The user chooses one, and the preconfigured dialog box + with the selected exporter's options are popped up. +
  4. pcb-rnd core runs the dialog and saves the results if the user + clicked on the ok button. +
  5. pcb-rnd starts the exporting process: it calls the callbacks + to draw the design layer by layer, object by object. +
+ +

1.3. How a script can interact with the user

+
    +
  • The script may register actions - these actions are instantly accessible from the GUI command line, on stdin with --listen and in batch mode +
  • The script may create menus and bind them to actions - when the menu is selected, the action is executed +
  • The script may bind to events that will be generated asynchronously by pcb-rnd - when such an event is received, the script executes some code +
  • The script may register new exporter(s) - the user will be able to export the design using the script +
  • The script may run arbitrary code "on load" (when the script is loaded) - however, that time the design or even the GUI may not be loaded/initialized yet - this is useful for registering actions, bind to events or set up exporters +
+ + +

2. GPMI intro

+ +

2.1. GPMI's place in the pcb-rnd world

+
+GPMI is a plugin/buildin HID. Instead of doing actual work, it loads scripts +and provides a glue layer between pcb-rnd and the scripts. The actual work +is performed by the scripts. +The glue layer comes in two kinds: +
    +
  • gpmi module: dynamic lib written in C, knows how to load and interpret a script and how to deliver events to the script +
  • gpmi package: dynamic lib, provides C functions the script can directly call; package functions then know how to deal with PCB internals +
+Arrows drawn with dashed line represents a slow, string based communication. +
+ +

2.2. Module, script, script context, packages

+
+Each time a script needs to be loaded, first a module is loaded and the name +of the script is passed to the module. During module initialization, the module +sets up a script interpreter and script context and loads the script into the +context. +

+If there are 3 separate lua scripts running in pcb-rnd, there are 3 separate +lua modules loaded, each dealing with one of the scripts. The process of +loading a script is illustrated by highlighting the relevant paths with red +for step 1 and green for step 2. +

+Step 0: the GPMI HID finds a script has to be loaded. The idea comes +from the config file (pcb-rnd-gpmi.conf) or from the GUI (manage scripts) +or as a request from a script already loaded. +

+Step 1: the GPMI HID loads the corresponding module which in turns +loads the script. The script has a "main" part that is run on load. For +most languages this is the global code sections; in some languages it is +a specific function, usually called main. A few basic glue packages +are already loaded before the script. +

+Step 2: the script can load glue packages. This usually happens +from the on-load main part from the script. The actual mechanism is to +call PkgLoad() from a glue package that was automatically loaded in +Step 1. The green arrows represent this path: the script executes PkgLoad() +which in turns loads other package(s) into the GPMI hid. +

+Packages are loaded only once and are globally accessible for multiple modules. +

+ +

2.3. Binding events, registering actions, creating menus

+
+Binding an event in a script is done by calling the Bind() function +(this is implemented in a package automatically loaded). The first +argument is the name of the event, the second argument is the name of +the script function that should be called when the event is triggered. Both +arguments are strings. The event binding mechanism is shown in red in the +map to the right. +

+The script can create new actions using the action_register() function +(the actions package needs to be loaded first). A script may register multiple +actions. This call is marked with green in the above map. +If any of the actions registered by the script is called, the event "ACTE_action" +is generated. This has two implications: +

    +
  • a script that registers actions needs to bind the ACTE_action event to serve the action requests +
  • if a script registers multiple actions, in the event handler it needs to check which action triggered the event (e.g. with a switch()-like construction on the event name) +
+
+ +
+Menus are created using the create_menu() call. Menus can be +created only when the GUI is already set up - this may happen only +after some of the scripts are already loaded. Thus scripts shall +create menus from an event handler bound to the ACTE_gui_init event. +This event is triggered right after the GUI has been set up. +On the map to the right the red arrows represent the path of ACTE_gui_init; +the green arrows represent the reaction of the script, creating the new +menu. +

+

+ +

2.4. Exporting

+
+Exporter scripts first have to set up an exporter hid. This typically +happens from their on-load main part. Related calls are in the hid +package. The following map shows this process with red arrows: +

+When the user chooses to use the exporter, among the green arrows, +a series of events are triggered and the script can generate output +directly to a file from event handlers bound to these exporting events. +

+ +

2.5. Making modifications on the design

+The purpose of a script might be to manipulate the objects in the current design. +Such a script registers actions, and implements the handler of the actions +using the layout package. The layout package provides calls to query, +change and create design objects. + + +

3. How it works in practice

+ +

3.1. Loading the GPMI plugin

+Check the output of ./configure, it will tell if gpmi is compiled as buildin +or plugin (or not at all). +If the gpmi plugin is compiled as a buildin, it is already loaded, no +further steps are required. +

+If gpmi is a plugin, gpmi_plugin.so (or gpmi_plugin.dll) needs to be +copied in one of the plugin directories pcb-rnd is looking into on startup: + +
path purpose +
+
$prefix/lib/pcb-rnd/plugins/$arch/ system plugins, multihost +
$prefix/lib/pcb-rnd/plugins/ system plugins +
~/.pcb/plugins/$arch/ user plugins, multihost +
~/.pcb/plugins/ user plugins +
./plugins/$arch/ project plugins, multihost +
./plugins/ project plugins +
+In the above table: +

    +
  • $prefix is the installation prefix (normally /usr) +
  • $arch is the host arch triplet, e.g. i386-unknown-linux; this is useful if multiple architectures share the same NFS mounted plugin dir +
  • ~ is the user home directory, if exists, e.g. /home/jdoe +
  • ./ is the current working directory pcb has been started from; may be useful for project-local scripts +
+ +

3.2. Loading scripts

+The gpmi plugin looks for a file called "pcb-rnd-gpmi.conf" in each of the +plugin directories. Wherever the file is found, it is loaded and parsed. +The file is plain text, each line describes a script to be loaded. Empty +lines and lines starting with # are comments and are ignored. +

+Script load lines contain two words separated by a space: a module name +and a script name. Relative paths in the the script name are relative to +the directory the config file is found in. +

+Example config: +

+# load the carc script (written in lua) from next to the config file:
+lua carc.lua
+
+# load foo.awk, whcih is a mawk script, from its installation path
+mawk /usr/lib/foo/foo.awk
+
Index: 1.0.8/doc-rnd/gpmi/util/Makefile =================================================================== --- 1.0.8/doc-rnd/gpmi/util/Makefile (nonexistent) +++ 1.0.8/doc-rnd/gpmi/util/Makefile (revision 1136) @@ -0,0 +1 @@ +all: Index: 1.0.8/doc-rnd/gpmi/util/rosetta_genpages.sh =================================================================== --- 1.0.8/doc-rnd/gpmi/util/rosetta_genpages.sh (nonexistent) +++ 1.0.8/doc-rnd/gpmi/util/rosetta_genpages.sh (revision 1136) @@ -0,0 +1,171 @@ +#!/bin/sh + +clean_id() +{ + tr "\r\n" "~" | sed ' +s/~*$//; +s/|/\&pipe;/g; +s/&/\&/g; +s//\>/g; +s/"/\"/g; +s/'\''/\'/g; +s/~\+/
/g; +' + echo "" +} + +genpage() +{ + local dir scripts name desc + + dir="$1" + scripts="$2" + + name=`cat $dir/ID.name` + desc=`cat $dir/ID.desc` + ./tags < "$dir/ex.html" | awk -v "fn_ref=../packages/XREF" -v "scripts=$scripts" -v "name=$name" -v "desc=$desc" ' + BEGIN { + while((getline < fn_ref) > 0) { + REF[$2] = $3 + } + print "" + print "" + print "<-- back to the index of Rosetta examples" + print "

" name "

" + print desc + + print "

Example implementations

" + v = split(scripts, S, "[\r\n]+") + for(n = 1; n <= v; n++) { + lang=S[n] + sub("^ex[.]", "", lang) + if (n != 1) + print " | " + print "" lang "" + } + + print "

Explanation, step by step

" + } + /^/ { + gsub("", "", $0) + name=$0 + gsub("[ \t]*", "", name) + if (name in REF) { + link_begin="" + link_end = "" + } + else { + link_begin="" + link_end="" + } + print "" link_begin $0 link_end "" + next + } + + { print $0 } + + ' > "$dir/index.html" +} + +gen_index() +{ + + awk -v "template=$1" ' + BEGIN { + FS="[|]" + q = "\"" + LANGS["rb"] = "ruby" + LANGS["pl"] = "perl" + LANGS["py"] = "python" + LANGS["stt"] = "stutter" + LANGS["scm"] = "scheme" + } + + ($1 == "scripts") { + s = $3 + gsub("ex[.]", "", s) + v = split(s, S, " ") + s = "" + for(n = 1; n <= v; n++) { + if (S[n] in LANGS) + s = s " " LANGS[S[n]] + else + s = s " " S[n] + } + DATA[$2, $1] = s + next + } + + ($1 == "name") { + if (names == "") + names = $2 + else + names = names "|" $2 + } + + + { + # DATA[script, name] = "hello world" + DATA[$2, $1] = $3 + } + + function generate(cmd ,N,n,v,name,level) { + if (cmd == "index") { + print "" + print "" + print "
lvlexample languages description" + v = split(names, N, "[|]") + for(n = 1; n <= v; n++) { + name = N[n] + level = name + sub("_.*", "", level) + if (level ~ "[^0-9]") + level = "n/a" + print "
" level + print " " DATA[name, "name"] "" + print " " DATA[name, "scripts"] + print " " DATA[name, "desc"] + } + print "
" + } + else + print "Do not know how to generate " cmd > "/dev/stderr" + } + + END { + FS="" + while((getline < template) > 0) { + if (match($0, "]*>")) { + print substr($0, 1, RSTART-1) + cmd=substr($0, RSTART+8, RLENGTH-9) + sub("^[ \t]*", "", cmd) + generate(cmd) + print substr($0, RSTART+RLENGTH) + } + else + print $0 + } + } + ' + +} + + +for n in ../rosetta/* +do + if test -d "$n" + then + bn=`basename $n` + scripts=`cd $n && ls ex.* | grep -v ".pyc$\|.html$" ` + genpage "$n" "$scripts" + echo -n "desc|$bn|" + clean_id < $n/ID.desc + echo -n "name|$bn|" + clean_id < $n/ID.name + echo -n "scripts|$bn|" + echo $scripts + fi +done | gen_index ../rosetta/index.templ.html > ../rosetta/index.html + + Property changes on: 1.0.8/doc-rnd/gpmi/util/rosetta_genpages.sh ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/doc-rnd/gpmi/util/tags =================================================================== --- 1.0.8/doc-rnd/gpmi/util/tags (nonexistent) +++ 1.0.8/doc-rnd/gpmi/util/tags (revision 1136) @@ -0,0 +1,4 @@ +#!/bin/sh + +tr "\n" " " | sed "s@\(<[^/]\)@\n\1@g;s@\(]*>\)@\1\n@g" + Property changes on: 1.0.8/doc-rnd/gpmi/util/tags ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/doc-rnd/gpmi.html =================================================================== --- 1.0.8/doc-rnd/gpmi.html (nonexistent) +++ 1.0.8/doc-rnd/gpmi.html (revision 1136) @@ -0,0 +1,41 @@ + + +

pcb-rnd - the [gpmi] patch

+ +Thanks to gpmi, pcb-rnd is scriptable in about 10 scripting languages (e.g. +lua, awk, ruby, python, scheme, tcl). Scripts are integrated in pcb-rnd and +have access to most of the internals. Scripts +are able to: +
    +
  • register new actions +
  • create new menus and submenus +
  • execute existing actions +
  • pop up simple dialog boxes (message, report, progress bar, file selection) -- check out the video +
  • build and pop up custom dialog boxes (so called attribute dialogs) +
  • search for objects (lines, arc, polys, vias, etc.) on the layout +
  • change and move existing objects on the layout +
  • create new objects on the layout +
  • change "page" properties (dimensions of the board) +
  • debug draw on the gui (slightly broken on gtk due to some gtk hid bugs) +
+ +

+This feature has three options: +

    +
  • disabled: not compiled at all - when gpmi is not installed (no gpmi scripting in PCB) +
  • buildin: compiled and linked in the executable - pcb-rnd always can load and run scripts +
  • plugin: compiled as a loadable plugin - pcb-rnd can load and run scripts if the plugin is installed +
+ +

Example

+Check out the Rosetta stone of +pcb-rnd. + +

save/load and compatibility

+Save/load files are not affected. + +

plans

+Expose more internals, write more example scripts and documentation. + + + Index: 1.0.8/doc-rnd/gpmi_temp_inst.txt =================================================================== --- 1.0.8/doc-rnd/gpmi_temp_inst.txt (nonexistent) +++ 1.0.8/doc-rnd/gpmi_temp_inst.txt (revision 1136) @@ -0,0 +1,65 @@ +GPMI system-wide installation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The installation process is somewhat manual at this early stage. Please +follow the steps below. + +First, you'll need libgpmi - it's a general purpose script glue interface. + +A/1. svn checkout svn://repo.hu/gpmi/trunk gpmi/trunk +A/2. look at doc/languages.txt there; if you have preferred languages, +please install the -dev packages of those. My favorite is mawk, but I +think most of the example pcb scripts would be in lua. Versions should +match; it may be that gpmi works with a newer minor version out of the +box, tho. +A/3. run ./configure +A/4. check if it found the language(s) you wanted; if not, or anything +else breaks, please send me your scconfig/config.log +A/5. make +A/6. make install (as root, but see below) + +There are options to step 6: + +- if you want to check what it'd do, you could run this: + + install_root=/tmp/foo make install + + it's like DESTDIR for autotools: it will do everything but will use + /tmp/foo instead of / so you see what it'd do without using root or + messing with /usr + +- you can use make linstall instead of make install; this creates symlinks +(pointing to the binaries in your user checkout) instead of copying the +files. If gpmi changes and you need to update and recompile, you won't +need to reinstall (until the number of files change). + +- there's a make uninstall, but it's more or less untested (failed once +and worked once for me) + +Second, you'll need pcb-rnd: + +B/1. svn checkout svn://repo.hu/pcb-rnd/trunk pcb-rnd/trunk +B/2. ./configure +B/3. check the output; if anything went wrong, please send me +scconfig/config.log +B/4. make +B/5. you don't need to install it for testing: cd src; ./pcb-rnd + + +There are options in step 2: by default, if gpmi is found, it's compiled +in "buildin" mode, which means script support is compiled into the pcb-rnd +executable. An alternative is to have it as a plugin (dynamic linkable +object). This can be done using the --plugin-gpmi argument for ./configure. + + +GPMI local installation +~~~~~~~~~~~~~~~~~~~~~~~ +GPMI can be installed without root, into a local user directory (typically +under home). To achieve this, follow the above steps with the following +modifications (assuming you want to install gpmi in ~/usr): + +A/3. ./configure --prefix=~/usr +B/2. ./configure --gpmi-prefix=~/usr + +NOTE: you don't need to use install_root; gpmi will install under ~/usr as +if it was /usr. Index: 1.0.8/doc-rnd/indent.html =================================================================== --- 1.0.8/doc-rnd/indent.html (nonexistent) +++ 1.0.8/doc-rnd/indent.html (revision 1136) @@ -0,0 +1,15 @@ + + +

pcb-rnd - indentation

+ +As of r1022 all old code is converted using indent(1) with the following +command line: + +
+indent --line-length128 -brs -br -nce --tab-size2 -ut -npsl  -npcs -hnl $*
+
+

+Contributors are kindly asked to follow this style or run the above commandline +on their code before sending a patch or commiting to svn. + + Index: 1.0.8/doc-rnd/index.html =================================================================== --- 1.0.8/doc-rnd/index.html (nonexistent) +++ 1.0.8/doc-rnd/index.html (revision 1136) @@ -0,0 +1,58 @@ + + +

pcb-rnd

+PCB-rnd is a fork of PCB, part of +the geda project. This fork features embedded scripting and a set of random +smaller features and bugfixes. +I don't plan to submit these patches to the upstream or merge changes from +the official repo (motivation). +

+When I work on pcb-rnd, I also write a developer log. +

+Feel free to give it a try: +

+ +

+Change summary, per topic: + +
commit message tag and docdescription +
[gpmi] scripting PCB (including GUI dialogs, actions, menus, changing the layout) +
[intconn] component internal connections +
[nonetlist] components that are not part of the netlist and should not cause shorts +
[tostyle] actions, menu and hotkey to change ring dia, line width, drill dia and clearance sizes to match the values defined for the current routing style +
[mincut] minimal cut based warnings on shorts +
[square] change square pad to a generic shaped-pin based on the octagon pin code - this is an alternative to teardrops +
[flagcomp] unknown flag compatibility +
[scconfig] use scconfig instead of autotools +
[pcb-fp] generic parametric footprints; on-the-fly footprint generation by external tools written in any language (remove m4 hardwirings) +
[pcblib], + [pcblib-param] clean up the footprint library shipped +
[debian] Debian packaging the binaries configured to my own taste +
[ba] back annotation +
[onpoint] on-point by Robert Drehmel +
[cycdrag] cycle drag; with additional feature: negative box select +
[mods] modularize the code to reduce core size +
settings minor changes in default settings + + +
+I have plans on my TODO list - these have lower priority +compared to the features above. + +

+Extra documentation: +

+ + + + Index: 1.0.8/doc-rnd/intconn.html =================================================================== --- 1.0.8/doc-rnd/intconn.html (nonexistent) +++ 1.0.8/doc-rnd/intconn.html (revision 1136) @@ -0,0 +1,64 @@ + + +

pcb-rnd - the [intconn] patch

+ +There are parts with internal connections (e.g. pin 2 and 4 of a SO8 +package are internally connected). Vanilla PCB can not handle this, +leaving the following options: +
    +
  • connect both pins to the net from the schematics - this works if all the internally connected pins are required to connect to copper (common with GND or power pins) but is very inconvenient for signal pins where only one of them needs to be connected +
  • back-annotate which pin is connected - there's no easy back annotation +
  • one pin connected, the other is closer to the next target; PCB doesn't understand that they are already connected internally; normally one shouldn't use the internal connection of a component instead of copper; except for the common practice to use 0 ohm SMD resistors for jumping wires +
+

+The patch introduces a new pin flag intconn(g) which marks the pin +to have internal connections in group g. If there +are multiple pins using the same g value within a single element, they +are internally connected. In other words, g is a group (or net name) +within the element and pins can join to one of the numbered groups (or internal +nets). The value of g shall be between 1 and 255, 0 means no internal +connection (equivalent to the case when intconn(0) is omitted). +

+When pin numbers are displayed (key 'd'), internal connection groups are +written in square brackets, e.g. "2 [9]" means "pin 2, internally connected +to group 9". +

+Combined with the [nonetlist] patch, this +solves the "0-ohm 1206 jumper" problem: the element should be marked +as nonetlist, with both pins set intconn(1) - this will result in a 2 +pad element, pads internally connected, that can be part of any one network +without causing short. +

Example

+Crossing traces resolved using a 0 Ohm 1206 resistor called J1. The footprint +has an intconn between the two pads which resolves the final rat line. +

+ +

+ +

+ +

+ + + +

save/load and compatibility

+This patch introduces a new pin flag. In the following example +pin 2 and 4 are connected internally as group 9, while pin 3 +does not have any internal connections: +
+Pin[40000 60000 6000 3000 6600 2800 "2" "2" "square,intconn(9)"]
+Pin[40000 50000 6000 3000 6600 2800 "3" "3" "square"]
+Pin[40000 40000 6000 3000 6600 2800 "4" "4" "square,intconn(9)"]
+
+Vanilla PCB will load the design ignoring internal connections - +this may introduce new rats. +

+Vanilla PCB doesn't save intconn() and elements are embedded in the file - +once the design is loaded and saved with vanilla PCB, internal connection +info is lost. + +

plans

+No plans - this feature is fully implemented. There is no plan for implementing +a GUI, internal connections should be hand-edited into the element. + + Index: 1.0.8/doc-rnd/intconn1.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/intconn1.png =================================================================== --- 1.0.8/doc-rnd/intconn1.png (nonexistent) +++ 1.0.8/doc-rnd/intconn1.png (revision 1136) Property changes on: 1.0.8/doc-rnd/intconn1.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/intconn2.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/intconn2.png =================================================================== --- 1.0.8/doc-rnd/intconn2.png (nonexistent) +++ 1.0.8/doc-rnd/intconn2.png (revision 1136) Property changes on: 1.0.8/doc-rnd/intconn2.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/intconn3.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/intconn3.png =================================================================== --- 1.0.8/doc-rnd/intconn3.png (nonexistent) +++ 1.0.8/doc-rnd/intconn3.png (revision 1136) Property changes on: 1.0.8/doc-rnd/intconn3.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/jumper_1206.fp =================================================================== --- 1.0.8/doc-rnd/jumper_1206.fp (nonexistent) +++ 1.0.8/doc-rnd/jumper_1206.fp (revision 1136) @@ -0,0 +1,7 @@ +Element["nonetlist" "1206 jumper, 0 ohm" "" "1206" 0 0 -3150 -3150 0 100 ""] +( + Pad[-5905 -1181 -5905 1181 5118 2000 5718 "1" "1" "square,intconn(1)"] + Pad[5905 -1181 5905 1181 5118 2000 5718 "2" "2" "square,intconn(1)"] + ElementLine[-2362 -3740 2362 -3740 800] + ElementLine[-2362 3740 2362 3740 800] +) Index: 1.0.8/doc-rnd/keys.html =================================================================== --- 1.0.8/doc-rnd/keys.html (nonexistent) +++ 1.0.8/doc-rnd/keys.html (revision 1136) @@ -0,0 +1,576 @@ + +

Key to action bindings

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
key modifiers pcb-menu.res
lesstif
gpcb-menu.res
gtk +
. +   + Display(Toggle45Degree) + Display(Toggle45Degree) +
/ +   + Display(CycleClip) + Display(CycleClip) +
1 + shift + PasteBuffer(1) + PasteBuffer(1) +
2 + shift + PasteBuffer(2) + PasteBuffer(2) +
3 + shift + PasteBuffer(3) + PasteBuffer(3) +
4 + shift + PasteBuffer(4) + PasteBuffer(4) +
5 + shift + PasteBuffer(5) + PasteBuffer(5) +
: +   + Command() + Command() +
= +   + djopt(simple) + djopt(simple) +
shift + djopt(auto) + djopt(auto) +
[ +   + Mode(Save) + Mode(Save) +
] +   + Mode(Release) + Mode(Release) +
` +   + Zoom(Toggle) +   +
a +   + SetSame() + SetSame() +
alt + Select(All) + Select(All) +
alt-shift + Unselect(All) + Unselect(All) +
b +   + Flip(Object) + Flip(Object) +
alt-ctrl +   + SavePatch() +
shift + Flip(SelectedElements) + Flip(SelectedElements) +
backspace +   + Delete(Selected) + RemoveSelected() +
shift + Atomic(Save) + Atomic(Save) +
c +   + Center() + Center() +
ctrl + Mode(PasteBuffer) + Mode(PasteBuffer) +
d +   + Display(PinOrPadName) + Display(PinOrPadName) +
shift + Display(Pinout) + Display(Pinout) +
delete +   + Delete(Selected) + Mode(Save) +
shift + Atomic(Save) + RemoveSelected() +
down +   + Cursor(Warp,0,-1,grid) + Cursor(Warp,0,-1,grid) +
shift + Cursor(Pan,0,-50,view) + Cursor(Pan,0,-50,view) +
e +   + DeleteRats(AllRats) + DeleteRats(AllRats) +
shift + DeleteRats(SelectedRats) + DeleteRats(SelectedRats) +
enter +   + Mode(Notify) + Mode(Notify) +
escape +   + Mode(Cancel) + Mode(Escape) +
f +   + Connection(Reset) + Connection(Reset) +
alt-shift +   + ReplaceFootprint() +
ctrl + Connection(Find) + Connection(Find) +
shift + Display(Redraw) + Display(Redraw) +
f1 +   + Mode(Via) + Mode(Via) +
f10 +   + Mode(Thermal) + Mode(Thermal) +
f11 +   + Mode(Arrow) + Mode(Arrow) +
f12 +   + Mode(Lock) + Mode(Lock) +
f2 +   + Mode(Line) + Mode(Line) +
f3 +   + Mode(Arc) + Mode(Arc) +
f4 +   + Mode(Text) + Mode(Text) +
f5 +   + Mode(Rectangle) + Mode(Rectangle) +
f6 +   + Mode(Polygon) + Mode(Polygon) +
f7 +   + Mode(PasteBuffer) + Mode(PasteBuffer) +
shift + PasteBuffer(Rotate,1) + PasteBuffer(Rotate,1) +
f8 +   + Mode(Remove) + Mode(Remove) +
f9 +   + Mode(Rotate) + Mode(Rotate) +
g +   + SetValue(Grid,+5,mil) + SetValue(Grid,+5,mil) +
ctrl + SetValue(Grid,+0.05,mm) + SetValue(Grid,+0.05,mm) +
ctrl-shift + SetValue(Grid,-0.05,mm) + SetValue(Grid,-0.05,mm) +
shift + SetValue(Grid,-5,mil) + SetValue(Grid,-5,mil) +
h +   + ToggleHideName(Object) + ToggleHideName(Object) +
ctrl + ChangeHole(Object) + ChangeHole(Object) +
shift + ToggleHideName(SelectedElements) + ToggleHideName(SelectedElements) +
i +   +   + DoWindows(Library) +
insert +   + Mode(InsertPoint) + Mode(InsertPoint) +
j +   + ChangeJoin(Object) + ChangeJoin(Object) +
shift + ChangeJoin(SelectedObjects) + ChangeJoin(SelectedObjects) +
k +   + ChangeClearSize(Object,+2,mil) + ChangeClearSize(Object,+2,mil) +
ctrl + ChangeClearSize(SelectedObjects,+2,mil) + ChangeClearSize(SelectedObjects,+2,mil) +
ctrl-shift + ChangeClearSize(SelectedObjects,-2,mil) + ChangeClearSize(SelectedObjects,-2,mil) +
shift + ChangeClearSize(Object,-2,mil) + ChangeClearSize(Object,-2,mil) +
l +   + SetValue(LineSize,+5,mil) + SetValue(LineSize,+5,mil) +
shift + SetValue(LineSize,-5,mil) + SetValue(LineSize,-5,mil) +
left +   + Cursor(Warp,-1,0,grid) + Cursor(Warp,-1,0,grid) +
shift + Cursor(Pan,-50,0,view) + Cursor(Pan,-50,0,view) +
m +   + MoveToCurrentLayer(Object) + MoveToCurrentLayer(Object) +
ctrl + MarkCrosshair() + MarkCrosshair() +
shift + MoveToCurrentLayer(Selected) + MoveToCurrentLayer(Selected) +
n +   + ChangeName(Object) + ChangeName(Object) +
alt +   + ChangeNonetlist(Element) +
ctrl + New() + New() +
ctrl-shift + Number) + Number) +
shift + AddRats(Close) + AddRats(Close) +
o +   + Atomic(Block) + Atomic(Block) +
ctrl + ChangeOctagon(Object) + ChangeOctagon(Object) +
shift + Atomic(Save) + Atomic(Save) +
p +   + Polygon(PreviousPoint) + Polygon(PreviousPoint) +
alt + ManagePlugins() + ManagePlugins() +
ctrl + AutoPlaceSelected() + AutoPlaceSelected() +
ctrl-shift + Display(ToggleThindrawPoly) + Display(ToggleThindrawPoly) +
shift + Polygon(Close) + Polygon(Close) +
q +   + ChangeSquare(Object) + ChangeSquare(ToggleObject) +
ctrl + Quit() + Quit() +
r +   + Report(NetLength) +   +
alt + AutoRoute(SelectedRats) + AutoRoute(SelectedRats) +
ctrl + ReportObject() + ReportObject() +
shift + Redo() + Redo() +
right +   + Cursor(Warp,1,0,grid) + Cursor(Warp,1,0,grid) +
shift + Cursor(Pan,50,0,view) + Cursor(Pan,50,0,view) +
s +   + ChangeSize(Object,+5,mil) + ChangeSize(Object,+5,mil) +
alt + ChangeDrillSize(Object,+5,mil) + ChangeDrillSize(Object,+5,mil) +
alt-shift + ChangeDrillSize(Object,-5,mil) + ChangeDrillSize(Object,-5,mil) +
ctrl + Save(Layout) + Save(Layout) +
ctrl-shift + Save(LayoutAs) + Save(LayoutAs) +
shift + ChangeSize(Object,-5,mil) + ChangeSize(Object,-5,mil) +
space +   + Mode(Arrow) + Mode(Arrow) +
t +   + SetValue(TextScale,+10,mil) + SetValue(TextScale,+10,mil) +
shift + SetValue(TextScale,-10,mil) + SetValue(TextScale,-10,mil) +
tab +   + SwapSides(V) + SwapSides(V) +
ctrl + SwapSides(R) + SwapSides(R) +
ctrl-shift + SwapSides() + SwapSides() +
shift + SwapSides(H) + SwapSides(H) +
u +   + Undo() + Undo() +
ctrl-shift + Undo(ClearList) + Undo(ClearList) +
up +   + Cursor(Warp,0,1,grid) + Cursor(Warp,0,1,grid) +
shift + Cursor(Pan,0,50,view) + Cursor(Pan,0,50,view) +
v +   + Zoom() + Zoom() +
alt + SetValue(ViaDrillingHole,+5,mil) + SetValue(ViaDrillingHole,+5,mil) +
alt-shift + SetValue(ViaDrillingHole,-5,mil) + SetValue(ViaDrillingHole,-5,mil) +
ctrl + Mode(PasteBuffer) + Mode(PasteBuffer) +
ctrl-shift + SetValue(ViaSize,-5,mil) + SetValue(ViaSize,-5,mil) +
shift + SetValue(ViaSize,+5,mil) + SetValue(ViaSize,+5,mil) +
w +   + AddRats(AllRats) + AddRats(AllRats) +
shift + AddRats(SelectedRats) + AddRats(SelectedRats) +
x +   +   + CycleDrag() +
ctrl + Mode(PasteBuffer) + Mode(PasteBuffer) +
shift +   + net(swap) +
y +   + Puller() + Puller() +
shift + ChangeSizes(Object,style,mil); + ChangeSizes(Object,style,mil); +
z +   + Zoom(-1.2) + Zoom(-1.2) +
alt + Undo() +   +
shift + Zoom(+1.2) + Zoom(+1.2) +
| +   + Display(ToggleThindraw) + Display(ToggleThindraw) +
+ Index: 1.0.8/doc-rnd/mincut.html =================================================================== --- 1.0.8/doc-rnd/mincut.html (nonexistent) +++ 1.0.8/doc-rnd/mincut.html (revision 1136) @@ -0,0 +1,47 @@ + + +

pcb-rnd - the [mincut] patch

+ +The original code was highlighting pins/pads only when a short came around +after rats nest optimization. This was not very helpful on a complex board. +There had been a long discussion on the mailing list about the best solutions. +There were a few very good ideas, including: +
    +
  • manual tagging of objects (lines, polys, arcs, vias) with net and warn + where two differently tagged net connects +
  • automatic tagging based on "where it was connected first", then the same + warning mechanism as above +
  • trace history (using the undo buffer?) and go back until when it was + not broken, check what exactly broke it +
  • history combined with tagging +
  • calculate minimal cut +
+

+I choose minimal cut for my patch because it doesn't require tracing the +full history or any manual administration of nets vs. objects (which I +would find inevitable even with manual tagging - directly or indirectly +the user needs to be able to change net tags). +

+The minimal cut is the least amount of object whose removal would resolve +the short. It is best demonstrated on an example: +

+ +

+Removing all the marked lines/polys/vias would surely resolve the short +(sometimes leaving rat lines behind). Minimal cut is better than randomly +removing objects, tho: it guarantees that the minimal amount of objects +are to be removed. On a complex board, this place is likely to be close +to the place where the problem really is - much closer than the pins/pads. +

+Since mincut can be expensive on large boards, the feature can be enabled +per board (a new PCB flag) and can be disbaled globally (--enable-mincut 0 +when starting PCB). + +

save/load and compatibility

+New PCB flag enablemincut. Vanilla pcb ignores this flag but does not +preserve it. + +

plans

+Finished, no plans. + + Index: 1.0.8/doc-rnd/mincut.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/mincut.png =================================================================== --- 1.0.8/doc-rnd/mincut.png (nonexistent) +++ 1.0.8/doc-rnd/mincut.png (revision 1136) Property changes on: 1.0.8/doc-rnd/mincut.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/misc/install_cgi.html =================================================================== --- 1.0.8/doc-rnd/misc/install_cgi.html (nonexistent) +++ 1.0.8/doc-rnd/misc/install_cgi.html (revision 1136) @@ -0,0 +1,45 @@ + + +

Installation of the footprint CGIs

+

system requirements, 3rd party software

+ The following software needs to be installed on the system + that will host the scripts: +
    +
  • /bin/bash (did not test with POSIX shell) +
  • awk (tested with gawk, may work with other modern implementation) +
  • common binutils, e.g. ls, find +
  • animator, the svn HEAD version; NOTE: it is possible to manually compile animator into a static executable (useful on dedicated web servers) +
  • a web server that can execute plain old CGI scripts +
  • a full checkout of pcb-rnd/trunk from svn://repo.hu/pcb-rnd/trunk +
+ +

Installation

+Since the CGIs are just demo scripts for repo.hu and are not really installed +anywhere else normally, there is no install script but a manual installation +process. For both the parametric and the static footprint CGI: +
    +
  1. check out pcb-rnd/trunk in a directory readable (but not writable) by www-data (or whatever user the CGI will run with) +
  2. copy the config file pcblib.cgi.conf from pcb-rnd/trunk/util to /etc +
  3. edit the config file; ignore setting sdir for now +
  4. hardlink, copy, or wrap the cgi files from under pcb-rnd/trunk/util into the web server's CGI directory +
+

+For the static footprint CGI (set up the map cache): +

    +
  1. cd to trunk/util/pcblib-map in the checkout and run make - NOTE: some awk scripts have hardwired CGI paths yet (TODO) +
  2. copy this directory to a web-accessible directory +
  3. set sdir to the absolute path of the web-accessible copy in /etc/pcblib.cgi.conf +
+ +

Tips and tricks

+

cgi wrapping

+Making the checkout directly into the cgi-bin dir is not a good idea. Using +a hard link on each CGI between the checkout and the cgi-bin dir is better, +but an svn up will silently break the link leaving the old version live. +The most stable solution is placing a wrapper script in the cgi-bin dir: +
+#!/bin/bash
+. /full/path/to/the/checkout/util/pcblib-param.cgi
+
+ + Index: 1.0.8/doc-rnd/mods/after.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/mods/after.png =================================================================== --- 1.0.8/doc-rnd/mods/after.png (nonexistent) +++ 1.0.8/doc-rnd/mods/after.png (revision 1136) Property changes on: 1.0.8/doc-rnd/mods/after.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/mods/before.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/mods/before.png =================================================================== --- 1.0.8/doc-rnd/mods/before.png (nonexistent) +++ 1.0.8/doc-rnd/mods/before.png (revision 1136) Property changes on: 1.0.8/doc-rnd/mods/before.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/mods/gen.sh =================================================================== --- 1.0.8/doc-rnd/mods/gen.sh (nonexistent) +++ 1.0.8/doc-rnd/mods/gen.sh (revision 1136) @@ -0,0 +1,128 @@ +#!/bin/sh + +path=../../src_plugins + +sloc() +{ + (cd "$1" && sloccount .) | awk '/^Total Phys/ { size=$9; sub(",", "", size); print size }' +} + +gen_pie() +{ + local bn=$1 code_size=$2 color=$3 + echo "" + echo "@slice" + echo "$code_size" + echo "@label" + echo "$bn ($code_size)" + if test ! -z "$color" + then + echo "@color" + echo "$color" + fi +} + +echo "#autogenerated by gen.sh" > mods.pie +echo "#autogenerated by gen.sh" > after.pie + +echo HIDs >&2 +code_size=`sloc ../../src/hid` +gen_pie "HIDs" $code_size "orangered" >> after.pie + +echo Core >&2 +tmp=/tmp/pcb-mods-stat +mkdir $tmp +cp -r ../../src/*.c ../../src/*.h ../../src/Makefile* $tmp +code_size=`sloc $tmp` +gen_pie "core" $code_size "#00ff88" >> after.pie + +#echo 3rd >&2 +#code_size=`sloc ../../src_3rd` +#gen_pie "3rd" $code_size >> after.pie + + +( +cat pre.html +for n in $path/* +do + if test -d "$n" + then + echo $n >&2 + bn=`basename $n` + code_size=`sloc $n` + total=$(($total + $code_size)) + gen_pie $bn $code_size >> mods.pie +# case $bn in +# gpmi) echo "@pull" >> mods.pie; echo "0.1" >> mods.pie;; +# esac + + echo "
$bn$code_size" + awk ' + /^#/ { + key=$1 + sub("#", "", key) + sub("[:=]", "", key) + $1="" + DB[key]=$0 + next + } + { desc = desc " " $0 } + + function strip(s) { + sub("^[ \t]*", "", s) + sub("[ \t]*$", "", s) + return s + } + + END { + st = DB["state"] + if (st ~ "partial") + clr = "bgcolor=\"yellow\"" + else if (st ~ "works") + clr = "bgcolor=\"lightgreen\"" + else if ((st ~ "fail") || (st ~ "disable")) + clr = "bgcolor=\"red\"" + else + clr="" + + clr2 = clr + if (clr2 != "") { + sub("bgcolor=\"", "", clr2) + sub("\"", "", clr2) + print "@color" >> "mods.pie" + print clr2 >> "mods.pie" + } + + print "" st + if (DB["lstate"] != "") + print "
(" strip(DB["lstate"]) ")" + + dfl = DB["default"] + if (dfl ~ "buildin") + clr = "bgcolor=\"lightgreen\"" + else if (dfl ~ "plugin") + clr = "bgcolor=\"yellow\"" + else if ((dfl ~ "fail") || (dfl ~ "disable")) + clr = "bgcolor=\"red\"" + else + clr="" + + print "
" dfl + if (DB["ldefault"] != "") + print "
(" strip(DB["ldefault"]) ")" + print "
" desc + } + ' < $n/README + fi +done +cat post.html +gen_pie "plugins" "$total" "#0088ff" >> after.pie +) > index.html + +for n in mods after +do + animpie < $n.pie | animator -H -d $n + pngtopnm ${n}0000.png | pnmcrop | pnmtopng > $n.png + rm ${n}0000.png +done + Property changes on: 1.0.8/doc-rnd/mods/gen.sh ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/doc-rnd/mods/index.html =================================================================== --- 1.0.8/doc-rnd/mods/index.html (nonexistent) +++ 1.0.8/doc-rnd/mods/index.html (revision 1136) @@ -0,0 +1,123 @@ + + +

pcb-rnd modularization

+

Why bother...

+I believe good software should be modular. This is especially important in +the context of large software, such as CAD applications. There should be +a thin core that can model the world and provide the basic operations defined +on it but anything else should go in separate modules. +

+Fortunately PCB already had a strong infrastructure supporting this idea. +It has dynamic loadable plugins and the GUI and exporters are in separate +HID modules. While working on pcb-gpmi and later pcb-rnd, I added the +gpmi module as a separate plugin. +

+As of version 1.0.8 a cosiderable chunk of core code has been moved into +core plugins. A core plugin is just a plugin that is +maintained together with the core, in the same repository, still the code is +somewhat detached from the core. More importantly, the user can choose, for +each plugin, separately: +

    +
  • to compile it as a buildin (static-link it into the pcb executable) +
  • to compile it as a plugin (dynamic-link it runtime, if the .so is installed in the plugins/ directory) +
  • to disable the plugin, so it is not compiled at all +
+

+I believe such modularization has benefits on multiple levels: +

    +
  • it is possible to compiler smaller, potentially faster executables by omitting features the specific user would never use anyway +
  • in a distribution dynamic-link plugins can be distributed as separate packages providing the user with the option to decide what features to install +
  • such plugins have to have some sort of APIs if they want to reference eachother or if the code needs to reference them; such an API may not (and often did not) exist when the code is part of the core +
+ +

Progress in charts

+

Before-after

+All numbers are in SLOC +and are acquired running sloccount on the given directory. While lines of +code alone is not a true measure of complexity, it's a good estimation. The +slices of pie charts are the major components of the pcb-rnd executable. +
+ +
        +
Before modularization: pcb-rnd version 1.0.7 +
Note: gpmi was already a plugin +
+ After modularization: pcb-rnd version 1.0.8 +
Note: gpmi is part of the "plugins" slice +
+
+

Zooming on to the plugins

+

+ +

+(Red means the plugin doesn't really work). + +

Progress in numbers

+Below is a table with the summary of core plugins. + +
module size [sloc] status configure
default
description + + +
autoplace604 + works + buildin + Automatically place elements. +
autoroute4172 + works + buildin + Automatically route selected or all rats. This is the original autorouter. +
dbus438 + disabled +
(TODO: needs scconfig support) +
disabled + Remote control PCB using DBUS. +
djopt2312 + works + buildin + Various board optimization algorithms. +
edif3575 + works + buildin + Import code for netlists in the EDIF format. +
gpmi2688 + works + buildin +
(if gpmi is installed) +
Scriptable plugin system with about 10 scripting languages supported and dynamic load/unload of scripts that can manipulate the GUI, the board, can implement exporters, etc. +
import_sch252 + works + buildin + Imports element and netlist data from the schematics (or some other source). +
mincut884 + works + buildin + Use the minimal cut algorithm to indicate shorts: instead of highlighting two random pins/pads, try to highlight the least number of objects that connect the two networks. +
oldactions50 + works + disabled + Random collection of old/obsolete actions. Bell(): audible feedback; DumpLibrary(): print footprint library on stdout +
puller1876 + works + buildin + Pull traces to minimize their length. +
renumber212 + works + buildin + Renumber elements (renaming them) and generate a text file for back annotation. +
stroke123 + partially works (doesn't work with lesstif; works with the gtk hid, but there's no zoom bindings) + disabled +
(requires libstroke installed) +
Gesture recognition with libstroke. +
toporouter6159 + fails +
(infinite loop in gts) +
disabled + Automatically route selected or all rats using a topological algorithm. This is the new autorouter from 2009. +
vendordrill564 + works + buildin + Vendor drill mapping. +
+ + Index: 1.0.8/doc-rnd/mods/mods.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/mods/mods.png =================================================================== --- 1.0.8/doc-rnd/mods/mods.png (nonexistent) +++ 1.0.8/doc-rnd/mods/mods.png (revision 1136) Property changes on: 1.0.8/doc-rnd/mods/mods.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/mods/post.html =================================================================== --- 1.0.8/doc-rnd/mods/post.html (nonexistent) +++ 1.0.8/doc-rnd/mods/post.html (revision 1136) @@ -0,0 +1,3 @@ +
+ + Index: 1.0.8/doc-rnd/mods/pre.html =================================================================== --- 1.0.8/doc-rnd/mods/pre.html (nonexistent) +++ 1.0.8/doc-rnd/mods/pre.html (revision 1136) @@ -0,0 +1,60 @@ + + +

pcb-rnd modularization

+

Why bother...

+I believe good software should be modular. This is especially important in +the context of large software, such as CAD applications. There should be +a thin core that can model the world and provide the basic operations defined +on it but anything else should go in separate modules. +

+Fortunately PCB already had a strong infrastructure supporting this idea. +It has dynamic loadable plugins and the GUI and exporters are in separate +HID modules. While working on pcb-gpmi and later pcb-rnd, I added the +gpmi module as a separate plugin. +

+As of version 1.0.8 a cosiderable chunk of core code has been moved into +core plugins. A core plugin is just a plugin that is +maintained together with the core, in the same repository, still the code is +somewhat detached from the core. More importantly, the user can choose, for +each plugin, separately: +

    +
  • to compile it as a buildin (static-link it into the pcb executable) +
  • to compile it as a plugin (dynamic-link it runtime, if the .so is installed in the plugins/ directory) +
  • to disable the plugin, so it is not compiled at all +
+

+I believe such modularization has benefits on multiple levels: +

    +
  • it is possible to compiler smaller, potentially faster executables by omitting features the specific user would never use anyway +
  • in a distribution dynamic-link plugins can be distributed as separate packages providing the user with the option to decide what features to install +
  • such plugins have to have some sort of APIs if they want to reference eachother or if the code needs to reference them; such an API may not (and often did not) exist when the code is part of the core +
+ +

Progress in charts

+

Before-after

+All numbers are in SLOC +and are acquired running sloccount on the given directory. While lines of +code alone is not a true measure of complexity, it's a good estimation. The +slices of pie charts are the major components of the pcb-rnd executable. +
+ +
        +
Before modularization: pcb-rnd version 1.0.7 +
Note: gpmi was already a plugin +
+ After modularization: pcb-rnd version 1.0.8 +
Note: gpmi is part of the "plugins" slice +
+
+

Zooming on to the plugins

+

+ +

+(Red means the plugin doesn't really work). + +

Progress in numbers

+Below is a table with the summary of core plugins. + +
module size [sloc] status configure
default
description + + Index: 1.0.8/doc-rnd/motivation.html =================================================================== --- 1.0.8/doc-rnd/motivation.html (nonexistent) +++ 1.0.8/doc-rnd/motivation.html (revision 1136) @@ -0,0 +1,58 @@ + + +

pcb-rnd motivation

+I use PCB a lot on various computers. I used to try to join the mainstream +development with small contribution (minor patches) and was active on +IRC and the mailing lists for a while. However, it didn't work out well, +and: +
    +
  • PCB already knew 95% of everything I'd ever need years ago +
  • the remaining 5% was not on the TODO list of developers and generally no one shown much interest in getting patches for those +
  • meanwhile a lot of new features have been added, from which most I find totally useless: +
      +
    • dbus +
    • gl - transparency makes even simple 2 sided boards unusable; slower than the classic version sw render on all my computers +
    • preparation for a C++ transition +
    +
  • the official Debian package enables (requires, depends on) both dbus and gl +
  • DVCS - it almost always results in chaos, and has no benefit for such a small group of developers; there are posts from time to time on the mailing list about how to handle the chaos; my choice is to stick with a simple, centralized version control system +
  • DVCS always results in increased administration, which I hate to spend my time on - I'd rather invest the time in bugfixing, documentation or implementing new features +
  • it's nearly impossible to get small patches applied^1: +
      +
    • often no one has the time to revise and commit them +
    • communication requires web2.0 +
    • there are too many cycles of "please fix this and change that first" +
    • with the chaos VCS, it's too likely that new feature patches would require ongoing maintenance to avoid that a large scale merge (or rebase, whatever) of another feature branch breaks it +
    • there are too much pondering and too less prototyping; there are features that are being considered for years (for example back annotation, internal connections) with multiple concurrent ideas, but no code. Instead, I'd like to implement some code from the early phase of the idea, test it, and deprecate it if it didn't work out well. +
    +
  • I don't even dream about getting larger patches in the official release^1 +
  • no stable release for years; maintaining a set of patches (like pcb-gpmi) and porting them to new releases is too much hassle +
+I was pondering a fork for years. The trigger was that one day I've upgraded +Debian on my lab computer and the new version of PCB came with gl enabled; this +made PCB absolutely unusable (had to wait like 10 seconds for a scroll) while +all the transparent polys over traces made the whole screen a mess. I should +have recompiled everything and built a new Debian package with gl disabled or +install from source (but I have too many computers for that). My decision +was to set up my own .deb but then build it from a fork (it's not much of +an extra effort), so I can add some of the features I miss in daily use. +My plans with this fork: +
    +
  • I stick with my fork and will use it on all my computers for all my designs +
  • Because of that, there's no emphasis on keeping the file formats compatible +
  • I won't actively seek ways to get my changes into the mainstream; I will keep on using my svn repo in a manner that (as a side effect) makes such merges easier, tho. If PCB developers decide to pick them up from svn and merge them in the official repo, it's fine (but I personally will keep using my fork anyway). +
  • Most probably I won't merge anything back from the mainstream to my fork - the past few years showed that it's unlikely there would be new features I'd need +
  • plans for new features: +
      +
    • pin shapes (a preliminary version is already implemented) +
    • 1206 jumpers without having to add them on the schematics/netlist (done: [intconn] and [nonetlist] are the PCB-side features for this) +
    • merge pcb-gpmi; GPMI would be an optional addon, it'd probably stay a plugin, but there should not be a separate repo (done) +
    +
+

+Footnotes: +

    +
  • ^1: this may have changed lately and pcb developers are more open to newcomers +
+ + Index: 1.0.8/doc-rnd/negselect.html =================================================================== --- 1.0.8/doc-rnd/negselect.html (nonexistent) +++ 1.0.8/doc-rnd/negselect.html (revision 1136) @@ -0,0 +1,23 @@ + + +

pcb-rnd - the [cycdrag] patches, negative box select

+ +When a selection is made using drag&drop (box selection), depending +on the direction the rule for object selection differ: +
    +
  • drag from top-right towards bottom-left (positive sized box): + select objects that are fully contained in the box (original behaviour) +
  • drag from bottom-left towards top-right (negative sized box): + select objects that are even partially within the box or merely touch + the edge of the box +
+ +

save/load and compatibility

+Not affected. + +

plans

+Work more on some rough corners of the negative direction: e.g. pads are +handled as 0 width lines so the selection has to hit the center. + + + Index: 1.0.8/doc-rnd/nonetlist.html =================================================================== --- 1.0.8/doc-rnd/nonetlist.html (nonexistent) +++ 1.0.8/doc-rnd/nonetlist.html (revision 1136) @@ -0,0 +1,53 @@ + + +

pcb-rnd - the [nonetlist] patch

+ +The [nonetlist] patch adds an element flag that makes PCB ignore the marked +element when dealing with netlists. This means connecting a net to a pin of +a nonetlist element will not cause a short. The refdes of a nonetlist +part is drawn with color element-color-nonetlist (ElementColor_nonetlist +in the source; default value #777777, grey). +

+Uses of the nonetlist feature: +

    +
  • smd jumper: Combined with the [intconn] patch, this + solves the "0-ohm 1206 jumper" problem: the element should be marked + as nonetlist, with both pins set intconn(1) - this will result in a 2 + pad element, pads internally connected, that can be part of any one network + without causing short. +
  • mechanical parts that should not show up on the schematics: +
      +
    • mounting hole elements: single pin holes with silk marking the head of the screw +
    • chassis (often with mounting holes or keep-out areas) +
    • logos in footprints (no poly support in footprint - yet?) +
    • mechanical parts which do not have solderable pins (plastic spacers, extra connector shields) +
    • "spare parts", e.g. unused/disconnected DIP sockets or pin grids or connectors in a corner of the PCB for prototyping (dev-board style) +
    +
+

+Preservation: gsch2pcb-rnd leaves nonetlist elements in the PCB. +

save/load and compatibility

+This patch introduces a new element flag. The following example demonstrates +a 1206 jumper footprint: +
+Element["nonetlist" "1206 jumper, 0 ohm" "" "1206" 0 0 -3150 -3150 0 100 ""]
+(
+	Pad[-5905 -1181 -5905 1181 5118 2000 5718 "1" "1" "square,intconn(1)"]
+	Pad[5905 -1181 5905 1181 5118 2000 5718 "2" "2" "square,intconn(1)"]
+	ElementLine[-2362 -3740 2362 -3740 800]
+	ElementLine[-2362 3740 2362 3740 800]
+)
+
+Vanilla PCB will load the design ignoring internal connections and nonetlist +flag - this will cause shorts on all connected pins/pads and will break +the connection. +

+Vanilla PCB doesn't save nonetlist and elements are embedded in the file - +once the design is loaded and saved with vanilla PCB, the flag is lost. +After reloading the file in pcb-rnd, the element causes the same shorts +as in vanilla PCB. + +

plans

+No plans, the feature is complete. + + Index: 1.0.8/doc-rnd/onpoint.html =================================================================== --- 1.0.8/doc-rnd/onpoint.html (nonexistent) +++ 1.0.8/doc-rnd/onpoint.html (revision 1136) @@ -0,0 +1,50 @@ + + +

pcb-rnd - the [onpoint] patches

+ +Robert Drehmel writes: +
+When (e.g.) routing 5mm power traces on a small grid, it's not always easy to hit the
+point where the trace ended (which is the center of the semicircle at the end of the
+line) to start the next line.  If you have selected the line tool, finding the end of
+the line can become guesswork as the cursor doesn't change shape like it does with the
+select tool.
+I want my traces to consist of lines and arcs that are perfectly connected and I want
+to work as fast as possible.
+
+Attached is a small patch that
+
+  - makes it possible to deactivate snapping to "some sensible point along a line".
+    (that's what a comment in the code says). This snapping algorithm gets in the way
+    sometimes so you have to slowly go over a line to find out where it really ends,
+    bouncing back and forth between the points of the small grid, the end of the line
+    and these "sensible points", which is wasting time. The command is
+    "Display(ToggleSnapOffGridLine)". It is still activated by default to avoid
+    violating POLA.
+
+  - more importantly, introduces a new command called "Display(ToggleHighlightOnPoint)"
+    that highlights all lines and arcs which have (end)points exactly on the position
+    where the cross hair is currently snapped to. It therefore helps finding the end
+    points of lines and arcs, but sometimes also shows redundant traces, traces that
+    aren't perfectly connected to each other, traces that don't end directly on the
+    center of a via but should, etc. It works with thin draw too and I tested it with
+    gtk and lesstif.
+
+I use the second option mostly in conjunction with deactivating the first. Both commands
+have been added to the menu by means of (g)pcb-menu.res.in and are available as command
+line options as well.
+Caveats:
+  - The HID API expects all HIDs to make a copy of the color string when setting a color.
+  - The function that lightens up a color could be improved.
+  - I used it for a while, but after porting it from my local fork, it probably needs
+    more testing.
+
+ +

save/load and compatibility

+Not affected. + +

plans

+The feature is complete. + + + Index: 1.0.8/doc-rnd/pcb-fp.html =================================================================== --- 1.0.8/doc-rnd/pcb-fp.html (nonexistent) +++ 1.0.8/doc-rnd/pcb-fp.html (revision 1136) @@ -0,0 +1,36 @@ + + +

pcb-rnd - the [pcb-fp] patch

+ +Pcb-fp is an effort to clean up the footprint situation: +
    +
  • replace lib and newlib with pcblib, a library that tries to provide common footprints only +
  • clear the syntax: if a footprint name contains parenthesis, it's generated (parametric footprint), else it's the name of a static footprint file +
  • parametric footprints: replace m4 with a generic, language-independent footprint generator framework +
      +
    • implement libpcb_fp, which centralizes searching and loading footprints +
    • fork gsch2pcb to gsch2pcb-rnd that uses libpcb_fp (and does not have any m4 references hardwired) +
    • fork gnet_gsch2pcb.scm (the gnetlist backend) to remove m4 heuristics +
    +
+ +

Example

+Intaractive parametric footprint selection in pcb-rnd: +

+ +

+An online footprint generator web1.0 version is also available. + +

save/load and compatibility

+Save/load files are not affected. If a schematics is written for the new +library and depends on parametric footprints: +
    +
  • vanilla gsch2pcb won't find those footprints +
  • vanilla pcb won't show those footprints in the footprint selection dialog +
+ +

plans

+No plans - this feature is fully implemented. + + + Index: 1.0.8/doc-rnd/pcb-fp.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/pcb-fp.png =================================================================== --- 1.0.8/doc-rnd/pcb-fp.png (nonexistent) +++ 1.0.8/doc-rnd/pcb-fp.png (revision 1136) Property changes on: 1.0.8/doc-rnd/pcb-fp.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/pcblib.html =================================================================== --- 1.0.8/doc-rnd/pcblib.html (nonexistent) +++ 1.0.8/doc-rnd/pcblib.html (revision 1136) @@ -0,0 +1,49 @@ + + +

pcb-rnd - the [pcblib] and [pcblib-param] patches

+ +
+The footprint library shipped with vanilla pcb is cluttered with +special puprose parts. I believe PCB encourages the user from +an early stage to build his own library. Thus the purpose of +the library shipped with PCB should be +to provide a minimal collection of real essential footprints ... +
    +
  • ... for the very beginning of the learning curve; +
  • ... and to be the core of the user's own library later. +
+

+[pcblib] is a replacement of newlib/ and lib/ and the m4 macros with +such an essential core library of static footprints ("file elements") +and easier-to-use parametric footprints. +

+There is an online map of +the library and +an online interface to the parametric footprint generators. + +

Design decisions

+Parts are sorted only in a few directories: smd, tru-hole, connector and +parametric. I believe there are so many orthogonal properties of footpritns +that there's no obvious hierarchy. Also, pcblib contains much fewer footpritns +than newlib so it should be still easy to navigate. +

+Parametric footprints are in a separate directory for now, even tho they +would fit under smd, tru-hole or connector. The reason is purely historical +and the layout may change in the future. + +

Example

+To the right: Footprint selection dialog on pcblib, with the smd directory +open. Note how few smd parts are there. Still, smd/ is the most crowded +subdirectory! + +

save/load and compatibility

+Not affected: elements are embedded in the PCB. + +

plans

+None, the feature is complete. +
            + + +
+ + Index: 1.0.8/doc-rnd/pcblib.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/pcblib.png =================================================================== --- 1.0.8/doc-rnd/pcblib.png (nonexistent) +++ 1.0.8/doc-rnd/pcblib.png (revision 1136) Property changes on: 1.0.8/doc-rnd/pcblib.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/polygrid.html =================================================================== --- 1.0.8/doc-rnd/polygrid.html (nonexistent) +++ 1.0.8/doc-rnd/polygrid.html (revision 1136) @@ -0,0 +1,17 @@ + + +

pcb-rnd - the [polygrid] patch

+ +Polygrid adds an option to the ps exporter to fill polygons with a grid +of horizontal and vertical lines instead of full fill. When toner transfer +is used or test prints are produced, the grid may save some toner. + +

save/load and compatibility

+Not affected. + +

plans

+Fix bugs. +

+No (feature) plans - this feature is fully implemented. + + Index: 1.0.8/doc-rnd/scconfig.html =================================================================== --- 1.0.8/doc-rnd/scconfig.html (nonexistent) +++ 1.0.8/doc-rnd/scconfig.html (revision 1136) @@ -0,0 +1,15 @@ + + +

pcb-rnd - the [scconfig] patch

+ +Pcb-rnd uses scconfig +for ./configure instead of autotools. Scconfig is smaller and easier +to maintain. + +

save/load and compatibility

+Not affected. + +

plans

+No plans - this feature is almost fully implemented. + + Index: 1.0.8/doc-rnd/settings.html =================================================================== --- 1.0.8/doc-rnd/settings.html (nonexistent) +++ 1.0.8/doc-rnd/settings.html (revision 1136) @@ -0,0 +1,31 @@ + + +

pcb-rnd - settings

+ +There are a few minor changes in default settings compared to mainline +pcb. + + + + + +
name + description + where to change + +
layers + the default layer stack is optimized for two sided boards with 3 layers on both sides + edit or replace /usr/share/pcb-rnd/default.pcb + +
styles & DRC + default styles and DRC settings are optimized for toner transfer + edit or replace /usr/share/pcb-rnd/default.pcb + +
grid + on startup "enable visible grid" is on and grid is set to 25 mil + grep "SET.* grid" main.c + +
+ + + Index: 1.0.8/doc-rnd/square.html =================================================================== --- 1.0.8/doc-rnd/square.html (nonexistent) +++ 1.0.8/doc-rnd/square.html (revision 1136) @@ -0,0 +1,71 @@ + + +

pcb-rnd - the [square] patch

+Most of my PCBs end up in toner transfer. There are a lot +of tricks around prototyping at home. One of the problems I often +face is small rings peeling off during rework (and rework tend to +happen on the first prototypes). The solution for this is increasing +ring size - which is not suitable if traces are passing between pins. +Another solution is to increase the area of the pin: +
    +
  • square pin: while it makes the pin slightly larger still letting traces pass between pins, it's too symmetrical and can not use up extra room +
  • DJ's teardrop plugin: this increases the area only toward the trace, whereas very often there's more room on the opposite side +
  • manually add an extra poly around the pin; with multiple pins it's hard to get the polys separate +
  • manually add a short extra track on the pin, width matching the size of the pin; this is very close, but increases workload when components are moved, layers are changed +
+ +

+The patch takes an octagon pin and stretches points in various directions. +There are 4 bits (for left, right, up and down) to indicate in which directions +the stretch applies. Pressing 'q' on a pin cycles thru round pin, square pin, +16 stretched octagons and the original octagon. +

+The code is also patched to handle clearances, shorts and connections (find.c). +

+Thermals are not fully working for funny shaped pins, but it has low priority: +they still work fine for rounded and square pins and if there is a poly around +the pin, I wouldn't use shaped pins anyway. + +

save/load and compatibility

+This patch introduces a new pin flag called shape(n), where n is an integer +selecting the shape of the pin when the square flag is also set: +
+Pin[40000 60000 6000 3000 6600 2800 "8" "8" "square,shape(3)"]
+
+Vanilla PCB will load the design ignoring the custom shape and will use a +square pin. As long a traces end in the center point of the pin, this +should not break connections. +

+Vanilla PCB doesn't save shape() - once the design is loaded and saved with +vanilla PCB pin shape info is lost. + +

plans

+In the original code there are separate code paths for round, octagonal and +square pins. The separation repeats for at least: +
    +
  • drawing the pin shape +
  • calculating the clearance +
  • checking whether things overlap or connect (pin vs pin, pin vs line, etc.) +
  • autorouter +
+In most cases a set of hardwired constants are written in the C code. A notable +exception was the octagon pin draw function, that had x and y offsets in a const +table for 8 points and a loop to create the poly (or line segments in thin draw). +

+The [square] feature is a good base for cleaning up the code a bit and for +moving toward a generic pin shape patch: +

    +
  • hardwired octagon calculations should be replaced to use the same x;y const offset table +
  • the table should be replaced by a struct that describes length (number of points) - alternatively use POLYAREA +
  • square pin should be renamed to polygon pin +
  • octagon flag shall be removed - it should be a configuration of the x;y const table +
  • square flag shall be removed - it should be a configuration +
  • the only flag remaining should be shape(); if a pin is not shaped, it's round +
  • the pin shape struct should have a field for compatibility - to mark the entry corresponding to the original square and octagon pins so PCB-rnd format can be converted to and from the vanilla PCB format. +
  • there should be a set of pin shapes in a default configuration table, including square and octagonal; these should be static +
  • the PCB file format should be extended with an option to expand the pin shape table with custom shapes +
  • UI: shapes could be imported (converted) from polys around vias +
  • UI: since there may be a lot of pin shapes, a GUI selector alternative shall be offered while also keeping the cycle-thru 'q' key +
+ + Index: 1.0.8/doc-rnd/square.pcb =================================================================== --- 1.0.8/doc-rnd/square.pcb (nonexistent) +++ 1.0.8/doc-rnd/square.pcb (revision 1136) @@ -0,0 +1,893 @@ +# release: pcb 20110918 + +# To read pcb files, the pcb version (or the git source date) must be >= the file version +FileVersion[20070407] + +PCB["" 130000 105000] + +Grid[2500.0 0 0 1] +Cursor[0 0 0.000000] +PolyArea[3100.006200] +Thermal[0.500000] +DRC[1000 1000 1000 1000 1500 1000] +Flags("nameonpcb,uniquename,clearnew") +Groups("1,c:2,s:3:4:5:6:7:8") +Styles["Signal,1500,6000,3150,2500:Power,3000,6000,3937,2500:Fat,8000,6000,3500,2500:Skinny,1200,2402,1181,2500"] + +Symbol[' ' 1800] +( +) +Symbol['!' 1200] +( + SymbolLine[0 4500 0 5000 800] + SymbolLine[0 1000 0 3500 800] +) +Symbol['"' 1200] +( + SymbolLine[0 1000 0 2000 800] + SymbolLine[1000 1000 1000 2000 800] +) +Symbol['#' 1200] +( + SymbolLine[0 3500 2000 3500 800] + SymbolLine[0 2500 2000 2500 800] + SymbolLine[1500 2000 1500 4000 800] + SymbolLine[500 2000 500 4000 800] +) +Symbol['$' 1200] +( + SymbolLine[1500 1500 2000 2000 800] + SymbolLine[500 1500 1500 1500 800] + SymbolLine[0 2000 500 1500 800] + SymbolLine[0 2000 0 2500 800] + SymbolLine[0 2500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 4000 800] + SymbolLine[1500 4500 2000 4000 800] + SymbolLine[500 4500 1500 4500 800] + SymbolLine[0 4000 500 4500 800] + SymbolLine[1000 1000 1000 5000 800] +) +Symbol['%' 1200] +( + SymbolLine[0 1500 0 2000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1000 1000 800] + SymbolLine[1000 1000 1500 1500 800] + SymbolLine[1500 1500 1500 2000 800] + SymbolLine[1000 2500 1500 2000 800] + SymbolLine[500 2500 1000 2500 800] + SymbolLine[0 2000 500 2500 800] + SymbolLine[0 5000 4000 1000 800] + SymbolLine[3500 5000 4000 4500 800] + SymbolLine[4000 4000 4000 4500 800] + SymbolLine[3500 3500 4000 4000 800] + SymbolLine[3000 3500 3500 3500 800] + SymbolLine[2500 4000 3000 3500 800] + SymbolLine[2500 4000 2500 4500 800] + SymbolLine[2500 4500 3000 5000 800] + SymbolLine[3000 5000 3500 5000 800] +) +Symbol['&' 1200] +( + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 1500 0 2500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 3500 1500 2000 800] + SymbolLine[500 5000 1000 5000 800] + SymbolLine[1000 5000 2000 4000 800] + SymbolLine[0 2500 2500 5000 800] + SymbolLine[500 1000 1000 1000 800] + SymbolLine[1000 1000 1500 1500 800] + SymbolLine[1500 1500 1500 2000 800] + SymbolLine[0 3500 0 4500 800] +) +Symbol[''' 1200] +( + SymbolLine[0 2000 1000 1000 800] +) +Symbol['(' 1200] +( + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 4500 800] +) +Symbol[')' 1200] +( + SymbolLine[0 1000 500 1500 800] + SymbolLine[500 1500 500 4500 800] + SymbolLine[0 5000 500 4500 800] +) +Symbol['*' 1200] +( + SymbolLine[0 2000 2000 4000 800] + SymbolLine[0 4000 2000 2000 800] + SymbolLine[0 3000 2000 3000 800] + SymbolLine[1000 2000 1000 4000 800] +) +Symbol['+' 1200] +( + SymbolLine[0 3000 2000 3000 800] + SymbolLine[1000 2000 1000 4000 800] +) +Symbol[',' 1200] +( + SymbolLine[0 6000 1000 5000 800] +) +Symbol['-' 1200] +( + SymbolLine[0 3000 2000 3000 800] +) +Symbol['.' 1200] +( + SymbolLine[0 5000 500 5000 800] +) +Symbol['/' 1200] +( + SymbolLine[0 4500 3000 1500 800] +) +Symbol['0' 1200] +( + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4000 2000 2000 800] +) +Symbol['1' 1200] +( + SymbolLine[0 1800 800 1000 800] + SymbolLine[800 1000 800 5000 800] + SymbolLine[0 5000 1500 5000 800] +) +Symbol['2' 1200] +( + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 2000 1000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 2500 800] + SymbolLine[0 5000 2500 2500 800] + SymbolLine[0 5000 2500 5000 800] +) +Symbol['3' 1200] +( + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 2800 1500 2800 800] + SymbolLine[2000 1500 2000 2300 800] + SymbolLine[2000 3300 2000 4500 800] + SymbolLine[2000 3300 1500 2800 800] + SymbolLine[2000 2300 1500 2800 800] +) +Symbol['4' 1200] +( + SymbolLine[0 3500 2000 1000 800] + SymbolLine[0 3500 2500 3500 800] + SymbolLine[2000 1000 2000 5000 800] +) +Symbol['5' 1200] +( + SymbolLine[0 1000 2000 1000 800] + SymbolLine[0 1000 0 3000 800] + SymbolLine[0 3000 500 2500 800] + SymbolLine[500 2500 1500 2500 800] + SymbolLine[1500 2500 2000 3000 800] + SymbolLine[2000 3000 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['6' 1200] +( + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[1500 2800 2000 3300 800] + SymbolLine[0 2800 1500 2800 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[2000 3300 2000 4500 800] +) +Symbol['7' 1200] +( + SymbolLine[500 5000 2500 1000 800] + SymbolLine[0 1000 2500 1000 800] +) +Symbol['8' 1200] +( + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 3700 0 4500 800] + SymbolLine[0 3700 700 3000 800] + SymbolLine[700 3000 1300 3000 800] + SymbolLine[1300 3000 2000 3700 800] + SymbolLine[2000 3700 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 2300 700 3000 800] + SymbolLine[0 1500 0 2300 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 2300 800] + SymbolLine[1300 3000 2000 2300 800] +) +Symbol['9' 1200] +( + SymbolLine[500 5000 2000 3000 800] + SymbolLine[2000 1500 2000 3000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 2500 800] + SymbolLine[0 2500 500 3000 800] + SymbolLine[500 3000 2000 3000 800] +) +Symbol[':' 1200] +( + SymbolLine[0 2500 500 2500 800] + SymbolLine[0 3500 500 3500 800] +) +Symbol[';' 1200] +( + SymbolLine[0 5000 1000 4000 800] + SymbolLine[1000 2500 1000 3000 800] +) +Symbol['<' 1200] +( + SymbolLine[0 3000 1000 2000 800] + SymbolLine[0 3000 1000 4000 800] +) +Symbol['=' 1200] +( + SymbolLine[0 2500 2000 2500 800] + SymbolLine[0 3500 2000 3500 800] +) +Symbol['>' 1200] +( + SymbolLine[0 2000 1000 3000 800] + SymbolLine[0 4000 1000 3000 800] +) +Symbol['?' 1200] +( + SymbolLine[1000 3000 1000 3500 800] + SymbolLine[1000 4500 1000 5000 800] + SymbolLine[0 1500 0 2000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 2000 800] + SymbolLine[1000 3000 2000 2000 800] +) +Symbol['@' 1200] +( + SymbolLine[0 1000 0 4000 800] + SymbolLine[0 4000 1000 5000 800] + SymbolLine[1000 5000 4000 5000 800] + SymbolLine[5000 3500 5000 1000 800] + SymbolLine[5000 1000 4000 0 800] + SymbolLine[4000 0 1000 0 800] + SymbolLine[1000 0 0 1000 800] + SymbolLine[1500 2000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 3000 3500 800] + SymbolLine[3000 3500 3500 3000 800] + SymbolLine[3500 3000 4000 3500 800] + SymbolLine[3500 3000 3500 1500 800] + SymbolLine[3500 2000 3000 1500 800] + SymbolLine[2000 1500 3000 1500 800] + SymbolLine[2000 1500 1500 2000 800] + SymbolLine[4000 3500 5000 3500 800] +) +Symbol['A' 1200] +( + SymbolLine[0 2000 0 5000 800] + SymbolLine[0 2000 700 1000 800] + SymbolLine[700 1000 1800 1000 800] + SymbolLine[1800 1000 2500 2000 800] + SymbolLine[2500 2000 2500 5000 800] + SymbolLine[0 3000 2500 3000 800] +) +Symbol['B' 1200] +( + SymbolLine[0 5000 2000 5000 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[2500 3300 2500 4500 800] + SymbolLine[2000 2800 2500 3300 800] + SymbolLine[500 2800 2000 2800 800] + SymbolLine[500 1000 500 5000 800] + SymbolLine[0 1000 2000 1000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 2300 800] + SymbolLine[2000 2800 2500 2300 800] +) +Symbol['C' 1200] +( + SymbolLine[700 5000 2000 5000 800] + SymbolLine[0 4300 700 5000 800] + SymbolLine[0 1700 0 4300 800] + SymbolLine[0 1700 700 1000 800] + SymbolLine[700 1000 2000 1000 800] +) +Symbol['D' 1200] +( + SymbolLine[500 1000 500 5000 800] + SymbolLine[1800 1000 2500 1700 800] + SymbolLine[2500 1700 2500 4300 800] + SymbolLine[1800 5000 2500 4300 800] + SymbolLine[0 5000 1800 5000 800] + SymbolLine[0 1000 1800 1000 800] +) +Symbol['E' 1200] +( + SymbolLine[0 2800 1500 2800 800] + SymbolLine[0 5000 2000 5000 800] + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 1000 2000 1000 800] +) +Symbol['F' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 1000 2000 1000 800] + SymbolLine[0 2800 1500 2800 800] +) +Symbol['G' 1200] +( + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[500 1000 2000 1000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 2000 5000 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[2500 3500 2500 4500 800] + SymbolLine[2000 3000 2500 3500 800] + SymbolLine[1000 3000 2000 3000 800] +) +Symbol['H' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[2500 1000 2500 5000 800] + SymbolLine[0 3000 2500 3000 800] +) +Symbol['I' 1200] +( + SymbolLine[0 1000 1000 1000 800] + SymbolLine[500 1000 500 5000 800] + SymbolLine[0 5000 1000 5000 800] +) +Symbol['J' 1200] +( + SymbolLine[700 1000 1500 1000 800] + SymbolLine[1500 1000 1500 4500 800] + SymbolLine[1000 5000 1500 4500 800] + SymbolLine[500 5000 1000 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 4500 0 4000 800] +) +Symbol['K' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 3000 2000 1000 800] + SymbolLine[0 3000 2000 5000 800] +) +Symbol['L' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 5000 2000 5000 800] +) +Symbol['M' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 1000 1500 3000 800] + SymbolLine[1500 3000 3000 1000 800] + SymbolLine[3000 1000 3000 5000 800] +) +Symbol['N' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 1000 2500 5000 800] + SymbolLine[2500 1000 2500 5000 800] +) +Symbol['O' 1200] +( + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['P' 1200] +( + SymbolLine[500 1000 500 5000 800] + SymbolLine[0 1000 2000 1000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 2500 800] + SymbolLine[2000 3000 2500 2500 800] + SymbolLine[500 3000 2000 3000 800] +) +Symbol['Q' 1200] +( + SymbolLine[0 1500 0 4500 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1500 1000 800] + SymbolLine[1500 1000 2000 1500 800] + SymbolLine[2000 1500 2000 4000 800] + SymbolLine[1000 5000 2000 4000 800] + SymbolLine[500 5000 1000 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[1000 3500 2000 5000 800] +) +Symbol['R' 1200] +( + SymbolLine[0 1000 2000 1000 800] + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[2500 1500 2500 2500 800] + SymbolLine[2000 3000 2500 2500 800] + SymbolLine[500 3000 2000 3000 800] + SymbolLine[500 1000 500 5000 800] + SymbolLine[1300 3000 2500 5000 800] +) +Symbol['S' 1200] +( + SymbolLine[2000 1000 2500 1500 800] + SymbolLine[500 1000 2000 1000 800] + SymbolLine[0 1500 500 1000 800] + SymbolLine[0 1500 0 2500 800] + SymbolLine[0 2500 500 3000 800] + SymbolLine[500 3000 2000 3000 800] + SymbolLine[2000 3000 2500 3500 800] + SymbolLine[2500 3500 2500 4500 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[500 5000 2000 5000 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['T' 1200] +( + SymbolLine[0 1000 2000 1000 800] + SymbolLine[1000 1000 1000 5000 800] +) +Symbol['U' 1200] +( + SymbolLine[0 1000 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[2000 1000 2000 4500 800] +) +Symbol['V' 1200] +( + SymbolLine[0 1000 1000 5000 800] + SymbolLine[1000 5000 2000 1000 800] +) +Symbol['W' 1200] +( + SymbolLine[0 1000 0 3000 800] + SymbolLine[0 3000 500 5000 800] + SymbolLine[500 5000 1500 3000 800] + SymbolLine[1500 3000 2500 5000 800] + SymbolLine[2500 5000 3000 3000 800] + SymbolLine[3000 3000 3000 1000 800] +) +Symbol['X' 1200] +( + SymbolLine[0 5000 2500 1000 800] + SymbolLine[0 1000 2500 5000 800] +) +Symbol['Y' 1200] +( + SymbolLine[0 1000 1000 3000 800] + SymbolLine[1000 3000 2000 1000 800] + SymbolLine[1000 3000 1000 5000 800] +) +Symbol['Z' 1200] +( + SymbolLine[0 1000 2500 1000 800] + SymbolLine[0 5000 2500 1000 800] + SymbolLine[0 5000 2500 5000 800] +) +Symbol['[' 1200] +( + SymbolLine[0 1000 500 1000 800] + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 5000 500 5000 800] +) +Symbol['\' 1200] +( + SymbolLine[0 1500 3000 4500 800] +) +Symbol[']' 1200] +( + SymbolLine[0 1000 500 1000 800] + SymbolLine[500 1000 500 5000 800] + SymbolLine[0 5000 500 5000 800] +) +Symbol['^' 1200] +( + SymbolLine[0 1500 500 1000 800] + SymbolLine[500 1000 1000 1500 800] +) +Symbol['_' 1200] +( + SymbolLine[0 5000 2000 5000 800] +) +Symbol['a' 1200] +( + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[2000 3000 2000 4500 800] + SymbolLine[2000 4500 2500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] +) +Symbol['b' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[2000 3500 2000 4500 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[0 3500 500 3000 800] +) +Symbol['c' 1200] +( + SymbolLine[500 3000 2000 3000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 2000 5000 800] +) +Symbol['d' 1200] +( + SymbolLine[2000 1000 2000 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] +) +Symbol['e' 1200] +( + SymbolLine[500 5000 2000 5000 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[0 4000 2000 4000 800] + SymbolLine[2000 4000 2000 3500 800] +) +Symbol['f' 1000] +( + SymbolLine[500 1500 500 5000 800] + SymbolLine[500 1500 1000 1000 800] + SymbolLine[1000 1000 1500 1000 800] + SymbolLine[0 3000 1000 3000 800] +) +Symbol['g' 1200] +( + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[0 6000 500 6500 800] + SymbolLine[500 6500 1500 6500 800] + SymbolLine[1500 6500 2000 6000 800] + SymbolLine[2000 3000 2000 6000 800] +) +Symbol['h' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 5000 800] +) +Symbol['i' 1000] +( + SymbolLine[0 2000 0 2100 1000] + SymbolLine[0 3500 0 5000 800] +) +Symbol['j' 1000] +( + SymbolLine[500 2000 500 2100 1000] + SymbolLine[500 3500 500 6000 800] + SymbolLine[0 6500 500 6000 800] +) +Symbol['k' 1200] +( + SymbolLine[0 1000 0 5000 800] + SymbolLine[0 3500 1500 5000 800] + SymbolLine[0 3500 1000 2500 800] +) +Symbol['l' 1000] +( + SymbolLine[0 1000 0 4500 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['m' 1200] +( + SymbolLine[500 3500 500 5000 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[1000 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 5000 800] + SymbolLine[2000 3500 2500 3000 800] + SymbolLine[2500 3000 3000 3000 800] + SymbolLine[3000 3000 3500 3500 800] + SymbolLine[3500 3500 3500 5000 800] + SymbolLine[0 3000 500 3500 800] +) +Symbol['n' 1200] +( + SymbolLine[500 3500 500 5000 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[1000 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 5000 800] + SymbolLine[0 3000 500 3500 800] +) +Symbol['o' 1200] +( + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[2000 3500 2000 4500 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['p' 1200] +( + SymbolLine[500 3500 500 6500 800] + SymbolLine[0 3000 500 3500 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[1000 3000 2000 3000 800] + SymbolLine[2000 3000 2500 3500 800] + SymbolLine[2500 3500 2500 4500 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[1000 5000 2000 5000 800] + SymbolLine[500 4500 1000 5000 800] +) +Symbol['q' 1200] +( + SymbolLine[2000 3500 2000 6500 800] + SymbolLine[1500 3000 2000 3500 800] + SymbolLine[500 3000 1500 3000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[0 3500 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] +) +Symbol['r' 1200] +( + SymbolLine[500 3500 500 5000 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[1000 3000 2000 3000 800] + SymbolLine[0 3000 500 3500 800] +) +Symbol['s' 1200] +( + SymbolLine[500 5000 2000 5000 800] + SymbolLine[2000 5000 2500 4500 800] + SymbolLine[2000 4000 2500 4500 800] + SymbolLine[500 4000 2000 4000 800] + SymbolLine[0 3500 500 4000 800] + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 2000 3000 800] + SymbolLine[2000 3000 2500 3500 800] + SymbolLine[0 4500 500 5000 800] +) +Symbol['t' 1000] +( + SymbolLine[500 1000 500 4500 800] + SymbolLine[500 4500 1000 5000 800] + SymbolLine[0 2500 1000 2500 800] +) +Symbol['u' 1200] +( + SymbolLine[0 3000 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] + SymbolLine[2000 3000 2000 4500 800] +) +Symbol['v' 1200] +( + SymbolLine[0 3000 1000 5000 800] + SymbolLine[2000 3000 1000 5000 800] +) +Symbol['w' 1200] +( + SymbolLine[0 3000 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[500 5000 1000 5000 800] + SymbolLine[1000 5000 1500 4500 800] + SymbolLine[1500 3000 1500 4500 800] + SymbolLine[1500 4500 2000 5000 800] + SymbolLine[2000 5000 2500 5000 800] + SymbolLine[2500 5000 3000 4500 800] + SymbolLine[3000 3000 3000 4500 800] +) +Symbol['x' 1200] +( + SymbolLine[0 3000 2000 5000 800] + SymbolLine[0 5000 2000 3000 800] +) +Symbol['y' 1200] +( + SymbolLine[0 3000 0 4500 800] + SymbolLine[0 4500 500 5000 800] + SymbolLine[2000 3000 2000 6000 800] + SymbolLine[1500 6500 2000 6000 800] + SymbolLine[500 6500 1500 6500 800] + SymbolLine[0 6000 500 6500 800] + SymbolLine[500 5000 1500 5000 800] + SymbolLine[1500 5000 2000 4500 800] +) +Symbol['z' 1200] +( + SymbolLine[0 3000 2000 3000 800] + SymbolLine[0 5000 2000 3000 800] + SymbolLine[0 5000 2000 5000 800] +) +Symbol['{' 1200] +( + SymbolLine[500 1500 1000 1000 800] + SymbolLine[500 1500 500 2500 800] + SymbolLine[0 3000 500 2500 800] + SymbolLine[0 3000 500 3500 800] + SymbolLine[500 3500 500 4500 800] + SymbolLine[500 4500 1000 5000 800] +) +Symbol['|' 1200] +( + SymbolLine[0 1000 0 5000 800] +) +Symbol['}' 1200] +( + SymbolLine[0 1000 500 1500 800] + SymbolLine[500 1500 500 2500 800] + SymbolLine[500 2500 1000 3000 800] + SymbolLine[500 3500 1000 3000 800] + SymbolLine[500 3500 500 4500 800] + SymbolLine[0 5000 500 4500 800] +) +Symbol['~' 1200] +( + SymbolLine[0 3500 500 3000 800] + SymbolLine[500 3000 1000 3000 800] + SymbolLine[1000 3000 1500 3500 800] + SymbolLine[1500 3500 2000 3500 800] + SymbolLine[2000 3500 2500 3000 800] +) +Attribute("PCB::grid::unit" "mil") + +Element["" "Dual in-line package, medium wide (400 mil)" "" "DIP14M" 62500 22500 22000 5000 3 100 ""] +( + Pin[0 0 6000 3000 6600 2800 "1" "1" "square"] + Pin[0 10000 6000 3000 6600 2800 "2" "2" ""] + Pin[0 20000 6000 3000 6600 2800 "3" "3" "thermal(1S)"] + Pin[0 30000 6000 3000 6600 2800 "4" "4" "square,shape(3)"] + Pin[0 40000 6000 3000 6600 2800 "5" "5" "square,shape(2)"] + Pin[0 50000 6000 3000 6600 2800 "6" "6" "square,shape(4)"] + Pin[0 60000 6000 3000 6600 2800 "7" "7" "square,shape(8)"] + Pin[40000 60000 6000 3000 6600 2800 "8" "8" "square,shape(8)"] + Pin[40000 50000 6000 3000 6600 2800 "9" "9" "square,shape(4)"] + Pin[40000 40000 6000 3000 6600 2800 "10" "10" "square,shape(2)"] + Pin[40000 30000 6000 3000 6600 2800 "11" "11" "square,shape(3)"] + Pin[40000 20000 6000 3000 6600 2800 "12" "12" ""] + Pin[40000 10000 6000 3000 6600 2800 "13" "13" ""] + Pin[40000 0 6000 3000 6600 2800 "14" "14" "square,shape(1)"] + ElementLine [-5000 -5000 -5000 65000 1000] + ElementLine [-5000 65000 45000 65000 1000] + ElementLine [45000 65000 45000 -5000 1000] + ElementLine [-5000 -5000 15000 -5000 1000] + ElementLine [25000 -5000 45000 -5000 1000] + ElementArc [20000 -5000 5000 5000 0 180 1000] + + ) +Layer(1 "component") +( +) +Layer(2 "solder") +( + Line[10000 17500 67500 17500 1500 5000 "clearline"] + Line[67500 17500 77500 27500 1500 5000 "clearline"] + Line[77500 27500 85000 27500 1500 5000 "clearline"] + Line[62500 22500 37500 22500 1500 5000 "clearline"] + Line[10000 27500 67500 27500 1500 5000 "clearline"] + Line[67500 27500 77500 37500 1500 5000 "clearline"] + Line[77500 37500 85000 37500 1500 5000 "clearline"] + Line[62500 32500 45000 32500 1500 5000 "clearline"] + Line[10000 37500 67500 37500 1500 5000 "clearline"] + Line[67500 37500 77500 47500 1500 5000 "clearline"] + Line[77500 47500 85000 47500 1500 5000 "clearline"] + Line[62500 42500 27500 42500 1500 5000 ""] + Line[10000 47500 67500 47500 1500 5000 "clearline"] + Line[67500 47500 77500 57500 1500 5000 "clearline"] + Line[77500 57500 85000 57500 1500 5000 "clearline"] + Line[62500 52500 37500 52500 1500 5000 "clearline"] + Line[37500 57500 67500 57500 1500 5000 "clearline"] + Line[67500 57500 77500 67500 1500 5000 "clearline"] + Line[77500 67500 85000 67500 1500 5000 "clearline"] + Line[62500 62500 37500 62500 1500 5000 "clearline"] + Line[37500 67500 67500 67500 1500 5000 "clearline"] + Line[67500 67500 77500 77500 1500 5000 "clearline"] + Line[77500 77500 85000 77500 1500 5000 "clearline"] + Line[62500 72500 37500 72500 1500 5000 "clearline"] + Line[37500 77500 67500 77500 1500 5000 "clearline"] + Line[67500 77500 77500 87500 1500 5000 "clearline"] + Line[77500 87500 85000 87500 1500 5000 "clearline"] + Line[62500 82500 37500 82500 1500 5000 "clearline"] + Line[65000 32500 60000 32500 6000 5000 "clearline"] + Line[105000 32500 100000 32500 6000 5000 "clearline"] + Line[102500 32500 125000 32500 1500 5000 "clearline"] + Line[102500 52500 125000 52500 1500 5000 "clearline"] + Line[102500 62500 125000 62500 1500 5000 "clearline"] + Line[102500 72500 125000 72500 1500 5000 "clearline"] + Line[102500 82500 125000 82500 1500 5000 "clearline"] + Line[102500 22500 125000 22500 1500 5000 "clearline"] + Polygon("clearpoly") + ( + [55000 37500] [70000 37500] [70000 47500] [55000 47500] + ) + Polygon("clearpoly") + ( + [85000 7500] [117500 7500] [117500 92500] [85000 92500] + ) +) +Layer(3 "GND") +( +) +Layer(4 "power") +( +) +Layer(5 "signal1") +( +) +Layer(6 "signal2") +( +) +Layer(7 "signal3") +( +) +Layer(8 "signal4") +( +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( + Text[10000 17500 0 130 "square" "clearline"] + Text[10000 27500 0 130 "fat trace" "clearline"] + Text[10000 37500 0 130 "poly" "clearline"] + Text[25000 95000 1 130 "with [square]" "clearline"] + Text[15000 92500 1 130 "shaped pins" "clearline"] +) Index: 1.0.8/doc-rnd/square.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.0.8/doc-rnd/square.png =================================================================== --- 1.0.8/doc-rnd/square.png (nonexistent) +++ 1.0.8/doc-rnd/square.png (revision 1136) Property changes on: 1.0.8/doc-rnd/square.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: 1.0.8/doc-rnd/tostyle.html =================================================================== --- 1.0.8/doc-rnd/tostyle.html (nonexistent) +++ 1.0.8/doc-rnd/tostyle.html (revision 1136) @@ -0,0 +1,50 @@ + + +

pcb-rnd - the [tostyle] patch

+ +Footprints bring their own hole sizes, copper ring sizes and clearances. +These parameters often depend on the manufacturing process, and such a value +coming from a footprint may differ much from the values used on the board already. +

+PCB has actions (and menus and hotkeys) to change sizes manually. In my practice, +I try to stick to the sizes defined in my routing styles and try to avoid +manually changing clearances or ring sizes. Still, the random values coming +from various footprints should be changed. +

+After many years of struggling with this, I realized the feature I need is +a way to change object sizes to not a relative or absolute number but +to the current routing style. The [tostyle] patch does exactly this. +It implements the following new features: +

    +
  • change clearance size now works on elements: it changes the clearance of all pins/pads; this is the same as change drill has been working for a long time +
  • size change actions normally take a value and a unit; if the value is not a number but text style, the value is copied from the currently active routing style +
  • a new ChangeSizes() action that attempts to execute the other three change size actions with the same arguments and fails only if all of them failed; the three sizes are: main size, drill size, clearance size +
  • a menu item and hotkey binding to key 'Shift+Y' (for routing stYle) that calls ChangeSizes() of the selected or current object(s) to resize them to the current routing style +
+

+The new route style set works on: +

    +
  • lines and arcs: sets their line width and clearance +
  • vias and individual pins: sets their ring dia, drill dia and clearance +
  • individual pads: sets their clearance +
  • elements: set all their pins and pads +
+ +

Example

+GUI: select a routing style; hover above a line, a via, a pin/pad of an element +or the silk of an element; press Shift+Y; undo if necessary. +

+CLI: select objects, execute action ChangeSizes(selected, style) +

+CLI: to adjust drill sizes only: select objects, execute action ChangeDrillSize(selected, style) + + +

save/load and compatibility

+Not affected, since the patch introduces actions and UI changes, no change +related to the data model. + +

plans

+No plans, the feature is complete. + + + Index: 1.0.8/globalconst.h =================================================================== --- 1.0.8/globalconst.h (nonexistent) +++ 1.0.8/globalconst.h (revision 1136) @@ -0,0 +1,138 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + * RCS: $Id$ + */ + +/* global constants + * most of these values are also required by files outside the source tree + * (manuals...) + */ + +#ifndef __GLOBALCONST_INCLUDED__ +#define __GLOBALCONST_INCLUDED__ + +#include "config.h" + +#include + +#ifdef HAVE_STDINT_H +#include +#endif + +/* --------------------------------------------------------------------------- + * some file-, directory- and environment names + */ +#define EMERGENCY_NAME "PCB.%.8i.save" /* %i --> pid */ +#define BACKUP_NAME "PCB.%.8i.backup" /* %i --> pid */ + +/* --------------------------------------------------------------------------- + * some default values + */ +#define DEFAULT_SIZE "7000x5000" /* default layout size */ +#define DEFAULT_MEDIASIZE "a4" /* default output media */ +#define DEFAULT_CELLSIZE 50 /* default cell size for symbols */ +#define CLICK_TIME 200 /* default time for click expiration */ +#define SCROLL_TIME 25 /* time between scrolls when drawing beyond border */ +#define COLUMNS 8 /* number of columns for found pin report */ + +/* --------------------------------------------------------------------------- + * frame between the groundplane and the copper + */ +#define GROUNDPLANEFRAME MIL_TO_COORD(15) +#define MASKFRAME MIL_TO_COORD(3) + +/* --------------------------------------------------------------------------- + * some limit specifications + */ +#define LARGE_VALUE (COORD_MAX / 2 - 1) /* maximum extent of board and elements */ + +#define MAX_LAYER 16 /* max number of layer, check source */ + /* code for more changes, a *lot* more changes */ +#define DEF_LAYER 8 /* default number of layers for new boards */ +#define NUM_STYLES 4 +#define MIN_LINESIZE MIL_TO_COORD(0.01) /* thickness of lines */ +#define MAX_LINESIZE LARGE_VALUE +#define MIN_TEXTSCALE 10 /* scaling of text objects in percent */ +#define MAX_TEXTSCALE 10000 +#define MIN_PINORVIASIZE MIL_TO_COORD(20) /* size of a pin or via */ +#define MIN_PINORVIAHOLE MIL_TO_COORD(4) /* size of a pins or vias drilling hole */ +#define MAX_PINORVIASIZE LARGE_VALUE +#define MIN_PINORVIACOPPER MIL_TO_COORD(4) /* min difference outer-inner diameter */ +#define MIN_PADSIZE MIL_TO_COORD(1) /* min size of a pad */ +#define MAX_PADSIZE LARGE_VALUE /* max size of a pad */ +#define MIN_DRC_VALUE MIL_TO_COORD(0.1) +#define MAX_DRC_VALUE MIL_TO_COORD(500) +#define MIN_DRC_SILK MIL_TO_COORD(1) +#define MAX_DRC_SILK MIL_TO_COORD(30) +#define MIN_DRC_DRILL MIL_TO_COORD(1) +#define MAX_DRC_DRILL MIL_TO_COORD(50) +#define MIN_DRC_RING 0 +#define MAX_DRC_RING MIL_TO_COORD(100) +#define MIN_GRID 1 +#define MAX_GRID MIL_TO_COORD(1000) +#define MAX_FONTPOSITION 255 /* upper limit of characters in my font */ + +#define MAX_COORD LARGE_VALUE /* coordinate limits */ +#define MIN_SIZE MIL_TO_COORD(10) /* lowest width and height of the board */ +#define MAX_BUFFER 5 /* number of pastebuffers */ + /* additional changes in menu.c are */ + /* also required to select more buffers */ + +#define DEFAULT_DRILLINGHOLE 40 /* default inner/outer ratio for */ + /* pins/vias in percent */ + +#if MAX_LINESIZE > MAX_PINORVIASIZE /* maximum size value */ +#define MAX_SIZE MAX_LINESIZE +#else +#define MAX_SIZE MAX_PINORVIASIZE +#endif + +#ifndef MAXPATHLEN /* maximum path length */ +#ifdef PATH_MAX +#define MAXPATHLEN PATH_MAX +#else +#define MAXPATHLEN 2048 +#endif +#endif + +#define MAX_LINE_POINT_DISTANCE 0 /* maximum distance when searching */ + /* line points */ +#define MAX_POLYGON_POINT_DISTANCE 0 /* maximum distance when searching */ + /* polygon points */ +#define MAX_ELEMENTNAMES 3 /* number of supported names of */ + /* an element */ +#define MAX_LIBRARY_LINE_LENGTH 255 /* maximum line length in the */ + /* library-description file */ +#define MAX_NETLIST_LINE_LENGTH 255 /* maximum line length for netlist files */ +#define MAX_MODESTACK_DEPTH 16 /* maximum depth of mode stack */ +#define MAX_CROSSHAIRSTACK_DEPTH 16 /* maximum depth of state stack */ +#define MIN_GRID_DISTANCE 4 /* minimum distance between point */ + /* to enable grid drawing */ + /* size of diamond element mark */ +#define EMARK_SIZE MIL_TO_COORD (10) + +/* (Approximate) capheight size of the default PCB font */ +#define FONT_CAPHEIGHT MIL_TO_COORD (45) +#endif Property changes on: 1.0.8/globalconst.h ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/pcblib/Makefile =================================================================== --- 1.0.8/pcblib/Makefile (nonexistent) +++ 1.0.8/pcblib/Makefile (revision 1136) @@ -0,0 +1,29 @@ +# This Makefile is a plain old hand written one; all configuration settings +# are included from ../Makefile.conf which is scconfig generated + +all: + +install_: + $(MKDIR) "$(DATADIR)/pcblib" + $(CPC) "`pwd`/connector" "$(DATADIR)/pcblib/connector" + $(CPC) "`pwd`/parametric" "$(DATADIR)/pcblib/parametric" + $(CPC) "`pwd`/smd" "$(DATADIR)/pcblib/smd" + $(CPC) "`pwd`/tru-hole" "$(DATADIR)/pcblib/tru-hole" + +install: + make install_ CPC="$(CP)" + +# hack: pcb's chdir() based approach gets fooled on symlinks because of "cd .." +# returns to the wrong dir +linstall: + make uninstall + $(MKDIR) "$(DATADIR)" + $(LN) "`pwd`" "$(DATADIR)/pcblib" + +uninstall: + $(RM) "$(DATADIR)/pcblib" + +clean: + +include ../Makefile.conf + Index: 1.0.8/pcblib/README =================================================================== --- 1.0.8/pcblib/README (nonexistent) +++ 1.0.8/pcblib/README (revision 1136) @@ -0,0 +1,8 @@ +This directory hosts the pcb-rnd's new footprint library. To avoid +confusuin with "newlib", which is in use in mainline, this one is called +pcblib. + +Some footprints are dynamically generated by scripts; they are +called parametric footprints and are in parametric/. Other footprints +are plain old data file footprints (static footpritns) in all the other +directories. Index: 1.0.8/pcblib/connector/BNC_LAY.fp =================================================================== --- 1.0.8/pcblib/connector/BNC_LAY.fp (nonexistent) +++ 1.0.8/pcblib/connector/BNC_LAY.fp (revision 1136) @@ -0,0 +1,15 @@ +##from:pcb +##geo:90 +##geo:female + +Element(0x00 "right angle BNC" "" "BNC_LAY" 200 0 3 100 0x00) +( + ElementLine(-60 -290 490 -290 10) + ElementLine(490 -290 490 290 10) + ElementLine(490 290 -60 290 10) + ElementLine(-60 290 -60 -290 10) + Pin(0 0 60 35 "1" 0x101) + Pin(0 -100 60 35 "2" 0x01) + Pin(200 -200 100 81 "m1" 0x01) + Pin(200 200 100 81 "m2" 0x01) +) Index: 1.0.8/pcblib/connector/DB15F.fp =================================================================== --- 1.0.8/pcblib/connector/DB15F.fp (nonexistent) +++ 1.0.8/pcblib/connector/DB15F.fp (revision 1136) @@ -0,0 +1,72 @@ +##from:pcb +##geo:90 +##geo:female + +Element(0x00 "DSUB connector, female/male" "" "DB15F" 1000 2026 1 150 0x00) +( + # Gehaeuse (schmaler Kasten incl. Bohrungen) + ElementLine(635 880 665 880 10) + ElementLine(665 880 665 2416 10) + ElementLine(665 2416 635 2416 10) + ElementLine(635 2416 635 880 10) + ElementLine(635 940 665 940 10) + ElementLine(635 1060 665 1060 10) + ElementLine(635 2356 665 2356 10) + ElementLine(635 2236 665 2236 10) + # Gehaeuse (aeusserer Kasten) + # This part of the connector normally hangs off the circuit board, + # so it is confusing to actually mark it on the silkscreen + # define(`X1', `eval(BASEX-PANEL_DISTANCE-260)') + # define(`Y1', `eval(PY1-100)') + # define(`X2', `eval(BASEX-PANEL_DISTANCE)') + # define(`Y2', `eval(PY2+100)') + # ElementLine(X1 Y1 X2 Y1 20) + # ElementLine(X2 Y1 X2 Y2 10) + # ElementLine(X2 Y2 X1 Y2 20) + # ElementLine(X1 Y2 X1 Y1 20) + # Gehaeuse (innerer Kasten) + ElementLine(665 1110 770 1110 20) + ElementLine(770 1110 770 2186 20) + ElementLine(770 2186 665 2186 20) + ElementLine(665 2186 665 1110 10) + # Pins + # Pin 1 + Pin(1056 2026 60 35 "1" 0x101) + ElementLine(1016 2026 770 2026 20) + # Plazierungsmarkierung == PIN 1 + # Changed PY1 to PY2 13-Dec-1999 LRD + Mark(1056 2026) + # Remainder of the first row + Pin(1056 1918 60 35 "2" 0x01) + ElementLine(1016 1918 770 1918 20) + Pin(1056 1810 60 35 "3" 0x01) + ElementLine(1016 1810 770 1810 20) + Pin(1056 1702 60 35 "4" 0x01) + ElementLine(1016 1702 770 1702 20) + Pin(1056 1594 60 35 "5" 0x01) + ElementLine(1016 1594 770 1594 20) + Pin(1056 1486 60 35 "6" 0x01) + ElementLine(1016 1486 770 1486 20) + Pin(1056 1378 60 35 "7" 0x01) + ElementLine(1016 1378 770 1378 20) + Pin(1056 1270 60 35 "8" 0x01) + ElementLine(1016 1270 770 1270 20) + # Second row + Pin(944 1972 60 35 "9" 0x01) + ElementLine(904 1972 770 1972 20) + Pin(944 1864 60 35 "10" 0x01) + ElementLine(904 1864 770 1864 20) + Pin(944 1756 60 35 "11" 0x01) + ElementLine(904 1756 770 1756 20) + Pin(944 1648 60 35 "12" 0x01) + ElementLine(904 1648 770 1648 20) + Pin(944 1540 60 35 "13" 0x01) + ElementLine(904 1540 770 1540 20) + Pin(944 1432 60 35 "14" 0x01) + ElementLine(904 1432 770 1432 20) + Pin(944 1324 60 35 "15" 0x01) + ElementLine(904 1324 770 1324 20) + # Befestigungsbohrung + Pin(1000 1000 250 125 "C1" 0x01) + Pin(1000 2296 250 125 "C2" 0x01) +) Index: 1.0.8/pcblib/connector/DB15M.fp =================================================================== --- 1.0.8/pcblib/connector/DB15M.fp (nonexistent) +++ 1.0.8/pcblib/connector/DB15M.fp (revision 1136) @@ -0,0 +1,71 @@ +##from:pcb +##geo:90 +##geo:male + +Element(0x00 "DSUB connector, female/male" "" "DB15M" 1000 2026 1 150 0x00) +( + # Gehaeuse (schmaler Kasten incl. Bohrungen) + ElementLine(635 880 665 880 10) + ElementLine(665 880 665 2416 10) + ElementLine(665 2416 635 2416 10) + ElementLine(635 2416 635 880 10) + ElementLine(635 940 665 940 10) + ElementLine(635 1060 665 1060 10) + ElementLine(635 2356 665 2356 10) + ElementLine(635 2236 665 2236 10) + # Gehaeuse (aeusserer Kasten) + # This part of the connector normally hangs off the circuit board, + # so it is confusing to actually mark it on the silkscreen + # define(`X1', `eval(BASEX-PANEL_DISTANCE-260)') + # define(`Y1', `eval(PY1-100)') + # define(`X2', `eval(BASEX-PANEL_DISTANCE)') + # define(`Y2', `eval(PY2+100)') + # ElementLine(X1 Y1 X2 Y1 20) + # ElementLine(X2 Y1 X2 Y2 10) + # ElementLine(X2 Y2 X1 Y2 20) + # ElementLine(X1 Y2 X1 Y1 20) + # Gehaeuse (innerer Kasten) + ElementLine(665 1110 770 1110 20) + ElementLine(770 1110 770 2186 20) + ElementLine(770 2186 665 2186 20) + ElementLine(665 2186 665 1110 10) + # Pins + # First row + Pin(1056 1270 60 35 "1" 0x101) + ElementLine(1016 1270 770 1270 20) + Pin(1056 1378 60 35 "2" 0x01) + ElementLine(1016 1378 770 1378 20) + Pin(1056 1486 60 35 "3" 0x01) + ElementLine(1016 1486 770 1486 20) + Pin(1056 1594 60 35 "4" 0x01) + ElementLine(1016 1594 770 1594 20) + Pin(1056 1702 60 35 "5" 0x01) + ElementLine(1016 1702 770 1702 20) + Pin(1056 1810 60 35 "6" 0x01) + ElementLine(1016 1810 770 1810 20) + Pin(1056 1918 60 35 "7" 0x01) + ElementLine(1016 1918 770 1918 20) + # Last pin in first row + Pin(1056 2026 60 35 "8" 0x01) + ElementLine(1016 2026 770 2026 20) + # Second row + Pin(944 1324 60 35 "9" 0x01) + ElementLine(904 1324 770 1324 20) + Pin(944 1432 60 35 "10" 0x01) + ElementLine(904 1432 770 1432 20) + Pin(944 1540 60 35 "11" 0x01) + ElementLine(904 1540 770 1540 20) + Pin(944 1648 60 35 "12" 0x01) + ElementLine(904 1648 770 1648 20) + Pin(944 1756 60 35 "13" 0x01) + ElementLine(904 1756 770 1756 20) + Pin(944 1864 60 35 "14" 0x01) + ElementLine(904 1864 770 1864 20) + Pin(944 1972 60 35 "15" 0x01) + ElementLine(904 1972 770 1972 20) + # Plazierungsmarkierung == PIN 1 + Mark(1050 1270) + # Befestigungsbohrung + Pin(1000 1000 250 125 "C1" 0x01) + Pin(1000 2296 250 125 "C2" 0x01) +) Index: 1.0.8/pcblib/connector/DB25F.fp =================================================================== --- 1.0.8/pcblib/connector/DB25F.fp (nonexistent) +++ 1.0.8/pcblib/connector/DB25F.fp (revision 1136) @@ -0,0 +1,92 @@ +##from:pcb +##geo:90 +##geo:female + +Element(0x00 "DSUB connector, female/male" "" "DB25F" 1000 2566 1 150 0x00) +( + # Gehaeuse (schmaler Kasten incl. Bohrungen) + ElementLine(635 880 665 880 10) + ElementLine(665 880 665 2956 10) + ElementLine(665 2956 635 2956 10) + ElementLine(635 2956 635 880 10) + ElementLine(635 940 665 940 10) + ElementLine(635 1060 665 1060 10) + ElementLine(635 2896 665 2896 10) + ElementLine(635 2776 665 2776 10) + # Gehaeuse (aeusserer Kasten) + # This part of the connector normally hangs off the circuit board, + # so it is confusing to actually mark it on the silkscreen + # define(`X1', `eval(BASEX-PANEL_DISTANCE-260)') + # define(`Y1', `eval(PY1-100)') + # define(`X2', `eval(BASEX-PANEL_DISTANCE)') + # define(`Y2', `eval(PY2+100)') + # ElementLine(X1 Y1 X2 Y1 20) + # ElementLine(X2 Y1 X2 Y2 10) + # ElementLine(X2 Y2 X1 Y2 20) + # ElementLine(X1 Y2 X1 Y1 20) + # Gehaeuse (innerer Kasten) + ElementLine(665 1110 770 1110 20) + ElementLine(770 1110 770 2726 20) + ElementLine(770 2726 665 2726 20) + ElementLine(665 2726 665 1110 10) + # Pins + # Pin 1 + Pin(1056 2566 60 35 "1" 0x101) + ElementLine(1016 2566 770 2566 20) + # Plazierungsmarkierung == PIN 1 + # Changed PY1 to PY2 13-Dec-1999 LRD + Mark(1056 2566) + # Remainder of the first row + Pin(1056 2458 60 35 "2" 0x01) + ElementLine(1016 2458 770 2458 20) + Pin(1056 2350 60 35 "3" 0x01) + ElementLine(1016 2350 770 2350 20) + Pin(1056 2242 60 35 "4" 0x01) + ElementLine(1016 2242 770 2242 20) + Pin(1056 2134 60 35 "5" 0x01) + ElementLine(1016 2134 770 2134 20) + Pin(1056 2026 60 35 "6" 0x01) + ElementLine(1016 2026 770 2026 20) + Pin(1056 1918 60 35 "7" 0x01) + ElementLine(1016 1918 770 1918 20) + Pin(1056 1810 60 35 "8" 0x01) + ElementLine(1016 1810 770 1810 20) + Pin(1056 1702 60 35 "9" 0x01) + ElementLine(1016 1702 770 1702 20) + Pin(1056 1594 60 35 "10" 0x01) + ElementLine(1016 1594 770 1594 20) + Pin(1056 1486 60 35 "11" 0x01) + ElementLine(1016 1486 770 1486 20) + Pin(1056 1378 60 35 "12" 0x01) + ElementLine(1016 1378 770 1378 20) + Pin(1056 1270 60 35 "13" 0x01) + ElementLine(1016 1270 770 1270 20) + # Second row + Pin(944 2512 60 35 "14" 0x01) + ElementLine(904 2512 770 2512 20) + Pin(944 2404 60 35 "15" 0x01) + ElementLine(904 2404 770 2404 20) + Pin(944 2296 60 35 "16" 0x01) + ElementLine(904 2296 770 2296 20) + Pin(944 2188 60 35 "17" 0x01) + ElementLine(904 2188 770 2188 20) + Pin(944 2080 60 35 "18" 0x01) + ElementLine(904 2080 770 2080 20) + Pin(944 1972 60 35 "19" 0x01) + ElementLine(904 1972 770 1972 20) + Pin(944 1864 60 35 "20" 0x01) + ElementLine(904 1864 770 1864 20) + Pin(944 1756 60 35 "21" 0x01) + ElementLine(904 1756 770 1756 20) + Pin(944 1648 60 35 "22" 0x01) + ElementLine(904 1648 770 1648 20) + Pin(944 1540 60 35 "23" 0x01) + ElementLine(904 1540 770 1540 20) + Pin(944 1432 60 35 "24" 0x01) + ElementLine(904 1432 770 1432 20) + Pin(944 1324 60 35 "25" 0x01) + ElementLine(904 1324 770 1324 20) + # Befestigungsbohrung + Pin(1000 1000 250 125 "C1" 0x01) + Pin(1000 2836 250 125 "C2" 0x01) +) Index: 1.0.8/pcblib/connector/DB25M.fp =================================================================== --- 1.0.8/pcblib/connector/DB25M.fp (nonexistent) +++ 1.0.8/pcblib/connector/DB25M.fp (revision 1136) @@ -0,0 +1,91 @@ +##from:pcb +##geo:90 +##geo:male + +Element(0x00 "DSUB connector, female/male" "" "DB25M" 1000 2566 1 150 0x00) +( + # Gehaeuse (schmaler Kasten incl. Bohrungen) + ElementLine(635 880 665 880 10) + ElementLine(665 880 665 2956 10) + ElementLine(665 2956 635 2956 10) + ElementLine(635 2956 635 880 10) + ElementLine(635 940 665 940 10) + ElementLine(635 1060 665 1060 10) + ElementLine(635 2896 665 2896 10) + ElementLine(635 2776 665 2776 10) + # Gehaeuse (aeusserer Kasten) + # This part of the connector normally hangs off the circuit board, + # so it is confusing to actually mark it on the silkscreen + # define(`X1', `eval(BASEX-PANEL_DISTANCE-260)') + # define(`Y1', `eval(PY1-100)') + # define(`X2', `eval(BASEX-PANEL_DISTANCE)') + # define(`Y2', `eval(PY2+100)') + # ElementLine(X1 Y1 X2 Y1 20) + # ElementLine(X2 Y1 X2 Y2 10) + # ElementLine(X2 Y2 X1 Y2 20) + # ElementLine(X1 Y2 X1 Y1 20) + # Gehaeuse (innerer Kasten) + ElementLine(665 1110 770 1110 20) + ElementLine(770 1110 770 2726 20) + ElementLine(770 2726 665 2726 20) + ElementLine(665 2726 665 1110 10) + # Pins + # First row + Pin(1056 1270 60 35 "1" 0x101) + ElementLine(1016 1270 770 1270 20) + Pin(1056 1378 60 35 "2" 0x01) + ElementLine(1016 1378 770 1378 20) + Pin(1056 1486 60 35 "3" 0x01) + ElementLine(1016 1486 770 1486 20) + Pin(1056 1594 60 35 "4" 0x01) + ElementLine(1016 1594 770 1594 20) + Pin(1056 1702 60 35 "5" 0x01) + ElementLine(1016 1702 770 1702 20) + Pin(1056 1810 60 35 "6" 0x01) + ElementLine(1016 1810 770 1810 20) + Pin(1056 1918 60 35 "7" 0x01) + ElementLine(1016 1918 770 1918 20) + Pin(1056 2026 60 35 "8" 0x01) + ElementLine(1016 2026 770 2026 20) + Pin(1056 2134 60 35 "9" 0x01) + ElementLine(1016 2134 770 2134 20) + Pin(1056 2242 60 35 "10" 0x01) + ElementLine(1016 2242 770 2242 20) + Pin(1056 2350 60 35 "11" 0x01) + ElementLine(1016 2350 770 2350 20) + Pin(1056 2458 60 35 "12" 0x01) + ElementLine(1016 2458 770 2458 20) + # Last pin in first row + Pin(1056 2566 60 35 "13" 0x01) + ElementLine(1016 2566 770 2566 20) + # Second row + Pin(944 1324 60 35 "14" 0x01) + ElementLine(904 1324 770 1324 20) + Pin(944 1432 60 35 "15" 0x01) + ElementLine(904 1432 770 1432 20) + Pin(944 1540 60 35 "16" 0x01) + ElementLine(904 1540 770 1540 20) + Pin(944 1648 60 35 "17" 0x01) + ElementLine(904 1648 770 1648 20) + Pin(944 1756 60 35 "18" 0x01) + ElementLine(904 1756 770 1756 20) + Pin(944 1864 60 35 "19" 0x01) + ElementLine(904 1864 770 1864 20) + Pin(944 1972 60 35 "20" 0x01) + ElementLine(904 1972 770 1972 20) + Pin(944 2080 60 35 "21" 0x01) + ElementLine(904 2080 770 2080 20) + Pin(944 2188 60 35 "22" 0x01) + ElementLine(904 2188 770 2188 20) + Pin(944 2296 60 35 "23" 0x01) + ElementLine(904 2296 770 2296 20) + Pin(944 2404 60 35 "24" 0x01) + ElementLine(904 2404 770 2404 20) + Pin(944 2512 60 35 "25" 0x01) + ElementLine(904 2512 770 2512 20) + # Plazierungsmarkierung == PIN 1 + Mark(1050 1270) + # Befestigungsbohrung + Pin(1000 1000 250 125 "C1" 0x01) + Pin(1000 2836 250 125 "C2" 0x01) +) Index: 1.0.8/pcblib/connector/DB37F.fp =================================================================== --- 1.0.8/pcblib/connector/DB37F.fp (nonexistent) +++ 1.0.8/pcblib/connector/DB37F.fp (revision 1136) @@ -0,0 +1,116 @@ +##from:pcb +##geo:90 +##geo:female + +Element(0x00 "DSUB connector, female/male" "" "DB37F" 1000 3214 1 150 0x00) +( + # Gehaeuse (schmaler Kasten incl. Bohrungen) + ElementLine(635 880 665 880 10) + ElementLine(665 880 665 3604 10) + ElementLine(665 3604 635 3604 10) + ElementLine(635 3604 635 880 10) + ElementLine(635 940 665 940 10) + ElementLine(635 1060 665 1060 10) + ElementLine(635 3544 665 3544 10) + ElementLine(635 3424 665 3424 10) + # Gehaeuse (aeusserer Kasten) + # This part of the connector normally hangs off the circuit board, + # so it is confusing to actually mark it on the silkscreen + # define(`X1', `eval(BASEX-PANEL_DISTANCE-260)') + # define(`Y1', `eval(PY1-100)') + # define(`X2', `eval(BASEX-PANEL_DISTANCE)') + # define(`Y2', `eval(PY2+100)') + # ElementLine(X1 Y1 X2 Y1 20) + # ElementLine(X2 Y1 X2 Y2 10) + # ElementLine(X2 Y2 X1 Y2 20) + # ElementLine(X1 Y2 X1 Y1 20) + # Gehaeuse (innerer Kasten) + ElementLine(665 1110 770 1110 20) + ElementLine(770 1110 770 3374 20) + ElementLine(770 3374 665 3374 20) + ElementLine(665 3374 665 1110 10) + # Pins + # Pin 1 + Pin(1056 3214 60 35 "1" 0x101) + ElementLine(1016 3214 770 3214 20) + # Plazierungsmarkierung == PIN 1 + # Changed PY1 to PY2 13-Dec-1999 LRD + Mark(1056 3214) + # Remainder of the first row + Pin(1056 3106 60 35 "2" 0x01) + ElementLine(1016 3106 770 3106 20) + Pin(1056 2998 60 35 "3" 0x01) + ElementLine(1016 2998 770 2998 20) + Pin(1056 2890 60 35 "4" 0x01) + ElementLine(1016 2890 770 2890 20) + Pin(1056 2782 60 35 "5" 0x01) + ElementLine(1016 2782 770 2782 20) + Pin(1056 2674 60 35 "6" 0x01) + ElementLine(1016 2674 770 2674 20) + Pin(1056 2566 60 35 "7" 0x01) + ElementLine(1016 2566 770 2566 20) + Pin(1056 2458 60 35 "8" 0x01) + ElementLine(1016 2458 770 2458 20) + Pin(1056 2350 60 35 "9" 0x01) + ElementLine(1016 2350 770 2350 20) + Pin(1056 2242 60 35 "10" 0x01) + ElementLine(1016 2242 770 2242 20) + Pin(1056 2134 60 35 "11" 0x01) + ElementLine(1016 2134 770 2134 20) + Pin(1056 2026 60 35 "12" 0x01) + ElementLine(1016 2026 770 2026 20) + Pin(1056 1918 60 35 "13" 0x01) + ElementLine(1016 1918 770 1918 20) + Pin(1056 1810 60 35 "14" 0x01) + ElementLine(1016 1810 770 1810 20) + Pin(1056 1702 60 35 "15" 0x01) + ElementLine(1016 1702 770 1702 20) + Pin(1056 1594 60 35 "16" 0x01) + ElementLine(1016 1594 770 1594 20) + Pin(1056 1486 60 35 "17" 0x01) + ElementLine(1016 1486 770 1486 20) + Pin(1056 1378 60 35 "18" 0x01) + ElementLine(1016 1378 770 1378 20) + Pin(1056 1270 60 35 "19" 0x01) + ElementLine(1016 1270 770 1270 20) + # Second row + Pin(944 3160 60 35 "20" 0x01) + ElementLine(904 3160 770 3160 20) + Pin(944 3052 60 35 "21" 0x01) + ElementLine(904 3052 770 3052 20) + Pin(944 2944 60 35 "22" 0x01) + ElementLine(904 2944 770 2944 20) + Pin(944 2836 60 35 "23" 0x01) + ElementLine(904 2836 770 2836 20) + Pin(944 2728 60 35 "24" 0x01) + ElementLine(904 2728 770 2728 20) + Pin(944 2620 60 35 "25" 0x01) + ElementLine(904 2620 770 2620 20) + Pin(944 2512 60 35 "26" 0x01) + ElementLine(904 2512 770 2512 20) + Pin(944 2404 60 35 "27" 0x01) + ElementLine(904 2404 770 2404 20) + Pin(944 2296 60 35 "28" 0x01) + ElementLine(904 2296 770 2296 20) + Pin(944 2188 60 35 "29" 0x01) + ElementLine(904 2188 770 2188 20) + Pin(944 2080 60 35 "30" 0x01) + ElementLine(904 2080 770 2080 20) + Pin(944 1972 60 35 "31" 0x01) + ElementLine(904 1972 770 1972 20) + Pin(944 1864 60 35 "32" 0x01) + ElementLine(904 1864 770 1864 20) + Pin(944 1756 60 35 "33" 0x01) + ElementLine(904 1756 770 1756 20) + Pin(944 1648 60 35 "34" 0x01) + ElementLine(904 1648 770 1648 20) + Pin(944 1540 60 35 "35" 0x01) + ElementLine(904 1540 770 1540 20) + Pin(944 1432 60 35 "36" 0x01) + ElementLine(904 1432 770 1432 20) + Pin(944 1324 60 35 "37" 0x01) + ElementLine(904 1324 770 1324 20) + # Befestigungsbohrung + Pin(1000 1000 250 125 "C1" 0x01) + Pin(1000 3484 250 125 "C2" 0x01) +) Index: 1.0.8/pcblib/connector/DB37M.fp =================================================================== --- 1.0.8/pcblib/connector/DB37M.fp (nonexistent) +++ 1.0.8/pcblib/connector/DB37M.fp (revision 1136) @@ -0,0 +1,115 @@ +##from:pcb +##geo:90 +##geo:male + +Element(0x00 "DSUB connector, female/male" "" "DB37M" 1000 3214 1 150 0x00) +( + # Gehaeuse (schmaler Kasten incl. Bohrungen) + ElementLine(635 880 665 880 10) + ElementLine(665 880 665 3604 10) + ElementLine(665 3604 635 3604 10) + ElementLine(635 3604 635 880 10) + ElementLine(635 940 665 940 10) + ElementLine(635 1060 665 1060 10) + ElementLine(635 3544 665 3544 10) + ElementLine(635 3424 665 3424 10) + # Gehaeuse (aeusserer Kasten) + # This part of the connector normally hangs off the circuit board, + # so it is confusing to actually mark it on the silkscreen + # define(`X1', `eval(BASEX-PANEL_DISTANCE-260)') + # define(`Y1', `eval(PY1-100)') + # define(`X2', `eval(BASEX-PANEL_DISTANCE)') + # define(`Y2', `eval(PY2+100)') + # ElementLine(X1 Y1 X2 Y1 20) + # ElementLine(X2 Y1 X2 Y2 10) + # ElementLine(X2 Y2 X1 Y2 20) + # ElementLine(X1 Y2 X1 Y1 20) + # Gehaeuse (innerer Kasten) + ElementLine(665 1110 770 1110 20) + ElementLine(770 1110 770 3374 20) + ElementLine(770 3374 665 3374 20) + ElementLine(665 3374 665 1110 10) + # Pins + # First row + Pin(1056 1270 60 35 "1" 0x101) + ElementLine(1016 1270 770 1270 20) + Pin(1056 1378 60 35 "2" 0x01) + ElementLine(1016 1378 770 1378 20) + Pin(1056 1486 60 35 "3" 0x01) + ElementLine(1016 1486 770 1486 20) + Pin(1056 1594 60 35 "4" 0x01) + ElementLine(1016 1594 770 1594 20) + Pin(1056 1702 60 35 "5" 0x01) + ElementLine(1016 1702 770 1702 20) + Pin(1056 1810 60 35 "6" 0x01) + ElementLine(1016 1810 770 1810 20) + Pin(1056 1918 60 35 "7" 0x01) + ElementLine(1016 1918 770 1918 20) + Pin(1056 2026 60 35 "8" 0x01) + ElementLine(1016 2026 770 2026 20) + Pin(1056 2134 60 35 "9" 0x01) + ElementLine(1016 2134 770 2134 20) + Pin(1056 2242 60 35 "10" 0x01) + ElementLine(1016 2242 770 2242 20) + Pin(1056 2350 60 35 "11" 0x01) + ElementLine(1016 2350 770 2350 20) + Pin(1056 2458 60 35 "12" 0x01) + ElementLine(1016 2458 770 2458 20) + Pin(1056 2566 60 35 "13" 0x01) + ElementLine(1016 2566 770 2566 20) + Pin(1056 2674 60 35 "14" 0x01) + ElementLine(1016 2674 770 2674 20) + Pin(1056 2782 60 35 "15" 0x01) + ElementLine(1016 2782 770 2782 20) + Pin(1056 2890 60 35 "16" 0x01) + ElementLine(1016 2890 770 2890 20) + Pin(1056 2998 60 35 "17" 0x01) + ElementLine(1016 2998 770 2998 20) + Pin(1056 3106 60 35 "18" 0x01) + ElementLine(1016 3106 770 3106 20) + # Last pin in first row + Pin(1056 3214 60 35 "19" 0x01) + ElementLine(1016 3214 770 3214 20) + # Second row + Pin(944 1324 60 35 "20" 0x01) + ElementLine(904 1324 770 1324 20) + Pin(944 1432 60 35 "21" 0x01) + ElementLine(904 1432 770 1432 20) + Pin(944 1540 60 35 "22" 0x01) + ElementLine(904 1540 770 1540 20) + Pin(944 1648 60 35 "23" 0x01) + ElementLine(904 1648 770 1648 20) + Pin(944 1756 60 35 "24" 0x01) + ElementLine(904 1756 770 1756 20) + Pin(944 1864 60 35 "25" 0x01) + ElementLine(904 1864 770 1864 20) + Pin(944 1972 60 35 "26" 0x01) + ElementLine(904 1972 770 1972 20) + Pin(944 2080 60 35 "27" 0x01) + ElementLine(904 2080 770 2080 20) + Pin(944 2188 60 35 "28" 0x01) + ElementLine(904 2188 770 2188 20) + Pin(944 2296 60 35 "29" 0x01) + ElementLine(904 2296 770 2296 20) + Pin(944 2404 60 35 "30" 0x01) + ElementLine(904 2404 770 2404 20) + Pin(944 2512 60 35 "31" 0x01) + ElementLine(904 2512 770 2512 20) + Pin(944 2620 60 35 "32" 0x01) + ElementLine(904 2620 770 2620 20) + Pin(944 2728 60 35 "33" 0x01) + ElementLine(904 2728 770 2728 20) + Pin(944 2836 60 35 "34" 0x01) + ElementLine(904 2836 770 2836 20) + Pin(944 2944 60 35 "35" 0x01) + ElementLine(904 2944 770 2944 20) + Pin(944 3052 60 35 "36" 0x01) + ElementLine(904 3052 770 3052 20) + Pin(944 3160 60 35 "37" 0x01) + ElementLine(904 3160 770 3160 20) + # Plazierungsmarkierung == PIN 1 + Mark(1050 1270) + # Befestigungsbohrung + Pin(1000 1000 250 125 "C1" 0x01) + Pin(1000 3484 250 125 "C2" 0x01) +) Index: 1.0.8/pcblib/connector/DB9F.fp =================================================================== --- 1.0.8/pcblib/connector/DB9F.fp (nonexistent) +++ 1.0.8/pcblib/connector/DB9F.fp (revision 1136) @@ -0,0 +1,60 @@ +##from:pcb +##geo:90 +##geo:female + +Element(0x00 "DSUB connector, female/male" "" "DB9F" 1000 1702 1 150 0x00) +( + # Gehaeuse (schmaler Kasten incl. Bohrungen) + ElementLine(635 880 665 880 10) + ElementLine(665 880 665 2092 10) + ElementLine(665 2092 635 2092 10) + ElementLine(635 2092 635 880 10) + ElementLine(635 940 665 940 10) + ElementLine(635 1060 665 1060 10) + ElementLine(635 2032 665 2032 10) + ElementLine(635 1912 665 1912 10) + # Gehaeuse (aeusserer Kasten) + # This part of the connector normally hangs off the circuit board, + # so it is confusing to actually mark it on the silkscreen + # define(`X1', `eval(BASEX-PANEL_DISTANCE-260)') + # define(`Y1', `eval(PY1-100)') + # define(`X2', `eval(BASEX-PANEL_DISTANCE)') + # define(`Y2', `eval(PY2+100)') + # ElementLine(X1 Y1 X2 Y1 20) + # ElementLine(X2 Y1 X2 Y2 10) + # ElementLine(X2 Y2 X1 Y2 20) + # ElementLine(X1 Y2 X1 Y1 20) + # Gehaeuse (innerer Kasten) + ElementLine(665 1110 770 1110 20) + ElementLine(770 1110 770 1862 20) + ElementLine(770 1862 665 1862 20) + ElementLine(665 1862 665 1110 10) + # Pins + # Pin 1 + Pin(1056 1702 60 35 "1" 0x101) + ElementLine(1016 1702 770 1702 20) + # Plazierungsmarkierung == PIN 1 + # Changed PY1 to PY2 13-Dec-1999 LRD + Mark(1056 1702) + # Remainder of the first row + Pin(1056 1594 60 35 "2" 0x01) + ElementLine(1016 1594 770 1594 20) + Pin(1056 1486 60 35 "3" 0x01) + ElementLine(1016 1486 770 1486 20) + Pin(1056 1378 60 35 "4" 0x01) + ElementLine(1016 1378 770 1378 20) + Pin(1056 1270 60 35 "5" 0x01) + ElementLine(1016 1270 770 1270 20) + # Second row + Pin(944 1648 60 35 "6" 0x01) + ElementLine(904 1648 770 1648 20) + Pin(944 1540 60 35 "7" 0x01) + ElementLine(904 1540 770 1540 20) + Pin(944 1432 60 35 "8" 0x01) + ElementLine(904 1432 770 1432 20) + Pin(944 1324 60 35 "9" 0x01) + ElementLine(904 1324 770 1324 20) + # Befestigungsbohrung + Pin(1000 1000 250 125 "C1" 0x01) + Pin(1000 1972 250 125 "C2" 0x01) +) Index: 1.0.8/pcblib/connector/DB9M.fp =================================================================== --- 1.0.8/pcblib/connector/DB9M.fp (nonexistent) +++ 1.0.8/pcblib/connector/DB9M.fp (revision 1136) @@ -0,0 +1,59 @@ +##from:pcb +##geo:90 +##geo:male + +Element(0x00 "DSUB connector, female/male" "" "DB9M" 1000 1702 1 150 0x00) +( + # Gehaeuse (schmaler Kasten incl. Bohrungen) + ElementLine(635 880 665 880 10) + ElementLine(665 880 665 2092 10) + ElementLine(665 2092 635 2092 10) + ElementLine(635 2092 635 880 10) + ElementLine(635 940 665 940 10) + ElementLine(635 1060 665 1060 10) + ElementLine(635 2032 665 2032 10) + ElementLine(635 1912 665 1912 10) + # Gehaeuse (aeusserer Kasten) + # This part of the connector normally hangs off the circuit board, + # so it is confusing to actually mark it on the silkscreen + # define(`X1', `eval(BASEX-PANEL_DISTANCE-260)') + # define(`Y1', `eval(PY1-100)') + # define(`X2', `eval(BASEX-PANEL_DISTANCE)') + # define(`Y2', `eval(PY2+100)') + # ElementLine(X1 Y1 X2 Y1 20) + # ElementLine(X2 Y1 X2 Y2 10) + # ElementLine(X2 Y2 X1 Y2 20) + # ElementLine(X1 Y2 X1 Y1 20) + # Gehaeuse (innerer Kasten) + ElementLine(665 1110 770 1110 20) + ElementLine(770 1110 770 1862 20) + ElementLine(770 1862 665 1862 20) + ElementLine(665 1862 665 1110 10) + # Pins + # First row + Pin(1056 1270 60 35 "1" 0x101) + ElementLine(1016 1270 770 1270 20) + Pin(1056 1378 60 35 "2" 0x01) + ElementLine(1016 1378 770 1378 20) + Pin(1056 1486 60 35 "3" 0x01) + ElementLine(1016 1486 770 1486 20) + Pin(1056 1594 60 35 "4" 0x01) + ElementLine(1016 1594 770 1594 20) + # Last pin in first row + Pin(1056 1702 60 35 "5" 0x01) + ElementLine(1016 1702 770 1702 20) + # Second row + Pin(944 1324 60 35 "6" 0x01) + ElementLine(904 1324 770 1324 20) + Pin(944 1432 60 35 "7" 0x01) + ElementLine(904 1432 770 1432 20) + Pin(944 1540 60 35 "8" 0x01) + ElementLine(904 1540 770 1540 20) + Pin(944 1648 60 35 "9" 0x01) + ElementLine(904 1648 770 1648 20) + # Plazierungsmarkierung == PIN 1 + Mark(1050 1270) + # Befestigungsbohrung + Pin(1000 1000 250 125 "C1" 0x01) + Pin(1000 1972 250 125 "C2" 0x01) +) Index: 1.0.8/pcblib/connector/pwrjack.fp =================================================================== --- 1.0.8/pcblib/connector/pwrjack.fp (nonexistent) +++ 1.0.8/pcblib/connector/pwrjack.fp (revision 1136) @@ -0,0 +1,16 @@ +##from:repo.hu/projects/openhw +##geo:90 +##geo:male + +Element["" "" "" "pwrjack" 124016 141732 0 0 0 100 ""] +( + Pin[0 0 19685 2000 20285 11811 "" "2" ""] + Pin[0 -27559 19685 2000 20285 11811 "" "1" ""] + Pin[-17717 -13779 19685 2000 20285 11811 "" "3" ""] + ElementLine [-17717 -55118 -17717 0 1000] + ElementLine [-17717 0 17716 0 1000] + ElementLine [17716 0 17716 -55118 1000] + ElementLine [17716 -55118 -17717 -55118 1000] + ElementLine [-17717 -43307 17716 -43307 1000] + + ) Index: 1.0.8/pcblib/parametric/acy =================================================================== --- 1.0.8/pcblib/parametric/acy (nonexistent) +++ 1.0.8/pcblib/parametric/acy (revision 1136) @@ -0,0 +1,56 @@ +#!/bin/sh + +#@@example acy(300) + +#@@purpose Generate axial lead tru-hole component + +#@@desc Generate axial lead tru-hole component with 2 pins (typical use: resistor) +#@@params spacing,type,pol,dia + +#@@param:spacing spacing between the two pins +#@@dim:spacing + +#@@param:type silk symbol type +#@@enum:type:block eu-style block resistor symbol +#@@enum:type:endcap block resistor with caps on the ends +#@@enum:type:zigzag us-style zigzag resistor symbol +#@@enum:type:line a single line (e.g. for jumper wires) +#@@enum:type:standing vertically aligned, body standing on pin 1, pin 2 bent back +#@@enum:type:coil wavy coil symbol +#@@enum:type:core wavy coil symbol with a parallel line +#@@enum:type:core2 wavy coil symbol with two parallel lines +#@@optional:type +#@@default:type block +#@@preview_args:type 300 + +#@@param:pol how to mark polarity +#@@enum:pol:none no marking +#@@enum:pol:sign + and - signs; pin 1 is + +#@@enum:pol:bar bar next to pin 1 +#@@enum:pol:dot dot next to pin 1 +#@@optional:pol +#@@default:pol none +#@@preview_args:pol 300 + +#@@param:dia body diameter - affects silk size +#@@dim:dia +#@@optional:dia +#@@default:dia spacing/6 + + +#@@param:wiper silk symbol wiper type +#@@enum:wiper:none no wiper +#@@enum:wiper:parrow perpendicular arrow, pointing inwards +#@@enum:wiper:aarrow angled arrow, pointing outwards +#@@enum:wiper:looparrow arrow starting at pin 2 looping back to point inwards on the body +#@@enum:wiper:thermistor wiper of a thermistor symbol +#@@optional:wiper +#@@default:wiper none +#@@preview_args:wiper 400 + +#@@thumbsize 2 + +#@@include common.awk + +awk -f `dirname $0`/common.awk -f `dirname $0`/acy.awk -v "args=$*" -v gen=`basename $0` + Property changes on: 1.0.8/pcblib/parametric/acy ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/pcblib/parametric/acy.awk =================================================================== --- 1.0.8/pcblib/parametric/acy.awk (nonexistent) +++ 1.0.8/pcblib/parametric/acy.awk (revision 1136) @@ -0,0 +1,152 @@ +function wave(type, repeat, step,x,y) +{ + step = len/repeat + for(x = sx1; x < sx2; x += step) { + if (type == 1) { + element_arc(x+step/2, 0, step/2, step/2, 0, -180) + } + else if (type == 2) { + y = dia + element_line(x, 0, x+step/4, -y) + element_line(x+step/4, -y, x+3*step/4, y) + element_line(x+3*step/4, y, x+step, 0) + + } + } +} + +BEGIN { + set_arg(P, "?type", "block") + proc_args(P, "spacing,type,pol,dia", "spacing") + + spacing = parse_dim(P["spacing"]) + dia = either(parse_dim(P["dia"]), spacing/6) + +# oops, dia is a radius rather + dia=dia/2 + + offs_x = +spacing/2 + + element_begin("", "R1", "acy" P["spacing"] ,0,0, spacing/2-spacing/5,-mil(20)) + + element_pin(-spacing/2, 0, 1) + element_pin(+spacing/2, 0, 2) + + dimension(-spacing/2, 0, +spacing/2, 0, dia*4, "spacing") + +# silk pins + if (P["type"] != "line") { + element_line(-spacing/2, 0, -spacing/4, 0) + element_line(+spacing/4, 0, +spacing/2, 0) + } + +# silk symbol + sx1 = -spacing/4 + sx2 = +spacing/4 + len = sx2-sx1 + if (P["type"] == "block") { + element_rectangle(sx1, -dia, sx2, +dia) + } + else if (P["type"] == "zigzag") { + wave(2, 3) + } + else if (P["type"] == "coil") { + wave(1, 4) + } + else if (P["type"] == "endcap") { + cl1 = len/9 + cl2 = len/8 + y1 = dia*1.2 + y2 = dia + rarc = dia/5 + element_line(sx1+cl2, y2, sx2-cl2, y2) + element_line(sx1+cl2, y2, sx1+cl1, y1) + element_line(sx2-cl2, y2, sx2-cl1, y1) + + element_line(sx1+cl2, -y2, sx2-cl2, -y2) + element_line(sx1+cl2, -y2, sx1+cl1, -y1) + element_line(sx2-cl2, -y2, sx2-cl1, -y1) + + element_rectangle(sx1, y1, sx1+cl1, -y1, "right,NE,SE", rarc) + element_rectangle(sx2-cl1, y1, sx2, -y1, "left,NW,SW", rarc) + } + else if (P["type"] ~ "^core") { + wave(1, 4) + nlines = P["type"] + sub("^core", "", nlines) + if (nlines == "") + nlines = 1 + + cdist = 3 * DEFAULT["line_thickness"] + y = -len/8 + for(nlines = int(nlines); nlines > 0; nlines--) { + y-=cdist + element_line(sx1, y, sx2, y) + } + } + else if (P["type"] == "line") { + element_line(-spacing/2, 0, +spacing/2, 0) + } + else if (P["type"] == "standing") { + r = dia*2 + if (r < DEFAULT["pin_ringdia"]/2*1.2) + r = DEFAULT["pin_ringdia"]/2*1.2 + element_arc(-spacing/2, 0, r, r, 0, 360) + element_line(-spacing/2, 0, +spacing/2, 0) + } + else { + error("Invalid type") + } + + dimension(sx2, -dia, sx2, dia, spacing/2, "dia") + +# silk wiper + if (P["wiper"] == "thermistor") { + x = len/3 + element_line(-4*x/4, dia*2, -2*x/4, dia*2) + element_line(-2*x/4, dia*2, +2*x/4, -dia*2) + } + else if (P["wiper"] == "aarrow") { + x = len/3 + element_arrow(-2*x/4, dia*2, +2*x/4, -dia*2-mil(30)) + } + else if (P["wiper"] == "parrow") { + element_arrow(0, -dia*2-mil(30), 0, -dia) + } + else if (P["wiper"] == "looparrow") { + y = -dia*2-mil(30) + x = sx2+len/8 + element_arrow(0, y, 0, -dia) + element_line(0, y, x, y) + element_line(x, y, x, 0) + } + else if ((P["wiper"] != "none") && (P["wiper"] != "")) { + error("Invalid wiper") + } + +# silk sign + if (P["pol"] == "sign") { + size=mil(10) + + offs_y = size*2.2 + offs_x = DEFAULT["pin_ringdia"]/2+size*1.1 + element_line(-size, 0, +size, 0) + + offs_x = spacing - (DEFAULT["pin_ringdia"]/2+size*1.1) + element_line(-size, 0, +size, 0) + element_line(0, -size, 0, +size) + } + else if (P["pol"] == "bar") { + offs=DEFAULT["line_thickness"] + element_rectangle(-spacing/4-offs, -dia, -spacing/4+offs, +dia, DEFAULT["line_thickness"]*4) + } + else if (P["pol"] == "dot") { + r=2*DEFAULT["line_thickness"]/3 + element_arc(-spacing/4-r*3, -dia/2, r, r, 0, 360) + } + else if ((P["pol"] != "") && (P["pol"] != "none")) { + error("Invalid pol") + } + + element_end() +} Index: 1.0.8/pcblib/parametric/alf =================================================================== --- 1.0.8/pcblib/parametric/alf (nonexistent) +++ 1.0.8/pcblib/parametric/alf (revision 1136) @@ -0,0 +1,37 @@ +#!/bin/sh + +#@@example alf(300, schottky) + +#@@purpose Generate ALF: axial lead tru-hole component for diodes + +#@@desc Generate axial lead tru-hole component with 2 pin diodes +#@@params spacing,type,dia +#@@thumbsize 2 + +#@@param:spacing spacing between the two pins +#@@dim:spacing + +#@@param:type symbol type +#@@enum:type:normal +#@@enum:type:schottky +#@@enum:type:zener +#@@enum:type:tunnel +#@@enum:type:varactor +#@@optional:type +#@@default:type normal +#@@preview_args:type 300 + +#@@param:dia body diameter - affects silk symbol size +#@@dim:dia +#@@optional:dia +#@@default:dia spacing/12 + +#@@param:aspect silk symbol aspect: total width expressed as a portion of spacing +#@@optional:aspect +#@@default:aspect spacing/6 + + +#@@include common.awk + +awk -f `dirname $0`/common.awk -f `dirname $0`/alf.awk -v "args=$*" -v gen=`basename $0` + Property changes on: 1.0.8/pcblib/parametric/alf ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/pcblib/parametric/alf.awk =================================================================== --- 1.0.8/pcblib/parametric/alf.awk (nonexistent) +++ 1.0.8/pcblib/parametric/alf.awk (revision 1136) @@ -0,0 +1,65 @@ +BEGIN { + + set_arg(P, "?aspect", 6) + set_arg(P, "?type", "normal") + + proc_args(P, "spacing,type,dia,aspect", "spacing") + + spacing = parse_dim(P["spacing"]) + dia = either(parse_dim(P["dia"]), spacing/6) + aspect = P["aspect"] + + offs_x = +spacing/2 + + element_begin("", "D1", "acy" P["spacing"] ,0,0, 2.2*spacing/3,-mil(50)) + + element_pin(-spacing/2, 0, 1) + element_pin(+spacing/2, 0, 2) + dimension(-spacing/2, 0, +spacing/2, 0, dia*4, "spacing") + +# pins + element_line(-spacing/2, 0, -spacing/aspect, 0) + element_line(+spacing/aspect, 0, +spacing/2, 0) + +# triangle + element_line(+spacing/aspect, -dia, +spacing/aspect, +dia) + element_line(+spacing/aspect, -dia, -spacing/aspect, 0) + element_line(+spacing/aspect, +dia, -spacing/aspect, 0) + + dimension(+spacing/aspect, -dia, +spacing/aspect, dia, "@" spacing*1.2 ";0", "dia") + + +# front cross line with decoration + r = dia*0.3 + if (P["type"] == "normal") { + element_line(-spacing/aspect, -dia, -spacing/aspect, +dia) + } + else if (P["type"] == "zener") { + element_line(-spacing/aspect, -dia, -spacing/aspect, +dia) + element_line(-spacing/aspect, +dia, -spacing/aspect-r, +dia) + element_line(-spacing/aspect, -dia, -spacing/aspect+r, -dia) + } + else if (P["type"] == "tunnel") { + element_line(-spacing/aspect, -dia, -spacing/aspect, +dia) + element_line(-spacing/aspect, +dia, -spacing/aspect+r, +dia) + element_line(-spacing/aspect, -dia, -spacing/aspect+r, -dia) + } + else if (P["type"] == "varactor") { + element_line(-spacing/aspect, -dia, -spacing/aspect, +dia) + element_line(-spacing/aspect-r, -dia, -spacing/aspect-r, +dia) + } + else if (P["type"] == "schottky") { + cx = -spacing/aspect + r + cy = -(dia-r) + element_line(-spacing/aspect, -(dia-r), -spacing/aspect, +dia-r) + element_arc(cx, cy, r, r, 0, -180) + cx = -spacing/aspect - r + cy = +(dia-r) + element_arc(cx, cy, r, r, 0, +180) + } + else if ((P["type"] != "") && (P["type"] != "none")) { + error("Invalid type") + } + + element_end() +} Index: 1.0.8/pcblib/parametric/bga =================================================================== --- 1.0.8/pcblib/parametric/bga (nonexistent) +++ 1.0.8/pcblib/parametric/bga (revision 1136) @@ -0,0 +1,69 @@ +#!/bin/sh + +# Reference: Microchip Packaging Specification DS00000049BX (en012702.pdf), SSOP + +#@@example bga(map=a1:a2:a2:#:b1:!:b3:#:c1:c2:!) + +#@@purpose Generate ball grid array + +#@@desc Generate a grid of circular pads for BGA chips + +#@@params nx,ny,spacing,balldia,silkmark,map,width,height,automap,automap2 + +#@@param:nx number of pins in the X direction +#@@optional:nx +#@@default:nx deduced from the map + +#@@param:ny number of pins in the Y direction +#@@optional:ny +#@@default:ny deduced from the map + +#@@param:spacing spacing between the pins +#@@dim:spacing +#@@default:spacing 0.5 mm + +#@@param:balldia diameter of a ball +#@@dim:balldia +#@@default:spacing 0.35 mm + +#@@include silkmark.help +#@@optional:silkmark +#@@default:silkmark square +#@@preview_args:silkmark 3,3 + +#@@param:map pin name map; a colon separated list of names, from left to right, rows first. If a name is empty or is a hash mark, a new row is started. If a name is a !, the given pin is missing and no pad is generated. +#@@optional:map + +#@@param:width width of the box (silk rectangle x size) +#@@dim:width +#@@optional:width +#@@default:width two columns wider than the array + +#@@param:height height of the box (silk rectangle y size) +#@@dim:height +#@@optional:height +#@@default:height two columns higher than the array + + +#@@param:automap assume a regular nx*ny array, automap (autonumber) the pins +#@@optional:automap +#@@enum:automap:none do not autonumber pins +#@@enum:automap:alnum number y rows from A..Z (then AA..AZ) from top to bottom, number x rows from 0..nx left to right +#@@default:none +#@@preview_args:automap 3,3 +#@@thumbsize:automap 3 +#@@thumbnum:automap 1 + +#@@param:automap2 change how automap behaves - multiple values separated by colon are accepted (e.g. automap2=pivot,reversex) +#@@enum:automap2:pivot swap x and y +#@@enum:automap2:reversex number x from right to left +#@@enum:automap2:reversey number y from bottom up +#@@preview_args:automap2 3,3,automap=alnum +#@@thumbsize:automap2 3 +#@@thumbnum:automap2 1 + + +#@@include common.awk + +awk -f `dirname $0`/common.awk -f `dirname $0`/bga.awk -v "args=$*" -v gen=`basename $0` + Property changes on: 1.0.8/pcblib/parametric/bga ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/pcblib/parametric/bga.awk =================================================================== --- 1.0.8/pcblib/parametric/bga.awk (nonexistent) +++ 1.0.8/pcblib/parametric/bga.awk (revision 1136) @@ -0,0 +1,117 @@ +function pinalpha(p, s) +{ + if (p >= 26) + s = pinalpha(int(p/26)-1) + return s sprintf("%c", 65 + (p % 26)) +} + +function automap(algo, pivot, revx, revy ,xx,yy) +{ + if (algo == 1) { + for(y = 0; y < ny; y++) { + if (revy) + yy = ny - y - 1 + else + yy = y + for(x = 0; x < nx; x++) { + if (revx) + xx = nx - x - 1 + else + xx = x + if (pivot) + MAP[x,y] = pinalpha(xx) yy+1 + else + MAP[x,y] = pinalpha(yy) xx+1 + } + } + } +} + +BEGIN { + set_arg(P, "?spacing", "0.5mm") + set_arg(P, "?balldia", "0.35mm") + set_arg(P, "?silkmark", "arc") + + proc_args(P, "nx,ny,spacing,balldia,silkmark,map,width,height,automap,automap2", "") + + step = parse_dim(P["spacing"]) + + half=step/2 + + nx = int(P["nx"]) + ny = int(P["ny"]) + + if (P["map"] != "") { + v = split(P["map"], A, ":") + x = 0 + y = 0 + for(n = 1; n <= v; n++) { + if ((A[n] == "") || (A[n] == "#")) { + x = 0 + y++ + continue; + } + if (x > nx) + nx = x + if (y > ny) + ny = y + print x,y,A[n] > "/dev/stderr" + MAP[x, y] = A[n] + x++ + } + ny++; + } + else { + if ((nx == "") || (ny == "")) + error("missing argument: need nx,ny or a map") + if (P["automap"] ~ "alnum") + automap(1, (P["automap2"] ~ "pivot"), (P["automap2"] ~ "reversex"), (P["automap2"] ~ "reversey")) + else if ((P["automap"] ~ "none") || (P["automap"] == "")) { + } + else + error("automap should be alnum or none") + } + + balldia = parse_dim(P["balldia"]) + bw = parse_dim(P["width"]) + bh = parse_dim(P["height"]) + + if (bw == "") + bw = (nx+1)*step + if (bh == "") + bh = (ny+1)*step + + xo = (nx-1)*step/2 + yo = (ny-1)*step/2 + + element_begin("", "U1", nx "*" ny ,0,0, 0, -bh) + + for(x = 0; x < nx; x++) { + for(y = 0; y < ny; y++) { + xx = x * step - xo + yy = y * step - yo + name = MAP[x,y] + if (name == "!") + continue + if (name == "") + name = "NC" + element_pad_circle(xx, yy, balldia, name) + } + } + + dimension(-xo, -yo, -xo+step, -yo, bw/2, "spacing") + dimension(-xo-balldia/2, +yo, -xo+balldia/2, +yo, -bw*0.75, "balldia") + + + xx = -1 * (bw/2) + yy = -1 * (bh/2) + element_rectangle(xx, yy, bw/2, bh/2) + + dimension(xx, yy, bw/2, yy, bw/2, "width") + dimension(bw/2, yy, bw/2, bh/2, +bh/2, "height") + + silkmark(P["silkmark"], xx, yy, half*1.5) + + + element_end() +} Index: 1.0.8/pcblib/parametric/common.awk =================================================================== --- 1.0.8/pcblib/parametric/common.awk (nonexistent) +++ 1.0.8/pcblib/parametric/common.awk (revision 1136) @@ -0,0 +1,517 @@ +#@@param:pin_ringdia pin's copper ring (annulus) outer diameter (in mil by default, mm suffix can be used) +#@@optional:pin_ringdia +#@@dim:pin_ringdia + +#@@param:pin_clearance pin's copper clearance diameter (in mil by default, mm suffix can be used) +#@@optional:pin_clearance +#@@dim:pin_clearance + +#@@param:pin_mask pin's solder mask diameter (in mil by default, mm suffix can be used) +#@@optional:pin_mask +#@@dim:pin_mask + +#@@param:pin_drill copper pin's drill diameter (in mil by default, mm suffix can be used) +#@@optional:pin_drill +#@@dim:pin_drill + +#@@param:pad_thickness width of pads (in mil by default, mm suffix can be used) +#@@optional:pad_thickness +#@@dim:pad_thickness + +#@@param:pad_clearance copper clearance around the pad (in mil by default, mm suffix can be used) +#@@optional:pad_clearance +#@@dim:pad_clearance + +#@@param:pad_mask pin's solder mask (in mil by default, mm suffix can be used) +#@@optional:pad_mask +#@@dim:pad_mask + +#@@param:line_thickness silk line thickness (in mil by default, mm suffix can be used) +#@@optional:line_thickness +#@@dim:line_thickness + +BEGIN { + q="\"" + + DEFAULT["pin_ringdia"] = 8000 + DEFAULT["pin_ringdia", "dim"] = 1 + + DEFAULT["pin_clearance"] = 5000 + DEFAULT["pin_clearance", "dim"] = 1 + + DEFAULT["pin_mask"] = 8600 + DEFAULT["pin_mask", "dim"] = 1 + + DEFAULT["pin_drill"] = 3937 + DEFAULT["pin_drill", "dim"] = 1 + + DEFAULT["line_thickness"] = 1000 + DEFAULT["line_thickness", "dim"] = 1 + + DEFAULT["pad_thickness"] = 2000 + DEFAULT["pad_thickness", "dim"] = 1 + DEFAULT["pad_clearance"] = 1000 + DEFAULT["pad_clearance", "dim"] = 1 + DEFAULT["pad_mask"] = 3000 + DEFAULT["pad_mask", "dim"] = 1 + + DEFAULT["pin_flags"] = "__auto" + + s_default=1 + s_weak=2 + s_explicit=3 + + offs_x = 0 + offs_y = 0 + + pi=3.141592654 +} + +# Throw an error and exit +function error(msg) +{ + print "Error: " msg > "/dev/stderr" + exit 1 +} + +# return a if it is not empty, else return b +function either(a, b) +{ + return a != "" ? a : b +} + +# strip leading/trailing whitespaces +function strip(s) +{ + sub("^[ \t\r\n]*", "", s) + sub("[ \t\r\n]*$", "", s) + return s +} + +# translate coordinates +function coord_x(x) { return int(x + offs_x) } +function coord_y(y) { return int(y + offs_y) } + +# generate an element header line; any argument may be empty +function element_begin(desc, name, value, cent_x, cent_y, text_x, text_y, text_dir, text_scale) +{ + if (desc == "") { + desc = gen "(" args ")" + gsub("[\r\n\t ]*[?][^,]*,[\r\n\t ]*", "", desc) + gsub("[\r\n\t]", " ", desc) + } + print "Element[" q q, q desc q, q name q, q value q, + int(either(cent_x, 0)), int(either(cent_y, 0)), + int(either(text_x, 0)), int(either(text_y, 0)), + int(either(text_dir, 0)), int(either(text_scale, 100)), q q "]" + print "(" +} + +# generate an element footer line +function element_end() +{ + print ")" +} + +# generate a pin; arguments from ringdia are optional (defaults are in global vars pin_*) +function element_pin(x, y, number, flags, ringdia, clearance, mask, drill, name) +{ + if (number == "") + number = ++pin_number + + flags = either(flags, DEFAULT["pin_flags"]) + + if (flags == "__auto") { + if (number == 1) + flags = "square" + else + flags = "" + } + + print " Pin[" coord_x(x), coord_y(y), + int(either(ringdia, DEFAULT["pin_ringdia"])), int(either(clearance, DEFAULT["pin_clearance"])), int(either(mask, DEFAULT["pin_mask"])), + int(either(drill, DEFAULT["pin_drill"])), q name q, q number q, q flags q "]" +} + +# draw element pad +function element_pad(x1, y1, x2, y2, thickness, number, flags, clearance, mask, name) +{ + print " Pad[", coord_x(x1), coord_y(y1), coord_x(x2), coord_y(y2), int(either(thickness, DEFAULT["pad_thickness"])), + int(either(clearance, DEFAULT["pad_clearance"])), int(either(mask, DEFAULT["pad_mask"])), + q name q, q number q, q flags q "]" +} + +# draw element pad - no thickness, but exact corner coordinates given +function element_pad_rectangle(x1, y1, x2, y2, number, flags, clearance, mask, name, th,dx,dy,cx,cy) +{ + if (x2 < x1) { + th = x2 + x2 = x1 + x1 = th + } + if (y2 < y1) { + th = y2 + y2 = y1 + y1 = th + } + + dx = x2-x1 + dy = y2-y1 + + if (dx >= dy) { + th = dy + cy = (y1+y2)/2 + + print " Pad[", coord_x(x1)+th/2, coord_y(cy), coord_x(x2)-th/2, coord_y(cy), th, + int(either(clearance, DEFAULT["pad_clearance"])), int(either(mask, DEFAULT["pad_mask"])), + q name q, q number q, q flags q "]" + } + else { + th = dx + cx = (x1+x2)/2 + + print " Pad[", coord_x(cx), coord_y(y1)+th/2, coord_x(cx), coord_y(y2)-th/2, th, + int(either(clearance, DEFAULT["pad_clearance"])), int(either(mask, DEFAULT["pad_mask"])), + q name q, q number q, q flags q "]" + } +} + +# draw element pad circle +function element_pad_circle(x1, y1, radius, number, clearance, mask, name) +{ + print " Pad[", coord_x(x1), coord_y(y1), coord_x(x1), coord_y(y1), int(either(radius, DEFAULT["pad_thickness"])), + int(either(clearance, DEFAULT["pad_clearance"])), int(either(mask, DEFAULT["pad_mask"])), + q name q, q number q, q "" q "]" +} + +# draw a line on silk; thickness is optional (default: line_thickness) +function element_line(x1, y1, x2, y2, thickness) +{ + print " ElementLine[" coord_x(x1), coord_y(y1), coord_x(x2), coord_y(y2), int(either(thickness, DEFAULT["line_thickness"])) "]" +} + +function element_arrow(x1, y1, x2, y2, asize, thickness ,vx,vy,nx,ny,len,xb,yb) +{ + element_line(x1, y1, x2,y2, thickness) + + if (asize == 0) + asize = mil(20) + + vx = x2-x1 + vy = y2-y1 + len = sqrt(vx*vx+vy*vy) + if (len != 0) { + vx /= len + vy /= len + nx = vy + ny = -vx + xb = x2 - vx*asize + yb = y2 - vy*asize +# element_line(x2, y2, xb + 1000, yb + 1000) + element_line(x2, y2, xb + nx*asize/2, yb + ny*asize/2) + element_line(x2, y2, xb - nx*asize/2, yb - ny*asize/2) + element_line(xb - nx*asize/2, yb - ny*asize/2, xb + nx*asize/2, yb + ny*asize/2) + } +} + +# draw a rectangle of silk lines +# omit sides as requested in omit +# if r is non-zero, round corners - omit applies as NW, NW, SW, SE +# if omit includes "arc", corners are "rounded" with lines +function element_rectangle(x1, y1, x2, y2, omit, r, thickness ,tmp,r1,r2) +{ +# order coords for round corners + if (x1 > x2) { + tmp = x1 + x1 = x2 + x2 = tmp + } + if (y1 > y2) { + tmp = y1 + y1 = y2 + y2 = tmp + } + + if (!(omit ~ "left")) { + r1 = (omit ~ "NW") ? 0 : r + r2 = (omit ~ "SW") ? 0 : r + element_line(x1, y1+r1, x1, y2-r2, thickness) + } + if (!(omit ~ "top")) { + r1 = (omit ~ "NW") ? 0 : r + r2 = (omit ~ "NE") ? 0 : r + element_line(x1+r1, y1, x2-r2, y1, thickness) + } + if (!(omit ~ "bottom")) { + r1 = (omit ~ "SE") ? 0 : r + r2 = (omit ~ "SW") ? 0 : r + element_line(x2-r1, y2, x1+r2, y2, thickness) + } + if (!(omit ~ "right")) { + r1 = (omit ~ "SE") ? 0 : r + r2 = (omit ~ "NE") ? 0 : r + element_line(x2, y2-r1, x2, y1+r2, thickness) + } + + if (r > 0) { + if (omit ~ "arc") { + if (!(omit ~ "NW")) + element_line(x1, y1+r, x1+r, y1) + if (!(omit ~ "SW")) + element_line(x1, y2-r, x1+r, y2) + if (!(omit ~ "NE")) + element_line(x2, y1+r, x2-r, y1) + if (!(omit ~ "SE")) + element_line(x2, y2-r, x2-r, y2) + } + else { + if (!(omit ~ "NW")) + element_arc(x1+r, y1+r, r, r, 270, 90) + if (!(omit ~ "SW")) + element_arc(x1+r, y2-r, r, r, 0, 90) + if (!(omit ~ "NE")) + element_arc(x2-r, y1+r, r, r, 180, 90) + if (!(omit ~ "SE")) + element_arc(x2-r, y2-r, r, r, 90, 90) + } + } +} + +# draw a rectangle corners of silk lines, wx and wy long in x and y directions +# omit sides as requested in omit: NW, NW, SW, SE +# corners are always sharp +function element_rectangle_corners(x1, y1, x2, y2, wx, wy, omit, thickness ,tmp) +{ + if (!(omit ~ "NW")) { + element_line(x1, y1, x1+wx, y1, thickness) + element_line(x1, y1, x1, y1+wy, thickness) + } + if (!(omit ~ "NE")) { + element_line(x2-wx, y1, x2, y1, thickness) + element_line(x2, y1, x2, y1+wy, thickness) + } + if (!(omit ~ "SW")) { + element_line(x1, y2, x1+wx, y2, thickness) + element_line(x1, y2-wy, x1, y2, thickness) + } + if (!(omit ~ "SE")) { + element_line(x2-wx, y2, x2, y2, thickness) + element_line(x2, y2-wy, x2, y2, thickness) + } +} + +# draw a line on silk; thickness is optional (default: line_thickness) +function element_arc(cx, cy, rx, ry, a_start, a_delta, thickness) +{ + print " ElementArc[" coord_x(cx), coord_y(cy), int(rx), int(ry), int(a_start), int(a_delta), int(either(thickness, DEFAULT["line_thickness"])) "]" +} + + +# convert coord given in mils to footprint units +function mil(coord) +{ + return coord * 100 +} + +# reverse mil(): converts footprint units back to mil +function rev_mil(coord) +{ + return coord/100 +} + + +# convert coord given in mm to footprint units +function mm(coord) +{ + return coord*3937 +} + +# reverse mm(): converts footprint units back to mm +function rev_mm(coord) +{ + return coord/3937 +} + + +function set_arg_(OUT, key, value, strength) +{ + if (OUT[key, "strength"] > strength) + return + + OUT[key] = value + OUT[key, "strength"] = strength +} + +# set parameter key=value with optioal strength (s_* consts) in array OUT[] +# set only if current strength is stronger than the original value +# if key starts with a "?", use s_weak +# if key is in DEFAULT[], use DEFAULT[] instead of OUT[] +function set_arg(OUT, key, value ,strength) +{ + if (strength == "") + strength = s_explicit + if (key ~ "^[?]") { + sub("^[?]", "", key) + strength = s_weak + } + + if (key in DEFAULT) { + if (DEFAULT[key, "dim"]) { + if (value ~ "mm") + value = mm(value) + else + value = mil(value) + } + set_arg_(DEFAULT, key, value, strength) + } + else + set_arg_(OUT, key, value, strength) +} + +# Process a generator argument list from arg_names. Save the result in +# array OUT. If mandatory is specified, check whether all mandatory +# parameters are specified +# Both arg_names and mandatory are comma separated list of argument names +function proc_args(OUT, arg_names, mandatory, N,A,M,v,n,key,val,pos) +{ + gsub(" ", "", arg_names) + gsub(" ", "", mandatory) + split(arg_names, N, ",") + v = split(args, A, ",") + +# fill in all named and positional arguments + pos = 1 + for(n = 1; n <= v; n++) { + A[n] = strip(A[n]) + if (A[n] == "") + continue + if (A[n] ~ "=") { +# named + key=A[n] + val=A[n] + sub("=.*", "", key) + sub("^[^=]*=", "", val) + set_arg(OUT, key, val, s_explicit) + } + else { +# positional + if (N[pos] == "") { + error("too many positional arguments at " A[n]) + } + while((N[pos] in OUT) && (N[pos, "strength"] == s_explicit)) pos++ + set_arg(OUT, N[pos], A[n], s_explicit) + pos++ + } + } + +# check whether all mandatory arguments are specified + v = split(mandatory, M, ",") + for(n = 1; n <= v; n++) { + if (!(M[n] in OUT)) { + error("missing argument " M[n] " (or positional " n ")") + exit 1 + } + } +} + +# Assume h is a dimension; if it has an "mm" suffix, convert it from mm, +# else convert it from mil. +function parse_dim(h) +{ + if (h == "") + return "" + if (h ~ "mm") { + sub("mm", "", h) + return mm(h) + } + return mil(h) +} + +# Draw a DIP outline: useful for any rectangular package with a little +# half circle centered on the top line +# arcr: radius of the half circle +# xhalf: optional coordinate where the circle should be put +function dip_outline(x1, y1, x2, y2, arcr ,xhalf) +{ + if (xhalf == "") + xhalf=(x1+x2)/2 + + element_rectangle(x1, y1, x2, y2, "top") + element_line(x1, y1, xhalf-arcr, y1) + element_line(xhalf+arcr, y1, x2, y1) + + element_arc(xhalf, y1, arcr, arcr, 0, 180) +} + +# decide whether x is true or false +# returns 1 if true +# returns 0 if false +function tobool(x) +{ + if (x == int(x)) + return (int(x) != 0) + + x = tolower(x) + return (x == "true") || (x == "yes") || (x == "on") +} + +# default pin1 mark on a box +# style: mark style, ":" separated list +# x,y: the coordinates of the origin corner (top-left) +# half: half the stepping of the pin grid - the size of the mark +# step: optional size of the external arrow or square (defaults to 2*half) +function silkmark(style, x, y, half, step, S,n,v) +{ + if (step == "") + step = half*2 + + v = split(style, S, ":") + + for(n = 1; n <= v; n++) { + if (S[n] == "angled") { + element_line(x+half, y, x, y+half) + } + else if (S[n] == "square") { + element_line(x, y+step, x+2*half, y+step) + element_line(x+step, y, x+2*half, y+step) + } + else if ((S[n] == "external") || (S[n] == "externalx")) { + element_line(x, y+half, x-step+half, y+half/2) + element_line(x, y+half, x-step+half, y+half*1.5) + element_line(x-step+half, y+half/2, x-step+half, y+half*1.5) + } + else if (S[n] == "externaly") { + element_line(x+half, y, x-half/2+half, y-step+half) + element_line(x+half, y, x+half/2+half, y-step+half) + element_line(x-half/2+half, y-step+half, x+half/2+half, y-step+half) + } + else if (S[n] == "external45") { + element_line(x, y, x-half, y-half/3) + element_line(x, y, x-half/3, y-half) + element_line(x-half, y-half/3, x-half/3, y-half) + } + else if (S[n] == "arc") { + element_arc(x, y, step/2, step/2, 180, 270) + } + else if (S[n] == "circle") { + element_arc(x, y, step/2, step/2, 0, 360) + } + else if (S[n] == "dot") { + element_arc(x-step/2, y-step/2, step/4, step/4, 0, 360) + } + else if ((S[n] != "none") && (S[n] != "")) { + error("invalid silkmark parameter: " S[n]) + } + } +} + +# output a dimension specification between x1;y1 and x2;y2, text distance at dist +# for a name,value pair +# if name is empty, only value is printed +# if value is empty, it's calculated +# if only name should be printed, value should be "!" +# if dist starts with a "@", it's the absolute coordinate of the center of the dim line (text base), else it's relative distance from the measured line +function dimension(x1, y1, x2, y2, dist, name, value, vx,vy) +{ + print "#dimension", coord_x(x1), coord_y(y1), coord_x(x2), coord_y(y2), dist, name, value +} Index: 1.0.8/pcblib/parametric/connector =================================================================== --- 1.0.8/pcblib/parametric/connector (nonexistent) +++ 1.0.8/pcblib/parametric/connector (revision 1136) @@ -0,0 +1,53 @@ +#!/bin/sh + +#@@example connector(2, 3, silkmark=external) + +#@@purpose Generate pin-array connectors (e.g. headers). + +#@@desc Generate thru-hole connectors that consits of an array of +#@@desc evenly spaced pins, a plain frame and some optional pin marks +#@@desc on the silk layer. + +#@@params nx, ny, spacing, silkmark, eshift, etrunc + +#@@param:nx number of pins in the X direction +#@@param:ny number of pins in the Y direction +#@@param:spacing spacing between the pins +#@@dim:spacing +#@@default:spacing 100 mil + +#@@include silkmark.help +#@@optional:silkmark +#@@default:silkmark square +#@@preview_args:silkmark 2,3 + +#@@param:eshift shift even rows or columns by half spacing (optional; default: don't shift) +#@@enum:eshift:x shift columns +#@@enum:eshift:y shift rows +#@@enum:eshift:none do not shift anything +#@@default:eshift none +#@@optional:eshift +#@@preview_args:eshift 2,3 + +#@@param:etrunc truncate the last pin of a shifted row or column +#@@bool:etrunc +#@@default:etrunc false +#@@optional:etrunc +#@@preview_args:etrunc 2,3,eshift=x + +#@@param:sequence pin numbering sequence +#@@enum:sequence:normal increase by y first, then by x +#@@enum:sequence:pivot increase by x first, then by y +#@@enum:sequence:zigzag "dip-style" numbering in zig-zag: number odd x rows by y ascending, even x rows by y descending +#@@preview_args:sequence 2,4 +#@@thumbsize:sequence 3 +#@@thumbnum:sequence 1 +#@@default:sequence normal +#@@optional:sequence + + + +#@@include common.awk + +awk -f `dirname $0`/common.awk -f `dirname $0`/connector.awk -v "args=$*" -v gen=`basename $0` + Property changes on: 1.0.8/pcblib/parametric/connector ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/pcblib/parametric/connector.awk =================================================================== --- 1.0.8/pcblib/parametric/connector.awk (nonexistent) +++ 1.0.8/pcblib/parametric/connector.awk (revision 1136) @@ -0,0 +1,87 @@ +BEGIN { + set_arg(P, "?spacing", 100) + set_arg(P, "?silkmark", "square") + set_arg(P, "?sequence", "normal") + + proc_args(P, "nx,ny,spacing,silkmark,eshift,etrunc", "nx,ny") + + + step = parse_dim(P["spacing"]) + + if (pin_ringdia > step*0.9) + pin_ringdia = step*0.9 + + if (pin_drill > pin_ringdia*0.9) + pin_drill = pin_ringdia*0.9 + + half=step/2 + + P["nx"] = int(P["nx"]) + P["ny"] = int(P["ny"]) + + eshift=tolower(P["eshift"]) + etrunc=tobool(P["etrunc"]) + if ((eshift != "x") && (eshift != "y") && (eshift != "") && (eshift != "none")) + error("eshift must be x or y or none (got: " eshift ")"); + + element_begin("", "CONN1", P["nx"] "*" P["ny"] ,0,0, 0, -step) + + for(x = 0; x < P["nx"]; x++) { + if ((eshift == "x") && ((x % 2) == 1)) + yo = step/2 + else + yo = 0 + for(y = 0; y < P["ny"]; y++) { + if ((eshift == "y") && ((y % 2) == 1)) { + xo = step/2 + if ((etrunc) && (x == P["nx"]-1)) + continue + } + else { + xo = 0 + if ((etrunc) && (y == P["ny"]-1) && (yo != 0)) + continue + } + if (P["sequence"] == "normal") { + pinno++ + } + else if (P["sequence"] == "pivot") { + pinno = y * P["nx"] + x + 1 + } + else if (P["sequence"] == "zigzag") { + if (x % 2) { + pinno = (x+1) * P["ny"] - y + if ((etrunc) && (eshift == "x")) + pinno -= int(x/2)+1 + else if ((etrunc) && (eshift == "y")) + pinno += int(x/2) + } + else { + pinno = x * P["ny"] + y + 1 + if ((etrunc) && (eshift == "x")) + pinno -= x/2 + else if ((etrunc) && (eshift == "y")) + pinno += x/2-1 + } + } + element_pin(x * step + xo, y * step + yo, pinno) + } + } + + xo = 0 + yo = 0 + if (!etrunc) { + if (eshift == "y") + xo = step/2 + if (eshift == "x") + yo = step/2 + } + + element_rectangle(-half, -half, P["nx"] * step - half + xo, P["ny"] * step - half + yo) + + silkmark(P["silkmark"], -half, -half, half) + + dimension(0, step, step, step, step*2, "spacing") + + element_end() +} Index: 1.0.8/pcblib/parametric/dip =================================================================== --- 1.0.8/pcblib/parametric/dip (nonexistent) +++ 1.0.8/pcblib/parametric/dip (revision 1136) @@ -0,0 +1,21 @@ +#!/bin/sh + +#@@example dip(18) + +#@@purpose Generate classic DIP packages. + +#@@desc Generate thru-hole DIP packages with variable number of pins and +#@@desc row spacing +#@@params n, spacing + +#@@param:n number of pins + +#@@param:spacing spacing between the two rows of pins +#@@dim:spacing +#@@optional:spacing +#@@default:spacing 100 mil + +#@@include common.awk + +awk -f `dirname $0`/common.awk -f `dirname $0`/dip.awk -v "args=$*" -v gen=`basename $0` + Property changes on: 1.0.8/pcblib/parametric/dip ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/pcblib/parametric/dip.awk =================================================================== --- 1.0.8/pcblib/parametric/dip.awk (nonexistent) +++ 1.0.8/pcblib/parametric/dip.awk (revision 1136) @@ -0,0 +1,27 @@ +BEGIN { + set_arg(P, "?spacing", 300) + + proc_args(P, "n,spacing", "n") + + P["n"] = int(P["n"]) + if ((P["n"] < 2) || ((P["n"] % 2) != 0)) + error("Number of pins have to be an even positive number") + + spacing=parse_dim(P["spacing"]) + + element_begin("", "U1", P["n"] "*" P["spacing"] ,0,0, 0, mil(-100)) + + half = mil(50) + + for(n = 1; n <= P["n"]/2; n++) { + element_pin(0, (n-1) * mil(100), n) + element_pin(spacing, (n-1) * mil(100), P["n"] - n + 1) + } + + dip_outline(-half, -half, spacing + half , (n-2) * mil(100) + half, half) + + + dimension(0, 0, spacing, 0, mil(100), "spacing") + + element_end() +} Index: 1.0.8/pcblib/parametric/msop =================================================================== --- 1.0.8/pcblib/parametric/msop (nonexistent) +++ 1.0.8/pcblib/parametric/msop (revision 1136) @@ -0,0 +1,28 @@ +#!/bin/sh + +# Reference: Microchip Packaging Specification DS00000049BX (en012702.pdf), MSOP + +#@@example msop(8) + +#@@purpose Generate MSOP packages. + +#@@desc Generate MSOP packages with variable number of pins and +#@@desc row spacing + +#@@include so +#@@include common.awk + + +defaults=' +?pad_spacing=0.65mm, +?row_spacing=4.9mm, +?int_bloat=0.6mm, +?ext_bloat=0.4mm, +?rarc=25, +?silk_ext_x=18, +?silk_ext_y=22, +?pad_thickness=0.45mm +' + +awk -f `dirname $0`/common.awk -f `dirname $0`/so.awk -v "args=$defaults,$*" -v gen=`basename $0` + Property changes on: 1.0.8/pcblib/parametric/msop ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/pcblib/parametric/plcc =================================================================== --- 1.0.8/pcblib/parametric/plcc (nonexistent) +++ 1.0.8/pcblib/parametric/plcc (revision 1136) @@ -0,0 +1,29 @@ +#!/bin/sh + +# Reference: Microchip Packaging Specification DS00000049BX (en012702.pdf), SSOP + +#@@example plcc(20) + +#@@purpose Generate PLCC packages +#@@desc Generate square PLCC packages - a simplified frontend to qf() - +#@@desc only the number of pins is really needed for a square PLCC footprint! +#@@desc NOTE: some of the qf() parameters can be also used; PLCC32 is non-square, and can not be properly generated using this generator. + +#@@params pins,size,pitch,cpad_size + +#@@param:pin total number of pins (leads); must be divisible by 4 + +#@@param:size a single integer N or NxN or NxNxH; outmost dimensions (width or height of the package, leads included) in mil +#@@optional:size +#@@default:size calculated from total number of pins and pitch + +#@@param:pitch lead pitch (distance between the centerline of two adjacent leads), in mil; must be 50 for now +#@@optional:pitch +#@@default:pitch 50mil + +#@@param:cpad_size width (and height) of the central pad, in mil +#@@optional:cpad_size +#@@default:cpad_size empty, there's no central pad + +awk -f `dirname $0`/common.awk -f `dirname $0`/plcc.awk -f `dirname $0`/qf.awk -v "args=$*" -v gen=`basename $0` + Property changes on: 1.0.8/pcblib/parametric/plcc ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/pcblib/parametric/plcc.awk =================================================================== --- 1.0.8/pcblib/parametric/plcc.awk (nonexistent) +++ 1.0.8/pcblib/parametric/plcc.awk (revision 1136) @@ -0,0 +1,58 @@ +function parri(A ,s,i) +{ + for(i in A) + s = s " " i + return s +} + +BEGIN { + + PT["50"] = "26mil" + set_arg(P, "?pitch", "50") + + proc_args(P, "pins,size,pitch,cpad_size,pad_thickness", "pins") + + pitch = P["pitch"] + sub("[.]0*$", "", pitch) + + if (!(args ~ "pad_thickness=")) { + if (!(pitch in PT)) + error("Unkown pitch (" pitch "), should be one of:" parri(PT)) + pt = PT[pitch] + } + else + pt = rev_mil(DEFAULT["pad_thickness"]) + + if (P["size"] == "") + P["size"] = int(P["pins"] * (pitch/4) + 140) + + split(P["size"], S, "x") + if (S[2] == "") + S[2] = S[1] + if (S[1] != S[2]) + error("need n*n size") + + pins = int(P["pins"]) + if (pins / 4 != int(pins / 4)) + error("number of pins must be divisible by 4") + + pins=pins/4 + + if ((pins % 2) != 1) + error("number of pins per side must be odd") + + S[1] -= 60 + S[2] -= 60 + args = args ",nx=" pins ",ny=" pins ",x_spacing=" S[1] "mil,y_spacing=" S[2] "mil,pad_spacing=" pitch "mil,pad_thickness=" pt "mil" + + args = args ",width=" S[1]-150 " mil,height=" S[2]-150 " mil" + + + if (P["cpad_size"] != "") + args = args ",cpad_width=" P["cpad_size"] "mil,cpad_height=" P["cpad_size"] "mil" + + args = args ",int_bloat=47mil,ext_bloat=47mil" + args = args ",?bodysilk=plcc,?silkmark=circle,pinoffs=" int(pins/2+0.5) + + +} Index: 1.0.8/pcblib/parametric/qf =================================================================== --- 1.0.8/pcblib/parametric/qf (nonexistent) +++ 1.0.8/pcblib/parametric/qf (revision 1136) @@ -0,0 +1,87 @@ +#!/bin/sh + +#@@example qf(nx=4,ny=4,cpad_auto=1) + +#@@purpose Generate generic *qf* (e.g. tqfp, qfn) packages + +#@@desc Generate *qf* (e.g. tqfp, qfn) packages: smd pads around a square; this is the generic implementation, end users may want to use the specific ones, e.g. tqfp(), qfn(), etc. +#@@params nx,ny,x_spacing,y_spacing,pad_spacing,ext_bloat,int_bloat,width,height,cpad_width,cpad_height,cpad_auto,bodysilk,pinoffs,silkmark + +#@@param:nx number of pins along the horizontal sides + +#@@param:ny number of pins along the vertical sides +#@@optional:ny +#@@default:ny assume ny=nx + +#@@param:x_spacing spacing between the two vertical rows of pins +#@@dim:x_spacing +#@@optional:x_spacing +#@@default:x_spacing calculated using nx and pad_spacing + +#@@param:y_spacing spacing between the two vertical rows of pins +#@@dim:y_spacing +#@@optional:y_spacing +#@@default:y_spacing calculated using ny and pad_spacing + +#@@param:pad_spacing spacing between the centerlines of two adjacent pads (aka pitch) +#@@dim:pad_spacing +#@@optional:pad_spacing + +#@@param:ext_bloat how much longer the pad should extend outwards from the end-point of the pin +#@@dim:ext_bloat +#@@optional:ext_bloat +#@@default:ext_bloat 0.37 mm + +#@@param:int_bloat how much longer the pad should extend inwards from the end-point of the pin +#@@dim:int_bloat +#@@optional:int_bloat +#@@default:int_bloat 0.37 mm + +#@@param:width width (horizontal, x axis size) of the box drawn on silk +#@@dim:width +#@@optional:width +#@@default:width calculated from the pad row geometry + +#@@param:height height (vertical, y axis size) of the box drawn on silk +#@@dim:height +#@@optional:height +#@@default:height calculated from the pad row geometry + +#@@param:cpad_width width (horizontal, x axis size) of the central pad +#@@dim:cpad_width +#@@optional:cpad_width +#@@default:cpad_width empty, no central pad + +#@@param:cpad_height height (vertical, y axis size) of the central pad +#@@dim:cpad_height +#@@optional:cpad_height +#@@default:cpad_height empty, no central pad + +#@@param:cpad_auto when true, calculate central pad sizes automatically from the pad row geometry +#@@bool:cpad_auto +#@@optional:cpad_height +#@@default:cpad_height false, no central pad + +#@@param:bodysilk how to draw body on the silk layer +#@@enum:bodysilk:none no drawing +#@@enum:bodysilk:corners draw the corners, silkmark is outside of the top-left corner +#@@enum:bodysilk:full draw a full rectanlge, silkmark of the top-left corner +#@@enum:bodysilk:plcc angled top-left corner, horizontal line on the top +#@@optional:bodysilk +#@@default:bodysilk corners + +#@@param:pinoffs rotate pins by this amount, CW +#@@optional:pinoffs +#@@default:pinoffs 0 + +#@@include silkmark.help +#@@optional:silkmark +#@@default:silkmark square +#@@preview_args:silkmark 4,4 + +#@@default:silkmark dot +#@@include common.awk + + +awk -f `dirname $0`/common.awk -f `dirname $0`/qf.awk -v "args=$*" -v gen=`basename $0` + Property changes on: 1.0.8/pcblib/parametric/qf ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/pcblib/parametric/qf.awk =================================================================== --- 1.0.8/pcblib/parametric/qf.awk (nonexistent) +++ 1.0.8/pcblib/parametric/qf.awk (revision 1136) @@ -0,0 +1,146 @@ +function qf_globals(pre_args, post_args ,reqs) +{ + if (hook_spc_conv == "") + hook_spc_conv = 1.8 + if (hook_cpad_mult == "") + hook_cpad_mult = 1 + + if (!qf_no_defaults) { + set_arg(P, "?pad_spacing", "0.5mm") + set_arg(P, "?ext_bloat", "0.37mm") + set_arg(P, "?int_bloat", "0.37mm") + set_arg(P, "?pad_thickness", "0.3mm") + set_arg(P, "?silkmark", "dot") + set_arg(P, "?line_thickness", "0.1mm") + } + + reqs = "nx,ny" + + if (pre_args != "") + reqs="" + + if ((post_args != "") && (!(post_args ~ "^,"))) + post_args = "," post_args + + if ((pre_args != "") && (!(pre_args ~ ",$"))) + pre_args = pre_args "," + + proc_args(P, pre_args "nx,ny,x_spacing,y_spacing,pad_spacing,ext_bloat,int_bloat,width,height,cpad_width,cpad_height,cpad_auto,bodysilk,pinoffs,silkmark" post_args, reqs) + + nx = int(P["nx"]) + ny = int(P["ny"]) + + if (P["ny"] == "") + ny = nx + + if ((nx < 2) || (ny < 2)) + error("Number of pins have to be more than 2 in both directions") + + x_spacing=parse_dim(P["x_spacing"]) + y_spacing=parse_dim(P["y_spacing"]) + pad_spacing=parse_dim(P["pad_spacing"]) + pt = DEFAULT["pad_thickness"] + ext_bloat=parse_dim(P["ext_bloat"]) - pt/2 + int_bloat=parse_dim(P["int_bloat"]) - pt/2 + width=parse_dim(P["width"]) + height=parse_dim(P["height"]) + pinoffs = int(P["pinoffs"]) + + if (x_spacing == "") + x_spacing = (nx+hook_spc_conv) * pad_spacing + if (y_spacing == "") + y_spacing = (ny+hook_spc_conv) * pad_spacing + + cpad_width=parse_dim(P["cpad_width"]) + cpad_height=parse_dim(P["cpad_height"]) + + if (tobool(P["cpad_auto"]) || hook_cpad_auto) { + if (cpad_width == "") + cpad_width = (x_spacing*0.85 - int_bloat*2 - pt) * hook_cpad_mult + if (cpad_height == "") + cpad_height = (y_spacing*0.85 - int_bloat*2 - pt) * hook_cpad_mult + } + + + if (width == "") + width = x_spacing + if (height == "") + height = y_spacing + + pinmax=(nx+ny)*2 +} + +function pinnum(num) +{ + return ((num-1) + pinoffs) % (pinmax)+1 +} + +BEGIN { + qf_globals() + + + element_begin("", "U1", 2*nx + 2*ny ,0,0, -width/2 - mm(1), -height/2 - mm(2)) + + cx = (nx+1)/2 + cy = (ny+1)/2 + + for(n = 1; n <= ny; n++) { + y = (-cy + n) * pad_spacing + x1 = -x_spacing/2 + x2 = x_spacing/2 + element_pad(x1-ext_bloat, y, x1+int_bloat, y, pad_width, pinnum(n), "square") + element_pad(x2-int_bloat, y, x2+ext_bloat, y, pad_width, pinnum(nx+2*ny-n+1), "square") + if (n == 1) + y1 = y + if (n == 2) + dimension(x1, y1, x1, y, (ext_bloat * -3), "pad_spacing") + } + + dimension(x1, y-pt/2, x1, y+pt/2, (ext_bloat * -3), "pad_thickness") + + for(n = 1; n <= nx; n++) { + x = (-cx + n) * pad_spacing + y1 = -y_spacing/2 + y2 = y_spacing/2 + element_pad(x, y1-ext_bloat, x, y1+int_bloat, pad_width, pinnum(nx*2+ny*2-n+1), "square") + element_pad(x, y2-int_bloat, x, y2+ext_bloat, pad_width, pinnum(n+ny), "square") + } + + + if ((cpad_width != "") && (cpad_height != "")) { + element_pad_rectangle(-cpad_width/2, -cpad_height/2, +cpad_width/2, +cpad_height/2, 2*nx+2*ny+1, "square") + dimension(-cpad_width/2, -cpad_height/2, +cpad_width/2, -cpad_height/2, "@0;" (height * -0.6-ext_bloat), "cpad_width") + dimension(cpad_width/2, -cpad_height/2, cpad_width/2, +cpad_height/2, "@" (width * 0.8+ext_bloat) ";0", "cpad_height") + } + + wx = (width - nx * pad_spacing) / 3.5 + wy = (height - ny * pad_spacing) / 3.5 + + bodysilk = P["bodysilk"] + if ((bodysilk == "corners") || (bodysilk == "")) { + element_rectangle_corners(-width/2, -height/2, width/2, height/2, wx, wy) + silkmark(P["silkmark"], -width/2 - wx/2, -height/2+wy*1.5, (wx+wy)/4) + } + else if (bodysilk == "full") { + element_rectangle(-width/2, -height/2, width/2, height/2) + silkmark(P["silkmark"], -width/2 + wx*3, -height/2+wy*3, (wx+wy)/2) + } + else if (bodysilk == "plcc") { + r = (width+height)/10 + element_rectangle(-width/2, -height/2, width/2, height/2, "arc,NE,SW,SE", r) + element_line(-width/2, -height/2+r, width/2, -height/2+r) + silkmark(P["silkmark"], 0, -height*0.2, height/40) + } + else if (bodysilk != "none") + error("invalid bodysilk parameter") + + dimension(-width/2, -height/2, +width/2, -height/2, "@0;" height*-0.8-ext_bloat, "width") + dimension(+width/2, -height/2, +width/2, +height/2, "@" (width * 1+ext_bloat) ";0", "height") + + dimension(-x_spacing/2, -height/2, +x_spacing/2, -height/2, "@0;" height*-1-ext_bloat, "x_spacing") + dimension(+width/2, -y_spacing/2, +width/2, +y_spacing/2, "@" (width * 1.2+ext_bloat) ";0", "y_spacing") + + + + element_end() +} Index: 1.0.8/pcblib/parametric/qfn =================================================================== --- 1.0.8/pcblib/parametric/qfn (nonexistent) +++ 1.0.8/pcblib/parametric/qfn (revision 1136) @@ -0,0 +1,24 @@ +#!/bin/sh + +# Reference: Microchip Packaging Specification DS00000049BX (en012702.pdf), SSOP + +#@@example qfn(16,3x3,0.5) + +#@@purpose Generate QFN packages +#@@desc Generate QFN packages - a simplified frontend to qf() - +#@@desc look up 3..4 data in the datasheet and get a regular QFN footprint! +#@@desc Should work for QFN, TQFN, etc. +#@@desc NOTE: some of the qf() parameters can be also used. + +#@@params pins,size,pitch,cpad_size + +#@@param:pin total number of pins (leads); must be divisible by 4 +#@@param:size a single integer N or NxN or NxNxH; the pad spacing dimension (outer dimension, lead-to-lead) in mm +#@@param:pitch lead pitch (distance between the centerline of two adjacent leads), in mm; must be one of 0.4, 0.5, 0.65 + +#@@param:cpad_size width (and height) of the central pad, in mm +#@@optional:cpad_size +#@@default:cpad_size empty, there's no central pad + +awk -f `dirname $0`/common.awk -f `dirname $0`/qfn.awk -f `dirname $0`/qf.awk -v "args=$*" -v gen=`basename $0` + Property changes on: 1.0.8/pcblib/parametric/qfn ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/pcblib/parametric/qfn.awk =================================================================== --- 1.0.8/pcblib/parametric/qfn.awk (nonexistent) +++ 1.0.8/pcblib/parametric/qfn.awk (revision 1136) @@ -0,0 +1,50 @@ +function parri(A ,s,i) +{ + for(i in A) + s = s " " i + return s +} + +BEGIN { + + PT["0.65"] = "0.35mm" + PT["0.5"] = "0.3mm" + PT["0.4"] = "0.2mm" + + proc_args(P, "pins,size,pitch,cpad_size,pad_thickness", "pins,size,pitch") + + pitch = P["pitch"] + sub("0*$", "", pitch) + + if (!(args ~ "pad_thickness=")) { + if (!(pitch in PT)) + error("Unkown pitch, should be one of:" parri(PT)) + pt = PT[pitch] + } + else + pt = rev_mm(DEFAULT["pad_thickness"]) + + split(P["size"], S, "x") + if (S[2] == "") + S[2] = S[1] + if (S[1] != S[2]) + error("need n*n size") + + pins = int(P["pins"]) + if (pins / 4 != int(pins / 4)) + error("number of pins must be divisible by 4") + + pins=pins/4 + + + args = args ",nx=" pins ",ny=" pins ",x_spacing=" S[1] "mm,y_spacing=" S[2] "mm,pad_spacing=" pitch "mm,pad_thickness=" pt + + if (P["cpad_size"] != "") + args = args ",cpad_width=" P["cpad_size"] "mm,cpad_height=" P["cpad_size"] "mm" + + + print "args=" args > "/dev/stderr" + +# qf_globals("pins,size") + +} Index: 1.0.8/pcblib/parametric/qfp =================================================================== --- 1.0.8/pcblib/parametric/qfp (nonexistent) +++ 1.0.8/pcblib/parametric/qfp (revision 1136) @@ -0,0 +1,24 @@ +#!/bin/sh + +# Reference: Microchip Packaging Specification DS00000049BX (en012702.pdf), SSOP + +#@@example qfp(32,7x7,0.8) + +#@@purpose Generate QFP packages +#@@desc Generate QFP packages - a simplified frontend to qf() - +#@@desc look up 3..4 data in the datasheet and get a regular QFP footprint! +#@@desc NOTE: some of the qf() parameters can be also used. +#@@desc Should work for QFP, TQFP, LQFP, etc. + +#@@params pins,size,pitch,cpad_size + +#@@param:pin total number of pins (leads); must be divisible by 4 +#@@param:size a single integer N or NxN or NxNxH; body dimension (width or height of the plastic body) in mm +#@@param:pitch lead pitch (distance between the centerline of two adjacent leads), in mm; must be one of 0.4, 0.5, 0.65 + +#@@param:cpad_size width (and height) of the central pad, in mm +#@@optional:cpad_size +#@@default:cpad_size empty, there's no central pad + +awk -f `dirname $0`/common.awk -f `dirname $0`/qfp.awk -f `dirname $0`/qf.awk -v "args=$*" -v gen=`basename $0` + Property changes on: 1.0.8/pcblib/parametric/qfp ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/pcblib/parametric/qfp.awk =================================================================== --- 1.0.8/pcblib/parametric/qfp.awk (nonexistent) +++ 1.0.8/pcblib/parametric/qfp.awk (revision 1136) @@ -0,0 +1,52 @@ +function parri(A ,s,i) +{ + for(i in A) + s = s " " i + return s +} + +BEGIN { + + PT["0.8"] = "0.55mm" + PT["0.65"] = "0.35mm" + PT["0.5"] = "0.3mm" + PT["0.4"] = "0.2mm" + + proc_args(P, "pins,size,pitch,cpad_size,pad_thickness", "pins,size,pitch") + + pitch = P["pitch"] + sub("0*$", "", pitch) + + if (!(args ~ "pad_thickness=")) { + if (!(pitch in PT)) + error("Unkown pitch, should be one of:" parri(PT)) + pt = PT[pitch] + } + else + pt = rev_mm(DEFAULT["pad_thickness"]) + + split(P["size"], S, "x") + if (S[2] == "") + S[2] = S[1] + if (S[1] != S[2]) + error("need n*n size") + + pins = int(P["pins"]) + if (pins / 4 != int(pins / 4)) + error("number of pins must be divisible by 4") + + pins=pins/4 + + args = args ",width=" S[1] " mm,height=" S[2] " mm" + + S[1] += 1.45 + S[2] += 1.45 + args = args ",nx=" pins ",ny=" pins ",x_spacing=" S[1] "mm,y_spacing=" S[2] "mm,pad_spacing=" pitch "mm,pad_thickness=" pt "mm" + + + if (P["cpad_size"] != "") + args = args ",cpad_width=" P["cpad_size"] "mm,cpad_height=" P["cpad_size"] "mm" + + args = args ",int_bloat=0.5mm,ext_bloat=1.1mm" + args = args ",?bodysilk=full,?silkmark=circle" +} Index: 1.0.8/pcblib/parametric/qsop =================================================================== --- 1.0.8/pcblib/parametric/qsop (nonexistent) +++ 1.0.8/pcblib/parametric/qsop (revision 1136) @@ -0,0 +1,27 @@ +#!/bin/sh + +# Reference: Microchip Packaging Specification DS00000049BX (en012702.pdf), QSOP + +#@@example qsop(14) + +#@@purpose Generate QSOP packages. + +#@@desc Generate QSOP packages with variable number of pins and +#@@desc row spacing + +#@@include so +#@@include common.awk + +defaults=' +?pad_spacing=25mil, +?row_spacing=213mil, +?int_bloat=22mil, +?ext_bloat=23mil, +?rarc=25, +?silk_ext_x=18, +?silk_ext_y=22, +?pad_thickness=16mil +' + +awk -f `dirname $0`/common.awk -f `dirname $0`/so.awk -v "args=$defaults,$*" -v gen=`basename $0` + Property changes on: 1.0.8/pcblib/parametric/qsop ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/pcblib/parametric/rcy =================================================================== --- 1.0.8/pcblib/parametric/rcy (nonexistent) +++ 1.0.8/pcblib/parametric/rcy (revision 1136) @@ -0,0 +1,32 @@ +#!/bin/sh + +#@@example rcy(300,bar+) + +#@@purpose Generate radial lead tru-hole component + +#@@desc Generate radial lead tru-hole component with 2 pins (typical use: electrolytic caps) +#@@params spacing,pol,dia + +#@@param:spacing spacing between the two pins +#@@dim:spacing + +#@@param:pol how to mark polarity: (optional; default: sign) +#@@enum:pol:none no marking +#@@enum:pol:sign print + next to pin 1 and - next to pin 2 +#@@enum:pol:bar+ draw a bar inside the circle, around pin 2 +#@@enum:pol:bar- draw a bar inside the circle, around pin 1 +#@@enum:pol:bar same as bar+ +#@@enum:pol:bar+sign bar+ and sign combined +#@@enum:pol:bar-sign bar- and sign combined +#@@optional:pol +#@@default:pol sign +#@@preview_args:pol 300 + +#@@param:dia body diameter - affects the silk circle +#@@optional:dia +#@@default:dia spacing*2 + +#@@include common.awk + +awk -f `dirname $0`/common.awk -f `dirname $0`/rcy.awk -v "args=$*" -v gen=`basename $0` + Property changes on: 1.0.8/pcblib/parametric/rcy ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/pcblib/parametric/rcy.awk =================================================================== --- 1.0.8/pcblib/parametric/rcy.awk (nonexistent) +++ 1.0.8/pcblib/parametric/rcy.awk (revision 1136) @@ -0,0 +1,93 @@ +function pol_sign( ox,oy) +{ + ox = offs_x + + size=mil(20) + + offs_x = spacing/2 +dia/2+size*2 + element_line(-size, 0, +size, 0) + + offs_x = spacing/2 -dia/2-size*2 + element_line(-size, 0, +size, 0) + element_line(0, -size, 0, +size) + + offs_x = ox +} + +BEGIN { + + set_arg(P, "?pol", "sign") + proc_args(P, "spacing,pol,dia", "spacing") + + spacing = parse_dim(P["spacing"]) + dia = either(parse_dim(P["dia"]), spacing*2) + + offs_x = +spacing/2 + + element_begin("", "C1", "acy" P["spacing"] ,0,0, spacing/2-spacing/5,-mil(20)) + + element_pin(-spacing/2, 0, 1) + element_pin(+spacing/2, 0, 2) + dimension(-spacing/2, 0, +spacing/2, 0, dia*0.8, "spacing") + + +# silk rectangle and pins + element_arc(0, 0, dia/2, dia/2, 0, 360) + dimension(-dia/2, 0, +dia/2, 0, dia*-0.8, "dia") + + + if (P["pol"] == "sign") { + pol_sign() + } + else if (P["pol"] ~ "^bar") { +# determine bar side (default to -) + side=P["pol"] + sub("^bar", "", side) + if (side ~ "sign") { + pol_sign() + sub("sign", "", side) + } + if (side == "") + side = "-" + side = int(side "1") * -1 + + th = mm(1) + ystep = th/2 + r = dia/2-th/2 + xs = dia/8 + ring = DEFAULT["pin_ringdia"] + for(y = 0; y < dia/2; y+=ystep) { + x = r*r-y*y + if (x < 0) + break + x = sqrt(x) + if (x <= xs) + break + if (y > ring/2+th/2) { + element_line(side*xs, y, side*x, y, th) + if (y != 0) + element_line(side*xs, -y, side*x, -y, th) + } + else { +# keep out a rectangle around the pin + end1=spacing/2-ring + end2=spacing/2+ring + if (end1 > xs) + element_line(side*xs, y, side*end1, y, th) + if (end2 < x) + element_line(side*end2, y, side*x, y, th) + if (y != 0) { + if (end1 > xs) + element_line(side*xs, -y, side*end1, -y, th) + if (end2 < x) + element_line(side*end2, -y, side*x, -y, th) + } + } + } + } + else if ((P["pol"] != "") && (P["pol"] != "none")) { + error("Invalid pol") + } + + element_end() +} Index: 1.0.8/pcblib/parametric/screw =================================================================== --- 1.0.8/pcblib/parametric/screw (nonexistent) +++ 1.0.8/pcblib/parametric/screw (revision 1136) @@ -0,0 +1,36 @@ +#!/bin/sh + +#@@example screw(3.2mm, 6mm, circle:hex) + +#@@purpose Generic screw. + +#@@desc Generate a "single pin" screw with optional head shapes +#@@params hole,head,shape,ring + +#@@param:hole hole diameter or name of a standard screw (e.g. M3) +#@@dim:hole + + +#@@param:head head outmost diameter (or optional head name for a standard screw: pan, button, cheese, flat-washer, internal-lock-washer) +#@@dim:head + +#@@param:ring copper ring outer diameter +#@@dim:ring +#@@optional:ring +#@@default:ring 80% of head diameter + + +#@@param:shape shape of the head drawn on silkmark; multiple values can be listed separated with colons, e.g. "shape=circle:hex" +#@@enum:shape:circle circle +#@@enum:shape:hex hexagon with straight line edges, size is from corner to corner +#@@enum:shape:tx "torx": hexagon with arced edges +#@@enum:shape:xzn "triple square" +#@@enum:shape:ph philips slot (cross) - useful together with circle +#@@enum:shape:slot a single straight line slot - useful together with circle +#@@default:shape circle +#@@preview_args:shape 3mm,6mm + +#@@include common.awk + +awk -f `dirname $0`/common.awk -f `dirname $0`/screw.awk -v "args=$*" -v gen=`basename $0` + Property changes on: 1.0.8/pcblib/parametric/screw ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/pcblib/parametric/screw.awk =================================================================== --- 1.0.8/pcblib/parametric/screw.awk (nonexistent) +++ 1.0.8/pcblib/parametric/screw.awk (revision 1136) @@ -0,0 +1,127 @@ +function shp(r, edges, tx ,a,x,y,xl,yl,step,x1,y1,x2,y2,tx1,tx2,txs) +{ + step = 2*3.141592654/edges + if (tx == 1) { + tx1 = 0.7 + tx2 = 0.6 + txs = 5 + } + else if (tx == 2) { + tx1 = 0.85 + tx2 = 0.8 + txs = 5 + } + else if (tx == 3) { + tx1 = 0.2 + tx2 = 0.2 + txs = 3 + } + for(n = 0; n <= edges; n++) { + a += step + x = cos(a)*r + y = sin(a)*r + if (xl != "") { + if (tx) { + x1 = cos(a-(txs-1)*step/txs)*r*tx1 + y1 = sin(a-(txs-1)*step/txs)*r*tx1 + x2 = cos(a-step/txs)*r*tx1 + y2 = sin(a-step/txs)*r*tx1 + x3 = cos(a-step/2)*r*tx2 + y3 = sin(a-step/2)*r*tx2 + element_line(xl, yl, x1, y1) + element_line(x, y, x2, y2) + element_line(x3, y3, x1, y1) + element_line(x3, y3, x2, y2) + } + else + element_line(xl, yl, x, y) + } + xl = x + yl = y + } +} + +function round_up(num, to) +{ + if ((num/to) == int(num/to)) + return num + return int(num/to+1)*to +} + +BEGIN { + set_arg(P, "?shape", "circle") + proc_args(P, "hole,head,shape,ring", "hole") + + element_begin("", "S1", "screw:" P["hole"] "," P["head"]"," P["shape"] ,0,0, 0, mil(-100)) + + if (P["hole"] ~ "^M") { + hole = P["hole"] + sub("^M", "", hole) + h = parse_dim(int(hole) "mm") + if ((hole ~ "tight") || (hole ~ "close.fit")) + hole = h * 1.05 + else + hole = h * 1.1 + hd = parse_dim(P["head"]) + if ((hd == 0) || (hd == "")) { + hd = P["head"] + if (hd == "button") + head = 1.9*h + else if (hd == "button") + head = 1.9*h + else if (hd == "cheese") + head = round_up(1.7*h, mm(0.5)) + else if (hd ~ "flat.washer") + head = round_up(2.1*h, mm(1)) + else if ((hd == "") || (hd == "pan") || (hd ~ "int.*.lock.washer")) + head = 2*h + else + error("Unknown standard head: " hd) + } + else + head = hd +# print hole, head > "/dev/stderr" + } + else { + hole = parse_dim(P["hole"]) + head = parse_dim(P["head"]) + } + + if (head == "") + error("need a standard screw name, e.g. M3, or a head diameter") + + if (head < hole) + error("head diameter must be larger than hole diameter") + + ring = parse_dim(P["ring"]) + + if (ring == "") + ring = head*0.8 + + element_pin(0, 0, 1, "none", ring, "", "", hole) + + shape = ":" P["shape"] ":" + + if (shape ~ ":circle:") + element_arc(0, 0, head/2, head/2, 0, 360) + + if (shape ~ ":hex:") + shp(head/2, 6, 0) + + if (shape ~ ":tx:") + shp(head/2, 6, 1) + + if (shape ~ ":xzn:") + shp(head/2, 12, 2) + + if (shape ~ ":ph:") + shp(head*0.4, 4, 3) + + if (shape ~ ":slot:") + element_line(-head/2, 0, head/2, 0) + + dimension(-head/2, 0, head/2, 0, head*0.7, "head") + dimension(-hole/2, 0, hole/2, 0, head*0.6, "hole") + + element_end() +} Index: 1.0.8/pcblib/parametric/silkmark.help =================================================================== --- 1.0.8/pcblib/parametric/silkmark.help (nonexistent) +++ 1.0.8/pcblib/parametric/silkmark.help (revision 1136) @@ -0,0 +1,11 @@ +#@@param:silkmark how to mark pin 1 on the silk layer; multiple values can be listed separated with colons, e.g. "silkmark=externalx:angled" +#@@enum:silkmark:square a rectangle around pin 1 +#@@enum:silkmark:externalx a little trinagle placed outside of the box pointing in line with the first x row +#@@enum:silkmark:externaly a little trinagle placed outside of the box pointing in line with the first y row +#@@enum:silkmark:external45 a little trinagle placed outside of the box pointing at the corner in 45 degree +#@@enum:silkmark:external shorthand for external +#@@enum:silkmark:angled an angled line in the corner +#@@enum:silkmark:arc an external 270 degree arc +#@@enum:silkmark:circle a circle, 270 degrees external +#@@enum:silkmark:dot a small external dot +#@@enum:silkmark:none no mark Index: 1.0.8/pcblib/parametric/so =================================================================== --- 1.0.8/pcblib/parametric/so (nonexistent) +++ 1.0.8/pcblib/parametric/so (revision 1136) @@ -0,0 +1,38 @@ +#!/bin/sh + +#@@example so(14) + +#@@purpose Generate SO and SO-like packages. + +#@@desc Generate SO packages with variable number of pins and +#@@desc row spacing +#@@params n, row_spacing, pad_spacing + +#@@param:n number of pins + +#@@param:row_spacing spacing between the two rows of pads: distance between the end of the first and last pins +#@@dim:row_spacing +#@@optional:row_spacing +#@@default:row_spacing 250 mil + + +#@@param:pad_spacing spacing between the centerline of two pads +#@@dim:pad_spacing +#@@optional:pad_spacing +#@@default:pad_spacing 250 mil + + +#@@param:ext_bloat how much longer the pad should extend outwards from the end-point of the pin +#@@dim:ext_bloat +#@@optional:ext_bloat +#@@default:ext_bloat 10 mil + +#@@param:int_bloat how much longer the pad should extend inwards from the end-point of the pin +#@@dim:int_bloat +#@@optional:int_bloat +#@@default:int_bloat 55 mil + +#@@include common.awk + +awk -f `dirname $0`/common.awk -f `dirname $0`/so.awk -v "args=$*" -v gen=`basename $0` + Property changes on: 1.0.8/pcblib/parametric/so ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/pcblib/parametric/so.awk =================================================================== --- 1.0.8/pcblib/parametric/so.awk (nonexistent) +++ 1.0.8/pcblib/parametric/so.awk (revision 1136) @@ -0,0 +1,50 @@ +BEGIN { + set_arg(P, "?row_spacing", 250) + set_arg(P, "?pad_spacing", 50) + set_arg(P, "?ext_bloat", 10) + set_arg(P, "?int_bloat", 55) + + proc_args(P, "n,row_spacing,pad_spacing,ext_bloat,int_bloat", "n") + + P["n"] = int(P["n"]) + if ((P["n"] < 2) || ((P["n"] % 2) != 0)) + error("Number of pins have to be an even positive number") + + row_spacing=parse_dim(P["row_spacing"]) + pad_spacing=parse_dim(P["pad_spacing"]) + ext_bloat=parse_dim(P["ext_bloat"]) + int_bloat=parse_dim(P["int_bloat"]) + +# translate origin to the middle (int() and -0.5 rounds it for odd number of pins) + offs_x = -(row_spacing/2) + offs_y = -int((P["n"]/4-0.5) * pad_spacing) + + element_begin("", "U1", P["n"] "*" P["row_spacing"] ,0,0, 0, mil(-100)) + + for(n = 1; n <= P["n"]/2; n++) { + y = (n-1) * pad_spacing + element_pad(-ext_bloat, y, int_bloat, y, pad_width, n, "square") + element_pad(row_spacing-int_bloat, y, row_spacing+ext_bloat, y, pad_width, P["n"] - n + 1, "square") + } + + silk_dist_x = either(parse_dim(P["silk_ext_x"]), pad_spacing/2) + silk_dist_y = either(parse_dim(P["silk_ext_y"]), pad_spacing/2) + rarc = either(parse_dim(P["rarc"]), pad_spacing/2) + + dip_outline(-silk_dist_x-ext_bloat, -silk_dist_y, row_spacing + silk_dist_x+ext_bloat , (n-2) * pad_spacing + silk_dist_y, rarc) + + left_dim="@" -silk_dist_x-ext_bloat-pad_spacing ";0" + dimension(0, 0, 0, pad_spacing, left_dim, "pad_spacing") + dimension(0, 0, row_spacing, 0, (pad_spacing * 1.8), "row_spacing") + dimension(-ext_bloat, 0, 0, 0, (pad_spacing * 1.2), "ext_bloat") + dimension(row_spacing-int_bloat, 0, row_spacing, 0, (pad_spacing * 1.2), "int_bloat") + + th=DEFAULT["pad_thickness"] + y = (n-2) * pad_spacing + dimension(-ext_bloat-th/2, y, +int_bloat+th/2, y, (pad_spacing * -1.2), "") + dimension(0, y-th/2, 0, y+th/2, left_dim, "pad_thickness") + +# dimension(-silk_dist_x-ext_bloat, -silk_dist_y, row_spacing + silk_dist_x+ext_bloat, -silk_dist_y, pad_spacing*2.5, "") + + element_end() +} Index: 1.0.8/pcblib/parametric/ssop =================================================================== --- 1.0.8/pcblib/parametric/ssop (nonexistent) +++ 1.0.8/pcblib/parametric/ssop (revision 1136) @@ -0,0 +1,27 @@ +#!/bin/sh + +# Reference: Microchip Packaging Specification DS00000049BX (en012702.pdf), SSOP + +#@@example ssop(14) + +#@@purpose Generate SSOP packages. + +#@@desc Generate SSOP packages with variable number of pins and +#@@desc row spacing + +#@@include so +#@@include common.awk + +defaults=' +?pad_spacing=0.65mm, +?row_spacing=7.8mm, +?int_bloat=0.5mm, +?ext_bloat=0.13mm, +?rarc=25, +?silk_ext_x=18, +?silk_ext_y=22, +?pad_thickness=0.45mm +' + +awk -f `dirname $0`/common.awk -f `dirname $0`/so.awk -v "args=$defaults,$*" -v gen=`basename $0` + Property changes on: 1.0.8/pcblib/parametric/ssop ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/pcblib/parametric/tssop =================================================================== --- 1.0.8/pcblib/parametric/tssop (nonexistent) +++ 1.0.8/pcblib/parametric/tssop (revision 1136) @@ -0,0 +1,28 @@ +#!/bin/sh + +# Reference: Microchip Packaging Specification DS00000049BX (en012702.pdf), MSOP + +#@@example tssop(8) + +#@@purpose Generate TSSOP packages. + +#@@desc Generate TSSOP 4.4mm body packages with variable number of pins and +#@@desc row spacing + +#@@include so +#@@include common.awk + + +defaults=' +?pad_spacing=0.65mm, +?row_spacing=6.4mm, +?int_bloat=0.6mm, +?ext_bloat=0.4mm, +?rarc=25, +?silk_ext_x=18, +?silk_ext_y=22, +?pad_thickness=0.45mm +' + +awk -f `dirname $0`/common.awk -f `dirname $0`/so.awk -v "args=$defaults,$*" -v gen=`basename $0` + Property changes on: 1.0.8/pcblib/parametric/tssop ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/pcblib/smd/01005.fp =================================================================== --- 1.0.8/pcblib/smd/01005.fp (nonexistent) +++ 1.0.8/pcblib/smd/01005.fp (revision 1136) @@ -0,0 +1,32 @@ +##from:pcb +##for:resistor +##for:capacitor +##for:led + + # grab the input values and convert to 1/100 mil + # how much to grow the pads by for soldermask [1/100 mil] + # clearance from planes [1/100 mil] + # silk screen width [1/100 mil] + # courtyard silk screen width [1/100 mil] +# element_flags, description, pcb-name, value, mark_x, mark_y, +# text_x, text_y, text_direction, text_scale, text_flags +Element[0x00000000 "Standard SMT resistor, capacitor etc" "" "01005" 0 0 -3150 -3150 0 100 ""] +( +# +# Pad[x1, y1, x2, y2, thickness, clearance, mask, name , pad number, flags] + Pad[-807 -19 + -807 19 + 984 2000 1584 "1" "1" "square"] + Pad[807 -19 + 807 19 + 984 2000 1584 "2" "2" "square"] +# +# This draws a 1 mil placement courtyard outline in silk. It should probably +# not be included since you wont want to try and fab a 1 mil silk line. Then +# again, it is most useful during parts placement. It really is time for some +# additional non-fab layers... +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval(-1*V1/2) eval( V2/2) CYW] +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval(-1*V1/2) eval( V2/2) CYW] +) Index: 1.0.8/pcblib/smd/0201.fp =================================================================== --- 1.0.8/pcblib/smd/0201.fp (nonexistent) +++ 1.0.8/pcblib/smd/0201.fp (revision 1136) @@ -0,0 +1,32 @@ +##from:pcb +##for:resistor +##for:capacitor +##for:led + + # grab the input values and convert to 1/100 mil + # how much to grow the pads by for soldermask [1/100 mil] + # clearance from planes [1/100 mil] + # silk screen width [1/100 mil] + # courtyard silk screen width [1/100 mil] +# element_flags, description, pcb-name, value, mark_x, mark_y, +# text_x, text_y, text_direction, text_scale, text_flags +Element[0x00000000 "Standard SMT resistor, capacitor etc" "" "0201" 0 0 -3150 -3150 0 100 ""] +( +# +# Pad[x1, y1, x2, y2, thickness, clearance, mask, name , pad number, flags] + Pad[-1181 0 + -1181 0 + 1574 2000 2174 "1" "1" "square"] + Pad[1181 0 + 1181 0 + 1574 2000 2174 "2" "2" "square"] +# +# This draws a 1 mil placement courtyard outline in silk. It should probably +# not be included since you wont want to try and fab a 1 mil silk line. Then +# again, it is most useful during parts placement. It really is time for some +# additional non-fab layers... +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval(-1*V1/2) eval( V2/2) CYW] +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval(-1*V1/2) eval( V2/2) CYW] +) Index: 1.0.8/pcblib/smd/0402.fp =================================================================== --- 1.0.8/pcblib/smd/0402.fp (nonexistent) +++ 1.0.8/pcblib/smd/0402.fp (revision 1136) @@ -0,0 +1,32 @@ +##from:pcb +##for:resistor +##for:capacitor +##for:led + + # grab the input values and convert to 1/100 mil + # how much to grow the pads by for soldermask [1/100 mil] + # clearance from planes [1/100 mil] + # silk screen width [1/100 mil] + # courtyard silk screen width [1/100 mil] +# element_flags, description, pcb-name, value, mark_x, mark_y, +# text_x, text_y, text_direction, text_scale, text_flags +Element[0x00000000 "Standard SMT resistor, capacitor etc" "" "0402" 0 0 -3150 -3150 0 100 ""] +( +# +# Pad[x1, y1, x2, y2, thickness, clearance, mask, name , pad number, flags] + Pad[-1574 -393 + -1574 393 + 1968 2000 2568 "1" "1" "square"] + Pad[1574 -393 + 1574 393 + 1968 2000 2568 "2" "2" "square"] +# +# This draws a 1 mil placement courtyard outline in silk. It should probably +# not be included since you wont want to try and fab a 1 mil silk line. Then +# again, it is most useful during parts placement. It really is time for some +# additional non-fab layers... +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval(-1*V1/2) eval( V2/2) CYW] +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval(-1*V1/2) eval( V2/2) CYW] +) Index: 1.0.8/pcblib/smd/0603.fp =================================================================== --- 1.0.8/pcblib/smd/0603.fp (nonexistent) +++ 1.0.8/pcblib/smd/0603.fp (revision 1136) @@ -0,0 +1,32 @@ +##from:pcb +##for:resistor +##for:capacitor +##for:led + + # grab the input values and convert to 1/100 mil + # how much to grow the pads by for soldermask [1/100 mil] + # clearance from planes [1/100 mil] + # silk screen width [1/100 mil] + # courtyard silk screen width [1/100 mil] +# element_flags, description, pcb-name, value, mark_x, mark_y, +# text_x, text_y, text_direction, text_scale, text_flags +Element[0x00000000 "Standard SMT resistor, capacitor etc" "" "0603" 0 0 -3150 -3150 0 100 ""] +( +# +# Pad[x1, y1, x2, y2, thickness, clearance, mask, name , pad number, flags] + Pad[-2559 -492 + -2559 492 + 2952 2000 3552 "1" "1" "square"] + Pad[2559 -492 + 2559 492 + 2952 2000 3552 "2" "2" "square"] +# +# This draws a 1 mil placement courtyard outline in silk. It should probably +# not be included since you wont want to try and fab a 1 mil silk line. Then +# again, it is most useful during parts placement. It really is time for some +# additional non-fab layers... +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval(-1*V1/2) eval( V2/2) CYW] +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval(-1*V1/2) eval( V2/2) CYW] +) Index: 1.0.8/pcblib/smd/0805.fp =================================================================== --- 1.0.8/pcblib/smd/0805.fp (nonexistent) +++ 1.0.8/pcblib/smd/0805.fp (revision 1136) @@ -0,0 +1,34 @@ +##from:pcb +##for:resistor +##for:capacitor +##for:led + + # grab the input values and convert to 1/100 mil + # how much to grow the pads by for soldermask [1/100 mil] + # clearance from planes [1/100 mil] + # silk screen width [1/100 mil] + # courtyard silk screen width [1/100 mil] +# element_flags, description, pcb-name, value, mark_x, mark_y, +# text_x, text_y, text_direction, text_scale, text_flags +Element[0x00000000 "Standard SMT resistor, capacitor etc" "" "0805" 0 0 -3150 -3150 0 100 ""] +( +# +# Pad[x1, y1, x2, y2, thickness, clearance, mask, name , pad number, flags] + Pad[-3543 -393 + -3543 393 + 5118 2000 5718 "1" "1" "square"] + Pad[3543 -393 + 3543 393 + 5118 2000 5718 "2" "2" "square"] + ElementLine[-393 -2755 393 -2755 800] + ElementLine[-393 2755 393 2755 800] +# +# This draws a 1 mil placement courtyard outline in silk. It should probably +# not be included since you wont want to try and fab a 1 mil silk line. Then +# again, it is most useful during parts placement. It really is time for some +# additional non-fab layers... +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval(-1*V1/2) eval( V2/2) CYW] +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval(-1*V1/2) eval( V2/2) CYW] +) Index: 1.0.8/pcblib/smd/1008.fp =================================================================== --- 1.0.8/pcblib/smd/1008.fp (nonexistent) +++ 1.0.8/pcblib/smd/1008.fp (revision 1136) @@ -0,0 +1,34 @@ +##from:pcb +##for:resistor +##for:capacitor +##for:led + + # grab the input values and convert to 1/100 mil + # how much to grow the pads by for soldermask [1/100 mil] + # clearance from planes [1/100 mil] + # silk screen width [1/100 mil] + # courtyard silk screen width [1/100 mil] +# element_flags, description, pcb-name, value, mark_x, mark_y, +# text_x, text_y, text_direction, text_scale, text_flags +Element[0x00000000 "Standard SMT resistor, capacitor etc" "" "1008" 0 0 -3150 -3150 0 100 ""] +( +# +# Pad[x1, y1, x2, y2, thickness, clearance, mask, name , pad number, flags] + Pad[-5118 -2362 + -5118 2362 + 4330 2000 4930 "1" "1" "square"] + Pad[5118 -2362 + 5118 2362 + 4330 2000 4930 "2" "2" "square"] + ElementLine[-1377 -4527 1377 -4527 800] + ElementLine[-1377 4527 1377 4527 800] +# +# This draws a 1 mil placement courtyard outline in silk. It should probably +# not be included since you wont want to try and fab a 1 mil silk line. Then +# again, it is most useful during parts placement. It really is time for some +# additional non-fab layers... +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval(-1*V1/2) eval( V2/2) CYW] +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval(-1*V1/2) eval( V2/2) CYW] +) Index: 1.0.8/pcblib/smd/1206.fp =================================================================== --- 1.0.8/pcblib/smd/1206.fp (nonexistent) +++ 1.0.8/pcblib/smd/1206.fp (revision 1136) @@ -0,0 +1,34 @@ +##from:pcb +##for:resistor +##for:capacitor +##for:led + + # grab the input values and convert to 1/100 mil + # how much to grow the pads by for soldermask [1/100 mil] + # clearance from planes [1/100 mil] + # silk screen width [1/100 mil] + # courtyard silk screen width [1/100 mil] +# element_flags, description, pcb-name, value, mark_x, mark_y, +# text_x, text_y, text_direction, text_scale, text_flags +Element[0x00000000 "Standard SMT resistor, capacitor etc" "" "1206" 0 0 -3150 -3150 0 100 ""] +( +# +# Pad[x1, y1, x2, y2, thickness, clearance, mask, name , pad number, flags] + Pad[-5905 -1181 + -5905 1181 + 5118 2000 5718 "1" "1" "square"] + Pad[5905 -1181 + 5905 1181 + 5118 2000 5718 "2" "2" "square"] + ElementLine[-2362 -3740 2362 -3740 800] + ElementLine[-2362 3740 2362 3740 800] +# +# This draws a 1 mil placement courtyard outline in silk. It should probably +# not be included since you wont want to try and fab a 1 mil silk line. Then +# again, it is most useful during parts placement. It really is time for some +# additional non-fab layers... +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval(-1*V1/2) eval( V2/2) CYW] +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval(-1*V1/2) eval( V2/2) CYW] +) Index: 1.0.8/pcblib/smd/1210.fp =================================================================== --- 1.0.8/pcblib/smd/1210.fp (nonexistent) +++ 1.0.8/pcblib/smd/1210.fp (revision 1136) @@ -0,0 +1,34 @@ +##from:pcb +##for:resistor +##for:capacitor +##for:led + + # grab the input values and convert to 1/100 mil + # how much to grow the pads by for soldermask [1/100 mil] + # clearance from planes [1/100 mil] + # silk screen width [1/100 mil] + # courtyard silk screen width [1/100 mil] +# element_flags, description, pcb-name, value, mark_x, mark_y, +# text_x, text_y, text_direction, text_scale, text_flags +Element[0x00000000 "Standard SMT resistor, capacitor etc" "" "1210" 0 0 -3150 -3150 0 100 ""] +( +# +# Pad[x1, y1, x2, y2, thickness, clearance, mask, name , pad number, flags] + Pad[-5905 -2755 + -5905 2755 + 5118 2000 5718 "1" "1" "square"] + Pad[5905 -2755 + 5905 2755 + 5118 2000 5718 "2" "2" "square"] + ElementLine[-1968 -5314 1968 -5314 800] + ElementLine[-1968 5314 1968 5314 800] +# +# This draws a 1 mil placement courtyard outline in silk. It should probably +# not be included since you wont want to try and fab a 1 mil silk line. Then +# again, it is most useful during parts placement. It really is time for some +# additional non-fab layers... +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval(-1*V1/2) eval( V2/2) CYW] +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval(-1*V1/2) eval( V2/2) CYW] +) Index: 1.0.8/pcblib/smd/1806.fp =================================================================== --- 1.0.8/pcblib/smd/1806.fp (nonexistent) +++ 1.0.8/pcblib/smd/1806.fp (revision 1136) @@ -0,0 +1,34 @@ +##from:pcb +##for:resistor +##for:capacitor +##for:led + + # grab the input values and convert to 1/100 mil + # how much to grow the pads by for soldermask [1/100 mil] + # clearance from planes [1/100 mil] + # silk screen width [1/100 mil] + # courtyard silk screen width [1/100 mil] +# element_flags, description, pcb-name, value, mark_x, mark_y, +# text_x, text_y, text_direction, text_scale, text_flags +Element[0x00000000 "Standard SMT resistor, capacitor etc" "" "1806" 0 0 -3150 -3150 0 100 ""] +( +# +# Pad[x1, y1, x2, y2, thickness, clearance, mask, name , pad number, flags] + Pad[-7874 -3543 + -7874 3543 + 6299 2000 6899 "1" "1" "square"] + Pad[7874 -3543 + 7874 3543 + 6299 2000 6899 "2" "2" "square"] + ElementLine[-3149 -6692 3149 -6692 800] + ElementLine[-3149 6692 3149 6692 800] +# +# This draws a 1 mil placement courtyard outline in silk. It should probably +# not be included since you wont want to try and fab a 1 mil silk line. Then +# again, it is most useful during parts placement. It really is time for some +# additional non-fab layers... +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval(-1*V1/2) eval( V2/2) CYW] +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval(-1*V1/2) eval( V2/2) CYW] +) Index: 1.0.8/pcblib/smd/1825.fp =================================================================== --- 1.0.8/pcblib/smd/1825.fp (nonexistent) +++ 1.0.8/pcblib/smd/1825.fp (revision 1136) @@ -0,0 +1,34 @@ +##from:pcb +##for:resistor +##for:capacitor +##for:led + + # grab the input values and convert to 1/100 mil + # how much to grow the pads by for soldermask [1/100 mil] + # clearance from planes [1/100 mil] + # silk screen width [1/100 mil] + # courtyard silk screen width [1/100 mil] +# element_flags, description, pcb-name, value, mark_x, mark_y, +# text_x, text_y, text_direction, text_scale, text_flags +Element[0x00000000 "Standard SMT resistor, capacitor etc" "" "1825" 0 0 -3150 -3150 0 100 ""] +( +# +# Pad[x1, y1, x2, y2, thickness, clearance, mask, name , pad number, flags] + Pad[-7874 -10236 + -7874 10236 + 6299 2000 6899 "1" "1" "square"] + Pad[7874 -10236 + 7874 10236 + 6299 2000 6899 "2" "2" "square"] + ElementLine[-3149 -13385 3149 -13385 800] + ElementLine[-3149 13385 3149 13385 800] +# +# This draws a 1 mil placement courtyard outline in silk. It should probably +# not be included since you wont want to try and fab a 1 mil silk line. Then +# again, it is most useful during parts placement. It really is time for some +# additional non-fab layers... +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval(-1*V1/2) eval( V2/2) CYW] +# ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval( V1/2) eval(-1*V2/2) CYW] +# ElementLine[eval( V1/2) eval( V2/2) eval(-1*V1/2) eval( V2/2) CYW] +) Index: 1.0.8/pcblib/smd/2706.fp =================================================================== --- 1.0.8/pcblib/smd/2706.fp (nonexistent) +++ 1.0.8/pcblib/smd/2706.fp (revision 1136) @@ -0,0 +1,20 @@ +##from:pcb +##for:resistor +##for:capacitor +##for:led + + # how much to grow the pads by for soldermask + # clearance from planes +Element(0x00 "Standard SMT resistor, capacitor etc" "" "2706" 0 0 179 0 3 100 0x00) +( + ElementLine(-159 -54 -159 54 10) + ElementLine(-159 54 159 54 10) + ElementLine(159 54 159 -54 10) + ElementLine(159 -54 -159 -54 10) + Pad(-108 -3 + -108 3 + 78 20 84 "1" "1" 0x00000100) + Pad(108 -3 + 108 3 + 78 20 84 "2" "2" 0x00000100) +) Index: 1.0.8/pcblib/smd/DO214.fp =================================================================== --- 1.0.8/pcblib/smd/DO214.fp (nonexistent) +++ 1.0.8/pcblib/smd/DO214.fp (revision 1136) @@ -0,0 +1,20 @@ +##from:pcb +##for:diode + + # how much to grow the pads by for soldermask + # clearance from planes +Element(0x00 "SMT diode (pin 1 is cathode)" "" "DO214" 0 0 221 0 3 100 0x00) +( + ElementLine(-211 -89 -211 89 20) + ElementLine(-211 89 -141 114 10) + ElementLine(-141 114 201 114 10) + ElementLine(201 114 201 -114 10) + ElementLine(201 -114 -141 -114 10) + ElementLine(-141 -114 -211 -89 10) + Pad(-106 -19 + -106 19 + 140 20 146 "1" "1" 0x00000100) + Pad(106 -19 + 106 19 + 140 20 146 "2" "2" 0x00000100) +) Index: 1.0.8/pcblib/smd/DO214AB.fp =================================================================== --- 1.0.8/pcblib/smd/DO214AB.fp (nonexistent) +++ 1.0.8/pcblib/smd/DO214AB.fp (revision 1136) @@ -0,0 +1,20 @@ +##from:pcb +##for:diode + + # how much to grow the pads by for soldermask + # clearance from planes +Element(0x00 "SMT diode (pin 1 is cathode)" "" "DO214AB" 0 0 227 0 3 100 0x00) +( + ElementLine(-217 -92 -217 92 20) + ElementLine(-217 92 -145 118 10) + ElementLine(-145 118 207 118 10) + ElementLine(207 118 207 -118 10) + ElementLine(207 -118 -145 -118 10) + ElementLine(-145 -118 -217 -92 10) + Pad(-109 -20 + -109 20 + 145 20 151 "1" "1" 0x00000100) + Pad(109 -20 + 109 20 + 145 20 151 "2" "2" 0x00000100) +) Index: 1.0.8/pcblib/smd/MPAK.fp =================================================================== --- 1.0.8/pcblib/smd/MPAK.fp (nonexistent) +++ 1.0.8/pcblib/smd/MPAK.fp (revision 1136) @@ -0,0 +1,31 @@ +##from:pcb +##for:transistor +##for:stabilizer +##for:linear + +Element(0x00 "Pressure transducer" "" "MPAK" 235 0 3 100 0x00) +( + ElementLine(0 0 0 558 10) + ElementLine(0 558 215 558 10) + ElementLine(215 558 215 0 10) + ElementLine(215 0 0 0 10) + # 1st pin on pin side + Pad(32 469 + 32 525 + 31 "1" "1" 0x100) + Pad(82 469 + 82 525 + 31 "2" "2" 0x100) + Pad(132 469 + 132 525 + 31 "3" "3" 0x100) + # last pin on pin side + Pad(182 469 + 182 525 + 31 "4" "4" 0x100) + # extra wide pin on opposite side + Pad(144 60 + 70 60 + 87 "5" "5" 0x100) + Mark(32 497) +) Index: 1.0.8/pcblib/smd/SC70_3.fp =================================================================== --- 1.0.8/pcblib/smd/SC70_3.fp (nonexistent) +++ 1.0.8/pcblib/smd/SC70_3.fp (revision 1136) @@ -0,0 +1,33 @@ +##from:pcb +##for:transistor + + # 78 for SOT23 + # 82 for SOT23 + # 41 for SOT23 + # 34 for SOT23, 24 for SOT25 +Element(0x00 "SMT transistor, 3 pins" "" "SC70_3" 114 0 3 100 0x00) +( + ElementLine(0 0 0 119 10) + ElementLine(0 119 94 119 10) + ElementLine(94 119 94 0 10) + ElementLine(94 0 0 0 10) + # 1st side, 1st pin + Pad(21 91 + 21 97 + 29 + "1" "1" 0x100) + # 1st side, 2nd pin + # 1st side, 3rd pin + Pad(72 91 + 72 97 + 29 + "2" "2" 0x100) + # 2nd side, 3rd pin + # 2nd side, 2nd pin + Pad(47 21 + 47 27 + 29 + "3" "3" 0x100) + # 2nd side, 1st pin + Mark(21 94) +) Index: 1.0.8/pcblib/smd/SC70_4.fp =================================================================== --- 1.0.8/pcblib/smd/SC70_4.fp (nonexistent) +++ 1.0.8/pcblib/smd/SC70_4.fp (revision 1136) @@ -0,0 +1,40 @@ +##from:pcb +##for:transistor +##for:stabilizer +##for:linear + + # 78 for SOT23 + # 82 for SOT23 + # 41 for SOT23 + # 34 for SOT23, 24 for SOT25 +Element(0x00 "SMT transistor, 4 pins" "" "SC70_4" 114 0 3 100 0x00) +( + ElementLine(0 0 0 119 10) + ElementLine(0 119 94 119 10) + ElementLine(94 119 94 0 10) + ElementLine(94 0 0 0 10) + # 1st side, 1st pin + # extra width + Pad(24 94 + 27 94 + 29 + "1" "1" 0x100) + # 1st side, 2nd pin + # 1st side, 3rd pin + Pad(72 91 + 72 97 + 29 + "2" "2" 0x100) + # 2nd side, 3rd pin + Pad(72 21 + 72 27 + 29 + "3" "3" 0x100) + # 2nd side, 2nd pin + # 2nd side, 1st pin + Pad(21 21 + 21 27 + 29 + "4" "4" 0x100) + Mark(21 94) +) Index: 1.0.8/pcblib/smd/SC90.fp =================================================================== --- 1.0.8/pcblib/smd/SC90.fp (nonexistent) +++ 1.0.8/pcblib/smd/SC90.fp (revision 1136) @@ -0,0 +1,33 @@ +##from:pcb +##for:transistor + + # 78 for SOT23 + # 82 for SOT23 + # 41 for SOT23 + # 34 for SOT23, 24 for SOT25 +Element(0x00 "SMT transistor, 3 pins" "" "SC90" 93 0 3 100 0x00) +( + ElementLine(0 0 0 98 10) + ElementLine(0 98 73 98 10) + ElementLine(73 98 73 0 10) + ElementLine(73 0 0 0 10) + # 1st side, 1st pin + Pad(17 76 + 17 80 + 24 + "1" "1" 0x100) + # 1st side, 2nd pin + # 1st side, 3rd pin + Pad(56 76 + 56 80 + 24 + "2" "2" 0x100) + # 2nd side, 3rd pin + # 2nd side, 2nd pin + Pad(36 17 + 36 21 + 24 + "3" "3" 0x100) + # 2nd side, 1st pin + Mark(17 78) +) Index: 1.0.8/pcblib/smd/SOD106A.fp =================================================================== --- 1.0.8/pcblib/smd/SOD106A.fp (nonexistent) +++ 1.0.8/pcblib/smd/SOD106A.fp (revision 1136) @@ -0,0 +1,20 @@ +##from:pcb +##for:diode + + # how much to grow the pads by for soldermask + # clearance from planes +Element(0x00 "SMT diode (pin 1 is cathode)" "" "SOD106A" 0 0 166 0 3 100 0x00) +( + ElementLine(-156 -68 -156 68 20) + ElementLine(-156 68 -105 87 10) + ElementLine(-105 87 146 87 10) + ElementLine(146 87 146 -87 10) + ElementLine(146 -87 -105 -87 10) + ElementLine(-105 -87 -156 -68 10) + Pad(-76 -17 + -76 17 + 102 20 108 "1" "1" 0x00000100) + Pad(76 -17 + 76 17 + 102 20 108 "2" "2" 0x00000100) +) Index: 1.0.8/pcblib/smd/SOD110.fp =================================================================== --- 1.0.8/pcblib/smd/SOD110.fp (nonexistent) +++ 1.0.8/pcblib/smd/SOD110.fp (revision 1136) @@ -0,0 +1,20 @@ +##from:pcb +##for:diode + + # how much to grow the pads by for soldermask + # clearance from planes +Element(0x00 "SMT diode (pin 1 is cathode)" "" "SOD110" 0 0 83 0 3 100 0x00) +( + ElementLine(-73 -38 -73 38 20) + ElementLine(-73 38 -50 49 10) + ElementLine(-50 49 63 49 10) + ElementLine(63 49 63 -49 10) + ElementLine(63 -49 -50 -49 10) + ElementLine(-50 -49 -73 -38 10) + Pad(-29 -15 + -29 15 + 46 20 52 "1" "1" 0x00000100) + Pad(29 -15 + 29 15 + 46 20 52 "2" "2" 0x00000100) +) Index: 1.0.8/pcblib/smd/SOD123.fp =================================================================== --- 1.0.8/pcblib/smd/SOD123.fp (nonexistent) +++ 1.0.8/pcblib/smd/SOD123.fp (revision 1136) @@ -0,0 +1,20 @@ +##from:pcb +##for:diode + + # how much to grow the pads by for soldermask + # clearance from planes +Element(0x00 "SMT diode (pin 1 is cathode)" "" "SOD123" 0 0 120 0 3 100 0x00) +( + ElementLine(-110 -40 -110 40 20) + ElementLine(-110 40 -76 51 10) + ElementLine(-76 51 100 51 10) + ElementLine(100 51 100 -51 10) + ElementLine(100 -51 -76 -51 10) + ElementLine(-76 -51 -110 -40 10) + Pad(-55 -6 + -55 6 + 69 20 75 "1" "1" 0x00000100) + Pad(55 -6 + 55 6 + 69 20 75 "2" "2" 0x00000100) +) Index: 1.0.8/pcblib/smd/SOD323.fp =================================================================== --- 1.0.8/pcblib/smd/SOD323.fp (nonexistent) +++ 1.0.8/pcblib/smd/SOD323.fp (revision 1136) @@ -0,0 +1,20 @@ +##from:pcb +##for:diode + + # how much to grow the pads by for soldermask + # clearance from planes +Element(0x00 "SMT diode (pin 1 is cathode)" "" "SOD323" 0 0 93 0 3 100 0x00) +( + ElementLine(-83 -35 -83 35 20) + ElementLine(-83 35 -58 45 10) + ElementLine(-58 45 73 45 10) + ElementLine(73 45 73 -45 10) + ElementLine(73 -45 -58 -45 10) + ElementLine(-58 -45 -83 -35 10) + Pad(-37 -10 + -37 10 + 51 20 57 "1" "1" 0x00000100) + Pad(37 -10 + 37 10 + 51 20 57 "2" "2" 0x00000100) +) Index: 1.0.8/pcblib/smd/SOD80.fp =================================================================== --- 1.0.8/pcblib/smd/SOD80.fp (nonexistent) +++ 1.0.8/pcblib/smd/SOD80.fp (revision 1136) @@ -0,0 +1,20 @@ +##from:pcb +##for:diode + + # how much to grow the pads by for soldermask + # clearance from planes +Element(0x00 "SMT diode (pin 1 is cathode)" "" "SOD80" 0 0 116 0 3 100 0x00) +( + ElementLine(-106 -43 -106 43 20) + ElementLine(-106 43 -80 55 10) + ElementLine(-80 55 96 55 10) + ElementLine(96 55 96 -55 10) + ElementLine(96 -55 -80 -55 10) + ElementLine(-80 -55 -106 -43 10) + Pad(-58 -16 + -58 16 + 53 20 59 "1" "1" 0x00000100) + Pad(58 -16 + 58 16 + 53 20 59 "2" "2" 0x00000100) +) Index: 1.0.8/pcblib/smd/SOD87.fp =================================================================== --- 1.0.8/pcblib/smd/SOD87.fp (nonexistent) +++ 1.0.8/pcblib/smd/SOD87.fp (revision 1136) @@ -0,0 +1,20 @@ +##from:pcb +##for:diode + + # how much to grow the pads by for soldermask + # clearance from planes +Element(0x00 "SMT diode (pin 1 is cathode)" "" "SOD87" 0 0 124 0 3 100 0x00) +( + ElementLine(-114 -57 -114 57 20) + ElementLine(-114 57 -84 73 10) + ElementLine(-84 73 104 73 10) + ElementLine(104 73 104 -73 10) + ElementLine(104 -73 -84 -73 10) + ElementLine(-84 -73 -114 -57 10) + Pad(-58 -26 + -58 26 + 61 20 67 "1" "1" 0x00000100) + Pad(58 -26 + 58 26 + 61 20 67 "2" "2" 0x00000100) +) Index: 1.0.8/pcblib/smd/SOT143.fp =================================================================== --- 1.0.8/pcblib/smd/SOT143.fp (nonexistent) +++ 1.0.8/pcblib/smd/SOT143.fp (revision 1136) @@ -0,0 +1,38 @@ +##from:pcb +##for:transistor + + # 78 for SOT23 + # 82 for SOT23 + # 41 for SOT23 + # 34 for SOT23, 24 for SOT25 +Element(0x00 "SMT transistor, 4 pins" "" "SOT143" 144 0 3 100 0x00) +( + ElementLine(0 0 0 139 10) + ElementLine(0 139 124 139 10) + ElementLine(124 139 124 0 10) + ElementLine(124 0 0 0 10) + # 1st side, 1st pin + # extra width + Pad(28 110 + 31 110 + 34 + "1" "1" 0x100) + # 1st side, 2nd pin + # 1st side, 3rd pin + Pad(99 107 + 99 113 + 34 + "2" "2" 0x100) + # 2nd side, 3rd pin + Pad(99 25 + 99 31 + 34 + "3" "3" 0x100) + # 2nd side, 2nd pin + # 2nd side, 1st pin + Pad(25 25 + 25 31 + 34 + "4" "4" 0x100) + Mark(25 110) +) Index: 1.0.8/pcblib/smd/SOT223.fp =================================================================== --- 1.0.8/pcblib/smd/SOT223.fp (nonexistent) +++ 1.0.8/pcblib/smd/SOT223.fp (revision 1136) @@ -0,0 +1,29 @@ +##from:pcb +##for:transistor + +Element(0x00 "SMT transistor, 4 pins" "" "SOT223" 305 0 3 100 0x00) +( + ElementLine(0 0 0 414 10) + ElementLine(0 414 285 414 10) + ElementLine(285 414 285 0 10) + ElementLine(285 0 0 0 10) + # 1st pin on pin side + Pad(52 296 + 52 362 + 56 + "1" "1" 0x100) + Pad(142 296 + 142 362 + 56 + "2" "2" 0x100) + # last pin on pin side + Pad(233 296 + 233 362 + 56 + "3" "3" 0x100) + # extra wide pin on opposite side + Pad(187 85 + 97 85 + 122 "4" "4" 0x100) + Mark(52 329) +) Index: 1.0.8/pcblib/smd/SOT23.fp =================================================================== --- 1.0.8/pcblib/smd/SOT23.fp (nonexistent) +++ 1.0.8/pcblib/smd/SOT23.fp (revision 1136) @@ -0,0 +1,33 @@ +##from:pcb +##for:transistor + + # 78 for SOT23 + # 82 for SOT23 + # 41 for SOT23 + # 34 for SOT23, 24 for SOT25 +Element(0x00 "SMT transistor, 3 pins" "" "SOT23" 148 0 3 100 0x00) +( + ElementLine(0 0 0 139 10) + ElementLine(0 139 128 139 10) + ElementLine(128 139 128 0 10) + ElementLine(128 0 0 0 10) + # 1st side, 1st pin + Pad(25 107 + 25 113 + 34 + "1" "1" 0x100) + # 1st side, 2nd pin + # 1st side, 3rd pin + Pad(103 107 + 103 113 + 34 + "2" "2" 0x100) + # 2nd side, 3rd pin + # 2nd side, 2nd pin + Pad(64 25 + 64 31 + 34 + "3" "3" 0x100) + # 2nd side, 1st pin + Mark(25 110) +) Index: 1.0.8/pcblib/smd/SOT23D.fp =================================================================== --- 1.0.8/pcblib/smd/SOT23D.fp (nonexistent) +++ 1.0.8/pcblib/smd/SOT23D.fp (revision 1136) @@ -0,0 +1,33 @@ +##from:pcb +##for:transistor + + # 78 for SOT23 + # 82 for SOT23 + # 41 for SOT23 + # 34 for SOT23, 24 for SOT25 +Element(0x00 "SMT diode (pin 1 is cathode)" "" "SOT23D" 148 0 3 100 0x00) +( + ElementLine(0 0 0 139 10) + ElementLine(0 139 128 139 10) + ElementLine(128 139 128 0 10) + ElementLine(128 0 0 0 10) + # 1st side, 1st pin + Pad(25 107 + 25 113 + 34 + "2" "2" 0x100) + # 1st side, 2nd pin + # 1st side, 3rd pin + Pad(103 107 + 103 113 + 34 + "3" "3" 0x100) + # 2nd side, 3rd pin + # 2nd side, 2nd pin + Pad(64 25 + 64 31 + 34 + "1" "1" 0x100) + # 2nd side, 1st pin + Mark(25 110) +) Index: 1.0.8/pcblib/smd/SOT25.fp =================================================================== --- 1.0.8/pcblib/smd/SOT25.fp (nonexistent) +++ 1.0.8/pcblib/smd/SOT25.fp (revision 1136) @@ -0,0 +1,38 @@ +##from:pcb +##for:transistor +##for:stabilizer +##for:linear + + # 78 for SOT23 + # 82 for SOT23 + # 41 for SOT23 + # 34 for SOT23, 24 for SOT25 +Element(0x00 "SMT transistor, 5 pins" "" "SOT25" 138 0 3 100 0x00) +( + ElementLine(0 0 0 139 10) + ElementLine(0 139 118 139 10) + ElementLine(118 139 118 0 10) + ElementLine(118 0 0 0 10) + # 1st side, 1st pin + Pad(20 102 + 20 118 + 24 "1" "1" 0x100) + # 1st side, 2nd pin + # 1st side, 3rd pin + Pad(98 102 + 98 118 + 24 "2" "2" 0x100) + # 2nd side, 3rd pin + Pad(98 20 + 98 36 + 24 "3" "3" 0x100) + # 2nd side, 2nd pin + Pad(59 20 + 59 36 + 24 "4" "4" 0x100) + # 2nd side, 1st pin + Pad(20 20 + 20 36 + 24 "5" "5" 0x100) + Mark(20 110) +) Index: 1.0.8/pcblib/smd/SOT26.fp =================================================================== --- 1.0.8/pcblib/smd/SOT26.fp (nonexistent) +++ 1.0.8/pcblib/smd/SOT26.fp (revision 1136) @@ -0,0 +1,41 @@ +##from:pcb +##for:transistor +##for:stabilizer +##for:linear + + # 78 for SOT23 + # 82 for SOT23 + # 41 for SOT23 + # 34 for SOT23, 24 for SOT25 +Element(0x00 "SMT transistor, 6 pins" "" "SOT26" 138 0 3 100 0x00) +( + ElementLine(0 0 0 139 10) + ElementLine(0 139 118 139 10) + ElementLine(118 139 118 0 10) + ElementLine(118 0 0 0 10) + # 1st side, 1st pin + Pad(20 102 + 20 118 + 24 "1" "1" 0x100) + # 1st side, 2nd pin + Pad(59 102 + 59 118 + 24 "2" "2" 0x100) + # 1st side, 3rd pin + Pad(98 102 + 98 118 + 24 "3" "3" 0x100) + # 2nd side, 3rd pin + Pad(98 20 + 98 36 + 24 "4" "4" 0x100) + # 2nd side, 2nd pin + Pad(59 20 + 59 36 + 24 "5" "5" 0x100) + # 2nd side, 1st pin + Pad(20 20 + 20 36 + 24 "6" "6" 0x100) + Mark(20 110) +) Index: 1.0.8/pcblib/smd/SOT323.fp =================================================================== --- 1.0.8/pcblib/smd/SOT323.fp (nonexistent) +++ 1.0.8/pcblib/smd/SOT323.fp (revision 1136) @@ -0,0 +1,33 @@ +##from:pcb +##for:transistor + + # 78 for SOT23 + # 82 for SOT23 + # 41 for SOT23 + # 34 for SOT23, 24 for SOT25 +Element(0x00 "SMT transistor, 3 pins" "" "SOT323" 114 0 3 100 0x00) +( + ElementLine(0 0 0 119 10) + ElementLine(0 119 94 119 10) + ElementLine(94 119 94 0 10) + ElementLine(94 0 0 0 10) + # 1st side, 1st pin + Pad(21 91 + 21 97 + 29 + "1" "1" 0x100) + # 1st side, 2nd pin + # 1st side, 3rd pin + Pad(72 91 + 72 97 + 29 + "2" "2" 0x100) + # 2nd side, 3rd pin + # 2nd side, 2nd pin + Pad(47 21 + 47 27 + 29 + "3" "3" 0x100) + # 2nd side, 1st pin + Mark(21 94) +) Index: 1.0.8/pcblib/smd/SOT323D.fp =================================================================== --- 1.0.8/pcblib/smd/SOT323D.fp (nonexistent) +++ 1.0.8/pcblib/smd/SOT323D.fp (revision 1136) @@ -0,0 +1,33 @@ +##from:pcb +##for:transistor + + # 78 for SOT23 + # 82 for SOT23 + # 41 for SOT23 + # 34 for SOT23, 24 for SOT25 +Element(0x00 "SMT diode (pin 1 is cathode)" "" "SOT323D" 114 0 3 100 0x00) +( + ElementLine(0 0 0 119 10) + ElementLine(0 119 94 119 10) + ElementLine(94 119 94 0 10) + ElementLine(94 0 0 0 10) + # 1st side, 1st pin + Pad(21 91 + 21 97 + 29 + "2" "2" 0x100) + # 1st side, 2nd pin + # 1st side, 3rd pin + Pad(72 91 + 72 97 + 29 + "3" "3" 0x100) + # 2nd side, 3rd pin + # 2nd side, 2nd pin + Pad(47 21 + 47 27 + 29 + "1" "1" 0x100) + # 2nd side, 1st pin + Mark(21 94) +) Index: 1.0.8/pcblib/smd/SOT325.fp =================================================================== --- 1.0.8/pcblib/smd/SOT325.fp (nonexistent) +++ 1.0.8/pcblib/smd/SOT325.fp (revision 1136) @@ -0,0 +1,40 @@ +##from:pcb +##for:transistor +##for:stabilizer +##for:linear + + + # 78 for SOT23 + # 82 for SOT23 + # 41 for SOT23 + # 34 for SOT23, 24 for SOT25 +# alias sc70-5 +Element(0x00 "SMT transistor, 5 pins" "" "SOT325" 100 0 3 100 0x00) +( + ElementLine(0 0 0 119 10) + ElementLine(0 119 80 119 10) + ElementLine(80 119 80 0 10) + ElementLine(80 0 0 0 10) + # 1st side, 1st pin + Pad(14 84 + 14 104 + 15 "1" "1" 0x100) + # 1st side, 2nd pin + # 1st side, 3rd pin + Pad(65 84 + 65 104 + 15 "2" "2" 0x100) + # 2nd side, 3rd pin + Pad(65 14 + 65 34 + 15 "3" "3" 0x100) + # 2nd side, 2nd pin + Pad(40 14 + 40 34 + 15 "4" "4" 0x100) + # 2nd side, 1st pin + Pad(14 14 + 14 34 + 15 "5" "5" 0x100) + Mark(14 94) +) Index: 1.0.8/pcblib/smd/SOT326.fp =================================================================== --- 1.0.8/pcblib/smd/SOT326.fp (nonexistent) +++ 1.0.8/pcblib/smd/SOT326.fp (revision 1136) @@ -0,0 +1,42 @@ +##from:pcb +##for:transistor +##for:stabilizer +##for:linear + + # 78 for SOT23 + # 82 for SOT23 + # 41 for SOT23 + # 34 for SOT23, 24 for SOT25 +# alias sc70-6 +Element(0x00 "SMT transistor, 6 pins" "" "SOT326" 100 0 3 100 0x00) +( + ElementLine(0 0 0 119 10) + ElementLine(0 119 80 119 10) + ElementLine(80 119 80 0 10) + ElementLine(80 0 0 0 10) + # 1st side, 1st pin + Pad(14 84 + 14 104 + 15 "1" "1" 0x100) + # 1st side, 2nd pin + Pad(40 84 + 40 104 + 15 "2" "2" 0x100) + # 1st side, 3rd pin + Pad(65 84 + 65 104 + 15 "3" "3" 0x100) + # 2nd side, 3rd pin + Pad(65 14 + 65 34 + 15 "4" "4" 0x100) + # 2nd side, 2nd pin + Pad(40 14 + 40 34 + 15 "5" "5" 0x100) + # 2nd side, 1st pin + Pad(14 14 + 14 34 + 15 "6" "6" 0x100) + Mark(14 94) +) Index: 1.0.8/pcblib/smd/SOT89.fp =================================================================== --- 1.0.8/pcblib/smd/SOT89.fp (nonexistent) +++ 1.0.8/pcblib/smd/SOT89.fp (revision 1136) @@ -0,0 +1,31 @@ +##from:pcb +##for:transistor +##for:stabilizer +##for:linear + +Element(0x00 "SMT transistor, 4 pins" "" "SOT89" 203 0 3 100 0x00) +( + ElementLine(0 0 0 207 10) + ElementLine(0 207 183 207 10) + ElementLine(183 207 183 0 10) + ElementLine(183 0 0 0 10) + # 1st pin on pin side + Pad(30 152 + 30 176 + 37 + "1" "1" 0x100) + Pad(91 152 + 91 176 + 37 + "2" "2" 0x100) + # last pin on pin side + Pad(152 152 + 152 176 + 37 + "3" "3" 0x100) + # extra wide pin on opposite side + Pad(121 42 + 61 42 + 61 "4" "4" 0x100) + Mark(30 164) +) Index: 1.0.8/pcblib/smd/TANT_A.fp =================================================================== --- 1.0.8/pcblib/smd/TANT_A.fp (nonexistent) +++ 1.0.8/pcblib/smd/TANT_A.fp (revision 1136) @@ -0,0 +1,21 @@ +##from:pcb +##for:capacitor +##for:tantal + + # how much to grow the pads by for soldermask + # clearance from planes +Element(0x00 "Tantalum SMT capacitor (pin 1 is +)" "" "TANT_A" 0 0 106 0 3 100 0x00) +( + ElementLine(-96 -43 -96 43 20) + ElementLine(-96 43 -72 55 10) + ElementLine(-72 55 86 55 10) + ElementLine(86 55 86 -55 10) + ElementLine(86 -55 -72 -55 10) + ElementLine(-72 -55 -96 -43 10) + Pad(-50 -18 + -50 18 + 49 20 55 "1" "1" 0x00000100) + Pad(50 -18 + 50 18 + 49 20 55 "2" "2" 0x00000100) +) Index: 1.0.8/pcblib/smd/TANT_B.fp =================================================================== --- 1.0.8/pcblib/smd/TANT_B.fp (nonexistent) +++ 1.0.8/pcblib/smd/TANT_B.fp (revision 1136) @@ -0,0 +1,21 @@ +##from:pcb +##for:capacitor +##for:tantal + + # how much to grow the pads by for soldermask + # clearance from planes +Element(0x00 "Tantalum SMT capacitor (pin 1 is +)" "" "TANT_B" 0 0 132 0 3 100 0x00) +( + ElementLine(-122 -77 -122 77 20) + ElementLine(-122 77 -87 99 10) + ElementLine(-87 99 112 99 10) + ElementLine(112 99 112 -99 10) + ElementLine(112 -99 -87 -99 10) + ElementLine(-87 -99 -122 -77 10) + Pad(-55 -41 + -55 41 + 71 20 77 "1" "1" 0x00000100) + Pad(55 -41 + 55 41 + 71 20 77 "2" "2" 0x00000100) +) Index: 1.0.8/pcblib/smd/TANT_C.fp =================================================================== --- 1.0.8/pcblib/smd/TANT_C.fp (nonexistent) +++ 1.0.8/pcblib/smd/TANT_C.fp (revision 1136) @@ -0,0 +1,21 @@ +##from:pcb +##for:capacitor +##for:tantal + + # how much to grow the pads by for soldermask + # clearance from planes +Element(0x00 "Tantalum SMT capacitor (pin 1 is +)" "" "TANT_C" 0 0 188 0 3 100 0x00) +( + ElementLine(-178 -87 -178 87 20) + ElementLine(-178 87 -130 112 10) + ElementLine(-130 112 168 112 10) + ElementLine(168 112 168 -112 10) + ElementLine(168 -112 -130 -112 10) + ElementLine(-130 -112 -178 -87 10) + Pad(-94 -39 + -94 39 + 97 20 103 "1" "1" 0x00000100) + Pad(94 -39 + 94 39 + 97 20 103 "2" "2" 0x00000100) +) Index: 1.0.8/pcblib/smd/TANT_D.fp =================================================================== --- 1.0.8/pcblib/smd/TANT_D.fp (nonexistent) +++ 1.0.8/pcblib/smd/TANT_D.fp (revision 1136) @@ -0,0 +1,21 @@ +##from:pcb +##for:capacitor +##for:tantal + + # how much to grow the pads by for soldermask + # clearance from planes +Element(0x00 "Tantalum SMT capacitor (pin 1 is +)" "" "TANT_D" 0 0 229 0 3 100 0x00) +( + ElementLine(-219 -117 -219 117 20) + ElementLine(-219 117 -158 150 10) + ElementLine(-158 150 209 150 10) + ElementLine(209 150 209 -150 10) + ElementLine(209 -150 -158 -150 10) + ElementLine(-158 -150 -219 -117 10) + Pad(-115 -56 + -115 56 + 123 20 129 "1" "1" 0x00000100) + Pad(115 -56 + 115 56 + 123 20 129 "2" "2" 0x00000100) +) Index: 1.0.8/pcblib/smd/minimelf.fp =================================================================== --- 1.0.8/pcblib/smd/minimelf.fp (nonexistent) +++ 1.0.8/pcblib/smd/minimelf.fp (revision 1136) @@ -0,0 +1,12 @@ +##from:repo.hu/projects/openhw +##for:diode + + +Element["" "" "D101" "" 145669 141732 -3720 -2087 0 70 ""] +( + Pad[7087 -984 7087 984 5118 5000 7618 "" "1" "square"] + Pad[-7087 -984 -7087 984 5118 5000 7618 "" "2" "square"] + ElementLine [-3937 -3150 3937 -3150 787] + ElementLine [-3937 3150 3937 3150 787] + + ) Index: 1.0.8/pcblib/tru-hole/HC49.fp =================================================================== --- 1.0.8/pcblib/tru-hole/HC49.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/HC49.fp (revision 1136) @@ -0,0 +1,13 @@ +##from:pcb +##for:crystal +##for:xtal +Element(0x00 "Crystals" "" "HC49" 0 -60 0 100 0x00) +( + Pin(50 50 60 28 "1" 0x101) + Pin(250 50 60 28 "2" 0x01) + ElementLine(50 0 250 0 20) + ElementArc(250 50 50 50 90 180 20) + ElementLine(250 100 50 100 20) + ElementArc(50 50 50 50 270 180 20) + Mark(50 50) +) Index: 1.0.8/pcblib/tru-hole/HC49U.fp =================================================================== --- 1.0.8/pcblib/tru-hole/HC49U.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/HC49U.fp (revision 1136) @@ -0,0 +1,13 @@ +##from:pcb +##for:crystal +##for:xtal +Element(0x00 "Crystals" "" "HC49U" 0 -60 0 100 0x00) +( + Pin(121 91 60 32 "1" 0x101) + Pin(313 91 60 32 "2" 0x01) + ElementLine(91 0 344 0 20) + ElementArc(344 91 91 91 90 180 20) + ElementLine(344 183 91 183 20) + ElementArc(91 91 91 91 270 180 20) + Mark(121 91) +) Index: 1.0.8/pcblib/tru-hole/HC49UH.fp =================================================================== --- 1.0.8/pcblib/tru-hole/HC49UH.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/HC49UH.fp (revision 1136) @@ -0,0 +1,13 @@ +##from:pcb +##for:crystal +##for:xtal +Element(0x00 "Crystals" "" "HC49UH" 0 -60 0 100 0x00) +( + Pin(121 615 60 32 "1" 0x101) + Pin(313 615 60 32 "2" 0x01) + ElementLine(0 0 435 0 20) + ElementLine(435 0 435 515 20) + ElementLine(435 515 0 515 20) + ElementLine(0 515 0 0 20) + Mark(121 615) +) Index: 1.0.8/pcblib/tru-hole/HC49U_3.fp =================================================================== --- 1.0.8/pcblib/tru-hole/HC49U_3.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/HC49U_3.fp (revision 1136) @@ -0,0 +1,14 @@ +##from:pcb +##for:crystal +##for:xtal +Element(0x00 "Crystals" "" "HC49U_3" 0 -60 0 100 0x00) +( + Pin(121 91 60 32 "1" 0x101) + Pin(217 91 60 32 "2" 0x01) + Pin(313 91 60 32 "3" 0x01) + ElementLine(91 0 344 0 20) + ElementArc(344 91 91 91 90 180 20) + ElementLine(344 183 91 183 20) + ElementArc(91 91 91 91 270 180 20) + Mark(121 91) +) Index: 1.0.8/pcblib/tru-hole/HC49U_3H.fp =================================================================== --- 1.0.8/pcblib/tru-hole/HC49U_3H.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/HC49U_3H.fp (revision 1136) @@ -0,0 +1,14 @@ +##from:pcb +##for:crystal +##for:xtal +Element(0x00 "Crystals" "" "HC49U_3H" 0 -60 0 100 0x00) +( + Pin(121 615 60 32 "1" 0x101) + Pin(217 615 60 32 "2" 0x01) + Pin(313 615 60 32 "3" 0x01) + ElementLine(0 0 435 0 20) + ElementLine(435 0 435 515 20) + ElementLine(435 515 0 515 20) + ElementLine(0 515 0 0 20) + Mark(121 615) +) Index: 1.0.8/pcblib/tru-hole/HC51U.fp =================================================================== --- 1.0.8/pcblib/tru-hole/HC51U.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/HC51U.fp (revision 1136) @@ -0,0 +1,13 @@ +##from:pcb +##for:crystal +##for:xtal +Element(0x00 "Crystals" "" "HC51U" 0 -60 0 100 0x00) +( + Pin(136 176 80 40 "1" 0x101) + Pin(621 176 80 40 "2" 0x01) + ElementLine(176 0 581 0 20) + ElementArc(581 176 176 176 90 180 20) + ElementLine(581 352 176 352 20) + ElementArc(176 176 176 176 270 180 20) + Mark(136 176) +) Index: 1.0.8/pcblib/tru-hole/HC51UH.fp =================================================================== --- 1.0.8/pcblib/tru-hole/HC51UH.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/HC51UH.fp (revision 1136) @@ -0,0 +1,13 @@ +##from:pcb +##for:crystal +##for:xtal +Element(0x00 "Crystals" "" "HC51UH" 0 -60 0 100 0x00) +( + Pin(136 975 80 40 "1" 0x101) + Pin(621 975 80 40 "2" 0x01) + ElementLine(0 0 757 0 20) + ElementLine(757 0 757 775 20) + ElementLine(757 775 0 775 20) + ElementLine(0 775 0 0 20) + Mark(136 975) +) Index: 1.0.8/pcblib/tru-hole/HEPTAWATT.fp =================================================================== --- 1.0.8/pcblib/tru-hole/HEPTAWATT.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/HEPTAWATT.fp (revision 1136) @@ -0,0 +1,20 @@ +##from:pcb +##for:IC +Element(0x00 "Power IC, as in MULTIWATT15" "" "HEPTAWATT" 469 50 3 100 0x00) +( + Pin(54 310 90 60 "1" 0x101) + Pin(104 110 90 60 "2" 0x01) + Pin(154 310 90 60 "3" 0x01) + Pin(204 110 90 60 "4" 0x01) + Pin(254 310 90 60 "5" 0x01) + Pin(304 110 90 60 "6" 0x01) + Pin(354 310 90 60 "7" 0x01) + ElementLine(0 0 0 189 20) + ElementLine(0 189 409 189 20) + ElementLine(409 189 409 0 20) + ElementLine(409 0 0 0 20) + ElementLine(0 50 409 50 10) + ElementLine(129 0 129 50 10) + ElementLine(279 0 279 50 10) + Mark(54 249) + ) Index: 1.0.8/pcblib/tru-hole/LED3.fp =================================================================== --- 1.0.8/pcblib/tru-hole/LED3.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/LED3.fp (revision 1136) @@ -0,0 +1,19 @@ +##from:pcb +##for:crystal +##for:led +##ref:http://www.lumex.com +Element(0x00 "LED, size in mm (pin 1 is +, 2 is -)" "" "LED3" 100 70 0 100 0x00) +( +# typical LED is 0.5 mm or 0.020" square pin. See for example +# http://www.lumex.com and part number SSL-LX3054LGD. +# 0.020" square is 0.0288" diagonal. A number 57 drill is +# 0.043" which should be enough. a 65 mil pad gives 11 mils +# of annular ring. + Pin(-50 0 65 43 "1" 0x101) + Pin(50 0 65 43 "2" 0x01) + ElementArc(0 0 59 59 45 90 10) + ElementArc(0 0 59 59 225 90 10) + ElementArc(0 0 79 79 45 90 10) + ElementArc(0 0 79 79 225 90 10) + Mark(0 0) +) Index: 1.0.8/pcblib/tru-hole/LED5.fp =================================================================== --- 1.0.8/pcblib/tru-hole/LED5.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/LED5.fp (revision 1136) @@ -0,0 +1,16 @@ +##from:pcb +##for:led +##ref:http://www.lumex.com +Element(0x00 "LED, size in mm (pin 1 is +, 2 is -)" "" "LED5" 100 70 0 100 0x00) +( +# typical LED is 0.5 mm or 0.020" square pin. See for example +# http://www.lumex.com and part number SSL-LX3054LGD. +# 0.020" square is 0.0288" diagonal. A number 57 drill is +# 0.043" which should be enough. a 65 mil pad gives 11 mils +# of annular ring. + Pin(-50 0 65 43 "1" 0x101) + Pin(50 0 65 43 "2" 0x01) + ElementArc(0 0 118 118 0 360 10) + ElementArc(0 0 138 138 0 360 10) + Mark(0 0) +) Index: 1.0.8/pcblib/tru-hole/MULTIWATT11.fp =================================================================== --- 1.0.8/pcblib/tru-hole/MULTIWATT11.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/MULTIWATT11.fp (revision 1136) @@ -0,0 +1,24 @@ +##from:pcb +##for:IC +Element(0x00 "Power IC, as in MULTIWATT15" "" "MULTIWATT11" 860 50 3 100 0x00) +( + Pin(65 380 90 60 "1" 0x101) + Pin(132 180 90 60 "2" 0x01) + Pin(199 380 90 60 "3" 0x01) + Pin(266 180 90 60 "4" 0x01) + Pin(333 380 90 60 "5" 0x01) + Pin(400 180 90 60 "6" 0x01) + Pin(467 380 90 60 "7" 0x01) + Pin(534 180 90 60 "8" 0x01) + Pin(601 380 90 60 "9" 0x01) + Pin(668 180 90 60 "10" 0x01) + Pin(735 380 90 60 "11" 0x01) + ElementLine(0 0 0 200 20) + ElementLine(0 200 800 200 20) + ElementLine(800 200 800 0 20) + ElementLine(800 0 0 0 20) + ElementLine(0 50 800 50 10) + ElementLine(325 0 325 50 10) + ElementLine(475 0 475 50 10) + Mark(65 260) + ) Index: 1.0.8/pcblib/tru-hole/MULTIWATT15.fp =================================================================== --- 1.0.8/pcblib/tru-hole/MULTIWATT15.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/MULTIWATT15.fp (revision 1136) @@ -0,0 +1,28 @@ +##from:pcb +##for:IC +Element(0x00 "Power IC, as in MULTIWATT15" "" "MULTIWATT15" 860 50 3 100 0x00) +( + Pin(50 380 90 60 "1" 0x101) + Pin(100 180 90 60 "2" 0x01) + Pin(150 380 90 60 "3" 0x01) + Pin(200 180 90 60 "4" 0x01) + Pin(250 380 90 60 "5" 0x01) + Pin(300 180 90 60 "6" 0x01) + Pin(350 380 90 60 "7" 0x01) + Pin(400 180 90 60 "8" 0x01) + Pin(450 380 90 60 "9" 0x01) + Pin(500 180 90 60 "10" 0x01) + Pin(550 380 90 60 "11" 0x01) + Pin(600 180 90 60 "12" 0x01) + Pin(650 380 90 60 "13" 0x01) + Pin(700 180 90 60 "14" 0x01) + Pin(750 380 90 60 "15" 0x01) + ElementLine(0 0 0 200 20) + ElementLine(0 200 800 200 20) + ElementLine(800 200 800 0 20) + ElementLine(800 0 0 0 20) + ElementLine(0 50 800 50 10) + ElementLine(325 0 325 50 10) + ElementLine(475 0 475 50 10) + Mark(50 260) + ) Index: 1.0.8/pcblib/tru-hole/MULTIWATT8.fp =================================================================== --- 1.0.8/pcblib/tru-hole/MULTIWATT8.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/MULTIWATT8.fp (revision 1136) @@ -0,0 +1,21 @@ +##from:pcb +##for:IC +Element(0x00 "Power IC, as in MULTIWATT15" "" "MULTIWATT8" 860 50 3 100 0x00) +( + Pin(50 115 90 60 "1" 0x101) + Pin(150 115 90 60 "2" 0x01) + Pin(250 115 90 60 "3" 0x01) + Pin(350 115 90 60 "4" 0x01) + Pin(450 115 90 60 "5" 0x01) + Pin(550 115 90 60 "6" 0x01) + Pin(650 115 90 60 "7" 0x01) + Pin(750 115 90 60 "8" 0x01) + ElementLine(0 0 0 200 20) + ElementLine(0 200 800 200 20) + ElementLine(800 200 800 0 20) + ElementLine(800 0 0 0 20) + ElementLine(0 50 800 50 10) + ElementLine(325 0 325 50 10) + ElementLine(475 0 475 50 10) + Mark(50 260) + ) Index: 1.0.8/pcblib/tru-hole/OSC14.fp =================================================================== --- 1.0.8/pcblib/tru-hole/OSC14.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/OSC14.fp (revision 1136) @@ -0,0 +1,26 @@ +##from:pcb +##for:oscillator +##for:xtal + Element(0x00 "Crystal oscillator" "" "OSC14" 270 300 3 100 0x00) +( + Pin(100 100 50 28 "NC" 0x01) + Pin(100 700 50 28 "GND" 0x01) + Pin(400 700 50 28 "CLK" 0x01) + Pin(400 100 50 28 "VCC" 0x01) + ElementLine(5 5 400 5 10) + ElementArc(400 100 95 95 180 90 10) + ElementLine(495 100 495 700 10) + ElementArc(400 700 95 95 90 90 10) + ElementLine(400 795 100 795 10) + ElementArc(100 700 95 95 0 90 10) + ElementLine(5 700 5 5 10) + ElementLine(100 60 400 60 10) + ElementArc(400 100 40 40 180 90 10) + ElementLine(440 100 440 700 10) + ElementArc(400 700 40 40 90 90 10) + ElementLine(400 740 100 740 10) + ElementArc(100 700 40 40 0 90 10) + ElementLine(60 700 60 100 10) + ElementArc(100 100 40 40 270 90 10) + Mark(100 100) +) Index: 1.0.8/pcblib/tru-hole/PENTAWATT.fp =================================================================== --- 1.0.8/pcblib/tru-hole/PENTAWATT.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/PENTAWATT.fp (revision 1136) @@ -0,0 +1,18 @@ +##from:pcb +##for:IC +Element(0x00 "Power IC, as in MULTIWATT15" "" "PENTAWATT" 469 50 3 100 0x00) +( + Pin(70 334 90 60 "1" 0x101) + Pin(137 177 90 60 "2" 0x01) + Pin(204 334 90 60 "3" 0x01) + Pin(271 177 90 60 "4" 0x01) + Pin(338 334 90 60 "5" 0x01) + ElementLine(0 0 0 189 20) + ElementLine(0 189 409 189 20) + ElementLine(409 189 409 0 20) + ElementLine(409 0 0 0 20) + ElementLine(0 50 409 50 10) + ElementLine(129 0 129 50 10) + ElementLine(279 0 279 50 10) + Mark(70 249) + ) Index: 1.0.8/pcblib/tru-hole/TACT_6x6_4p =================================================================== --- 1.0.8/pcblib/tru-hole/TACT_6x6_4p (nonexistent) +++ 1.0.8/pcblib/tru-hole/TACT_6x6_4p (revision 1136) @@ -0,0 +1,37 @@ +##from:repo.hu/projects/openhw +##geo:180 +##for:switch +##for:button + +Element["" "" "" "" 175500 115500 0 0 0 100 ""] +( + Pin[13091 9000 9000 5000 9600 3937 "" "4" "edge2,intconn(2)"] + Pin[-12500 9000 9000 5000 9600 3937 "" "3" "edge2,intconn(2)"] + Pin[13091 -9000 9000 5000 9600 3937 "" "2" "edge2,intconn(1)"] + Pin[-12500 -9000 9000 5000 9600 3937 "" "1" "edge2,intconn(1)"] + ElementLine [12181 11736 12181 -11886 787] + ElementLine [-11441 11736 12181 11736 787] + ElementLine [-11441 -11886 -11441 11736 787] + ElementLine [-11441 -11886 12181 -11886 787] + ElementArc [7815 -8031 2756 2756 90 90 787] + ElementArc [7815 -8031 2756 2756 0 90 787] + ElementArc [7815 -8031 2756 2756 270 90 787] + ElementArc [7815 -8031 2756 2756 180 90 787] + ElementArc [7815 7717 2756 2756 0 90 787] + ElementArc [7815 7717 2756 2756 270 90 787] + ElementArc [7815 7717 2756 2756 180 90 787] + ElementArc [7815 7717 2756 2756 90 90 787] + ElementArc [-7933 7717 2756 2756 270 90 787] + ElementArc [-7933 7717 2756 2756 180 90 787] + ElementArc [-7933 7717 2756 2756 90 90 787] + ElementArc [-7933 7717 2756 2756 0 90 787] + ElementArc [-7933 -8031 2756 2756 180 90 787] + ElementArc [-7933 -8031 2756 2756 90 90 787] + ElementArc [-7933 -8031 2756 2756 0 90 787] + ElementArc [-7933 -8031 2756 2756 270 90 787] + ElementArc [-59 -157 6693 6693 270 90 787] + ElementArc [-59 -157 6693 6693 180 90 787] + ElementArc [-59 -157 6693 6693 90 90 787] + ElementArc [-59 -157 6693 6693 0 90 787] + + ) Index: 1.0.8/pcblib/tru-hole/TO126.fp =================================================================== --- 1.0.8/pcblib/tru-hole/TO126.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/TO126.fp (revision 1136) @@ -0,0 +1,35 @@ +##from:pcb +##for:transistor +##for:linear +##for:stabilizer +##geo:laying + Element(0x00 "Transistor" "" "TO126" 80 480 1 100 0x00) +( +# From the JEDEC drawing, the pins are rectangular with dimensions +# 25-35 mil X 15-25 mil +# +# This gives a diagonal dimension of 29.2 to 43.0 mils. +# Pin pitch is 80 to 100 mils. +# +# For a minimum clearance of 10 mils (probably not unreasonable if +# you are doing a design with leaded parts, this gives a max pad size +# of 80 mils. A 52 mil drill will give 14 mil annular ring which should +# be plenty. +# +# The mounting hole is 100 to 130 mils diameter + Pin(110 600 80 52 "1" 0x101) + Pin(200 600 80 52 "2" 0x01) + Pin(290 600 80 52 "3" 0x01) + # Befestigungsbohrung + Pin(200 170 130 110 "4" 0x01) + # Anschlussdraehte + ElementLine(100 600 100 500 30) + ElementLine(200 600 200 500 30) + ElementLine(300 600 300 500 30) + # Gehaeuse + ElementLine( 50 500 350 500 20) + ElementLine(350 500 350 70 20) + ElementLine(350 70 50 70 20) + ElementLine( 50 70 50 500 20) + Mark(100 600) +) Index: 1.0.8/pcblib/tru-hole/TO126S.fp =================================================================== --- 1.0.8/pcblib/tru-hole/TO126S.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/TO126S.fp (revision 1136) @@ -0,0 +1,23 @@ +##from:pcb +##for:transistor +##for:linear +##for:stabilizer +##geo:standing + Element(0x00 "Transistor" "" "TO126S" 80 480 1 100 0x00) +( + Pin(110 600 80 52 "1" 0x101) + Pin(200 700 80 52 "2" 0x01) + Pin(290 600 80 52 "3" 0x01) + # Befestigungsbohrung + Pin(200 170 130 110 "4" 0x01) + # Anschlussdraehte + ElementLine(100 600 100 500 30) + ElementLine(200 700 200 500 30) + ElementLine(300 600 300 500 30) + # Gehaeuse + ElementLine( 50 500 350 500 20) + ElementLine(350 500 350 70 20) + ElementLine(350 70 50 70 20) + ElementLine( 50 70 50 500 20) + Mark(100 600) +) Index: 1.0.8/pcblib/tru-hole/TO126SW.fp =================================================================== --- 1.0.8/pcblib/tru-hole/TO126SW.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/TO126SW.fp (revision 1136) @@ -0,0 +1,21 @@ +##from:pcb +##for:transistor +##for:linear +##for:stabilizer +##geo:standing + Element(0x00 "Transistor" "" "TO126SW" 270 170 0 100 0x00) +( + Pin(110 100 80 52 "1" 0x101) + Pin(200 200 80 52 "2" 0x01) + Pin(290 100 80 52 "3" 0x01) + # Gehaeuse + ElementLine(200 200 200 150 30) + ElementLine( 50 50 350 50 20) + ElementLine(350 50 350 150 20) + ElementLine(350 150 50 150 20) + ElementLine( 50 150 50 50 20) + # Bohrung + ElementLine(150 50 150 150 10) + ElementLine(250 50 250 150 10) + Mark(100 100) +) Index: 1.0.8/pcblib/tru-hole/TO126W.fp =================================================================== --- 1.0.8/pcblib/tru-hole/TO126W.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/TO126W.fp (revision 1136) @@ -0,0 +1,16 @@ +##from:pcb +##for:transistor +##for:linear +##for:stabilizer +##geo:standing + Element(0x00 "Transistor" "" "TO126W" 60 170 0 100 0x00) +( + Pin(110 100 80 52 "1" 0x101) + Pin(200 100 80 52 "2" 0x01) + Pin(290 100 80 52 "3" 0x01) + ElementLine(50 50 350 50 20) + ElementLine(350 50 350 150 20) + ElementLine(350 150 50 150 20) + ElementLine(50 150 50 50 20) + Mark(100 100) +) Index: 1.0.8/pcblib/tru-hole/TO18.fp =================================================================== --- 1.0.8/pcblib/tru-hole/TO18.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/TO18.fp (revision 1136) @@ -0,0 +1,36 @@ +##from:pcb +##for:transistor +##for:linear +##for:stabilizer + Element["" "Transistor" "" "TO18" 10300 11100 6000 7000 0 100 ""] +( +# The JEDEC drawing shows a pin diameter of 16-21 mils +# +# +# ___x_ +# / \ +# TO18: |3 1| <-- bottom view (supposed to be a circle) +# \ 2 / +# --- +# +# NOTE: some vendors, ST for example, number the pins +# differently. Here we follow the JEDEC drawing. +# +# the pins are arranged along a 100 mil diameter +# circle. The can outline is 178 to 195 mils +# for the top of the can and 209 to 230 mils +# for the bottom edge of the can +# + Pin[0 -5000 5500 3000 6100 3500 "1" "1" ""] + Pin[-5000 0 5500 3000 6100 3500 "2" "2" ""] + Pin[0 5000 5500 3000 6100 3500 "3" "3" ""] +# x, y, width, height, start angle, delta angle, thickness + ElementArc [0 0 9800 9800 0 360 1000] +# tab is 28 to 48 mils long, 36 to 46 wide +# and comes off at an angle of 45 deg clockwise from +# pin 1 when looking at the top of the board + ElementLine [6700 -7900 9400 -10600 1000] + ElementLine [7300 -7300 10000 -10000 1000] + ElementLine [7900 -6700 10600 -9400 1000] + ElementLine [9400 -10600 10600 -9400 1000] +) Index: 1.0.8/pcblib/tru-hole/TO218.fp =================================================================== --- 1.0.8/pcblib/tru-hole/TO218.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/TO218.fp (revision 1136) @@ -0,0 +1,17 @@ +##from:pcb +##for:diode +##geo:standing +Element(0x00 "diode in TO220" "" "TO218" 675 50 3 100 0x00) +( + Pin(88 120 100 60 "1" 0x101) + Pin(307 120 100 60 "2" 0x01) + Pin(526 120 100 60 "3" 0x01) + ElementLine(0 0 0 200 20) + ElementLine(0 200 615 200 20) + ElementLine(615 200 615 0 20) + ElementLine(615 0 0 0 20) + ElementLine(0 50 615 50 10) + ElementLine(232 0 232 50 10) + ElementLine(382 0 382 50 10) + Mark(88 260) + ) Index: 1.0.8/pcblib/tru-hole/TO220.fp =================================================================== --- 1.0.8/pcblib/tru-hole/TO220.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/TO220.fp (revision 1136) @@ -0,0 +1,47 @@ +##from:pcb +##for:transistor +##for:linear +##for:stabilizer +##geo:laying +##ref:http://www.zetex.com/3.0/pdf/TO220.pdf + Element(0x00 "Transistor" "" "TO220" 50 570 1 100 0x00) +( +# I have been unable to locate the JEDEC drawing. However, refering +# to http://www.zetex.com/3.0/pdf/TO220.pdf which claims to be JEDEC +# compliant, I see that the pins are rectangular with dimensions: +# +# 15-40 mils X 16-20 mils which gives a diagonal of +# 21.9 to 44.7 mils +# +# The pin pitch is 90 to 110 mils. +# +# The mounting hole is 139 to 160 mils diameter + Pin(100 800 90 60 "1" 0x101) + Pin(200 800 90 60 "2" 0x01) + Pin(300 800 90 60 "3" 0x01) + # Befestigungsbohrung + Pin(200 130 150 130 "4" 0x01) + # Anschlussdraehte + ElementLine(100 800 100 620 30) + ElementLine(200 800 200 620 30) + ElementLine(300 800 300 620 30) + # Gehaeuse + ElementLine( 0 620 400 620 20) + ElementLine(400 620 400 245 20) + ElementLine(400 245 0 245 20) + ElementLine( 0 245 0 620 20) + # Kuehlfahne mit Kerben + ElementLine( 0 245 400 245 20) + ElementLine(400 245 400 120 20) + ElementLine(400 120 385 120 20) + ElementLine(385 120 385 50 20) + ElementLine(385 50 400 50 20) + ElementLine(400 50 400 10 20) + ElementLine(400 10 0 10 20) + ElementLine( 0 10 0 50 20) + ElementLine( 0 50 15 50 20) + ElementLine( 15 50 15 120 20) + ElementLine( 15 120 0 120 20) + ElementLine( 0 120 0 245 20) + Mark(200 800) +) Index: 1.0.8/pcblib/tru-hole/TO220ACSTAND.fp =================================================================== --- 1.0.8/pcblib/tru-hole/TO220ACSTAND.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/TO220ACSTAND.fp (revision 1136) @@ -0,0 +1,16 @@ +##from:pcb +##for:diode +##geo:standing +Element(0x00 "diode in TO220" "" "TO220ACSTAND" 460 50 3 100 0x00) +( + Pin(100 100 80 40 "1" 0x101) + Pin(300 100 80 40 "2" 0x01) + ElementLine(0 0 0 180 20) + ElementLine(0 180 400 180 20) + ElementLine(400 180 400 0 20) + ElementLine(400 0 0 0 20) + ElementLine(0 50 400 50 10) + ElementLine(125 0 125 50 10) + ElementLine(275 0 275 50 10) + Mark(100 220) + ) Index: 1.0.8/pcblib/tru-hole/TO220S.fp =================================================================== --- 1.0.8/pcblib/tru-hole/TO220S.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/TO220S.fp (revision 1136) @@ -0,0 +1,36 @@ +##from:pcb +##for:transistor +##for:linear +##for:stabilizer +##geo:stadning + Element(0x00 "Transistor" "" "TO220S" 50 570 1 100 0x00) +( + Pin(100 800 90 60 "1" 0x101) + Pin(200 900 90 60 "2" 0x01) + Pin(300 800 90 60 "3" 0x01) + # Befestigungsbohrung + Pin(200 130 150 130 "4" 0x01) + # Anschlussdraehte + ElementLine(100 800 100 620 30) + ElementLine(200 900 200 620 30) + ElementLine(300 800 300 620 30) + # Gehaeuse + ElementLine( 0 620 400 620 20) + ElementLine(400 620 400 245 20) + ElementLine(400 245 0 245 20) + ElementLine( 0 245 0 620 20) + # Kuehlfahne mit Kerben + ElementLine( 0 245 400 245 20) + ElementLine(400 245 400 120 20) + ElementLine(400 120 385 120 20) + ElementLine(385 120 385 50 20) + ElementLine(385 50 400 50 20) + ElementLine(400 50 400 10 20) + ElementLine(400 10 0 10 20) + ElementLine( 0 10 0 50 20) + ElementLine( 0 50 15 50 20) + ElementLine( 15 50 15 120 20) + ElementLine( 15 120 0 120 20) + ElementLine( 0 120 0 245 20) + Mark(200 800) +) Index: 1.0.8/pcblib/tru-hole/TO220SW.fp =================================================================== --- 1.0.8/pcblib/tru-hole/TO220SW.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/TO220SW.fp (revision 1136) @@ -0,0 +1,26 @@ +##from:pcb +##for:transistor +##for:linear +##for:stabilizer +##geo:standing + Element(0x00 "Transistor" "" "TO220SW" 0 10 0 100 0x00) +( + Pin(100 200 90 60 "1" 0x101) + Pin(200 300 90 60 "2" 0x01) + Pin(300 200 90 60 "3" 0x01) + # Gehaeuse + ElementLine( 0 80 400 80 20) + ElementLine(400 80 400 260 20) + ElementLine(400 260 0 260 20) + ElementLine( 0 260 0 80 20) + # Kuehlfahne icl. Bohrung + ElementLine( 0 80 400 80 20) + ElementLine(400 80 400 140 20) + ElementLine(400 140 0 140 20) + ElementLine( 0 140 0 80 20) + ElementLine(130 80 130 140 10) + ElementLine(270 80 270 140 10) + # Anschlussdraht + ElementLine(200 300 200 260 30) + Mark(100 200) +) Index: 1.0.8/pcblib/tru-hole/TO220W.fp =================================================================== --- 1.0.8/pcblib/tru-hole/TO220W.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/TO220W.fp (revision 1136) @@ -0,0 +1,23 @@ +##from:pcb +##for:transistor +##for:linear +##for:stabilizer +##geo:standing Element(0x00 "Transistor" "" "TO220W" 0 10 0 100 0x00) +( + Pin(100 200 90 60 "1" 0x101) + Pin(200 200 90 60 "2" 0x01) + Pin(300 200 90 60 "3" 0x01) + # Gehaeuse + ElementLine( 0 80 400 80 20) + ElementLine(400 80 400 260 20) + ElementLine(400 260 0 260 20) + ElementLine( 0 260 0 80 20) + # Kuehlfahne icl. Bohrung + ElementLine( 0 80 400 80 20) + ElementLine(400 80 400 140 20) + ElementLine(400 140 0 140 20) + ElementLine( 0 140 0 80 20) + ElementLine(130 80 130 140 10) + ElementLine(270 80 270 140 10) + Mark(100 200) +) Index: 1.0.8/pcblib/tru-hole/TO247.fp =================================================================== --- 1.0.8/pcblib/tru-hole/TO247.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/TO247.fp (revision 1136) @@ -0,0 +1,19 @@ +##from:pcb +##for:transistor +##for:linear +##for:stabilizer +##geo:standing +Element(0x00 "diode in TO220" "" "TO247" 690 50 3 100 0x00) +( + Pin(96 130 100 60 "1" 0x101) + Pin(315 130 100 60 "2" 0x01) + Pin(534 130 100 60 "3" 0x01) + ElementLine(0 0 0 210 20) + ElementLine(0 210 630 210 20) + ElementLine(630 210 630 0 20) + ElementLine(630 0 0 0 20) + ElementLine(0 50 630 50 10) + ElementLine(240 0 240 50 10) + ElementLine(390 0 390 50 10) + Mark(96 270) + ) Index: 1.0.8/pcblib/tru-hole/TO247_2.fp =================================================================== --- 1.0.8/pcblib/tru-hole/TO247_2.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/TO247_2.fp (revision 1136) @@ -0,0 +1,17 @@ +##from:pcb +##for:diode +##geo:standing + +Element(0x00 "diode in TO220" "" "TO247_2" 690 50 3 100 0x00) +( + Pin(96 130 100 60 "1" 0x101) + Pin(534 130 100 60 "2" 0x01) + ElementLine(0 0 0 210 20) + ElementLine(0 210 630 210 20) + ElementLine(630 210 630 0 20) + ElementLine(630 0 0 0 20) + ElementLine(0 50 630 50 10) + ElementLine(240 0 240 50 10) + ElementLine(390 0 390 50 10) + Mark(96 270) + ) Index: 1.0.8/pcblib/tru-hole/TO251.fp =================================================================== --- 1.0.8/pcblib/tru-hole/TO251.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/TO251.fp (revision 1136) @@ -0,0 +1,20 @@ +##from:pcb +##for:transistor +##for:linear +##for:stabilizer +##geo:standing + +Element(0x00 "diode in TO220" "" "TO251" 325 50 3 100 0x00) +( + Pin(42 50 70 40 "1" 0x101) + Pin(132 50 70 40 "2" 0x01) + Pin(222 50 70 40 "3" 0x01) + ElementLine(0 0 0 100 20) + ElementLine(0 100 265 100 20) + ElementLine(265 100 265 0 20) + ElementLine(265 0 0 0 20) + ElementLine(0 50 265 50 10) + ElementLine(57 0 57 50 10) + ElementLine(207 0 207 50 10) + Mark(42 140) + ) Index: 1.0.8/pcblib/tru-hole/TO264.fp =================================================================== --- 1.0.8/pcblib/tru-hole/TO264.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/TO264.fp (revision 1136) @@ -0,0 +1,18 @@ +##from:pcb +##for:diode +##geo:standing + +Element(0x00 "diode in TO220" "" "TO264" 860 50 3 100 0x00) +( + Pin(181 130 100 60 "1" 0x101) + Pin(400 130 100 60 "2" 0x01) + Pin(619 130 100 60 "3" 0x01) + ElementLine(0 0 0 210 20) + ElementLine(0 210 800 210 20) + ElementLine(800 210 800 0 20) + ElementLine(800 0 0 0 20) + ElementLine(0 50 800 50 10) + ElementLine(325 0 325 50 10) + ElementLine(475 0 475 50 10) + Mark(181 270) + ) Index: 1.0.8/pcblib/tru-hole/TO39.fp =================================================================== --- 1.0.8/pcblib/tru-hole/TO39.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/TO39.fp (revision 1136) @@ -0,0 +1,37 @@ +##from:pcb +##for:transistor +##for:linear +##for:stabilizer + + Element["" "Transistor" "" "TO39" 18800 18800 6000 7000 0 100 ""] +( +# The JEDEC drawing shows a pin diameter of 16-21 mils +# +# +# ___x_ +# / \ +# TO39: |3 1| <-- bottom view (supposed to be a circle) +# \ 2 / +# --- +# +# NOTE: some vendors, ST for example, number the pins +# differently. Here we follow the JEDEC drawing. +# +# the pins are arranged along a 200 mil diameter +# circle. The can outline is 315 to 335 mils (320 nom) +# for the top of the can and 350 to 370 mils (360 nom) +# for the bottom edge of thecan +# + Pin[0 -10000 5500 3000 6100 3500 "1" "1" "square"] + Pin[-10000 0 5500 3000 6100 3500 "2" "2" ""] + Pin[0 10000 5500 3000 6100 3500 "3" "3" ""] +# tab is 29 to 40 mils long, 28 to 34 wide +# and comes off at an angle of 45 deg clockwise from +# pin 1 when looking at the top of the board + ElementLine [12700 -13900 14800 -16000 1000] + ElementLine [13300 -13300 15400 -15400 1000] + ElementLine [13900 -12700 16000 -14800 1000] + ElementLine [16000 -14800 14800 -16000 1000] +# x, y, width, height, start angle, delta angle, thickness + ElementArc [0 0 18300 18300 0 360 1000] + ) Index: 1.0.8/pcblib/tru-hole/TO92.fp =================================================================== --- 1.0.8/pcblib/tru-hole/TO92.fp (nonexistent) +++ 1.0.8/pcblib/tru-hole/TO92.fp (revision 1136) @@ -0,0 +1,23 @@ +##from:pcb +##for:transistor +##for:linear +##for:stabilizer +##geo:standing + + Element(0x00 "Transistor" "" "TO92" 60 70 0 100 0x00) +( +# The JEDEC drawing shows a pin diameter of 16-21 mils +# +# +# _______ +# TO92: | 1 2 3 | <-- bottom view +# \_____/ +# +# The pin to pin spacing is 100 mils. + Pin(250 200 72 42 "1" 0x101) + Pin(150 200 72 42 "2" 0x01) + Pin(50 200 72 42 "3" 0x01) + ElementArc(150 200 100 100 315 270 10) + ElementLine( 80 130 220 130 10) + Mark(50 200) +) Index: 1.0.8/scconfig/Makefile =================================================================== --- 1.0.8/scconfig/Makefile (nonexistent) +++ 1.0.8/scconfig/Makefile (revision 1136) @@ -0,0 +1,78 @@ +# --- configuration part -- + +# - generic configuration - +# what cflags to use to compile scconfig +USER_CFLAGS = -Wall -g -DGENCALL -Isrc + +# what ldflags to use to link scconfig +USER_LDFLAGS = + +# in case hooks.c needs to link to something local +USER_OBJS = src/util/arg_auto_set.o + +# what to build - a ./configure +all: configure + +# This line imports scconfig core and default tests +include src/default/Makefile.plugin + +# +# - PLUGINS - +# +# Comment this line if you are not interested in c99 features +include src/c99/Makefile.plugin + +# Comment this line if you do not need script libs to be detected +include src/scripts/Makefile.plugin + +# Comment this line if you do not need parser libs to be detected +# include src/parser/Makefile.plugin + +# Comment this line if you do not need to detect parser generators +include src/parsgen/Makefile.plugin + +# Comment this line if you do not need math related libs +include src/math/Makefile.plugin + +# Comment this line if you do not need socket/networking +# include src/socket/Makefile.plugin + +# Comment this line if you do not need user/password API detection +# include src/userpass/Makefile.plugin + +# Comment this line if you do not need gui (X11, toolkits) +include src/gui/Makefile.plugin + +# Comment this line if you do not need software utility libs (glib) +include src/sul/Makefile.plugin + +# Uncomment this line if you need menus +include src/menulib/Makefile.plugin + +# Comment this line if you do not need generator (templating) +#include src/generator/Makefile.plugin + +# Comment this line if you do not need tmpasm (templating); conflicts with generator +include src/tmpasm/Makefile.plugin + +# --- you shouldn't edit the lines below --- +OBJS = $(USER_OBJS) hooks.o $(DEFAULT_NOMAIN_OBJS) $(SCRIPT_OBJS) $(PARSER_OBJS) $(GENERATOR_OBJS) $(TMPASM_OBJS) $(C99_OBJS) $(PARSGEN_OBJS) $(MATH_OBJS) $(SOCKET_OBJS) $(USERPASS_OBJS) $(GUI_OBJS) $(SUL_OBJS) +CFLAGS = $(USER_CFLAGS) $(DEFAULT_CFLAGS) $(SCRIPT_CFLAGS) $(PARSER_CFLAGS) $(GENERATOR_CFLAGS) $(TMPASM_CFLAGS) $(C99_CFLAGS) $(PARSGEN_CFLAGS) $(MATH_CFLAGS) $(SOCKET_CFLAGS) $(USERPASS_CFLAGS) $(GUI_CFLAGS) $(SUL_CFLAGS) $(MENULIB_CFLAGS) -Isrc/default +LDFLAGS = $(USER_LDFLAGS) $(DEFAULT_LDFLAGS) $(SCRIPT_LDFLAGS) $(PARSER_LDFLAGS) $(GENERATOR_LDFLAGS) $(TMPASM_LDFLAGS) $(C99_LDFLAGS) $(PARSGEN_LDFLAGS) $(MATH_LDFLAGS) $(SOCKET_LDFLAGS) $(USERPASS_LDFLAGS) $(GUI_LDFLAGS) $(SUL_LDFLAGS) $(MENULIB_LDFLAGS) + + +configure: $(OBJS) $(DEFAULT_MAIN_OBJS) + $(CC) -o configure $(OBJS) $(DEFAULT_MAIN_OBJS) + +menuconfig: menucfg + ./menucfg + +menucfg: $(OBJS) $(MENULIB_OBJS) src/default/main_lib.o src/default/main_custom_args.o menucfg.o src/util/arg_auto_menu.o + $(CC) -o menucfg $(OBJS) $(MENULIB_OBJS) menucfg.o src/default/main_lib.o src/default/main_custom_args.o src/util/arg_auto_menu.o + +menucfg.o: menucfg.c + $(CC) -c $(CFLAGS) -o menucfg.o menucfg.c + +clean: + rm $(OBJS) configure + Index: 1.0.8/scconfig/Makefile.comp.inc =================================================================== --- 1.0.8/scconfig/Makefile.comp.inc (nonexistent) +++ 1.0.8/scconfig/Makefile.comp.inc (revision 1136) @@ -0,0 +1,16 @@ +# Generate Makefile code to compile .c -> .o +# Arguments: +# /local/comp/OBJS list of .o files (assuming each have at least a .c) + +print { +### explicit rules for .c -> .o ### +} + +foreach /local/o in /local/comp/OBJS +put /local/c /local/o +sub /local/c {.o$} {.c} +print [@ +@/local/o@: @/local/c@ + $(CC) -c $(CFLAGS) -o @/local/o@ $< +@] +end Index: 1.0.8/scconfig/Makefile.dep.inc =================================================================== --- 1.0.8/scconfig/Makefile.dep.inc (nonexistent) +++ 1.0.8/scconfig/Makefile.dep.inc (revision 1136) @@ -0,0 +1,32 @@ +# Generate Makefile code that can generate Makefile.dep +# Arguments: +# /local/dep/CFLAGS CFLAGS used for compiling +# /local/dep/SRCS list of c soures + +print [@ + +### generate dependencies (requires gcc) ### +FORCE: + +include Makefile.dep + +dep: FORCE + echo "### Generated file, do not edit, run make dep ###" > Makefile.dep + echo "" >> Makefile.dep +@] + +gsub /local/dep/CFLAGS {-I} {-isystem } +gsub /local/dep/CFLAGS {-isystem [.][.]} {-I ..} +gsub /local/dep/CFLAGS {-isystem [.]} {-I .} +foreach /local/c in /local/dep/SRCS + switch /local/c + case {/src_plugins/} end + case {$(PLUGDIR)} + put /local/o /local/c + sub {/local/o} {.c$} {.o} + print [@ gcc -MT @/local/o@ -MM @/local/c@ @/local/dep/CFLAGS@ @/local/pcb/DEPCFLAGS@ >> Makefile.dep +@]; end + default print [@ gcc -MM @/local/c@ @/local/dep/CFLAGS@ >> Makefile.dep +@]; end + end +end Index: 1.0.8/scconfig/README =================================================================== --- 1.0.8/scconfig/README (nonexistent) +++ 1.0.8/scconfig/README (revision 1136) @@ -0,0 +1,3 @@ +The configuration system that runs ./configure. + +The engine is scconfig. Index: 1.0.8/scconfig/hooks.c =================================================================== --- 1.0.8/scconfig/hooks.c (nonexistent) +++ 1.0.8/scconfig/hooks.c (revision 1136) @@ -0,0 +1,445 @@ +#include +#include +#include "arg.h" +#include "log.h" +#include "dep.h" +#include "libs.h" +#include "db.h" +#include "tmpasm.h" +#include "tmpasm_scconfig.h" +#include "util/arg_auto_set.h" + +#define version "1.0.8" + +const char *gui_list[] = { + "GTK", "libs/gui/gtk2/presents", + "lesstif", "libs/gui/lesstif2/presents", + NULL, NULL +}; + +const char *exporter_list[] = { + "png", "libs/gui/gd/gdImagePng/presents", + "gif", "libs/gui/gd/gdImageGif/presents", + "jpg", "libs/gui/gd/gdImageJpeg/presents", + "gcode", "libs/gui/gd/presents", + "nelma", "libs/gui/gd/presents", + NULL, NULL +}; + +const arg_auto_set_t disable_libs[] = { /* list of --disable-LIBs and the subtree they affect */ + {"disable-gtk", "libs/gui/gtk2", arg_lib_nodes, "$do not compile the gtk HID"}, + {"disable-lesstif", "libs/gui/lesstif2", arg_lib_nodes, "$do not compile the lesstif HID"}, + {"disable-xrender", "libs/gui/xrender", arg_lib_nodes, "$do not use xrender for lesstif"}, + {"disable-xinerama", "libs/gui/xinerama", arg_lib_nodes, "$do not use xinerama for lesstif"}, + {"disable-gd", "libs/gui/gd", arg_lib_nodes, "$do not use gd (many exporters need it)"}, + {"disable-gd-gif", "libs/gui/gd/gdImageGif", arg_lib_nodes, "$no gif support in the png exporter"}, + {"disable-gd-png", "libs/gui/gd/gdImagePng", arg_lib_nodes, "$no png support in the png exporter"}, + {"disable-gd-jpg", "libs/gui/gd/gdImageJpeg", arg_lib_nodes, "$no jpeg support in the png exporter"}, + {"disable-gpmi", "libs/script/gpmi", arg_lib_nodes, "$do not compile the gpmi (scripting) plugin"}, + + {"buildin-gpmi", "/local/pcb/gpmi/buildin", arg_true, "$static link the gpmi plugin into the executable"}, + {"plugin-gpmi", "/local/pcb/gpmi/buildin", arg_false, "$the gpmi plugin is dynamic loadable"}, + + {"disable-autoroute", "/local/pcb/autoroute/enable", arg_false, "$do not compile the autorouter"}, + {"buildin-autoroute", "/local/pcb/autoroute/buildin", arg_true, "$static link the autorouter plugin into the executable"}, + {"plugin-autoroute", "/local/pcb/autoroute/buildin", arg_false, "$the autorouter plugin is dynamic loadable"}, + + {"disable-autoplace", "/local/pcb/autoplace/enable", arg_false, "$do not compile the autoplace"}, + {"buildin-autoplace", "/local/pcb/autoplace/buildin", arg_true, "$static link the autoplace plugin into the executable"}, + {"plugin-autoplace", "/local/pcb/autoplace/buildin", arg_false, "$the autoplace plugin is dynamic loadable"}, + + {"disable-vendordrill", "/local/pcb/vendordrill/enable", arg_false, "$do not compile the vendor drill mapping"}, + {"buildin-vendordrill", "/local/pcb/vendordrill/buildin", arg_true, "$static link the vendor drill mapping plugin into the executable"}, + {"plugin-vendordrill", "/local/pcb/vendordrill/buildin", arg_false, "$the vendor drill mapping plugin is dynamic loadable"}, + + {"disable-puller", "/local/pcb/puller/enable", arg_false, "$do not compile the puller"}, + {"buildin-puller", "/local/pcb/puller/buildin", arg_true, "$static link the puller plugin into the executable"}, + {"plugin-puller", "/local/pcb/puller/buildin", arg_false, "$the puller plugin is dynamic loadable"}, + + {"disable-edif", "/local/pcb/edif/enable", arg_false, "$do not compile the edif"}, + {"buildin-edif", "/local/pcb/edif/buildin", arg_true, "$static link the edif plugin into the executable"}, + {"plugin-edif", "/local/pcb/edif/buildin", arg_false, "$the edif plugin is dynamic loadable"}, + + {"disable-djopt", "/local/pcb/djopt/enable", arg_false, "$do not compile the djopt"}, + {"buildin-djopt", "/local/pcb/djopt/buildin", arg_true, "$static link the djopt plugin into the executable"}, + {"plugin-djopt", "/local/pcb/djopt/buildin", arg_false, "$the djopt plugin is dynamic loadable"}, + + {"disable-mincut", "/local/pcb/mincut/enable", arg_false, "$do not compile the mincut"}, + {"buildin-mincut", "/local/pcb/mincut/buildin", arg_true, "$static link the mincut plugin into the executable"}, + {"plugin-mincut", "/local/pcb/mincut/buildin", arg_false, "$the mincut plugin is dynamic loadable"}, + + {"disable-toporouter", "/local/pcb/toporouter/enable", arg_false, "$do not compile the toporouter"}, + {"buildin-toporouter", "/local/pcb/toporouter/buildin", arg_true, "$static link the toporouter plugin into the executable"}, + {"plugin-toporouter", "/local/pcb/toporouter/buildin", arg_false, "$the toporouter plugin is dynamic loadable"}, + + {"disable-oldactions", "/local/pcb/oldactions/enable", arg_false, "$do not compile the oldactions"}, + {"buildin-oldactions", "/local/pcb/oldactions/buildin", arg_true, "$static link the oldactions plugin into the executable"}, + {"plugin-oldactions", "/local/pcb/oldactions/buildin", arg_false, "$the oldactions plugin is dynamic loadable"}, + + {"disable-renumber", "/local/pcb/renumber/enable", arg_false, "$do not compile the renumber action"}, + {"buildin-renumber", "/local/pcb/renumber/buildin", arg_true, "$static link the renumber action into the executable"}, + {"plugin-renumber", "/local/pcb/renumber/buildin", arg_false, "$the renumber action is dynamic loadable plugin"}, + + {"disable-stroke", "/local/pcb/stroke/enable", arg_false, "$do not compile libstroke gestures"}, + {"buildin-stroke", "/local/pcb/stroke/buildin", arg_true, "$static link libstroke gestures into the executable"}, + {"plugin-stroke", "/local/pcb/stroke/buildin", arg_false, "$libstroke gestures is dynamic loadable plugin"}, + + {"disable-import_sch", "/local/pcb/import_sch/enable", arg_false, "$do not compile the import schematics action"}, + {"buildin-import_sch", "/local/pcb/import_sch/buildin", arg_true, "$static link the import schematics action into the executable"}, + {"plugin-import_sch", "/local/pcb/import_sch/buildin", arg_false, "$the import schematics action is dynamic loadable plugin"}, + + {NULL, NULL, NULL, NULL} +}; + + +static void help1(void) +{ + printf("./configure: configure pcn-rnd.\n"); + printf("\n"); + printf("Usage: ./configure [options]\n"); + printf("\n"); + printf("options are:\n"); + printf(" --prefix=path change installation prefix from /usr to path\n"); +} + +static void help2(void) +{ + printf("\n"); + printf("The --disable options will make ./configure to skip detection of the "); + printf("given feature and mark them \"not found\"."); + printf("\n"); +} + +/* Runs when a custom command line argument is found + returns true if no furhter argument processing should be done */ +int hook_custom_arg(const char *key, const char *value) +{ + if (strcmp(key, "prefix") == 0) { + report("Setting prefix to '%s'\n", value); + put("/local/prefix", strclone(value)); + return 1; + } + else if (strcmp(key, "help") == 0) { + help1(); + arg_auto_print_options(stdout, " ", " ", disable_libs); + help2(); + exit(0); + } + + return arg_auto_set(key, value, disable_libs); +} + + +/* Runs before anything else */ +int hook_preinit() +{ + return 0; +} + +/* Runs after initialization */ +int hook_postinit() +{ + db_mkdir("/local"); + db_mkdir("/local/pcb"); + + /* DEFAULTS */ + db_mkdir("/local/pcb/gpmi"); + put("/local/pcb/gpmi/buildin", strue); + put("/local/prefix", "/usr/local"); + + + db_mkdir("/local/pcb/autoroute"); + put("/local/pcb/autoroute/enable", strue); + put("/local/pcb/autoroute/buildin", strue); + + db_mkdir("/local/pcb/autoplace"); + put("/local/pcb/autoplace/enable", strue); + put("/local/pcb/autoplace/buildin", strue); + + db_mkdir("/local/pcb/vendordrill"); + put("/local/pcb/vendordrill/enable", strue); + put("/local/pcb/vendordrill/buildin", strue); + + db_mkdir("/local/pcb/puller"); + put("/local/pcb/puller/enable", strue); + put("/local/pcb/puller/buildin", strue); + + db_mkdir("/local/pcb/edif"); + put("/local/pcb/edif/enable", strue); + put("/local/pcb/edif/buildin", strue); + + db_mkdir("/local/pcb/djopt"); + put("/local/pcb/djopt/enable", strue); + put("/local/pcb/djopt/buildin", strue); + + db_mkdir("/local/pcb/mincut"); + put("/local/pcb/mincut/enable", strue); + put("/local/pcb/mincut/buildin", strue); + + db_mkdir("/local/pcb/toporouter"); + put("/local/pcb/toporouter/enable", strue); + put("/local/pcb/toporouter/buildin", strue); + + db_mkdir("/local/pcb/oldactions"); + put("/local/pcb/oldactions/enable", strue); + put("/local/pcb/oldactions/buildin", strue); + + db_mkdir("/local/pcb/renumber"); + put("/local/pcb/renumber/enable", strue); + put("/local/pcb/renumber/buildin", strue); + + db_mkdir("/local/pcb/stroke"); + put("/local/pcb/stroke/enable", sfalse); + put("/local/pcb/stroke/buildin", strue); + + db_mkdir("/local/pcb/import_sch"); + put("/local/pcb/import_sch/enable", strue); + put("/local/pcb/import_sch/buildin", strue); + + return 0; +} + +/* Runs after all arguments are read and parsed */ +int hook_postarg() +{ + return 0; +} + +/* Runs when things should be detected for the host system */ +int hook_detect_host() +{ + return 0; +} + +/* Runs when things should be detected for the target system */ +int hook_detect_target() +{ + + require("cc/fpic", 0, 1); + require("fstools/mkdir", 0, 1); + require("libs/gui/gtk2/presents", 0, 0); + require("libs/gui/lesstif2/presents", 0, 0); + + if (istrue(get("libs/gui/lesstif2/presents"))) { + require("libs/gui/xinerama/presents", 0, 0); + require("libs/gui/xrender/presents", 0, 0); + } + else { + report("Since there's no lesstif2, disabling xinerama and xrender...\n"); + hook_custom_arg("disable-xinerama", NULL); + hook_custom_arg("disable-xrender", NULL); + } + + /* for the exporters */ + require("libs/gui/gd/presents", 0, 0); + + if (!istrue(get("libs/gui/gd/presents"))) { + report("Since there's no libgd, disabling raster output formats...\n"); + hook_custom_arg("disable-gd-gif", NULL); + hook_custom_arg("disable-gd-png", NULL); + hook_custom_arg("disable-gd-jpg", NULL); + } + + + /* for core, the toporouter and gsch2pcb: */ + require("libs/sul/glib", 0, 1); + + /* generic utils for Makefiles */ + require("fstools/rm", 0, 1); + require("fstools/ar", 0, 1); + require("fstools/cp", 0, 1); + require("fstools/ln", 0, 1); + require("fstools/mkdir", 0, 1); + require("sys/ext_exe", 0, 1); + require("sys/sysid", 0, 1); + + /* options for config.h */ + require("sys/path_sep", 0, 1); + require("cc/alloca/presents", 0, 0); + require("cc/rdynamic", 0, 0); + require("libs/env/putenv/presents", 0, 0); + require("libs/env/setenv/presents", 0, 0); + require("libs/snprintf", 0, 0); + require("libs/vsnprintf", 0, 0); + require("libs/fs/getcwd", 0, 0); + require("libs/math/expf", 0, 0); + require("libs/math/logf", 0, 0); + require("libs/script/m4/bin/*", 0, 0); + require("libs/gui/gd/gdImagePng/presents", 0, 0); + require("libs/gui/gd/gdImageGif/presents", 0, 0); + require("libs/gui/gd/gdImageJpeg/presents", 0, 0); + require("libs/fs/stat/macros/*", 0, 0); + + require("libs/script/gpmi/presents", 0, 0); + + + if (get("cc/rdynamic") == NULL) + put("cc/rdynamic", ""); + + + { + char *tmp, *fpic, *debug; + fpic = get("/target/cc/fpic"); + if (fpic == NULL) fpic = ""; + debug = get("/arg/debug"); + if (debug == NULL) debug = ""; + tmp = str_concat(" ", fpic, debug, NULL); + put("/local/global_cflags", tmp); + } + + return 0; +} + +#ifdef GENCALL +/* If enabled, generator implements ###call *### and generator_callback is + the callback function that will be executed upon ###call### */ +void generator_callback(char *cmd, char *args) +{ + printf("* generator_callback: '%s' '%s'\n", cmd, args); +} +#endif + +static void list_presents(const char *prefix, const char *nodes[]) +{ + char **s; + printf("%s", prefix); + for(s = nodes; s[0] != NULL; s+=2) + if (node_istrue(s[1])) + printf(" %s", s[0]); + printf("\n"); +} + +static int gpmi_config(void) +{ + char *tmp; + const char *gcfg = get("libs/script/gpmi/gpmi-config"); + int generr = 0; + + printf("Generating pcb-gpmi/Makefile.conf (%d)\n", generr |= tmpasm("../src_plugins/gpmi/pcb-gpmi", "Makefile.config.in", "Makefile.config")); + + + printf("Configuring gpmi packages...\n"); + tmp = str_concat("", "cd ../src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg && ", gcfg, " --pkggrp && ./configure", NULL); + generr |= system(tmp); + free(tmp); + + printf("Configuring gpmi plugin \"app\"\n"); + tmp = str_concat("", "cd ../src_plugins/gpmi//pcb-gpmi/gpmi_plugin && ", gcfg, " --app", NULL); + generr |= system(tmp); + free(tmp); + + printf("Finished configuring gpmi packages\n"); + + return generr; +} + +static void plugin_stat(const char *header, const char *path_prefix) +{ + char path_en[256], path_bi[256]; + + sprintf(path_en, "%s/enable", path_prefix); + sprintf(path_bi, "%s/buildin", path_prefix); + + printf("%-32s", header); + if (node_istrue(path_en)) { + printf("yes "); + if (node_istrue(path_bi)) + printf("(buildin)\n"); + else + printf("(plugin)\n"); + } + else + printf("no\n"); + + +} + +/* Runs after detection hooks, should generate the output (Makefiles, etc.) */ +int hook_generate() +{ + char *rev = "non-svn", *tmp; + int manual_config = 0, generr = 0; + + tmp = svn_info(0, "../src", "Revision:"); + if (tmp != NULL) { + rev = str_concat("", "svn r", tmp, NULL); + free(tmp); + } + put("/local/revision", rev); + put("/local/version", version); + + printf("Generating Makefile.conf (%d)\n", generr |= tmpasm("..", "Makefile.conf.in", "Makefile.conf")); + + printf("Generating gts/Makefile (%d)\n", generr |= tmpasm("../src_3rd/gts", "Makefile.in", "Makefile")); + printf("Generating pcb/Makefile (%d)\n", generr |= tmpasm("../src", "Makefile.in", "Makefile")); + + /* Has to be after pcb/Makefile so that all the modules are loaded. */ + printf("Generating pcb/hidlist (%d)\n", generr |= tmpasm("../src/hid/common", "hidlist.h.in", "hidlist.h")); + printf("Generating pcb/buildin (%d)\n", generr |= tmpasm("../src", "buildin.c.in", "buildin.c")); + + printf("Generating util/Makefile (%d)\n", generr |= tmpasm("../util", "Makefile.in", "Makefile")); + + printf("Generating config.auto.h (%d)\n", generr |= tmpasm("..", "config.auto.h.in", "config.auto.h")); + + if (node_istrue("libs/script/gpmi/presents")) + gpmi_config(); + + if (!exists("../config.manual.h")) { + printf("Generating config.manual.h (%d)\n", generr |= tmpasm("..", "config.manual.h.in", "config.manual.h")); + manual_config = 1; + } + + if (!generr) { + printf("\n\n"); + printf("=====================\n"); + printf("Configuration summary\n"); + printf("=====================\n\n"); + list_presents("GUI hids: batch", gui_list); + list_presents("Export hids: bom gerber lpr ps", exporter_list); + +/* special case because the "presents" node */ + printf("%-32s", "Scripting via GPMI: "); + if (node_istrue("libs/script/gpmi/presents")) { + printf("yes "); + if (node_istrue("/local/pcb/gpmi/buildin")) + printf("(buildin)\n"); + else + printf("(plugin)\n"); + } + else + printf("no\n"); + + plugin_stat("Autorouter: ", "/local/pcb/autoroute"); + plugin_stat("Toporouter: ", "/local/pcb/toporouter"); + plugin_stat("Autoplace: ", "/local/pcb/autoplace"); + plugin_stat("Vendor drill mapping: ", "/local/pcb/vendordrill"); + plugin_stat("Puller: ", "/local/pcb/puller"); + plugin_stat("Edif: ", "/local/pcb/edif"); + plugin_stat("djopt: ", "/local/pcb/djopt"); + plugin_stat("Mincut: ", "/local/pcb/mincut"); + plugin_stat("renumber:", "/local/pcb/renumber"); + plugin_stat("old actions:", "/local/pcb/oldactions"); + plugin_stat("import_sch:", "/local/pcb/import_sch"); + plugin_stat("stroke:", "/local/pcb/stroke"); + + + if (manual_config) + printf("\n\n * NOTE: you may want to edit config.manual.h (user preferences) *\n"); + } + else + fprintf(stderr, "Error generating some of the files\n"); + + + return 0; +} + +/* Runs before everything is uninitialized */ +void hook_preuninit() +{ +} + +/* Runs at the very end, when everything is already uninitialized */ +void hook_postuninit() +{ +} + Index: 1.0.8/scconfig/menucfg.c =================================================================== --- 1.0.8/scconfig/menucfg.c (nonexistent) +++ 1.0.8/scconfig/menucfg.c (revision 1136) @@ -0,0 +1,71 @@ +#include +#include +#include "default/hooks.h" +#include "default/libs.h" +#include "default/main_custom_args.h" +#include "default/main_lib.h" +#include "menulib/scmenu.h" +#include "util/arg_auto_set.h" +#include "util/arg_auto_menu.h" + + +void re_fail(char *s, char c) +{ + fprintf(stderr, "Regex error: %s [opcode %o]\n", s, c); + abort(); +} + +int cb_configure(scm_ctx_t *ctx, scm_menu_t *menu, scm_win_t *w, int selection) +{ + printf("configure!!\n"); + sleep(1); + return -1; +} + + + +scm_menu_entry_t me_hid_gtk[8] = {{SCM_TERMINATOR, NULL, NULL, NULL, NULL, NULL, 0}}; +scm_menu_entry_t me_hid_lesstif[8] = {{SCM_TERMINATOR, NULL, NULL, NULL, NULL, NULL, 0}}; +scm_menu_entry_t me_export[8] = {{SCM_TERMINATOR, NULL, NULL, NULL, NULL, NULL, 0}}; +scm_menu_entry_t me_gpmi[8] = {{SCM_TERMINATOR, NULL, NULL, NULL, NULL, NULL, 0}}; +scm_menu_entry_t me_autorouter[8] = {{SCM_TERMINATOR, NULL, NULL, NULL, NULL, NULL, 0}}; +scm_menu_entry_t me_all_settings[32] = {{SCM_TERMINATOR, NULL, NULL, NULL, NULL, NULL, 0}}; + +scm_menu_entry_t me_settings[] = { + {SCM_SUBMENU, NULL, "HID: gtk", "gtk settings -->", NULL, me_hid_gtk, SCM_AUTO_RUN}, + {SCM_SUBMENU, NULL, "HID: lesstif", "lesstif settings -->", NULL, me_hid_lesstif, SCM_AUTO_RUN}, + {SCM_SUBMENU, NULL, "HID: exporters", "export format settings -->", NULL, me_export, SCM_AUTO_RUN}, + {SCM_SUBMENU, NULL, "scripting", "gpmi settings -->", NULL, me_gpmi, SCM_AUTO_RUN}, + {SCM_SUBMENU, NULL, "auto routers", "autorouter settings -->", NULL, me_autorouter, SCM_AUTO_RUN}, + {SCM_EMPTY, NULL, NULL, NULL, NULL, 0}, + {SCM_SUBMENU, NULL, "all", "all settings at once -->", NULL, me_all_settings, SCM_AUTO_RUN}, + {SCM_TERMINATOR, NULL, NULL, NULL, NULL, NULL, 0} +}; + +scm_menu_entry_t me_main[] = { + {SCM_SUBMENU, NULL, "Edit settings", "Edit user configurable settings -->", NULL, me_settings, SCM_AUTO_RUN}, + {SCM_SUBMENU, NULL, "Manual detection", "Run detection of individual libs -->", NULL, NULL, SCM_AUTO_RUN}, + {SCM_SUBMENU_CB, NULL, "Configure pcb-rnd", "Run the configuration process -->", NULL, cb_configure, SCM_AUTO_RUN}, + {SCM_EMPTY, NULL, NULL, NULL, NULL, 0}, + {SCM_KEY_VALUE, NULL, "Exit & save", "Exit with saving the settings", NULL, NULL, SCM_AUTO_RUN}, + {SCM_KEY_VALUE, NULL, "Exit", "Exit without saving the settings", NULL, NULL, SCM_AUTO_RUN}, + {SCM_TERMINATOR, NULL, NULL, NULL, NULL, NULL, 0} +}; + +extern const arg_auto_set_t disable_libs[] ; + +int main() +{ + scm_ctx_t ctx; + + main_init(); + + append_settings_auto_set(me_export, 32, disable_libs, "-gd", NULL, "^disable-", SCM_SUBMENU, 0); + + scm_init(&ctx); + scm_menu_autowin(&ctx, "main menu", me_main); + + main_uninit(); + + return 0; +} Index: 1.0.8/scconfig =================================================================== --- 1.0.8/scconfig (nonexistent) +++ 1.0.8/scconfig (revision 1136) Property changes on: 1.0.8/scconfig ___________________________________________________________________ Added: svn:externals ## -0,0 +1 ## +svn://repo.hu/scconfig/trunk/src src Index: 1.0.8/src/Makefile.dep =================================================================== --- 1.0.8/src/Makefile.dep (nonexistent) +++ 1.0.8/src/Makefile.dep (revision 1136) @@ -0,0 +1,692 @@ +### Generated file, do not edit, run make dep ### + +action.o: action.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h action.h action_funclist.h action_funchash.h buffer.h \ + change.h copy.h create.h crosshair.h data.h draw.h error.h find.h \ + insert.h line.h misc.h ds.h mymem.h move.h polygon.h rats.h remove.h \ + rotate.h rubberband.h search.h select.h set.h undo.h rtree.h \ + stub_stroke.h +action_funchash.o: action_funchash.c action.h global.h ../config.h \ + ../config.manual.h ../config.auto.h const.h ../globalconst.h ../config.h \ + macro.h hid.h polyarea.h libpcb_fp.h action_funclist.h action_funchash.h +buffer.o: buffer.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h action.h action_funclist.h action_funchash.h buffer.h copy.h \ + create.h crosshair.h data.h error.h file.h mymem.h mirror.h misc.h ds.h \ + parse_l.h polygon.h rats.h rotate.h remove.h rtree.h search.h select.h \ + set.h +change.o: change.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h change.h create.h crosshair.h data.h draw.h error.h mymem.h \ + misc.h ds.h mirror.h polygon.h rats.h remove.h rtree.h search.h select.h \ + set.h thermal.h undo.h +change_act.o: change_act.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h data.h action.h action_funclist.h \ + action_funchash.h change.h crosshair.h draw.h search.h misc.h ds.h \ + mymem.h set.h error.h undo.h rubberband.h +clip.o: clip.c ../config.h ../config.manual.h ../config.auto.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h draw.h mymem.h +command.o: command.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h action.h action_funclist.h action_funchash.h buffer.h \ + command.h data.h error.h file.h mymem.h misc.h ds.h rats.h set.h +compat.o: compat.c ../config.h ../config.manual.h ../config.auto.h \ + compat.h global.h const.h ../globalconst.h ../config.h macro.h hid.h \ + polyarea.h libpcb_fp.h +copy.o: copy.c ../config.h ../config.manual.h ../config.auto.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h copy.h create.h data.h draw.h mymem.h mirror.h misc.h ds.h \ + move.h polygon.h rats.h rtree.h select.h undo.h +create.o: create.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h create.h data.h draw.h error.h mymem.h misc.h ds.h parse_l.h \ + pcb-printf.h polygon.h rtree.h search.h set.h undo.h file.h \ + stub_vendor.h +crosshair.o: crosshair.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h box.h misc.h ds.h mymem.h crosshair.h data.h draw.h error.h \ + line.h rtree.h search.h polygon.h +data.o: data.c ../config.h ../config.manual.h ../config.auto.h data.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h +draw.o: draw.c ../config.h ../config.manual.h ../config.auto.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h compat.h crosshair.h data.h draw.h error.h mymem.h misc.h \ + ds.h rotate.h rtree.h search.h select.h print.h +drill.o: drill.c ../config.h ../config.manual.h ../config.auto.h data.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h error.h mymem.h +error.o: error.c ../config.h ../config.manual.h ../config.auto.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h error.h file.h misc.h ds.h mymem.h +event.o: event.c event.h error.h +file.o: file.c ../config.h ../config.manual.h ../config.auto.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h buffer.h change.h create.h crosshair.h data.h error.h file.h \ + misc.h ds.h mymem.h move.h parse_l.h pcb-printf.h polygon.h rats.h \ + remove.h set.h strflags.h portability.h paths.h rats_patch.h stub_edif.h +file_act.o: file_act.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h action.h action_funclist.h action_funchash.h change.h \ + error.h undo.h crosshair.h set.h file.h buffer.h mymem.h misc.h ds.h \ + remove.h create.h draw.h find.h search.h +find.o: find.c ../config.h ../config.manual.h ../config.auto.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h crosshair.h data.h draw.h error.h find.h mymem.h misc.h ds.h \ + rtree.h polygon.h pcb-printf.h search.h set.h undo.h rats.h +find_act.o: find_act.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h action.h action_funclist.h action_funchash.h change.h \ + error.h undo.h find.h pcb-printf.h +flags.o: flags.c ../config.h ../config.manual.h ../config.auto.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h pcb-printf.h +fontmode.o: fontmode.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h create.h data.h draw.h misc.h ds.h mymem.h move.h remove.h \ + rtree.h strflags.h undo.h pcb-printf.h +free_atexit.o: free_atexit.c +gui_act.o: gui_act.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h action.h action_funclist.h action_funchash.h change.h \ + error.h undo.h draw.h search.h crosshair.h find.h set.h misc.h ds.h \ + mymem.h stub_stroke.h +heap.o: heap.c ../config.h ../config.manual.h ../config.auto.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h heap.h +insert.o: insert.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h copy.h create.h crosshair.h data.h draw.h insert.h line.h \ + misc.h ds.h mymem.h move.h polygon.h rtree.h search.h select.h set.h \ + undo.h +intersect.o: intersect.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h intersect.h mymem.h +line.o: line.c ../config.h ../config.manual.h ../config.auto.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h crosshair.h find.h line.h misc.h ds.h mymem.h rtree.h +lrealpath.o: lrealpath.c ../config.h ../config.manual.h ../config.auto.h \ + lrealpath.h +main.o: main.c ../config.h ../config.manual.h ../config.auto.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h buffer.h create.h crosshair.h draw.h error.h file.h \ + set.h action.h action_funclist.h action_funchash.h misc.h ds.h mymem.h \ + lrealpath.h free_atexit.h polygon.h pcb-printf.h buildin.h paths.h \ + hid/common/actions.h hid/hidint.h dolists.h action_list.h +mirror.o: mirror.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h draw.h mirror.h misc.h ds.h mymem.h polygon.h \ + search.h select.h set.h +misc.o: misc.c ../config.h ../config.manual.h ../config.auto.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h box.h misc.h ds.h mymem.h crosshair.h create.h data.h draw.h \ + file.h error.h move.h pcb-printf.h polygon.h remove.h rtree.h rotate.h \ + rubberband.h search.h set.h undo.h action.h action_funclist.h \ + action_funchash.h portability.h +move.o: move.c ../config.h ../config.manual.h ../config.auto.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h create.h crosshair.h data.h draw.h error.h misc.h ds.h \ + mymem.h move.h polygon.h rtree.h search.h select.h thermal.h undo.h +mymem.o: mymem.c ../config.h ../config.manual.h ../config.auto.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h error.h mymem.h misc.h ds.h rats.h rtree.h +netlist.o: netlist.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h action.h action_funclist.h action_funchash.h buffer.h \ + command.h data.h error.h file.h find.h mymem.h misc.h ds.h rats.h set.h \ + create.h rats_patch.h +object_act.o: object_act.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h data.h action.h action_funclist.h \ + action_funchash.h change.h error.h undo.h search.h move.h draw.h \ + mirror.h rotate.h set.h copy.h misc.h ds.h mymem.h rubberband.h buffer.h \ + remove.h create.h +paths.o: paths.c paths.h error.h +pcb-printf.o: pcb-printf.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h pcb-printf.h +plugins.o: plugins.c plugins.h ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h data.h action.h action_funclist.h \ + action_funchash.h ds.h +polygon.o: polygon.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h box.h misc.h ds.h mymem.h create.h crosshair.h data.h draw.h \ + error.h find.h move.h pcb-printf.h polygon.h remove.h rtree.h search.h \ + set.h thermal.h undo.h +polygon1.o: polygon1.c global.h ../config.h ../config.manual.h \ + ../config.auto.h const.h ../globalconst.h ../config.h macro.h hid.h \ + polyarea.h libpcb_fp.h rtree.h heap.h +polygon_act.o: polygon_act.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h data.h action.h action_funclist.h \ + action_funchash.h change.h error.h undo.h polygon.h draw.h search.h \ + crosshair.h +print.o: print.c ../config.h ../config.manual.h ../config.auto.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h draw.h drill.h file.h find.h error.h misc.h ds.h \ + mymem.h print.h polygon.h rtree.h search.h +rats.o: rats.c ../config.h ../config.manual.h ../config.auto.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h create.h data.h draw.h error.h file.h find.h misc.h ds.h \ + mymem.h polygon.h rats.h search.h set.h undo.h stub_mincut.h +rats_act.o: rats_act.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h action.h action_funclist.h action_funchash.h change.h \ + error.h undo.h rats.h draw.h +rats_patch.o: rats_patch.c rats_patch.h global.h ../config.h \ + ../config.manual.h ../config.auto.h const.h ../globalconst.h ../config.h \ + macro.h hid.h polyarea.h libpcb_fp.h ../src_3rd/genht/htsp.h \ + ../src_3rd/genht/ht.h ../src_3rd/genht/ht_inlines.h \ + ../src_3rd/genht/hash.h create.h data.h action.h action_funclist.h \ + action_funchash.h error.h buffer.h remove.h copy.h +remove.o: remove.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h draw.h error.h misc.h ds.h mymem.h move.h polygon.h \ + rats.h remove.h rtree.h search.h select.h set.h undo.h +remove_act.o: remove_act.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h data.h action.h action_funclist.h \ + action_funchash.h change.h error.h undo.h +report.o: report.c ../config.h ../config.manual.h ../config.auto.h \ + report.h global.h const.h ../globalconst.h ../config.h macro.h hid.h \ + polyarea.h libpcb_fp.h crosshair.h data.h drill.h error.h search.h \ + misc.h ds.h mymem.h rats.h rtree.h strflags.h undo.h find.h draw.h \ + pcb-printf.h +rotate.o: rotate.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h crosshair.h data.h draw.h error.h misc.h ds.h mymem.h \ + polygon.h rotate.h rtree.h rubberband.h search.h select.h set.h undo.h +rtree.o: rtree.c ../config.h ../config.manual.h ../config.auto.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h mymem.h rtree.h +rubberband.o: rubberband.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h create.h data.h error.h misc.h ds.h mymem.h \ + polygon.h rubberband.h rtree.h search.h +search.o: search.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h box.h misc.h ds.h mymem.h data.h draw.h error.h find.h \ + polygon.h rtree.h search.h +select.o: select.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h draw.h error.h search.h select.h undo.h rats.h misc.h \ + ds.h mymem.h find.h +select_act.o: select_act.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h data.h action.h action_funclist.h \ + action_funchash.h change.h error.h undo.h search.h select.h crosshair.h \ + set.h buffer.h draw.h remove.h copy.h +set.o: set.c ../config.h ../config.manual.h ../config.auto.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h action.h action_funclist.h action_funchash.h buffer.h \ + compat.h crosshair.h data.h draw.h error.h find.h misc.h ds.h mymem.h \ + set.h undo.h +strflags.o: strflags.c ../config.h ../config.manual.h ../config.auto.h \ + ../globalconst.h ../config.h global.h const.h macro.h hid.h polyarea.h \ + libpcb_fp.h compat.h strflags.h +stub_edif.o: stub_edif.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h error.h stub_edif.h +stub_mincut.o: stub_mincut.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h error.h data.h stub_mincut.h +stub_stroke.o: stub_stroke.c error.h +stub_vendor.o: stub_vendor.c stub_vendor.h ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h +thermal.o: thermal.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h create.h data.h draw.h error.h misc.h ds.h mymem.h move.h \ + polygon.h rtree.h thermal.h undo.h +undo.o: undo.c ../config.h ../config.manual.h ../config.auto.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h buffer.h change.h create.h data.h draw.h error.h insert.h \ + misc.h ds.h mymem.h mirror.h move.h polygon.h remove.h rotate.h rtree.h \ + search.h set.h undo.h strflags.h +undo_act.o: undo_act.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h action.h action_funclist.h action_funchash.h change.h \ + error.h crosshair.h undo.h polygon.h set.h search.h draw.h misc.h ds.h \ + mymem.h +vector.o: vector.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h vector.h +actions.o: hid/common/actions.c ../config.h ../config.manual.h \ + ../config.auto.h hid/common/../../../src_3rd/genht/hash.h \ + hid/common/../../../src_3rd/genht/htsp.h \ + hid/common/../../../src_3rd/genht/ht.h \ + hid/common/../../../src_3rd/genht/ht_inlines.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h data.h \ + global.h error.h event.h hid.h hid/common/../hidint.h +flags.o: hid/common/flags.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h data.h global.h misc.h ds.h mymem.h hid.h \ + hid/common/../hidint.h +hidinit.o: hid/common/hidinit.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h hid.h hid/common/hidnogui.h \ + hid/common/../hidint.h compat.h error.h misc.h global.h ds.h mymem.h \ + portability.h pcb-printf.h plugins.h hid/common/hidlist.h +hidnogui.o: hid/common/hidnogui.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h hid.h +extents.o: hid/common/extents.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h data.h global.h hid.h \ + hid/common/../hidint.h hid/common/draw_helpers.h +draw_helpers.o: hid/common/draw_helpers.c global.h ../config.h \ + ../config.manual.h ../config.auto.h const.h ../globalconst.h ../config.h \ + macro.h hid.h polyarea.h libpcb_fp.h hid.h polygon.h global.h +hid_resource.o: hid/common/hid_resource.c global.h ../config.h \ + ../config.manual.h ../config.auto.h const.h ../globalconst.h ../config.h \ + macro.h hid.h polyarea.h libpcb_fp.h hid.h resource.h \ + hid/common/hid_resource.h +res_parse.o: res_parse.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h resource.h res_parse.h +res_lex.o: res_lex.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h resource.h res_parse.h +portability.o: portability.c ../config.h ../config.manual.h \ + ../config.auto.h ds.h global.h const.h ../globalconst.h ../config.h \ + macro.h hid.h polyarea.h libpcb_fp.h error.h mymem.h +ds.o: ds.c ds.h +libpcb_fp.o: libpcb_fp.c ds.h ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h error.h portability.h paths.h \ + ../src_3rd/genht/htsp.h ../src_3rd/genht/ht.h \ + ../src_3rd/genht/ht_inlines.h ../src_3rd/genht/hash.h +parse_y.o: parse_y.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h create.h data.h error.h file.h mymem.h misc.h ds.h parse_l.h \ + polygon.h remove.h rtree.h strflags.h thermal.h rats_patch.h parse_y.h +parse_l.o: parse_l.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h crosshair.h data.h error.h file.h mymem.h misc.h ds.h \ + strflags.h parse_l.h parse_y.h create.h +buildin.o: buildin.c plugins.h buildin.h +hash.o: ../src_3rd/genht/hash.c +htsp.o: ../src_3rd/genht/htsp.c ../src_3rd/genht/htsp.h \ + ../src_3rd/genht/ht.h ../src_3rd/genht/ht_inlines.h \ + ../src_3rd/genht/ht.c +ghid-cell-renderer-visibility.o: hid/gtk/ghid-cell-renderer-visibility.c \ + hid/gtk/gtkhid.h hid/gtk/gui.h global.h ../config.h ../config.manual.h \ + ../config.auto.h const.h ../globalconst.h ../config.h macro.h hid.h \ + polyarea.h libpcb_fp.h hid.h hid/common/hid_resource.h resource.h data.h \ + global.h misc.h ds.h mymem.h hid/gtk/ghid-coord-entry.h \ + hid/gtk/ghid-main-menu.h hid/gtk/ghid-layer-selector.h \ + hid/gtk/ghid-route-style-selector.h hid/gtk/gui-pinout-preview.h \ + hid/gtk/ghid-cell-renderer-visibility.h +ghid-coord-entry.o: hid/gtk/ghid-coord-entry.c hid/gtk/gtkhid.h \ + hid/gtk/gui.h global.h ../config.h ../config.manual.h ../config.auto.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h hid.h hid/common/hid_resource.h resource.h data.h global.h \ + misc.h ds.h mymem.h hid/gtk/ghid-coord-entry.h hid/gtk/ghid-main-menu.h \ + hid/gtk/ghid-layer-selector.h hid/gtk/ghid-route-style-selector.h \ + hid/gtk/gui-pinout-preview.h pcb-printf.h +ghid-layer-selector.o: hid/gtk/ghid-layer-selector.c hid/gtk/gtkhid.h \ + hid/gtk/gui.h global.h ../config.h ../config.manual.h ../config.auto.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h hid.h hid/common/hid_resource.h resource.h data.h global.h \ + misc.h ds.h mymem.h hid/gtk/ghid-coord-entry.h hid/gtk/ghid-main-menu.h \ + hid/gtk/ghid-layer-selector.h hid/gtk/ghid-route-style-selector.h \ + hid/gtk/gui-pinout-preview.h pcb-printf.h \ + hid/gtk/ghid-cell-renderer-visibility.h +ghid-main-menu.o: hid/gtk/ghid-main-menu.c hid/gtk/gtkhid.h hid/gtk/gui.h \ + global.h ../config.h ../config.manual.h ../config.auto.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h hid.h \ + hid/common/hid_resource.h resource.h data.h global.h misc.h ds.h mymem.h \ + hid/gtk/ghid-coord-entry.h hid/gtk/ghid-main-menu.h \ + hid/gtk/ghid-layer-selector.h hid/gtk/ghid-route-style-selector.h \ + hid/gtk/gui-pinout-preview.h pcb-printf.h +ghid-route-style-selector.o: hid/gtk/ghid-route-style-selector.c global.h \ + ../config.h ../config.manual.h ../config.auto.h const.h ../globalconst.h \ + ../config.h macro.h hid.h polyarea.h libpcb_fp.h hid/gtk/gtkhid.h \ + hid/gtk/gui.h hid.h hid/common/hid_resource.h resource.h data.h global.h \ + misc.h ds.h mymem.h hid/gtk/ghid-coord-entry.h hid/gtk/ghid-main-menu.h \ + hid/gtk/ghid-layer-selector.h hid/gtk/ghid-route-style-selector.h \ + hid/gtk/gui-pinout-preview.h pcb-printf.h +gtkhid-main.o: hid/gtk/gtkhid-main.c ../config.h ../config.manual.h \ + ../config.auto.h action.h global.h const.h ../globalconst.h ../config.h \ + macro.h hid.h polyarea.h libpcb_fp.h action_funclist.h action_funchash.h \ + crosshair.h error.h hid/gtk/../hidint.h hid/gtk/gui.h global.h hid.h \ + hid/common/hid_resource.h resource.h data.h misc.h ds.h mymem.h \ + hid/gtk/ghid-coord-entry.h hid/gtk/ghid-main-menu.h \ + hid/gtk/ghid-layer-selector.h hid/gtk/ghid-route-style-selector.h \ + hid/gtk/gui-pinout-preview.h hid/common/hidnogui.h \ + hid/common/draw_helpers.h pcb-printf.h dolists.h +gui-command-window.o: hid/gtk/gui-command-window.c ../config.h \ + ../config.manual.h ../config.auto.h hid/gtk/gui.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h hid.h \ + hid/common/hid_resource.h resource.h data.h global.h misc.h ds.h mymem.h \ + hid/gtk/ghid-coord-entry.h hid/gtk/ghid-main-menu.h \ + hid/gtk/ghid-layer-selector.h hid/gtk/ghid-route-style-selector.h \ + hid/gtk/gui-pinout-preview.h command.h crosshair.h +gui-config.o: hid/gtk/gui-config.c ../config.h ../config.manual.h \ + ../config.auto.h hid/gtk/gui.h global.h const.h ../globalconst.h \ + ../config.h macro.h hid.h polyarea.h libpcb_fp.h hid.h \ + hid/common/hid_resource.h resource.h data.h global.h misc.h ds.h mymem.h \ + hid/gtk/ghid-coord-entry.h hid/gtk/ghid-main-menu.h \ + hid/gtk/ghid-layer-selector.h hid/gtk/ghid-route-style-selector.h \ + hid/gtk/gui-pinout-preview.h hid/gtk/../hidint.h hid/gtk/gtkhid.h \ + action.h action_funclist.h action_funchash.h change.h file.h error.h \ + draw.h portability.h pcb-printf.h set.h +gui-dialog-print.o: hid/gtk/gui-dialog-print.c ../config.h \ + ../config.manual.h ../config.auto.h hid/gtk/gui.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h hid.h \ + hid/common/hid_resource.h resource.h data.h global.h misc.h ds.h mymem.h \ + hid/gtk/ghid-coord-entry.h hid/gtk/ghid-main-menu.h \ + hid/gtk/ghid-layer-selector.h hid/gtk/ghid-route-style-selector.h \ + hid/gtk/gui-pinout-preview.h pcb-printf.h +gui-dialog.o: hid/gtk/gui-dialog.c ../config.h ../config.manual.h \ + ../config.auto.h data.h global.h const.h ../globalconst.h ../config.h \ + macro.h hid.h polyarea.h libpcb_fp.h hid/gtk/gui.h global.h hid.h \ + hid/common/hid_resource.h resource.h misc.h ds.h mymem.h \ + hid/gtk/ghid-coord-entry.h hid/gtk/ghid-main-menu.h \ + hid/gtk/ghid-layer-selector.h hid/gtk/ghid-route-style-selector.h \ + hid/gtk/gui-pinout-preview.h command.h +gui-drc-window.o: hid/gtk/gui-drc-window.c ../config.h ../config.manual.h \ + ../config.auto.h error.h search.h global.h const.h ../globalconst.h \ + ../config.h macro.h hid.h polyarea.h libpcb_fp.h draw.h pcb-printf.h \ + undo.h set.h hid/gtk/gui.h global.h hid.h hid/common/hid_resource.h \ + resource.h data.h misc.h ds.h mymem.h hid/gtk/ghid-coord-entry.h \ + hid/gtk/ghid-main-menu.h hid/gtk/ghid-layer-selector.h \ + hid/gtk/ghid-route-style-selector.h hid/gtk/gui-pinout-preview.h \ + hid/gtk/gui-drc-window.h +gui-keyref-window.o: hid/gtk/gui-keyref-window.c ../config.h \ + ../config.manual.h ../config.auto.h hid/gtk/gui.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h hid.h \ + hid/common/hid_resource.h resource.h data.h global.h misc.h ds.h mymem.h \ + hid/gtk/ghid-coord-entry.h hid/gtk/ghid-main-menu.h \ + hid/gtk/ghid-layer-selector.h hid/gtk/ghid-route-style-selector.h \ + hid/gtk/gui-pinout-preview.h +gui-library-window.o: hid/gtk/gui-library-window.c ../config.h \ + ../config.manual.h ../config.auto.h hid/gtk/gui.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h hid.h \ + hid/common/hid_resource.h resource.h data.h global.h misc.h ds.h mymem.h \ + hid/gtk/ghid-coord-entry.h hid/gtk/ghid-main-menu.h \ + hid/gtk/ghid-layer-selector.h hid/gtk/ghid-route-style-selector.h \ + hid/gtk/gui-pinout-preview.h buffer.h set.h hid/gtk/gui-library-window.h +gui-log-window.o: hid/gtk/gui-log-window.c ../config.h ../config.manual.h \ + ../config.auto.h hid/gtk/gui.h global.h const.h ../globalconst.h \ + ../config.h macro.h hid.h polyarea.h libpcb_fp.h hid.h \ + hid/common/hid_resource.h resource.h data.h global.h misc.h ds.h mymem.h \ + hid/gtk/ghid-coord-entry.h hid/gtk/ghid-main-menu.h \ + hid/gtk/ghid-layer-selector.h hid/gtk/ghid-route-style-selector.h \ + hid/gtk/gui-pinout-preview.h pcb-printf.h +gui-misc.o: hid/gtk/gui-misc.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h crosshair.h global.h data.h misc.h ds.h \ + mymem.h action.h action_funclist.h action_funchash.h set.h pcb-printf.h \ + hid/gtk/gui.h hid.h hid/common/hid_resource.h resource.h \ + hid/gtk/ghid-coord-entry.h hid/gtk/ghid-main-menu.h \ + hid/gtk/ghid-layer-selector.h hid/gtk/ghid-route-style-selector.h \ + hid/gtk/gui-pinout-preview.h +gui-netlist-window.o: hid/gtk/gui-netlist-window.c ../config.h \ + ../config.manual.h ../config.auto.h global.h const.h ../globalconst.h \ + ../config.h macro.h hid.h polyarea.h libpcb_fp.h create.h global.h \ + data.h draw.h error.h find.h misc.h ds.h mymem.h mymem.h rats.h remove.h \ + search.h select.h set.h undo.h hid/gtk/gui.h hid.h \ + hid/common/hid_resource.h resource.h hid/gtk/ghid-coord-entry.h \ + hid/gtk/ghid-main-menu.h hid/gtk/ghid-layer-selector.h \ + hid/gtk/ghid-route-style-selector.h hid/gtk/gui-pinout-preview.h +gui-output-events.o: hid/gtk/gui-output-events.c ../config.h \ + ../config.manual.h ../config.auto.h hid/gtk/gui.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h hid.h \ + hid/common/hid_resource.h resource.h data.h global.h misc.h ds.h mymem.h \ + hid/gtk/ghid-coord-entry.h hid/gtk/ghid-main-menu.h \ + hid/gtk/ghid-layer-selector.h hid/gtk/ghid-route-style-selector.h \ + hid/gtk/gui-pinout-preview.h hid/gtk/gtkhid.h action.h action_funclist.h \ + action_funchash.h crosshair.h draw.h error.h set.h find.h search.h \ + rats.h +gui-pinout-preview.o: hid/gtk/gui-pinout-preview.c ../config.h \ + ../config.manual.h ../config.auto.h global.h const.h ../globalconst.h \ + ../config.h macro.h hid.h polyarea.h libpcb_fp.h hid/gtk/gui.h hid.h \ + hid/common/hid_resource.h resource.h data.h global.h misc.h ds.h mymem.h \ + hid/gtk/ghid-coord-entry.h hid/gtk/ghid-main-menu.h \ + hid/gtk/ghid-layer-selector.h hid/gtk/ghid-route-style-selector.h \ + hid/gtk/gui-pinout-preview.h copy.h draw.h mymem.h move.h rotate.h +gui-pinout-window.o: hid/gtk/gui-pinout-window.c ../config.h \ + ../config.manual.h ../config.auto.h global.h const.h ../globalconst.h \ + ../config.h macro.h hid.h polyarea.h libpcb_fp.h hid/gtk/gui.h hid.h \ + hid/common/hid_resource.h resource.h data.h global.h misc.h ds.h mymem.h \ + hid/gtk/ghid-coord-entry.h hid/gtk/ghid-main-menu.h \ + hid/gtk/ghid-layer-selector.h hid/gtk/ghid-route-style-selector.h \ + hid/gtk/gui-pinout-preview.h copy.h draw.h mymem.h move.h rotate.h +gui-top-window.o: hid/gtk/gui-top-window.c ../config.h ../config.manual.h \ + ../config.auto.h hid/gtk/ghid-layer-selector.h \ + hid/gtk/ghid-route-style-selector.h global.h const.h ../globalconst.h \ + ../config.h macro.h hid.h polyarea.h libpcb_fp.h hid/gtk/gtkhid.h \ + hid/gtk/gui.h hid.h hid/common/hid_resource.h resource.h data.h global.h \ + misc.h ds.h mymem.h hid/gtk/ghid-coord-entry.h hid/gtk/ghid-main-menu.h \ + hid/gtk/gui-pinout-preview.h hid/gtk/../hidint.h action.h \ + action_funclist.h action_funchash.h buffer.h change.h command.h copy.h \ + create.h crosshair.h draw.h error.h file.h find.h gpcb-menu.h insert.h \ + line.h mymem.h move.h pcb-printf.h polygon.h rats.h remove.h report.h \ + rotate.h rubberband.h search.h select.h set.h undo.h event.h \ + free_atexit.h paths.h hid/gtk/gui-icons-mode-buttons.data \ + hid/gtk/gui-icons-misc.data +gui-utils.o: hid/gtk/gui-utils.c ../config.h ../config.manual.h \ + ../config.auto.h hid/gtk/gui.h global.h const.h ../globalconst.h \ + ../config.h macro.h hid.h polyarea.h libpcb_fp.h hid.h \ + hid/common/hid_resource.h resource.h data.h global.h misc.h ds.h mymem.h \ + hid/gtk/ghid-coord-entry.h hid/gtk/ghid-main-menu.h \ + hid/gtk/ghid-layer-selector.h hid/gtk/ghid-route-style-selector.h \ + hid/gtk/gui-pinout-preview.h +gtkhid-gdk.o: hid/gtk/gtkhid-gdk.c ../config.h ../config.manual.h \ + ../config.auto.h crosshair.h global.h const.h ../globalconst.h \ + ../config.h macro.h hid.h polyarea.h libpcb_fp.h clip.h \ + hid/gtk/../hidint.h hid/gtk/gui.h global.h hid.h \ + hid/common/hid_resource.h resource.h data.h misc.h ds.h mymem.h \ + hid/gtk/ghid-coord-entry.h hid/gtk/ghid-main-menu.h \ + hid/gtk/ghid-layer-selector.h hid/gtk/ghid-route-style-selector.h \ + hid/gtk/gui-pinout-preview.h hid/common/draw_helpers.h +dialogs.o: hid/lesstif/dialogs.c ../config.h ../config.manual.h \ + ../config.auto.h hid/lesstif/xincludes.h compat.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h data.h \ + global.h crosshair.h misc.h ds.h mymem.h pcb-printf.h hid.h \ + hid/lesstif/../hidint.h hid/lesstif/lesstif.h +library.o: hid/lesstif/library.c ../config.h ../config.manual.h \ + ../config.auto.h hid/lesstif/xincludes.h compat.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h data.h \ + global.h misc.h ds.h mymem.h set.h buffer.h hid.h \ + hid/lesstif/../hidint.h hid/lesstif/lesstif.h +main.o: hid/lesstif/main.c ../config.h ../config.manual.h \ + ../config.auto.h hid/lesstif/xincludes.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h data.h \ + global.h action.h action_funclist.h action_funchash.h crosshair.h \ + mymem.h misc.h ds.h mymem.h pcb-printf.h resource.h clip.h event.h \ + error.h hid.h hid/lesstif/../hidint.h hid/common/hidnogui.h \ + hid/common/draw_helpers.h hid/common/hid_resource.h \ + hid/lesstif/lesstif.h dolists.h +menu.o: hid/lesstif/menu.c ../config.h ../config.manual.h \ + ../config.auto.h hid/lesstif/xincludes.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h data.h \ + global.h error.h misc.h ds.h mymem.h pcb-printf.h hid.h \ + hid/lesstif/../hidint.h hid/common/hid_resource.h resource.h \ + hid/lesstif/lesstif.h mymem.h paths.h pcb-menu.h \ + hid/lesstif/../../../src_3rd/genht/htsp.h \ + hid/lesstif/../../../src_3rd/genht/ht.h \ + hid/lesstif/../../../src_3rd/genht/ht_inlines.h \ + hid/lesstif/../../../src_3rd/genht/hash.h +netlist.o: hid/lesstif/netlist.c ../config.h ../config.manual.h \ + ../config.auto.h hid/lesstif/xincludes.h compat.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h data.h \ + global.h find.h rats.h select.h undo.h remove.h crosshair.h draw.h hid.h \ + hid/lesstif/../hidint.h hid/lesstif/lesstif.h +styles.o: hid/lesstif/styles.c ../config.h ../config.manual.h \ + ../config.auto.h hid/lesstif/xincludes.h compat.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h data.h \ + global.h set.h misc.h ds.h mymem.h mymem.h pcb-printf.h hid.h \ + hid/lesstif/../hidint.h hid/lesstif/lesstif.h +batch.o: hid/batch/batch.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h hid.h data.h global.h misc.h ds.h mymem.h \ + hid/batch/../hidint.h pcb-printf.h hid/common/draw_helpers.h \ + hid/common/hidnogui.h hid/common/actions.h hid/common/hidinit.h \ + dolists.h +bom.o: hid/bom/bom.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h global.h error.h misc.h ds.h mymem.h pcb-printf.h \ + hid.h hid/common/hidnogui.h hid/bom/../hidint.h +ps.o: hid/ps/ps.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h global.h misc.h ds.h mymem.h error.h draw.h \ + pcb-printf.h hid.h hid/ps/../hidint.h hid/common/hidnogui.h \ + hid/common/draw_helpers.h hid/ps/../ps/ps.h hid/ps/../../print.h \ + hid/ps/../../global.h hid/common/hidinit.h dolists.h +eps.o: hid/ps/eps.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h global.h misc.h ds.h mymem.h pcb-printf.h hid.h \ + hid/ps/../hidint.h hid/common/hidnogui.h hid/common/draw_helpers.h \ + hid/ps/../ps/ps.h hid/common/hidinit.h +png.o: hid/png/png.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h global.h error.h misc.h ds.h mymem.h hid.h \ + hid/png/../hidint.h hid/common/hidnogui.h hid/common/draw_helpers.h \ + hid/png/png.h hid/common/hidinit.h dolists.h +gerber.o: hid/gerber/gerber.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h data.h global.h misc.h ds.h mymem.h error.h \ + draw.h pcb-printf.h hid.h hid/gerber/../hidint.h hid/common/hidnogui.h \ + hid/common/draw_helpers.h hid/common/hidinit.h +gcode.o: hid/gcode/gcode.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h error.h data.h global.h misc.h ds.h mymem.h \ + rats.h hid.h hid/gcode/../hidint.h hid/common/hidnogui.h \ + hid/common/draw_helpers.h hid/gcode/gcode.h hid/gcode/bitmap.h \ + hid/gcode/potracelib.h hid/gcode/curve.h hid/gcode/auxiliary.h \ + hid/gcode/trace.h hid/gcode/decompose.h pcb-printf.h \ + hid/common/hidinit.h dolists.h +decompose.o: hid/gcode/decompose.c hid/gcode/potracelib.h \ + hid/gcode/curve.h hid/gcode/auxiliary.h ../config.h ../config.manual.h \ + ../config.auto.h hid/gcode/lists.h hid/gcode/bitmap.h \ + hid/gcode/decompose.h +trace.o: hid/gcode/trace.c global.h ../config.h ../config.manual.h \ + ../config.auto.h const.h ../globalconst.h ../config.h macro.h hid.h \ + polyarea.h libpcb_fp.h hid/gcode/potracelib.h hid/gcode/curve.h \ + hid/gcode/auxiliary.h hid/gcode/lists.h hid/gcode/trace.h +curve.o: hid/gcode/curve.c hid/gcode/potracelib.h hid/gcode/lists.h \ + hid/gcode/curve.h hid/gcode/auxiliary.h ../config.h ../config.manual.h \ + ../config.auto.h +nelma.o: hid/nelma/nelma.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h error.h data.h global.h misc.h ds.h mymem.h \ + rats.h hid.h hid/nelma/../hidint.h hid/common/hidnogui.h \ + hid/common/draw_helpers.h hid/common/hidinit.h dolists.h +lpr.o: hid/lpr/lpr.c ../config.h ../config.manual.h ../config.auto.h \ + global.h const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h global.h misc.h ds.h mymem.h hid.h \ + hid/lpr/../hidint.h hid/lpr/../ps/ps.h hid/common/hidnogui.h \ + hid/common/hidinit.h +../src_plugins/autoplace/autoplace.o: \ + ../src_plugins/autoplace/autoplace.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h ../src_plugins/autoplace/autoplace.h box.h \ + global.h misc.h ds.h mymem.h compat.h data.h draw.h error.h intersect.h \ + rtree.h macro.h mirror.h misc.h move.h mymem.h rats.h remove.h rotate.h +../src_plugins/autoplace/action.o: ../src_plugins/autoplace/action.c \ + ../config.h ../config.manual.h ../config.auto.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h \ + ../src_plugins/autoplace/autoplace.h dolists.h +../src_plugins/autoroute/autoroute.o: \ + ../src_plugins/autoroute/autoroute.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h data.h global.h macro.h \ + ../src_plugins/autoroute/autoroute.h box.h misc.h ds.h mymem.h create.h \ + draw.h error.h find.h heap.h rtree.h misc.h \ + ../src_plugins/autoroute/mtspace.h vector.h mymem.h polygon.h rats.h \ + remove.h thermal.h undo.h pcb-printf.h +../src_plugins/autoroute/mtspace.o: ../src_plugins/autoroute/mtspace.c \ + ../config.h ../config.manual.h ../config.auto.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h box.h \ + global.h misc.h ds.h mymem.h heap.h rtree.h \ + ../src_plugins/autoroute/mtspace.h vector.h +../src_plugins/autoroute/action.o: ../src_plugins/autoroute/action.c \ + ../config.h ../config.manual.h ../config.auto.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h \ + ../src_plugins/autoroute/autoroute.h dolists.h +../src_plugins/vendordrill/vendor.o: ../src_plugins/vendordrill/vendor.c \ + ../config.h ../config.manual.h ../config.auto.h change.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h draw.h error.h global.h resource.h set.h undo.h \ + ../src_plugins/vendordrill/vendor.h stub_vendor.h dolists.h +../src_plugins/puller/puller.o: ../src_plugins/puller/puller.c \ + ../config.h ../config.manual.h ../config.auto.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h \ + create.h global.h data.h draw.h misc.h ds.h mymem.h move.h pcb-printf.h \ + remove.h rtree.h strflags.h undo.h dolists.h +../src_plugins/edif/edif.o: ../src_plugins/edif/edif.c global.h \ + ../config.h ../config.manual.h ../config.auto.h const.h ../globalconst.h \ + ../config.h macro.h hid.h polyarea.h libpcb_fp.h data.h global.h \ + stub_edif.h +../src_plugins/toporouter/toporouter.o: \ + ../src_plugins/toporouter/toporouter.c \ + ../src_plugins/toporouter/toporouter.h data.h global.h ../config.h \ + ../config.manual.h ../config.auto.h const.h ../globalconst.h ../config.h \ + macro.h hid.h polyarea.h libpcb_fp.h macro.h \ + ../src_plugins/toporouter/../autoroute/autoroute.h global.h box.h misc.h \ + ds.h mymem.h create.h draw.h error.h find.h heap.h rtree.h misc.h \ + mymem.h polygon.h rats.h remove.h thermal.h undo.h ../src_3rd/gts/gts.h \ + pcb-printf.h +../src_plugins/oldactions/oldactions.o: \ + ../src_plugins/oldactions/oldactions.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h data.h global.h action.h action_funclist.h \ + action_funchash.h change.h error.h undo.h dolists.h +../src_plugins/renumber/renumber.o: ../src_plugins/renumber/renumber.c \ + ../config.h ../config.manual.h ../config.auto.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h data.h \ + global.h action.h action_funclist.h action_funchash.h change.h error.h \ + undo.h pcb-printf.h dolists.h +../src_plugins/import_sch/import_sch.o: \ + ../src_plugins/import_sch/import_sch.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h data.h global.h action.h action_funclist.h \ + action_funchash.h change.h error.h undo.h misc.h ds.h mymem.h \ + portability.h pcb-printf.h remove.h rats.h dolists.h +../src_plugins/autoroute/autoroute.o: \ + ../src_plugins/autoroute/autoroute.c ../config.h ../config.manual.h \ + ../config.auto.h global.h const.h ../globalconst.h ../config.h macro.h \ + hid.h polyarea.h libpcb_fp.h data.h global.h macro.h \ + ../src_plugins/autoroute/autoroute.h box.h misc.h ds.h mymem.h create.h \ + draw.h error.h find.h heap.h rtree.h misc.h \ + ../src_plugins/autoroute/mtspace.h vector.h mymem.h polygon.h rats.h \ + remove.h thermal.h undo.h pcb-printf.h +../src_plugins/autoroute/mtspace.o: ../src_plugins/autoroute/mtspace.c \ + ../config.h ../config.manual.h ../config.auto.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h box.h \ + global.h misc.h ds.h mymem.h heap.h rtree.h \ + ../src_plugins/autoroute/mtspace.h vector.h +../src_plugins/autoroute/action.o: ../src_plugins/autoroute/action.c \ + ../config.h ../config.manual.h ../config.auto.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h \ + ../src_plugins/autoroute/autoroute.h dolists.h +../src_plugins/vendordrill/vendor.o: ../src_plugins/vendordrill/vendor.c \ + ../config.h ../config.manual.h ../config.auto.h change.h global.h \ + const.h ../globalconst.h ../config.h macro.h hid.h polyarea.h \ + libpcb_fp.h data.h draw.h error.h global.h resource.h set.h undo.h \ + ../src_plugins/vendordrill/vendor.h stub_vendor.h dolists.h +../src_plugins/puller/puller.o: ../src_plugins/puller/puller.c \ + ../config.h ../config.manual.h ../config.auto.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h \ + create.h global.h data.h draw.h misc.h ds.h mymem.h move.h pcb-printf.h \ + remove.h rtree.h strflags.h undo.h dolists.h +../src_plugins/edif/edif.o: ../src_plugins/edif/edif.c global.h \ + ../config.h ../config.manual.h ../config.auto.h const.h ../globalconst.h \ + ../config.h macro.h hid.h polyarea.h libpcb_fp.h data.h global.h \ + stub_edif.h +../src_plugins/djopt/djopt.o: ../src_plugins/djopt/djopt.c ../config.h \ + ../config.manual.h ../config.auto.h global.h const.h ../globalconst.h \ + ../config.h macro.h hid.h polyarea.h libpcb_fp.h data.h global.h \ + create.h remove.h move.h draw.h undo.h strflags.h find.h pcb-printf.h \ + dolists.h +../src_plugins/stroke/stroke.o: ../src_plugins/stroke/stroke.c \ + ../config.h ../config.manual.h ../config.auto.h global.h const.h \ + ../globalconst.h ../config.h macro.h hid.h polyarea.h libpcb_fp.h data.h \ + global.h crosshair.h stub_stroke.h rotate.h undo.h set.h error.h misc.h \ + ds.h mymem.h Index: 1.0.8/src/Makefile.in =================================================================== --- 1.0.8/src/Makefile.in (nonexistent) +++ 1.0.8/src/Makefile.in (revision 1136) @@ -0,0 +1,333 @@ +# lpr bom gcode gerber nelma png ps + + +# TODO default compiler flags +put /local/pcb/CFLAGS cc/rdynamic +append /local/pcb/CFLAGS cc/cflags +append /local/pcb/CFLAGS {-I. -I.. -I../src_3rd -Iicons -DHAVE_CONFIG_H -g -DNDEBUG} +append /local/pcb/LDFLAGS cc/ldflags +append /local/pcb/LDFLAGS cc/rdynamic +put /local/pcb/DEPCFLAGS {} + + +# main: objects +put /local/pcb/OBJS [@ + action.o + action_funchash.o + buffer.o + change.o + change_act.o + clip.o + command.o + compat.o + copy.o + create.o + crosshair.o + data.o + draw.o + drill.o + error.o + event.o + file.o + file_act.o + find.o + find_act.o + flags.o + fontmode.o + free_atexit.o + gui_act.o + heap.o + insert.o + intersect.o + line.o + lrealpath.o + main.o + mirror.o + misc.o + move.o + mymem.o + netlist.o + object_act.o + paths.o + pcb-printf.o + plugins.o + polygon.o + polygon1.o + polygon_act.o + print.o + rats.o + rats_act.o + rats_patch.o + remove.o + remove_act.o + report.o + rotate.o + rtree.o + rubberband.o + search.o + select.o + select_act.o + set.o + strflags.o + stub_edif.o + stub_mincut.o + stub_stroke.o + stub_vendor.o + thermal.o + undo.o + undo_act.o + vector.o + hid/common/actions.o + hid/common/flags.o + hid/common/hidinit.o + hid/common/hidnogui.o + hid/common/extents.o + hid/common/draw_helpers.o + hid/common/hid_resource.o + res_parse.o + res_lex.o + portability.o + ds.o + libpcb_fp.o + parse_y.o + parse_l.o + buildin.o + ../src_3rd/genht/hash.o + ../src_3rd/genht/htsp.o +@] + +# main: language generator files +put /local/pcb/YACC {res_parse parse_y} +put /local/pcb/LEX {res_lex parse_l} + +# main: action registrations +put /local/pcb/ACTION_REG_SRC { + action.c buffer.c change_act.c command.c file_act.c find_act.c + flags.c gui_act.c main.c misc.c move.c netlist.c + object_act.c plugins.c polygon_act.c rats_act.c rats_patch.c + remove_act.c report.c select_act.c undo_act.c +} + +#---- modules ----# +# extra rules for modules +put /local/pcb/RULES {} +put /local/pcb/CLEANFILES {} +put /local/pcb/CLEANRULES {} +put /local/pcb/EXEDEPS {} +put /local/pcb/all {} +put /local/pcb/buildin_init {} +put /local/pcb/rules/install_ {} +put /local/pcb/rules/install {} +put /local/pcb/rules/linstall {} +put /local/pcb/rules/uninstall {} + + + +include {Makefile.in.mod/gtk-gdk} +include {Makefile.in.mod/lesstif} +include {Makefile.in.mod/batch} +include {Makefile.in.mod/bom} +include {Makefile.in.mod/ps} +include {Makefile.in.mod/png} +include {Makefile.in.mod/gerber} +include {Makefile.in.mod/gcode} +include {Makefile.in.mod/nelma} +include {Makefile.in.mod/lpr} + +include {../src_plugins/autoplace/Plug.tmpasm} +include {../src_plugins/autoroute/Plug.tmpasm} +include {../src_plugins/vendordrill/Plug.tmpasm} +include {../src_plugins/puller/Plug.tmpasm} +include {../src_plugins/edif/Plug.tmpasm} +include {../src_plugins/djopt/Plug.tmpasm} +include {../src_plugins/mincut/Plug.tmpasm} +include {../src_plugins/gpmi/Plug.tmpasm} +include {../src_plugins/toporouter/Plug.tmpasm} +include {../src_plugins/oldactions/Plug.tmpasm} +include {../src_plugins/renumber/Plug.tmpasm} +include {../src_plugins/stroke/Plug.tmpasm} +include {../src_plugins/import_sch/Plug.tmpasm} + +append /local/pcb/CFLAGS /target/libs/sul/glib/cflags +append /local/pcb/LIBS /target/libs/sul/glib/ldflags + +# ---- logic ---- + +# Clean up variables +put /tmpasm/OFS { } +uniq /local/pcb/OBJS +uniq /local/pcb/CFLAGS +uniq /local/pcb/LDFLAGS +uniq /local/pcb/LIBS +uniq /local/pcb/HIDS +uniq /local/pcb/ACTION_REG_SRC +put /local/pcb/SRCS /local/pcb/OBJS +gsub /local/pcb/SRCS {.o } {.c } + +# Makefile, static +print [@ +# *** DO NOT EDIT THIS FILE *** +# This file has been generated from Makefile.in by configure +# *** DO NOT EDIT THIS FILE *** + +# plugin source +PLUGDIR=../src_plugins + +# plugin source install - so that pcb-rnd runs from source properly +PLUGIDIR=plugins + +@/local/pcb/TOPVARS@ +OBJS=@/local/pcb/OBJS@ +SRCS=@/local/pcb/SRCS@ +CFLAGS=@/local/pcb/CFLAGS@ +LDFLAGS=@/local/pcb/LDFLAGS@ +LIBS=@/local/pcb/LIBS@ -lm -ldl +HIDLIST=@/local/pcb/HIDS@ +EXEDEPS=@/local/pcb/EXEDEPS@ +CLEANFILES=@/local/pcb/CLEANFILES@ +CLEANRULES=@/local/pcb/CLEANRULES@ +CC=@cc/cc@ + +all: pcb-rnd @/local/pcb/all@ + +pcb-rnd: $(OBJS) $(EXEDEPS) + $(CC) $(LDFLAGS) $(OBJS) -o pcb-rnd $(LIBS) +@] + +# explicit rules: .y -> .c +# do not assume old yacc to work to different file names, do the generation +# in a separate directory to allow parallel compilation with -j +foreach /local/n in /local/pcb/YACC +print [@ +@/local/n@.c @/local/n@.h: @/local/n@.y + mkdir tmp.@/local/n@.y + cp @/local/n@.y tmp.@/local/n@.y + cd tmp.@/local/n@.y && bison -d @/local/n@.y + mv tmp.@/local/n@.y/@/local/n@.tab.h @/local/n@.h + mv tmp.@/local/n@.y/@/local/n@.tab.c @/local/n@.c + -mv tmp.@/local/n@.y/@/local/n@.output @/local/n@.output + rm -rf tmp.@/local/n@.y +@] +end + +# explicit rules: .l -> .c +# do not assume old lex to work to different file names, do the generation +# in a separate directory to allow parallel compilation with -j +foreach /local/n in /local/pcb/LEX +print [@ +@/local/n@.c: @/local/n@.l + mkdir tmp.@/local/n@.l + cp @/local/n@.l tmp.@/local/n@.l + cd tmp.@/local/n@.l && flex @/local/n@.l + mv tmp.@/local/n@.l/lex.yy.c @/local/n@.c + rm -rf tmp.@/local/n@.l +@] +end + + +print [@ +##### module rules begin ##### + +@/local/pcb/RULES@ + +##### module rules end ##### + +pcblib_DATA= \ + default_font \ + default.pcb \ + gpcb-menu.res \ + pcb-menu.res + + +EXTRA_DIST= \ + check_icon.data \ + default_font \ + default.pcb \ + hid/batch/hid.conf \ + hid/bom/hid.conf \ + hid/gcode/hid.conf \ + hid/gerber/hid.conf \ + hid/gtk/gui-icons-misc.data \ + hid/gtk/gui-icons-mode-buttons.data \ + hid/gtk/hid.conf \ + hid/gtk/pcb.rc \ + hid/lesstif/hid.conf \ + hid/lpr/hid.conf \ + hid/png/hid.conf \ + hid/nelma/hid.conf \ + hid/ps/hid.conf \ + pcbtest.sh.in + + +all-local: pcbtest.sh + +pcb-menu.h: pcb-menu.res + echo '/* AUTOMATICALLY GENERATED FROM pcb-menu.res DO NOT EDIT */' > pcb-menu.h + echo 'const char *pcb_menu_default[] = {' >> pcb-menu.h + sed 's/\\/\\\\/g; s/"/\\"/g; s/^/"/; s/$$/",/' < pcb-menu.res >> pcb-menu.h + echo '0};' >> pcb-menu.h + +gpcb-menu.h: gpcb-menu.res + echo '/* AUTOMATICALLY GENERATED FROM gpcb-menu.res DO NOT EDIT */' > gpcb-menu.h + echo 'const char *gpcb_menu_default[] = {' >> gpcb-menu.h + sed 's/\\/\\\\/g; s/"/\\"/g; s/^/"/; s/$$/",/' < gpcb-menu.res >> gpcb-menu.h + echo '0};' >> gpcb-menu.h + +action_list.h: @/local/pcb/ACTION_REG_SRC@ Makefile + Makefile.in.mod/gen_core_lists.sh @/local/pcb/ACTION_REG_SRC@ > action_list.h + +FORCE: + + +DISTCLEANFILES= pcbtest.sh gpcb-menu.h pcb-menu.h \ + hid/batch/batch_lists.h \ + hid/common/hidlist.h \ + hid/gtk/gtk_lists.h \ + hid/lesstif/lesstif_lists.h \ + hid/png/png_lists.h \ + hid/gcode/gcode_lists.h \ + hid/nelma/nelma_lists.h \ + hid/ps/ps_lists.h \ + core_lists.h \ + gpcb-menu.res \ + pcb-menu.res + +clean: $(CLEANRULES) + -rm pcb-rnd $(OBJS) $(CLEANFILES) + +include ../Makefile.conf + +install_: + $(MKDIR) $(BINDIR) $(DATADIR) $(LIBDIR) + $(CPC) "`pwd`/pcb-rnd" "$(BINDIR)/pcb-rnd" + $(CPC) "`pwd`/default.pcb" "$(DATADIR)/default.pcb" + $(CPC) "`pwd`/default_font" "$(DATADIR)/default_font" + $(CPC) "`pwd`/gpcb-menu.res" "$(DATADIR)/gpcb-menu.res" + $(CPC) "`pwd`/pcb-menu.res" "$(DATADIR)/pcb-menu.res"@/local/pcb/rules/install_@ + +install: + make install_ CPC="$(CP)"@/local/pcb/rules/install@ + +linstall: + make install_ CPC="$(LN)"@/local/pcb/rules/linstall@ + + +uninstall: + $(RM) $(BINDIR)/pcb-rnd + $(RM) $(DATADIR)/default.pcb + $(RM) $(DATADIR)/default_font + $(RM) $(DATADIR)/gpcb-menu.res + $(RM) $(DATADIR)/pcb-menu.res@/local/pcb/rules/uninstall@ +@] + +# generate explicit rules for .c -> .o +put /local/comp/OBJS /local/pcb/OBJS +include {../scconfig/Makefile.comp.inc} + +# generate deps +put /local/dep/CFLAGS /local/pcb/CFLAGS +put /local/dep/SRCS /local/pcb/SRCS + +gsub /local/pcb/DEPSRCS {.o } {.c } +append /local/dep/SRCS /local/pcb/DEPSRCS +include {../scconfig/Makefile.dep.inc} Index: 1.0.8/src/Makefile.in.mod/Buildin =================================================================== --- 1.0.8/src/Makefile.in.mod/Buildin (nonexistent) +++ 1.0.8/src/Makefile.in.mod/Buildin (revision 1136) @@ -0,0 +1,12 @@ +# tmpasm script for compiling a plugin_src/ module as a buildin +# Requires variables before the include: +# /local/pcb/mod basename of the module (e.g. autoplace) +# /local/pcb/mod/OBJS full path of all object files + +append /local/pcb/buildin_init [@ extern void hid_@/local/pcb/mod@_init(); hid_@/local/pcb/mod@_init(); plugin_register("@/local/pcb/mod@", "<@/local/pcb/mod@>", NULL, 0); @] +append /local/pcb/OBJS /local/pcb/mod/OBJS +append /local/pcb/RULES [@ + +mod_@/local/pcb/mod@: all + +@] Index: 1.0.8/src/Makefile.in.mod/Disable =================================================================== --- 1.0.8/src/Makefile.in.mod/Disable (nonexistent) +++ 1.0.8/src/Makefile.in.mod/Disable (revision 1136) @@ -0,0 +1,7 @@ +# tmpasm script for disable a plugin_src/ module +# Requires variables before the include: +# /local/pcb/mod/OBJS full path of all object files + +# append all objects to the source list used only for dependencies +# NOTE: .o suffixes will be replaced with .c before generating the dep +append /local/pcb/DEPSRCS /local/pcb/mod/OBJS Index: 1.0.8/src/Makefile.in.mod/Plugin =================================================================== --- 1.0.8/src/Makefile.in.mod/Plugin (nonexistent) +++ 1.0.8/src/Makefile.in.mod/Plugin (revision 1136) @@ -0,0 +1,23 @@ +# tmpasm script for compiling a plugin_src/ module as a plugin +# Requires variables before the include: +# /local/pcb/mod basename of the module (e.g. autoplace) +# /local/pcb/mod/OBJS full path of all object files + +append /local/pcb/all [@ $(PLUGIDIR)/@/local/pcb/mod@.so @] + +append /local/pcb/rules/install_ [@ + $(CPC) "`pwd`/$(PLUGDIR)/@/local/pcb/mod@/@/local/pcb/mod@.so" "$(LIBDIR)/plugins/@/local/pcb/mod@.so"@] + +append /local/pcb/RULES [@ + +$(PLUGDIR)/@/local/pcb/mod@/@/local/pcb/mod@.so: @/local/pcb/mod/OBJS@ + $(CC) $(LDFLAGS) -shared @cc/rdynamic@ -o $(PLUGDIR)/@/local/pcb/mod@/@/local/pcb/mod@.so @/local/pcb/mod/OBJS@ + +mod_@/local/pcb/mod@: $(PLUGIDIR)/@/local/pcb/mod@.so + + +$(PLUGIDIR)/@/local/pcb/mod@.so: $(PLUGDIR)/@/local/pcb/mod@/@/local/pcb/mod@.so + $(MKDIR) $(PLUGIDIR) + $(CP) $(PLUGDIR)/@/local/pcb/mod@/@/local/pcb/mod@.so $(PLUGIDIR)/@/local/pcb/mod@.so + +@] Index: 1.0.8/src/Makefile.in.mod/batch =================================================================== --- 1.0.8/src/Makefile.in.mod/batch (nonexistent) +++ 1.0.8/src/Makefile.in.mod/batch (revision 1136) @@ -0,0 +1,4 @@ +append /local/pcb/HIDS {batch} +append /local/pcb/CFLAGS {-I./hid/batch} +append /local/pcb/OBJS {hid/batch/batch.o} +append /local/pcb/ACTION_REG_SRC {hid/batch/batch.c hid/batch/hid.conf} Index: 1.0.8/src/Makefile.in.mod/bom =================================================================== --- 1.0.8/src/Makefile.in.mod/bom (nonexistent) +++ 1.0.8/src/Makefile.in.mod/bom (revision 1136) @@ -0,0 +1,2 @@ +append /local/pcb/HIDS {bom} +append /local/pcb/OBJS {hid/bom/bom.o} Index: 1.0.8/src/Makefile.in.mod/gcode =================================================================== --- 1.0.8/src/Makefile.in.mod/gcode (nonexistent) +++ 1.0.8/src/Makefile.in.mod/gcode (revision 1136) @@ -0,0 +1,14 @@ +if /target/libs/gui/gd/presents then + +append /local/pcb/HIDS {gcode} +append /local/pcb/CFLAGS {-I./hid/gcode} +append /local/pcb/OBJS [@ + hid/gcode/gcode.o + hid/gcode/decompose.o + hid/gcode/trace.o + hid/gcode/curve.o +@] + +append /local/pcb/ACTION_REG_SRC {hid/gcode/gcode.c hid/gcode/hid.conf} + +end Index: 1.0.8/src/Makefile.in.mod/gen_core_lists.sh =================================================================== --- 1.0.8/src/Makefile.in.mod/gen_core_lists.sh (nonexistent) +++ 1.0.8/src/Makefile.in.mod/gen_core_lists.sh (revision 1136) @@ -0,0 +1,54 @@ +#!/bin/sh +for f in $* +do + echo "___name___ $f" + cat $f +done | awk ' +BEGIN { + q = "\"" +} + +/^___name___/ { + fullname = $2 + basename = $2 + sub("/[^/]*$", "", basename) + if (fullname ~ "src_plugins/") + TYPE[basename]="plugdir" +} + +/^type=/ { + type = $0 + sub("^type=", "", type) + TYPE[basename] = type + print "/* ", type, basename " */" +} + + +/^REGISTER/ { + LIST[basename] = LIST[basename] $0 "\n" +} + +END { + for(n in LIST) { + hn = n + sub("^hid/", "", hn) +# if (hn in HIDNAME_FIXUP) +# hn = HIDNAME_FIXUP[hn] + + print "/* " n " (" TYPE[n] ") */" + if (TYPE[n] == "gui") + print "if ((gui != NULL) && (strcmp(gui->name, " q hn q ") == 0)) {" + if (TYPE[n] == "plugdir") { + vname = LIST[n] + sub("REGISTER_ACTIONS.*[(]", "", vname) + sub("[)].*[\n\r]*", "", vname) + print "extern HID_Action " vname "[];" + } + print LIST[n] + if (TYPE[n] == "gui") + print "}" + } +} + +' + Property changes on: 1.0.8/src/Makefile.in.mod/gen_core_lists.sh ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: 1.0.8/src/Makefile.in.mod/gerber =================================================================== --- 1.0.8/src/Makefile.in.mod/gerber (nonexistent) +++ 1.0.8/src/Makefile.in.mod/gerber (revision 1136) @@ -0,0 +1,3 @@ +append /local/pcb/HIDS {gerber} +append /local/pcb/OBJS {hid/gerber/gerber.o} + Index: 1.0.8/src/Makefile.in.mod/gl =================================================================== --- 1.0.8/src/Makefile.in.mod/gl (nonexistent) +++ 1.0.8/src/Makefile.in.mod/gl (revision 1136) @@ -0,0 +1,6 @@ +#LIBGTK_GL_SRCS= \ +# hid/gtk/gtkhid-gl.c + +#GL_SRCS= \ +# hid/common/hidgl.c \ +# hid/common/hidgl.h Index: 1.0.8/src/Makefile.in.mod/gtk-gdk =================================================================== --- 1.0.8/src/Makefile.in.mod/gtk-gdk (nonexistent) +++ 1.0.8/src/Makefile.in.mod/gtk-gdk (revision 1136) @@ -0,0 +1,52 @@ +# gtk option +if /target/libs/gui/gtk2/presents then +append /local/pcb/HIDS {gtk} +append /local/pcb/CFLAGS {-I./hid/gtk} +append /local/pcb/CFLAGS /target/libs/gui/gtk2/cflags +append /local/pcb/LIBS /target/libs/gui/gtk2/ldflags +append /local/pcb/OBJS [@ + hid/gtk/ghid-cell-renderer-visibility.o + hid/gtk/ghid-coord-entry.o + hid/gtk/ghid-layer-selector.o + hid/gtk/ghid-main-menu.o + hid/gtk/ghid-route-style-selector.o + hid/gtk/gtkhid-main.o + hid/gtk/gui-command-window.o + hid/gtk/gui-config.o + hid/gtk/gui-dialog-print.o + hid/gtk/gui-dialog.o + hid/gtk/gui-drc-window.o + hid/gtk/gui-keyref-window.o + hid/gtk/gui-library-window.o + hid/gtk/gui-log-window.o + hid/gtk/gui-misc.o + hid/gtk/gui-netlist-window.o + hid/gtk/gui-output-events.o + hid/gtk/gui-pinout-preview.o + hid/gtk/gui-pinout-window.o + hid/gtk/gui-top-window.o + hid/gtk/gui-utils.o + hid/gtk/gtkhid-gdk.o +@] + +append /local/pcb/ACTION_REG_SRC [@ + hid/gtk/gui-top-window.c + hid/gtk/gui-netlist-window.c + hid/gtk/gui-log-window.c + hid/gtk/gtkhid-main.c + hid/gtk/hid.conf +@] + +append /local/pcb/RULES [@ + +### gtk-gdk + +hid/gtk/gtk_lists.h: $(LIBGTK_SRCS) Makefile + $(MKDIR_P) hid/gtk + true > hid/gtk/gtk_lists.h + (for f in $(LIBGTK_SRCS) ; do cat $$f ; done) | grep "^REGISTER" > hid/gtk/gtk_lists.h.tmp + mv hid/gtk/gtk_lists.h.tmp hid/gtk/gtk_lists.h + +@] + +end Index: 1.0.8/src/Makefile.in.mod/lesstif =================================================================== --- 1.0.8/src/Makefile.in.mod/lesstif (nonexistent) +++ 1.0.8/src/Makefile.in.mod/lesstif (revision 1136) @@ -0,0 +1,37 @@ +# lesstif2 options +if /target/libs/gui/lesstif2/presents then + +append /local/pcb/HIDS {lesstif} + +append /local/pcb/CFLAGS [@ + -I./hid/lesstif + @/target/libs/gui/lesstif2/cflags@ + @/target/libs/gui/xinerama/cflags@ + @/target/libs/gui/xrender/cflags@ +@] + +append /local/pcb/LIBS [@ + @/target/libs/gui/lesstif2/ldflags@ + @/target/libs/gui/xinerama/ldflags@ + @/target/libs/gui/xrender/ldflags@ +@] + +append /local/pcb/OBJS [@ + hid/lesstif/dialogs.o + hid/lesstif/library.o + hid/lesstif/main.o + hid/lesstif/menu.o + hid/lesstif/netlist.o + hid/lesstif/styles.o +@] + +append /local/pcb/ACTION_REG_SRC [@ + hid/lesstif/library.c + hid/lesstif/menu.c + hid/lesstif/main.c + hid/lesstif/styles.c + hid/lesstif/dialogs.c + hid/lesstif/netlist.c + hid/lesstif/hid.conf +@] +end Index: 1.0.8/src/Makefile.in.mod/lpr =================================================================== --- 1.0.8/src/Makefile.in.mod/lpr (nonexistent) +++ 1.0.8/src/Makefile.in.mod/lpr (revision 1136) @@ -0,0 +1,4 @@ +append /local/pcb/HIDS {lpr} +append /local/pcb/OBJS {hid/lpr/lpr.o} + + Index: 1.0.8/src/Makefile.in.mod/nelma =================================================================== --- 1.0.8/src/Makefile.in.mod/nelma (nonexistent) +++ 1.0.8/src/Makefile.in.mod/nelma (revision 1136) @@ -0,0 +1,7 @@ +if /target/libs/gui/gd/presents then +append /local/pcb/HIDS {nelma} +append /local/pcb/CFLAGS {-I./hid/nelma} +append /local/pcb/OBJS {hid/nelma/nelma.o} +append /local/pcb/ACTION_REG_SRC {hid/nelma/nelma.c hid/nelma/hid.conf} +end + Index: 1.0.8/src/Makefile.in.mod/png =================================================================== --- 1.0.8/src/Makefile.in.mod/png (nonexistent) +++ 1.0.8/src/Makefile.in.mod/png (revision 1136) @@ -0,0 +1,8 @@ +if /target/libs/gui/gd/presents then +append /local/pcb/HIDS {png} +append /local/pcb/CFLAGS {-I./hid/png} +append /local/pcb/LIBS libs/gui/gd/cflags +append /local/pcb/OBJS {hid/png/png.o} +append /local/pcb/LIBS libs/gui/gd/ldflags +append /local/pcb/ACTION_REG_SRC {hid/png/png.c hid/png/hid.conf} +end Index: 1.0.8/src/Makefile.in.mod/ps =================================================================== --- 1.0.8/src/Makefile.in.mod/ps (nonexistent) +++ 1.0.8/src/Makefile.in.mod/ps (revision 1136) @@ -0,0 +1,14 @@ +append /local/pcb/HIDS {ps} +append /local/pcb/CFLAGS {-I./hid/ps} +append /local/pcb/OBJS [@ + hid/ps/ps.o + hid/ps/eps.o +@] + +append /local/pcb/ACTION_REG_SRC [@ + hid/ps/ps.c + hid/ps/eps.c + hid/ps/hid.conf +@] + + Index: 1.0.8/src/Makefile.in.mod/win32 =================================================================== --- 1.0.8/src/Makefile.in.mod/win32 (nonexistent) +++ 1.0.8/src/Makefile.in.mod/win32 (revision 1136) @@ -0,0 +1,14 @@ +# We are building on win32; compile in some icons for the +# desktop and application toolbar + +append /local/pcb/OBJS {pcb_icon.o} + +append /local/pcb/RULES [@ +# win32 +pcb_icon.o : pcb_icon.ico $(srcdir)/hid/gtk/pcb.rc + $(WINDRES) $(srcdir)/hid/gtk/pcb.rc $@ + +pcb_icon.ico: $(top_srcdir)/data/pcb_icon.ico + cp $(top_srcdir)/data/pcb_icon.ico $@ + +@] \ No newline at end of file Index: 1.0.8/src/action.c =================================================================== --- 1.0.8/src/action.c (nonexistent) +++ 1.0.8/src/action.c (revision 1136) @@ -0,0 +1,1278 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact addresses for paper mail and Email: + * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA + * haceaton@aplcomm.jhuapl.edu + * + */ + +/* action routines for output window + */ + +#include "config.h" + +#include "global.h" + +#include "action.h" +#include "buffer.h" +#include "change.h" +#include "copy.h" +#include "create.h" +#include "crosshair.h" +#include "data.h" +#include "draw.h" +#include "error.h" +#include "find.h" +#include "insert.h" +#include "line.h" +#include "misc.h" +#include "move.h" +#include "polygon.h" +#include "rats.h" +#include "remove.h" +#include "rotate.h" +#include "rubberband.h" +#include "search.h" +#include "select.h" +#include "set.h" +#include "undo.h" +#include "rtree.h" +#include "stub_stroke.h" + + +/* --------------------------------------------------------------------------- */ + +/* %start-doc actions 00delta + +Many actions take a @code{delta} parameter as the last parameter, +which is an amount to change something. That @code{delta} may include +units, as an additional parameter, such as @code{Action(Object,5,mm)}. +If no units are specified, the default is PCB's native units +(currently 1/100 mil). Also, if the delta is prefixed by @code{+} or +@code{-}, the size is increased or decreased by that amount. +Otherwise, the size size is set to the given amount. + +@example +Action(Object,5,mil) +Action(Object,+0.5,mm) +Action(Object,-1) +@end example + +Actions which take a @code{delta} parameter which do not accept all +these options will specify what they do take. + +%end-doc */ + +/* %start-doc actions 00objects + +Many actions act on indicated objects on the board. They will have +parameters like @code{ToggleObject} or @code{SelectedVias} to indicate +what group of objects they act on. Unless otherwise specified, these +parameters are defined as follows: + +@table @code + +@item Object +@itemx ToggleObject +Affects the object under the mouse pointer. If this action is invoked +from a menu or script, the user will be prompted to click on an +object, which is then the object affected. + +@item Selected +@itemx SelectedObjects + +Affects all objects which are currently selected. At least, all +selected objects for which the given action makes sense. + +@item SelectedPins +@itemx SelectedVias +@itemx Selected@var{Type} +@itemx @i{etc} +Affects all objects which are both selected and of the @var{Type} specified. + +@end table + +%end-doc */ + +/* %start-doc actions 00macros + +@macro pinshapes + +Pins, pads, and vias can have various shapes. All may be round. Pins +and pads may be square (obviously "square" pads are usually +rectangular). Pins and vias may be octagonal. When you change a +shape flag of an element, you actually change all of its pins and +pads. + +Note that the square flag takes precedence over the octagon flag, +thus, if both the square and octagon flags are set, the object is +square. When the square flag is cleared, the pins and pads will be +either round or, if the octagon flag is set, octagonal. + +@end macro + +%end-doc */ + +/* --------------------------------------------------------------------------- + * some local identifiers + */ +static PointType InsertedPoint; +LayerTypePtr lastLayer; +static struct { + PolygonTypePtr poly; + LineType line; +} fake; + +action_note_t Note; +int defer_updates = 0; +int defer_needs_update = 0; + + +static Cardinal polyIndex = 0; +bool saved_mode = false; + +/* --------------------------------------------------------------------------- + * some local routines + */ +static void AdjustAttachedBox(void); +/* --------------------------------------------------------------------------- + * Clear warning color from pins/pads + */ +void ClearWarnings() +{ + Settings.RatWarn = false; + ALLPIN_LOOP(PCB->Data); + { + if (TEST_FLAG(WARNFLAG, pin)) { + CLEAR_FLAG(WARNFLAG, pin); + DrawPin(pin); + } + } + ENDALL_LOOP; + VIA_LOOP(PCB->Data); + { + if (TEST_FLAG(WARNFLAG, via)) { + CLEAR_FLAG(WARNFLAG, via); + DrawVia(via); + } + } + END_LOOP; + ALLPAD_LOOP(PCB->Data); + { + if (TEST_FLAG(WARNFLAG, pad)) { + CLEAR_FLAG(WARNFLAG, pad); + DrawPad(pad); + } + } + ENDALL_LOOP; + ALLLINE_LOOP(PCB->Data); + { + if (TEST_FLAG(WARNFLAG, line)) { + CLEAR_FLAG(WARNFLAG, line); + DrawLine(layer, line); + } + } + ENDALL_LOOP; + ALLARC_LOOP(PCB->Data); + { + if (TEST_FLAG(WARNFLAG, arc)) { + CLEAR_FLAG(WARNFLAG, arc); + DrawArc(layer, arc); + } + } + ENDALL_LOOP; + ALLPOLYGON_LOOP(PCB->Data); + { + if (TEST_FLAG(WARNFLAG, polygon)) { + CLEAR_FLAG(WARNFLAG, polygon); + DrawPolygon(layer, polygon); + } + } + ENDALL_LOOP; + + Draw(); +} + +static void click_cb(hidval hv) +{ + if (Note.Click) { + notify_crosshair_change(false); + Note.Click = false; + if (Note.Moving && !gui->shift_is_pressed()) { + Note.Buffer = Settings.BufferNumber; + SetBufferNumber(MAX_BUFFER - 1); + ClearBuffer(PASTEBUFFER); + AddSelectedToBuffer(PASTEBUFFER, Note.X, Note.Y, true); + SaveUndoSerialNumber(); + RemoveSelected(); + SaveMode(); + saved_mode = true; + SetMode(PASTEBUFFER_MODE); + } + else if (Note.Hit && !gui->shift_is_pressed()) { + BoxType box; + + SaveMode(); + saved_mode = true; + SetMode(gui->control_is_pressed()? COPY_MODE : MOVE_MODE); + Crosshair.AttachedObject.Ptr1 = Note.ptr1; + Crosshair.AttachedObject.Ptr2 = Note.ptr2; + Crosshair.AttachedObject.Ptr3 = Note.ptr3; + Crosshair.AttachedObject.Type = Note.Hit; + + if (Crosshair.drags != NULL) { + free(Crosshair.drags); + Crosshair.drags = NULL; + } + Crosshair.dragx = Note.X; + Crosshair.dragy = Note.Y; + box.X1 = Note.X + SLOP * pixel_slop; + box.X2 = Note.X - SLOP * pixel_slop; + box.Y1 = Note.Y + SLOP * pixel_slop; + box.Y2 = Note.Y - SLOP * pixel_slop; + Crosshair.drags = ListBlock(&box, &Crosshair.drags_len); + Crosshair.drags_current = 0; + AttachForCopy(Note.X, Note.Y); + } + else { + BoxType box; + + Note.Hit = 0; + Note.Moving = false; + SaveUndoSerialNumber(); + box.X1 = -MAX_COORD; + box.Y1 = -MAX_COORD; + box.X2 = MAX_COORD; + box.Y2 = MAX_COORD; + /* unselect first if shift key not down */ + if (!gui->shift_is_pressed() && SelectBlock(&box, false)) + SetChangedFlag(true); + NotifyBlock(); + Crosshair.AttachedBox.Point1.X = Note.X; + Crosshair.AttachedBox.Point1.Y = Note.Y; + } + notify_crosshair_change(true); + } +} + +void ReleaseMode(void) +{ + BoxType box; + + if (Note.Click) { + BoxType box; + + box.X1 = -MAX_COORD; + box.Y1 = -MAX_COORD; + box.X2 = MAX_COORD; + box.Y2 = MAX_COORD; + + Note.Click = false; /* inhibit timer action */ + SaveUndoSerialNumber(); + /* unselect first if shift key not down */ + if (!gui->shift_is_pressed()) { + if (SelectBlock(&box, false)) + SetChangedFlag(true); + if (Note.Moving) { + Note.Moving = 0; + Note.Hit = 0; + return; + } + } + RestoreUndoSerialNumber(); + if (SelectObject()) + SetChangedFlag(true); + Note.Hit = 0; + Note.Moving = 0; + } + else if (Note.Moving) { + RestoreUndoSerialNumber(); + NotifyMode(); + ClearBuffer(PASTEBUFFER); + SetBufferNumber(Note.Buffer); + Note.Moving = false; + Note.Hit = 0; + } + else if (Note.Hit) { + NotifyMode(); + Note.Hit = 0; + } + else if (Settings.Mode == ARROW_MODE) { + box.X1 = Crosshair.AttachedBox.Point1.X; + box.Y1 = Crosshair.AttachedBox.Point1.Y; + box.X2 = Crosshair.AttachedBox.Point2.X; + box.Y2 = Crosshair.AttachedBox.Point2.Y; + + RestoreUndoSerialNumber(); + if (SelectBlock(&box, true)) + SetChangedFlag(true); + else if (Bumped) + IncrementUndoSerialNumber(); + Crosshair.AttachedBox.State = STATE_FIRST; + } + if (saved_mode) + RestoreMode(); + saved_mode = false; +} + +/* --------------------------------------------------------------------------- + * set new coordinates if in 'RECTANGLE' mode + * the cursor shape is also adjusted + */ +static void AdjustAttachedBox(void) +{ + if (Settings.Mode == ARC_MODE) { + Crosshair.AttachedBox.otherway = gui->shift_is_pressed(); + return; + } + switch (Crosshair.AttachedBox.State) { + case STATE_SECOND: /* one corner is selected */ + { + /* update coordinates */ + Crosshair.AttachedBox.Point2.X = Crosshair.X; + Crosshair.AttachedBox.Point2.Y = Crosshair.Y; + break; + } + } +} + +/* --------------------------------------------------------------------------- + * adjusts the objects which are to be created like attached lines... + */ +void AdjustAttachedObjects(void) +{ + PointTypePtr pnt; + switch (Settings.Mode) { + /* update at least an attached block (selection) */ + case NO_MODE: + case ARROW_MODE: + if (Crosshair.AttachedBox.State) { + Crosshair.AttachedBox.Point2.X = Crosshair.X; + Crosshair.AttachedBox.Point2.Y = Crosshair.Y; + } + break; + + /* rectangle creation mode */ + case RECTANGLE_MODE: + case ARC_MODE: + AdjustAttachedBox(); + break; + + /* polygon creation mode */ + case POLYGON_MODE: + case POLYGONHOLE_MODE: + AdjustAttachedLine(); + break; + /* line creation mode */ + case LINE_MODE: + if (PCB->RatDraw || PCB->Clipping == 0) + AdjustAttachedLine(); + else + AdjustTwoLine(PCB->Clipping - 1); + break; + /* point insertion mode */ + case INSERTPOINT_MODE: + pnt = AdjustInsertPoint(); + if (pnt) + InsertedPoint = *pnt; + break; + case ROTATE_MODE: + break; + } +} + +/* --------------------------------------------------------------------------- + * creates points of a line + */ +void NotifyLine(void) +{ + int type = NO_TYPE; + void *ptr1, *ptr2, *ptr3; + + if (!Marked.status || TEST_FLAG(LOCALREFFLAG, PCB)) + SetLocalRef(Crosshair.X, Crosshair.Y, true); + switch (Crosshair.AttachedLine.State) { + case STATE_FIRST: /* first point */ + if (PCB->RatDraw && SearchScreen(Crosshair.X, Crosshair.Y, PAD_TYPE | PIN_TYPE, &ptr1, &ptr1, &ptr1) == NO_TYPE) { + gui->beep(); + break; + } + if (TEST_FLAG(AUTODRCFLAG, PCB) && Settings.Mode == LINE_MODE) { + type = SearchScreen(Crosshair.X, Crosshair.Y, PIN_TYPE | PAD_TYPE | VIA_TYPE, &ptr1, &ptr2, &ptr3); + LookupConnection(Crosshair.X, Crosshair.Y, true, 1, FOUNDFLAG); + } + if (type == PIN_TYPE || type == VIA_TYPE) { + Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X = ((PinTypePtr) ptr2)->X; + Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y = ((PinTypePtr) ptr2)->Y; + } + else if (type == PAD_TYPE) { + PadTypePtr pad = (PadTypePtr) ptr2; + double d1 = Distance(Crosshair.X, Crosshair.Y, pad->Point1.X, pad->Point1.Y); + double d2 = Distance(Crosshair.X, Crosshair.Y, pad->Point2.X, pad->Point2.Y); + if (d2 < d1) { + Crosshair.AttachedLine.Point1 = Crosshair.AttachedLine.Point2 = pad->Point2; + } + else { + Crosshair.AttachedLine.Point1 = Crosshair.AttachedLine.Point2 = pad->Point1; + } + } + else { + Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X = Crosshair.X; + Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y = Crosshair.Y; + } + Crosshair.AttachedLine.State = STATE_SECOND; + break; + + case STATE_SECOND: + /* fall through to third state too */ + lastLayer = CURRENT; + default: /* all following points */ + Crosshair.AttachedLine.State = STATE_THIRD; + break; + } +} + +/* --------------------------------------------------------------------------- + * create first or second corner of a marked block + */ +void NotifyBlock(void) +{ + notify_crosshair_change(false); + switch (Crosshair.AttachedBox.State) { + case STATE_FIRST: /* setup first point */ + Crosshair.AttachedBox.Point1.X = Crosshair.AttachedBox.Point2.X = Crosshair.X; + Crosshair.AttachedBox.Point1.Y = Crosshair.AttachedBox.Point2.Y = Crosshair.Y; + Crosshair.AttachedBox.State = STATE_SECOND; + break; + + case STATE_SECOND: /* setup second point */ + Crosshair.AttachedBox.State = STATE_THIRD; + break; + } + notify_crosshair_change(true); +} + + +/* --------------------------------------------------------------------------- + * + * does what's appropriate for the current mode setting. This normally + * means creation of an object at the current crosshair location. + * + * new created objects are added to the create undo list of course + */ +void NotifyMode(void) +{ + void *ptr1, *ptr2, *ptr3; + int type; + + if (Settings.RatWarn) + ClearWarnings(); + switch (Settings.Mode) { + case ARROW_MODE: + { + int test; + hidval hv; + + Note.Click = true; + /* do something after click time */ + gui->add_timer(click_cb, CLICK_TIME, hv); + + /* see if we clicked on something already selected + * (Note.Moving) or clicked on a MOVE_TYPE + * (Note.Hit) + */ + for (test = (SELECT_TYPES | MOVE_TYPES) & ~RATLINE_TYPE; test; test &= ~type) { + type = SearchScreen(Note.X, Note.Y, test, &ptr1, &ptr2, &ptr3); + if (!Note.Hit && (type & MOVE_TYPES) && !TEST_FLAG(LOCKFLAG, (PinTypePtr) ptr2)) { + Note.Hit = type; + Note.ptr1 = ptr1; + Note.ptr2 = ptr2; + Note.ptr3 = ptr3; + } + if (!Note.Moving && (type & SELECT_TYPES) && TEST_FLAG(SELECTEDFLAG, (PinTypePtr) ptr2)) + Note.Moving = true; + if ((Note.Hit && Note.Moving) || type == NO_TYPE) + break; + } + break; + } + + case VIA_MODE: + { + PinTypePtr via; + + if (!PCB->ViaOn) { + Message(_("You must turn via visibility on before\n" "you can place vias\n")); + break; + } + if ((via = CreateNewVia(PCB->Data, Note.X, Note.Y, + Settings.ViaThickness, 2 * Settings.Keepaway, + 0, Settings.ViaDrillingHole, NULL, NoFlags())) != NULL) { + AddObjectToCreateUndoList(VIA_TYPE, via, via, via); + if (gui->shift_is_pressed()) + ChangeObjectThermal(VIA_TYPE, via, via, via, PCB->ThermStyle); + IncrementUndoSerialNumber(); + DrawVia(via); + Draw(); + } + break; + } + + case ARC_MODE: + { + switch (Crosshair.AttachedBox.State) { + case STATE_FIRST: + Crosshair.AttachedBox.Point1.X = Crosshair.AttachedBox.Point2.X = Note.X; + Crosshair.AttachedBox.Point1.Y = Crosshair.AttachedBox.Point2.Y = Note.Y; + Crosshair.AttachedBox.State = STATE_SECOND; + break; + + case STATE_SECOND: + case STATE_THIRD: + { + ArcTypePtr arc; + Coord wx, wy; + Angle sa, dir; + + wx = Note.X - Crosshair.AttachedBox.Point1.X; + wy = Note.Y - Crosshair.AttachedBox.Point1.Y; + if (XOR(Crosshair.AttachedBox.otherway, abs(wy) > abs(wx))) { + Crosshair.AttachedBox.Point2.X = Crosshair.AttachedBox.Point1.X + abs(wy) * SGNZ(wx); + sa = (wx >= 0) ? 0 : 180; +#ifdef ARC45 + if (abs(wy) / 2 >= abs(wx)) + dir = (SGNZ(wx) == SGNZ(wy)) ? 45 : -45; + else +#endif + dir = (SGNZ(wx) == SGNZ(wy)) ? 90 : -90; + } + else { + Crosshair.AttachedBox.Point2.Y = Crosshair.AttachedBox.Point1.Y + abs(wx) * SGNZ(wy); + sa = (wy >= 0) ? -90 : 90; +#ifdef ARC45 + if (abs(wx) / 2 >= abs(wy)) + dir = (SGNZ(wx) == SGNZ(wy)) ? -45 : 45; + else +#endif + dir = (SGNZ(wx) == SGNZ(wy)) ? -90 : 90; + wy = wx; + } + if (abs(wy) > 0 && (arc = CreateNewArcOnLayer(CURRENT, + Crosshair.AttachedBox.Point2.X, + Crosshair.AttachedBox.Point2.Y, + abs(wy), + abs(wy), + sa, + dir, + Settings.LineThickness, + 2 * Settings.Keepaway, + MakeFlags(TEST_FLAG(CLEARNEWFLAG, PCB) ? CLEARLINEFLAG : 0)))) { + BoxTypePtr bx; + + bx = GetArcEnds(arc); + Crosshair.AttachedBox.Point1.X = Crosshair.AttachedBox.Point2.X = bx->X2; + Crosshair.AttachedBox.Point1.Y = Crosshair.AttachedBox.Point2.Y = bx->Y2; + AddObjectToCreateUndoList(ARC_TYPE, CURRENT, arc, arc); + IncrementUndoSerialNumber(); + addedLines++; + DrawArc(CURRENT, arc); + Draw(); + Crosshair.AttachedBox.State = STATE_THIRD; + } + break; + } + } + break; + } + case LOCK_MODE: + { + type = SearchScreen(Note.X, Note.Y, LOCK_TYPES, &ptr1, &ptr2, &ptr3); + if (type == ELEMENT_TYPE) { + ElementTypePtr element = (ElementTypePtr) ptr2; + + TOGGLE_FLAG(LOCKFLAG, element); + PIN_LOOP(element); + { + TOGGLE_FLAG(LOCKFLAG, pin); + CLEAR_FLAG(SELECTEDFLAG, pin); + } + END_LOOP; + PAD_LOOP(element); + { + TOGGLE_FLAG(LOCKFLAG, pad); + CLEAR_FLAG(SELECTEDFLAG, pad); + } + END_LOOP; + CLEAR_FLAG(SELECTEDFLAG, element); + /* always re-draw it since I'm too lazy + * to tell if a selected flag changed + */ + DrawElement(element); + Draw(); + hid_actionl("Report", "Object", NULL); + } + else if (type != NO_TYPE) { + TextTypePtr thing = (TextTypePtr) ptr3; + TOGGLE_FLAG(LOCKFLAG, thing); + if (TEST_FLAG(LOCKFLAG, thing) + && TEST_FLAG(SELECTEDFLAG, thing)) { + /* this is not un-doable since LOCK isn't */ + CLEAR_FLAG(SELECTEDFLAG, thing); + DrawObject(type, ptr1, ptr2); + Draw(); + } + hid_actionl("Report", "Object", NULL); + } + break; + } + case THERMAL_MODE: + { + if (((type = SearchScreen(Note.X, Note.Y, PIN_TYPES, &ptr1, &ptr2, &ptr3)) != NO_TYPE) + && !TEST_FLAG(HOLEFLAG, (PinTypePtr) ptr3)) { + if (gui->shift_is_pressed()) { + int tstyle = GET_THERM(INDEXOFCURRENT, (PinTypePtr) ptr3); + tstyle++; + if (tstyle > 5) + tstyle = 1; + ChangeObjectThermal(type, ptr1, ptr2, ptr3, tstyle); + } + else if (GET_THERM(INDEXOFCURRENT, (PinTypePtr) ptr3)) + ChangeObjectThermal(type, ptr1, ptr2, ptr3, 0); + else + ChangeObjectThermal(type, ptr1, ptr2, ptr3, PCB->ThermStyle); + } + break; + } + + case LINE_MODE: + /* do update of position */ + NotifyLine(); + if (Crosshair.AttachedLine.State != STATE_THIRD) + break; + + /* Remove anchor if clicking on start point; + * this means we can't paint 0 length lines + * which could be used for square SMD pads. + * Instead use a very small delta, or change + * the file after saving. + */ + if (Crosshair.X == Crosshair.AttachedLine.Point1.X && Crosshair.Y == Crosshair.AttachedLine.Point1.Y) { + SetMode(LINE_MODE); + break; + } + + if (PCB->RatDraw) { + RatTypePtr line; + if ((line = AddNet())) { + addedLines++; + AddObjectToCreateUndoList(RATLINE_TYPE, line, line, line); + IncrementUndoSerialNumber(); + DrawRat(line); + Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X; + Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y; + Draw(); + } + break; + } + else + /* create line if both ends are determined && length != 0 */ + { + LineTypePtr line; + int maybe_found_flag; + + if (PCB->Clipping + && Crosshair.AttachedLine.Point1.X == + Crosshair.AttachedLine.Point2.X + && Crosshair.AttachedLine.Point1.Y == + Crosshair.AttachedLine.Point2.Y + && (Crosshair.AttachedLine.Point2.X != Note.X || Crosshair.AttachedLine.Point2.Y != Note.Y)) { + /* We will only need to paint the second line segment. + Since we only check for vias on the first segment, + swap them so the non-empty segment is the first segment. */ + Crosshair.AttachedLine.Point2.X = Note.X; + Crosshair.AttachedLine.Point2.Y = Note.Y; + } + + if (TEST_FLAG(AUTODRCFLAG, PCB) + && !TEST_SILK_LAYER(CURRENT)) + maybe_found_flag = FOUNDFLAG; + else + maybe_found_flag = 0; + + if ((Crosshair.AttachedLine.Point1.X != + Crosshair.AttachedLine.Point2.X || Crosshair.AttachedLine.Point1.Y != Crosshair.AttachedLine.Point2.Y) + && (line = + CreateDrawnLineOnLayer(CURRENT, + Crosshair.AttachedLine.Point1.X, + Crosshair.AttachedLine.Point1.Y, + Crosshair.AttachedLine.Point2.X, + Crosshair.AttachedLine.Point2.Y, + Settings.LineThickness, + 2 * Settings.Keepaway, + MakeFlags(maybe_found_flag | + (TEST_FLAG(CLEARNEWFLAG, PCB) ? CLEARLINEFLAG : 0)))) != NULL) { + PinTypePtr via; + + addedLines++; + AddObjectToCreateUndoList(LINE_TYPE, CURRENT, line, line); + DrawLine(CURRENT, line); + /* place a via if vias are visible, the layer is + in a new group since the last line and there + isn't a pin already here */ + if (PCB->ViaOn && GetLayerGroupNumberByPointer(CURRENT) != + GetLayerGroupNumberByPointer(lastLayer) && + SearchObjectByLocation(PIN_TYPES, &ptr1, &ptr2, &ptr3, + Crosshair.AttachedLine.Point1.X, + Crosshair.AttachedLine.Point1.Y, + Settings.ViaThickness / 2) == + NO_TYPE + && (via = + CreateNewVia(PCB->Data, + Crosshair.AttachedLine.Point1.X, + Crosshair.AttachedLine.Point1.Y, + Settings.ViaThickness, + 2 * Settings.Keepaway, 0, Settings.ViaDrillingHole, NULL, NoFlags())) != NULL) { + AddObjectToCreateUndoList(VIA_TYPE, via, via, via); + DrawVia(via); + } + /* copy the coordinates */ + Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X; + Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y; + IncrementUndoSerialNumber(); + lastLayer = CURRENT; + } + if (PCB->Clipping && (Note.X != Crosshair.AttachedLine.Point2.X || Note.Y != Crosshair.AttachedLine.Point2.Y) + && (line = + CreateDrawnLineOnLayer(CURRENT, + Crosshair.AttachedLine.Point2.X, + Crosshair.AttachedLine.Point2.Y, + Note.X, Note.Y, + Settings.LineThickness, + 2 * Settings.Keepaway, + MakeFlags((TEST_FLAG + (AUTODRCFLAG, + PCB) ? FOUNDFLAG : 0) | + (TEST_FLAG(CLEARNEWFLAG, PCB) ? CLEARLINEFLAG : 0)))) != NULL) { + addedLines++; + AddObjectToCreateUndoList(LINE_TYPE, CURRENT, line, line); + IncrementUndoSerialNumber(); + DrawLine(CURRENT, line); + /* move to new start point */ + Crosshair.AttachedLine.Point1.X = Note.X; + Crosshair.AttachedLine.Point1.Y = Note.Y; + Crosshair.AttachedLine.Point2.X = Note.X; + Crosshair.AttachedLine.Point2.Y = Note.Y; + if (TEST_FLAG(SWAPSTARTDIRFLAG, PCB)) { + PCB->Clipping ^= 3; + } + } + Draw(); + } + break; + + case RECTANGLE_MODE: + /* do update of position */ + NotifyBlock(); + + /* create rectangle if both corners are determined + * and width, height are != 0 + */ + if (Crosshair.AttachedBox.State == STATE_THIRD && + Crosshair.AttachedBox.Point1.X != Crosshair.AttachedBox.Point2.X && + Crosshair.AttachedBox.Point1.Y != Crosshair.AttachedBox.Point2.Y) { + PolygonTypePtr polygon; + + int flags = CLEARPOLYFLAG; + if (TEST_FLAG(NEWFULLPOLYFLAG, PCB)) + flags |= FULLPOLYFLAG; + if ((polygon = CreateNewPolygonFromRectangle(CURRENT, + Crosshair.AttachedBox.Point1.X, + Crosshair.AttachedBox.Point1.Y, + Crosshair.AttachedBox.Point2.X, + Crosshair.AttachedBox.Point2.Y, MakeFlags(flags))) != NULL) { + AddObjectToCreateUndoList(POLYGON_TYPE, CURRENT, polygon, polygon); + IncrementUndoSerialNumber(); + DrawPolygon(CURRENT, polygon); + Draw(); + } + + /* reset state to 'first corner' */ + Crosshair.AttachedBox.State = STATE_FIRST; + } + break; + + case TEXT_MODE: + { + char *string; + + if ((string = gui->prompt_for(_("Enter text:"), "")) != NULL) { + if (strlen(string) > 0) { + TextTypePtr text; + int flag = CLEARLINEFLAG; + + if (GetLayerGroupNumberByNumber(INDEXOFCURRENT) == GetLayerGroupNumberByNumber(solder_silk_layer)) + flag |= ONSOLDERFLAG; + if ((text = CreateNewText(CURRENT, &PCB->Font, Note.X, + Note.Y, 0, Settings.TextScale, string, MakeFlags(flag))) != NULL) { + AddObjectToCreateUndoList(TEXT_TYPE, CURRENT, text, text); + IncrementUndoSerialNumber(); + DrawText(CURRENT, text); + Draw(); + } + } + free(string); + } + break; + } + + case POLYGON_MODE: + { + PointTypePtr points = Crosshair.AttachedPolygon.Points; + Cardinal n = Crosshair.AttachedPolygon.PointN; + + /* do update of position; use the 'LINE_MODE' mechanism */ + NotifyLine(); + + /* check if this is the last point of a polygon */ + if (n >= 3 && points->X == Crosshair.AttachedLine.Point2.X && points->Y == Crosshair.AttachedLine.Point2.Y) { + CopyAttachedPolygonToLayer(); + Draw(); + break; + } + + /* create new point if it's the first one or if it's + * different to the last one + */ + if (!n || points[n - 1].X != Crosshair.AttachedLine.Point2.X || points[n - 1].Y != Crosshair.AttachedLine.Point2.Y) { + CreateNewPointInPolygon(&Crosshair.AttachedPolygon, Crosshair.AttachedLine.Point2.X, Crosshair.AttachedLine.Point2.Y); + + /* copy the coordinates */ + Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X; + Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y; + } + break; + } + + case POLYGONHOLE_MODE: + { + switch (Crosshair.AttachedObject.State) { + /* first notify, lookup object */ + case STATE_FIRST: + Crosshair.AttachedObject.Type = + SearchScreen(Note.X, Note.Y, POLYGON_TYPE, + &Crosshair.AttachedObject.Ptr1, &Crosshair.AttachedObject.Ptr2, &Crosshair.AttachedObject.Ptr3); + + if (Crosshair.AttachedObject.Type != NO_TYPE) { + if (TEST_FLAG(LOCKFLAG, (PolygonTypePtr) + Crosshair.AttachedObject.Ptr2)) { + Message(_("Sorry, the object is locked\n")); + Crosshair.AttachedObject.Type = NO_TYPE; + break; + } + else + Crosshair.AttachedObject.State = STATE_SECOND; + } + break; + + /* second notify, insert new point into object */ + case STATE_SECOND: + { + PointTypePtr points = Crosshair.AttachedPolygon.Points; + Cardinal n = Crosshair.AttachedPolygon.PointN; + POLYAREA *original, *new_hole, *result; + FlagType Flags; + + /* do update of position; use the 'LINE_MODE' mechanism */ + NotifyLine(); + + /* check if this is the last point of a polygon */ + if (n >= 3 && points->X == Crosshair.AttachedLine.Point2.X && points->Y == Crosshair.AttachedLine.Point2.Y) { + /* Create POLYAREAs from the original polygon + * and the new hole polygon */ + original = PolygonToPoly((PolygonType *) Crosshair.AttachedObject.Ptr2); + new_hole = PolygonToPoly(&Crosshair.AttachedPolygon); + + /* Subtract the hole from the original polygon shape */ + poly_Boolean_free(original, new_hole, &result, PBO_SUB); + + /* Convert the resulting polygon(s) into a new set of nodes + * and place them on the page. Delete the original polygon. + */ + SaveUndoSerialNumber(); + Flags = ((PolygonType *) Crosshair.AttachedObject.Ptr2)->Flags; + PolyToPolygonsOnLayer(PCB->Data, (LayerType *) Crosshair.AttachedObject.Ptr1, result, Flags); + RemoveObject(POLYGON_TYPE, + Crosshair.AttachedObject.Ptr1, Crosshair.AttachedObject.Ptr2, Crosshair.AttachedObject.Ptr3); + RestoreUndoSerialNumber(); + IncrementUndoSerialNumber(); + Draw(); + + /* reset state of attached line */ + memset(&Crosshair.AttachedPolygon, 0, sizeof(PolygonType)); + Crosshair.AttachedLine.State = STATE_FIRST; + addedLines = 0; + + break; + } + + /* create new point if it's the first one or if it's + * different to the last one + */ + if (!n || points[n - 1].X != Crosshair.AttachedLine.Point2.X || points[n - 1].Y != Crosshair.AttachedLine.Point2.Y) { + CreateNewPointInPolygon(&Crosshair.AttachedPolygon, + Crosshair.AttachedLine.Point2.X, Crosshair.AttachedLine.Point2.Y); + + /* copy the coordinates */ + Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X; + Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y; + } + break; + } + } + + break; + } + + case PASTEBUFFER_MODE: + { + TextType estr[MAX_ELEMENTNAMES]; + ElementTypePtr e = 0; + + if (gui->shift_is_pressed()) { + int type = SearchScreen(Note.X, Note.Y, ELEMENT_TYPE, &ptr1, &ptr2, + &ptr3); + if (type == ELEMENT_TYPE) { + e = (ElementTypePtr) ptr1; + if (e) { + int i; + + memcpy(estr, e->Name, MAX_ELEMENTNAMES * sizeof(TextType)); + for (i = 0; i < MAX_ELEMENTNAMES; ++i) + estr[i].TextString = estr[i].TextString ? strdup(estr[i].TextString) : NULL; + RemoveElement(e); + } + } + } + if (CopyPastebufferToLayout(Note.X, Note.Y)) + SetChangedFlag(true); + if (e) { + int type = SearchScreen(Note.X, Note.Y, ELEMENT_TYPE, &ptr1, &ptr2, + &ptr3); + if (type == ELEMENT_TYPE && ptr1) { + int i, save_n; + e = (ElementTypePtr) ptr1; + + save_n = NAME_INDEX(PCB); + + for (i = 0; i < MAX_ELEMENTNAMES; i++) { + if (i == save_n) + EraseElementName(e); + r_delete_entry(PCB->Data->name_tree[i], (BoxType *) & (e->Name[i])); + memcpy(&(e->Name[i]), &(estr[i]), sizeof(TextType)); + e->Name[i].Element = e; + SetTextBoundingBox(&PCB->Font, &(e->Name[i])); + r_insert_entry(PCB->Data->name_tree[i], (BoxType *) & (e->Name[i]), 0); + if (i == save_n) + DrawElementName(e); + } + } + } + break; + } + + case REMOVE_MODE: + if ((type = SearchScreen(Note.X, Note.Y, REMOVE_TYPES, &ptr1, &ptr2, &ptr3)) != NO_TYPE) { + if (TEST_FLAG(LOCKFLAG, (LineTypePtr) ptr2)) { + Message(_("Sorry, the object is locked\n")); + break; + } + if (type == ELEMENT_TYPE) { + RubberbandTypePtr ptr; + int i; + + Crosshair.AttachedObject.RubberbandN = 0; + LookupRatLines(type, ptr1, ptr2, ptr3); + ptr = Crosshair.AttachedObject.Rubberband; + for (i = 0; i < Crosshair.AttachedObject.RubberbandN; i++) { + if (PCB->RatOn) + EraseRat((RatTypePtr) ptr->Line); + if (TEST_FLAG(RUBBERENDFLAG, ptr->Line)) + MoveObjectToRemoveUndoList(RATLINE_TYPE, ptr->Line, ptr->Line, ptr->Line); + else + TOGGLE_FLAG(RUBBERENDFLAG, ptr->Line); /* only remove line once */ + ptr++; + } + } + RemoveObject(type, ptr1, ptr2, ptr3); + IncrementUndoSerialNumber(); + SetChangedFlag(true); + } + break; + + case ROTATE_MODE: + RotateScreenObject(Note.X, Note.Y, gui->shift_is_pressed()? (SWAP_IDENT ? 1 : 3) + : (SWAP_IDENT ? 3 : 1)); + break; + + /* both are almost the same */ + case COPY_MODE: + case MOVE_MODE: + switch (Crosshair.AttachedObject.State) { + /* first notify, lookup object */ + case STATE_FIRST: + { + int types = (Settings.Mode == COPY_MODE) ? COPY_TYPES : MOVE_TYPES; + + Crosshair.AttachedObject.Type = + SearchScreen(Note.X, Note.Y, types, + &Crosshair.AttachedObject.Ptr1, &Crosshair.AttachedObject.Ptr2, &Crosshair.AttachedObject.Ptr3); + if (Crosshair.AttachedObject.Type != NO_TYPE) { + if (Settings.Mode == MOVE_MODE && TEST_FLAG(LOCKFLAG, (PinTypePtr) + Crosshair.AttachedObject.Ptr2)) { + Message(_("Sorry, the object is locked\n")); + Crosshair.AttachedObject.Type = NO_TYPE; + } + else + AttachForCopy(Note.X, Note.Y); + } + break; + } + + /* second notify, move or copy object */ + case STATE_SECOND: + if (Settings.Mode == COPY_MODE) + CopyObject(Crosshair.AttachedObject.Type, + Crosshair.AttachedObject.Ptr1, + Crosshair.AttachedObject.Ptr2, + Crosshair.AttachedObject.Ptr3, Note.X - Crosshair.AttachedObject.X, Note.Y - Crosshair.AttachedObject.Y); + else { + MoveObjectAndRubberband(Crosshair.AttachedObject.Type, + Crosshair.AttachedObject.Ptr1, + Crosshair.AttachedObject.Ptr2, + Crosshair.AttachedObject.Ptr3, + Note.X - Crosshair.AttachedObject.X, Note.Y - Crosshair.AttachedObject.Y); + SetLocalRef(0, 0, false); + } + SetChangedFlag(true); + + /* reset identifiers */ + Crosshair.AttachedObject.Type = NO_TYPE; + Crosshair.AttachedObject.State = STATE_FIRST; + break; + } + break; + + /* insert a point into a polygon/line/... */ + case INSERTPOINT_MODE: + switch (Crosshair.AttachedObject.State) { + /* first notify, lookup object */ + case STATE_FIRST: + Crosshair.AttachedObject.Type = + SearchScreen(Note.X, Note.Y, INSERT_TYPES, + &Crosshair.AttachedObject.Ptr1, &Crosshair.AttachedObject.Ptr2, &Crosshair.AttachedObject.Ptr3); + + if (Crosshair.AttachedObject.Type != NO_TYPE) { + if (TEST_FLAG(LOCKFLAG, (PolygonTypePtr) + Crosshair.AttachedObject.Ptr2)) { + Message(_("Sorry, the object is locked\n")); + Crosshair.AttachedObject.Type = NO_TYPE; + break; + } + else { + /* get starting point of nearest segment */ + if (Crosshair.AttachedObject.Type == POLYGON_TYPE) { + fake.poly = (PolygonTypePtr) Crosshair.AttachedObject.Ptr2; + polyIndex = GetLowestDistancePolygonPoint(fake.poly, Note.X, Note.Y); + fake.line.Point1 = fake.poly->Points[polyIndex]; + fake.line.Point2 = fake.poly->Points[prev_contour_point(fake.poly, polyIndex)]; + Crosshair.AttachedObject.Ptr2 = &fake.line; + + } + Crosshair.AttachedObject.State = STATE_SECOND; + InsertedPoint = *AdjustInsertPoint(); + } + } + break; + + /* second notify, insert new point into object */ + case STATE_SECOND: + if (Crosshair.AttachedObject.Type == POLYGON_TYPE) + InsertPointIntoObject(POLYGON_TYPE, + Crosshair.AttachedObject.Ptr1, fake.poly, + &polyIndex, InsertedPoint.X, InsertedPoint.Y, false, false); + else + InsertPointIntoObject(Crosshair.AttachedObject.Type, + Crosshair.AttachedObject.Ptr1, + Crosshair.AttachedObject.Ptr2, &polyIndex, InsertedPoint.X, InsertedPoint.Y, false, false); + SetChangedFlag(true); + + /* reset identifiers */ + Crosshair.AttachedObject.Type = NO_TYPE; + Crosshair.AttachedObject.State = STATE_FIRST; + break; + } + break; + } +} + +/* --------------------------------------------------------------------------- + * !!! no action routine !!! + * + * event handler to set the cursor according to the X pointer position + * called from inside main.c + */ +void EventMoveCrosshair(int ev_x, int ev_y) +{ + if (mid_stroke) + stub_stroke_record(ev_x, ev_y); + if (MoveCrosshairAbsolute(ev_x, ev_y)) { + /* update object position and cursor location */ + AdjustAttachedObjects(); + notify_crosshair_change(true); + } +} + +/* --------------------------------------------------------------------------- */ +/* helper: get route style size for a function and selected object type. + size_id: 0=main size; 1=2nd size (drill); 2=clearance */ +int get_style_size(int funcid, Coord * out, int type, int size_id) +{ + switch (funcid) { + case F_Object: + switch (type) { + case ELEMENT_TYPE: /* we'd set pin/pad properties, so fall thru */ + case VIA_TYPE: + case PIN_TYPE: + return get_style_size(F_SelectedVias, out, 0, size_id); + case PAD_TYPE: + return get_style_size(F_SelectedPads, out, 0, size_id); + case LINE_TYPE: + return get_style_size(F_SelectedLines, out, 0, size_id); + case ARC_TYPE: + return get_style_size(F_SelectedArcs, out, 0, size_id); + } + Message(_("Sorry, can't fetch the style of that object tpye (%x)\n"), type); + return -1; + case F_SelectedPads: + if (size_id != 2) /* don't mess with pad size */ + return -1; + case F_SelectedVias: + case F_SelectedPins: + case F_SelectedObjects: + case F_Selected: + case F_SelectedElements: + if (size_id == 0) + *out = Settings.ViaThickness; + else if (size_id == 1) + *out = Settings.ViaDrillingHole; + else + *out = Settings.Keepaway; + break; + case F_SelectedArcs: + case F_SelectedLines: + if (size_id == 2) + *out = Settings.Keepaway; + else + *out = Settings.LineThickness; + return 0; + case F_SelectedTexts: + case F_SelectedNames: + Message(_("Sorry, can't change style of every selected object\n")); + return -1; + } + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char executefile_syntax[] = "ExecuteFile(filename)"; + +static const char executefile_help[] = "Run actions from the given file."; + +/* %start-doc actions ExecuteFile + +Lines starting with @code{#} are ignored. + +%end-doc */ + +int ActionExecuteFile(int argc, char **argv, Coord x, Coord y) +{ + FILE *fp; + char *fname; + char line[256]; + int n = 0; + char *sp; + + if (argc != 1) + AFAIL(executefile); + + fname = argv[0]; + + if ((fp = fopen(fname, "r")) == NULL) { + fprintf(stderr, _("Could not open actions file \"%s\".\n"), fname); + return 1; + } + + defer_updates = 1; + defer_needs_update = 0; + while (fgets(line, sizeof(line), fp) != NULL) { + n++; + sp = line; + + /* eat the trailing newline */ + while (*sp && *sp != '\r' && *sp != '\n') + sp++; + *sp = '\0'; + + /* eat leading spaces and tabs */ + sp = line; + while (*sp && (*sp == ' ' || *sp == '\t')) + sp++; + + /* + * if we have anything left and its not a comment line + * then execute it + */ + + if (*sp && *sp != '#') { + /*Message ("%s : line %-3d : \"%s\"\n", fname, n, sp); */ + hid_parse_actions(sp); + } + } + + defer_updates = 0; + if (defer_needs_update) { + IncrementUndoSerialNumber(); + gui->invalidate_all(); + } + fclose(fp); + return 0; +} + +/* --------------------------------------------------------------------------- */ + +HID_Action action_action_list[] = { + {"ExecuteFile", 0, ActionExecuteFile, + executefile_help, executefile_syntax} +}; + +REGISTER_ACTIONS(action_action_list) Index: 1.0.8/src/action.h =================================================================== --- 1.0.8/src/action.h (nonexistent) +++ 1.0.8/src/action.h (revision 1136) @@ -0,0 +1,94 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + * RCS: $Id$ + */ + +/* prototypes for action routines + */ + +#ifndef PCB_ACTION_H +#define PCH_ACTION_H + +#include "global.h" + +#define CLONE_TYPES LINE_TYPE | ARC_TYPE | VIA_TYPE | POLYGON_TYPE + +void ActionAdjustStyle(char *); +void EventMoveCrosshair(int, int); + +void AdjustAttachedObjects(void); + +void warpNoWhere(void); + +/* In gui-misc.c */ +bool ActionGetLocation(char *); +void ActionGetXY(char *); + +#define action_entry(x) F_ ## x, +typedef enum { +#include "action_funclist.h" +F_END +} FunctionID; +#undef action_entry + +#include "action_funchash.h" + +#define ARG(n) (argc > (n) ? argv[n] : NULL) + +int get_style_size(int funcid, Coord * out, int type, int size_id); + +extern int defer_updates; +extern int defer_needs_update; +extern LayerTypePtr lastLayer; + +void NotifyLine(void); +void NotifyBlock(void); +void NotifyMode(void); +void ClearWarnings(void); + +typedef struct { + Coord X, Y; + Cardinal Buffer; + bool Click; + bool Moving; /* selected type clicked on */ + int Hit; /* move type clicked on */ + void *ptr1; + void *ptr2; + void *ptr3; +} action_note_t; + +extern action_note_t Note; +extern bool saved_mode; + +int ActionExecuteFile(int argc, char **argv, Coord x, Coord y); +void ReleaseMode(void); + +#ifdef HAVE_LIBSTROKE +extern bool mid_stroke; +extern BoxType StrokeBox; +void FinishStroke(void); +#endif + +#endif Index: 1.0.8/src/action_funchash.c =================================================================== --- 1.0.8/src/action_funchash.c (nonexistent) +++ 1.0.8/src/action_funchash.c (revision 1136) @@ -0,0 +1,94 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact addresses for paper mail and Email: + * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA + * haceaton@aplcomm.jhuapl.edu + * + */ +#include "action.h" + +#define action_entry(x) { #x, F_ ## x}, +static FunctionType Functions[] = { +#include "action_funclist.h" + {"F_END", F_END} +}; + +/* --------------------------------------------------------------------------- + * get function ID of passed string + */ +#define HSIZE 257 +static char function_hash[HSIZE]; +static int hash_initted = 0; + +static int hashfunc(const char *s) +{ + int i = 0; + while (*s) { + i ^= i >> 16; + i = (i * 13) ^ (unsigned char) tolower((int) *s); + s++; + } + i = (unsigned int) i % HSIZE; + return i; +} + +FunctionID GetFunctionID(const char *Ident) +{ + int i, h; + + if (Ident == 0) + return -1; + + if (!hash_initted) { + hash_initted = 1; + if (HSIZE < ENTRIES(Functions) * 2) { + fprintf(stderr, _("Error: function hash size too small (%d vs %lu at %s:%d)\n"), + HSIZE, (unsigned long) ENTRIES(Functions) * 2, __FILE__, __LINE__); + exit(1); + } + if (ENTRIES(Functions) > 254) { + /* Change 'char' to 'int' and remove this when we get to 256 + strings to hash. */ + fprintf(stderr, _("Error: function hash type too small (%d vs %lu at %s:%d)\n"), + 256, (unsigned long) ENTRIES(Functions), __FILE__, __LINE__); + exit(1); + + } + for (i = ENTRIES(Functions) - 1; i >= 0; i--) { + h = hashfunc(Functions[i].Identifier); + while (function_hash[h]) + h = (h + 1) % HSIZE; + function_hash[h] = i + 1; + } + } + + i = hashfunc(Ident); + while (1) { + /* We enforce the "hash table bigger than function table" rule, + so we know there will be at least one zero entry to find. */ + if (!function_hash[i]) + return (-1); + if (!strcasecmp(Ident, Functions[function_hash[i] - 1].Identifier)) + return ((int) Functions[function_hash[i] - 1].ID); + i = (i + 1) % HSIZE; + } +} Index: 1.0.8/src/action_funchash.h =================================================================== --- 1.0.8/src/action_funchash.h (nonexistent) +++ 1.0.8/src/action_funchash.h (revision 1136) @@ -0,0 +1,34 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact addresses for paper mail and Email: + * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA + * haceaton@aplcomm.jhuapl.edu + * + */ + +typedef struct { /* used to identify subfunctions */ + char *Identifier; + FunctionID ID; +} FunctionType, *FunctionTypePtr; + +/* Convert function name to integer function id */ +FunctionID GetFunctionID(const char *Ident); Index: 1.0.8/src/action_funclist.h =================================================================== --- 1.0.8/src/action_funclist.h (nonexistent) +++ 1.0.8/src/action_funclist.h (revision 1136) @@ -0,0 +1,126 @@ +/* + Central list of function IDs + The core and core plugins use these from a single, central hash + This list is used to cpp-generate the F_* constants in enum FunctionID +*/ +action_entry(AddSelected) +action_entry(All) +action_entry(AllConnections) +action_entry(AllRats) +action_entry(AllUnusedPins) +action_entry(Arc) +action_entry(Arrow) +action_entry(Block) +action_entry(Description) +action_entry(Cancel) +action_entry(Center) +action_entry(Clear) +action_entry(ClearAndRedraw) +action_entry(ClearList) +action_entry(Close) +action_entry(Connection) +action_entry(Convert) +action_entry(Copy) +action_entry(CycleClip) +action_entry(CycleCrosshair) +action_entry(DeleteRats) +action_entry(Drag) +action_entry(DrillReport) +action_entry(Element) +action_entry(ElementByName) +action_entry(ElementConnections) +action_entry(ElementToBuffer) +action_entry(Escape) +action_entry(Find) +action_entry(FlipElement) +action_entry(FoundPins) +action_entry(Grid) +action_entry(InsertPoint) +action_entry(Layer) +action_entry(Layout) +action_entry(LayoutAs) +action_entry(LayoutToBuffer) +action_entry(Line) +action_entry(LineSize) +action_entry(Lock) +action_entry(Mirror) +action_entry(Move) +action_entry(NameOnPCB) +action_entry(Netlist) +action_entry(NetByName) +action_entry(None) +action_entry(Notify) +action_entry(Object) +action_entry(ObjectByName) +action_entry(PasteBuffer) +action_entry(PadByName) +action_entry(PinByName) +action_entry(PinOrPadName) +action_entry(Pinout) +action_entry(Polygon) +action_entry(PolygonHole) +action_entry(PreviousPoint) +action_entry(RatsNest) +action_entry(Rectangle) +action_entry(Redraw) +action_entry(Release) +action_entry(Revert) +action_entry(Remove) +action_entry(RemoveSelected) +action_entry(Report) +action_entry(Reset) +action_entry(ResetLinesAndPolygons) +action_entry(ResetPinsViasAndPads) +action_entry(Restore) +action_entry(Rotate) +action_entry(Save) +action_entry(Selected) +action_entry(SelectedArcs) +action_entry(SelectedElements) +action_entry(SelectedLines) +action_entry(SelectedNames) +action_entry(SelectedObjects) +action_entry(SelectedPads) +action_entry(SelectedPins) +action_entry(SelectedTexts) +action_entry(SelectedVias) +action_entry(SelectedRats) +action_entry(Stroke) +action_entry(Text) +action_entry(TextByName) +action_entry(TextScale) +action_entry(Thermal) +action_entry(ToLayout) +action_entry(ToggleAllDirections) +action_entry(ToggleAutoDRC) +action_entry(ToggleClearLine) +action_entry(ToggleFullPoly) +action_entry(ToggleGrid) +action_entry(ToggleHideNames) +action_entry(ToggleMinCut) +action_entry(ToggleMask) +action_entry(ToggleName) +action_entry(ToggleObject) +action_entry(ToggleShowDRC) +action_entry(ToggleLiveRoute) +action_entry(ToggleRubberBandMode) +action_entry(ToggleStartDirection) +action_entry(ToggleSnapPin) +action_entry(ToggleSnapOffGridLine) +action_entry(ToggleHighlightOnPoint) +action_entry(ToggleThindraw) +action_entry(ToggleLockNames) +action_entry(ToggleOnlyNames) +action_entry(ToggleThindrawPoly) +action_entry(ToggleOrthoMove) +action_entry(ToggleLocalRef) +action_entry(ToggleCheckPlanes) +action_entry(ToggleUniqueNames) +action_entry(ToggleStroke) +action_entry(Via) +action_entry(ViaByName) +action_entry(Value) +action_entry(ViaDrillingHole) +action_entry(ViaSize) +action_entry(Zoom) + Index: 1.0.8/src/action_list.h =================================================================== --- 1.0.8/src/action_list.h (nonexistent) +++ 1.0.8/src/action_list.h (revision 1136) @@ -0,0 +1,112 @@ +/* gui hid/gtk */ +/* gui hid/lesstif */ +/* gui hid/batch */ +/* export hid/ps */ +/* export hid/png */ +/* export hid/gcode */ +/* export hid/nelma */ +/* hid/png (export) */ +REGISTER_ATTRIBUTES(png_attribute_list) + +/* find_act.c () */ +REGISTER_ACTIONS(find_action_list) + +/* move.c () */ +REGISTER_ACTIONS(move_action_list) + +/* select_act.c () */ +REGISTER_ACTIONS(select_action_list) + +/* remove_act.c () */ +REGISTER_ACTIONS(remove_action_list) + +/* file_act.c () */ +REGISTER_ACTIONS(file_action_list) + +/* main.c () */ +REGISTER_ATTRIBUTES(main_attribute_list) + +/* command.c () */ +REGISTER_ACTIONS(command_action_list) + +/* change_act.c () */ +REGISTER_ACTIONS(change_action_list) + +/* action.c () */ +REGISTER_ACTIONS(action_action_list) + +/* hid/ps (export) */ +REGISTER_ATTRIBUTES(ps_attribute_list) +REGISTER_ACTIONS(hidps_action_list) +REGISTER_ATTRIBUTES(eps_attribute_list) + +/* hid/gtk (gui) */ +if ((gui != NULL) && (strcmp(gui->name, "gtk") == 0)) { +REGISTER_ATTRIBUTES(ghid_attribute_list) +REGISTER_ACTIONS(gtk_topwindow_action_list) +REGISTER_ACTIONS(ghid_menu_action_list) +REGISTER_ACTIONS(ghid_netlist_action_list) +REGISTER_ACTIONS(ghid_log_action_list) +REGISTER_ACTIONS(ghid_main_action_list) +REGISTER_FLAGS(ghid_main_flag_list) + +} +/* hid/nelma (export) */ +REGISTER_ATTRIBUTES(nelma_attribute_list) + +/* gui_act.c () */ +REGISTER_ACTIONS(gui_action_list) + +/* report.c () */ +REGISTER_ACTIONS(report_action_list) + +/* polygon_act.c () */ +REGISTER_ACTIONS(polygon_action_list) + +/* netlist.c () */ +REGISTER_ACTIONS(netlist_action_list) + +/* misc.c () */ +REGISTER_ACTIONS(misc_action_list) + +/* flags.c () */ +REGISTER_FLAGS(flags_flag_list) + +/* buffer.c () */ +REGISTER_ACTIONS(buffer_action_list) + +/* hid/gcode (export) */ +REGISTER_ATTRIBUTES(gcode_attribute_list) + +/* object_act.c () */ +REGISTER_ACTIONS(object_action_list) + +/* hid/batch (gui) */ +if ((gui != NULL) && (strcmp(gui->name, "batch") == 0)) { +REGISTER_ACTIONS(batch_action_list) + +} +/* hid/lesstif (gui) */ +if ((gui != NULL) && (strcmp(gui->name, "lesstif") == 0)) { +REGISTER_ACTIONS(lesstif_library_action_list) +REGISTER_ACTIONS(lesstif_menu_action_list) +REGISTER_FLAGS(lesstif_main_flag_list) +REGISTER_ATTRIBUTES(lesstif_attribute_list) +REGISTER_ACTIONS(lesstif_main_action_list) +REGISTER_ACTIONS(lesstif_styles_action_list) +REGISTER_ACTIONS(lesstif_dialog_action_list) +REGISTER_ACTIONS(lesstif_netlist_action_list) + +} +/* rats_act.c () */ +REGISTER_ACTIONS(rats_action_list) + +/* plugins.c () */ +REGISTER_ACTIONS(plugins_action_list) + +/* undo_act.c () */ +REGISTER_ACTIONS(undo_action_list) + +/* rats_patch.c () */ +REGISTER_ACTIONS(rats_patch_action_list) + Index: 1.0.8/src/box.h =================================================================== --- 1.0.8/src/box.h (nonexistent) +++ 1.0.8/src/box.h (revision 1136) @@ -0,0 +1,209 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * Copyright (C) 1998,1999,2000,2001 harry eaton + * + * 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: + * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA + * haceaton@aplcomm.jhuapl.edu + * + */ + +/* this file, box.h, was written and is + * Copyright (c) 2001 C. Scott Ananian. + */ + +/* random box-related utilities. + */ + +#ifndef PCB_BOX_H +#define PCB_BOX_H + +#include +#include "global.h" + +#include "misc.h" + +typedef enum { NORTH = 0, EAST = 1, SOUTH = 2, WEST = 3, NE = 4, SE = 5, SW = 6, NW = 7, ALL = 8 +} direction_t; + +/* rotates box 90-degrees cw */ +/* that's a strange rotation! */ +#define ROTATEBOX_CW(box) { Coord t;\ + t = (box).X1; (box).X1 = -(box).Y2; (box).Y2 = (box).X2;\ + (box).X2 = -(box).Y1; (box).Y1 = t;\ +} +#define ROTATEBOX_TO_NORTH(box, dir) do { Coord t;\ + switch(dir) {\ + case EAST: \ + t = (box).X1; (box).X1 = (box).Y1; (box).Y1 = -(box).X2;\ + (box).X2 = (box).Y2; (box).Y2 = -t; break;\ + case SOUTH: \ + t = (box).X1; (box).X1 = -(box).X2; (box).X2 = -t;\ + t = (box).Y1; (box).Y1 = -(box).Y2; (box).Y2 = -t; break;\ + case WEST: \ + t = (box).X1; (box).X1 = -(box).Y2; (box).Y2 = (box).X2;\ + (box).X2 = -(box).Y1; (box).Y1 = t; break;\ + case NORTH: break;\ + default: assert(0);\ + }\ + } while (0) +#define ROTATEBOX_FROM_NORTH(box, dir) do { Coord t;\ + switch(dir) {\ + case WEST: \ + t = (box).X1; (box).X1 = (box).Y1; (box).Y1 = -(box).X2;\ + (box).X2 = (box).Y2; (box).Y2 = -t; break;\ + case SOUTH: \ + t = (box).X1; (box).X1 = -(box).X2; (box).X2 = -t;\ + t = (box).Y1; (box).Y1 = -(box).Y2; (box).Y2 = -t; break;\ + case EAST: \ + t = (box).X1; (box).X1 = -(box).Y2; (box).Y2 = (box).X2;\ + (box).X2 = -(box).Y1; (box).Y1 = t; break;\ + case NORTH: break;\ + default: assert(0);\ + }\ + } while (0) + +/* to avoid overflow, we calculate centers this way */ +#define CENTER_X(b) ((b).X1 + ((b).X2 - (b).X1)/2) +#define CENTER_Y(b) ((b).Y1 + ((b).Y2 - (b).Y1)/2) +/* some useful box utilities. */ + +typedef struct cheap_point { + Coord X, Y; +} CheapPointType; + + +/* note that boxes are closed on top and left and open on bottom and right. */ +/* this means that top-left corner is in box, *but bottom-right corner is + * not*. */ +static inline bool point_in_box(const BoxType * box, Coord X, Coord Y) +{ + return (X >= box->X1) && (Y >= box->Y1) && (X < box->X2) && (Y < box->Y2); +} + +static inline bool point_in_closed_box(const BoxType * box, Coord X, Coord Y) +{ + return (X >= box->X1) && (Y >= box->Y1) && (X <= box->X2) && (Y <= box->Y2); +} + +static inline bool box_is_good(const BoxType * b) +{ + return (b->X1 < b->X2) && (b->Y1 < b->Y2); +} + +static inline bool box_intersect(const BoxType * a, const BoxType * b) +{ + return (a->X1 < b->X2) && (b->X1 < a->X2) && (a->Y1 < b->Y2) && (b->Y1 < a->Y2); +} + +static inline CheapPointType closest_point_in_box(const CheapPointType * from, const BoxType * box) +{ + CheapPointType r; + assert(box->X1 < box->X2 && box->Y1 < box->Y2); + r.X = (from->X < box->X1) ? box->X1 : (from->X > box->X2 - 1) ? box->X2 - 1 : from->X; + r.Y = (from->Y < box->Y1) ? box->Y1 : (from->Y > box->Y2 - 1) ? box->Y2 - 1 : from->Y; + assert(point_in_box(box, r.X, r.Y)); + return r; +} + +static inline bool box_in_box(const BoxType * outer, const BoxType * inner) +{ + return (outer->X1 <= inner->X1) && (inner->X2 <= outer->X2) && (outer->Y1 <= inner->Y1) && (inner->Y2 <= outer->Y2); +} + +static inline BoxType clip_box(const BoxType * box, const BoxType * clipbox) +{ + BoxType r; + assert(box_intersect(box, clipbox)); + r.X1 = MAX(box->X1, clipbox->X1); + r.X2 = MIN(box->X2, clipbox->X2); + r.Y1 = MAX(box->Y1, clipbox->Y1); + r.Y2 = MIN(box->Y2, clipbox->Y2); + assert(box_in_box(clipbox, &r)); + return r; +} + +static inline BoxType shrink_box(const BoxType * box, Coord amount) +{ + BoxType r = *box; + r.X1 += amount; + r.Y1 += amount; + r.X2 -= amount; + r.Y2 -= amount; + return r; +} + +static inline BoxType bloat_box(const BoxType * box, Coord amount) +{ + return shrink_box(box, -amount); +} + +/* construct a minimum box that touches the input box at the center */ +static inline BoxType box_center(const BoxType * box) +{ + BoxType r; + r.X1 = box->X1 + (box->X2 - box->X1) / 2; + r.X2 = r.X1 + 1; + r.Y1 = box->Y1 + (box->Y2 - box->Y1) / 2; + r.Y2 = r.Y1 + 1; + return r; +} + +/* construct a minimum box that touches the input box at the corner */ +static inline BoxType box_corner(const BoxType * box) +{ + BoxType r; + r.X1 = box->X1; + r.X2 = r.X1 + 1; + r.Y1 = box->Y1; + r.Y2 = r.Y1 + 1; + return r; +} + +/* construct a box that holds a single point */ +static inline BoxType point_box(Coord X, Coord Y) +{ + BoxType r; + r.X1 = X; + r.X2 = X + 1; + r.Y1 = Y; + r.Y2 = Y + 1; + return r; +} + +/* close a bounding box by pushing its upper right corner */ +static inline void close_box(BoxType * r) +{ + r->X2++; + r->Y2++; +} + +/* return the square of the minimum distance from a point to some point + * inside a box. The box is half-closed! That is, the top-left corner + * is considered in the box, but the bottom-right corner is not. */ +static inline double dist2_to_box(const CheapPointType * p, const BoxType * b) +{ + CheapPointType r = closest_point_in_box(p, b); + return Distance(r.X, r.Y, p->X, p->Y); +} + +#endif /* __BOX_H_INCLUDED__ */ Index: 1.0.8/src/buffer.c =================================================================== --- 1.0.8/src/buffer.c (nonexistent) +++ 1.0.8/src/buffer.c (revision 1136) @@ -0,0 +1,1456 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996, 2005 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* functions used by paste- and move/copy buffer + */ + +#include "config.h" + +#include +#include +#include + +#include "global.h" + +#include "action.h" +#include "buffer.h" +#include "copy.h" +#include "create.h" +#include "crosshair.h" +#include "data.h" +#include "error.h" +#include "file.h" +#include "mymem.h" +#include "mirror.h" +#include "misc.h" +#include "parse_l.h" +#include "polygon.h" +#include "rats.h" +#include "rotate.h" +#include "remove.h" +#include "rtree.h" +#include "search.h" +#include "select.h" +#include "set.h" + + +RCSID("$Id$"); + +/* --------------------------------------------------------------------------- + * some local prototypes + */ +static void *AddViaToBuffer(PinTypePtr); +static void *AddLineToBuffer(LayerTypePtr, LineTypePtr); +static void *AddArcToBuffer(LayerTypePtr, ArcTypePtr); +static void *AddRatToBuffer(RatTypePtr); +static void *AddTextToBuffer(LayerTypePtr, TextTypePtr); +static void *AddPolygonToBuffer(LayerTypePtr, PolygonTypePtr); +static void *AddElementToBuffer(ElementTypePtr); +static void *MoveViaToBuffer(PinTypePtr); +static void *MoveLineToBuffer(LayerTypePtr, LineTypePtr); +static void *MoveArcToBuffer(LayerTypePtr, ArcTypePtr); +static void *MoveRatToBuffer(RatTypePtr); +static void *MoveTextToBuffer(LayerTypePtr, TextTypePtr); +static void *MovePolygonToBuffer(LayerTypePtr, PolygonTypePtr); +static void *MoveElementToBuffer(ElementTypePtr); +static void SwapBuffer(BufferTypePtr); + +/* --------------------------------------------------------------------------- + * some local identifiers + */ +static DataTypePtr Dest, Source; + +static ObjectFunctionType AddBufferFunctions = { + AddLineToBuffer, + AddTextToBuffer, + AddPolygonToBuffer, + AddViaToBuffer, + AddElementToBuffer, + NULL, + NULL, + NULL, + NULL, + NULL, + AddArcToBuffer, + AddRatToBuffer +}, MoveBufferFunctions = { +MoveLineToBuffer, + MoveTextToBuffer, + MovePolygonToBuffer, MoveViaToBuffer, MoveElementToBuffer, NULL, NULL, NULL, NULL, NULL, MoveArcToBuffer, MoveRatToBuffer}; + +static int ExtraFlag = 0; + +/* --------------------------------------------------------------------------- + * copies a via to paste buffer + */ +static void *AddViaToBuffer(PinTypePtr Via) +{ + return (CreateNewVia(Dest, Via->X, Via->Y, Via->Thickness, Via->Clearance, + Via->Mask, Via->DrillingHole, Via->Name, MaskFlags(Via->Flags, FOUNDFLAG | ExtraFlag))); +} + +/* --------------------------------------------------------------------------- + * copies a rat-line to paste buffer + */ +static void *AddRatToBuffer(RatTypePtr Rat) +{ + return (CreateNewRat(Dest, Rat->Point1.X, Rat->Point1.Y, + Rat->Point2.X, Rat->Point2.Y, Rat->group1, + Rat->group2, Rat->Thickness, MaskFlags(Rat->Flags, FOUNDFLAG | ExtraFlag))); +} + +/* --------------------------------------------------------------------------- + * copies a line to buffer + */ +static void *AddLineToBuffer(LayerTypePtr Layer, LineTypePtr Line) +{ + LineTypePtr line; + LayerTypePtr layer = &Dest->Layer[GetLayerNumber(Source, Layer)]; + + line = CreateNewLineOnLayer(layer, Line->Point1.X, Line->Point1.Y, + Line->Point2.X, Line->Point2.Y, + Line->Thickness, Line->Clearance, MaskFlags(Line->Flags, FOUNDFLAG | ExtraFlag)); + if (line && Line->Number) + line->Number = strdup(Line->Number); + return (line); +} + +/* --------------------------------------------------------------------------- + * copies an arc to buffer + */ +static void *AddArcToBuffer(LayerTypePtr Layer, ArcTypePtr Arc) +{ + LayerTypePtr layer = &Dest->Layer[GetLayerNumber(Source, Layer)]; + + return (CreateNewArcOnLayer(layer, Arc->X, Arc->Y, + Arc->Width, Arc->Height, Arc->StartAngle, Arc->Delta, + Arc->Thickness, Arc->Clearance, MaskFlags(Arc->Flags, FOUNDFLAG | ExtraFlag))); +} + +/* --------------------------------------------------------------------------- + * copies a text to buffer + */ +static void *AddTextToBuffer(LayerTypePtr Layer, TextTypePtr Text) +{ + LayerTypePtr layer = &Dest->Layer[GetLayerNumber(Source, Layer)]; + + return (CreateNewText(layer, &PCB->Font, Text->X, Text->Y, + Text->Direction, Text->Scale, Text->TextString, MaskFlags(Text->Flags, ExtraFlag))); +} + +/* --------------------------------------------------------------------------- + * copies a polygon to buffer + */ +static void *AddPolygonToBuffer(LayerTypePtr Layer, PolygonTypePtr Polygon) +{ + LayerTypePtr layer = &Dest->Layer[GetLayerNumber(Source, Layer)]; + PolygonTypePtr polygon; + + polygon = CreateNewPolygon(layer, Polygon->Flags); + CopyPolygonLowLevel(polygon, Polygon); + + /* Update the polygon r-tree. Unlike similarly named functions for + * other objects, CreateNewPolygon does not do this as it creates a + * skeleton polygon object, which won't have correct bounds. + */ + if (!layer->polygon_tree) + layer->polygon_tree = r_create_tree(NULL, 0, 0); + r_insert_entry(layer->polygon_tree, (BoxType *) polygon, 0); + + CLEAR_FLAG(FOUNDFLAG | ExtraFlag, polygon); + return (polygon); +} + +/* --------------------------------------------------------------------------- + * copies a element to buffer + */ +static void *AddElementToBuffer(ElementTypePtr Element) +{ + ElementTypePtr element; + + element = GetElementMemory(Dest); + CopyElementLowLevel(Dest, element, Element, false, 0, 0); + CLEAR_FLAG(ExtraFlag, element); + if (ExtraFlag) { + ELEMENTTEXT_LOOP(element); + { + CLEAR_FLAG(ExtraFlag, text); + } + END_LOOP; + PIN_LOOP(element); + { + CLEAR_FLAG(FOUNDFLAG | ExtraFlag, pin); + } + END_LOOP; + PAD_LOOP(element); + { + CLEAR_FLAG(FOUNDFLAG | ExtraFlag, pad); + } + END_LOOP; + } + return (element); +} + +/* --------------------------------------------------------------------------- + * moves a via to paste buffer without allocating memory for the name + */ +static void *MoveViaToBuffer(PinType * via) +{ + RestoreToPolygon(Source, VIA_TYPE, via, via); + + r_delete_entry(Source->via_tree, (BoxType *) via); + Source->Via = g_list_remove(Source->Via, via); + Source->ViaN--; + Dest->Via = g_list_append(Dest->Via, via); + Dest->ViaN++; + + CLEAR_FLAG(WARNFLAG | FOUNDFLAG, via); + + if (!Dest->via_tree) + Dest->via_tree = r_create_tree(NULL, 0, 0); + r_insert_entry(Dest->via_tree, (BoxType *) via, 0); + ClearFromPolygon(Dest, VIA_TYPE, via, via); + return via; +} + +/* --------------------------------------------------------------------------- + * moves a rat-line to paste buffer + */ +static void *MoveRatToBuffer(RatType * rat) +{ + r_delete_entry(Source->rat_tree, (BoxType *) rat); + + Source->Rat = g_list_remove(Source->Rat, rat); + Source->RatN--; + Dest->Rat = g_list_append(Dest->Rat, rat); + Dest->RatN++; + + CLEAR_FLAG(FOUNDFLAG, rat); + + if (!Dest->rat_tree) + Dest->rat_tree = r_create_tree(NULL, 0, 0); + r_insert_entry(Dest->rat_tree, (BoxType *) rat, 0); + return rat; +} + +/* --------------------------------------------------------------------------- + * moves a line to buffer + */ +static void *MoveLineToBuffer(LayerType * layer, LineType * line) +{ + LayerTypePtr lay = &Dest->Layer[GetLayerNumber(Source, layer)]; + + RestoreToPolygon(Source, LINE_TYPE, layer, line); + r_delete_entry(layer->line_tree, (BoxType *) line); + + layer->Line = g_list_remove(layer->Line, line); + layer->LineN--; + lay->Line = g_list_append(lay->Line, line); + lay->LineN++; + + CLEAR_FLAG(FOUNDFLAG, line); + + if (!lay->line_tree) + lay->line_tree = r_create_tree(NULL, 0, 0); + r_insert_entry(lay->line_tree, (BoxType *) line, 0); + ClearFromPolygon(Dest, LINE_TYPE, lay, line); + return (line); +} + +/* --------------------------------------------------------------------------- + * moves an arc to buffer + */ +static void *MoveArcToBuffer(LayerType * layer, ArcType * arc) +{ + LayerType *lay = &Dest->Layer[GetLayerNumber(Source, layer)]; + + RestoreToPolygon(Source, ARC_TYPE, layer, arc); + r_delete_entry(layer->arc_tree, (BoxType *) arc); + + layer->Arc = g_list_remove(layer->Arc, arc); + layer->ArcN--; + lay->Arc = g_list_append(lay->Arc, arc); + lay->ArcN++; + + CLEAR_FLAG(FOUNDFLAG, arc); + + if (!lay->arc_tree) + lay->arc_tree = r_create_tree(NULL, 0, 0); + r_insert_entry(lay->arc_tree, (BoxType *) arc, 0); + ClearFromPolygon(Dest, ARC_TYPE, lay, arc); + return (arc); +} + +/* --------------------------------------------------------------------------- + * moves a text to buffer without allocating memory for the name + */ +static void *MoveTextToBuffer(LayerType * layer, TextType * text) +{ + LayerType *lay = &Dest->Layer[GetLayerNumber(Source, layer)]; + + r_delete_entry(layer->text_tree, (BoxType *) text); + RestoreToPolygon(Source, TEXT_TYPE, layer, text); + + layer->Text = g_list_remove(layer->Text, text); + layer->TextN--; + lay->Text = g_list_append(lay->Text, text); + lay->TextN++; + + if (!lay->text_tree) + lay->text_tree = r_create_tree(NULL, 0, 0); + r_insert_entry(lay->text_tree, (BoxType *) text, 0); + ClearFromPolygon(Dest, TEXT_TYPE, lay, text); + return (text); +} + +/* --------------------------------------------------------------------------- + * moves a polygon to buffer. Doesn't allocate memory for the points + */ +static void *MovePolygonToBuffer(LayerType * layer, PolygonType * polygon) +{ + LayerType *lay = &Dest->Layer[GetLayerNumber(Source, layer)]; + + r_delete_entry(layer->polygon_tree, (BoxType *) polygon); + + layer->Polygon = g_list_remove(layer->Polygon, polygon); + layer->PolygonN--; + lay->Polygon = g_list_append(lay->Polygon, polygon); + lay->PolygonN++; + + CLEAR_FLAG(FOUNDFLAG, polygon); + + if (!lay->polygon_tree) + lay->polygon_tree = r_create_tree(NULL, 0, 0); + r_insert_entry(lay->polygon_tree, (BoxType *) polygon, 0); + return (polygon); +} + +/* --------------------------------------------------------------------------- + * moves a element to buffer without allocating memory for pins/names + */ +static void *MoveElementToBuffer(ElementType * element) +{ + /* + * Delete the element from the source (remove it from trees, + * restore to polygons) + */ + r_delete_element(Source, element); + + Source->Element = g_list_remove(Source->Element, element); + Source->ElementN--; + Dest->Element = g_list_append(Dest->Element, element); + Dest->ElementN++; + + PIN_LOOP(element); + { + RestoreToPolygon(Source, PIN_TYPE, element, pin); + CLEAR_FLAG(WARNFLAG | FOUNDFLAG, pin); + } + END_LOOP; + PAD_LOOP(element); + { + RestoreToPolygon(Source, PAD_TYPE, element, pad); + CLEAR_FLAG(WARNFLAG | FOUNDFLAG, pad); + } + END_LOOP; + SetElementBoundingBox(Dest, element, &PCB->Font); + /* + * Now clear the from the polygons in the destination + */ + PIN_LOOP(element); + { + ClearFromPolygon(Dest, PIN_TYPE, element, pin); + } + END_LOOP; + PAD_LOOP(element); + { + ClearFromPolygon(Dest, PAD_TYPE, element, pad); + } + END_LOOP; + + return element; +} + +/* --------------------------------------------------------------------------- + * calculates the bounding box of the buffer + */ +void SetBufferBoundingBox(BufferTypePtr Buffer) +{ + BoxTypePtr box = GetDataBoundingBox(Buffer->Data); + + if (box) + Buffer->BoundingBox = *box; +} + +/* --------------------------------------------------------------------------- + * clears the contents of the paste buffer + */ +void ClearBuffer(BufferTypePtr Buffer) +{ + if (Buffer && Buffer->Data) { + FreeDataMemory(Buffer->Data); + Buffer->Data->pcb = PCB; + } +} + +/* ---------------------------------------------------------------------- + * copies all selected and visible objects to the paste buffer + * returns true if any objects have been removed + */ +void AddSelectedToBuffer(BufferTypePtr Buffer, Coord X, Coord Y, bool LeaveSelected) +{ + /* switch crosshair off because adding objects to the pastebuffer + * may change the 'valid' area for the cursor + */ + if (!LeaveSelected) + ExtraFlag = SELECTEDFLAG; + notify_crosshair_change(false); + Source = PCB->Data; + Dest = Buffer->Data; + SelectedOperation(&AddBufferFunctions, false, ALL_TYPES); + + /* set origin to passed or current position */ + if (X || Y) { + Buffer->X = X; + Buffer->Y = Y; + } + else { + Buffer->X = Crosshair.X; + Buffer->Y = Crosshair.Y; + } + notify_crosshair_change(true); + ExtraFlag = 0; +} + +/* --------------------------------------------------------------------------- + * loads element data from file/library into buffer + * parse the file with disabled 'PCB mode' (see parser) + * returns false on error + * if successful, update some other stuff and reposition the pastebuffer + */ +bool LoadElementToBuffer(BufferTypePtr Buffer, const char *Name) +{ + ElementTypePtr element; + + ClearBuffer(Buffer); + if (!ParseElement(Buffer->Data, Name)) { + if (Settings.ShowSolderSide) + SwapBuffer(Buffer); + SetBufferBoundingBox(Buffer); + if (Buffer->Data->ElementN) { + element = Buffer->Data->Element->data; + Buffer->X = element->MarkX; + Buffer->Y = element->MarkY; + } + else { + Buffer->X = 0; + Buffer->Y = 0; + } + return (true); + } + + /* release memory which might have been acquired */ + ClearBuffer(Buffer); + return (false); +} + + +/*--------------------------------------------------------------------------- + * Searches for the given element by "footprint" name, and loads it + * into the buffer. + */ + +/* Returns zero on success, non-zero on error. */ +int LoadFootprintByName(BufferTypePtr Buffer, char *Footprint) +{ + return !LoadElementToBuffer(Buffer, Footprint); +} + + +static const char loadfootprint_syntax[] = "LoadFootprint(filename[,refdes,value])"; + +static const char loadfootprint_help[] = "Loads a single footprint by name."; + +/* %start-doc actions LoadFootprint + +Loads a single footprint by name, rather than by reference or through +the library. If a refdes and value are specified, those are inserted +into the footprint as well. The footprint remains in the paste buffer. + +%end-doc */ + +int LoadFootprint(int argc, char **argv, Coord x, Coord y) +{ + char *name = ARG(0); + char *refdes = ARG(1); + char *value = ARG(2); + ElementTypePtr e; + + if (!name) + AFAIL(loadfootprint); + + if (LoadFootprintByName(PASTEBUFFER, name)) + return 1; + + if (PASTEBUFFER->Data->ElementN == 0) { + Message("Footprint %s contains no elements", name); + return 1; + } + if (PASTEBUFFER->Data->ElementN > 1) { + Message("Footprint %s contains multiple elements", name); + return 1; + } + + e = PASTEBUFFER->Data->Element->data; + + if (e->Name[0].TextString) + free(e->Name[0].TextString); + e->Name[0].TextString = strdup(name); + + if (e->Name[1].TextString) + free(e->Name[1].TextString); + e->Name[1].TextString = refdes ? strdup(refdes) : 0; + + if (e->Name[2].TextString) + free(e->Name[2].TextString); + e->Name[2].TextString = value ? strdup(value) : 0; + + return 0; +} + +/*--------------------------------------------------------------------------- + * + * break buffer element into pieces + */ +bool SmashBufferElement(BufferTypePtr Buffer) +{ + ElementTypePtr element; + Cardinal group; + LayerTypePtr clayer, slayer; + + if (Buffer->Data->ElementN != 1) { + Message(_("Error! Buffer doesn't contain a single element\n")); + return (false); + } + /* + * At this point the buffer should contain just a single element. + * Now we detach the single element from the buffer and then clear the + * buffer, ready to receive the smashed elements. As a result of detaching + * it the single element is orphaned from the buffer and thus will not be + * free()'d by FreeDataMemory (called via ClearBuffer). This leaves it + * around for us to smash bits off it. It then becomes our responsibility, + * however, to free the single element when we're finished with it. + */ + element = Buffer->Data->Element->data; + Buffer->Data->Element = NULL; + Buffer->Data->ElementN = 0; + ClearBuffer(Buffer); + ELEMENTLINE_LOOP(element); + { + CreateNewLineOnLayer(&Buffer->Data->SILKLAYER, + line->Point1.X, line->Point1.Y, line->Point2.X, line->Point2.Y, line->Thickness, 0, NoFlags()); + if (line) + line->Number = STRDUP(NAMEONPCB_NAME(element)); + } + END_LOOP; + ARC_LOOP(element); + { + CreateNewArcOnLayer(&Buffer->Data->SILKLAYER, + arc->X, arc->Y, arc->Width, arc->Height, arc->StartAngle, arc->Delta, arc->Thickness, 0, NoFlags()); + } + END_LOOP; + PIN_LOOP(element); + { + FlagType f = NoFlags(); + AddFlags(f, VIAFLAG); + if (TEST_FLAG(HOLEFLAG, pin)) + AddFlags(f, HOLEFLAG); + + CreateNewVia(Buffer->Data, pin->X, pin->Y, pin->Thickness, pin->Clearance, pin->Mask, pin->DrillingHole, pin->Number, f); + } + END_LOOP; + group = GetLayerGroupNumberByNumber(SWAP_IDENT ? solder_silk_layer : component_silk_layer); + clayer = &Buffer->Data->Layer[PCB->LayerGroups.Entries[group][0]]; + group = GetLayerGroupNumberByNumber(SWAP_IDENT ? component_silk_layer : solder_silk_layer); + slayer = &Buffer->Data->Layer[PCB->LayerGroups.Entries[group][0]]; + PAD_LOOP(element); + { + LineTypePtr line; + line = CreateNewLineOnLayer(TEST_FLAG(ONSOLDERFLAG, pad) ? slayer : clayer, + pad->Point1.X, pad->Point1.Y, + pad->Point2.X, pad->Point2.Y, pad->Thickness, pad->Clearance, NoFlags()); + if (line) + line->Number = STRDUP(pad->Number); + } + END_LOOP; + FreeElementMemory(element); + g_slice_free(ElementType, element); + return (true); +} + +/*--------------------------------------------------------------------------- + * + * see if a polygon is a rectangle. If so, canonicalize it. + */ + +static int polygon_is_rectangle(PolygonTypePtr poly) +{ + int i, best; + PointType temp[4]; + if (poly->PointN != 4 || poly->HoleIndexN != 0) + return 0; + best = 0; + for (i = 1; i < 4; i++) + if (poly->Points[i].X < poly->Points[best].X || poly->Points[i].Y < poly->Points[best].Y) + best = i; + for (i = 0; i < 4; i++) + temp[i] = poly->Points[(i + best) % 4]; + if (temp[0].X == temp[1].X) + memcpy(poly->Points, temp, sizeof(temp)); + else { + /* reverse them */ + poly->Points[0] = temp[0]; + poly->Points[1] = temp[3]; + poly->Points[2] = temp[2]; + poly->Points[3] = temp[1]; + } + if (poly->Points[0].X == poly->Points[1].X + && poly->Points[1].Y == poly->Points[2].Y + && poly->Points[2].X == poly->Points[3].X && poly->Points[3].Y == poly->Points[0].Y) + return 1; + return 0; +} + +/*--------------------------------------------------------------------------- + * + * convert buffer contents into an element + */ +bool ConvertBufferToElement(BufferTypePtr Buffer) +{ + ElementTypePtr Element; + Cardinal group; + Cardinal pin_n = 1; + bool hasParts = false, crooked = false; + int onsolder; + bool warned = false; + + if (Buffer->Data->pcb == 0) + Buffer->Data->pcb = PCB; + + Element = CreateNewElement(PCB->Data, NULL, &PCB->Font, NoFlags(), + NULL, NULL, NULL, PASTEBUFFER->X, + PASTEBUFFER->Y, 0, 100, MakeFlags(SWAP_IDENT ? ONSOLDERFLAG : NOFLAG), false); + if (!Element) + return (false); + VIA_LOOP(Buffer->Data); + { + char num[8]; + if (via->Mask < via->Thickness) + via->Mask = via->Thickness + 2 * MASKFRAME; + if (via->Name) + CreateNewPin(Element, via->X, via->Y, via->Thickness, + via->Clearance, via->Mask, via->DrillingHole, + NULL, via->Name, MaskFlags(via->Flags, VIAFLAG | FOUNDFLAG | SELECTEDFLAG | WARNFLAG)); + else { + sprintf(num, "%d", pin_n++); + CreateNewPin(Element, via->X, via->Y, via->Thickness, + via->Clearance, via->Mask, via->DrillingHole, + NULL, num, MaskFlags(via->Flags, VIAFLAG | FOUNDFLAG | SELECTEDFLAG | WARNFLAG)); + } + hasParts = true; + } + END_LOOP; + + for (onsolder = 0; onsolder < 2; onsolder++) { + int silk_layer; + int onsolderflag; + + if ((!onsolder) == (!SWAP_IDENT)) { + silk_layer = component_silk_layer; + onsolderflag = NOFLAG; + } + else { + silk_layer = solder_silk_layer; + onsolderflag = ONSOLDERFLAG; + } + +#define MAYBE_WARN() \ + if (onsolder && !hasParts && !warned) \ + { \ + warned = true; \ + Message \ + (_("Warning: All of the pads are on the opposite\n" \ + "side from the component - that's probably not what\n" \ + "you wanted\n")); \ + } \ + + /* get the component-side SM pads */ + group = GetLayerGroupNumberByNumber(silk_layer); + GROUP_LOOP(Buffer->Data, group); + { + char num[8]; + LINE_LOOP(layer); + { + sprintf(num, "%d", pin_n++); + CreateNewPad(Element, line->Point1.X, + line->Point1.Y, line->Point2.X, + line->Point2.Y, line->Thickness, + line->Clearance, + line->Thickness + line->Clearance, NULL, line->Number ? line->Number : num, MakeFlags(onsolderflag)); + MAYBE_WARN(); + hasParts = true; + } + END_LOOP; + POLYGON_LOOP(layer); + { + Coord x1, y1, x2, y2, w, h, t; + + if (!polygon_is_rectangle(polygon)) { + crooked = true; + continue; + } + + w = polygon->Points[2].X - polygon->Points[0].X; + h = polygon->Points[1].Y - polygon->Points[0].Y; + t = (w < h) ? w : h; + x1 = polygon->Points[0].X + t / 2; + y1 = polygon->Points[0].Y + t / 2; + x2 = x1 + (w - t); + y2 = y1 + (h - t); + + sprintf(num, "%d", pin_n++); + CreateNewPad(Element, + x1, y1, x2, y2, t, + 2 * Settings.Keepaway, t + Settings.Keepaway, NULL, num, MakeFlags(SQUAREFLAG | onsolderflag)); + MAYBE_WARN(); + hasParts = true; + } + END_LOOP; + } + END_LOOP; + } + + /* now add the silkscreen. NOTE: elements must have pads or pins too */ + LINE_LOOP(&Buffer->Data->SILKLAYER); + { + if (line->Number && !NAMEONPCB_NAME(Element)) + NAMEONPCB_NAME(Element) = strdup(line->Number); + CreateNewLineInElement(Element, line->Point1.X, line->Point1.Y, line->Point2.X, line->Point2.Y, line->Thickness); + hasParts = true; + } + END_LOOP; + ARC_LOOP(&Buffer->Data->SILKLAYER); + { + CreateNewArcInElement(Element, arc->X, arc->Y, arc->Width, arc->Height, arc->StartAngle, arc->Delta, arc->Thickness); + hasParts = true; + } + END_LOOP; + if (!hasParts) { + DestroyObject(PCB->Data, ELEMENT_TYPE, Element, Element, Element); + Message(_("There was nothing to convert!\n" "Elements must have some silk, pads or pins.\n")); + return (false); + } + if (crooked) + Message(_("There were polygons that can't be made into pins!\n" "So they were not included in the element\n")); + Element->MarkX = Buffer->X; + Element->MarkY = Buffer->Y; + if (SWAP_IDENT) + SET_FLAG(ONSOLDERFLAG, Element); + SetElementBoundingBox(PCB->Data, Element, &PCB->Font); + ClearBuffer(Buffer); + MoveObjectToBuffer(Buffer->Data, PCB->Data, ELEMENT_TYPE, Element, Element, Element); + SetBufferBoundingBox(Buffer); + return (true); +} + +/* --------------------------------------------------------------------------- + * load PCB into buffer + * parse the file with enabled 'PCB mode' (see parser) + * if successful, update some other stuff + */ +bool LoadLayoutToBuffer(BufferTypePtr Buffer, char *Filename) +{ + PCBTypePtr newPCB = CreateNewPCB(); + + /* new data isn't added to the undo list */ + if (!ParsePCB(newPCB, Filename)) { + /* clear data area and replace pointer */ + ClearBuffer(Buffer); + free(Buffer->Data); + Buffer->Data = newPCB->Data; + newPCB->Data = NULL; + Buffer->X = newPCB->CursorX; + Buffer->Y = newPCB->CursorY; + RemovePCB(newPCB); + Buffer->Data->pcb = PCB; + return (true); + } + + /* release unused memory */ + RemovePCB(newPCB); + Buffer->Data->pcb = PCB; + return (false); +} + +/* --------------------------------------------------------------------------- + * rotates the contents of the pastebuffer + */ +void RotateBuffer(BufferTypePtr Buffer, BYTE Number) +{ + /* rotate vias */ + VIA_LOOP(Buffer->Data); + { + r_delete_entry(Buffer->Data->via_tree, (BoxType *) via); + ROTATE_VIA_LOWLEVEL(via, Buffer->X, Buffer->Y, Number); + SetPinBoundingBox(via); + r_insert_entry(Buffer->Data->via_tree, (BoxType *) via, 0); + } + END_LOOP; + + /* elements */ + ELEMENT_LOOP(Buffer->Data); + { + RotateElementLowLevel(Buffer->Data, element, Buffer->X, Buffer->Y, Number); + } + END_LOOP; + + /* all layer related objects */ + ALLLINE_LOOP(Buffer->Data); + { + r_delete_entry(layer->line_tree, (BoxType *) line); + RotateLineLowLevel(line, Buffer->X, Buffer->Y, Number); + r_insert_entry(layer->line_tree, (BoxType *) line, 0); + } + ENDALL_LOOP; + ALLARC_LOOP(Buffer->Data); + { + r_delete_entry(layer->arc_tree, (BoxType *) arc); + RotateArcLowLevel(arc, Buffer->X, Buffer->Y, Number); + r_insert_entry(layer->arc_tree, (BoxType *) arc, 0); + } + ENDALL_LOOP; + ALLTEXT_LOOP(Buffer->Data); + { + r_delete_entry(layer->text_tree, (BoxType *) text); + RotateTextLowLevel(text, Buffer->X, Buffer->Y, Number); + r_insert_entry(layer->text_tree, (BoxType *) text, 0); + } + ENDALL_LOOP; + ALLPOLYGON_LOOP(Buffer->Data); + { + r_delete_entry(layer->polygon_tree, (BoxType *) polygon); + RotatePolygonLowLevel(polygon, Buffer->X, Buffer->Y, Number); + r_insert_entry(layer->polygon_tree, (BoxType *) polygon, 0); + } + ENDALL_LOOP; + + /* finally the origin and the bounding box */ + ROTATE(Buffer->X, Buffer->Y, Buffer->X, Buffer->Y, Number); + RotateBoxLowLevel(&Buffer->BoundingBox, Buffer->X, Buffer->Y, Number); +} + +static void free_rotate(Coord * x, Coord * y, Coord cx, Coord cy, double cosa, double sina) +{ + double nx, ny; + Coord px = *x - cx; + Coord py = *y - cy; + + nx = px * cosa + py * sina; + ny = py * cosa - px * sina; + + *x = nx + cx; + *y = ny + cy; +} + +void +FreeRotateElementLowLevel(DataTypePtr Data, ElementTypePtr Element, Coord X, Coord Y, double cosa, double sina, Angle angle) +{ + /* solder side objects need a different orientation */ + + /* the text subroutine decides by itself if the direction + * is to be corrected + */ +#if 0 + ELEMENTTEXT_LOOP(Element); + { + if (Data && Data->name_tree[n]) + r_delete_entry(Data->name_tree[n], (BoxType *) text); + RotateTextLowLevel(text, X, Y, Number); + } + END_LOOP; +#endif + ELEMENTLINE_LOOP(Element); + { + free_rotate(&line->Point1.X, &line->Point1.Y, X, Y, cosa, sina); + free_rotate(&line->Point2.X, &line->Point2.Y, X, Y, cosa, sina); + SetLineBoundingBox(line); + } + END_LOOP; + PIN_LOOP(Element); + { + /* pre-delete the pins from the pin-tree before their coordinates change */ + if (Data) + r_delete_entry(Data->pin_tree, (BoxType *) pin); + RestoreToPolygon(Data, PIN_TYPE, Element, pin); + free_rotate(&pin->X, &pin->Y, X, Y, cosa, sina); + SetPinBoundingBox(pin); + } + END_LOOP; + PAD_LOOP(Element); + { + /* pre-delete the pads before their coordinates change */ + if (Data) + r_delete_entry(Data->pad_tree, (BoxType *) pad); + RestoreToPolygon(Data, PAD_TYPE, Element, pad); + free_rotate(&pad->Point1.X, &pad->Point1.Y, X, Y, cosa, sina); + free_rotate(&pad->Point2.X, &pad->Point2.Y, X, Y, cosa, sina); + SetLineBoundingBox((LineType *) pad); + } + END_LOOP; + ARC_LOOP(Element); + { + free_rotate(&arc->X, &arc->Y, X, Y, cosa, sina); + arc->StartAngle = NormalizeAngle(arc->StartAngle + angle); + } + END_LOOP; + + free_rotate(&Element->MarkX, &Element->MarkY, X, Y, cosa, sina); + SetElementBoundingBox(Data, Element, &PCB->Font); + ClearFromPolygon(Data, ELEMENT_TYPE, Element, Element); +} + +void FreeRotateBuffer(BufferTypePtr Buffer, Angle angle) +{ + double cosa, sina; + + cosa = cos(angle * M_PI / 180.0); + sina = sin(angle * M_PI / 180.0); + + /* rotate vias */ + VIA_LOOP(Buffer->Data); + { + r_delete_entry(Buffer->Data->via_tree, (BoxType *) via); + free_rotate(&via->X, &via->Y, Buffer->X, Buffer->Y, cosa, sina); + SetPinBoundingBox(via); + r_insert_entry(Buffer->Data->via_tree, (BoxType *) via, 0); + } + END_LOOP; + + /* elements */ + ELEMENT_LOOP(Buffer->Data); + { + FreeRotateElementLowLevel(Buffer->Data, element, Buffer->X, Buffer->Y, cosa, sina, angle); + } + END_LOOP; + + /* all layer related objects */ + ALLLINE_LOOP(Buffer->Data); + { + r_delete_entry(layer->line_tree, (BoxType *) line); + free_rotate(&line->Point1.X, &line->Point1.Y, Buffer->X, Buffer->Y, cosa, sina); + free_rotate(&line->Point2.X, &line->Point2.Y, Buffer->X, Buffer->Y, cosa, sina); + SetLineBoundingBox(line); + r_insert_entry(layer->line_tree, (BoxType *) line, 0); + } + ENDALL_LOOP; + ALLARC_LOOP(Buffer->Data); + { + r_delete_entry(layer->arc_tree, (BoxType *) arc); + free_rotate(&arc->X, &arc->Y, Buffer->X, Buffer->Y, cosa, sina); + arc->StartAngle = NormalizeAngle(arc->StartAngle + angle); + r_insert_entry(layer->arc_tree, (BoxType *) arc, 0); + } + ENDALL_LOOP; + /* FIXME: rotate text */ + ALLPOLYGON_LOOP(Buffer->Data); + { + r_delete_entry(layer->polygon_tree, (BoxType *) polygon); + POLYGONPOINT_LOOP(polygon); + { + free_rotate(&point->X, &point->Y, Buffer->X, Buffer->Y, cosa, sina); + } + END_LOOP; + SetPolygonBoundingBox(polygon); + r_insert_entry(layer->polygon_tree, (BoxType *) polygon, 0); + } + ENDALL_LOOP; + + SetBufferBoundingBox(Buffer); +} + + +/* -------------------------------------------------------------------------- */ + +static const char freerotatebuffer_syntax[] = "FreeRotateBuffer([Angle])"; + +static const char freerotatebuffer_help[] = + "Rotates the current paste buffer contents by the specified angle. The\n" + "angle is given in degrees. If no angle is given, the user is prompted\n" "for one.\n"; + +/* %start-doc actions FreeRotateBuffer + +Rotates the contents of the pastebuffer by an arbitrary angle. If no +angle is given, the user is prompted for one. + +%end-doc */ + +int ActionFreeRotateBuffer(int argc, char **argv, Coord x, Coord y) +{ + char *angle_s; + + if (argc < 1) + angle_s = gui->prompt_for("Enter Rotation (degrees, CCW):", "0"); + else + angle_s = argv[0]; + + notify_crosshair_change(false); + FreeRotateBuffer(PASTEBUFFER, strtod(angle_s, 0)); + notify_crosshair_change(true); + return 0; +} + +/* --------------------------------------------------------------------------- + * initializes the buffers by allocating memory + */ +void InitBuffers(void) +{ + int i; + + for (i = 0; i < MAX_BUFFER; i++) + Buffers[i].Data = CreateNewBuffer(); +} + +void SwapBuffers(void) +{ + int i; + + for (i = 0; i < MAX_BUFFER; i++) + SwapBuffer(&Buffers[i]); + SetCrosshairRangeToBuffer(); +} + +void MirrorBuffer(BufferTypePtr Buffer) +{ + int i; + + if (Buffer->Data->ElementN) { + Message(_("You can't mirror a buffer that has elements!\n")); + return; + } + for (i = 0; i < max_copper_layer + 2; i++) { + LayerTypePtr layer = Buffer->Data->Layer + i; + if (layer->TextN) { + Message(_("You can't mirror a buffer that has text!\n")); + return; + } + } + /* set buffer offset to 'mark' position */ + Buffer->X = SWAP_X(Buffer->X); + Buffer->Y = SWAP_Y(Buffer->Y); + VIA_LOOP(Buffer->Data); + { + via->X = SWAP_X(via->X); + via->Y = SWAP_Y(via->Y); + } + END_LOOP; + ALLLINE_LOOP(Buffer->Data); + { + line->Point1.X = SWAP_X(line->Point1.X); + line->Point1.Y = SWAP_Y(line->Point1.Y); + line->Point2.X = SWAP_X(line->Point2.X); + line->Point2.Y = SWAP_Y(line->Point2.Y); + } + ENDALL_LOOP; + ALLARC_LOOP(Buffer->Data); + { + arc->X = SWAP_X(arc->X); + arc->Y = SWAP_Y(arc->Y); + arc->StartAngle = SWAP_ANGLE(arc->StartAngle); + arc->Delta = SWAP_DELTA(arc->Delta); + SetArcBoundingBox(arc); + } + ENDALL_LOOP; + ALLPOLYGON_LOOP(Buffer->Data); + { + POLYGONPOINT_LOOP(polygon); + { + point->X = SWAP_X(point->X); + point->Y = SWAP_Y(point->Y); + } + END_LOOP; + SetPolygonBoundingBox(polygon); + } + ENDALL_LOOP; + SetBufferBoundingBox(Buffer); +} + + +/* --------------------------------------------------------------------------- + * flip components/tracks from one side to the other + */ +static void SwapBuffer(BufferTypePtr Buffer) +{ + int j, k; + Cardinal sgroup, cgroup; + LayerType swap; + + ELEMENT_LOOP(Buffer->Data); + { + r_delete_element(Buffer->Data, element); + MirrorElementCoordinates(Buffer->Data, element, 0); + } + END_LOOP; + /* set buffer offset to 'mark' position */ + Buffer->X = SWAP_X(Buffer->X); + Buffer->Y = SWAP_Y(Buffer->Y); + VIA_LOOP(Buffer->Data); + { + r_delete_entry(Buffer->Data->via_tree, (BoxType *) via); + via->X = SWAP_X(via->X); + via->Y = SWAP_Y(via->Y); + SetPinBoundingBox(via); + r_insert_entry(Buffer->Data->via_tree, (BoxType *) via, 0); + } + END_LOOP; + ALLLINE_LOOP(Buffer->Data); + { + r_delete_entry(layer->line_tree, (BoxType *) line); + line->Point1.X = SWAP_X(line->Point1.X); + line->Point1.Y = SWAP_Y(line->Point1.Y); + line->Point2.X = SWAP_X(line->Point2.X); + line->Point2.Y = SWAP_Y(line->Point2.Y); + SetLineBoundingBox(line); + r_insert_entry(layer->line_tree, (BoxType *) line, 0); + } + ENDALL_LOOP; + ALLARC_LOOP(Buffer->Data); + { + r_delete_entry(layer->arc_tree, (BoxType *) arc); + arc->X = SWAP_X(arc->X); + arc->Y = SWAP_Y(arc->Y); + arc->StartAngle = SWAP_ANGLE(arc->StartAngle); + arc->Delta = SWAP_DELTA(arc->Delta); + SetArcBoundingBox(arc); + r_insert_entry(layer->arc_tree, (BoxType *) arc, 0); + } + ENDALL_LOOP; + ALLPOLYGON_LOOP(Buffer->Data); + { + r_delete_entry(layer->polygon_tree, (BoxType *) polygon); + POLYGONPOINT_LOOP(polygon); + { + point->X = SWAP_X(point->X); + point->Y = SWAP_Y(point->Y); + } + END_LOOP; + SetPolygonBoundingBox(polygon); + r_insert_entry(layer->polygon_tree, (BoxType *) polygon, 0); + /* hmmm, how to handle clip */ + } + ENDALL_LOOP; + ALLTEXT_LOOP(Buffer->Data); + { + r_delete_entry(layer->text_tree, (BoxType *) text); + text->X = SWAP_X(text->X); + text->Y = SWAP_Y(text->Y); + TOGGLE_FLAG(ONSOLDERFLAG, text); + SetTextBoundingBox(&PCB->Font, text); + r_insert_entry(layer->text_tree, (BoxType *) text, 0); + } + ENDALL_LOOP; + /* swap silkscreen layers */ + swap = Buffer->Data->Layer[solder_silk_layer]; + Buffer->Data->Layer[solder_silk_layer] = Buffer->Data->Layer[component_silk_layer]; + Buffer->Data->Layer[component_silk_layer] = swap; + + /* swap layer groups when balanced */ + sgroup = GetLayerGroupNumberByNumber(solder_silk_layer); + cgroup = GetLayerGroupNumberByNumber(component_silk_layer); + if (PCB->LayerGroups.Number[cgroup] == PCB->LayerGroups.Number[sgroup]) { + for (j = k = 0; j < PCB->LayerGroups.Number[sgroup]; j++) { + int t1, t2; + Cardinal cnumber = PCB->LayerGroups.Entries[cgroup][k]; + Cardinal snumber = PCB->LayerGroups.Entries[sgroup][j]; + + if (snumber >= max_copper_layer) + continue; + swap = Buffer->Data->Layer[snumber]; + + while (cnumber >= max_copper_layer) { + k++; + cnumber = PCB->LayerGroups.Entries[cgroup][k]; + } + Buffer->Data->Layer[snumber] = Buffer->Data->Layer[cnumber]; + Buffer->Data->Layer[cnumber] = swap; + k++; + /* move the thermal flags with the layers */ + ALLPIN_LOOP(Buffer->Data); + { + t1 = TEST_THERM(snumber, pin); + t2 = TEST_THERM(cnumber, pin); + ASSIGN_THERM(snumber, t2, pin); + ASSIGN_THERM(cnumber, t1, pin); + } + ENDALL_LOOP; + VIA_LOOP(Buffer->Data); + { + t1 = TEST_THERM(snumber, via); + t2 = TEST_THERM(cnumber, via); + ASSIGN_THERM(snumber, t2, via); + ASSIGN_THERM(cnumber, t1, via); + } + END_LOOP; + } + } + SetBufferBoundingBox(Buffer); +} + +/* ---------------------------------------------------------------------- + * moves the passed object to the passed buffer and removes it + * from its original place + */ +void *MoveObjectToBuffer(DataTypePtr Destination, DataTypePtr Src, int Type, void *Ptr1, void *Ptr2, void *Ptr3) +{ + /* setup local identifiers used by move operations */ + Dest = Destination; + Source = Src; + return (ObjectOperation(&MoveBufferFunctions, Type, Ptr1, Ptr2, Ptr3)); +} + +/* ---------------------------------------------------------------------- + * Adds the passed object to the passed buffer + */ +void *CopyObjectToBuffer(DataTypePtr Destination, DataTypePtr Src, int Type, void *Ptr1, void *Ptr2, void *Ptr3) +{ + /* setup local identifiers used by Add operations */ + Dest = Destination; + Source = Src; + return (ObjectOperation(&AddBufferFunctions, Type, Ptr1, Ptr2, Ptr3)); +} + +/* ---------------------------------------------------------------------- */ + +static const char pastebuffer_syntax[] = + "PasteBuffer(AddSelected|Clear|1..MAX_BUFFER)\n" + "PasteBuffer(Rotate, 1..3)\n" "PasteBuffer(Convert|Save|Restore|Mirror)\n" "PasteBuffer(ToLayout, X, Y, units)"; + +static const char pastebuffer_help[] = "Various operations on the paste buffer."; + +/* %start-doc actions PasteBuffer + +There are a number of paste buffers; the actual limit is a +compile-time constant @code{MAX_BUFFER} in @file{globalconst.h}. It +is currently @code{5}. One of these is the ``current'' paste buffer, +often referred to as ``the'' paste buffer. + +@table @code + +@item AddSelected +Copies the selected objects to the current paste buffer. + +@item Clear +Remove all objects from the current paste buffer. + +@item Convert +Convert the current paste buffer to an element. Vias are converted to +pins, lines are converted to pads. + +@item Restore +Convert any elements in the paste buffer back to vias and lines. + +@item Mirror +Flip all objects in the paste buffer vertically (up/down flip). To mirror +horizontally, combine this with rotations. + +@item Rotate +Rotates the current buffer. The number to pass is 1..3, where 1 means +90 degrees counter clockwise, 2 means 180 degrees, and 3 means 90 +degrees clockwise (270 CCW). + +@item Save +Saves any elements in the current buffer to the indicated file. + +@item ToLayout +Pastes any elements in the current buffer to the indicated X, Y +coordinates in the layout. The @code{X} and @code{Y} are treated like +@code{delta} is for many other objects. For each, if it's prefixed by +@code{+} or @code{-}, then that amount is relative to the last +location. Otherwise, it's absolute. Units can be +@code{mil} or @code{mm}; if unspecified, units are PCB's internal +units, currently 1/100 mil. + + +@item 1..MAX_BUFFER +Selects the given buffer to be the current paste buffer. + +@end table + +%end-doc */ + +static int ActionPasteBuffer(int argc, char **argv, Coord x, Coord y) +{ + char *function = argc ? argv[0] : (char *) ""; + char *sbufnum = argc > 1 ? argv[1] : (char *) ""; + char *name; + static char *default_file = NULL; + int free_name = 0; + + notify_crosshair_change(false); + if (function) { + switch (GetFunctionID(function)) { + /* clear contents of paste buffer */ + case F_Clear: + ClearBuffer(PASTEBUFFER); + break; + + /* copies objects to paste buffer */ + case F_AddSelected: + AddSelectedToBuffer(PASTEBUFFER, 0, 0, false); + break; + + /* converts buffer contents into an element */ + case F_Convert: + ConvertBufferToElement(PASTEBUFFER); + break; + + /* break up element for editing */ + case F_Restore: + SmashBufferElement(PASTEBUFFER); + break; + + /* Mirror buffer */ + case F_Mirror: + MirrorBuffer(PASTEBUFFER); + break; + + case F_Rotate: + if (sbufnum) { + RotateBuffer(PASTEBUFFER, (BYTE) atoi(sbufnum)); + SetCrosshairRangeToBuffer(); + } + break; + + case F_Save: + if (PASTEBUFFER->Data->ElementN == 0) { + Message(_("Buffer has no elements!\n")); + break; + } + free_name = 0; + if (argc <= 1) { + name = gui->fileselect(_("Save Paste Buffer As ..."), + _("Choose a file to save the contents of the\n" + "paste buffer to.\n"), default_file, ".fp", "footprint", 0); + + if (default_file) { + free(default_file); + default_file = NULL; + } + if (name && *name) { + default_file = strdup(name); + } + free_name = 1; + } + + else + name = argv[1]; + + { + FILE *exist; + + if ((exist = fopen(name, "r"))) { + fclose(exist); + if (gui->confirm_dialog(_("File exists! Ok to overwrite?"), 0)) + SaveBufferElements(name); + } + else + SaveBufferElements(name); + + if (free_name && name) + free(name); + } + break; + + case F_ToLayout: + { + static Coord oldx = 0, oldy = 0; + Coord x, y; + bool absolute; + + if (argc == 1) { + x = y = 0; + } + else if (argc == 3 || argc == 4) { + x = GetValue(ARG(1), ARG(3), &absolute); + if (!absolute) + x += oldx; + y = GetValue(ARG(2), ARG(3), &absolute); + if (!absolute) + y += oldy; + } + else { + notify_crosshair_change(true); + AFAIL(pastebuffer); + } + + oldx = x; + oldy = y; + if (CopyPastebufferToLayout(x, y)) + SetChangedFlag(true); + } + break; + + /* set number */ + default: + { + int number = atoi(function); + + /* correct number */ + if (number) + SetBufferNumber(number - 1); + } + } + } + + notify_crosshair_change(true); + return 0; +} + +/* --------------------------------------------------------------------------- */ + +HID_Action buffer_action_list[] = { + {"FreeRotateBuffer", 0, ActionFreeRotateBuffer, + freerotatebuffer_syntax, freerotatebuffer_help} + , + {"LoadFootprint", 0, LoadFootprint, + 0, 0} + , + {"PasteBuffer", 0, ActionPasteBuffer, + pastebuffer_help, pastebuffer_syntax} +}; + +REGISTER_ACTIONS(buffer_action_list) Index: 1.0.8/src/buffer.h =================================================================== --- 1.0.8/src/buffer.h (nonexistent) +++ 1.0.8/src/buffer.h (revision 1136) @@ -0,0 +1,57 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + * RCS: $Id$ + */ + +/* prototypes for buffer handling routines + */ + +#ifndef PCB_BUFFER_H +#define PCB_BUFFER_H + +#include "global.h" + +/* --------------------------------------------------------------------------- + * prototypes + */ +void SetBufferBoundingBox(BufferTypePtr); +void ClearBuffer(BufferTypePtr); +void AddSelectedToBuffer(BufferTypePtr, Coord, Coord, bool); +bool LoadElementToBuffer(BufferTypePtr, const char *); +bool ConvertBufferToElement(BufferTypePtr); +bool SmashBufferElement(BufferTypePtr); +bool LoadLayoutToBuffer(BufferTypePtr, char *); +void RotateBuffer(BufferTypePtr, BYTE); +void SelectPasteBuffer(int); +void SwapBuffers(void); +void MirrorBuffer(BufferTypePtr); +void InitBuffers(void); +void *MoveObjectToBuffer(DataTypePtr, DataTypePtr, int, void *, void *, void *); +void *CopyObjectToBuffer(DataTypePtr, DataTypePtr, int, void *, void *, void *); + +/* This action is called from ActionElementAddIf() */ +int LoadFootprint(int argc, char **argv, Coord x, Coord y); + +#endif Index: 1.0.8/src/buildin.c.in =================================================================== --- 1.0.8/src/buildin.c.in (nonexistent) +++ 1.0.8/src/buildin.c.in (revision 1136) @@ -0,0 +1,10 @@ +print [@ +/**** This file autogenerated by scconfig, do not edit ****/ +#include +#include "plugins.h" +#include "buildin.h" +void buildin_init(void) +{ +@/local/pcb/buildin_init@ +} +@] Index: 1.0.8/src/buildin.h =================================================================== --- 1.0.8/src/buildin.h (nonexistent) +++ 1.0.8/src/buildin.h (revision 1136) @@ -0,0 +1,2 @@ +/* Run the init code of all buildins. */ +void buildin_init(void); Index: 1.0.8/src/change.c =================================================================== --- 1.0.8/src/change.c (nonexistent) +++ 1.0.8/src/change.c (revision 1136) @@ -0,0 +1,2548 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996, 2005 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* functions used to change object properties + * + */ + +#include "config.h" + +#include +#include +#include + +#include "global.h" + +#include "change.h" +#include "create.h" +#include "crosshair.h" +#include "data.h" +#include "draw.h" +#include "error.h" +#include "mymem.h" +#include "misc.h" +#include "mirror.h" +#include "polygon.h" +#include "rats.h" +#include "remove.h" +#include "rtree.h" +#include "search.h" +#include "select.h" +#include "set.h" +#include "thermal.h" +#include "undo.h" + + +RCSID("$Id$"); + +/* --------------------------------------------------------------------------- + * some local prototypes + */ +static void *ChangePinSize(ElementTypePtr, PinTypePtr); +static void *ChangePinClearSize(ElementTypePtr, PinTypePtr); +static void *ChangePinMaskSize(ElementTypePtr, PinTypePtr); +static void *ChangePadSize(ElementTypePtr, PadTypePtr); +static void *ChangePadClearSize(ElementTypePtr, PadTypePtr); +static void *ChangePadMaskSize(ElementTypePtr, PadTypePtr); +static void *ChangePin2ndSize(ElementTypePtr, PinTypePtr); +static void *ChangeElement1stSize(ElementTypePtr); +static void *ChangeElement2ndSize(ElementTypePtr); +static void *ChangeViaSize(PinTypePtr); +static void *ChangeVia2ndSize(PinTypePtr); +static void *ChangeViaClearSize(PinTypePtr); +static void *ChangeViaMaskSize(PinTypePtr); +static void *ChangeLineSize(LayerTypePtr, LineTypePtr); +static void *ChangeLineClearSize(LayerTypePtr, LineTypePtr); +static void *ChangePolygonClearSize(LayerTypePtr, PolygonTypePtr); +static void *ChangeArcSize(LayerTypePtr, ArcTypePtr); +static void *ChangeArcClearSize(LayerTypePtr, ArcTypePtr); +static void *ChangeTextSize(LayerTypePtr, TextTypePtr); +static void *ChangeElementSize(ElementTypePtr); +static void *ChangeElementNameSize(ElementTypePtr); +static void *ChangeElementClearSize(ElementTypePtr); +static void *ChangePinName(ElementTypePtr, PinTypePtr); +static void *ChangePadName(ElementTypePtr, PadTypePtr); +static void *ChangePinNum(ElementTypePtr, PinTypePtr); +static void *ChangePadNum(ElementTypePtr, PadTypePtr); +static void *ChangeViaName(PinTypePtr); +static void *ChangeLineName(LayerTypePtr, LineTypePtr); +static void *ChangeElementName(ElementTypePtr); +static void *ChangeElementNonetlist(ElementTypePtr); +static void *ChangeTextName(LayerTypePtr, TextTypePtr); +static void *ChangeElementSquare(ElementTypePtr); +static void *SetElementSquare(ElementTypePtr); +static void *ClrElementSquare(ElementTypePtr); +static void *ChangeElementOctagon(ElementTypePtr); +static void *SetElementOctagon(ElementTypePtr); +static void *ClrElementOctagon(ElementTypePtr); +static void *ChangeViaSquare(PinTypePtr); +static void *ChangePinSquare(ElementTypePtr, PinTypePtr); +static void *SetPinSquare(ElementTypePtr, PinTypePtr); +static void *ClrPinSquare(ElementTypePtr, PinTypePtr); +static void *ChangePinOctagon(ElementTypePtr, PinTypePtr); +static void *SetPinOctagon(ElementTypePtr, PinTypePtr); +static void *ClrPinOctagon(ElementTypePtr, PinTypePtr); +static void *ChangeViaOctagon(PinTypePtr); +static void *SetViaOctagon(PinTypePtr); +static void *ClrViaOctagon(PinTypePtr); +static void *ChangePadSquare(ElementTypePtr, PadTypePtr); +static void *SetPadSquare(ElementTypePtr, PadTypePtr); +static void *ClrPadSquare(ElementTypePtr, PadTypePtr); +static void *ChangeViaThermal(PinTypePtr); +static void *ChangePinThermal(ElementTypePtr, PinTypePtr); +static void *ChangeLineJoin(LayerTypePtr, LineTypePtr); +static void *SetLineJoin(LayerTypePtr, LineTypePtr); +static void *ClrLineJoin(LayerTypePtr, LineTypePtr); +static void *ChangeArcJoin(LayerTypePtr, ArcTypePtr); +static void *SetArcJoin(LayerTypePtr, ArcTypePtr); +static void *ClrArcJoin(LayerTypePtr, ArcTypePtr); +static void *ChangeTextJoin(LayerTypePtr, TextTypePtr); +static void *SetTextJoin(LayerTypePtr, TextTypePtr); +static void *ClrTextJoin(LayerTypePtr, TextTypePtr); +static void *ChangePolyClear(LayerTypePtr, PolygonTypePtr); + +/* --------------------------------------------------------------------------- + * some local identifiers + */ +static Coord Delta; /* change of size */ +static Coord Absolute; /* Absolute size */ +static char *NewName; /* new name */ +static ObjectFunctionType ChangeSizeFunctions = { + ChangeLineSize, + ChangeTextSize, + ChangePolyClear, + ChangeViaSize, + ChangeElementSize, /* changes silk screen line width */ + ChangeElementNameSize, + ChangePinSize, + ChangePadSize, + NULL, + NULL, + ChangeArcSize, + NULL +}; + +static ObjectFunctionType Change1stSizeFunctions = { + ChangeLineSize, + ChangeTextSize, + ChangePolyClear, + ChangeViaSize, + ChangeElement1stSize, + ChangeElementNameSize, + ChangePinSize, + ChangePadSize, + NULL, + NULL, + ChangeArcSize, + NULL +}; + +static ObjectFunctionType Change2ndSizeFunctions = { + NULL, + NULL, + NULL, + ChangeVia2ndSize, + ChangeElement2ndSize, + NULL, + ChangePin2ndSize, + NULL, + NULL, + NULL, + NULL, + NULL +}; + +static ObjectFunctionType ChangeThermalFunctions = { + NULL, + NULL, + NULL, + ChangeViaThermal, + NULL, + NULL, + ChangePinThermal, + NULL, + NULL, + NULL, + NULL, + NULL +}; + +static ObjectFunctionType ChangeClearSizeFunctions = { + ChangeLineClearSize, + NULL, + ChangePolygonClearSize, /* just to tell the user not to :-) */ + ChangeViaClearSize, + ChangeElementClearSize, + NULL, + ChangePinClearSize, + ChangePadClearSize, + NULL, + NULL, + ChangeArcClearSize, + NULL +}; + +static ObjectFunctionType ChangeNameFunctions = { + ChangeLineName, + ChangeTextName, + NULL, + ChangeViaName, + ChangeElementName, + NULL, + ChangePinName, + ChangePadName, + NULL, + NULL, + NULL, + NULL +}; + +static ObjectFunctionType ChangePinnumFunctions = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + ChangePinNum, + ChangePadNum, + NULL, + NULL, + NULL, + NULL +}; + +static ObjectFunctionType ChangeSquareFunctions = { + NULL, + NULL, + NULL, + ChangeViaSquare, + ChangeElementSquare, + NULL, + ChangePinSquare, + ChangePadSquare, + NULL, + NULL, + NULL, + NULL +}; + +static ObjectFunctionType ChangeNonetlistFunctions = { + NULL, + NULL, + NULL, + NULL, + ChangeElementNonetlist, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL +}; + +static ObjectFunctionType ChangeJoinFunctions = { + ChangeLineJoin, + ChangeTextJoin, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + ChangeArcJoin, + NULL +}; + +static ObjectFunctionType ChangeOctagonFunctions = { + NULL, + NULL, + NULL, + ChangeViaOctagon, + ChangeElementOctagon, + NULL, + ChangePinOctagon, + NULL, + NULL, + NULL, + NULL, + NULL +}; + +static ObjectFunctionType ChangeMaskSizeFunctions = { + NULL, + NULL, + NULL, + ChangeViaMaskSize, +#if 0 + ChangeElementMaskSize, +#else + NULL, +#endif + NULL, + ChangePinMaskSize, + ChangePadMaskSize, + NULL, + NULL, + NULL, + NULL +}; + +static ObjectFunctionType SetSquareFunctions = { + NULL, + NULL, + NULL, + NULL, + SetElementSquare, + NULL, + SetPinSquare, + SetPadSquare, + NULL, + NULL, + NULL, + NULL +}; + +static ObjectFunctionType SetJoinFunctions = { + SetLineJoin, + SetTextJoin, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + SetArcJoin, + NULL +}; + +static ObjectFunctionType SetOctagonFunctions = { + NULL, + NULL, + NULL, + SetViaOctagon, + SetElementOctagon, + NULL, + SetPinOctagon, + NULL, + NULL, + NULL, + NULL, + NULL +}; + +static ObjectFunctionType ClrSquareFunctions = { + NULL, + NULL, + NULL, + NULL, + ClrElementSquare, + NULL, + ClrPinSquare, + ClrPadSquare, + NULL, + NULL, + NULL, + NULL +}; + +static ObjectFunctionType ClrJoinFunctions = { + ClrLineJoin, + ClrTextJoin, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + ClrArcJoin, + NULL +}; + +static ObjectFunctionType ClrOctagonFunctions = { + NULL, + NULL, + NULL, + ClrViaOctagon, + ClrElementOctagon, + NULL, + ClrPinOctagon, + NULL, + NULL, + NULL, + NULL, + NULL +}; + +/* --------------------------------------------------------------------------- + * changes the thermal on a via + * returns TRUE if changed + */ +static void *ChangeViaThermal(PinTypePtr Via) +{ + AddObjectToClearPolyUndoList(VIA_TYPE, Via, Via, Via, false); + RestoreToPolygon(PCB->Data, VIA_TYPE, CURRENT, Via); + AddObjectToFlagUndoList(VIA_TYPE, Via, Via, Via); + if (!Delta) /* remove the thermals */ + CLEAR_THERM(INDEXOFCURRENT, Via); + else + ASSIGN_THERM(INDEXOFCURRENT, Delta, Via); + AddObjectToClearPolyUndoList(VIA_TYPE, Via, Via, Via, true); + ClearFromPolygon(PCB->Data, VIA_TYPE, CURRENT, Via); + DrawVia(Via); + return Via; +} + +/* --------------------------------------------------------------------------- + * changes the thermal on a pin + * returns TRUE if changed + */ +static void *ChangePinThermal(ElementTypePtr element, PinTypePtr Pin) +{ + AddObjectToClearPolyUndoList(PIN_TYPE, element, Pin, Pin, false); + RestoreToPolygon(PCB->Data, VIA_TYPE, CURRENT, Pin); + AddObjectToFlagUndoList(PIN_TYPE, element, Pin, Pin); + if (!Delta) /* remove the thermals */ + CLEAR_THERM(INDEXOFCURRENT, Pin); + else + ASSIGN_THERM(INDEXOFCURRENT, Delta, Pin); + AddObjectToClearPolyUndoList(PIN_TYPE, element, Pin, Pin, true); + ClearFromPolygon(PCB->Data, VIA_TYPE, CURRENT, Pin); + DrawPin(Pin); + return Pin; +} + +/* --------------------------------------------------------------------------- + * changes the size of a via + * returns TRUE if changed + */ +static void *ChangeViaSize(PinTypePtr Via) +{ + Coord value = Absolute ? Absolute : Via->Thickness + Delta; + + if (TEST_FLAG(LOCKFLAG, Via)) + return (NULL); + if (!TEST_FLAG(HOLEFLAG, Via) && value <= MAX_PINORVIASIZE && + value >= MIN_PINORVIASIZE && value >= Via->DrillingHole + MIN_PINORVIACOPPER && value != Via->Thickness) { + AddObjectToSizeUndoList(VIA_TYPE, Via, Via, Via); + EraseVia(Via); + r_delete_entry(PCB->Data->via_tree, (BoxType *) Via); + RestoreToPolygon(PCB->Data, PIN_TYPE, Via, Via); + if (Via->Mask) { + AddObjectToMaskSizeUndoList(VIA_TYPE, Via, Via, Via); + Via->Mask += value - Via->Thickness; + } + Via->Thickness = value; + SetPinBoundingBox(Via); + r_insert_entry(PCB->Data->via_tree, (BoxType *) Via, 0); + ClearFromPolygon(PCB->Data, VIA_TYPE, Via, Via); + DrawVia(Via); + return (Via); + } + return (NULL); +} + +/* --------------------------------------------------------------------------- + * changes the drilling hole of a via + * returns TRUE if changed + */ +static void *ChangeVia2ndSize(PinTypePtr Via) +{ + Coord value = (Absolute) ? Absolute : Via->DrillingHole + Delta; + + if (TEST_FLAG(LOCKFLAG, Via)) + return (NULL); + if (value <= MAX_PINORVIASIZE && + value >= MIN_PINORVIAHOLE && (TEST_FLAG(HOLEFLAG, Via) || value <= Via->Thickness - MIN_PINORVIACOPPER) + && value != Via->DrillingHole) { + AddObjectTo2ndSizeUndoList(VIA_TYPE, Via, Via, Via); + EraseVia(Via); + RestoreToPolygon(PCB->Data, VIA_TYPE, Via, Via); + Via->DrillingHole = value; + if (TEST_FLAG(HOLEFLAG, Via)) { + AddObjectToSizeUndoList(VIA_TYPE, Via, Via, Via); + Via->Thickness = value; + } + ClearFromPolygon(PCB->Data, VIA_TYPE, Via, Via); + DrawVia(Via); + return (Via); + } + return (NULL); +} + +/* --------------------------------------------------------------------------- + * changes the clearance size of a via + * returns TRUE if changed + */ +static void *ChangeViaClearSize(PinTypePtr Via) +{ + Coord value = (Absolute) ? Absolute : Via->Clearance + Delta; + + if (TEST_FLAG(LOCKFLAG, Via)) + return (NULL); + value = MIN(MAX_LINESIZE, value); + if (value < 0) + value = 0; + if (Delta < 0 && value < PCB->Bloat * 2) + value = 0; + if ((Delta > 0 || Absolute) && value < PCB->Bloat * 2) + value = PCB->Bloat * 2 + 2; + if (Via->Clearance == value) + return NULL; + RestoreToPolygon(PCB->Data, VIA_TYPE, Via, Via); + AddObjectToClearSizeUndoList(VIA_TYPE, Via, Via, Via); + EraseVia(Via); + r_delete_entry(PCB->Data->via_tree, (BoxType *) Via); + Via->Clearance = value; + SetPinBoundingBox(Via); + r_insert_entry(PCB->Data->via_tree, (BoxType *) Via, 0); + ClearFromPolygon(PCB->Data, VIA_TYPE, Via, Via); + DrawVia(Via); + Via->Element = NULL; + return (Via); +} + + +/* --------------------------------------------------------------------------- + * changes the size of a pin + * returns TRUE if changed + */ +static void *ChangePinSize(ElementTypePtr Element, PinTypePtr Pin) +{ + Coord value = (Absolute) ? Absolute : Pin->Thickness + Delta; + + if (TEST_FLAG(LOCKFLAG, Pin)) + return (NULL); + if (!TEST_FLAG(HOLEFLAG, Pin) && value <= MAX_PINORVIASIZE && + value >= MIN_PINORVIASIZE && value >= Pin->DrillingHole + MIN_PINORVIACOPPER && value != Pin->Thickness) { + AddObjectToSizeUndoList(PIN_TYPE, Element, Pin, Pin); + AddObjectToMaskSizeUndoList(PIN_TYPE, Element, Pin, Pin); + ErasePin(Pin); + r_delete_entry(PCB->Data->pin_tree, &Pin->BoundingBox); + RestoreToPolygon(PCB->Data, PIN_TYPE, Element, Pin); + Pin->Mask += value - Pin->Thickness; + Pin->Thickness = value; + /* SetElementBB updates all associated rtrees */ + SetElementBoundingBox(PCB->Data, Element, &PCB->Font); + ClearFromPolygon(PCB->Data, PIN_TYPE, Element, Pin); + DrawPin(Pin); + return (Pin); + } + return (NULL); +} + +/* --------------------------------------------------------------------------- + * changes the clearance size of a pin + * returns TRUE if changed + */ +static void *ChangePinClearSize(ElementTypePtr Element, PinTypePtr Pin) +{ + Coord value = (Absolute) ? Absolute : Pin->Clearance + Delta; + + if (TEST_FLAG(LOCKFLAG, Pin)) + return (NULL); + value = MIN(MAX_LINESIZE, value); + if (value < 0) + value = 0; + if (Delta < 0 && value < PCB->Bloat * 2) + value = 0; + if ((Delta > 0 || Absolute) && value < PCB->Bloat * 2) + value = PCB->Bloat * 2 + 2; + if (Pin->Clearance == value) + return NULL; + RestoreToPolygon(PCB->Data, PIN_TYPE, Element, Pin); + AddObjectToClearSizeUndoList(PIN_TYPE, Element, Pin, Pin); + ErasePin(Pin); + r_delete_entry(PCB->Data->pin_tree, &Pin->BoundingBox); + Pin->Clearance = value; + /* SetElementBB updates all associated rtrees */ + SetElementBoundingBox(PCB->Data, Element, &PCB->Font); + ClearFromPolygon(PCB->Data, PIN_TYPE, Element, Pin); + DrawPin(Pin); + return (Pin); +} + +/* --------------------------------------------------------------------------- + * changes the size of a pad + * returns TRUE if changed + */ +static void *ChangePadSize(ElementTypePtr Element, PadTypePtr Pad) +{ + Coord value = (Absolute) ? Absolute : Pad->Thickness + Delta; + + if (TEST_FLAG(LOCKFLAG, Pad)) + return (NULL); + if (value <= MAX_PADSIZE && value >= MIN_PADSIZE && value != Pad->Thickness) { + AddObjectToSizeUndoList(PAD_TYPE, Element, Pad, Pad); + AddObjectToMaskSizeUndoList(PAD_TYPE, Element, Pad, Pad); + RestoreToPolygon(PCB->Data, PAD_TYPE, Element, Pad); + ErasePad(Pad); + r_delete_entry(PCB->Data->pad_tree, &Pad->BoundingBox); + Pad->Mask += value - Pad->Thickness; + Pad->Thickness = value; + /* SetElementBB updates all associated rtrees */ + SetElementBoundingBox(PCB->Data, Element, &PCB->Font); + ClearFromPolygon(PCB->Data, PAD_TYPE, Element, Pad); + DrawPad(Pad); + return (Pad); + } + return (NULL); +} + +/* --------------------------------------------------------------------------- + * changes the clearance size of a pad + * returns TRUE if changed + */ +static void *ChangePadClearSize(ElementTypePtr Element, PadTypePtr Pad) +{ + Coord value = (Absolute) ? Absolute : Pad->Clearance + Delta; + + if (TEST_FLAG(LOCKFLAG, Pad)) + return (NULL); + value = MIN(MAX_LINESIZE, value); + if (value < 0) + value = 0; + if (Delta < 0 && value < PCB->Bloat * 2) + value = 0; + if ((Delta > 0 || Absolute) && value < PCB->Bloat * 2) + value = PCB->Bloat * 2 + 2; + if (value == Pad->Clearance) + return NULL; + AddObjectToClearSizeUndoList(PAD_TYPE, Element, Pad, Pad); + RestoreToPolygon(PCB->Data, PAD_TYPE, Element, Pad); + ErasePad(Pad); + r_delete_entry(PCB->Data->pad_tree, &Pad->BoundingBox); + Pad->Clearance = value; + /* SetElementBB updates all associated rtrees */ + SetElementBoundingBox(PCB->Data, Element, &PCB->Font); + ClearFromPolygon(PCB->Data, PAD_TYPE, Element, Pad); + DrawPad(Pad); + return Pad; +} + +/* --------------------------------------------------------------------------- + * changes the drilling hole of all pins of an element + * returns TRUE if changed + */ +static void *ChangeElement2ndSize(ElementTypePtr Element) +{ + bool changed = false; + Coord value; + + if (TEST_FLAG(LOCKFLAG, Element)) + return (NULL); + PIN_LOOP(Element); + { + value = (Absolute) ? Absolute : pin->DrillingHole + Delta; + if (value <= MAX_PINORVIASIZE && + value >= MIN_PINORVIAHOLE && (TEST_FLAG(HOLEFLAG, pin) || value <= pin->Thickness - MIN_PINORVIACOPPER) + && value != pin->DrillingHole) { + changed = true; + AddObjectTo2ndSizeUndoList(PIN_TYPE, Element, pin, pin); + ErasePin(pin); + RestoreToPolygon(PCB->Data, PIN_TYPE, Element, pin); + pin->DrillingHole = value; + if (TEST_FLAG(HOLEFLAG, pin)) { + AddObjectToSizeUndoList(PIN_TYPE, Element, pin, pin); + pin->Thickness = value; + } + ClearFromPolygon(PCB->Data, PIN_TYPE, Element, pin); + DrawPin(pin); + } + } + END_LOOP; + if (changed) + return (Element); + else + return (NULL); +} + +/* --------------------------------------------------------------------------- + * changes ring dia of all pins of an element + * returns TRUE if changed + */ +static void *ChangeElement1stSize(ElementTypePtr Element) +{ + bool changed = false; + Coord value; + + if (TEST_FLAG(LOCKFLAG, Element)) + return (NULL); + PIN_LOOP(Element); + { + value = (Absolute) ? Absolute : pin->DrillingHole + Delta; + if (value <= MAX_PINORVIASIZE && value >= pin->DrillingHole + MIN_PINORVIACOPPER && value != pin->Thickness) { + changed = true; + AddObjectToSizeUndoList(PIN_TYPE, Element, pin, pin); + ErasePin(pin); + RestoreToPolygon(PCB->Data, PIN_TYPE, Element, pin); + pin->Thickness = value; + if (TEST_FLAG(HOLEFLAG, pin)) { + AddObjectToSizeUndoList(PIN_TYPE, Element, pin, pin); + pin->Thickness = value; + } + ClearFromPolygon(PCB->Data, PIN_TYPE, Element, pin); + DrawPin(pin); + } + } + END_LOOP; + if (changed) + return (Element); + else + return (NULL); +} + +/* --------------------------------------------------------------------------- + * changes the clearance of all pins of an element + * returns TRUE if changed + */ +static void *ChangeElementClearSize(ElementTypePtr Element) +{ + bool changed = false; + Coord value; + + if (TEST_FLAG(LOCKFLAG, Element)) + return (NULL); + PIN_LOOP(Element); + { + value = (Absolute) ? Absolute : pin->Clearance + Delta; + if (value <= MAX_PINORVIASIZE && + value >= MIN_PINORVIAHOLE && (TEST_FLAG(HOLEFLAG, pin) || value <= pin->Thickness - MIN_PINORVIACOPPER) + && value != pin->Clearance) { + changed = true; + AddObjectToClearSizeUndoList(PIN_TYPE, Element, pin, pin); + ErasePin(pin); + RestoreToPolygon(PCB->Data, PIN_TYPE, Element, pin); + pin->Clearance = value; + if (TEST_FLAG(HOLEFLAG, pin)) { + AddObjectToSizeUndoList(PIN_TYPE, Element, pin, pin); + pin->Thickness = value; + } + ClearFromPolygon(PCB->Data, PIN_TYPE, Element, pin); + DrawPin(pin); + } + } + END_LOOP; + + PAD_LOOP(Element); + { + value = (Absolute) ? Absolute : pad->Clearance + Delta; + if (value <= MAX_PINORVIASIZE && value >= MIN_PINORVIAHOLE && value != pad->Clearance) { + changed = true; + AddObjectToClearSizeUndoList(PAD_TYPE, Element, pad, pad); + ErasePad(pad); + RestoreToPolygon(PCB->Data, PAD_TYPE, Element, pad); + r_delete_entry(PCB->Data->pad_tree, &pad->BoundingBox); + pad->Clearance = value; + if (TEST_FLAG(HOLEFLAG, pad)) { + AddObjectToSizeUndoList(PAD_TYPE, Element, pad, pad); + pad->Thickness = value; + } + /* SetElementBB updates all associated rtrees */ + SetElementBoundingBox(PCB->Data, Element, &PCB->Font); + + ClearFromPolygon(PCB->Data, PAD_TYPE, Element, pad); + DrawPad(pad); + } + } + END_LOOP; + + if (changed) + return (Element); + else + return (NULL); +} + +/* --------------------------------------------------------------------------- + * changes the drilling hole of a pin + * returns TRUE if changed + */ +static void *ChangePin2ndSize(ElementTypePtr Element, PinTypePtr Pin) +{ + Coord value = (Absolute) ? Absolute : Pin->DrillingHole + Delta; + + if (TEST_FLAG(LOCKFLAG, Pin)) + return (NULL); + if (value <= MAX_PINORVIASIZE && + value >= MIN_PINORVIAHOLE && (TEST_FLAG(HOLEFLAG, Pin) || value <= Pin->Thickness - MIN_PINORVIACOPPER) + && value != Pin->DrillingHole) { + AddObjectTo2ndSizeUndoList(PIN_TYPE, Element, Pin, Pin); + ErasePin(Pin); + RestoreToPolygon(PCB->Data, PIN_TYPE, Element, Pin); + Pin->DrillingHole = value; + if (TEST_FLAG(HOLEFLAG, Pin)) { + AddObjectToSizeUndoList(PIN_TYPE, Element, Pin, Pin); + Pin->Thickness = value; + } + ClearFromPolygon(PCB->Data, PIN_TYPE, Element, Pin); + DrawPin(Pin); + return (Pin); + } + return (NULL); +} + +/* --------------------------------------------------------------------------- + * changes the size of a line + * returns TRUE if changed + */ +static void *ChangeLineSize(LayerTypePtr Layer, LineTypePtr Line) +{ + Coord value = (Absolute) ? Absolute : Line->Thickness + Delta; + + if (TEST_FLAG(LOCKFLAG, Line)) + return (NULL); + if (value <= MAX_LINESIZE && value >= MIN_LINESIZE && value != Line->Thickness) { + AddObjectToSizeUndoList(LINE_TYPE, Layer, Line, Line); + EraseLine(Line); + r_delete_entry(Layer->line_tree, (BoxTypePtr) Line); + RestoreToPolygon(PCB->Data, LINE_TYPE, Layer, Line); + Line->Thickness = value; + SetLineBoundingBox(Line); + r_insert_entry(Layer->line_tree, (BoxTypePtr) Line, 0); + ClearFromPolygon(PCB->Data, LINE_TYPE, Layer, Line); + DrawLine(Layer, Line); + return (Line); + } + return (NULL); +} + +/* --------------------------------------------------------------------------- + * changes the clearance size of a line + * returns TRUE if changed + */ +static void *ChangeLineClearSize(LayerTypePtr Layer, LineTypePtr Line) +{ + Coord value = (Absolute) ? Absolute : Line->Clearance + Delta; + + if (TEST_FLAG(LOCKFLAG, Line) || !TEST_FLAG(CLEARLINEFLAG, Line)) + return (NULL); + value = MIN(MAX_LINESIZE, MAX(value, PCB->Bloat * 2 + 2)); + if (value != Line->Clearance) { + AddObjectToClearSizeUndoList(LINE_TYPE, Layer, Line, Line); + RestoreToPolygon(PCB->Data, LINE_TYPE, Layer, Line); + EraseLine(Line); + r_delete_entry(Layer->line_tree, (BoxTypePtr) Line); + Line->Clearance = value; + if (Line->Clearance == 0) { + CLEAR_FLAG(CLEARLINEFLAG, Line); + Line->Clearance = MIL_TO_COORD(10); + } + SetLineBoundingBox(Line); + r_insert_entry(Layer->line_tree, (BoxTypePtr) Line, 0); + ClearFromPolygon(PCB->Data, LINE_TYPE, Layer, Line); + DrawLine(Layer, Line); + return (Line); + } + return (NULL); +} + +/* --------------------------------------------------------------------------- + * Handle attepts to change the clearance of a polygon. + */ +static void *ChangePolygonClearSize(LayerTypePtr Layer, PolygonTypePtr poly) +{ + static int shown_this_message = 0; + if (!shown_this_message) { + gui->confirm_dialog(_("To change the clearance of objects in a polygon, " + "change the objects, not the polygon.\n" + "Hint: To set a minimum clearance for a group of objects, " + "select them all then :MinClearGap(Selected,=10,mil)"), "Ok", NULL); + shown_this_message = 1; + } + + return (NULL); +} + +/* --------------------------------------------------------------------------- + * changes the size of an arc + * returns TRUE if changed + */ +static void *ChangeArcSize(LayerTypePtr Layer, ArcTypePtr Arc) +{ + Coord value = (Absolute) ? Absolute : Arc->Thickness + Delta; + + if (TEST_FLAG(LOCKFLAG, Arc)) + return (NULL); + if (value <= MAX_LINESIZE && value >= MIN_LINESIZE && value != Arc->Thickness) { + AddObjectToSizeUndoList(ARC_TYPE, Layer, Arc, Arc); + EraseArc(Arc); + r_delete_entry(Layer->arc_tree, (BoxTypePtr) Arc); + RestoreToPolygon(PCB->Data, ARC_TYPE, Layer, Arc); + Arc->Thickness = value; + SetArcBoundingBox(Arc); + r_insert_entry(Layer->arc_tree, (BoxTypePtr) Arc, 0); + ClearFromPolygon(PCB->Data, ARC_TYPE, Layer, Arc); + DrawArc(Layer, Arc); + return (Arc); + } + return (NULL); +} + +/* --------------------------------------------------------------------------- + * changes the clearance size of an arc + * returns TRUE if changed + */ +static void *ChangeArcClearSize(LayerTypePtr Layer, ArcTypePtr Arc) +{ + Coord value = (Absolute) ? Absolute : Arc->Clearance + Delta; + + if (TEST_FLAG(LOCKFLAG, Arc) || !TEST_FLAG(CLEARLINEFLAG, Arc)) + return (NULL); + value = MIN(MAX_LINESIZE, MAX(value, PCB->Bloat * 2 + 2)); + if (value != Arc->Clearance) { + AddObjectToClearSizeUndoList(ARC_TYPE, Layer, Arc, Arc); + EraseArc(Arc); + r_delete_entry(Layer->arc_tree, (BoxTypePtr) Arc); + RestoreToPolygon(PCB->Data, ARC_TYPE, Layer, Arc); + Arc->Clearance = value; + if (Arc->Clearance == 0) { + CLEAR_FLAG(CLEARLINEFLAG, Arc); + Arc->Clearance = MIL_TO_COORD(10); + } + SetArcBoundingBox(Arc); + r_insert_entry(Layer->arc_tree, (BoxTypePtr) Arc, 0); + ClearFromPolygon(PCB->Data, ARC_TYPE, Layer, Arc); + DrawArc(Layer, Arc); + return (Arc); + } + return (NULL); +} + +/* --------------------------------------------------------------------------- + * changes the scaling factor of a text object + * returns TRUE if changed + */ +static void *ChangeTextSize(LayerTypePtr Layer, TextTypePtr Text) +{ + int value = Absolute ? COORD_TO_MIL(Absolute) + : Text->Scale + COORD_TO_MIL(Delta); + + if (TEST_FLAG(LOCKFLAG, Text)) + return (NULL); + if (value <= MAX_TEXTSCALE && value >= MIN_TEXTSCALE && value != Text->Scale) { + AddObjectToSizeUndoList(TEXT_TYPE, Layer, Text, Text); + EraseText(Layer, Text); + r_delete_entry(Layer->text_tree, (BoxTypePtr) Text); + RestoreToPolygon(PCB->Data, TEXT_TYPE, Layer, Text); + Text->Scale = value; + SetTextBoundingBox(&PCB->Font, Text); + r_insert_entry(Layer->text_tree, (BoxTypePtr) Text, 0); + ClearFromPolygon(PCB->Data, TEXT_TYPE, Layer, Text); + DrawText(Layer, Text); + return (Text); + } + return (NULL); +} + +/* --------------------------------------------------------------------------- + * changes the scaling factor of an element's outline + * returns TRUE if changed + */ +static void *ChangeElementSize(ElementTypePtr Element) +{ + Coord value; + bool changed = false; + + if (TEST_FLAG(LOCKFLAG, Element)) + return (NULL); + if (PCB->ElementOn) + EraseElement(Element); + ELEMENTLINE_LOOP(Element); + { + value = (Absolute) ? Absolute : line->Thickness + Delta; + if (value <= MAX_LINESIZE && value >= MIN_LINESIZE && value != line->Thickness) { + AddObjectToSizeUndoList(ELEMENTLINE_TYPE, Element, line, line); + line->Thickness = value; + changed = true; + } + } + END_LOOP; + ARC_LOOP(Element); + { + value = (Absolute) ? Absolute : arc->Thickness + Delta; + if (value <= MAX_LINESIZE && value >= MIN_LINESIZE && value != arc->Thickness) { + AddObjectToSizeUndoList(ELEMENTARC_TYPE, Element, arc, arc); + arc->Thickness = value; + changed = true; + } + } + END_LOOP; + if (PCB->ElementOn) { + DrawElement(Element); + } + if (changed) + return (Element); + return (NULL); +} + +/* --------------------------------------------------------------------------- + * changes the scaling factor of a elementname object + * returns TRUE if changed + */ +static void *ChangeElementNameSize(ElementTypePtr Element) +{ + int value = Absolute ? COORD_TO_MIL(Absolute) + : DESCRIPTION_TEXT(Element).Scale + COORD_TO_MIL(Delta); + + if (TEST_FLAG(LOCKFLAG, &Element->Name[0])) + return (NULL); + if (value <= MAX_TEXTSCALE && value >= MIN_TEXTSCALE) { + EraseElementName(Element); + ELEMENTTEXT_LOOP(Element); + { + AddObjectToSizeUndoList(ELEMENTNAME_TYPE, Element, text, text); + r_delete_entry(PCB->Data->name_tree[n], (BoxType *) text); + text->Scale = value; + SetTextBoundingBox(&PCB->Font, text); + r_insert_entry(PCB->Data->name_tree[n], (BoxType *) text, 0); + } + END_LOOP; + DrawElementName(Element); + return (Element); + } + return (NULL); +} + +/* --------------------------------------------------------------------------- + * changes the name of a via + */ +static void *ChangeViaName(PinTypePtr Via) +{ + char *old = Via->Name; + + if (TEST_FLAG(DISPLAYNAMEFLAG, Via)) { + ErasePinName(Via); + Via->Name = NewName; + DrawPinName(Via); + } + else + Via->Name = NewName; + return (old); +} + +/* --------------------------------------------------------------------------- + * changes the name of a pin + */ +static void *ChangePinName(ElementTypePtr Element, PinTypePtr Pin) +{ + char *old = Pin->Name; + + Element = Element; /* get rid of 'unused...' warnings */ + if (TEST_FLAG(DISPLAYNAMEFLAG, Pin)) { + ErasePinName(Pin); + Pin->Name = NewName; + DrawPinName(Pin); + } + else + Pin->Name = NewName; + return (old); +} + +/* --------------------------------------------------------------------------- + * changes the name of a pad + */ +static void *ChangePadName(ElementTypePtr Element, PadTypePtr Pad) +{ + char *old = Pad->Name; + + Element = Element; /* get rid of 'unused...' warnings */ + if (TEST_FLAG(DISPLAYNAMEFLAG, Pad)) { + ErasePadName(Pad); + Pad->Name = NewName; + DrawPadName(Pad); + } + else + Pad->Name = NewName; + return (old); +} + +/* --------------------------------------------------------------------------- + * changes the number of a pin + */ +static void *ChangePinNum(ElementTypePtr Element, PinTypePtr Pin) +{ + char *old = Pin->Number; + + Element = Element; /* get rid of 'unused...' warnings */ + if (TEST_FLAG(DISPLAYNAMEFLAG, Pin)) { + ErasePinName(Pin); + Pin->Number = NewName; + DrawPinName(Pin); + } + else + Pin->Number = NewName; + return (old); +} + +/* --------------------------------------------------------------------------- + * changes the number of a pad + */ +static void *ChangePadNum(ElementTypePtr Element, PadTypePtr Pad) +{ + char *old = Pad->Number; + + Element = Element; /* get rid of 'unused...' warnings */ + if (TEST_FLAG(DISPLAYNAMEFLAG, Pad)) { + ErasePadName(Pad); + Pad->Number = NewName; + DrawPadName(Pad); + } + else + Pad->Number = NewName; + return (old); +} + +/* --------------------------------------------------------------------------- + * changes the name of a line + */ +static void *ChangeLineName(LayerTypePtr Layer, LineTypePtr Line) +{ + char *old = Line->Number; + + Layer = Layer; + Line->Number = NewName; + return (old); +} + +/* --------------------------------------------------------------------------- + * changes the layout-name of an element + */ + +char *ChangeElementText(PCBType * pcb, DataType * data, ElementTypePtr Element, int which, char *new_name) +{ + char *old = Element->Name[which].TextString; + +#ifdef DEBUG + printf("In ChangeElementText, updating old TextString %s to %s\n", old, new_name); +#endif + + if (pcb && which == NAME_INDEX(pcb)) + EraseElementName(Element); + + r_delete_entry(data->name_tree[which], &Element->Name[which].BoundingBox); + + Element->Name[which].TextString = new_name; + SetTextBoundingBox(&PCB->Font, &Element->Name[which]); + + r_insert_entry(data->name_tree[which], &Element->Name[which].BoundingBox, 0); + + if (pcb && which == NAME_INDEX(pcb)) + DrawElementName(Element); + + return old; +} + +static void *ChangeElementName(ElementTypePtr Element) +{ + if (TEST_FLAG(LOCKFLAG, &Element->Name[0])) + return (NULL); + if (NAME_INDEX(PCB) == NAMEONPCB_INDEX) { + if (TEST_FLAG(UNIQUENAMEFLAG, PCB) && UniqueElementName(PCB->Data, NewName) != NewName) { + Message(_("Error: The name \"%s\" is not unique!\n"), NewName); + return ((char *) -1); + } + } + + return ChangeElementText(PCB, PCB->Data, Element, NAME_INDEX(PCB), NewName); +} + +static void *ChangeElementNonetlist(ElementTypePtr Element) +{ + if (TEST_FLAG(LOCKFLAG, Element)) + return (NULL); + TOGGLE_FLAG(NONETLISTFLAG, Element); + return Element; +} + +/* --------------------------------------------------------------------------- + * sets data of a text object and calculates bounding box + * memory must have already been allocated + * the one for the new string is allocated + * returns true if the string has been changed + */ +static void *ChangeTextName(LayerTypePtr Layer, TextTypePtr Text) +{ + char *old = Text->TextString; + + if (TEST_FLAG(LOCKFLAG, Text)) + return (NULL); + EraseText(Layer, Text); + RestoreToPolygon(PCB->Data, TEXT_TYPE, Layer, Text); + Text->TextString = NewName; + + /* calculate size of the bounding box */ + SetTextBoundingBox(&PCB->Font, Text); + ClearFromPolygon(PCB->Data, TEXT_TYPE, Layer, Text); + DrawText(Layer, Text); + return (old); +} + +/* --------------------------------------------------------------------------- + * changes the name of a layout; memory has to be already allocated + */ +bool ChangeLayoutName(char *Name) +{ + free(PCB->Name); + PCB->Name = Name; + hid_action("PCBChanged"); + return (true); +} + +/* --------------------------------------------------------------------------- + * changes the side of the board an element is on + * returns TRUE if done + */ +bool ChangeElementSide(ElementTypePtr Element, Coord yoff) +{ + if (TEST_FLAG(LOCKFLAG, Element)) + return (false); + EraseElement(Element); + AddObjectToMirrorUndoList(ELEMENT_TYPE, Element, Element, Element, yoff); + MirrorElementCoordinates(PCB->Data, Element, yoff); + DrawElement(Element); + return (true); +} + +/* --------------------------------------------------------------------------- + * changes the name of a layer; memory has to be already allocated + */ +bool ChangeLayerName(LayerTypePtr Layer, char *Name) +{ + free(CURRENT->Name); + CURRENT->Name = Name; + hid_action("LayersChanged"); + return (true); +} + +/* --------------------------------------------------------------------------- + * changes the clearance flag of a line + */ +static void *ChangeLineJoin(LayerTypePtr Layer, LineTypePtr Line) +{ + if (TEST_FLAG(LOCKFLAG, Line)) + return (NULL); + EraseLine(Line); + if (TEST_FLAG(CLEARLINEFLAG, Line)) { + AddObjectToClearPolyUndoList(LINE_TYPE, Layer, Line, Line, false); + RestoreToPolygon(PCB->Data, LINE_TYPE, Layer, Line); + } + AddObjectToFlagUndoList(LINE_TYPE, Layer, Line, Line); + TOGGLE_FLAG(CLEARLINEFLAG, Line); + if (TEST_FLAG(CLEARLINEFLAG, Line)) { + AddObjectToClearPolyUndoList(LINE_TYPE, Layer, Line, Line, true); + ClearFromPolygon(PCB->Data, LINE_TYPE, Layer, Line); + } + DrawLine(Layer, Line); + return (Line); +} + +/* --------------------------------------------------------------------------- + * sets the clearance flag of a line + */ +static void *SetLineJoin(LayerTypePtr Layer, LineTypePtr Line) +{ + if (TEST_FLAG(LOCKFLAG, Line) || TEST_FLAG(CLEARLINEFLAG, Line)) + return (NULL); + return ChangeLineJoin(Layer, Line); +} + +/* --------------------------------------------------------------------------- + * clears the clearance flag of a line + */ +static void *ClrLineJoin(LayerTypePtr Layer, LineTypePtr Line) +{ + if (TEST_FLAG(LOCKFLAG, Line) || !TEST_FLAG(CLEARLINEFLAG, Line)) + return (NULL); + return ChangeLineJoin(Layer, Line); +} + +/* --------------------------------------------------------------------------- + * changes the clearance flag of an arc + */ +static void *ChangeArcJoin(LayerTypePtr Layer, ArcTypePtr Arc) +{ + if (TEST_FLAG(LOCKFLAG, Arc)) + return (NULL); + EraseArc(Arc); + if (TEST_FLAG(CLEARLINEFLAG, Arc)) { + RestoreToPolygon(PCB->Data, ARC_TYPE, Layer, Arc); + AddObjectToClearPolyUndoList(ARC_TYPE, Layer, Arc, Arc, false); + } + AddObjectToFlagUndoList(ARC_TYPE, Layer, Arc, Arc); + TOGGLE_FLAG(CLEARLINEFLAG, Arc); + if (TEST_FLAG(CLEARLINEFLAG, Arc)) { + ClearFromPolygon(PCB->Data, ARC_TYPE, Layer, Arc); + AddObjectToClearPolyUndoList(ARC_TYPE, Layer, Arc, Arc, true); + } + DrawArc(Layer, Arc); + return (Arc); +} + +/* --------------------------------------------------------------------------- + * sets the clearance flag of an arc + */ +static void *SetArcJoin(LayerTypePtr Layer, ArcTypePtr Arc) +{ + if (TEST_FLAG(LOCKFLAG, Arc) || TEST_FLAG(CLEARLINEFLAG, Arc)) + return (NULL); + return ChangeArcJoin(Layer, Arc); +} + +/* --------------------------------------------------------------------------- + * clears the clearance flag of an arc + */ +static void *ClrArcJoin(LayerTypePtr Layer, ArcTypePtr Arc) +{ + if (TEST_FLAG(LOCKFLAG, Arc) || !TEST_FLAG(CLEARLINEFLAG, Arc)) + return (NULL); + return ChangeArcJoin(Layer, Arc); +} + +/* --------------------------------------------------------------------------- + * changes the clearance flag of a text + */ +static void *ChangeTextJoin(LayerTypePtr Layer, TextTypePtr Text) +{ + if (TEST_FLAG(LOCKFLAG, Text)) + return (NULL); + EraseText(Layer, Text); + if (TEST_FLAG(CLEARLINEFLAG, Text)) { + AddObjectToClearPolyUndoList(TEXT_TYPE, Layer, Text, Text, false); + RestoreToPolygon(PCB->Data, TEXT_TYPE, Layer, Text); + } + AddObjectToFlagUndoList(LINE_TYPE, Layer, Text, Text); + TOGGLE_FLAG(CLEARLINEFLAG, Text); + if (TEST_FLAG(CLEARLINEFLAG, Text)) { + AddObjectToClearPolyUndoList(TEXT_TYPE, Layer, Text, Text, true); + ClearFromPolygon(PCB->Data, TEXT_TYPE, Layer, Text); + } + DrawText(Layer, Text); + return (Text); +} + +/* --------------------------------------------------------------------------- + * sets the clearance flag of a text + */ +static void *SetTextJoin(LayerTypePtr Layer, TextTypePtr Text) +{ + if (TEST_FLAG(LOCKFLAG, Text) || TEST_FLAG(CLEARLINEFLAG, Text)) + return (NULL); + return ChangeTextJoin(Layer, Text); +} + +/* --------------------------------------------------------------------------- + * clears the clearance flag of a text + */ +static void *ClrTextJoin(LayerTypePtr Layer, TextTypePtr Text) +{ + if (TEST_FLAG(LOCKFLAG, Text) || !TEST_FLAG(CLEARLINEFLAG, Text)) + return (NULL); + return ChangeTextJoin(Layer, Text); +} + +/* --------------------------------------------------------------------------- + * changes the square flag of all pins on an element + */ +static void *ChangeElementSquare(ElementTypePtr Element) +{ + void *ans = NULL; + + if (TEST_FLAG(LOCKFLAG, Element)) + return (NULL); + PIN_LOOP(Element); + { + ans = ChangePinSquare(Element, pin); + } + END_LOOP; + PAD_LOOP(Element); + { + ans = ChangePadSquare(Element, pad); + } + END_LOOP; + return (ans); +} + +/* --------------------------------------------------------------------------- + * sets the square flag of all pins on an element + */ +static void *SetElementSquare(ElementTypePtr Element) +{ + void *ans = NULL; + + if (TEST_FLAG(LOCKFLAG, Element)) + return (NULL); + PIN_LOOP(Element); + { + ans = SetPinSquare(Element, pin); + } + END_LOOP; + PAD_LOOP(Element); + { + ans = SetPadSquare(Element, pad); + } + END_LOOP; + return (ans); +} + +/* --------------------------------------------------------------------------- + * clears the square flag of all pins on an element + */ +static void *ClrElementSquare(ElementTypePtr Element) +{ + void *ans = NULL; + + if (TEST_FLAG(LOCKFLAG, Element)) + return (NULL); + PIN_LOOP(Element); + { + ans = ClrPinSquare(Element, pin); + } + END_LOOP; + PAD_LOOP(Element); + { + ans = ClrPadSquare(Element, pad); + } + END_LOOP; + return (ans); +} + +/* --------------------------------------------------------------------------- + * changes the octagon flags of all pins of an element + */ +static void *ChangeElementOctagon(ElementTypePtr Element) +{ + void *result = NULL; + + if (TEST_FLAG(LOCKFLAG, Element)) + return (NULL); + PIN_LOOP(Element); + { + ChangePinOctagon(Element, pin); + result = Element; + } + END_LOOP; + return (result); +} + +/* --------------------------------------------------------------------------- + * sets the octagon flags of all pins of an element + */ +static void *SetElementOctagon(ElementTypePtr Element) +{ + void *result = NULL; + + if (TEST_FLAG(LOCKFLAG, Element)) + return (NULL); + PIN_LOOP(Element); + { + SetPinOctagon(Element, pin); + result = Element; + } + END_LOOP; + return (result); +} + +/* --------------------------------------------------------------------------- + * clears the octagon flags of all pins of an element + */ +static void *ClrElementOctagon(ElementTypePtr Element) +{ + void *result = NULL; + + if (TEST_FLAG(LOCKFLAG, Element)) + return (NULL); + PIN_LOOP(Element); + { + ClrPinOctagon(Element, pin); + result = Element; + } + END_LOOP; + return (result); +} + +/* --------------------------------------------------------------------------- + * changes the square flag of a pad + */ +static void *ChangePadSquare(ElementTypePtr Element, PadTypePtr Pad) +{ + if (TEST_FLAG(LOCKFLAG, Pad)) + return (NULL); + ErasePad(Pad); + AddObjectToClearPolyUndoList(PAD_TYPE, Element, Pad, Pad, false); + RestoreToPolygon(PCB->Data, PAD_TYPE, Element, Pad); + AddObjectToFlagUndoList(PAD_TYPE, Element, Pad, Pad); + TOGGLE_FLAG(SQUAREFLAG, Pad); + AddObjectToClearPolyUndoList(PAD_TYPE, Element, Pad, Pad, true); + ClearFromPolygon(PCB->Data, PAD_TYPE, Element, Pad); + DrawPad(Pad); + return (Pad); +} + +/* --------------------------------------------------------------------------- + * sets the square flag of a pad + */ +static void *SetPadSquare(ElementTypePtr Element, PadTypePtr Pad) +{ + + if (TEST_FLAG(LOCKFLAG, Pad) || TEST_FLAG(SQUAREFLAG, Pad)) + return (NULL); + + return (ChangePadSquare(Element, Pad)); +} + + +/* --------------------------------------------------------------------------- + * clears the square flag of a pad + */ +static void *ClrPadSquare(ElementTypePtr Element, PadTypePtr Pad) +{ + + if (TEST_FLAG(LOCKFLAG, Pad) || !TEST_FLAG(SQUAREFLAG, Pad)) + return (NULL); + + return (ChangePadSquare(Element, Pad)); +} + + +/* --------------------------------------------------------------------------- + * changes the square flag of a via + */ +static void *ChangeViaSquare(PinTypePtr Via) +{ + if (TEST_FLAG(LOCKFLAG, Via)) + return (NULL); + EraseVia(Via); + AddObjectToClearPolyUndoList(VIA_TYPE, NULL, Via, Via, false); + RestoreToPolygon(PCB->Data, VIA_TYPE, NULL, Via); + AddObjectToFlagUndoList(VIA_TYPE, NULL, Via, Via); + ASSIGN_SQUARE(Absolute, Via); + if (Absolute == 0) + CLEAR_FLAG(SQUAREFLAG, Via); + else + SET_FLAG(SQUAREFLAG, Via); + SetPinBoundingBox(Via); + AddObjectToClearPolyUndoList(VIA_TYPE, NULL, Via, Via, true); + ClearFromPolygon(PCB->Data, VIA_TYPE, NULL, Via); + DrawVia(Via); + return (Via); +} + +/* --------------------------------------------------------------------------- + * changes the square flag of a pin + */ +static void *ChangePinSquare(ElementTypePtr Element, PinTypePtr Pin) +{ + if (TEST_FLAG(LOCKFLAG, Pin)) + return (NULL); + ErasePin(Pin); + AddObjectToClearPolyUndoList(PIN_TYPE, Element, Pin, Pin, false); + RestoreToPolygon(PCB->Data, PIN_TYPE, Element, Pin); + AddObjectToFlagUndoList(PIN_TYPE, Element, Pin, Pin); + ASSIGN_SQUARE(Absolute, Pin); + if (Absolute == 0) + CLEAR_FLAG(SQUAREFLAG, Pin); + else + SET_FLAG(SQUAREFLAG, Pin); + SetPinBoundingBox(Pin); + AddObjectToClearPolyUndoList(PIN_TYPE, Element, Pin, Pin, true); + ClearFromPolygon(PCB->Data, PIN_TYPE, Element, Pin); + DrawPin(Pin); + return (Pin); +} + +/* --------------------------------------------------------------------------- + * sets the square flag of a pin + */ +static void *SetPinSquare(ElementTypePtr Element, PinTypePtr Pin) +{ + if (TEST_FLAG(LOCKFLAG, Pin) || TEST_FLAG(SQUAREFLAG, Pin)) + return (NULL); + + return (ChangePinSquare(Element, Pin)); +} + +/* --------------------------------------------------------------------------- + * clears the square flag of a pin + */ +static void *ClrPinSquare(ElementTypePtr Element, PinTypePtr Pin) +{ + if (TEST_FLAG(LOCKFLAG, Pin) || !TEST_FLAG(SQUAREFLAG, Pin)) + return (NULL); + + return (ChangePinSquare(Element, Pin)); +} + +/* --------------------------------------------------------------------------- + * changes the octagon flag of a via + */ +static void *ChangeViaOctagon(PinTypePtr Via) +{ + if (TEST_FLAG(LOCKFLAG, Via)) + return (NULL); + EraseVia(Via); + AddObjectToClearPolyUndoList(VIA_TYPE, Via, Via, Via, false); + RestoreToPolygon(PCB->Data, VIA_TYPE, Via, Via); + AddObjectToFlagUndoList(VIA_TYPE, Via, Via, Via); + TOGGLE_FLAG(OCTAGONFLAG, Via); + AddObjectToClearPolyUndoList(VIA_TYPE, Via, Via, Via, true); + ClearFromPolygon(PCB->Data, VIA_TYPE, Via, Via); + DrawVia(Via); + return (Via); +} + +/* --------------------------------------------------------------------------- + * sets the octagon flag of a via + */ +static void *SetViaOctagon(PinTypePtr Via) +{ + if (TEST_FLAG(LOCKFLAG, Via) || TEST_FLAG(OCTAGONFLAG, Via)) + return (NULL); + + return (ChangeViaOctagon(Via)); +} + +/* --------------------------------------------------------------------------- + * clears the octagon flag of a via + */ +static void *ClrViaOctagon(PinTypePtr Via) +{ + if (TEST_FLAG(LOCKFLAG, Via) || !TEST_FLAG(OCTAGONFLAG, Via)) + return (NULL); + + return (ChangeViaOctagon(Via)); +} + +/* --------------------------------------------------------------------------- + * changes the octagon flag of a pin + */ +static void *ChangePinOctagon(ElementTypePtr Element, PinTypePtr Pin) +{ + if (TEST_FLAG(LOCKFLAG, Pin)) + return (NULL); + ErasePin(Pin); + AddObjectToClearPolyUndoList(PIN_TYPE, Element, Pin, Pin, false); + RestoreToPolygon(PCB->Data, PIN_TYPE, Element, Pin); + AddObjectToFlagUndoList(PIN_TYPE, Element, Pin, Pin); + TOGGLE_FLAG(OCTAGONFLAG, Pin); + AddObjectToClearPolyUndoList(PIN_TYPE, Element, Pin, Pin, true); + ClearFromPolygon(PCB->Data, PIN_TYPE, Element, Pin); + DrawPin(Pin); + return (Pin); +} + +/* --------------------------------------------------------------------------- + * sets the octagon flag of a pin + */ +static void *SetPinOctagon(ElementTypePtr Element, PinTypePtr Pin) +{ + if (TEST_FLAG(LOCKFLAG, Pin) || TEST_FLAG(OCTAGONFLAG, Pin)) + return (NULL); + + return (ChangePinOctagon(Element, Pin)); +} + +/* --------------------------------------------------------------------------- + * clears the octagon flag of a pin + */ +static void *ClrPinOctagon(ElementTypePtr Element, PinTypePtr Pin) +{ + if (TEST_FLAG(LOCKFLAG, Pin) || !TEST_FLAG(OCTAGONFLAG, Pin)) + return (NULL); + + return (ChangePinOctagon(Element, Pin)); +} + +/* --------------------------------------------------------------------------- + * changes the hole flag of a via + */ +bool ChangeHole(PinTypePtr Via) +{ + if (TEST_FLAG(LOCKFLAG, Via)) + return (false); + EraseVia(Via); + AddObjectToFlagUndoList(VIA_TYPE, Via, Via, Via); + AddObjectToMaskSizeUndoList(VIA_TYPE, Via, Via, Via); + r_delete_entry(PCB->Data->via_tree, (BoxType *) Via); + RestoreToPolygon(PCB->Data, VIA_TYPE, Via, Via); + TOGGLE_FLAG(HOLEFLAG, Via); + + if (TEST_FLAG(HOLEFLAG, Via)) { + /* A tented via becomes an minimally untented hole. An untented + via retains its mask clearance. */ + if (Via->Mask > Via->Thickness) { + Via->Mask = (Via->DrillingHole + (Via->Mask - Via->Thickness)); + } + else if (Via->Mask < Via->DrillingHole) { + Via->Mask = Via->DrillingHole + 2 * MASKFRAME; + } + } + else { + Via->Mask = (Via->Thickness + (Via->Mask - Via->DrillingHole)); + } + + SetPinBoundingBox(Via); + r_insert_entry(PCB->Data->via_tree, (BoxType *) Via, 0); + ClearFromPolygon(PCB->Data, VIA_TYPE, Via, Via); + DrawVia(Via); + Draw(); + return (true); +} + +/* --------------------------------------------------------------------------- + * changes the nopaste flag of a pad + */ +bool ChangePaste(PadTypePtr Pad) +{ + if (TEST_FLAG(LOCKFLAG, Pad)) + return (false); + ErasePad(Pad); + AddObjectToFlagUndoList(PAD_TYPE, Pad, Pad, Pad); + TOGGLE_FLAG(NOPASTEFLAG, Pad); + DrawPad(Pad); + Draw(); + return (true); +} + +/* --------------------------------------------------------------------------- + * changes the CLEARPOLY flag of a polygon + */ +static void *ChangePolyClear(LayerTypePtr Layer, PolygonTypePtr Polygon) +{ + if (TEST_FLAG(LOCKFLAG, Polygon)) + return (NULL); + AddObjectToClearPolyUndoList(POLYGON_TYPE, Layer, Polygon, Polygon, true); + AddObjectToFlagUndoList(POLYGON_TYPE, Layer, Polygon, Polygon); + TOGGLE_FLAG(CLEARPOLYFLAG, Polygon); + InitClip(PCB->Data, Layer, Polygon); + DrawPolygon(Layer, Polygon); + return (Polygon); +} + +/* ---------------------------------------------------------------------- + * changes the side of all selected and visible elements + * returns true if anything has changed + */ +bool ChangeSelectedElementSide(void) +{ + bool change = false; + + /* setup identifiers */ + if (PCB->PinOn && PCB->ElementOn) + ELEMENT_LOOP(PCB->Data); + { + if (TEST_FLAG(SELECTEDFLAG, element)) { + change |= ChangeElementSide(element, 0); + } + } + END_LOOP; + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* ---------------------------------------------------------------------- + * changes the thermals on all selected and visible pins + * and/or vias. Returns true if anything has changed + */ +bool ChangeSelectedThermals(int types, int therm_style) +{ + bool change = false; + + Delta = therm_style; + change = SelectedOperation(&ChangeThermalFunctions, false, types); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* ---------------------------------------------------------------------- + * changes the size of all selected and visible object types + * returns true if anything has changed + */ +bool ChangeSelectedSize(int types, Coord Difference, bool fixIt) +{ + bool change = false; + + /* setup identifiers */ + Absolute = (fixIt) ? Difference : 0; + Delta = Difference; + + change = SelectedOperation(&ChangeSizeFunctions, false, types); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* ---------------------------------------------------------------------- + * changes the clearance size of all selected and visible objects + * returns true if anything has changed + */ +bool ChangeSelectedClearSize(int types, Coord Difference, bool fixIt) +{ + bool change = false; + + /* setup identifiers */ + Absolute = (fixIt) ? Difference : 0; + Delta = Difference; + if (TEST_FLAG(SHOWMASKFLAG, PCB)) + change = SelectedOperation(&ChangeMaskSizeFunctions, false, types); + else + change = SelectedOperation(&ChangeClearSizeFunctions, false, types); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* -------------------------------------------------------------------------- + * changes the 2nd size (drilling hole) of all selected and visible objects + * returns true if anything has changed + */ +bool ChangeSelected2ndSize(int types, Coord Difference, bool fixIt) +{ + bool change = false; + + /* setup identifiers */ + Absolute = (fixIt) ? Difference : 0; + Delta = Difference; + change = SelectedOperation(&Change2ndSizeFunctions, false, types); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* ---------------------------------------------------------------------- + * changes the clearance flag (join) of all selected and visible lines + * and/or arcs. Returns true if anything has changed + */ +bool ChangeSelectedJoin(int types) +{ + bool change = false; + + change = SelectedOperation(&ChangeJoinFunctions, false, types); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* ---------------------------------------------------------------------- + * changes the clearance flag (join) of all selected and visible lines + * and/or arcs. Returns true if anything has changed + */ +bool SetSelectedJoin(int types) +{ + bool change = false; + + change = SelectedOperation(&SetJoinFunctions, false, types); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* ---------------------------------------------------------------------- + * changes the clearance flag (join) of all selected and visible lines + * and/or arcs. Returns true if anything has changed + */ +bool ClrSelectedJoin(int types) +{ + bool change = false; + + change = SelectedOperation(&ClrJoinFunctions, false, types); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* ---------------------------------------------------------------------- + * changes the nonetlist-flag of all selected and visible elements + * returns true if anything has changed + */ +bool ChangeSelectedNonetlist(int types) +{ + bool change = false; + + change = SelectedOperation(&ChangeNonetlistFunctions, false, types); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +#if 0 +/* ---------------------------------------------------------------------- + * sets the square-flag of all selected and visible pins or pads + * returns true if anything has changed + */ +bool SetSelectedNonetlist(int types) +{ + bool change = false; + + change = SelectedOperation(&SetNonetlistFunctions, false, types); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* ---------------------------------------------------------------------- + * clears the square-flag of all selected and visible pins or pads + * returns true if anything has changed + */ +bool ClrSelectedNonetlist(int types) +{ + bool change = false; + + change = SelectedOperation(&ClrNonetlistFunctions, false, types); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} +#endif + +/* ---------------------------------------------------------------------- + * changes the square-flag of all selected and visible pins or pads + * returns true if anything has changed + */ +bool ChangeSelectedSquare(int types) +{ + bool change = false; + + change = SelectedOperation(&ChangeSquareFunctions, false, types); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* ---------------------------------------------------------------------- + * sets the square-flag of all selected and visible pins or pads + * returns true if anything has changed + */ +bool SetSelectedSquare(int types) +{ + bool change = false; + + change = SelectedOperation(&SetSquareFunctions, false, types); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* ---------------------------------------------------------------------- + * clears the square-flag of all selected and visible pins or pads + * returns true if anything has changed + */ +bool ClrSelectedSquare(int types) +{ + bool change = false; + + change = SelectedOperation(&ClrSquareFunctions, false, types); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* ---------------------------------------------------------------------- + * changes the octagon-flag of all selected and visible pins and vias + * returns true if anything has changed + */ +bool ChangeSelectedOctagon(int types) +{ + bool change = false; + + change = SelectedOperation(&ChangeOctagonFunctions, false, types); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* ---------------------------------------------------------------------- + * sets the octagon-flag of all selected and visible pins and vias + * returns true if anything has changed + */ +bool SetSelectedOctagon(int types) +{ + bool change = false; + + change = SelectedOperation(&SetOctagonFunctions, false, types); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* ---------------------------------------------------------------------- + * clears the octagon-flag of all selected and visible pins and vias + * returns true if anything has changed + */ +bool ClrSelectedOctagon(int types) +{ + bool change = false; + + change = SelectedOperation(&ClrOctagonFunctions, false, types); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* ---------------------------------------------------------------------- + * changes the hole-flag of all selected and visible vias + * returns true if anything has changed + */ +bool ChangeSelectedHole(void) +{ + bool change = false; + + if (PCB->ViaOn) + VIA_LOOP(PCB->Data); + { + if (TEST_FLAG(SELECTEDFLAG, via)) + change |= ChangeHole(via); + } + END_LOOP; + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* ---------------------------------------------------------------------- + * changes the no paste-flag of all selected and visible pads + * returns true if anything has changed + */ +bool ChangeSelectedPaste(void) +{ + bool change = false; + + ALLPAD_LOOP(PCB->Data); + { + if (TEST_FLAG(SELECTEDFLAG, pad)) + change |= ChangePaste(pad); + } + ENDALL_LOOP; + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + + +/* --------------------------------------------------------------------------- + * changes the size of the passed object; element size is silk size + * Returns true if anything is changed + */ +bool ChangeObjectSize(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord Difference, bool fixIt) +{ + bool change; + + /* setup identifier */ + Absolute = (fixIt) ? Difference : 0; + Delta = Difference; + change = (ObjectOperation(&ChangeSizeFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* --------------------------------------------------------------------------- + * changes the size of the passed object; element size is pin ring sizes + * Returns true if anything is changed + */ +bool ChangeObject1stSize(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord Difference, bool fixIt) +{ + bool change; + + /* setup identifier */ + Absolute = (fixIt) ? Difference : 0; + Delta = Difference; + change = (ObjectOperation(&Change1stSizeFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* --------------------------------------------------------------------------- + * changes the clearance size of the passed object + * Returns true if anything is changed + */ +bool ChangeObjectClearSize(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord Difference, bool fixIt) +{ + bool change; + + /* setup identifier */ + Absolute = (fixIt) ? Difference : 0; + Delta = Difference; + if (TEST_FLAG(SHOWMASKFLAG, PCB)) + change = (ObjectOperation(&ChangeMaskSizeFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); + else + change = (ObjectOperation(&ChangeClearSizeFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* --------------------------------------------------------------------------- + * changes the thermal of the passed object + * Returns true if anything is changed + * + */ +bool ChangeObjectThermal(int Type, void *Ptr1, void *Ptr2, void *Ptr3, int therm_type) +{ + bool change; + + Delta = Absolute = therm_type; + change = (ObjectOperation(&ChangeThermalFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* --------------------------------------------------------------------------- + * changes the 2nd size of the passed object + * Returns true if anything is changed + */ +bool ChangeObject2ndSize(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord Difference, bool fixIt, bool incundo) +{ + bool change; + + /* setup identifier */ + Absolute = (fixIt) ? Difference : 0; + Delta = Difference; + change = (ObjectOperation(&Change2ndSizeFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); + if (change) { + Draw(); + if (incundo) + IncrementUndoSerialNumber(); + } + return (change); +} + +/* --------------------------------------------------------------------------- + * changes the mask size of the passed object + * Returns true if anything is changed + */ +bool ChangeObjectMaskSize(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord Difference, bool fixIt) +{ + bool change; + + /* setup identifier */ + Absolute = (fixIt) ? Difference : 0; + Delta = Difference; + change = (ObjectOperation(&ChangeMaskSizeFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); + if (change) { + Draw(); + IncrementUndoSerialNumber(); + } + return (change); +} + +/* --------------------------------------------------------------------------- + * changes the name of the passed object + * returns the old name + * + * The allocated memory isn't freed because the old string is used + * by the undo module. + */ +void *ChangeObjectName(int Type, void *Ptr1, void *Ptr2, void *Ptr3, char *Name) +{ + void *result; + /* setup identifier */ + NewName = Name; + if ((result = ObjectOperation(&ChangeNameFunctions, Type, Ptr1, Ptr2, Ptr3))); + Draw(); + return (result); +} + +/* --------------------------------------------------------------------------- + * changes the pin number of the passed object + * returns the old name + * + * The allocated memory isn't freed because the old string is used + * by the undo module. + */ +void *ChangeObjectPinnum(int Type, void *Ptr1, void *Ptr2, void *Ptr3, char *Name) +{ + void *result; + /* setup identifier */ + NewName = Name; + if ((result = ObjectOperation(&ChangePinnumFunctions, Type, Ptr1, Ptr2, Ptr3))); + Draw(); + return (result); +} + +/* --------------------------------------------------------------------------- + * changes the clearance-flag of the passed object + * Returns true if anything is changed + */ +bool ChangeObjectJoin(int Type, void *Ptr1, void *Ptr2, void *Ptr3) +{ + if (ObjectOperation(&ChangeJoinFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + Draw(); + IncrementUndoSerialNumber(); + return (true); + } + return (false); +} + +/* --------------------------------------------------------------------------- + * sets the clearance-flag of the passed object + * Returns true if anything is changed + */ +bool SetObjectJoin(int Type, void *Ptr1, void *Ptr2, void *Ptr3) +{ + if (ObjectOperation(&SetJoinFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + Draw(); + IncrementUndoSerialNumber(); + return (true); + } + return (false); +} + +/* --------------------------------------------------------------------------- + * clears the clearance-flag of the passed object + * Returns true if anything is changed + */ +bool ClrObjectJoin(int Type, void *Ptr1, void *Ptr2, void *Ptr3) +{ + if (ObjectOperation(&ClrJoinFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + Draw(); + IncrementUndoSerialNumber(); + return (true); + } + return (false); +} + +/* --------------------------------------------------------------------------- + * changes the square-flag of the passed object + * Returns true if anything is changed + */ +bool ChangeObjectNonetlist(int Type, void *Ptr1, void *Ptr2, void *Ptr3) +{ + if (ObjectOperation(&ChangeNonetlistFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + Draw(); + IncrementUndoSerialNumber(); + return (true); + } + return (false); +} + +/* --------------------------------------------------------------------------- + * changes the square-flag of the passed object + * Returns true if anything is changed + */ +bool ChangeObjectSquare(int Type, void *Ptr1, void *Ptr2, void *Ptr3, int style) +{ + Absolute = style; + if (ObjectOperation(&ChangeSquareFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + Draw(); + IncrementUndoSerialNumber(); + return (true); + } + return (false); +} + +/* --------------------------------------------------------------------------- + * sets the square-flag of the passed object + * Returns true if anything is changed + */ +bool SetObjectSquare(int Type, void *Ptr1, void *Ptr2, void *Ptr3) +{ + if (ObjectOperation(&SetSquareFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + Draw(); + IncrementUndoSerialNumber(); + return (true); + } + return (false); +} + +/* --------------------------------------------------------------------------- + * clears the square-flag of the passed object + * Returns true if anything is changed + */ +bool ClrObjectSquare(int Type, void *Ptr1, void *Ptr2, void *Ptr3) +{ + if (ObjectOperation(&ClrSquareFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + Draw(); + IncrementUndoSerialNumber(); + return (true); + } + return (false); +} + +/* --------------------------------------------------------------------------- + * changes the octagon-flag of the passed object + * Returns true if anything is changed + */ +bool ChangeObjectOctagon(int Type, void *Ptr1, void *Ptr2, void *Ptr3) +{ + if (ObjectOperation(&ChangeOctagonFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + Draw(); + IncrementUndoSerialNumber(); + return (true); + } + return (false); +} + +/* --------------------------------------------------------------------------- + * sets the octagon-flag of the passed object + * Returns true if anything is changed + */ +bool SetObjectOctagon(int Type, void *Ptr1, void *Ptr2, void *Ptr3) +{ + if (ObjectOperation(&SetOctagonFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + Draw(); + IncrementUndoSerialNumber(); + return (true); + } + return (false); +} + +/* --------------------------------------------------------------------------- + * clears the octagon-flag of the passed object + * Returns true if anything is changed + */ +bool ClrObjectOctagon(int Type, void *Ptr1, void *Ptr2, void *Ptr3) +{ + if (ObjectOperation(&ClrOctagonFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + Draw(); + IncrementUndoSerialNumber(); + return (true); + } + return (false); +} + +/* --------------------------------------------------------------------------- + * queries the user for a new object name and changes it + * + * The allocated memory isn't freed because the old string is used + * by the undo module. + */ +void *QueryInputAndChangeObjectName(int Type, void *Ptr1, void *Ptr2, void *Ptr3, int pinnum) +{ + char *name = NULL; + char msg[513]; + + /* if passed an element name, make it an element reference instead */ + if (Type == ELEMENTNAME_TYPE) { + Type = ELEMENT_TYPE; + Ptr2 = Ptr1; + Ptr3 = Ptr1; + } + switch (Type) { + case LINE_TYPE: + name = gui->prompt_for(_("Linename:"), EMPTY(((LineTypePtr) Ptr2)->Number)); + break; + + case VIA_TYPE: + name = gui->prompt_for(_("Vianame:"), EMPTY(((PinTypePtr) Ptr2)->Name)); + break; + + case PIN_TYPE: + if (pinnum) + sprintf(msg, _("%s Pin Number:"), EMPTY(((PinTypePtr) Ptr2)->Number)); + else + sprintf(msg, _("%s Pin Name:"), EMPTY(((PinTypePtr) Ptr2)->Number)); + name = gui->prompt_for(msg, EMPTY(((PinTypePtr) Ptr2)->Name)); + break; + + case PAD_TYPE: + if (pinnum) + sprintf(msg, _("%s Pad Number:"), EMPTY(((PadTypePtr) Ptr2)->Number)); + else + sprintf(msg, _("%s Pad Name:"), EMPTY(((PadTypePtr) Ptr2)->Number)); + name = gui->prompt_for(msg, EMPTY(((PadTypePtr) Ptr2)->Name)); + break; + + case TEXT_TYPE: + name = gui->prompt_for(_("Enter text:"), EMPTY(((TextTypePtr) Ptr2)->TextString)); + break; + + case ELEMENT_TYPE: + name = gui->prompt_for(_("Elementname:"), EMPTY(ELEMENT_NAME(PCB, (ElementTypePtr) Ptr2))); + break; + } + if (name) { + /* NB: ChangeObjectName takes ownership of the passed memory */ + char *old; + if (pinnum) + old = (char *) ChangeObjectPinnum(Type, Ptr1, Ptr2, Ptr3, name); + else + old = (char *) ChangeObjectName(Type, Ptr1, Ptr2, Ptr3, name); + + if (old != (char *) -1) { + if (pinnum) + AddObjectToChangePinnumUndoList(Type, Ptr1, Ptr2, Ptr3, old); + else + AddObjectToChangeNameUndoList(Type, Ptr1, Ptr2, Ptr3, old); + IncrementUndoSerialNumber(); + } + Draw(); + return (Ptr3); + } + return (NULL); +} + +/* --------------------------------------------------------------------------- + * changes the maximum size of a layout + * adjusts the scrollbars + * releases the saved pixmap if necessary + * and adjusts the cursor confinement box + */ +void ChangePCBSize(Coord Width, Coord Height) +{ + PCB->MaxWidth = Width; + PCB->MaxHeight = Height; + + /* crosshair range is different if pastebuffer-mode + * is enabled + */ + if (Settings.Mode == PASTEBUFFER_MODE) + SetCrosshairRange(PASTEBUFFER->X - PASTEBUFFER->BoundingBox.X1, + PASTEBUFFER->Y - PASTEBUFFER->BoundingBox.Y1, + MAX(0, + Width - (PASTEBUFFER->BoundingBox.X2 - + PASTEBUFFER->X)), MAX(0, Height - (PASTEBUFFER->BoundingBox.Y2 - PASTEBUFFER->Y))); + else + SetCrosshairRange(0, 0, Width, Height); + hid_action("PCBChanged"); +} + +/* --------------------------------------------------------------------------- + * changes the mask size of a pad + * returns TRUE if changed + */ +static void *ChangePadMaskSize(ElementTypePtr Element, PadTypePtr Pad) +{ + Coord value = (Absolute) ? Absolute : Pad->Mask + Delta; + + value = MAX(value, 0); + if (value == Pad->Mask && Absolute == 0) + value = Pad->Thickness; + if (value != Pad->Mask) { + AddObjectToMaskSizeUndoList(PAD_TYPE, Element, Pad, Pad); + ErasePad(Pad); + r_delete_entry(PCB->Data->pad_tree, &Pad->BoundingBox); + Pad->Mask = value; + SetElementBoundingBox(PCB->Data, Element, &PCB->Font); + DrawPad(Pad); + return (Pad); + } + return (NULL); +} + +/* --------------------------------------------------------------------------- + * changes the mask size of a pin + * returns TRUE if changed + */ +static void *ChangePinMaskSize(ElementTypePtr Element, PinTypePtr Pin) +{ + Coord value = (Absolute) ? Absolute : Pin->Mask + Delta; + + value = MAX(value, 0); + if (value == Pin->Mask && Absolute == 0) + value = Pin->Thickness; + if (value != Pin->Mask) { + AddObjectToMaskSizeUndoList(PIN_TYPE, Element, Pin, Pin); + ErasePin(Pin); + r_delete_entry(PCB->Data->pin_tree, &Pin->BoundingBox); + Pin->Mask = value; + SetElementBoundingBox(PCB->Data, Element, &PCB->Font); + DrawPin(Pin); + return (Pin); + } + return (NULL); +} + +/* --------------------------------------------------------------------------- + * changes the mask size of a via + * returns TRUE if changed + */ +static void *ChangeViaMaskSize(PinTypePtr Via) +{ + Coord value; + + value = (Absolute) ? Absolute : Via->Mask + Delta; + value = MAX(value, 0); + if (value != Via->Mask) { + AddObjectToMaskSizeUndoList(VIA_TYPE, Via, Via, Via); + EraseVia(Via); + r_delete_entry(PCB->Data->via_tree, &Via->BoundingBox); + Via->Mask = value; + SetPinBoundingBox(Via); + r_insert_entry(PCB->Data->via_tree, &Via->BoundingBox, 0); + DrawVia(Via); + return (Via); + } + return (NULL); +} Index: 1.0.8/src/change.h =================================================================== --- 1.0.8/src/change.h (nonexistent) +++ 1.0.8/src/change.h (revision 1136) @@ -0,0 +1,120 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + * RCS: $Id$ + */ + +/* prototypes to change object properties + */ + +#ifndef PCB_CHANGE_H +#define PCB_CHANGE_H + +#include "global.h" + +/* --------------------------------------------------------------------------- + * some defines + */ +#define CHANGENAME_TYPES \ + (VIA_TYPE | PIN_TYPE | PAD_TYPE | TEXT_TYPE | ELEMENT_TYPE | ELEMENTNAME_TYPE | LINE_TYPE) + +#define CHANGESIZE_TYPES \ + (POLYGON_TYPE | VIA_TYPE | PIN_TYPE | PAD_TYPE | LINE_TYPE | \ + ARC_TYPE | TEXT_TYPE | ELEMENTNAME_TYPE | ELEMENT_TYPE) + +#define CHANGE2NDSIZE_TYPES \ + (VIA_TYPE | PIN_TYPE | ELEMENT_TYPE) + +/* We include polygons here only to inform the user not to do it that way. */ +#define CHANGECLEARSIZE_TYPES \ + (PIN_TYPE | PAD_TYPE | VIA_TYPE | LINE_TYPE | ARC_TYPE | POLYGON_TYPE) + +#define CHANGENONETLIST_TYPES \ + (ELEMENT_TYPE) + +#define CHANGESQUARE_TYPES \ + (ELEMENT_TYPE | PIN_TYPE | PAD_TYPE | VIA_TYPE) + +#define CHANGEOCTAGON_TYPES \ + (ELEMENT_TYPE | PIN_TYPE | VIA_TYPE) + +#define CHANGEJOIN_TYPES \ + (ARC_TYPE | LINE_TYPE | TEXT_TYPE) + +#define CHANGETHERMAL_TYPES \ + (PIN_TYPE | VIA_TYPE) + +#define CHANGEMASKSIZE_TYPES \ + (PIN_TYPE | VIA_TYPE | PAD_TYPE) + +bool ChangeLayoutName(char *); +bool ChangeLayerName(LayerTypePtr, char *); +bool ChangeSelectedSize(int, Coord, bool); +bool ChangeSelectedClearSize(int, Coord, bool); +bool ChangeSelected2ndSize(int, Coord, bool); +bool ChangeSelectedMaskSize(int, Coord, bool); +bool ChangeSelectedJoin(int); +bool SetSelectedJoin(int); +bool ClrSelectedJoin(int); +bool ChangeSelectedNonetlist(int); +bool ChangeSelectedSquare(int); +bool SetSelectedSquare(int); +bool ClrSelectedSquare(int); +bool ChangeSelectedThermals(int, int); +bool ChangeSelectedHole(void); +bool ChangeSelectedPaste(void); +bool ChangeSelectedOctagon(int); +bool SetSelectedOctagon(int); +bool ClrSelectedOctagon(int); +bool ChangeSelectedElementSide(void); +bool ChangeElementSide(ElementTypePtr, Coord); +bool ChangeHole(PinTypePtr); +bool ChangePaste(PadTypePtr); +bool ChangeObjectSize(int, void *, void *, void *, Coord, bool); +bool ChangeObject1stSize(int, void *, void *, void *, Coord, bool); +bool ChangeObjectThermal(int, void *, void *, void *, int); +bool ChangeObjectClearSize(int, void *, void *, void *, Coord, bool); +bool ChangeObject2ndSize(int, void *, void *, void *, Coord, bool, bool); +bool ChangeObjectMaskSize(int, void *, void *, void *, Coord, bool); +bool ChangeObjectJoin(int, void *, void *, void *); +bool SetObjectJoin(int, void *, void *, void *); +bool ClrObjectJoin(int, void *, void *, void *); +bool ChangeObjectNonetlist(int Type, void *Ptr1, void *Ptr2, void *Ptr3); +bool ChangeObjectSquare(int, void *, void *, void *, int); +bool SetObjectSquare(int, void *, void *, void *); +bool ClrObjectSquare(int, void *, void *, void *); +bool ChangeObjectOctagon(int, void *, void *, void *); +bool SetObjectOctagon(int, void *, void *, void *); +bool ClrObjectOctagon(int, void *, void *, void *); +void *ChangeObjectName(int, void *, void *, void *, char *); +void *QueryInputAndChangeObjectName(int, void *, void *, void *, int); +void ChangePCBSize(Coord, Coord); +void *ChangeObjectPinnum(int Type, void *Ptr1, void *Ptr2, void *Ptr3, char *Name); + +/* Change the specified text on an element, either on the board (give + PCB, PCB->Data) or in a buffer (give NULL, Buffer->Data). The old + string is returned, and must be properly freed by the caller. */ +char *ChangeElementText(PCBType * pcb, DataType * data, ElementTypePtr Element, int which, char *new_name); + +#endif Index: 1.0.8/src/change_act.c =================================================================== --- 1.0.8/src/change_act.c (nonexistent) +++ 1.0.8/src/change_act.c (revision 1136) @@ -0,0 +1,1435 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact addresses for paper mail and Email: + * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA + * haceaton@aplcomm.jhuapl.edu + * + */ + +/* action routines for output window + */ + +#include "config.h" + +#include "global.h" +#include "data.h" + +#include "action.h" +#include "change.h" +#include "crosshair.h" +#include "draw.h" +#include "search.h" +#include "misc.h" +#include "set.h" +#include "error.h" +#include "undo.h" +#include "rubberband.h" +#include + +static void ChangeFlag(char *, char *, int, char *); +static int ActionChangeSize(int argc, char **argv, Coord x, Coord y); +static int ActionChange2ndSize(int argc, char **argv, Coord x, Coord y); + +/* --------------------------------------------------------------------------- */ + +static const char changeclearsize_syntax[] = + "ChangeClearSize(Object, delta|style)\n" + "ChangeClearSize(SelectedPins|SelectedPads|SelectedVias, delta|style)\n" + "ChangeClearSize(SelectedLines|SelectedArcs, delta|style)\n" "ChangeClearSize(Selected|SelectedObjects, delta|style)"; + +static const char changeclearsize_help[] = "Changes the clearance size of objects."; + +/* %start-doc actions ChangeClearSize + +If the solder mask is currently showing, this action changes the +solder mask clearance. If the mask is not showing, this action +changes the polygon clearance. + +%end-doc */ + +static int ActionChangeClearSize(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + char *delta = ARG(1); + char *units = ARG(2); + bool absolute; + Coord value; + int type; + void *ptr1, *ptr2, *ptr3; + + if (function && delta) { + int funcid = GetFunctionID(function); + + if (funcid == F_Object) { + gui->get_coords(_("Select an Object"), &x, &y); + type = SearchScreen(x, y, CHANGECLEARSIZE_TYPES, &ptr1, &ptr2, &ptr3); + } + + if (strcmp(argv[1], "style") == 0) { + if ((type == NO_TYPE) || (type == POLYGON_TYPE)) /* workaround: SearchScreen(CHANGECLEARSIZE_TYPES) wouldn't return elements */ + type = SearchScreen(x, y, CHANGE2NDSIZE_TYPES, &ptr1, &ptr2, &ptr3); + if (get_style_size(funcid, &value, type, 2) != 0) + return 1; + absolute = 1; + value *= 2; + } + else + value = 2 * GetValue(delta, units, &absolute); + switch (GetFunctionID(function)) { + case F_Object: + { + if (type != NO_TYPE) + if (ChangeObjectClearSize(type, ptr1, ptr2, ptr3, value, absolute)) + SetChangedFlag(true); + break; + } + case F_SelectedVias: + if (ChangeSelectedClearSize(VIA_TYPE, value, absolute)) + SetChangedFlag(true); + break; + case F_SelectedPads: + if (ChangeSelectedClearSize(PAD_TYPE, value, absolute)) + SetChangedFlag(true); + break; + case F_SelectedPins: + if (ChangeSelectedClearSize(PIN_TYPE, value, absolute)) + SetChangedFlag(true); + break; + case F_SelectedLines: + if (ChangeSelectedClearSize(LINE_TYPE, value, absolute)) + SetChangedFlag(true); + break; + case F_SelectedArcs: + if (ChangeSelectedClearSize(ARC_TYPE, value, absolute)) + SetChangedFlag(true); + break; + case F_Selected: + case F_SelectedObjects: + if (ChangeSelectedClearSize(CHANGECLEARSIZE_TYPES, value, absolute)) + SetChangedFlag(true); + break; + } + } + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char changeflag_syntax[] = + "ChangeFlag(Object|Selected|SelectedObjects, flag, value)\n" + "ChangeFlag(SelectedLines|SelectedPins|SelectedVias, flag, value)\n" + "ChangeFlag(SelectedPads|SelectedTexts|SelectedNames, flag, value)\n" + "ChangeFlag(SelectedElements, flag, value)\n" "flag = square | octagon | thermal | join\n" "value = 0 | 1"; + +static const char changeflag_help[] = "Sets or clears flags on objects."; + +/* %start-doc actions ChangeFlag + +Toggles the given flag on the indicated object(s). The flag may be +one of the flags listed above (square, octagon, thermal, join). The +value may be the number 0 or 1. If the value is 0, the flag is +cleared. If the value is 1, the flag is set. + +%end-doc */ + +static int ActionChangeFlag(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + char *flag = ARG(1); + int value = argc > 2 ? atoi(argv[2]) : -1; + if (value != 0 && value != 1) + AFAIL(changeflag); + + ChangeFlag(function, flag, value, "ChangeFlag"); + return 0; +} + + +static void ChangeFlag(char *what, char *flag_name, int value, char *cmd_name) +{ + bool(*set_object) (int, void *, void *, void *); + bool(*set_selected) (int); + + if (NSTRCMP(flag_name, "square") == 0) { + set_object = value ? SetObjectSquare : ClrObjectSquare; + set_selected = value ? SetSelectedSquare : ClrSelectedSquare; + } + else if (NSTRCMP(flag_name, "octagon") == 0) { + set_object = value ? SetObjectOctagon : ClrObjectOctagon; + set_selected = value ? SetSelectedOctagon : ClrSelectedOctagon; + } + else if (NSTRCMP(flag_name, "join") == 0) { + /* Note: these are backwards, because the flag is "clear" but + the command is "join". */ + set_object = value ? ClrObjectJoin : SetObjectJoin; + set_selected = value ? ClrSelectedJoin : SetSelectedJoin; + } + else { + Message(_("%s(): Flag \"%s\" is not valid\n"), cmd_name, flag_name); + return; + } + + switch (GetFunctionID(what)) { + case F_Object: + { + int type; + void *ptr1, *ptr2, *ptr3; + + if ((type = SearchScreen(Crosshair.X, Crosshair.Y, CHANGESIZE_TYPES, &ptr1, &ptr2, &ptr3)) != NO_TYPE) + if (TEST_FLAG(LOCKFLAG, (PinTypePtr) ptr2)) + Message(_("Sorry, the object is locked\n")); + if (set_object(type, ptr1, ptr2, ptr3)) + SetChangedFlag(true); + break; + } + + case F_SelectedVias: + if (set_selected(VIA_TYPE)) + SetChangedFlag(true); + break; + + case F_SelectedPins: + if (set_selected(PIN_TYPE)) + SetChangedFlag(true); + break; + + case F_SelectedPads: + if (set_selected(PAD_TYPE)) + SetChangedFlag(true); + break; + + case F_SelectedLines: + if (set_selected(LINE_TYPE)) + SetChangedFlag(true); + break; + + case F_SelectedTexts: + if (set_selected(TEXT_TYPE)) + SetChangedFlag(true); + break; + + case F_SelectedNames: + if (set_selected(ELEMENTNAME_TYPE)) + SetChangedFlag(true); + break; + + case F_SelectedElements: + if (set_selected(ELEMENT_TYPE)) + SetChangedFlag(true); + break; + + case F_Selected: + case F_SelectedObjects: + if (set_selected(CHANGESIZE_TYPES)) + SetChangedFlag(true); + break; + } +} + +/* --------------------------------------------------------------------------- */ + +static const char changehold_syntax[] = "ChangeHole(ToggleObject|Object|SelectedVias|Selected)"; + +static const char changehold_help[] = "Changes the hole flag of objects."; + +/* %start-doc actions ChangeHole + +The "hole flag" of a via determines whether the via is a +plated-through hole (not set), or an unplated hole (set). + +%end-doc */ + +static int ActionChangeHole(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + if (function) { + switch (GetFunctionID(function)) { + case F_ToggleObject: + case F_Object: + { + int type; + void *ptr1, *ptr2, *ptr3; + + gui->get_coords(_("Select an Object"), &x, &y); + if ((type = SearchScreen(x, y, VIA_TYPE, &ptr1, &ptr2, &ptr3)) != NO_TYPE && ChangeHole((PinTypePtr) ptr3)) + IncrementUndoSerialNumber(); + break; + } + + case F_SelectedVias: + case F_Selected: + if (ChangeSelectedHole()) + SetChangedFlag(true); + break; + } + } + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char changepaste_syntax[] = "ChangePaste(ToggleObject|Object|SelectedPads|Selected)"; + +static const char changepaste_help[] = "Changes the no paste flag of objects."; + +/* %start-doc actions ChangePaste + +The "no paste flag" of a pad determines whether the solderpaste + stencil will have an opening for the pad (no set) or if there wil be + no solderpaste on the pad (set). This is used for things such as + fiducial pads. + +%end-doc */ + +static int ActionChangePaste(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + if (function) { + switch (GetFunctionID(function)) { + case F_ToggleObject: + case F_Object: + { + int type; + void *ptr1, *ptr2, *ptr3; + + gui->get_coords(_("Select an Object"), &x, &y); + if ((type = SearchScreen(x, y, PAD_TYPE, &ptr1, &ptr2, &ptr3)) != NO_TYPE && ChangePaste((PadTypePtr) ptr3)) + IncrementUndoSerialNumber(); + break; + } + + case F_SelectedPads: + case F_Selected: + if (ChangeSelectedPaste()) + SetChangedFlag(true); + break; + } + } + return 0; +} + + +/* --------------------------------------------------------------------------- */ + +static const char changesizes_syntax[] = + "ChangeSizes(Object, delta|style)\n" + "ChangeSizes(SelectedObjects|Selected, delta|style)\n" + "ChangeSizes(SelectedLines|SelectedPins|SelectedVias, delta|style)\n" + "ChangeSizes(SelectedPads|SelectedTexts|SelectedNames, delta|style)\n" "ChangeSizes(SelectedElements, delta|style)"; + +static const char changesizes_help[] = "Changes all sizes of objects."; + +/* %start-doc actions ChangeSize + +Call ActionChangeSize, ActionChangeDrillSize and ActionChangeClearSize +with the same arguments. If any of them did not fail, return success. +%end-doc */ + +static int ActionChangeSizes(int argc, char **argv, Coord x, Coord y) +{ + int a, b, c; + SaveUndoSerialNumber(); + a = ActionChangeSize(argc, argv, x, y); + RestoreUndoSerialNumber(); + b = ActionChange2ndSize(argc, argv, x, y); + RestoreUndoSerialNumber(); + c = ActionChangeClearSize(argc, argv, x, y); + RestoreUndoSerialNumber(); + IncrementUndoSerialNumber(); + return !(!a || !b || !c); +} + +/* --------------------------------------------------------------------------- */ + +static const char changesize_syntax[] = + "ChangeSize(Object, delta|style)\n" + "ChangeSize(SelectedObjects|Selected, delta|style)\n" + "ChangeSize(SelectedLines|SelectedPins|SelectedVias, delta|style)\n" + "ChangeSize(SelectedPads|SelectedTexts|SelectedNames, delta|style)\n" "ChangeSize(SelectedElements, delta|style)"; + +static const char changesize_help[] = "Changes the size of objects."; + +/* %start-doc actions ChangeSize + +For lines and arcs, this changes the width. For pins and vias, this +changes the overall diameter of the copper annulus. For pads, this +changes the width and, indirectly, the length. For texts and names, +this changes the scaling factor. For elements, this changes the width +of the silk layer lines and arcs for this element. + +%end-doc */ + +static int ActionChangeSize(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + char *delta = ARG(1); + char *units = ARG(2); + bool absolute; /* indicates if absolute size is given */ + Coord value; + int type, tostyle = 0; + void *ptr1, *ptr2, *ptr3; + + + if (function && delta) { + int funcid = GetFunctionID(function); + + if (funcid == F_Object) + type = SearchScreen(Crosshair.X, Crosshair.Y, CHANGESIZE_TYPES, &ptr1, &ptr2, &ptr3); + + if (strcmp(argv[1], "style") == 0) { + if (get_style_size(funcid, &value, type, 0) != 0) + return 1; + absolute = 1; + tostyle = 1; + } + else + value = GetValue(delta, units, &absolute); + switch (funcid) { + case F_Object: + { + if (type != NO_TYPE) + if (TEST_FLAG(LOCKFLAG, (PinTypePtr) ptr2)) + Message(_("Sorry, the object is locked\n")); + if (tostyle) { + if (ChangeObject1stSize(type, ptr1, ptr2, ptr3, value, absolute)) + SetChangedFlag(true); + } + else { + if (ChangeObjectSize(type, ptr1, ptr2, ptr3, value, absolute)) + SetChangedFlag(true); + } + break; + } + case F_SelectedVias: + if (ChangeSelectedSize(VIA_TYPE, value, absolute)) + SetChangedFlag(true); + break; + + case F_SelectedPins: + if (ChangeSelectedSize(PIN_TYPE, value, absolute)) + SetChangedFlag(true); + break; + + case F_SelectedPads: + if (ChangeSelectedSize(PAD_TYPE, value, absolute)) + SetChangedFlag(true); + break; + + case F_SelectedArcs: + if (ChangeSelectedSize(ARC_TYPE, value, absolute)) + SetChangedFlag(true); + break; + + case F_SelectedLines: + if (ChangeSelectedSize(LINE_TYPE, value, absolute)) + SetChangedFlag(true); + break; + + case F_SelectedTexts: + if (ChangeSelectedSize(TEXT_TYPE, value, absolute)) + SetChangedFlag(true); + break; + + case F_SelectedNames: + if (ChangeSelectedSize(ELEMENTNAME_TYPE, value, absolute)) + SetChangedFlag(true); + break; + + case F_SelectedElements: + if (ChangeSelectedSize(ELEMENT_TYPE, value, absolute)) + SetChangedFlag(true); + break; + + case F_Selected: + case F_SelectedObjects: + if (ChangeSelectedSize(CHANGESIZE_TYPES, value, absolute)) + SetChangedFlag(true); + break; + } + } + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char changedrillsize_syntax[] = + "ChangeDrillSize(Object, delta|style)\n" "ChangeDrillSize(SelectedPins|SelectedVias|Selected|SelectedObjects, delta|style)"; + +static const char changedrillsize_help[] = "Changes the drilling hole size of objects."; + +/* %start-doc actions ChangeDrillSize + +%end-doc */ + +static int ActionChange2ndSize(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + char *delta = ARG(1); + char *units = ARG(2); + int type; + void *ptr1, *ptr2, *ptr3; + + bool absolute; + Coord value; + + if (function && delta) { + int funcid = GetFunctionID(function); + + if (funcid == F_Object) { + gui->get_coords(_("Select an Object"), &x, &y); + type = SearchScreen(x, y, CHANGE2NDSIZE_TYPES, &ptr1, &ptr2, &ptr3); + } + + if (strcmp(argv[1], "style") == 0) { + if (get_style_size(funcid, &value, type, 1) != 0) + return 1; + absolute = 1; + } + else + value = GetValue(delta, units, &absolute); + + switch (GetFunctionID(function)) { + case F_Object: + { + + if (type != NO_TYPE) + if (ChangeObject2ndSize(type, ptr1, ptr2, ptr3, value, absolute, true)) + SetChangedFlag(true); + break; + } + + case F_SelectedVias: + if (ChangeSelected2ndSize(VIA_TYPE, value, absolute)) + SetChangedFlag(true); + break; + + case F_SelectedPins: + if (ChangeSelected2ndSize(PIN_TYPE, value, absolute)) + SetChangedFlag(true); + break; + case F_Selected: + case F_SelectedObjects: + if (ChangeSelected2ndSize(PIN_TYPES, value, absolute)) + SetChangedFlag(true); + break; + } + } + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char changepinname_syntax[] = "ChangePinName(ElementName,PinNumber,PinName)"; + +static const char changepinname_help[] = "Sets the name of a specific pin on a specific element."; + +/* %start-doc actions ChangePinName + +This can be especially useful for annotating pin names from a +schematic to the layout without requiring knowledge of the pcb file +format. + +@example +ChangePinName(U3, 7, VCC) +@end example + +%end-doc */ + +static int ActionChangePinName(int argc, char **argv, Coord x, Coord y) +{ + int changed = 0; + char *refdes, *pinnum, *pinname; + + if (argc != 3) { + AFAIL(changepinname); + } + + refdes = argv[0]; + pinnum = argv[1]; + pinname = argv[2]; + + ELEMENT_LOOP(PCB->Data); + { + if (NSTRCMP(refdes, NAMEONPCB_NAME(element)) == 0) { + PIN_LOOP(element); + { + if (NSTRCMP(pinnum, pin->Number) == 0) { + AddObjectToChangeNameUndoList(PIN_TYPE, NULL, NULL, pin, pin->Name); + /* + * Note: we can't free() pin->Name first because + * it is used in the undo list + */ + pin->Name = strdup(pinname); + SetChangedFlag(true); + changed = 1; + } + } + END_LOOP; + + PAD_LOOP(element); + { + if (NSTRCMP(pinnum, pad->Number) == 0) { + AddObjectToChangeNameUndoList(PAD_TYPE, NULL, NULL, pad, pad->Name); + /* + * Note: we can't free() pad->Name first because + * it is used in the undo list + */ + pad->Name = strdup(pinname); + SetChangedFlag(true); + changed = 1; + } + } + END_LOOP; + } + } + END_LOOP; + /* + * done with our action so increment the undo # if we actually + * changed anything + */ + if (changed) { + if (defer_updates) + defer_needs_update = 1; + else { + IncrementUndoSerialNumber(); + gui->invalidate_all(); + } + } + + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char changename_syntax[] = "ChangeName(Object)\n" "ChangeName(Object|\"Number\")\n" "ChangeName(Layout|Layer)"; + +static const char changename_help[] = "Sets the name (or pin number) of objects."; + +/* %start-doc actions ChangeName + +@table @code + +@item Object +Changes the name of the element under the cursor. + +@item Layout +Changes the name of the layout. This is printed on the fab drawings. + +@item Layer +Changes the name of the currently active layer. + +@end table + +%end-doc */ + +int ActionChangeName(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + char *pinnums = ARG(1); + char *name; + int pinnum; + + if (function) { + switch (GetFunctionID(function)) { + /* change the name of an object */ + case F_Object: + { + int type; + void *ptr1, *ptr2, *ptr3; + + gui->get_coords(_("Select an Object"), &x, &y); + if ((type = SearchScreen(x, y, CHANGENAME_TYPES, &ptr1, &ptr2, &ptr3)) != NO_TYPE) { + SaveUndoSerialNumber(); + if ((pinnums != NULL) && (strcasecmp(pinnums, "Number") == 0)) + pinnum = 1; + else + pinnum = 0; + if (QueryInputAndChangeObjectName(type, ptr1, ptr2, ptr3, pinnum)) { + SetChangedFlag(true); + if (type == ELEMENT_TYPE) { + RubberbandTypePtr ptr; + int i; + + RestoreUndoSerialNumber(); + Crosshair.AttachedObject.RubberbandN = 0; + LookupRatLines(type, ptr1, ptr2, ptr3); + ptr = Crosshair.AttachedObject.Rubberband; + for (i = 0; i < Crosshair.AttachedObject.RubberbandN; i++, ptr++) { + if (PCB->RatOn) + EraseRat((RatTypePtr) ptr->Line); + MoveObjectToRemoveUndoList(RATLINE_TYPE, ptr->Line, ptr->Line, ptr->Line); + } + IncrementUndoSerialNumber(); + Draw(); + } + } + } + break; + } + + /* change the layout's name */ + case F_Layout: + name = gui->prompt_for(_("Enter the layout name:"), EMPTY(PCB->Name)); + /* NB: ChangeLayoutName takes ownership of the passed memory */ + if (name && ChangeLayoutName(name)) + SetChangedFlag(true); + break; + + /* change the name of the active layer */ + case F_Layer: + name = gui->prompt_for(_("Enter the layer name:"), EMPTY(CURRENT->Name)); + /* NB: ChangeLayerName takes ownership of the passed memory */ + if (name && ChangeLayerName(CURRENT, name)) + SetChangedFlag(true); + break; + } + } + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char changejoin_syntax[] = "ChangeJoin(ToggleObject|SelectedLines|SelectedArcs|Selected)"; + +static const char changejoin_help[] = "Changes the join (clearance through polygons) of objects."; + +/* %start-doc actions ChangeJoin + +The join flag determines whether a line or arc, drawn to intersect a +polygon, electrically connects to the polygon or not. When joined, +the line/arc is simply drawn over the polygon, making an electrical +connection. When not joined, a gap is drawn between the line and the +polygon, insulating them from each other. + +%end-doc */ + +static int ActionChangeJoin(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + if (function) { + switch (GetFunctionID(function)) { + case F_ToggleObject: + case F_Object: + { + int type; + void *ptr1, *ptr2, *ptr3; + + gui->get_coords(_("Select an Object"), &x, &y); + if ((type = SearchScreen(x, y, CHANGEJOIN_TYPES, &ptr1, &ptr2, &ptr3)) != NO_TYPE) + if (ChangeObjectJoin(type, ptr1, ptr2, ptr3)) + SetChangedFlag(true); + break; + } + + case F_SelectedLines: + if (ChangeSelectedJoin(LINE_TYPE)) + SetChangedFlag(true); + break; + + case F_SelectedArcs: + if (ChangeSelectedJoin(ARC_TYPE)) + SetChangedFlag(true); + break; + + case F_Selected: + case F_SelectedObjects: + if (ChangeSelectedJoin(CHANGEJOIN_TYPES)) + SetChangedFlag(true); + break; + } + } + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char changenonetlist_syntax[] = + "ChangeNonetlist(ToggleObject)\n" "ChangeNonetlist(SelectedElements)\n" "ChangeNonetlist(Selected|SelectedObjects)"; + +static const char changenonetlist_help[] = "Changes the nonetlist flag of elements."; + +/* %start-doc actions ChangeNonetlist + +Note that @code{Pins} means both pins and pads. + +@pinshapes + +%end-doc */ + +static int ActionChangeNonetlist(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + if (function) { + switch (GetFunctionID(function)) { + case F_ToggleObject: + case F_Object: + case F_Element: + { + int type; + void *ptr1, *ptr2, *ptr3; + gui->get_coords(_("Select an Element"), &x, &y); + + ptr3 = NULL; + type = SearchScreen(x, y, CHANGENONETLIST_TYPES, &ptr1, &ptr2, &ptr3); + if (ChangeObjectNonetlist(type, ptr1, ptr2, ptr3)) + SetChangedFlag(true); + break; + } + case F_SelectedElements: + case F_Selected: + case F_SelectedObjects: + if (ChangeSelectedNonetlist(ELEMENT_TYPE)) + SetChangedFlag(true); + break; + } + } + return 0; +} + + +/* --------------------------------------------------------------------------- */ + +static const char changesquare_syntax[] = + "ChangeSquare(ToggleObject)\n" "ChangeSquare(SelectedElements|SelectedPins)\n" "ChangeSquare(Selected|SelectedObjects)"; + +static const char changesquare_help[] = "Changes the square flag of pins and pads."; + +/* %start-doc actions ChangeSquare + +Note that @code{Pins} means both pins and pads. + +@pinshapes + +%end-doc */ + +static int ActionChangeSquare(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + if (function) { + switch (GetFunctionID(function)) { + case F_ToggleObject: + case F_Object: + { + int type; + void *ptr1, *ptr2, *ptr3; + + gui->get_coords(_("Select an Object"), &x, &y); + + ptr3 = NULL; + type = SearchScreen(x, y, CHANGESQUARE_TYPES, &ptr1, &ptr2, &ptr3); + + if (ptr3 != NULL) { + int qstyle = GET_SQUARE((PinTypePtr) ptr3); + qstyle++; + if (qstyle > 17) + qstyle = 0; + if (type != NO_TYPE) + if (ChangeObjectSquare(type, ptr1, ptr2, ptr3, qstyle)) + SetChangedFlag(true); + } + break; + } + + case F_SelectedElements: + if (ChangeSelectedSquare(ELEMENT_TYPE)) + SetChangedFlag(true); + break; + + case F_SelectedPins: + if (ChangeSelectedSquare(PIN_TYPE | PAD_TYPE)) + SetChangedFlag(true); + break; + + case F_Selected: + case F_SelectedObjects: + if (ChangeSelectedSquare(PIN_TYPE | PAD_TYPE)) + SetChangedFlag(true); + break; + } + } + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char setsquare_syntax[] = "SetSquare(ToggleObject|SelectedElements|SelectedPins)"; + +static const char setsquare_help[] = "sets the square-flag of objects."; + +/* %start-doc actions SetSquare + +Note that @code{Pins} means pins and pads. + +@pinshapes + +%end-doc */ + +static int ActionSetSquare(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + if (function && *function) { + switch (GetFunctionID(function)) { + case F_ToggleObject: + case F_Object: + { + int type; + void *ptr1, *ptr2, *ptr3; + + gui->get_coords(_("Select an Object"), &x, &y); + if ((type = SearchScreen(x, y, CHANGESQUARE_TYPES, &ptr1, &ptr2, &ptr3)) != NO_TYPE) + if (SetObjectSquare(type, ptr1, ptr2, ptr3)) + SetChangedFlag(true); + break; + } + + case F_SelectedElements: + if (SetSelectedSquare(ELEMENT_TYPE)) + SetChangedFlag(true); + break; + + case F_SelectedPins: + if (SetSelectedSquare(PIN_TYPE | PAD_TYPE)) + SetChangedFlag(true); + break; + + case F_Selected: + case F_SelectedObjects: + if (SetSelectedSquare(PIN_TYPE | PAD_TYPE)) + SetChangedFlag(true); + break; + } + } + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char clearsquare_syntax[] = "ClearSquare(ToggleObject|SelectedElements|SelectedPins)"; + +static const char clearsquare_help[] = "Clears the square-flag of pins and pads."; + +/* %start-doc actions ClearSquare + +Note that @code{Pins} means pins and pads. + +@pinshapes + +%end-doc */ + +static int ActionClearSquare(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + if (function && *function) { + switch (GetFunctionID(function)) { + case F_ToggleObject: + case F_Object: + { + int type; + void *ptr1, *ptr2, *ptr3; + + gui->get_coords(_("Select an Object"), &x, &y); + if ((type = SearchScreen(x, y, CHANGESQUARE_TYPES, &ptr1, &ptr2, &ptr3)) != NO_TYPE) + if (ClrObjectSquare(type, ptr1, ptr2, ptr3)) + SetChangedFlag(true); + break; + } + + case F_SelectedElements: + if (ClrSelectedSquare(ELEMENT_TYPE)) + SetChangedFlag(true); + break; + + case F_SelectedPins: + if (ClrSelectedSquare(PIN_TYPE | PAD_TYPE)) + SetChangedFlag(true); + break; + + case F_Selected: + case F_SelectedObjects: + if (ClrSelectedSquare(PIN_TYPE | PAD_TYPE)) + SetChangedFlag(true); + break; + } + } + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char changeoctagon_syntax[] = + "ChangeOctagon(Object|ToggleObject|SelectedObjects|Selected)\n" "ChangeOctagon(SelectedElements|SelectedPins|SelectedVias)"; + +static const char changeoctagon_help[] = "Changes the octagon-flag of pins and vias."; + +/* %start-doc actions ChangeOctagon + +@pinshapes + +%end-doc */ + +static int ActionChangeOctagon(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + if (function) { + switch (GetFunctionID(function)) { + case F_ToggleObject: + case F_Object: + { + int type; + void *ptr1, *ptr2, *ptr3; + + gui->get_coords(_("Select an Object"), &x, &y); + if ((type = SearchScreen(x, y, CHANGEOCTAGON_TYPES, &ptr1, &ptr2, &ptr3)) != NO_TYPE) + if (ChangeObjectOctagon(type, ptr1, ptr2, ptr3)) + SetChangedFlag(true); + break; + } + + case F_SelectedElements: + if (ChangeSelectedOctagon(ELEMENT_TYPE)) + SetChangedFlag(true); + break; + + case F_SelectedPins: + if (ChangeSelectedOctagon(PIN_TYPE)) + SetChangedFlag(true); + break; + + case F_SelectedVias: + if (ChangeSelectedOctagon(VIA_TYPE)) + SetChangedFlag(true); + break; + + case F_Selected: + case F_SelectedObjects: + if (ChangeSelectedOctagon(PIN_TYPES)) + SetChangedFlag(true); + break; + } + } + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char setoctagon_syntax[] = "SetOctagon(Object|ToggleObject|SelectedElements|Selected)"; + +static const char setoctagon_help[] = "Sets the octagon-flag of objects."; + +/* %start-doc actions SetOctagon + +@pinshapes + +%end-doc */ + +static int ActionSetOctagon(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + if (function) { + switch (GetFunctionID(function)) { + case F_ToggleObject: + case F_Object: + { + int type; + void *ptr1, *ptr2, *ptr3; + + gui->get_coords(_("Select an Object"), &x, &y); + if ((type = SearchScreen(x, y, CHANGEOCTAGON_TYPES, &ptr1, &ptr2, &ptr3)) != NO_TYPE) + if (SetObjectOctagon(type, ptr1, ptr2, ptr3)) + SetChangedFlag(true); + break; + } + + case F_SelectedElements: + if (SetSelectedOctagon(ELEMENT_TYPE)) + SetChangedFlag(true); + break; + + case F_SelectedPins: + if (SetSelectedOctagon(PIN_TYPE)) + SetChangedFlag(true); + break; + + case F_SelectedVias: + if (SetSelectedOctagon(VIA_TYPE)) + SetChangedFlag(true); + break; + + case F_Selected: + case F_SelectedObjects: + if (SetSelectedOctagon(PIN_TYPES)) + SetChangedFlag(true); + break; + } + } + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char clearoctagon_syntax[] = + "ClearOctagon(ToggleObject|Object|SelectedObjects|Selected)\n" "ClearOctagon(SelectedElements|SelectedPins|SelectedVias)"; + +static const char clearoctagon_help[] = "Clears the octagon-flag of pins and vias."; + +/* %start-doc actions ClearOctagon + +@pinshapes + +%end-doc */ + +static int ActionClearOctagon(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + if (function) { + switch (GetFunctionID(function)) { + case F_ToggleObject: + case F_Object: + { + int type; + void *ptr1, *ptr2, *ptr3; + + gui->get_coords(_("Select an Object"), &x, &y); + if ((type = SearchScreen(Crosshair.X, Crosshair.Y, CHANGEOCTAGON_TYPES, &ptr1, &ptr2, &ptr3)) != NO_TYPE) + if (ClrObjectOctagon(type, ptr1, ptr2, ptr3)) + SetChangedFlag(true); + break; + } + + case F_SelectedElements: + if (ClrSelectedOctagon(ELEMENT_TYPE)) + SetChangedFlag(true); + break; + + case F_SelectedPins: + if (ClrSelectedOctagon(PIN_TYPE)) + SetChangedFlag(true); + break; + + case F_SelectedVias: + if (ClrSelectedOctagon(VIA_TYPE)) + SetChangedFlag(true); + break; + + case F_Selected: + case F_SelectedObjects: + if (ClrSelectedOctagon(PIN_TYPES)) + SetChangedFlag(true); + break; + } + } + return 0; +} + +/* -------------------------------------------------------------------------- */ + +static const char setthermal_syntax[] = "SetThermal(Object|SelectedPins|SelectedVias|Selected, Style)"; + +static const char setthermal_help[] = + "Set the thermal (on the current layer) of pins or vias to the given style.\n" + "Style = 0 means no thermal.\n" + "Style = 1 has diagonal fingers with sharp edges.\n" + "Style = 2 has horizontal and vertical fingers with sharp edges.\n" + "Style = 3 is a solid connection to the plane." + "Style = 4 has diagonal fingers with rounded edges.\n" "Style = 5 has horizontal and vertical fingers with rounded edges.\n"; + +/* %start-doc actions SetThermal + +This changes how/whether pins or vias connect to any rectangle or polygon +on the current layer. The first argument can specify one object, or all +selected pins, or all selected vias, or all selected pins and vias. +The second argument specifies the style of connection. +There are 5 possibilities: +0 - no connection, +1 - 45 degree fingers with sharp edges, +2 - horizontal & vertical fingers with sharp edges, +3 - solid connection, +4 - 45 degree fingers with rounded corners, +5 - horizontal & vertical fingers with rounded corners. + +Pins and Vias may have thermals whether or not there is a polygon available +to connect with. However, they will have no effect without the polygon. +%end-doc */ + +static int ActionSetThermal(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + char *style = ARG(1); + void *ptr1, *ptr2, *ptr3; + int type, kind; + int err = 0; + + if (function && *function && style && *style) { + bool absolute; + + kind = GetValue(style, NULL, &absolute); + if (absolute) + switch (GetFunctionID(function)) { + case F_Object: + if ((type = SearchScreen(Crosshair.X, Crosshair.Y, CHANGETHERMAL_TYPES, &ptr1, &ptr2, &ptr3)) != NO_TYPE) { + ChangeObjectThermal(type, ptr1, ptr2, ptr3, kind); + IncrementUndoSerialNumber(); + Draw(); + } + break; + case F_SelectedPins: + ChangeSelectedThermals(PIN_TYPE, kind); + break; + case F_SelectedVias: + ChangeSelectedThermals(VIA_TYPE, kind); + break; + case F_Selected: + case F_SelectedElements: + ChangeSelectedThermals(CHANGETHERMAL_TYPES, kind); + break; + default: + err = 1; + break; + } + else + err = 1; + if (!err) + return 0; + } + + AFAIL(setthermal); +} + + +/* --------------------------------------------------------------------------- */ + +static const char setflag_syntax[] = + "SetFlag(Object|Selected|SelectedObjects, flag)\n" + "SetFlag(SelectedLines|SelectedPins|SelectedVias, flag)\n" + "SetFlag(SelectedPads|SelectedTexts|SelectedNames, flag)\n" + "SetFlag(SelectedElements, flag)\n" "flag = square | octagon | thermal | join"; + +static const char setflag_help[] = "Sets flags on objects."; + +/* %start-doc actions SetFlag + +Turns the given flag on, regardless of its previous setting. See +@code{ChangeFlag}. + +@example +SetFlag(SelectedPins,thermal) +@end example + +%end-doc */ + +static int ActionSetFlag(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + char *flag = ARG(1); + ChangeFlag(function, flag, 1, "SetFlag"); + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char clrflag_syntax[] = + "ClrFlag(Object|Selected|SelectedObjects, flag)\n" + "ClrFlag(SelectedLines|SelectedPins|SelectedVias, flag)\n" + "ClrFlag(SelectedPads|SelectedTexts|SelectedNames, flag)\n" + "ClrFlag(SelectedElements, flag)\n" "flag = square | octagon | thermal | join"; + +static const char clrflag_help[] = "Clears flags on objects."; + +/* %start-doc actions ClrFlag + +Turns the given flag off, regardless of its previous setting. See +@code{ChangeFlag}. + +@example +ClrFlag(SelectedLines,join) +@end example + +%end-doc */ + +static int ActionClrFlag(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + char *flag = ARG(1); + ChangeFlag(function, flag, 0, "ClrFlag"); + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char setvalue_syntax[] = "SetValue(Grid|Line|LineSize|Text|TextScale|ViaDrillingHole|Via|ViaSize, delta)"; + +static const char setvalue_help[] = "Change various board-wide values and sizes."; + +/* %start-doc actions SetValue + +@table @code + +@item ViaDrillingHole +Changes the diameter of the drill for new vias. + +@item Grid +Sets the grid spacing. + +@item Line +@item LineSize +Changes the thickness of new lines. + +@item Via +@item ViaSize +Changes the diameter of new vias. + +@item Text +@item TextScale +Changes the size of new text. + +@end table + +%end-doc */ + +static int ActionSetValue(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + char *val = ARG(1); + char *units = ARG(2); + bool absolute; /* flag for 'absolute' value */ + double value; + int err = 0; + + if (function && val) { + value = GetValue(val, units, &absolute); + switch (GetFunctionID(function)) { + case F_ViaDrillingHole: + SetViaDrillingHole(absolute ? value : value + Settings.ViaDrillingHole, false); + hid_action("RouteStylesChanged"); + break; + + case F_Grid: + if (absolute) + SetGrid(value, false); + else { + /* On the way down, short against the minimum + * PCB drawing unit */ + if ((value + PCB->Grid) < 1) + SetGrid(1, false); + else if (PCB->Grid == 1) + SetGrid(value, false); + else + SetGrid(value + PCB->Grid, false); + } + break; + + case F_LineSize: + case F_Line: + SetLineSize(absolute ? value : value + Settings.LineThickness); + hid_action("RouteStylesChanged"); + break; + + case F_Via: + case F_ViaSize: + SetViaSize(absolute ? value : value + Settings.ViaThickness, false); + hid_action("RouteStylesChanged"); + break; + + case F_Text: + case F_TextScale: + value /= 45; + SetTextScale(absolute ? value : value + Settings.TextScale); + break; + default: + err = 1; + break; + } + if (!err) + return 0; + } + + AFAIL(setvalue); +} + +/* --------------------------------------------------------------------------- */ + +HID_Action change_action_list[] = { + {"ChangeClearSize", 0, ActionChangeClearSize, + changeclearsize_help, changeclearsize_syntax} + , + {"ChangeDrillSize", 0, ActionChange2ndSize, + changedrillsize_help, changedrillsize_syntax} + , + {"ChangeHole", 0, ActionChangeHole, + changehold_help, changehold_syntax} + , + {"ChangeJoin", 0, ActionChangeJoin, + changejoin_help, changejoin_syntax} + , + {"ChangeName", 0, ActionChangeName, + changename_help, changename_syntax} + , + {"ChangePaste", 0, ActionChangePaste, + changepaste_help, changepaste_syntax} + , + {"ChangePinName", 0, ActionChangePinName, + changepinname_help, changepinname_syntax} + , + {"ChangeSize", 0, ActionChangeSize, + changesize_help, changesize_syntax} + , + {"ChangeSizes", 0, ActionChangeSizes, + changesizes_help, changesizes_syntax} + , + {"ChangeNonetlist", 0, ActionChangeNonetlist, + changenonetlist_help, changenonetlist_syntax} + , + {"ChangeSquare", 0, ActionChangeSquare, + changesquare_help, changesquare_syntax} + , + {"ChangeOctagon", 0, ActionChangeOctagon, + changeoctagon_help, changeoctagon_syntax} + , + {"ChangeFlag", 0, ActionChangeFlag, + changeflag_help, changeflag_syntax} + , + {"ClearSquare", 0, ActionClearSquare, + clearsquare_help, clearsquare_syntax} + , + {"ClearOctagon", 0, ActionClearOctagon, + clearoctagon_help, clearoctagon_syntax} + , + {"SetSquare", 0, ActionSetSquare, + setsquare_help, setsquare_syntax} + , + {"SetOctagon", 0, ActionSetOctagon, + setoctagon_help, setoctagon_syntax} + , + {"SetThermal", 0, ActionSetThermal, + setthermal_help, setthermal_syntax} + , + {"SetValue", 0, ActionSetValue, + setvalue_help, setvalue_syntax} + , + {"SetFlag", 0, ActionSetFlag, + setflag_help, setflag_syntax} + , + {"ClrFlag", 0, ActionClrFlag, + clrflag_help, clrflag_syntax} +}; + +REGISTER_ACTIONS(change_action_list) Index: 1.0.8/src/check_icon.data =================================================================== --- 1.0.8/src/check_icon.data (nonexistent) +++ 1.0.8/src/check_icon.data (revision 1136) @@ -0,0 +1,4 @@ +#define check_icon_width 8 +#define check_icon_height 8 +static unsigned char check_icon_bits[] = { + 0x80, 0xc0, 0x61, 0x31, 0x1b, 0x0f, 0x06, 0x00}; Index: 1.0.8/src/clip.c =================================================================== --- 1.0.8/src/clip.c (nonexistent) +++ 1.0.8/src/clip.c (revision 1136) @@ -0,0 +1,124 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * Copyright (C) 2004 harry eaton + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + + +#include "config.h" + +#include +#include +#include + +#include "global.h" +#include "data.h" +#include "draw.h" +#include "mymem.h" + + +RCSID("$Id$"); + +/* Clip the line to the clipBox + * return true if something to be drawn + * false if the whole thing is clipped + */ +bool ClipLine(double minx, double miny, double maxx, double maxy, double *x1, double *y1, double *x2, double *y2, double margin) +{ + double d, r; + + minx -= margin; + miny -= margin; + maxx += margin; + maxy += margin; + + /* clip first point on left side */ + if (*x1 < minx) { + if (*x2 < minx) + return false; + d = *x2 - *x1; + r = (minx - *x1) / d; + *x1 = minx; + *y1 += r * (*y2 - *y1); + } + /* clip second point on left side */ + if (*x2 < minx) { + d = *x1 - *x2; + r = (minx - *x2) / d; + *x2 = minx; + *y2 += r * (*y1 - *y2); + } + /* clip first point on right side */ + if (*x1 > maxx) { + if (*x2 > maxx) + return false; + d = *x2 - *x1; + r = (maxx - *x1) / d; + *x1 = maxx; + *y1 += r * (*y2 - *y1); + } + /* clip second point on right side */ + if (*x2 > maxx) { + d = *x1 - *x2; + r = (maxx - *x2) / d; + *x2 = maxx; + *y2 += r * (*y1 - *y2); + } + + /* clip first point on top */ + if (*y1 < miny) { + if (*y2 < miny) + return false; + d = *y2 - *y1; + r = (miny - *y1) / d; + *y1 = miny; + *x1 += r * (*x2 - *x1); + } + /* clip second point on top */ + if (*y2 < miny) { + d = *y1 - *y2; + r = (miny - *y2) / d; + *y2 = miny; + *x2 += r * (*x1 - *x2); + } + /* clip first point on bottom */ + if (*y1 > maxy) { + if (*y2 > maxy) + return false; + d = *y2 - *y1; + r = (maxy - *y1) / d; + *y1 = maxy; + *x1 += r * (*x2 - *x1); + } + /* clip second point on top */ + if (*y2 > maxy) { + d = *y1 - *y2; + r = (maxy - *y2) / d; + *y2 = maxy; + *x2 += r * (*x1 - *x2); + } + return true; +} Index: 1.0.8/src/clip.h =================================================================== --- 1.0.8/src/clip.h (nonexistent) +++ 1.0.8/src/clip.h (revision 1136) @@ -0,0 +1,46 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * Copyright (C) 2004 harry eaton + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + * RCS: $Id$ + */ + +/* prototypes for inserting points into objects + */ + +#ifndef PCB_CLIP_H +#define PCB_CLIP_H + +#include "global.h" + +/* --------------------------------------------------------------------------- + * prototypes + */ + +/* Clip X,Y to the given bounding box, plus a margin. Returns TRUE if + there is something left to be drawn. */ +bool ClipLine(double minx, double miny, double maxx, double maxy, + double *x1, double *y1, double *x2, double *y2, double margin); + +#endif Index: 1.0.8/src/command.c =================================================================== --- 1.0.8/src/command.c (nonexistent) +++ 1.0.8/src/command.c (revision 1136) @@ -0,0 +1,400 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996, 2005 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* executes commands from user + */ + +#include "config.h" + +#include +#ifdef HAVE_STRING_H +#include +#endif +#include + +#include "global.h" +#include "action.h" +#include "buffer.h" +#include "command.h" +#include "data.h" +#include "error.h" +#include "file.h" +#include "mymem.h" +#include "misc.h" +#include "rats.h" +#include "set.h" + + +RCSID("$Id$"); + +/* ---------------------------------------------------------------------- */ + +/* %start-doc actions 00macros + +@macro colonaction + +This is one of the command box helper actions. While it is a regular +action and can be used like any other action, its name and syntax are +optimized for use with the command box (@code{:}) and thus the syntax +is documented for that purpose. + +@end macro + +%end-doc */ + +/* ---------------------------------------------------------------------- */ + +static const char h_syntax[] = "h"; + +static const char h_help[] = "Print a help message for commands."; + +/* %start-doc actions h + +@colonaction + +%end-doc */ + +static int CommandHelp(int argc, char **argv, Coord x, Coord y) +{ + Message("following commands are supported:\n" + " Command() execute an action command (too numerous to list)\n" + " see the manual for the list of action commands\n" + " h display this help message\n" + " l [file] load layout\n" + " le [file] load element to buffer\n" + " m [file] load layout to buffer (merge)\n" + " q quits the application\n" + " q! quits without save warning\n" + " rn [file] read in a net-list file\n" + " s [file] save layout\n" " w [file] save layout\n" " wq [file] save layout and quit\n"); + return (0); +} + +/* ---------------------------------------------------------------------- */ + +static const char l_syntax[] = "l [name]"; + +static const char l_help[] = "Loads layout data."; + +/* %start-doc actions l + +Loads a new datafile (layout) and, if confirmed, overwrites any +existing unsaved data. The filename and the searchpath +(@emph{filePath}) are passed to the command defined by +@emph{fileCommand}. If no filename is specified a file select box +will popup. + +@colonaction + +%end-doc */ + +static int CommandLoadLayout(int argc, char **argv, Coord x, Coord y) +{ + char *filename, *name = NULL; + + switch (argc) { + case 1: /* filename is passed in commandline */ + filename = argv[0]; + break; + + default: /* usage */ + Message("Usage: l [name]\n loads layout data\n"); + return (1); + } + + if (!PCB->Changed || gui->confirm_dialog("OK to override layout data?", 0)) + LoadPCB(filename, true, false); + free(name); + return (0); +} + +/* --------------------------------------------------------------------------- */ + +static const char le_syntax[] = "le [name]"; + +static const char le_help[] = "Loads an element into the current buffer."; + +/* %start-doc actions le + +The filename and the searchpath (@emph{elementSearchPaths}) are passed to the +element loader. If no filename is specified a file select box will popup. + +@colonaction + +%end-doc */ + +static int CommandLoadElementToBuffer(int argc, char **argv, Coord x, Coord y) +{ + char *filename; + + switch (argc) { + case 1: /* filename is passed in commandline */ + filename = argv[0]; + if (filename && LoadElementToBuffer(PASTEBUFFER, filename)) + SetMode(PASTEBUFFER_MODE); + break; + + default: /* usage */ + Message(false, "Usage: le [name]\n loads element data to buffer\n"); + return (1); + } + return (0); +} + +/* --------------------------------------------------------------------------- */ + +static const char m_syntax[] = "m [name]"; + +static const char m_help[] = "Loads a layout into the current buffer."; + +/* %start-doc actions m + +The filename and the searchpath (@emph{filePath}) are passed to the +command defined by @emph{fileCommand}. +If no filename is specified a file select box will popup. + +@colonaction + +%end-doc */ + +static int CommandLoadLayoutToBuffer(int argc, char **argv, Coord x, Coord y) +{ + char *filename; + + switch (argc) { + case 1: /* filename is passed in commandline */ + filename = argv[0]; + if (filename && LoadLayoutToBuffer(PASTEBUFFER, filename)) + SetMode(PASTEBUFFER_MODE); + break; + + default: /* usage */ + Message("Usage: m [name]\n loads layout data to buffer\n"); + return (1); + } + return (0); +} + +/* --------------------------------------------------------------------------- */ + +static const char q_syntax[] = "q"; + +static const char q_help[] = "Quits the application after confirming."; + +/* %start-doc actions q + +If you have unsaved changes, you will be prompted to confirm (or +save) before quitting. + +@colonaction + +%end-doc */ + +static int CommandQuit(int argc, char **argv, Coord x, Coord y) +{ + if (!PCB->Changed || gui->close_confirm_dialog() == HID_CLOSE_CONFIRM_OK) + QuitApplication(); + return 0; +} + +static const char qreally_syntax[] = "q!"; + +static const char qreally_help[] = "Quits the application without confirming."; + +/* %start-doc actions q! + +Note that this command neither saves your data nor prompts for +confirmation. + +@colonaction + +%end-doc */ + +static int CommandReallyQuit(int argc, char **argv, Coord x, Coord y) +{ + QuitApplication(); + return 0; +} + +/* ---------------------------------------------------------------------- */ + +static const char rn_syntax[] = "rn [name]"; + +static const char rn_help[] = "Reads netlist."; + +/* %start-doc actions rn + +If no filename is given a file select box will pop up. The file is +read via the command defined by the @emph{RatCommand} resource. The +command must send its output to @emph{stdout}. + +Netlists are used for generating rat's nests (see @ref{Rats Nest}) and +for verifying the board layout (which is also accomplished by the +@emph{Ratsnest} command). + +@colonaction + +%end-doc */ + +static int CommandLoadNetlist(int argc, char **argv, Coord x, Coord y) +{ + char *filename, *name = NULL; + + switch (argc) { + case 1: /* filename is passed in commandline */ + filename = argv[0]; + break; + + default: /* usage */ + Message("Usage: rn [name]\n reads in a netlist file\n"); + return (1); + } + if (PCB->Netlistname) + free(PCB->Netlistname); + PCB->Netlistname = StripWhiteSpaceAndDup(filename); + free(name); + return (0); +} + +/* ---------------------------------------------------------------------- */ + +static const char s_syntax[] = "s [name]"; + +static const char s_help[] = "Saves layout data."; + +/* %start-doc actions s + +Data and the filename are passed to the command defined by the +resource @emph{saveCommand}. It must read the layout data from +@emph{stdin}. If no filename is entered, either the last one is used +again or, if it is not available, a file select box will pop up. + +@colonaction + +%end-doc */ + +static const char w_syntax[] = "w [name]"; + +static const char w_help[] = "Saves layout data."; + +/* %start-doc actions w + +This commands has been added for the convenience of @code{vi} users +and has the same functionality as @code{s}. + +@colonaction + +%end-doc */ + +static int CommandSaveLayout(int argc, char **argv, Coord x, Coord y) +{ + switch (argc) { + case 0: + if (PCB->Filename) { + if (SavePCB(PCB->Filename) == 0) + SetChangedFlag(false); + } + else + Message("No filename to save to yet\n"); + break; + + case 1: + if (SavePCB(argv[0]) == 0) { + SetChangedFlag(false); + free(PCB->Filename); + PCB->Filename = strdup(argv[0]); + if (gui->notify_filename_changed != NULL) + gui->notify_filename_changed(); + } + break; + + default: + Message("Usage: s [name] | w [name]\n saves layout data\n"); + return (1); + } + return (0); +} + +/* --------------------------------------------------------------------------- */ + +static const char wq_syntax[] = "wq"; + +static const char wq_help[] = "Saves the layout data and quits."; + +/* %start-doc actions wq + +This command has been added for the convenience of @code{vi} users and +has the same functionality as @code{s} combined with @code{q}. + +@colonaction + +%end-doc */ + +static int CommandSaveLayoutAndQuit(int argc, char **argv, Coord x, Coord y) +{ + if (!CommandSaveLayout(argc, argv, x, y)) + return CommandQuit(0, 0, 0, 0); + return (1); +} + +/* --------------------------------------------------------------------------- */ + +HID_Action command_action_list[] = { + {"h", 0, CommandHelp, + h_help, h_syntax} + , + {"l", 0, CommandLoadLayout, + l_help, l_syntax} + , + {"le", 0, CommandLoadElementToBuffer, + le_help, le_syntax} + , + {"m", 0, CommandLoadLayoutToBuffer, + m_help, m_syntax} + , + {"q", 0, CommandQuit, + q_help, q_syntax} + , + {"q!", 0, CommandReallyQuit, + qreally_help, qreally_syntax} + , + {"rn", 0, CommandLoadNetlist, + rn_help, rn_syntax} + , + {"s", 0, CommandSaveLayout, + s_help, s_syntax} + , + {"w", 0, CommandSaveLayout, + w_help, w_syntax} + , + {"wq", 0, CommandSaveLayoutAndQuit, + wq_help, wq_syntax} + , +}; + +REGISTER_ACTIONS(command_action_list) Index: 1.0.8/src/command.h =================================================================== --- 1.0.8/src/command.h (nonexistent) +++ 1.0.8/src/command.h (revision 1136) @@ -0,0 +1,39 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + * RCS: $Id$ + */ + +/* prototypes for command execution + */ + +#ifndef PCB_COMMAND_H +#define PCB_COMMAND_H + +#include "global.h" + +void ExecuteUserCommand(char *); +void CallActionProc(char *action, char **arg, int argc); + +#endif Index: 1.0.8/src/compat.c =================================================================== --- 1.0.8/src/compat.c (nonexistent) +++ 1.0.8/src/compat.c (revision 1136) @@ -0,0 +1,95 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 2004, 2006 Dan McMahill + * + * 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. + * + */ + +#include "config.h" + +#include +#include "compat.h" +#include "global.h" + + +RCSID("$Id$"); + +#ifndef HAVE_EXPF +float expf(float x) +{ + return (float) exp((double) x); +} +#endif + +#ifndef HAVE_LOGF +float logf(float x) +{ + return (float) log((double) x); +} +#endif + +#ifndef HAVE_RANDOM +long random(void) +{ + return (long) rand(); +} +#endif + +#if !defined(HAVE_DLFCN_H) && defined(WIN32) +#include + +void *dlopen(const char *f, int ATTRIBUTE_UNUSED flag) +{ + return LoadLibrary(f); +} + +void dlclose(void *h) +{ + FreeLibrary((HINSTANCE) h); +} + +char *dlerror() +{ + static LPVOID lpMsgBuf = NULL; + DWORD dw; + + /* free the error message buffer */ + if (lpMsgBuf) + LocalFree(lpMsgBuf); + + /* get the error code */ + dw = GetLastError(); + + /* get the corresponding error message */ + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) & lpMsgBuf, 0, NULL); + + return (char *) lpMsgBuf; +} + +void *dlsym(void *handle, const char *symbol) +{ + return (void *) GetProcAddress((HMODULE) handle, symbol); +} + + +#endif Index: 1.0.8/src/compat.h =================================================================== --- 1.0.8/src/compat.h (nonexistent) +++ 1.0.8/src/compat.h (revision 1136) @@ -0,0 +1,58 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 2004 Dan McMahill + * + * 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. + * + */ + +#ifndef PCB_COMPAT_H +#define PCH_COMPAT_H + +#include "config.h" + +#include + +#ifndef HAVE_EXPF +float expf(float); +#endif + +#ifndef HAVE_LOGF +float logf(float); +#endif + +#ifndef HAVE_RANDOM +long random(void); +#endif + +#if !defined(HAVE_DLFCN_H) && defined(WIN32) +void *dlopen(const char *, int); +void dlclose(void *); +char *dlerror(void); + +void *dlsym(void *, const char *); + +#define RTLD_NOW 2 +#define RTLD_LOCAL 0 +#define RTLD_GLOBAL 4 + +#endif + + +#endif /* PCB_COMPAT_H */ Index: 1.0.8/src/const.h =================================================================== --- 1.0.8/src/const.h (nonexistent) +++ 1.0.8/src/const.h (revision 1136) @@ -0,0 +1,344 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + * RCS: $Id$ + */ + +/* global source constants + */ + +#ifndef PCB_CONST_H +#define PCB_CONST_H + +#include +#include + +#include "globalconst.h" + +/* --------------------------------------------------------------------------- + * the layer-numbers of the two additional special layers + * 'component' and 'solder'. The offset of MAX_LAYER is not added + */ +#define SOLDER_LAYER 0 +#define COMPONENT_LAYER 1 + +/* --------------------------------------------------------------------------- + * misc constants + */ +#define MARK_SIZE MIL_TO_COORD(50) /* relative marker size */ +#define UNDO_WARNING_SIZE (1024*1024) /* warning limit of undo */ +#define USERMEDIANAME "user defined" /* label of default media */ + +/* --------------------------------------------------------------------------- + * some math constants + */ +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif +#ifndef M_SQRT1_2 +#define M_SQRT1_2 0.707106781 /* 1/sqrt(2) */ +#endif +#define M180 (M_PI/180.0) +#define RAD_TO_DEG (180.0/M_PI) +#define TAN_22_5_DEGREE_2 0.207106781 /* 0.5*tan(22.5) */ +#define COS_22_5_DEGREE 0.923879533 /* cos(22.5) */ +#define TAN_30_DEGREE 0.577350269 /* tan(30) */ +#define TAN_60_DEGREE 1.732050808 /* tan(60) */ +#define LN_2_OVER_2 0.346573590 + +/* PCB/physical unit conversions */ +#define COORD_TO_MIL(n) ((n) / 25400.0) +#define MIL_TO_COORD(n) ((n) * 25400.0) +#define COORD_TO_MM(n) ((n) / 1000000.0) +#define MM_TO_COORD(n) ((n) * 1000000.0) +#define COORD_TO_INCH(n) (COORD_TO_MIL(n) / 1000.0) +#define INCH_TO_COORD(n) (MIL_TO_COORD(n) * 1000.0) + +/* These need to be carefully written to avoid overflows, and return + a Coord type. */ +#define SCALE_TEXT(COORD,TEXTSCALE) ((Coord)((COORD) * ((double)(TEXTSCALE) / 100.0))) +#define UNSCALE_TEXT(COORD,TEXTSCALE) ((Coord)((COORD) * (100.0 / (double)(TEXTSCALE)))) + +/* --------------------------------------------------------------------------- + * modes + */ +#define NO_MODE 0 /* no mode selected */ +#define VIA_MODE 1 /* draw vias */ +#define LINE_MODE 2 /* draw lines */ +#define RECTANGLE_MODE 3 /* create rectangles */ +#define POLYGON_MODE 4 /* draw filled polygons */ +#define PASTEBUFFER_MODE 5 /* paste objects from buffer */ +#define TEXT_MODE 6 /* create text objects */ +#define ROTATE_MODE 102 /* rotate objects */ +#define REMOVE_MODE 103 /* remove objects */ +#define MOVE_MODE 104 /* move objects */ +#define COPY_MODE 105 /* copy objects */ +#define INSERTPOINT_MODE 106 /* insert point into line/polygon */ +#define RUBBERBANDMOVE_MODE 107 /* move objects and attached lines */ +#define THERMAL_MODE 108 /* toggle thermal layer flag */ +#define ARC_MODE 109 /* draw arcs */ +#define ARROW_MODE 110 /* selection with arrow mode */ +#define PAN_MODE 0 /* same as no mode */ +#define LOCK_MODE 111 /* lock/unlock objects */ +#define POLYGONHOLE_MODE 112 /* cut holes in filled polygons */ + +/* --------------------------------------------------------------------------- + * object flags + */ + +/* %start-doc pcbfile ~objectflags +@node Object Flags +@section Object Flags + +Note that object flags can be given numerically (like @code{0x0147}) +or symbolically (like @code{"found,showname,square"}. Some numeric +values are reused for different object types. The table below lists +the numeric value followed by the symbolic name. + +@table @code +@item 0x0001 pin +If set, this object is a pin. This flag is for internal use only. +@item 0x0002 via +Likewise, for vias. +@item 0x0004 found +If set, this object has been found by @code{FindConnection()}. +@item 0x0008 hole +For pins and vias, this flag means that the pin or via is a hole +without a copper annulus. +@item 0x0010 rat +If set for a line, indicates that this line is a rat line instead of a +copper trace. +@item 0x0010 pininpoly +For pins and pads, this flag is used internally to indicate that the +pin or pad overlaps a polygon on some layer. +@item 0x0010 clearpoly +For polygons, this flag means that pins and vias will normally clear +these polygons (thus, thermals are required for electrical +connection). When clear, polygons will solidly connect to pins and +vias. +@item 0x0010 hidename +For elements, when set the name of the element is hidden. +@item 0x0020 showname +For elements, when set the names of pins are shown. +@item 0x0020 clearline +For lines and arcs, the line/arc will clear polygons instead of +connecting to them. +@item 0x0020 fullpoly +For polygons, the full polygon is drawn (i.e. all parts instead of only the biggest one). +@item 0x0040 selected +Set when the object is selected. +@item 0x0080 onsolder +For elements and pads, indicates that they are on the solder side. +@item 0x0080 auto +For lines and vias, indicates that these were created by the +autorouter. +@item 0x0100 square +For pins and pads, indicates a square (vs round) pin/pad. +@item 0x0200 rubberend +For lines, used internally for rubber band moves. +@item 0x0200 warn +For pins, vias, and pads, set to indicate a warning. +@item 0x0400 usetherm +Obsolete, indicates that pins/vias should be drawn with thermal +fingers. +@item 0x0400 +Obsolete, old files used this to indicate lines drawn on silk. +@item 0x0800 octagon +Draw pins and vias as octagons. +@item 0x1000 drc +Set for objects that fail DRC. +@item 0x2000 lock +Set for locked objects. +@item 0x4000 edge2 +For pads, indicates that the second point is closer to the edge. For +pins, indicates that the pin is closer to a horizontal edge and thus +pinout text should be vertical. +@item 0x8000 marker +Marker used internally to avoid revisiting an object. +@item 0x10000 nopaste +For pads, set to prevent a solderpaste stencil opening for the +pad. Primarily used for pads used as fiducials. +@end table +%end-doc */ + +#define NOFLAG 0x0000 +#define PINFLAG 0x0001 /* is a pin */ +#define VIAFLAG 0x0002 /* is a via */ +#define FOUNDFLAG 0x0004 /* used by 'FindConnection()' */ +#define HOLEFLAG 0x0008 /* pin or via is only a hole */ +#define NOPASTEFLAG 0x0008 /* pad should not receive + solderpaste. This is to + support fiducials */ +#define RATFLAG 0x0010 /* indicates line is a rat line */ +#define PININPOLYFLAG 0x0010 /* pin found inside poly - same as */ + /* rat line since not used on lines */ +#define CLEARPOLYFLAG 0x0010 /* pins/vias clear these polygons */ +#define HIDENAMEFLAG 0x0010 /* hide the element name */ +#define DISPLAYNAMEFLAG 0x0020 /* display the names of pins/pads */ + /* of an element */ +#define CLEARLINEFLAG 0x0020 /* line doesn't touch polygons */ +#define FULLPOLYFLAG 0x0020 /* full polygon is drawn (i.e. all parts instead of only the biggest one) */ +#define SELECTEDFLAG 0x0040 /* object has been selected */ +#define ONSOLDERFLAG 0x0080 /* element is on bottom side */ +#define AUTOFLAG 0x0080 /* line/via created by auto-router */ +#define SQUAREFLAG 0x0100 /* pin is square, not round */ +#define RUBBERENDFLAG 0x0200 /* indicates one end already rubber */ + /* banding same as warn flag */ + /* since pins/pads won't use it */ +#define WARNFLAG 0x0200 /* Warning for pin/via/pad */ +#define USETHERMALFLAG 0x0400 /* draw pin, via with thermal fingers */ +#define ONSILKFLAG 0x0400 /* old files use this to indicate silk */ +#define OCTAGONFLAG 0x0800 /* draw pin/via as octagon instead of round */ +#define DRCFLAG 0x1000 /* flag like FOUND flag for DRC checking */ +#define LOCKFLAG 0x2000 /* object locked in place */ +#define EDGE2FLAG 0x4000 /* Padr.Point2 is closer to outside edge */ + /* also pinout text for pins is vertical */ +#define VISITFLAG 0x8000 /* marker to avoid re-visiting an object */ +#define NONETLISTFLAG 0x10000 /* element is not on the netlist and should not interfere with the netlist */ +#define MINCUTFLAG 0x20000 /* used by the mincut short find code */ +#define ONPOINTFLAG 0x40000 /*!< crosshair is on line point or arc point */ + +#define NOCOPY_FLAGS (FOUNDFLAG | CONNECTEDFLAG | ONPOINTFLAG) + +/* --------------------------------------------------------------------------- + * PCB flags + */ + +/* %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 SHOWDRCFLAG 0x00000008 +#define RUBBERBANDFLAG 0x00000010 +#define DESCRIPTIONFLAG 0x00000020 +#define NAMEONPCBFLAG 0x00000040 +#define AUTODRCFLAG 0x00000080 +#define ALLDIRECTIONFLAG 0x00000100 +#define SWAPSTARTDIRFLAG 0x00000200 +#define UNIQUENAMEFLAG 0x00000400 +#define CLEARNEWFLAG 0x00000800 +#define SNAPPINFLAG 0x00001000 +#define SHOWMASKFLAG 0x00002000 +#define THINDRAWFLAG 0x00004000 +#define ORTHOMOVEFLAG 0x00008000 +#define LIVEROUTEFLAG 0x00010000 +#define THINDRAWPOLYFLAG 0x00020000 +#define LOCKNAMESFLAG 0x00040000 +#define ONLYNAMESFLAG 0x00080000 +#define NEWFULLPOLYFLAG 0x00100000 +#define HIDENAMESFLAG 0x00200000 +#define ENABLEMINCUTFLAG 0x00400000 +#define SNAPOFFGRIDLINEFLAG 0x00800000 +#define HIGHLIGHTONPOINTFLAG 0x01000000 +#define ENABLESTROKEFLAG 0x02000000 + +/* --------------------------------------------------------------------------- + * object types + */ +#define NO_TYPE 0x00000 /* no object */ +#define VIA_TYPE 0x00001 +#define ELEMENT_TYPE 0x00002 +#define LINE_TYPE 0x00004 +#define POLYGON_TYPE 0x00008 +#define TEXT_TYPE 0x00010 +#define RATLINE_TYPE 0x00020 + +#define PIN_TYPE 0x00100 /* objects that are part */ +#define PAD_TYPE 0x00200 /* 'pin' of SMD element */ +#define ELEMENTNAME_TYPE 0x00400 /* of others */ +#define POLYGONPOINT_TYPE 0x00800 +#define LINEPOINT_TYPE 0x01000 +#define ELEMENTLINE_TYPE 0x02000 +#define ARC_TYPE 0x04000 +#define ELEMENTARC_TYPE 0x08000 + +#define LOCKED_TYPE 0x10000 /* used to tell search to include locked items. */ +#define NET_TYPE 0x20000 /* used to select whole net. */ + +#define PIN_TYPES (VIA_TYPE | PIN_TYPE) +#define LOCK_TYPES (VIA_TYPE | LINE_TYPE | ARC_TYPE | POLYGON_TYPE | ELEMENT_TYPE \ + | TEXT_TYPE | ELEMENTNAME_TYPE | LOCKED_TYPE) + +#define ALL_TYPES (~0) /* all bits set */ + +#endif Index: 1.0.8/src/copy.c =================================================================== --- 1.0.8/src/copy.c (nonexistent) +++ 1.0.8/src/copy.c (revision 1136) @@ -0,0 +1,385 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* functions used to copy pins, elements ... + * it's necessary to copy data by calling create... since the base pointer + * may change cause of dynamic memory allocation + */ + +#include "config.h" + +#include + +#include "global.h" + +#include "copy.h" +#include "create.h" +#include "data.h" +#include "draw.h" +#include "mymem.h" +#include "mirror.h" +#include "misc.h" +#include "move.h" +#include "polygon.h" +#include "rats.h" +#include "rtree.h" +#include "select.h" +#include "undo.h" + + +RCSID("$Id$"); + +/* --------------------------------------------------------------------------- + * some local prototypes + */ +static void *CopyVia(PinTypePtr); +static void *CopyLine(LayerTypePtr, LineTypePtr); +static void *CopyArc(LayerTypePtr, ArcTypePtr); +static void *CopyText(LayerTypePtr, TextTypePtr); +static void *CopyPolygon(LayerTypePtr, PolygonTypePtr); +static void *CopyElement(ElementTypePtr); + +/* --------------------------------------------------------------------------- + * some local identifiers + */ +static Coord DeltaX, DeltaY; /* movement vector */ +static ObjectFunctionType CopyFunctions = { + CopyLine, + CopyText, + CopyPolygon, + CopyVia, + CopyElement, + NULL, + NULL, + NULL, + NULL, + NULL, + CopyArc, + NULL +}; + +/* --------------------------------------------------------------------------- + * copies data from one polygon to another + * 'Dest' has to exist + */ +PolygonTypePtr CopyPolygonLowLevel(PolygonTypePtr Dest, PolygonTypePtr Src) +{ + Cardinal hole = 0; + Cardinal n; + + for (n = 0; n < Src->PointN; n++) { + if (hole < Src->HoleIndexN && n == Src->HoleIndex[hole]) { + CreateNewHoleInPolygon(Dest); + hole++; + } + CreateNewPointInPolygon(Dest, Src->Points[n].X, Src->Points[n].Y); + } + SetPolygonBoundingBox(Dest); + Dest->Flags = Src->Flags; + CLEAR_FLAG(FOUNDFLAG, Dest); + return (Dest); +} + +/* --------------------------------------------------------------------------- + * copies data from one element to another and creates the destination + * if necessary + */ +ElementTypePtr +CopyElementLowLevel(DataTypePtr Data, ElementTypePtr Dest, ElementTypePtr Src, bool uniqueName, Coord dx, Coord dy) +{ + int i; + /* release old memory if necessary */ + if (Dest) + FreeElementMemory(Dest); + + /* both coordinates and flags are the same */ + Dest = CreateNewElement(Data, Dest, &PCB->Font, + MaskFlags(Src->Flags, FOUNDFLAG), + DESCRIPTION_NAME(Src), NAMEONPCB_NAME(Src), + VALUE_NAME(Src), DESCRIPTION_TEXT(Src).X + dx, + DESCRIPTION_TEXT(Src).Y + dy, + DESCRIPTION_TEXT(Src).Direction, + DESCRIPTION_TEXT(Src).Scale, MaskFlags(DESCRIPTION_TEXT(Src).Flags, FOUNDFLAG), uniqueName); + + /* abort on error */ + if (!Dest) + return (Dest); + + ELEMENTLINE_LOOP(Src); + { + CreateNewLineInElement(Dest, line->Point1.X + dx, + line->Point1.Y + dy, line->Point2.X + dx, line->Point2.Y + dy, line->Thickness); + } + END_LOOP; + PIN_LOOP(Src); + { + CreateNewPin(Dest, pin->X + dx, pin->Y + dy, pin->Thickness, + pin->Clearance, pin->Mask, pin->DrillingHole, pin->Name, pin->Number, MaskFlags(pin->Flags, FOUNDFLAG)); + } + END_LOOP; + PAD_LOOP(Src); + { + CreateNewPad(Dest, pad->Point1.X + dx, pad->Point1.Y + dy, + pad->Point2.X + dx, pad->Point2.Y + dy, pad->Thickness, + pad->Clearance, pad->Mask, pad->Name, pad->Number, MaskFlags(pad->Flags, FOUNDFLAG)); + } + END_LOOP; + ARC_LOOP(Src); + { + CreateNewArcInElement(Dest, arc->X + dx, arc->Y + dy, arc->Width, arc->Height, arc->StartAngle, arc->Delta, arc->Thickness); + } + END_LOOP; + + for (i = 0; i < Src->Attributes.Number; i++) + CreateNewAttribute(&Dest->Attributes, Src->Attributes.List[i].name, Src->Attributes.List[i].value); + + Dest->MarkX = Src->MarkX + dx; + Dest->MarkY = Src->MarkY + dy; + + SetElementBoundingBox(Data, Dest, &PCB->Font); + return (Dest); +} + +/* --------------------------------------------------------------------------- + * copies a via + */ +static void *CopyVia(PinTypePtr Via) +{ + PinTypePtr via; + + via = CreateNewVia(PCB->Data, Via->X + DeltaX, Via->Y + DeltaY, + Via->Thickness, Via->Clearance, Via->Mask, Via->DrillingHole, Via->Name, MaskFlags(Via->Flags, FOUNDFLAG)); + if (!via) + return (via); + DrawVia(via); + AddObjectToCreateUndoList(VIA_TYPE, via, via, via); + return (via); +} + +/* --------------------------------------------------------------------------- + * copies a line + */ +static void *CopyLine(LayerTypePtr Layer, LineTypePtr Line) +{ + LineTypePtr line; + + line = CreateDrawnLineOnLayer(Layer, Line->Point1.X + DeltaX, + Line->Point1.Y + DeltaY, + Line->Point2.X + DeltaX, + Line->Point2.Y + DeltaY, Line->Thickness, Line->Clearance, MaskFlags(Line->Flags, FOUNDFLAG)); + if (!line) + return (line); + if (Line->Number) + line->Number = strdup(Line->Number); + DrawLine(Layer, line); + AddObjectToCreateUndoList(LINE_TYPE, Layer, line, line); + return (line); +} + +/* --------------------------------------------------------------------------- + * copies an arc + */ +static void *CopyArc(LayerTypePtr Layer, ArcTypePtr Arc) +{ + ArcTypePtr arc; + + arc = CreateNewArcOnLayer(Layer, Arc->X + DeltaX, + Arc->Y + DeltaY, Arc->Width, Arc->Height, Arc->StartAngle, + Arc->Delta, Arc->Thickness, Arc->Clearance, MaskFlags(Arc->Flags, FOUNDFLAG)); + if (!arc) + return (arc); + DrawArc(Layer, arc); + AddObjectToCreateUndoList(ARC_TYPE, Layer, arc, arc); + return (arc); +} + +/* --------------------------------------------------------------------------- + * copies a text + */ +static void *CopyText(LayerTypePtr Layer, TextTypePtr Text) +{ + TextTypePtr text; + + text = CreateNewText(Layer, &PCB->Font, Text->X + DeltaX, + Text->Y + DeltaY, Text->Direction, Text->Scale, Text->TextString, MaskFlags(Text->Flags, FOUNDFLAG)); + DrawText(Layer, text); + AddObjectToCreateUndoList(TEXT_TYPE, Layer, text, text); + return (text); +} + +/* --------------------------------------------------------------------------- + * copies a polygon + */ +static void *CopyPolygon(LayerTypePtr Layer, PolygonTypePtr Polygon) +{ + PolygonTypePtr polygon; + + polygon = CreateNewPolygon(Layer, NoFlags()); + CopyPolygonLowLevel(polygon, Polygon); + MovePolygonLowLevel(polygon, DeltaX, DeltaY); + if (!Layer->polygon_tree) + Layer->polygon_tree = r_create_tree(NULL, 0, 0); + r_insert_entry(Layer->polygon_tree, (BoxTypePtr) polygon, 0); + InitClip(PCB->Data, Layer, polygon); + DrawPolygon(Layer, polygon); + AddObjectToCreateUndoList(POLYGON_TYPE, Layer, polygon, polygon); + return (polygon); +} + +/* --------------------------------------------------------------------------- + * copies an element onto the PCB. Then does a draw. + */ +static void *CopyElement(ElementTypePtr Element) +{ + +#ifdef DEBUG + printf("Entered CopyElement, trying to copy element %s\n", Element->Name[1].TextString); +#endif + + ElementTypePtr element = CopyElementLowLevel(PCB->Data, + NULL, Element, + TEST_FLAG(UNIQUENAMEFLAG, + PCB), DeltaX, + DeltaY); + + /* this call clears the polygons */ + AddObjectToCreateUndoList(ELEMENT_TYPE, element, element, element); + if (PCB->ElementOn && (FRONT(element) || PCB->InvisibleObjectsOn)) { + DrawElementName(element); + DrawElementPackage(element); + } + if (PCB->PinOn) { + DrawElementPinsAndPads(element); + } +#ifdef DEBUG + printf(" ... Leaving CopyElement.\n"); +#endif + return (element); +} + +/* --------------------------------------------------------------------------- + * pastes the contents of the buffer to the layout. Only visible objects + * are handled by the routine. + */ +bool CopyPastebufferToLayout(Coord X, Coord Y) +{ + Cardinal i; + bool changed = false; + +#ifdef DEBUG + printf("Entering CopyPastebufferToLayout.....\n"); +#endif + + /* set movement vector */ + DeltaX = X - PASTEBUFFER->X, DeltaY = Y - PASTEBUFFER->Y; + + /* paste all layers */ + for (i = 0; i < max_copper_layer + 2; i++) { + LayerTypePtr sourcelayer = &PASTEBUFFER->Data->Layer[i], destlayer = LAYER_PTR(i); + + if (destlayer->On) { + changed = changed || + (sourcelayer->LineN != 0) || (sourcelayer->ArcN != 0) || (sourcelayer->PolygonN != 0) || (sourcelayer->TextN != 0); + LINE_LOOP(sourcelayer); + { + CopyLine(destlayer, line); + } + END_LOOP; + ARC_LOOP(sourcelayer); + { + CopyArc(destlayer, arc); + } + END_LOOP; + TEXT_LOOP(sourcelayer); + { + CopyText(destlayer, text); + } + END_LOOP; + POLYGON_LOOP(sourcelayer); + { + CopyPolygon(destlayer, polygon); + } + END_LOOP; + } + } + + /* paste elements */ + if (PCB->PinOn && PCB->ElementOn) { + ELEMENT_LOOP(PASTEBUFFER->Data); + { +#ifdef DEBUG + printf("In CopyPastebufferToLayout, pasting element %s\n", element->Name[1].TextString); +#endif + if (FRONT(element) || PCB->InvisibleObjectsOn) { + CopyElement(element); + changed = true; + } + } + END_LOOP; + } + + /* finally the vias */ + if (PCB->ViaOn) { + changed |= (PASTEBUFFER->Data->ViaN != 0); + VIA_LOOP(PASTEBUFFER->Data); + { + CopyVia(via); + } + END_LOOP; + } + + if (changed) { + Draw(); + IncrementUndoSerialNumber(); + } + +#ifdef DEBUG + printf(" .... Leaving CopyPastebufferToLayout.\n"); +#endif + + return (changed); +} + +/* --------------------------------------------------------------------------- + * copies the object identified by its data pointers and the type + * the new objects is moved by DX,DY + * I assume that the appropriate layer ... is switched on + */ +void *CopyObject(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord DX, Coord DY) +{ + void *ptr; + + /* setup movement vector */ + DeltaX = DX; + DeltaY = DY; + + /* the subroutines add the objects to the undo-list */ + ptr = ObjectOperation(&CopyFunctions, Type, Ptr1, Ptr2, Ptr3); + IncrementUndoSerialNumber(); + return (ptr); +} Index: 1.0.8/src/copy.h =================================================================== --- 1.0.8/src/copy.h (nonexistent) +++ 1.0.8/src/copy.h (revision 1136) @@ -0,0 +1,49 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + * RCS: $Id$ + */ + +/* prototypes for copy routines + */ + +#ifndef PCB_COPY_H +#define PCB_COPY_H + +#include "global.h" + +/* --------------------------------------------------------------------------- + * some defines + */ +#define COPY_TYPES \ + (VIA_TYPE | LINE_TYPE | TEXT_TYPE | \ + ELEMENT_TYPE | ELEMENTNAME_TYPE | POLYGON_TYPE | ARC_TYPE) + + +PolygonTypePtr CopyPolygonLowLevel(PolygonTypePtr, PolygonTypePtr); +ElementTypePtr CopyElementLowLevel(DataTypePtr, ElementTypePtr, ElementTypePtr, bool, Coord, Coord); +bool CopyPastebufferToLayout(Coord, Coord); +void *CopyObject(int, void *, void *, void *, Coord, Coord); + +#endif Index: 1.0.8/src/core_lists.h =================================================================== --- 1.0.8/src/core_lists.h (nonexistent) +++ 1.0.8/src/core_lists.h (revision 1136) @@ -0,0 +1,16 @@ +REGISTER_ACTIONS(action_action_list) + REGISTER_ACTIONS(rotate_action_list) + REGISTER_ACTIONS(command_action_list) + REGISTER_FLAGS(djopt_flag_list) + REGISTER_ACTIONS(djopt_action_list) + REGISTER_FLAGS(flags_flag_list) + REGISTER_ACTIONS(fontmode_action_list) + REGISTER_ATTRIBUTES(main_attribute_list) + REGISTER_ACTIONS(misc_action_list) + REGISTER_ACTIONS(move_action_list) + REGISTER_ACTIONS(netlist_action_list) + REGISTER_ACTIONS(puller_action_list) + REGISTER_ACTIONS(report_action_list) + REGISTER_ACTIONS(vendor_action_list) + REGISTER_FLAGS(vendor_flag_list) + REGISTER_ACTIONS(toporouter_action_list) Index: 1.0.8/src/create.c =================================================================== --- 1.0.8/src/create.c (nonexistent) +++ 1.0.8/src/create.c (revision 1136) @@ -0,0 +1,927 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996, 2005 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* functions used to create vias, pins ... + */ + +#include "config.h" + +#include +#include +#include +#include + +#include "global.h" + +#include "create.h" +#include "data.h" +#include "draw.h" +#include "error.h" +#include "mymem.h" +#include "misc.h" +#include "parse_l.h" +#include "pcb-printf.h" +#include "polygon.h" +#include "rtree.h" +#include "search.h" +#include "set.h" +#include "undo.h" +#include "file.h" +#include "stub_vendor.h" + +RCSID("$Id$"); + +/* --------------------------------------------------------------------------- + * some local identifiers + */ +static int ID = 1; /* current object ID; incremented after */ + /* each creation of an object */ + +static bool be_lenient = false; + +/* ---------------------------------------------------------------------- + * some local prototypes + */ +static void AddTextToElement(TextTypePtr, FontTypePtr, Coord, Coord, unsigned, char *, int, FlagType); + +/* --------------------------------------------------------------------------- + * Set the lenience mode. + */ + +void CreateBeLenient(bool v) +{ + be_lenient = v; +} + +/* --------------------------------------------------------------------------- + * creates a new paste buffer + */ +DataTypePtr CreateNewBuffer(void) +{ + DataTypePtr data; + data = (DataTypePtr) calloc(1, sizeof(DataType)); + data->pcb = (PCBTypePtr) PCB; + return data; +} + +/* --------------------------------------------------------------------------- + * Perhaps PCB should internally just use the Settings colors? For now, + * use this to set PCB colors so the config can reassign PCB colors. + */ +void pcb_colors_from_settings(PCBTypePtr ptr) +{ + int i; + + /* copy default settings */ + ptr->ConnectedColor = Settings.ConnectedColor; + ptr->ElementColor = Settings.ElementColor; + ptr->ElementColor_nonetlist = Settings.ElementColor_nonetlist; + ptr->RatColor = Settings.RatColor; + ptr->InvisibleObjectsColor = Settings.InvisibleObjectsColor; + ptr->InvisibleMarkColor = Settings.InvisibleMarkColor; + ptr->ElementSelectedColor = Settings.ElementSelectedColor; + ptr->RatSelectedColor = Settings.RatSelectedColor; + ptr->PinColor = Settings.PinColor; + ptr->PinSelectedColor = Settings.PinSelectedColor; + ptr->PinNameColor = Settings.PinNameColor; + ptr->ViaColor = Settings.ViaColor; + ptr->ViaSelectedColor = Settings.ViaSelectedColor; + ptr->WarnColor = Settings.WarnColor; + ptr->MaskColor = Settings.MaskColor; + for (i = 0; i < MAX_LAYER; i++) { + ptr->Data->Layer[i].Color = Settings.LayerColor[i]; + ptr->Data->Layer[i].SelectedColor = Settings.LayerSelectedColor[i]; + } + ptr->Data->Layer[component_silk_layer].Color = + Settings.ShowSolderSide ? Settings.InvisibleObjectsColor : Settings.ElementColor; + ptr->Data->Layer[component_silk_layer].SelectedColor = Settings.ElementSelectedColor; + ptr->Data->Layer[solder_silk_layer].Color = Settings.ShowSolderSide ? Settings.ElementColor : Settings.InvisibleObjectsColor; + ptr->Data->Layer[solder_silk_layer].SelectedColor = Settings.ElementSelectedColor; +} + +/* --------------------------------------------------------------------------- + * creates a new PCB + */ +PCBTypePtr CreateNewPCB_(bool SetDefaultNames) +{ + PCBTypePtr ptr; + int i; + + /* allocate memory, switch all layers on and copy resources */ + ptr = (PCBTypePtr) calloc(1, sizeof(PCBType)); + ptr->Data = CreateNewBuffer(); + ptr->Data->pcb = (PCBTypePtr) ptr; + + ptr->ThermStyle = 4; + ptr->IsleArea = 2.e8; + ptr->SilkActive = false; + ptr->RatDraw = false; + SET_FLAG(NAMEONPCBFLAG, ptr); + if (Settings.ShowNumber) + SET_FLAG(SHOWNUMBERFLAG, ptr); + if (Settings.AllDirectionLines) + SET_FLAG(ALLDIRECTIONFLAG, ptr); + ptr->Clipping = 1; /* this is the most useful starting point for now */ + if (Settings.RubberBandMode) + SET_FLAG(RUBBERBANDFLAG, ptr); + if (Settings.SwapStartDirection) + SET_FLAG(SWAPSTARTDIRFLAG, ptr); + if (Settings.UniqueNames) + SET_FLAG(UNIQUENAMEFLAG, ptr); + if (Settings.SnapPin) + SET_FLAG(SNAPPINFLAG, ptr); + if (Settings.SnapOffGridLine) + SET_FLAG(SNAPOFFGRIDLINEFLAG, ptr); + if (Settings.HighlightOnPoint) + SET_FLAG(HIGHLIGHTONPOINTFLAG, ptr); + if (Settings.ClearLine) + SET_FLAG(CLEARNEWFLAG, ptr); + if (Settings.FullPoly) + SET_FLAG(NEWFULLPOLYFLAG, ptr); + if (Settings.OrthogonalMoves) + SET_FLAG(ORTHOMOVEFLAG, ptr); + if (Settings.liveRouting) + SET_FLAG(LIVEROUTEFLAG, ptr); + if (Settings.ShowDRC) + SET_FLAG(SHOWDRCFLAG, ptr); + if (Settings.AutoDRC) + SET_FLAG(AUTODRCFLAG, ptr); + ptr->Grid = Settings.Grid; + ptr->LayerGroups = Settings.LayerGroups; + STYLE_LOOP(ptr); + { + *style = Settings.RouteStyle[n]; + style->index = n; + } + END_LOOP; + hid_action("RouteStylesChanged"); + ptr->Zoom = Settings.Zoom; + ptr->MaxWidth = Settings.MaxWidth; + ptr->MaxHeight = Settings.MaxHeight; + ptr->ID = ID++; + ptr->ThermScale = 0.5; + + ptr->Bloat = Settings.Bloat; + ptr->Shrink = Settings.Shrink; + ptr->minWid = Settings.minWid; + ptr->minSlk = Settings.minSlk; + ptr->minDrill = Settings.minDrill; + ptr->minRing = Settings.minRing; + + for (i = 0; i < MAX_LAYER; i++) + ptr->Data->Layer[i].Name = strdup(Settings.DefaultLayerName[i]); + + CreateDefaultFont(ptr); + + return (ptr); +} + +PCBTypePtr CreateNewPCB() +{ + PCBTypePtr old, nw; + + old = PCB; + + PCB = NULL; + if ((LoadPCB(Settings.DefaultPcbFile, false, true) == 0) || (LoadPCB(PCB_DEFAULT_PCB_FILE_SRC, false, true) == 0)) { + nw = PCB; + if (nw->Filename != NULL) { + /* make sure the new PCB doesn't inherit the name of the default pcb */ + free(nw->Filename); + nw->Filename = NULL; + } + } + else + nw = NULL; + + PCB = old; + return nw; +} + + +/* This post-processing step adds the top and bottom silk layers to a + * pre-existing PCB. + */ +int CreateNewPCBPost(PCBTypePtr pcb, int use_defaults) +{ + /* copy default settings */ + pcb_colors_from_settings(pcb); + + return 0; +} + +/* --------------------------------------------------------------------------- + * creates a new via + */ +PinTypePtr +CreateNewVia(DataTypePtr Data, + Coord X, Coord Y, + Coord Thickness, Coord Clearance, Coord Mask, Coord DrillingHole, const char *Name, FlagType Flags) +{ + PinTypePtr Via; + + if (!be_lenient) { + VIA_LOOP(Data); + { + if (Distance(X, Y, via->X, via->Y) <= via->DrillingHole / 2 + DrillingHole / 2) { + Message(_("%m+Dropping via at %$mD because it's hole would overlap with the via " + "at %$mD\n"), Settings.grid_unit->allow, X, Y, via->X, via->Y); + return (NULL); /* don't allow via stacking */ + } + } + END_LOOP; + } + + Via = GetViaMemory(Data); + + if (!Via) + return (Via); + /* copy values */ + Via->X = X; + Via->Y = Y; + Via->Thickness = Thickness; + Via->Clearance = Clearance; + Via->Mask = Mask; + Via->DrillingHole = stub_vendorDrillMap(DrillingHole); + if (Via->DrillingHole != DrillingHole) { + Message(_("%m+Mapped via drill hole to %$mS from %$mS per vendor table\n"), + Settings.grid_unit->allow, Via->DrillingHole, DrillingHole); + } + + Via->Name = STRDUP(Name); + Via->Flags = Flags; + CLEAR_FLAG(WARNFLAG, Via); + SET_FLAG(VIAFLAG, Via); + Via->ID = ID++; + + /* + * don't complain about MIN_PINORVIACOPPER on a mounting hole (pure + * hole) + */ + if (!TEST_FLAG(HOLEFLAG, Via) && (Via->Thickness < Via->DrillingHole + MIN_PINORVIACOPPER)) { + Via->Thickness = Via->DrillingHole + MIN_PINORVIACOPPER; + Message(_("%m+Increased via thickness to %$mS to allow enough copper" + " at %$mD.\n"), Settings.grid_unit->allow, Via->Thickness, Via->X, Via->Y); + } + + SetPinBoundingBox(Via); + if (!Data->via_tree) + Data->via_tree = r_create_tree(NULL, 0, 0); + r_insert_entry(Data->via_tree, (BoxTypePtr) Via, 0); + return (Via); +} + +struct line_info { + Coord X1, X2, Y1, Y2; + Coord Thickness; + FlagType Flags; + LineType test, *ans; + jmp_buf env; +}; + +static int line_callback(const BoxType * b, void *cl) +{ + LineTypePtr line = (LineTypePtr) b; + struct line_info *i = (struct line_info *) cl; + + if (line->Point1.X == i->X1 && line->Point2.X == i->X2 && line->Point1.Y == i->Y1 && line->Point2.Y == i->Y2) { + i->ans = (LineTypePtr) (-1); + longjmp(i->env, 1); + } + /* check the other point order */ + if (line->Point1.X == i->X1 && line->Point2.X == i->X2 && line->Point1.Y == i->Y1 && line->Point2.Y == i->Y2) { + i->ans = (LineTypePtr) (-1); + longjmp(i->env, 1); + } + if (line->Point2.X == i->X1 && line->Point1.X == i->X2 && line->Point2.Y == i->Y1 && line->Point1.Y == i->Y2) { + i->ans = (LineTypePtr) - 1; + longjmp(i->env, 1); + } + /* remove unnecessary line points */ + if (line->Thickness == i->Thickness + /* don't merge lines if the clear flags differ */ + && TEST_FLAG(CLEARLINEFLAG, line) == TEST_FLAG(CLEARLINEFLAG, i)) { + if (line->Point1.X == i->X1 && line->Point1.Y == i->Y1) { + i->test.Point1.X = line->Point2.X; + i->test.Point1.Y = line->Point2.Y; + i->test.Point2.X = i->X2; + i->test.Point2.Y = i->Y2; + if (IsPointOnLine(i->X1, i->Y1, 0.0, &i->test)) { + i->ans = line; + longjmp(i->env, 1); + } + } + else if (line->Point2.X == i->X1 && line->Point2.Y == i->Y1) { + i->test.Point1.X = line->Point1.X; + i->test.Point1.Y = line->Point1.Y; + i->test.Point2.X = i->X2; + i->test.Point2.Y = i->Y2; + if (IsPointOnLine(i->X1, i->Y1, 0.0, &i->test)) { + i->ans = line; + longjmp(i->env, 1); + } + } + else if (line->Point1.X == i->X2 && line->Point1.Y == i->Y2) { + i->test.Point1.X = line->Point2.X; + i->test.Point1.Y = line->Point2.Y; + i->test.Point2.X = i->X1; + i->test.Point2.Y = i->Y1; + if (IsPointOnLine(i->X2, i->Y2, 0.0, &i->test)) { + i->ans = line; + longjmp(i->env, 1); + } + } + else if (line->Point2.X == i->X2 && line->Point2.Y == i->Y2) { + i->test.Point1.X = line->Point1.X; + i->test.Point1.Y = line->Point1.Y; + i->test.Point2.X = i->X1; + i->test.Point2.Y = i->Y1; + if (IsPointOnLine(i->X2, i->Y2, 0.0, &i->test)) { + i->ans = line; + longjmp(i->env, 1); + } + } + } + return 0; +} + + +/* --------------------------------------------------------------------------- + * creates a new line on a layer and checks for overlap and extension + */ +LineTypePtr +CreateDrawnLineOnLayer(LayerTypePtr Layer, + Coord X1, Coord Y1, Coord X2, Coord Y2, Coord Thickness, Coord Clearance, FlagType Flags) +{ + struct line_info info; + BoxType search; + + search.X1 = MIN(X1, X2); + search.X2 = MAX(X1, X2); + search.Y1 = MIN(Y1, Y2); + search.Y2 = MAX(Y1, Y2); + if (search.Y2 == search.Y1) + search.Y2++; + if (search.X2 == search.X1) + search.X2++; + info.X1 = X1; + info.X2 = X2; + info.Y1 = Y1; + info.Y2 = Y2; + info.Thickness = Thickness; + info.Flags = Flags; + info.test.Thickness = 0; + info.test.Flags = NoFlags(); + info.ans = NULL; + /* prevent stacking of duplicate lines + * and remove needless intermediate points + * verify that the layer is on the board first! + */ + if (setjmp(info.env) == 0) { + r_search(Layer->line_tree, &search, NULL, line_callback, &info); + return CreateNewLineOnLayer(Layer, X1, Y1, X2, Y2, Thickness, Clearance, Flags); + } + + if ((void *) info.ans == (void *) (-1)) + return NULL; /* stacked line */ + /* remove unnecessary points */ + if (info.ans) { + /* must do this BEFORE getting new line memory */ + MoveObjectToRemoveUndoList(LINE_TYPE, Layer, info.ans, info.ans); + X1 = info.test.Point1.X; + X2 = info.test.Point2.X; + Y1 = info.test.Point1.Y; + Y2 = info.test.Point2.Y; + } + return CreateNewLineOnLayer(Layer, X1, Y1, X2, Y2, Thickness, Clearance, Flags); +} + +LineTypePtr +CreateNewLineOnLayer(LayerTypePtr Layer, + Coord X1, Coord Y1, Coord X2, Coord Y2, Coord Thickness, Coord Clearance, FlagType Flags) +{ + LineTypePtr Line; + + Line = GetLineMemory(Layer); + if (!Line) + return (Line); + Line->ID = ID++; + Line->Flags = Flags; + CLEAR_FLAG(RATFLAG, Line); + Line->Thickness = Thickness; + Line->Clearance = Clearance; + Line->Point1.X = X1; + Line->Point1.Y = Y1; + Line->Point1.ID = ID++; + Line->Point2.X = X2; + Line->Point2.Y = Y2; + Line->Point2.ID = ID++; + SetLineBoundingBox(Line); + if (!Layer->line_tree) + Layer->line_tree = r_create_tree(NULL, 0, 0); + r_insert_entry(Layer->line_tree, (BoxTypePtr) Line, 0); + return (Line); +} + +/* --------------------------------------------------------------------------- + * creates a new rat-line + */ +RatTypePtr +CreateNewRat(DataTypePtr Data, Coord X1, Coord Y1, + Coord X2, Coord Y2, Cardinal group1, Cardinal group2, Coord Thickness, FlagType Flags) +{ + RatTypePtr Line = GetRatMemory(Data); + + if (!Line) + return (Line); + + Line->ID = ID++; + Line->Flags = Flags; + SET_FLAG(RATFLAG, Line); + Line->Thickness = Thickness; + Line->Point1.X = X1; + Line->Point1.Y = Y1; + Line->Point1.ID = ID++; + Line->Point2.X = X2; + Line->Point2.Y = Y2; + Line->Point2.ID = ID++; + Line->group1 = group1; + Line->group2 = group2; + SetLineBoundingBox((LineTypePtr) Line); + if (!Data->rat_tree) + Data->rat_tree = r_create_tree(NULL, 0, 0); + r_insert_entry(Data->rat_tree, &Line->BoundingBox, 0); + return (Line); +} + +/* --------------------------------------------------------------------------- + * creates a new arc on a layer + */ +ArcTypePtr +CreateNewArcOnLayer(LayerTypePtr Layer, + Coord X1, Coord Y1, + Coord width, Coord height, Angle sa, Angle dir, Coord Thickness, Coord Clearance, FlagType Flags) +{ + ArcTypePtr Arc; + + ARC_LOOP(Layer); + { + if (arc->X == X1 && arc->Y == Y1 && arc->Width == width && + NormalizeAngle(arc->StartAngle) == NormalizeAngle(sa) && arc->Delta == dir) + return (NULL); /* prevent stacked arcs */ + } + END_LOOP; + Arc = GetArcMemory(Layer); + if (!Arc) + return (Arc); + + Arc->ID = ID++; + Arc->Flags = Flags; + Arc->Thickness = Thickness; + Arc->Clearance = Clearance; + Arc->X = X1; + Arc->Y = Y1; + Arc->Width = width; + Arc->Height = height; + Arc->StartAngle = sa; + Arc->Delta = dir; + SetArcBoundingBox(Arc); + if (!Layer->arc_tree) + Layer->arc_tree = r_create_tree(NULL, 0, 0); + r_insert_entry(Layer->arc_tree, (BoxTypePtr) Arc, 0); + return (Arc); +} + + +/* --------------------------------------------------------------------------- + * creates a new polygon from the old formats rectangle data + */ +PolygonTypePtr CreateNewPolygonFromRectangle(LayerTypePtr Layer, Coord X1, Coord Y1, Coord X2, Coord Y2, FlagType Flags) +{ + PolygonTypePtr polygon = CreateNewPolygon(Layer, Flags); + if (!polygon) + return (polygon); + + CreateNewPointInPolygon(polygon, X1, Y1); + CreateNewPointInPolygon(polygon, X2, Y1); + CreateNewPointInPolygon(polygon, X2, Y2); + CreateNewPointInPolygon(polygon, X1, Y2); + SetPolygonBoundingBox(polygon); + if (!Layer->polygon_tree) + Layer->polygon_tree = r_create_tree(NULL, 0, 0); + r_insert_entry(Layer->polygon_tree, (BoxTypePtr) polygon, 0); + return (polygon); +} + +/* --------------------------------------------------------------------------- + * creates a new text on a layer + */ +TextTypePtr +CreateNewText(LayerTypePtr Layer, FontTypePtr PCBFont, + Coord X, Coord Y, unsigned Direction, int Scale, char *TextString, FlagType Flags) +{ + TextType *text; + + if (TextString == NULL) + return NULL; + + text = GetTextMemory(Layer); + if (text == NULL) + return NULL; + + /* copy values, width and height are set by drawing routine + * because at this point we don't know which symbols are available + */ + text->X = X; + text->Y = Y; + text->Direction = Direction; + text->Flags = Flags; + text->Scale = Scale; + text->TextString = strdup(TextString); + + /* calculate size of the bounding box */ + SetTextBoundingBox(PCBFont, text); + text->ID = ID++; + if (!Layer->text_tree) + Layer->text_tree = r_create_tree(NULL, 0, 0); + r_insert_entry(Layer->text_tree, (BoxTypePtr) text, 0); + return (text); +} + +/* --------------------------------------------------------------------------- + * creates a new polygon on a layer + */ +PolygonTypePtr CreateNewPolygon(LayerTypePtr Layer, FlagType Flags) +{ + PolygonTypePtr polygon = GetPolygonMemory(Layer); + + /* copy values */ + polygon->Flags = Flags; + polygon->ID = ID++; + polygon->Clipped = NULL; + polygon->NoHoles = NULL; + polygon->NoHolesValid = 0; + return (polygon); +} + +/* --------------------------------------------------------------------------- + * creates a new point in a polygon + */ +PointTypePtr CreateNewPointInPolygon(PolygonTypePtr Polygon, Coord X, Coord Y) +{ + PointTypePtr point = GetPointMemoryInPolygon(Polygon); + + /* copy values */ + point->X = X; + point->Y = Y; + point->ID = ID++; + return (point); +} + +/* --------------------------------------------------------------------------- + * creates a new hole in a polygon + */ +PolygonType *CreateNewHoleInPolygon(PolygonType * Polygon) +{ + Cardinal *holeindex = GetHoleIndexMemoryInPolygon(Polygon); + *holeindex = Polygon->PointN; + return Polygon; +} + +/* --------------------------------------------------------------------------- + * creates an new element + * memory is allocated if needed + */ +ElementTypePtr +CreateNewElement(DataTypePtr Data, ElementTypePtr Element, + FontTypePtr PCBFont, + FlagType Flags, + char *Description, char *NameOnPCB, char *Value, + Coord TextX, Coord TextY, BYTE Direction, int TextScale, FlagType TextFlags, bool uniqueName) +{ +#ifdef DEBUG + printf("Entered CreateNewElement.....\n"); +#endif + + if (!Element) + Element = GetElementMemory(Data); + + /* copy values and set additional information */ + TextScale = MAX(MIN_TEXTSCALE, TextScale); + AddTextToElement(&DESCRIPTION_TEXT(Element), PCBFont, TextX, TextY, Direction, Description, TextScale, TextFlags); + if (uniqueName) + NameOnPCB = UniqueElementName(Data, NameOnPCB); + AddTextToElement(&NAMEONPCB_TEXT(Element), PCBFont, TextX, TextY, Direction, NameOnPCB, TextScale, TextFlags); + AddTextToElement(&VALUE_TEXT(Element), PCBFont, TextX, TextY, Direction, Value, TextScale, TextFlags); + DESCRIPTION_TEXT(Element).Element = Element; + NAMEONPCB_TEXT(Element).Element = Element; + VALUE_TEXT(Element).Element = Element; + Element->Flags = Flags; + Element->ID = ID++; + +#ifdef DEBUG + printf(" .... Leaving CreateNewElement.\n"); +#endif + + return (Element); +} + +/* --------------------------------------------------------------------------- + * creates a new arc in an element + */ +ArcTypePtr +CreateNewArcInElement(ElementTypePtr Element, + Coord X, Coord Y, Coord Width, Coord Height, Angle angle, Angle delta, Coord Thickness) +{ + ArcType *arc; + + arc = g_slice_new0(ArcType); + Element->Arc = g_list_append(Element->Arc, arc); + Element->ArcN++; + + /* set Delta (0,360], StartAngle in [0,360) */ + if (delta < 0) { + delta = -delta; + angle -= delta; + } + angle = NormalizeAngle(angle); + delta = NormalizeAngle(delta); + if (delta == 0) + delta = 360; + + /* copy values */ + arc->X = X; + arc->Y = Y; + arc->Width = Width; + arc->Height = Height; + arc->StartAngle = angle; + arc->Delta = delta; + arc->Thickness = Thickness; + arc->ID = ID++; + return arc; +} + +/* --------------------------------------------------------------------------- + * creates a new line for an element + */ +LineTypePtr CreateNewLineInElement(ElementTypePtr Element, Coord X1, Coord Y1, Coord X2, Coord Y2, Coord Thickness) +{ + LineType *line; + + if (Thickness == 0) + return NULL; + + line = g_slice_new0(LineType); + Element->Line = g_list_append(Element->Line, line); + Element->LineN++; + + /* copy values */ + line->Point1.X = X1; + line->Point1.Y = Y1; + line->Point2.X = X2; + line->Point2.Y = Y2; + line->Thickness = Thickness; + line->Flags = NoFlags(); + line->ID = ID++; + return line; +} + +/* --------------------------------------------------------------------------- + * creates a new pin in an element + */ +PinTypePtr +CreateNewPin(ElementTypePtr Element, + Coord X, Coord Y, + Coord Thickness, Coord Clearance, Coord Mask, Coord DrillingHole, char *Name, char *Number, FlagType Flags) +{ + PinTypePtr pin = GetPinMemory(Element); + + /* copy values */ + pin->X = X; + pin->Y = Y; + pin->Thickness = Thickness; + pin->Clearance = Clearance; + pin->Mask = Mask; + pin->Name = STRDUP(Name); + pin->Number = STRDUP(Number); + pin->Flags = Flags; + CLEAR_FLAG(WARNFLAG, pin); + SET_FLAG(PINFLAG, pin); + pin->ID = ID++; + pin->Element = Element; + + /* + * If there is no vendor drill map installed, this will simply + * return DrillingHole. + */ + pin->DrillingHole = stub_vendorDrillMap(DrillingHole); + + /* Unless we should not map drills on this element, map them! */ + if (stub_vendorIsElementMappable(Element)) { + if (pin->DrillingHole < MIN_PINORVIASIZE) { + Message(_("%m+Did not map pin #%s (%s) drill hole because %$mS is below the minimum allowed size\n"), + Settings.grid_unit->allow, UNKNOWN(Number), UNKNOWN(Name), pin->DrillingHole); + pin->DrillingHole = DrillingHole; + } + else if (pin->DrillingHole > MAX_PINORVIASIZE) { + Message(_("%m+Did not map pin #%s (%s) drill hole because %$mS is above the maximum allowed size\n"), + Settings.grid_unit->allow, UNKNOWN(Number), UNKNOWN(Name), pin->DrillingHole); + pin->DrillingHole = DrillingHole; + } + else if (!TEST_FLAG(HOLEFLAG, pin) + && (pin->DrillingHole > pin->Thickness - MIN_PINORVIACOPPER)) { + Message(_("%m+Did not map pin #%s (%s) drill hole because %$mS does not leave enough copper\n"), + Settings.grid_unit->allow, UNKNOWN(Number), UNKNOWN(Name), pin->DrillingHole); + pin->DrillingHole = DrillingHole; + } + } + else { + pin->DrillingHole = DrillingHole; + } + + if (pin->DrillingHole != DrillingHole) { + Message(_("%m+Mapped pin drill hole to %$mS from %$mS per vendor table\n"), + Settings.grid_unit->allow, pin->DrillingHole, DrillingHole); + } + + return (pin); +} + +/* --------------------------------------------------------------------------- + * creates a new pad in an element + */ +PadTypePtr +CreateNewPad(ElementTypePtr Element, + Coord X1, Coord Y1, Coord X2, + Coord Y2, Coord Thickness, Coord Clearance, Coord Mask, char *Name, char *Number, FlagType Flags) +{ + PadTypePtr pad = GetPadMemory(Element); + + /* copy values */ + if (X1 > X2 || (X1 == X2 && Y1 > Y2)) { + pad->Point1.X = X2; + pad->Point1.Y = Y2; + pad->Point2.X = X1; + pad->Point2.Y = Y1; + } + else { + pad->Point1.X = X1; + pad->Point1.Y = Y1; + pad->Point2.X = X2; + pad->Point2.Y = Y2; + } + pad->Thickness = Thickness; + pad->Clearance = Clearance; + pad->Mask = Mask; + pad->Name = STRDUP(Name); + pad->Number = STRDUP(Number); + pad->Flags = Flags; + CLEAR_FLAG(WARNFLAG, pad); + pad->ID = ID++; + pad->Element = Element; + return (pad); +} + +/* --------------------------------------------------------------------------- + * creates a new textobject as part of an element + * copies the values to the appropriate text object + */ +static void +AddTextToElement(TextTypePtr Text, FontTypePtr PCBFont, + Coord X, Coord Y, unsigned Direction, char *TextString, int Scale, FlagType Flags) +{ + free(Text->TextString); + Text->TextString = (TextString && *TextString) ? strdup(TextString) : NULL; + Text->X = X; + Text->Y = Y; + Text->Direction = Direction; + Text->Flags = Flags; + Text->Scale = Scale; + + /* calculate size of the bounding box */ + SetTextBoundingBox(PCBFont, Text); + Text->ID = ID++; +} + +/* --------------------------------------------------------------------------- + * creates a new line in a symbol + */ +LineTypePtr CreateNewLineInSymbol(SymbolTypePtr Symbol, Coord X1, Coord Y1, Coord X2, Coord Y2, Coord Thickness) +{ + LineTypePtr line = Symbol->Line; + + /* realloc new memory if necessary and clear it */ + if (Symbol->LineN >= Symbol->LineMax) { + Symbol->LineMax += STEP_SYMBOLLINE; + line = (LineTypePtr) realloc(line, Symbol->LineMax * sizeof(LineType)); + Symbol->Line = line; + memset(line + Symbol->LineN, 0, STEP_SYMBOLLINE * sizeof(LineType)); + } + + /* copy values */ + line = line + Symbol->LineN++; + line->Point1.X = X1; + line->Point1.Y = Y1; + line->Point2.X = X2; + line->Point2.Y = Y2; + line->Thickness = Thickness; + return (line); +} + +/* --------------------------------------------------------------------------- + * parses a file with font information and installs it into the provided PCB + * checks directories given as colon separated list by resource fontPath + * if the fonts filename doesn't contain a directory component + */ +void CreateDefaultFont(PCBTypePtr pcb) +{ + if (ParseFont(&pcb->Font, Settings.FontFile)) + Message(_("Can't find font-symbol-file '%s'\n"), Settings.FontFile); +} + +/* --------------------------------------------------------------------------- + * adds a new line to the rubberband list of 'Crosshair.AttachedObject' + * if Layer == 0 it is a rat line + */ +RubberbandTypePtr CreateNewRubberbandEntry(LayerTypePtr Layer, LineTypePtr Line, PointTypePtr MovedPoint) +{ + RubberbandTypePtr ptr = GetRubberbandMemory(); + + /* we toggle the RUBBERENDFLAG of the line to determine if */ + /* both points are being moved. */ + TOGGLE_FLAG(RUBBERENDFLAG, Line); + ptr->Layer = Layer; + ptr->Line = Line; + ptr->MovedPoint = MovedPoint; + return (ptr); +} + +/* --------------------------------------------------------------------------- + * Add a new net to the netlist menu + */ +LibraryMenuTypePtr CreateNewNet(LibraryTypePtr lib, char *name, char *style) +{ + LibraryMenuTypePtr menu; + char temp[64]; + + sprintf(temp, " %s", name); + menu = GetLibraryMenuMemory(lib, NULL); + menu->Name = strdup(temp); + menu->flag = 1; /* net is enabled by default */ + if (style == NULL || NSTRCMP("(unknown)", style) == 0) + menu->Style = NULL; + else + menu->Style = strdup(style); + return (menu); +} + +/* --------------------------------------------------------------------------- + * Add a connection to the net + */ +LibraryEntryTypePtr CreateNewConnection(LibraryMenuTypePtr net, char *conn) +{ + LibraryEntryTypePtr entry = GetLibraryEntryMemory(net); + + entry->ListEntry = STRDUP(conn); + return (entry); +} + +/* --------------------------------------------------------------------------- + * Add an attribute to a list. + */ +AttributeTypePtr CreateNewAttribute(AttributeListTypePtr list, char *name, char *value) +{ + if (list->Number >= list->Max) { + list->Max += 10; + list->List = (AttributeType *) realloc(list->List, list->Max * sizeof(AttributeType)); + } + list->List[list->Number].name = STRDUP(name); + list->List[list->Number].value = STRDUP(value); + list->Number++; + return &list->List[list->Number - 1]; +} Index: 1.0.8/src/create.h =================================================================== --- 1.0.8/src/create.h (nonexistent) +++ 1.0.8/src/create.h (revision 1136) @@ -0,0 +1,72 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + * RCS: $Id$ + */ + +/* prototypes for create routines + */ + +#ifndef PCB_CREATE_H +#define PCB_CREATE_H + +#include "global.h" + +/* TRUE during file loads, for example to allow overlapping vias. + FALSE otherwise, to stop the user from doing normally dangerous + things. */ +void CreateBeLenient(bool); + +DataTypePtr CreateNewBuffer(void); +void pcb_colors_from_settings(PCBTypePtr); +PCBTypePtr CreateNewPCB_(bool); +PCBTypePtr CreateNewPCB(); +/* Called after PCB->Data->LayerN is set. Returns zero if no errors, + else nonzero. */ +int CreateNewPCBPost(PCBTypePtr, int /* set defaults */ ); +PinTypePtr CreateNewVia(DataTypePtr, Coord, Coord, Coord, Coord, Coord, Coord, const char *, FlagType); +LineTypePtr CreateDrawnLineOnLayer(LayerTypePtr, Coord, Coord, Coord, Coord, Coord, Coord, FlagType); +LineTypePtr CreateNewLineOnLayer(LayerTypePtr, Coord, Coord, Coord, Coord, Coord, Coord, FlagType); +RatTypePtr CreateNewRat(DataTypePtr, Coord, Coord, Coord, Coord, Cardinal, Cardinal, Coord, FlagType); +ArcTypePtr CreateNewArcOnLayer(LayerTypePtr, Coord, Coord, Coord, Coord, Angle, Angle, Coord, Coord, FlagType); +PolygonTypePtr CreateNewPolygonFromRectangle(LayerTypePtr, Coord, Coord, Coord, Coord, FlagType); +TextTypePtr CreateNewText(LayerTypePtr, FontTypePtr, Coord, Coord, unsigned, int, char *, FlagType); +PolygonTypePtr CreateNewPolygon(LayerTypePtr, FlagType); +PointTypePtr CreateNewPointInPolygon(PolygonTypePtr, Coord, Coord); +PolygonType *CreateNewHoleInPolygon(PolygonType * polygon); +ElementTypePtr CreateNewElement(DataTypePtr, ElementTypePtr, + FontTypePtr, FlagType, char *, char *, char *, Coord, Coord, BYTE, int, FlagType, bool); +LineTypePtr CreateNewLineInElement(ElementTypePtr, Coord, Coord, Coord, Coord, Coord); +ArcTypePtr CreateNewArcInElement(ElementTypePtr, Coord, Coord, Coord, Coord, Angle, Angle, Coord); +PinTypePtr CreateNewPin(ElementTypePtr, Coord, Coord, Coord, Coord, Coord, Coord, char *, char *, FlagType); +PadTypePtr CreateNewPad(ElementTypePtr, Coord, Coord, Coord, Coord, Coord, Coord, Coord, char *, char *, FlagType); +LineTypePtr CreateNewLineInSymbol(SymbolTypePtr, Coord, Coord, Coord, Coord, Coord); +void CreateDefaultFont(PCBTypePtr); +RubberbandTypePtr CreateNewRubberbandEntry(LayerTypePtr, LineTypePtr, PointTypePtr); +LibraryMenuTypePtr CreateNewNet(LibraryTypePtr, char *, char *); +LibraryEntryTypePtr CreateNewConnection(LibraryMenuTypePtr, char *); + +AttributeTypePtr CreateNewAttribute(AttributeListTypePtr list, char *name, char *value); + +#endif Index: 1.0.8/src/crosshair.c =================================================================== --- 1.0.8/src/crosshair.c (nonexistent) +++ 1.0.8/src/crosshair.c (revision 1136) @@ -0,0 +1,1177 @@ +/* $Id$ */ +/* 15 Oct 2008 Ineiev: add different crosshair shapes */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact addresses for paper mail and Email: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + + +/* crosshair stuff + */ + +#include "config.h" + +#include +#include +#include + +#include "global.h" + +#include "box.h" +#include "crosshair.h" +#include "data.h" +#include "draw.h" +#include "error.h" +#include "line.h" +#include "misc.h" +#include "mymem.h" +#include "rtree.h" +#include "search.h" +#include "polygon.h" + + +RCSID("$Id$"); + +typedef struct { + int x, y; +} point; + +/* --------------------------------------------------------------------------- + * some local prototypes + */ +static void XORPolygon(PolygonTypePtr, Coord, Coord); +static void XORDrawElement(ElementTypePtr, Coord, Coord); +static void XORDrawBuffer(BufferTypePtr); +static void XORDrawInsertPointObject(void); +static void XORDrawMoveOrCopyObject(void); +static void XORDrawAttachedLine(Coord, Coord, Coord, Coord, Coord); +static void XORDrawAttachedArc(Coord); + +static void thindraw_moved_pv(PinType * pv, Coord x, Coord y) +{ + /* Make a copy of the pin structure, moved to the correct position */ + PinType moved_pv = *pv; + moved_pv.X += x; + moved_pv.Y += y; + + gui->thindraw_pcb_pv(Crosshair.GC, Crosshair.GC, &moved_pv, true, false); +} + +/* --------------------------------------------------------------------------- + * creates a tmp polygon with coordinates converted to screen system + */ +static void XORPolygon(PolygonTypePtr polygon, Coord dx, Coord dy) +{ + Cardinal i; + for (i = 0; i < polygon->PointN; i++) { + Cardinal next = next_contour_point(polygon, i); + gui->draw_line(Crosshair.GC, + polygon->Points[i].X + dx, + polygon->Points[i].Y + dy, polygon->Points[next].X + dx, polygon->Points[next].Y + dy); + } +} + +/*----------------------------------------------------------- + * Draws the outline of an arc + */ +static void XORDrawAttachedArc(Coord thick) +{ + ArcType arc; + BoxTypePtr bx; + Coord wx, wy; + Angle sa, dir; + Coord wid = thick / 2; + + wx = Crosshair.X - Crosshair.AttachedBox.Point1.X; + wy = Crosshair.Y - Crosshair.AttachedBox.Point1.Y; + if (wx == 0 && wy == 0) + return; + arc.X = Crosshair.AttachedBox.Point1.X; + arc.Y = Crosshair.AttachedBox.Point1.Y; + if (XOR(Crosshair.AttachedBox.otherway, abs(wy) > abs(wx))) { + arc.X = Crosshair.AttachedBox.Point1.X + abs(wy) * SGNZ(wx); + sa = (wx >= 0) ? 0 : 180; +#ifdef ARC45 + if (abs(wy) >= 2 * abs(wx)) + dir = (SGNZ(wx) == SGNZ(wy)) ? 45 : -45; + else +#endif + dir = (SGNZ(wx) == SGNZ(wy)) ? 90 : -90; + } + else { + arc.Y = Crosshair.AttachedBox.Point1.Y + abs(wx) * SGNZ(wy); + sa = (wy >= 0) ? -90 : 90; +#ifdef ARC45 + if (abs(wx) >= 2 * abs(wy)) + dir = (SGNZ(wx) == SGNZ(wy)) ? -45 : 45; + else +#endif + dir = (SGNZ(wx) == SGNZ(wy)) ? -90 : 90; + wy = wx; + } + wy = abs(wy); + arc.StartAngle = sa; + arc.Delta = dir; + arc.Width = arc.Height = wy; + bx = GetArcEnds(&arc); + /* sa = sa - 180; */ + gui->draw_arc(Crosshair.GC, arc.X, arc.Y, wy + wid, wy + wid, sa, dir); + if (wid > pixel_slop) { + gui->draw_arc(Crosshair.GC, arc.X, arc.Y, wy - wid, wy - wid, sa, dir); + gui->draw_arc(Crosshair.GC, bx->X1, bx->Y1, wid, wid, sa, -180 * SGN(dir)); + gui->draw_arc(Crosshair.GC, bx->X2, bx->Y2, wid, wid, sa + dir, 180 * SGN(dir)); + } +} + +/*----------------------------------------------------------- + * Draws the outline of a line + */ +static void XORDrawAttachedLine(Coord x1, Coord y1, Coord x2, Coord y2, Coord thick) +{ + Coord dx, dy, ox, oy; + double h; + + dx = x2 - x1; + dy = y2 - y1; + if (dx != 0 || dy != 0) + h = 0.5 * thick / sqrt(SQUARE(dx) + SQUARE(dy)); + else + h = 0.0; + ox = dy * h + 0.5 * SGN(dy); + oy = -(dx * h + 0.5 * SGN(dx)); + gui->draw_line(Crosshair.GC, x1 + ox, y1 + oy, x2 + ox, y2 + oy); + if (abs(ox) >= pixel_slop || abs(oy) >= pixel_slop) { + Angle angle = atan2(dx, dy) * 57.295779; + gui->draw_line(Crosshair.GC, x1 - ox, y1 - oy, x2 - ox, y2 - oy); + gui->draw_arc(Crosshair.GC, x1, y1, thick / 2, thick / 2, angle - 180, 180); + gui->draw_arc(Crosshair.GC, x2, y2, thick / 2, thick / 2, angle, 180); + } +} + +/* --------------------------------------------------------------------------- + * draws the elements of a loaded circuit which is to be merged in + */ +static void XORDrawElement(ElementTypePtr Element, Coord DX, Coord DY) +{ + /* if no silkscreen, draw the bounding box */ + if (Element->ArcN == 0 && Element->LineN == 0) { + gui->draw_line(Crosshair.GC, + DX + Element->BoundingBox.X1, + DY + Element->BoundingBox.Y1, DX + Element->BoundingBox.X1, DY + Element->BoundingBox.Y2); + gui->draw_line(Crosshair.GC, + DX + Element->BoundingBox.X1, + DY + Element->BoundingBox.Y2, DX + Element->BoundingBox.X2, DY + Element->BoundingBox.Y2); + gui->draw_line(Crosshair.GC, + DX + Element->BoundingBox.X2, + DY + Element->BoundingBox.Y2, DX + Element->BoundingBox.X2, DY + Element->BoundingBox.Y1); + gui->draw_line(Crosshair.GC, + DX + Element->BoundingBox.X2, + DY + Element->BoundingBox.Y1, DX + Element->BoundingBox.X1, DY + Element->BoundingBox.Y1); + } + else { + ELEMENTLINE_LOOP(Element); + { + gui->draw_line(Crosshair.GC, DX + line->Point1.X, DY + line->Point1.Y, DX + line->Point2.X, DY + line->Point2.Y); + } + END_LOOP; + + /* arc coordinates and angles have to be converted to X11 notation */ + ARC_LOOP(Element); + { + gui->draw_arc(Crosshair.GC, DX + arc->X, DY + arc->Y, arc->Width, arc->Height, arc->StartAngle, arc->Delta); + } + END_LOOP; + } + /* pin coordinates and angles have to be converted to X11 notation */ + PIN_LOOP(Element); + { + thindraw_moved_pv(pin, DX, DY); + } + END_LOOP; + + /* pads */ + PAD_LOOP(Element); + { + if (PCB->InvisibleObjectsOn || (TEST_FLAG(ONSOLDERFLAG, pad) != 0) == Settings.ShowSolderSide) { + /* Make a copy of the pad structure, moved to the correct position */ + PadType moved_pad = *pad; + moved_pad.Point1.X += DX; + moved_pad.Point1.Y += DY; + moved_pad.Point2.X += DX; + moved_pad.Point2.Y += DY; + + gui->thindraw_pcb_pad(Crosshair.GC, &moved_pad, false, false); + } + } + END_LOOP; + /* mark */ + gui->draw_line(Crosshair.GC, + Element->MarkX + DX - EMARK_SIZE, Element->MarkY + DY, Element->MarkX + DX, Element->MarkY + DY - EMARK_SIZE); + gui->draw_line(Crosshair.GC, + Element->MarkX + DX + EMARK_SIZE, Element->MarkY + DY, Element->MarkX + DX, Element->MarkY + DY - EMARK_SIZE); + gui->draw_line(Crosshair.GC, + Element->MarkX + DX - EMARK_SIZE, Element->MarkY + DY, Element->MarkX + DX, Element->MarkY + DY + EMARK_SIZE); + gui->draw_line(Crosshair.GC, + Element->MarkX + DX + EMARK_SIZE, Element->MarkY + DY, Element->MarkX + DX, Element->MarkY + DY + EMARK_SIZE); +} + +/* --------------------------------------------------------------------------- + * draws all visible and attached objects of the pastebuffer + */ +static void XORDrawBuffer(BufferTypePtr Buffer) +{ + Cardinal i; + Coord x, y; + + /* set offset */ + x = Crosshair.X - Buffer->X; + y = Crosshair.Y - Buffer->Y; + + /* draw all visible layers */ + for (i = 0; i < max_copper_layer + 2; i++) + if (PCB->Data->Layer[i].On) { + LayerTypePtr layer = &Buffer->Data->Layer[i]; + + LINE_LOOP(layer); + { +/* + XORDrawAttachedLine(x +line->Point1.X, + y +line->Point1.Y, x +line->Point2.X, + y +line->Point2.Y, line->Thickness); +*/ + gui->draw_line(Crosshair.GC, x + line->Point1.X, y + line->Point1.Y, x + line->Point2.X, y + line->Point2.Y); + } + END_LOOP; + ARC_LOOP(layer); + { + gui->draw_arc(Crosshair.GC, x + arc->X, y + arc->Y, arc->Width, arc->Height, arc->StartAngle, arc->Delta); + } + END_LOOP; + TEXT_LOOP(layer); + { + BoxTypePtr box = &text->BoundingBox; + gui->draw_rect(Crosshair.GC, x + box->X1, y + box->Y1, x + box->X2, y + box->Y2); + } + END_LOOP; + /* the tmp polygon has n+1 points because the first + * and the last one are set to the same coordinates + */ + POLYGON_LOOP(layer); + { + XORPolygon(polygon, x, y); + } + END_LOOP; + } + + /* draw elements if visible */ + if (PCB->PinOn && PCB->ElementOn) + ELEMENT_LOOP(Buffer->Data); + { + if (FRONT(element) || PCB->InvisibleObjectsOn) + XORDrawElement(element, x, y); + } + END_LOOP; + + /* and the vias */ + if (PCB->ViaOn) + VIA_LOOP(Buffer->Data); + { + thindraw_moved_pv(via, x, y); + } + END_LOOP; +} + +/* --------------------------------------------------------------------------- + * draws the rubberband to insert points into polygons/lines/... + */ +static void XORDrawInsertPointObject(void) +{ + LineTypePtr line = (LineTypePtr) Crosshair.AttachedObject.Ptr2; + PointTypePtr point = (PointTypePtr) Crosshair.AttachedObject.Ptr3; + + if (Crosshair.AttachedObject.Type != NO_TYPE) { + gui->draw_line(Crosshair.GC, point->X, point->Y, line->Point1.X, line->Point1.Y); + gui->draw_line(Crosshair.GC, point->X, point->Y, line->Point2.X, line->Point2.Y); + } +} + +/* --------------------------------------------------------------------------- + * draws the attached object while in MOVE_MODE or COPY_MODE + */ +static void XORDrawMoveOrCopyObject(void) +{ + RubberbandTypePtr ptr; + Cardinal i; + Coord dx = Crosshair.X - Crosshair.AttachedObject.X, dy = Crosshair.Y - Crosshair.AttachedObject.Y; + + switch (Crosshair.AttachedObject.Type) { + case VIA_TYPE: + { + PinTypePtr via = (PinTypePtr) Crosshair.AttachedObject.Ptr1; + thindraw_moved_pv(via, dx, dy); + break; + } + + case LINE_TYPE: + { + LineTypePtr line = (LineTypePtr) Crosshair.AttachedObject.Ptr2; + + XORDrawAttachedLine(line->Point1.X + dx, line->Point1.Y + dy, line->Point2.X + dx, line->Point2.Y + dy, line->Thickness); + break; + } + + case ARC_TYPE: + { + ArcTypePtr Arc = (ArcTypePtr) Crosshair.AttachedObject.Ptr2; + + gui->draw_arc(Crosshair.GC, Arc->X + dx, Arc->Y + dy, Arc->Width, Arc->Height, Arc->StartAngle, Arc->Delta); + break; + } + + case POLYGON_TYPE: + { + PolygonTypePtr polygon = (PolygonTypePtr) Crosshair.AttachedObject.Ptr2; + + /* the tmp polygon has n+1 points because the first + * and the last one are set to the same coordinates + */ + XORPolygon(polygon, dx, dy); + break; + } + + case LINEPOINT_TYPE: + { + LineTypePtr line; + PointTypePtr point; + + line = (LineTypePtr) Crosshair.AttachedObject.Ptr2; + point = (PointTypePtr) Crosshair.AttachedObject.Ptr3; + if (point == &line->Point1) + XORDrawAttachedLine(point->X + dx, point->Y + dy, line->Point2.X, line->Point2.Y, line->Thickness); + else + XORDrawAttachedLine(point->X + dx, point->Y + dy, line->Point1.X, line->Point1.Y, line->Thickness); + break; + } + + case POLYGONPOINT_TYPE: + { + PolygonTypePtr polygon; + PointTypePtr point; + Cardinal point_idx, prev, next; + + polygon = (PolygonTypePtr) Crosshair.AttachedObject.Ptr2; + point = (PointTypePtr) Crosshair.AttachedObject.Ptr3; + point_idx = polygon_point_idx(polygon, point); + + /* get previous and following point */ + prev = prev_contour_point(polygon, point_idx); + next = next_contour_point(polygon, point_idx); + + /* draw the two segments */ + gui->draw_line(Crosshair.GC, polygon->Points[prev].X, polygon->Points[prev].Y, point->X + dx, point->Y + dy); + gui->draw_line(Crosshair.GC, point->X + dx, point->Y + dy, polygon->Points[next].X, polygon->Points[next].Y); + break; + } + + case ELEMENTNAME_TYPE: + { + /* locate the element "mark" and draw an association line from crosshair to it */ + ElementTypePtr element = (ElementTypePtr) Crosshair.AttachedObject.Ptr1; + + gui->draw_line(Crosshair.GC, element->MarkX, element->MarkY, Crosshair.X, Crosshair.Y); + /* fall through to move the text as a box outline */ + } + case TEXT_TYPE: + { + TextTypePtr text = (TextTypePtr) Crosshair.AttachedObject.Ptr2; + BoxTypePtr box = &text->BoundingBox; + gui->draw_rect(Crosshair.GC, box->X1 + dx, box->Y1 + dy, box->X2 + dx, box->Y2 + dy); + break; + } + + /* pin/pad movements result in moving an element */ + case PAD_TYPE: + case PIN_TYPE: + case ELEMENT_TYPE: + XORDrawElement((ElementTypePtr) Crosshair.AttachedObject.Ptr2, dx, dy); + break; + } + + /* draw the attached rubberband lines too */ + i = Crosshair.AttachedObject.RubberbandN; + ptr = Crosshair.AttachedObject.Rubberband; + while (i) { + PointTypePtr point1, point2; + + if (TEST_FLAG(VIAFLAG, ptr->Line)) { + /* this is a rat going to a polygon. do not draw for rubberband */ ; + } + else if (TEST_FLAG(RUBBERENDFLAG, ptr->Line)) { + /* 'point1' is always the fix-point */ + if (ptr->MovedPoint == &ptr->Line->Point1) { + point1 = &ptr->Line->Point2; + point2 = &ptr->Line->Point1; + } + else { + point1 = &ptr->Line->Point1; + point2 = &ptr->Line->Point2; + } + XORDrawAttachedLine(point1->X, point1->Y, point2->X + dx, point2->Y + dy, ptr->Line->Thickness); + } + else if (ptr->MovedPoint == &ptr->Line->Point1) + XORDrawAttachedLine(ptr->Line->Point1.X + dx, + ptr->Line->Point1.Y + dy, ptr->Line->Point2.X + dx, ptr->Line->Point2.Y + dy, ptr->Line->Thickness); + + ptr++; + i--; + } +} + +/* --------------------------------------------------------------------------- + * draws additional stuff that follows the crosshair + */ +void DrawAttached(void) +{ + switch (Settings.Mode) { + case VIA_MODE: + { + /* Make a dummy via structure to draw from */ + PinType via; + via.X = Crosshair.X; + via.Y = Crosshair.Y; + via.Thickness = Settings.ViaThickness; + via.Clearance = 2 * Settings.Keepaway; + via.DrillingHole = Settings.ViaDrillingHole; + via.Mask = 0; + via.Flags = NoFlags(); + + gui->thindraw_pcb_pv(Crosshair.GC, Crosshair.GC, &via, true, false); + + if (TEST_FLAG(SHOWDRCFLAG, PCB)) { + /* XXX: Naughty cheat - use the mask to draw DRC clearance! */ + via.Mask = Settings.ViaThickness + PCB->Bloat * 2; + gui->set_color(Crosshair.GC, Settings.CrossColor); + gui->thindraw_pcb_pv(Crosshair.GC, Crosshair.GC, &via, false, true); + gui->set_color(Crosshair.GC, Settings.CrosshairColor); + } + break; + } + + /* the attached line is used by both LINEMODE, POLYGON_MODE and POLYGONHOLE_MODE */ + case POLYGON_MODE: + case POLYGONHOLE_MODE: + /* draw only if starting point is set */ + if (Crosshair.AttachedLine.State != STATE_FIRST) + gui->draw_line(Crosshair.GC, + Crosshair.AttachedLine.Point1.X, + Crosshair.AttachedLine.Point1.Y, Crosshair.AttachedLine.Point2.X, Crosshair.AttachedLine.Point2.Y); + + /* draw attached polygon only if in POLYGON_MODE or POLYGONHOLE_MODE */ + if (Crosshair.AttachedPolygon.PointN > 1) { + XORPolygon(&Crosshair.AttachedPolygon, 0, 0); + } + break; + + case ARC_MODE: + if (Crosshair.AttachedBox.State != STATE_FIRST) { + XORDrawAttachedArc(Settings.LineThickness); + if (TEST_FLAG(SHOWDRCFLAG, PCB)) { + gui->set_color(Crosshair.GC, Settings.CrossColor); + XORDrawAttachedArc(Settings.LineThickness + 2 * (PCB->Bloat + 1)); + gui->set_color(Crosshair.GC, Settings.CrosshairColor); + } + + } + break; + + case LINE_MODE: + /* draw only if starting point exists and the line has length */ + if (Crosshair.AttachedLine.State != STATE_FIRST && Crosshair.AttachedLine.draw) { + XORDrawAttachedLine(Crosshair.AttachedLine.Point1.X, + Crosshair.AttachedLine.Point1.Y, + Crosshair.AttachedLine.Point2.X, + Crosshair.AttachedLine.Point2.Y, PCB->RatDraw ? 10 : Settings.LineThickness); + /* draw two lines ? */ + if (PCB->Clipping) + XORDrawAttachedLine(Crosshair.AttachedLine.Point2.X, + Crosshair.AttachedLine.Point2.Y, + Crosshair.X, Crosshair.Y, PCB->RatDraw ? 10 : Settings.LineThickness); + if (TEST_FLAG(SHOWDRCFLAG, PCB)) { + gui->set_color(Crosshair.GC, Settings.CrossColor); + XORDrawAttachedLine(Crosshair.AttachedLine.Point1.X, + Crosshair.AttachedLine.Point1.Y, + Crosshair.AttachedLine.Point2.X, + Crosshair.AttachedLine.Point2.Y, PCB->RatDraw ? 10 : Settings.LineThickness + 2 * (PCB->Bloat + 1)); + if (PCB->Clipping) + XORDrawAttachedLine(Crosshair.AttachedLine.Point2.X, + Crosshair.AttachedLine.Point2.Y, + Crosshair.X, Crosshair.Y, PCB->RatDraw ? 10 : Settings.LineThickness + 2 * (PCB->Bloat + 1)); + gui->set_color(Crosshair.GC, Settings.CrosshairColor); + } + } + break; + + case PASTEBUFFER_MODE: + XORDrawBuffer(PASTEBUFFER); + break; + + case COPY_MODE: + case MOVE_MODE: + XORDrawMoveOrCopyObject(); + break; + + case INSERTPOINT_MODE: + XORDrawInsertPointObject(); + break; + } + + /* an attached box does not depend on a special mode */ + if (Crosshair.AttachedBox.State == STATE_SECOND || Crosshair.AttachedBox.State == STATE_THIRD) { + Coord x1, y1, x2, y2; + + x1 = Crosshair.AttachedBox.Point1.X; + y1 = Crosshair.AttachedBox.Point1.Y; + x2 = Crosshair.AttachedBox.Point2.X; + y2 = Crosshair.AttachedBox.Point2.Y; + gui->draw_rect(Crosshair.GC, x1, y1, x2, y2); + } +} + + +/* -------------------------------------------------------------------------- + * draw the marker position + */ +void DrawMark(void) +{ + /* Mark is not drawn when it is not set */ + if (!Marked.status) + return; + + gui->draw_line(Crosshair.GC, Marked.X - MARK_SIZE, Marked.Y - MARK_SIZE, Marked.X + MARK_SIZE, Marked.Y + MARK_SIZE); + gui->draw_line(Crosshair.GC, Marked.X + MARK_SIZE, Marked.Y - MARK_SIZE, Marked.X - MARK_SIZE, Marked.Y + MARK_SIZE); +} + +/* --------------------------------------------------------------------------- + * Returns the nearest grid-point to the given Coord + */ +Coord GridFit(Coord x, Coord grid_spacing, Coord grid_offset) +{ + x -= grid_offset; + x = grid_spacing * round((double) x / grid_spacing); + x += grid_offset; + return x; +} + + +/* --------------------------------------------------------------------------- + * notify the GUI that data relating to the crosshair is being changed. + * + * The argument passed is false to notify "changes are about to happen", + * and true to notify "changes have finished". + * + * Each call with a 'false' parameter must be matched with a following one + * with a 'true' parameter. Unmatched 'true' calls are currently not permitted, + * but might be allowed in the future. + * + * GUIs should not complain if they receive extra calls with 'true' as parameter. + * They should initiate a redraw of the crosshair attached objects - which may + * (if necessary) mean repainting the whole screen if the GUI hasn't tracked the + * location of existing attached drawing. + */ +void notify_crosshair_change(bool changes_complete) +{ + if (gui->notify_crosshair_change) + gui->notify_crosshair_change(changes_complete); +} + + +/* --------------------------------------------------------------------------- + * notify the GUI that data relating to the mark is being changed. + * + * The argument passed is false to notify "changes are about to happen", + * and true to notify "changes have finished". + * + * Each call with a 'false' parameter must be matched with a following one + * with a 'true' parameter. Unmatched 'true' calls are currently not permitted, + * but might be allowed in the future. + * + * GUIs should not complain if they receive extra calls with 'true' as parameter. + * They should initiate a redraw of the mark - which may (if necessary) mean + * repainting the whole screen if the GUI hasn't tracked the mark's location. + */ +void notify_mark_change(bool changes_complete) +{ + if (gui->notify_mark_change) + gui->notify_mark_change(changes_complete); +} + + +/* --------------------------------------------------------------------------- + * Convenience for plugins using the old {Hide,Restore}Crosshair API. + * This links up to notify the GUI of the expected changes using the new APIs. + * + * Use of this old API is deprecated, as the names don't necessarily reflect + * what all GUIs may do in response to the notifications. Keeping these APIs + * is aimed at easing transition to the newer API, they will emit a harmless + * warning at the time of their first use. + * + */ +void HideCrosshair(void) +{ + static bool warned_old_api = false; + if (!warned_old_api) { + Message(_("WARNING: A plugin is using the deprecated API HideCrosshair().\n" + " This API may be removed in a future release of PCB.\n")); + warned_old_api = true; + } + + notify_crosshair_change(false); + notify_mark_change(false); +} + +void RestoreCrosshair(void) +{ + static bool warned_old_api = false; + if (!warned_old_api) { + Message(_("WARNING: A plugin is using the deprecated API RestoreCrosshair().\n" + " This API may be removed in a future release of PCB.\n")); + warned_old_api = true; + } + + notify_crosshair_change(true); + notify_mark_change(true); +} + +/* + * Below is the implementation of the "highlight on endpoint" functionality. + * This highlights lines and arcs when the crosshair is on of their (two) + * endpoints. + */ +struct onpoint_search_info { + CrosshairType *crosshair; + Coord X; + Coord Y; +}; + +static int onpoint_line_callback(const BoxType * box, void *cl) +{ + struct onpoint_search_info *info = (struct onpoint_search_info *) cl; + CrosshairType *crosshair = info->crosshair; + LineType *line = (LineType *) box; + +#ifdef DEBUG_ONPOINT + printf("X=%ld Y=%ld X1=%ld Y1=%ld X2=%ld Y2=%ld\n", info->X, info->Y, + line->Point1.X, line->Point1.Y, line->Point2.X, line->Point2.Y); +#endif + if ((line->Point1.X == info->X && line->Point1.Y == info->Y) || (line->Point2.X == info->X && line->Point2.Y == info->Y)) { + crosshair->onpoint_objs = g_list_prepend(crosshair->onpoint_objs, line); + crosshair->onpoint_objs_types = g_list_prepend(crosshair->onpoint_objs_types, GINT_TO_POINTER(LINE_TYPE)); + SET_FLAG(ONPOINTFLAG, (AnyObjectType *) line); + DrawLine(NULL, line); + return 1; + } + else { + return 0; + } +} + +#define close_enough(v1, v2) (fabs((v1)-(v2)) < 10) + +static int onpoint_arc_callback(const BoxType * box, void *cl) +{ + struct onpoint_search_info *info = (struct onpoint_search_info *) cl; + CrosshairType *crosshair = info->crosshair; + ArcType *arc = (ArcType *) box; + Coord p1x, p1y, p2x, p2y; + + p1x = arc->X - arc->Width * cos(TO_RADIANS(arc->StartAngle)); + p1y = arc->Y + arc->Height * sin(TO_RADIANS(arc->StartAngle)); + p2x = arc->X - arc->Width * cos(TO_RADIANS(arc->StartAngle + arc->Delta)); + p2y = arc->Y + arc->Height * sin(TO_RADIANS(arc->StartAngle + arc->Delta)); + + /* printf("p1=%ld;%ld p2=%ld;%ld info=%ld;%ld\n", p1x, p1y, p2x, p2y, info->X, info->Y); */ + + if ((close_enough(p1x, info->X) && close_enough(p1y, info->Y)) || (close_enough(p2x, info->X) && close_enough(p2y, info->Y))) { + crosshair->onpoint_objs = g_list_prepend(crosshair->onpoint_objs, arc); + crosshair->onpoint_objs_types = g_list_prepend(crosshair->onpoint_objs_types, GINT_TO_POINTER(ARC_TYPE)); + SET_FLAG(ONPOINTFLAG, (AnyObjectType *) arc); + DrawArc(NULL, arc); + return 1; + } + else { + return 0; + } +} + +void DrawLineOrArc(int type, void *obj) +{ + switch (type) { + case LINEPOINT_TYPE: + /* Attention: We can use a NULL pointer here for the layer, + * because it is not used in the DrawLine() function anyways. + * ATM DrawLine() only alls AddPart() internally, which invalidates + * the area specified by the line's bounding box. + */ + DrawLine(NULL, (LineType *) obj); + break; +#if 0 + case ARCPOINT_TYPE: + /* See comment above */ + DrawArc(NULL, (ArcType *) obj); + break; +#endif + } +} + +/* + * Searches for lines or arcs which have points that are exactly + * at the given coordinates and adds them to the crosshair's + * object list along with their respective type. + */ +static void onpoint_work(CrosshairType * crosshair, Coord X, Coord Y) +{ + BoxType SearchBox = point_box(X, Y); + struct onpoint_search_info info; + int i; + GList *lobjs, *ltypes; + GList *old_onpoint_objs = crosshair->onpoint_objs; + GList *old_onpoint_objs_types = crosshair->onpoint_objs_types; + bool redraw = false; + + crosshair->onpoint_objs = NULL; + crosshair->onpoint_objs_types = NULL; + + info.crosshair = crosshair; + info.X = X; + info.Y = Y; + + for (i = 0; i < max_copper_layer; i++) { + LayerType *layer = &PCB->Data->Layer[i]; + /* Only find points of arcs and lines on currently visible layers. */ + if (!layer->On) + continue; + r_search(layer->line_tree, &SearchBox, NULL, onpoint_line_callback, &info); + r_search(layer->arc_tree, &SearchBox, NULL, onpoint_arc_callback, &info); + } + + /* Undraw the old objects */ + for (lobjs = old_onpoint_objs, ltypes = old_onpoint_objs_types; lobjs != NULL; lobjs = lobjs->next, ltypes = ltypes->next) { + /* only remove and redraw those which aren't in the new list */ + if (g_list_find(crosshair->onpoint_objs, lobjs->data) != NULL) + continue; + + CLEAR_FLAG(ONPOINTFLAG, (AnyObjectType *) lobjs->data); + DrawLineOrArc(GPOINTER_TO_INT(ltypes->data), lobjs->data); + redraw = true; + } + + /* draw the new objects */ + for (lobjs = crosshair->onpoint_objs, + ltypes = crosshair->onpoint_objs_types; lobjs != NULL; lobjs = lobjs->next, ltypes = ltypes->next) { + /* only draw those which aren't in the old list */ + if (g_list_find(old_onpoint_objs, lobjs->data) != NULL) + continue; + DrawLineOrArc(GPOINTER_TO_INT(ltypes->data), lobjs->data); + redraw = true; + } + + g_list_free(old_onpoint_objs); + g_list_free(old_onpoint_objs_types); + + if (redraw) { + Redraw(); + } +} + +/* --------------------------------------------------------------------------- + * Returns the square of the given number + */ +static double square(double x) +{ + return x * x; +} + +static double crosshair_sq_dist(CrosshairType * crosshair, Coord x, Coord y) +{ + return square(x - crosshair->X) + square(y - crosshair->Y); +} + +struct snap_data { + CrosshairType *crosshair; + double nearest_sq_dist; + bool nearest_is_grid; + Coord x, y; +}; + +/* Snap to a given location if it is the closest thing we found so far. + * If "prefer_to_grid" is set, the passed location will take preference + * over a closer grid points we already snapped to UNLESS the user is + * pressing the SHIFT key. If the SHIFT key is pressed, the closest object + * (including grid points), is always preferred. + */ +static void check_snap_object(struct snap_data *snap_data, Coord x, Coord y, bool prefer_to_grid) +{ + double sq_dist; + + sq_dist = crosshair_sq_dist(snap_data->crosshair, x, y); + if (sq_dist < snap_data->nearest_sq_dist || (prefer_to_grid && snap_data->nearest_is_grid && !gui->shift_is_pressed())) { + snap_data->x = x; + snap_data->y = y; + snap_data->nearest_sq_dist = sq_dist; + snap_data->nearest_is_grid = false; + } +} + +static void check_snap_offgrid_line(struct snap_data *snap_data, Coord nearest_grid_x, Coord nearest_grid_y) +{ + void *ptr1, *ptr2, *ptr3; + int ans; + LineType *line; + Coord try_x, try_y; + double dx, dy; + double dist; + + if (!TEST_FLAG(SNAPPINFLAG, PCB)) + return; + + /* Code to snap at some sensible point along a line */ + /* Pick the nearest grid-point in the x or y direction + * to align with, then adjust until we hit the line + */ + ans = SearchScreenGridSlop(Crosshair.X, Crosshair.Y, LINE_TYPE, &ptr1, &ptr2, &ptr3); + + if (ans == NO_TYPE) + return; + + line = (LineType *) ptr2; + + /* Allow snapping to off-grid lines when drawing new lines (on + * the same layer), and when moving a line end-point + * (but don't snap to the same line) + */ + if ((Settings.Mode != LINE_MODE || CURRENT != ptr1) && + (Settings.Mode != MOVE_MODE || + Crosshair.AttachedObject.Ptr1 != ptr1 || + Crosshair.AttachedObject.Type != LINEPOINT_TYPE || Crosshair.AttachedObject.Ptr2 == line)) + return; + + dx = line->Point2.X - line->Point1.X; + dy = line->Point2.Y - line->Point1.Y; + + /* Try snapping along the X axis */ + if (dy != 0.) { + /* Move in the X direction until we hit the line */ + try_x = (nearest_grid_y - line->Point1.Y) / dy * dx + line->Point1.X; + try_y = nearest_grid_y; + check_snap_object(snap_data, try_x, try_y, true); + } + + /* Try snapping along the Y axis */ + if (dx != 0.) { + try_x = nearest_grid_x; + try_y = (nearest_grid_x - line->Point1.X) / dx * dy + line->Point1.Y; + check_snap_object(snap_data, try_x, try_y, true); + } + + if (dx != dy) { /* If line not parallel with dX = dY direction.. */ + /* Try snapping diagonally towards the line in the dX = dY direction */ + + if (dy == 0) + dist = line->Point1.Y - nearest_grid_y; + else + dist = ((line->Point1.X - nearest_grid_x) - (line->Point1.Y - nearest_grid_y) * dx / dy) / (1 - dx / dy); + + try_x = nearest_grid_x + dist; + try_y = nearest_grid_y + dist; + + check_snap_object(snap_data, try_x, try_y, true); + } + + if (dx != -dy) { /* If line not parallel with dX = -dY direction.. */ + /* Try snapping diagonally towards the line in the dX = -dY direction */ + + if (dy == 0) + dist = nearest_grid_y - line->Point1.Y; + else + dist = ((line->Point1.X - nearest_grid_x) - (line->Point1.Y - nearest_grid_y) * dx / dy) / (1 + dx / dy); + + try_x = nearest_grid_x + dist; + try_y = nearest_grid_y - dist; + + check_snap_object(snap_data, try_x, try_y, true); + } +} + +/* --------------------------------------------------------------------------- + * recalculates the passed coordinates to fit the current grid setting + */ +void FitCrosshairIntoGrid(Coord X, Coord Y) +{ + Coord nearest_grid_x, nearest_grid_y; + void *ptr1, *ptr2, *ptr3; + struct snap_data snap_data; + int ans; + + Crosshair.X = CLAMP(X, Crosshair.MinX, Crosshair.MaxX); + Crosshair.Y = CLAMP(Y, Crosshair.MinY, Crosshair.MaxY); + + if (PCB->RatDraw) { + nearest_grid_x = -MIL_TO_COORD(6); + nearest_grid_y = -MIL_TO_COORD(6); + } + else { + nearest_grid_x = GridFit(Crosshair.X, PCB->Grid, PCB->GridOffsetX); + nearest_grid_y = GridFit(Crosshair.Y, PCB->Grid, PCB->GridOffsetY); + + if (Marked.status && TEST_FLAG(ORTHOMOVEFLAG, PCB)) { + Coord dx = Crosshair.X - Marked.X; + Coord dy = Crosshair.Y - Marked.Y; + if (ABS(dx) > ABS(dy)) + nearest_grid_y = Marked.Y; + else + nearest_grid_x = Marked.X; + } + + } + + snap_data.crosshair = &Crosshair; + snap_data.nearest_sq_dist = crosshair_sq_dist(&Crosshair, nearest_grid_x, nearest_grid_y); + snap_data.nearest_is_grid = true; + snap_data.x = nearest_grid_x; + snap_data.y = nearest_grid_y; + + ans = NO_TYPE; + if (!PCB->RatDraw) + ans = SearchScreenGridSlop(Crosshair.X, Crosshair.Y, ELEMENT_TYPE, &ptr1, &ptr2, &ptr3); + + if (ans & ELEMENT_TYPE) { + ElementType *el = (ElementType *) ptr1; + check_snap_object(&snap_data, el->MarkX, el->MarkY, false); + } + + ans = NO_TYPE; + if (PCB->RatDraw || TEST_FLAG(SNAPPINFLAG, PCB)) + ans = SearchScreenGridSlop(Crosshair.X, Crosshair.Y, PAD_TYPE, &ptr1, &ptr2, &ptr3); + + /* Avoid self-snapping when moving */ + if (ans != NO_TYPE && + Settings.Mode == MOVE_MODE && Crosshair.AttachedObject.Type == ELEMENT_TYPE && ptr1 == Crosshair.AttachedObject.Ptr1) + ans = NO_TYPE; + + if (ans != NO_TYPE && + (Settings.Mode == LINE_MODE || (Settings.Mode == MOVE_MODE && Crosshair.AttachedObject.Type == LINEPOINT_TYPE))) { + PadTypePtr pad = (PadTypePtr) ptr2; + LayerType *desired_layer; + Cardinal desired_group; + Cardinal SLayer, CLayer; + int found_our_layer = false; + + desired_layer = CURRENT; + if (Settings.Mode == MOVE_MODE && Crosshair.AttachedObject.Type == LINEPOINT_TYPE) { + desired_layer = (LayerType *) Crosshair.AttachedObject.Ptr1; + } + + /* find layer groups of the component side and solder side */ + SLayer = GetLayerGroupNumberByNumber(solder_silk_layer); + CLayer = GetLayerGroupNumberByNumber(component_silk_layer); + desired_group = TEST_FLAG(ONSOLDERFLAG, pad) ? SLayer : CLayer; + + GROUP_LOOP(PCB->Data, desired_group); + { + if (layer == desired_layer) { + found_our_layer = true; + break; + } + } + END_LOOP; + + if (found_our_layer == false) + ans = NO_TYPE; + } + + if (ans != NO_TYPE) { + PadType *pad = (PadType *) ptr2; + check_snap_object(&snap_data, (pad->Point1.X + pad->Point2.X) / 2, (pad->Point1.Y + pad->Point2.Y) / 2, true); + } + + ans = NO_TYPE; + if (PCB->RatDraw || TEST_FLAG(SNAPPINFLAG, PCB)) + ans = SearchScreenGridSlop(Crosshair.X, Crosshair.Y, PIN_TYPE, &ptr1, &ptr2, &ptr3); + + /* Avoid self-snapping when moving */ + if (ans != NO_TYPE && + Settings.Mode == MOVE_MODE && Crosshair.AttachedObject.Type == ELEMENT_TYPE && ptr1 == Crosshair.AttachedObject.Ptr1) + ans = NO_TYPE; + + if (ans != NO_TYPE) { + PinType *pin = (PinType *) ptr2; + check_snap_object(&snap_data, pin->X, pin->Y, true); + } + + ans = NO_TYPE; + if (TEST_FLAG(SNAPPINFLAG, PCB)) + ans = SearchScreenGridSlop(Crosshair.X, Crosshair.Y, VIA_TYPE, &ptr1, &ptr2, &ptr3); + + /* Avoid snapping vias to any other vias */ + if (Settings.Mode == MOVE_MODE && Crosshair.AttachedObject.Type == VIA_TYPE && (ans & PIN_TYPES)) + ans = NO_TYPE; + + if (ans != NO_TYPE) { + PinType *pin = (PinType *) ptr2; + check_snap_object(&snap_data, pin->X, pin->Y, true); + } + + ans = NO_TYPE; + if (TEST_FLAG(SNAPPINFLAG, PCB)) + ans = SearchScreenGridSlop(Crosshair.X, Crosshair.Y, LINEPOINT_TYPE, &ptr1, &ptr2, &ptr3); + + if (ans != NO_TYPE) { + PointType *pnt = (PointType *) ptr3; + check_snap_object(&snap_data, pnt->X, pnt->Y, true); + } + + /* + * Snap to offgrid points on lines. + */ + if (TEST_FLAG(SNAPOFFGRIDLINEFLAG, PCB)) + check_snap_offgrid_line(&snap_data, nearest_grid_x, nearest_grid_y); + + ans = NO_TYPE; + if (TEST_FLAG(SNAPPINFLAG, PCB)) + ans = SearchScreenGridSlop(Crosshair.X, Crosshair.Y, POLYGONPOINT_TYPE, &ptr1, &ptr2, &ptr3); + + if (ans != NO_TYPE) { + PointType *pnt = (PointType *) ptr3; + check_snap_object(&snap_data, pnt->X, pnt->Y, true); + } + + if (snap_data.x >= 0 && snap_data.y >= 0) { + Crosshair.X = snap_data.x; + Crosshair.Y = snap_data.y; + } + + if (TEST_FLAG(HIGHLIGHTONPOINTFLAG, PCB)) + onpoint_work(&Crosshair, Crosshair.X, Crosshair.Y); + + if (Settings.Mode == ARROW_MODE) { + ans = SearchScreenGridSlop(Crosshair.X, Crosshair.Y, LINEPOINT_TYPE, &ptr1, &ptr2, &ptr3); + if (ans == NO_TYPE) + hid_action("PointCursor"); + else if (!TEST_FLAG(SELECTEDFLAG, (LineType *) ptr2)) + hid_actionl("PointCursor", "True", NULL); + } + + if (Settings.Mode == LINE_MODE && Crosshair.AttachedLine.State != STATE_FIRST && TEST_FLAG(AUTODRCFLAG, PCB)) + EnforceLineDRC(); + + gui->set_crosshair(Crosshair.X, Crosshair.Y, HID_SC_DO_NOTHING); +} + +/* --------------------------------------------------------------------------- + * move crosshair relative (has to be switched off) + */ +void MoveCrosshairRelative(Coord DeltaX, Coord DeltaY) +{ + FitCrosshairIntoGrid(Crosshair.X + DeltaX, Crosshair.Y + DeltaY); +} + +/* --------------------------------------------------------------------------- + * move crosshair absolute + * return true if the crosshair was moved from its existing position + */ +bool MoveCrosshairAbsolute(Coord X, Coord Y) +{ + Coord x, y, z; + x = Crosshair.X; + y = Crosshair.Y; + FitCrosshairIntoGrid(X, Y); + if (Crosshair.X != x || Crosshair.Y != y) { + /* back up to old position to notify the GUI + * (which might want to erase the old crosshair) */ + z = Crosshair.X; + Crosshair.X = x; + x = z; + z = Crosshair.Y; + Crosshair.Y = y; + notify_crosshair_change(false); /* Our caller notifies when it has done */ + /* now move forward again */ + Crosshair.X = x; + Crosshair.Y = z; + return (true); + } + return (false); +} + +/* --------------------------------------------------------------------------- + * sets the valid range for the crosshair cursor + */ +void SetCrosshairRange(Coord MinX, Coord MinY, Coord MaxX, Coord MaxY) +{ + Crosshair.MinX = MAX(0, MinX); + Crosshair.MinY = MAX(0, MinY); + Crosshair.MaxX = MIN(PCB->MaxWidth, MaxX); + Crosshair.MaxY = MIN(PCB->MaxHeight, MaxY); + + /* force update of position */ + MoveCrosshairRelative(0, 0); +} + +/* --------------------------------------------------------------------------- + * initializes crosshair stuff + * clears the struct, allocates to graphical contexts + */ +void InitCrosshair(void) +{ + Crosshair.GC = gui->make_gc(); + + gui->set_color(Crosshair.GC, Settings.CrosshairColor); + gui->set_draw_xor(Crosshair.GC, 1); + gui->set_line_cap(Crosshair.GC, Trace_Cap); + gui->set_line_width(Crosshair.GC, 1); + + /* set initial shape */ + Crosshair.shape = Basic_Crosshair_Shape; + + /* set default limits */ + Crosshair.MinX = Crosshair.MinY = 0; + Crosshair.MaxX = PCB->MaxWidth; + Crosshair.MaxY = PCB->MaxHeight; + + /* Initialize the onpoint data. */ + Crosshair.onpoint_objs = NULL; + Crosshair.onpoint_objs_types = NULL; + + /* clear the mark */ + Marked.status = false; +} + +/* --------------------------------------------------------------------------- + * exits crosshair routines, release GCs + */ +void DestroyCrosshair(void) +{ + FreePolygonMemory(&Crosshair.AttachedPolygon); + gui->destroy_gc(Crosshair.GC); +} Index: 1.0.8/src/crosshair.h =================================================================== --- 1.0.8/src/crosshair.h (nonexistent) +++ 1.0.8/src/crosshair.h (revision 1136) @@ -0,0 +1,57 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + * RCS: $Id$ + */ + +/* prototypes for crosshair routines + */ + +#ifndef PCB_CROSSHAIR_H +#define PCB_CROSSHAIR_H + +#include "global.h" + +/* --------------------------------------------------------------------------- + * all possible states of an attached object + */ +#define STATE_FIRST 0 /* initial state */ +#define STATE_SECOND 1 +#define STATE_THIRD 2 + +Coord GridFit(Coord x, Coord grid_spacing, Coord grid_offset); +void notify_crosshair_change(bool changes_complete); +void notify_mark_change(bool changes_complete); +void HideCrosshair(void); +void RestoreCrosshair(void); +void DrawAttached(void); +void DrawMark(void); +void MoveCrosshairRelative(Coord, Coord); +bool MoveCrosshairAbsolute(Coord, Coord); +void SetCrosshairRange(Coord, Coord, Coord, Coord); +void InitCrosshair(void); +void DestroyCrosshair(void); +void FitCrosshairIntoGrid(Coord, Coord); + +#endif Index: 1.0.8/src/data.c =================================================================== --- 1.0.8/src/data.c (nonexistent) +++ 1.0.8/src/data.c (revision 1136) @@ -0,0 +1,55 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* just defines common identifiers + */ +#include "config.h" + +#include "data.h" + + +RCSID("$Id$"); + +/* --------------------------------------------------------------------------- + * some shared identifiers + */ + +CrosshairType Crosshair; /* information about cursor settings */ +MarkType Marked; /* a cross-hair mark */ +OutputType Output; /* some widgets ... used for drawing */ +PCBTypePtr PCB; /* pointer to layout struct */ + +char *Progname; +SettingType Settings; +int LayerStack[MAX_LAYER]; /* determines the layer draw order */ + +BufferType Buffers[MAX_BUFFER]; /* my buffers */ +LibraryType Library; /* the library */ +bool Bumped; /* if the undo serial number has changed */ + +int addedLines; Index: 1.0.8/src/data.h =================================================================== --- 1.0.8/src/data.h (nonexistent) +++ 1.0.8/src/data.h (revision 1136) @@ -0,0 +1,74 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + * RCS: $Id$ + */ + +/* common identifiers + */ + +#ifndef PCB_DATA_H +#define PCB_DATA_H + +#include "global.h" + +/* --------------------------------------------------------------------------- + * some shared identifiers + */ + + +extern CrosshairType Crosshair; + +extern MarkType Marked; + +extern OutputType Output; + +extern PCBTypePtr PCB; + +#define max_group (PCB->Data->LayerN) +#define max_copper_layer (PCB->Data->LayerN) +#define solder_silk_layer (max_copper_layer + SOLDER_LAYER) +#define component_silk_layer (max_copper_layer + COMPONENT_LAYER) + +extern SettingType Settings; + +extern BufferType Buffers[MAX_BUFFER]; + +extern LibraryType Library; + +/*extern DeviceInfoType PrintingDevice[];*/ + +extern char *Progname; +extern char *InputTranslations; + +extern int addedLines; +extern int LayerStack[MAX_LAYER]; + +extern bool Bumped; + +extern FlagType no_flags; + +extern int netlist_frozen; + +#endif Index: 1.0.8/src/default.pcb =================================================================== --- 1.0.8/src/default.pcb (nonexistent) +++ 1.0.8/src/default.pcb (revision 1136) @@ -0,0 +1,47 @@ +# release: pcb 20110918 + +# To read pcb files, the pcb version (or the git source date) must be >= the file version +FileVersion[20070407] + +PCB["" 600000 500000] + +Grid[2500.0 0 0 1] +Cursor[2500 62500 0.000000] +PolyArea[3100.006200] +Thermal[0.500000] +DRC[1200 900 1000 700 1500 1000] +Flags("nameonpcb,clearnew,snappin") +Groups("1,3,4,c:2,5,6,s:7:8") +Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] + +Attribute("PCB::grid::unit" "mil") +Layer(1 "component") +( +) +Layer(2 "solder") +( +) +Layer(3 "comp-GND") +( +) +Layer(4 "comp-power") +( +) +Layer(5 "sold-GND") +( +) +Layer(6 "sold-power") +( +) +Layer(7 "signal3") +( +) +Layer(8 "outline") +( +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( +) Index: 1.0.8/src/default_font =================================================================== --- 1.0.8/src/default_font (nonexistent) +++ 1.0.8/src/default_font (revision 1136) @@ -0,0 +1,773 @@ +Symbol(' ' 18) +( +) +Symbol('!' 12) +( + SymbolLine(0 35 0 40 8) + SymbolLine(0 0 0 25 8) +) +Symbol('"' 12) +( + SymbolLine(0 0 0 10 8) + SymbolLine(10 0 10 10 8) +) +Symbol('#' 12) +( + SymbolLine(0 25 20 25 8) + SymbolLine(0 15 20 15 8) + SymbolLine(15 10 15 30 8) + SymbolLine(5 10 5 30 8) +) +Symbol('$' 12) +( + SymbolLine(15 5 20 10 8) + SymbolLine(5 5 15 5 8) + SymbolLine(0 10 5 5 8) + SymbolLine(0 10 0 15 8) + SymbolLine(0 15 5 20 8) + SymbolLine(5 20 15 20 8) + SymbolLine(15 20 20 25 8) + SymbolLine(20 25 20 30 8) + SymbolLine(15 35 20 30 8) + SymbolLine(5 35 15 35 8) + SymbolLine(0 30 5 35 8) + SymbolLine(10 0 10 40 8) +) +Symbol('%' 12) +( + SymbolLine(0 5 0 10 8) + SymbolLine(0 5 5 0 8) + SymbolLine(5 0 10 0 8) + SymbolLine(10 0 15 5 8) + SymbolLine(15 5 15 10 8) + SymbolLine(10 15 15 10 8) + SymbolLine(5 15 10 15 8) + SymbolLine(0 10 5 15 8) + SymbolLine(0 40 40 0 8) + SymbolLine(35 40 40 35 8) + SymbolLine(40 30 40 35 8) + SymbolLine(35 25 40 30 8) + SymbolLine(30 25 35 25 8) + SymbolLine(25 30 30 25 8) + SymbolLine(25 30 25 35 8) + SymbolLine(25 35 30 40 8) + SymbolLine(30 40 35 40 8) +) +Symbol('&' 12) +( + SymbolLine(0 35 5 40 8) + SymbolLine(0 5 0 15 8) + SymbolLine(0 5 5 0 8) + SymbolLine(0 25 15 10 8) + SymbolLine(5 40 10 40 8) + SymbolLine(10 40 20 30 8) + SymbolLine(0 15 25 40 8) + SymbolLine(5 0 10 0 8) + SymbolLine(10 0 15 5 8) + SymbolLine(15 5 15 10 8) + SymbolLine(0 25 0 35 8) +) +Symbol(''' 12) +( + SymbolLine(0 10 10 0 8) +) +Symbol('(' 12) +( + SymbolLine(0 35 5 40 8) + SymbolLine(0 5 5 0 8) + SymbolLine(0 5 0 35 8) +) +Symbol(')' 12) +( + SymbolLine(0 0 5 5 8) + SymbolLine(5 5 5 35 8) + SymbolLine(0 40 5 35 8) +) +Symbol('*' 12) +( + SymbolLine(0 10 20 30 8) + SymbolLine(0 30 20 10 8) + SymbolLine(0 20 20 20 8) + SymbolLine(10 10 10 30 8) +) +Symbol('+' 12) +( + SymbolLine(0 20 20 20 8) + SymbolLine(10 10 10 30 8) +) +Symbol(',' 12) +( + SymbolLine(0 50 10 40 8) +) +Symbol('-' 12) +( + SymbolLine(0 20 20 20 8) +) +Symbol('.' 12) +( + SymbolLine(0 40 5 40 8) +) +Symbol('/' 12) +( + SymbolLine(0 35 30 5 8) +) +Symbol('0' 12) +( + SymbolLine(0 35 5 40 8) + SymbolLine(0 5 0 35 8) + SymbolLine(0 5 5 0 8) + SymbolLine(5 0 15 0 8) + SymbolLine(15 0 20 5 8) + SymbolLine(20 5 20 35 8) + SymbolLine(15 40 20 35 8) + SymbolLine(5 40 15 40 8) + SymbolLine(0 30 20 10 8) +) +Symbol('1' 12) +( + SymbolLine( 0 8 8 0 8) + SymbolLine( 8 0 8 40 8) + SymbolLine( 0 40 15 40 8) +) +Symbol('2' 12) +( + SymbolLine(0 5 5 0 8) + SymbolLine(5 0 20 0 8) + SymbolLine(20 0 25 5 8) + SymbolLine(25 5 25 15 8) + SymbolLine(0 40 25 15 8) + SymbolLine(0 40 25 40 8) +) +Symbol('3' 12) +( + SymbolLine( 0 5 5 0 8) + SymbolLine( 5 0 15 0 8) + SymbolLine(15 0 20 5 8) + SymbolLine(15 40 20 35 8) + SymbolLine( 5 40 15 40 8) + SymbolLine( 0 35 5 40 8) + + SymbolLine( 5 18 15 18 8) + SymbolLine(20 5 20 13 8) + SymbolLine(20 23 20 35 8) + SymbolLine(20 23 15 18 8) + SymbolLine(20 13 15 18 8) +) +Symbol('4' 12) +( + SymbolLine(0 25 20 0 8) + SymbolLine(0 25 25 25 8) + SymbolLine(20 0 20 40 8) +) +Symbol('5' 12) +( + SymbolLine(0 0 20 0 8) + SymbolLine(0 0 0 20 8) + SymbolLine(0 20 5 15 8) + SymbolLine(5 15 15 15 8) + SymbolLine(15 15 20 20 8) + SymbolLine(20 20 20 35 8) + SymbolLine(15 40 20 35 8) + SymbolLine(5 40 15 40 8) + SymbolLine(0 35 5 40 8) +) +Symbol('6' 12) +( + SymbolLine(15 0 20 5 8) + SymbolLine( 5 0 15 0 8) + SymbolLine( 0 5 5 0 8) + SymbolLine( 0 5 0 35 8) + SymbolLine( 0 35 5 40 8) + SymbolLine(15 18 20 23 8) + SymbolLine( 0 18 15 18 8) + SymbolLine( 5 40 15 40 8) + SymbolLine(15 40 20 35 8) + SymbolLine(20 23 20 35 8) +) +Symbol('7' 12) +( + SymbolLine( 5 40 25 0 8) + SymbolLine( 0 0 25 0 8) +) +Symbol('8' 12) +( + SymbolLine( 0 35 5 40 8) + SymbolLine( 0 27 0 35 8) + SymbolLine( 0 27 7 20 8) + SymbolLine( 7 20 13 20 8) + SymbolLine(13 20 20 27 8) + SymbolLine(20 27 20 35 8) + SymbolLine(15 40 20 35 8) + SymbolLine( 5 40 15 40 8) + SymbolLine( 0 13 7 20 8) + SymbolLine( 0 5 0 13 8) + SymbolLine( 0 5 5 0 8) + SymbolLine( 5 0 15 0 8) + SymbolLine(15 0 20 5 8) + SymbolLine(20 5 20 13 8) + SymbolLine(13 20 20 13 8) +) +Symbol('9' 12) +( + SymbolLine(5 40 20 20 8) + SymbolLine(20 5 20 20 8) + SymbolLine(15 0 20 5 8) + SymbolLine(5 0 15 0 8) + SymbolLine(0 5 5 0 8) + SymbolLine(0 5 0 15 8) + SymbolLine(0 15 5 20 8) + SymbolLine(5 20 20 20 8) +) +Symbol(':' 12) +( + SymbolLine(0 15 5 15 8) + SymbolLine(0 25 5 25 8) +) +Symbol(';' 12) +( + SymbolLine(0 40 10 30 8) + SymbolLine(10 15 10 20 8) +) +Symbol('<' 12) +( + SymbolLine(0 20 10 10 8) + SymbolLine(0 20 10 30 8) +) +Symbol('=' 12) +( + SymbolLine(0 15 20 15 8) + SymbolLine(0 25 20 25 8) +) +Symbol('>' 12) +( + SymbolLine(0 10 10 20 8) + SymbolLine(0 30 10 20 8) +) +Symbol('?' 12) +( + SymbolLine(10 20 10 25 8) + SymbolLine(10 35 10 40 8) + SymbolLine(0 5 0 10 8) + SymbolLine(0 5 5 0 8) + SymbolLine(5 0 15 0 8) + SymbolLine(15 0 20 5 8) + SymbolLine(20 5 20 10 8) + SymbolLine(10 20 20 10 8) +) +Symbol('A' 12) +( + SymbolLine( 0 10 0 40 8) + SymbolLine( 0 10 7 0 8) + SymbolLine( 7 0 18 0 8) + SymbolLine(18 0 25 10 8) + SymbolLine(25 10 25 40 8) + SymbolLine( 0 20 25 20 8) +) +Symbol('B' 12) +( + SymbolLine( 0 40 20 40 8) + SymbolLine(20 40 25 35 8) + SymbolLine(25 23 25 35 8) + SymbolLine(20 18 25 23 8) + SymbolLine( 5 18 20 18 8) + SymbolLine( 5 0 5 40 8) + SymbolLine( 0 0 20 0 8) + SymbolLine(20 0 25 5 8) + SymbolLine(25 5 25 13 8) + SymbolLine(20 18 25 13 8) +) +Symbol('C' 12) +( + SymbolLine(7 40 20 40 8) + SymbolLine(0 33 7 40 8) + SymbolLine(0 7 0 33 8) + SymbolLine(0 7 7 0 8) + SymbolLine(7 0 20 0 8) +) +Symbol('D' 12) +( + SymbolLine( 5 0 5 40 8) + SymbolLine(18 0 25 7 8) + SymbolLine(25 7 25 33 8) + SymbolLine(18 40 25 33 8) + SymbolLine( 0 40 18 40 8) + SymbolLine( 0 0 18 0 8) +) +Symbol('E' 12) +( + SymbolLine(0 18 15 18 8) + SymbolLine(0 40 20 40 8) + SymbolLine(0 0 0 40 8) + SymbolLine(0 0 20 0 8) +) +Symbol('F' 12) +( + SymbolLine(0 0 0 40 8) + SymbolLine(0 0 20 0 8) + SymbolLine(0 18 15 18 8) +) +Symbol('G' 12) +( + SymbolLine(20 0 25 5 8) + SymbolLine(5 0 20 0 8) + SymbolLine(0 5 5 0 8) + SymbolLine(0 5 0 35 8) + SymbolLine(0 35 5 40 8) + SymbolLine(5 40 20 40 8) + SymbolLine(20 40 25 35 8) + SymbolLine(25 25 25 35 8) + SymbolLine(20 20 25 25 8) + SymbolLine(10 20 20 20 8) +) +Symbol('H' 12) +( + SymbolLine(0 0 0 40 8) + SymbolLine(25 0 25 40 8) + SymbolLine(0 20 25 20 8) +) +Symbol('I' 12) +( + SymbolLine(0 0 10 0 8) + SymbolLine(5 0 5 40 8) + SymbolLine(0 40 10 40 8) +) +Symbol('J' 12) +( + SymbolLine( 7 0 15 0 8) + SymbolLine(15 0 15 35 8) + SymbolLine(10 40 15 35 8) + SymbolLine( 5 40 10 40 8) + SymbolLine( 0 35 5 40 8) + SymbolLine( 0 35 0 30 8) +) +Symbol('K' 12) +( + SymbolLine(0 0 0 40 8) + SymbolLine(0 20 20 0 8) + SymbolLine(0 20 20 40 8) +) +Symbol('L' 12) +( + SymbolLine(0 0 0 40 8) + SymbolLine(0 40 20 40 8) +) +Symbol('M' 12) +( + SymbolLine(0 0 0 40 8) + SymbolLine(0 0 15 20 8) + SymbolLine(15 20 30 0 8) + SymbolLine(30 0 30 40 8) +) +Symbol('N' 12) +( + SymbolLine(0 0 0 40 8) + SymbolLine(0 0 25 40 8) + SymbolLine(25 0 25 40 8) +) +Symbol('O' 12) +( + SymbolLine(0 5 0 35 8) + SymbolLine(0 5 5 0 8) + SymbolLine(5 0 15 0 8) + SymbolLine(15 0 20 5 8) + SymbolLine(20 5 20 35 8) + SymbolLine(15 40 20 35 8) + SymbolLine(5 40 15 40 8) + SymbolLine(0 35 5 40 8) +) +Symbol('P' 12) +( + SymbolLine(5 0 5 40 8) + SymbolLine(0 0 20 0 8) + SymbolLine(20 0 25 5 8) + SymbolLine(25 5 25 15 8) + SymbolLine(20 20 25 15 8) + SymbolLine(5 20 20 20 8) +) +Symbol('Q' 12) +( + SymbolLine( 0 5 0 35 8) + SymbolLine( 0 5 5 0 8) + SymbolLine( 5 0 15 0 8) + SymbolLine(15 0 20 5 8) + SymbolLine(20 5 20 30 8) + SymbolLine(10 40 20 30 8) + SymbolLine( 5 40 10 40 8) + SymbolLine( 0 35 5 40 8) + SymbolLine(10 25 20 40 8) +) +Symbol('R' 12) +( + SymbolLine( 0 0 20 0 8) + SymbolLine(20 0 25 5 8) + SymbolLine(25 5 25 15 8) + SymbolLine(20 20 25 15 8) + SymbolLine( 5 20 20 20 8) + SymbolLine( 5 0 5 40 8) + SymbolLine(13 20 25 40 8) +) +Symbol('S' 12) +( + SymbolLine(20 0 25 5 8) + SymbolLine(5 0 20 0 8) + SymbolLine(0 5 5 0 8) + SymbolLine(0 5 0 15 8) + SymbolLine(0 15 5 20 8) + SymbolLine(5 20 20 20 8) + SymbolLine(20 20 25 25 8) + SymbolLine(25 25 25 35 8) + SymbolLine(20 40 25 35 8) + SymbolLine(5 40 20 40 8) + SymbolLine(0 35 5 40 8) +) +Symbol('T' 12) +( + SymbolLine(0 0 20 0 8) + SymbolLine(10 0 10 40 8) +) +Symbol('U' 12) +( + SymbolLine(0 0 0 35 8) + SymbolLine(0 35 5 40 8) + SymbolLine(5 40 15 40 8) + SymbolLine(15 40 20 35 8) + SymbolLine(20 0 20 35 8) +) +Symbol('V' 12) +( + SymbolLine( 0 0 10 40 8) + SymbolLine(10 40 20 0 8) +) +Symbol('W' 12) +( + SymbolLine( 0 0 0 20 8) + SymbolLine( 0 20 5 40 8) + SymbolLine( 5 40 15 20 8) + SymbolLine(15 20 25 40 8) + SymbolLine(25 40 30 20 8) + SymbolLine(30 20 30 0 8) +) +Symbol('X' 12) +( + SymbolLine( 0 40 25 0 8) + SymbolLine( 0 0 25 40 8) +) +Symbol('Y' 12) +( + SymbolLine( 0 0 10 20 8) + SymbolLine(10 20 20 0 8) + SymbolLine(10 20 10 40 8) +) +Symbol('Z' 12) +( + SymbolLine( 0 0 25 0 8) + SymbolLine( 0 40 25 0 8) + SymbolLine( 0 40 25 40 8) +) +Symbol('[' 12) +( + SymbolLine(0 0 5 0 8) + SymbolLine(0 0 0 40 8) + SymbolLine(0 40 5 40 8) +) +Symbol('\' 12) +( + SymbolLine(0 5 30 35 8) +) +Symbol(']' 12) +( + SymbolLine(0 0 5 0 8) + SymbolLine(5 0 5 40 8) + SymbolLine(0 40 5 40 8) +) +Symbol('^' 12) +( + SymbolLine(0 5 5 0 8) + SymbolLine(5 0 10 5 8) +) +Symbol('_' 12) +( + SymbolLine(0 40 20 40 8) +) +Symbol('a' 12) +( + SymbolLine(15 20 20 25 8) + SymbolLine(5 20 15 20 8) + SymbolLine(0 25 5 20 8) + SymbolLine(0 25 0 35 8) + SymbolLine(0 35 5 40 8) + SymbolLine(20 20 20 35 8) + SymbolLine(20 35 25 40 8) + SymbolLine(5 40 15 40 8) + SymbolLine(15 40 20 35 8) +) +Symbol('b' 12) +( + SymbolLine(0 0 0 40 8) + SymbolLine(0 35 5 40 8) + SymbolLine(5 40 15 40 8) + SymbolLine(15 40 20 35 8) + SymbolLine(20 25 20 35 8) + SymbolLine(15 20 20 25 8) + SymbolLine(5 20 15 20 8) + SymbolLine(0 25 5 20 8) +) +Symbol('c' 12) +( + SymbolLine(5 20 20 20 8) + SymbolLine(0 25 5 20 8) + SymbolLine(0 25 0 35 8) + SymbolLine(0 35 5 40 8) + SymbolLine(5 40 20 40 8) +) +Symbol('d' 12) +( + SymbolLine(20 0 20 40 8) + SymbolLine(15 40 20 35 8) + SymbolLine(5 40 15 40 8) + SymbolLine(0 35 5 40 8) + SymbolLine(0 25 0 35 8) + SymbolLine(0 25 5 20 8) + SymbolLine(5 20 15 20 8) + SymbolLine(15 20 20 25 8) +) +Symbol('e' 12) +( + SymbolLine(5 40 20 40 8) + SymbolLine(0 35 5 40 8) + SymbolLine(0 25 0 35 8) + SymbolLine(0 25 5 20 8) + SymbolLine(5 20 15 20 8) + SymbolLine(15 20 20 25 8) + SymbolLine(0 30 20 30 8) + SymbolLine(20 30 20 25 8) +) +Symbol('f' 10) +( + SymbolLine(5 5 5 40 8) + SymbolLine(5 5 10 0 8) + SymbolLine(10 0 15 0 8) + SymbolLine(0 20 10 20 8) +) +Symbol('g' 12) +( + SymbolLine(15 20 20 25 8) + SymbolLine(5 20 15 20 8) + SymbolLine(0 25 5 20 8) + SymbolLine(0 25 0 35 8) + SymbolLine(0 35 5 40 8) + SymbolLine(5 40 15 40 8) + SymbolLine(15 40 20 35 8) + SymbolLine(0 50 5 55 8) + SymbolLine(5 55 15 55 8) + SymbolLine(15 55 20 50 8) + SymbolLine(20 20 20 50 8) +) +Symbol('h' 12) +( + SymbolLine(0 0 0 40 8) + SymbolLine(0 25 5 20 8) + SymbolLine(5 20 15 20 8) + SymbolLine(15 20 20 25 8) + SymbolLine(20 25 20 40 8) +) +Symbol('i' 10) +( + SymbolLine(0 10 0 11 10) + SymbolLine(0 25 0 40 8) +) +Symbol('j' 10) +( + SymbolLine(5 10 5 11 10) + SymbolLine(5 25 5 50 8) + SymbolLine(0 55 5 50 8) +) +Symbol('k' 12) +( + SymbolLine(0 0 0 40 8) + SymbolLine(0 25 15 40 8) + SymbolLine(0 25 10 15 8) +) +Symbol('l' 10) +( + SymbolLine(0 0 0 35 8) + SymbolLine(0 35 5 40 8) +) +Symbol('m' 12) +( + SymbolLine(5 25 5 40 8) + SymbolLine(5 25 10 20 8) + SymbolLine(10 20 15 20 8) + SymbolLine(15 20 20 25 8) + SymbolLine(20 25 20 40 8) + SymbolLine(20 25 25 20 8) + SymbolLine(25 20 30 20 8) + SymbolLine(30 20 35 25 8) + SymbolLine(35 25 35 40 8) + SymbolLine(0 20 5 25 8) +) +Symbol('n' 12) +( + SymbolLine(5 25 5 40 8) + SymbolLine(5 25 10 20 8) + SymbolLine(10 20 15 20 8) + SymbolLine(15 20 20 25 8) + SymbolLine(20 25 20 40 8) + SymbolLine(0 20 5 25 8) +) +Symbol('o' 12) +( + SymbolLine(0 25 0 35 8) + SymbolLine(0 25 5 20 8) + SymbolLine(5 20 15 20 8) + SymbolLine(15 20 20 25 8) + SymbolLine(20 25 20 35 8) + SymbolLine(15 40 20 35 8) + SymbolLine(5 40 15 40 8) + SymbolLine(0 35 5 40 8) +) +Symbol('p' 12) +( + SymbolLine(5 25 5 55 8) + SymbolLine(0 20 5 25 8) + SymbolLine(5 25 10 20 8) + SymbolLine(10 20 20 20 8) + SymbolLine(20 20 25 25 8) + SymbolLine(25 25 25 35 8) + SymbolLine(20 40 25 35 8) + SymbolLine(10 40 20 40 8) + SymbolLine(5 35 10 40 8) +) +Symbol('q' 12) +( + SymbolLine(20 25 20 55 8) + SymbolLine(15 20 20 25 8) + SymbolLine(5 20 15 20 8) + SymbolLine(0 25 5 20 8) + SymbolLine(0 25 0 35 8) + SymbolLine(0 35 5 40 8) + SymbolLine(5 40 15 40 8) + SymbolLine(15 40 20 35 8) +) +Symbol('r' 12) +( + SymbolLine(5 25 5 40 8) + SymbolLine(5 25 10 20 8) + SymbolLine(10 20 20 20 8) + SymbolLine(0 20 5 25 8) +) +Symbol('s' 12) +( + SymbolLine(5 40 20 40 8) + SymbolLine(20 40 25 35 8) + SymbolLine(20 30 25 35 8) + SymbolLine(5 30 20 30 8) + SymbolLine(0 25 5 30 8) + SymbolLine(0 25 5 20 8) + SymbolLine(5 20 20 20 8) + SymbolLine(20 20 25 25 8) + SymbolLine(0 35 5 40 8) +) +Symbol('t' 10) +( + SymbolLine(5 0 5 35 8) + SymbolLine(5 35 10 40 8) + SymbolLine(0 15 10 15 8) +) +Symbol('u' 12) +( + SymbolLine(0 20 0 35 8) + SymbolLine(0 35 5 40 8) + SymbolLine(5 40 15 40 8) + SymbolLine(15 40 20 35 8) + SymbolLine(20 20 20 35 8) +) +Symbol('v' 12) +( + SymbolLine( 0 20 10 40 8) + SymbolLine(20 20 10 40 8) +) +Symbol('w' 12) +( + SymbolLine(0 20 0 35 8) + SymbolLine(0 35 5 40 8) + SymbolLine(5 40 10 40 8) + SymbolLine(10 40 15 35 8) + SymbolLine(15 20 15 35 8) + SymbolLine(15 35 20 40 8) + SymbolLine(20 40 25 40 8) + SymbolLine(25 40 30 35 8) + SymbolLine(30 20 30 35 8) +) +Symbol('x' 12) +( + SymbolLine(0 20 20 40 8) + SymbolLine(0 40 20 20 8) +) +Symbol('y' 12) +( + SymbolLine(0 20 0 35 8) + SymbolLine(0 35 5 40 8) + SymbolLine(20 20 20 50 8) + SymbolLine(15 55 20 50 8) + SymbolLine(5 55 15 55 8) + SymbolLine(0 50 5 55 8) + SymbolLine(5 40 15 40 8) + SymbolLine(15 40 20 35 8) +) +Symbol('z' 12) +( + SymbolLine(0 20 20 20 8) + SymbolLine(0 40 20 20 8) + SymbolLine(0 40 20 40 8) +) +Symbol('{' 12) +( + SymbolLine(5 5 10 0 8) + SymbolLine(5 5 5 15 8) + SymbolLine(0 20 5 15 8) + SymbolLine(0 20 5 25 8) + SymbolLine(5 25 5 35 8) + SymbolLine(5 35 10 40 8) +) +Symbol('|' 12) +( + SymbolLine(0 0 0 40 8) +) +Symbol('}' 12) +( + SymbolLine(0 0 5 5 8) + SymbolLine(5 5 5 15 8) + SymbolLine(5 15 10 20 8) + SymbolLine(5 25 10 20 8) + SymbolLine(5 25 5 35 8) + SymbolLine(0 40 5 35 8) +) +Symbol('~' 12) +( + SymbolLine(0 25 5 20 8) + SymbolLine(5 20 10 20 8) + SymbolLine(10 20 15 25 8) + SymbolLine(15 25 20 25 8) + SymbolLine(20 25 25 20 8) +) +Symbol('@' 12) +( + SymbolLine(0 0 0 30 8) + SymbolLine(0 30 10 40 8) + SymbolLine(10 40 40 40 8) + SymbolLine(50 25 50 0 8) + SymbolLine(50 0 40 -10 8) + SymbolLine(40 -10 10 -10 8) + SymbolLine(10 -10 0 0 8) + SymbolLine(15 10 15 20 8) + SymbolLine(15 20 20 25 8) + SymbolLine(20 25 30 25 8) + SymbolLine(30 25 35 20 8) + SymbolLine(35 20 40 25 8) + SymbolLine(35 20 35 5 8) + SymbolLine(35 10 30 5 8) + SymbolLine(20 5 30 5 8) + SymbolLine(20 5 15 10 8) + SymbolLine(40 25 50 25 8) +) Index: 1.0.8/src/dolists.h =================================================================== --- 1.0.8/src/dolists.h (nonexistent) +++ 1.0.8/src/dolists.h (revision 1136) @@ -0,0 +1,9 @@ +/* $Id$ */ + +#undef REGISTER_ACTIONS +#undef REGISTER_ATTRIBUTES +#undef REGISTER_FLAGS + +#define REGISTER_ACTIONS(a) {extern void HIDCONCAT(register_,a)();HIDCONCAT(register_,a)();} +#define REGISTER_ATTRIBUTES(a) {extern void HIDCONCAT(register_,a)();HIDCONCAT(register_,a)();} +#define REGISTER_FLAGS(a) {extern void HIDCONCAT(register_,a)();HIDCONCAT(register_,a)();} Index: 1.0.8/src/draw.c =================================================================== --- 1.0.8/src/draw.c (nonexistent) +++ 1.0.8/src/draw.c (revision 1136) @@ -0,0 +1,1707 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996, 2003, 2004 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + + +/* drawing routines + */ + +#include "config.h" + +#include "global.h" + +/*#include "clip.h"*/ +#include "compat.h" +#include "crosshair.h" +#include "data.h" +#include "draw.h" +#include "error.h" +#include "mymem.h" +#include "misc.h" +#include "rotate.h" +#include "rtree.h" +#include "search.h" +#include "select.h" +#include "print.h" + + +#undef NDEBUG +#include + +#ifndef MAXINT +#define MAXINT (((unsigned int)(~0))>>1) +#endif + +RCSID("$Id$"); + +#define SMALL_SMALL_TEXT_SIZE 0 +#define SMALL_TEXT_SIZE 1 +#define NORMAL_TEXT_SIZE 2 +#define LARGE_TEXT_SIZE 3 +#define N_TEXT_SIZES 4 + + +/* --------------------------------------------------------------------------- + * some local identifiers + */ +static BoxType Block = { MAXINT, MAXINT, -MAXINT, -MAXINT }; + +static int doing_pinout = 0; +static bool doing_assy = false; + +/* --------------------------------------------------------------------------- + * some local prototypes + */ +static void DrawEverything(const BoxType *); +static void DrawPPV(int group, const BoxType *); +static void DrawLayerGroup(int, const BoxType *); +static void AddPart(void *); +static void SetPVColor(PinTypePtr, int); +static void DrawEMark(ElementTypePtr, Coord, Coord, bool); +static void DrawMask(int side, const BoxType *); +static void DrawPaste(int side, const BoxType *); +static void DrawRats(const BoxType *); +static void DrawSilk(int side, const BoxType *); + +static void LightenColor(const char *orig, char buf[8], double factor) +{ + unsigned int r, g, b; + + if (orig[0] == '#') { + sscanf(&orig[1], "%2x%2x%2x", &r, &g, &b); + r = MIN(255, r * factor); + g = MIN(255, g * factor); + b = MIN(255, b * factor); + } + else { + r = 0xff; + g = 0xff; + b = 0xff; + } + snprintf(buf, sizeof("#XXXXXX"), "#%02x%02x%02x", r, g, b); +} + + +/*-------------------------------------------------------------------------------------- + * setup color for pin or via + */ +static void SetPVColor(PinTypePtr Pin, int Type) +{ + char *color; + char buf[sizeof("#XXXXXX")]; + + if (Type == VIA_TYPE) { + if (!doing_pinout && TEST_FLAG(WARNFLAG | SELECTEDFLAG | FOUNDFLAG, Pin)) { + if (TEST_FLAG(WARNFLAG, Pin)) + color = PCB->WarnColor; + else if (TEST_FLAG(SELECTEDFLAG, Pin)) + color = PCB->ViaSelectedColor; + else + color = PCB->ConnectedColor; + + if (TEST_FLAG(ONPOINTFLAG, Pin)) { + assert(color != NULL); + LightenColor(color, buf, 1.75); + color = buf; + } + } + else + color = PCB->ViaColor; + } + else { + if (!doing_pinout && TEST_FLAG(WARNFLAG | SELECTEDFLAG | FOUNDFLAG, Pin)) { + if (TEST_FLAG(WARNFLAG, Pin)) + color = PCB->WarnColor; + else if (TEST_FLAG(SELECTEDFLAG, Pin)) + color = PCB->PinSelectedColor; + else + color = PCB->ConnectedColor; + + if (TEST_FLAG(ONPOINTFLAG, Pin)) { + assert(color != NULL); + LightenColor(color, buf, 1.75); + color = buf; + } + } + else + color = PCB->PinColor; + } + + gui->set_color(Output.fgGC, color); +} + +/*--------------------------------------------------------------------------- + * Adds the update rect to the update region + */ +static void AddPart(void *b) +{ + BoxType *box = (BoxType *) b; + + Block.X1 = MIN(Block.X1, box->X1); + Block.X2 = MAX(Block.X2, box->X2); + Block.Y1 = MIN(Block.Y1, box->Y1); + Block.Y2 = MAX(Block.Y2, box->Y2); +} + +/* + * initiate the actual redrawing of the updated area + */ +void Draw(void) +{ + if (Block.X1 <= Block.X2 && Block.Y1 <= Block.Y2) + gui->invalidate_lr(Block.X1, Block.X2, Block.Y1, Block.Y2); + + /* shrink the update block */ + Block.X1 = Block.Y1 = MAXINT; + Block.X2 = Block.Y2 = -MAXINT; +} + +/* ---------------------------------------------------------------------- + * redraws all the data by the event handlers + */ +void Redraw(void) +{ + gui->invalidate_all(); +} + +static void _draw_pv_name(PinType * pv) +{ + BoxType box; + bool vert; + TextType text; + char buff[128], *pn; + + if (!pv->Name || !pv->Name[0]) + pn = EMPTY(pv->Number); + else + pn = EMPTY(TEST_FLAG(SHOWNUMBERFLAG, PCB) ? pv->Number : pv->Name); + + if (GET_INTCONN(pv) > 0) + snprintf(buff, sizeof(buff), "%s[%d]", pn, GET_INTCONN(pv)); + else + strcpy(buff, pn); + text.TextString = buff; + + vert = TEST_FLAG(EDGE2FLAG, pv); + + if (vert) { + box.X1 = pv->X - pv->Thickness / 2 + Settings.PinoutTextOffsetY; + box.Y1 = pv->Y - pv->DrillingHole / 2 - Settings.PinoutTextOffsetX; + } + else { + box.X1 = pv->X + pv->DrillingHole / 2 + Settings.PinoutTextOffsetX; + box.Y1 = pv->Y - pv->Thickness / 2 + Settings.PinoutTextOffsetY; + } + + gui->set_color(Output.fgGC, PCB->PinNameColor); + + text.Flags = NoFlags(); + /* Set font height to approx 56% of pin thickness */ + text.Scale = 56 * pv->Thickness / FONT_CAPHEIGHT; + text.X = box.X1; + text.Y = box.Y1; + text.Direction = vert ? 1 : 0; + + if (gui->gui) + doing_pinout++; + DrawTextLowLevel(&text, 0); + if (gui->gui) + doing_pinout--; +} + +static void _draw_pv(PinTypePtr pv, bool draw_hole) +{ + if (TEST_FLAG(THINDRAWFLAG, PCB)) + gui->thindraw_pcb_pv(Output.fgGC, Output.fgGC, pv, draw_hole, false); + else + gui->fill_pcb_pv(Output.fgGC, Output.bgGC, pv, draw_hole, false); + + if (!TEST_FLAG(HOLEFLAG, pv) && TEST_FLAG(DISPLAYNAMEFLAG, pv)) + _draw_pv_name(pv); +} + +static void draw_pin(PinTypePtr pin, bool draw_hole) +{ + SetPVColor(pin, PIN_TYPE); + _draw_pv(pin, draw_hole); +} + +static int pin_callback(const BoxType * b, void *cl) +{ + draw_pin((PinType *) b, false); + return 1; +} + +static void draw_via(PinTypePtr via, bool draw_hole) +{ + SetPVColor(via, VIA_TYPE); + _draw_pv(via, draw_hole); +} + +static int via_callback(const BoxType * b, void *cl) +{ + draw_via((PinType *) b, false); + return 1; +} + +static void draw_pad_name(PadType * pad) +{ + BoxType box; + bool vert; + TextType text; + char buff[128], *pn; + + + + if (!pad->Name || !pad->Name[0]) + pn = EMPTY(pad->Number); + else + pn = EMPTY(TEST_FLAG(SHOWNUMBERFLAG, PCB) ? pad->Number : pad->Name); + + if (GET_INTCONN(pad) > 0) + snprintf(buff, sizeof(buff), "%s[%d]", pn, GET_INTCONN(pad)); + else + strcpy(buff, pn); + text.TextString = buff; + + /* should text be vertical ? */ + vert = (pad->Point1.X == pad->Point2.X); + + if (vert) { + box.X1 = pad->Point1.X - pad->Thickness / 2; + box.Y1 = MAX(pad->Point1.Y, pad->Point2.Y) + pad->Thickness / 2; + box.X1 += Settings.PinoutTextOffsetY; + box.Y1 -= Settings.PinoutTextOffsetX; + } + else { + box.X1 = MIN(pad->Point1.X, pad->Point2.X) - pad->Thickness / 2; + box.Y1 = pad->Point1.Y - pad->Thickness / 2; + box.X1 += Settings.PinoutTextOffsetX; + box.Y1 += Settings.PinoutTextOffsetY; + } + + gui->set_color(Output.fgGC, PCB->PinNameColor); + + text.Flags = NoFlags(); + /* Set font height to approx 90% of pin thickness */ + text.Scale = 90 * pad->Thickness / FONT_CAPHEIGHT; + text.X = box.X1; + text.Y = box.Y1; + text.Direction = vert ? 1 : 0; + + DrawTextLowLevel(&text, 0); +} + +static void _draw_pad(hidGC gc, PadType * pad, bool clear, bool mask) +{ + if (clear && !mask && pad->Clearance <= 0) + return; + + if (TEST_FLAG(THINDRAWFLAG, PCB) || (clear && TEST_FLAG(THINDRAWPOLYFLAG, PCB))) + gui->thindraw_pcb_pad(gc, pad, clear, mask); + else + gui->fill_pcb_pad(gc, pad, clear, mask); +} + +static void draw_pad(PadType * pad) +{ + const char *color; + char buf[sizeof("#XXXXXX")]; + + if (doing_pinout) + gui->set_color(Output.fgGC, PCB->PinColor); + else if (TEST_FLAG(WARNFLAG | SELECTEDFLAG | FOUNDFLAG, pad)) { + if (TEST_FLAG(WARNFLAG, pad)) + color = PCB->WarnColor; + else if (TEST_FLAG(SELECTEDFLAG, pad)) + color = PCB->PinSelectedColor; + else + color = PCB->ConnectedColor; + + } + else if (FRONT(pad)) + color = PCB->PinColor; + else + color = PCB->InvisibleObjectsColor; + + if (TEST_FLAG(ONPOINTFLAG, pad)) { + assert(color != NULL); + LightenColor(color, buf, 1.75); + color = buf; + } + gui->set_color(Output.fgGC, color); + + _draw_pad(Output.fgGC, pad, false, false); + + if (doing_pinout || TEST_FLAG(DISPLAYNAMEFLAG, pad)) + draw_pad_name(pad); +} + +static int pad_callback(const BoxType * b, void *cl) +{ + PadTypePtr pad = (PadTypePtr) b; + int *side = cl; + + if (ON_SIDE(pad, *side)) + draw_pad(pad); + return 1; +} + +static void draw_element_name(ElementType * element) +{ + if ((TEST_FLAG(HIDENAMESFLAG, PCB) && gui->gui) || TEST_FLAG(HIDENAMEFLAG, element)) + return; + if (doing_pinout || doing_assy) + gui->set_color(Output.fgGC, PCB->ElementColor); + else if (TEST_FLAG(SELECTEDFLAG, &ELEMENT_TEXT(PCB, element))) + gui->set_color(Output.fgGC, PCB->ElementSelectedColor); + else if (FRONT(element)) { +/* TODO: why do we test for Name's flag here? */ + if (TEST_FLAG(NONETLISTFLAG, element)) + gui->set_color(Output.fgGC, PCB->ElementColor_nonetlist); + else + gui->set_color(Output.fgGC, PCB->ElementColor); + } + else + gui->set_color(Output.fgGC, PCB->InvisibleObjectsColor); + + DrawTextLowLevel(&ELEMENT_TEXT(PCB, element), PCB->minSlk); + +} + +static int name_callback(const BoxType * b, void *cl) +{ + TextTypePtr text = (TextTypePtr) b; + ElementTypePtr element = (ElementTypePtr) text->Element; + int *side = cl; + + if (TEST_FLAG(HIDENAMEFLAG, element)) + return 0; + + if (ON_SIDE(element, *side)) + draw_element_name(element); + return 0; +} + +static void draw_element_pins_and_pads(ElementType * element) +{ + PAD_LOOP(element); + { + if (doing_pinout || doing_assy || FRONT(pad) || PCB->InvisibleObjectsOn) + draw_pad(pad); + } + END_LOOP; + PIN_LOOP(element); + { + draw_pin(pin, true); + } + END_LOOP; +} + +static int EMark_callback(const BoxType * b, void *cl) +{ + ElementTypePtr element = (ElementTypePtr) b; + + DrawEMark(element, element->MarkX, element->MarkY, !FRONT(element)); + return 1; +} + +static int hole_callback(const BoxType * b, void *cl) +{ + PinTypePtr pv = (PinTypePtr) b; + int plated = cl ? *(int *) cl : -1; + const char *color; + char buf[sizeof("#XXXXXX")]; + + if ((plated == 0 && !TEST_FLAG(HOLEFLAG, pv)) || (plated == 1 && TEST_FLAG(HOLEFLAG, pv))) + return 1; + + if (TEST_FLAG(THINDRAWFLAG, PCB)) { + if (!TEST_FLAG(HOLEFLAG, pv)) { + gui->set_line_cap(Output.fgGC, Round_Cap); + gui->set_line_width(Output.fgGC, 0); + gui->draw_arc(Output.fgGC, pv->X, pv->Y, pv->DrillingHole / 2, pv->DrillingHole / 2, 0, 360); + } + } + else + gui->fill_circle(Output.bgGC, pv->X, pv->Y, pv->DrillingHole / 2); + + if (TEST_FLAG(HOLEFLAG, pv)) { + if (TEST_FLAG(WARNFLAG, pv)) + color = PCB->WarnColor; + else if (TEST_FLAG(SELECTEDFLAG, pv)) + color = PCB->ViaSelectedColor; + else + color = Settings.BlackColor; + + if (TEST_FLAG(ONPOINTFLAG, pv)) { + assert(color != NULL); + LightenColor(color, buf, 1.75); + color = buf; + } + gui->set_color(Output.fgGC, color); + + gui->set_line_cap(Output.fgGC, Round_Cap); + gui->set_line_width(Output.fgGC, 0); + gui->draw_arc(Output.fgGC, pv->X, pv->Y, pv->DrillingHole / 2, pv->DrillingHole / 2, 0, 360); + } + return 1; +} + +static void DrawHoles(bool draw_plated, bool draw_unplated, const BoxType * drawn_area) +{ + int plated = -1; + + if (draw_plated && !draw_unplated) + plated = 1; + if (!draw_plated && draw_unplated) + plated = 0; + + r_search(PCB->Data->pin_tree, drawn_area, NULL, hole_callback, &plated); + r_search(PCB->Data->via_tree, drawn_area, NULL, hole_callback, &plated); +} + +static void _draw_line(LineType * line) +{ + gui->set_line_cap(Output.fgGC, Trace_Cap); + if (TEST_FLAG(THINDRAWFLAG, PCB)) + gui->set_line_width(Output.fgGC, 0); + else + gui->set_line_width(Output.fgGC, line->Thickness); + + gui->draw_line(Output.fgGC, line->Point1.X, line->Point1.Y, line->Point2.X, line->Point2.Y); +} + +static void draw_line(LayerType * layer, LineType * line) +{ + const char *color; + char buf[sizeof("#XXXXXX")]; + + if (TEST_FLAG(WARNFLAG, line)) + color = PCB->WarnColor; + else if (TEST_FLAG(SELECTEDFLAG | FOUNDFLAG, line)) { + if (TEST_FLAG(SELECTEDFLAG, line)) + color = layer->SelectedColor; + else + color = PCB->ConnectedColor; + } + else + color = layer->Color; + + if (TEST_FLAG(ONPOINTFLAG, line)) { + assert(color != NULL); + LightenColor(color, buf, 1.75); + color = buf; + } + + gui->set_color(Output.fgGC, color); + _draw_line(line); +} + +static int line_callback(const BoxType * b, void *cl) +{ + draw_line((LayerType *) cl, (LineType *) b); + return 1; +} + +static int rat_callback(const BoxType * b, void *cl) +{ + RatType *rat = (RatType *) b; + + if (TEST_FLAG(SELECTEDFLAG | FOUNDFLAG, rat)) { + if (TEST_FLAG(SELECTEDFLAG, rat)) + gui->set_color(Output.fgGC, PCB->RatSelectedColor); + else + gui->set_color(Output.fgGC, PCB->ConnectedColor); + } + else + gui->set_color(Output.fgGC, PCB->RatColor); + + if (Settings.RatThickness < 20) + rat->Thickness = pixel_slop * Settings.RatThickness; + /* rats.c set VIAFLAG if this rat goes to a containing poly: draw a donut */ + if (TEST_FLAG(VIAFLAG, rat)) { + int w = rat->Thickness; + + if (TEST_FLAG(THINDRAWFLAG, PCB)) + gui->set_line_width(Output.fgGC, 0); + else + gui->set_line_width(Output.fgGC, w); + gui->draw_arc(Output.fgGC, rat->Point1.X, rat->Point1.Y, w * 2, w * 2, 0, 360); + } + else + _draw_line((LineType *) rat); + return 1; +} + +static void _draw_arc(ArcType * arc) +{ + if (!arc->Thickness) + return; + + if (TEST_FLAG(THINDRAWFLAG, PCB)) + gui->set_line_width(Output.fgGC, 0); + else + gui->set_line_width(Output.fgGC, arc->Thickness); + gui->set_line_cap(Output.fgGC, Trace_Cap); + + gui->draw_arc(Output.fgGC, arc->X, arc->Y, arc->Width, arc->Height, arc->StartAngle, arc->Delta); +} + +static void draw_arc(LayerType * layer, ArcType * arc) +{ + const char *color; + char buf[sizeof("#XXXXXX")]; + + if (TEST_FLAG(WARNFLAG, arc)) + color = PCB->WarnColor; + else if (TEST_FLAG(SELECTEDFLAG | FOUNDFLAG, arc)) { + if (TEST_FLAG(SELECTEDFLAG, arc)) + color = layer->SelectedColor; + else + color = PCB->ConnectedColor; + } + else + color = layer->Color; + + if (TEST_FLAG(ONPOINTFLAG, arc)) { + assert(color != NULL); + LightenColor(color, buf, 1.75); + color = buf; + } + gui->set_color(Output.fgGC, color); + _draw_arc(arc); +} + +static int arc_callback(const BoxType * b, void *cl) +{ + draw_arc((LayerTypePtr) cl, (ArcTypePtr) b); + return 1; +} + +static void draw_element_package(ElementType * element) +{ + /* set color and draw lines, arcs, text and pins */ + if (doing_pinout || doing_assy) + gui->set_color(Output.fgGC, PCB->ElementColor); + else if (TEST_FLAG(SELECTEDFLAG, element)) + gui->set_color(Output.fgGC, PCB->ElementSelectedColor); + else if (FRONT(element)) + gui->set_color(Output.fgGC, PCB->ElementColor); + else + gui->set_color(Output.fgGC, PCB->InvisibleObjectsColor); + + /* draw lines, arcs, text and pins */ + ELEMENTLINE_LOOP(element); + { + _draw_line(line); + } + END_LOOP; + ARC_LOOP(element); + { + _draw_arc(arc); + } + END_LOOP; +} + +static int element_callback(const BoxType * b, void *cl) +{ + ElementTypePtr element = (ElementTypePtr) b; + int *side = cl; + + if (ON_SIDE(element, *side)) + draw_element_package(element); + return 1; +} + +/* --------------------------------------------------------------------------- + * prints assembly drawing. + */ + +static void PrintAssembly(int side, const BoxType * drawn_area) +{ + int side_group = GetLayerGroupNumberByNumber(max_copper_layer + side); + + doing_assy = true; + gui->set_draw_faded(Output.fgGC, 1); + DrawLayerGroup(side_group, drawn_area); + gui->set_draw_faded(Output.fgGC, 0); + + /* draw package */ + DrawSilk(side, drawn_area); + doing_assy = false; +} + +/* --------------------------------------------------------------------------- + * initializes some identifiers for a new zoom factor and redraws whole screen + */ +static void DrawEverything(const BoxType * drawn_area) +{ + int i, ngroups, side; + int component, solder; + /* This is the list of layer groups we will draw. */ + int do_group[MAX_LAYER]; + /* This is the reverse of the order in which we draw them. */ + int drawn_groups[MAX_LAYER]; + int plated, unplated; + bool paste_empty; + + PCB->Data->SILKLAYER.Color = PCB->ElementColor; + PCB->Data->BACKSILKLAYER.Color = PCB->InvisibleObjectsColor; + + memset(do_group, 0, sizeof(do_group)); + for (ngroups = 0, i = 0; i < max_copper_layer; i++) { + LayerType *l = LAYER_ON_STACK(i); + int group = GetLayerGroupNumberByNumber(LayerStack[i]); + if (l->On && !do_group[group]) { + do_group[group] = 1; + drawn_groups[ngroups++] = group; + } + } + + component = GetLayerGroupNumberByNumber(component_silk_layer); + solder = GetLayerGroupNumberByNumber(solder_silk_layer); + + /* + * first draw all 'invisible' stuff + */ + if (!TEST_FLAG(CHECKPLANESFLAG, PCB) + && gui->set_layer("invisible", SL(INVISIBLE, 0), 0)) { + side = SWAP_IDENT ? COMPONENT_LAYER : SOLDER_LAYER; + if (PCB->ElementOn) { + r_search(PCB->Data->element_tree, drawn_area, NULL, element_callback, &side); + r_search(PCB->Data->name_tree[NAME_INDEX(PCB)], drawn_area, NULL, name_callback, &side); + DrawLayer(&(PCB->Data->Layer[max_copper_layer + side]), drawn_area); + } + r_search(PCB->Data->pad_tree, drawn_area, NULL, pad_callback, &side); + gui->end_layer(); + } + + /* draw all layers in layerstack order */ + for (i = ngroups - 1; i >= 0; i--) { + int group = drawn_groups[i]; + + if (gui->set_layer(0, group, 0)) { + DrawLayerGroup(group, drawn_area); + gui->end_layer(); + } + } + + if (TEST_FLAG(CHECKPLANESFLAG, PCB) && gui->gui) + return; + + /* Draw pins, pads, vias below silk */ + if (gui->gui) + DrawPPV(SWAP_IDENT ? solder : component, drawn_area); + else { + CountHoles(&plated, &unplated, drawn_area); + + if (plated && gui->set_layer("plated-drill", SL(PDRILL, 0), 0)) { + DrawHoles(true, false, drawn_area); + gui->end_layer(); + } + + if (unplated && gui->set_layer("unplated-drill", SL(UDRILL, 0), 0)) { + DrawHoles(false, true, drawn_area); + gui->end_layer(); + } + } + + /* Draw the solder mask if turned on */ + if (gui->set_layer("componentmask", SL(MASK, TOP), 0)) { + DrawMask(COMPONENT_LAYER, drawn_area); + gui->end_layer(); + } + + if (gui->set_layer("soldermask", SL(MASK, BOTTOM), 0)) { + DrawMask(SOLDER_LAYER, drawn_area); + gui->end_layer(); + } + + if (gui->set_layer("topsilk", SL(SILK, TOP), 0)) { + DrawSilk(COMPONENT_LAYER, drawn_area); + gui->end_layer(); + } + + if (gui->set_layer("bottomsilk", SL(SILK, BOTTOM), 0)) { + DrawSilk(SOLDER_LAYER, drawn_area); + gui->end_layer(); + } + + if (gui->gui) { + /* Draw element Marks */ + if (PCB->PinOn) + r_search(PCB->Data->element_tree, drawn_area, NULL, EMark_callback, NULL); + /* Draw rat lines on top */ + if (gui->set_layer("rats", SL(RATS, 0), 0)) { + DrawRats(drawn_area); + gui->end_layer(); + } + } + + paste_empty = IsPasteEmpty(COMPONENT_LAYER); + if (gui->set_layer("toppaste", SL(PASTE, TOP), paste_empty)) { + DrawPaste(COMPONENT_LAYER, drawn_area); + gui->end_layer(); + } + + paste_empty = IsPasteEmpty(SOLDER_LAYER); + if (gui->set_layer("bottompaste", SL(PASTE, BOTTOM), paste_empty)) { + DrawPaste(SOLDER_LAYER, drawn_area); + gui->end_layer(); + } + + if (gui->set_layer("topassembly", SL(ASSY, TOP), 0)) { + PrintAssembly(COMPONENT_LAYER, drawn_area); + gui->end_layer(); + } + + if (gui->set_layer("bottomassembly", SL(ASSY, BOTTOM), 0)) { + PrintAssembly(SOLDER_LAYER, drawn_area); + gui->end_layer(); + } + + if (gui->set_layer("fab", SL(FAB, 0), 0)) { + PrintFab(Output.fgGC); + gui->end_layer(); + } +} + +static void DrawEMark(ElementTypePtr e, Coord X, Coord Y, bool invisible) +{ + Coord mark_size = EMARK_SIZE; + if (!PCB->InvisibleObjectsOn && invisible) + return; + + if (e->Pin != NULL) { + PinType *pin0 = e->Pin->data; + if (TEST_FLAG(HOLEFLAG, pin0)) + mark_size = MIN(mark_size, pin0->DrillingHole / 2); + else + mark_size = MIN(mark_size, pin0->Thickness / 2); + } + + if (e->Pad != NULL) { + PadType *pad0 = e->Pad->data; + mark_size = MIN(mark_size, pad0->Thickness / 2); + } + + gui->set_color(Output.fgGC, invisible ? PCB->InvisibleMarkColor : PCB->ElementColor); + gui->set_line_cap(Output.fgGC, Trace_Cap); + gui->set_line_width(Output.fgGC, 0); + gui->draw_line(Output.fgGC, X - mark_size, Y, X, Y - mark_size); + gui->draw_line(Output.fgGC, X + mark_size, Y, X, Y - mark_size); + gui->draw_line(Output.fgGC, X - mark_size, Y, X, Y + mark_size); + gui->draw_line(Output.fgGC, X + mark_size, Y, X, Y + mark_size); + + /* + * If an element is locked, place a "L" on top of the "diamond". + * This provides a nice visual indication that it is locked that + * works even for color blind users. + */ + if (TEST_FLAG(LOCKFLAG, e)) { + gui->draw_line(Output.fgGC, X, Y, X + 2 * mark_size, Y); + gui->draw_line(Output.fgGC, X, Y, X, Y - 4 * mark_size); + } +} + +/* --------------------------------------------------------------------------- + * Draws pins pads and vias - Always draws for non-gui HIDs, + * otherwise drawing depends on PCB->PinOn and PCB->ViaOn + */ +static void DrawPPV(int group, const BoxType * drawn_area) +{ + int component_group = GetLayerGroupNumberByNumber(component_silk_layer); + int solder_group = GetLayerGroupNumberByNumber(solder_silk_layer); + int side; + + if (PCB->PinOn || !gui->gui) { + /* draw element pins */ + r_search(PCB->Data->pin_tree, drawn_area, NULL, pin_callback, NULL); + + /* draw element pads */ + if (group == component_group) { + side = COMPONENT_LAYER; + r_search(PCB->Data->pad_tree, drawn_area, NULL, pad_callback, &side); + } + + if (group == solder_group) { + side = SOLDER_LAYER; + r_search(PCB->Data->pad_tree, drawn_area, NULL, pad_callback, &side); + } + } + + /* draw vias */ + if (PCB->ViaOn || !gui->gui) { + r_search(PCB->Data->via_tree, drawn_area, NULL, via_callback, NULL); + r_search(PCB->Data->via_tree, drawn_area, NULL, hole_callback, NULL); + } + if (PCB->PinOn || doing_assy) + r_search(PCB->Data->pin_tree, drawn_area, NULL, hole_callback, NULL); +} + +static int clearPin_callback(const BoxType * b, void *cl) +{ + PinType *pin = (PinTypePtr) b; + if (TEST_FLAG(THINDRAWFLAG, PCB) || TEST_FLAG(THINDRAWPOLYFLAG, PCB)) + gui->thindraw_pcb_pv(Output.pmGC, Output.pmGC, pin, false, true); + else + gui->fill_pcb_pv(Output.pmGC, Output.pmGC, pin, false, true); + return 1; +} + +struct poly_info { + const BoxType *drawn_area; + LayerType *layer; +}; + +static int poly_callback(const BoxType * b, void *cl) +{ + struct poly_info *i = cl; + PolygonType *polygon = (PolygonType *) b; + static char *color; + char buf[sizeof("#XXXXXX")]; + + if (!polygon->Clipped) + return 0; + + if (TEST_FLAG(WARNFLAG, polygon)) + color = PCB->WarnColor; + else if (TEST_FLAG(SELECTEDFLAG, polygon)) + color = i->layer->SelectedColor; + else if (TEST_FLAG(FOUNDFLAG, polygon)) + color = PCB->ConnectedColor; + else if (TEST_FLAG(ONPOINTFLAG, polygon)) { + assert(color != NULL); + LightenColor(color, buf, 1.75); + color = buf; + } + else + color = i->layer->Color; + gui->set_color(Output.fgGC, color); + + if (gui->thindraw_pcb_polygon != NULL && (TEST_FLAG(THINDRAWFLAG, PCB) || TEST_FLAG(THINDRAWPOLYFLAG, PCB))) + gui->thindraw_pcb_polygon(Output.fgGC, polygon, i->drawn_area); + else + gui->fill_pcb_polygon(Output.fgGC, polygon, i->drawn_area); + + /* If checking planes, thin-draw any pieces which have been clipped away */ + if (gui->thindraw_pcb_polygon != NULL && TEST_FLAG(CHECKPLANESFLAG, PCB) && !TEST_FLAG(FULLPOLYFLAG, polygon)) { + PolygonType poly = *polygon; + + for (poly.Clipped = polygon->Clipped->f; poly.Clipped != polygon->Clipped; poly.Clipped = poly.Clipped->f) + gui->thindraw_pcb_polygon(Output.fgGC, &poly, i->drawn_area); + } + + return 1; +} + +static int clearPad_callback(const BoxType * b, void *cl) +{ + PadTypePtr pad = (PadTypePtr) b; + int *side = cl; + if (ON_SIDE(pad, *side) && pad->Mask) + _draw_pad(Output.pmGC, pad, true, true); + return 1; +} + +/* --------------------------------------------------------------------------- + * Draws silk layer. + */ + +static void DrawSilk(int side, const BoxType * drawn_area) +{ +#if 0 + /* This code is used when you want to mask silk to avoid exposed + pins and pads. We decided it was a bad idea to do this + unconditionally, but the code remains. */ +#endif + +#if 0 + if (gui->poly_before) { + gui->use_mask(HID_MASK_BEFORE); +#endif + DrawLayer(LAYER_PTR(max_copper_layer + side), drawn_area); + /* draw package */ + r_search(PCB->Data->element_tree, drawn_area, NULL, element_callback, &side); + r_search(PCB->Data->name_tree[NAME_INDEX(PCB)], drawn_area, NULL, name_callback, &side); +#if 0 + } + + gui->use_mask(HID_MASK_CLEAR); + r_search(PCB->Data->pin_tree, drawn_area, NULL, clearPin_callback, NULL); + r_search(PCB->Data->via_tree, drawn_area, NULL, clearPin_callback, NULL); + r_search(PCB->Data->pad_tree, drawn_area, NULL, clearPad_callback, &side); + + if (gui->poly_after) { + gui->use_mask(HID_MASK_AFTER); + DrawLayer(LAYER_PTR(max_copper_layer + layer), drawn_area); + /* draw package */ + r_search(PCB->Data->element_tree, drawn_area, NULL, element_callback, &side); + r_search(PCB->Data->name_tree[NAME_INDEX(PCB)], drawn_area, NULL, name_callback, &side); + } + gui->use_mask(HID_MASK_OFF); +#endif +} + + +static void DrawMaskBoardArea(int mask_type, const BoxType * drawn_area) +{ + /* Skip the mask drawing if the GUI doesn't want this type */ + if ((mask_type == HID_MASK_BEFORE && !gui->poly_before) || (mask_type == HID_MASK_AFTER && !gui->poly_after)) + return; + + gui->use_mask(mask_type); + gui->set_color(Output.fgGC, PCB->MaskColor); + if (drawn_area == NULL) + gui->fill_rect(Output.fgGC, 0, 0, PCB->MaxWidth, PCB->MaxHeight); + else + gui->fill_rect(Output.fgGC, drawn_area->X1, drawn_area->Y1, drawn_area->X2, drawn_area->Y2); +} + +/* --------------------------------------------------------------------------- + * draws solder mask layer - this will cover nearly everything + */ +static void DrawMask(int side, const BoxType * screen) +{ + int thin = TEST_FLAG(THINDRAWFLAG, PCB) || TEST_FLAG(THINDRAWPOLYFLAG, PCB); + + if (thin) + gui->set_color(Output.pmGC, PCB->MaskColor); + else { + DrawMaskBoardArea(HID_MASK_BEFORE, screen); + gui->use_mask(HID_MASK_CLEAR); + } + + r_search(PCB->Data->pin_tree, screen, NULL, clearPin_callback, NULL); + r_search(PCB->Data->via_tree, screen, NULL, clearPin_callback, NULL); + r_search(PCB->Data->pad_tree, screen, NULL, clearPad_callback, &side); + + if (thin) + gui->set_color(Output.pmGC, "erase"); + else { + DrawMaskBoardArea(HID_MASK_AFTER, screen); + gui->use_mask(HID_MASK_OFF); + } +} + +/* --------------------------------------------------------------------------- + * draws solder paste layer for a given side of the board + */ +static void DrawPaste(int side, const BoxType * drawn_area) +{ + gui->set_color(Output.fgGC, PCB->ElementColor); + ALLPAD_LOOP(PCB->Data); + { + if (ON_SIDE(pad, side) && !TEST_FLAG(NOPASTEFLAG, pad) && pad->Mask > 0) { + if (pad->Mask < pad->Thickness) + _draw_pad(Output.fgGC, pad, true, true); + else + _draw_pad(Output.fgGC, pad, false, false); + } + } + ENDALL_LOOP; +} + +static void DrawRats(const BoxType * drawn_area) +{ + /* + * XXX lesstif allows positive AND negative drawing in HID_MASK_CLEAR. + * XXX gtk only allows negative drawing. + * XXX using the mask here is to get rat transparency + */ + int can_mask = strcmp(gui->name, "lesstif") == 0; + + if (can_mask) + gui->use_mask(HID_MASK_CLEAR); + r_search(PCB->Data->rat_tree, drawn_area, NULL, rat_callback, NULL); + if (can_mask) + gui->use_mask(HID_MASK_OFF); +} + +static int text_callback(const BoxType * b, void *cl) +{ + LayerType *layer = cl; + TextType *text = (TextType *) b; + int min_silk_line; + + if (TEST_FLAG(SELECTEDFLAG, text)) + gui->set_color(Output.fgGC, layer->SelectedColor); + else + gui->set_color(Output.fgGC, layer->Color); + if (layer == &PCB->Data->SILKLAYER || layer == &PCB->Data->BACKSILKLAYER) + min_silk_line = PCB->minSlk; + else + min_silk_line = PCB->minWid; + DrawTextLowLevel(text, min_silk_line); + return 1; +} + +void DrawLayer(LayerTypePtr Layer, const BoxType * screen) +{ + struct poly_info info = { screen, Layer }; + + /* print the non-clearing polys */ + r_search(Layer->polygon_tree, screen, NULL, poly_callback, &info); + + if (TEST_FLAG(CHECKPLANESFLAG, PCB)) + return; + + /* draw all visible lines this layer */ + r_search(Layer->line_tree, screen, NULL, line_callback, Layer); + + /* draw the layer arcs on screen */ + r_search(Layer->arc_tree, screen, NULL, arc_callback, Layer); + + /* draw the layer text on screen */ + r_search(Layer->text_tree, screen, NULL, text_callback, Layer); + + /* We should check for gui->gui here, but it's kinda cool seeing the + auto-outline magically disappear when you first add something to + the "outline" layer. */ + if (IsLayerEmpty(Layer) + && (strcmp(Layer->Name, "outline") == 0 || strcmp(Layer->Name, "route") == 0)) { + gui->set_color(Output.fgGC, Layer->Color); + gui->set_line_width(Output.fgGC, PCB->minWid); + gui->draw_rect(Output.fgGC, 0, 0, PCB->MaxWidth, PCB->MaxHeight); + } +} + +/* --------------------------------------------------------------------------- + * draws one layer group. If the exporter is not a GUI, + * also draws the pins / pads / vias in this layer group. + */ +static void DrawLayerGroup(int group, const BoxType * drawn_area) +{ + int i, rv = 1; + int layernum; + LayerTypePtr Layer; + int n_entries = PCB->LayerGroups.Number[group]; + Cardinal *layers = PCB->LayerGroups.Entries[group]; + + for (i = n_entries - 1; i >= 0; i--) { + layernum = layers[i]; + Layer = PCB->Data->Layer + layers[i]; + if (strcmp(Layer->Name, "outline") == 0 || strcmp(Layer->Name, "route") == 0) + rv = 0; + if (layernum < max_copper_layer && Layer->On) + DrawLayer(Layer, drawn_area); + } + if (n_entries > 1) + rv = 1; + + if (rv && !gui->gui) + DrawPPV(group, drawn_area); +} + +static void GatherPVName(PinTypePtr Ptr) +{ + BoxType box; + bool vert = TEST_FLAG(EDGE2FLAG, Ptr); + + if (vert) { + box.X1 = Ptr->X - Ptr->Thickness / 2 + Settings.PinoutTextOffsetY; + box.Y1 = Ptr->Y - Ptr->DrillingHole / 2 - Settings.PinoutTextOffsetX; + } + else { + box.X1 = Ptr->X + Ptr->DrillingHole / 2 + Settings.PinoutTextOffsetX; + box.Y1 = Ptr->Y - Ptr->Thickness / 2 + Settings.PinoutTextOffsetY; + } + + if (vert) { + box.X2 = box.X1; + box.Y2 = box.Y1; + } + else { + box.X2 = box.X1; + box.Y2 = box.Y1; + } + AddPart(&box); +} + +static void GatherPadName(PadTypePtr Pad) +{ + BoxType box; + bool vert; + + /* should text be vertical ? */ + vert = (Pad->Point1.X == Pad->Point2.X); + + if (vert) { + box.X1 = Pad->Point1.X - Pad->Thickness / 2; + box.Y1 = MAX(Pad->Point1.Y, Pad->Point2.Y) + Pad->Thickness / 2; + box.X1 += Settings.PinoutTextOffsetY; + box.Y1 -= Settings.PinoutTextOffsetX; + box.X2 = box.X1; + box.Y2 = box.Y1; + } + else { + box.X1 = MIN(Pad->Point1.X, Pad->Point2.X) - Pad->Thickness / 2; + box.Y1 = Pad->Point1.Y - Pad->Thickness / 2; + box.X1 += Settings.PinoutTextOffsetX; + box.Y1 += Settings.PinoutTextOffsetY; + box.X2 = box.X1; + box.Y2 = box.Y1; + } + + AddPart(&box); + return; +} + +/* --------------------------------------------------------------------------- + * lowlevel drawing routine for text objects + */ +void DrawTextLowLevel(TextTypePtr Text, Coord min_line_width) +{ + Coord x = 0; + unsigned char *string = (unsigned char *) Text->TextString; + Cardinal n; + FontTypePtr font = &PCB->Font; + + while (string && *string) { + /* draw lines if symbol is valid and data is present */ + if (*string <= MAX_FONTPOSITION && font->Symbol[*string].Valid) { + LineTypePtr line = font->Symbol[*string].Line; + LineType newline; + + for (n = font->Symbol[*string].LineN; n; n--, line++) { + /* create one line, scale, move, rotate and swap it */ + newline = *line; + newline.Point1.X = SCALE_TEXT(newline.Point1.X + x, Text->Scale); + newline.Point1.Y = SCALE_TEXT(newline.Point1.Y, Text->Scale); + newline.Point2.X = SCALE_TEXT(newline.Point2.X + x, Text->Scale); + newline.Point2.Y = SCALE_TEXT(newline.Point2.Y, Text->Scale); + newline.Thickness = SCALE_TEXT(newline.Thickness, Text->Scale / 2); + if (newline.Thickness < min_line_width) + newline.Thickness = min_line_width; + + RotateLineLowLevel(&newline, 0, 0, Text->Direction); + + /* the labels of SMD objects on the bottom + * side haven't been swapped yet, only their offset + */ + if (TEST_FLAG(ONSOLDERFLAG, Text)) { + newline.Point1.X = SWAP_SIGN_X(newline.Point1.X); + newline.Point1.Y = SWAP_SIGN_Y(newline.Point1.Y); + newline.Point2.X = SWAP_SIGN_X(newline.Point2.X); + newline.Point2.Y = SWAP_SIGN_Y(newline.Point2.Y); + } + /* add offset and draw line */ + newline.Point1.X += Text->X; + newline.Point1.Y += Text->Y; + newline.Point2.X += Text->X; + newline.Point2.Y += Text->Y; + _draw_line(&newline); + } + + /* move on to next cursor position */ + x += (font->Symbol[*string].Width + font->Symbol[*string].Delta); + } + else { + /* the default symbol is a filled box */ + BoxType defaultsymbol = PCB->Font.DefaultSymbol; + Coord size = (defaultsymbol.X2 - defaultsymbol.X1) * 6 / 5; + + defaultsymbol.X1 = SCALE_TEXT(defaultsymbol.X1 + x, Text->Scale); + defaultsymbol.Y1 = SCALE_TEXT(defaultsymbol.Y1, Text->Scale); + defaultsymbol.X2 = SCALE_TEXT(defaultsymbol.X2 + x, Text->Scale); + defaultsymbol.Y2 = SCALE_TEXT(defaultsymbol.Y2, Text->Scale); + + RotateBoxLowLevel(&defaultsymbol, 0, 0, Text->Direction); + + /* add offset and draw box */ + defaultsymbol.X1 += Text->X; + defaultsymbol.Y1 += Text->Y; + defaultsymbol.X2 += Text->X; + defaultsymbol.Y2 += Text->Y; + gui->fill_rect(Output.fgGC, defaultsymbol.X1, defaultsymbol.Y1, defaultsymbol.X2, defaultsymbol.Y2); + + /* move on to next cursor position */ + x += size; + } + string++; + } +} + +/* --------------------------------------------------------------------------- + * draw a via object + */ +void DrawVia(PinTypePtr Via) +{ + AddPart(Via); + if (!TEST_FLAG(HOLEFLAG, Via) && TEST_FLAG(DISPLAYNAMEFLAG, Via)) + DrawViaName(Via); +} + +/* --------------------------------------------------------------------------- + * draws the name of a via + */ +void DrawViaName(PinTypePtr Via) +{ + GatherPVName(Via); +} + +/* --------------------------------------------------------------------------- + * draw a pin object + */ +void DrawPin(PinTypePtr Pin) +{ + AddPart(Pin); + if ((!TEST_FLAG(HOLEFLAG, Pin) && TEST_FLAG(DISPLAYNAMEFLAG, Pin)) + || doing_pinout) + DrawPinName(Pin); +} + +/* --------------------------------------------------------------------------- + * draws the name of a pin + */ +void DrawPinName(PinTypePtr Pin) +{ + GatherPVName(Pin); +} + +/* --------------------------------------------------------------------------- + * draw a pad object + */ +void DrawPad(PadTypePtr Pad) +{ + AddPart(Pad); + if (doing_pinout || TEST_FLAG(DISPLAYNAMEFLAG, Pad)) + DrawPadName(Pad); +} + +/* --------------------------------------------------------------------------- + * draws the name of a pad + */ +void DrawPadName(PadTypePtr Pad) +{ + GatherPadName(Pad); +} + +/* --------------------------------------------------------------------------- + * draws a line on a layer + */ +void DrawLine(LayerTypePtr Layer, LineTypePtr Line) +{ + AddPart(Line); +} + +/* --------------------------------------------------------------------------- + * draws a ratline + */ +void DrawRat(RatTypePtr Rat) +{ + if (Settings.RatThickness < 20) + Rat->Thickness = pixel_slop * Settings.RatThickness; + /* rats.c set VIAFLAG if this rat goes to a containing poly: draw a donut */ + if (TEST_FLAG(VIAFLAG, Rat)) { + Coord w = Rat->Thickness; + + BoxType b; + + b.X1 = Rat->Point1.X - w * 2 - w / 2; + b.X2 = Rat->Point1.X + w * 2 + w / 2; + b.Y1 = Rat->Point1.Y - w * 2 - w / 2; + b.Y2 = Rat->Point1.Y + w * 2 + w / 2; + AddPart(&b); + } + else + DrawLine(NULL, (LineType *) Rat); +} + +/* --------------------------------------------------------------------------- + * draws an arc on a layer + */ +void DrawArc(LayerTypePtr Layer, ArcTypePtr Arc) +{ + AddPart(Arc); +} + +/* --------------------------------------------------------------------------- + * draws a text on a layer + */ +void DrawText(LayerTypePtr Layer, TextTypePtr Text) +{ + AddPart(Text); +} + + +/* --------------------------------------------------------------------------- + * draws a polygon on a layer + */ +void DrawPolygon(LayerTypePtr Layer, PolygonTypePtr Polygon) +{ + AddPart(Polygon); +} + +/* --------------------------------------------------------------------------- + * draws an element + */ +void DrawElement(ElementTypePtr Element) +{ + DrawElementPackage(Element); + DrawElementName(Element); + DrawElementPinsAndPads(Element); +} + +/* --------------------------------------------------------------------------- + * draws the name of an element + */ +void DrawElementName(ElementTypePtr Element) +{ + if (TEST_FLAG(HIDENAMEFLAG, Element)) + return; + DrawText(NULL, &ELEMENT_TEXT(PCB, Element)); +} + +/* --------------------------------------------------------------------------- + * draws the package of an element + */ +void DrawElementPackage(ElementTypePtr Element) +{ + ELEMENTLINE_LOOP(Element); + { + DrawLine(NULL, line); + } + END_LOOP; + ARC_LOOP(Element); + { + DrawArc(NULL, arc); + } + END_LOOP; +} + +/* --------------------------------------------------------------------------- + * draw pins of an element + */ +void DrawElementPinsAndPads(ElementTypePtr Element) +{ + PAD_LOOP(Element); + { + if (doing_pinout || doing_assy || FRONT(pad) || PCB->InvisibleObjectsOn) + DrawPad(pad); + } + END_LOOP; + PIN_LOOP(Element); + { + DrawPin(pin); + } + END_LOOP; +} + +void EraseFlags(FlagType * f) +{ + unknown_flag_t *u, *next; + for (u = f->unknowns; u != NULL; u = next) { + free(u->str); + next = u->next; + free(u); + } + f->unknowns = NULL; +} + +/* --------------------------------------------------------------------------- + * erase a via + */ +void EraseVia(PinTypePtr Via) +{ + AddPart(Via); + if (TEST_FLAG(DISPLAYNAMEFLAG, Via)) + EraseViaName(Via); + EraseFlags(&Via->Flags); +} + +/* --------------------------------------------------------------------------- + * erase a ratline + */ +void EraseRat(RatTypePtr Rat) +{ + if (TEST_FLAG(VIAFLAG, Rat)) { + Coord w = Rat->Thickness; + + BoxType b; + + b.X1 = Rat->Point1.X - w * 2 - w / 2; + b.X2 = Rat->Point1.X + w * 2 + w / 2; + b.Y1 = Rat->Point1.Y - w * 2 - w / 2; + b.Y2 = Rat->Point1.Y + w * 2 + w / 2; + AddPart(&b); + } + else + EraseLine((LineType *) Rat); + EraseFlags(&Rat->Flags); +} + + +/* --------------------------------------------------------------------------- + * erase a via name + */ +void EraseViaName(PinTypePtr Via) +{ + GatherPVName(Via); +} + +/* --------------------------------------------------------------------------- + * erase a pad object + */ +void ErasePad(PadTypePtr Pad) +{ + AddPart(Pad); + if (TEST_FLAG(DISPLAYNAMEFLAG, Pad)) + ErasePadName(Pad); + EraseFlags(&Pad->Flags); +} + +/* --------------------------------------------------------------------------- + * erase a pad name + */ +void ErasePadName(PadTypePtr Pad) +{ + GatherPadName(Pad); +} + +/* --------------------------------------------------------------------------- + * erase a pin object + */ +void ErasePin(PinTypePtr Pin) +{ + AddPart(Pin); + if (TEST_FLAG(DISPLAYNAMEFLAG, Pin)) + ErasePinName(Pin); + EraseFlags(&Pin->Flags); +} + +/* --------------------------------------------------------------------------- + * erase a pin name + */ +void ErasePinName(PinTypePtr Pin) +{ + GatherPVName(Pin); +} + +/* --------------------------------------------------------------------------- + * erases a line on a layer + */ +void EraseLine(LineTypePtr Line) +{ + AddPart(Line); + EraseFlags(&Line->Flags); +} + +/* --------------------------------------------------------------------------- + * erases an arc on a layer + */ +void EraseArc(ArcTypePtr Arc) +{ + if (!Arc->Thickness) + return; + AddPart(Arc); + EraseFlags(&Arc->Flags); +} + +/* --------------------------------------------------------------------------- + * erases a text on a layer + */ +void EraseText(LayerTypePtr Layer, TextTypePtr Text) +{ + AddPart(Text); +} + +/* --------------------------------------------------------------------------- + * erases a polygon on a layer + */ +void ErasePolygon(PolygonTypePtr Polygon) +{ + AddPart(Polygon); + EraseFlags(&Polygon->Flags); +} + +/* --------------------------------------------------------------------------- + * erases an element + */ +void EraseElement(ElementTypePtr Element) +{ + ELEMENTLINE_LOOP(Element); + { + EraseLine(line); + } + END_LOOP; + ARC_LOOP(Element); + { + EraseArc(arc); + } + END_LOOP; + EraseElementName(Element); + EraseElementPinsAndPads(Element); + EraseFlags(&Element->Flags); +} + +/* --------------------------------------------------------------------------- + * erases all pins and pads of an element + */ +void EraseElementPinsAndPads(ElementTypePtr Element) +{ + PIN_LOOP(Element); + { + ErasePin(pin); + } + END_LOOP; + PAD_LOOP(Element); + { + ErasePad(pad); + } + END_LOOP; +} + +/* --------------------------------------------------------------------------- + * erases the name of an element + */ +void EraseElementName(ElementTypePtr Element) +{ + if (TEST_FLAG(HIDENAMEFLAG, Element)) + return; + DrawText(NULL, &ELEMENT_TEXT(PCB, Element)); +} + + +void EraseObject(int type, void *lptr, void *ptr) +{ + switch (type) { + case VIA_TYPE: + case PIN_TYPE: + ErasePin((PinTypePtr) ptr); + break; + case TEXT_TYPE: + case ELEMENTNAME_TYPE: + EraseText((LayerTypePtr) lptr, (TextTypePtr) ptr); + break; + case POLYGON_TYPE: + ErasePolygon((PolygonTypePtr) ptr); + break; + case ELEMENT_TYPE: + EraseElement((ElementTypePtr) ptr); + break; + case LINE_TYPE: + case ELEMENTLINE_TYPE: + case RATLINE_TYPE: + EraseLine((LineTypePtr) ptr); + break; + case PAD_TYPE: + ErasePad((PadTypePtr) ptr); + break; + case ARC_TYPE: + case ELEMENTARC_TYPE: + EraseArc((ArcTypePtr) ptr); + break; + default: + Message("hace: Internal ERROR, trying to erase an unknown type\n"); + } +} + + +void DrawObject(int type, void *ptr1, void *ptr2) +{ + switch (type) { + case VIA_TYPE: + if (PCB->ViaOn) + DrawVia((PinTypePtr) ptr2); + break; + case LINE_TYPE: + if (((LayerTypePtr) ptr1)->On) + DrawLine((LayerTypePtr) ptr1, (LineTypePtr) ptr2); + break; + case ARC_TYPE: + if (((LayerTypePtr) ptr1)->On) + DrawArc((LayerTypePtr) ptr1, (ArcTypePtr) ptr2); + break; + case TEXT_TYPE: + if (((LayerTypePtr) ptr1)->On) + DrawText((LayerTypePtr) ptr1, (TextTypePtr) ptr2); + break; + case POLYGON_TYPE: + if (((LayerTypePtr) ptr1)->On) + DrawPolygon((LayerTypePtr) ptr1, (PolygonTypePtr) ptr2); + break; + case ELEMENT_TYPE: + if (PCB->ElementOn && (FRONT((ElementTypePtr) ptr2) || PCB->InvisibleObjectsOn)) + DrawElement((ElementTypePtr) ptr2); + break; + case RATLINE_TYPE: + if (PCB->RatOn) + DrawRat((RatTypePtr) ptr2); + break; + case PIN_TYPE: + if (PCB->PinOn) + DrawPin((PinTypePtr) ptr2); + break; + case PAD_TYPE: + if (PCB->PinOn) + DrawPad((PadTypePtr) ptr2); + break; + case ELEMENTNAME_TYPE: + if (PCB->ElementOn && (FRONT((ElementTypePtr) ptr2) || PCB->InvisibleObjectsOn)) + DrawElementName((ElementTypePtr) ptr1); + break; + } +} + +static void draw_element(ElementTypePtr element) +{ + draw_element_package(element); + draw_element_name(element); + draw_element_pins_and_pads(element); +} + +/* --------------------------------------------------------------------------- + * HID drawing callback. + */ + +void hid_expose_callback(HID * hid, BoxType * region, void *item) +{ + HID *old_gui = gui; + + gui = hid; + Output.fgGC = gui->make_gc(); + Output.bgGC = gui->make_gc(); + Output.pmGC = gui->make_gc(); + + hid->set_color(Output.pmGC, "erase"); + hid->set_color(Output.bgGC, "drill"); + + if (item) { + doing_pinout = true; + draw_element((ElementType *) item); + doing_pinout = false; + } + else + DrawEverything(region); + + gui->destroy_gc(Output.fgGC); + gui->destroy_gc(Output.bgGC); + gui->destroy_gc(Output.pmGC); + gui = old_gui; +} Index: 1.0.8/src/draw.h =================================================================== --- 1.0.8/src/draw.h (nonexistent) +++ 1.0.8/src/draw.h (revision 1136) @@ -0,0 +1,74 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996, 2004 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + * RCS: $Id$ + */ + +/* prototypes for drawing routines + */ + +#ifndef PCB_DRAW_H +#define PCB_DRAW_H + +#include "global.h" + +/*bool SwitchDrawingWindow(double, GdkDrawable *, gboolean, gboolean);*/ + +void Draw(void); +void Redraw(void); +void DrawVia(PinTypePtr); +void DrawRat(RatTypePtr); +void DrawViaName(PinTypePtr); +void DrawPin(PinTypePtr); +void DrawPinName(PinTypePtr); +void DrawPad(PadTypePtr); +void DrawPadName(PadTypePtr); +void DrawLine(LayerTypePtr, LineTypePtr); +void DrawArc(LayerTypePtr, ArcTypePtr); +void DrawText(LayerTypePtr, TextTypePtr); +void DrawTextLowLevel(TextTypePtr, Coord); +void DrawPolygon(LayerTypePtr, PolygonTypePtr); +void DrawElement(ElementTypePtr); +void DrawElementName(ElementTypePtr); +void DrawElementPackage(ElementTypePtr); +void DrawElementPinsAndPads(ElementTypePtr); +void DrawObject(int, void *, void *); +void DrawLayer(LayerTypePtr, const BoxType *); +void EraseVia(PinTypePtr); +void EraseRat(RatTypePtr); +void EraseViaName(PinTypePtr); +void ErasePad(PadTypePtr); +void ErasePadName(PadTypePtr); +void ErasePin(PinTypePtr); +void ErasePinName(PinTypePtr); +void EraseLine(LineTypePtr); +void EraseArc(ArcTypePtr); +void EraseText(LayerTypePtr, TextTypePtr); +void ErasePolygon(PolygonTypePtr); +void EraseElement(ElementTypePtr); +void EraseElementPinsAndPads(ElementTypePtr); +void EraseElementName(ElementTypePtr); +void EraseObject(int, void *, void *); + +#endif Index: 1.0.8/src/drill.c =================================================================== --- 1.0.8/src/drill.c (nonexistent) +++ 1.0.8/src/drill.c (revision 1136) @@ -0,0 +1,254 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * This module, drill.c, was written and is Copyright (C) 1997 harry eaton + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ +#include "config.h" + + +#include "data.h" +#include "error.h" +#include "mymem.h" + + +RCSID("$Id$"); + + + + +/* + * some local prototypes + */ +static void FillDrill(DrillTypePtr, ElementTypePtr, PinTypePtr); +static void InitializeDrill(DrillTypePtr, PinTypePtr, ElementTypePtr); + + +static void FillDrill(DrillTypePtr Drill, ElementTypePtr Element, PinTypePtr Pin) +{ + Cardinal n; + ElementTypeHandle ptr; + PinTypeHandle pin; + + pin = GetDrillPinMemory(Drill); + *pin = Pin; + if (Element) { + Drill->PinCount++; + for (n = Drill->ElementN - 1; n != -1; n--) + if (Drill->Element[n] == Element) + break; + if (n == -1) { + ptr = GetDrillElementMemory(Drill); + *ptr = Element; + } + } + else + Drill->ViaCount++; + if (TEST_FLAG(HOLEFLAG, Pin)) + Drill->UnplatedCount++; +} + +static void InitializeDrill(DrillTypePtr drill, PinTypePtr pin, ElementTypePtr element) +{ + void *ptr; + + drill->DrillSize = pin->DrillingHole; + drill->ElementN = 0; + drill->ViaCount = 0; + drill->PinCount = 0; + drill->UnplatedCount = 0; + drill->ElementMax = 0; + drill->Element = NULL; + drill->PinN = 0; + drill->Pin = NULL; + drill->PinMax = 0; + ptr = (void *) GetDrillPinMemory(drill); + *((PinTypeHandle) ptr) = pin; + if (element) { + ptr = (void *) GetDrillElementMemory(drill); + *((ElementTypeHandle) ptr) = element; + drill->PinCount = 1; + } + else + drill->ViaCount = 1; + if (TEST_FLAG(HOLEFLAG, pin)) + drill->UnplatedCount = 1; +} + +static int DrillQSort(const void *va, const void *vb) +{ + DrillType *a = (DrillType *) va; + DrillType *b = (DrillType *) vb; + return a->DrillSize - b->DrillSize; +} + +DrillInfoTypePtr GetDrillInfo(DataTypePtr top) +{ + DrillInfoTypePtr AllDrills; + DrillTypePtr Drill = NULL; + DrillType savedrill, swapdrill; + bool DrillFound = false; + bool NewDrill; + + AllDrills = (DrillInfoTypePtr) calloc(1, sizeof(DrillInfoType)); + ALLPIN_LOOP(top); + { + if (!DrillFound) { + DrillFound = true; + Drill = GetDrillInfoDrillMemory(AllDrills); + InitializeDrill(Drill, pin, element); + } + else { + if (Drill->DrillSize == pin->DrillingHole) + FillDrill(Drill, element, pin); + else { + NewDrill = false; + DRILL_LOOP(AllDrills); + { + if (drill->DrillSize == pin->DrillingHole) { + Drill = drill; + FillDrill(Drill, element, pin); + break; + } + else if (drill->DrillSize > pin->DrillingHole) { + if (!NewDrill) { + NewDrill = true; + InitializeDrill(&swapdrill, pin, element); + Drill = GetDrillInfoDrillMemory(AllDrills); + Drill->DrillSize = pin->DrillingHole + 1; + Drill = drill; + } + savedrill = *drill; + *drill = swapdrill; + swapdrill = savedrill; + } + } + END_LOOP; + if (AllDrills->Drill[AllDrills->DrillN - 1].DrillSize < pin->DrillingHole) { + Drill = GetDrillInfoDrillMemory(AllDrills); + InitializeDrill(Drill, pin, element); + } + } + } + } + ENDALL_LOOP; + VIA_LOOP(top); + { + if (!DrillFound) { + DrillFound = true; + Drill = GetDrillInfoDrillMemory(AllDrills); + Drill->DrillSize = via->DrillingHole; + FillDrill(Drill, NULL, via); + } + else { + if (Drill->DrillSize != via->DrillingHole) { + DRILL_LOOP(AllDrills); + { + if (drill->DrillSize == via->DrillingHole) { + Drill = drill; + FillDrill(Drill, NULL, via); + break; + } + } + END_LOOP; + if (Drill->DrillSize != via->DrillingHole) { + Drill = GetDrillInfoDrillMemory(AllDrills); + Drill->DrillSize = via->DrillingHole; + FillDrill(Drill, NULL, via); + } + } + else + FillDrill(Drill, NULL, via); + } + } + END_LOOP; + qsort(AllDrills->Drill, AllDrills->DrillN, sizeof(DrillType), DrillQSort); + return (AllDrills); +} + +#define ROUND(x,n) ((int)(((x)+(n)/2)/(n))*(n)) + +void RoundDrillInfo(DrillInfoTypePtr d, int roundto) +{ + unsigned int i = 0; + + while ((d->DrillN > 0) && (i < d->DrillN - 1)) { + int diam1 = ROUND(d->Drill[i].DrillSize, roundto); + int diam2 = ROUND(d->Drill[i + 1].DrillSize, roundto); + + if (diam1 == diam2) { + int ei, ej; + + d->Drill[i].ElementMax = d->Drill[i].ElementN + d->Drill[i + 1].ElementN; + if (d->Drill[i].ElementMax) { + d->Drill[i].Element = (ElementTypePtr *) realloc(d->Drill[i].Element, d->Drill[i].ElementMax * sizeof(ElementTypePtr)); + + for (ei = 0; ei < d->Drill[i + 1].ElementN; ei++) { + for (ej = 0; ej < d->Drill[i].ElementN; ej++) + if (d->Drill[i].Element[ej] == d->Drill[i + 1].Element[ei]) + break; + if (ej == d->Drill[i].ElementN) + d->Drill[i].Element[d->Drill[i].ElementN++] + = d->Drill[i + 1].Element[ei]; + } + } + free(d->Drill[i + 1].Element); + d->Drill[i + 1].Element = NULL; + + d->Drill[i].PinMax = d->Drill[i].PinN + d->Drill[i + 1].PinN; + d->Drill[i].Pin = (PinTypePtr *) realloc(d->Drill[i].Pin, d->Drill[i].PinMax * sizeof(PinTypePtr)); + memcpy(d->Drill[i].Pin + d->Drill[i].PinN, d->Drill[i + 1].Pin, d->Drill[i + 1].PinN * sizeof(PinTypePtr)); + d->Drill[i].PinN += d->Drill[i + 1].PinN; + free(d->Drill[i + 1].Pin); + d->Drill[i + 1].Pin = NULL; + + d->Drill[i].PinCount += d->Drill[i + 1].PinCount; + d->Drill[i].ViaCount += d->Drill[i + 1].ViaCount; + d->Drill[i].UnplatedCount += d->Drill[i + 1].UnplatedCount; + + d->Drill[i].DrillSize = diam1; + + memmove(d->Drill + i + 1, d->Drill + i + 2, (d->DrillN - i - 2) * sizeof(DrillType)); + d->DrillN--; + } + else { + d->Drill[i].DrillSize = diam1; + i++; + } + } +} + +void FreeDrillInfo(DrillInfoTypePtr Drills) +{ + DRILL_LOOP(Drills); + { + free(drill->Element); + free(drill->Pin); + } + END_LOOP; + free(Drills->Drill); + free(Drills); +} Index: 1.0.8/src/drill.h =================================================================== --- 1.0.8/src/drill.h (nonexistent) +++ 1.0.8/src/drill.h (revision 1136) @@ -0,0 +1,33 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * This module, drill.h, was written and is Copyright (C) 1997 harry eaton + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +DrillInfoTypePtr GetDrillInfo(DataTypePtr); +void FreeDrillInfo(DrillInfoTypePtr); +void RoundDrillInfo(DrillInfoTypePtr, int); Index: 1.0.8/src/ds.c =================================================================== --- 1.0.8/src/ds.c (nonexistent) +++ 1.0.8/src/ds.c (revision 1136) @@ -0,0 +1,50 @@ +#include +#include + +/* --------------------------------------------------------------------------- + * reallocates memory for a dynamic length string if necessary + */ +static void DSRealloc(DynamicStringTypePtr Ptr, size_t Length) +{ + int input_null = (Ptr->Data == NULL); + if (input_null || Length >= Ptr->MaxLength) { + Ptr->MaxLength = Length + 512; + Ptr->Data = (char *) realloc(Ptr->Data, Ptr->MaxLength); + if (input_null) + Ptr->Data[0] = '\0'; + } +} + +/* --------------------------------------------------------------------------- + * adds one character to a dynamic string + */ +void DSAddCharacter(DynamicStringTypePtr Ptr, char Char) +{ + size_t position = Ptr->Data ? strlen(Ptr->Data) : 0; + + DSRealloc(Ptr, position + 1); + Ptr->Data[position++] = Char; + Ptr->Data[position] = '\0'; +} + +/* --------------------------------------------------------------------------- + * add a string to a dynamic string + */ +void DSAddString(DynamicStringTypePtr Ptr, const char *S) +{ + size_t position = Ptr->Data ? strlen(Ptr->Data) : 0; + + if (S && *S) { + DSRealloc(Ptr, position + 1 + strlen(S)); + strcat(&Ptr->Data[position], S); + } +} + +/* ---------------------------------------------------------------------- + * clears a dynamic string + */ +void DSClearString(DynamicStringTypePtr Ptr) +{ + if (Ptr->Data) + Ptr->Data[0] = '\0'; +} Index: 1.0.8/src/ds.h =================================================================== --- 1.0.8/src/ds.h (nonexistent) +++ 1.0.8/src/ds.h (revision 1136) @@ -0,0 +1,10 @@ +#include + +typedef struct { + size_t MaxLength; + char *Data; +} DynamicStringType, *DynamicStringTypePtr; + +void DSAddCharacter(DynamicStringTypePtr, char); +void DSAddString(DynamicStringTypePtr, const char *); +void DSClearString(DynamicStringTypePtr); Index: 1.0.8/src/error.c =================================================================== --- 1.0.8/src/error.c (nonexistent) +++ 1.0.8/src/error.c (revision 1136) @@ -0,0 +1,225 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996, 2005 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + + +/* error and debug functions + * getpid() needs a cast to (int) to get rid of compiler warnings + * on several architectures + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_STDARG_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#include + +#include "global.h" + +#include "data.h" +#include "error.h" +#include "file.h" + +#include "misc.h" + + +RCSID("$Id$"); + + +#define utf8_dup_string(a,b) *(a) = strdup(b) + +/* ---------------------------------------------------------------------- + * some external identifiers + */ + +#if !defined(HAVE_STRERROR) +extern int sys_nerr; /* number of messages available from array */ +#define USE_SYS_ERRLIST +#endif + +/* the list is already defined for some OS */ +#if !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__linux__) && !defined(__DragonFly__) +#ifdef USE_SYS_ERRLIST +extern char *sys_errlist[]; /* array of error messages */ +#endif +#endif + + +/* --------------------------------------------------------------------------- + * output of message in a dialog window or log window + */ +void Message(const char *Format, ...) +{ + va_list args; + + if (gui != NULL) { + va_start(args, Format); + gui->logv(Format, args); + va_end(args); + } + +#ifdef HAVE_STDARG_H + va_start(args, Format); + vfprintf(stderr, Format, args); + va_end(args); +#endif +} + + +/* --------------------------------------------------------------------------- + * print standard 'open error' + */ +void OpenErrorMessage(const char *Filename) +{ + char *utf8 = NULL; + + utf8_dup_string(&utf8, Filename); +#ifdef USE_SYS_ERRLIST + Message(_("Can't open file\n" " '%s'\nfopen() returned: '%s'\n"), utf8, errno <= sys_nerr ? sys_errlist[errno] : "???"); +#else + Message(_("Can't open file\n" " '%s'\nfopen() returned: '%s'\n"), utf8, strerror(errno)); +#endif + free(utf8); +} + +/* --------------------------------------------------------------------------- + * print standard 'popen error' + */ +void PopenErrorMessage(const char *Filename) +{ + char *utf8 = NULL; + + utf8_dup_string(&utf8, Filename); +#ifdef USE_SYS_ERRLIST + Message(_("Can't execute command\n" + " '%s'\npopen() returned: '%s'\n"), utf8, errno <= sys_nerr ? sys_errlist[errno] : "???"); +#else + Message(_("Can't execute command\n" " '%s'\npopen() returned: '%s'\n"), utf8, strerror(errno)); +#endif + free(utf8); +} + +/* --------------------------------------------------------------------------- + * print standard 'opendir' + */ +void OpendirErrorMessage(const char *DirName) +{ + char *utf8 = NULL; + + utf8_dup_string(&utf8, DirName); +#ifdef USE_SYS_ERRLIST + Message(_("Can't scan directory\n" + " '%s'\nopendir() returned: '%s'\n"), utf8, errno <= sys_nerr ? sys_errlist[errno] : "???"); +#else + Message(_("Can't scan directory\n" " '%s'\nopendir() returned: '%s'\n"), utf8, strerror(errno)); +#endif + free(utf8); +} + +/* --------------------------------------------------------------------------- + * print standard 'chdir error' + */ +void ChdirErrorMessage(const char *DirName) +{ + char *utf8 = NULL; + + utf8_dup_string(&utf8, DirName); +#ifdef USE_SYS_ERRLIST + Message(_("Can't change working directory to\n" + " '%s'\nchdir() returned: '%s'\n"), utf8, errno <= sys_nerr ? sys_errlist[errno] : "???"); +#else + Message(_("Can't change working directory to\n" " '%s'\nchdir() returned: '%s'\n"), utf8, strerror(errno)); +#endif + free(utf8); +} + +/* --------------------------------------------------------------------------- + * output of fatal error message + */ +void MyFatal(const char *Format, ...) +{ + va_list args; + + va_start(args, Format); + + /* try to save the layout and do some cleanup */ + EmergencySave(); + fprintf(stderr, "%s (%i): fatal, ", Progname, (int) getpid()); + vfprintf(stderr, Format, args); + fflush(stderr); + va_end(args); + exit(1); +} + +/* --------------------------------------------------------------------------- + * catches signals which abort the program + */ +void CatchSignal(int Signal) +{ + char *s; + + switch (Signal) { +#ifdef SIGHUP + case SIGHUP: + s = "SIGHUP"; + break; +#endif + case SIGINT: + s = "SIGINT"; + break; +#ifdef SIGQUIT + case SIGQUIT: + s = "SIGQUIT"; + break; +#endif + case SIGABRT: + s = "SIGABRT"; + break; + case SIGTERM: + s = "SIGTERM"; + break; + case SIGSEGV: + s = "SIGSEGV"; + break; + default: + s = "unknown"; + break; + } + MyFatal("aborted by %s signal\n", s); +} Index: 1.0.8/src/error.h =================================================================== --- 1.0.8/src/error.h (nonexistent) +++ 1.0.8/src/error.h (revision 1136) @@ -0,0 +1,47 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + * RCS: $Id$ + */ + +/* prototypes for error and debug functions + */ + +#ifndef PCB_ERROR_H +#define PCB_ERROR_H + + +#define STATUS_OK 0 +#define STATUS_BREAK 1 +#define STATUS_ERROR -1 + +void Message(const char *Format, ...); +void MyFatal(const char *Format, ...); +void OpenErrorMessage(const char *); +void PopenErrorMessage(const char *); +void OpendirErrorMessage(const char *); +void ChdirErrorMessage(const char *); +void CatchSignal(int); + +#endif Index: 1.0.8/src/event.c =================================================================== --- 1.0.8/src/event.c (nonexistent) +++ 1.0.8/src/event.c (revision 1136) @@ -0,0 +1,128 @@ +#include +#include +#include "event.h" +#include "error.h" + +typedef struct event_s event_t; + +struct event_s { + event_handler_t *handler; + void *user_data; + void *cookie; + event_t *next; +}; + +event_t *events[EVENT_last]; + +#define event_valid(ev) (((ev) >= 0) && ((ev) < EVENT_last)) + +void event_bind(event_id_t ev, event_handler_t * handler, void *user_data, void *cookie) +{ + event_t *e; + + if (!(event_valid(ev))) + return; + + e = malloc(sizeof(event_t)); + e->handler = handler; + e->cookie = cookie; + e->user_data = user_data; + + /* insert the new event in front of the list */ + e->next = events[ev]; + events[ev] = e; +} + +static void event_destroy(event_t * ev) +{ + free(ev); +} + +void event_unbind(event_id_t ev, event_handler_t * handler) +{ + event_t *prev = NULL, *e, *next; + if (!(event_valid(ev))) + return; + for (e = events[ev]; e != NULL; prev = e, e = next) { + next = e->next; + if (e->handler == handler) { + event_destroy(e); + if (prev == NULL) + events[ev] = next; + else + prev->next = next; + } + } +} + +void event_unbind_cookie(event_id_t ev, void *cookie) +{ + event_t *prev = NULL, *e, *next; + if (!(event_valid(ev))) + return; + for (e = events[ev]; e != NULL; prev = e, e = next) { + next = e->next; + if (e->cookie == cookie) { + event_destroy(e); + if (prev == NULL) + events[ev] = next; + else + prev->next = next; + } + } +} + + +void event_unbind_allcookie(void *cookie) +{ + event_id_t n; + for (n = 0; n < EVENT_last; n++) + event_unbind_cookie(n, cookie); +} + +void event(event_id_t ev, const char *fmt, ...) +{ + va_list ap; + const char *f; + event_arg_t argv[EVENT_MAX_ARG], *a; + event_t *e; + int argc; + + a = argv; + a->type = ARG_INT; + a->d.i = ev; + argc = 1; + + if (fmt != NULL) { + va_start(ap, fmt); + for (a++; *fmt != '\0'; fmt++, a++, argc++) { + if (argc >= EVENT_MAX_ARG) { + Message("event(): too many arguments\n"); + break; + } + switch (*fmt) { + case 'i': + a->type = ARG_INT; + a->d.i = va_arg(ap, int); + break; + case 'd': + a->type = ARG_DOUBLE; + a->d.d = va_arg(ap, double); + break; + case 's': + a->type = ARG_STR; + a->d.s = va_arg(ap, const char *); + break; + default: + a->type = ARG_INT; + a->d.i = 0; + Message("event(): invalid argument type '%c'\n", *fmt); + break; + } + } + va_end(ap); + } + + for (e = events[ev]; e != NULL; e = e->next) + e->handler(e->user_data, argc, (event_arg_t **) & argv); +} Index: 1.0.8/src/event.h =================================================================== --- 1.0.8/src/event.h (nonexistent) +++ 1.0.8/src/event.h (revision 1136) @@ -0,0 +1,48 @@ +typedef enum { + EVENT_GUI_INIT, /* finished initializing the GUI called right before the main loop of the GUI; args: (void) */ + EVENT_CLI_ENTER, /* the user pressed enter on a CLI command - called before parsing the line for actions; args: (str commandline) */ + + EVENT_last /* not a real event */ +} event_id_t; + +/* Maximum number of arguments for an event handler, auto-set argv[0] included */ +#define EVENT_MAX_ARG 16 + +/* Argument types in event's argv[] */ +typedef enum { + ARG_INT, /* format char: i */ + ARG_DOUBLE, /* format char: d */ + ARG_STR /* format char: s */ +} event_argtype_t; + + +/* An argument is its type and value */ +typedef struct { + event_argtype_t type; + union { + int i; + double d; + const char *s; + } d; +} event_arg_t; + +/* Event callback prototype; user_data is the same as in event_bind(). + argv[0] is always an ARG_INT with the event id that triggered the event. */ +typedef void (event_handler_t) (void *user_data, int argc, event_arg_t * argv[]); + +/* Bind: add a handler to the call-list of an event; the cookie is also remembered + so that mass-unbind is easier later. user_data is passed to the handler. */ +void event_bind(event_id_t ev, event_handler_t * handler, void *user_data, void *cookie); + +/* Unbind: remove a handler from an event */ +void event_unbind(event_id_t ev, event_handler_t * handler); + +/* Unbind by cookie: remove all handlers from an event matching the cookie */ +void event_unbind_cookie(event_id_t ev, void *cookie); + +/* Unbind all by cookie: remove all handlers from all events matching the cookie */ +void event_unbind_allcookie(void *cookie); + +/* Event trigger: call all handlers for an event. Fmt is a list of + format characters (e.g. i for ARG_INT). */ +void event(event_id_t ev, const char *fmt, ...); Index: 1.0.8/src/file.c =================================================================== --- 1.0.8/src/file.c (nonexistent) +++ 1.0.8/src/file.c (revision 1136) @@ -0,0 +1,1367 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996,1997,1998,2005,2006 Thomas Nau + * Copyright (C) 2015 Tibor 'Igor2' Palinkas + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* file save, load, merge ... routines + * getpid() needs a cast to (int) to get rid of compiler warnings + * on several architectures + */ + +#include "config.h" + +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +#include "global.h" + +#include +#ifdef HAVE_PWD_H +#include +#endif +#include + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#include + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_NETDB_H +#include +#endif + +#include + +#ifdef HAVE_STDLIB_H +#include +#endif + +#ifdef HAVE_STRING_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + + +#include "buffer.h" +#include "change.h" +#include "create.h" +#include "crosshair.h" +#include "data.h" +#include "error.h" +#include "file.h" +#include "hid.h" +#include "misc.h" +#include "move.h" +#include "mymem.h" +#include "parse_l.h" +#include "pcb-printf.h" +#include "polygon.h" +#include "rats.h" +#include "remove.h" +#include "set.h" +#include "strflags.h" +#include "portability.h" +#include "libpcb_fp.h" +#include "paths.h" +#include "rats_patch.h" +#include "stub_edif.h" + + +RCSID("$Id$"); + +#if !defined(HAS_ATEXIT) && !defined(HAS_ON_EXIT) +/* --------------------------------------------------------------------------- + * some local identifiers for OS without an atexit() or on_exit() + * call + */ +static char TMPFilename[80]; +#endif + +/* --------------------------------------------------------------------------- + * some local prototypes + */ +static void PrintQuotedString(FILE *, char *); +static void WritePCBInfoHeader(FILE *); +static void WritePCBDataHeader(FILE *); +static void WritePCBFontData(FILE *); +static void WriteViaData(FILE *, DataTypePtr); +static void WritePCBRatData(FILE *); +static void WriteElementData(FILE *, DataTypePtr); +static void WriteLayerData(FILE *, Cardinal, LayerTypePtr); +static int WritePCB(FILE *); +static int WritePCBFile(char *); +static int WritePipe(char *, bool); +static int ParseLibraryTree(void); +static int LoadNewlibFootprintsFromDir(const char *subdir, const char *toppath, int is_root); +static const char *pcb_basename(const char *p); + +/* --------------------------------------------------------------------------- + * Flag helper functions + */ + +#define F2S(OBJ, TYPE) flags_to_string ((OBJ)->Flags, TYPE) + +/* --------------------------------------------------------------------------- */ + +/* The idea here is to avoid gratuitously breaking backwards + compatibility due to a new but rarely used feature. The first such + case, for example, was the polygon Hole - if your design included + polygon holes, you needed a newer PCB to read it, but if your + design didn't include holes, PCB would produce a file that older + PCBs could read, if only it had the correct version number in it. + + If, however, you have to add or change a feature that really does + require a new PCB version all the time, it's time to remove all the + tests below and just always output the new version. + + Note: Best practices here is to add support for a feature *first* + (and bump PCB_FILE_VERSION in file.h), and note the version that + added that support below, and *later* update the file format to + need that version (which may then be older than PCB_FILE_VERSION). + Hopefully, that allows for one release between adding support and + needing it, which should minimize breakage. Of course, that's not + *always* possible, practical, or desirable. + +*/ + +/* Hole[] in Polygon. */ +#define PCB_FILE_VERSION_HOLES 20100606 +/* First version ever saved. */ +#define PCB_FILE_VERSION_BASELINE 20070407 + +int PCBFileVersionNeeded(void) +{ + ALLPOLYGON_LOOP(PCB->Data); + { + if (polygon->HoleIndexN > 0) + return PCB_FILE_VERSION_HOLES; + } + ENDALL_LOOP; + + return PCB_FILE_VERSION_BASELINE; +} + +/* --------------------------------------------------------------------------- */ + +static int string_cmp(const char *a, const char *b) +{ + while (*a && *b) { + if (isdigit((int) *a) && isdigit((int) *b)) { + int ia = atoi(a); + int ib = atoi(b); + if (ia != ib) + return ia - ib; + while (isdigit((int) *a) && *(a + 1)) + a++; + while (isdigit((int) *b) && *(b + 1)) + b++; + } + else if (tolower((int) *a) != tolower((int) *b)) + return tolower((int) *a) - tolower((int) *b); + a++; + b++; + } + if (*a) + return 1; + if (*b) + return -1; + return 0; +} + +static int netlist_sort_offset = 0; + +static int netlist_sort(const void *va, const void *vb) +{ + LibraryMenuType *am = (LibraryMenuType *) va; + LibraryMenuType *bm = (LibraryMenuType *) vb; + char *a = am->Name; + char *b = bm->Name; + if (*a == '~') + a++; + if (*b == '~') + b++; + return string_cmp(a, b); +} + +static int netnode_sort(const void *va, const void *vb) +{ + LibraryEntryType *am = (LibraryEntryType *) va; + LibraryEntryType *bm = (LibraryEntryType *) vb; + char *a = am->ListEntry; + char *b = bm->ListEntry; + return string_cmp(a, b); +} + +static void sort_library(LibraryTypePtr lib) +{ + int i; + qsort(lib->Menu, lib->MenuN, sizeof(lib->Menu[0]), netlist_sort); + for (i = 0; i < lib->MenuN; i++) + qsort(lib->Menu[i].Entry, lib->Menu[i].EntryN, sizeof(lib->Menu[i].Entry[0]), netnode_sort); +} + +void sort_netlist() +{ + netlist_sort_offset = 2; + sort_library(&(PCB->NetlistLib[NETLIST_INPUT])); + netlist_sort_offset = 0; +} + +/* --------------------------------------------------------------------------- + * opens a file and check if it exists + */ +FILE *CheckAndOpenFile(char *Filename, bool Confirm, bool AllButton, bool * WasAllButton, bool * WasCancelButton) +{ + FILE *fp = NULL; + struct stat buffer; + char message[MAXPATHLEN + 80]; + int response; + + if (Filename && *Filename) { + if (!stat(Filename, &buffer) && Confirm) { + sprintf(message, _("File '%s' exists, use anyway?"), Filename); + if (WasAllButton) + *WasAllButton = false; + if (WasCancelButton) + *WasCancelButton = false; + if (AllButton) + response = gui->confirm_dialog(message, "Cancel", "Ok", AllButton ? "Sequence OK" : 0); + else + response = gui->confirm_dialog(message, "Cancel", "Ok", "Sequence OK"); + + switch (response) { + case 2: + if (WasAllButton) + *WasAllButton = true; + break; + case 0: + if (WasCancelButton) + *WasCancelButton = true; + } + } + if ((fp = fopen(Filename, "w")) == NULL) + OpenErrorMessage(Filename); + } + return (fp); +} + +/* --------------------------------------------------------------------------- + * opens a file for saving connection data + */ +FILE *OpenConnectionDataFile(void) +{ + char *fname; + FILE *fp; + static char *default_file = NULL; + bool result; /* not used */ + + /* CheckAndOpenFile deals with the case where fname already exists */ + fname = gui->fileselect(_("Save Connection Data As ..."), + _("Choose a file to save all connection data to."), default_file, ".net", "connection_data", 0); + if (fname == NULL) + return NULL; + + if (default_file != NULL) { + free(default_file); + default_file = NULL; + } + + if (fname && *fname) + default_file = strdup(fname); + + fp = CheckAndOpenFile(fname, true, false, &result, NULL); + free(fname); + + return fp; +} + +/* --------------------------------------------------------------------------- + * save elements in the current buffer + */ +int SaveBufferElements(char *Filename) +{ + int result; + + if (SWAP_IDENT) + SwapBuffers(); + result = WritePipe(Filename, false); + if (SWAP_IDENT) + SwapBuffers(); + return (result); +} + +/* --------------------------------------------------------------------------- + * save PCB + */ +int SavePCB(char *file) +{ + int retcode; + + if (gui->notify_save_pcb == NULL) + return WritePipe(file, true); + + gui->notify_save_pcb(file, false); + retcode = WritePipe(file, true); + gui->notify_save_pcb(file, true); + + return retcode; +} + +/* --------------------------------------------------------------------------- + * set the route style to the first one, if the current one doesn't + * happen to match any. This way, "revert" won't change the route + * style. + */ +static void set_some_route_style() +{ + if (hid_get_flag("style")) + return; + SetLineSize(PCB->RouteStyle[0].Thick); + SetViaSize(PCB->RouteStyle[0].Diameter, true); + SetViaDrillingHole(PCB->RouteStyle[0].Hole, true); + SetKeepawayWidth(PCB->RouteStyle[0].Keepaway); +} + +/* --------------------------------------------------------------------------- + * load PCB + * parse the file with enabled 'PCB mode' (see parser) + * if successful, update some other stuff + * + * If revert is true, we pass "revert" as a parameter + * to the HID's PCBChanged action. + */ +static int real_load_pcb(char *Filename, bool revert, bool require_font, bool is_misc) +{ + const char *unit_suffix; + char *new_filename; + PCBTypePtr newPCB = CreateNewPCB_(false); + PCBTypePtr oldPCB; +#ifdef DEBUG + double elapsed; + clock_t start, end; + + start = clock(); +#endif + + resolve_path(Filename, &new_filename); + + oldPCB = PCB; + PCB = newPCB; + + /* mark the default font invalid to know if the file has one */ + newPCB->Font.Valid = false; + + /* new data isn't added to the undo list */ + if (!ParsePCB(PCB, new_filename)) { + RemovePCB(oldPCB); + + CreateNewPCBPost(PCB, 0); + ResetStackAndVisibility(); + + if (!is_misc) { + /* update cursor location */ + Crosshair.X = CLAMP(PCB->CursorX, 0, PCB->MaxWidth); + Crosshair.Y = CLAMP(PCB->CursorY, 0, PCB->MaxHeight); + + /* update cursor confinement and output area (scrollbars) */ + ChangePCBSize(PCB->MaxWidth, PCB->MaxHeight); + } + + /* enable default font if necessary */ + if (!PCB->Font.Valid) { + if (require_font) + Message(_("File '%s' has no font information, using default font\n"), new_filename); + PCB->Font.Valid = true; + } + + /* clear 'changed flag' */ + SetChangedFlag(false); + PCB->Filename = new_filename; + /* just in case a bad file saved file is loaded */ + + /* Use attribute PCB::grid::unit as unit, if we can */ + unit_suffix = AttributeGet(PCB, "PCB::grid::unit"); + if (unit_suffix && *unit_suffix) { + const Unit *new_unit = get_unit_struct(unit_suffix); + if (new_unit) + Settings.grid_unit = new_unit; + } + AttributePut(PCB, "PCB::grid::unit", Settings.grid_unit->suffix); + + sort_netlist(); + rats_patch_make_edited(PCB); + + set_some_route_style(); + + if (!is_misc) { + if (revert) + hid_actionl("PCBChanged", "revert", NULL); + else + hid_action("PCBChanged"); + } + +#ifdef DEBUG + end = clock(); + elapsed = ((double) (end - start)) / CLOCKS_PER_SEC; + gui->log("Loading file %s took %f seconds of CPU time\n", new_filename, elapsed); +#endif + + return (0); + } + PCB = oldPCB; + hid_action("PCBChanged"); + + /* release unused memory */ + RemovePCB(newPCB); + return (1); +} + +/* --------------------------------------------------------------------------- + * Load PCB + */ +int LoadPCB(char *file, bool require_font, bool is_misc) +{ + return real_load_pcb(file, false, require_font, is_misc); +} + +/* --------------------------------------------------------------------------- + * Revert PCB + */ +int RevertPCB(void) +{ + return real_load_pcb(PCB->Filename, true, true, true); +} + +/* --------------------------------------------------------------------------- + * functions for loading elements-as-pcb + */ + +extern PCBTypePtr yyPCB; +extern DataTypePtr yyData; +extern FontTypePtr yyFont; + +void PreLoadElementPCB() +{ + + if (!yyPCB) + return; + + yyFont = &yyPCB->Font; + yyData = yyPCB->Data; + yyData->pcb = yyPCB; + yyData->LayerN = 0; +} + +void PostLoadElementPCB() +{ + PCBTypePtr pcb_save = PCB; + ElementTypePtr e; + + if (!yyPCB) + return; + + CreateNewPCBPost(yyPCB, 0); + ParseGroupString("1,c:2,s", &yyPCB->LayerGroups, yyData->LayerN); + e = yyPCB->Data->Element->data; /* we know there's only one */ + PCB = yyPCB; + MoveElementLowLevel(yyPCB->Data, e, -e->BoundingBox.X1, -e->BoundingBox.Y1); + PCB = pcb_save; + yyPCB->MaxWidth = e->BoundingBox.X2; + yyPCB->MaxHeight = e->BoundingBox.Y2; + yyPCB->is_footprint = 1; +} + +/* --------------------------------------------------------------------------- + * writes the quoted string created by another subroutine + */ +static void PrintQuotedString(FILE * FP, char *S) +{ + static DynamicStringType ds; + + CreateQuotedString(&ds, S); + fputs(ds.Data, FP); +} + +/* --------------------------------------------------------------------------- + * writes out an attribute list + */ +static void WriteAttributeList(FILE * FP, AttributeListTypePtr list, char *prefix) +{ + int i; + + for (i = 0; i < list->Number; i++) + fprintf(FP, "%sAttribute(\"%s\" \"%s\")\n", prefix, list->List[i].name, list->List[i].value); +} + +/* --------------------------------------------------------------------------- + * writes layout header information + */ +static void WritePCBInfoHeader(FILE * FP) +{ + /* write some useful comments */ + fprintf(FP, "# release: %s " VERSION "\n", Progname); + + /* avoid writing things like user name or date, as these cause merge + * conflicts in collaborative environments using version control systems + */ +} + +/* --------------------------------------------------------------------------- + * writes data header + * the name of the PCB, cursor location, zoom and grid + * layergroups and some flags + */ +static void WritePCBDataHeader(FILE * FP) +{ + Cardinal group; + + /* + * ************************** README ******************* + * ************************** README ******************* + * + * If the file format is modified in any way, update + * PCB_FILE_VERSION in file.h as well as PCBFileVersionNeeded() + * at the top of this file. + * + * ************************** README ******************* + * ************************** README ******************* + */ + + fprintf(FP, "\n# To read pcb files, the pcb version (or the git source date) must be >= the file version\n"); + fprintf(FP, "FileVersion[%i]\n", PCBFileVersionNeeded()); + + fputs("\nPCB[", FP); + PrintQuotedString(FP, (char *) EMPTY(PCB->Name)); + pcb_fprintf(FP, " %mr %mr]\n\n", PCB->MaxWidth, PCB->MaxHeight); + pcb_fprintf(FP, "Grid[%.1mr %mr %mr %d]\n", PCB->Grid, PCB->GridOffsetX, PCB->GridOffsetY, Settings.DrawGrid); + pcb_fprintf(FP, "Cursor[%mr %mr %s]\n", Crosshair.X, Crosshair.Y, c_dtostr(PCB->Zoom)); + /* PolyArea should be output in square cmils, no suffix */ + fprintf(FP, "PolyArea[%s]\n", c_dtostr(COORD_TO_MIL(COORD_TO_MIL(PCB->IsleArea) * 100) * 100)); + pcb_fprintf(FP, "Thermal[%s]\n", c_dtostr(PCB->ThermScale)); + pcb_fprintf(FP, "DRC[%mr %mr %mr %mr %mr %mr]\n", PCB->Bloat, PCB->Shrink, + PCB->minWid, PCB->minSlk, PCB->minDrill, PCB->minRing); + fprintf(FP, "Flags(%s)\n", pcbflags_to_string(PCB->Flags)); + fprintf(FP, "Groups(\"%s\")\n", LayerGroupsToString(&PCB->LayerGroups)); + fputs("Styles[\"", FP); + for (group = 0; group < NUM_STYLES - 1; group++) + pcb_fprintf(FP, "%s,%mr,%mr,%mr,%mr:", PCB->RouteStyle[group].Name, + PCB->RouteStyle[group].Thick, + PCB->RouteStyle[group].Diameter, PCB->RouteStyle[group].Hole, PCB->RouteStyle[group].Keepaway); + pcb_fprintf(FP, "%s,%mr,%mr,%mr,%mr\"]\n\n", PCB->RouteStyle[group].Name, + PCB->RouteStyle[group].Thick, + PCB->RouteStyle[group].Diameter, PCB->RouteStyle[group].Hole, PCB->RouteStyle[group].Keepaway); +} + +/* --------------------------------------------------------------------------- + * writes font data of non empty symbols + */ +static void WritePCBFontData(FILE * FP) +{ + Cardinal i, j; + LineTypePtr line; + FontTypePtr font; + + for (font = &PCB->Font, i = 0; i <= MAX_FONTPOSITION; i++) { + if (!font->Symbol[i].Valid) + continue; + + if (isprint(i)) + pcb_fprintf(FP, "Symbol['%c' %mr]\n(\n", i, font->Symbol[i].Delta); + else + pcb_fprintf(FP, "Symbol[%i %mr]\n(\n", i, font->Symbol[i].Delta); + + line = font->Symbol[i].Line; + for (j = font->Symbol[i].LineN; j; j--, line++) + pcb_fprintf(FP, "\tSymbolLine[%mr %mr %mr %mr %mr]\n", + line->Point1.X, line->Point1.Y, line->Point2.X, line->Point2.Y, line->Thickness); + fputs(")\n", FP); + } +} + +/* --------------------------------------------------------------------------- + * writes via data + */ +static void WriteViaData(FILE * FP, DataTypePtr Data) +{ + GList *iter; + /* write information about vias */ + for (iter = Data->Via; iter != NULL; iter = g_list_next(iter)) { + PinType *via = iter->data; + pcb_fprintf(FP, "Via[%mr %mr %mr %mr %mr %mr ", via->X, via->Y, + via->Thickness, via->Clearance, via->Mask, via->DrillingHole); + PrintQuotedString(FP, (char *) EMPTY(via->Name)); + fprintf(FP, " %s]\n", F2S(via, VIA_TYPE)); + } +} + +/* --------------------------------------------------------------------------- + * writes rat-line data + */ +static void WritePCBRatData(FILE * FP) +{ + GList *iter; + /* write information about rats */ + for (iter = PCB->Data->Rat; iter != NULL; iter = g_list_next(iter)) { + RatType *line = iter->data; + pcb_fprintf(FP, "Rat[%mr %mr %d %mr %mr %d ", + line->Point1.X, line->Point1.Y, line->group1, line->Point2.X, line->Point2.Y, line->group2); + fprintf(FP, " %s]\n", F2S(line, RATLINE_TYPE)); + } +} + +/* --------------------------------------------------------------------------- + * writes netlist data + */ +static void WritePCBNetlistData(FILE * FP) +{ + /* write out the netlist if it exists */ + if (PCB->NetlistLib[NETLIST_INPUT].MenuN) { + int n, p; + fprintf(FP, "NetList()\n(\n"); + + for (n = 0; n < PCB->NetlistLib[NETLIST_INPUT].MenuN; n++) { + LibraryMenuTypePtr menu = &PCB->NetlistLib[NETLIST_INPUT].Menu[n]; + fprintf(FP, "\tNet("); + PrintQuotedString(FP, &menu->Name[2]); + fprintf(FP, " "); + PrintQuotedString(FP, (char *) UNKNOWN(menu->Style)); + fprintf(FP, ")\n\t(\n"); + for (p = 0; p < menu->EntryN; p++) { + LibraryEntryTypePtr entry = &menu->Entry[p]; + fprintf(FP, "\t\tConnect("); + PrintQuotedString(FP, entry->ListEntry); + fprintf(FP, ")\n"); + } + fprintf(FP, "\t)\n"); + } + fprintf(FP, ")\n"); + } +} + +/* --------------------------------------------------------------------------- + * writes netlist patch data + */ +static void WritePCBNetlistPatchData(FILE * FP) +{ + if (PCB->NetlistPatches != NULL) { + fprintf(FP, "NetListPatch()\n(\n"); + rats_patch_fexport(PCB, FP, 1); + fprintf(FP, ")\n"); + } +} + +/* --------------------------------------------------------------------------- + * writes element data + */ +static void WriteElementData(FILE * FP, DataTypePtr Data) +{ + GList *n, *p; + for (n = Data->Element; n != NULL; n = g_list_next(n)) { + ElementType *element = n->data; + + /* only non empty elements */ + if (!element->LineN && !element->PinN && !element->ArcN && !element->PadN) + continue; + /* the coordinates and text-flags are the same for + * both names of an element + */ + fprintf(FP, "\nElement[%s ", F2S(element, ELEMENT_TYPE)); + PrintQuotedString(FP, (char *) EMPTY(DESCRIPTION_NAME(element))); + fputc(' ', FP); + PrintQuotedString(FP, (char *) EMPTY(NAMEONPCB_NAME(element))); + fputc(' ', FP); + PrintQuotedString(FP, (char *) EMPTY(VALUE_NAME(element))); + pcb_fprintf(FP, " %mr %mr %mr %mr %d %d %s]\n(\n", + element->MarkX, element->MarkY, + DESCRIPTION_TEXT(element).X - element->MarkX, + DESCRIPTION_TEXT(element).Y - element->MarkY, + DESCRIPTION_TEXT(element).Direction, + DESCRIPTION_TEXT(element).Scale, F2S(&(DESCRIPTION_TEXT(element)), ELEMENTNAME_TYPE)); + WriteAttributeList(FP, &element->Attributes, "\t"); + for (p = element->Pin; p != NULL; p = g_list_next(p)) { + PinType *pin = p->data; + pcb_fprintf(FP, "\tPin[%mr %mr %mr %mr %mr %mr ", + pin->X - element->MarkX, + pin->Y - element->MarkY, pin->Thickness, pin->Clearance, pin->Mask, pin->DrillingHole); + PrintQuotedString(FP, (char *) EMPTY(pin->Name)); + fprintf(FP, " "); + PrintQuotedString(FP, (char *) EMPTY(pin->Number)); + fprintf(FP, " %s]\n", F2S(pin, PIN_TYPE)); + } + for (p = element->Pad; p != NULL; p = g_list_next(p)) { + PadType *pad = p->data; + pcb_fprintf(FP, "\tPad[%mr %mr %mr %mr %mr %mr %mr ", + pad->Point1.X - element->MarkX, + pad->Point1.Y - element->MarkY, + pad->Point2.X - element->MarkX, pad->Point2.Y - element->MarkY, pad->Thickness, pad->Clearance, pad->Mask); + PrintQuotedString(FP, (char *) EMPTY(pad->Name)); + fprintf(FP, " "); + PrintQuotedString(FP, (char *) EMPTY(pad->Number)); + fprintf(FP, " %s]\n", F2S(pad, PAD_TYPE)); + } + for (p = element->Line; p != NULL; p = g_list_next(p)) { + LineType *line = p->data; + pcb_fprintf(FP, "\tElementLine [%mr %mr %mr %mr %mr]\n", + line->Point1.X - element->MarkX, + line->Point1.Y - element->MarkY, + line->Point2.X - element->MarkX, line->Point2.Y - element->MarkY, line->Thickness); + } + for (p = element->Arc; p != NULL; p = g_list_next(p)) { + ArcType *arc = p->data; + pcb_fprintf(FP, "\tElementArc [%mr %mr %mr %mr %ma %ma %mr]\n", + arc->X - element->MarkX, + arc->Y - element->MarkY, arc->Width, arc->Height, arc->StartAngle, arc->Delta, arc->Thickness); + } + fputs("\n\t)\n", FP); + } +} + +/* --------------------------------------------------------------------------- + * writes layer data + */ +static void WriteLayerData(FILE * FP, Cardinal Number, LayerTypePtr layer) +{ + GList *n; + /* write information about non empty layers */ + if (layer->LineN || layer->ArcN || layer->TextN || layer->PolygonN || (layer->Name && *layer->Name)) { + fprintf(FP, "Layer(%i ", (int) Number + 1); + PrintQuotedString(FP, (char *) EMPTY(layer->Name)); + fputs(")\n(\n", FP); + WriteAttributeList(FP, &layer->Attributes, "\t"); + + for (n = layer->Line; n != NULL; n = g_list_next(n)) { + LineType *line = n->data; + pcb_fprintf(FP, "\tLine[%mr %mr %mr %mr %mr %mr %s]\n", + line->Point1.X, line->Point1.Y, + line->Point2.X, line->Point2.Y, line->Thickness, line->Clearance, F2S(line, LINE_TYPE)); + } + for (n = layer->Arc; n != NULL; n = g_list_next(n)) { + ArcType *arc = n->data; + pcb_fprintf(FP, "\tArc[%mr %mr %mr %mr %mr %mr %ma %ma %s]\n", + arc->X, arc->Y, arc->Width, + arc->Height, arc->Thickness, arc->Clearance, arc->StartAngle, arc->Delta, F2S(arc, ARC_TYPE)); + } + for (n = layer->Text; n != NULL; n = g_list_next(n)) { + TextType *text = n->data; + pcb_fprintf(FP, "\tText[%mr %mr %d %d ", text->X, text->Y, text->Direction, text->Scale); + PrintQuotedString(FP, (char *) EMPTY(text->TextString)); + fprintf(FP, " %s]\n", F2S(text, TEXT_TYPE)); + } + for (n = layer->Polygon; n != NULL; n = g_list_next(n)) { + PolygonType *polygon = n->data; + int p, i = 0; + Cardinal hole = 0; + fprintf(FP, "\tPolygon(%s)\n\t(", F2S(polygon, POLYGON_TYPE)); + for (p = 0; p < polygon->PointN; p++) { + PointTypePtr point = &polygon->Points[p]; + + if (hole < polygon->HoleIndexN && p == polygon->HoleIndex[hole]) { + if (hole > 0) + fputs("\n\t\t)", FP); + fputs("\n\t\tHole (", FP); + hole++; + i = 0; + } + + if (i++ % 5 == 0) { + fputs("\n\t\t", FP); + if (hole) + fputs("\t", FP); + } + pcb_fprintf(FP, "[%mr %mr] ", point->X, point->Y); + } + if (hole > 0) + fputs("\n\t\t)", FP); + fputs("\n\t)\n", FP); + } + fputs(")\n", FP); + } +} + +/* --------------------------------------------------------------------------- + * writes just the elements in the buffer to file + */ +static int WriteBuffer(FILE * FP) +{ + Cardinal i; + + WriteViaData(FP, PASTEBUFFER->Data); + WriteElementData(FP, PASTEBUFFER->Data); + for (i = 0; i < max_copper_layer + 2; i++) + WriteLayerData(FP, i, &(PASTEBUFFER->Data->Layer[i])); + return (STATUS_OK); +} + +/* --------------------------------------------------------------------------- + * writes PCB to file + */ +static int WritePCB(FILE * FP) +{ + Cardinal i; + + WritePCBInfoHeader(FP); + WritePCBDataHeader(FP); + WritePCBFontData(FP); + WriteAttributeList(FP, &PCB->Attributes, ""); + WriteViaData(FP, PCB->Data); + WriteElementData(FP, PCB->Data); + WritePCBRatData(FP); + for (i = 0; i < max_copper_layer + 2; i++) + WriteLayerData(FP, i, &(PCB->Data->Layer[i])); + WritePCBNetlistData(FP); + WritePCBNetlistPatchData(FP); + + return (STATUS_OK); +} + +/* --------------------------------------------------------------------------- + * writes PCB to file + */ +static int WritePCBFile(char *Filename) +{ + FILE *fp; + int result; + + if ((fp = fopen(Filename, "w")) == NULL) { + OpenErrorMessage(Filename); + return (STATUS_ERROR); + } + result = WritePCB(fp); + fclose(fp); + return (result); +} + +/* --------------------------------------------------------------------------- + * writes to pipe using the command defined by Settings.SaveCommand + * %f are replaced by the passed filename + */ +static int WritePipe(char *Filename, bool thePcb) +{ + FILE *fp; + int result; + char *p; + static DynamicStringType command; + int used_popen = 0; + + if (EMPTY_STRING_P(Settings.SaveCommand)) { + fp = fopen(Filename, "w"); + if (fp == 0) { + Message("Unable to write to file %s\n", Filename); + return STATUS_ERROR; + } + } + else { + used_popen = 1; + /* setup commandline */ + DSClearString(&command); + for (p = Settings.SaveCommand; *p; p++) { + /* copy character if not special or add string to command */ + if (!(*p == '%' && *(p + 1) == 'f')) + DSAddCharacter(&command, *p); + else { + DSAddString(&command, Filename); + + /* skip the character */ + p++; + } + } + DSAddCharacter(&command, '\0'); + printf("write to pipe \"%s\"\n", command.Data); + if ((fp = popen(command.Data, "w")) == NULL) { + PopenErrorMessage(command.Data); + return (STATUS_ERROR); + } + } + if (thePcb) { + if (PCB->is_footprint) { + WriteElementData(fp, PCB->Data); + result = 0; + } + else + result = WritePCB(fp); + } + else + result = WriteBuffer(fp); + + if (used_popen) + return (pclose(fp) ? STATUS_ERROR : result); + return (fclose(fp) ? STATUS_ERROR : result); +} + +/* --------------------------------------------------------------------------- + * saves the layout in a temporary file + * this is used for fatal errors and does not call the program specified + * in 'saveCommand' for safety reasons + */ +void SaveInTMP(void) +{ + char filename[80]; + + /* memory might have been released before this function is called */ + if (PCB && PCB->Changed) { + sprintf(filename, EMERGENCY_NAME, (int) getpid()); + Message(_("Trying to save your layout in '%s'\n"), filename); + WritePCBFile(filename); + } +} + +/* --------------------------------------------------------------------------- + * front-end for 'SaveInTMP()' + * just makes sure that the routine is only called once + */ +static bool dont_save_any_more = false; +void EmergencySave(void) +{ + + if (!dont_save_any_more) { + SaveInTMP(); + dont_save_any_more = true; + } +} + +void DisableEmergencySave(void) +{ + dont_save_any_more = true; +} + +/* ---------------------------------------------------------------------- + * Callback for the autosave + */ + +static hidval backup_timer; + +/* + * If the backup interval is > 0 then set another timer. Otherwise + * we do nothing and it is up to the GUI to call EnableAutosave() + * after setting Settings.BackupInterval > 0 again. + */ +static void backup_cb(hidval data) +{ + backup_timer.ptr = NULL; + Backup(); + if (Settings.BackupInterval > 0 && gui->add_timer) + backup_timer = gui->add_timer(backup_cb, 1000 * Settings.BackupInterval, data); +} + +void EnableAutosave(void) +{ + hidval x; + + x.ptr = NULL; + + /* If we already have a timer going, then cancel it out */ + if (backup_timer.ptr != NULL && gui->stop_timer) + gui->stop_timer(backup_timer); + + backup_timer.ptr = NULL; + /* Start up a new timer */ + if (Settings.BackupInterval > 0 && gui->add_timer) + backup_timer = gui->add_timer(backup_cb, 1000 * Settings.BackupInterval, x); +} + +/* --------------------------------------------------------------------------- + * creates backup file. The default is to use the pcb file name with + * a "-" appended (like "foo.pcb-") and if we don't have a pcb file name + * then use the template in BACKUP_NAME + */ +void Backup(void) +{ + char *filename = NULL; + + if (PCB && PCB->Filename) { + filename = (char *) malloc(sizeof(char) * (strlen(PCB->Filename) + 2)); + if (filename == NULL) { + fprintf(stderr, "Backup(): malloc failed\n"); + exit(1); + } + sprintf(filename, "%s-", PCB->Filename); + } + else { + /* BACKUP_NAME has %.8i which will be replaced by the process ID */ + filename = (char *) malloc(sizeof(char) * (strlen(BACKUP_NAME) + 8)); + if (filename == NULL) { + fprintf(stderr, "Backup(): malloc failed\n"); + exit(1); + } + sprintf(filename, BACKUP_NAME, (int) getpid()); + } + + WritePCBFile(filename); + free(filename); +} + +#if !defined(HAS_ATEXIT) && !defined(HAS_ON_EXIT) +/* --------------------------------------------------------------------------- + * makes a temporary copy of the data. This is useful for systems which + * doesn't support calling functions on exit. We use this to save the data + * before LEX and YACC functions are called because they are able to abort + * the program. + */ +void SaveTMPData(void) +{ + sprintf(TMPFilename, EMERGENCY_NAME, (int) getpid()); + WritePCBFile(TMPFilename); +} + +/* --------------------------------------------------------------------------- + * removes the temporary copy of the data file + */ +void RemoveTMPData(void) +{ + unlink(TMPFilename); +} +#endif + +/* --------------------------------------------------------------------------- + * Parse the directory tree where newlib footprints are found + */ + +/* Helper function for ParseLibraryTree */ +static const char *pcb_basename(const char *p) +{ + char *rv = strrchr(p, '/'); + if (rv) + return rv + 1; + return p; +} + +typedef struct list_dir_s list_dir_t; + +struct list_dir_s { + char *parent; + char *subdir; + list_dir_t *next; +}; + +typedef struct { + LibraryMenuTypePtr menu; + list_dir_t *subdirs; + int children; +} list_st_t; + + +static int list_cb(void *cookie, const char *subdir, const char *name, pcb_fp_type_t type, void *tags[]) +{ + list_st_t *l = (list_st_t *) cookie; + LibraryEntryTypePtr entry; /* Pointer to individual menu entry */ + size_t len; + + if (type == PCB_FP_DIR) { + list_dir_t *d; + /* can not recurse directly from here because that would ruin the menu + pointer: GetLibraryMenuMemory (&Library) calls realloc()! + Build a list of directories to be visited later, instead. */ + d = malloc(sizeof(list_dir_t)); + d->subdir = strdup(name); + d->parent = strdup(subdir); + d->next = l->subdirs; + l->subdirs = d; + return 0; + } + + l->children++; + entry = GetLibraryEntryMemory(l->menu); + + /* + * entry->AllocatedMemory points to abs path to the footprint. + * entry->ListEntry points to fp name itself. + */ + len = strlen(subdir) + strlen("/") + strlen(name) + 8; + entry->AllocatedMemory = (char *) calloc(1, len); + strcat(entry->AllocatedMemory, subdir); + strcat(entry->AllocatedMemory, PCB_DIR_SEPARATOR_S); + + /* store pointer to start of footprint name */ + entry->ListEntry = entry->AllocatedMemory + strlen(entry->AllocatedMemory); + + /* Now place footprint name into AllocatedMemory */ + strcat(entry->AllocatedMemory, name); + + if (type == PCB_FP_PARAMETRIC) + strcat(entry->AllocatedMemory, "()"); + + entry->Type = type; + + entry->Tags = tags; + + return 0; +} + +static int LoadNewlibFootprintsFromDir(const char *subdir, const char *toppath, int is_root) +{ + LibraryMenuTypePtr menu = NULL; /* Pointer to PCB's library menu structure */ + list_st_t l; + list_dir_t *d, *nextd; + char working_[MAXPATHLEN + 1]; + char *working; /* String holding abs path to working dir */ + int menuidx; + + sprintf(working_, "%s%c%s", toppath, PCB_DIR_SEPARATOR_C, subdir); + resolve_path(working_, &working); + + /* Get pointer to memory holding menu */ + menu = GetLibraryMenuMemory(&Library, &menuidx); + + + /* Populate menuname and path vars */ + menu->Name = strdup(pcb_basename(subdir)); + menu->directory = strdup(pcb_basename(toppath)); + + l.menu = menu; + l.subdirs = NULL; + l.children = 0; + + pcb_fp_list(working, 0, list_cb, &l, is_root, 1); + + /* now recurse to each subdirectory mapped in the previous call; + by now we don't care if menu is ruined by the realloc() in GetLibraryMenuMemory() */ + for (d = l.subdirs; d != NULL; d = nextd) { + l.children += LoadNewlibFootprintsFromDir(d->subdir, d->parent, 0); + nextd = d->next; + free(d->subdir); + free(d->parent); + free(d); + } + if (l.children == 0) { + DeleteLibraryMenuMemory(&Library, menuidx); + } + free(working); + return l.children; +} + + + +/* This function loads the newlib footprints into the Library. + * It examines all directories pointed to by Settings.LibraryTree. + * In each directory specified there, it looks both in that directory, + * as well as *one* level down. It calls the subfunction + * LoadNewlibFootprintsFromDir to put the footprints into PCB's internal + * datastructures. + */ +static int ParseLibraryTree(void) +{ + char toppath[MAXPATHLEN + 1]; /* String holding abs path to top level library dir */ + char *libpaths; /* String holding list of library paths to search */ + char *p; /* Helper string used in iteration */ + DIR *dirobj; /* Iterable directory object */ + struct dirent *direntry = NULL; /* Object holding individual directory entries */ + struct stat buffer; /* buffer used in stat */ + int n_footprints = 0; /* Running count of footprints found */ + + /* Initialize path, working by writing 0 into every byte. */ + memset(toppath, 0, sizeof toppath); + + /* Additional loop to allow for multiple 'newlib' style library directories + * called out in Settings.LibraryTree + */ + libpaths = strdup(Settings.LibrarySearchPaths); + for (p = strtok(libpaths, PCB_PATH_DELIMETER); p && *p; p = strtok(NULL, PCB_PATH_DELIMETER)) { + /* remove trailing path delimeter */ + strncpy(toppath, p, sizeof(toppath) - 1); + +#ifdef DEBUG + printf("In ParseLibraryTree, looking for newlib footprints inside top level directory %s ... \n", toppath); +#endif + + /* Next read in any footprints in the top level dir */ + n_footprints += LoadNewlibFootprintsFromDir(".", toppath, 1); + } + +#ifdef DEBUG + printf("Leaving ParseLibraryTree, found %d footprints.\n", n_footprints); +#endif + + return n_footprints; +} + +int ReadLibraryContents(void) +{ + static char *command = NULL; + char inputline[MAX_LIBRARY_LINE_LENGTH + 1]; + FILE *resultFP = NULL; + LibraryMenuTypePtr menu = NULL; + LibraryEntryTypePtr entry; + + /* List all footprint libraries. Then sort the whole + * library. + */ + if (ParseLibraryTree() > 0 || resultFP != NULL) { + sort_library(&Library); + return 0; + } + + return (1); +} + +#define BLANK(x) ((x) == ' ' || (x) == '\t' || (x) == '\n' \ + || (x) == '\0') + +/* --------------------------------------------------------------------------- + * Read in a netlist and store it in the netlist menu + */ + +int ReadNetlist(char *filename) +{ + static char *command = NULL; + char inputline[MAX_NETLIST_LINE_LENGTH + 1]; + char temp[MAX_NETLIST_LINE_LENGTH + 1]; + FILE *fp; + LibraryMenuTypePtr menu = NULL; + LibraryEntryTypePtr entry; + int i, j, lines, kind; + bool continued; + int used_popen = 0; + + if (!filename) + return (1); /* nothing to do */ + + Message(_("Importing PCB netlist %s\n"), filename); + + if (EMPTY_STRING_P(Settings.RatCommand)) { + fp = fopen(filename, "r"); + if (!fp) { + Message("Cannot open %s for reading", filename); + return 1; + } + } + else { + used_popen = 1; + free(command); + command = EvaluateFilename(Settings.RatCommand, Settings.RatPath, filename, NULL); + + /* open pipe to stdout of command */ + if (*command == '\0' || (fp = popen(command, "r")) == NULL) { + PopenErrorMessage(command); + return (1); + } + } + lines = 0; + /* kind = 0 is net name + * kind = 1 is route style name + * kind = 2 is connection + */ + kind = 0; + while (fgets(inputline, MAX_NETLIST_LINE_LENGTH, fp)) { + size_t len = strlen(inputline); + /* check for maximum length line */ + if (len) { + if (inputline[--len] != '\n') + Message(_("Line length (%i) exceeded in netlist file.\n" + "additional characters will be ignored.\n"), MAX_NETLIST_LINE_LENGTH); + else + inputline[len] = '\0'; + } + continued = (inputline[len - 1] == '\\') ? true : false; + if (continued) + inputline[len - 1] = '\0'; + lines++; + i = 0; + while (inputline[i] != '\0') { + j = 0; + /* skip leading blanks */ + while (inputline[i] != '\0' && BLANK(inputline[i])) + i++; + if (kind == 0) { + /* add two spaces for included/unincluded */ + temp[j++] = ' '; + temp[j++] = ' '; + } + while (!BLANK(inputline[i])) + temp[j++] = inputline[i++]; + temp[j] = '\0'; + while (inputline[i] != '\0' && BLANK(inputline[i])) + i++; + if (kind == 0) { + menu = GetLibraryMenuMemory(&PCB->NetlistLib[NETLIST_INPUT], NULL); + menu->Name = strdup(temp); + menu->flag = 1; + kind++; + } + else { + if (kind == 1 && strchr(temp, '-') == NULL) { + kind++; + menu->Style = strdup(temp); + } + else { + entry = GetLibraryEntryMemory(menu); + entry->ListEntry = strdup(temp); + } + } + } + if (!continued) + kind = 0; + } + if (!lines) { + Message(_("Empty netlist file!\n")); + pclose(fp); + return (1); + } + if (used_popen) + pclose(fp); + else + fclose(fp); + sort_netlist(); + rats_patch_make_edited(PCB); + return (0); +} + +int ImportNetlist(char *filename) +{ + FILE *fp; + char buf[16]; + int i; + char *p; + + + if (!filename) + return (1); /* nothing to do */ + fp = fopen(filename, "r"); + if (!fp) + return (1); /* bad filename */ + i = fread(buf, 1, sizeof(buf) - 1, fp); + fclose(fp); + buf[i] = '\0'; + p = buf; + while (*p) { + *p = tolower((int) *p); + p++; + } + p = strstr(buf, "edif"); + if (!p) + return ReadNetlist(filename); + else + return stub_ReadEdifNetlist(filename); +} Index: 1.0.8/src/file.h =================================================================== --- 1.0.8/src/file.h (nonexistent) +++ 1.0.8/src/file.h (revision 1136) @@ -0,0 +1,77 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* prototypes for file routines + */ + +#ifndef PCB_FILE_H +#define PCB_FILE_H + +#include /* needed to define 'FILE *' */ +#include "global.h" + +FILE *CheckAndOpenFile(char *, bool, bool, bool *, bool *); +FILE *OpenConnectionDataFile(void); +int SavePCB(char *); +int LoadPCB(char *, bool, bool); +int RevertPCB(void); +void EnableAutosave(void); +void Backup(void); +void SaveInTMP(void); +void EmergencySave(void); +void DisableEmergencySave(void); +int ReadLibraryContents(void); /* walk through all lib paths and build the library menu */ +int ImportNetlist(char *); +int SaveBufferElements(char *); +void PreLoadElementPCB(void); +void PostLoadElementPCB(void); +void sort_netlist(void); + +/* + * Whenever the pcb file format is modified, this version number + * should be updated to the date when the new code is committed. + * It will be written out to the file and also used by pcb to give + * guidance to the user as to what the minimum version of pcb required + * is. + */ + +/* This is the version needed by the file we're saving. */ +int PCBFileVersionNeeded(void); + +/* This is the version we support. */ +#define PCB_FILE_VERSION 20110603 + + +#ifndef HAS_ATEXIT +#ifdef HAS_ON_EXIT +void GlueEmergencySave(int, caddr_t); +#else +void SaveTMPData(void); +void RemoveTMPData(void); +#endif +#endif + +#endif Index: 1.0.8/src/file_act.c =================================================================== --- 1.0.8/src/file_act.c (nonexistent) +++ 1.0.8/src/file_act.c (revision 1136) @@ -0,0 +1,387 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact addresses for paper mail and Email: + * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA + * haceaton@aplcomm.jhuapl.edu + * + */ +#include "config.h" +#include "global.h" +#include "data.h" +#include "action.h" +#include "change.h" +#include "error.h" +#include "undo.h" + +#include "crosshair.h" +#include "set.h" +#include "file.h" +#include "buffer.h" +#include "mymem.h" +#include "misc.h" +#include "remove.h" +#include "create.h" +#include "draw.h" +#include "find.h" +#include "search.h" + +/* ---------------------------------------------------------------- */ +static const char execcommand_syntax[] = "ExecCommand(command)"; + +static const char execcommand_help[] = "Runs a command."; + +/* %start-doc actions execcommand + +Runs the given command, which is a system executable. + +%end-doc */ + +static int ActionExecCommand(int argc, char **argv, Coord x, Coord y) +{ + char *command; + + if (argc < 1) { + AFAIL(execcommand); + } + + command = ARG(0); + + if (system(command)) + return 1; + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char loadfrom_syntax[] = "LoadFrom(Layout|LayoutToBuffer|ElementToBuffer|Netlist|Revert,filename)"; + +static const char loadfrom_help[] = "Load layout data from a file."; + +/* %start-doc actions LoadFrom + +This action assumes you know what the filename is. The various GUIs +should have a similar @code{Load} action where the filename is +optional, and will provide their own file selection mechanism to let +you choose the file name. + +@table @code + +@item Layout +Loads an entire PCB layout, replacing the current one. + +@item LayoutToBuffer +Loads an entire PCB layout to the paste buffer. + +@item ElementToBuffer +Loads the given element file into the paste buffer. Element files +contain only a single @code{Element} definition, such as the +``newlib'' library uses. + +@item Netlist +Loads a new netlist, replacing any current netlist. + +@item Revert +Re-loads the current layout from its disk file, reverting any changes +you may have made. + +@end table + +%end-doc */ + +static int ActionLoadFrom(int argc, char **argv, Coord x, Coord y) +{ + char *function; + char *name; + + if (argc < 2) + AFAIL(loadfrom); + + function = argv[0]; + name = argv[1]; + + if (strcasecmp(function, "ElementToBuffer") == 0) { + notify_crosshair_change(false); + if (LoadElementToBuffer(PASTEBUFFER, name)) + SetMode(PASTEBUFFER_MODE); + notify_crosshair_change(true); + } + + else if (strcasecmp(function, "LayoutToBuffer") == 0) { + notify_crosshair_change(false); + if (LoadLayoutToBuffer(PASTEBUFFER, name)) + SetMode(PASTEBUFFER_MODE); + notify_crosshair_change(true); + } + + else if (strcasecmp(function, "Layout") == 0) { + if (!PCB->Changed || gui->confirm_dialog(_("OK to override layout data?"), 0)) + LoadPCB(name, true, false); + } + + else if (strcasecmp(function, "Netlist") == 0) { + if (PCB->Netlistname) + free(PCB->Netlistname); + PCB->Netlistname = StripWhiteSpaceAndDup(name); + { + int i; + for (i = 0; i < NUM_NETLISTS; i++) + FreeLibraryMemory(&(PCB->NetlistLib[i])); + } + if (!ImportNetlist(PCB->Netlistname)) + NetlistChanged(1); + } + else if (strcasecmp(function, "Revert") == 0 && PCB->Filename + && (!PCB->Changed || gui->confirm_dialog(_("OK to override changes?"), 0))) { + RevertPCB(); + } + + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char new_syntax[] = "New([name])"; + +static const char new_help[] = "Starts a new layout."; + +/* %start-doc actions New + +If a name is not given, one is prompted for. + +%end-doc */ + +static int ActionNew(int argc, char **argv, Coord x, Coord y) +{ + char *name = ARG(0); + + if (!PCB->Changed || gui->confirm_dialog(_("OK to clear layout data?"), 0)) { + if (name) + name = strdup(name); + else + name = gui->prompt_for(_("Enter the layout name:"), ""); + + if (!name) + return 1; + + notify_crosshair_change(false); + /* do emergency saving + * clear the old struct and allocate memory for the new one + */ + if (PCB->Changed && Settings.SaveInTMP) + SaveInTMP(); + RemovePCB(PCB); + PCB = CreateNewPCB(); + PCB->Data->LayerN = DEF_LAYER; + CreateNewPCBPost(PCB, 1); + + /* setup the new name and reset some values to default */ + free(PCB->Name); + PCB->Name = name; + + ResetStackAndVisibility(); + SetCrosshairRange(0, 0, PCB->MaxWidth, PCB->MaxHeight); + CenterDisplay(PCB->MaxWidth / 2, PCB->MaxHeight / 2); + Redraw(); + + hid_action("PCBChanged"); + notify_crosshair_change(true); + return 0; + } + return 1; +} + +/* --------------------------------------------------------------------------- */ + +static const char savesettings_syntax[] = "SaveSettings()\n" "SaveSettings(local)"; + +static const char savesettings_help[] = "Saves settings."; + +/* %start-doc actions SaveSettings + +If you pass no arguments, the settings are stored in +@code{$HOME/.pcb/settings}. If you pass the word @code{local} they're +saved in @code{./pcb.settings}. + +%end-doc */ + +static int ActionSaveSettings(int argc, char **argv, Coord x, Coord y) +{ + int locally = argc > 0 ? (strncasecmp(argv[0], "local", 5) == 0) : 0; + hid_save_settings(locally); + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char saveto_syntax[] = + "SaveTo(Layout|LayoutAs,filename)\n" + "SaveTo(AllConnections|AllUnusedPins|ElementConnections,filename)\n" "SaveTo(PasteBuffer,filename)"; + +static const char saveto_help[] = "Saves data to a file."; + +/* %start-doc actions SaveTo + +@table @code + +@item Layout +Saves the current layout. + +@item LayoutAs +Saves the current layout, and remembers the filename used. + +@item AllConnections +Save all connections to a file. + +@item AllUnusedPins +List all unused pins to a file. + +@item ElementConnections +Save connections to the element at the cursor to a file. + +@item PasteBuffer +Save the content of the active Buffer to a file. This is the graphical way to create a footprint. + +@end table + +%end-doc */ + +static int ActionSaveTo(int argc, char **argv, Coord x, Coord y) +{ + char *function; + char *name; + + function = argv[0]; + name = argv[1]; + + if (strcasecmp(function, "Layout") == 0) { + if (SavePCB(PCB->Filename) == 0) + SetChangedFlag(false); + return 0; + } + + if (argc != 2) + AFAIL(saveto); + + if (strcasecmp(function, "LayoutAs") == 0) { + if (SavePCB(name) == 0) { + SetChangedFlag(false); + free(PCB->Filename); + PCB->Filename = strdup(name); + if (gui->notify_filename_changed != NULL) + gui->notify_filename_changed(); + } + return 0; + } + + if (strcasecmp(function, "AllConnections") == 0) { + FILE *fp; + bool result; + if ((fp = CheckAndOpenFile(name, true, false, &result, NULL)) != NULL) { + LookupConnectionsToAllElements(fp); + fclose(fp); + SetChangedFlag(true); + } + return 0; + } + + if (strcasecmp(function, "AllUnusedPins") == 0) { + FILE *fp; + bool result; + if ((fp = CheckAndOpenFile(name, true, false, &result, NULL)) != NULL) { + LookupUnusedPins(fp); + fclose(fp); + SetChangedFlag(true); + } + return 0; + } + + if (strcasecmp(function, "ElementConnections") == 0) { + ElementTypePtr element; + void *ptrtmp; + FILE *fp; + bool result; + + if ((SearchScreen(Crosshair.X, Crosshair.Y, ELEMENT_TYPE, &ptrtmp, &ptrtmp, &ptrtmp)) != NO_TYPE) { + element = (ElementTypePtr) ptrtmp; + if ((fp = CheckAndOpenFile(name, true, false, &result, NULL)) != NULL) { + LookupElementConnections(element, fp); + fclose(fp); + SetChangedFlag(true); + } + } + return 0; + } + + if (strcasecmp(function, "PasteBuffer") == 0) { + return SaveBufferElements(name); + } + + AFAIL(saveto); +} + +/* --------------------------------------------------------------------------- */ + +static const char quit_syntax[] = "Quit()"; + +static const char quit_help[] = "Quits the application after confirming."; + +/* %start-doc actions Quit + +If you have unsaved changes, you will be prompted to confirm (or +save) before quitting. + +%end-doc */ + +static int ActionQuit(int argc, char **argv, Coord x, Coord y) +{ + char *force = ARG(0); + if (force && strcasecmp(force, "force") == 0) { + PCB->Changed = 0; + exit(0); + } + if (!PCB->Changed || gui->close_confirm_dialog() == HID_CLOSE_CONFIRM_OK) + QuitApplication(); + return 1; +} + + +HID_Action file_action_list[] = { + {"ExecCommand", 0, ActionExecCommand, + execcommand_help, execcommand_syntax} + , + {"LoadFrom", 0, ActionLoadFrom, + loadfrom_help, loadfrom_syntax} + , + {"New", 0, ActionNew, + new_help, new_syntax} + , + {"SaveSettings", 0, ActionSaveSettings, + savesettings_help, savesettings_syntax} + , + {"SaveTo", 0, ActionSaveTo, + saveto_help, saveto_syntax} + , + {"Quit", 0, ActionQuit, + quit_help, quit_syntax} +}; + +REGISTER_ACTIONS(file_action_list) Index: 1.0.8/src/find.c =================================================================== --- 1.0.8/src/find.c (nonexistent) +++ 1.0.8/src/find.c (revision 1136) @@ -0,0 +1,3953 @@ +/* $Id$ */ + +/* + * + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996, 2005 Thomas Nau + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact addresses for paper mail and Email: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + + +/* + * short description: + * - lists for pins and vias, lines, arcs, pads and for polygons are created. + * Every object that has to be checked is added to its list. + * Coarse searching is accomplished with the data rtrees. + * - there's no 'speed-up' mechanism for polygons because they are not used + * as often as other objects + * - the maximum distance between line and pin ... would depend on the angle + * between them. To speed up computation the limit is set to one half + * of the thickness of the objects (cause of square pins). + * + * PV: means pin or via (objects that connect layers) + * LO: all non PV objects (layer objects like lines, arcs, polygons, pads) + * + * 1. first, the LO or PV at the given coordinates is looked up + * 2. all LO connections to that PV are looked up next + * 3. lookup of all LOs connected to LOs from (2). + * This step is repeated until no more new connections are found. + * 4. lookup all PVs connected to the LOs from (2) and (3) + * 5. start again with (1) for all new PVs from (4) + * + * Intersection of line <--> circle: + * - calculate the signed distance from the line to the center, + * return false if abs(distance) > R + * - get the distance from the line <--> distancevector intersection to + * (X1,Y1) in range [0,1], return true if 0 <= distance <= 1 + * - depending on (r > 1.0 or r < 0.0) check the distance of X2,Y2 or X1,Y1 + * to X,Y + * + * Intersection of line <--> line: + * - see the description of 'LineLineIntersect()' + */ + +/* routines to find connections between pins, vias, lines... + */ +#include "config.h" + +#include +#ifdef HAVE_STRING_H +#include +#endif +#include +#include +#include + +#ifdef HAVE_SYS_TIMES_H +#include +#endif + +#include "global.h" + +#include "crosshair.h" +#include "data.h" +#include "draw.h" +#include "error.h" +#include "find.h" +#include "mymem.h" +#include "misc.h" +#include "rtree.h" +#include "polygon.h" +#include "pcb-printf.h" +#include "search.h" +#include "set.h" +#include "undo.h" +#include "rats.h" + + +#undef DEBUG + +RCSID("$Id$"); + + + + +/* --------------------------------------------------------------------------- + * some local macros + */ + +#define EXPAND_BOUNDS(p) if (Bloat > 0) {\ + (p)->BoundingBox.X1 -= Bloat; \ + (p)->BoundingBox.X2 += Bloat; \ + (p)->BoundingBox.Y1 -= Bloat; \ + (p)->BoundingBox.Y2 += Bloat;} + +#define SEPARATE(FP) \ + { \ + int i; \ + fputc('#', (FP)); \ + for (i = Settings.CharPerLine; i; i--) \ + fputc('=', (FP)); \ + fputc('\n', (FP)); \ + } + +#define PADLIST_ENTRY(L,I) \ + (((PadTypePtr *)PadList[(L)].Data)[(I)]) + +#define LINELIST_ENTRY(L,I) \ + (((LineTypePtr *)LineList[(L)].Data)[(I)]) + +#define ARCLIST_ENTRY(L,I) \ + (((ArcTypePtr *)ArcList[(L)].Data)[(I)]) + +#define RATLIST_ENTRY(I) \ + (((RatTypePtr *)RatList.Data)[(I)]) + +#define POLYGONLIST_ENTRY(L,I) \ + (((PolygonTypePtr *)PolygonList[(L)].Data)[(I)]) + +#define PVLIST_ENTRY(I) \ + (((PinTypePtr *)PVList.Data)[(I)]) + +#define IS_PV_ON_RAT(PV, Rat) \ + (IsPointOnLineEnd((PV)->X,(PV)->Y, (Rat))) + +#define IS_PV_ON_ARC(PV, Arc) \ + (TEST_FLAG(SQUAREFLAG, (PV)) ? \ + IsArcInRectangle( \ + (PV)->X -MAX(((PV)->Thickness+1)/2 +Bloat,0), (PV)->Y -MAX(((PV)->Thickness+1)/2 +Bloat,0), \ + (PV)->X +MAX(((PV)->Thickness+1)/2 +Bloat,0), (PV)->Y +MAX(((PV)->Thickness+1)/2 +Bloat,0), \ + (Arc)) : \ + IsPointOnArc((PV)->X,(PV)->Y,MAX((PV)->Thickness/2.0 + Bloat,0.0), (Arc))) + +#define IS_PV_ON_PAD(PV,Pad) \ + ( IsPointInPad((PV)->X, (PV)->Y, MAX((PV)->Thickness/2 +Bloat,0), (Pad))) + +static DrcViolationType + * pcb_drc_violation_new(const char *title, + const char *explanation, + Coord x, Coord y, + Angle angle, + bool have_measured, + Coord measured_value, + Coord required_value, int object_count, long int *object_id_list, int *object_type_list) +{ + DrcViolationType *violation = (DrcViolationType *) malloc(sizeof(DrcViolationType)); + + violation->title = strdup(title); + violation->explanation = strdup(explanation); + violation->x = x; + violation->y = y; + violation->angle = angle; + violation->have_measured = have_measured; + violation->measured_value = measured_value; + violation->required_value = required_value; + violation->object_count = object_count; + violation->object_id_list = object_id_list; + violation->object_type_list = object_type_list; + + return violation; +} + +static void pcb_drc_violation_free(DrcViolationType * violation) +{ + free(violation->title); + free(violation->explanation); + free(violation); +} + +static GString *drc_dialog_message; +static void reset_drc_dialog_message(void) +{ + if (drc_dialog_message) + g_string_free(drc_dialog_message, FALSE); + drc_dialog_message = g_string_new(""); + if (gui->drc_gui != NULL) { + gui->drc_gui->reset_drc_dialog_message(); + } +} + +static void append_drc_dialog_message(const char *fmt, ...) +{ + gchar *new_str; + va_list ap; + va_start(ap, fmt); + new_str = pcb_vprintf(fmt, ap); + g_string_append(drc_dialog_message, new_str); + va_end(ap); + g_free(new_str); +} + +static void GotoError(void); + +static void append_drc_violation(DrcViolationType * violation) +{ + if (gui->drc_gui != NULL) { + gui->drc_gui->append_drc_violation(violation); + } + else { + /* Fallback to formatting the violation message as text */ + append_drc_dialog_message("%s\n", violation->title); + append_drc_dialog_message(_("%m+near %$mD\n"), Settings.grid_unit->allow, violation->x, violation->y); + GotoError(); + } + + if (gui->drc_gui == NULL || gui->drc_gui->log_drc_violations) { + Message(_("WARNING! Design Rule error - %s\n"), violation->title); + Message(_("%m+near location %$mD\n"), Settings.grid_unit->allow, violation->x, violation->y); + } +} + +/* + * message when asked about continuing DRC checks after next + * violation is found. + */ +#define DRC_CONTINUE _("Press Next to continue DRC checking") +#define DRC_NEXT _("Next") +#define DRC_CANCEL _("Cancel") + +static int throw_drc_dialog(void) +{ + int r; + + if (gui->drc_gui != NULL) { + r = gui->drc_gui->throw_drc_dialog(); + } + else { + /* Fallback to formatting the violation message as text */ + append_drc_dialog_message(DRC_CONTINUE); + r = gui->confirm_dialog(drc_dialog_message->str, DRC_CANCEL, DRC_NEXT); + reset_drc_dialog_message(); + } + return r; +} + +/* --------------------------------------------------------------------------- + * some local types + * + * the two 'dummy' structs for PVs and Pads are necessary for creating + * connection lists which include the element's name + */ +typedef struct { + void **Data; /* pointer to index data */ + Cardinal Location, /* currently used position */ + DrawLocation, Number, /* number of objects in list */ + Size; +} ListType, *ListTypePtr; + +/* --------------------------------------------------------------------------- + * some local identifiers + */ +static Coord Bloat = 0; +static int TheFlag = FOUNDFLAG; +static int OldFlag = FOUNDFLAG; +static void *thing_ptr1, *thing_ptr2, *thing_ptr3; +static int thing_type; +find_callback_t find_callback = NULL; +#define make_callback(current_type, current_ptr, from_type, from_ptr, type) \ + do { \ + if (find_callback != NULL) \ + find_callback(current_type, current_ptr, from_type, from_ptr, type); \ + } while(0) + +static bool User = false; /* user action causing this */ +static bool drc = false; /* whether to stop if finding something not found */ +static bool IsBad = false; +static Cardinal drcerr_count; /* count of drc errors */ +static Cardinal TotalP, TotalV, NumberOfPads[2]; +static ListType LineList[MAX_LAYER], /* list of objects to */ + PolygonList[MAX_LAYER], ArcList[MAX_LAYER], PadList[2], RatList, PVList; + +/* --------------------------------------------------------------------------- + * some local prototypes + */ +static bool LookupLOConnectionsToPVList(bool); +static bool LookupLOConnectionsToLOList(bool); +static bool LookupPVConnectionsToLOList(bool); +static bool LookupPVConnectionsToPVList(void); +static bool LookupLOConnectionsToLine(LineTypePtr, Cardinal, bool); +static bool LookupLOConnectionsToPad(PadTypePtr, Cardinal); +static bool LookupLOConnectionsToPolygon(PolygonTypePtr, Cardinal); +static bool LookupLOConnectionsToArc(ArcTypePtr, Cardinal); +static bool LookupLOConnectionsToRatEnd(PointTypePtr, Cardinal); +static bool IsRatPointOnLineEnd(PointTypePtr, LineTypePtr); +static bool ArcArcIntersect(ArcTypePtr, ArcTypePtr); +static bool PrepareNextLoop(FILE *); +static bool PrintElementConnections(ElementTypePtr, FILE *, bool); +static bool ListsEmpty(bool); +static bool DoIt(bool, bool); +static void PrintElementNameList(ElementTypePtr, FILE *); +static void PrintConnectionElementName(ElementTypePtr, FILE *); +static void PrintConnectionListEntry(char *, ElementTypePtr, bool, FILE *); +static void PrintPadConnections(Cardinal, FILE *, bool); +static void PrintPinConnections(FILE *, bool); +static bool PrintAndSelectUnusedPinsAndPadsOfElement(ElementTypePtr, FILE *); +static void DrawNewConnections(void); +static void DumpList(void); +static void LocateError(Coord *, Coord *); +static void BuildObjectList(int *, long int **, int **); +static void GotoError(void); +static bool DRCFind(int, void *, void *, void *); +static bool ListStart(int, void *, void *, void *); +static bool LOTouchesLine(LineTypePtr Line, Cardinal LayerGroup); +static bool PVTouchesLine(LineTypePtr line); +static bool SetThing(int, void *, void *, void *); + +/* --------------------------------------------------------------------------- + * some of the 'pad' routines are the same as for lines because the 'pad' + * struct starts with a line struct. See global.h for details + */ +bool LinePadIntersect(LineTypePtr Line, PadTypePtr Pad) +{ + return LineLineIntersect((Line), (LineTypePtr) Pad); +} + +bool ArcPadIntersect(ArcTypePtr Arc, PadTypePtr Pad) +{ + return LineArcIntersect((LineTypePtr) (Pad), (Arc)); +} + +static bool ADD_PV_TO_LIST(PinTypePtr Pin, int from_type, void *from_ptr, found_conn_type_t type) +{ + if (User) + AddObjectToFlagUndoList(Pin->Element ? PIN_TYPE : VIA_TYPE, Pin->Element ? Pin->Element : Pin, Pin, Pin); + SET_FLAG(TheFlag, Pin); + make_callback(PIN_TYPE, Pin, from_type, from_ptr, type); + PVLIST_ENTRY(PVList.Number) = Pin; + PVList.Number++; +#ifdef DEBUG + if (PVList.Number > PVList.Size) + printf("ADD_PV_TO_LIST overflow! num=%d size=%d\n", PVList.Number, PVList.Size); +#endif + if (drc && !TEST_FLAG(SELECTEDFLAG, Pin)) + return (SetThing(PIN_TYPE, Pin->Element, Pin, Pin)); + return false; +} + +static bool ADD_PAD_TO_LIST(Cardinal L, PadTypePtr Pad, int from_type, void *from_ptr, found_conn_type_t type) +{ +/*fprintf(stderr, "ADD_PAD_TO_LIST cardinal %d %p %d\n", L, Pad, from_type);*/ + if (User) + AddObjectToFlagUndoList(PAD_TYPE, Pad->Element, Pad, Pad); + SET_FLAG(TheFlag, Pad); + make_callback(PAD_TYPE, Pad, from_type, from_ptr, type); + PADLIST_ENTRY((L), PadList[(L)].Number) = Pad; + PadList[(L)].Number++; +#ifdef DEBUG + if (PadList[(L)].Number > PadList[(L)].Size) + printf("ADD_PAD_TO_LIST overflow! lay=%d, num=%d size=%d\n", L, PadList[(L)].Number, PadList[(L)].Size); +#endif + if (drc && !TEST_FLAG(SELECTEDFLAG, Pad)) + return (SetThing(PAD_TYPE, Pad->Element, Pad, Pad)); + return false; +} + +static bool ADD_LINE_TO_LIST(Cardinal L, LineTypePtr Ptr, int from_type, void *from_ptr, found_conn_type_t type) +{ + if (User) + AddObjectToFlagUndoList(LINE_TYPE, LAYER_PTR(L), (Ptr), (Ptr)); + SET_FLAG(TheFlag, (Ptr)); + make_callback(LINE_TYPE, Ptr, from_type, from_ptr, type); + LINELIST_ENTRY((L), LineList[(L)].Number) = (Ptr); + LineList[(L)].Number++; +#ifdef DEBUG + if (LineList[(L)].Number > LineList[(L)].Size) + printf("ADD_LINE_TO_LIST overflow! lay=%d, num=%d size=%d\n", L, LineList[(L)].Number, LineList[(L)].Size); +#endif + if (drc && !TEST_FLAG(SELECTEDFLAG, (Ptr))) + return (SetThing(LINE_TYPE, LAYER_PTR(L), (Ptr), (Ptr))); + return false; +} + +static bool ADD_ARC_TO_LIST(Cardinal L, ArcTypePtr Ptr, int from_type, void *from_ptr, found_conn_type_t type) +{ + if (User) + AddObjectToFlagUndoList(ARC_TYPE, LAYER_PTR(L), (Ptr), (Ptr)); + SET_FLAG(TheFlag, (Ptr)); + make_callback(ARC_TYPE, Ptr, from_type, from_ptr, type); + ARCLIST_ENTRY((L), ArcList[(L)].Number) = (Ptr); + ArcList[(L)].Number++; +#ifdef DEBUG + if (ArcList[(L)].Number > ArcList[(L)].Size) + printf("ADD_ARC_TO_LIST overflow! lay=%d, num=%d size=%d\n", L, ArcList[(L)].Number, ArcList[(L)].Size); +#endif + if (drc && !TEST_FLAG(SELECTEDFLAG, (Ptr))) + return (SetThing(ARC_TYPE, LAYER_PTR(L), (Ptr), (Ptr))); + return false; +} + +static bool ADD_RAT_TO_LIST(RatTypePtr Ptr, int from_type, void *from_ptr, found_conn_type_t type) +{ + if (User) + AddObjectToFlagUndoList(RATLINE_TYPE, (Ptr), (Ptr), (Ptr)); + SET_FLAG(TheFlag, (Ptr)); + make_callback(RATLINE_TYPE, Ptr, from_type, from_ptr, type); + RATLIST_ENTRY(RatList.Number) = (Ptr); + RatList.Number++; +#ifdef DEBUG + if (RatList.Number > RatList.Size) + printf("ADD_RAT_TO_LIST overflow! num=%d size=%d\n", RatList.Number, RatList.Size); +#endif + if (drc && !TEST_FLAG(SELECTEDFLAG, (Ptr))) + return (SetThing(RATLINE_TYPE, (Ptr), (Ptr), (Ptr))); + return false; +} + +static bool ADD_POLYGON_TO_LIST(Cardinal L, PolygonTypePtr Ptr, int from_type, void *from_ptr, found_conn_type_t type) +{ + if (User) + AddObjectToFlagUndoList(POLYGON_TYPE, LAYER_PTR(L), (Ptr), (Ptr)); + SET_FLAG(TheFlag, (Ptr)); + make_callback(POLYGON_TYPE, Ptr, from_type, from_ptr, type); + POLYGONLIST_ENTRY((L), PolygonList[(L)].Number) = (Ptr); + PolygonList[(L)].Number++; +#ifdef DEBUG + if (PolygonList[(L)].Number > PolygonList[(L)].Size) + printf("ADD_ARC_TO_LIST overflow! lay=%d, num=%d size=%d\n", L, PolygonList[(L)].Number, PolygonList[(L)].Size); +#endif + if (drc && !TEST_FLAG(SELECTEDFLAG, (Ptr))) + return (SetThing(POLYGON_TYPE, LAYER_PTR(L), (Ptr), (Ptr))); + return false; +} + +bool PinLineIntersect(PinTypePtr PV, LineTypePtr Line) +{ + if (TEST_FLAG(SQUAREFLAG, PV)) { + int shape = GET_SQUARE(PV); + if (shape <= 1) { + /* the original square case */ + /* IsLineInRectangle already has Bloat factor */ + return IsLineInRectangle(PV->X - (PIN_SIZE(PV) + 1) / 2, + PV->Y - (PIN_SIZE(PV) + 1) / 2, + PV->X + (PIN_SIZE(PV) + 1) / 2, PV->Y + (PIN_SIZE(PV) + 1) / 2, Line); + } + + { + /* shaped pin case */ + POLYAREA *pl, *lp; + int ret; + + pl = PinPoly(PV, PIN_SIZE(PV), 0); + lp = LinePoly(Line, Line->Thickness + Bloat); + ret = Touching(lp, pl); + poly_Free(&pl); + poly_Free(&lp); + return ret; + } + + } + + + /* the original round pin version */ + return IsPointInPad(PV->X, PV->Y, MAX(PIN_SIZE(PV) / 2.0 + Bloat, 0.0), (PadTypePtr) Line); +} + + +bool SetThing(int type, void *ptr1, void *ptr2, void *ptr3) +{ + thing_ptr1 = ptr1; + thing_ptr2 = ptr2; + thing_ptr3 = ptr3; + thing_type = type; + if (type == PIN_TYPE && ptr1 == NULL) { + thing_ptr1 = ptr3; + thing_type = VIA_TYPE; + } + return true; +} + +bool BoxBoxIntersection(BoxTypePtr b1, BoxTypePtr b2) +{ + if (b2->X2 < b1->X1 || b2->X1 > b1->X2) + return false; + if (b2->Y2 < b1->Y1 || b2->Y1 > b1->Y2) + return false; + return true; +} + +static bool PadPadIntersect(PadTypePtr p1, PadTypePtr p2) +{ + return LinePadIntersect((LineTypePtr) p1, p2); +} + +static inline bool PV_TOUCH_PV(PinTypePtr PV1, PinTypePtr PV2) +{ + double t1, t2; + BoxType b1, b2; + int shape1, shape2; + + shape1 = GET_SQUARE(PV1); + shape2 = GET_SQUARE(PV2); + + if ((shape1 > 1) || (shape2 > 1)) { + POLYAREA *pl1, *pl2; + int ret; + + pl1 = PinPoly(PV1, PIN_SIZE(PV1) + Bloat, 0); + pl2 = PinPoly(PV2, PIN_SIZE(PV2) + Bloat, 0); + ret = Touching(pl1, pl2); + poly_Free(&pl1); + poly_Free(&pl2); + return ret; + } + + + t1 = MAX(PV1->Thickness / 2.0 + Bloat, 0); + t2 = MAX(PV2->Thickness / 2.0 + Bloat, 0); + if (IsPointOnPin(PV1->X, PV1->Y, t1, PV2) + || IsPointOnPin(PV2->X, PV2->Y, t2, PV1)) + return true; + if (!TEST_FLAG(SQUAREFLAG, PV1) || !TEST_FLAG(SQUAREFLAG, PV2)) + return false; + /* check for square/square overlap */ + b1.X1 = PV1->X - t1; + b1.X2 = PV1->X + t1; + b1.Y1 = PV1->Y - t1; + b1.Y2 = PV1->Y + t1; + t2 = PV2->Thickness / 2.0; + b2.X1 = PV2->X - t2; + b2.X2 = PV2->X + t2; + b2.Y1 = PV2->Y - t2; + b2.Y2 = PV2->Y + t2; + return BoxBoxIntersection(&b1, &b2); +} + +/* --------------------------------------------------------------------------- + * releases all allocated memory + */ +void FreeLayoutLookupMemory(void) +{ + Cardinal i; + + for (i = 0; i < max_copper_layer; i++) { + free(LineList[i].Data); + LineList[i].Data = NULL; + free(ArcList[i].Data); + ArcList[i].Data = NULL; + free(PolygonList[i].Data); + PolygonList[i].Data = NULL; + } + free(PVList.Data); + PVList.Data = NULL; + free(RatList.Data); + RatList.Data = NULL; +} + +void FreeComponentLookupMemory(void) +{ +/*fprintf(stderr, "PadList free both\n");*/ + free(PadList[0].Data); + PadList[0].Data = NULL; + free(PadList[1].Data); + PadList[1].Data = NULL; +} + +/* --------------------------------------------------------------------------- + * allocates memory for component related stacks ... + * initializes index and sorts it by X1 and X2 + */ +void InitComponentLookup(void) +{ + Cardinal i; + + /* initialize pad data; start by counting the total number + * on each of the two possible layers + */ + NumberOfPads[COMPONENT_LAYER] = NumberOfPads[SOLDER_LAYER] = 0; + ALLPAD_LOOP(PCB->Data); + { + if (TEST_FLAG(ONSOLDERFLAG, pad)) + NumberOfPads[SOLDER_LAYER]++; + else + NumberOfPads[COMPONENT_LAYER]++; + } + ENDALL_LOOP; + for (i = 0; i < 2; i++) { +/*fprintf(stderr, "PadList alloc %d: %d\n", i, NumberOfPads[i]);*/ + + /* allocate memory for working list */ + PadList[i].Data = (void **) calloc(NumberOfPads[i], sizeof(PadTypePtr)); + + /* clear some struct members */ + PadList[i].Location = 0; + PadList[i].DrawLocation = 0; + PadList[i].Number = 0; + PadList[i].Size = NumberOfPads[i]; + } +} + +/* --------------------------------------------------------------------------- + * allocates memory for component related stacks ... + * initializes index and sorts it by X1 and X2 + */ +void InitLayoutLookup(void) +{ + Cardinal i; + + /* initialize line arc and polygon data */ + for (i = 0; i < max_copper_layer; i++) { + LayerTypePtr layer = LAYER_PTR(i); + + if (layer->LineN) { + /* allocate memory for line pointer lists */ + LineList[i].Data = (void **) calloc(layer->LineN, sizeof(LineTypePtr)); + LineList[i].Size = layer->LineN; + } + if (layer->ArcN) { + ArcList[i].Data = (void **) calloc(layer->ArcN, sizeof(ArcTypePtr)); + ArcList[i].Size = layer->ArcN; + } + + + /* allocate memory for polygon list */ + if (layer->PolygonN) { + PolygonList[i].Data = (void **) calloc(layer->PolygonN, sizeof(PolygonTypePtr)); + PolygonList[i].Size = layer->PolygonN; + } + + /* clear some struct members */ + LineList[i].Location = 0; + LineList[i].DrawLocation = 0; + LineList[i].Number = 0; + ArcList[i].Location = 0; + ArcList[i].DrawLocation = 0; + ArcList[i].Number = 0; + PolygonList[i].Location = 0; + PolygonList[i].DrawLocation = 0; + PolygonList[i].Number = 0; + } + + if (PCB->Data->pin_tree) + TotalP = PCB->Data->pin_tree->size; + else + TotalP = 0; + if (PCB->Data->via_tree) + TotalV = PCB->Data->via_tree->size; + else + TotalV = 0; + /* allocate memory for 'new PV to check' list and clear struct */ + PVList.Data = (void **) calloc(TotalP + TotalV, sizeof(PinTypePtr)); + PVList.Size = TotalP + TotalV; + PVList.Location = 0; + PVList.DrawLocation = 0; + PVList.Number = 0; + /* Initialize ratline data */ + RatList.Data = (void **) calloc(PCB->Data->RatN, sizeof(RatTypePtr)); + RatList.Size = PCB->Data->RatN; + RatList.Location = 0; + RatList.DrawLocation = 0; + RatList.Number = 0; +} + +struct pv_info { + Cardinal layer; + PinType pv; + jmp_buf env; +}; + +static int LOCtoPVline_callback(const BoxType * b, void *cl) +{ + LineTypePtr line = (LineTypePtr) b; + struct pv_info *i = (struct pv_info *) cl; + + if (!TEST_FLAG(TheFlag, line) && PinLineIntersect(&i->pv, line) && !TEST_FLAG(HOLEFLAG, &i->pv)) { + if (ADD_LINE_TO_LIST(i->layer, line, PIN_TYPE, &i->pv, FCT_COPPER)) + longjmp(i->env, 1); + } + return 0; +} + +static int LOCtoPVarc_callback(const BoxType * b, void *cl) +{ + ArcTypePtr arc = (ArcTypePtr) b; + struct pv_info *i = (struct pv_info *) cl; + + if (!TEST_FLAG(TheFlag, arc) && IS_PV_ON_ARC(&i->pv, arc) && !TEST_FLAG(HOLEFLAG, &i->pv)) { + if (ADD_ARC_TO_LIST(i->layer, arc, PIN_TYPE, &i->pv, FCT_COPPER)) + longjmp(i->env, 1); + } + return 0; +} + +static int LOCtoPVpad_callback(const BoxType * b, void *cl) +{ + PadTypePtr pad = (PadTypePtr) b; + struct pv_info *i = (struct pv_info *) cl; + + if (!TEST_FLAG(TheFlag, pad) && IS_PV_ON_PAD(&i->pv, pad) && + !TEST_FLAG(HOLEFLAG, &i->pv) && + ADD_PAD_TO_LIST(TEST_FLAG(ONSOLDERFLAG, pad) ? SOLDER_LAYER : COMPONENT_LAYER, pad, PIN_TYPE, &i->pv, FCT_COPPER)) + longjmp(i->env, 1); + return 0; +} + +static int LOCtoPVrat_callback(const BoxType * b, void *cl) +{ + RatTypePtr rat = (RatTypePtr) b; + struct pv_info *i = (struct pv_info *) cl; + + if (!TEST_FLAG(TheFlag, rat) && IS_PV_ON_RAT(&i->pv, rat) && ADD_RAT_TO_LIST(rat, PIN_TYPE, &i->pv, FCT_RAT)) + longjmp(i->env, 1); + return 0; +} + +static int LOCtoPVpoly_callback(const BoxType * b, void *cl) +{ + PolygonTypePtr polygon = (PolygonTypePtr) b; + struct pv_info *i = (struct pv_info *) cl; + + /* if the pin doesn't have a therm and polygon is clearing + * then it can't touch due to clearance, so skip the expensive + * test. If it does have a therm, you still need to test + * because it might not be inside the polygon, or it could + * be on an edge such that it doesn't actually touch. + */ + if (!TEST_FLAG(TheFlag, polygon) && !TEST_FLAG(HOLEFLAG, &i->pv) && + (TEST_THERM(i->layer, &i->pv) || !TEST_FLAG(CLEARPOLYFLAG, polygon) + || !i->pv.Clearance)) { + double wide = MAX(0.5 * i->pv.Thickness + Bloat, 0); + if (TEST_FLAG(SQUAREFLAG, &i->pv)) { + Coord x1 = i->pv.X - (i->pv.Thickness + 1 + Bloat) / 2; + Coord x2 = i->pv.X + (i->pv.Thickness + 1 + Bloat) / 2; + Coord y1 = i->pv.Y - (i->pv.Thickness + 1 + Bloat) / 2; + Coord y2 = i->pv.Y + (i->pv.Thickness + 1 + Bloat) / 2; + if (IsRectangleInPolygon(x1, y1, x2, y2, polygon) + && ADD_POLYGON_TO_LIST(i->layer, polygon, PIN_TYPE, &i->pv, FCT_COPPER)) + longjmp(i->env, 1); + } + else if (TEST_FLAG(OCTAGONFLAG, &i->pv)) { + POLYAREA *oct = OctagonPoly(i->pv.X, i->pv.Y, i->pv.Thickness / 2, GET_SQUARE(&i->pv)); + if (isects(oct, polygon, true) + && ADD_POLYGON_TO_LIST(i->layer, polygon, PIN_TYPE, &i->pv, FCT_COPPER)) + longjmp(i->env, 1); + } + else if (IsPointInPolygon(i->pv.X, i->pv.Y, wide, polygon) + && ADD_POLYGON_TO_LIST(i->layer, polygon, PIN_TYPE, &i->pv, FCT_COPPER)) + longjmp(i->env, 1); + } + return 0; +} + +/* --------------------------------------------------------------------------- + * checks if a PV is connected to LOs, if it is, the LO is added to + * the appropriate list and the 'used' flag is set + */ +static bool LookupLOConnectionsToPVList(bool AndRats) +{ + Cardinal layer; + struct pv_info info; + + /* loop over all PVs currently on list */ + while (PVList.Location < PVList.Number) { + /* get pointer to data */ + info.pv = *(PVLIST_ENTRY(PVList.Location)); + EXPAND_BOUNDS(&info.pv); + + /* check pads */ + if (setjmp(info.env) == 0) + r_search(PCB->Data->pad_tree, (BoxType *) & info.pv, NULL, LOCtoPVpad_callback, &info); + else + return true; + + /* now all lines, arcs and polygons of the several layers */ + for (layer = 0; layer < max_copper_layer; layer++) { + if (LAYER_PTR(layer)->no_drc) + continue; + info.layer = layer; + /* add touching lines */ + if (setjmp(info.env) == 0) + r_search(LAYER_PTR(layer)->line_tree, (BoxType *) & info.pv, NULL, LOCtoPVline_callback, &info); + else + return true; + /* add touching arcs */ + if (setjmp(info.env) == 0) + r_search(LAYER_PTR(layer)->arc_tree, (BoxType *) & info.pv, NULL, LOCtoPVarc_callback, &info); + else + return true; + /* check all polygons */ + if (setjmp(info.env) == 0) + r_search(LAYER_PTR(layer)->polygon_tree, (BoxType *) & info.pv, NULL, LOCtoPVpoly_callback, &info); + else + return true; + } + /* Check for rat-lines that may intersect the PV */ + if (AndRats) { + if (setjmp(info.env) == 0) + r_search(PCB->Data->rat_tree, (BoxType *) & info.pv, NULL, LOCtoPVrat_callback, &info); + else + return true; + } + PVList.Location++; + } + return false; +} + +/* --------------------------------------------------------------------------- + * find all connections between LO at the current list position and new LOs + */ +static bool LookupLOConnectionsToLOList(bool AndRats) +{ + bool done; + Cardinal i, group, layer, ratposition, + lineposition[MAX_LAYER], polyposition[MAX_LAYER], arcposition[MAX_LAYER], padposition[2]; + + /* copy the current LO list positions; the original data is changed + * by 'LookupPVConnectionsToLOList()' which has to check the same + * list entries plus the new ones + */ + for (i = 0; i < max_copper_layer; i++) { + lineposition[i] = LineList[i].Location; + polyposition[i] = PolygonList[i].Location; + arcposition[i] = ArcList[i].Location; + } + for (i = 0; i < 2; i++) + padposition[i] = PadList[i].Location; + ratposition = RatList.Location; + + /* loop over all new LOs in the list; recurse until no + * more new connections in the layergroup were found + */ + do { + Cardinal *position; + + if (AndRats) { + position = &ratposition; + for (; *position < RatList.Number; (*position)++) { + group = RATLIST_ENTRY(*position)->group1; + if (LookupLOConnectionsToRatEnd(&(RATLIST_ENTRY(*position)->Point1), group)) + return (true); + group = RATLIST_ENTRY(*position)->group2; + if (LookupLOConnectionsToRatEnd(&(RATLIST_ENTRY(*position)->Point2), group)) + return (true); + } + } + /* loop over all layergroups */ + for (group = 0; group < max_group; group++) { + Cardinal entry; + + for (entry = 0; entry < PCB->LayerGroups.Number[group]; entry++) { + layer = PCB->LayerGroups.Entries[group][entry]; + + /* be aware that the layer number equal max_copper_layer + * and max_copper_layer+1 have a special meaning for pads + */ + if (layer < max_copper_layer) { + /* try all new lines */ + position = &lineposition[layer]; + for (; *position < LineList[layer].Number; (*position)++) + if (LookupLOConnectionsToLine(LINELIST_ENTRY(layer, *position), group, true)) + return (true); + + /* try all new arcs */ + position = &arcposition[layer]; + for (; *position < ArcList[layer].Number; (*position)++) + if (LookupLOConnectionsToArc(ARCLIST_ENTRY(layer, *position), group)) + return (true); + + /* try all new polygons */ + position = &polyposition[layer]; + for (; *position < PolygonList[layer].Number; (*position)++) + if (LookupLOConnectionsToPolygon(POLYGONLIST_ENTRY(layer, *position), group)) + return (true); + } + else { + /* try all new pads */ + layer -= max_copper_layer; + if (layer > 1) { + Message(_("bad layer number %d max_copper_layer=%d in find.c\n"), layer, max_copper_layer); + return false; + } + position = &padposition[layer]; + for (; *position < PadList[layer].Number; (*position)++) + if (LookupLOConnectionsToPad(PADLIST_ENTRY(layer, *position), group)) + return (true); + } + } + } + + /* check if all lists are done; Later for-loops + * may have changed the prior lists + */ + done = !AndRats || ratposition >= RatList.Number; + for (layer = 0; layer < max_copper_layer + 2; layer++) { + if (layer < max_copper_layer) + done = done && + lineposition[layer] >= LineList[layer].Number + && arcposition[layer] >= ArcList[layer].Number && polyposition[layer] >= PolygonList[layer].Number; + else + done = done && padposition[layer - max_copper_layer] >= PadList[layer - max_copper_layer].Number; + } + } + while (!done); + return (false); +} + +static int pv_pv_callback(const BoxType * b, void *cl) +{ + PinTypePtr pin = (PinTypePtr) b; + struct pv_info *i = (struct pv_info *) cl; + + if (!TEST_FLAG(TheFlag, pin) && PV_TOUCH_PV(&i->pv, pin)) { + if (TEST_FLAG(HOLEFLAG, pin) || TEST_FLAG(HOLEFLAG, &i->pv)) { + SET_FLAG(WARNFLAG, pin); + Settings.RatWarn = true; + if (pin->Element) + Message(_("WARNING: Hole too close to pin.\n")); + else + Message(_("WARNING: Hole too close to via.\n")); + } + else if (ADD_PV_TO_LIST(pin, PIN_TYPE, &i->pv, FCT_COPPER)) + longjmp(i->env, 1); + } + return 0; +} + +/* --------------------------------------------------------------------------- + * searches for new PVs that are connected to PVs on the list + */ +static bool LookupPVConnectionsToPVList(void) +{ + Cardinal save_place; + struct pv_info info; + + + /* loop over all PVs on list */ + save_place = PVList.Location; + while (PVList.Location < PVList.Number) { + int ic; + PinType *orig_pin; + /* get pointer to data */ + orig_pin = (PVLIST_ENTRY(PVList.Location)); + info.pv = *orig_pin; + + /* Internal connection: if pins in the same element have the same + internal connection group number, they are connected */ + ic = GET_INTCONN(orig_pin); + if ((info.pv.Element != NULL) && (ic > 0)) { + ElementType *e = info.pv.Element; + PIN_LOOP(e); + { + if ((orig_pin != pin) && (ic == GET_INTCONN(pin))) { + if (!TEST_FLAG(TheFlag, pin)) + ADD_PV_TO_LIST(pin, PIN_TYPE, orig_pin, FCT_INTERNAL); + } + } + END_LOOP; + } + + + EXPAND_BOUNDS(&info.pv); + if (setjmp(info.env) == 0) + r_search(PCB->Data->via_tree, (BoxType *) & info.pv, NULL, pv_pv_callback, &info); + else + return true; + if (setjmp(info.env) == 0) + r_search(PCB->Data->pin_tree, (BoxType *) & info.pv, NULL, pv_pv_callback, &info); + else + return true; + PVList.Location++; + } + PVList.Location = save_place; + return (false); +} + +struct lo_info { + Cardinal layer; + LineType line; + PadType pad; + ArcType arc; + PolygonType polygon; + RatType rat; + jmp_buf env; +}; + +static int pv_line_callback(const BoxType * b, void *cl) +{ + PinTypePtr pv = (PinTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!TEST_FLAG(TheFlag, pv) && PinLineIntersect(pv, &i->line)) { + if (TEST_FLAG(HOLEFLAG, pv)) { + SET_FLAG(WARNFLAG, pv); + Settings.RatWarn = true; + Message(_("WARNING: Hole too close to line.\n")); + } + else if (ADD_PV_TO_LIST(pv, LINE_TYPE, &i->line, FCT_COPPER)) + longjmp(i->env, 1); + } + return 0; +} + +static int pv_pad_callback(const BoxType * b, void *cl) +{ + PinTypePtr pv = (PinTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!TEST_FLAG(TheFlag, pv) && IS_PV_ON_PAD(pv, &i->pad)) { + if (TEST_FLAG(HOLEFLAG, pv)) { + SET_FLAG(WARNFLAG, pv); + Settings.RatWarn = true; + Message(_("WARNING: Hole too close to pad.\n")); + } + else if (ADD_PV_TO_LIST(pv, PAD_TYPE, &i->pad, FCT_COPPER)) + longjmp(i->env, 1); + } + return 0; +} + +static int pv_arc_callback(const BoxType * b, void *cl) +{ + PinTypePtr pv = (PinTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!TEST_FLAG(TheFlag, pv) && IS_PV_ON_ARC(pv, &i->arc)) { + if (TEST_FLAG(HOLEFLAG, pv)) { + SET_FLAG(WARNFLAG, pv); + Settings.RatWarn = true; + Message(_("WARNING: Hole touches arc.\n")); + } + else if (ADD_PV_TO_LIST(pv, ARC_TYPE, &i->arc, FCT_COPPER)) + longjmp(i->env, 1); + } + return 0; +} + +static int pv_poly_callback(const BoxType * b, void *cl) +{ + PinTypePtr pv = (PinTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + /* note that holes in polygons are ok, so they don't generate warnings. */ + if (!TEST_FLAG(TheFlag, pv) && !TEST_FLAG(HOLEFLAG, pv) && + (TEST_THERM(i->layer, pv) || !TEST_FLAG(CLEARPOLYFLAG, &i->polygon) || !pv->Clearance)) { + if (TEST_FLAG(SQUAREFLAG, pv)) { + Coord x1, x2, y1, y2; + x1 = pv->X - (PIN_SIZE(pv) + 1 + Bloat) / 2; + x2 = pv->X + (PIN_SIZE(pv) + 1 + Bloat) / 2; + y1 = pv->Y - (PIN_SIZE(pv) + 1 + Bloat) / 2; + y2 = pv->Y + (PIN_SIZE(pv) + 1 + Bloat) / 2; + if (IsRectangleInPolygon(x1, y1, x2, y2, &i->polygon) + && ADD_PV_TO_LIST(pv, POLYGON_TYPE, &i->polygon, FCT_COPPER)) + longjmp(i->env, 1); + } + else if (TEST_FLAG(OCTAGONFLAG, pv)) { + POLYAREA *oct = OctagonPoly(pv->X, pv->Y, PIN_SIZE(pv) / 2, GET_SQUARE(pv)); + if (isects(oct, &i->polygon, true) && ADD_PV_TO_LIST(pv, POLYGON_TYPE, &i->polygon, FCT_COPPER)) + longjmp(i->env, 1); + } + else { + if (IsPointInPolygon(pv->X, pv->Y, PIN_SIZE(pv) * 0.5 + Bloat, &i->polygon) + && ADD_PV_TO_LIST(pv, POLYGON_TYPE, &i->polygon, FCT_COPPER)) + longjmp(i->env, 1); + } + } + return 0; +} + +static int pv_rat_callback(const BoxType * b, void *cl) +{ + PinTypePtr pv = (PinTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + /* rats can't cause DRC so there is no early exit */ + if (!TEST_FLAG(TheFlag, pv) && IS_PV_ON_RAT(pv, &i->rat)) + ADD_PV_TO_LIST(pv, RATLINE_TYPE, &i->rat, FCT_RAT); + return 0; +} + +/* --------------------------------------------------------------------------- + * searches for new PVs that are connected to NEW LOs on the list + * This routine updates the position counter of the lists too. + */ +static bool LookupPVConnectionsToLOList(bool AndRats) +{ + Cardinal layer; + struct lo_info info; + + /* loop over all layers */ + for (layer = 0; layer < max_copper_layer; layer++) { + if (LAYER_PTR(layer)->no_drc) + continue; + /* do nothing if there are no PV's */ + if (TotalP + TotalV == 0) { + LineList[layer].Location = LineList[layer].Number; + ArcList[layer].Location = ArcList[layer].Number; + PolygonList[layer].Location = PolygonList[layer].Number; + continue; + } + + /* check all lines */ + while (LineList[layer].Location < LineList[layer].Number) { + info.line = *(LINELIST_ENTRY(layer, LineList[layer].Location)); + EXPAND_BOUNDS(&info.line); + if (setjmp(info.env) == 0) + r_search(PCB->Data->via_tree, (BoxType *) & info.line, NULL, pv_line_callback, &info); + else + return true; + if (setjmp(info.env) == 0) + r_search(PCB->Data->pin_tree, (BoxType *) & info.line, NULL, pv_line_callback, &info); + else + return true; + LineList[layer].Location++; + } + + /* check all arcs */ + while (ArcList[layer].Location < ArcList[layer].Number) { + info.arc = *(ARCLIST_ENTRY(layer, ArcList[layer].Location)); + EXPAND_BOUNDS(&info.arc); + if (setjmp(info.env) == 0) + r_search(PCB->Data->via_tree, (BoxType *) & info.arc, NULL, pv_arc_callback, &info); + else + return true; + if (setjmp(info.env) == 0) + r_search(PCB->Data->pin_tree, (BoxType *) & info.arc, NULL, pv_arc_callback, &info); + else + return true; + ArcList[layer].Location++; + } + + /* now all polygons */ + info.layer = layer; + while (PolygonList[layer].Location < PolygonList[layer].Number) { + info.polygon = *(POLYGONLIST_ENTRY(layer, PolygonList[layer].Location)); + EXPAND_BOUNDS(&info.polygon); + if (setjmp(info.env) == 0) + r_search(PCB->Data->via_tree, (BoxType *) & info.polygon, NULL, pv_poly_callback, &info); + else + return true; + if (setjmp(info.env) == 0) + r_search(PCB->Data->pin_tree, (BoxType *) & info.polygon, NULL, pv_poly_callback, &info); + else + return true; + PolygonList[layer].Location++; + } + } + + /* loop over all pad-layers */ + for (layer = 0; layer < 2; layer++) { + /* do nothing if there are no PV's */ + if (TotalP + TotalV == 0) { + PadList[layer].Location = PadList[layer].Number; + continue; + } + + /* check all pads; for a detailed description see + * the handling of lines in this subroutine + */ + while (PadList[layer].Location < PadList[layer].Number) { + info.pad = *(PADLIST_ENTRY(layer, PadList[layer].Location)); + EXPAND_BOUNDS(&info.pad); + if (setjmp(info.env) == 0) + r_search(PCB->Data->via_tree, (BoxType *) & info.pad, NULL, pv_pad_callback, &info); + else + return true; + if (setjmp(info.env) == 0) + r_search(PCB->Data->pin_tree, (BoxType *) & info.pad, NULL, pv_pad_callback, &info); + else + return true; + PadList[layer].Location++; + } + } + + /* do nothing if there are no PV's */ + if (TotalP + TotalV == 0) + RatList.Location = RatList.Number; + + /* check all rat-lines */ + if (AndRats) { + while (RatList.Location < RatList.Number) { + info.rat = *(RATLIST_ENTRY(RatList.Location)); + r_search_pt(PCB->Data->via_tree, &info.rat.Point1, 1, NULL, pv_rat_callback, &info); + r_search_pt(PCB->Data->via_tree, &info.rat.Point2, 1, NULL, pv_rat_callback, &info); + r_search_pt(PCB->Data->pin_tree, &info.rat.Point1, 1, NULL, pv_rat_callback, &info); + r_search_pt(PCB->Data->pin_tree, &info.rat.Point2, 1, NULL, pv_rat_callback, &info); + + RatList.Location++; + } + } + return (false); +} + +int pv_touch_callback(const BoxType * b, void *cl) +{ + PinTypePtr pin = (PinTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!TEST_FLAG(TheFlag, pin) && PinLineIntersect(pin, &i->line)) + longjmp(i->env, 1); + return 0; +} + +static bool PVTouchesLine(LineTypePtr line) +{ + struct lo_info info; + + info.line = *line; + EXPAND_BOUNDS(&info.line); + if (setjmp(info.env) == 0) + r_search(PCB->Data->via_tree, (BoxType *) & info.line, NULL, pv_touch_callback, &info); + else + return true; + if (setjmp(info.env) == 0) + r_search(PCB->Data->pin_tree, (BoxType *) & info.line, NULL, pv_touch_callback, &info); + else + return true; + + return (false); +} + +/* reduce arc start angle and delta to 0..360 */ +static void normalize_angles(Angle * sa, Angle * d) +{ + if (*d < 0) { + *sa += *d; + *d = -*d; + } + if (*d > 360) /* full circle */ + *d = 360; + *sa = NormalizeAngle(*sa); +} + +static int radius_crosses_arc(double x, double y, ArcTypePtr arc) +{ + double alpha = atan2(y - arc->Y, -x + arc->X) * RAD_TO_DEG; + Angle sa = arc->StartAngle, d = arc->Delta; + + normalize_angles(&sa, &d); + if (alpha < 0) + alpha += 360; + if (sa <= alpha) + return (sa + d) >= alpha; + return (sa + d - 360) >= alpha; +} + +static void get_arc_ends(Coord * box, ArcTypePtr arc) +{ + box[0] = arc->X - arc->Width * cos(M180 * arc->StartAngle); + box[1] = arc->Y + arc->Height * sin(M180 * arc->StartAngle); + box[2] = arc->X - arc->Width * cos(M180 * (arc->StartAngle + arc->Delta)); + box[3] = arc->Y + arc->Height * sin(M180 * (arc->StartAngle + arc->Delta)); +} + +/* --------------------------------------------------------------------------- + * check if two arcs intersect + * first we check for circle intersections, + * then find the actual points of intersection + * and test them to see if they are on arcs + * + * consider a, the distance from the center of arc 1 + * to the point perpendicular to the intersecting points. + * + * a = (r1^2 - r2^2 + l^2)/(2l) + * + * the perpendicular distance to the point of intersection + * is then + * + * d = sqrt(r1^2 - a^2) + * + * the points of intersection would then be + * + * x = X1 + a/l dx +- d/l dy + * y = Y1 + a/l dy -+ d/l dx + * + * where dx = X2 - X1 and dy = Y2 - Y1 + * + * + */ +static bool ArcArcIntersect(ArcTypePtr Arc1, ArcTypePtr Arc2) +{ + double x, y, dx, dy, r1, r2, a, d, l, t, t1, t2, dl; + Coord pdx, pdy; + Coord box[8]; + + t = 0.5 * Arc1->Thickness + Bloat; + t2 = 0.5 * Arc2->Thickness; + t1 = t2 + Bloat; + + /* too thin arc */ + if (t < 0 || t1 < 0) + return false; + + /* try the end points first */ + get_arc_ends(&box[0], Arc1); + get_arc_ends(&box[4], Arc2); + if (IsPointOnArc(box[0], box[1], t, Arc2) + || IsPointOnArc(box[2], box[3], t, Arc2) + || IsPointOnArc(box[4], box[5], t, Arc1) + || IsPointOnArc(box[6], box[7], t, Arc1)) + return true; + + pdx = Arc2->X - Arc1->X; + pdy = Arc2->Y - Arc1->Y; + dl = Distance(Arc1->X, Arc1->Y, Arc2->X, Arc2->Y); + /* concentric arcs, simpler intersection conditions */ + if (dl < 0.5) { + if ((Arc1->Width - t >= Arc2->Width - t2 && Arc1->Width - t <= Arc2->Width + t2) + || (Arc1->Width + t >= Arc2->Width - t2 && Arc1->Width + t <= Arc2->Width + t2)) { + Angle sa1 = Arc1->StartAngle, d1 = Arc1->Delta; + Angle sa2 = Arc2->StartAngle, d2 = Arc2->Delta; + /* NB the endpoints have already been checked, + so we just compare the angles */ + + normalize_angles(&sa1, &d1); + normalize_angles(&sa2, &d2); + /* sa1 == sa2 was caught when checking endpoints */ + if (sa1 > sa2) + if (sa1 < sa2 + d2 || sa1 + d1 - 360 > sa2) + return true; + if (sa2 > sa1) + if (sa2 < sa1 + d1 || sa2 + d2 - 360 > sa1) + return true; + } + return false; + } + r1 = Arc1->Width; + r2 = Arc2->Width; + /* arcs centerlines are too far or too near */ + if (dl > r1 + r2 || dl + r1 < r2 || dl + r2 < r1) { + /* check the nearest to the other arc's center point */ + dx = pdx * r1 / dl; + dy = pdy * r1 / dl; + if (dl + r1 < r2) { /* Arc1 inside Arc2 */ + dx = -dx; + dy = -dy; + } + + if (radius_crosses_arc(Arc1->X + dx, Arc1->Y + dy, Arc1) + && IsPointOnArc(Arc1->X + dx, Arc1->Y + dy, t, Arc2)) + return true; + + dx = -pdx * r2 / dl; + dy = -pdy * r2 / dl; + if (dl + r2 < r1) { /* Arc2 inside Arc1 */ + dx = -dx; + dy = -dy; + } + + if (radius_crosses_arc(Arc2->X + dx, Arc2->Y + dy, Arc2) + && IsPointOnArc(Arc2->X + dx, Arc2->Y + dy, t1, Arc1)) + return true; + return false; + } + + l = dl * dl; + r1 *= r1; + r2 *= r2; + a = 0.5 * (r1 - r2 + l) / l; + r1 = r1 / l; + d = r1 - a * a; + /* the circles are too far apart to touch or probably just touch: + check the nearest point */ + if (d < 0) + d = 0; + else + d = sqrt(d); + x = Arc1->X + a * pdx; + y = Arc1->Y + a * pdy; + dx = d * pdx; + dy = d * pdy; + if (radius_crosses_arc(x + dy, y - dx, Arc1) + && IsPointOnArc(x + dy, y - dx, t, Arc2)) + return true; + if (radius_crosses_arc(x + dy, y - dx, Arc2) + && IsPointOnArc(x + dy, y - dx, t1, Arc1)) + return true; + + if (radius_crosses_arc(x - dy, y + dx, Arc1) + && IsPointOnArc(x - dy, y + dx, t, Arc2)) + return true; + if (radius_crosses_arc(x - dy, y + dx, Arc2) + && IsPointOnArc(x - dy, y + dx, t1, Arc1)) + return true; + return false; +} + +/* --------------------------------------------------------------------------- + * Tests if point is same as line end point + */ +static bool IsRatPointOnLineEnd(PointTypePtr Point, LineTypePtr Line) +{ + if ((Point->X == Line->Point1.X && Point->Y == Line->Point1.Y) + || (Point->X == Line->Point2.X && Point->Y == Line->Point2.Y)) + return (true); + return (false); +} + +static void form_slanted_rectangle(PointType p[4], LineTypePtr l) +/* writes vertices of a squared line */ +{ + double dwx = 0, dwy = 0; + if (l->Point1.Y == l->Point2.Y) + dwx = l->Thickness / 2.0; + else if (l->Point1.X == l->Point2.X) + dwy = l->Thickness / 2.0; + else { + Coord dX = l->Point2.X - l->Point1.X; + Coord dY = l->Point2.Y - l->Point1.Y; + double r = Distance(l->Point1.X, l->Point1.Y, l->Point2.X, l->Point2.Y); + dwx = l->Thickness / 2.0 / r * dX; + dwy = l->Thickness / 2.0 / r * dY; + } + p[0].X = l->Point1.X - dwx + dwy; + p[0].Y = l->Point1.Y - dwy - dwx; + p[1].X = l->Point1.X - dwx - dwy; + p[1].Y = l->Point1.Y - dwy + dwx; + p[2].X = l->Point2.X + dwx - dwy; + p[2].Y = l->Point2.Y + dwy + dwx; + p[3].X = l->Point2.X + dwx + dwy; + p[3].Y = l->Point2.Y + dwy - dwx; +} + +/* --------------------------------------------------------------------------- + * checks if two lines intersect + * from news FAQ: + * + * Let A,B,C,D be 2-space position vectors. Then the directed line + * segments AB & CD are given by: + * + * AB=A+r(B-A), r in [0,1] + * CD=C+s(D-C), s in [0,1] + * + * If AB & CD intersect, then + * + * A+r(B-A)=C+s(D-C), or + * + * XA+r(XB-XA)=XC+s(XD-XC) + * YA+r(YB-YA)=YC+s(YD-YC) for some r,s in [0,1] + * + * Solving the above for r and s yields + * + * (YA-YC)(XD-XC)-(XA-XC)(YD-YC) + * r = ----------------------------- (eqn 1) + * (XB-XA)(YD-YC)-(YB-YA)(XD-XC) + * + * (YA-YC)(XB-XA)-(XA-XC)(YB-YA) + * s = ----------------------------- (eqn 2) + * (XB-XA)(YD-YC)-(YB-YA)(XD-XC) + * + * Let I be the position vector of the intersection point, then + * + * I=A+r(B-A) or + * + * XI=XA+r(XB-XA) + * YI=YA+r(YB-YA) + * + * By examining the values of r & s, you can also determine some + * other limiting conditions: + * + * If 0<=r<=1 & 0<=s<=1, intersection exists + * r<0 or r>1 or s<0 or s>1 line segments do not intersect + * + * If the denominator in eqn 1 is zero, AB & CD are parallel + * If the numerator in eqn 1 is also zero, AB & CD are coincident + * + * If the intersection point of the 2 lines are needed (lines in this + * context mean infinite lines) regardless whether the two line + * segments intersect, then + * + * If r>1, I is located on extension of AB + * If r<0, I is located on extension of BA + * If s>1, I is located on extension of CD + * If s<0, I is located on extension of DC + * + * Also note that the denominators of eqn 1 & 2 are identical. + * + */ +bool LineLineIntersect(LineTypePtr Line1, LineTypePtr Line2) +{ + double s, r; + double line1_dx, line1_dy, line2_dx, line2_dy, point1_dx, point1_dy; + if (TEST_FLAG(SQUAREFLAG, Line1)) { /* pretty reckless recursion */ + PointType p[4]; + form_slanted_rectangle(p, Line1); + return IsLineInQuadrangle(p, Line2); + } + /* here come only round Line1 because IsLineInQuadrangle() + calls LineLineIntersect() with first argument rounded */ + if (TEST_FLAG(SQUAREFLAG, Line2)) { + PointType p[4]; + form_slanted_rectangle(p, Line2); + return IsLineInQuadrangle(p, Line1); + } + /* now all lines are round */ + + /* Check endpoints: this provides a quick exit, catches + * cases where the "real" lines don't intersect but the + * thick lines touch, and ensures that the dx/dy business + * below does not cause a divide-by-zero. */ + if (IsPointInPad(Line2->Point1.X, Line2->Point1.Y, MAX(Line2->Thickness / 2 + Bloat, 0), (PadTypePtr) Line1) + || IsPointInPad(Line2->Point2.X, Line2->Point2.Y, MAX(Line2->Thickness / 2 + Bloat, 0), (PadTypePtr) Line1) + || IsPointInPad(Line1->Point1.X, Line1->Point1.Y, MAX(Line1->Thickness / 2 + Bloat, 0), (PadTypePtr) Line2) + || IsPointInPad(Line1->Point2.X, Line1->Point2.Y, MAX(Line1->Thickness / 2 + Bloat, 0), (PadTypePtr) Line2)) + return true; + + /* setup some constants */ + line1_dx = Line1->Point2.X - Line1->Point1.X; + line1_dy = Line1->Point2.Y - Line1->Point1.Y; + line2_dx = Line2->Point2.X - Line2->Point1.X; + line2_dy = Line2->Point2.Y - Line2->Point1.Y; + point1_dx = Line1->Point1.X - Line2->Point1.X; + point1_dy = Line1->Point1.Y - Line2->Point1.Y; + + /* If either line is a point, we have failed already, since the + * endpoint check above will have caught an "intersection". */ + if ((line1_dx == 0 && line1_dy == 0) + || (line2_dx == 0 && line2_dy == 0)) + return false; + + /* set s to cross product of Line1 and the line + * Line1.Point1--Line2.Point1 (as vectors) */ + s = point1_dy * line1_dx - point1_dx * line1_dy; + + /* set r to cross product of both lines (as vectors) */ + r = line1_dx * line2_dy - line1_dy * line2_dx; + + /* No cross product means parallel lines, or maybe Line2 is + * zero-length. In either case, since we did a bounding-box + * check before getting here, the above IsPointInPad() checks + * will have caught any intersections. */ + if (r == 0.0) + return false; + + s /= r; + r = (point1_dy * line2_dx - point1_dx * line2_dy) / r; + + /* intersection is at least on AB */ + if (r >= 0.0 && r <= 1.0) + return (s >= 0.0 && s <= 1.0); + + /* intersection is at least on CD */ + /* [removed this case since it always returns false --asp] */ + return false; +} + +/*--------------------------------------------------- + * + * Check for line intersection with an arc + * + * Mostly this is like the circle/line intersection + * found in IsPointOnLine (search.c) see the detailed + * discussion for the basics there. + * + * Since this is only an arc, not a full circle we need + * to find the actual points of intersection with the + * circle, and see if they are on the arc. + * + * To do this, we translate along the line from the point Q + * plus or minus a distance delta = sqrt(Radius^2 - d^2) + * but it's handy to normalize with respect to l, the line + * length so a single projection is done (e.g. we don't first + * find the point Q + * + * The projection is now of the form + * + * Px = X1 + (r +- r2)(X2 - X1) + * Py = Y1 + (r +- r2)(Y2 - Y1) + * + * Where r2 sqrt(Radius^2 l^2 - d^2)/l^2 + * note that this is the variable d, not the symbol d described in IsPointOnLine + * (variable d = symbol d * l) + * + * The end points are hell so they are checked individually + */ +bool LineArcIntersect(LineTypePtr Line, ArcTypePtr Arc) +{ + double dx, dy, dx1, dy1, l, d, r, r2, Radius; + BoxTypePtr box; + + dx = Line->Point2.X - Line->Point1.X; + dy = Line->Point2.Y - Line->Point1.Y; + dx1 = Line->Point1.X - Arc->X; + dy1 = Line->Point1.Y - Arc->Y; + l = dx * dx + dy * dy; + d = dx * dy1 - dy * dx1; + d *= d; + + /* use the larger diameter circle first */ + Radius = Arc->Width + MAX(0.5 * (Arc->Thickness + Line->Thickness) + Bloat, 0.0); + Radius *= Radius; + r2 = Radius * l - d; + /* projection doesn't even intersect circle when r2 < 0 */ + if (r2 < 0) + return (false); + /* check the ends of the line in case the projected point */ + /* of intersection is beyond the line end */ + if (IsPointOnArc(Line->Point1.X, Line->Point1.Y, MAX(0.5 * Line->Thickness + Bloat, 0.0), Arc)) + return (true); + if (IsPointOnArc(Line->Point2.X, Line->Point2.Y, MAX(0.5 * Line->Thickness + Bloat, 0.0), Arc)) + return (true); + if (l == 0.0) + return (false); + r2 = sqrt(r2); + Radius = -(dx * dx1 + dy * dy1); + r = (Radius + r2) / l; + if (r >= 0 && r <= 1 + && IsPointOnArc(Line->Point1.X + r * dx, Line->Point1.Y + r * dy, MAX(0.5 * Line->Thickness + Bloat, 0.0), Arc)) + return (true); + r = (Radius - r2) / l; + if (r >= 0 && r <= 1 + && IsPointOnArc(Line->Point1.X + r * dx, Line->Point1.Y + r * dy, MAX(0.5 * Line->Thickness + Bloat, 0.0), Arc)) + return (true); + /* check arc end points */ + box = GetArcEnds(Arc); + if (IsPointInPad(box->X1, box->Y1, Arc->Thickness * 0.5 + Bloat, (PadTypePtr) Line)) + return true; + if (IsPointInPad(box->X2, box->Y2, Arc->Thickness * 0.5 + Bloat, (PadTypePtr) Line)) + return true; + return false; +} + +static int LOCtoArcLine_callback(const BoxType * b, void *cl) +{ + LineTypePtr line = (LineTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!TEST_FLAG(TheFlag, line) && LineArcIntersect(line, &i->arc)) { + if (ADD_LINE_TO_LIST(i->layer, line, ARC_TYPE, &i->arc, FCT_COPPER)) + longjmp(i->env, 1); + } + return 0; +} + +static int LOCtoArcArc_callback(const BoxType * b, void *cl) +{ + ArcTypePtr arc = (ArcTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!arc->Thickness) + return 0; + if (!TEST_FLAG(TheFlag, arc) && ArcArcIntersect(&i->arc, arc)) { + if (ADD_ARC_TO_LIST(i->layer, arc, ARC_TYPE, &i->arc, FCT_COPPER)) + longjmp(i->env, 1); + } + return 0; +} + +static int LOCtoArcPad_callback(const BoxType * b, void *cl) +{ + PadTypePtr pad = (PadTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!TEST_FLAG(TheFlag, pad) && i->layer == (TEST_FLAG(ONSOLDERFLAG, pad) ? SOLDER_LAYER : COMPONENT_LAYER) + && ArcPadIntersect(&i->arc, pad) && ADD_PAD_TO_LIST(i->layer, pad, ARC_TYPE, &i->arc, FCT_COPPER)) + longjmp(i->env, 1); + return 0; +} + +/* --------------------------------------------------------------------------- + * searches all LOs that are connected to the given arc on the given + * layergroup. All found connections are added to the list + * + * the notation that is used is: + * Xij means Xj at arc i + */ +static bool LookupLOConnectionsToArc(ArcTypePtr Arc, Cardinal LayerGroup) +{ + Cardinal entry; + struct lo_info info; + + info.arc = *Arc; + EXPAND_BOUNDS(&info.arc); + /* loop over all layers of the group */ + for (entry = 0; entry < PCB->LayerGroups.Number[LayerGroup]; entry++) { + Cardinal layer; + GList *i; + + layer = PCB->LayerGroups.Entries[LayerGroup][entry]; + + /* handle normal layers */ + if (layer < max_copper_layer) { + info.layer = layer; + /* add arcs */ + if (setjmp(info.env) == 0) + r_search(LAYER_PTR(layer)->line_tree, &info.arc.BoundingBox, NULL, LOCtoArcLine_callback, &info); + else + return true; + + if (setjmp(info.env) == 0) + r_search(LAYER_PTR(layer)->arc_tree, &info.arc.BoundingBox, NULL, LOCtoArcArc_callback, &info); + else + return true; + + /* now check all polygons */ + for (i = PCB->Data->Layer[layer].Polygon; i != NULL; i = g_list_next(i)) { + PolygonType *polygon = i->data; + if (!TEST_FLAG(TheFlag, polygon) && IsArcInPolygon(Arc, polygon) + && ADD_POLYGON_TO_LIST(layer, polygon, ARC_TYPE, Arc, FCT_COPPER)) + return true; + } + } + else { + info.layer = layer - max_copper_layer; + if (setjmp(info.env) == 0) + r_search(PCB->Data->pad_tree, &info.arc.BoundingBox, NULL, LOCtoArcPad_callback, &info); + else + return true; + } + } + return (false); +} + +static int LOCtoLineLine_callback(const BoxType * b, void *cl) +{ + LineTypePtr line = (LineTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!TEST_FLAG(TheFlag, line) && LineLineIntersect(&i->line, line)) { + if (ADD_LINE_TO_LIST(i->layer, line, LINE_TYPE, &i->line, FCT_COPPER)) + longjmp(i->env, 1); + } + return 0; +} + +static int LOCtoLineArc_callback(const BoxType * b, void *cl) +{ + ArcTypePtr arc = (ArcTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!arc->Thickness) + return 0; + if (!TEST_FLAG(TheFlag, arc) && LineArcIntersect(&i->line, arc)) { + if (ADD_ARC_TO_LIST(i->layer, arc, LINE_TYPE, &i->line, FCT_COPPER)) + longjmp(i->env, 1); + } + return 0; +} + +static int LOCtoLineRat_callback(const BoxType * b, void *cl) +{ + RatTypePtr rat = (RatTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!TEST_FLAG(TheFlag, rat)) { + if ((rat->group1 == i->layer) + && IsRatPointOnLineEnd(&rat->Point1, &i->line)) { + if (ADD_RAT_TO_LIST(rat, LINE_TYPE, &i->line, FCT_RAT)) + longjmp(i->env, 1); + } + else if ((rat->group2 == i->layer) + && IsRatPointOnLineEnd(&rat->Point2, &i->line)) { + if (ADD_RAT_TO_LIST(rat, LINE_TYPE, &i->line, FCT_RAT)) + longjmp(i->env, 1); + } + } + return 0; +} + +static int LOCtoLinePad_callback(const BoxType * b, void *cl) +{ + PadTypePtr pad = (PadTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!TEST_FLAG(TheFlag, pad) && i->layer == (TEST_FLAG(ONSOLDERFLAG, pad) ? SOLDER_LAYER : COMPONENT_LAYER) + && LinePadIntersect(&i->line, pad) && ADD_PAD_TO_LIST(i->layer, pad, LINE_TYPE, &i->line, FCT_COPPER)) + longjmp(i->env, 1); + return 0; +} + +/* --------------------------------------------------------------------------- + * searches all LOs that are connected to the given line on the given + * layergroup. All found connections are added to the list + * + * the notation that is used is: + * Xij means Xj at line i + */ +static bool LookupLOConnectionsToLine(LineTypePtr Line, Cardinal LayerGroup, bool PolysTo) +{ + Cardinal entry; + struct lo_info info; + + info.line = *Line; + info.layer = LayerGroup; + EXPAND_BOUNDS(&info.line) + /* add the new rat lines */ + if (setjmp(info.env) == 0) + r_search(PCB->Data->rat_tree, &info.line.BoundingBox, NULL, LOCtoLineRat_callback, &info); + else + return true; + + /* loop over all layers of the group */ + for (entry = 0; entry < PCB->LayerGroups.Number[LayerGroup]; entry++) { + Cardinal layer; + + layer = PCB->LayerGroups.Entries[LayerGroup][entry]; + + /* handle normal layers */ + if (layer < max_copper_layer) { + info.layer = layer; + /* add lines */ + if (setjmp(info.env) == 0) + r_search(LAYER_PTR(layer)->line_tree, (BoxType *) & info.line, NULL, LOCtoLineLine_callback, &info); + else + return true; + /* add arcs */ + if (setjmp(info.env) == 0) + r_search(LAYER_PTR(layer)->arc_tree, (BoxType *) & info.line, NULL, LOCtoLineArc_callback, &info); + else + return true; + /* now check all polygons */ + if (PolysTo) { + GList *i; + for (i = PCB->Data->Layer[layer].Polygon; i != NULL; i = g_list_next(i)) { + PolygonType *polygon = i->data; + if (!TEST_FLAG(TheFlag, polygon) && IsLineInPolygon(Line, polygon) + && ADD_POLYGON_TO_LIST(layer, polygon, LINE_TYPE, Line, FCT_COPPER)) + return true; + } + } + } + else { + /* handle special 'pad' layers */ + info.layer = layer - max_copper_layer; + if (setjmp(info.env) == 0) + r_search(PCB->Data->pad_tree, &info.line.BoundingBox, NULL, LOCtoLinePad_callback, &info); + else + return true; + } + } + return (false); +} + +static int LOT_Linecallback(const BoxType * b, void *cl) +{ + LineTypePtr line = (LineTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!TEST_FLAG(TheFlag, line) && LineLineIntersect(&i->line, line)) + longjmp(i->env, 1); + return 0; +} + +static int LOT_Arccallback(const BoxType * b, void *cl) +{ + ArcTypePtr arc = (ArcTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!arc->Thickness) + return 0; + if (!TEST_FLAG(TheFlag, arc) && LineArcIntersect(&i->line, arc)) + longjmp(i->env, 1); + return 0; +} + +static int LOT_Padcallback(const BoxType * b, void *cl) +{ + PadTypePtr pad = (PadTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!TEST_FLAG(TheFlag, pad) && i->layer == (TEST_FLAG(ONSOLDERFLAG, pad) ? SOLDER_LAYER : COMPONENT_LAYER) + && LinePadIntersect(&i->line, pad)) + longjmp(i->env, 1); + return 0; +} + +static bool LOTouchesLine(LineTypePtr Line, Cardinal LayerGroup) +{ + Cardinal entry; + struct lo_info info; + + + /* the maximum possible distance */ + + info.line = *Line; + EXPAND_BOUNDS(&info.line); + + /* loop over all layers of the group */ + for (entry = 0; entry < PCB->LayerGroups.Number[LayerGroup]; entry++) { + Cardinal layer = PCB->LayerGroups.Entries[LayerGroup][entry]; + + /* handle normal layers */ + if (layer < max_copper_layer) { + GList *i; + + /* find the first line that touches coordinates */ + + if (setjmp(info.env) == 0) + r_search(LAYER_PTR(layer)->line_tree, (BoxType *) & info.line, NULL, LOT_Linecallback, &info); + else + return (true); + if (setjmp(info.env) == 0) + r_search(LAYER_PTR(layer)->arc_tree, (BoxType *) & info.line, NULL, LOT_Arccallback, &info); + else + return (true); + + /* now check all polygons */ + for (i = PCB->Data->Layer[layer].Polygon; i != NULL; i = g_list_next(i)) { + PolygonType *polygon = i->data; + if (!TEST_FLAG(TheFlag, polygon) + && IsLineInPolygon(Line, polygon)) + return (true); + } + } + else { + /* handle special 'pad' layers */ + info.layer = layer - max_copper_layer; + if (setjmp(info.env) == 0) + r_search(PCB->Data->pad_tree, &info.line.BoundingBox, NULL, LOT_Padcallback, &info); + else + return true; + } + } + return (false); +} + +struct rat_info { + Cardinal layer; + PointTypePtr Point; + jmp_buf env; +}; + +static int LOCtoRat_callback(const BoxType * b, void *cl) +{ + LineTypePtr line = (LineTypePtr) b; + struct rat_info *i = (struct rat_info *) cl; + + if (!TEST_FLAG(TheFlag, line) && + ((line->Point1.X == i->Point->X && + line->Point1.Y == i->Point->Y) || (line->Point2.X == i->Point->X && line->Point2.Y == i->Point->Y))) { + if (ADD_LINE_TO_LIST(i->layer, line, RATLINE_TYPE, &i->Point, FCT_RAT)) + longjmp(i->env, 1); + } + return 0; +} + +static int PolygonToRat_callback(const BoxType * b, void *cl) +{ + PolygonTypePtr polygon = (PolygonTypePtr) b; + struct rat_info *i = (struct rat_info *) cl; + + if (!TEST_FLAG(TheFlag, polygon) && polygon->Clipped && + (i->Point->X == polygon->Clipped->contours->head.point[0]) && + (i->Point->Y == polygon->Clipped->contours->head.point[1])) { + if (ADD_POLYGON_TO_LIST(i->layer, polygon, RATLINE_TYPE, &i->Point, FCT_RAT)) + longjmp(i->env, 1); + } + return 0; +} + +static int LOCtoPad_callback(const BoxType * b, void *cl) +{ + PadTypePtr pad = (PadTypePtr) b; + struct rat_info *i = (struct rat_info *) cl; + + if (!TEST_FLAG(TheFlag, pad) && i->layer == + (TEST_FLAG(ONSOLDERFLAG, pad) ? SOLDER_LAYER : COMPONENT_LAYER) && + ((pad->Point1.X == i->Point->X && pad->Point1.Y == i->Point->Y) || + (pad->Point2.X == i->Point->X && pad->Point2.Y == i->Point->Y) || + ((pad->Point1.X + pad->Point2.X) / 2 == i->Point->X && + (pad->Point1.Y + pad->Point2.Y) / 2 == i->Point->Y)) && + ADD_PAD_TO_LIST(i->layer, pad, RATLINE_TYPE, &i->Point, FCT_RAT)) + longjmp(i->env, 1); + return 0; +} + +/* --------------------------------------------------------------------------- + * searches all LOs that are connected to the given rat-line on the given + * layergroup. All found connections are added to the list + * + * the notation that is used is: + * Xij means Xj at line i + */ +static bool LookupLOConnectionsToRatEnd(PointTypePtr Point, Cardinal LayerGroup) +{ + Cardinal entry; + struct rat_info info; + + info.Point = Point; + /* loop over all layers of this group */ + for (entry = 0; entry < PCB->LayerGroups.Number[LayerGroup]; entry++) { + Cardinal layer; + + layer = PCB->LayerGroups.Entries[LayerGroup][entry]; + /* handle normal layers + rats don't ever touch + arcs by definition + */ + + if (layer < max_copper_layer) { + info.layer = layer; + if (setjmp(info.env) == 0) + r_search_pt(LAYER_PTR(layer)->line_tree, Point, 1, NULL, LOCtoRat_callback, &info); + else + return true; + if (setjmp(info.env) == 0) + r_search_pt(LAYER_PTR(layer)->polygon_tree, Point, 1, NULL, PolygonToRat_callback, &info); + } + else { + /* handle special 'pad' layers */ + info.layer = layer - max_copper_layer; + if (setjmp(info.env) == 0) + r_search_pt(PCB->Data->pad_tree, Point, 1, NULL, LOCtoPad_callback, &info); + else + return true; + } + } + return (false); +} + +static int LOCtoPadLine_callback(const BoxType * b, void *cl) +{ + LineTypePtr line = (LineTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!TEST_FLAG(TheFlag, line) && LinePadIntersect(line, &i->pad)) { + if (ADD_LINE_TO_LIST(i->layer, line, PAD_TYPE, &i->pad, FCT_COPPER)) + longjmp(i->env, 1); + } + return 0; +} + +static int LOCtoPadArc_callback(const BoxType * b, void *cl) +{ + ArcTypePtr arc = (ArcTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!arc->Thickness) + return 0; + if (!TEST_FLAG(TheFlag, arc) && ArcPadIntersect(arc, &i->pad)) { + if (ADD_ARC_TO_LIST(i->layer, arc, PAD_TYPE, &i->pad, FCT_COPPER)) + longjmp(i->env, 1); + } + return 0; +} + +static int LOCtoPadPoly_callback(const BoxType * b, void *cl) +{ + PolygonTypePtr polygon = (PolygonTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + + if (!TEST_FLAG(TheFlag, polygon) && (!TEST_FLAG(CLEARPOLYFLAG, polygon) || !i->pad.Clearance)) { + if (IsPadInPolygon(&i->pad, polygon) && ADD_POLYGON_TO_LIST(i->layer, polygon, PAD_TYPE, &i->pad, FCT_COPPER)) + longjmp(i->env, 1); + } + return 0; +} + +static int LOCtoPadRat_callback(const BoxType * b, void *cl) +{ + RatTypePtr rat = (RatTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!TEST_FLAG(TheFlag, rat)) { + if (rat->group1 == i->layer && + ((rat->Point1.X == i->pad.Point1.X && rat->Point1.Y == i->pad.Point1.Y) || + (rat->Point1.X == i->pad.Point2.X && rat->Point1.Y == i->pad.Point2.Y) || + (rat->Point1.X == (i->pad.Point1.X + i->pad.Point2.X) / 2 && + rat->Point1.Y == (i->pad.Point1.Y + i->pad.Point2.Y) / 2))) { + if (ADD_RAT_TO_LIST(rat, PAD_TYPE, &i->pad, FCT_RAT)) + longjmp(i->env, 1); + } + else if (rat->group2 == i->layer && + ((rat->Point2.X == i->pad.Point1.X && rat->Point2.Y == i->pad.Point1.Y) || + (rat->Point2.X == i->pad.Point2.X && rat->Point2.Y == i->pad.Point2.Y) || + (rat->Point2.X == (i->pad.Point1.X + i->pad.Point2.X) / 2 && + rat->Point2.Y == (i->pad.Point1.Y + i->pad.Point2.Y) / 2))) { + if (ADD_RAT_TO_LIST(rat, PAD_TYPE, &i->pad, FCT_RAT)) + longjmp(i->env, 1); + } + } + return 0; +} + +static int LOCtoPadPad_callback(const BoxType * b, void *cl) +{ + PadTypePtr pad = (PadTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!TEST_FLAG(TheFlag, pad) && i->layer == (TEST_FLAG(ONSOLDERFLAG, pad) ? SOLDER_LAYER : COMPONENT_LAYER) + && PadPadIntersect(pad, &i->pad) && ADD_PAD_TO_LIST(i->layer, pad, PAD_TYPE, &i->pad, FCT_COPPER)) + longjmp(i->env, 1); + return 0; +} + +/* --------------------------------------------------------------------------- + * searches all LOs that are connected to the given pad on the given + * layergroup. All found connections are added to the list + */ +static bool LookupLOConnectionsToPad(PadTypePtr Pad, Cardinal LayerGroup) +{ + Cardinal entry; + struct lo_info info; + int ic; + bool retv = false; + + /* Internal connection: if pads in the same element have the same + internal connection group number, they are connected */ + ic = GET_INTCONN(Pad); + if ((Pad->Element != NULL) && (ic > 0)) { + ElementType *e = Pad->Element; + PadTypePtr orig_pad = Pad; + int tlayer = -1; + +/*fprintf(stderr, "lg===\n");*/ + for (entry = 0; entry < PCB->LayerGroups.Number[LayerGroup]; entry++) { + Cardinal layer; + layer = PCB->LayerGroups.Entries[LayerGroup][entry]; +/*fprintf(stderr, "lg: %d\n", layer);*/ + if (layer == COMPONENT_LAYER) + tlayer = COMPONENT_LAYER; + else if (layer == SOLDER_LAYER) + tlayer = SOLDER_LAYER; + } + +/*fprintf(stderr, "tlayer=%d\n", tlayer);*/ + + if (tlayer >= 0) { + PAD_LOOP(e); + { + if ((orig_pad != pad) && (ic == GET_INTCONN(pad))) { + int padlayer = TEST_FLAG(ONSOLDERFLAG, pad) ? SOLDER_LAYER : COMPONENT_LAYER; +/*fprintf(stderr, "layergroup1: %d {%d %d %d} %d \n", tlayer, TEST_FLAG(ONSOLDERFLAG, pad), SOLDER_LAYER, COMPONENT_LAYER, padlayer);*/ + if ((!TEST_FLAG(TheFlag, pad)) && (tlayer != padlayer)) { +/*fprintf(stderr, "layergroup2\n");*/ + ADD_PAD_TO_LIST(padlayer, pad, PAD_TYPE, orig_pad, FCT_INTERNAL); + if (LookupLOConnectionsToPad(pad, LayerGroup)) + retv = true; + } + } + } + END_LOOP; + } + } + + + if (!TEST_FLAG(SQUAREFLAG, Pad)) + return (LookupLOConnectionsToLine((LineTypePtr) Pad, LayerGroup, false)); + + info.pad = *Pad; + EXPAND_BOUNDS(&info.pad); + /* add the new rat lines */ + info.layer = LayerGroup; + if (setjmp(info.env) == 0) + r_search(PCB->Data->rat_tree, &info.pad.BoundingBox, NULL, LOCtoPadRat_callback, &info); + else + return true; + + /* loop over all layers of the group */ + for (entry = 0; entry < PCB->LayerGroups.Number[LayerGroup]; entry++) { + Cardinal layer; + + layer = PCB->LayerGroups.Entries[LayerGroup][entry]; + /* handle normal layers */ + if (layer < max_copper_layer) { + info.layer = layer; + /* add lines */ + if (setjmp(info.env) == 0) + r_search(LAYER_PTR(layer)->line_tree, &info.pad.BoundingBox, NULL, LOCtoPadLine_callback, &info); + else + return true; + /* add arcs */ + if (setjmp(info.env) == 0) + r_search(LAYER_PTR(layer)->arc_tree, &info.pad.BoundingBox, NULL, LOCtoPadArc_callback, &info); + else + return true; + /* add polygons */ + if (setjmp(info.env) == 0) + r_search(LAYER_PTR(layer)->polygon_tree, &info.pad.BoundingBox, NULL, LOCtoPadPoly_callback, &info); + else + return true; + } + else { + /* handle special 'pad' layers */ + info.layer = layer - max_copper_layer; + if (setjmp(info.env) == 0) + r_search(PCB->Data->pad_tree, (BoxType *) & info.pad, NULL, LOCtoPadPad_callback, &info); + else + return true; + } + + } + return retv; +} + +static int LOCtoPolyLine_callback(const BoxType * b, void *cl) +{ + LineTypePtr line = (LineTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!TEST_FLAG(TheFlag, line) && IsLineInPolygon(line, &i->polygon)) { + if (ADD_LINE_TO_LIST(i->layer, line, POLYGON_TYPE, &i->polygon, FCT_COPPER)) + longjmp(i->env, 1); + } + return 0; +} + +static int LOCtoPolyArc_callback(const BoxType * b, void *cl) +{ + ArcTypePtr arc = (ArcTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!arc->Thickness) + return 0; + if (!TEST_FLAG(TheFlag, arc) && IsArcInPolygon(arc, &i->polygon)) { + if (ADD_ARC_TO_LIST(i->layer, arc, POLYGON_TYPE, &i->polygon, FCT_COPPER)) + longjmp(i->env, 1); + } + return 0; +} + +static int LOCtoPolyPad_callback(const BoxType * b, void *cl) +{ + PadTypePtr pad = (PadTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!TEST_FLAG(TheFlag, pad) && i->layer == (TEST_FLAG(ONSOLDERFLAG, pad) ? SOLDER_LAYER : COMPONENT_LAYER) + && IsPadInPolygon(pad, &i->polygon)) { + if (ADD_PAD_TO_LIST(i->layer, pad, POLYGON_TYPE, &i->polygon, FCT_COPPER)) + longjmp(i->env, 1); + } + return 0; +} + +static int LOCtoPolyRat_callback(const BoxType * b, void *cl) +{ + RatTypePtr rat = (RatTypePtr) b; + struct lo_info *i = (struct lo_info *) cl; + + if (!TEST_FLAG(TheFlag, rat)) { + if ((rat->Point1.X == (i->polygon.Clipped->contours->head.point[0]) && + rat->Point1.Y == (i->polygon.Clipped->contours->head.point[1]) && + rat->group1 == i->layer) || + (rat->Point2.X == (i->polygon.Clipped->contours->head.point[0]) && + rat->Point2.Y == (i->polygon.Clipped->contours->head.point[1]) && rat->group2 == i->layer)) + if (ADD_RAT_TO_LIST(rat, POLYGON_TYPE, &i->polygon, FCT_RAT)) + longjmp(i->env, 1); + } + return 0; +} + + +/* --------------------------------------------------------------------------- + * looks up LOs that are connected to the given polygon + * on the given layergroup. All found connections are added to the list + */ +static bool LookupLOConnectionsToPolygon(PolygonTypePtr Polygon, Cardinal LayerGroup) +{ + Cardinal entry; + struct lo_info info; + + if (!Polygon->Clipped) + return false; + info.polygon = *Polygon; + EXPAND_BOUNDS(&info.polygon); + info.layer = LayerGroup; + /* check rats */ + if (setjmp(info.env) == 0) + r_search(PCB->Data->rat_tree, (BoxType *) & info.polygon, NULL, LOCtoPolyRat_callback, &info); + else + return true; +/* loop over all layers of the group */ + for (entry = 0; entry < PCB->LayerGroups.Number[LayerGroup]; entry++) { + Cardinal layer; + + layer = PCB->LayerGroups.Entries[LayerGroup][entry]; + + /* handle normal layers */ + if (layer < max_copper_layer) { + GList *i; + + /* check all polygons */ + for (i = PCB->Data->Layer[layer].Polygon; i != NULL; i = g_list_next(i)) { + PolygonType *polygon = i->data; + if (!TEST_FLAG(TheFlag, polygon) + && IsPolygonInPolygon(polygon, Polygon) + && ADD_POLYGON_TO_LIST(layer, polygon, POLYGON_TYPE, Polygon, FCT_COPPER)) + return true; + } + + info.layer = layer; + /* check all lines */ + if (setjmp(info.env) == 0) + r_search(LAYER_PTR(layer)->line_tree, (BoxType *) & info.polygon, NULL, LOCtoPolyLine_callback, &info); + else + return true; + /* check all arcs */ + if (setjmp(info.env) == 0) + r_search(LAYER_PTR(layer)->arc_tree, (BoxType *) & info.polygon, NULL, LOCtoPolyArc_callback, &info); + else + return true; + } + else { + info.layer = layer - max_copper_layer; + if (setjmp(info.env) == 0) + r_search(PCB->Data->pad_tree, (BoxType *) & info.polygon, NULL, LOCtoPolyPad_callback, &info); + else + return true; + } + } + return (false); +} + +/* --------------------------------------------------------------------------- + * checks if an arc has a connection to a polygon + * + * - first check if the arc can intersect with the polygon by + * evaluating the bounding boxes + * - check the two end points of the arc. If none of them matches + * - check all segments of the polygon against the arc. + */ +bool IsArcInPolygon(ArcTypePtr Arc, PolygonTypePtr Polygon) +{ + BoxTypePtr Box = (BoxType *) Arc; + + /* arcs with clearance never touch polys */ + if (TEST_FLAG(CLEARPOLYFLAG, Polygon) && TEST_FLAG(CLEARLINEFLAG, Arc)) + return false; + if (!Polygon->Clipped) + return false; + if (Box->X1 <= Polygon->Clipped->contours->xmax + Bloat + && Box->X2 >= Polygon->Clipped->contours->xmin - Bloat + && Box->Y1 <= Polygon->Clipped->contours->ymax + Bloat && Box->Y2 >= Polygon->Clipped->contours->ymin - Bloat) { + POLYAREA *ap; + + if (!(ap = ArcPoly(Arc, Arc->Thickness + Bloat))) + return false; /* error */ + return isects(ap, Polygon, true); + } + return false; +} + +/* --------------------------------------------------------------------------- + * checks if a line has a connection to a polygon + * + * - first check if the line can intersect with the polygon by + * evaluating the bounding boxes + * - check the two end points of the line. If none of them matches + * - check all segments of the polygon against the line. + */ +bool IsLineInPolygon(LineTypePtr Line, PolygonTypePtr Polygon) +{ + BoxTypePtr Box = (BoxType *) Line; + POLYAREA *lp; + + /* lines with clearance never touch polygons */ + if (TEST_FLAG(CLEARPOLYFLAG, Polygon) && TEST_FLAG(CLEARLINEFLAG, Line)) + return false; + if (!Polygon->Clipped) + return false; + if (TEST_FLAG(SQUAREFLAG, Line) && (Line->Point1.X == Line->Point2.X || Line->Point1.Y == Line->Point2.Y)) { + Coord wid = (Line->Thickness + Bloat + 1) / 2; + Coord x1, x2, y1, y2; + + x1 = MIN(Line->Point1.X, Line->Point2.X) - wid; + y1 = MIN(Line->Point1.Y, Line->Point2.Y) - wid; + x2 = MAX(Line->Point1.X, Line->Point2.X) + wid; + y2 = MAX(Line->Point1.Y, Line->Point2.Y) + wid; + return IsRectangleInPolygon(x1, y1, x2, y2, Polygon); + } + if (Box->X1 <= Polygon->Clipped->contours->xmax + Bloat + && Box->X2 >= Polygon->Clipped->contours->xmin - Bloat + && Box->Y1 <= Polygon->Clipped->contours->ymax + Bloat && Box->Y2 >= Polygon->Clipped->contours->ymin - Bloat) { + if (!(lp = LinePoly(Line, Line->Thickness + Bloat))) + return FALSE; /* error */ + return isects(lp, Polygon, true); + } + return false; +} + +/* --------------------------------------------------------------------------- + * checks if a pad connects to a non-clearing polygon + * + * The polygon is assumed to already have been proven non-clearing + */ +bool IsPadInPolygon(PadTypePtr pad, PolygonTypePtr polygon) +{ + return IsLineInPolygon((LineTypePtr) pad, polygon); +} + +/* --------------------------------------------------------------------------- + * checks if a polygon has a connection to a second one + * + * First check all points out of P1 against P2 and vice versa. + * If both fail check all lines of P1 against the ones of P2 + */ +bool IsPolygonInPolygon(PolygonTypePtr P1, PolygonTypePtr P2) +{ + if (!P1->Clipped || !P2->Clipped) + return false; + assert(P1->Clipped->contours); + assert(P2->Clipped->contours); + + /* first check if both bounding boxes intersect. If not, return quickly */ + if (P1->Clipped->contours->xmin - Bloat > P2->Clipped->contours->xmax || + P1->Clipped->contours->xmax + Bloat < P2->Clipped->contours->xmin || + P1->Clipped->contours->ymin - Bloat > P2->Clipped->contours->ymax || + P1->Clipped->contours->ymax + Bloat < P2->Clipped->contours->ymin) + return false; + + /* first check un-bloated case */ + if (isects(P1->Clipped, P2, false)) + return TRUE; + + /* now the difficult case of bloated */ + if (Bloat > 0) { + PLINE *c; + for (c = P1->Clipped->contours; c; c = c->next) { + LineType line; + VNODE *v = &c->head; + if (c->xmin - Bloat <= P2->Clipped->contours->xmax && + c->xmax + Bloat >= P2->Clipped->contours->xmin && + c->ymin - Bloat <= P2->Clipped->contours->ymax && c->ymax + Bloat >= P2->Clipped->contours->ymin) { + + line.Point1.X = v->point[0]; + line.Point1.Y = v->point[1]; + line.Thickness = 2 * Bloat; + line.Clearance = 0; + line.Flags = NoFlags(); + for (v = v->next; v != &c->head; v = v->next) { + line.Point2.X = v->point[0]; + line.Point2.Y = v->point[1]; + SetLineBoundingBox(&line); + if (IsLineInPolygon(&line, P2)) + return (true); + line.Point1.X = line.Point2.X; + line.Point1.Y = line.Point2.Y; + } + } + } + } + + return (false); +} + +/* --------------------------------------------------------------------------- + * writes the several names of an element to a file + */ +static void PrintElementNameList(ElementTypePtr Element, FILE * FP) +{ + static DynamicStringType cname, pname, vname; + + CreateQuotedString(&cname, (char *) EMPTY(DESCRIPTION_NAME(Element))); + CreateQuotedString(&pname, (char *) EMPTY(NAMEONPCB_NAME(Element))); + CreateQuotedString(&vname, (char *) EMPTY(VALUE_NAME(Element))); + fprintf(FP, "(%s %s %s)\n", cname.Data, pname.Data, vname.Data); +} + +/* --------------------------------------------------------------------------- + * writes the several names of an element to a file + */ +static void PrintConnectionElementName(ElementTypePtr Element, FILE * FP) +{ + fputs("Element", FP); + PrintElementNameList(Element, FP); + fputs("{\n", FP); +} + +/* --------------------------------------------------------------------------- + * prints one {pin,pad,via}/element entry of connection lists + */ +static void PrintConnectionListEntry(char *ObjName, ElementTypePtr Element, bool FirstOne, FILE * FP) +{ + static DynamicStringType oname; + + CreateQuotedString(&oname, ObjName); + if (FirstOne) + fprintf(FP, "\t%s\n\t{\n", oname.Data); + else { + fprintf(FP, "\t\t%s ", oname.Data); + if (Element) + PrintElementNameList(Element, FP); + else + fputs("(__VIA__)\n", FP); + } +} + +/* --------------------------------------------------------------------------- + * prints all found connections of a pads to file FP + * the connections are stacked in 'PadList' + */ +static void PrintPadConnections(Cardinal Layer, FILE * FP, bool IsFirst) +{ + Cardinal i; + PadTypePtr ptr; + + if (!PadList[Layer].Number) + return; + + /* the starting pad */ + if (IsFirst) { + ptr = PADLIST_ENTRY(Layer, 0); + if (ptr != NULL) + PrintConnectionListEntry((char *) UNKNOWN(ptr->Name), NULL, true, FP); + else + printf("Skipping NULL ptr in 1st part of PrintPadConnections\n"); + } + + /* we maybe have to start with i=1 if we are handling the + * starting-pad itself + */ + for (i = IsFirst ? 1 : 0; i < PadList[Layer].Number; i++) { + ptr = PADLIST_ENTRY(Layer, i); + if (ptr != NULL) + PrintConnectionListEntry((char *) EMPTY(ptr->Name), (ElementTypePtr) ptr->Element, false, FP); + else + printf("Skipping NULL ptr in 2nd part of PrintPadConnections\n"); + } +} + +/* --------------------------------------------------------------------------- + * prints all found connections of a pin to file FP + * the connections are stacked in 'PVList' + */ +static void PrintPinConnections(FILE * FP, bool IsFirst) +{ + Cardinal i; + PinTypePtr pv; + + if (!PVList.Number) + return; + + if (IsFirst) { + /* the starting pin */ + pv = PVLIST_ENTRY(0); + PrintConnectionListEntry((char *) EMPTY(pv->Name), NULL, true, FP); + } + + /* we maybe have to start with i=1 if we are handling the + * starting-pin itself + */ + for (i = IsFirst ? 1 : 0; i < PVList.Number; i++) { + /* get the elements name or assume that its a via */ + pv = PVLIST_ENTRY(i); + PrintConnectionListEntry((char *) EMPTY(pv->Name), (ElementTypePtr) pv->Element, false, FP); + } +} + +/* --------------------------------------------------------------------------- + * checks if all lists of new objects are handled + */ +static bool ListsEmpty(bool AndRats) +{ + bool empty; + int i; + + empty = (PVList.Location >= PVList.Number); + if (AndRats) + empty = empty && (RatList.Location >= RatList.Number); + for (i = 0; i < max_copper_layer && empty; i++) + empty = empty && LineList[i].Location >= LineList[i].Number + && ArcList[i].Location >= ArcList[i].Number && PolygonList[i].Location >= PolygonList[i].Number; + return (empty); +} + +static void reassign_no_drc_flags(void) +{ + int layer; + + for (layer = 0; layer < max_copper_layer; layer++) { + LayerTypePtr l = LAYER_PTR(layer); + l->no_drc = AttributeGet(l, "PCB::skip-drc") != NULL; + } +} + + + + +/* --------------------------------------------------------------------------- + * loops till no more connections are found + */ +static bool DoIt(bool AndRats, bool AndDraw) +{ + bool newone = false; + reassign_no_drc_flags(); + do { + /* lookup connections; these are the steps (2) to (4) + * from the description + */ + newone = LookupPVConnectionsToPVList() || + LookupLOConnectionsToPVList(AndRats) || LookupLOConnectionsToLOList(AndRats) || LookupPVConnectionsToLOList(AndRats); + if (AndDraw) + DrawNewConnections(); + } + while (!newone && !ListsEmpty(AndRats)); + if (AndDraw) + Draw(); + return (newone); +} + +/* returns true if nothing un-found touches the passed line + * returns false if it would touch something not yet found + * doesn't include rat-lines in the search + */ + +bool lineClear(LineTypePtr line, Cardinal group) +{ + if (LOTouchesLine(line, group)) + return (false); + if (PVTouchesLine(line)) + return (false); + return (true); +} + +/* --------------------------------------------------------------------------- + * prints all unused pins of an element to file FP + */ +static bool PrintAndSelectUnusedPinsAndPadsOfElement(ElementTypePtr Element, FILE * FP) +{ + bool first = true; + Cardinal number; + static DynamicStringType oname; + + /* check all pins in element */ + + PIN_LOOP(Element); + { + if (!TEST_FLAG(HOLEFLAG, pin)) { + /* pin might have bee checked before, add to list if not */ + if (!TEST_FLAG(TheFlag, pin) && FP) { + int i; + if (ADD_PV_TO_LIST(pin, 0, NULL, 0)) + return true; + DoIt(true, true); + number = PadList[COMPONENT_LAYER].Number + PadList[SOLDER_LAYER].Number + PVList.Number; + /* the pin has no connection if it's the only + * list entry; don't count vias + */ + for (i = 0; i < PVList.Number; i++) + if (!PVLIST_ENTRY(i)->Element) + number--; + if (number == 1) { + /* output of element name if not already done */ + if (first) { + PrintConnectionElementName(Element, FP); + first = false; + } + + /* write name to list and draw selected object */ + CreateQuotedString(&oname, (char *) EMPTY(pin->Name)); + fprintf(FP, "\t%s\n", oname.Data); + SET_FLAG(SELECTEDFLAG, pin); + DrawPin(pin); + } + + /* reset found objects for the next pin */ + if (PrepareNextLoop(FP)) + return (true); + } + } + } + END_LOOP; + + /* check all pads in element */ + PAD_LOOP(Element); + { + /* lookup pad in list */ + /* pad might has bee checked before, add to list if not */ + if (!TEST_FLAG(TheFlag, pad) && FP) { + int i; + if (ADD_PAD_TO_LIST(TEST_FLAG(ONSOLDERFLAG, pad) + ? SOLDER_LAYER : COMPONENT_LAYER, pad, 0, NULL, 0)) + return true; + DoIt(true, true); + number = PadList[COMPONENT_LAYER].Number + PadList[SOLDER_LAYER].Number + PVList.Number; + /* the pin has no connection if it's the only + * list entry; don't count vias + */ + for (i = 0; i < PVList.Number; i++) + if (!PVLIST_ENTRY(i)->Element) + number--; + if (number == 1) { + /* output of element name if not already done */ + if (first) { + PrintConnectionElementName(Element, FP); + first = false; + } + + /* write name to list and draw selected object */ + CreateQuotedString(&oname, (char *) EMPTY(pad->Name)); + fprintf(FP, "\t%s\n", oname.Data); + SET_FLAG(SELECTEDFLAG, pad); + DrawPad(pad); + } + + /* reset found objects for the next pin */ + if (PrepareNextLoop(FP)) + return (true); + } + } + END_LOOP; + + /* print separator if element has unused pins or pads */ + if (!first) { + fputs("}\n\n", FP); + SEPARATE(FP); + } + return (false); +} + +/* --------------------------------------------------------------------------- + * resets some flags for looking up the next pin/pad + */ +static bool PrepareNextLoop(FILE * FP) +{ + Cardinal layer; + + /* reset found LOs for the next pin */ + for (layer = 0; layer < max_copper_layer; layer++) { + LineList[layer].Location = LineList[layer].Number = 0; + ArcList[layer].Location = ArcList[layer].Number = 0; + PolygonList[layer].Location = PolygonList[layer].Number = 0; + } + + /* reset found pads */ + for (layer = 0; layer < 2; layer++) + PadList[layer].Location = PadList[layer].Number = 0; + + /* reset PVs */ + PVList.Number = PVList.Location = 0; + RatList.Number = RatList.Location = 0; + + return (false); +} + +/* --------------------------------------------------------------------------- + * finds all connections to the pins of the passed element. + * The result is written to file FP + * Returns true if operation was aborted + */ +static bool PrintElementConnections(ElementTypePtr Element, FILE * FP, bool AndDraw) +{ + PrintConnectionElementName(Element, FP); + + /* check all pins in element */ + PIN_LOOP(Element); + { + /* pin might have been checked before, add to list if not */ + if (TEST_FLAG(TheFlag, pin)) { + PrintConnectionListEntry((char *) EMPTY(pin->Name), NULL, true, FP); + fputs("\t\t__CHECKED_BEFORE__\n\t}\n", FP); + continue; + } + if (ADD_PV_TO_LIST(pin, ELEMENT_TYPE, Element, FCT_ELEMENT)) + return true; + DoIt(true, AndDraw); + /* printout all found connections */ + PrintPinConnections(FP, true); + PrintPadConnections(COMPONENT_LAYER, FP, false); + PrintPadConnections(SOLDER_LAYER, FP, false); + fputs("\t}\n", FP); + if (PrepareNextLoop(FP)) + return (true); + } + END_LOOP; + + /* check all pads in element */ + PAD_LOOP(Element); + { + Cardinal layer; + /* pad might have been checked before, add to list if not */ + if (TEST_FLAG(TheFlag, pad)) { + PrintConnectionListEntry((char *) EMPTY(pad->Name), NULL, true, FP); + fputs("\t\t__CHECKED_BEFORE__\n\t}\n", FP); + continue; + } + layer = TEST_FLAG(ONSOLDERFLAG, pad) ? SOLDER_LAYER : COMPONENT_LAYER; + if (ADD_PAD_TO_LIST(layer, pad, ELEMENT_TYPE, Element, FCT_ELEMENT)) + return true; + DoIt(true, AndDraw); + /* print all found connections */ + PrintPadConnections(layer, FP, true); + PrintPadConnections(layer == (COMPONENT_LAYER ? SOLDER_LAYER : COMPONENT_LAYER), FP, false); + PrintPinConnections(FP, false); + fputs("\t}\n", FP); + if (PrepareNextLoop(FP)) + return (true); + } + END_LOOP; + fputs("}\n\n", FP); + return (false); +} + +/* --------------------------------------------------------------------------- + * draws all new connections which have been found since the + * routine was called the last time + */ +static void DrawNewConnections(void) +{ + int i; + Cardinal position; + + /* decrement 'i' to keep layerstack order */ + for (i = max_copper_layer - 1; i != -1; i--) { + Cardinal layer = LayerStack[i]; + + if (PCB->Data->Layer[layer].On) { + /* draw all new lines */ + position = LineList[layer].DrawLocation; + for (; position < LineList[layer].Number; position++) + DrawLine(LAYER_PTR(layer), LINELIST_ENTRY(layer, position)); + LineList[layer].DrawLocation = LineList[layer].Number; + + /* draw all new arcs */ + position = ArcList[layer].DrawLocation; + for (; position < ArcList[layer].Number; position++) + DrawArc(LAYER_PTR(layer), ARCLIST_ENTRY(layer, position)); + ArcList[layer].DrawLocation = ArcList[layer].Number; + + /* draw all new polygons */ + position = PolygonList[layer].DrawLocation; + for (; position < PolygonList[layer].Number; position++) + DrawPolygon(LAYER_PTR(layer), POLYGONLIST_ENTRY(layer, position)); + PolygonList[layer].DrawLocation = PolygonList[layer].Number; + } + } + + /* draw all new pads */ + if (PCB->PinOn) + for (i = 0; i < 2; i++) { + position = PadList[i].DrawLocation; + + for (; position < PadList[i].Number; position++) + DrawPad(PADLIST_ENTRY(i, position)); + PadList[i].DrawLocation = PadList[i].Number; + } + + /* draw all new PVs; 'PVList' holds a list of pointers to the + * sorted array pointers to PV data + */ + while (PVList.DrawLocation < PVList.Number) { + PinTypePtr pv = PVLIST_ENTRY(PVList.DrawLocation); + + if (TEST_FLAG(PINFLAG, pv)) { + if (PCB->PinOn) + DrawPin(pv); + } + else if (PCB->ViaOn) + DrawVia(pv); + PVList.DrawLocation++; + } + /* draw the new rat-lines */ + if (PCB->RatOn) { + position = RatList.DrawLocation; + for (; position < RatList.Number; position++) + DrawRat(RATLIST_ENTRY(position)); + RatList.DrawLocation = RatList.Number; + } +} + +/* --------------------------------------------------------------------------- + * find all connections to pins within one element + */ +void LookupElementConnections(ElementTypePtr Element, FILE * FP) +{ + /* reset all currently marked connections */ + User = true; + TheFlag = FOUNDFLAG; + ResetConnections(true); + InitConnectionLookup(); + PrintElementConnections(Element, FP, true); + SetChangedFlag(true); + if (Settings.RingBellWhenFinished) + gui->beep(); + FreeConnectionLookupMemory(); + IncrementUndoSerialNumber(); + User = false; + Draw(); +} + +/* --------------------------------------------------------------------------- + * find all connections to pins of all element + */ +void LookupConnectionsToAllElements(FILE * FP) +{ + /* reset all currently marked connections */ + User = false; + TheFlag = FOUNDFLAG; + ResetConnections(false); + InitConnectionLookup(); + + ELEMENT_LOOP(PCB->Data); + { + /* break if abort dialog returned true */ + if (PrintElementConnections(element, FP, false)) + break; + SEPARATE(FP); + if (Settings.ResetAfterElement && n != 1) + ResetConnections(false); + } + END_LOOP; + if (Settings.RingBellWhenFinished) + gui->beep(); + ResetConnections(false); + FreeConnectionLookupMemory(); + Redraw(); +} + +/*--------------------------------------------------------------------------- + * add the starting object to the list of found objects + */ +static bool ListStart(int type, void *ptr1, void *ptr2, void *ptr3) +{ + DumpList(); + switch (type) { + case PIN_TYPE: + case VIA_TYPE: + { + if (ADD_PV_TO_LIST((PinTypePtr) ptr2, 0, NULL, FCT_START)) + return true; + break; + } + + case RATLINE_TYPE: + { + if (ADD_RAT_TO_LIST((RatTypePtr) ptr1, 0, NULL, FCT_START)) + return true; + break; + } + + case LINE_TYPE: + { + int layer = GetLayerNumber(PCB->Data, + (LayerTypePtr) ptr1); + + if (ADD_LINE_TO_LIST(layer, (LineTypePtr) ptr2, 0, NULL, FCT_START)) + return true; + break; + } + + case ARC_TYPE: + { + int layer = GetLayerNumber(PCB->Data, + (LayerTypePtr) ptr1); + + if (ADD_ARC_TO_LIST(layer, (ArcTypePtr) ptr2, 0, NULL, FCT_START)) + return true; + break; + } + + case POLYGON_TYPE: + { + int layer = GetLayerNumber(PCB->Data, + (LayerTypePtr) ptr1); + + if (ADD_POLYGON_TO_LIST(layer, (PolygonTypePtr) ptr2, 0, NULL, FCT_START)) + return true; + break; + } + + case PAD_TYPE: + { + PadTypePtr pad = (PadTypePtr) ptr2; + if (ADD_PAD_TO_LIST(TEST_FLAG(ONSOLDERFLAG, pad) ? SOLDER_LAYER : COMPONENT_LAYER, pad, 0, NULL, FCT_START)) + return true; + break; + } + } + return (false); +} + + +/* --------------------------------------------------------------------------- + * looks up all connections from the object at the given coordinates + * the TheFlag (normally 'FOUNDFLAG') is set for all objects found + * the objects are re-drawn if AndDraw is true + * also the action is marked as undoable if AndDraw is true + */ +void LookupConnection(Coord X, Coord Y, bool AndDraw, Coord Range, int which_flag) +{ + void *ptr1, *ptr2, *ptr3; + char *name; + int type; + + /* check if there are any pins or pads at that position */ + + reassign_no_drc_flags(); + + type = SearchObjectByLocation(LOOKUP_FIRST, &ptr1, &ptr2, &ptr3, X, Y, Range); + if (type == NO_TYPE) { + type = SearchObjectByLocation(LOOKUP_MORE, &ptr1, &ptr2, &ptr3, X, Y, Range); + if (type == NO_TYPE) + return; + if (type & SILK_TYPE) { + int laynum = GetLayerNumber(PCB->Data, + (LayerTypePtr) ptr1); + + /* don't mess with non-conducting objects! */ + if (laynum >= max_copper_layer || ((LayerTypePtr) ptr1)->no_drc) + return; + } + } + else { + name = ConnectionName(type, ptr1, ptr2); + hid_actionl("NetlistShow", name, NULL); + } + + TheFlag = which_flag; + User = AndDraw; + InitConnectionLookup(); + + /* now add the object to the appropriate list and start scanning + * This is step (1) from the description + */ + ListStart(type, ptr1, ptr2, ptr3); + DoIt(true, AndDraw); + if (User) + IncrementUndoSerialNumber(); + User = false; + + /* we are done */ + if (AndDraw) + Draw(); + if (AndDraw && Settings.RingBellWhenFinished) + gui->beep(); + FreeConnectionLookupMemory(); +} + +/* --------------------------------------------------------------------------- + * find connections for rats nesting + * assumes InitConnectionLookup() has already been done + */ +void RatFindHook(int type, void *ptr1, void *ptr2, void *ptr3, bool undo, bool AndRats) +{ + User = undo; + DumpList(); + ListStart(type, ptr1, ptr2, ptr3); + DoIt(AndRats, false); + User = false; +} + +/* --------------------------------------------------------------------------- + * find all unused pins of all element + */ +void LookupUnusedPins(FILE * FP) +{ + /* reset all currently marked connections */ + User = true; + ResetConnections(true); + InitConnectionLookup(); + + ELEMENT_LOOP(PCB->Data); + { + /* break if abort dialog returned true; + * passing NULL as filedescriptor discards the normal output + */ + if (PrintAndSelectUnusedPinsAndPadsOfElement(element, FP)) + break; + } + END_LOOP; + + if (Settings.RingBellWhenFinished) + gui->beep(); + FreeConnectionLookupMemory(); + IncrementUndoSerialNumber(); + User = false; + Draw(); +} + +/* --------------------------------------------------------------------------- + * resets all used flags of pins and vias + */ +bool ResetFoundPinsViasAndPads(bool AndDraw) +{ + bool change = false; + + VIA_LOOP(PCB->Data); + { + if (TEST_FLAG(TheFlag, via)) { + if (AndDraw) + AddObjectToFlagUndoList(VIA_TYPE, via, via, via); + CLEAR_FLAG(TheFlag, via); + if (AndDraw) + DrawVia(via); + change = true; + } + } + END_LOOP; + ELEMENT_LOOP(PCB->Data); + { + PIN_LOOP(element); + { + if (TEST_FLAG(TheFlag, pin)) { + if (AndDraw) + AddObjectToFlagUndoList(PIN_TYPE, element, pin, pin); + CLEAR_FLAG(TheFlag, pin); + if (AndDraw) + DrawPin(pin); + change = true; + } + } + END_LOOP; + PAD_LOOP(element); + { + if (TEST_FLAG(TheFlag, pad)) { + if (AndDraw) + AddObjectToFlagUndoList(PAD_TYPE, element, pad, pad); + CLEAR_FLAG(TheFlag, pad); + if (AndDraw) + DrawPad(pad); + change = true; + } + } + END_LOOP; + } + END_LOOP; + if (change) + SetChangedFlag(true); + return change; +} + +/* --------------------------------------------------------------------------- + * resets all used flags of LOs + */ +bool ResetFoundLinesAndPolygons(bool AndDraw) +{ + bool change = false; + + RAT_LOOP(PCB->Data); + { + if (TEST_FLAG(TheFlag, line)) { + if (AndDraw) + AddObjectToFlagUndoList(RATLINE_TYPE, line, line, line); + CLEAR_FLAG(TheFlag, line); + if (AndDraw) + DrawRat(line); + change = true; + } + } + END_LOOP; + COPPERLINE_LOOP(PCB->Data); + { + if (TEST_FLAG(TheFlag, line)) { + if (AndDraw) + AddObjectToFlagUndoList(LINE_TYPE, layer, line, line); + CLEAR_FLAG(TheFlag, line); + if (AndDraw) + DrawLine(layer, line); + change = true; + } + } + ENDALL_LOOP; + COPPERARC_LOOP(PCB->Data); + { + if (TEST_FLAG(TheFlag, arc)) { + if (AndDraw) + AddObjectToFlagUndoList(ARC_TYPE, layer, arc, arc); + CLEAR_FLAG(TheFlag, arc); + if (AndDraw) + DrawArc(layer, arc); + change = true; + } + } + ENDALL_LOOP; + COPPERPOLYGON_LOOP(PCB->Data); + { + if (TEST_FLAG(TheFlag, polygon)) { + if (AndDraw) + AddObjectToFlagUndoList(POLYGON_TYPE, layer, polygon, polygon); + CLEAR_FLAG(TheFlag, polygon); + if (AndDraw) + DrawPolygon(layer, polygon); + change = true; + } + } + ENDALL_LOOP; + if (change) + SetChangedFlag(true); + return change; +} + +/* --------------------------------------------------------------------------- + * resets all found connections + */ +bool ResetConnections(bool AndDraw) +{ + bool change = false; + + change = ResetFoundPinsViasAndPads(AndDraw) || change; + change = ResetFoundLinesAndPolygons(AndDraw) || change; + + return change; +} + +/*---------------------------------------------------------------------------- + * Dumps the list contents + */ +static void DumpList(void) +{ + Cardinal i; + + for (i = 0; i < 2; i++) { + PadList[i].Number = 0; + PadList[i].Location = 0; + PadList[i].DrawLocation = 0; + } + + PVList.Number = 0; + PVList.Location = 0; + + for (i = 0; i < max_copper_layer; i++) { + LineList[i].Location = 0; + LineList[i].DrawLocation = 0; + LineList[i].Number = 0; + ArcList[i].Location = 0; + ArcList[i].DrawLocation = 0; + ArcList[i].Number = 0; + PolygonList[i].Location = 0; + PolygonList[i].DrawLocation = 0; + PolygonList[i].Number = 0; + } + RatList.Number = 0; + RatList.Location = 0; + RatList.DrawLocation = 0; +} + +/*----------------------------------------------------------------------------- + * Check for DRC violations on a single net starting from the pad or pin + * sees if the connectivity changes when everything is bloated, or shrunk + */ +static bool DRCFind(int What, void *ptr1, void *ptr2, void *ptr3) +{ + Coord x, y; + int object_count; + long int *object_id_list; + int *object_type_list; + DrcViolationType *violation; + + if (PCB->Shrink != 0) { + Bloat = -PCB->Shrink; + TheFlag = DRCFLAG | SELECTEDFLAG; + ListStart(What, ptr1, ptr2, ptr3); + DoIt(true, false); + /* ok now the shrunk net has the SELECTEDFLAG set */ + DumpList(); + TheFlag = FOUNDFLAG; + ListStart(What, ptr1, ptr2, ptr3); + Bloat = 0; + drc = true; /* abort the search if we find anything not already found */ + if (DoIt(true, false)) { + DumpList(); + /* make the flag changes undoable */ + TheFlag = FOUNDFLAG | SELECTEDFLAG; + ResetConnections(false); + User = true; + drc = false; + Bloat = -PCB->Shrink; + TheFlag = SELECTEDFLAG; + ListStart(What, ptr1, ptr2, ptr3); + DoIt(true, true); + DumpList(); + ListStart(What, ptr1, ptr2, ptr3); + TheFlag = FOUNDFLAG; + Bloat = 0; + drc = true; + DoIt(true, true); + DumpList(); + User = false; + drc = false; + drcerr_count++; + LocateError(&x, &y); + BuildObjectList(&object_count, &object_id_list, &object_type_list); + violation = pcb_drc_violation_new(_("Potential for broken trace"), _("Insufficient overlap between objects can lead to broken tracks\n" "due to registration errors with old wheel style photo-plotters."), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ + FALSE, /* MEASUREMENT OF ERROR UNKNOWN */ + 0, /* MAGNITUDE OF ERROR UNKNOWN */ + PCB->Shrink, object_count, object_id_list, object_type_list); + append_drc_violation(violation); + pcb_drc_violation_free(violation); + free(object_id_list); + free(object_type_list); + + if (!throw_drc_dialog()) + return (true); + IncrementUndoSerialNumber(); + Undo(true); + } + DumpList(); + } + /* now check the bloated condition */ + drc = false; + ResetConnections(false); + TheFlag = FOUNDFLAG; + ListStart(What, ptr1, ptr2, ptr3); + Bloat = PCB->Bloat; + drc = true; + while (DoIt(true, false)) { + DumpList(); + /* make the flag changes undoable */ + TheFlag = FOUNDFLAG | SELECTEDFLAG; + ResetConnections(false); + User = true; + drc = false; + Bloat = 0; + TheFlag = SELECTEDFLAG; + ListStart(What, ptr1, ptr2, ptr3); + DoIt(true, true); + DumpList(); + TheFlag = FOUNDFLAG; + ListStart(What, ptr1, ptr2, ptr3); + Bloat = PCB->Bloat; + drc = true; + DoIt(true, true); + DumpList(); + drcerr_count++; + LocateError(&x, &y); + BuildObjectList(&object_count, &object_id_list, &object_type_list); + violation = pcb_drc_violation_new(_("Copper areas too close"), _("Circuits that are too close may bridge during imaging, etching,\n" "plating, or soldering processes resulting in a direct short."), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ + FALSE, /* MEASUREMENT OF ERROR UNKNOWN */ + 0, /* MAGNITUDE OF ERROR UNKNOWN */ + PCB->Bloat, object_count, object_id_list, object_type_list); + append_drc_violation(violation); + pcb_drc_violation_free(violation); + free(object_id_list); + free(object_type_list); + User = false; + drc = false; + if (!throw_drc_dialog()) + return (true); + IncrementUndoSerialNumber(); + Undo(true); + /* highlight the rest of the encroaching net so it's not reported again */ + TheFlag |= SELECTEDFLAG; + Bloat = 0; + ListStart(thing_type, thing_ptr1, thing_ptr2, thing_ptr3); + DoIt(true, true); + DumpList(); + drc = true; + Bloat = PCB->Bloat; + ListStart(What, ptr1, ptr2, ptr3); + } + drc = false; + DumpList(); + TheFlag = FOUNDFLAG | SELECTEDFLAG; + ResetConnections(false); + return (false); +} + +/*---------------------------------------------------------------------------- + * set up a temporary flag to use + */ +void SaveFindFlag(int NewFlag) +{ + OldFlag = TheFlag; + TheFlag = NewFlag; +} + +/*---------------------------------------------------------------------------- + * restore flag + */ +void RestoreFindFlag(void) +{ + TheFlag = OldFlag; +} + +/* DRC clearance callback */ + +static int drc_callback(DataTypePtr data, LayerTypePtr layer, PolygonTypePtr polygon, int type, void *ptr1, void *ptr2) +{ + char *message; + Coord x, y; + int object_count; + long int *object_id_list; + int *object_type_list; + DrcViolationType *violation; + + LineTypePtr line = (LineTypePtr) ptr2; + ArcTypePtr arc = (ArcTypePtr) ptr2; + PinTypePtr pin = (PinTypePtr) ptr2; + PadTypePtr pad = (PadTypePtr) ptr2; + + thing_type = type; + thing_ptr1 = ptr1; + thing_ptr2 = ptr2; + thing_ptr3 = ptr2; + switch (type) { + case LINE_TYPE: + if (line->Clearance < 2 * PCB->Bloat) { + AddObjectToFlagUndoList(type, ptr1, ptr2, ptr2); + SET_FLAG(TheFlag, line); + message = _("Line with insufficient clearance inside polygon\n"); + goto doIsBad; + } + break; + case ARC_TYPE: + if (arc->Clearance < 2 * PCB->Bloat) { + AddObjectToFlagUndoList(type, ptr1, ptr2, ptr2); + SET_FLAG(TheFlag, arc); + message = _("Arc with insufficient clearance inside polygon\n"); + goto doIsBad; + } + break; + case PAD_TYPE: + if (pad->Clearance && pad->Clearance < 2 * PCB->Bloat) + if (IsPadInPolygon(pad, polygon)) { + AddObjectToFlagUndoList(type, ptr1, ptr2, ptr2); + SET_FLAG(TheFlag, pad); + message = _("Pad with insufficient clearance inside polygon\n"); + goto doIsBad; + } + break; + case PIN_TYPE: + if (pin->Clearance && pin->Clearance < 2 * PCB->Bloat) { + AddObjectToFlagUndoList(type, ptr1, ptr2, ptr2); + SET_FLAG(TheFlag, pin); + message = _("Pin with insufficient clearance inside polygon\n"); + goto doIsBad; + } + break; + case VIA_TYPE: + if (pin->Clearance && pin->Clearance < 2 * PCB->Bloat) { + AddObjectToFlagUndoList(type, ptr1, ptr2, ptr2); + SET_FLAG(TheFlag, pin); + message = _("Via with insufficient clearance inside polygon\n"); + goto doIsBad; + } + break; + default: + Message("hace: Bad Plow object in callback\n"); + } + return 0; + +doIsBad: + AddObjectToFlagUndoList(POLYGON_TYPE, layer, polygon, polygon); + SET_FLAG(FOUNDFLAG, polygon); + DrawPolygon(layer, polygon); + DrawObject(type, ptr1, ptr2); + drcerr_count++; + LocateError(&x, &y); + BuildObjectList(&object_count, &object_id_list, &object_type_list); + violation = pcb_drc_violation_new(message, _("Circuits that are too close may bridge during imaging, etching,\n" "plating, or soldering processes resulting in a direct short."), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ + FALSE, /* MEASUREMENT OF ERROR UNKNOWN */ + 0, /* MAGNITUDE OF ERROR UNKNOWN */ + PCB->Bloat, object_count, object_id_list, object_type_list); + append_drc_violation(violation); + pcb_drc_violation_free(violation); + free(object_id_list); + free(object_type_list); + if (!throw_drc_dialog()) { + IsBad = true; + return 1; + } + IncrementUndoSerialNumber(); + Undo(true); + return 0; +} + +/*----------------------------------------------------------------------------- + * Check for DRC violations + * see if the connectivity changes when everything is bloated, or shrunk + */ +int DRCAll(void) +{ + Coord x, y; + int object_count; + long int *object_id_list; + int *object_type_list; + DrcViolationType *violation; + int tmpcnt; + int nopastecnt = 0; + + reset_drc_dialog_message(); + + IsBad = false; + drcerr_count = 0; + SaveStackAndVisibility(); + ResetStackAndVisibility(); + hid_action("LayersChanged"); + InitConnectionLookup(); + + TheFlag = FOUNDFLAG | DRCFLAG | SELECTEDFLAG; + + if (ResetConnections(true)) { + IncrementUndoSerialNumber(); + Draw(); + } + + User = false; + + ELEMENT_LOOP(PCB->Data); + { + PIN_LOOP(element); + { + if (!TEST_FLAG(DRCFLAG, pin) + && DRCFind(PIN_TYPE, (void *) element, (void *) pin, (void *) pin)) { + IsBad = true; + break; + } + } + END_LOOP; + if (IsBad) + break; + PAD_LOOP(element); + { + + /* count up how many pads have no solderpaste openings */ + if (TEST_FLAG(NOPASTEFLAG, pad)) + nopastecnt++; + + if (!TEST_FLAG(DRCFLAG, pad) + && DRCFind(PAD_TYPE, (void *) element, (void *) pad, (void *) pad)) { + IsBad = true; + break; + } + } + END_LOOP; + if (IsBad) + break; + } + END_LOOP; + if (!IsBad) + VIA_LOOP(PCB->Data); + { + if (!TEST_FLAG(DRCFLAG, via) + && DRCFind(VIA_TYPE, (void *) via, (void *) via, (void *) via)) { + IsBad = true; + break; + } + } + END_LOOP; + + TheFlag = (IsBad) ? DRCFLAG : (FOUNDFLAG | DRCFLAG | SELECTEDFLAG); + ResetConnections(false); + TheFlag = SELECTEDFLAG; + /* check minimum widths and polygon clearances */ + if (!IsBad) { + COPPERLINE_LOOP(PCB->Data); + { + /* check line clearances in polygons */ + PlowsPolygon(PCB->Data, LINE_TYPE, layer, line, drc_callback); + if (IsBad) + break; + if (line->Thickness < PCB->minWid) { + AddObjectToFlagUndoList(LINE_TYPE, layer, line, line); + SET_FLAG(TheFlag, line); + DrawLine(layer, line); + drcerr_count++; + SetThing(LINE_TYPE, layer, line, line); + LocateError(&x, &y); + BuildObjectList(&object_count, &object_id_list, &object_type_list); + violation = pcb_drc_violation_new(_("Line width is too thin"), _("Process specifications dictate a minimum feature-width\n" "that can reliably be reproduced"), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ + TRUE, /* MEASUREMENT OF ERROR KNOWN */ + line->Thickness, PCB->minWid, object_count, object_id_list, object_type_list); + append_drc_violation(violation); + pcb_drc_violation_free(violation); + free(object_id_list); + free(object_type_list); + if (!throw_drc_dialog()) { + IsBad = true; + break; + } + IncrementUndoSerialNumber(); + Undo(false); + } + } + ENDALL_LOOP; + } + if (!IsBad) { + COPPERARC_LOOP(PCB->Data); + { + PlowsPolygon(PCB->Data, ARC_TYPE, layer, arc, drc_callback); + if (IsBad) + break; + if (arc->Thickness < PCB->minWid) { + AddObjectToFlagUndoList(ARC_TYPE, layer, arc, arc); + SET_FLAG(TheFlag, arc); + DrawArc(layer, arc); + drcerr_count++; + SetThing(ARC_TYPE, layer, arc, arc); + LocateError(&x, &y); + BuildObjectList(&object_count, &object_id_list, &object_type_list); + violation = pcb_drc_violation_new(_("Arc width is too thin"), _("Process specifications dictate a minimum feature-width\n" "that can reliably be reproduced"), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ + TRUE, /* MEASUREMENT OF ERROR KNOWN */ + arc->Thickness, PCB->minWid, object_count, object_id_list, object_type_list); + append_drc_violation(violation); + pcb_drc_violation_free(violation); + free(object_id_list); + free(object_type_list); + if (!throw_drc_dialog()) { + IsBad = true; + break; + } + IncrementUndoSerialNumber(); + Undo(false); + } + } + ENDALL_LOOP; + } + if (!IsBad) { + ALLPIN_LOOP(PCB->Data); + { + PlowsPolygon(PCB->Data, PIN_TYPE, element, pin, drc_callback); + if (IsBad) + break; + if (!TEST_FLAG(HOLEFLAG, pin) && pin->Thickness - pin->DrillingHole < 2 * PCB->minRing) { + AddObjectToFlagUndoList(PIN_TYPE, element, pin, pin); + SET_FLAG(TheFlag, pin); + DrawPin(pin); + drcerr_count++; + SetThing(PIN_TYPE, element, pin, pin); + LocateError(&x, &y); + BuildObjectList(&object_count, &object_id_list, &object_type_list); + violation = pcb_drc_violation_new(_("Pin annular ring too small"), _("Annular rings that are too small may erode during etching,\n" "resulting in a broken connection"), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ + TRUE, /* MEASUREMENT OF ERROR KNOWN */ + (pin->Thickness - pin->DrillingHole) / 2, + PCB->minRing, object_count, object_id_list, object_type_list); + append_drc_violation(violation); + pcb_drc_violation_free(violation); + free(object_id_list); + free(object_type_list); + if (!throw_drc_dialog()) { + IsBad = true; + break; + } + IncrementUndoSerialNumber(); + Undo(false); + } + if (pin->DrillingHole < PCB->minDrill) { + AddObjectToFlagUndoList(PIN_TYPE, element, pin, pin); + SET_FLAG(TheFlag, pin); + DrawPin(pin); + drcerr_count++; + SetThing(PIN_TYPE, element, pin, pin); + LocateError(&x, &y); + BuildObjectList(&object_count, &object_id_list, &object_type_list); + violation = pcb_drc_violation_new(_("Pin drill size is too small"), _("Process rules dictate the minimum drill size which can be used"), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ + TRUE, /* MEASUREMENT OF ERROR KNOWN */ + pin->DrillingHole, PCB->minDrill, object_count, object_id_list, object_type_list); + append_drc_violation(violation); + pcb_drc_violation_free(violation); + free(object_id_list); + free(object_type_list); + if (!throw_drc_dialog()) { + IsBad = true; + break; + } + IncrementUndoSerialNumber(); + Undo(false); + } + } + ENDALL_LOOP; + } + if (!IsBad) { + ALLPAD_LOOP(PCB->Data); + { + PlowsPolygon(PCB->Data, PAD_TYPE, element, pad, drc_callback); + if (IsBad) + break; + if (pad->Thickness < PCB->minWid) { + AddObjectToFlagUndoList(PAD_TYPE, element, pad, pad); + SET_FLAG(TheFlag, pad); + DrawPad(pad); + drcerr_count++; + SetThing(PAD_TYPE, element, pad, pad); + LocateError(&x, &y); + BuildObjectList(&object_count, &object_id_list, &object_type_list); + violation = pcb_drc_violation_new(_("Pad is too thin"), _("Pads which are too thin may erode during etching,\n" "resulting in a broken or unreliable connection"), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ + TRUE, /* MEASUREMENT OF ERROR KNOWN */ + pad->Thickness, PCB->minWid, object_count, object_id_list, object_type_list); + append_drc_violation(violation); + pcb_drc_violation_free(violation); + free(object_id_list); + free(object_type_list); + if (!throw_drc_dialog()) { + IsBad = true; + break; + } + IncrementUndoSerialNumber(); + Undo(false); + } + } + ENDALL_LOOP; + } + if (!IsBad) { + VIA_LOOP(PCB->Data); + { + PlowsPolygon(PCB->Data, VIA_TYPE, via, via, drc_callback); + if (IsBad) + break; + if (!TEST_FLAG(HOLEFLAG, via) && via->Thickness - via->DrillingHole < 2 * PCB->minRing) { + AddObjectToFlagUndoList(VIA_TYPE, via, via, via); + SET_FLAG(TheFlag, via); + DrawVia(via); + drcerr_count++; + SetThing(VIA_TYPE, via, via, via); + LocateError(&x, &y); + BuildObjectList(&object_count, &object_id_list, &object_type_list); + violation = pcb_drc_violation_new(_("Via annular ring too small"), _("Annular rings that are too small may erode during etching,\n" "resulting in a broken connection"), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ + TRUE, /* MEASUREMENT OF ERROR KNOWN */ + (via->Thickness - via->DrillingHole) / 2, + PCB->minRing, object_count, object_id_list, object_type_list); + append_drc_violation(violation); + pcb_drc_violation_free(violation); + free(object_id_list); + free(object_type_list); + if (!throw_drc_dialog()) { + IsBad = true; + break; + } + IncrementUndoSerialNumber(); + Undo(false); + } + if (via->DrillingHole < PCB->minDrill) { + AddObjectToFlagUndoList(VIA_TYPE, via, via, via); + SET_FLAG(TheFlag, via); + DrawVia(via); + drcerr_count++; + SetThing(VIA_TYPE, via, via, via); + LocateError(&x, &y); + BuildObjectList(&object_count, &object_id_list, &object_type_list); + violation = pcb_drc_violation_new(_("Via drill size is too small"), _("Process rules dictate the minimum drill size which can be used"), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ + TRUE, /* MEASUREMENT OF ERROR KNOWN */ + via->DrillingHole, PCB->minDrill, object_count, object_id_list, object_type_list); + append_drc_violation(violation); + pcb_drc_violation_free(violation); + free(object_id_list); + free(object_type_list); + if (!throw_drc_dialog()) { + IsBad = true; + break; + } + IncrementUndoSerialNumber(); + Undo(false); + } + } + END_LOOP; + } + + FreeConnectionLookupMemory(); + TheFlag = FOUNDFLAG; + Bloat = 0; + + /* check silkscreen minimum widths outside of elements */ + /* XXX - need to check text and polygons too! */ + TheFlag = SELECTEDFLAG; + if (!IsBad) { + SILKLINE_LOOP(PCB->Data); + { + if (line->Thickness < PCB->minSlk) { + SET_FLAG(TheFlag, line); + DrawLine(layer, line); + drcerr_count++; + SetThing(LINE_TYPE, layer, line, line); + LocateError(&x, &y); + BuildObjectList(&object_count, &object_id_list, &object_type_list); + violation = pcb_drc_violation_new(_("Silk line is too thin"), _("Process specifications dictate a minimum silkscreen feature-width\n" "that can reliably be reproduced"), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ + TRUE, /* MEASUREMENT OF ERROR KNOWN */ + line->Thickness, PCB->minSlk, object_count, object_id_list, object_type_list); + append_drc_violation(violation); + pcb_drc_violation_free(violation); + free(object_id_list); + free(object_type_list); + if (!throw_drc_dialog()) { + IsBad = true; + break; + } + } + } + ENDALL_LOOP; + } + + /* check silkscreen minimum widths inside of elements */ + /* XXX - need to check text and polygons too! */ + TheFlag = SELECTEDFLAG; + if (!IsBad) { + ELEMENT_LOOP(PCB->Data); + { + tmpcnt = 0; + ELEMENTLINE_LOOP(element); + { + if (line->Thickness < PCB->minSlk) + tmpcnt++; + } + END_LOOP; + if (tmpcnt > 0) { + char *title; + char *name; + char *buffer; + int buflen; + + SET_FLAG(TheFlag, element); + DrawElement(element); + drcerr_count++; + SetThing(ELEMENT_TYPE, element, element, element); + LocateError(&x, &y); + BuildObjectList(&object_count, &object_id_list, &object_type_list); + + title = _("Element %s has %i silk lines which are too thin"); + name = (char *) UNKNOWN(NAMEONPCB_NAME(element)); + + /* -4 is for the %s and %i place-holders */ + /* +11 is the max printed length for a 32 bit integer */ + /* +1 is for the \0 termination */ + buflen = strlen(title) - 4 + strlen(name) + 11 + 1; + buffer = (char *) malloc(buflen); + snprintf(buffer, buflen, title, name, tmpcnt); + + violation = pcb_drc_violation_new(buffer, _("Process specifications dictate a minimum silkscreen\n" "feature-width that can reliably be reproduced"), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ + TRUE, /* MEASUREMENT OF ERROR KNOWN */ + 0, /* MINIMUM OFFENDING WIDTH UNKNOWN */ + PCB->minSlk, object_count, object_id_list, object_type_list); + free(buffer); + append_drc_violation(violation); + pcb_drc_violation_free(violation); + free(object_id_list); + free(object_type_list); + if (!throw_drc_dialog()) { + IsBad = true; + break; + } + } + } + END_LOOP; + } + + + if (IsBad) { + IncrementUndoSerialNumber(); + } + + + RestoreStackAndVisibility(); + hid_action("LayersChanged"); + gui->invalidate_all(); + + if (nopastecnt > 0) { + Message(_("Warning: %d pad%s the nopaste flag set.\n"), nopastecnt, nopastecnt > 1 ? "s have" : " has"); + } + return IsBad ? -drcerr_count : drcerr_count; +} + +/*---------------------------------------------------------------------------- + * Locate the coordinatates of offending item (thing) + */ +static void LocateError(Coord * x, Coord * y) +{ + switch (thing_type) { + case LINE_TYPE: + { + LineTypePtr line = (LineTypePtr) thing_ptr3; + *x = (line->Point1.X + line->Point2.X) / 2; + *y = (line->Point1.Y + line->Point2.Y) / 2; + break; + } + case ARC_TYPE: + { + ArcTypePtr arc = (ArcTypePtr) thing_ptr3; + *x = arc->X; + *y = arc->Y; + break; + } + case POLYGON_TYPE: + { + PolygonTypePtr polygon = (PolygonTypePtr) thing_ptr3; + *x = (polygon->Clipped->contours->xmin + polygon->Clipped->contours->xmax) / 2; + *y = (polygon->Clipped->contours->ymin + polygon->Clipped->contours->ymax) / 2; + break; + } + case PIN_TYPE: + case VIA_TYPE: + { + PinTypePtr pin = (PinTypePtr) thing_ptr3; + *x = pin->X; + *y = pin->Y; + break; + } + case PAD_TYPE: + { + PadTypePtr pad = (PadTypePtr) thing_ptr3; + *x = (pad->Point1.X + pad->Point2.X) / 2; + *y = (pad->Point1.Y + pad->Point2.Y) / 2; + break; + } + case ELEMENT_TYPE: + { + ElementTypePtr element = (ElementTypePtr) thing_ptr3; + *x = element->MarkX; + *y = element->MarkY; + break; + } + default: + return; + } +} + + +/*---------------------------------------------------------------------------- + * Build a list of the of offending items by ID. (Currently just "thing") + */ +static void BuildObjectList(int *object_count, long int **object_id_list, int **object_type_list) +{ + *object_count = 0; + *object_id_list = NULL; + *object_type_list = NULL; + + switch (thing_type) { + case LINE_TYPE: + case ARC_TYPE: + case POLYGON_TYPE: + case PIN_TYPE: + case VIA_TYPE: + case PAD_TYPE: + case ELEMENT_TYPE: + case RATLINE_TYPE: + *object_count = 1; + *object_id_list = (long int *) malloc(sizeof(long int)); + *object_type_list = (int *) malloc(sizeof(int)); + **object_id_list = ((AnyObjectType *) thing_ptr3)->ID; + **object_type_list = thing_type; + return; + + default: + fprintf(stderr, _("Internal error in BuildObjectList: unknown object type %i\n"), thing_type); + } +} + + +/*---------------------------------------------------------------------------- + * center the display to show the offending item (thing) + */ +static void GotoError(void) +{ + Coord X, Y; + + LocateError(&X, &Y); + + switch (thing_type) { + case LINE_TYPE: + case ARC_TYPE: + case POLYGON_TYPE: + ChangeGroupVisibility(GetLayerNumber(PCB->Data, (LayerTypePtr) thing_ptr1), true, true); + } + CenterDisplay(X, Y); +} + +void InitConnectionLookup(void) +{ + InitComponentLookup(); + InitLayoutLookup(); +} + +void FreeConnectionLookupMemory(void) +{ + FreeComponentLookupMemory(); + FreeLayoutLookupMemory(); +} Index: 1.0.8/src/find.h =================================================================== --- 1.0.8/src/find.h (nonexistent) +++ 1.0.8/src/find.h (revision 1136) @@ -0,0 +1,93 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + * RCS: $Id$ + */ + +/* prototypes connection search routines + */ + +#ifndef PCB_FIND_H +#define PCB_FIND_H + +#include /* needed to define 'FILE *' */ +#include "global.h" + +typedef enum { + FCT_COPPER = 1, /* copper connection */ + FCT_INTERNAL = 2, /* element-internal connection */ + FCT_RAT = 4, /* connected by a rat line */ + FCT_ELEMENT = 8, /* pin/pad is part of an element whose pins/pads are being listed */ + FCT_START = 16, /* starting object of a query */ +} found_conn_type_t; + +typedef void (*find_callback_t) (int current_type, void *current_ptr, int from_type, void *from_ptr, + found_conn_type_t conn_type); + + +/* if not NULL, this function is called whenever something is found + (in LookupConnections for example). The caller should save the original + value and set that back around the call, if the callback needs to be changed. + */ +find_callback_t find_callback; + +/* --------------------------------------------------------------------------- + * some local defines + */ +#define LOOKUP_FIRST \ + (PIN_TYPE | PAD_TYPE) +#define LOOKUP_MORE \ + (VIA_TYPE | LINE_TYPE | RATLINE_TYPE | POLYGON_TYPE | ARC_TYPE) +#define SILK_TYPE \ + (LINE_TYPE | ARC_TYPE | POLYGON_TYPE) + +bool LineLineIntersect(LineTypePtr, LineTypePtr); +bool LineArcIntersect(LineTypePtr, ArcTypePtr); +bool PinLineIntersect(PinTypePtr, LineTypePtr); +bool LinePadIntersect(LineTypePtr, PadTypePtr); +bool ArcPadIntersect(ArcTypePtr, PadTypePtr); +bool IsPolygonInPolygon(PolygonTypePtr, PolygonTypePtr); +void LookupElementConnections(ElementTypePtr, FILE *); +void LookupConnectionsToAllElements(FILE *); +void LookupConnection(Coord, Coord, bool, Coord, int); +void LookupUnusedPins(FILE *); +bool ResetFoundLinesAndPolygons(bool); +bool ResetFoundPinsViasAndPads(bool); +bool ResetConnections(bool); +void InitConnectionLookup(void); +void InitComponentLookup(void); +void InitLayoutLookup(void); +void FreeConnectionLookupMemory(void); +void FreeComponentLookupMemory(void); +void FreeLayoutLookupMemory(void); +void RatFindHook(int, void *, void *, void *, bool, bool); +void SaveFindFlag(int); +void RestoreFindFlag(void); +int DRCAll(void); +bool lineClear(LineTypePtr, Cardinal); +bool IsLineInPolygon(LineTypePtr, PolygonTypePtr); +bool IsArcInPolygon(ArcTypePtr, PolygonTypePtr); +bool IsPadInPolygon(PadTypePtr, PolygonTypePtr); + +#endif Index: 1.0.8/src/find_act.c =================================================================== --- 1.0.8/src/find_act.c (nonexistent) +++ 1.0.8/src/find_act.c (revision 1136) @@ -0,0 +1,77 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact addresses for paper mail and Email: + * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA + * haceaton@aplcomm.jhuapl.edu + * + */ +#include "config.h" +#include "global.h" +#include "data.h" +#include "action.h" +#include "change.h" +#include "error.h" +#include "undo.h" + +#include "find.h" +#include "pcb-printf.h" +/* -------------------------------------------------------------------------- */ + +static const char drc_syntax[] = "DRC()"; + +static const char drc_help[] = "Invoke the DRC check."; + +/* %start-doc actions DRC + +Note that the design rule check uses the current board rule settings, +not the current style settings. + +%end-doc */ + +static int ActionDRCheck(int argc, char **argv, Coord x, Coord y) +{ + int count; + + if (gui->drc_gui == NULL || gui->drc_gui->log_drc_overview) { + Message(_("%m+Rules are minspace %$mS, minoverlap %$mS " + "minwidth %$mS, minsilk %$mS\n" + "min drill %$mS, min annular ring %$mS\n"), + Settings.grid_unit->allow, PCB->Bloat, PCB->Shrink, PCB->minWid, PCB->minSlk, PCB->minDrill, PCB->minRing); + } + count = DRCAll(); + if (gui->drc_gui == NULL || gui->drc_gui->log_drc_overview) { + if (count == 0) + Message(_("No DRC problems found.\n")); + else if (count > 0) + Message(_("Found %d design rule errors.\n"), count); + else + Message(_("Aborted DRC after %d design rule errors.\n"), -count); + } + return 0; +} + +HID_Action find_action_list[] = { + {"DRC", 0, ActionDRCheck, + drc_help, drc_syntax} +}; + +REGISTER_ACTIONS(find_action_list) Index: 1.0.8/src/flags.c =================================================================== --- 1.0.8/src/flags.c (nonexistent) +++ 1.0.8/src/flags.c (revision 1136) @@ -0,0 +1,337 @@ +/* $Id$ */ + +/* + * 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. + * + */ + + +#include "config.h" + +#include +#include +#include +#ifdef HAVE_STRING_H +#include +#endif + +#include "global.h" +#include "data.h" +#include "pcb-printf.h" + + +RCSID("$Id$"); + +static int FlagCurrentStyle(int dummy) +{ + STYLE_LOOP(PCB); + { + if (style->Thick == Settings.LineThickness && + style->Diameter == Settings.ViaThickness && + style->Hole == Settings.ViaDrillingHole && style->Keepaway == Settings.Keepaway) + return n + 1; + } + END_LOOP; + return 0; +} + +static int FlagGrid(int dummy) +{ + return PCB->Grid > 1; +} + +static int FlagGridSize(int dummy) +{ + return PCB->Grid; +} + +static int FlagUnitsMm(int dummy) +{ + static const Unit *u = NULL; + if (u == NULL) + u = get_unit_struct("mm"); + return (Settings.grid_unit == u); +} + +static int FlagUnitsMil(int dummy) +{ + static const Unit *u = NULL; + if (u == NULL) + u = get_unit_struct("mil"); + return (Settings.grid_unit == u); +} + +static int FlagBuffer(int dummy) +{ + return (int) (Settings.BufferNumber + 1); +} + +static int FlagElementName(int dummy) +{ + if (TEST_FLAG(NAMEONPCBFLAG, PCB)) + return 2; + if (TEST_FLAG(DESCRIPTIONFLAG, PCB)) + return 1; + return 3; +} + +static int FlagTESTFLAG(int bit) +{ + return TEST_FLAG(bit, PCB) ? 1 : 0; +} + +static int FlagSETTINGS(int ofs) +{ + return *(bool *) ((char *) (&Settings) + ofs); +} + +static int FlagMode(int x) +{ + if (x == -1) + return Settings.Mode; + return Settings.Mode == x; +} + +static int FlagHaveRegex(int x) +{ +#if defined(HAVE_REGCOMP) || defined(HAVE_RE_COMP) + return 1; +#else + return 0; +#endif +} + +enum { + FL_SILK = -6, + FL_PINS, + FL_RATS, + FL_VIAS, + FL_BACK, + FL_MASK +}; + +static int FlagLayerShown(int n) +{ + switch (n) { + case FL_SILK: + return PCB->ElementOn; + case FL_PINS: + return PCB->PinOn; + case FL_RATS: + return PCB->RatOn; + case FL_VIAS: + return PCB->ViaOn; + case FL_BACK: + return PCB->InvisibleObjectsOn; + case FL_MASK: + return TEST_FLAG(SHOWMASKFLAG, PCB); + default: + if (n >= 0 && n < max_copper_layer) + return PCB->Data->Layer[n].On; + } + return 0; +} + +static int FlagLayerActive(int n) +{ + int current_layer; + if (PCB->RatDraw) + current_layer = FL_RATS; + else if (PCB->SilkActive) + current_layer = FL_SILK; + else + return 0; + + return current_layer == n; +} + +/* The cast to (int) is ONLY valid because we know we are + * taking offsets on structures where the offset will fit + * in an integer variable. It silences compile warnings on + * 64bit machines. + */ +#define OffsetOf(a,b) (int)(size_t)(&(((a *)0)->b)) + +HID_Flag flags_flag_list[] = { + {"style", FlagCurrentStyle, 0} + , + {"grid", FlagGrid, 0} + , + {"gridsize", FlagGridSize, 0} + , + {"elementname", FlagElementName, 0} + , + {"have_regex", FlagHaveRegex, 0} + , + + {"silk_shown", FlagLayerShown, FL_SILK} + , + {"pins_shown", FlagLayerShown, FL_PINS} + , + {"rats_shown", FlagLayerShown, FL_RATS} + , + {"vias_shown", FlagLayerShown, FL_VIAS} + , + {"back_shown", FlagLayerShown, FL_BACK} + , + {"mask_shown", FlagLayerShown, FL_MASK} + , + {"silk_active", FlagLayerActive, FL_SILK} + , + {"rats_active", FlagLayerActive, FL_RATS} + , + + {"mode", FlagMode, -1} + , + {"nomode", FlagMode, NO_MODE} + , + {"arcmode", FlagMode, ARC_MODE} + , + {"arrowmode", FlagMode, ARROW_MODE} + , + {"copymode", FlagMode, COPY_MODE} + , + {"insertpointmode", FlagMode, INSERTPOINT_MODE} + , + {"linemode", FlagMode, LINE_MODE} + , + {"lockmode", FlagMode, LOCK_MODE} + , + {"movemode", FlagMode, MOVE_MODE} + , + {"pastebuffermode", FlagMode, PASTEBUFFER_MODE} + , + {"polygonmode", FlagMode, POLYGON_MODE} + , + {"polygonholemode", FlagMode, POLYGONHOLE_MODE} + , + {"rectanglemode", FlagMode, RECTANGLE_MODE} + , + {"removemode", FlagMode, REMOVE_MODE} + , + {"rotatemode", FlagMode, ROTATE_MODE} + , + {"rubberbandmovemode", FlagMode, RUBBERBANDMOVE_MODE} + , + {"textmode", FlagMode, TEXT_MODE} + , + {"thermalmode", FlagMode, THERMAL_MODE} + , + {"viamode", FlagMode, VIA_MODE} + , + + {"shownumber", FlagTESTFLAG, SHOWNUMBERFLAG} + , + {"localref", FlagTESTFLAG, LOCALREFFLAG} + , + {"checkplanes", FlagTESTFLAG, CHECKPLANESFLAG} + , + {"showdrc", FlagTESTFLAG, SHOWDRCFLAG} + , + {"rubberband", FlagTESTFLAG, RUBBERBANDFLAG} + , + {"description", FlagTESTFLAG, DESCRIPTIONFLAG} + , + {"nameonpcb", FlagTESTFLAG, NAMEONPCBFLAG} + , + {"autodrc", FlagTESTFLAG, AUTODRCFLAG} + , + {"alldirection", FlagTESTFLAG, ALLDIRECTIONFLAG} + , + {"swapstartdir", FlagTESTFLAG, SWAPSTARTDIRFLAG} + , + {"uniquename", FlagTESTFLAG, UNIQUENAMEFLAG} + , + {"clearnew", FlagTESTFLAG, CLEARNEWFLAG} + , + {"snappin", FlagTESTFLAG, SNAPPINFLAG} + , + {"showmask", FlagTESTFLAG, SHOWMASKFLAG} + , + {"thindraw", FlagTESTFLAG, THINDRAWFLAG} + , + {"orthomove", FlagTESTFLAG, ORTHOMOVEFLAG} + , + {"liveroute", FlagTESTFLAG, LIVEROUTEFLAG} + , + {"thindrawpoly", FlagTESTFLAG, THINDRAWPOLYFLAG} + , + {"locknames", FlagTESTFLAG, LOCKNAMESFLAG} + , + {"onlynames", FlagTESTFLAG, ONLYNAMESFLAG} + , + {"newfullpoly", FlagTESTFLAG, NEWFULLPOLYFLAG} + , + {"hidenames", FlagTESTFLAG, HIDENAMESFLAG} + , + {"enablemincut", FlagTESTFLAG, ENABLEMINCUTFLAG} + , + {"enablestroke", FlagTESTFLAG, ENABLESTROKEFLAG} + , + {"snapoffgridline", FlagTESTFLAG, SNAPOFFGRIDLINEFLAG} + , + {"highlightonpoint", FlagTESTFLAG, HIGHLIGHTONPOINTFLAG} + , + + {"fullpoly", FlagSETTINGS, OffsetOf(SettingType, FullPoly)} + , + {"grid_units_mm", FlagUnitsMm, -1} + , + {"grid_units_mil", FlagUnitsMil, -1} + , + {"clearline", FlagSETTINGS, OffsetOf(SettingType, ClearLine)} + , + {"uniquenames", FlagSETTINGS, OffsetOf(SettingType, UniqueNames)} + , + {"showsolderside", FlagSETTINGS, OffsetOf(SettingType, ShowSolderSide)} + , + {"savelastcommand", FlagSETTINGS, OffsetOf(SettingType, SaveLastCommand)} + , + {"saveintmp", FlagSETTINGS, OffsetOf(SettingType, SaveInTMP)} + , + {"drawgrid", FlagSETTINGS, OffsetOf(SettingType, DrawGrid)} + , + {"ratwarn", FlagSETTINGS, OffsetOf(SettingType, RatWarn)} + , + {"stipplepolygons", FlagSETTINGS, OffsetOf(SettingType, StipplePolygons)} + , + {"alldirectionlines", FlagSETTINGS, + OffsetOf(SettingType, AllDirectionLines)} + , + {"rubberbandmode", FlagSETTINGS, OffsetOf(SettingType, RubberBandMode)} + , + {"swapstartdirection", FlagSETTINGS, + OffsetOf(SettingType, SwapStartDirection)} + , + {"showdrcmode", FlagSETTINGS, OffsetOf(SettingType, ShowDRC)} + , + {"resetafterelement", FlagSETTINGS, + OffsetOf(SettingType, ResetAfterElement)} + , + {"ringbellwhenfinished", FlagSETTINGS, + OffsetOf(SettingType, RingBellWhenFinished)} + , + + {"buffer", FlagBuffer, 0} + , + +}; + +REGISTER_FLAGS(flags_flag_list) Index: 1.0.8/src/fontmode.c =================================================================== --- 1.0.8/src/fontmode.c (nonexistent) +++ 1.0.8/src/fontmode.c (revision 1136) @@ -0,0 +1,233 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 2006 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 "global.h" + +#include +#include +#include + + +#include "create.h" +#include "data.h" +#include "draw.h" +#include "misc.h" +#include "move.h" +#include "remove.h" +#include "rtree.h" +#include "strflags.h" +#include "undo.h" +#include "pcb-printf.h" + + +RCSID("$Id$"); + +/* FIXME - we currently hardcode the grid and PCB size. What we + should do in the future is scan the font for its extents, and size + the grid appropriately. Also, when we convert back to a font, we + should search the grid for the gridlines and use them to figure out + where the symbols are. */ + +#define CELL_SIZE MIL_TO_COORD (100) +#define CELL_OFFSET MIL_TO_COORD (10) + +#define XYtoSym(x,y) ((x1 + CELL_OFFSET) / CELL_SIZE - 1 \ + + 16 * ((y1 + CELL_OFFSET) / CELL_SIZE - 1)) + +static const char fontedit_syntax[] = "FontEdit()"; + +static const char fontedit_help[] = "Convert the current font to a PCB for editing."; + +/* %start-doc actions FontEdit + +%end-doc */ + +static int FontEdit(int argc, char **argv, Coord Ux, Coord Uy) +{ + FontType *font; + SymbolType *symbol; + LayerTypePtr lfont, lorig, lwidth, lgrid; + int s, l; + + if (hid_actionl("New", "Font", 0)) + return 1; + + Settings.grid_unit = get_unit_struct("mil"); + Settings.Bloat = PCB->Bloat = 1; + Settings.Shrink = PCB->Shrink = 1; + Settings.minWid = PCB->minWid = 1; + Settings.minSlk = PCB->minSlk = 1; + + MoveLayerToGroup(max_copper_layer + COMPONENT_LAYER, 0); + MoveLayerToGroup(max_copper_layer + SOLDER_LAYER, 1); + + while (PCB->Data->LayerN > 4) + MoveLayer(4, -1); + for (l = 0; l < 4; l++) { + MoveLayerToGroup(l, l); + } + PCB->MaxWidth = CELL_SIZE * 18; + PCB->MaxHeight = CELL_SIZE * ((MAX_FONTPOSITION + 15) / 16 + 2); + PCB->Grid = MIL_TO_COORD(5); + PCB->Data->Layer[0].Name = strdup("Font"); + PCB->Data->Layer[1].Name = strdup("OrigFont"); + PCB->Data->Layer[2].Name = strdup("Width"); + PCB->Data->Layer[3].Name = strdup("Grid"); + hid_action("PCBChanged"); + hid_action("LayersChanged"); + + lfont = PCB->Data->Layer + 0; + lorig = PCB->Data->Layer + 1; + lwidth = PCB->Data->Layer + 2; + lgrid = PCB->Data->Layer + 3; + + font = &PCB->Font; + for (s = 0; s <= MAX_FONTPOSITION; s++) { + Coord ox = (s % 16 + 1) * CELL_SIZE; + Coord oy = (s / 16 + 1) * CELL_SIZE; + Coord w, miny, maxy, maxx = 0; + + symbol = &font->Symbol[s]; + + miny = MIL_TO_COORD(5); + maxy = font->MaxHeight; + + for (l = 0; l < symbol->LineN; l++) { + CreateDrawnLineOnLayer(lfont, + symbol->Line[l].Point1.X + ox, + symbol->Line[l].Point1.Y + oy, + symbol->Line[l].Point2.X + ox, + symbol->Line[l].Point2.Y + oy, symbol->Line[l].Thickness, symbol->Line[l].Thickness, NoFlags()); + CreateDrawnLineOnLayer(lorig, symbol->Line[l].Point1.X + ox, + symbol->Line[l].Point1.Y + oy, + symbol->Line[l].Point2.X + ox, + symbol->Line[l].Point2.Y + oy, symbol->Line[l].Thickness, symbol->Line[l].Thickness, NoFlags()); + if (maxx < symbol->Line[l].Point1.X) + maxx = symbol->Line[l].Point1.X; + if (maxx < symbol->Line[l].Point2.X) + maxx = symbol->Line[l].Point2.X; + } + w = maxx + symbol->Delta + ox; + CreateDrawnLineOnLayer(lwidth, w, miny + oy, w, maxy + oy, MIL_TO_COORD(1), MIL_TO_COORD(1), NoFlags()); + } + + for (l = 0; l < 16; l++) { + int x = (l + 1) * CELL_SIZE; + CreateDrawnLineOnLayer(lgrid, x, 0, x, PCB->MaxHeight, MIL_TO_COORD(1), MIL_TO_COORD(1), NoFlags()); + } + for (l = 0; l <= MAX_FONTPOSITION / 16 + 1; l++) { + int y = (l + 1) * CELL_SIZE; + CreateDrawnLineOnLayer(lgrid, 0, y, PCB->MaxWidth, y, MIL_TO_COORD(1), MIL_TO_COORD(1), NoFlags()); + } + return 0; +} + +static const char fontsave_syntax[] = "FontSave()"; + +static const char fontsave_help[] = "Convert the current PCB back to a font."; + +/* %start-doc actions FontSave + +%end-doc */ + +static int FontSave(int argc, char **argv, Coord Ux, Coord Uy) +{ + FontTypePtr font; + SymbolTypePtr symbol; + int i; + GList *ii; + LayerTypePtr lfont, lwidth; + + font = &PCB->Font; + lfont = PCB->Data->Layer + 0; + lwidth = PCB->Data->Layer + 2; + + for (i = 0; i <= MAX_FONTPOSITION; i++) { + font->Symbol[i].LineN = 0; + font->Symbol[i].Valid = 0; + font->Symbol[i].Width = 0; + } + + for (ii = lfont->Line; ii != NULL; ii = g_list_next(ii)) { + LineType *l = ii->data; + int x1 = l->Point1.X; + int y1 = l->Point1.Y; + int x2 = l->Point2.X; + int y2 = l->Point2.Y; + int ox, oy, s; + + s = XYtoSym(x1, y1); + ox = (s % 16 + 1) * CELL_SIZE; + oy = (s / 16 + 1) * CELL_SIZE; + symbol = &PCB->Font.Symbol[s]; + + x1 -= ox; + y1 -= oy; + x2 -= ox; + y2 -= oy; + + if (symbol->Width < x1) + symbol->Width = x1; + if (symbol->Width < x2) + symbol->Width = x2; + symbol->Valid = 1; + + CreateNewLineInSymbol(symbol, x1, y1, x2, y2, l->Thickness); + } + + for (ii = lwidth->Line; ii != NULL; ii = g_list_next(ii)) { + LineType *l = ii->data; + Coord x1 = l->Point1.X; + Coord y1 = l->Point1.Y; + Coord ox, s; + + s = XYtoSym(x1, y1); + ox = (s % 16 + 1) * CELL_SIZE; + symbol = &PCB->Font.Symbol[s]; + + x1 -= ox; + + symbol->Delta = x1 - symbol->Width; + } + + SetFontInfo(font); + + return 0; +} + +HID_Action fontmode_action_list[] = { + {"FontEdit", 0, FontEdit, + fontedit_help, fontedit_syntax} + , + {"FontSave", 0, FontSave, + fontsave_help, fontsave_syntax} +}; + +REGISTER_ACTIONS(fontmode_action_list) Index: 1.0.8/src/free_atexit.c =================================================================== --- 1.0.8/src/free_atexit.c (nonexistent) +++ 1.0.8/src/free_atexit.c (revision 1136) @@ -0,0 +1,100 @@ +/* COPYRIGHT + * + * Copyright (C) 2010 PCB Contributors (see ChangeLog for details) + * + * 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: + * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA + * haceaton@aplcomm.jhuapl.edu + * + */ + +#include +#include + +/* we need one ID per context - short int with 64k IDs should be enough */ +typedef unsigned int leaky_idx_t; + + +/* This structure should be as big as void *, which should be the natural +bit-width of the architecture. We allocate extra admin space to be as big +as this union, to preserve alignment of pointers returned by malloc(). +NOTE: in the special corner case when leaky_idx_t is wider than void * but +not multiple of it, the alignment will be messed up, potentially causing slower +memory access. */ +typedef union { + leaky_idx_t idx; + void *ptr; +} leaky_admin_t; + +static void **free_list = NULL; +static leaky_idx_t free_size = 0; + + +void *leaky_malloc(size_t size) +{ + void *new_memory = malloc(size + sizeof(leaky_admin_t)); + + free_list = (void **) realloc(free_list, (free_size + 1) * sizeof(void *)); + free_list[free_size] = new_memory; + *(leaky_idx_t *) new_memory = free_size; + + free_size++; + return new_memory + sizeof(leaky_admin_t); +} + +void *leaky_calloc(size_t nmemb, size_t size) +{ + size_t size_ = size * nmemb; + void *new_memory = leaky_malloc(size_); + + memset(new_memory, 0, size_); + return new_memory; +} + +void *leaky_realloc(void *old_memory, size_t size) +{ + void *new_memory; + leaky_idx_t i; + + if (old_memory == NULL) + return leaky_malloc(size); + + old_memory -= sizeof(leaky_admin_t); + + i = *(leaky_idx_t *) old_memory; + + new_memory = realloc(old_memory, size + sizeof(leaky_admin_t)); + free_list[i] = new_memory; + + return new_memory + sizeof(leaky_admin_t); +} + +void leaky_uninit(void) +{ + int i; + + for (i = 0; i < free_size; i++) + free(free_list[i]); + + free(free_list); + free_size = 0; +} + +void leaky_init(void) +{ + atexit(leaky_uninit); +} Index: 1.0.8/src/free_atexit.h =================================================================== --- 1.0.8/src/free_atexit.h (nonexistent) +++ 1.0.8/src/free_atexit.h (revision 1136) @@ -0,0 +1,34 @@ +/* This tiny library is to assist cleaning up harmless memory leaks caused + by (growing) buffers allocated in static variables in functions. The + library provides leaky_ prefixed variants of the common allocation + routines. These wrappers will remember all pointers they return and + can free all memory used, at the end of the applocation. +*/ + +#include + +#ifdef NDEBUG +#define leaky_init() +#define leaky_uninit() +#define leaky_malloc(size) malloc(size) +#define leaky_calloc(nmemb, size) calloc(nmemb, size) +#define leaky_realloc(old_memory, size) realloc(old_memory, size) +#else + +/* set up atexit() hook - can be avoided if leaky_uninit() is called by hand */ +void leaky_init(void); + +/* free all allocations */ +void leaky_uninit(void); + +/* allocate memory, remember the pointer and free it after exit from the application */ +void *leaky_malloc(size_t size); + +/* same as leaky_malloc but this one wraps calloc() */ +void *leaky_calloc(size_t nmemb, size_t size); + +/* reallocate memory, remember the new pointer and free it after exit from the application */ +void *leaky_realloc(void *old_memory, size_t size); + + +#endif Index: 1.0.8/src/global.h =================================================================== --- 1.0.8/src/global.h (nonexistent) +++ 1.0.8/src/global.h (revision 1136) @@ -0,0 +1,835 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996, 2004 Thomas Nau + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact addresses for paper mail and Email: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + * RCS: $Id$ + */ +/* 15 Oct 2008 Ineiev: add different crosshair shapes */ + +/* definition of types + */ + +/* Change History: + * 10/11/96 11:37 AJF Added support for a Text() driver function. + * This was done out of a pressing need to force text to be printed on the + * silkscreen layer. Perhaps the design is not the best. + */ + +#ifndef PCB_GLOBAL_H +#define PCB_GLOBAL_H + +#include "config.h" + +#include "const.h" +#include "macro.h" + +#ifdef HAVE_STDINT_H +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Forward declarations for structures the HIDs need. */ +typedef struct BoxType BoxType, *BoxTypePtr; +typedef struct polygon_st PolygonType, *PolygonTypePtr; +typedef struct pad_st PadType, *PadTypePtr; +typedef struct pin_st PinType, *PinTypePtr, **PinTypeHandle; +typedef struct drc_violation_st DrcViolationType, *DrcViolationTypePtr; +typedef struct rtree rtree_t; +typedef struct AttributeListType AttributeListType, *AttributeListTypePtr; +typedef struct rats_patch_line_s rats_patch_line_t; + +typedef struct unit Unit; +typedef struct increments Increments; + +typedef COORD_TYPE Coord; /* pcb base unit */ +typedef double Angle; /* degrees */ + +#include "hid.h" +#include "polyarea.h" + +/* Internationalization support. */ +#ifdef ENABLE_NLS +#include +#define _(S) gettext(S) +#if defined(gettext_noop) +#define N_(S) gettext_noop(S) +#else +#define N_(S) (S) +#endif +#else +#define _(S) (S) +#define N_(S) (S) +#define textdomain(S) (S) +#define gettext(S) (S) +#define dgettext(D, S) (S) +#define dcgettext(D, S, T) (S) +#define bindtextdomain(D, Dir) (D) +#endif /* ENABLE_NLS */ + +/* This is used by the lexer/parser */ +typedef struct { + int ival; + Coord bval; + double dval; + char has_units; +} PLMeasure; + +#ifndef XtSpecificationRelease +typedef unsigned int Cardinal; +/*typedef unsigned int Pixel;*/ +typedef char *String; +typedef short Position; +typedef short Dimension; +#endif +typedef unsigned char BYTE; + +/* Nobody should know about the internals of this except the macros in + macros.h that access it. This structure must be simple-assignable + for now. */ +typedef struct unknown_flag_s unknown_flag_t; +struct unknown_flag_s { + char *str; + unknown_flag_t *next; +}; + +typedef struct { + unsigned long f; /* generic flags */ + unsigned char t[(MAX_LAYER + 1) / 2]; /* thermals */ + unsigned char q; /* square geometry flag */ + unsigned char int_conn_grp; + unknown_flag_t *unknowns; +} FlagType, *FlagTypePtr; + +#ifndef __GNUC__ +#define __FUNCTION1(a,b) a ":" #b +#define __FUNCTION2(a,b) __FUNCTION1(a,b) +#define __FUNCTION__ __FUNCTION2(__FILE__,__LINE__) +#endif + + +/* --------------------------------------------------------------------------- + * Macros to annotate branch-prediction information. + * Taken from GLib 2.16.3 (LGPL 2).G_ / g_ prefixes have + * been removed to avoid namespace clashes. + */ + +/* The LIKELY and UNLIKELY macros let the programmer give hints to + * the compiler about the expected result of an expression. Some compilers + * can use this information for optimizations. + * + * The PCB_BOOLEAN_EXPR macro is intended to trigger a gcc warning when + * putting assignments inside the test. + */ +#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) +#define PCB_BOOLEAN_EXPR(expr) \ + __extension__ ({ \ + int _boolean_var_; \ + if (expr) \ + _boolean_var_ = 1; \ + else \ + _boolean_var_ = 0; \ + _boolean_var_; \ +}) +#define LIKELY(expr) (__builtin_expect (PCB_BOOLEAN_EXPR(expr), 1)) +#define UNLIKELY(expr) (__builtin_expect (PCB_BOOLEAN_EXPR(expr), 0)) +#else +#define LIKELY(expr) (expr) +#define UNLIKELY(expr) (expr) +#endif + + +/* --------------------------------------------------------------------------- + * Do not change the following definitions even if they're not very + * nice. It allows us to have functions act on these "base types" and + * not need to know what kind of actual object they're working on. + */ + +/* Any object that uses the "object flags" defined in const.h, or + exists as an object on the pcb, MUST be defined using this as the + first fields, either directly or through ANYLINEFIELDS. */ +#define ANYOBJECTFIELDS \ + BoxType BoundingBox; \ + long int ID; \ + FlagType Flags + /* struct LibraryEntryType *net */ + +/* Lines, pads, and rats all use this so they can be cross-cast. */ +#define ANYLINEFIELDS \ + ANYOBJECTFIELDS; \ + Coord Thickness, \ + Clearance; \ + PointType Point1, \ + Point2 + +/* --------------------------------------------------------------------------- + * some useful values of our widgets + */ +typedef struct { /* holds information about output window */ + hidGC bgGC, /* background and foreground; */ + fgGC, /* changed from some routines */ + pmGC; /* depth 1 pixmap GC to store clip */ +} OutputType, *OutputTypePtr; + +/* ---------------------------------------------------------------------- + * layer group. A layer group identifies layers which are always switched + * on/off together. + */ +typedef struct { + Cardinal Number[MAX_LAYER], /* number of entries per groups */ + Entries[MAX_LAYER][MAX_LAYER + 2]; +} LayerGroupType, *LayerGroupTypePtr; + +struct BoxType { /* a bounding box */ + Coord X1, Y1; /* upper left */ + Coord X2, Y2; /* and lower right corner */ +}; + +typedef struct { + Coord x, y; + Coord width, height; +} RectangleType, *RectangleTypePtr; + +typedef struct { + char *name; + char *value; +} AttributeType, *AttributeTypePtr; + +struct AttributeListType { + int Number, Max; + AttributeType *List; +}; + +/* --------------------------------------------------------------------------- + * the basic object types supported by PCB + */ + +/* All on-pcb objects (elements, lines, pads, vias, rats, etc) are + based on this. */ +typedef struct { + ANYOBJECTFIELDS; +} AnyObjectType, *AnyObjectTypePtr; + +typedef struct { /* a line/polygon point */ + Coord X, Y, X2, Y2; /* so Point type can be cast as BoxType */ + long int ID; +} PointType, *PointTypePtr; + +/* Lines, rats, pads, etc. */ +typedef struct { + ANYLINEFIELDS; +} AnyLineObjectType, *AnyLineObjectTypePtr; + +typedef struct { /* holds information about one line */ + ANYLINEFIELDS; + char *Number; +} LineType, *LineTypePtr; + +typedef struct { + ANYOBJECTFIELDS; + int Scale; /* text scaling in percent */ + Coord X, Y; /* origin */ + BYTE Direction; + char *TextString; /* string */ + void *Element; +} TextType, *TextTypePtr; + +struct polygon_st { /* holds information about a polygon */ + ANYOBJECTFIELDS; + Cardinal PointN, /* number of points in polygon */ + PointMax; /* max number from malloc() */ + POLYAREA *Clipped; /* the clipped region of this polygon */ + PLINE *NoHoles; /* the polygon broken into hole-less regions */ + int NoHolesValid; /* Is the NoHoles polygon up to date? */ + PointTypePtr Points; /* data */ + Cardinal *HoleIndex; /* Index of hole data within the Points array */ + Cardinal HoleIndexN; /* number of holes in polygon */ + Cardinal HoleIndexMax; /* max number from malloc() */ + +}; + +typedef struct { /* holds information about arcs */ + ANYOBJECTFIELDS; + Coord Thickness, Clearance; + Coord Width, Height, /* length of axis */ + X, Y; /* center coordinates */ + Angle StartAngle, Delta; /* the two limiting angles in degrees */ +} ArcType, *ArcTypePtr; + +struct rtree { + struct rtree_node *root; + int size; /* number of entries in tree */ +}; + +typedef struct { /* holds information about one layer */ + char *Name; /* layer name */ + Cardinal LineN, /* number of lines */ + TextN, /* labels */ + PolygonN, /* polygons */ + ArcN; /* and arcs */ + GList *Line; + GList *Text; + GList *Polygon; + GList *Arc; + rtree_t *line_tree, *text_tree, *polygon_tree, *arc_tree; + bool On; /* visible flag */ + char *Color, /* color */ + *SelectedColor; + AttributeListType Attributes; + int no_drc; /* whether to ignore the layer when checking the design rules */ +} LayerType, *LayerTypePtr; + +typedef struct { /* a rat-line */ + ANYLINEFIELDS; + Cardinal group1, group2; /* the layer group each point is on */ +} RatType, *RatTypePtr; + +struct pad_st { /* a SMD pad */ + ANYLINEFIELDS; + Coord Mask; + char *Name, *Number; /* 'Line' */ + void *Element; + void *Spare; +}; + +struct pin_st { + ANYOBJECTFIELDS; + Coord Thickness, Clearance, Mask, DrillingHole; + Coord X, Y; /* center and diameter */ + char *Name, *Number; + void *Element; + void *Spare; +}; + +/* This is the extents of a Pin or Via, depending on whether it's a + hole or not. */ +#define PIN_SIZE(pinptr) (TEST_FLAG(HOLEFLAG, (pinptr)) \ + ? (pinptr)->DrillingHole \ + : (pinptr)->Thickness) + +typedef struct { + ANYOBJECTFIELDS; + TextType Name[MAX_ELEMENTNAMES]; /* the elements names; */ + /* description text */ + /* name on PCB second, */ + /* value third */ + /* see macro.h */ + Coord MarkX, MarkY; /* position mark */ + Cardinal PinN; /* number of pins */ + Cardinal PadN; /* number of pads */ + Cardinal LineN; /* number of lines */ + Cardinal ArcN; /* number of arcs */ + GList *Pin; + GList *Pad; + GList *Line; + GList *Arc; + BoxType VBox; + AttributeListType Attributes; +} ElementType, *ElementTypePtr, **ElementTypeHandle; + +/* --------------------------------------------------------------------------- + * symbol and font related stuff + */ +typedef struct { /* a single symbol */ + LineTypePtr Line; + bool Valid; + Cardinal LineN, /* number of lines */ + LineMax; + Coord Width, Height, /* size of cell */ + Delta; /* distance to next symbol */ +} SymbolType, *SymbolTypePtr; + +typedef struct { /* complete set of symbols */ + Coord MaxHeight, /* maximum cell width and height */ + MaxWidth; + BoxType DefaultSymbol; /* the default symbol is a filled box */ + SymbolType Symbol[MAX_FONTPOSITION + 1]; + bool Valid; +} FontType, *FontTypePtr; + +typedef struct { /* holds all objects */ + Cardinal ViaN, /* number of vias */ + ElementN, /* and elements */ + RatN; /* and rat-lines */ + int LayerN; /* number of layers in this board */ + GList *Via; + GList *Element; + GList *Rat; + rtree_t *via_tree, *element_tree, *pin_tree, *pad_tree, *name_tree[3], /* for element names */ + *rat_tree; + struct PCBType *pcb; + LayerType Layer[MAX_LAYER + 2]; /* add 2 silkscreen layers */ +} DataType, *DataTypePtr; + +typedef struct { /* holds drill information */ + Coord DrillSize; /* this drill's diameter */ + Cardinal ElementN, /* the number of elements using this drill size */ + ElementMax, /* max number of elements from malloc() */ + PinCount, /* number of pins drilled this size */ + ViaCount, /* number of vias drilled this size */ + UnplatedCount, /* number of these holes that are unplated */ + PinN, /* number of drill coordinates in the list */ + PinMax; /* max number of coordinates from malloc() */ + PinTypePtr *Pin; /* coordinates to drill */ + ElementTypePtr *Element; /* a pointer to an array of element pointers */ +} DrillType, *DrillTypePtr; + +typedef struct { /* holds a range of Drill Infos */ + Cardinal DrillN, /* number of drill sizes */ + DrillMax; /* max number from malloc() */ + DrillTypePtr Drill; /* plated holes */ +} DrillInfoType, *DrillInfoTypePtr; + +typedef struct { + Coord Thick, /* line thickness */ + Diameter, /* via diameter */ + Hole, /* via drill hole */ + Keepaway; /* min. separation from other nets */ + char *Name; + int index; +} RouteStyleType, *RouteStyleTypePtr; + +#include "libpcb_fp.h" +/* --------------------------------------------------------------------------- + * structure used by library routines + */ +typedef struct { + char *ListEntry; /* the string for the selection box */ + char *AllocatedMemory, /* pointer to allocated memory; all others */ + /* point to parts of the string */ + *Package, /* package */ + *Value, /* the value field */ + *Description; /* some descritional text */ + pcb_fp_type_t Type; + void **Tags; /* an array of void * tag IDs; last tag ID is NULL */ +} LibraryEntryType, *LibraryEntryTypePtr; +/*typedef LibraryEntryType *LibraryEntryTypePtr;*/ + +/* If the internal flag is set, the only field that is valid is Name, + and the struct is allocated with malloc instead of + CreateLibraryEntry. These "internal" entries are used for + electrical paths that aren't yet assigned to a real net. */ + +typedef struct { + char *Name, /* name of the menu entry */ + *directory, /* Directory name library elements are from */ + *Style; /* routing style */ + Cardinal EntryN, /* number of objects */ + EntryMax; /* number of reserved memory locations */ + LibraryEntryTypePtr Entry; /* the entries */ + char flag; /* used by the netlist window to enable/disable nets */ + char internal; /* if set, this is an internal-only entry, not + part of the global netlist. */ +} LibraryMenuType, *LibraryMenuTypePtr; + +typedef struct { + Cardinal MenuN; /* number of objects */ + Cardinal MenuMax; /* number of reserved memory locations */ + LibraryMenuTypePtr Menu; /* the entries */ +} LibraryType, *LibraryTypePtr; + +enum { + NETLIST_INPUT = 0, /* index of the original netlist as imported */ + NETLIST_EDITED = 1, /* index of the netlist produced by applying netlist patches on [NETLIST_INPUT] */ + NUM_NETLISTS /* so that we know how many netlists we are dealing with */ +}; + + + /* The PCBType struct holds information about board layout most of which is + | saved with the layout. A new PCB layout struct is first initialized + | with values from the user configurable Settings struct and then reset + | to the saved layout values when a layout is loaded. + | This struct is also used for the remove list and for buffer handling + */ +typedef struct PCBType { + long ID; /* see macro.h */ + FlagType Flags; + char *Name, /* name of board */ + *Filename, /* name of file (from load) */ + *PrintFilename, /* from print dialog */ + *Netlistname, /* name of netlist file */ + ThermStyle; /* type of thermal to place with thermal tool */ + bool Changed, /* layout has been changed */ + ViaOn, /* visibility flags */ + ElementOn, RatOn, InvisibleObjectsOn, PinOn, SilkActive, /* active layer is actually silk */ + RatDraw; /* we're drawing rats */ + char *ViaColor, /* some colors */ + *ViaSelectedColor, + *PinColor, + *PinSelectedColor, + *PinNameColor, + *ElementColor, + *ElementColor_nonetlist, + *RatColor, + *InvisibleObjectsColor, + *InvisibleMarkColor, *ElementSelectedColor, *RatSelectedColor, *ConnectedColor, *WarnColor, *MaskColor; + long CursorX, /* cursor position as saved with layout */ + CursorY, Clipping; + Coord Bloat, /* drc sizes saved with layout */ + Shrink, minWid, minSlk, minDrill, minRing; + Coord GridOffsetX, /* as saved with layout */ + GridOffsetY, MaxWidth, /* allowed size */ + MaxHeight; + + Coord Grid; /* used grid with offsets */ + double Zoom, /* zoom factor */ + IsleArea, /* minimum poly island to retain */ + ThermScale; /* scale factor used with thermals */ + FontType Font; + LayerGroupType LayerGroups; + RouteStyleType RouteStyle[NUM_STYLES]; + LibraryType NetlistLib[NUM_NETLISTS]; + rats_patch_line_t *NetlistPatches, *NetlistPatchLast; + AttributeListType Attributes; + DataTypePtr Data; /* entire database */ + + bool is_footprint; /* If set, the user has loaded a footprint, not a pcb. */ +} PCBType, *PCBTypePtr; + +typedef struct { /* information about the paste buffer */ + Coord X, Y; /* offset */ + BoxType BoundingBox; + DataTypePtr Data; /* data; not all members of PCBType */ + /* are used */ +} BufferType, *BufferTypePtr; + +/* --------------------------------------------------------------------------- + * some types for cursor drawing, setting of block and lines + * as well as for merging of elements + */ +typedef struct { /* rubberband lines for element moves */ + LayerTypePtr Layer; /* layer that holds the line */ + LineTypePtr Line; /* the line itself */ + PointTypePtr MovedPoint; /* and finally the point */ +} RubberbandType, *RubberbandTypePtr; + +typedef struct { /* current marked line */ + PointType Point1, /* start- and end-position */ + Point2; + long int State; + bool draw; +} AttachedLineType, *AttachedLineTypePtr; + +typedef struct { /* currently marked block */ + PointType Point1, /* start- and end-position */ + Point2; + long int State; + bool otherway; +} AttachedBoxType, *AttachedBoxTypePtr; + +typedef struct { /* currently attached object */ + Coord X, Y; /* saved position when MOVE_MODE */ + BoxType BoundingBox; + long int Type, /* object type */ + State; + void *Ptr1, /* three pointers to data, see */ + *Ptr2, /* search.c */ + *Ptr3; + Cardinal RubberbandN, /* number of lines in array */ + RubberbandMax; + RubberbandTypePtr Rubberband; +} AttachedObjectType, *AttachedObjectTypePtr; + +enum crosshair_shape { + Basic_Crosshair_Shape = 0, /* 4-ray */ + Union_Jack_Crosshair_Shape, /* 8-ray */ + Dozen_Crosshair_Shape, /* 12-ray */ + Crosshair_Shapes_Number +}; + +typedef struct { /* holds cursor information */ + hidGC GC, /* GC for cursor drawing */ + AttachGC; /* and for displaying buffer contents */ + Coord X, Y, /* position in PCB coordinates */ + MinX, MinY, /* lowest and highest coordinates */ + MaxX, MaxY; + AttachedLineType AttachedLine; /* data of new lines... */ + AttachedBoxType AttachedBox; + PolygonType AttachedPolygon; + AttachedObjectType AttachedObject; /* data of attached objects */ + enum crosshair_shape shape; /* shape of crosshair */ + GList *onpoint_objs; /* list of associated lines/arc */ + GList *onpoint_objs_types; /* ..and a list of their respective types */ + + /* list of object IDs that could have been dragged so that they can be cycled */ + long int *drags; + int drags_len, drags_current; + Coord dragx, dragy; /* the point where drag started */ +} CrosshairType, *CrosshairTypePtr; + +typedef struct { + bool status; + Coord X, Y; +} MarkType, *MarkTypePtr; + +/* --------------------------------------------------------------------------- + * our resources + * most of them are used as default when a new design is started + */ +typedef struct { /* some resources... */ + const Unit *grid_unit; + Increments *increments; + + int verbose; + + char *BlackColor, *WhiteColor, *BackgroundColor, /* background and cursor color ... */ + *CrosshairColor, /* different object colors */ + *CrossColor, + *ViaColor, + *ViaSelectedColor, + *PinColor, + *PinSelectedColor, + *PinNameColor, + *ElementColor, + *ElementColor_nonetlist, + *RatColor, + *InvisibleObjectsColor, + *InvisibleMarkColor, + *ElementSelectedColor, + *RatSelectedColor, + *ConnectedColor, *OffLimitColor, *GridColor, *LayerColor[MAX_LAYER], *LayerSelectedColor[MAX_LAYER], *WarnColor, *MaskColor; + Coord ViaThickness, /* some preset values */ + ViaDrillingHole, LineThickness, RatThickness, Keepaway, /* default size of a new layout */ + MaxWidth, MaxHeight, AlignmentDistance, Bloat, /* default drc sizes */ + Shrink, minWid, minSlk, minDrill, minRing; + int TextScale; /* text scaling in % */ + Coord Grid; /* grid in pcb-units */ + double Zoom, IsleArea, /* polygon min area */ + PinoutZoom; /* same for pinout windows */ + int PinoutNameLength, /* max displayed length of a pinname */ + Volume, /* the speakers volume -100..100 */ + CharPerLine, /* width of an output line in characters */ + Mode, /* currently active mode */ + BufferNumber; /* number of the current buffer */ + int BackupInterval; /* time between two backups in seconds */ + char *DefaultLayerName[MAX_LAYER], *FontCommand, /* commands for file loading... */ + *FileCommand, *PrintFile, *LibraryShell, *LibrarySearchPaths, *SaveCommand, *FontFile, /* name of default font file */ + *DefaultPcbFile, *Groups, /* string with layergroups */ + *Routes, /* string with route styles */ + *FilePath, *RatPath, *RatCommand, *FontPath, *PinoutFont, *ElementPath, *Size, /* geometry string for size */ + *BackgroundImage, /* PPM file for board background */ + *ScriptFilename, /* PCB Actions script to execute on startup */ + *ActionString, /* PCB Actions string to execute on startup */ + *FabAuthor, /* Full name of author for FAB drawings */ + *GnetlistProgram, /* gnetlist program name */ + *MakeProgram, /* make program name */ + *InitialLayerStack; /* If set, the initial layer stack is set to this */ + Coord PinoutOffsetX, /* offset of origin */ + PinoutOffsetY; + Coord PinoutTextOffsetX, /* offset of text from pin center */ + PinoutTextOffsetY; + RouteStyleType RouteStyle[NUM_STYLES]; /* default routing styles */ + LayerGroupType LayerGroups; /* default layer groups */ + bool ClearLine, FullPoly, UniqueNames, /* force unique names */ + SnapPin, /* snap to pins and pads */ + SnapOffGridLine, /*!< Snap to certain off-grid points along a line. */ + HighlightOnPoint, /*!< Highlight if crosshair is on endpoints. */ + ShowSolderSide, /* mirror output */ + SaveLastCommand, /* save the last command entered by user */ + SaveInTMP, /* always save data in /tmp */ + DrawGrid, /* draw grid points */ + RatWarn, /* rats nest has set warnings */ + StipplePolygons, /* draw polygons with stipple */ + AllDirectionLines, /* enable lines to all directions */ + RubberBandMode, /* move, rotate use rubberband connections */ + SwapStartDirection, /* change starting direction after each click */ + ShowDRC, /* show drc region on crosshair */ + AutoDRC, /* */ + ShowNumber, /* pinout shows number */ + OrthogonalMoves, /* */ + ResetAfterElement, /* reset connections after each element */ + liveRouting, /* autorouter shows tracks in progress */ + RingBellWhenFinished, /* flag if a signal should be */ + /* produced when searching of */ + /* connections is done */ + AutoPlace, /* flag which says we should force placement of the + windows on startup */ + EnableMincut, /* Enable calculating mincut on shorts (rats_mincut.c) when non-zero */ + EnableStroke; /* Enable libstroke gesutres on middle mouse button when non-zero */ +} SettingType, *SettingTypePtr; + +/* ---------------------------------------------------------------------- + * pointer to low-level copy, move and rotate functions + */ +typedef struct { + void *(*Line) (LayerTypePtr, LineTypePtr); + void *(*Text) (LayerTypePtr, TextTypePtr); + void *(*Polygon) (LayerTypePtr, PolygonTypePtr); + void *(*Via) (PinTypePtr); + void *(*Element) (ElementTypePtr); + void *(*ElementName) (ElementTypePtr); + void *(*Pin) (ElementTypePtr, PinTypePtr); + void *(*Pad) (ElementTypePtr, PadTypePtr); + void *(*LinePoint) (LayerTypePtr, LineTypePtr, PointTypePtr); + void *(*Point) (LayerTypePtr, PolygonTypePtr, PointTypePtr); + void *(*Arc) (LayerTypePtr, ArcTypePtr); + void *(*Rat) (RatTypePtr); +} ObjectFunctionType, *ObjectFunctionTypePtr; + +/* --------------------------------------------------------------------------- + * structure used by device drivers + */ + +typedef struct { /* holds a connection */ + Coord X, Y; /* coordinate of connection */ + long int type; /* type of object in ptr1 - 3 */ + void *ptr1, *ptr2; /* the object of the connection */ + Cardinal group; /* the layer group of the connection */ + LibraryMenuType *menu; /* the netmenu this *SHOULD* belong too */ +} ConnectionType, *ConnectionTypePtr; + +typedef struct { /* holds a net of connections */ + Cardinal ConnectionN, /* the number of connections contained */ + ConnectionMax; /* max connections from malloc */ + ConnectionTypePtr Connection; + RouteStyleTypePtr Style; +} NetType, *NetTypePtr; + +typedef struct { /* holds a list of nets */ + Cardinal NetN, /* the number of subnets contained */ + NetMax; /* max subnets from malloc */ + NetTypePtr Net; +} NetListType, *NetListTypePtr; + +typedef struct { /* holds a list of net lists */ + Cardinal NetListN, /* the number of net lists contained */ + NetListMax; /* max net lists from malloc */ + NetListTypePtr NetList; +} NetListListType, *NetListListTypePtr; + +typedef struct { /* holds a generic list of pointers */ + Cardinal PtrN, /* the number of pointers contained */ + PtrMax; /* max subnets from malloc */ + void **Ptr; +} PointerListType, *PointerListTypePtr; + +typedef struct { + Cardinal BoxN, /* the number of boxes contained */ + BoxMax; /* max boxes from malloc */ + BoxTypePtr Box; + +} BoxListType, *BoxListTypePtr; + +struct drc_violation_st { + char *title; + char *explanation; + Coord x, y; + Angle angle; + int have_measured; + Coord measured_value; + Coord required_value; + int object_count; + long int *object_id_list; + int *object_type_list; +}; + +typedef enum { + RATP_ADD_CONN, + RATP_DEL_CONN, + RATP_CHANGE_ATTRIB +} rats_patch_op_t; + +struct rats_patch_line_s { + rats_patch_op_t op; + char *id; + union { + char *net_name; + char *attrib_name; + } arg1; + union { + char *attrib_val; + } arg2; + + rats_patch_line_t *prev, *next; +}; + +/* --------------------------------------------------------------------------- + * define supported types of undo operations + * note these must be separate bits now + */ +#define UNDO_CHANGENAME 0x0001 /* change of names */ +#define UNDO_MOVE 0x0002 /* moving objects */ +#define UNDO_REMOVE 0x0004 /* removing objects */ +#define UNDO_REMOVE_POINT 0x0008 /* removing polygon/... points */ +#define UNDO_INSERT_POINT 0x0010 /* inserting polygon/... points */ +#define UNDO_REMOVE_CONTOUR 0x0020 /* removing a contour from a polygon */ +#define UNDO_INSERT_CONTOUR 0x0040 /* inserting a contour from a polygon */ +#define UNDO_ROTATE 0x0080 /* rotations */ +#define UNDO_CREATE 0x0100 /* creation of objects */ +#define UNDO_MOVETOLAYER 0x0200 /* moving objects to */ +#define UNDO_FLAG 0x0400 /* toggling SELECTED flag */ +#define UNDO_CHANGESIZE 0x0800 /* change size of object */ +#define UNDO_CHANGE2NDSIZE 0x1000 /* change 2ndSize of object */ +#define UNDO_MIRROR 0x2000 /* change side of board */ +#define UNDO_CHANGECLEARSIZE 0x4000 /* change clearance size */ +#define UNDO_CHANGEMASKSIZE 0x8000 /* change mask size */ +#define UNDO_CHANGEANGLES 0x10000 /* change arc angles */ +#define UNDO_LAYERCHANGE 0x20000 /* layer new/delete/move */ +#define UNDO_CLEAR 0x40000 /* clear/restore to polygons */ +#define UNDO_NETLISTCHANGE 0x80000 /* netlist change */ +#define UNDO_CHANGEPINNUM 0x100000 /* change of pin number */ + + + +/* --------------------------------------------------------------------------- + * add a macro for wrapping RCS ID's in so that ident will still work + * but we won't get as many compiler warnings + */ + +#ifndef GCC_VERSION +#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) +#endif /* GCC_VERSION */ + +#if GCC_VERSION > 2007 +#define ATTRIBUTE_UNUSED __attribute__((unused)) +#else +#define ATTRIBUTE_UNUSED +#endif + +#define RCSID(x) static char *rcsid ATTRIBUTE_UNUSED = x + +/* --------------------------------------------------------------------------- + * Macros called by various action routines to show usage or to report + * a syntax error and fail + */ +#define AUSAGE(x) Message ("Usage:\n%s\n", (x##_syntax)) +#define AFAIL(x) { Message ("Syntax error. Usage:\n%s\n", (x##_syntax)); return 1; } + +/* --------------------------------------------------------------------------- + * Variables with absolute paths to various directories. These are deduced + * at runtime to allow pcb to be relocatable + */ +extern char *bindir; /* The dir in which PCB installation was found */ +extern char *pcblibdir; +extern char *exec_prefix; +extern char *homedir; + +#endif /* PCB_GLOBAL_H */ Index: 1.0.8/src/gpcb-menu.h =================================================================== --- 1.0.8/src/gpcb-menu.h (nonexistent) +++ 1.0.8/src/gpcb-menu.h (revision 1136) @@ -0,0 +1,540 @@ +/* AUTOMATICALLY GENERATED FROM gpcb-menu.res DO NOT EDIT */ +const char *gpcb_menu_default[] = { + "# -*- c -*-", + "# Note - gpcb-menu.res is used to build gpcb-menu.h", + "# Note - parameters are sensitive to extra spaces around the commas", + "", + "Mouse =", + "{", + " Left = {", + " Mode(Notify)", + " ctrl = { Mode(Save) Mode(None) Mode(Restore) Mode(Notify) }", + " shift-ctrl = { Mode(Save) Mode(Remove) Mode(Notify) Mode(Restore) }", + " up = Mode(Release)", + " }", + " Right = {", + " Pan(1)", + " up = Pan(0)", + " shift = Popup(Popup1)", + " ctrl = Display(CycleCrosshair)", + " }", + " Middle = {", + " Mode(Stroke)", + " up = Mode(Release)", + " ctrl = { Mode(Save) Mode(Copy) Mode(Notify) }", + " up-ctrl = { Mode(Notify) Mode(Restore) }", + " shift-ctrl = { Display(ToggleRubberbandMode) Mode(Save) Mode(Move) Mode(Notify) }", + " up-shift-ctrl = { Mode(Notify) Mode(Restore) Display(ToggleRubberbandMode) }", + " }", + " Up = {", + " Zoom(0.8)", + " shift = Scroll(up)", + " ctrl = Scroll(left)", + " }", + " Down = {", + " Zoom(1.25)", + " shift = Scroll(down)", + " ctrl = Scroll(right)", + " }", + "# If you want zoom to center, do this instead.", + " #Up = { {Zoom(0.8) Center()} }", + " #Down = { {Zoom(1.25) Center()} }", + "}", + "", + "MainMenu =", + "{", + "", + "#", + "# File Menu", + "#", + " {\"File\" m=F", + " {\"Save Layout\" Save(Layout) tip=\"Saves current layout\" m=S a={\"Ctrl-S\" \"Ctrls\"}}", + " {\"Save Layout As...\" Save(LayoutAs) tip=\"Saves current layout into a new file\" m=A a={\"Shift Ctrl-S\" \"Shift Ctrls\"}}", + " -", + " {\"Revert\" Load(Revert,none) tip=\"Revert to the layout stored on disk\"}", + " -", + " {\"Import Schematics\" Import() }", + " {\"Load layout\" Load(Layout) tip=\"Load a layout from a file\"}", + " {\"Load element data to paste-buffer\" PasteBuffer(Clear) Load(ElementTobuffer)}", + " {\"Load layout data to paste-buffer\" PasteBuffer(Clear) Load(LayoutTobuffer)}", + " {\"Load netlist file\" Load(Netlist)}", + " {\"Load vendor resource file\" LoadVendorFrom()}", + " -", + " {\"Save connection data of\"", + " {\" a single element\" GetXY(Click to set the element mark <>) Save(ElementConnections)}", + " {\" all elements\" Save(AllConnections)}", + " {\" unused pins\" Save(AllUnusedPins)}", + " }", + " -", + " {\"Print layout...\" Print()}", + " {\"Export layout...\" Export()}", + " {\"Calibrate Printer...\" PrintCalibrate()}", + " -", + " {\"Start New Layout\" New() a={\"Ctrl-N\" \"Ctrln\"}}", + " -", + " {\"Preferences...\" DoWindows(Preferences)}", + " -", + " {\"Quit Program\" Quit() a={\"Ctrl-Q\" \"Ctrlq\"}}", + " }", + "", + "#", + "# Edit Menu", + "#", + " {\"Edit\" m=E", + " {\"Undo last operation\" Undo() a={\"U\" \"u\"}}", + " {\"Redo last undone operation\" Redo() a={\"Shift-R\" \"Shiftr\"}}", + " {\"Clear undo-buffer\" Undo(ClearList) a={\"Shift-Ctrl-U\" \"Shift Ctrlu\"}}", + " -", + " {\"Cut selection to buffer\" GetXY(Click to set the snap point for this buffer)", + " PasteBuffer(Clear) PasteBuffer(AddSelected) RemoveSelected() Mode(PasteBuffer)", + " a={\"Ctrl-X\" \"Ctrlx\"}}", + " {\"Copy selection to buffer\" GetXY(Click to set the snap point for this buffer)", + " PasteBuffer(Clear) PasteBuffer(AddSelected) Unselect(All) Mode(PasteBuffer)", + " a={\"Ctrl-C\" \"Ctrlc\"}}", + " {\"Paste buffer to layout\" Mode(PasteBuffer) a={\"Ctrl-V\" \"Ctrlv\"}}", + " -", + " {\"Unselect all\" Unselect(All) a={\"Shift-Alt-A\" \"Shift Alta\"}}", + " {\"Select all visible\" Select(All) a={\"Alt-A\" \"Alta\"}}", + " -", + " {\"Edit name of\"", + " {\"text on layout\" ChangeName(Object) a={\"N\" \"n\"}}", + " {\"layout\" ChangeName(Layout)}", + " {\"active layer\" ChangeName(Layer)}", + " }", + " {\"Edit attributes of\"", + " {\"Layout\" Attributes(Layout)}", + " {\"CurrentLayer\" Attributes(Layer)}", + " {\"Element\" Attributes(Element)}", + " }", + " {\"Change flags\"", + " {\"Nonetlist\" ChangeNonetlist(Element) a={\"Alt-N\" \"Altn\"}}", + " }", + " -", + " {\"Route Styles\" @routestyles", + " -", + " {\"Edit...\" AdjustStyle(0)}", + " }", + " }", + "", + "#", + "# View Menu", + "#", + " {\"View\" m=V", + " {\"Enable visible grid\" checked=drawgrid Display(Grid)}", + " {\"Grid units\"", + " {\"mil\" checked=grid_units_mil,1 SetUnits(mil)}", + " {\"mm\" checked=grid_units_mm,1 SetUnits(mm)}", + " }", + " {\"Grid size\"", + " {\"No Grid\" checked=grid,0 SetValue(Grid,1)}", + " -", + " { \"0.1 mil\" checked=gridsize,0.1mil SetUnits(mil) SetValue(Grid,0.1mil)}", + " { \"1 mil\" checked=gridsize,1mil SetUnits(mil) SetValue(Grid,1mil)}", + " { \"5 mil\" checked=gridsize,5mil SetUnits(mil) SetValue(Grid,5mil)}", + " { \"10 mil\" checked=gridsize,10mil SetUnits(mil) SetValue(Grid,10mil)}", + " { \"25 mil\" checked=gridsize,25mil SetUnits(mil) SetValue(Grid,25mil)}", + " { \"50 mil\" checked=gridsize,50mil SetUnits(mil) SetValue(Grid,50mil)}", + " {\"100 mil\" checked=gridsize,100mil SetUnits(mil) SetValue(Grid,100mil)}", + " -", + " {\"0.01 mm\" checked=gridsize,0.01mm SetUnits(mm) SetValue(Grid,0.01mm)}", + " {\"0.05 mm\" checked=gridsize,0.05mm SetUnits(mm) SetValue(Grid,0.05mm)}", + " {\"0.1 mm\" checked=gridsize,0.10mm SetUnits(mm) SetValue(Grid,0.1mm)}", + " {\"0.25 mm\" checked=gridsize,0.25mm SetUnits(mm) SetValue(Grid,0.25mm)}", + " {\"0.5 mm\" checked=gridsize,0.50mm SetUnits(mm) SetValue(Grid,0.5mm)}", + " {\"1 mm\" checked=gridsize,1mm SetUnits(mm) SetValue(Grid,1mm)}", + " -", + " {\"Grid -5mil\" SetValue(Grid,-5,mil) a={\"Shift-G\" \"Shiftg\"}}", + " {\"Grid +5mil\" SetValue(Grid,+5,mil) a={\"G\" \"g\"}}", + " {\"Grid -0.05mm\" SetValue(Grid,-0.05,mm) a={\"Shift-Ctrl-G\" \"Shift Ctrlg\"}}", + " {\"Grid +0.05mm\" SetValue(Grid,+0.05,mm) a={\"Ctrl-G\" \"Ctrlg\"}}", + " }", + " {\"Realign grid\" GetXY(Click to set the grid origin) Display(ToggleGrid)}", + " -", + " {\"Displayed element name\"", + " {\"Description\" Display(Description) checked=elementname,1}", + " {\"Reference Designator\" Display(NameOnPCB) checked=elementname,2}", + " {\"Value\" Display(Value) checked=elementname,3}", + " }", + " {\"Enable Pinout shows number\" checked=shownumber Display(ToggleName)}", + " {\"Pins/Via show Name/Number\" Display(PinOrPadName) a={\"D\" \"d\"}}", + " -", + " {\"Zoom In 20%\" Zoom(-1.2) m=Z a={\"Z\" \"z\"}}", + " {\"Zoom Out 20%\" Zoom(+1.2) m=O a={\"Shift-Z\" \"Shiftz\"}}", + " {\"More zooms and view changes\"", + " {\"Zoom Max\" Zoom() m=M a={\"V\" \"v\"}}", + " {\"Zoom In 2X\" Zoom(-2)}", + " {\"Zoom Out 2X\" Zoom(+2)}", + " {\"Zoom to 0.1mil/px\" Zoom(=0.1mil)}", + " {\"Zoom to 0.01mm/px\" Zoom(=0.01mm)}", + " {\"Zoom to 1mil/px\" Zoom(=1mil)}", + " {\"Zoom to 0.05mm/px\" Zoom(=0.05mm)}", + " {\"Zoom to 2.5mil/px\" Zoom(=2.5mil)}", + " {\"Zoom to 0.1mm/px\" Zoom(=0.1mm)}", + " {\"Zoom to 10mil/px\" Zoom(=10mil)}", + " {\"Zoom In 20% and center\" Zoom(-1.2) Center() m=Z }", + " {\"Zoom Out 20% and center\" Zoom(+1.2) Center() m=O }", + " {\"Flip up/down\" checked=flip_y SwapSides(V) a={\"Tab\" \"Tab\"}}", + " {\"Flip left/right\" checked=flip_x SwapSides(H) a={\"Shift-Tab\" \"ShiftTab\"}}", + " {\"Spin 180 degrees\" SwapSides(R) a={\"Ctrl-Tab\" \"CtrlTab\"}}", + " {\"Swap Sides\" SwapSides() a={\"Ctrl-Shift-Tab\" \"Ctrl ShiftTab\"}}", + " {\"Center cursor\" Center() a={\"C\" \"c\"}}", + " }", + " -", + " {\"Shown Layers\"", + " @layerview", + " -", + " {\"Edit Layer Groups\" EditLayerGroups()}", + " }", + " {\"Current Layer\"", + " @layerpick", + " -", + " {\"Delete current layer\" MoveLayer(c,-1)}", + " {\"Add new layer\" MoveLayer(-1,c)}", + " {\"Move current layer up\" MoveLayer(c,up)}", + " {\"Move current layer down\" MoveLayer(c,down)}", + " }", + " }", + "", + "#", + "# Settings menu", + "#", + " {\"Settings\" m=S", + " {\"'All-direction' lines\" checked=alldirection Display(Toggle45Degree) a={\".\" \".\"}}", + " {\"Auto swap line start angle\" checked=swapstartdir Display(ToggleStartDirection)}", + " {\"Orthogonal moves\" checked=orthomove Display(ToggleOrthoMove)}", + " {\"Crosshair snaps to pins and pads\" checked=snappin Display(ToggleSnapPin)}", + " {\"Crosshair shows DRC clearance\" checked=showdrc Display(ToggleShowDRC)}", + " {\"Auto enforce DRC clearance\" checked=autodrc Display(ToggleAutoDRC)}", + " {\"Lock Names\" checked=locknames Display(ToggleLockNames)}", + " {\"Only Names\" checked=onlynames Display(ToggleOnlyNames)}", + " {\"Hide Names\" checked=hidenames Display(ToggleHideNames)}", + " {\"Mincut on shorts\" checked=enablemincut Display(ToggleMinCut)}", + " -", + " {\"Rubber band mode\" checked=rubberband Display(ToggleRubberBandMode)}", + " {\"Require unique element names\" checked=uniquename Display(ToggleUniqueNames)}", + " {\"Auto-zero delta measurements\" checked=localref Display(ToggleLocalRef)}", + " {\"New lines, arcs clear polygons\" checked=clearnew Display(ToggleClearLine)}", + " {\"New polygons are full ones\" checked=newfullpoly Display(ToggleFullPoly)}", + " {\"Show autorouter trials\" checked=liveroute Display(ToggleLiveRoute)}", + " {\"Thin draw\" checked=thindraw Display(ToggleThindraw) a={\"|\" \"|\"}}", + " {\"Thin draw poly\" checked=thindrawpoly Display(ToggleThindrawPoly) a={\"Ctrl-Shift-P\" \"Ctrl Shiftp\"}}", + " {\"Check polygons\" checked=checkplanes Display(ToggleCheckPlanes)}", + " -", + " {\"Vendor drill mapping\" ToggleVendor() checked=VendorMapOn}", + " {\"Import New Elements at\" m=I", + " {\" Center\" Import(setnewpoint,center) m=C}", + " {\" Mark\" Import(setnewpoint,mark) m=M}", + " {\" Crosshair\" Import(setnewpoint) m=h}", + " -", + " {\"Set Dispersion\" Import(setdisperse) m=D}", + " }", + " }", + "", + "#", + "# Select menu", + "#", + " {\"Select\" m=l", + " {\"Select all visible objects\" Select(All)}", + " {\"Select all connected objects\" Select(Connection)}", + " -", + " {\"Unselect all objects\" Unselect(All)}", + " {\"unselect all connected objects\" Unselect(Connection)}", + " -", + " {\"Select by name\"", + " {\"All objects\" Select(ObjectByName) active=have_regex}", + " {\"Elements\" Select(ElementByName) active=have_regex}", + " {\"Pads\" Select(PadByName) active=have_regex}", + " {\"Pins\" Select(PinByName) active=have_regex}", + " {\"Text\" Select(TextByName) active=have_regex}", + " {\"Vias\" Select(ViaByName) active=have_regex}", + " }", + " -", + " {\"Auto-place selected elements\" AutoPlaceSelected() a={\"Ctrl-P\" \"Ctrlp\"}}", + " {\"Disperse all elements\" DisperseElements(All)}", + " {\"Disperse selected elements\" DisperseElements(Selected)}", + " -", + " {\"Move selected elements to other side\" Flip(SelectedElements) a={\"Shift-B\" \"Shiftb\"}}", + " {\"Move selected to current layer\" MoveToCurrentLayer(Selected) a={\"Shift-M\" \"Shiftm\"}}", + " {\"Remove selected objects\" RemoveSelected() a={\"Shift-Delete\" \"ShiftDelete\"}}", + " {\"Convert selection to element\" Select(Convert)}", + " -", + " {\"Optimize selected rats\" DeleteRats(SelectedRats) AddRats(SelectedRats)}", + " {\"Auto-route selected rats\" AutoRoute(SelectedRats) a={\"Alt-R\" \"Altr\"}}", + " {\"Rip up selected auto-routed tracks\" RipUp(Selected)}", + " -", + " {\"Change size of selected objects\"", + " {\"Lines -10 mil\" ChangeSize(SelectedLines,-10,mil) ChangeSize(SelectedArcs,-10,mil)}", + " {\"Lines +10 mil\" ChangeSize(SelectedLines,+10,mil) ChangeSize(SelectedArcs,+10,mil)}", + " {\"Pads -10 mil\" ChangeSize(SelectedPads,-10,mil)}", + " {\"Pads +10 mil\" ChangeSize(SelectedPads,+10,mil)}", + " {\"Pins -10 mil\" ChangeSize(SelectedPins,-10,mil)}", + " {\"Pins +10 mil\" ChangeSize(SelectedPins,+10,mil)}", + " {\"Texts -10 mil\" ChangeSize(SelectedTexts,-10,mil)}", + " {\"Texts +10 mil\" ChangeSize(SelectedTexts,+10,mil)}", + " {\"Vias -10 mil\" ChangeSize(SelectedVias,-10,mil)}", + " {\"Vias +10 mil\" ChangeSize(SelectedVias,+10,mil)}", + " }", + " -", + " {\"Change drilling hole of selected objects\"", + " {\"Vias -10 mil\" ChangeDrillSize(SelectedVias,-10,mil)}", + " {\"Vias +10 mil\" ChangeDrillSize(SelectedVias,+10,mil)}", + " {\"Pins -10 mil\" ChangeDrillSize(SelectedPins,-10,mil)}", + " {\"Pins +10 mil\" ChangeDrillSize(SelectedPins,+10,mil)}", + " }", + " -", + " {\"Change square-flag of selected objects\"", + " {\"Elements\" ChangeSquare(SelectedElements)}", + " {\"Pins\" ChangeSquare(SelectedPins)}", + " }", + " }", + "", + "#", + "# Buffer menu", + "#", + " {\"Buffer\" m=B", + " {\"Cut selection to buffer\" GetXY(Click to set the snap point for this buffer)", + " PasteBuffer(Clear) PasteBuffer(AddSelected) RemoveSelected() Mode(PasteBuffer)}", + " {\"Paste buffer to layout\" Mode(PasteBuffer)}", + " -", + " {\"Rotate buffer 90 deg CCW\" Mode(PasteBuffer) PasteBuffer(Rotate,1)", + " a={\"Shift-F7\" \"ShiftF7\"}}", + " {\"Rotate buffer 90 deg CW\" Mode(PasteBuffer) PasteBuffer(Rotate,3)}", + " {\"Arbitrarily Rotate Buffer\" Mode(PasteBuffer) FreeRotateBuffer()}", + " {\"Mirror buffer (up/down)\" Mode(PasteBuffer) PasteBuffer(Mirror)}", + " {\"Mirror buffer (left/right)\" Mode(PasteBuffer) PasteBuffer(Rotate,1)", + " PasteBuffer(Mirror) PasteBuffer(Rotate,3)}", + " -", + " {\"Clear buffer\" PasteBuffer(Clear)}", + " {\"Convert buffer to element\" PasteBuffer(Convert)}", + " {\"Break buffer elements to pieces\" PasteBuffer(Restore)}", + " {\"Save buffer elements to file\" Save(PasteBuffer)}", + " -", + " {\"Select Buffer #1\" checked=buffer,1 PasteBuffer(1) m=1 a={\"Shift-1\" \"Shift1\"}}", + " {\"Select Buffer #2\" checked=buffer,2 PasteBuffer(2) m=2 a={\"Shift-2\" \"Shift2\"}}", + " {\"Select Buffer #3\" checked=buffer,3 PasteBuffer(3) m=3 a={\"Shift-3\" \"Shift3\"}}", + " {\"Select Buffer #4\" checked=buffer,4 PasteBuffer(4) m=4 a={\"Shift-4\" \"Shift4\"}}", + " {\"Select Buffer #5\" checked=buffer,5 PasteBuffer(5) m=5 a={\"Shift-5\" \"Shift5\"}}", + " }", + "", + "#", + "# Connects menu", + "#", + " {\"Connects\" m=C", + " {\"Lookup connection to object\" GetXY(Click on the object) Connection(Find) a={\"Ctrl-F\" \"Ctrlf\"}}", + " {\"Reset scanned pads/pins/vias\" Connection(ResetPinsViasAndPads) Display(Redraw)}", + " {\"Reset scanned lines/polygons\" Connection(ResetLinesAndPolygons) Display(Redraw)}", + " {\"Reset all connections\" Connection(Reset) Display(Redraw) a={\"Shift-F\" \"Shiftf\"}}", + " -", + " {\"Optimize rats nest\" Atomic(Save) DeleteRats(AllRats)", + " Atomic(Restore) AddRats(AllRats) Atomic(Block) a={\"O\" \"o\"}}", + " {\"Erase rats nest\" DeleteRats(AllRats) a={\"E\" \"e\"}}", + " {\"Erase selected rats\" DeleteRats(SelectedRats) a={\"Shift-E\" \"Shifte\"}}", + " -", + " {\"Auto-route selected rats\" AutoRoute(Selected)}", + " {\"Auto-route all rats\" AutoRoute(AllRats)}", + " {\"Rip up all auto-routed tracks\" RipUp(All)}", + " -", + " {\"Optimize routed tracks\"", + " {\"Auto-Optimize\" djopt(auto) a={\"Shift-=\" \"Shift=\"}}", + " {\"Debumpify\" djopt(debumpify) }", + " {\"Unjaggy\" djopt(unjaggy) }", + " {\"Vianudge\" djopt(vianudge) }", + " {\"Viatrim\" djopt(viatrim) }", + " {\"Ortho pull\" djopt(orthopull) }", + " {\"Simple optimization\" djopt(simple) a={\"=\" \"=\"}}", + " {\"Miter\" djopt(miter) }", + " {\"Puller\" a={\"Y\" \"y\"} Puller() }", + " {\"Global Puller\"", + " {\"Selected\" GlobalPuller(selected) }", + " {\"Found\" GlobalPuller(found) }", + " {\"All\" GlobalPuller() }", + " }", + " -", + " {\"Only autorouted nets\" OptAutoOnly() checked=optautoonly}", + " }", + " -", + " {\"Design Rule Checker\" DRC()}", + " -", + " {\"Apply vendor drill mapping\" ApplyVendor()}", + " }", + "", + "#", + "# Info Menu", + "#", + " {\"Info\" m=I", + " {\"Generate object report\" ReportObject() a={\"Ctrl-R\" \"Ctrlr\"}}", + " {\"Generate drill summary\" Report(DrillReport)}", + " {\"Report found pins/pads\" Report(FoundPins)}", + " {\"Key Bindings\"", + " {\"Remove\" a={\"Delete\" \"Delete\"}", + " Mode(Save)", + " Mode(Remove)", + " Mode(Notify)", + " Mode(Restore)", + " }", + " {\"Remove Selected\" a={\"Backspace\" \"BackSpace\"}", + " RemoveSelected()", + " }", + " {\"Remove Connected\" a={\"Shift-Backspace\" \"ShiftBackSpace\"}", + " Atomic(Save)", + " Connection(Reset)", + " Atomic(Restore)", + " Unselect(All)", + " Atomic(Restore)", + " Connection(Find)", + " Atomic(Restore)", + " Select(Connection)", + " Atomic(Restore)", + " RemoveSelected()", + " Atomic(Restore)", + " Connection(Reset)", + " Atomic(Restore)", + " Unselect(All)", + " Atomic(Block)", + " }", + " {\"Remove Connected\"", + " Atomic(Save)", + " Connection(Reset)", + " Atomic(Restore)", + " Unselect(All)", + " Atomic(Restore)", + " Connection(Find)", + " Atomic(Restore)", + " Select(Connection)", + " Atomic(Restore)", + " RemoveSelected()", + " Atomic(Restore)", + " Connection(Reset)", + " Atomic(Restore)", + " Unselect(All)", + " Atomic(Block)", + " }", + " {\"Set Same\" a={\"A\" \"a\"} SetSame()}", + " {\"Flip Object\" a={\"B\" \"b\"} Flip(Object)}", + " {\"Find Connections\" a={\"F\" \"f\"} Connection(Reset) Connection(Find)}", + " {\"ToggleHideName Object\" a={\"H\" \"h\"} ToggleHideName(Object)}", + " {\"ToggleHideName SelectedElement\" a={\"Shift-H\" \"Shifth\"} ToggleHideName(SelectedElements)}", + " {\"ChangeHole Object\" a={\"Ctrl-H\" \"Ctrlh\"} ChangeHole(Object)}", + " {\"ChangeJoin Object\" a={\"J\" \"j\"} ChangeJoin(Object)}", + " {\"ChangeJoin SelectedObject\" a={\"Shift-J\" \"Shiftj\"} ChangeJoin(SelectedObjects)}", + " {\"Clear Object +2 mil\" a={\"K\" \"k\"} ChangeClearSize(Object,+2,mil)}", + " {\"Clear Object -2 mil\" a={\"Shift-K\" \"Shiftk\"} ChangeClearSize(Object,-2,mil)}", + " {\"Clear Selected +2 mil\" a={\"Ctrl-K\" \"Ctrlk\"} ChangeClearSize(SelectedObjects,+2,mil)}", + " {\"Clear Selected -2 mil\" a={\"Shift-Ctrl-K\" \"Shift Ctrlk\"} ChangeClearSize(SelectedObjects,-2,mil)}", + " {\"Line Tool size +5 mil\" a={\"L\" \"l\"} SetValue(LineSize,+5,mil)}", + " {\"Line Tool size -5 mil\" a={\"Shift-L\" \"Shiftl\"} SetValue(LineSize,-5,mil)}", + " {\"Move Object to current layer\" a={\"M\" \"m\"} MoveToCurrentLayer(Object)}", + " {\"MarkCrosshair\" a={\"Ctrl-M\" \"Ctrlm\"} MarkCrosshair()}", + " {\"Select shortest rat\" a={\"Shift-N\" \"Shiftn\"} AddRats(Close)}", + " {\"AddRats to selected pins\" a={\"Shift-O\" \"Shifto\"}", + " Atomic(Save)", + " DeleteRats(AllRats)", + " Atomic(Restore)", + " AddRats(SelectedRats)", + " Atomic(Block) }", + " {\"ChangeOctagon Object\" a={\"Ctrl-O\" \"Ctrlo\"} ChangeOctagon(Object)}", + " {\"Polygon PreviousPoint\" a={\"P\" \"p\"} Polygon(PreviousPoint)}", + " {\"Polygon Close\" a={\"Shift-P\" \"Shiftp\"} Polygon(Close)}", + " {\"ChangeSquare Object\" a={\"Q\" \"q\"} ChangeSquare(ToggleObject)}", + " {\"ChangeSize +5 mil\" a={\"S\" \"s\"} ChangeSize(Object,+5,mil)}", + " {\"ChangeSize -5 mil\" a={\"Shift-S\" \"Shifts\"} ChangeSize(Object,-5,mil)}", + " {\"ChangeDrill +5 mil\" a={\"Alt-S\" \"Alts\"} ChangeDrillSize(Object,+5,mil)}", + " {\"ChangeDrill -5 mil\" a={\"Alt-Shift-S\" \"Alt Shifts\"} ChangeDrillSize(Object,-5,mil)}", + " {\"Text Tool scale +10 mil\" a={\"T\" \"t\"} SetValue(TextScale,+10,mil)}", + " {\"Text Tool scale -10 mil\" a={\"Shift-T\" \"Shiftt\"} SetValue(TextScale,-10,mil)}", + " {\"Via Tool size +5 mil\" a={\"Shift-V\" \"Shiftv\"} SetValue(ViaSize,+5,mil)}", + " {\"Via Tool size -5 mil\" a={\"Shift-Ctrl-V\" \"Shift Ctrlv\"} SetValue(ViaSize,-5,mil)}", + " {\"Via Tool drill +5 mil\" a={\"Alt-V\" \"Altv\"} SetValue(ViaDrillingHole,+5,mil)}", + " {\"Via Tool drill -5 mil\" a={\"Alt-Shift-V\" \"Alt Shiftv\"} SetValue(ViaDrillingHole,-5,mil)}", + " {\"AddRats Selected\" a={\"Shift-W\" \"Shiftw\"} AddRats(SelectedRats)}", + " {\"Add All Rats\" a={\"W\" \"w\"} AddRats(AllRats)}", + " {\"Cycle Clip\" a={\"/\" \"/\"} Display(CycleClip)}", + " {\"Arrow Mode\" a={\"Space\" \"space\"} Mode(Arrow) checked=arrowmode,1}", + " {\"Temp Arrow ON\" a={\"[\" \"[\"} Mode(Save) Mode(Arrow) Mode(Notify)}", + " {\"Temp Arrow OFF\" a={\"]\" \"]\"} Mode(Release) Mode(Restore)}", + " -", + " {\"Step Up\" a={\"Up\" \"Up\"} Cursor(Warp,0,1,grid)}", + " {\"Step Down\" a={\"Down\" \"Down\"} Cursor(Warp,0,-1,grid)}", + " {\"Step Left\" a={\"Left\" \"Left\"} Cursor(Warp,-1,0,grid)}", + " {\"Step Right\" a={\"Right\" \"Right\"} Cursor(Warp,1,0,grid)}", + " {\"Step +Up\" a={\"Up\" \"ShiftUp\"} Cursor(Pan,0,50,view)}", + " {\"Step +Down\" a={\"Down\" \"ShiftDown\"} Cursor(Pan,0,-50,view)}", + " {\"Step +Left\" a={\"Left\" \"ShiftLeft\"} Cursor(Pan,-50,0,view)}", + " {\"Step +Right\" a={\"Right\" \"ShiftRight\"} Cursor(Pan,50,0,view)}", + " {'\"Click\"' a={\"Enter\" \"Enter\"} Mode(Notify) Mode(Release)}", + " -", + " }", + " }", + "", + "#", + "# Window Menu", + "#", + " {\"Window\" m=W", + " {\"Library\" DoWindows(Library) a={\"i\" \"i\"}}", + " {\"Message Log\" DoWindows(Log)}", + " {\"DRC Check\" DoWindows(DRC)}", + " {\"Netlist\" DoWindows(Netlist)}", + " {\"Command Entry\" Command() a={\":\" \":\"}}", + " {\"Pinout\" Display(Pinout) a={\"Shift-D\" \"Shiftd\"}}", + " -", + " {\"About...\" About()}", + " }", + "}", + "", + "PopupMenus =", + " {", + " Popup1 =", + " {", + " {\"Operations on selections\"", + " {\"Unselect all objects\" Unselect(All)}", + " {\"Remove selected objects\" RemoveSelected()}", + " {\"Copy selection to buffer\"", + " GetXY(Click to set the snap point for this buffer)", + " PasteBuffer(Clear)", + " PasteBuffer(AddSelected)", + " Mode(PasteBuffer)", + " }", + " {\"Cut selection to buffer\"", + " GetXY(Click to set the snap point for this buffer)", + " PasteBuffer(Clear)", + " PasteBuffer(AddSelected)", + " RemoveSelected()", + " Mode(PasteBuffer)", + " }", + " {\"Convert selection to element\" Select(Convert)}", + " {\"Auto place selected elements\" AutoPlaceSelected()}", + " {\"Autoroute selected elements\" AutoRoute(SelectedRats)}", + " {\"Rip up selected auto-routed tracks\" RipUp(Selected)}", + " }", + " {\"Operations on this location\"", + " {\"Generate object report\" GetXY(Click on the object) Report(Object)}", + " }", + " -", + " {\"Undo last operation\" Undo()}", + " {\"Redo last undone operation\" Redo()}", + " -", + " {Tools", + " {\"None\" checked=nomode,1 Mode(None)}", + " {\"Via\" checked=viamode,1 Mode(Via) a={\"F1\" \"F1\"}}", + " {\"Line\" checked=linemode,1 Mode(Line) a={\"F2\" \"F2\"}}", + " {\"Arc\" checked=arcmode,1 Mode(Arc) a={\"F3\" \"F3\"}}", + " {\"Text\" checked=textmode,1 Mode(Text) a={\"F4\" \"F4\"}}", + " {\"Rectangle\" checked=rectanglemode,1 Mode(Rectangle) a={\"F5\" \"F5\"}}", + " {\"Polygon\" checked=polygonmode,1 Mode(Polygon) a={\"F6\" \"F6\"}}", + " {\"Polygon Hole\" checked=polygonholemode,1 Mode(PolygonHole)}", + " {\"Buffer\" checked=pastebuffermode,1 Mode(PasteBuffer) a={\"F7\" \"F7\"}}", + " {\"Remove\" checked=removemode,1 Mode(Remove) a={\"F8\" \"F8\"}}", + " {\"Rotate\" checked=rotatemode,1 Mode(Rotate) a={\"F9\" \"F9\"}}", + " {\"Thermal\" checked=thermalmode,1 Mode(Thermal) a={\"F10\" \"F10\"}}", + " {\"Arrow\" checked=arrowmode,1 Mode(Arrow) a={\"F11\" \"F11\"}}", + " {\"Insert Point\" checked=insertpointmode,1 Mode(InsertPoint) a={\"Insert\" \"Insert\"}}", + " {\"Move\" checked=movemode,1 Mode(Move)}", + " {\"Copy\" checked=copymode,1 Mode(Copy)}", + " {\"Lock\" checked=lockmode,1 Mode(Lock) a={\"F12\" \"F12\"}}", + " {\"Cancel\" Mode(Escape) a={\"Esc\" \"Escape\"}}", + " }", + " }", + " }", + "", + 0 +}; Index: 1.0.8/src/gpcb-menu.res =================================================================== --- 1.0.8/src/gpcb-menu.res (nonexistent) +++ 1.0.8/src/gpcb-menu.res (revision 1136) @@ -0,0 +1,555 @@ +# -*- c -*- +# Note - gpcb-menu.res is used to build gpcb-menu.h +# Note - parameters are sensitive to extra spaces around the commas + +Mouse = +{ + Left = { + Mode(Notify) + ctrl = { Mode(Save) Mode(None) Mode(Restore) Mode(Notify) } + shift-ctrl = { Mode(Save) Mode(Remove) Mode(Notify) Mode(Restore) } + up = Mode(Release) + } + Right = { + Pan(1) + up = Pan(0) + shift = Popup(Popup1) + ctrl = Display(CycleCrosshair) + } + Middle = { + Mode(Stroke) + up = Mode(Release) + ctrl = { Mode(Save) Mode(Copy) Mode(Notify) } + up-ctrl = { Mode(Notify) Mode(Restore) } + shift-ctrl = { Display(ToggleRubberbandMode) Mode(Save) Mode(Move) Mode(Notify) } + up-shift-ctrl = { Mode(Notify) Mode(Restore) Display(ToggleRubberbandMode) } + } + Up = { + Zoom(0.8) + shift = Scroll(up) + ctrl = Scroll(left) + } + Down = { + Zoom(1.25) + shift = Scroll(down) + ctrl = Scroll(right) + } +# If you want zoom to center, do this instead. + #Up = { {Zoom(0.8) Center()} } + #Down = { {Zoom(1.25) Center()} } +} + +MainMenu = +{ + +# +# File Menu +# + {"File" m=F + {"Save Layout" Save(Layout) tip="Saves current layout" m=S a={"Ctrl-S" "Ctrls"}} + {"Save Layout As..." Save(LayoutAs) tip="Saves current layout into a new file" m=A a={"Shift Ctrl-S" "Shift Ctrls"}} + - + {"Revert" Load(Revert,none) tip="Revert to the layout stored on disk"} + - + {"Import Schematics" Import() } + {"Load layout" Load(Layout) tip="Load a layout from a file"} + {"Load element data to paste-buffer" PasteBuffer(Clear) Load(ElementTobuffer)} + {"Load layout data to paste-buffer" PasteBuffer(Clear) Load(LayoutTobuffer)} + {"Load netlist file" Load(Netlist)} + {"Load vendor resource file" LoadVendorFrom()} + - + {"Save connection data of" + {" a single element" GetXY(Click to set the element mark <>) Save(ElementConnections)} + {" all elements" Save(AllConnections)} + {" unused pins" Save(AllUnusedPins)} + {" netlist patch for back annotation" SavePatch() a={"Alt-Ctrl-B" "Alt Ctrlb"}} + } + - + {"Print layout..." Print()} + {"Export layout..." Export()} + {"Calibrate Printer..." PrintCalibrate()} + - + {"Start New Layout" New() a={"Ctrl-N" "Ctrln"}} + - + {"Preferences..." DoWindows(Preferences)} + - + {"Quit Program" Quit() a={"Ctrl-Q" "Ctrlq"}} + } + +# +# Edit Menu +# + {"Edit" m=E + {"Undo last operation" Undo() a={"U" "u"}} + {"Redo last undone operation" Redo() a={"Shift-R" "Shiftr"}} + {"Clear undo-buffer" Undo(ClearList) a={"Shift-Ctrl-U" "Shift Ctrlu"}} + - + {"Cut selection to buffer" GetXY(Click to set the snap point for this buffer) + PasteBuffer(Clear) PasteBuffer(AddSelected) RemoveSelected() Mode(PasteBuffer) + a={"Ctrl-X" "Ctrlx"}} + {"Copy selection to buffer" GetXY(Click to set the snap point for this buffer) + PasteBuffer(Clear) PasteBuffer(AddSelected) Unselect(All) Mode(PasteBuffer) + a={"Ctrl-C" "Ctrlc"}} + {"Paste buffer to layout" Mode(PasteBuffer) a={"Ctrl-V" "Ctrlv"}} + - + {"Unselect all" Unselect(All) a={"Shift-Alt-A" "Shift Alta"}} + {"Select all visible" Select(All) a={"Alt-A" "Alta"}} + - + {"Edit name of" + {"text on layout" ChangeName(Object) a={"N" "n"}} + {"pin on layout" ChangeName(Object, Number) a={"Shift-Ctrl-N" "Shift Ctrln"}} + {"layout" ChangeName(Layout)} + {"active layer" ChangeName(Layer)} + } + {"Edit attributes of" + {"Layout" Attributes(Layout)} + {"CurrentLayer" Attributes(Layer)} + {"Element" Attributes(Element)} + } + {"Change flags" + {"Nonetlist" ChangeNonetlist(Element) a={"Alt-N" "Altn"}} + } + - + {"Route Styles" @routestyles + - + {"Edit..." AdjustStyle(0)} + } + } + +# +# View Menu +# + {"View" m=V + {"Enable visible grid" checked=drawgrid Display(Grid)} + {"Grid units" + {"mil" checked=grid_units_mil,1 SetUnits(mil)} + {"mm" checked=grid_units_mm,1 SetUnits(mm)} + } + {"Grid size" + {"No Grid" checked=grid,0 SetValue(Grid,1)} + - + { "0.1 mil" checked=gridsize,0.1mil SetUnits(mil) SetValue(Grid,0.1mil)} + { "1 mil" checked=gridsize,1mil SetUnits(mil) SetValue(Grid,1mil)} + { "5 mil" checked=gridsize,5mil SetUnits(mil) SetValue(Grid,5mil)} + { "10 mil" checked=gridsize,10mil SetUnits(mil) SetValue(Grid,10mil)} + { "25 mil" checked=gridsize,25mil SetUnits(mil) SetValue(Grid,25mil)} + { "50 mil" checked=gridsize,50mil SetUnits(mil) SetValue(Grid,50mil)} + {"100 mil" checked=gridsize,100mil SetUnits(mil) SetValue(Grid,100mil)} + - + {"0.01 mm" checked=gridsize,0.01mm SetUnits(mm) SetValue(Grid,0.01mm)} + {"0.05 mm" checked=gridsize,0.05mm SetUnits(mm) SetValue(Grid,0.05mm)} + {"0.1 mm" checked=gridsize,0.10mm SetUnits(mm) SetValue(Grid,0.1mm)} + {"0.25 mm" checked=gridsize,0.25mm SetUnits(mm) SetValue(Grid,0.25mm)} + {"0.5 mm" checked=gridsize,0.50mm SetUnits(mm) SetValue(Grid,0.5mm)} + {"1 mm" checked=gridsize,1mm SetUnits(mm) SetValue(Grid,1mm)} + - + {"Grid -5mil" SetValue(Grid,-5,mil) a={"Shift-G" "Shiftg"}} + {"Grid +5mil" SetValue(Grid,+5,mil) a={"G" "g"}} + {"Grid -0.05mm" SetValue(Grid,-0.05,mm) a={"Shift-Ctrl-G" "Shift Ctrlg"}} + {"Grid +0.05mm" SetValue(Grid,+0.05,mm) a={"Ctrl-G" "Ctrlg"}} + } + {"Realign grid" GetXY(Click to set the grid origin) Display(ToggleGrid)} + - + {"Displayed element name" + {"Description" Display(Description) checked=elementname,1} + {"Reference Designator" Display(NameOnPCB) checked=elementname,2} + {"Value" Display(Value) checked=elementname,3} + } + {"Enable Pinout shows number" checked=shownumber Display(ToggleName)} + {"Pins/Via show Name/Number" Display(PinOrPadName) a={"D" "d"}} + - + {"Zoom In 20%" Zoom(-1.2) m=Z a={"Z" "z"}} + {"Zoom Out 20%" Zoom(+1.2) m=O a={"Shift-Z" "Shiftz"}} + {"More zooms and view changes" + {"Zoom Max" Zoom() m=M a={"V" "v"}} + {"Zoom In 2X" Zoom(-2)} + {"Zoom Out 2X" Zoom(+2)} + {"Zoom to 0.1mil/px" Zoom(=0.1mil)} + {"Zoom to 0.01mm/px" Zoom(=0.01mm)} + {"Zoom to 1mil/px" Zoom(=1mil)} + {"Zoom to 0.05mm/px" Zoom(=0.05mm)} + {"Zoom to 2.5mil/px" Zoom(=2.5mil)} + {"Zoom to 0.1mm/px" Zoom(=0.1mm)} + {"Zoom to 10mil/px" Zoom(=10mil)} + {"Zoom In 20% and center" Zoom(-1.2) Center() m=Z } + {"Zoom Out 20% and center" Zoom(+1.2) Center() m=O } + {"Flip up/down" checked=flip_y SwapSides(V) a={"Tab" "Tab"}} + {"Flip left/right" checked=flip_x SwapSides(H) a={"Shift-Tab" "ShiftTab"}} + {"Spin 180 degrees" SwapSides(R) a={"Ctrl-Tab" "CtrlTab"}} + {"Swap Sides" SwapSides() a={"Ctrl-Shift-Tab" "Ctrl ShiftTab"}} + {"Center cursor" Center() a={"C" "c"}} + } + - + {"Shown Layers" + @layerview + - + {"Edit Layer Groups" EditLayerGroups()} + } + {"Current Layer" + @layerpick + - + {"Delete current layer" MoveLayer(c,-1)} + {"Add new layer" MoveLayer(-1,c)} + {"Move current layer up" MoveLayer(c,up)} + {"Move current layer down" MoveLayer(c,down)} + } + } + +# +# Settings menu +# + {"Settings" m=S + {"'All-direction' lines" checked=alldirection Display(Toggle45Degree) a={"." "."}} + {"Auto swap line start angle" checked=swapstartdir Display(ToggleStartDirection)} + {"Orthogonal moves" checked=orthomove Display(ToggleOrthoMove)} + {"Crosshair snaps to pins and pads" checked=snappin Display(ToggleSnapPin)} + {"Crosshair snaps to off-grid points on lines" checked=snapoffgridline Display(ToggleSnapOffGridLine)} + {"Crosshair shows DRC clearance" checked=showdrc Display(ToggleShowDRC)} + {"Auto enforce DRC clearance" checked=autodrc Display(ToggleAutoDRC)} + {"Lock Names" checked=locknames Display(ToggleLockNames)} + {"Only Names" checked=onlynames Display(ToggleOnlyNames)} + {"Hide Names" checked=hidenames Display(ToggleHideNames)} + {"Mincut on shorts" checked=enablemincut Display(ToggleMinCut)} + {"Libstroke gestures on middle button" checked=enablestroke Display(ToggleStroke)} + - + {"Rubber band mode" checked=rubberband Display(ToggleRubberBandMode)} + {"Require unique element names" checked=uniquename Display(ToggleUniqueNames)} + {"Auto-zero delta measurements" checked=localref Display(ToggleLocalRef)} + {"New lines, arcs clear polygons" checked=clearnew Display(ToggleClearLine)} + {"New polygons are full ones" checked=newfullpoly Display(ToggleFullPoly)} + {"Show autorouter trials" checked=liveroute Display(ToggleLiveRoute)} + {"Highlighting on line, arc points" checked=highlightonpoint Display(ToggleHighlightOnPoint)} + {"Thin draw" checked=thindraw Display(ToggleThindraw) a={"|" "|"}} + {"Thin draw poly" checked=thindrawpoly Display(ToggleThindrawPoly) a={"Ctrl-Shift-P" "Ctrl Shiftp"}} + {"Check polygons" checked=checkplanes Display(ToggleCheckPlanes)} + - + {"Vendor drill mapping" ToggleVendor() checked=VendorMapOn} + {"Import New Elements at" m=I + {" Center" Import(setnewpoint,center) m=C} + {" Mark" Import(setnewpoint,mark) m=M} + {" Crosshair" Import(setnewpoint) m=h} + - + {"Set Dispersion" Import(setdisperse) m=D} + } + } + +# +# Select menu +# + {"Select" m=l + {"Select all visible objects" Select(All)} + {"Select all connected objects" Select(Connection)} + - + {"Unselect all objects" Unselect(All)} + {"unselect all connected objects" Unselect(Connection)} + - + {"Select by name" + {"All objects" Select(ObjectByName) active=have_regex} + {"Elements" Select(ElementByName) active=have_regex} + {"Pads" Select(PadByName) active=have_regex} + {"Pins" Select(PinByName) active=have_regex} + {"Text" Select(TextByName) active=have_regex} + {"Vias" Select(ViaByName) active=have_regex} + } + - + {"Auto-place selected elements" AutoPlaceSelected() a={"Ctrl-P" "Ctrlp"}} + {"Disperse all elements" DisperseElements(All)} + {"Disperse selected elements" DisperseElements(Selected)} + - + {"Move selected elements to other side" Flip(SelectedElements) a={"Shift-B" "Shiftb"}} + {"Move selected to current layer" MoveToCurrentLayer(Selected) a={"Shift-M" "Shiftm"}} + {"Remove selected objects" RemoveSelected() a={"Shift-Delete" "ShiftDelete"}} + {"Convert selection to element" Select(Convert)} + - + {"Optimize selected rats" DeleteRats(SelectedRats) AddRats(SelectedRats)} + {"Auto-route selected rats" AutoRoute(SelectedRats) a={"Alt-R" "Altr"}} + {"Rip up selected auto-routed tracks" RipUp(Selected)} + - + {"Change size of selected objects" + {"Lines -10 mil" ChangeSize(SelectedLines,-10,mil) ChangeSize(SelectedArcs,-10,mil)} + {"Lines +10 mil" ChangeSize(SelectedLines,+10,mil) ChangeSize(SelectedArcs,+10,mil)} + {"Pads -10 mil" ChangeSize(SelectedPads,-10,mil)} + {"Pads +10 mil" ChangeSize(SelectedPads,+10,mil)} + {"Pins -10 mil" ChangeSize(SelectedPins,-10,mil)} + {"Pins +10 mil" ChangeSize(SelectedPins,+10,mil)} + {"Texts -10 mil" ChangeSize(SelectedTexts,-10,mil)} + {"Texts +10 mil" ChangeSize(SelectedTexts,+10,mil)} + {"Vias -10 mil" ChangeSize(SelectedVias,-10,mil)} + {"Vias +10 mil" ChangeSize(SelectedVias,+10,mil)} + } + - + {"Change drilling hole of selected objects" + {"Vias -10 mil" ChangeDrillSize(SelectedVias,-10,mil)} + {"Vias +10 mil" ChangeDrillSize(SelectedVias,+10,mil)} + {"Pins -10 mil" ChangeDrillSize(SelectedPins,-10,mil)} + {"Pins +10 mil" ChangeDrillSize(SelectedPins,+10,mil)} + } + - + {"Change square-flag of selected objects" + {"Elements" ChangeSquare(SelectedElements)} + {"Pins" ChangeSquare(SelectedPins)} + } + + {"Cycle object being dragged" CycleDrag() a={"x" "x"}} + } + +# +# Buffer menu +# + {"Buffer" m=B + {"Cut selection to buffer" GetXY(Click to set the snap point for this buffer) + PasteBuffer(Clear) PasteBuffer(AddSelected) RemoveSelected() Mode(PasteBuffer)} + {"Paste buffer to layout" Mode(PasteBuffer)} + - + {"Rotate buffer 90 deg CCW" Mode(PasteBuffer) PasteBuffer(Rotate,1) + a={"Shift-F7" "ShiftF7"}} + {"Rotate buffer 90 deg CW" Mode(PasteBuffer) PasteBuffer(Rotate,3)} + {"Arbitrarily Rotate Buffer" Mode(PasteBuffer) FreeRotateBuffer()} + {"Mirror buffer (up/down)" Mode(PasteBuffer) PasteBuffer(Mirror)} + {"Mirror buffer (left/right)" Mode(PasteBuffer) PasteBuffer(Rotate,1) + PasteBuffer(Mirror) PasteBuffer(Rotate,3)} + - + {"Clear buffer" PasteBuffer(Clear)} + {"Convert buffer to element" PasteBuffer(Convert)} + {"Break buffer elements to pieces" PasteBuffer(Restore)} + {"Save buffer elements to file" Save(PasteBuffer)} + - + {"Select Buffer #1" checked=buffer,1 PasteBuffer(1) m=1 a={"Shift-1" "Shift1"}} + {"Select Buffer #2" checked=buffer,2 PasteBuffer(2) m=2 a={"Shift-2" "Shift2"}} + {"Select Buffer #3" checked=buffer,3 PasteBuffer(3) m=3 a={"Shift-3" "Shift3"}} + {"Select Buffer #4" checked=buffer,4 PasteBuffer(4) m=4 a={"Shift-4" "Shift4"}} + {"Select Buffer #5" checked=buffer,5 PasteBuffer(5) m=5 a={"Shift-5" "Shift5"}} + } + +# +# Connects menu +# + {"Connects" m=C + {"Lookup connection to object" GetXY(Click on the object) Connection(Find) a={"Ctrl-F" "Ctrlf"}} + {"Reset scanned pads/pins/vias" Connection(ResetPinsViasAndPads) Display(Redraw)} + {"Reset scanned lines/polygons" Connection(ResetLinesAndPolygons) Display(Redraw)} + {"Reset all connections" Connection(Reset) Display(Redraw) a={"Shift-F" "Shiftf"}} + - + {"Optimize rats nest" Atomic(Save) DeleteRats(AllRats) + Atomic(Restore) AddRats(AllRats) Atomic(Block) a={"O" "o"}} + {"Erase rats nest" DeleteRats(AllRats) a={"E" "e"}} + {"Erase selected rats" DeleteRats(SelectedRats) a={"Shift-E" "Shifte"}} + - + {"Auto-route selected rats" AutoRoute(Selected)} + {"Auto-route all rats" AutoRoute(AllRats)} + {"Rip up all auto-routed tracks" RipUp(All)} + - + {"Optimize routed tracks" + {"Auto-Optimize" djopt(auto) a={"Shift-=" "Shift="}} + {"Debumpify" djopt(debumpify) } + {"Unjaggy" djopt(unjaggy) } + {"Vianudge" djopt(vianudge) } + {"Viatrim" djopt(viatrim) } + {"Ortho pull" djopt(orthopull) } + {"Simple optimization" djopt(simple) a={"=" "="}} + {"Miter" djopt(miter) } + {"Puller" a={"Y" "y"} Puller() } + {"Global Puller" + {"Selected" GlobalPuller(selected) } + {"Found" GlobalPuller(found) } + {"All" GlobalPuller() } + } + - + {"Only autorouted nets" OptAutoOnly() checked=optautoonly} + } + - + {"Design Rule Checker" DRC()} + - + {"Apply vendor drill mapping" ApplyVendor()} + - + {"Design changes (back annotation)" + {"Swap nets on two selected pins" net(swap) a={"Shift-x" "Shiftx"}} + {"Replace footprint" ReplaceFootprint() a={"Alt-Shift-f" "Alt Shiftf"}} + } + } + +# +# Plugins Menu +# + {"Plugins" m=P + {"Manage plugins..." ManagePlugins() a={"Alt-R" "Altp"}} + } +# +# Info Menu +# + {"Info" m=I + {"Generate object report" ReportObject() a={"Ctrl-R" "Ctrlr"}} + {"Generate drill summary" Report(DrillReport)} + {"Report found pins/pads" Report(FoundPins)} + {"Key Bindings" + {"Remove" a={"Delete" "Delete"} + Mode(Save) + Mode(Remove) + Mode(Notify) + Mode(Restore) + } + {"Remove Selected" a={"Backspace" "BackSpace"} + RemoveSelected() + } + {"Remove Connected" a={"Shift-Backspace" "ShiftBackSpace"} + Atomic(Save) + Connection(Reset) + Atomic(Restore) + Unselect(All) + Atomic(Restore) + Connection(Find) + Atomic(Restore) + Select(Connection) + Atomic(Restore) + RemoveSelected() + Atomic(Restore) + Connection(Reset) + Atomic(Restore) + Unselect(All) + Atomic(Block) + } + {"Remove Connected" + Atomic(Save) + Connection(Reset) + Atomic(Restore) + Unselect(All) + Atomic(Restore) + Connection(Find) + Atomic(Restore) + Select(Connection) + Atomic(Restore) + RemoveSelected() + Atomic(Restore) + Connection(Reset) + Atomic(Restore) + Unselect(All) + Atomic(Block) + } + {"Set Same" a={"A" "a"} SetSame()} + {"Flip Object" a={"B" "b"} Flip(Object)} + {"Find Connections" a={"F" "f"} Connection(Reset) Connection(Find)} + {"ToggleHideName Object" a={"H" "h"} ToggleHideName(Object)} + {"ToggleHideName SelectedElement" a={"Shift-H" "Shifth"} ToggleHideName(SelectedElements)} + {"ChangeHole Object" a={"Ctrl-H" "Ctrlh"} ChangeHole(Object)} + {"ChangeJoin Object" a={"J" "j"} ChangeJoin(Object)} + {"ChangeJoin SelectedObject" a={"Shift-J" "Shiftj"} ChangeJoin(SelectedObjects)} + {"Clear Object +2 mil" a={"K" "k"} ChangeClearSize(Object,+2,mil)} + {"Clear Object -2 mil" a={"Shift-K" "Shiftk"} ChangeClearSize(Object,-2,mil)} + {"Clear Selected +2 mil" a={"Ctrl-K" "Ctrlk"} ChangeClearSize(SelectedObjects,+2,mil)} + {"Clear Selected -2 mil" a={"Shift-Ctrl-K" "Shift Ctrlk"} ChangeClearSize(SelectedObjects,-2,mil)} + {"Line Tool size +5 mil" a={"L" "l"} SetValue(LineSize,+5,mil)} + {"Line Tool size -5 mil" a={"Shift-L" "Shiftl"} SetValue(LineSize,-5,mil)} + {"Move Object to current layer" a={"M" "m"} MoveToCurrentLayer(Object)} + {"MarkCrosshair" a={"Ctrl-M" "Ctrlm"} MarkCrosshair()} + {"Select shortest rat" a={"Shift-N" "Shiftn"} AddRats(Close)} + {"AddRats to selected pins" a={"Shift-O" "Shifto"} + Atomic(Save) + DeleteRats(AllRats) + Atomic(Restore) + AddRats(SelectedRats) + Atomic(Block) } + {"ChangeOctagon Object" a={"Ctrl-O" "Ctrlo"} ChangeOctagon(Object)} + {"Polygon PreviousPoint" a={"P" "p"} Polygon(PreviousPoint)} + {"Polygon Close" a={"Shift-P" "Shiftp"} Polygon(Close)} + {"ChangeSquare Object" a={"Q" "q"} ChangeSquare(ToggleObject)} + {"ChangeSizes to Route style" a={"Y" "Shifty"} ChangeSizes(Object,style,mil);} + {"ChangeSize +5 mil" a={"S" "s"} ChangeSize(Object,+5,mil)} + {"ChangeSize -5 mil" a={"Shift-S" "Shifts"} ChangeSize(Object,-5,mil)} + {"ChangeDrill +5 mil" a={"Alt-S" "Alts"} ChangeDrillSize(Object,+5,mil)} + {"ChangeDrill -5 mil" a={"Alt-Shift-S" "Alt Shifts"} ChangeDrillSize(Object,-5,mil)} + {"Text Tool scale +10 mil" a={"T" "t"} SetValue(TextScale,+10,mil)} + {"Text Tool scale -10 mil" a={"Shift-T" "Shiftt"} SetValue(TextScale,-10,mil)} + {"Via Tool size +5 mil" a={"Shift-V" "Shiftv"} SetValue(ViaSize,+5,mil)} + {"Via Tool size -5 mil" a={"Shift-Ctrl-V" "Shift Ctrlv"} SetValue(ViaSize,-5,mil)} + {"Via Tool drill +5 mil" a={"Alt-V" "Altv"} SetValue(ViaDrillingHole,+5,mil)} + {"Via Tool drill -5 mil" a={"Alt-Shift-V" "Alt Shiftv"} SetValue(ViaDrillingHole,-5,mil)} + {"AddRats Selected" a={"Shift-W" "Shiftw"} AddRats(SelectedRats)} + {"Add All Rats" a={"W" "w"} AddRats(AllRats)} + {"Cycle Clip" a={"/" "/"} Display(CycleClip)} + {"Arrow Mode" a={"Space" "space"} Mode(Arrow) checked=arrowmode,1} + {"Temp Arrow ON" a={"[" "["} Mode(Save) Mode(Arrow) Mode(Notify)} + {"Temp Arrow OFF" a={"]" "]"} Mode(Release) Mode(Restore)} + - + {"Step Up" a={"Up" "Up"} Cursor(Warp,0,1,grid)} + {"Step Down" a={"Down" "Down"} Cursor(Warp,0,-1,grid)} + {"Step Left" a={"Left" "Left"} Cursor(Warp,-1,0,grid)} + {"Step Right" a={"Right" "Right"} Cursor(Warp,1,0,grid)} + {"Step +Up" a={"Up" "ShiftUp"} Cursor(Pan,0,50,view)} + {"Step +Down" a={"Down" "ShiftDown"} Cursor(Pan,0,-50,view)} + {"Step +Left" a={"Left" "ShiftLeft"} Cursor(Pan,-50,0,view)} + {"Step +Right" a={"Right" "ShiftRight"} Cursor(Pan,50,0,view)} + {'"Click"' a={"Enter" "Enter"} Mode(Notify) Mode(Release)} + - + } + } + +# +# Window Menu +# + {"Window" m=W + {"Library" DoWindows(Library) a={"i" "i"}} + {"Message Log" DoWindows(Log)} + {"DRC Check" DoWindows(DRC)} + {"Netlist" DoWindows(Netlist)} + {"Command Entry" Command() a={":" ":"}} + {"Pinout" Display(Pinout) a={"Shift-D" "Shiftd"}} + - + {"About..." About()} + } +} + +PopupMenus = + { + Popup1 = + { + {"Operations on selections" + {"Unselect all objects" Unselect(All)} + {"Remove selected objects" RemoveSelected()} + {"Copy selection to buffer" + GetXY(Click to set the snap point for this buffer) + PasteBuffer(Clear) + PasteBuffer(AddSelected) + Mode(PasteBuffer) + } + {"Cut selection to buffer" + GetXY(Click to set the snap point for this buffer) + PasteBuffer(Clear) + PasteBuffer(AddSelected) + RemoveSelected() + Mode(PasteBuffer) + } + {"Convert selection to element" Select(Convert)} + {"Auto place selected elements" AutoPlaceSelected()} + {"Autoroute selected elements" AutoRoute(SelectedRats)} + {"Rip up selected auto-routed tracks" RipUp(Selected)} + } + {"Operations on this location" + {"Generate object report" GetXY(Click on the object) Report(Object)} + } + - + {"Undo last operation" Undo()} + {"Redo last undone operation" Redo()} + - + {Tools + {"None" checked=nomode,1 Mode(None)} + {"Via" checked=viamode,1 Mode(Via) a={"F1" "F1"}} + {"Line" checked=linemode,1 Mode(Line) a={"F2" "F2"}} + {"Arc" checked=arcmode,1 Mode(Arc) a={"F3" "F3"}} + {"Text" checked=textmode,1 Mode(Text) a={"F4" "F4"}} + {"Rectangle" checked=rectanglemode,1 Mode(Rectangle) a={"F5" "F5"}} + {"Polygon" checked=polygonmode,1 Mode(Polygon) a={"F6" "F6"}} + {"Polygon Hole" checked=polygonholemode,1 Mode(PolygonHole)} + {"Buffer" checked=pastebuffermode,1 Mode(PasteBuffer) a={"F7" "F7"}} + {"Remove" checked=removemode,1 Mode(Remove) a={"F8" "F8"}} + {"Rotate" checked=rotatemode,1 Mode(Rotate) a={"F9" "F9"}} + {"Thermal" checked=thermalmode,1 Mode(Thermal) a={"F10" "F10"}} + {"Arrow" checked=arrowmode,1 Mode(Arrow) a={"F11" "F11"}} + {"Insert Point" checked=insertpointmode,1 Mode(InsertPoint) a={"Insert" "Insert"}} + {"Move" checked=movemode,1 Mode(Move)} + {"Copy" checked=copymode,1 Mode(Copy)} + {"Lock" checked=lockmode,1 Mode(Lock) a={"F12" "F12"}} + {"Cancel" Mode(Escape) a={"Esc" "Escape"}} + } + } + } + Index: 1.0.8/src/gui_act.c =================================================================== --- 1.0.8/src/gui_act.c (nonexistent) +++ 1.0.8/src/gui_act.c (revision 1136) @@ -0,0 +1,1113 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact addresses for paper mail and Email: + * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA + * haceaton@aplcomm.jhuapl.edu + * + */ +#include "config.h" +#include "global.h" +#include "data.h" +#include "action.h" +#include "change.h" +#include "error.h" +#include "undo.h" + +#include "draw.h" +#include "search.h" +#include "crosshair.h" +#include "find.h" +#include "set.h" +#include "misc.h" +#include "stub_stroke.h" + +/* --------------------------------------------------------------------------- */ + +static const char display_syntax[] = + "Display(NameOnPCB|Description|Value)\n" + "Display(Grid|Redraw)\n" + "Display(CycleClip|CycleCrosshair|Toggle45Degree|ToggleStartDirection)\n" + "Display(ToggleGrid|ToggleRubberBandMode|ToggleUniqueNames)\n" + "Display(ToggleMask|ToggleName|ToggleClearLine|ToggleFullPoly)\n" + "Display(ToggleSnapPin|ToggleSnapOffGridLine|ToggleHighlightOnPoint)\n" + "Display(ToggleThindraw|ToggleThindrawPoly|ToggleOrthoMove|ToggleLocalRef)\n" + "Display(ToggleCheckPlanes|ToggleShowDRC|ToggleAutoDRC)\n" + "Display(ToggleLiveRoute|LockNames|OnlyNames)\n" "Display(Pinout|PinOrPadName)"; + +static const char display_help[] = "Several display-related actions."; + +/* %start-doc actions Display + +@table @code + +@item NameOnPCB +@item Description +@item Value +Specify whether all elements show their name, description, or value. + +@item Redraw +Redraw the whole board. + +@item Toggle45Degree +When clear, lines can be drawn at any angle. When set, lines are +restricted to multiples of 45 degrees and requested lines may be +broken up according to the clip setting. + +@item CycleClip +Changes the way lines are restricted to 45 degree increments. The +various settings are: straight only, orthogonal then angled, and angled +then orthogonal. If AllDirections is set, this action disables it. + +@item CycleCrosshair +Changes crosshair drawing. Crosshair may accept form of 4-ray, +8-ray and 12-ray cross. + +@item ToggleRubberBandMode +If set, moving an object moves all the lines attached to it too. + +@item ToggleStartDirection +If set, each time you set a point in a line, the Clip toggles between +orth-angle and angle-ortho. + +@item ToggleUniqueNames +If set, you will not be permitted to change the name of an element to +match that of another element. + +@item ToggleSnapPin +If set, pin centers and pad end points are treated as additional grid +points that the cursor can snap to. + +@item ToggleSnapOffGridLine +If set, snap at some sensible point along a line. + +@item ToggleHighlightOnPoint +If set, highlights lines and arcs when the crosshair is on one of their +two (end) points. + +@item ToggleLocalRef +If set, the mark is automatically set to the beginning of any move, so +you can see the relative distance you've moved. + +@item ToggleThindraw +If set, objects on the screen are drawn as outlines (lines are drawn +as center-lines). This lets you see line endpoints hidden under pins, +for example. + +@item ToggleThindrawPoly +If set, polygons on the screen are drawn as outlines. + +@item ToggleShowDRC +If set, pending objects (i.e. lines you're in the process of drawing) +will be drawn with an outline showing how far away from other copper +you need to be. + +@item ToggleLiveRoute +If set, the progress of the autorouter will be visible on the screen. + +@item ToggleAutoDRC +If set, you will not be permitted to make connections which violate +the current DRC and netlist settings. + +@item ToggleCheckPlanes +If set, lines and arcs aren't drawn, which usually leaves just the +polygons. If you also disable all but the layer you're interested in, +this allows you to check for isolated regions. + +@item ToggleOrthoMove +If set, the crosshair is only allowed to move orthogonally from its +previous position. I.e. you can move an element or line up, down, +left, or right, but not up+left or down+right. + +@item ToggleName +Selects whether the pinouts show the pin names or the pin numbers. + +@item ToggleLockNames +If set, text will ignore left mouse clicks and actions that work on +objects under the mouse. You can still select text with a lasso (left +mouse drag) and perform actions on the selection. + +@item ToggleOnlyNames +If set, only text will be sensitive for mouse clicks and actions that +work on objects under the mouse. You can still select other objects +with a lasso (left mouse drag) and perform actions on the selection. + +@item ToggleMask +Turns the solder mask on or off. + +@item ToggleClearLine +When set, the clear-line flag causes new lines and arcs to have their +``clear polygons'' flag set, so they won't be electrically connected +to any polygons they overlap. + +@item ToggleFullPoly +When set, the full-poly flag causes new polygons to have their +``full polygon'' flag set, so all parts of them will be displayed +instead of only the biggest one. + +@item ToggleGrid +Resets the origin of the current grid to be wherever the mouse pointer +is (not where the crosshair currently is). If you provide two numbers +after this, the origin is set to that coordinate. + +@item Grid +Toggles whether the grid is displayed or not. + +@item Pinout +Causes the pinout of the element indicated by the cursor to be +displayed, usually in a separate window. + +@item PinOrPadName +Toggles whether the names of pins, pads, or (yes) vias will be +displayed. If the cursor is over an element, all of its pins and pads +are affected. + +@end table + +%end-doc */ + +static enum crosshair_shape CrosshairShapeIncrement(enum crosshair_shape shape) +{ + switch (shape) { + case Basic_Crosshair_Shape: + shape = Union_Jack_Crosshair_Shape; + break; + case Union_Jack_Crosshair_Shape: + shape = Dozen_Crosshair_Shape; + break; + case Dozen_Crosshair_Shape: + shape = Crosshair_Shapes_Number; + break; + case Crosshair_Shapes_Number: + shape = Basic_Crosshair_Shape; + break; + } + return shape; +} + +static int ActionDisplay(int argc, char **argv, Coord childX, Coord childY) +{ + char *function, *str_dir; + int id; + int err = 0; + + function = ARG(0); + str_dir = ARG(1); + + if (function && (!str_dir || !*str_dir)) { + switch (id = GetFunctionID(function)) { + + /* redraw layout */ + case F_ClearAndRedraw: + case F_Redraw: + Redraw(); + break; + + /* change the displayed name of elements */ + case F_Value: + case F_NameOnPCB: + case F_Description: + ELEMENT_LOOP(PCB->Data); + { + EraseElementName(element); + } + END_LOOP; + CLEAR_FLAG(DESCRIPTIONFLAG | NAMEONPCBFLAG, PCB); + switch (id) { + case F_Value: + break; + case F_NameOnPCB: + SET_FLAG(NAMEONPCBFLAG, PCB); + break; + case F_Description: + SET_FLAG(DESCRIPTIONFLAG, PCB); + break; + } + ELEMENT_LOOP(PCB->Data); + { + DrawElementName(element); + } + END_LOOP; + Draw(); + break; + + /* toggle line-adjust flag */ + case F_ToggleAllDirections: + TOGGLE_FLAG(ALLDIRECTIONFLAG, PCB); + AdjustAttachedObjects(); + break; + + case F_CycleClip: + notify_crosshair_change(false); + if TEST_FLAG + (ALLDIRECTIONFLAG, PCB) { + TOGGLE_FLAG(ALLDIRECTIONFLAG, PCB); + PCB->Clipping = 0; + } + else + PCB->Clipping = (PCB->Clipping + 1) % 3; + AdjustAttachedObjects(); + notify_crosshair_change(true); + break; + + case F_CycleCrosshair: + notify_crosshair_change(false); + Crosshair.shape = CrosshairShapeIncrement(Crosshair.shape); + if (Crosshair_Shapes_Number == Crosshair.shape) + Crosshair.shape = Basic_Crosshair_Shape; + notify_crosshair_change(true); + break; + + case F_ToggleRubberBandMode: + notify_crosshair_change(false); + TOGGLE_FLAG(RUBBERBANDFLAG, PCB); + notify_crosshair_change(true); + break; + + case F_ToggleStartDirection: + notify_crosshair_change(false); + TOGGLE_FLAG(SWAPSTARTDIRFLAG, PCB); + notify_crosshair_change(true); + break; + + case F_ToggleUniqueNames: + TOGGLE_FLAG(UNIQUENAMEFLAG, PCB); + break; + + case F_ToggleSnapPin: + notify_crosshair_change(false); + TOGGLE_FLAG(SNAPPINFLAG, PCB); + notify_crosshair_change(true); + break; + + case F_ToggleSnapOffGridLine: + notify_crosshair_change(false); + TOGGLE_FLAG(SNAPOFFGRIDLINEFLAG, PCB); + notify_crosshair_change(true); + break; + + case F_ToggleHighlightOnPoint: + notify_crosshair_change(false); + TOGGLE_FLAG(HIGHLIGHTONPOINTFLAG, PCB); + notify_crosshair_change(true); + break; + + case F_ToggleLocalRef: + TOGGLE_FLAG(LOCALREFFLAG, PCB); + break; + + case F_ToggleThindraw: + TOGGLE_FLAG(THINDRAWFLAG, PCB); + Redraw(); + break; + + case F_ToggleThindrawPoly: + TOGGLE_FLAG(THINDRAWPOLYFLAG, PCB); + Redraw(); + break; + + case F_ToggleLockNames: + TOGGLE_FLAG(LOCKNAMESFLAG, PCB); + CLEAR_FLAG(ONLYNAMESFLAG, PCB); + break; + + case F_ToggleOnlyNames: + TOGGLE_FLAG(ONLYNAMESFLAG, PCB); + CLEAR_FLAG(LOCKNAMESFLAG, PCB); + break; + + case F_ToggleHideNames: + TOGGLE_FLAG(HIDENAMESFLAG, PCB); + Redraw(); + break; + + case F_ToggleMinCut: + TOGGLE_FLAG(ENABLEMINCUTFLAG, PCB); + break; + + case F_ToggleStroke: + TOGGLE_FLAG(ENABLESTROKEFLAG, PCB); + Settings.EnableStroke = TEST_FLAG(ENABLESTROKEFLAG, PCB); + break; + + case F_ToggleShowDRC: + TOGGLE_FLAG(SHOWDRCFLAG, PCB); + break; + + case F_ToggleLiveRoute: + TOGGLE_FLAG(LIVEROUTEFLAG, PCB); + break; + + case F_ToggleAutoDRC: + notify_crosshair_change(false); + TOGGLE_FLAG(AUTODRCFLAG, PCB); + if (TEST_FLAG(AUTODRCFLAG, PCB) && Settings.Mode == LINE_MODE) { + if (ResetConnections(true)) { + IncrementUndoSerialNumber(); + Draw(); + } + if (Crosshair.AttachedLine.State != STATE_FIRST) + LookupConnection(Crosshair.AttachedLine.Point1.X, Crosshair.AttachedLine.Point1.Y, true, 1, FOUNDFLAG); + } + notify_crosshair_change(true); + break; + + case F_ToggleCheckPlanes: + TOGGLE_FLAG(CHECKPLANESFLAG, PCB); + Redraw(); + break; + + case F_ToggleOrthoMove: + TOGGLE_FLAG(ORTHOMOVEFLAG, PCB); + break; + + case F_ToggleName: + TOGGLE_FLAG(SHOWNUMBERFLAG, PCB); + Redraw(); + break; + + case F_ToggleMask: + TOGGLE_FLAG(SHOWMASKFLAG, PCB); + Redraw(); + break; + + case F_ToggleClearLine: + TOGGLE_FLAG(CLEARNEWFLAG, PCB); + break; + + case F_ToggleFullPoly: + TOGGLE_FLAG(NEWFULLPOLYFLAG, PCB); + break; + + /* shift grid alignment */ + case F_ToggleGrid: + { + Coord oldGrid = PCB->Grid; + + PCB->Grid = 1; + if (MoveCrosshairAbsolute(Crosshair.X, Crosshair.Y)) + notify_crosshair_change(true); /* first notify was in MoveCrosshairAbs */ + SetGrid(oldGrid, true); + } + break; + + /* toggle displaying of the grid */ + case F_Grid: + Settings.DrawGrid = !Settings.DrawGrid; + Redraw(); + break; + + /* display the pinout of an element */ + case F_Pinout: + { + ElementTypePtr element; + void *ptrtmp; + Coord x, y; + + gui->get_coords(_("Click on an element"), &x, &y); + if ((SearchScreen(x, y, ELEMENT_TYPE, &ptrtmp, &ptrtmp, &ptrtmp)) != NO_TYPE) { + element = (ElementTypePtr) ptrtmp; + gui->show_item(element); + } + break; + } + + /* toggle displaying of pin/pad/via names */ + case F_PinOrPadName: + { + void *ptr1, *ptr2, *ptr3; + + switch (SearchScreen(Crosshair.X, Crosshair.Y, + ELEMENT_TYPE | PIN_TYPE | PAD_TYPE | + VIA_TYPE, (void **) &ptr1, (void **) &ptr2, (void **) &ptr3)) { + case ELEMENT_TYPE: + PIN_LOOP((ElementTypePtr) ptr1); + { + if (TEST_FLAG(DISPLAYNAMEFLAG, pin)) + ErasePinName(pin); + else + DrawPinName(pin); + AddObjectToFlagUndoList(PIN_TYPE, ptr1, pin, pin); + TOGGLE_FLAG(DISPLAYNAMEFLAG, pin); + } + END_LOOP; + PAD_LOOP((ElementTypePtr) ptr1); + { + if (TEST_FLAG(DISPLAYNAMEFLAG, pad)) + ErasePadName(pad); + else + DrawPadName(pad); + AddObjectToFlagUndoList(PAD_TYPE, ptr1, pad, pad); + TOGGLE_FLAG(DISPLAYNAMEFLAG, pad); + } + END_LOOP; + SetChangedFlag(true); + IncrementUndoSerialNumber(); + Draw(); + break; + + case PIN_TYPE: + if (TEST_FLAG(DISPLAYNAMEFLAG, (PinTypePtr) ptr2)) + ErasePinName((PinTypePtr) ptr2); + else + DrawPinName((PinTypePtr) ptr2); + AddObjectToFlagUndoList(PIN_TYPE, ptr1, ptr2, ptr3); + TOGGLE_FLAG(DISPLAYNAMEFLAG, (PinTypePtr) ptr2); + SetChangedFlag(true); + IncrementUndoSerialNumber(); + Draw(); + break; + + case PAD_TYPE: + if (TEST_FLAG(DISPLAYNAMEFLAG, (PadTypePtr) ptr2)) + ErasePadName((PadTypePtr) ptr2); + else + DrawPadName((PadTypePtr) ptr2); + AddObjectToFlagUndoList(PAD_TYPE, ptr1, ptr2, ptr3); + TOGGLE_FLAG(DISPLAYNAMEFLAG, (PadTypePtr) ptr2); + SetChangedFlag(true); + IncrementUndoSerialNumber(); + Draw(); + break; + case VIA_TYPE: + if (TEST_FLAG(DISPLAYNAMEFLAG, (PinTypePtr) ptr2)) + EraseViaName((PinTypePtr) ptr2); + else + DrawViaName((PinTypePtr) ptr2); + AddObjectToFlagUndoList(VIA_TYPE, ptr1, ptr2, ptr3); + TOGGLE_FLAG(DISPLAYNAMEFLAG, (PinTypePtr) ptr2); + SetChangedFlag(true); + IncrementUndoSerialNumber(); + Draw(); + break; + } + break; + } + default: + err = 1; + } + } + else if (function && str_dir) { + switch (GetFunctionID(function)) { + case F_ToggleGrid: + if (argc > 2) { + PCB->GridOffsetX = GetValue(argv[1], NULL, NULL); + PCB->GridOffsetY = GetValue(argv[2], NULL, NULL); + if (Settings.DrawGrid) + Redraw(); + } + break; + + default: + err = 1; + break; + } + } + + if (!err) + return 0; + + AFAIL(display); +} + +/* --------------------------------------------------------------------------- */ + +static const char mode_syntax[] = + "Mode(Arc|Arrow|Copy|InsertPoint|Line|Lock|Move|None|PasteBuffer)\n" + "Mode(Polygon|Rectangle|Remove|Rotate|Text|Thermal|Via)\n" "Mode(Notify|Release|Cancel|Stroke)\n" "Mode(Save|Restore)"; + +static const char mode_help[] = "Change or use the tool mode."; + +/* %start-doc actions Mode + +@table @code + +@item Arc +@itemx Arrow +@itemx Copy +@itemx InsertPoint +@itemx Line +@itemx Lock +@itemx Move +@itemx None +@itemx PasteBuffer +@itemx Polygon +@itemx Rectangle +@itemx Remove +@itemx Rotate +@itemx Text +@itemx Thermal +@itemx Via +Select the indicated tool. + +@item Notify +Called when you press the mouse button, or move the mouse. + +@item Release +Called when you release the mouse button. + +@item Cancel +Cancels any pending tool activity, allowing you to restart elsewhere. +For example, this allows you to start a new line rather than attach a +line to the previous line. + +@item Escape +Similar to Cancel but calling this action a second time will return +to the Arrow tool. + +@item Stroke +If your @code{pcb} was built with libstroke, this invokes the stroke +input method. If not, this will restart a drawing mode if you were +drawing, else it will select objects. + +@item Save +Remembers the current tool. + +@item Restore +Restores the tool to the last saved tool. + +@end table + +%end-doc */ + +static int ActionMode(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + + if (function) { + Note.X = Crosshair.X; + Note.Y = Crosshair.Y; + notify_crosshair_change(false); + switch (GetFunctionID(function)) { + case F_Arc: + SetMode(ARC_MODE); + break; + case F_Arrow: + SetMode(ARROW_MODE); + break; + case F_Copy: + SetMode(COPY_MODE); + break; + case F_InsertPoint: + SetMode(INSERTPOINT_MODE); + break; + case F_Line: + SetMode(LINE_MODE); + break; + case F_Lock: + SetMode(LOCK_MODE); + break; + case F_Move: + SetMode(MOVE_MODE); + break; + case F_None: + SetMode(NO_MODE); + break; + case F_Cancel: + { + int saved_mode = Settings.Mode; + SetMode(NO_MODE); + SetMode(saved_mode); + } + break; + case F_Escape: + { + switch (Settings.Mode) { + case VIA_MODE: + case PASTEBUFFER_MODE: + case TEXT_MODE: + case ROTATE_MODE: + case REMOVE_MODE: + case MOVE_MODE: + case COPY_MODE: + case INSERTPOINT_MODE: + case RUBBERBANDMOVE_MODE: + case THERMAL_MODE: + case LOCK_MODE: + SetMode(NO_MODE); + SetMode(ARROW_MODE); + break; + + case LINE_MODE: + if (Crosshair.AttachedLine.State == STATE_FIRST) + SetMode(ARROW_MODE); + else { + SetMode(NO_MODE); + SetMode(LINE_MODE); + } + break; + + case RECTANGLE_MODE: + if (Crosshair.AttachedBox.State == STATE_FIRST) + SetMode(ARROW_MODE); + else { + SetMode(NO_MODE); + SetMode(RECTANGLE_MODE); + } + break; + + case POLYGON_MODE: + if (Crosshair.AttachedLine.State == STATE_FIRST) + SetMode(ARROW_MODE); + else { + SetMode(NO_MODE); + SetMode(POLYGON_MODE); + } + break; + + case POLYGONHOLE_MODE: + if (Crosshair.AttachedLine.State == STATE_FIRST) + SetMode(ARROW_MODE); + else { + SetMode(NO_MODE); + SetMode(POLYGONHOLE_MODE); + } + break; + + case ARC_MODE: + if (Crosshair.AttachedBox.State == STATE_FIRST) + SetMode(ARROW_MODE); + else { + SetMode(NO_MODE); + SetMode(ARC_MODE); + } + break; + + case ARROW_MODE: + break; + + default: + break; + } + } + break; + + case F_Notify: + NotifyMode(); + break; + case F_PasteBuffer: + SetMode(PASTEBUFFER_MODE); + break; + case F_Polygon: + SetMode(POLYGON_MODE); + break; + case F_PolygonHole: + SetMode(POLYGONHOLE_MODE); + break; + case F_Release: + if ((mid_stroke) && (Settings.EnableStroke)) + stub_stroke_finish(); + else + ReleaseMode(); + break; + case F_Remove: + SetMode(REMOVE_MODE); + break; + case F_Rectangle: + SetMode(RECTANGLE_MODE); + break; + case F_Rotate: + SetMode(ROTATE_MODE); + break; + case F_Stroke: + if (Settings.EnableStroke) { + stub_stroke_start(); + break; + } + /* Handle middle mouse button restarts of drawing mode. If not in + | a drawing mode, middle mouse button will select objects. + */ + if (Settings.Mode == LINE_MODE && Crosshair.AttachedLine.State != STATE_FIRST) { + SetMode(LINE_MODE); + } + else if (Settings.Mode == ARC_MODE && Crosshair.AttachedBox.State != STATE_FIRST) + SetMode(ARC_MODE); + else if (Settings.Mode == RECTANGLE_MODE && Crosshair.AttachedBox.State != STATE_FIRST) + SetMode(RECTANGLE_MODE); + else if (Settings.Mode == POLYGON_MODE && Crosshair.AttachedLine.State != STATE_FIRST) + SetMode(POLYGON_MODE); + else { + SaveMode(); + saved_mode = true; + SetMode(ARROW_MODE); + NotifyMode(); + } + break; + case F_Text: + SetMode(TEXT_MODE); + break; + case F_Thermal: + SetMode(THERMAL_MODE); + break; + case F_Via: + SetMode(VIA_MODE); + break; + + case F_Restore: /* restore the last saved mode */ + RestoreMode(); + break; + + case F_Save: /* save currently selected mode */ + SaveMode(); + break; + } + notify_crosshair_change(true); + return 0; + } + + AFAIL(mode); +} + +/* ---------------------------------------------------------------- */ +static const char cycledrag_syntax[] = "CycleDrag()\n"; + +static const char cycledrag_help[] = "Cycle through which object is being dragged"; + +#define close_enough(a, b) ((((a)-(b)) > 0) ? ((a)-(b) < (SLOP * pixel_slop)) : ((a)-(b) > -(SLOP * pixel_slop))) +static int ActionCycleDrag(int argc, char **argv, Coord x, Coord y) +{ + void *ptr1, *ptr2, *ptr3; + int over = 0; + + if (Crosshair.drags == NULL) + return NULL; + + do { + Crosshair.drags_current++; + if (Crosshair.drags_current >= Crosshair.drags_len) { + Crosshair.drags_current = 0; + over++; + } + + if (SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Crosshair.drags[Crosshair.drags_current], LINE_TYPE) != NO_TYPE) { + /* line has two endpoints, check which one is close to the original x;y */ + LineType *l = ptr2; + long int d1, d2; + if (close_enough(Note.X, l->Point1.X) && close_enough(Note.Y, l->Point1.Y)) { + Crosshair.AttachedObject.Type = LINEPOINT_TYPE; + Crosshair.AttachedObject.Ptr1 = ptr1; + Crosshair.AttachedObject.Ptr2 = ptr2; + Crosshair.AttachedObject.Ptr3 = &l->Point1; + return 0; + } + if (close_enough(Note.X, l->Point2.X) && close_enough(Note.Y, l->Point2.Y)) { + Crosshair.AttachedObject.Type = LINEPOINT_TYPE; + Crosshair.AttachedObject.Ptr1 = ptr1; + Crosshair.AttachedObject.Ptr2 = ptr2; + Crosshair.AttachedObject.Ptr3 = &l->Point2; + return 0; + } + } + else if (SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Crosshair.drags[Crosshair.drags_current], VIA_TYPE) != NO_TYPE) { + Crosshair.AttachedObject.Type = VIA_TYPE; + Crosshair.AttachedObject.Ptr1 = ptr1; + Crosshair.AttachedObject.Ptr2 = ptr2; + Crosshair.AttachedObject.Ptr3 = ptr3; + return 0; + } + else if (SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Crosshair.drags[Crosshair.drags_current], PAD_TYPE) != NO_TYPE) { + Crosshair.AttachedObject.Type = ELEMENT_TYPE; + Crosshair.AttachedObject.Ptr1 = ptr1; + Crosshair.AttachedObject.Ptr2 = ptr1; + Crosshair.AttachedObject.Ptr3 = ptr1; + return 0; + } + else if (SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Crosshair.drags[Crosshair.drags_current], ARC_TYPE) != NO_TYPE) { + Crosshair.AttachedObject.Type = ARC_TYPE; + Crosshair.AttachedObject.Ptr1 = ptr1; + Crosshair.AttachedObject.Ptr2 = ptr2; + Crosshair.AttachedObject.Ptr3 = ptr3; + return 0; + } + + } while (over <= 1); + + return -1; +} + +#undef close_enough + +/* -------------------------------------------------------------------------- */ + +static const char message_syntax[] = "Message(message)"; + +static const char message_help[] = "Writes a message to the log window."; + +/* %start-doc actions Message + +This action displays a message to the log window. This action is primarily +provided for use by other programs which may interface with PCB. If +multiple arguments are given, each one is sent to the log window +followed by a newline. + +%end-doc */ + +static int ActionMessage(int argc, char **argv, Coord x, Coord y) +{ + int i; + + if (argc < 1) + AFAIL(message); + + for (i = 0; i < argc; i++) { + Message(argv[i]); + Message("\n"); + } + + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char togglehidename_syntax[] = "ToggleHideName(Object|SelectedElements)"; + +static const char togglehidename_help[] = "Toggles the visibility of element names."; + +/* %start-doc actions ToggleHideName + +If names are hidden you won't see them on the screen and they will not +appear on the silk layer when you print the layout. + +%end-doc */ + +static int ActionToggleHideName(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + if (function && PCB->ElementOn) { + switch (GetFunctionID(function)) { + case F_Object: + { + int type; + void *ptr1, *ptr2, *ptr3; + + gui->get_coords(_("Select an Object"), &x, &y); + if ((type = SearchScreen(x, y, ELEMENT_TYPE, &ptr1, &ptr2, &ptr3)) != NO_TYPE) { + AddObjectToFlagUndoList(type, ptr1, ptr2, ptr3); + EraseElementName((ElementTypePtr) ptr2); + TOGGLE_FLAG(HIDENAMEFLAG, (ElementTypePtr) ptr2); + DrawElementName((ElementTypePtr) ptr2); + Draw(); + IncrementUndoSerialNumber(); + } + break; + } + case F_SelectedElements: + case F_Selected: + { + bool changed = false; + ELEMENT_LOOP(PCB->Data); + { + if ((TEST_FLAG(SELECTEDFLAG, element) || TEST_FLAG(SELECTEDFLAG, &NAMEONPCB_TEXT(element))) + && (FRONT(element) || PCB->InvisibleObjectsOn)) { + AddObjectToFlagUndoList(ELEMENT_TYPE, element, element, element); + EraseElementName(element); + TOGGLE_FLAG(HIDENAMEFLAG, element); + DrawElementName(element); + changed = true; + } + } + END_LOOP; + if (changed) { + Draw(); + IncrementUndoSerialNumber(); + } + } + } + } + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char markcrosshair_syntax[] = "MarkCrosshair()\n" "MarkCrosshair(Center)"; + +static const char markcrosshair_help[] = "Set/Reset the Crosshair mark."; + +/* %start-doc actions MarkCrosshair + +The ``mark'' is a small X-shaped target on the display which is +treated like a second origin (the normal origin is the upper let +corner of the board). The GUI will display a second set of +coordinates for this mark, which tells you how far you are from it. + +If no argument is given, the mark is toggled - disabled if it was +enabled, or enabled at the current cursor position of disabled. If +the @code{Center} argument is given, the mark is moved to the current +cursor location. + +%end-doc */ + +static int ActionMarkCrosshair(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + if (!function || !*function) { + if (Marked.status) { + notify_mark_change(false); + Marked.status = false; + notify_mark_change(true); + } + else { + notify_mark_change(false); + Marked.status = false; + Marked.status = true; + Marked.X = Crosshair.X; + Marked.Y = Crosshair.Y; + notify_mark_change(true); + } + } + else if (GetFunctionID(function) == F_Center) { + notify_mark_change(false); + Marked.status = true; + Marked.X = Crosshair.X; + Marked.Y = Crosshair.Y; + notify_mark_change(true); + } + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char routestyle_syntax[] = "RouteStyle(1|2|3|4)"; + +static const char routestyle_help[] = "Copies the indicated routing style into the current sizes."; + +/* %start-doc actions RouteStyle + +%end-doc */ + +static int ActionRouteStyle(int argc, char **argv, Coord x, Coord y) +{ + char *str = ARG(0); + RouteStyleType *rts; + int number; + + if (str) { + number = atoi(str); + if (number > 0 && number <= NUM_STYLES) { + rts = &PCB->RouteStyle[number - 1]; + SetLineSize(rts->Thick); + SetViaSize(rts->Diameter, true); + SetViaDrillingHole(rts->Hole, true); + SetKeepawayWidth(rts->Keepaway); + hid_action("RouteStylesChanged"); + } + } + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char setsame_syntax[] = "SetSame()"; + +static const char setsame_help[] = "Sets current layer and sizes to match indicated item."; + +/* %start-doc actions SetSame + +When invoked over any line, arc, polygon, or via, this changes the +current layer to be the layer that item is on, and changes the current +sizes (thickness, keepaway, drill, etc) according to that item. + +%end-doc */ + +static int ActionSetSame(int argc, char **argv, Coord x, Coord y) +{ + void *ptr1, *ptr2, *ptr3; + int type; + LayerTypePtr layer = CURRENT; + + type = SearchScreen(x, y, CLONE_TYPES, &ptr1, &ptr2, &ptr3); +/* set layer current and size from line or arc */ + switch (type) { + case LINE_TYPE: + notify_crosshair_change(false); + Settings.LineThickness = ((LineTypePtr) ptr2)->Thickness; + Settings.Keepaway = ((LineTypePtr) ptr2)->Clearance / 2; + layer = (LayerTypePtr) ptr1; + if (Settings.Mode != LINE_MODE) + SetMode(LINE_MODE); + notify_crosshair_change(true); + hid_action("RouteStylesChanged"); + break; + + case ARC_TYPE: + notify_crosshair_change(false); + Settings.LineThickness = ((ArcTypePtr) ptr2)->Thickness; + Settings.Keepaway = ((ArcTypePtr) ptr2)->Clearance / 2; + layer = (LayerTypePtr) ptr1; + if (Settings.Mode != ARC_MODE) + SetMode(ARC_MODE); + notify_crosshair_change(true); + hid_action("RouteStylesChanged"); + break; + + case POLYGON_TYPE: + layer = (LayerTypePtr) ptr1; + break; + + case VIA_TYPE: + notify_crosshair_change(false); + Settings.ViaThickness = ((PinTypePtr) ptr2)->Thickness; + Settings.ViaDrillingHole = ((PinTypePtr) ptr2)->DrillingHole; + Settings.Keepaway = ((PinTypePtr) ptr2)->Clearance / 2; + if (Settings.Mode != VIA_MODE) + SetMode(VIA_MODE); + notify_crosshair_change(true); + hid_action("RouteStylesChanged"); + break; + + default: + return 1; + } + if (layer != CURRENT) { + ChangeGroupVisibility(GetLayerNumber(PCB->Data, layer), true, true); + Redraw(); + } + return 0; +} + + +HID_Action gui_action_list[] = { + {"Display", 0, ActionDisplay, + display_help, display_syntax} + , + {"CycleDrag", 0, ActionCycleDrag, + cycledrag_help, cycledrag_syntax} + , + {"MarkCrosshair", 0, ActionMarkCrosshair, + markcrosshair_help, markcrosshair_syntax} + , + {"Message", 0, ActionMessage, + message_help, message_syntax} + , + {"Mode", 0, ActionMode, + mode_help, mode_syntax} + , + {"ToggleHideName", 0, ActionToggleHideName, + togglehidename_help, togglehidename_syntax} + , + {"SetSame", N_("Select item to use attributes from"), ActionSetSame, + setsame_help, setsame_syntax} + , + {"RouteStyle", 0, ActionRouteStyle, + routestyle_help, routestyle_syntax} +}; + +REGISTER_ACTIONS(gui_action_list) Index: 1.0.8/src/heap.c =================================================================== --- 1.0.8/src/heap.c (nonexistent) +++ 1.0.8/src/heap.c (revision 1136) @@ -0,0 +1,246 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * Copyright (C) 1998,1999,2000,2001 harry eaton + * + * 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: + * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA + * haceaton@aplcomm.jhuapl.edu + * + */ + +/* this file, heap.c, was written and is + * Copyright (c) 2001 C. Scott Ananian. + */ + +/* operations on heaps. + */ + +#include "config.h" + +#include "global.h" + +#include + +#include "heap.h" + + +RCSID("$Id$"); + + +/* define this for more thorough self-checking of data structures */ +#undef SLOW_ASSERTIONS + +/* --------------------------------------------------------------------------- + * some local prototypes + */ + +/* --------------------------------------------------------------------------- + * some local types + */ +struct heap_element { + cost_t cost; + void *data; +}; +struct heap_struct { + struct heap_element *element; + int size, max; +}; + +/* --------------------------------------------------------------------------- + * some local identifiers + */ +static cost_t MIN_COST = 0; + +/* --------------------------------------------------------------------------- + * functions. + */ +/* helper functions for assertions */ +#ifndef NDEBUG +#ifdef SLOW_ASSERTIONS +static int __heap_is_good_slow(heap_t * heap) +{ + int i; + /* heap condition: key in each node should be smaller than in its children */ + /* alternatively (and this is what we check): key in each node should be + * larger than (or equal to) key of its parent. */ + /* note that array element[0] is not used (except as a sentinel) */ + for (i = 2; i < heap->size; i++) + if (heap->element[i].cost < heap->element[i / 2].cost) + return 0; + return 1; +} +#endif /* SLOW_ASSERTIONS */ +static int __heap_is_good(heap_t * heap) +{ + return heap && (heap->max == 0 || heap->element) && + (heap->max >= 0) && (heap->size >= 0) && (heap->max == 0 || heap->size < heap->max) && +#ifdef SLOW_ASSERTIONS + __heap_is_good_slow(heap) && +#endif + 1; +} +#endif /* ! NDEBUG */ + +/* create an empty heap */ +heap_t *heap_create() +{ + heap_t *heap; + /* initialize MIN_COST if necessary */ + if (MIN_COST == 0) + MIN_COST = -1e23; + assert(MIN_COST < 0); + /* okay, create empty heap */ + heap = (heap_t *) calloc(1, sizeof(*heap)); + assert(heap); + assert(__heap_is_good(heap)); + return heap; +} + +/* destroy a heap */ +void heap_destroy(heap_t ** heap) +{ + assert(heap && *heap); + assert(__heap_is_good(*heap)); + if ((*heap)->element) + free((*heap)->element); + free(*heap); + *heap = NULL; +} + +/* free all elements in the heap */ +void heap_free(heap_t * heap, void (*freefunc) (void *)) +{ + assert(heap); + assert(__heap_is_good(heap)); + for (; heap->size; heap->size--) { + if (heap->element[heap->size].data) + freefunc(heap->element[heap->size].data); + } +} + +/* -- mutation -- */ +static void __upheap(heap_t * heap, int k) +{ + struct heap_element v; + + assert(heap && heap->size < heap->max); + assert(k <= heap->size); + + v = heap->element[k]; + heap->element[0].cost = MIN_COST; + for (v = heap->element[k]; heap->element[k / 2].cost > v.cost; k = k / 2) + heap->element[k] = heap->element[k / 2]; + heap->element[k] = v; +} + +void heap_insert(heap_t * heap, cost_t cost, void *data) +{ + assert(heap && __heap_is_good(heap)); + assert(cost >= MIN_COST); + + /* determine whether we need to grow the heap */ + if (heap->size + 1 >= heap->max) { + heap->max *= 2; + if (heap->max == 0) + heap->max = 256; /* default initial heap size */ + heap->element = (struct heap_element *) realloc(heap->element, heap->max * sizeof(*heap->element)); + } + heap->size++; + assert(heap->size < heap->max); + heap->element[heap->size].cost = cost; + heap->element[heap->size].data = data; + __upheap(heap, heap->size); /* fix heap condition violation */ + assert(__heap_is_good(heap)); + return; +} + +/* this procedure moves down the heap, exchanging the node at position + * k with the smaller of its two children as necessary and stopping when + * the node at k is smaller than both children or the bottom is reached. + */ +static void __downheap(heap_t * heap, int k) +{ + struct heap_element v; + + assert(heap && heap->size < heap->max); + assert(k <= heap->size); + + v = heap->element[k]; + while (k <= heap->size / 2) { + int j = k + k; + if (j < heap->size && heap->element[j].cost > heap->element[j + 1].cost) + j++; + if (v.cost < heap->element[j].cost) + break; + heap->element[k] = heap->element[j]; + k = j; + } + heap->element[k] = v; +} + +void *heap_remove_smallest(heap_t * heap) +{ + struct heap_element v; + assert(heap && __heap_is_good(heap)); + assert(heap->size > 0); + assert(heap->max > 1); + + v = heap->element[1]; + heap->element[1] = heap->element[heap->size--]; + if (heap->size > 0) + __downheap(heap, 1); + + assert(__heap_is_good(heap)); + return v.data; +} + +void *heap_replace(heap_t * heap, cost_t cost, void *data) +{ + assert(heap && __heap_is_good(heap)); + + if (heap_is_empty(heap)) + return data; + + assert(heap->size > 0); + assert(heap->max > 1); + + heap->element[0].cost = cost; + heap->element[0].data = data; + __downheap(heap, 0); /* ooh, tricky! */ + + assert(__heap_is_good(heap)); + return heap->element[0].data; +} + +/* -- interrogation -- */ +int heap_is_empty(heap_t * heap) +{ + assert(__heap_is_good(heap)); + return heap->size == 0; +} + +/* -- size -- */ +int heap_size(heap_t * heap) +{ + assert(__heap_is_good(heap)); + return heap->size; +} Index: 1.0.8/src/heap.h =================================================================== --- 1.0.8/src/heap.h (nonexistent) +++ 1.0.8/src/heap.h (revision 1136) @@ -0,0 +1,65 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * Copyright (C) 1998,1999,2000,2001 harry eaton + * + * 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: + * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA + * haceaton@aplcomm.jhuapl.edu + * + */ + +/* this file, heap.h, was written and is + * Copyright (c) 2001 C. Scott Ananian. + */ + +/* prototypes for heap routines. + */ + +#ifndef PCB_HEAP_H +#define PCB_HEAP_H + +#include "global.h" + +/* type of heap costs */ +typedef double cost_t; +/* what a heap looks like */ +typedef struct heap_struct heap_t; + +/* create an empty heap */ +heap_t *heap_create(); +/* destroy a heap */ +void heap_destroy(heap_t ** heap); +/* free all elements in a heap */ +void heap_free(heap_t * heap, void (*funcfree) (void *)); + +/* -- mutation -- */ +void heap_insert(heap_t * heap, cost_t cost, void *data); +void *heap_remove_smallest(heap_t * heap); +/* replace the smallest item with a new item and return the smallest item. + * (if the new item is the smallest, than return it, instead.) */ +void *heap_replace(heap_t * heap, cost_t cost, void *data); + +/* -- interrogation -- */ +int heap_is_empty(heap_t * heap); +int heap_size(heap_t * heap); + +#endif /* PCB_HEAP_H */ Index: 1.0.8/src/hid/batch/batch.c =================================================================== --- 1.0.8/src/hid/batch/batch.c (nonexistent) +++ 1.0.8/src/hid/batch/batch.c (revision 1136) @@ -0,0 +1,342 @@ +/* $Id$ */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "global.h" +#include "hid.h" +#include "data.h" +#include "misc.h" +#include "hid.h" +#include "../hidint.h" +#include "pcb-printf.h" + +#include "hid/common/draw_helpers.h" +#include "hid/common/hidnogui.h" +#include "hid/common/actions.h" +#include "hid/common/hidinit.h" + + +RCSID("$Id$"); + +/* This is a text-line "batch" HID, which exists for scripting and + non-GUI needs. */ + +typedef struct hid_gc_struct { + int nothing_interesting_here; +} hid_gc_struct; + +static HID_Attribute *batch_get_export_options(int *n_ret) +{ + return 0; +} + +/* ----------------------------------------------------------------------------- */ + +static char *prompt = NULL; + +static int nop(int argc, char **argv, Coord x, Coord y) +{ + return 0; +} + +static int PCBChanged(int argc, char **argv, Coord x, Coord y) +{ + if (prompt != NULL) + free(prompt); + if (PCB && PCB->Filename) { + prompt = strrchr(PCB->Filename, '/'); + if (prompt) + prompt++; + else + prompt = PCB->Filename; + if (prompt != NULL) + prompt = strdup(prompt); + } + else + prompt = strdup("no-board"); + return 0; +} + +static int help(int argc, char **argv, Coord x, Coord y) +{ + print_actions(); + return 0; +} + +static int info(int argc, char **argv, Coord x, Coord y) +{ + int i, j; + int cg, sg; + if (!PCB || !PCB->Data || !PCB->Filename) { + printf("No PCB loaded.\n"); + return 0; + } + printf("Filename: %s\n", PCB->Filename); + pcb_printf("Size: %ml x %ml mils, %mm x %mm mm\n", PCB->MaxWidth, PCB->MaxHeight, PCB->MaxWidth, PCB->MaxHeight); + cg = GetLayerGroupNumberByNumber(component_silk_layer); + sg = GetLayerGroupNumberByNumber(solder_silk_layer); + for (i = 0; i < MAX_LAYER; i++) { + + int lg = GetLayerGroupNumberByNumber(i); + for (j = 0; j < MAX_LAYER; j++) + putchar(j == lg ? '#' : '-'); + printf(" %c %s\n", lg == cg ? 'c' : lg == sg ? 's' : '-', PCB->Data->Layer[i].Name); + } + return 0; +} + + +HID_Action batch_action_list[] = { + {"PCBChanged", 0, PCBChanged} + , + {"RouteStylesChanged", 0, nop} + , + {"NetlistChanged", 0, nop} + , + {"LayersChanged", 0, nop} + , + {"LibraryChanged", 0, nop} + , + {"Busy", 0, nop} + , + {"Help", 0, help} + , + {"Info", 0, info} +}; + +REGISTER_ACTIONS(batch_action_list) + + +/* ----------------------------------------------------------------------------- */ + static void + batch_do_export(HID_Attr_Val * options) +{ + int interactive; + char line[1000]; + + if (isatty(0)) + interactive = 1; + else + interactive = 0; + + if (interactive) { + printf("Entering %s version %s batch mode.\n", PACKAGE, VERSION); + printf("See http://pcb.gpleda.org for project information\n"); + } + while (1) { + if (interactive) { + printf("%s> ", prompt); + fflush(stdout); + } + if (fgets(line, sizeof(line) - 1, stdin) == NULL) + return; + hid_parse_command(line); + } +} + +static void batch_parse_arguments(int *argc, char ***argv) +{ + hid_parse_command_line(argc, argv); +} + +static void batch_invalidate_lr(int l, int r, int t, int b) +{ +} + +static void batch_invalidate_all(void) +{ +} + +static int batch_set_layer(const char *name, int idx, int empty) +{ + return 0; +} + +static hidGC batch_make_gc(void) +{ + return 0; +} + +static void batch_destroy_gc(hidGC gc) +{ +} + +static void batch_use_mask(int use_it) +{ +} + +static void batch_set_color(hidGC gc, const char *name) +{ +} + +static void batch_set_line_cap(hidGC gc, EndCapStyle style) +{ +} + +static void batch_set_line_width(hidGC gc, Coord width) +{ +} + +static void batch_set_draw_xor(hidGC gc, int xor_set) +{ +} + +static void batch_draw_line(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ +} + +static void batch_draw_arc(hidGC gc, Coord cx, Coord cy, Coord width, Coord height, Angle start_angle, Angle end_angle) +{ +} + +static void batch_draw_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ +} + +static void batch_fill_circle(hidGC gc, Coord cx, Coord cy, Coord radius) +{ +} + +static void batch_fill_polygon(hidGC gc, int n_coords, Coord * x, Coord * y) +{ +} + +static void batch_fill_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ +} + +static void batch_calibrate(double xval, double yval) +{ +} + +static int batch_shift_is_pressed(void) +{ + return 0; +} + +static int batch_control_is_pressed(void) +{ + return 0; +} + +static int batch_mod1_is_pressed(void) +{ + return 0; +} + +static void batch_get_coords(const char *msg, Coord * x, Coord * y) +{ +} + +static void batch_set_crosshair(int x, int y, int action) +{ +} + +static hidval batch_add_timer(void (*func) (hidval user_data), unsigned long milliseconds, hidval user_data) +{ + hidval rv; + rv.lval = 0; + return rv; +} + +static void batch_stop_timer(hidval timer) +{ +} + +hidval +batch_watch_file(int fd, unsigned int condition, void (*func) (hidval watch, int fd, unsigned int condition, hidval user_data), + hidval user_data) +{ + hidval ret; + ret.ptr = NULL; + return ret; +} + +void batch_unwatch_file(hidval data) +{ +} + +static hidval batch_add_block_hook(void (*func) (hidval data), hidval user_data) +{ + hidval ret; + ret.ptr = NULL; + return ret; +} + +static void batch_stop_block_hook(hidval mlpoll) +{ +} + +static int +batch_attribute_dialog(HID_Attribute * attrs_, int n_attrs_, HID_Attr_Val * results_, const char *title_, const char *descr_) +{ + return 0; +} + +static void batch_show_item(void *item) +{ +} + +static void batch_create_menu(const char *menu[], const char *action, const char *mnemonic, const char *accel, const char *tip) +{ +} + +#include "dolists.h" + +static HID batch_hid; + +void hid_batch_init() +{ + memset(&batch_hid, 0, sizeof(HID)); + + common_nogui_init(&batch_hid); + common_draw_helpers_init(&batch_hid); + + batch_hid.struct_size = sizeof(HID); + batch_hid.name = "batch"; + batch_hid.description = "Batch-mode GUI for non-interactive use."; + batch_hid.gui = 1; + + batch_hid.get_export_options = batch_get_export_options; + batch_hid.do_export = batch_do_export; + batch_hid.parse_arguments = batch_parse_arguments; + batch_hid.invalidate_lr = batch_invalidate_lr; + batch_hid.invalidate_all = batch_invalidate_all; + batch_hid.set_layer = batch_set_layer; + batch_hid.make_gc = batch_make_gc; + batch_hid.destroy_gc = batch_destroy_gc; + batch_hid.use_mask = batch_use_mask; + batch_hid.set_color = batch_set_color; + batch_hid.set_line_cap = batch_set_line_cap; + batch_hid.set_line_width = batch_set_line_width; + batch_hid.set_draw_xor = batch_set_draw_xor; + batch_hid.draw_line = batch_draw_line; + batch_hid.draw_arc = batch_draw_arc; + batch_hid.draw_rect = batch_draw_rect; + batch_hid.fill_circle = batch_fill_circle; + batch_hid.fill_polygon = batch_fill_polygon; + batch_hid.fill_rect = batch_fill_rect; + batch_hid.calibrate = batch_calibrate; + batch_hid.shift_is_pressed = batch_shift_is_pressed; + batch_hid.control_is_pressed = batch_control_is_pressed; + batch_hid.mod1_is_pressed = batch_mod1_is_pressed; + batch_hid.get_coords = batch_get_coords; + batch_hid.set_crosshair = batch_set_crosshair; + batch_hid.add_timer = batch_add_timer; + batch_hid.stop_timer = batch_stop_timer; + batch_hid.watch_file = batch_watch_file; + batch_hid.unwatch_file = batch_unwatch_file; + batch_hid.add_block_hook = batch_add_block_hook; + batch_hid.stop_block_hook = batch_stop_block_hook; + batch_hid.attribute_dialog = batch_attribute_dialog; + batch_hid.show_item = batch_show_item; + batch_hid.create_menu = batch_create_menu; + + hid_register_hid(&batch_hid); +} Index: 1.0.8/src/hid/batch/hid.conf =================================================================== --- 1.0.8/src/hid/batch/hid.conf (nonexistent) +++ 1.0.8/src/hid/batch/hid.conf (revision 1136) @@ -0,0 +1 @@ +type=gui Index: 1.0.8/src/hid/bom/bom.c =================================================================== --- 1.0.8/src/hid/bom/bom.c (nonexistent) +++ 1.0.8/src/hid/bom/bom.c (revision 1136) @@ -0,0 +1,523 @@ +/* $Id$ */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "global.h" +#include "data.h" +#include "error.h" +#include "misc.h" +#include "pcb-printf.h" + +#include "hid.h" +#include "hid/common/hidnogui.h" +#include "../hidint.h" + + +RCSID("$Id$"); + +static HID_Attribute bom_options[] = { +/* %start-doc options "8 BOM Creation" +@ftable @code +@item --bomfile +Name of the BOM output file. +@end ftable +%end-doc +*/ + {"bomfile", "Name of the BOM output file", + HID_String, 0, 0, {0, 0, 0}, 0, 0}, +#define HA_bomfile 0 +/* %start-doc options "8 BOM Creation" +@ftable @code +@item --xyfile +Name of the XY output file. +@end ftable +%end-doc +*/ + {"xyfile", "Name of the XY output file", + HID_String, 0, 0, {0, 0, 0}, 0, 0}, +#define HA_xyfile 1 + +/* %start-doc options "8 BOM Creation" +@ftable @code +@item --xy-unit +Unit of XY dimensions. Defaults to mil. +@end ftable +%end-doc +*/ + {"xy-unit", "XY units", + HID_Unit, 0, 0, {-1, 0, 0}, NULL, 0}, +#define HA_unit 2 + {"xy-in-mm", ATTR_UNDOCUMENTED, + HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, +#define HA_xymm 3 +}; + +#define NUM_OPTIONS (sizeof(bom_options)/sizeof(bom_options[0])) + +static HID_Attr_Val bom_values[NUM_OPTIONS]; + +static const char *bom_filename; +static const char *xy_filename; +static const Unit *xy_unit; + +typedef struct _StringList { + char *str; + struct _StringList *next; +} StringList; + +typedef struct _BomList { + char *descr; + char *value; + int num; + StringList *refdes; + struct _BomList *next; +} BomList; + +static HID_Attribute *bom_get_export_options(int *n) +{ + static char *last_bom_filename = 0; + static char *last_xy_filename = 0; + static int last_unit_value = -1; + + if (bom_options[HA_unit].default_val.int_value == last_unit_value) { + if (Settings.grid_unit) + bom_options[HA_unit].default_val.int_value = Settings.grid_unit->index; + else + bom_options[HA_unit].default_val.int_value = get_unit_struct("mil")->index; + last_unit_value = bom_options[HA_unit].default_val.int_value; + } + if (PCB) { + derive_default_filename(PCB->Filename, &bom_options[HA_bomfile], ".bom", &last_bom_filename); + derive_default_filename(PCB->Filename, &bom_options[HA_xyfile], ".xy", &last_xy_filename); + } + + if (n) + *n = NUM_OPTIONS; + return bom_options; +} + +/* --------------------------------------------------------------------------- + * prints a centroid file in a format which includes data needed by a + * pick and place machine. Further formatting for a particular factory setup + * can easily be generated with awk or perl. In addition, a bill of materials + * file is generated which can be used for checking stock and purchasing needed + * materials. + * returns != zero on error + */ + + +static char *CleanBOMString(char *in) +{ + char *out; + int i; + + if ((out = (char *) malloc((strlen(in) + 1) * sizeof(char))) == NULL) { + fprintf(stderr, "Error: CleanBOMString() malloc() failed\n"); + exit(1); + } + + /* + * copy over in to out with some character conversions. + * Go all the way to then end to get the terminating \0 + */ + for (i = 0; i <= strlen(in); i++) { + switch (in[i]) { + case '"': + out[i] = '\''; + break; + default: + out[i] = in[i]; + } + } + + return out; +} + + +static double xyToAngle(double x, double y) +{ + double theta; + + if ((x > 0.0) && (y >= 0.0)) + theta = 180.0; + else if ((x <= 0.0) && (y > 0.0)) + theta = 90.0; + else if ((x < 0.0) && (y <= 0.0)) + theta = 0.0; + else if ((x >= 0.0) && (y < 0.0)) + theta = 270.0; + else { + theta = 0.0; + Message("xyToAngle(): unable to figure out angle of element\n" + " because the pin is at the centroid of the part.\n" + " This is a BUG!!!\n" " Setting to %g degrees\n", theta); + } + + return (theta); +} + +static StringList *string_insert(char *str, StringList * list) +{ + StringList *newlist, *cur; + + if ((newlist = (StringList *) malloc(sizeof(StringList))) == NULL) { + fprintf(stderr, "malloc() failed in string_insert()\n"); + exit(1); + } + + newlist->next = NULL; + newlist->str = strdup(str); + + if (list == NULL) + return (newlist); + + cur = list; + while (cur->next != NULL) + cur = cur->next; + + cur->next = newlist; + + return (list); +} + +static BomList *bom_insert(char *refdes, char *descr, char *value, BomList * bom) +{ + BomList *newlist, *cur, *prev = NULL; + + if (bom == NULL) { + /* this is the first element so automatically create an entry */ + if ((newlist = (BomList *) malloc(sizeof(BomList))) == NULL) { + fprintf(stderr, "malloc() failed in bom_insert()\n"); + exit(1); + } + + newlist->next = NULL; + newlist->descr = strdup(descr); + newlist->value = strdup(value); + newlist->num = 1; + newlist->refdes = string_insert(refdes, NULL); + return (newlist); + } + + /* search and see if we already have used one of these + components */ + cur = bom; + while (cur != NULL) { + if ((NSTRCMP(descr, cur->descr) == 0) && (NSTRCMP(value, cur->value) == 0)) { + cur->num++; + cur->refdes = string_insert(refdes, cur->refdes); + break; + } + prev = cur; + cur = cur->next; + } + + if (cur == NULL) { + if ((newlist = (BomList *) malloc(sizeof(BomList))) == NULL) { + fprintf(stderr, "malloc() failed in bom_insert()\n"); + exit(1); + } + + prev->next = newlist; + + newlist->next = NULL; + newlist->descr = strdup(descr); + newlist->value = strdup(value); + newlist->num = 1; + newlist->refdes = string_insert(refdes, NULL); + } + + return (bom); + +} + +/* + * If fp is not NULL then print out the bill of materials contained in + * bom. Either way, free all memory which has been allocated for bom. + */ +static void print_and_free(FILE * fp, BomList * bom) +{ + BomList *lastb; + StringList *lasts; + char *descr, *value; + + while (bom != NULL) { + if (fp) { + descr = CleanBOMString(bom->descr); + value = CleanBOMString(bom->value); + fprintf(fp, "%d,\"%s\",\"%s\",", bom->num, descr, value); + free(descr); + free(value); + } + + while (bom->refdes != NULL) { + if (fp) { + fprintf(fp, "%s ", bom->refdes->str); + } + free(bom->refdes->str); + lasts = bom->refdes; + bom->refdes = bom->refdes->next; + free(lasts); + } + if (fp) { + fprintf(fp, "\n"); + } + lastb = bom; + bom = bom->next; + free(lastb); + } +} + +static int PrintBOM(void) +{ + char utcTime[64]; + Coord x, y; + double theta = 0.0; + double sumx, sumy; + double pin1x = 0.0, pin1y = 0.0, pin1angle = 0.0; + double pin2x = 0.0, pin2y = 0.0; + int found_pin1; + int found_pin2; + int pin_cnt; + time_t currenttime; + FILE *fp; + BomList *bom = NULL; + char *name, *descr, *value; + + fp = fopen(xy_filename, "w"); + if (!fp) { + gui->log("Cannot open file %s for writing\n", xy_filename); + return 1; + } + + /* Create a portable timestamp. */ + currenttime = time(NULL); + { + /* avoid gcc complaints */ + const char *fmt = "%c UTC"; + strftime(utcTime, sizeof(utcTime), fmt, gmtime(¤ttime)); + } + fprintf(fp, "# $Id"); + fprintf(fp, "$\n"); + fprintf(fp, "# PcbXY Version 1.0\n"); + fprintf(fp, "# Date: %s\n", utcTime); + fprintf(fp, "# Author: %s\n", pcb_author()); + fprintf(fp, "# Title: %s - PCB X-Y\n", UNKNOWN(PCB->Name)); + fprintf(fp, "# RefDes, Description, Value, X, Y, rotation, top/bottom\n"); + fprintf(fp, "# X,Y in %s. rotation in degrees.\n", xy_unit->in_suffix); + fprintf(fp, "# --------------------------------------------\n"); + + /* + * For each element we calculate the centroid of the footprint. + * In addition, we need to extract some notion of rotation. + * While here generate the BOM list + */ + + ELEMENT_LOOP(PCB->Data); + { + + /* initialize our pin count and our totals for finding the + centriod */ + pin_cnt = 0; + sumx = 0.0; + sumy = 0.0; + found_pin1 = 0; + found_pin2 = 0; + + /* insert this component into the bill of materials list */ + bom = bom_insert((char *) UNKNOWN(NAMEONPCB_NAME(element)), + (char *) UNKNOWN(DESCRIPTION_NAME(element)), (char *) UNKNOWN(VALUE_NAME(element)), bom); + + + /* + * iterate over the pins and pads keeping a running count of how + * many pins/pads total and the sum of x and y coordinates + * + * While we're at it, store the location of pin/pad #1 and #2 if + * we can find them + */ + + PIN_LOOP(element); + { + sumx += (double) pin->X; + sumy += (double) pin->Y; + pin_cnt++; + + if (NSTRCMP(pin->Number, "1") == 0) { + pin1x = (double) pin->X; + pin1y = (double) pin->Y; + pin1angle = 0.0; /* pins have no notion of angle */ + found_pin1 = 1; + } + else if (NSTRCMP(pin->Number, "2") == 0) { + pin2x = (double) pin->X; + pin2y = (double) pin->Y; + found_pin2 = 1; + } + } + END_LOOP; + + PAD_LOOP(element); + { + sumx += (pad->Point1.X + pad->Point2.X) / 2.0; + sumy += (pad->Point1.Y + pad->Point2.Y) / 2.0; + pin_cnt++; + + if (NSTRCMP(pad->Number, "1") == 0) { + pin1x = (double) (pad->Point1.X + pad->Point2.X) / 2.0; + pin1y = (double) (pad->Point1.Y + pad->Point2.Y) / 2.0; + /* + * NOTE: We swap the Y points because in PCB, the Y-axis + * is inverted. Increasing Y moves down. We want to deal + * in the usual increasing Y moves up coordinates though. + */ + pin1angle = (180.0 / M_PI) * atan2(pad->Point1.Y - pad->Point2.Y, pad->Point2.X - pad->Point1.X); + found_pin1 = 1; + } + else if (NSTRCMP(pad->Number, "2") == 0) { + pin2x = (double) (pad->Point1.X + pad->Point2.X) / 2.0; + pin2y = (double) (pad->Point1.Y + pad->Point2.Y) / 2.0; + found_pin2 = 1; + } + + } + END_LOOP; + + if (pin_cnt > 0) { + x = sumx / (double) pin_cnt; + y = sumy / (double) pin_cnt; + + if (found_pin1) { + /* recenter pin #1 onto the axis which cross at the part + centroid */ + pin1x -= x; + pin1y -= y; + pin1y = -1.0 * pin1y; + + /* if only 1 pin, use pin 1's angle */ + if (pin_cnt == 1) + theta = pin1angle; + else { + /* if pin #1 is at (0,0) use pin #2 for rotation */ + if ((pin1x == 0.0) && (pin1y == 0.0)) { + if (found_pin2) + theta = xyToAngle(pin2x, pin2y); + else { + Message + ("PrintBOM(): unable to figure out angle of element\n" + " %s because pin #1 is at the centroid of the part.\n" + " and I could not find pin #2's location\n" + " Setting to %g degrees\n", UNKNOWN(NAMEONPCB_NAME(element)), theta); + } + } + else + theta = xyToAngle(pin1x, pin1y); + } + } + /* we did not find pin #1 */ + else { + theta = 0.0; + Message + ("PrintBOM(): unable to figure out angle because I could\n" + " not find pin #1 of element %s\n" " Setting to %g degrees\n", UNKNOWN(NAMEONPCB_NAME(element)), theta); + } + + name = CleanBOMString((char *) UNKNOWN(NAMEONPCB_NAME(element))); + descr = CleanBOMString((char *) UNKNOWN(DESCRIPTION_NAME(element))); + value = CleanBOMString((char *) UNKNOWN(VALUE_NAME(element))); + + y = PCB->MaxHeight - y; + pcb_fprintf(fp, "%m+%s,\"%s\",\"%s\",%mS,%.2mS,%g,%s\n", + xy_unit->allow, name, descr, value, x, y, theta, FRONT(element) == 1 ? "top" : "bottom"); + free(name); + free(descr); + free(value); + } + } + END_LOOP; + + fclose(fp); + + /* Now print out a Bill of Materials file */ + + fp = fopen(bom_filename, "w"); + if (!fp) { + gui->log("Cannot open file %s for writing\n", bom_filename); + print_and_free(NULL, bom); + return 1; + } + + fprintf(fp, "# $Id"); + fprintf(fp, "$\n"); + fprintf(fp, "# PcbBOM Version 1.0\n"); + fprintf(fp, "# Date: %s\n", utcTime); + fprintf(fp, "# Author: %s\n", pcb_author()); + fprintf(fp, "# Title: %s - PCB BOM\n", UNKNOWN(PCB->Name)); + fprintf(fp, "# Quantity, Description, Value, RefDes\n"); + fprintf(fp, "# --------------------------------------------\n"); + + print_and_free(fp, bom); + + fclose(fp); + + return (0); +} + +static void bom_do_export(HID_Attr_Val * options) +{ + int i; + + if (!options) { + bom_get_export_options(0); + for (i = 0; i < NUM_OPTIONS; i++) + bom_values[i] = bom_options[i].default_val; + options = bom_values; + } + + bom_filename = options[HA_bomfile].str_value; + if (!bom_filename) + bom_filename = "pcb-out.bom"; + + xy_filename = options[HA_xyfile].str_value; + if (!xy_filename) + xy_filename = "pcb-out.xy"; + + if (options[HA_unit].int_value == -1) + xy_unit = options[HA_xymm].int_value ? get_unit_struct("mm") + : get_unit_struct("mil"); + else + xy_unit = &get_unit_list()[options[HA_unit].int_value]; + PrintBOM(); +} + +static void bom_parse_arguments(int *argc, char ***argv) +{ + hid_register_attributes(bom_options, sizeof(bom_options) / sizeof(bom_options[0])); + hid_parse_command_line(argc, argv); +} + +HID bom_hid; + +void hid_bom_init() +{ + memset(&bom_hid, 0, sizeof(HID)); + + common_nogui_init(&bom_hid); + + bom_hid.struct_size = sizeof(HID); + bom_hid.name = "bom"; + bom_hid.description = "Exports a Bill of Materials"; + bom_hid.exporter = 1; + + bom_hid.get_export_options = bom_get_export_options; + bom_hid.do_export = bom_do_export; + bom_hid.parse_arguments = bom_parse_arguments; + + hid_register_hid(&bom_hid); +} Index: 1.0.8/src/hid/bom/hid.conf =================================================================== --- 1.0.8/src/hid/bom/hid.conf (nonexistent) +++ 1.0.8/src/hid/bom/hid.conf (revision 1136) @@ -0,0 +1 @@ +type=export Index: 1.0.8/src/hid/common/actions.c =================================================================== --- 1.0.8/src/hid/common/actions.c (nonexistent) +++ 1.0.8/src/hid/common/actions.c (revision 1136) @@ -0,0 +1,451 @@ +/* $Id$ */ + +#include "config.h" + +#include +#include +#include +#include + +#include "../../../src_3rd/genht/hash.h" +#include "../../../src_3rd/genht/htsp.h" + +#include "global.h" +#include "data.h" +#include "error.h" +#include "event.h" + +#include "hid.h" +#include "../hidint.h" + + +RCSID("$Id$"); + +static htsp_t *all_actions = NULL; +HID_Action *current_action = NULL; + +static int keyeq(char *a, char *b) +{ + return !strcmp(a, b); +} + +static unsigned int keyhash(char *key) +{ + return strhash(key); +} + + +static const char *check_action_name(const char *s) +{ + while (*s) + if (isspace((int) *s++) || *s == '(') + return (s - 1); + return NULL; +} + +void hid_register_actions(HID_Action * a, int n) +{ + int i; + + if (all_actions == NULL) + all_actions = htsp_alloc(keyhash, keyeq); + + for (i = 0; i < n; i++) { + if (check_action_name(a[i].name)) { + Message(_("ERROR! Invalid action name, " "action \"%s\" not registered.\n"), a[i].name); + continue; + } + if (htsp_get(all_actions, a[i].name) != NULL) { + Message(_("ERROR! Invalid action name, " "action \"%s\" is already registered.\n"), a[i].name); + continue; + } + htsp_set(all_actions, a[i].name, a + i); + } +} + +void hid_register_action(HID_Action * a) +{ + hid_register_actions(a, 1); +} + +void hid_remove_actions(HID_Action * a, int n) +{ + int i; + + if (all_actions == NULL) + return; + + for (i = 0; i < n; i++) + htsp_pop(all_actions, a[i].name); +} + +HID_Action *hid_remove_action(HID_Action * a) +{ + if (all_actions == NULL) + return NULL; + + return htsp_pop(all_actions, a->name); +} + +HID_Action *hid_find_action(const char *name) +{ + HID_Action *action; + int i; + + if ((name == NULL) && (all_actions == NULL)) + return 0; + + action = htsp_get(all_actions, (char *) name); + + if (action) + return action; + + printf("unknown action `%s'\n", name); + return 0; +} + +void print_actions() +{ + htsp_entry_t *e; + + fprintf(stderr, "Registered Actions:\n"); + for (e = htsp_first(all_actions); e; e = htsp_next(all_actions, e)) { + HID_Action *action = e->value; + if (action->description) + fprintf(stderr, " %s - %s\n", action->name, action->description); + else + fprintf(stderr, " %s\n", action->name); + if (action->syntax) { + const char *bb, *eb; + bb = eb = action->syntax; + while (1) { + for (eb = bb; *eb && *eb != '\n'; eb++); + fwrite(" ", 4, 1, stderr); + fwrite(bb, eb - bb, 1, stderr); + fputc('\n', stderr); + if (*eb == 0) + break; + bb = eb + 1; + } + } + } +} + +static void dump_string(char prefix, const char *str) +{ + int eol = 1; + while (*str) { + if (eol) { + putchar(prefix); + eol = 0; + } + putchar(*str); + if (*str == '\n') + eol = 1; + str++; + } + if (!eol) + putchar('\n'); +} + +void dump_actions() +{ + int i; + htsp_entry_t *e; + + fprintf(stderr, "Registered Actions:\n"); + for (e = htsp_first(all_actions); e; e = htsp_next(all_actions, e)) { + HID_Action *action = e->value; + const char *desc = action->description; + const char *synt = action->syntax; + + desc = desc ? desc : ""; + synt = synt ? synt : ""; + + printf("A%s\n", action->name); + dump_string('D', desc); + dump_string('S', synt); + } +} + +int hid_action(const char *name) +{ + return hid_actionv(name, 0, 0); +} + +int hid_actionl(const char *name, ...) +{ + char *argv[20]; + int argc = 0; + va_list ap; + char *arg; + + va_start(ap, name); + while ((arg = va_arg(ap, char *)) != 0) + argv[argc++] = arg; + va_end(ap); + return hid_actionv(name, argc, argv); +} + +int hid_actionv(const char *name, int argc, char **argv) +{ + Coord x = 0, y = 0; + int i, ret; + HID_Action *a, *old_action; + + if (!name) + return 1; + + a = hid_find_action(name); + if (!a) { + int i; + Message("no action %s(", name); + for (i = 0; i < argc; i++) + Message("%s%s", i ? ", " : "", argv[i]); + Message(")\n"); + return 1; + } + + if (a->need_coord_msg) + gui->get_coords(_(a->need_coord_msg), &x, &y); + + if (Settings.verbose) { + printf("Action: \033[34m%s(", name); + for (i = 0; i < argc; i++) + printf("%s%s", i ? "," : "", argv[i]); + printf(")\033[0m\n"); + } + + old_action = current_action; + current_action = a; + ret = current_action->trigger_cb(argc, argv, x, y); + current_action = old_action; + + return ret; +} + +static int hid_parse_actionstring(const char *rstr, char require_parens) +{ + char **list = NULL; + int max = 0; + int num; + char *str = NULL; + const char *sp; + char *cp, *aname, *cp2; + int maybe_empty = 0; + char in_quotes = 0; + char parens = 0; + int retcode = 0; + + /*fprintf(stderr, "invoke: `%s'\n", rstr); */ + + sp = rstr; + str = (char *) malloc(strlen(rstr) + 1); + +another: + num = 0; + cp = str; + + /* eat leading spaces and tabs */ + while (*sp && isspace((int) *sp)) + sp++; + + if (!*sp) { + retcode = 0; + goto cleanup; + } + + aname = cp; + + /* copy the action name, assumes name does not have a space or '(' + * in its name */ + while (*sp && !isspace((int) *sp) && *sp != '(') + *cp++ = *sp++; + *cp++ = 0; + + /* skip whitespace */ + while (*sp && isspace((int) *sp)) + sp++; + + /* + * we only have an action name, so invoke the action + * with no parameters or event. + */ + if (!*sp) { + retcode = hid_actionv(aname, 0, 0); + goto cleanup; + } + + /* are we using parenthesis? */ + if (*sp == '(') { + parens = 1; + sp++; + } + else if (require_parens) { + Message(_("Syntax error: %s\n"), rstr); + Message(_(" expected: Action(arg1, arg2)")); + retcode = 1; + goto cleanup; + } + + /* get the parameters to pass to the action */ + while (1) { + /* + * maybe_empty == 0 means that the last char examined was not a + * "," + */ + if (!maybe_empty && ((parens && *sp == ')') || (!parens && !*sp))) { + retcode = hid_actionv(aname, num, list); + if (retcode) + goto cleanup; + + /* strip any white space or ';' following the action */ + if (parens) + sp++; + while (*sp && (isspace((int) *sp) || *sp == ';')) + sp++; + goto another; + } + else if (*sp == 0 && !maybe_empty) + break; + else { + maybe_empty = 0; + in_quotes = 0; + /* + * if we have more parameters than memory in our array of + * pointers, then either allocate some or grow the array + */ + if (num >= max) { + max += 10; + if (list) + list = (char **) realloc(list, max * sizeof(char *)); + else + list = (char **) malloc(max * sizeof(char *)); + } + /* Strip leading whitespace. */ + while (*sp && isspace((int) *sp)) + sp++; + list[num++] = cp; + + /* search for the end of the argument, we want to keep going + * if we are in quotes or the char is not a delimiter + */ + while (*sp && (in_quotes || ((*sp != ',') + && (!parens || *sp != ')') + && (parens || !isspace((int) *sp))))) { + /* + * single quotes give literal value inside, including '\'. + * you can't have a single inside single quotes. + * doubles quotes gives literal value inside, but allows escape. + */ + if ((*sp == '"' || *sp == '\'') && (!in_quotes || *sp == in_quotes)) { + in_quotes = in_quotes ? 0 : *sp; + sp++; + continue; + } + /* unless within single quotes, \ will just be */ + else if (*sp == '\\' && in_quotes != '\'') + sp++; + *cp++ = *sp++; + } + cp2 = cp - 1; + *cp++ = 0; + if (*sp == ',' || (!parens && isspace((int) *sp))) { + maybe_empty = 1; + sp++; + } + /* Strip trailing whitespace. */ + for (; isspace((int) *cp2) && cp2 >= list[num - 1]; cp2--) + *cp2 = 0; + } + } + +cleanup: + + if (list != NULL) + free(list); + + if (str != NULL) + free(str); + + return retcode; +} + +int hid_parse_command(const char *str_) +{ + event(EVENT_CLI_ENTER, "s", str_); + return hid_parse_actionstring(str_, FALSE); +} + +int hid_parse_actions(const char *str_) +{ + return hid_parse_actionstring(str_, TRUE); +} + +/* trick for the doc extractor */ +#define static + +/* %start-doc actions 00macros + +@macro hidaction + +This is one of a number of actions which are part of the HID +interface. The core functions use these actions to tell the current +GUI when to change the presented information in response to changes +that the GUI may not know about. The user normally does not invoke +these directly. + +@end macro + +%end-doc */ + + +static const char pcbchanged_syntax[] = "PCBChanged([revert])"; +static const char pcbchanged_help[] = + "Tells the GUI that the whole PCB has changed. The optional \"revert\"" + "parameter can be used as a hint to the GUI that the same design is being" + "reloaded, and that it might keep some viewport settings"; + +/* %start-doc actions PCBChanged + +@hidaction + +%end-doc */ + +static const char routestyleschanged_syntax[] = "RouteStylesChanged()"; +static const char routestyleschanged_help[] = "Tells the GUI that the routing styles have changed."; + +/* %start-doc actions RouteStylesChanged + +@hidaction + +%end-doc */ + +static const char netlistchanged_syntax[] = "NetlistChanged()"; +static const char netlistchanged_help[] = "Tells the GUI that the netlist has changed."; + +/* %start-doc actions NetlistChanged + +@hidaction + +%end-doc */ + +static const char layerschanged_syntax[] = "LayersChanged()"; +static const char layerschanged_help[] = "Tells the GUI that the layers have changed."; + +/* %start-doc actions LayersChanged + +This includes layer names, colors, stacking order, visibility, etc. + +@hidaction + +%end-doc */ + +static const char librarychanged_syntax[] = "LibraryChanged()"; +static const char librarychanged_help[] = "Tells the GUI that the libraries have changed."; + +/* %start-doc actions LibraryChanged + +@hidaction + +%end-doc */ Index: 1.0.8/src/hid/common/actions.h =================================================================== --- 1.0.8/src/hid/common/actions.h (nonexistent) +++ 1.0.8/src/hid/common/actions.h (revision 1136) @@ -0,0 +1,7 @@ + +#ifndef PCB_HID_COMMON_ACTIONS_H +#define PCB_HID_COMMON_ACTIONS_H + +void print_actions(void); + +#endif Index: 1.0.8/src/hid/common/draw_helpers.c =================================================================== --- 1.0.8/src/hid/common/draw_helpers.c (nonexistent) +++ 1.0.8/src/hid/common/draw_helpers.c (revision 1136) @@ -0,0 +1,436 @@ +#include "global.h" +#include "hid.h" +#include "polygon.h" + +static void fill_contour(hidGC gc, PLINE * pl) +{ + Coord *x, *y, n, i = 0; + VNODE *v; + + n = pl->Count; + x = (Coord *) malloc(n * sizeof(*x)); + y = (Coord *) malloc(n * sizeof(*y)); + + for (v = &pl->head; i < n; v = v->next) { + x[i] = v->point[0]; + y[i++] = v->point[1]; + } + + gui->fill_polygon(gc, n, x, y); + + free(x); + free(y); +} + +static void thindraw_contour(hidGC gc, PLINE * pl) +{ + VNODE *v; + Coord last_x, last_y; + Coord this_x, this_y; + + gui->set_line_width(gc, 0); + gui->set_line_cap(gc, Round_Cap); + + /* If the contour is round, use an arc drawing routine. */ + if (pl->is_round) { + gui->draw_arc(gc, pl->cx, pl->cy, pl->radius, pl->radius, 0, 360); + return; + } + + /* Need at least two points in the contour */ + if (pl->head.next == NULL) + return; + + last_x = pl->head.point[0]; + last_y = pl->head.point[1]; + v = pl->head.next; + + do { + this_x = v->point[0]; + this_y = v->point[1]; + + gui->draw_line(gc, last_x, last_y, this_x, this_y); + /* gui->fill_circle (gc, this_x, this_y, 30); */ + + last_x = this_x; + last_y = this_y; + } + while ((v = v->next) != pl->head.next); +} + +static void fill_contour_cb(PLINE * pl, void *user_data) +{ + hidGC gc = (hidGC) user_data; + PLINE *local_pl = pl; + + fill_contour(gc, pl); + poly_FreeContours(&local_pl); +} + +static void fill_clipped_contour(hidGC gc, PLINE * pl, const BoxType * clip_box) +{ + PLINE *pl_copy; + POLYAREA *clip_poly; + POLYAREA *piece_poly; + POLYAREA *clipped_pieces; + POLYAREA *draw_piece; + int x; + + clip_poly = RectPoly(clip_box->X1, clip_box->X2, clip_box->Y1, clip_box->Y2); + poly_CopyContour(&pl_copy, pl); + piece_poly = poly_Create(); + poly_InclContour(piece_poly, pl_copy); + x = poly_Boolean_free(piece_poly, clip_poly, &clipped_pieces, PBO_ISECT); + if (x != err_ok || clipped_pieces == NULL) + return; + + draw_piece = clipped_pieces; + do { + /* NB: The polygon won't have any holes in it */ + fill_contour(gc, draw_piece->contours); + } + while ((draw_piece = draw_piece->f) != clipped_pieces); + poly_Free(&clipped_pieces); +} + +/* If at least 50% of the bounding box of the polygon is on the screen, + * lets compute the complete no-holes polygon. + */ +#define BOUNDS_INSIDE_CLIP_THRESHOLD 0.5 +static int should_compute_no_holes(PolygonType * poly, const BoxType * clip_box) +{ + Coord x1, x2, y1, y2; + double poly_bounding_area; + double clipped_poly_area; + + /* If there is no passed clip box, compute the whole thing */ + if (clip_box == NULL) + return 1; + + x1 = MAX(poly->BoundingBox.X1, clip_box->X1); + x2 = MIN(poly->BoundingBox.X2, clip_box->X2); + y1 = MAX(poly->BoundingBox.Y1, clip_box->Y1); + y2 = MIN(poly->BoundingBox.Y2, clip_box->Y2); + + /* Check if the polygon is outside the clip box */ + if ((x2 <= x1) || (y2 <= y1)) + return 0; + + poly_bounding_area = (double) (poly->BoundingBox.X2 - poly->BoundingBox.X1) * + (double) (poly->BoundingBox.Y2 - poly->BoundingBox.Y1); + + clipped_poly_area = (double) (x2 - x1) * (double) (y2 - y1); + + if (clipped_poly_area / poly_bounding_area >= BOUNDS_INSIDE_CLIP_THRESHOLD) + return 1; + + return 0; +} + +#undef BOUNDS_INSIDE_CLIP_THRESHOLD + +void common_fill_pcb_polygon(hidGC gc, PolygonType * poly, const BoxType * clip_box) +{ + if (!poly->NoHolesValid) { + /* If enough of the polygon is on-screen, compute the entire + * NoHoles version and cache it for later rendering, otherwise + * just compute what we need to render now. + */ + if (should_compute_no_holes(poly, clip_box)) + ComputeNoHoles(poly); + else + NoHolesPolygonDicer(poly, clip_box, fill_contour_cb, gc); + } + if (poly->NoHolesValid && poly->NoHoles) { + PLINE *pl; + + for (pl = poly->NoHoles; pl != NULL; pl = pl->next) { + if (clip_box == NULL) + fill_contour(gc, pl); + else + fill_clipped_contour(gc, pl, clip_box); + } + } + + /* Draw other parts of the polygon if fullpoly flag is set */ + /* NB: No "NoHoles" cache for these */ + if (TEST_FLAG(FULLPOLYFLAG, poly)) { + PolygonType p = *poly; + + for (p.Clipped = poly->Clipped->f; p.Clipped != poly->Clipped; p.Clipped = p.Clipped->f) + NoHolesPolygonDicer(&p, clip_box, fill_contour_cb, gc); + } +} + +static int thindraw_hole_cb(PLINE * pl, void *user_data) +{ + hidGC gc = (hidGC) user_data; + thindraw_contour(gc, pl); + return 0; +} + +void common_thindraw_pcb_polygon(hidGC gc, PolygonType * poly, const BoxType * clip_box) +{ + thindraw_contour(gc, poly->Clipped->contours); + PolygonHoles(poly, clip_box, thindraw_hole_cb, gc); +} + +void common_thindraw_pcb_pad(hidGC gc, PadType * pad, bool clear, bool mask) +{ + Coord w = clear ? (mask ? pad->Mask : pad->Thickness + pad->Clearance) + : pad->Thickness; + Coord x1, y1, x2, y2; + Coord t = w / 2; + x1 = pad->Point1.X; + y1 = pad->Point1.Y; + x2 = pad->Point2.X; + y2 = pad->Point2.Y; + if (x1 > x2 || y1 > y2) { + Coord temp_x = x1; + Coord temp_y = y1; + x1 = x2; + x2 = temp_x; + y1 = y2; + y2 = temp_y; + } + gui->set_line_cap(gc, Round_Cap); + gui->set_line_width(gc, 0); + if (TEST_FLAG(SQUAREFLAG, pad)) { + /* slanted square pad */ + double tx, ty, theta; + + if (x1 == x2 && y1 == y2) + theta = 0; + else + theta = atan2(y2 - y1, x2 - x1); + + /* T is a vector half a thickness long, in the direction of + one of the corners. */ + tx = t * cos(theta + M_PI / 4) * sqrt(2.0); + ty = t * sin(theta + M_PI / 4) * sqrt(2.0); + + gui->draw_line(gc, x1 - tx, y1 - ty, x2 + ty, y2 - tx); + gui->draw_line(gc, x2 + ty, y2 - tx, x2 + tx, y2 + ty); + gui->draw_line(gc, x2 + tx, y2 + ty, x1 - ty, y1 + tx); + gui->draw_line(gc, x1 - ty, y1 + tx, x1 - tx, y1 - ty); + } + else if (x1 == x2 && y1 == y2) { + gui->draw_arc(gc, x1, y1, t, t, 0, 360); + } + else { + /* Slanted round-end pads. */ + Coord dx, dy, ox, oy; + double h; + + dx = x2 - x1; + dy = y2 - y1; + h = t / sqrt(SQUARE(dx) + SQUARE(dy)); + ox = dy * h + 0.5 * SGN(dy); + oy = -(dx * h + 0.5 * SGN(dx)); + + gui->draw_line(gc, x1 + ox, y1 + oy, x2 + ox, y2 + oy); + + if (abs(ox) >= pixel_slop || abs(oy) >= pixel_slop) { + Angle angle = atan2(dx, dy) * 57.295779; + gui->draw_line(gc, x1 - ox, y1 - oy, x2 - ox, y2 - oy); + gui->draw_arc(gc, x1, y1, t, t, angle - 180, 180); + gui->draw_arc(gc, x2, y2, t, t, angle, 180); + } + } +} + +void common_fill_pcb_pad(hidGC gc, PadType * pad, bool clear, bool mask) +{ + Coord w = clear ? (mask ? pad->Mask : pad->Thickness + pad->Clearance) + : pad->Thickness; + + if (pad->Point1.X == pad->Point2.X && pad->Point1.Y == pad->Point2.Y) { + if (TEST_FLAG(SQUAREFLAG, pad)) { + Coord l, r, t, b; + l = pad->Point1.X - w / 2; + b = pad->Point1.Y - w / 2; + r = l + w; + t = b + w; + gui->fill_rect(gc, l, b, r, t); + } + else { + gui->fill_circle(gc, pad->Point1.X, pad->Point1.Y, w / 2); + } + } + else { + gui->set_line_cap(gc, TEST_FLAG(SQUAREFLAG, pad) ? Square_Cap : Round_Cap); + gui->set_line_width(gc, w); + + gui->draw_line(gc, pad->Point1.X, pad->Point1.Y, pad->Point2.X, pad->Point2.Y); + } +} + +/* --------------------------------------------------------------------------- + * draws one polygon + * x and y are already in display coordinates + * the points are numbered: + * + * 5 --- 6 + * / \ + * 4 7 + * | | + * 3 0 + * \ / + * 2 --- 1 + */ + +typedef struct { + double X, Y; +} FloatPolyType; + +static void draw_square_pin_poly(hidGC gc, Coord X, Coord Y, Coord Thickness, Coord thin_draw, int style) +{ + static FloatPolyType p[8] = { + {0.5, -TAN_22_5_DEGREE_2}, + {TAN_22_5_DEGREE_2, -0.5}, + {-TAN_22_5_DEGREE_2, -0.5}, + {-0.5, -TAN_22_5_DEGREE_2}, + {-0.5, TAN_22_5_DEGREE_2}, + {-TAN_22_5_DEGREE_2, 0.5}, + {TAN_22_5_DEGREE_2, 0.5}, + {0.5, TAN_22_5_DEGREE_2} + }; + static int special_size = 0; + static int scaled_x[8]; + static int scaled_y[8]; + Coord polygon_x[9]; + Coord polygon_y[9]; + double xm[8], ym[8]; + int i; + + square_pin_factors(style, xm, ym); + + if (Thickness != special_size) { + special_size = Thickness; + for (i = 0; i < 8; i++) { + scaled_x[i] = p[i].X * special_size; + scaled_y[i] = p[i].Y * special_size; + } + } + /* add line offset */ + for (i = 0; i < 8; i++) { + polygon_x[i] = X + scaled_x[i] * xm[i]; + polygon_y[i] = Y + scaled_y[i] * ym[i]; + } + + if (thin_draw) { + int i; + gui->set_line_cap(gc, Round_Cap); + gui->set_line_width(gc, 0); + polygon_x[8] = X + scaled_x[0] * xm[0]; + polygon_y[8] = Y + scaled_y[0] * ym[0]; + for (i = 0; i < 8; i++) + gui->draw_line(gc, polygon_x[i], polygon_y[i], polygon_x[i + 1], polygon_y[i + 1]); + } + else + gui->fill_polygon(gc, 8, polygon_x, polygon_y); +} + +static void draw_octagon_poly(hidGC gc, Coord X, Coord Y, Coord Thickness, Coord thin_draw) +{ + draw_square_pin_poly(gc, X, Y, Thickness, thin_draw, 17); +} + + +void common_fill_pcb_pv(hidGC fg_gc, hidGC bg_gc, PinType * pv, bool drawHole, bool mask) +{ + Coord w = mask ? pv->Mask : pv->Thickness; + Coord r = w / 2; + + if (TEST_FLAG(HOLEFLAG, pv)) { + if (mask) + gui->fill_circle(bg_gc, pv->X, pv->Y, r); + if (drawHole) { + gui->fill_circle(bg_gc, pv->X, pv->Y, r); + gui->set_line_cap(fg_gc, Round_Cap); + gui->set_line_width(fg_gc, 0); + gui->draw_arc(fg_gc, pv->X, pv->Y, r, r, 0, 360); + } + return; + } + + if (TEST_FLAG(SQUAREFLAG, pv)) { + /* use the original code for now */ + if ((GET_SQUARE(pv) == 0) || (GET_SQUARE(pv) == 1)) { + Coord l = pv->X - r; + Coord b = pv->Y - r; + Coord r = l + w; + Coord t = b + w; + gui->fill_rect(fg_gc, l, b, r, t); + } + else + draw_square_pin_poly(fg_gc, pv->X, pv->Y, w, false, GET_SQUARE(pv)); + } + else if (TEST_FLAG(OCTAGONFLAG, pv)) + draw_octagon_poly(fg_gc, pv->X, pv->Y, w, false); + else /* draw a round pin or via */ + gui->fill_circle(fg_gc, pv->X, pv->Y, r); + + /* and the drilling hole (which is always round) */ + if (drawHole) + gui->fill_circle(bg_gc, pv->X, pv->Y, pv->DrillingHole / 2); +} + +void common_thindraw_pcb_pv(hidGC fg_gc, hidGC bg_gc, PinType * pv, bool drawHole, bool mask) +{ + Coord w = mask ? pv->Mask : pv->Thickness; + Coord r = w / 2; + + if (TEST_FLAG(HOLEFLAG, pv)) { + if (mask) + gui->draw_arc(fg_gc, pv->X, pv->Y, r, r, 0, 360); + if (drawHole) { + r = pv->DrillingHole / 2; + gui->set_line_cap(bg_gc, Round_Cap); + gui->set_line_width(bg_gc, 0); + gui->draw_arc(bg_gc, pv->X, pv->Y, r, r, 0, 360); + } + return; + } + + if (TEST_FLAG(SQUAREFLAG, pv)) { + Coord l = pv->X - r; + Coord b = pv->Y - r; + Coord r = l + w; + Coord t = b + w; + + gui->set_line_cap(fg_gc, Round_Cap); + gui->set_line_width(fg_gc, 0); + gui->draw_line(fg_gc, r, t, r, b); + gui->draw_line(fg_gc, l, t, l, b); + gui->draw_line(fg_gc, r, t, l, t); + gui->draw_line(fg_gc, r, b, l, b); + + } + else if (TEST_FLAG(OCTAGONFLAG, pv)) { + draw_octagon_poly(fg_gc, pv->X, pv->Y, w, true); + } + else { /* draw a round pin or via */ + + gui->set_line_cap(fg_gc, Round_Cap); + gui->set_line_width(fg_gc, 0); + gui->draw_arc(fg_gc, pv->X, pv->Y, r, r, 0, 360); + } + + /* and the drilling hole (which is always round */ + if (drawHole) { + gui->set_line_cap(bg_gc, Round_Cap); + gui->set_line_width(bg_gc, 0); + gui->draw_arc(bg_gc, pv->X, pv->Y, pv->DrillingHole / 2, pv->DrillingHole / 2, 0, 360); + } +} + +void common_draw_helpers_init(HID * hid) +{ + hid->fill_pcb_polygon = common_fill_pcb_polygon; + hid->thindraw_pcb_polygon = common_thindraw_pcb_polygon; + hid->fill_pcb_pad = common_fill_pcb_pad; + hid->thindraw_pcb_pad = common_thindraw_pcb_pad; + hid->fill_pcb_pv = common_fill_pcb_pv; + hid->thindraw_pcb_pv = common_thindraw_pcb_pv; +} Index: 1.0.8/src/hid/common/draw_helpers.h =================================================================== --- 1.0.8/src/hid/common/draw_helpers.h (nonexistent) +++ 1.0.8/src/hid/common/draw_helpers.h (revision 1136) @@ -0,0 +1,7 @@ +void common_fill_pcb_polygon(hidGC gc, PolygonType * poly, const BoxType * clip_box); +void common_thindraw_pcb_polygon(hidGC gc, PolygonType * poly, const BoxType * clip_box); +void common_fill_pcb_pad(hidGC gc, PadType * pad, bool clear, bool mask); +void common_thindraw_pcb_pad(hidGC gc, PadType * pad, bool clear, bool mask); +void common_fill_pcb_pv(hidGC gc, PinType * pv, bool drawHole, bool mask); +void common_thindraw_pcb_pv(hidGC fg_gc, hidGC bg_gc, PinType * pv, bool drawHole, bool mask); +void common_draw_helpers_init(HID * hid); Index: 1.0.8/src/hid/common/extents.c =================================================================== --- 1.0.8/src/hid/common/extents.c (nonexistent) +++ 1.0.8/src/hid/common/extents.c (revision 1136) @@ -0,0 +1,192 @@ +/* $Id$ */ + +#include "config.h" + +#include +#include +#include +#include + +#include "global.h" +#include "data.h" + +#include "hid.h" +#include "../hidint.h" +#include "hid/common/draw_helpers.h" + + +RCSID("$Id$"); + +#ifndef MAXINT +#define MAXINT (((unsigned int)(~0))>>1) +#endif + +static BoxType box; + +typedef struct hid_gc_struct { + int width; +} hid_gc_struct; + +static int extents_set_layer(const char *name, int group, int empty) +{ + int idx = group; + if (idx >= 0 && idx < max_group) { + idx = PCB->LayerGroups.Entries[idx][0]; + } + if (idx >= 0 && idx < max_copper_layer + 2) + return 1; + if (idx < 0) { + switch (SL_TYPE(idx)) { + case SL_INVISIBLE: + case SL_MASK: + case SL_ASSY: + return 0; + case SL_SILK: + case SL_PDRILL: + case SL_UDRILL: + return 1; + } + } + return 0; +} + +static hidGC extents_make_gc(void) +{ + hidGC rv = (hidGC) malloc(sizeof(hid_gc_struct)); + memset(rv, 0, sizeof(hid_gc_struct)); + return rv; +} + +static void extents_destroy_gc(hidGC gc) +{ + free(gc); +} + +static void extents_use_mask(int use_it) +{ +} + +static void extents_set_color(hidGC gc, const char *name) +{ +} + +static void extents_set_line_cap(hidGC gc, EndCapStyle style) +{ +} + +static void extents_set_line_width(hidGC gc, Coord width) +{ + gc->width = width; +} + +static void extents_set_draw_xor(hidGC gc, int xor_) +{ +} + +#define PEX(x,w) if (box.X1 > (x)-(w)) box.X1 = (x)-(w); \ + if (box.X2 < (x)+(w)) box.X2 = (x)+(w) +#define PEY(y,w) if (box.Y1 > (y)-(w)) box.Y1 = (y)-(w); \ + if (box.Y2 < (y)+(w)) box.Y2 = (y)+(w) + +static void extents_draw_line(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ + PEX(x1, gc->width); + PEY(y1, gc->width); + PEX(x2, gc->width); + PEY(y2, gc->width); +} + +static void extents_draw_arc(hidGC gc, Coord cx, Coord cy, Coord width, Coord height, Angle start_angle, Angle end_angle) +{ + /* Naive but good enough. */ + PEX(cx, width + gc->width); + PEY(cy, height + gc->width); +} + +static void extents_draw_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ + PEX(x1, gc->width); + PEY(y1, gc->width); + PEX(x2, gc->width); + PEY(y2, gc->width); +} + +static void extents_fill_circle(hidGC gc, Coord cx, Coord cy, Coord radius) +{ + PEX(cx, radius); + PEY(cy, radius); +} + +static void extents_fill_polygon(hidGC gc, int n_coords, Coord * x, Coord * y) +{ + int i; + for (i = 0; i < n_coords; i++) { + PEX(x[i], 0); + PEY(y[i], 0); + } +} + +static void extents_fill_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ + PEX(x1, 0); + PEY(y1, 0); + PEX(x2, 0); + PEY(y2, 0); +} + +static HID extents_hid; + +void hid_extents_init(void) +{ + static bool initialised = false; + + if (initialised) + return; + + memset(&extents_hid, 0, sizeof(HID)); + + common_draw_helpers_init(&extents_hid); + + extents_hid.struct_size = sizeof(HID); + extents_hid.name = "extents-extents"; + extents_hid.description = "used to calculate extents"; + extents_hid.poly_before = 1; + + extents_hid.set_layer = extents_set_layer; + extents_hid.make_gc = extents_make_gc; + extents_hid.destroy_gc = extents_destroy_gc; + extents_hid.use_mask = extents_use_mask; + extents_hid.set_color = extents_set_color; + extents_hid.set_line_cap = extents_set_line_cap; + extents_hid.set_line_width = extents_set_line_width; + extents_hid.set_draw_xor = extents_set_draw_xor; + extents_hid.draw_line = extents_draw_line; + extents_hid.draw_arc = extents_draw_arc; + extents_hid.draw_rect = extents_draw_rect; + extents_hid.fill_circle = extents_fill_circle; + extents_hid.fill_polygon = extents_fill_polygon; + extents_hid.fill_rect = extents_fill_rect; + + initialised = true; +} + +BoxType *hid_get_extents(void *item) +{ + BoxType region; + + /* As this isn't a real "HID", we need to ensure we are initialised. */ + hid_extents_init(); + + box.X1 = MAXINT; + box.Y1 = MAXINT; + box.X2 = -MAXINT; + box.Y2 = -MAXINT; + + region.X1 = -MAXINT; + region.Y1 = -MAXINT; + region.X2 = MAXINT; + region.Y2 = MAXINT; + hid_expose_callback(&extents_hid, ®ion, item); + + return &box; +} Index: 1.0.8/src/hid/common/flags.c =================================================================== --- 1.0.8/src/hid/common/flags.c (nonexistent) +++ 1.0.8/src/hid/common/flags.c (revision 1136) @@ -0,0 +1,191 @@ +/* $Id$ */ + +#include "config.h" + +#include +#include +#include + +#include "global.h" +#include "data.h" +#include "misc.h" + +#include "hid.h" +#include "../hidint.h" + + +RCSID("$Id$"); + +typedef struct HID_FlagNode { + struct HID_FlagNode *next; + HID_Flag *flags; + int n; +} HID_FlagNode; + +HID_FlagNode *hid_flag_nodes = 0; +static int n_flags = 0; +static HID_Flag *all_flags = 0; + +void hid_register_flags(HID_Flag * a, int n) +{ + HID_FlagNode *ha; + + /* printf("%d flag%s registered\n", n, n==1 ? "" : "s"); */ + ha = (HID_FlagNode *) malloc(sizeof(HID_FlagNode)); + ha->next = hid_flag_nodes; + hid_flag_nodes = ha; + ha->flags = a; + ha->n = n; + n_flags += n; + if (all_flags) { + free(all_flags); + all_flags = 0; + } +} + +static int flag_sort(const void *va, const void *vb) +{ + HID_Flag *a = (HID_Flag *) va; + HID_Flag *b = (HID_Flag *) vb; + return strcmp(a->name, b->name); +} + +HID_Flag *hid_find_flag(const char *name) +{ + HID_FlagNode *hf; + int i, n, lower, upper; + + if (all_flags == 0) { + n = 0; + all_flags = (HID_Flag *) malloc(n_flags * sizeof(HID_Flag)); + for (hf = hid_flag_nodes; hf; hf = hf->next) + for (i = 0; i < hf->n; i++) + all_flags[n++] = hf->flags[i]; + qsort(all_flags, n_flags, sizeof(HID_Flag), flag_sort); + } + + lower = -1; + upper = n_flags + 1; + /*printf("search flag %s\n", name); */ + while (lower < upper - 1) { + i = (lower + upper) / 2; + n = strcmp(all_flags[i].name, name); + /*printf("try [%d].%s, cmp %d\n", i, all_flags[i].name, n); */ + if (n == 0) + return all_flags + i; + if (n > 0) + upper = i; + else + lower = i; + } + printf("unknown flag `%s'\n", name); + return 0; +} + +int hid_get_flag(const char *name) +{ + static char *buf = 0; + static int nbuf = 0; + const char *cp; + HID_Flag *f; + + cp = strchr(name, ','); + if (cp) { + int wv; + + if (nbuf < (cp - name + 1)) { + nbuf = cp - name + 10; + buf = (char *) realloc(buf, nbuf); + } + memcpy(buf, name, cp - name); + buf[cp - name] = 0; + /* A number without units is just a number. */ + wv = GetValueEx(cp + 1, NULL, NULL, NULL, NULL); + f = hid_find_flag(buf); + if (!f) + return 0; + return f->function(f->parm) == wv; + } + + f = hid_find_flag(name); + if (!f) + return 0; + return f->function(f->parm); +} + + +void hid_save_and_show_layer_ons(int *save_array) +{ + int i; + for (i = 0; i < max_copper_layer + 2; i++) { + save_array[i] = PCB->Data->Layer[i].On; + PCB->Data->Layer[i].On = 1; + } +} + +void hid_restore_layer_ons(int *save_array) +{ + int i; + for (i = 0; i < max_copper_layer + 2; i++) + PCB->Data->Layer[i].On = save_array[i]; +} + +const char *layer_type_to_file_name(int idx, int style) +{ + int group; + int nlayers; + const char *single_name; + + switch (idx) { + case SL(SILK, TOP): + return "topsilk"; + case SL(SILK, BOTTOM): + return "bottomsilk"; + case SL(MASK, TOP): + return "topmask"; + case SL(MASK, BOTTOM): + return "bottommask"; + case SL(PDRILL, 0): + return "plated-drill"; + case SL(UDRILL, 0): + return "unplated-drill"; + case SL(PASTE, TOP): + return "toppaste"; + case SL(PASTE, BOTTOM): + return "bottompaste"; + case SL(INVISIBLE, 0): + return "invisible"; + case SL(FAB, 0): + return "fab"; + case SL(ASSY, TOP): + return "topassembly"; + case SL(ASSY, BOTTOM): + return "bottomassembly"; + default: + group = GetLayerGroupNumberByNumber(idx); + nlayers = PCB->LayerGroups.Number[group]; + single_name = PCB->Data->Layer[idx].Name; + if (group == GetLayerGroupNumberByNumber(component_silk_layer)) { + if (style == FNS_first || (style == FNS_single && nlayers == 2)) + return single_name; + return "top"; + } + else if (group == GetLayerGroupNumberByNumber(solder_silk_layer)) { + if (style == FNS_first || (style == FNS_single && nlayers == 2)) + return single_name; + return "bottom"; + } + else if (nlayers == 1 + && (strcmp(PCB->Data->Layer[idx].Name, "route") == 0 || strcmp(PCB->Data->Layer[idx].Name, "outline") == 0)) { + return "outline"; + } + else { + static char buf[20]; + if (style == FNS_first || (style == FNS_single && nlayers == 1)) + return single_name; + sprintf(buf, "group%d", group); + return buf; + } + break; + } +} Index: 1.0.8/src/hid/common/hid_resource.c =================================================================== --- 1.0.8/src/hid/common/hid_resource.c (nonexistent) +++ 1.0.8/src/hid/common/hid_resource.c (revision 1136) @@ -0,0 +1,267 @@ +#include +#include +#include + +#include "global.h" +#include "hid.h" +#include "resource.h" +#include "hid/common/hid_resource.h" + +/* #define DEBUG_HID_RESOURCE */ + +static int button_count; /* number of buttons we have actions for */ +static int *button_nums; /* list of button numbers */ +static int *mod_count; /* how many mods they have */ +static unsigned *mods; /* mods, in order, one button after another */ +static Resource **actions; /* actions, in order, one button after another */ + +static Resource *res_wrap(char *value) +{ + Resource *tmp; + tmp = resource_create(0); + resource_add_val(tmp, 0, value, 0); + return tmp; +} + +static unsigned parse_mods(char *value) +{ + unsigned m = 0; + long int mod_num; + char *s; + + for (s = value; *s; s++) + *s = tolower(*s); + + s = strstr(value, "mod"); + if (s) { + s += 3; /* skip "mod" to get to number */ + errno = 0; + mod_num = strtol(s, (char **) NULL, 0); + if (!errno) + m |= M_Mod(mod_num); + } + if (strstr(value, "shift")) + m |= M_Shift; + if (strstr(value, "ctrl")) + m |= M_Ctrl; + if (strstr(value, "alt")) + m |= M_Alt; + if (strstr(value, "up")) + m |= M_Release; + return m; +} + +static int button_name_to_num(const char *name) +{ + /* All mouse-related resources must be named. The name is the + mouse button number. */ + if (!name) + return -1; + else if (strcasecmp(name, "left") == 0) + return 1; + else if (strcasecmp(name, "middle") == 0) + return 2; + else if (strcasecmp(name, "right") == 0) + return 3; + else if (strcasecmp(name, "up") == 0) + return 4; + else if (strcasecmp(name, "down") == 0) + return 5; + else + return atoi(name); +} + +void load_mouse_resource(const Resource * res) +{ + int bi, mi, a; + int action_count; +#ifdef DEBUG_HID_RESOURCE + fprintf(stderr, "note mouse resource:\n"); + resource_dump(res); +#endif + + button_count = res->c; + button_nums = (int *) malloc(res->c * sizeof(int)); + mod_count = (int *) malloc(res->c * sizeof(int)); + action_count = 0; + for (bi = 0; bi < res->c; bi++) { + if (res->v[bi].value) + action_count++; + + if (res->v[bi].subres) + action_count += res->v[bi].subres->c; + + } + mods = (unsigned int *) malloc(action_count * sizeof(int)); + actions = (Resource **) malloc(action_count * sizeof(Resource *)); + + a = 0; + for (bi = 0; bi < res->c; bi++) { + int button_num = button_name_to_num(res->v[bi].name); + + if (button_num < 0) + continue; + + button_nums[bi] = button_num; + mod_count[bi] = 0; + + if (res->v[bi].value) { + mods[a] = 0; + actions[a++] = res_wrap(res->v[bi].value); + mod_count[bi] = 1; + } + + if (res->v[bi].subres) { + Resource *m = res->v[bi].subres; + mod_count[bi] += m->c; + + for (mi = 0; mi < m->c; mi++, a++) { + switch (resource_type(m->v[mi])) { + case 1: /* subres only */ + mods[a] = 0; + actions[a] = m->v[mi].subres; + break; + + case 10: /* value only */ + mods[a] = 0; + actions[a] = res_wrap(m->v[mi].value); + break; + + case 101: /* name = subres */ + mods[a] = parse_mods(m->v[mi].name); + actions[a] = m->v[mi].subres; + break; + + case 110: /* name = value */ + mods[a] = parse_mods(m->v[mi].name); + actions[a] = res_wrap(m->v[mi].value); + break; + } + } + } + } +} + +static Resource *find_best_action(int button, int start, unsigned mod_mask) +{ + int i, j; + int count = mod_count[button]; + unsigned search_mask = mod_mask & ~M_Release; + unsigned release_mask = mod_mask & M_Release; + + /* look for exact mod match */ + for (i = start; i < start + count; i++) + if (mods[i] == mod_mask) { + return actions[i]; + } + + for (j = search_mask - 1; j >= 0; j--) + if ((j & search_mask) == j) /* this would work */ + for (i = start; i < start + count; i++) /* search for it */ + if (mods[i] == (j | release_mask)) + return actions[i]; + + return NULL; +} + +void do_mouse_action(int button, int mod_mask) +{ + Resource *action = NULL; + int bi, i, a; + + /* find the right set of actions; */ + a = 0; + for (bi = 0; bi < button_count && !action; bi++) + if (button_nums[bi] == button) { + action = find_best_action(bi, a, mod_mask); + break; + } + else + a += mod_count[bi]; /* skip this buttons actions */ + + if (!action) + return; + + for (i = 0; i < action->c; i++) + if (action->v[i].value) + if (hid_parse_actions(action->v[i].value)) + return; +} + +Resource *resource_create_menu(const char *name, const char *action, const char *mnemonic, const char *accel, const char *tip, + int flags) +{ + Resource *resp, *res; + ResourceVal *rvp, *rv; + int next; + + /* child */ + res = calloc(sizeof(Resource), 1); + res->c = 1 + (action != NULL) + (mnemonic != NULL) + (accel != NULL) + (tip != NULL); + rv = malloc(sizeof(ResourceVal) * res->c); + res->v = rv; + res->flags = flags; + + rv[0].name = NULL; + rv[0].value = strdup(name); + rv[0].subres = NULL; + next = 1; + + if (action != NULL) { + rv[next].name = NULL; + rv[next].value = strdup(action); + rv[next].subres = NULL; + next++; + } + + if (mnemonic != NULL) { + rv[next].name = "m"; + rv[next].value = strdup(mnemonic); + rv[next].subres = NULL; + next++; + } + + if (accel != NULL) { + Resource *ares; + ResourceVal *arv; + + ares = calloc(sizeof(Resource), 1); + arv = malloc(sizeof(ResourceVal) * 2); + ares->c = 2; + ares->v = arv; + ares->flags = 0; + + arv[0].name = NULL; + arv[0].value = strdup(accel); + arv[0].subres = NULL; + + arv[1].name = NULL; + arv[1].value = strdup(accel); + arv[1].subres = NULL; + + rv[next].name = "a"; + rv[next].value = NULL; + rv[next].subres = ares; + + next++; + } + + if (tip != NULL) { + rv[next].name = "tip"; + rv[next].value = strdup(tip); + rv[next].subres = NULL; + next++; + } + + /* parent */ + resp = calloc(sizeof(Resource), 1); + rvp = malloc(sizeof(ResourceVal)); + + resp->v = rvp; + resp->c = 1; + rvp->name = NULL; + rvp->value = NULL; + rvp->subres = res; + + return resp; +} Index: 1.0.8/src/hid/common/hid_resource.h =================================================================== --- 1.0.8/src/hid/common/hid_resource.h (nonexistent) +++ 1.0.8/src/hid/common/hid_resource.h (revision 1136) @@ -0,0 +1,21 @@ + +#ifndef PCB_HID_COMMON_HID_RESOURCE_H +#define PCB_HID_COMMON_HID_RESOURCE_H + +#include "resource.h" + +#define M_Shift 1 +#define M_Ctrl 2 +#define M_Mod(n) (1<<(n+1)) +#define M_Alt M_Mod(1) +#define M_Multi M_Mod(2) +#define M_Release (~((unsigned)-1>>1)) /* set the top bit */ + +void load_mouse_resource(const Resource * res); +void do_mouse_action(int button, int mods); + +/* Create a set of resources representing a single menu item */ +Resource *resource_create_menu(const char *name, const char *action, const char *mnemonic, const char *accel, const char *tip, + int flags); + +#endif Index: 1.0.8/src/hid/common/hidgl.c =================================================================== --- 1.0.8/src/hid/common/hidgl.c (nonexistent) +++ 1.0.8/src/hid/common/hidgl.c (revision 1136) @@ -0,0 +1,725 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 2009-2011 PCB Contributers (See ChangeLog for details) + * + * 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. + * + */ + +#include "config.h" + +#include +#include +#ifdef HAVE_STRING_H +#include +#endif +#include +#include + +/* The Linux OpenGL ABI 1.0 spec requires that we define + * GL_GLEXT_PROTOTYPES before including gl.h or glx.h for extensions + * in order to get prototypes: + * http://www.opengl.org/registry/ABI/ + */ +#define GL_GLEXT_PROTOTYPES 1 +#ifdef HAVE_OPENGL_GL_H +#include +#else +#include +#endif + +#ifdef HAVE_OPENGL_GLU_H +#include +#else +#include +#endif + +#include "action.h" +#include "crosshair.h" +#include "data.h" +#include "error.h" +#include "global.h" +#include "mymem.h" +#include "clip.h" + +#include "hid.h" +#include "hidgl.h" +#include "rtree.h" + + + +triangle_buffer buffer; +float global_depth = 0; + +void hidgl_init_triangle_array(triangle_buffer * buffer) +{ + buffer->triangle_count = 0; + buffer->coord_comp_count = 0; +} + +void hidgl_flush_triangles(triangle_buffer * buffer) +{ + if (buffer->triangle_count == 0) + return; + + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, 0, buffer->triangle_array); + glDrawArrays(GL_TRIANGLES, 0, buffer->triangle_count * 3); + glDisableClientState(GL_VERTEX_ARRAY); + + buffer->triangle_count = 0; + buffer->coord_comp_count = 0; +} + +void hidgl_ensure_triangle_space(triangle_buffer * buffer, int count) +{ + if (count > TRIANGLE_ARRAY_SIZE) { + fprintf(stderr, "Not enough space in vertex buffer\n"); + fprintf(stderr, "Requested %i triangles, %i available\n", count, TRIANGLE_ARRAY_SIZE); + exit(1); + } + if (count > TRIANGLE_ARRAY_SIZE - buffer->triangle_count) + hidgl_flush_triangles(buffer); +} + +void hidgl_set_depth(float depth) +{ + global_depth = depth; +} + +void hidgl_draw_grid(BoxType * drawn_area) +{ + static GLfloat *points = 0; + static int npoints = 0; + Coord x1, y1, x2, y2, n, i; + double x, y; + + if (!Settings.DrawGrid) + return; + + x1 = GridFit(MAX(0, drawn_area->X1), PCB->Grid, PCB->GridOffsetX); + y1 = GridFit(MAX(0, drawn_area->Y1), PCB->Grid, PCB->GridOffsetY); + x2 = GridFit(MIN(PCB->MaxWidth, drawn_area->X2), PCB->Grid, PCB->GridOffsetX); + y2 = GridFit(MIN(PCB->MaxHeight, drawn_area->Y2), PCB->Grid, PCB->GridOffsetY); + + if (x1 > x2) { + Coord tmp = x1; + x1 = x2; + x2 = tmp; + } + + if (y1 > y2) { + Coord tmp = y1; + y1 = y2; + y2 = tmp; + } + + n = (int) ((x2 - x1) / PCB->Grid + 0.5) + 1; + if (n > npoints) { + npoints = n + 10; + points = realloc(points, npoints * 3 * sizeof(GLfloat)); + } + + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, 0, points); + + n = 0; + for (x = x1; x <= x2; x += PCB->Grid) { + points[3 * n + 0] = x; + points[3 * n + 2] = global_depth; + n++; + } + for (y = y1; y <= y2; y += PCB->Grid) { + for (i = 0; i < n; i++) + points[3 * i + 1] = y; + glDrawArrays(GL_POINTS, 0, n); + } + + glDisableClientState(GL_VERTEX_ARRAY); +} + +#define MAX_PIXELS_ARC_TO_CHORD 0.5 +#define MIN_SLICES 6 +int calc_slices(float pix_radius, float sweep_angle) +{ + float slices; + + if (pix_radius <= MAX_PIXELS_ARC_TO_CHORD) + return MIN_SLICES; + + slices = sweep_angle / acosf(1 - MAX_PIXELS_ARC_TO_CHORD / pix_radius) / 2.; + return (int) ceilf(slices); +} + +#define MIN_TRIANGLES_PER_CAP 3 +#define MAX_TRIANGLES_PER_CAP 90 +static void draw_cap(Coord width, Coord x, Coord y, Angle angle, double scale) +{ + float last_capx, last_capy; + float capx, capy; + float radius = width / 2.; + int slices = calc_slices(radius / scale, M_PI); + int i; + + if (slices < MIN_TRIANGLES_PER_CAP) + slices = MIN_TRIANGLES_PER_CAP; + + if (slices > MAX_TRIANGLES_PER_CAP) + slices = MAX_TRIANGLES_PER_CAP; + + hidgl_ensure_triangle_space(&buffer, slices); + + last_capx = radius * cosf(angle * M_PI / 180.) + x; + last_capy = -radius * sinf(angle * M_PI / 180.) + y; + for (i = 0; i < slices; i++) { + capx = radius * cosf(angle * M_PI / 180. + ((float) (i + 1)) * M_PI / (float) slices) + x; + capy = -radius * sinf(angle * M_PI / 180. + ((float) (i + 1)) * M_PI / (float) slices) + y; + hidgl_add_triangle(&buffer, last_capx, last_capy, capx, capy, x, y); + last_capx = capx; + last_capy = capy; + } +} + +void hidgl_draw_line(int cap, Coord width, Coord x1, Coord y1, Coord x2, Coord y2, double scale) +{ + double angle; + float deltax, deltay, length; + float wdx, wdy; + int circular_caps = 0; + int hairline = 0; + + if (width == 0.0) + hairline = 1; + + if (width < scale) + width = scale; + + deltax = x2 - x1; + deltay = y2 - y1; + + length = sqrt(deltax * deltax + deltay * deltay); + + if (length == 0) { + /* Assume the orientation of the line is horizontal */ + angle = 0; + wdx = -width / 2.; + wdy = 0; + length = 1.; + deltax = 1.; + deltay = 0.; + } + else { + wdy = deltax * width / 2. / length; + wdx = -deltay * width / 2. / length; + + if (deltay == 0.) + angle = (deltax < 0) ? 270. : 90.; + else + angle = 180. / M_PI * atanl(deltax / deltay); + + if (deltay < 0) + angle += 180.; + } + + switch (cap) { + case Trace_Cap: + case Round_Cap: + circular_caps = 1; + break; + + case Square_Cap: + case Beveled_Cap: + x1 -= deltax * width / 2. / length; + y1 -= deltay * width / 2. / length; + x2 += deltax * width / 2. / length; + y2 += deltay * width / 2. / length; + break; + } + + hidgl_ensure_triangle_space(&buffer, 2); + hidgl_add_triangle(&buffer, x1 - wdx, y1 - wdy, x2 - wdx, y2 - wdy, x2 + wdx, y2 + wdy); + hidgl_add_triangle(&buffer, x1 - wdx, y1 - wdy, x2 + wdx, y2 + wdy, x1 + wdx, y1 + wdy); + + /* Don't bother capping hairlines */ + if (circular_caps && !hairline) { + draw_cap(width, x1, y1, angle, scale); + draw_cap(width, x2, y2, angle + 180., scale); + } +} + +#define MIN_SLICES_PER_ARC 6 +#define MAX_SLICES_PER_ARC 360 +void hidgl_draw_arc(Coord width, Coord x, Coord y, Coord rx, Coord ry, Angle start_angle, Angle delta_angle, double scale) +{ + float last_inner_x, last_inner_y; + float last_outer_x, last_outer_y; + float inner_x, inner_y; + float outer_x, outer_y; + float inner_r; + float outer_r; + float cos_ang, sin_ang; + float start_angle_rad; + float delta_angle_rad; + float angle_incr_rad; + int slices; + int i; + int hairline = 0; + + if (width == 0.0) + hairline = 1; + + if (width < scale) + width = scale; + + inner_r = rx - width / 2.; + outer_r = rx + width / 2.; + + if (delta_angle < 0) { + start_angle += delta_angle; + delta_angle = -delta_angle; + } + + start_angle_rad = start_angle * M_PI / 180.; + delta_angle_rad = delta_angle * M_PI / 180.; + + slices = calc_slices((rx + width / 2.) / scale, delta_angle_rad); + + if (slices < MIN_SLICES_PER_ARC) + slices = MIN_SLICES_PER_ARC; + + if (slices > MAX_SLICES_PER_ARC) + slices = MAX_SLICES_PER_ARC; + + hidgl_ensure_triangle_space(&buffer, 2 * slices); + + angle_incr_rad = delta_angle_rad / (float) slices; + + cos_ang = cosf(start_angle_rad); + sin_ang = sinf(start_angle_rad); + last_inner_x = -inner_r * cos_ang + x; + last_inner_y = inner_r * sin_ang + y; + last_outer_x = -outer_r * cos_ang + x; + last_outer_y = outer_r * sin_ang + y; + for (i = 1; i <= slices; i++) { + cos_ang = cosf(start_angle_rad + ((float) (i)) * angle_incr_rad); + sin_ang = sinf(start_angle_rad + ((float) (i)) * angle_incr_rad); + inner_x = -inner_r * cos_ang + x; + inner_y = inner_r * sin_ang + y; + outer_x = -outer_r * cos_ang + x; + outer_y = outer_r * sin_ang + y; + hidgl_add_triangle(&buffer, last_inner_x, last_inner_y, last_outer_x, last_outer_y, outer_x, outer_y); + hidgl_add_triangle(&buffer, last_inner_x, last_inner_y, inner_x, inner_y, outer_x, outer_y); + last_inner_x = inner_x; + last_inner_y = inner_y; + last_outer_x = outer_x; + last_outer_y = outer_y; + } + + /* Don't bother capping hairlines */ + if (hairline) + return; + + draw_cap(width, x + rx * -cosf(start_angle_rad), y + rx * sinf(start_angle_rad), start_angle, scale); + draw_cap(width, x + rx * -cosf(start_angle_rad + delta_angle_rad), + y + rx * sinf(start_angle_rad + delta_angle_rad), start_angle + delta_angle + 180., scale); +} + +void hidgl_draw_rect(Coord x1, Coord y1, Coord x2, Coord y2) +{ + glBegin(GL_LINE_LOOP); + glVertex3f(x1, y1, global_depth); + glVertex3f(x1, y2, global_depth); + glVertex3f(x2, y2, global_depth); + glVertex3f(x2, y1, global_depth); + glEnd(); +} + + +void hidgl_fill_circle(Coord vx, Coord vy, Coord vr, double scale) +{ +#define MIN_TRIANGLES_PER_CIRCLE 6 +#define MAX_TRIANGLES_PER_CIRCLE 360 + float last_x, last_y; + float radius = vr; + int slices; + int i; + + slices = calc_slices(vr / scale, 2 * M_PI); + + if (slices < MIN_TRIANGLES_PER_CIRCLE) + slices = MIN_TRIANGLES_PER_CIRCLE; + + if (slices > MAX_TRIANGLES_PER_CIRCLE) + slices = MAX_TRIANGLES_PER_CIRCLE; + + hidgl_ensure_triangle_space(&buffer, slices); + + last_x = vx + vr; + last_y = vy; + + for (i = 0; i < slices; i++) { + float x, y; + x = radius * cosf(((float) (i + 1)) * 2. * M_PI / (float) slices) + vx; + y = radius * sinf(((float) (i + 1)) * 2. * M_PI / (float) slices) + vy; + hidgl_add_triangle(&buffer, vx, vy, last_x, last_y, x, y); + last_x = x; + last_y = y; + } +} + +#define MAX_COMBINED_MALLOCS 2500 +static void *combined_to_free[MAX_COMBINED_MALLOCS]; +static int combined_num_to_free = 0; + +static GLenum tessVertexType; +static int stashed_vertices; +static int triangle_comp_idx; + + +static void myError(GLenum errno) +{ + printf("gluTess error: %s\n", gluErrorString(errno)); +} + +static void myFreeCombined() +{ + while (combined_num_to_free) + free(combined_to_free[--combined_num_to_free]); +} + +static void myCombine(GLdouble coords[3], void *vertex_data[4], GLfloat weight[4], void **dataOut) +{ +#define MAX_COMBINED_VERTICES 2500 + static GLdouble combined_vertices[3 * MAX_COMBINED_VERTICES]; + static int num_combined_vertices = 0; + + GLdouble *new_vertex; + + if (num_combined_vertices < MAX_COMBINED_VERTICES) { + new_vertex = &combined_vertices[3 * num_combined_vertices]; + num_combined_vertices++; + } + else { + new_vertex = malloc(3 * sizeof(GLdouble)); + + if (combined_num_to_free < MAX_COMBINED_MALLOCS) + combined_to_free[combined_num_to_free++] = new_vertex; + else + printf("myCombine leaking %lu bytes of memory\n", 3 * sizeof(GLdouble)); + } + + new_vertex[0] = coords[0]; + new_vertex[1] = coords[1]; + new_vertex[2] = coords[2]; + + *dataOut = new_vertex; +} + +static void myBegin(GLenum type) +{ + tessVertexType = type; + stashed_vertices = 0; + triangle_comp_idx = 0; +} + +static double global_scale; + +static void myVertex(GLdouble * vertex_data) +{ + static GLfloat triangle_vertices[2 * 3]; + + if (tessVertexType == GL_TRIANGLE_STRIP || tessVertexType == GL_TRIANGLE_FAN) { + if (stashed_vertices < 2) { + triangle_vertices[triangle_comp_idx++] = vertex_data[0]; + triangle_vertices[triangle_comp_idx++] = vertex_data[1]; + stashed_vertices++; + } + else { + hidgl_ensure_triangle_space(&buffer, 1); + hidgl_add_triangle(&buffer, + triangle_vertices[0], triangle_vertices[1], + triangle_vertices[2], triangle_vertices[3], vertex_data[0], vertex_data[1]); + + if (tessVertexType == GL_TRIANGLE_STRIP) { + /* STRIP saves the last two vertices for re-use in the next triangle */ + triangle_vertices[0] = triangle_vertices[2]; + triangle_vertices[1] = triangle_vertices[3]; + } + /* Both FAN and STRIP save the last vertex for re-use in the next triangle */ + triangle_vertices[2] = vertex_data[0]; + triangle_vertices[3] = vertex_data[1]; + } + } + else if (tessVertexType == GL_TRIANGLES) { + triangle_vertices[triangle_comp_idx++] = vertex_data[0]; + triangle_vertices[triangle_comp_idx++] = vertex_data[1]; + stashed_vertices++; + if (stashed_vertices == 3) { + hidgl_ensure_triangle_space(&buffer, 1); + hidgl_add_triangle(&buffer, + triangle_vertices[0], triangle_vertices[1], + triangle_vertices[2], triangle_vertices[3], triangle_vertices[4], triangle_vertices[5]); + triangle_comp_idx = 0; + stashed_vertices = 0; + } + } + else + printf("Vertex received with unknown type\n"); +} + +void hidgl_fill_polygon(int n_coords, Coord * x, Coord * y) +{ + int i; + GLUtesselator *tobj; + GLdouble *vertices; + + assert(n_coords > 0); + + vertices = malloc(sizeof(GLdouble) * n_coords * 3); + + tobj = gluNewTess(); + gluTessCallback(tobj, GLU_TESS_BEGIN, (_GLUfuncptr) myBegin); + gluTessCallback(tobj, GLU_TESS_VERTEX, (_GLUfuncptr) myVertex); + gluTessCallback(tobj, GLU_TESS_COMBINE, (_GLUfuncptr) myCombine); + gluTessCallback(tobj, GLU_TESS_ERROR, (_GLUfuncptr) myError); + + gluTessBeginPolygon(tobj, NULL); + gluTessBeginContour(tobj); + + for (i = 0; i < n_coords; i++) { + vertices[0 + i * 3] = x[i]; + vertices[1 + i * 3] = y[i]; + vertices[2 + i * 3] = 0.; + gluTessVertex(tobj, &vertices[i * 3], &vertices[i * 3]); + } + + gluTessEndContour(tobj); + gluTessEndPolygon(tobj); + gluDeleteTess(tobj); + + myFreeCombined(); + free(vertices); +} + +void tesselate_contour(GLUtesselator * tobj, PLINE * contour, GLdouble * vertices, double scale) +{ + VNODE *vn = &contour->head; + int offset = 0; + + /* If the contour is round, and hidgl_fill_circle would use + * less slices than we have vertices to draw it, then call + * hidgl_fill_circle to draw this contour. + */ + if (contour->is_round) { + double slices = calc_slices(contour->radius / scale, 2 * M_PI); + if (slices < contour->Count) { + hidgl_fill_circle(contour->cx, contour->cy, contour->radius, scale); + return; + } + } + + gluTessBeginPolygon(tobj, NULL); + gluTessBeginContour(tobj); + do { + vertices[0 + offset] = vn->point[0]; + vertices[1 + offset] = vn->point[1]; + vertices[2 + offset] = 0.; + gluTessVertex(tobj, &vertices[offset], &vertices[offset]); + offset += 3; + } while ((vn = vn->next) != &contour->head); + gluTessEndContour(tobj); + gluTessEndPolygon(tobj); +} + +struct do_hole_info { + GLUtesselator *tobj; + GLdouble *vertices; + double scale; +}; + +static int do_hole(const BoxType * b, void *cl) +{ + struct do_hole_info *info = cl; + PLINE *curc = (PLINE *) b; + + /* Ignore the outer contour - we draw it first explicitly */ + if (curc->Flags.orient == PLF_DIR) { + return 0; + } + + tesselate_contour(info->tobj, curc, info->vertices, info->scale); + return 1; +} + +static GLint stencil_bits; +static int dirty_bits = 0; +static int assigned_bits = 0; + +/* FIXME: JUST DRAWS THE FIRST PIECE.. TODO: SUPPORT FOR FULLPOLY POLYGONS */ +void hidgl_fill_pcb_polygon(PolygonType * poly, const BoxType * clip_box, double scale) +{ + int vertex_count = 0; + PLINE *contour; + struct do_hole_info info; + int stencil_bit; + + info.scale = scale; + global_scale = scale; + + if (poly->Clipped == NULL) { + fprintf(stderr, "hidgl_fill_pcb_polygon: poly->Clipped == NULL\n"); + return; + } + + stencil_bit = hidgl_assign_clear_stencil_bit(); + if (!stencil_bit) { + printf("hidgl_fill_pcb_polygon: No free stencil bits, aborting polygon\n"); + return; + } + + /* Flush out any existing geoemtry to be rendered */ + hidgl_flush_triangles(&buffer); + + /* Walk the polygon structure, counting vertices */ + /* This gives an upper bound on the amount of storage required */ + for (contour = poly->Clipped->contours; contour != NULL; contour = contour->next) + vertex_count = MAX(vertex_count, contour->Count); + + info.vertices = malloc(sizeof(GLdouble) * vertex_count * 3); + info.tobj = gluNewTess(); + gluTessCallback(info.tobj, GLU_TESS_BEGIN, (_GLUfuncptr) myBegin); + gluTessCallback(info.tobj, GLU_TESS_VERTEX, (_GLUfuncptr) myVertex); + gluTessCallback(info.tobj, GLU_TESS_COMBINE, (_GLUfuncptr) myCombine); + gluTessCallback(info.tobj, GLU_TESS_ERROR, (_GLUfuncptr) myError); + + glPushAttrib(GL_STENCIL_BUFFER_BIT); /* Save the write mask etc.. for final restore */ + glEnable(GL_STENCIL_TEST); + glPushAttrib(GL_STENCIL_BUFFER_BIT | /* Resave the stencil write-mask etc.., and */ + GL_COLOR_BUFFER_BIT); /* the colour buffer write mask etc.. for part way restore */ + glStencilMask(stencil_bit); /* Only write to our stencil bit */ + glStencilFunc(GL_ALWAYS, stencil_bit, stencil_bit); /* Always pass stencil test, ref value is our bit */ + glColorMask(0, 0, 0, 0); /* Disable writting in color buffer */ + + glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); /* Stencil pass => replace stencil value */ + + /* Drawing operations now set our reference bit in the stencil buffer */ + + r_search(poly->Clipped->contour_tree, clip_box, NULL, do_hole, &info); + hidgl_flush_triangles(&buffer); + + glPopAttrib(); /* Restore the colour and stencil buffer write-mask etc.. */ + + glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); /* This allows us to toggle the bit on any subcompositing bitplane */ + /* If the stencil test has passed, we know that bit is 0, so we're */ + /* effectively just setting it to 1. */ + + glStencilFunc(GL_GEQUAL, 0, assigned_bits); /* Pass stencil test if all assigned bits clear, */ + /* reference is all assigned bits so we set */ + /* any bits permitted by the stencil writemask */ + + /* Drawing operations as masked to areas where the stencil buffer is '0' */ + + /* Draw the polygon outer */ + tesselate_contour(info.tobj, poly->Clipped->contours, info.vertices, scale); + hidgl_flush_triangles(&buffer); + + /* Unassign our stencil buffer bit */ + hidgl_return_stencil_bit(stencil_bit); + + glPopAttrib(); /* Restore the stencil buffer write-mask etc.. */ + + gluDeleteTess(info.tobj); + myFreeCombined(); + free(info.vertices); +} + +void hidgl_fill_rect(Coord x1, Coord y1, Coord x2, Coord y2) +{ + hidgl_ensure_triangle_space(&buffer, 2); + hidgl_add_triangle(&buffer, x1, y1, x1, y2, x2, y2); + hidgl_add_triangle(&buffer, x2, y1, x2, y2, x1, y1); +} + +void hidgl_init(void) +{ + glGetIntegerv(GL_STENCIL_BITS, &stencil_bits); + + if (stencil_bits == 0) { + printf("No stencil bits available.\n" "Cannot mask polygon holes or subcomposite layers\n"); + /* TODO: Flag this to the HID so it can revert to the dicer? */ + } + else if (stencil_bits == 1) { + printf("Only one stencil bitplane avilable\n" "Cannot use stencil buffer to sub-composite layers.\n"); + /* Do we need to disable that somewhere? */ + } +} + +int hidgl_stencil_bits(void) +{ + return stencil_bits; +} + +static void hidgl_clean_unassigned_stencil(void) +{ + glPushAttrib(GL_STENCIL_BUFFER_BIT); + glStencilMask(~assigned_bits); + glClearStencil(0); + glClear(GL_STENCIL_BUFFER_BIT); + glPopAttrib(); +} + +int hidgl_assign_clear_stencil_bit(void) +{ + int stencil_bitmask = (1 << stencil_bits) - 1; + int test; + int first_dirty = 0; + + if (assigned_bits == stencil_bitmask) { + printf("No more stencil bits available, total of %i already assigned\n", stencil_bits); + return 0; + } + + /* Look for a bitplane we don't have to clear */ + for (test = 1; test & stencil_bitmask; test <<= 1) { + if (!(test & dirty_bits)) { + assigned_bits |= test; + dirty_bits |= test; + return test; + } + else if (!first_dirty && !(test & assigned_bits)) { + first_dirty = test; + } + } + + /* Didn't find any non dirty planes. Clear those dirty ones which aren't in use */ + hidgl_clean_unassigned_stencil(); + assigned_bits |= first_dirty; + dirty_bits = assigned_bits; + + return first_dirty; +} + +void hidgl_return_stencil_bit(int bit) +{ + assigned_bits &= ~bit; +} + +void hidgl_reset_stencil_usage(void) +{ + assigned_bits = 0; + dirty_bits = 0; +} Index: 1.0.8/src/hid/common/hidgl.h =================================================================== --- 1.0.8/src/hid/common/hidgl.h (nonexistent) +++ 1.0.8/src/hid/common/hidgl.h (revision 1136) @@ -0,0 +1,79 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 2009-2011 PCB Contributors (See ChangeLog for details). + * + * 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. + * + */ + +#ifndef PCB_HID_COMMON_HIDGL_H +#define PCB_HID_COMMON_HIDGL_H + +#define TRIANGLE_ARRAY_SIZE 5461 +typedef struct { + GLfloat triangle_array[3 * 3 * TRIANGLE_ARRAY_SIZE]; + unsigned int triangle_count; + unsigned int coord_comp_count; +} triangle_buffer; + +extern triangle_buffer buffer; +extern float global_depth; + +void hidgl_init_triangle_array(triangle_buffer * buffer); +void hidgl_flush_triangles(triangle_buffer * buffer); +void hidgl_ensure_triangle_space(triangle_buffer * buffer, int count); + +static inline void +hidgl_add_triangle_3D(triangle_buffer * buffer, + GLfloat x1, GLfloat y1, GLfloat z1, + GLfloat x2, GLfloat y2, GLfloat z2, GLfloat x3, GLfloat y3, GLfloat z3) +{ + buffer->triangle_array[buffer->coord_comp_count++] = x1; + buffer->triangle_array[buffer->coord_comp_count++] = y1; + buffer->triangle_array[buffer->coord_comp_count++] = z1; + buffer->triangle_array[buffer->coord_comp_count++] = x2; + buffer->triangle_array[buffer->coord_comp_count++] = y2; + buffer->triangle_array[buffer->coord_comp_count++] = z2; + buffer->triangle_array[buffer->coord_comp_count++] = x3; + buffer->triangle_array[buffer->coord_comp_count++] = y3; + buffer->triangle_array[buffer->coord_comp_count++] = z3; + buffer->triangle_count++; +} + +static inline void +hidgl_add_triangle(triangle_buffer * buffer, GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, GLfloat x3, GLfloat y3) +{ + hidgl_add_triangle_3D(buffer, x1, y1, global_depth, x2, y2, global_depth, x3, y3, global_depth); +} + +void hidgl_draw_grid(BoxType * drawn_area); +void hidgl_set_depth(float depth); +void hidgl_draw_line(int cap, Coord width, Coord x1, Coord y1, Coord x2, Coord y2, double scale); +void hidgl_draw_arc(Coord width, Coord vx, Coord vy, Coord vrx, Coord vry, Angle start_angle, Angle delta_angle, double scale); +void hidgl_draw_rect(Coord x1, Coord y1, Coord x2, Coord y2); +void hidgl_fill_circle(Coord vx, Coord vy, Coord vr, double scale); +void hidgl_fill_polygon(int n_coords, Coord * x, Coord * y); +void hidgl_fill_pcb_polygon(PolygonType * poly, const BoxType * clip_box, double scale); +void hidgl_fill_rect(Coord x1, Coord y1, Coord x2, Coord y2); + +void hidgl_init(void); +int hidgl_stencil_bits(void); +int hidgl_assign_clear_stencil_bit(void); +void hidgl_return_stencil_bit(int bit); +void hidgl_reset_stencil_usage(void); + +#endif /* PCB_HID_COMMON_HIDGL_H */ Index: 1.0.8/src/hid/common/hidinit.c =================================================================== --- 1.0.8/src/hid/common/hidinit.c (nonexistent) +++ 1.0.8/src/hid/common/hidinit.c (revision 1136) @@ -0,0 +1,697 @@ +/* $Id$ */ + +#include "config.h" + +#include +#include +#include + +#ifdef HAVE_DLFCN_H +#include +#endif + +#include +#include +#include +#include + +#if defined(WIN32) && defined(HAVE_WINDOWS_H) +#include +#endif + +#include "global.h" +#include "hid.h" +#include "hidnogui.h" +#include "../hidint.h" + +/* for dlopen() and friends on windows */ +#include "compat.h" + +#include "error.h" +#include "global.h" +#include "misc.h" +#include "portability.h" /* MKDIR() */ +#include "pcb-printf.h" +#include "plugins.h" + + +RCSID("$Id$"); + +#define HID_DEF(x) extern void hid_ ## x ## _init(void); +#include "hid/common/hidlist.h" +#undef HID_DEF + +HID **hid_list = 0; +int hid_num_hids = 0; + +HID *gui = NULL; +HID *exporter = NULL; + +int pixel_slop = 1; + +static void hid_load_dir(char *dirname) +{ + DIR *dir; + struct dirent *de; + + dir = opendir(dirname); + if (!dir) { + free(dirname); + return; + } + while ((de = readdir(dir)) != NULL) { + void *sym; + void (*symv) (); + void *so; + char *basename, *path, *symname; + struct stat st; + + basename = strdup(de->d_name); + if (strlen(basename) > 3 && strcasecmp(basename + strlen(basename) - 3, ".so") == 0) + basename[strlen(basename) - 3] = 0; + else if (strlen(basename) > 4 && strcasecmp(basename + strlen(basename) - 4, ".dll") == 0) + basename[strlen(basename) - 4] = 0; + path = Concat(dirname, PCB_DIR_SEPARATOR_S, de->d_name, NULL); + + if (stat(path, &st) == 0 && ( +/* mingw and win32 do not support S_IXGRP or S_IXOTH */ +#if defined(S_IXGRP) + (st.st_mode & S_IXGRP) || +#endif +#if defined(S_IXOTH) + (st.st_mode & S_IXOTH) || +#endif + (st.st_mode & S_IXUSR)) + && S_ISREG(st.st_mode)) { + if ((so = dlopen(path, RTLD_NOW | RTLD_GLOBAL)) == NULL) { + fprintf(stderr, "dl_error: %s\n", dlerror()); + } + else { + symname = Concat("hid_", basename, "_init", NULL); + if ((sym = dlsym(so, symname)) != NULL) { + symv = (void (*)()) sym; + symv(); + } + else if ((sym = dlsym(so, "pcb_plugin_init")) != NULL) { + symv = (void (*)()) sym; + symv(); + } + plugin_register(basename, path, so, 1); + free(symname); + } + } + free(basename); + free(path); + } + free(dirname); +} + +void hid_init() +{ + /* Setup a "nogui" default HID */ + gui = hid_nogui_get_hid(); + +#define HID_DEF(x) hid_ ## x ## _init(); +#include "hid/common/hidlist.h" +#undef HID_DEF + + hid_load_dir(Concat(exec_prefix, PCB_DIR_SEPARATOR_S, "lib", + PCB_DIR_SEPARATOR_S, "pcb", PCB_DIR_SEPARATOR_S, "plugins", PCB_DIR_SEPARATOR_S, HOST, NULL)); + hid_load_dir(Concat(exec_prefix, PCB_DIR_SEPARATOR_S, "lib", + PCB_DIR_SEPARATOR_S, "pcb", PCB_DIR_SEPARATOR_S, "plugins", NULL)); + + /* homedir is set by the core immediately on startup */ + if (homedir != NULL) { + hid_load_dir(Concat(homedir, PCB_DIR_SEPARATOR_S, ".pcb", PCB_DIR_SEPARATOR_S, "plugins", PCB_DIR_SEPARATOR_S, HOST, NULL)); + hid_load_dir(Concat(homedir, PCB_DIR_SEPARATOR_S, ".pcb", PCB_DIR_SEPARATOR_S, "plugins", NULL)); + } + hid_load_dir(Concat("plugins", PCB_DIR_SEPARATOR_S, HOST, NULL)); + hid_load_dir(Concat("plugins", NULL)); +} + +void hid_register_hid(HID * hid) +{ + int i; + int sz = (hid_num_hids + 2) * sizeof(HID *); + + if (hid->struct_size != sizeof(HID)) { + fprintf(stderr, "Warning: hid \"%s\" has an incompatible ABI.\n", hid->name); + return; + } + + for (i = 0; i < hid_num_hids; i++) + if (hid == hid_list[i]) + return; + + hid_num_hids++; + if (hid_list) + hid_list = (HID **) realloc(hid_list, sz); + else + hid_list = (HID **) malloc(sz); + + hid_list[hid_num_hids - 1] = hid; + hid_list[hid_num_hids] = 0; +} + +void hid_remove_hid(HID * hid) +{ + int i; + + for (i = 0; i < hid_num_hids; i++) { + if (hid == hid_list[i]) { + hid_list[i] = hid_list[hid_num_hids - 1]; + hid_list[hid_num_hids - 1] = 0; + hid_num_hids--; + return; + } + } +} + + +HID *hid_find_gui(const char *preference) +{ + int i; + + if (preference != NULL) { + for (i = 0; i < hid_num_hids; i++) + if (!hid_list[i]->printer && !hid_list[i]->exporter && !strcmp(hid_list[i]->name, preference)) + return hid_list[i]; + return NULL; + } + + for (i = 0; i < hid_num_hids; i++) + if (!hid_list[i]->printer && !hid_list[i]->exporter) + return hid_list[i]; + + fprintf(stderr, "Error: No GUI available.\n"); + exit(1); +} + +HID *hid_find_printer() +{ + int i; + + for (i = 0; i < hid_num_hids; i++) + if (hid_list[i]->printer) + return hid_list[i]; + + return 0; +} + +HID *hid_find_exporter(const char *which) +{ + int i; + + for (i = 0; i < hid_num_hids; i++) + if (hid_list[i]->exporter && strcmp(which, hid_list[i]->name) == 0) + return hid_list[i]; + + fprintf(stderr, "Invalid exporter %s, available ones:", which); + for (i = 0; i < hid_num_hids; i++) + if (hid_list[i]->exporter) + fprintf(stderr, " %s", hid_list[i]->name); + fprintf(stderr, "\n"); + + return 0; +} + +HID **hid_enumerate() +{ + return hid_list; +} + +HID_AttrNode *hid_attr_nodes = 0; + +void hid_register_attributes(HID_Attribute * a, int n) +{ + HID_AttrNode *ha; + + /* printf("%d attributes registered\n", n); */ + ha = (HID_AttrNode *) malloc(sizeof(HID_AttrNode)); + ha->next = hid_attr_nodes; + hid_attr_nodes = ha; + ha->attributes = a; + ha->n = n; +} + +void hid_parse_command_line(int *argc, char ***argv) +{ + HID_AttrNode *ha; + int i, e, ok; + + (*argc)--; + (*argv)++; + + for (ha = hid_attr_nodes; ha; ha = ha->next) + for (i = 0; i < ha->n; i++) { + HID_Attribute *a = ha->attributes + i; + switch (a->type) { + case HID_Label: + break; + case HID_Integer: + if (a->value) + *(int *) a->value = a->default_val.int_value; + break; + case HID_Coord: + if (a->value) + *(Coord *) a->value = a->default_val.coord_value; + break; + case HID_Boolean: + if (a->value) + *(char *) a->value = a->default_val.int_value; + break; + case HID_Real: + if (a->value) + *(double *) a->value = a->default_val.real_value; + break; + case HID_String: + if (a->value) + *(const char **) a->value = a->default_val.str_value; + break; + case HID_Enum: + if (a->value) + *(int *) a->value = a->default_val.int_value; + break; + case HID_Mixed: + if (a->value) { + *(HID_Attr_Val *) a->value = a->default_val; + case HID_Unit: + if (a->value) + *(int *) a->value = a->default_val.int_value; + break; + } + break; + default: + abort(); + } + } + + while (*argc && (*argv)[0][0] == '-' && (*argv)[0][1] == '-') { + int bool_val; + int arg_ofs; + + bool_val = 1; + arg_ofs = 2; + try_no_arg: + for (ha = hid_attr_nodes; ha; ha = ha->next) + for (i = 0; i < ha->n; i++) + if (strcmp((*argv)[0] + arg_ofs, ha->attributes[i].name) == 0) { + HID_Attribute *a = ha->attributes + i; + char *ep; + const Unit *unit; + switch (ha->attributes[i].type) { + case HID_Label: + break; + case HID_Integer: + if (a->value) + *(int *) a->value = strtol((*argv)[1], 0, 0); + else + a->default_val.int_value = strtol((*argv)[1], 0, 0); + (*argc)--; + (*argv)++; + break; + case HID_Coord: + if (a->value) + *(Coord *) a->value = GetValue((*argv)[1], NULL, NULL); + else + a->default_val.coord_value = GetValue((*argv)[1], NULL, NULL); + (*argc)--; + (*argv)++; + break; + case HID_Real: + if (a->value) + *(double *) a->value = strtod((*argv)[1], 0); + else + a->default_val.real_value = strtod((*argv)[1], 0); + (*argc)--; + (*argv)++; + break; + case HID_String: + if (a->value) + *(char **) a->value = (*argv)[1]; + else + a->default_val.str_value = (*argv)[1]; + (*argc)--; + (*argv)++; + break; + case HID_Boolean: + if (a->value) + *(char *) a->value = bool_val; + else + a->default_val.int_value = bool_val; + break; + case HID_Mixed: + a->default_val.real_value = strtod((*argv)[1], &ep); + goto do_enum; + case HID_Enum: + ep = (*argv)[1]; + do_enum: + ok = 0; + for (e = 0; a->enumerations[e]; e++) + if (strcmp(a->enumerations[e], ep) == 0) { + ok = 1; + a->default_val.int_value = e; + a->default_val.str_value = ep; + break; + } + if (!ok) { + fprintf(stderr, "ERROR: \"%s\" is an unknown value for the --%s option\n", (*argv)[1], a->name); + exit(1); + } + (*argc)--; + (*argv)++; + break; + case HID_Path: + abort(); + a->default_val.str_value = (*argv)[1]; + (*argc)--; + (*argv)++; + break; + case HID_Unit: + unit = get_unit_struct((*argv)[1]); + if (unit == NULL) { + fprintf(stderr, "ERROR: unit \"%s\" is unknown to pcb (option --%s)\n", (*argv)[1], a->name); + exit(1); + } + a->default_val.int_value = unit->index; + a->default_val.str_value = unit->suffix; + (*argc)--; + (*argv)++; + break; + } + (*argc)--; + (*argv)++; + ha = 0; + goto got_match; + } + if (bool_val == 1 && strncmp((*argv)[0], "--no-", 5) == 0) { + bool_val = 0; + arg_ofs = 5; + goto try_no_arg; + } + fprintf(stderr, "unrecognized option: %s\n", (*argv)[0]); + exit(1); + got_match:; + } + + (*argc)++; + (*argv)--; +} + +static int attr_hash(HID_Attribute * a) +{ + unsigned char *cp = (unsigned char *) a; + int i, rv = 0; + for (i = 0; i < (int) ((char *) &(a->hash) - (char *) a); i++) + rv = (rv * 13) ^ (rv >> 16) ^ cp[i]; + return rv; +} + +void hid_save_settings(int locally) +{ + char *fname; + struct stat st; + FILE *f; + HID_AttrNode *ha; + int i; + + if (locally) { + fname = Concat("pcb.settings", NULL); + } + else { + if (homedir == NULL) + return; + fname = Concat(homedir, PCB_DIR_SEPARATOR_S, ".pcb", NULL); + + if (stat(fname, &st)) + if (MKDIR(fname, 0777)) { + free(fname); + return; + } + free(fname); + + fname = Concat(homedir, PCB_DIR_SEPARATOR_S, ".pcb", PCB_DIR_SEPARATOR_S, "settings", NULL); + } + + f = fopen(fname, "w"); + if (!f) { + Message("Can't open %s", fname); + free(fname); + return; + } + + for (ha = hid_attr_nodes; ha; ha = ha->next) { + for (i = 0; i < ha->n; i++) { + const char *str; + HID_Attribute *a = ha->attributes + i; + + if (a->hash == attr_hash(a)) + fprintf(f, "# "); + switch (a->type) { + case HID_Label: + break; + case HID_Integer: + fprintf(f, "%s = %d\n", a->name, a->value ? *(int *) a->value : a->default_val.int_value); + break; + case HID_Coord: + pcb_fprintf(f, "%s = %$mS\n", a->name, a->value ? *(Coord *) a->value : a->default_val.coord_value); + break; + case HID_Boolean: + fprintf(f, "%s = %d\n", a->name, a->value ? *(char *) a->value : a->default_val.int_value); + break; + case HID_Real: + fprintf(f, "%s = %f\n", a->name, a->value ? *(double *) a->value : a->default_val.real_value); + break; + case HID_String: + case HID_Path: + str = a->value ? *(char **) a->value : a->default_val.str_value; + fprintf(f, "%s = %s\n", a->name, str ? str : ""); + break; + case HID_Enum: + fprintf(f, "%s = %s\n", a->name, a->enumerations[a->value ? *(int *) a->value : a->default_val.int_value]); + break; + case HID_Mixed: + { + HID_Attr_Val *value = a->value ? (HID_Attr_Val *) a->value : &(a->default_val); + fprintf(f, "%s = %g%s\n", a->name, value->real_value, a->enumerations[value->int_value]); + } + break; + case HID_Unit: + fprintf(f, "%s = %s\n", a->name, get_unit_list()[a->value ? *(int *) a->value : a->default_val.int_value].suffix); + break; + } + } + fprintf(f, "\n"); + } + fclose(f); + free(fname); +} + +static void hid_set_attribute(char *name, char *value) +{ + const Unit *unit; + HID_AttrNode *ha; + int i, e, ok; + + for (ha = hid_attr_nodes; ha; ha = ha->next) + for (i = 0; i < ha->n; i++) + if (strcmp(name, ha->attributes[i].name) == 0) { + HID_Attribute *a = ha->attributes + i; + switch (ha->attributes[i].type) { + case HID_Label: + break; + case HID_Integer: + a->default_val.int_value = strtol(value, 0, 0); + break; + case HID_Coord: + a->default_val.coord_value = GetValue(value, NULL, NULL); + break; + case HID_Real: + a->default_val.real_value = strtod(value, 0); + break; + case HID_String: + a->default_val.str_value = strdup(value); + break; + case HID_Boolean: + a->default_val.int_value = 1; + break; + case HID_Mixed: + a->default_val.real_value = strtod(value, &value); + /* fall through */ + case HID_Enum: + ok = 0; + for (e = 0; a->enumerations[e]; e++) + if (strcmp(a->enumerations[e], value) == 0) { + ok = 1; + a->default_val.int_value = e; + a->default_val.str_value = value; + break; + } + if (!ok) { + fprintf(stderr, "ERROR: \"%s\" is an unknown value for the %s option\n", value, a->name); + exit(1); + } + break; + case HID_Path: + a->default_val.str_value = value; + break; + case HID_Unit: + unit = get_unit_struct(value); + if (unit == NULL) { + fprintf(stderr, "ERROR: unit \"%s\" is unknown to pcb (option --%s)\n", value, a->name); + exit(1); + } + a->default_val.int_value = unit->index; + a->default_val.str_value = unit->suffix; + break; + } + } +} + +static void hid_load_settings_1(char *fname) +{ + char line[1024], *namep, *valp, *cp; + FILE *f; + + f = fopen(fname, "r"); + if (!f) { + free(fname); + return; + } + + free(fname); + while (fgets(line, sizeof(line), f) != NULL) { + for (namep = line; *namep && isspace((int) *namep); namep++); + if (*namep == '#') + continue; + for (valp = namep; *valp && !isspace((int) *valp); valp++); + if (!*valp) + continue; + *valp++ = 0; + while (*valp && (isspace((int) *valp) || *valp == '=')) + valp++; + if (!*valp) + continue; + cp = valp + strlen(valp) - 1; + while (cp >= valp && isspace((int) *cp)) + *cp-- = 0; + hid_set_attribute(namep, valp); + } + + fclose(f); +} + +void hid_load_settings() +{ + HID_AttrNode *ha; + int i; + + for (ha = hid_attr_nodes; ha; ha = ha->next) + for (i = 0; i < ha->n; i++) + ha->attributes[i].hash = attr_hash(ha->attributes + i); + + hid_load_settings_1(Concat(pcblibdir, PCB_DIR_SEPARATOR_S, "settings", NULL)); + if (homedir != NULL) + hid_load_settings_1(Concat(homedir, PCB_DIR_SEPARATOR_S, ".pcb", PCB_DIR_SEPARATOR_S, "settings", NULL)); + hid_load_settings_1(Concat("pcb.settings", NULL)); +} + +#define HASH_SIZE 31 + +typedef struct ecache { + struct ecache *next; + const char *name; + hidval val; +} ecache; + +typedef struct ccache { + ecache *colors[HASH_SIZE]; + ecache *lru; +} ccache; + +static void copy_color(int set, hidval * cval, hidval * aval) +{ + if (set) + memcpy(cval, aval, sizeof(hidval)); + else + memcpy(aval, cval, sizeof(hidval)); +} + +int hid_cache_color(int set, const char *name, hidval * val, void **vcache) +{ + unsigned long hash; + const char *cp; + ccache *cache; + ecache *e; + + cache = (ccache *) * vcache; + if (cache == 0) { + cache = (ccache *) calloc(sizeof(ccache), 1); + *vcache = cache; + } + if (cache->lru && strcmp(cache->lru->name, name) == 0) { + copy_color(set, &(cache->lru->val), val); + return 1; + } + + /* djb2: this algorithm (k=33) was first reported by dan bernstein many + * years ago in comp.lang.c. another version of this algorithm (now favored + * by bernstein) uses xor: hash(i) = hash(i - 1) * 33 ^ str[i]; the magic + * of number 33 (why it works better than many other constants, prime or + * not) has never been adequately explained. + */ + hash = 5381; + for (cp = name, hash = 0; *cp; cp++) + hash = ((hash << 5) + hash) + (*cp & 0xff); /* hash * 33 + c */ + hash %= HASH_SIZE; + + for (e = cache->colors[hash]; e; e = e->next) + if (strcmp(e->name, name) == 0) { + copy_color(set, &(e->val), val); + cache->lru = e; + return 1; + } + if (!set) + return 0; + + e = (ecache *) malloc(sizeof(ecache)); + e->next = cache->colors[hash]; + cache->colors[hash] = e; + e->name = strdup(name); + memcpy(&(e->val), val, sizeof(hidval)); + cache->lru = e; + + return 1; +} + +/* otherwise homeless function, refactored out of the five export HIDs */ +void derive_default_filename(const char *pcbfile, HID_Attribute * filename_attrib, const char *suffix, char **memory) +{ + char *buf; + char *pf; + + if (pcbfile == NULL) + pf = strdup("unknown.pcb"); + else + pf = strdup(pcbfile); + + if (!pf || (memory && filename_attrib->default_val.str_value != *memory)) + return; + + buf = (char *) malloc(strlen(pf) + strlen(suffix) + 1); + if (memory) + *memory = buf; + if (buf) { + size_t bl; + strcpy(buf, pf); + bl = strlen(buf); + if (bl > 4 && strcmp(buf + bl - 4, ".pcb") == 0) + buf[bl - 4] = 0; + strcat(buf, suffix); + if (filename_attrib->default_val.str_value) + free((void *) filename_attrib->default_val.str_value); + filename_attrib->default_val.str_value = buf; + } + + free(pf); +} Index: 1.0.8/src/hid/common/hidinit.h =================================================================== --- 1.0.8/src/hid/common/hidinit.h (nonexistent) +++ 1.0.8/src/hid/common/hidinit.h (revision 1136) @@ -0,0 +1,6 @@ +#ifndef PCB_HID_COMMON_HIDINIT_H +#define PCB_HID_COMMON_HIDINIT_H + +void hid_parse_command_line(int *argc, char ***argv); + +#endif Index: 1.0.8/src/hid/common/hidlist.h.in =================================================================== --- 1.0.8/src/hid/common/hidlist.h.in (nonexistent) +++ 1.0.8/src/hid/common/hidlist.h.in (revision 1136) @@ -0,0 +1,8 @@ +print {/* Autogenerated by scconfig, do not edit */\n\n} +foreach h in /local/pcb/HIDS + print [@HID_DEF(@h@) +@] +end + + + Index: 1.0.8/src/hid/common/hidnogui.c =================================================================== --- 1.0.8/src/hid/common/hidnogui.c (nonexistent) +++ 1.0.8/src/hid/common/hidnogui.c (revision 1136) @@ -0,0 +1,460 @@ +/* $Id$ */ + +#include "config.h" + +#include +#include +#include +#include + +#include "global.h" +#include "hid.h" + + +RCSID("$Id$"); + +/* This is the "gui" that is installed at startup, and is used when + there is no other real GUI to use. For the most part, it just + stops the application from (1) crashing randomly, and (2) doing + gui-specific things when it shouldn't. */ + +#define CRASH fprintf(stderr, "HID error: pcb called GUI function %s without having a GUI available.\n", __FUNCTION__); abort() + +typedef struct hid_gc_struct { + int nothing_interesting_here; +} hid_gc_struct; + +static HID_Attribute *nogui_get_export_options(int *n_ret) +{ + CRASH; + return 0; +} + +static void nogui_do_export(HID_Attr_Val * options) +{ + CRASH; +} + +static void nogui_parse_arguments(int *argc, char ***argv) +{ + CRASH; +} + +static void nogui_invalidate_lr(int l, int r, int t, int b) +{ + CRASH; +} + +static void nogui_invalidate_all(void) +{ + CRASH; +} + +static int nogui_set_layer(const char *name, int idx, int empty) +{ + CRASH; + return 0; +} + +static void nogui_end_layer(void) +{ +} + +static hidGC nogui_make_gc(void) +{ + return 0; +} + +static void nogui_destroy_gc(hidGC gc) +{ +} + +static void nogui_use_mask(int use_it) +{ + CRASH; +} + +static void nogui_set_color(hidGC gc, const char *name) +{ + CRASH; +} + +static void nogui_set_line_cap(hidGC gc, EndCapStyle style) +{ + CRASH; +} + +static void nogui_set_line_width(hidGC gc, Coord width) +{ + CRASH; +} + +static void nogui_set_draw_xor(hidGC gc, int xor_) +{ + CRASH; +} + +static void nogui_set_draw_faded(hidGC gc, int faded) +{ +} + +static void nogui_draw_line(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ + CRASH; +} + +static void nogui_draw_arc(hidGC gc, Coord cx, Coord cy, Coord width, Coord height, Angle start_angle, Angle end_angle) +{ + CRASH; +} + +static void nogui_draw_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ + CRASH; +} + +static void nogui_fill_circle(hidGC gc, Coord cx, Coord cy, Coord radius) +{ + CRASH; +} + +static void nogui_fill_polygon(hidGC gc, int n_coords, Coord * x, Coord * y) +{ + CRASH; +} + +static void nogui_fill_pcb_polygon(hidGC gc, PolygonType * poly, const BoxType * clip_box) +{ + CRASH; +} + +static void nogui_fill_pcb_pad(hidGC gc, PadType * pad, bool clear, bool mask) +{ + CRASH; +} + +static void nogui_thindraw_pcb_pad(hidGC gc, PadType * pad, bool clear, bool mask) +{ + CRASH; +} + +static void nogui_fill_pcb_pv(hidGC fg_gc, hidGC bg_gc, PinType * pad, bool drawHole, bool mask) +{ + CRASH; +} + +static void nogui_thindraw_pcb_pv(hidGC fg_gc, hidGC bg_gc, PinType * pad, bool drawHole, bool mask) +{ + CRASH; +} + +static void nogui_fill_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ + CRASH; +} + +static void nogui_calibrate(double xval, double yval) +{ + CRASH; +} + +static int nogui_shift_is_pressed(void) +{ + /* This is called from FitCrosshairIntoGrid() when the board is loaded. */ + return 0; +} + +static int nogui_control_is_pressed(void) +{ + CRASH; + return 0; +} + +static int nogui_mod1_is_pressed(void) +{ + CRASH; + return 0; +} + +static void nogui_get_coords(const char *msg, Coord * x, Coord * y) +{ + CRASH; +} + +static void nogui_set_crosshair(int x, int y, int action) +{ +} + +static hidval nogui_add_timer(void (*func) (hidval user_data), unsigned long milliseconds, hidval user_data) +{ + hidval rv; + CRASH; + rv.lval = 0; + return rv; +} + +static void nogui_stop_timer(hidval timer) +{ + CRASH; +} + +static hidval +nogui_watch_file(int fd, unsigned int condition, void (*func) (hidval watch, int fd, unsigned int condition, hidval user_data), + hidval user_data) +{ + hidval rv; + CRASH; + rv.lval = 0; + return rv; +} + +static void nogui_unwatch_file(hidval watch) +{ + CRASH; +} + +static hidval nogui_add_block_hook(void (*func) (hidval data), hidval data) +{ + hidval rv; + CRASH; + rv.ptr = NULL; + return rv; +} + +static void nogui_stop_block_hook(hidval block_hook) +{ + CRASH; +} + +static void nogui_log(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); +} + +static void nogui_logv(const char *fmt, va_list ap) +{ + vprintf(fmt, ap); +} + +/* Return a line of user input text, stripped of any newline characters. + * Returns NULL if the user simply presses enter, or otherwise gives no input. + */ +#define MAX_LINE_LENGTH 1024 +static char *read_stdin_line(void) +{ + static char buf[MAX_LINE_LENGTH]; + char *s; + int i; + + s = fgets(buf, MAX_LINE_LENGTH, stdin); + if (s == NULL) { + printf("\n"); + return NULL; + } + + /* Strip any trailing newline characters */ + for (i = strlen(s) - 1; i >= 0; i--) + if (s[i] == '\r' || s[i] == '\n') + s[i] = '\0'; + + if (s[0] == '\0') + return NULL; + + return strdup(s); +} + +#undef MAX_LINE_LENGTH + +static int nogui_confirm_dialog(const char *msg, ...) +{ + char *answer; + int ret = 0; + bool valid_answer = false; + va_list args; + + do { + va_start(args, msg); + vprintf(msg, args); + va_end(args); + + printf(" ? 0=cancel 1 = ok : "); + + answer = read_stdin_line(); + + if (answer == NULL) + continue; + + if (answer[0] == '0' && answer[1] == '\0') { + ret = 0; + valid_answer = true; + } + + if (answer[0] == '1' && answer[1] == '\0') { + ret = 1; + valid_answer = true; + } + + free(answer); + } + while (!valid_answer); + return ret; +} + +static int nogui_close_confirm_dialog() +{ + return nogui_confirm_dialog(_("OK to lose data ?"), NULL); +} + +static void nogui_report_dialog(const char *title, const char *msg) +{ + printf("--- %s ---\n%s\n", title, msg); +} + +static char *nogui_prompt_for(const char *msg, const char *default_string) +{ + char *answer; + + if (default_string) + printf("%s [%s] : ", msg, default_string); + else + printf("%s : ", msg); + + answer = read_stdin_line(); + if (answer == NULL) + return strdup((default_string != NULL) ? default_string : ""); + else + return strdup(answer); +} + +/* FIXME - this could use some enhancement to actually use the other + args */ +static char *nogui_fileselect(const char *title, const char *descr, + char *default_file, char *default_ext, const char *history_tag, int flags) +{ + char *answer; + + if (default_file) + printf("%s [%s] : ", title, default_file); + else + printf("%s : ", title); + + answer = read_stdin_line(); + if (answer == NULL) + return (default_file != NULL) ? strdup(default_file) : NULL; + else + return strdup(answer); +} + +static int +nogui_attribute_dialog(HID_Attribute * attrs, int n_attrs, HID_Attr_Val * results, const char *title, const char *descr) +{ + CRASH; +} + +static void nogui_show_item(void *item) +{ + CRASH; +} + +static void nogui_beep(void) +{ + putchar(7); + fflush(stdout); +} + +static int nogui_progress(int so_far, int total, const char *message) +{ + return 0; +} + +static HID *nogui_request_debug_draw(void) +{ + return NULL; +} + +static void nogui_flush_debug_draw(void) +{ +} + +static void nogui_finish_debug_draw(void) +{ +} + +static void nogui_create_menu(const char *menu[], const char *action, const char *mnemonic, const char *accel, const char *tip) +{ +} + +void common_nogui_init(HID * hid) +{ + hid->get_export_options = nogui_get_export_options; + hid->do_export = nogui_do_export; + hid->parse_arguments = nogui_parse_arguments; + hid->invalidate_lr = nogui_invalidate_lr; + hid->invalidate_all = nogui_invalidate_all; + hid->set_layer = nogui_set_layer; + hid->end_layer = nogui_end_layer; + hid->make_gc = nogui_make_gc; + hid->destroy_gc = nogui_destroy_gc; + hid->use_mask = nogui_use_mask; + hid->set_color = nogui_set_color; + hid->set_line_cap = nogui_set_line_cap; + hid->set_line_width = nogui_set_line_width; + hid->set_draw_xor = nogui_set_draw_xor; + hid->set_draw_faded = nogui_set_draw_faded; + hid->draw_line = nogui_draw_line; + hid->draw_arc = nogui_draw_arc; + hid->draw_rect = nogui_draw_rect; + hid->fill_circle = nogui_fill_circle; + hid->fill_polygon = nogui_fill_polygon; + hid->fill_pcb_polygon = nogui_fill_pcb_polygon; + hid->fill_pcb_pad = nogui_fill_pcb_pad; + hid->thindraw_pcb_pad = nogui_thindraw_pcb_pad; + hid->fill_pcb_pv = nogui_fill_pcb_pv; + hid->thindraw_pcb_pv = nogui_thindraw_pcb_pv; + hid->fill_rect = nogui_fill_rect; + hid->calibrate = nogui_calibrate; + hid->shift_is_pressed = nogui_shift_is_pressed; + hid->control_is_pressed = nogui_control_is_pressed; + hid->mod1_is_pressed = nogui_mod1_is_pressed; + hid->get_coords = nogui_get_coords; + hid->set_crosshair = nogui_set_crosshair; + hid->add_timer = nogui_add_timer; + hid->stop_timer = nogui_stop_timer; + hid->watch_file = nogui_watch_file; + hid->unwatch_file = nogui_unwatch_file; + hid->add_block_hook = nogui_add_block_hook; + hid->stop_block_hook = nogui_stop_block_hook; + hid->log = nogui_log; + hid->logv = nogui_logv; + hid->confirm_dialog = nogui_confirm_dialog; + hid->close_confirm_dialog = nogui_close_confirm_dialog; + hid->report_dialog = nogui_report_dialog; + hid->prompt_for = nogui_prompt_for; + hid->fileselect = nogui_fileselect; + hid->attribute_dialog = nogui_attribute_dialog; + hid->show_item = nogui_show_item; + hid->beep = nogui_beep; + hid->progress = nogui_progress; + hid->request_debug_draw = nogui_request_debug_draw; + hid->flush_debug_draw = nogui_flush_debug_draw; + hid->finish_debug_draw = nogui_finish_debug_draw; + hid->create_menu = nogui_create_menu; +} + +static HID nogui_hid; + +HID *hid_nogui_get_hid(void) +{ + memset(&nogui_hid, 0, sizeof(HID)); + + nogui_hid.struct_size = sizeof(HID); + nogui_hid.name = "nogui"; + nogui_hid.description = "Default GUI when no other GUI is present. " "Does nothing."; + + common_nogui_init(&nogui_hid); + + return &nogui_hid; +} Index: 1.0.8/src/hid/common/hidnogui.h =================================================================== --- 1.0.8/src/hid/common/hidnogui.h (nonexistent) +++ 1.0.8/src/hid/common/hidnogui.h (revision 1136) @@ -0,0 +1,7 @@ +#ifndef PCB_HID_COMMON_HIDNOGUI_H +#define PCB_HID_COMMON_HIDNOGUI_H + +void common_nogui_init(HID * hid); +HID *hid_nogui_get_hid(void); + +#endif Index: 1.0.8/src/hid/gcode/auxiliary.h =================================================================== --- 1.0.8/src/hid/gcode/auxiliary.h (nonexistent) +++ 1.0.8/src/hid/gcode/auxiliary.h (revision 1136) @@ -0,0 +1,80 @@ +/* Copyright (C) 2001-2007 Peter Selinger. + This file is part of Potrace. It is free software and it is covered + by the GNU General Public License. See the file COPYING for details. */ + +/* This header file collects some general-purpose macros (and static + inline functions) that are used in various places. */ + +#ifndef AUXILIARY_H +#define AUXILIARY_H + +#include "config.h" + +/* ---------------------------------------------------------------------- */ +/* point arithmetic */ + +#include "potracelib.h" + +struct point_s { + long x; + long y; +}; +typedef struct point_s point_t; + +typedef potrace_dpoint_t dpoint_t; + +/* convert point_t to dpoint_t */ +static inline dpoint_t dpoint(point_t p) +{ + dpoint_t res; + res.x = p.x; + res.y = p.y; + return res; +} + +/* range over the straight line segment [a,b] when lambda ranges over [0,1] */ +static inline dpoint_t interval(double lambda, dpoint_t a, dpoint_t b) +{ + dpoint_t res; + + res.x = a.x + lambda * (b.x - a.x); + res.y = a.y + lambda * (b.y - a.y); + return res; +} + +/* ---------------------------------------------------------------------- */ +/* some useful macros. Note: the "mod" macro works correctly for + negative a. Also note that the test for a>=n, while redundant, + speeds up the mod function by 70% in the average case (significant + since the program spends about 16% of its time here - or 40% + without the test). The "floordiv" macro returns the largest integer + <= a/n, and again this works correctly for negative a, as long as + a,n are integers and n>0. */ + +/* integer arithmetic */ + +static inline int mod(int a, int n) +{ + return a >= n ? a % n : a >= 0 ? a : n - 1 - (-1 - a) % n; +} + +static inline int floordiv(int a, int n) +{ + return a >= 0 ? a / n : -1 - (-1 - a) / n; +} + +/* Note: the following work for integers and other numeric types. */ +#undef sign +#undef abs +#undef min +#undef max +#undef sq +#undef cu +#define sign(x) ((x)>0 ? 1 : (x)<0 ? -1 : 0) +#define abs(a) ((a)>0 ? (a) : -(a)) +#define min(a,b) ((a)<(b) ? (a) : (b)) +#define max(a,b) ((a)>(b) ? (a) : (b)) +#define sq(a) ((a)*(a)) +#define cu(a) ((a)*(a)*(a)) + +#endif /* AUXILIARY_H */ Index: 1.0.8/src/hid/gcode/bitmap.h =================================================================== --- 1.0.8/src/hid/gcode/bitmap.h (nonexistent) +++ 1.0.8/src/hid/gcode/bitmap.h (revision 1136) @@ -0,0 +1,104 @@ +/* Copyright (C) 2001-2007 Peter Selinger. + This file is part of Potrace. It is free software and it is covered + by the GNU General Public License. See the file COPYING for details. */ + +#ifndef BITMAP_H +#define BITMAP_H + +#include "config.h" + +#include +#include + +/* The bitmap type is defined in potracelib.h */ +#include "potracelib.h" + +/* The present file defines some convenient macros and static inline + functions for accessing bitmaps. Since they only produce inline + code, they can be conveniently shared by the library and frontends, + if desired */ + +/* ---------------------------------------------------------------------- */ +/* some measurements */ + +#define BM_WORDSIZE ((int)sizeof(potrace_word)) +#define BM_WORDBITS (8*BM_WORDSIZE) +#define BM_HIBIT (((potrace_word)1)<<(BM_WORDBITS-1)) +#define BM_ALLBITS (~(potrace_word)0) + +/* macros for accessing pixel at index (x,y). U* macros omit the + bounds check. */ + +#define bm_scanline(bm, y) ((bm)->map + (y)*(bm)->dy) +#define bm_index(bm, x, y) (&bm_scanline(bm, y)[(x)/BM_WORDBITS]) +#define bm_mask(x) (BM_HIBIT >> ((x) & (BM_WORDBITS-1))) +#define bm_range(x, a) ((int)(x) >= 0 && (int)(x) < (a)) +#define bm_safe(bm, x, y) (bm_range(x, (bm)->w) && bm_range(y, (bm)->h)) +#define BM_UGET(bm, x, y) ((*bm_index(bm, x, y) & bm_mask(x)) != 0) +#define BM_USET(bm, x, y) (*bm_index(bm, x, y) |= bm_mask(x)) +#define BM_UCLR(bm, x, y) (*bm_index(bm, x, y) &= ~bm_mask(x)) +#define BM_UINV(bm, x, y) (*bm_index(bm, x, y) ^= bm_mask(x)) +#define BM_UPUT(bm, x, y, b) ((b) ? BM_USET(bm, x, y) : BM_UCLR(bm, x, y)) +#define BM_GET(bm, x, y) (bm_safe(bm, x, y) ? BM_UGET(bm, x, y) : 0) +#define BM_SET(bm, x, y) (bm_safe(bm, x, y) ? BM_USET(bm, x, y) : 0) +#define BM_CLR(bm, x, y) (bm_safe(bm, x, y) ? BM_UCLR(bm, x, y) : 0) +#define BM_INV(bm, x, y) (bm_safe(bm, x, y) ? BM_UINV(bm, x, y) : 0) +#define BM_PUT(bm, x, y, b) (bm_safe(bm, x, y) ? BM_UPUT(bm, x, y, b) : 0) + +/* free the given bitmap. Leaves errno untouched. */ +static inline void bm_free(potrace_bitmap_t * bm) +{ + if (bm) { + free(bm->map); + } + free(bm); +} + +/* return new un-initialized bitmap. NULL with errno on error */ +static inline potrace_bitmap_t *bm_new(int w, int h) +{ + potrace_bitmap_t *bm; + int dy = (w + BM_WORDBITS - 1) / BM_WORDBITS; + + bm = (potrace_bitmap_t *) malloc(sizeof(potrace_bitmap_t)); + if (!bm) { + return NULL; + } + bm->w = w; + bm->h = h; + bm->dy = dy; + bm->map = (potrace_word *) malloc(dy * h * BM_WORDSIZE); + if (!bm->map) { + free(bm); + return NULL; + } + return bm; +} + +/* clear the given bitmap. Set all bits to c. */ +static inline void bm_clear(potrace_bitmap_t * bm, int c) +{ + memset(bm->map, c ? -1 : 0, bm->dy * bm->h * BM_WORDSIZE); +} + +/* duplicate the given bitmap. Return NULL on error with errno set. */ +static inline potrace_bitmap_t *bm_dup(const potrace_bitmap_t * bm) +{ + potrace_bitmap_t *bm1 = bm_new(bm->w, bm->h); + if (!bm1) { + return NULL; + } + memcpy(bm1->map, bm->map, bm->dy * bm->h * BM_WORDSIZE); + return bm1; +} + +/* invert the given bitmap. */ +static inline void bm_invert(potrace_bitmap_t * bm) +{ + int i; + for (i = 0; i < bm->dy * bm->h; i++) { + bm->map[i] ^= BM_ALLBITS; + } +} + +#endif /* BITMAP_H */ Index: 1.0.8/src/hid/gcode/curve.c =================================================================== --- 1.0.8/src/hid/gcode/curve.c (nonexistent) +++ 1.0.8/src/hid/gcode/curve.c (revision 1136) @@ -0,0 +1,114 @@ +/* Copyright (C) 2001-2007 Peter Selinger. + This file is part of Potrace. It is free software and it is covered + by the GNU General Public License. See the file COPYING for details. */ + +/* $Id: curve.c 147 2007-04-09 00:44:09Z selinger $ */ +/* private part of the path and curve data structures */ + +#include +#include +#include + +#include "potracelib.h" +#include "lists.h" +#include "curve.h" + +#define SAFE_MALLOC(var, n, typ) \ + if ((var = (typ *)malloc((n)*sizeof(typ))) == NULL) goto malloc_error + +/* ---------------------------------------------------------------------- */ +/* allocate and free path objects */ + +path_t *path_new(void) +{ + path_t *p = NULL; + privpath_t *priv = NULL; + + SAFE_MALLOC(p, 1, path_t); + memset(p, 0, sizeof(path_t)); + SAFE_MALLOC(priv, 1, privpath_t); + memset(priv, 0, sizeof(privpath_t)); + p->priv = priv; + return p; + +malloc_error: + free(p); + free(priv); + return NULL; +} + +/* free the members of the given curve structure. Leave errno unchanged. */ +static void privcurve_free_members(privcurve_t * curve) +{ + free(curve->tag); + free(curve->c); + free(curve->vertex); + free(curve->alpha); + free(curve->alpha0); + free(curve->beta); +} + +/* free a path. Leave errno untouched. */ +void path_free(path_t * p) +{ + if (p) { + if (p->priv) { + free(p->priv->pt); + free(p->priv->lon); + free(p->priv->sums); + free(p->priv->po); + privcurve_free_members(&p->priv->curve); + privcurve_free_members(&p->priv->ocurve); + } + free(p->priv); + /* do not free p->fcurve ! */ + } + free(p); +} + +/* free a pathlist, leaving errno untouched. */ +void pathlist_free(path_t * plist) +{ + path_t *p; + + list_forall_unlink(p, plist) { + path_free(p); + } +} + +/* ---------------------------------------------------------------------- */ +/* initialize and finalize curve structures */ + +typedef dpoint_t dpoint3_t[3]; + +/* initialize the members of the given curve structure to size m. + Return 0 on success, 1 on error with errno set. */ +int privcurve_init(privcurve_t * curve, int n) +{ + memset(curve, 0, sizeof(privcurve_t)); + curve->n = n; + SAFE_MALLOC(curve->tag, n, int); + SAFE_MALLOC(curve->c, n, dpoint3_t); + SAFE_MALLOC(curve->vertex, n, dpoint_t); + SAFE_MALLOC(curve->alpha, n, double); + SAFE_MALLOC(curve->alpha0, n, double); + SAFE_MALLOC(curve->beta, n, double); + return 0; + +malloc_error: + free(curve->tag); + free(curve->c); + free(curve->vertex); + free(curve->alpha); + free(curve->alpha0); + free(curve->beta); + return 1; +} + +/* copy private to public curve structure */ +void privcurve_to_curve(privcurve_t * pc, potrace_curve_t * c) +{ + c->n = pc->n; + c->tag = pc->tag; + c->c = pc->c; +} Index: 1.0.8/src/hid/gcode/curve.h =================================================================== --- 1.0.8/src/hid/gcode/curve.h (nonexistent) +++ 1.0.8/src/hid/gcode/curve.h (revision 1136) @@ -0,0 +1,76 @@ +/* Copyright (C) 2001-2007 Peter Selinger. + This file is part of Potrace. It is free software and it is covered + by the GNU General Public License. See the file COPYING for details. */ + +#ifndef CURVE_H +#define CURVE_H + +#include "auxiliary.h" + +/* vertex is c[1] for tag=POTRACE_CORNER, and the intersection of + .c[-1][2]..c[0] and c[1]..c[2] for tag=POTRACE_CURVETO. alpha is only + defined for tag=POTRACE_CURVETO and is the alpha parameter of the curve: + .c[-1][2]..c[0] = alpha*(.c[-1][2]..vertex), and + c[2]..c[1] = alpha*(c[2]..vertex). + Beta is so that (.beta[i])[.vertex[i],.vertex[i+1]] = .c[i][2]. +*/ + +struct privcurve_s { + int n; /* number of segments */ + int *tag; /* tag[n]: POTRACE_CORNER or POTRACE_CURVETO */ + dpoint_t(*c)[3]; /* c[n][i]: control points. + c[n][0] is unused for tag[n]=POTRACE_CORNER */ + /* the remainder of this structure is special to privcurve, and is + used in EPS debug output and special EPS "short coding". These + fields are valid only if "alphacurve" is set. */ + int alphacurve; /* have the following fields been initialized? */ + dpoint_t *vertex; /* for POTRACE_CORNER, this equals c[1] */ + double *alpha; /* only for POTRACE_CURVETO */ + double *alpha0; /* "uncropped" alpha parameter - for debug output only */ + double *beta; +}; +typedef struct privcurve_s privcurve_t; + +struct sums_s { + double x; + double y; + double x2; + double xy; + double y2; +}; +typedef struct sums_s sums_t; + +/* the path structure is filled in with information about a given path + as it is accumulated and passed through the different stages of the + Potrace algorithm. Backends only need to read the fcurve and fm + fields of this data structure, but debugging backends may read + other fields. */ +struct potrace_privpath_s { + int len; + point_t *pt; /* pt[len]: path as extracted from bitmap */ + int *lon; /* lon[len]: (i,lon[i]) = longest straight line from i */ + + int x0, y0; /* origin for sums */ + sums_t *sums; /* sums[len+1]: cache for fast summing */ + + int m; /* length of optimal polygon */ + int *po; /* po[m]: optimal polygon */ + + privcurve_t curve; /* curve[m]: array of curve elements */ + privcurve_t ocurve; /* ocurve[om]: array of curve elements */ + privcurve_t *fcurve; /* final curve: this points to either curve or + ocurve. Do not free this separately. */ +}; +typedef struct potrace_privpath_s potrace_privpath_t; + +/* shorter names */ +typedef potrace_privpath_t privpath_t; +typedef potrace_path_t path_t; + +path_t *path_new(void); +void path_free(path_t * p); +void pathlist_free(path_t * plist); +int privcurve_init(privcurve_t * curve, int n); +void privcurve_to_curve(privcurve_t * pc, potrace_curve_t * c); + +#endif /* CURVE_H */ Index: 1.0.8/src/hid/gcode/decompose.c =================================================================== --- 1.0.8/src/hid/gcode/decompose.c (nonexistent) +++ 1.0.8/src/hid/gcode/decompose.c (revision 1136) @@ -0,0 +1,525 @@ +/* Copyright (C) 2001-2007 Peter Selinger. + This file is part of Potrace. It is free software and it is covered + by the GNU General Public License. See the file COPYING for details. */ + +/* $Id: decompose.c 146 2007-04-09 00:43:46Z selinger $ */ + +#include +#include +#include +#include + +#include "potracelib.h" +#include "curve.h" +#include "lists.h" +#include "auxiliary.h" +#include "bitmap.h" +#include "decompose.h" +/*#include "progress.h"*/ + +/* ---------------------------------------------------------------------- */ +/* auxiliary bitmap manipulations */ + +/* set the excess padding to 0 */ +static void bm_clearexcess(potrace_bitmap_t * bm) +{ + potrace_word mask; + int y; + + if (bm->w % BM_WORDBITS != 0) { + mask = BM_ALLBITS << (BM_WORDBITS - (bm->w % BM_WORDBITS)); + for (y = 0; y < bm->h; y++) { + *bm_index(bm, bm->w, y) &= mask; + } + } +} + +struct bbox_s { + int x0, x1, y0, y1; /* bounding box */ +}; +typedef struct bbox_s bbox_t; + +/* clear the bm, assuming the bounding box is set correctly (faster + than clearing the whole bitmap) */ +static void clear_bm_with_bbox(potrace_bitmap_t * bm, bbox_t * bbox) +{ + int imin = (bbox->x0 / BM_WORDBITS); + int imax = ((bbox->x1 + BM_WORDBITS - 1) / BM_WORDBITS); + int i, y; + + for (y = bbox->y0; y < bbox->y1; y++) { + for (i = imin; i < imax; i++) { + bm_scanline(bm, y)[i] = 0; + } + } +} + +/* ---------------------------------------------------------------------- */ +/* auxiliary functions */ + +/* deterministically and efficiently hash (x,y) into a pseudo-random bit */ +static inline int detrand(int x, int y) +{ + unsigned int z; + static const unsigned char t[256] = { + /* non-linear sequence: constant term of inverse in GF(8), + mod x^8+x^4+x^3+x+1 */ + 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, + 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, + 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, + 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, + 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, + 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, + 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, + 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, + 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, + }; + + /* 0x04b3e375 and 0x05a8ef93 are chosen to contain every possible + 5-bit sequence */ + z = ((0x04b3e375 * x) ^ y) * 0x05a8ef93; + z = t[z & 0xff] ^ t[(z >> 8) & 0xff] ^ t[(z >> 16) & 0xff] ^ t[(z >> 24) & 0xff]; + return z & 1; +} + +/* return the "majority" value of bitmap bm at intersection (x,y). We + assume that the bitmap is balanced at "radius" 1. */ +static int majority(potrace_bitmap_t * bm, int x, int y) +{ + int i, a, ct; + + for (i = 2; i < 5; i++) { /* check at "radius" i */ + ct = 0; + for (a = -i + 1; a <= i - 1; a++) { + ct += BM_GET(bm, x + a, y + i - 1) ? 1 : -1; + ct += BM_GET(bm, x + i - 1, y + a - 1) ? 1 : -1; + ct += BM_GET(bm, x + a - 1, y - i) ? 1 : -1; + ct += BM_GET(bm, x - i, y + a) ? 1 : -1; + } + if (ct > 0) { + return 1; + } + else if (ct < 0) { + return 0; + } + } + return 0; +} + +/* ---------------------------------------------------------------------- */ +/* decompose image into paths */ + +/* efficiently invert bits [x,infty) and [xa,infty) in line y. Here xa + must be a multiple of BM_WORDBITS. */ +static void xor_to_ref(potrace_bitmap_t * bm, int x, int y, int xa) +{ + int xhi = x & -BM_WORDBITS; + int xlo = x & (BM_WORDBITS - 1); /* = x % BM_WORDBITS */ + int i; + + if (xhi < xa) { + for (i = xhi; i < xa; i += BM_WORDBITS) { + *bm_index(bm, i, y) ^= BM_ALLBITS; + } + } + else { + for (i = xa; i < xhi; i += BM_WORDBITS) { + *bm_index(bm, i, y) ^= BM_ALLBITS; + } + } + /* note: the following "if" is needed because x86 treats a<priv->len <= 0) { /* a path of length 0 is silly, but legal */ + return; + } + + y1 = p->priv->pt[p->priv->len - 1].y; + + xa = p->priv->pt[0].x & -BM_WORDBITS; + for (k = 0; k < p->priv->len; k++) { + x = p->priv->pt[k].x; + y = p->priv->pt[k].y; + + if (y != y1) { + /* efficiently invert the rectangle [x,xa] x [y,y1] */ + xor_to_ref(bm, x, min(y, y1), xa); + y1 = y; + } + } +} + +/* Find the bounding box of a given path. Path is assumed to be of + non-zero length. */ +static void setbbox_path(bbox_t * bbox, path_t * p) +{ + int x, y; + int k; + + bbox->y0 = INT_MAX; + bbox->y1 = 0; + bbox->x0 = INT_MAX; + bbox->x1 = 0; + + for (k = 0; k < p->priv->len; k++) { + x = p->priv->pt[k].x; + y = p->priv->pt[k].y; + + if (x < bbox->x0) { + bbox->x0 = x; + } + if (x > bbox->x1) { + bbox->x1 = x; + } + if (y < bbox->y0) { + bbox->y0 = y; + } + if (y > bbox->y1) { + bbox->y1 = y; + } + } +} + +/* compute a path in the given pixmap, separating black from white. + Start path at the point (x0,x1), which must be an upper left corner + of the path. Also compute the area enclosed by the path. Return a + new path_t object, or NULL on error (note that a legitimate path + cannot have length 0). Sign is required for correct interpretation + of turnpolicies. */ +static path_t *findpath(potrace_bitmap_t * bm, int x0, int y0, int sign, int turnpolicy) +{ + int x, y, dirx, diry, len, size, area; + int c, d, tmp; + point_t *pt, *pt1; + path_t *p = NULL; + + x = x0; + y = y0; + dirx = 0; + diry = -1; + + len = size = 0; + pt = NULL; + area = 0; + + while (1) { + /* add point to path */ + if (len >= size) { + size += 100; + size = (int) (1.3 * size); + pt1 = (point_t *) realloc(pt, size * sizeof(point_t)); + if (!pt1) { + goto error; + } + pt = pt1; + } + pt[len].x = x; + pt[len].y = y; + len++; + + /* move to next point */ + x += dirx; + y += diry; + area += x * diry; + + /* path complete? */ + if (x == x0 && y == y0) { + break; + } + + /* determine next direction */ + c = BM_GET(bm, x + (dirx + diry - 1) / 2, y + (diry - dirx - 1) / 2); + d = BM_GET(bm, x + (dirx - diry - 1) / 2, y + (diry + dirx - 1) / 2); + + if (c && !d) { /* ambiguous turn */ + if (turnpolicy == POTRACE_TURNPOLICY_RIGHT || (turnpolicy == POTRACE_TURNPOLICY_BLACK && sign == '+') + || (turnpolicy == POTRACE_TURNPOLICY_WHITE && sign == '-') + || (turnpolicy == POTRACE_TURNPOLICY_RANDOM && detrand(x, y)) + || (turnpolicy == POTRACE_TURNPOLICY_MAJORITY && majority(bm, x, y)) + || (turnpolicy == POTRACE_TURNPOLICY_MINORITY && !majority(bm, x, y))) { + tmp = dirx; /* right turn */ + dirx = diry; + diry = -tmp; + } + else { + tmp = dirx; /* left turn */ + dirx = -diry; + diry = tmp; + } + } + else if (c) { /* right turn */ + tmp = dirx; + dirx = diry; + diry = -tmp; + } + else if (!d) { /* left turn */ + tmp = dirx; + dirx = -diry; + diry = tmp; + } + } /* while this path */ + + /* allocate new path object */ + p = path_new(); + if (!p) { + goto error; + } + + p->priv->pt = pt; + p->priv->len = len; + p->area = area; + p->sign = sign; + + return p; + +error: + free(pt); + return NULL; +} + +/* Give a tree structure to the given path list, based on "insideness" + testing. I.e., path A is considered "below" path B if it is inside + path B. The input pathlist is assumed to be ordered so that "outer" + paths occur before "inner" paths. The tree structure is stored in + the "childlist" and "sibling" components of the path_t + structure. The linked list structure is also changed so that + negative path components are listed immediately after their + positive parent. Note: some backends may ignore the tree + structure, others may use it e.g. to group path components. We + assume that in the input, point 0 of each path is an "upper left" + corner of the path, as returned by bm_to_pathlist. This makes it + easy to find an "interior" point. The bm argument should be a + bitmap of the correct size (large enough to hold all the paths), + and will be used as scratch space. Return 0 on success or -1 on + error with errno set. */ + +static void pathlist_to_tree(path_t * plist, potrace_bitmap_t * bm) +{ + path_t *p, *p1; + path_t *heap, *heap1; + path_t *cur; + path_t *head; + path_t **hook, **hook_in, **hook_out; /* for fast appending to linked list */ + bbox_t bbox; + + bm_clear(bm, 0); + + /* save original "next" pointers */ + list_forall(p, plist) { + p->sibling = p->next; + p->childlist = NULL; + } + + heap = plist; + + /* the heap holds a list of lists of paths. Use "childlist" field + for outer list, "next" field for inner list. Each of the sublists + is to be turned into a tree. This code is messy, but it is + actually fast. Each path is rendered exactly once. We use the + heap to get a tail recursive algorithm: the heap holds a list of + pathlists which still need to be transformed. */ + + while (heap) { + /* unlink first sublist */ + cur = heap; + heap = heap->childlist; + cur->childlist = NULL; + + /* unlink first path */ + head = cur; + cur = cur->next; + head->next = NULL; + + /* render path */ + xor_path(bm, head); + setbbox_path(&bbox, head); + + /* now do insideness test for each element of cur; append it to + head->childlist if it's inside head, else append it to + head->next. */ + hook_in = &head->childlist; + hook_out = &head->next; + list_forall_unlink(p, cur) { + if (p->priv->pt[0].y <= bbox.y0) { + list_insert_beforehook(p, hook_out); + /* append the remainder of the list to hook_out */ + *hook_out = cur; + break; + } + if (BM_GET(bm, p->priv->pt[0].x, p->priv->pt[0].y - 1)) { + list_insert_beforehook(p, hook_in); + } + else { + list_insert_beforehook(p, hook_out); + } + } + + /* clear bm */ + clear_bm_with_bbox(bm, &bbox); + + /* now schedule head->childlist and head->next for further + processing */ + if (head->next) { + head->next->childlist = heap; + heap = head->next; + } + if (head->childlist) { + head->childlist->childlist = heap; + heap = head->childlist; + } + } + + /* copy sibling structure from "next" to "sibling" component */ + p = plist; + while (p) { + p1 = p->sibling; + p->sibling = p->next; + p = p1; + } + + /* reconstruct a new linked list ("next") structure from tree + ("childlist", "sibling") structure. This code is slightly messy, + because we use a heap to make it tail recursive: the heap + contains a list of childlists which still need to be + processed. */ + heap = plist; + if (heap) { + heap->next = NULL; /* heap is a linked list of childlists */ + } + plist = NULL; + hook = &plist; + while (heap) { + heap1 = heap->next; + for (p = heap; p; p = p->sibling) { + /* p is a positive path */ + /* append to linked list */ + list_insert_beforehook(p, hook); + + /* go through its children */ + for (p1 = p->childlist; p1; p1 = p1->sibling) { + /* append to linked list */ + list_insert_beforehook(p1, hook); + /* append its childlist to heap, if non-empty */ + if (p1->childlist) { + list_append(path_t, heap1, p1->childlist); + } + } + } + heap = heap1; + } + + return; +} + +/* find the next set pixel in a row <= y. Pixels are searched first + left-to-right, then top-down. In other words, (x,y)<(x',y') if y>y' + or y=y' and x= 0; y--) { + for (x = 0; x < bm->w; x += BM_WORDBITS) { + if (*bm_index(bm, x, y)) { + while (!BM_GET(bm, x, y)) { + x++; + } + /* found */ + *xp = x; + *yp = y; + return 0; + } + } + } + /* not found */ + return 1; +} + +/* Decompose the given bitmap into paths. Returns a linked list of + path_t objects with the fields len, pt, area, sign filled + in. Returns 0 on success with plistp set, or -1 on error with errno + set. */ + +int bm_to_pathlist(const potrace_bitmap_t * bm, path_t ** plistp, const potrace_param_t * param) +{ + int x; + int y; + path_t *p; + path_t *plist = NULL; /* linked list of path objects */ + path_t **hook = &plist; /* used to speed up appending to linked list */ + potrace_bitmap_t *bm1 = NULL; + int sign; + + bm1 = bm_dup(bm); + if (!bm1) { + goto error; + } + + /* be sure the byte padding on the right is set to 0, as the fast + pixel search below relies on it */ + bm_clearexcess(bm1); + + /* iterate through components */ + y = bm1->h - 1; + while (findnext(bm1, &x, &y) == 0) { + /* calculate the sign by looking at the original */ + sign = BM_GET(bm, x, y) ? '+' : '-'; + + /* calculate the path */ + p = findpath(bm1, x, y + 1, sign, param->turnpolicy); + if (p == NULL) { + goto error; + } + + /* update buffered image */ + xor_path(bm1, p); + + /* if it's a turd, eliminate it, else append it to the list */ + if (p->area <= param->turdsize) { + path_free(p); + } + else { + list_insert_beforehook(p, hook); + } + + if (bm1->h > 0) { /* to be sure */ + /*progress_update(1-y/(double)bm1->h, progress); */ + } + } + + pathlist_to_tree(plist, bm1); + bm_free(bm1); + *plistp = plist; + +/* progress_update(1.0, progress);*/ + + return 0; + +error: + bm_free(bm1); + list_forall_unlink(p, plist) { + path_free(p); + } + return -1; +} Index: 1.0.8/src/hid/gcode/decompose.h =================================================================== --- 1.0.8/src/hid/gcode/decompose.h (nonexistent) +++ 1.0.8/src/hid/gcode/decompose.h (revision 1136) @@ -0,0 +1,15 @@ +/* Copyright (C) 2001-2007 Peter Selinger. + This file is part of Potrace. It is free software and it is covered + by the GNU General Public License. See the file COPYING for details. */ + +/* $Id: decompose.h 147 2007-04-09 00:44:09Z selinger $ */ + +#ifndef DECOMPOSE_H +#define DECOMPOSE_H + +#include "potracelib.h" +/*#include "progress.h"*/ + +int bm_to_pathlist(const potrace_bitmap_t * bm, path_t ** plistp, const potrace_param_t * param); + +#endif /* DECOMPOSE_H */ Index: 1.0.8/src/hid/gcode/gcode.c =================================================================== --- 1.0.8/src/hid/gcode/gcode.c (nonexistent) +++ 1.0.8/src/hid/gcode/gcode.c (revision 1136) @@ -0,0 +1,897 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * + * GCODE export HID + * Copyright (C) 2010 Alberto Maccioni + * this code is based on the NELMA export HID, the PNG export HID, + * and potrace, a tracing program by Peter Selinger + * + * 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. + * + */ + +/* + * This HID exports a PCB layout into: + * one layer mask file (PNG format) per copper layer, + * one G-CODE CNC drill file. + * one G-CODE CNC file per copper layer. + * The latter is used by a CNC milling machine to mill the pcb. + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include + +#include "global.h" +#include "error.h" /* Message() */ +#include "data.h" +#include "misc.h" +#include "rats.h" + +#include "hid.h" +#include "../hidint.h" +#include +#include "hid/common/hidnogui.h" +#include "hid/common/draw_helpers.h" +#include "gcode.h" +#include "bitmap.h" +#include "curve.h" +#include "potracelib.h" +#include "trace.h" +#include "decompose.h" +#include "pcb-printf.h" + +#include "hid/common/hidinit.h" + + +#define CRASH fprintf(stderr, "HID error: pcb called unimplemented GCODE function %s.\n", __FUNCTION__); abort() +struct color_struct { + /* the descriptor used by the gd library */ + int c; + + /* so I can figure out what rgb value c refers to */ + unsigned int r, g, b; +}; + +struct hid_gc_struct { + HID *me_pointer; + EndCapStyle cap; + int width; + unsigned char r, g, b; + int erase; + int faded; + struct color_struct *color; + gdImagePtr brush; +}; + +static struct color_struct *black = NULL, *white = NULL; +static int linewidth = -1; +static gdImagePtr lastbrush = (gdImagePtr) ((void *) -1); +static int lastcolor = -1; + +/* gd image and file for PNG export */ +static gdImagePtr gcode_im = NULL; +static FILE *gcode_f = NULL, *gcode_f2 = NULL; + +static int is_mask; +static int is_drill; +static int is_solder; + +/* + * Which groups of layers to export into PNG layer masks. 1 means export, 0 + * means do not export. + */ +static int gcode_export_group[MAX_LAYER]; + +/* Group that is currently exported. */ +static int gcode_cur_group; + +/* Filename prefix that will be used when saving files. */ +static const char *gcode_basename = NULL; + +/* Horizontal DPI (grid points per inch) */ +static int gcode_dpi = -1; + +static double gcode_cutdepth = 0; /* milling depth (inch) */ +static double gcode_drilldepth = 0; /* drilling depth (inch) */ +static double gcode_safeZ = 100; /* safe Z (inch) */ +static double gcode_toolradius = 0; /* tool radius(inch) */ +static int save_drill = 0; +static int n_drill = 0; +static int nmax_drill = 0; +struct drill_struct { + double x; + double y; +}; + +static struct drill_struct *drill = 0; + +static const char *units[] = { + "mm", + "mil", + "um", + "inch", + NULL +}; + +HID_Attribute gcode_attribute_list[] = { + /* other HIDs expect this to be first. */ + {"basename", "File name prefix", + HID_String, 0, 0, {0, 0, 0}, 0, 0}, +#define HA_basename 0 + + {"dpi", "Resolution of intermediate image (pixels/inch)", + HID_Integer, 0, 2000, {600, 0, 0}, 0, 0}, +#define HA_dpi 1 + + {"mill-depth", "Milling depth", + HID_Real, -1000, 1000, {0, 0, -0.05}, 0, 0}, +#define HA_cutdepth 2 + + {"safe-Z", "Safe Z for traverse move", + HID_Real, -1000, 10000, {0, 0, 2}, 0, 0}, +#define HA_safeZ 3 + + {"tool-radius", "Milling tool radius compensation", + HID_Real, 0, 10000, {0, 0, 0.1}, 0, 0}, +#define HA_toolradius 4 + + {"drill-depth", "Drilling depth", + HID_Real, -10000, 10000, {0, 0, -2}, 0, 0}, +#define HA_drilldepth 5 + + {"measurement-unit", "Measurement unit", + HID_Unit, 0, 0, {-1, 0, 0}, units, 0}, +#define HA_unit 6 + +}; + +#define NUM_OPTIONS (sizeof(gcode_attribute_list)/sizeof(gcode_attribute_list[0])) + +REGISTER_ATTRIBUTES(gcode_attribute_list) + static HID_Attr_Val gcode_values[NUM_OPTIONS]; + +/* *** Utility funcions **************************************************** */ + +/* convert from default PCB units to gcode units */ + static int pcb_to_gcode(int pcb) +{ + return round(COORD_TO_INCH(pcb) * gcode_dpi); +} + +static char *gcode_get_png_name(const char *basename, const char *suffix) +{ + return g_strdup_printf("%s.%s.png", basename, suffix); +} + +/* Sorts drills in order of distance from the origin */ +struct drill_struct *sort_drill(struct drill_struct *drill, int n_drill) +{ + int i, j, imin; + double dmin, d; + struct drill_struct p = { 0, 0 }; + struct drill_struct *temp = (struct drill_struct *) malloc(n_drill * sizeof(struct drill_struct)); + for (j = 0; j < n_drill; j++) { + dmin = 1e20; + imin = 0; + for (i = 0; i < n_drill - j; i++) { + d = (drill[i].x - p.x) * (drill[i].x - p.x) + (drill[i].y - p.y) * (drill[i].y - p.y); + if (d < dmin) { + imin = i; + dmin = d; + } + } + /* printf("j=%d imin=%d dmin=%f p=(%f,%f)\n",j,imin,dmin,p.x,p.y); */ + temp[j] = drill[imin]; + drill[imin] = drill[n_drill - j - 1]; + p = temp[j]; + } + free(drill); + return temp; +} + +/* *** Main export callback ************************************************ */ + +static void gcode_parse_arguments(int *argc, char ***argv) +{ + hid_register_attributes(gcode_attribute_list, sizeof(gcode_attribute_list) / sizeof(gcode_attribute_list[0])); + hid_parse_command_line(argc, argv); +} + +static HID_Attribute *gcode_get_export_options(int *n) +{ + static char *last_made_filename = 0; + static int last_unit_value = -1; + + if (gcode_attribute_list[HA_unit].default_val.int_value == last_unit_value) { + if (Settings.grid_unit) + gcode_attribute_list[HA_unit].default_val.int_value = Settings.grid_unit->index; + else + gcode_attribute_list[HA_unit].default_val.int_value = get_unit_struct("mil")->index; + last_unit_value = gcode_attribute_list[HA_unit].default_val.int_value; + } + + if (PCB) { + derive_default_filename(PCB->Filename, &gcode_attribute_list[HA_basename], ".gcode", &last_made_filename); + } + if (n) { + *n = NUM_OPTIONS; + } + return gcode_attribute_list; +} + +/* Populates gcode_export_group array */ +void gcode_choose_groups() +{ + int n, m; + LayerType *layer; + + /* Set entire array to 0 (don't export any layer groups by default */ + memset(gcode_export_group, 0, sizeof(gcode_export_group)); + + for (n = 0; n < max_copper_layer; n++) { + layer = &PCB->Data->Layer[n]; + + if (layer->LineN || layer->TextN || layer->ArcN || layer->PolygonN) { + /* layer isn't empty */ + + /* + * is this check necessary? It seems that special + * layers have negative indexes? + */ + + if (SL_TYPE(n) == 0) { + /* layer is a copper layer */ + m = GetLayerGroupNumberByNumber(n); + + /* the export layer */ + gcode_export_group[m] = 1; + } + } + } +} + +static void gcode_alloc_colors() +{ + /* + * Allocate white and black -- the first color allocated becomes the + * background color + */ + + white = (struct color_struct *) malloc(sizeof(*white)); + white->r = white->g = white->b = 255; + white->c = gdImageColorAllocate(gcode_im, white->r, white->g, white->b); + + black = (struct color_struct *) malloc(sizeof(*black)); + black->r = black->g = black->b = 0; + black->c = gdImageColorAllocate(gcode_im, black->r, black->g, black->b); +} + +static void gcode_start_png(const char *basename, const char *suffix) +{ + int h, w; + char *buf; + + buf = gcode_get_png_name(basename, suffix); + + h = pcb_to_gcode(PCB->MaxHeight); + w = pcb_to_gcode(PCB->MaxWidth); + + /* Nelma only works with true color images */ + gcode_im = gdImageCreate(w, h); + gcode_f = fopen(buf, "wb"); + + gcode_alloc_colors(); + + free(buf); +} + +static void gcode_finish_png() +{ +#ifdef HAVE_GDIMAGEPNG + gdImagePng(gcode_im, gcode_f); +#else + Message("GCODE: PNG not supported by gd. Can't write layer mask.\n"); +#endif + gdImageDestroy(gcode_im); + fclose(gcode_f); + + free(white); + free(black); + + gcode_im = NULL; + gcode_f = NULL; +} + +void gcode_start_png_export() +{ + BoxType region; + + region.X1 = 0; + region.Y1 = 0; + region.X2 = PCB->MaxWidth; + region.Y2 = PCB->MaxHeight; + + linewidth = -1; + lastbrush = (gdImagePtr) ((void *) -1); + lastcolor = -1; + + hid_expose_callback(&gcode_hid, ®ion, 0); +} + +static void gcode_do_export(HID_Attr_Val * options) +{ + int save_ons[MAX_LAYER + 2]; + int i, idx; + time_t t; + const Unit *unit; + double scale = 0, d = 0; + int r, c, v, p, metric; + char *filename; + path_t *plist = NULL; + potrace_bitmap_t *bm = NULL; + potrace_param_t param_default = { + 2, /* turnsize */ + POTRACE_TURNPOLICY_MINORITY, /* turnpolicy */ + 1.0, /* alphamax */ + 1, /* opticurve */ + 0.2, /* opttolerance */ + { + NULL, /* callback function */ + NULL, /* callback data */ + 0.0, 1.0, /* progress range */ + 0.0, /* granularity */ + }, + }; + + if (!options) { + gcode_get_export_options(0); + for (i = 0; i < NUM_OPTIONS; i++) { + gcode_values[i] = gcode_attribute_list[i].default_val; + } + options = gcode_values; + } + gcode_basename = options[HA_basename].str_value; + if (!gcode_basename) { + gcode_basename = "pcb-out"; + } + gcode_dpi = options[HA_dpi].int_value; + if (gcode_dpi < 0) { + fprintf(stderr, "ERROR: dpi may not be < 0\n"); + return; + } + unit = &(get_unit_list()[options[HA_unit].int_value]); + metric = (unit->family == METRIC); + scale = metric ? 1.0 / coord_to_unit(unit, MM_TO_COORD(1.0)) + : 1.0 / coord_to_unit(unit, INCH_TO_COORD(1.0)); + + gcode_cutdepth = options[HA_cutdepth].real_value * scale; + gcode_drilldepth = options[HA_drilldepth].real_value * scale; + gcode_safeZ = options[HA_safeZ].real_value * scale; + gcode_toolradius = metric ? MM_TO_COORD(options[HA_toolradius].real_value * scale) + : INCH_TO_COORD(options[HA_toolradius].real_value * scale); + gcode_choose_groups(); + + for (i = 0; i < MAX_LAYER; i++) { + if (gcode_export_group[i]) { + + gcode_cur_group = i; + + /* magic */ + idx = (i >= 0 && i < max_group) ? PCB->LayerGroups.Entries[i][0] : i; + printf("idx=%d %s\n", idx, layer_type_to_file_name(idx, FNS_fixed)); + is_solder = (GetLayerGroupNumberByNumber(idx) == GetLayerGroupNumberByNumber(solder_silk_layer)) ? 1 : 0; + save_drill = is_solder; /* save drills for one layer only */ + gcode_start_png(gcode_basename, layer_type_to_file_name(idx, FNS_fixed)); + hid_save_and_show_layer_ons(save_ons); + gcode_start_png_export(); + hid_restore_layer_ons(save_ons); + +/* ***************** gcode conversion *************************** */ +/* potrace uses a different kind of bitmap; for simplicity gcode_im is copied to this format */ + bm = bm_new(gdImageSX(gcode_im), gdImageSY(gcode_im)); + filename = (char *) malloc(MAXPATHLEN); + plist = NULL; + if (is_solder) { /* only for back layer */ + gdImagePtr temp_im = gdImageCreate(gdImageSX(gcode_im), gdImageSY(gcode_im)); + gdImageCopy(temp_im, gcode_im, 0, 0, 0, 0, gdImageSX(gcode_im), gdImageSY(gcode_im)); + for (r = 0; r < gdImageSX(gcode_im); r++) { + for (c = 0; c < gdImageSY(gcode_im); c++) { + gdImageSetPixel(gcode_im, r, c, gdImageGetPixel(temp_im, gdImageSX(gcode_im) - 1 - r, c)); + } + } + gdImageDestroy(temp_im); + } + sprintf(filename, "%s.%s.cnc", gcode_basename, layer_type_to_file_name(idx, FNS_fixed)); + for (r = 0; r < gdImageSX(gcode_im); r++) { + for (c = 0; c < gdImageSY(gcode_im); c++) { + v = gdImageGetPixel(gcode_im, r, gdImageSY(gcode_im) - 1 - c); + p = (gcode_im->red[v] || gcode_im->green[v] + || gcode_im->blue[v]) ? 0 : 0xFFFFFF; + BM_PUT(bm, r, c, p); + } + } + gcode_f2 = fopen(filename, "wb"); + if (!gcode_f2) { + perror(filename); + return; + } + fprintf(gcode_f2, "(Created by G-code exporter)\n"); + t = time(NULL); + sprintf(filename, "%s", ctime(&t)); + filename[strlen(filename) - 1] = 0; + fprintf(gcode_f2, "( %s )\n", filename); + fprintf(gcode_f2, "(%d dpi)\n", gcode_dpi); + fprintf(gcode_f2, "(Unit: %s)\n", metric ? "mm" : "inch"); + if (metric) + pcb_fprintf(gcode_f2, "(Board size: %.2mmx%.2mm mm)", PCB->MaxWidth, PCB->MaxHeight); + else + pcb_fprintf(gcode_f2, "(Board size: %.2mix%.2mi inches)", PCB->MaxWidth, PCB->MaxHeight); + fprintf(gcode_f2, "#100=%f (safe Z)\n", gcode_safeZ); + fprintf(gcode_f2, "#101=%f (cutting depth)\n", gcode_cutdepth); + fprintf(gcode_f2, "(---------------------------------)\n"); + fprintf(gcode_f2, "G17 G%d G90 G64 P0.003 M3 S3000 M7 F%d\n", metric ? 21 : 20, metric ? 25 : 1); + fprintf(gcode_f2, "G0 Z#100\n"); + /* extract contour points from image */ + r = bm_to_pathlist(bm, &plist, ¶m_default); + if (r) { + fprintf(stderr, "ERROR: pathlist function failed\n"); + return; + } + /* generate best polygon and write vertices in g-code format */ + d = process_path(plist, ¶m_default, bm, gcode_f2, metric ? 25.4 / gcode_dpi : 1.0 / gcode_dpi); + if (d < 0) { + fprintf(stderr, "ERROR: path process function failed\n"); + return; + } + if (metric) + fprintf(gcode_f2, "(end, total distance %.2fmm = %.2fin)\n", d, d * 1 / 25.4); + else + fprintf(gcode_f2, "(end, total distance %.2fmm = %.2fin)\n", 25.4 * d, d); + fprintf(gcode_f2, "M5 M9 M2\n"); + pathlist_free(plist); + bm_free(bm); + fclose(gcode_f2); + if (save_drill) { + d = 0; + drill = sort_drill(drill, n_drill); + sprintf(filename, "%s.drill.cnc", gcode_basename); + gcode_f2 = fopen(filename, "wb"); + if (!gcode_f2) { + perror(filename); + return; + } + fprintf(gcode_f2, "(Created by G-code exporter)\n"); + fprintf(gcode_f2, "(drill file: %d drills)\n", n_drill); + sprintf(filename, "%s", ctime(&t)); + filename[strlen(filename) - 1] = 0; + fprintf(gcode_f2, "( %s )\n", filename); + fprintf(gcode_f2, "(Unit: %s)\n", metric ? "mm" : "inch"); + if (metric) + pcb_fprintf(gcode_f2, "(Board size: %.2mmx%.2mm mm)", PCB->MaxWidth, PCB->MaxHeight); + else + pcb_fprintf(gcode_f2, "(Board size: %.2mix%.2mi inches)", PCB->MaxWidth, PCB->MaxHeight); + fprintf(gcode_f2, "#100=%f (safe Z)\n", gcode_safeZ); + fprintf(gcode_f2, "#101=%f (drill depth)\n", gcode_drilldepth); + fprintf(gcode_f2, "(---------------------------------)\n"); + fprintf(gcode_f2, "G17 G%d G90 G64 P0.003 M3 S3000 M7 F%d\n", metric ? 21 : 20, metric ? 25 : 1); +/* fprintf(gcode_f2,"G0 Z#100\n"); */ + for (r = 0; r < n_drill; r++) { +/* if(metric) fprintf(gcode_f2,"G0 X%f Y%f\n",drill[r].x*25.4,drill[r].y*25.4); */ +/* else fprintf(gcode_f2,"G0 X%f Y%f\n",drill[r].x,drill[r].y); */ + if (metric) + fprintf(gcode_f2, "G81 X%f Y%f Z#101 R#100\n", drill[r].x * 25.4, drill[r].y * 25.4); + else + fprintf(gcode_f2, "G81 X%f Y%f Z#101 R#100\n", drill[r].x, drill[r].y); +/* fprintf(gcode_f2,"G1 Z#101\n"); */ +/* fprintf(gcode_f2,"G0 Z#100\n"); */ + if (r > 0) + d += + sqrt((drill[r].x - drill[r - 1].x) * (drill[r].x - + drill[r - 1].x) + + (drill[r].y - drill[r - 1].y) * (drill[r].y - drill[r - 1].y)); + } + fprintf(gcode_f2, "M5 M9 M2\n"); + fprintf(gcode_f2, "(end, total distance %.2fmm = %.2fin)\n", 25.4 * d, d); + fclose(gcode_f2); + free(drill); + drill = NULL; + n_drill = nmax_drill = 0; + } + free(filename); + +/* ******************* end gcode conversion **************************** */ + gcode_finish_png(); + } + } +} + +/* *** PNG export (slightly modified code from PNG export HID) ************* */ + +static int gcode_set_layer(const char *name, int group, int empty) +{ + int idx = (group >= 0 && group < max_group) ? PCB->LayerGroups.Entries[group][0] : group; + + if (name == 0) { + name = PCB->Data->Layer[idx].Name; + } + if (strcmp(name, "invisible") == 0) { + return 0; + } + is_drill = (SL_TYPE(idx) == SL_PDRILL || SL_TYPE(idx) == SL_UDRILL); + is_mask = (SL_TYPE(idx) == SL_MASK); + + if (is_mask) { + /* Don't print masks */ + return 0; + } + if (is_drill) { + /* + * Print 'holes', so that we can fill gaps in the copper + * layer + */ + return 1; + } + if (group == gcode_cur_group) { + return 1; + } + return 0; +} + +static hidGC gcode_make_gc(void) +{ + hidGC rv = (hidGC) malloc(sizeof(struct hid_gc_struct)); + rv->me_pointer = &gcode_hid; + rv->cap = Trace_Cap; + rv->width = 1; + rv->color = (struct color_struct *) malloc(sizeof(*rv->color)); + rv->color->r = rv->color->g = rv->color->b = 0; + rv->color->c = 0; + return rv; +} + +static void gcode_destroy_gc(hidGC gc) +{ + free(gc); +} + +static void gcode_use_mask(int use_it) +{ + /* does nothing */ +} + +static void gcode_set_color(hidGC gc, const char *name) +{ + if (gcode_im == NULL) { + return; + } + if (name == NULL) { + name = "#ff0000"; + } + if (!strcmp(name, "drill")) { + gc->color = black; + gc->erase = 0; + return; + } + if (!strcmp(name, "erase")) { + /* FIXME -- should be background, not white */ + gc->color = white; + gc->erase = 1; + return; + } + gc->color = black; + gc->erase = 0; + return; +} + +static void gcode_set_line_cap(hidGC gc, EndCapStyle style) +{ + gc->cap = style; +} + +static void gcode_set_line_width(hidGC gc, Coord width) +{ + gc->width = width; +} + +static void gcode_set_draw_xor(hidGC gc, int xor_) +{ + ; +} + +static void gcode_set_draw_faded(hidGC gc, int faded) +{ + gc->faded = faded; +} + +static void use_gc(hidGC gc) +{ + int need_brush = 0; + + if (gc->me_pointer != &gcode_hid) { + fprintf(stderr, "Fatal: GC from another HID passed to gcode HID\n"); + abort(); + } + if (linewidth != gc->width) { + /* Make sure the scaling doesn't erase lines completely */ + /* + if (SCALE (gc->width) == 0 && gc->width > 0) + gdImageSetThickness (im, 1); + else + */ + gdImageSetThickness(gcode_im, pcb_to_gcode(gc->width + 2 * gcode_toolradius)); + linewidth = gc->width; + need_brush = 1; + } + if (lastbrush != gc->brush || need_brush) { + static void *bcache = 0; + hidval bval; + char name[256]; + char type; + int r; + + switch (gc->cap) { + case Round_Cap: + case Trace_Cap: + type = 'C'; + r = pcb_to_gcode(gc->width / 2 + gcode_toolradius); + break; + default: + case Square_Cap: + r = pcb_to_gcode(gc->width + gcode_toolradius * 2); + type = 'S'; + break; + } + sprintf(name, "#%.2x%.2x%.2x_%c_%d", gc->color->r, gc->color->g, gc->color->b, type, r); + + if (hid_cache_color(0, name, &bval, &bcache)) { + gc->brush = (gdImagePtr) bval.ptr; + } + else { + int bg, fg; + if (type == 'C') + gc->brush = gdImageCreate(2 * r + 1, 2 * r + 1); + else + gc->brush = gdImageCreate(r + 1, r + 1); + bg = gdImageColorAllocate(gc->brush, 255, 255, 255); + fg = gdImageColorAllocate(gc->brush, gc->color->r, gc->color->g, gc->color->b); + gdImageColorTransparent(gc->brush, bg); + + /* + * if we shrunk to a radius/box width of zero, then just use + * a single pixel to draw with. + */ + if (r == 0) + gdImageFilledRectangle(gc->brush, 0, 0, 0, 0, fg); + else { + if (type == 'C') + gdImageFilledEllipse(gc->brush, r, r, 2 * r, 2 * r, fg); + else + gdImageFilledRectangle(gc->brush, 0, 0, r, r, fg); + } + bval.ptr = gc->brush; + hid_cache_color(1, name, &bval, &bcache); + } + + gdImageSetBrush(gcode_im, gc->brush); + lastbrush = gc->brush; + + } +#define CBLEND(gc) (((gc->r)<<24)|((gc->g)<<16)|((gc->b)<<8)|(gc->faded)) + if (lastcolor != CBLEND(gc)) { + if (is_drill || is_mask) { +#ifdef FIXME + fprintf(f, "%d gray\n", gc->erase ? 0 : 1); +#endif + lastcolor = 0; + } + else { + double r, g, b; + r = gc->r; + g = gc->g; + b = gc->b; + if (gc->faded) { + r = 0.8 * 255 + 0.2 * r; + g = 0.8 * 255 + 0.2 * g; + b = 0.8 * 255 + 0.2 * b; + } +#ifdef FIXME + if (gc->r == gc->g && gc->g == gc->b) + fprintf(f, "%g gray\n", r / 255.0); + else + fprintf(f, "%g %g %g rgb\n", r / 255.0, g / 255.0, b / 255.0); +#endif + lastcolor = CBLEND(gc); + } + } +} + +static void gcode_draw_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ + use_gc(gc); + gdImageRectangle(gcode_im, + pcb_to_gcode(x1 - gcode_toolradius), + pcb_to_gcode(y1 - gcode_toolradius), + pcb_to_gcode(x2 + gcode_toolradius), pcb_to_gcode(y2 + gcode_toolradius), gc->color->c); +/* printf("Rect %d %d %d %d\n",x1,y1,x2,y2); */ +} + +static void gcode_fill_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ + use_gc(gc); + gdImageSetThickness(gcode_im, 0); + linewidth = 0; + gdImageFilledRectangle(gcode_im, + pcb_to_gcode(x1 - gcode_toolradius), + pcb_to_gcode(y1 - gcode_toolradius), + pcb_to_gcode(x2 + gcode_toolradius), pcb_to_gcode(y2 + gcode_toolradius), gc->color->c); +/* printf("FillRect %d %d %d %d\n",x1,y1,x2,y2); */ +} + +static void gcode_draw_line(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ + if (x1 == x2 && y1 == y2) { + Coord w = gc->width / 2; + gcode_fill_rect(gc, x1 - w, y1 - w, x1 + w, y1 + w); + return; + } + use_gc(gc); + + gdImageSetThickness(gcode_im, 0); + linewidth = 0; + gdImageLine(gcode_im, pcb_to_gcode(x1), pcb_to_gcode(y1), pcb_to_gcode(x2), pcb_to_gcode(y2), gdBrushed); +} + +static void gcode_draw_arc(hidGC gc, Coord cx, Coord cy, Coord width, Coord height, Angle start_angle, Angle delta_angle) +{ + Angle sa, ea; + + /* + * in gdImageArc, 0 degrees is to the right and +90 degrees is down + * in pcb, 0 degrees is to the left and +90 degrees is down + */ + start_angle = 180 - start_angle; + delta_angle = -delta_angle; + if (delta_angle > 0) { + sa = start_angle; + ea = start_angle + delta_angle; + } + else { + sa = start_angle + delta_angle; + ea = start_angle; + } + + /* + * make sure we start between 0 and 360 otherwise gd does strange + * things + */ + sa = NormalizeAngle(sa); + ea = NormalizeAngle(ea); + +#if 0 + printf("draw_arc %d,%d %dx%d %d..%d %d..%d\n", cx, cy, width, height, start_angle, delta_angle, sa, ea); + printf("gdImageArc (%p, %d, %d, %d, %d, %d, %d, %d)\n", + im, SCALE_X(cx), SCALE_Y(cy), SCALE(width), SCALE(height), sa, ea, gc->color->c); +#endif + use_gc(gc); + gdImageSetThickness(gcode_im, 0); + linewidth = 0; + gdImageArc(gcode_im, pcb_to_gcode(cx), pcb_to_gcode(cy), + pcb_to_gcode(2 * width + gcode_toolradius * 2), + pcb_to_gcode(2 * height + gcode_toolradius * 2), sa, ea, gdBrushed); +} + +static void gcode_fill_circle(hidGC gc, Coord cx, Coord cy, Coord radius) +{ + use_gc(gc); + + gdImageSetThickness(gcode_im, 0); + linewidth = 0; + gdImageFilledEllipse(gcode_im, pcb_to_gcode(cx), pcb_to_gcode(cy), + pcb_to_gcode(2 * radius + gcode_toolradius * 2), + pcb_to_gcode(2 * radius + gcode_toolradius * 2), gc->color->c); + if (save_drill && is_drill) { + if (n_drill == nmax_drill) { + drill = (struct drill_struct *) realloc(drill, (nmax_drill + 100) * sizeof(struct drill_struct)); + nmax_drill += 100; + } + drill[n_drill].x = COORD_TO_INCH(PCB->MaxWidth - cx); /* convert to inch, flip: will drill from bottom side */ + drill[n_drill].y = COORD_TO_INCH(PCB->MaxHeight - cy); /* PCB reverses y axis */ + n_drill++; +/* printf("Circle %d %d\n",cx,cy); */ + } +} + +static void gcode_fill_polygon(hidGC gc, int n_coords, Coord * x, Coord * y) +{ + int i; + gdPoint *points; + + points = (gdPoint *) malloc(n_coords * sizeof(gdPoint)); + if (points == NULL) { + fprintf(stderr, "ERROR: gcode_fill_polygon(): malloc failed\n"); + exit(1); + } + use_gc(gc); + for (i = 0; i < n_coords; i++) { + points[i].x = pcb_to_gcode(x[i]); + points[i].y = pcb_to_gcode(y[i]); + } + gdImageSetThickness(gcode_im, 0); + linewidth = 0; + gdImageFilledPolygon(gcode_im, points, n_coords, gc->color->c); + free(points); +/* printf("FillPoly\n"); */ +} + +static void gcode_calibrate(double xval, double yval) +{ + CRASH; +} + +static void gcode_set_crosshair(int x, int y, int a) +{ +} + +/* *** Miscellaneous ******************************************************* */ + +#include "dolists.h" + +HID gcode_hid; + +void hid_gcode_init() +{ + memset(&gcode_hid, 0, sizeof(HID)); + + common_nogui_init(&gcode_hid); + common_draw_helpers_init(&gcode_hid); + + gcode_hid.struct_size = sizeof(HID); + gcode_hid.name = "gcode"; + gcode_hid.description = "G-CODE export"; + gcode_hid.exporter = 1; + gcode_hid.poly_before = 1; + + gcode_hid.get_export_options = gcode_get_export_options; + gcode_hid.do_export = gcode_do_export; + gcode_hid.parse_arguments = gcode_parse_arguments; + gcode_hid.set_layer = gcode_set_layer; + gcode_hid.make_gc = gcode_make_gc; + gcode_hid.destroy_gc = gcode_destroy_gc; + gcode_hid.use_mask = gcode_use_mask; + gcode_hid.set_color = gcode_set_color; + gcode_hid.set_line_cap = gcode_set_line_cap; + gcode_hid.set_line_width = gcode_set_line_width; + gcode_hid.set_draw_xor = gcode_set_draw_xor; + gcode_hid.set_draw_faded = gcode_set_draw_faded; + gcode_hid.draw_line = gcode_draw_line; + gcode_hid.draw_arc = gcode_draw_arc; + gcode_hid.draw_rect = gcode_draw_rect; + gcode_hid.fill_circle = gcode_fill_circle; + gcode_hid.fill_polygon = gcode_fill_polygon; + gcode_hid.fill_rect = gcode_fill_rect; + gcode_hid.calibrate = gcode_calibrate; + gcode_hid.set_crosshair = gcode_set_crosshair; + + hid_register_hid(&gcode_hid); +} Index: 1.0.8/src/hid/gcode/gcode.h =================================================================== --- 1.0.8/src/hid/gcode/gcode.h (nonexistent) +++ 1.0.8/src/hid/gcode/gcode.h (revision 1136) @@ -0,0 +1,3 @@ +/* $Id: nelma.h,v 1.2 2007/04/20 11:31:15 danmc Exp $ */ + +extern HID gcode_hid; Index: 1.0.8/src/hid/gcode/hid.conf =================================================================== --- 1.0.8/src/hid/gcode/hid.conf (nonexistent) +++ 1.0.8/src/hid/gcode/hid.conf (revision 1136) @@ -0,0 +1 @@ +type=export Index: 1.0.8/src/hid/gcode/lists.h =================================================================== --- 1.0.8/src/hid/gcode/lists.h (nonexistent) +++ 1.0.8/src/hid/gcode/lists.h (revision 1136) @@ -0,0 +1,285 @@ +/* Copyright (C) 2001-2007 Peter Selinger. + This file is part of Potrace. It is free software and it is covered + by the GNU General Public License. See the file COPYING for details. */ + +/* $Id: lists.h 147 2007-04-09 00:44:09Z selinger $ */ + +#ifndef PCB_HID_GCODE_LISTS_H +#define PCB_HID_GCODE_LISTS_H + +/* here we define some general list macros. Because they are macros, + they should work on any datatype with a "->next" component. Some of + them use a "hook". If elt and list are of type t* then hook is of + type t**. A hook stands for an insertion point in the list, i.e., + either before the first element, or between two elements, or after + the last element. If an operation "sets the hook" for an element, + then the hook is set to just before the element. One can insert + something at a hook. One can also unlink at a hook: this means, + unlink the element just after the hook. By "to unlink", we mean the + element is removed from the list, but not deleted. Thus, it and its + components still need to be freed. */ + +/* Note: these macros are somewhat experimental. Only the ones that + are actually *used* have been tested. So be careful to test any + that you use. Looking at the output of the preprocessor, "gcc -E" + (possibly piped though "indent"), might help too. Also: these + macros define some internal (local) variables that start with + "_". */ + +/* we enclose macro definitions whose body consists of more than one + statement in MACRO_BEGIN and MACRO_END, rather than '{' and '}'. The + reason is that we want to be able to use the macro in a context + such as "if (...) macro(...); else ...". If we didn't use this obscure + trick, we'd have to omit the ";" in such cases. */ + +#define MACRO_BEGIN do { +#define MACRO_END } while (0) + +/* ---------------------------------------------------------------------- */ +/* macros for singly-linked lists */ + +/* traverse list. At the end, elt is set to NULL. */ +#define list_forall(elt, list) for (elt=list; elt!=NULL; elt=elt->next) + +/* set elt to the first element of list satisfying boolean condition + c, or NULL if not found */ +#define list_find(elt, list, c) \ + MACRO_BEGIN list_forall(elt, list) if (c) break; MACRO_END + +/* like forall, except also set hook for elt. */ +#define list_forall2(elt, list, hook) \ + for (elt=list, hook=&list; elt!=NULL; hook=&elt->next, elt=elt->next) + +/* same as list_find, except also set hook for elt. */ +#define list_find2(elt, list, c, hook) \ + MACRO_BEGIN list_forall2(elt, list, hook) if (c) break; MACRO_END + +/* same, except only use hook. */ +#define _list_forall_hook(list, hook) \ + for (hook=&list; *hook!=NULL; hook=&(*hook)->next) + +/* same, except only use hook. Note: c may only refer to *hook, not elt. */ +#define _list_find_hook(list, c, hook) \ + MACRO_BEGIN _list_forall_hook(list, hook) if (c) break; MACRO_END + +/* insert element after hook */ +#define list_insert_athook(elt, hook) \ + MACRO_BEGIN elt->next = *hook; *hook = elt; MACRO_END + +/* insert element before hook */ +#define list_insert_beforehook(elt, hook) \ + MACRO_BEGIN elt->next = *hook; *hook = elt; hook=&elt->next; MACRO_END + +/* unlink element after hook, let elt be unlinked element, or NULL. + hook remains. */ +#define list_unlink_athook(list, elt, hook) \ + MACRO_BEGIN \ + elt = hook ? *hook : NULL; if (elt) { *hook = elt->next; elt->next = NULL; }\ + MACRO_END + +/* unlink the specific element, if it is in the list. Otherwise, set + elt to NULL */ +#define list_unlink(listtype, list, elt) \ + MACRO_BEGIN \ + listtype **_hook; \ + _list_find_hook(list, *_hook==elt, _hook); \ + list_unlink_athook(list, elt, _hook); \ + MACRO_END + +/* prepend elt to list */ +#define list_prepend(list, elt) \ + MACRO_BEGIN elt->next = list; list = elt; MACRO_END + +/* append elt to list. */ +#define list_append(listtype, list, elt) \ + MACRO_BEGIN \ + listtype **_hook; \ + _list_forall_hook(list, _hook) {} \ + list_insert_athook(elt, _hook); \ + MACRO_END + +/* unlink the first element that satisfies the condition. */ +#define list_unlink_cond(listtype, list, elt, c) \ + MACRO_BEGIN \ + listtype **_hook; \ + list_find2(elt, list, c, _hook); \ + list_unlink_athook(list, elt, _hook); \ + MACRO_END + +/* let elt be the nth element of the list, starting to count from 0. + Return NULL if out of bounds. */ +#define list_nth(elt, list, n) \ + MACRO_BEGIN \ + int _x; /* only evaluate n once */ \ + for (_x=(n), elt=list; _x && elt; _x--, elt=elt->next) {} \ + MACRO_END + +/* let elt be the nth element of the list, starting to count from 0. + Return NULL if out of bounds. */ +#define list_nth_hook(elt, list, n, hook) \ + MACRO_BEGIN \ + int _x; /* only evaluate n once */ \ + for (_x=(n), elt=list, hook=&list; _x && elt; _x--, hook=&elt->next, elt=elt->next) {} \ + MACRO_END + +/* set n to the length of the list */ +#define list_length(listtype, list, n) \ + MACRO_BEGIN \ + listtype *_elt; \ + n=0; \ + list_forall(_elt, list) \ + n++; \ + MACRO_END + +/* set n to the index of the first element satisfying cond, or -1 if + none found. Also set elt to the element, or NULL if none found. */ +#define list_index(list, n, elt, c) \ + MACRO_BEGIN \ + n=0; \ + list_forall(elt, list) { \ + if (c) break; \ + n++; \ + } \ + if (!elt) \ + n=-1; \ + MACRO_END + +/* set n to the number of elements in the list that satisfy condition c */ +#define list_count(list, n, elt, c) \ + MACRO_BEGIN \ + n=0; \ + list_forall(elt, list) { \ + if (c) n++; \ + } \ + MACRO_END + +/* let elt be each element of the list, unlinked. At the end, set list=NULL. */ +#define list_forall_unlink(elt, list) \ + for (elt=list; elt ? (list=elt->next, elt->next=NULL), 1 : 0; elt=list) + +/* reverse a list (efficient) */ +#define list_reverse(listtype, list) \ + MACRO_BEGIN \ + listtype *_list1=NULL, *elt; \ + list_forall_unlink(elt, list) \ + list_prepend(_list1, elt); \ + list = _list1; \ + MACRO_END + +/* insert the element ELT just before the first element TMP of the + list for which COND holds. Here COND must be a condition of ELT and + TMP. Typical usage is to insert an element into an ordered list: + for instance, list_insert_ordered(listtype, list, elt, tmp, + elt->size <= tmp->size). Note: if we give a "less than or equal" + condition, the new element will be inserted just before a sequence + of equal elements. If we give a "less than" condition, the new + element will be inserted just after a list of equal elements. + Note: it is much more efficient to construct a list with + list_prepend and then order it with list_merge_sort, than to + construct it with list_insert_ordered. */ +#define list_insert_ordered(listtype, list, elt, tmp, cond) \ + MACRO_BEGIN \ + listtype **_hook; \ + _list_find_hook(list, (tmp=*_hook, (cond)), _hook); \ + list_insert_athook(elt, _hook); \ + MACRO_END + +/* sort the given list, according to the comparison condition. + Typical usage is list_sort(listtype, list, a, b, a->size < + b->size). Note: if we give "less than or equal" condition, each + segment of equal elements will be reversed in order. If we give a + "less than" condition, each segment of equal elements will retain + the original order. The latter is slower but sometimes + prettier. Average running time: n*n/2. */ +#define list_sort(listtype, list, a, b, cond) \ + MACRO_BEGIN \ + listtype *_newlist=NULL; \ + list_forall_unlink(a, list) \ + list_insert_ordered(listtype, _newlist, a, b, cond); \ + list = _newlist; \ + MACRO_END + +/* a much faster sort algorithm (merge sort, n log n worst case). It + is required that the list type has an additional, unused next1 + component. Note there is no curious reversal of order of equal + elements as for list_sort. */ + +#define list_mergesort(listtype, list, a, b, cond) \ + MACRO_BEGIN \ + listtype *_elt, **_hook1; \ + \ + for (_elt=list; _elt; _elt=_elt->next1) { \ + _elt->next1 = _elt->next; \ + _elt->next = NULL; \ + } \ + do { \ + _hook1 = &(list); \ + while ((a = *_hook1) != NULL && (b = a->next1) != NULL ) { \ + _elt = b->next1; \ + _list_merge_cond(listtype, a, b, cond, *_hook1); \ + _hook1 = &((*_hook1)->next1); \ + *_hook1 = _elt; \ + } \ + } while (_hook1 != &(list)); \ + MACRO_END + +/* merge two sorted lists. Store result at &result */ +#define _list_merge_cond(listtype, a, b, cond, result) \ + MACRO_BEGIN \ + listtype **_hook; \ + _hook = &(result); \ + while (1) { \ + if (a==NULL) { \ + *_hook = b; \ + break; \ + } else if (b==NULL) { \ + *_hook = a; \ + break; \ + } else if (cond) { \ + *_hook = a; \ + _hook = &(a->next); \ + a = a->next; \ + } else { \ + *_hook = b; \ + _hook = &(b->next); \ + b = b->next; \ + } \ + } \ + MACRO_END + +/* ---------------------------------------------------------------------- */ +/* macros for doubly-linked lists */ + +#define dlist_append(head, end, elt) \ + MACRO_BEGIN \ + elt->prev = end; \ + elt->next = NULL; \ + if (end) { \ + end->next = elt; \ + } else { \ + head = elt; \ + } \ + end = elt; \ + MACRO_END + +/* let elt be each element of the list, unlinked. At the end, set list=NULL. */ +#define dlist_forall_unlink(elt, head, end) \ + for (elt=head; elt ? (head=elt->next, elt->next=NULL, elt->prev=NULL), 1 : (end=NULL, 0); elt=head) + +/* unlink the first element of the list */ +#define dlist_unlink_first(head, end, elt) \ + MACRO_BEGIN \ + elt = head; \ + if (head) { \ + head = head->next; \ + if (head) { \ + head->prev = NULL; \ + } else { \ + end = NULL; \ + } \ + elt->prev = NULL; \ + elt->next = NULL; \ + } \ + MACRO_END + +#endif /* PCB_HID_GCODE_LISTS_H */ Index: 1.0.8/src/hid/gcode/potracelib.h =================================================================== --- 1.0.8/src/hid/gcode/potracelib.h (nonexistent) +++ 1.0.8/src/hid/gcode/potracelib.h (revision 1136) @@ -0,0 +1,130 @@ +/* Copyright (C) 2001-2007 Peter Selinger. + This file is part of Potrace. It is free software and it is covered + by the GNU General Public License. See the file COPYING for details. */ + +#ifndef POTRACELIB_H +#define POTRACELIB_H + +/* this file defines the API for the core Potrace library. For a more + detailed description of the API, see doc/potracelib.txt */ + +/* ---------------------------------------------------------------------- */ +/* tracing parameters */ + +/* turn policies */ +#define POTRACE_TURNPOLICY_BLACK 0 +#define POTRACE_TURNPOLICY_WHITE 1 +#define POTRACE_TURNPOLICY_LEFT 2 +#define POTRACE_TURNPOLICY_RIGHT 3 +#define POTRACE_TURNPOLICY_MINORITY 4 +#define POTRACE_TURNPOLICY_MAJORITY 5 +#define POTRACE_TURNPOLICY_RANDOM 6 + +/* structure to hold progress bar callback data */ +struct potrace_progress_s { + void (*callback) (double progress, void *privdata); /* callback fn */ + void *data; /* callback function's private data */ + double min, max; /* desired range of progress, e.g. 0.0 to 1.0 */ + double epsilon; /* granularity: can skip smaller increments */ +}; +typedef struct potrace_progress_s potrace_progress_t; + +/* structure to hold tracing parameters */ +struct potrace_param_s { + int turdsize; /* area of largest path to be ignored */ + int turnpolicy; /* resolves ambiguous turns in path decomposition */ + double alphamax; /* corner threshold */ + int opticurve; /* use curve optimization? */ + double opttolerance; /* curve optimization tolerance */ + potrace_progress_t progress; /* progress callback function */ +}; +typedef struct potrace_param_s potrace_param_t; + +/* ---------------------------------------------------------------------- */ +/* bitmaps */ + +/* native word size */ +typedef unsigned long potrace_word; + +/* Internal bitmap format. The n-th scanline starts at scanline(n) = + (map + n*dy). Raster data is stored as a sequence of potrace_words + (NOT bytes). The leftmost bit of scanline n is the most significant + bit of scanline(n)[0]. */ +struct potrace_bitmap_s { + int w, h; /* width and height, in pixels */ + int dy; /* words per scanline (not bytes) */ + potrace_word *map; /* raw data, dy*h words */ +}; +typedef struct potrace_bitmap_s potrace_bitmap_t; + +/* ---------------------------------------------------------------------- */ +/* curves */ + +/* point */ +struct potrace_dpoint_s { + double x, y; +}; +typedef struct potrace_dpoint_s potrace_dpoint_t; + +/* segment tags */ +#define POTRACE_CURVETO 1 +#define POTRACE_CORNER 2 + +/* closed curve segment */ +struct potrace_curve_s { + int n; /* number of segments */ + int *tag; /* tag[n]: POTRACE_CURVETO or POTRACE_CORNER */ + potrace_dpoint_t(*c)[3]; /* c[n][3]: control points. + c[n][0] is unused for tag[n]=POTRACE_CORNER */ +}; +typedef struct potrace_curve_s potrace_curve_t; + +/* Linked list of signed curve segments. Also carries a tree structure. */ +struct potrace_path_s { + int area; /* area of the bitmap path */ + int sign; /* '+' or '-', depending on orientation */ + potrace_curve_t curve; /* this path's vector data */ + + struct potrace_path_s *next; /* linked list structure */ + + struct potrace_path_s *childlist; /* tree structure */ + struct potrace_path_s *sibling; /* tree structure */ + + struct potrace_privpath_s *priv; /* private state */ +}; +typedef struct potrace_path_s potrace_path_t; + +/* ---------------------------------------------------------------------- */ +/* Potrace state */ + +#define POTRACE_STATUS_OK 0 +#define POTRACE_STATUS_INCOMPLETE 1 + +struct potrace_state_s { + int status; + potrace_path_t *plist; /* vector data */ + + struct potrace_privstate_s *priv; /* private state */ +}; +typedef struct potrace_state_s potrace_state_t; + +/* ---------------------------------------------------------------------- */ +/* API functions */ + +/* get default parameters */ +potrace_param_t *potrace_param_default(void); + +/* free parameter set */ +void potrace_param_free(potrace_param_t * p); + +/* trace a bitmap*/ +potrace_state_t *potrace_trace(const potrace_param_t * param, const potrace_bitmap_t * bm); + +/* free a Potrace state */ +void potrace_state_free(potrace_state_t * st); + +/* return a static plain text version string identifying this version + of potracelib */ +char *potrace_version(void); + +#endif /* POTRACELIB_H */ Index: 1.0.8/src/hid/gcode/trace.c =================================================================== --- 1.0.8/src/hid/gcode/trace.c (nonexistent) +++ 1.0.8/src/hid/gcode/trace.c (revision 1136) @@ -0,0 +1,1292 @@ +/* This file was slightly modified by Alberto Maccioni to be used with PCB G-CODE exporter*/ + +/* Copyright (C) 2001-2007 Peter Selinger. + This file is part of Potrace. It is free software and it is covered + by the GNU General Public License. See the file COPYING for details. */ + +/* $Id: trace.c 147 2007-04-09 00:44:09Z selinger $ */ +/* transform jaggy paths into smooth curves */ + +#include +#include +#include +#include + +#include "global.h" +#include "potracelib.h" +#include "curve.h" +#include "lists.h" +#include "auxiliary.h" +#include "trace.h" +/*#include "progress.h"*/ + +#define INFTY 10000000 /* it suffices that this is longer than any + path; it need not be really infinite */ +#define COS179 -0.999847695156 /* the cosine of 179 degrees */ + +/* ---------------------------------------------------------------------- */ +#define SAFE_MALLOC(var, n, typ) \ + if ((var = (typ *)malloc((n)*sizeof(typ))) == NULL) goto malloc_error + +/* ---------------------------------------------------------------------- */ +/* auxiliary functions */ + +/* return a direction that is 90 degrees counterclockwise from p2-p0, + but then restricted to one of the major wind directions (n, nw, w, etc) */ +static inline point_t dorth_infty(dpoint_t p0, dpoint_t p2) +{ + point_t r; + + r.y = sign(p2.x - p0.x); + r.x = -sign(p2.y - p0.y); + + return r; +} + +/* return (p1-p0)x(p2-p0), the area of the parallelogram */ +static inline double dpara(dpoint_t p0, dpoint_t p1, dpoint_t p2) +{ + double x1, y1, x2, y2; + + x1 = p1.x - p0.x; + y1 = p1.y - p0.y; + x2 = p2.x - p0.x; + y2 = p2.y - p0.y; + + return x1 * y2 - x2 * y1; +} + +/* ddenom/dpara have the property that the square of radius 1 centered + at p1 intersects the line p0p2 iff |dpara(p0,p1,p2)| <= ddenom(p0,p2) */ +static inline double ddenom(dpoint_t p0, dpoint_t p2) +{ + point_t r = dorth_infty(p0, p2); + + return r.y * (p2.x - p0.x) - r.x * (p2.y - p0.y); +} + +/* return 1 if a <= b < c < a, in a cyclic sense (mod n) */ +static inline int cyclic(int a, int b, int c) +{ + if (a <= c) { + return (a <= b && b < c); + } + else { + return (a <= b || b < c); + } +} + +/* determine the center and slope of the line i..j. Assume ilen; + sums_t *sums = pp->sums; + + double x, y, x2, xy, y2; + double k; + double a, b, c, lambda2, l; + int r = 0; /* rotations from i to j */ + + while (j >= n) { + j -= n; + r += 1; + } + while (i >= n) { + i -= n; + r -= 1; + } + while (j < 0) { + j += n; + r -= 1; + } + while (i < 0) { + i += n; + r += 1; + } + + x = sums[j + 1].x - sums[i].x + r * sums[n].x; + y = sums[j + 1].y - sums[i].y + r * sums[n].y; + x2 = sums[j + 1].x2 - sums[i].x2 + r * sums[n].x2; + xy = sums[j + 1].xy - sums[i].xy + r * sums[n].xy; + y2 = sums[j + 1].y2 - sums[i].y2 + r * sums[n].y2; + k = j + 1 - i + r * n; + + ctr->x = x / k; + ctr->y = y / k; + + a = (x2 - (double) x * x / k) / k; + b = (xy - (double) x * y / k) / k; + c = (y2 - (double) y * y / k) / k; + + lambda2 = (a + c + sqrt((a - c) * (a - c) + 4 * b * b)) / 2; /* larger e.value */ + + /* now find e.vector for lambda2 */ + a -= lambda2; + c -= lambda2; + + if (fabs(a) >= fabs(c)) { + l = sqrt(a * a + b * b); + if (l != 0) { + dir->x = -b / l; + dir->y = a / l; + } + } + else { + l = sqrt(c * c + b * b); + if (l != 0) { + dir->x = -c / l; + dir->y = b / l; + } + } + if (l == 0) { + dir->x = dir->y = 0; /* sometimes this can happen when k=4: + the two eigenvalues coincide */ + } +} + +/* the type of (affine) quadratic forms, represented as symmetric 3x3 + matrices. The value of the quadratic form at a vector (x,y) is v^t + Q v, where v = (x,y,1)^t. */ +typedef double quadform_t[3][3]; + +/* Apply quadratic form Q to vector w = (w.x,w.y) */ +static inline double quadform(quadform_t Q, dpoint_t w) +{ + double v[3]; + int i, j; + double sum; + + v[0] = w.x; + v[1] = w.y; + v[2] = 1; + sum = 0.0; + + for (i = 0; i < 3; i++) { + for (j = 0; j < 3; j++) { + sum += v[i] * Q[i][j] * v[j]; + } + } + return sum; +} + +/* calculate p1 x p2 */ +static inline int xprod(point_t p1, point_t p2) +{ + return p1.x * p2.y - p1.y * p2.x; +} + +/* calculate (p1-p0)x(p3-p2) */ +static inline double cprod(dpoint_t p0, dpoint_t p1, dpoint_t p2, dpoint_t p3) +{ + double x1, y1, x2, y2; + + x1 = p1.x - p0.x; + y1 = p1.y - p0.y; + x2 = p3.x - p2.x; + y2 = p3.y - p2.y; + + return x1 * y2 - x2 * y1; +} + +/* calculate (p1-p0)*(p2-p0) */ +static inline double iprod(dpoint_t p0, dpoint_t p1, dpoint_t p2) +{ + double x1, y1, x2, y2; + + x1 = p1.x - p0.x; + y1 = p1.y - p0.y; + x2 = p2.x - p0.x; + y2 = p2.y - p0.y; + + return x1 * x2 + y1 * y2; +} + +/* calculate (p1-p0)*(p3-p2) */ +static inline double iprod1(dpoint_t p0, dpoint_t p1, dpoint_t p2, dpoint_t p3) +{ + double x1, y1, x2, y2; + + x1 = p1.x - p0.x; + y1 = p1.y - p0.y; + x2 = p3.x - p2.x; + y2 = p3.y - p2.y; + + return x1 * x2 + y1 * y2; +} + +/* calculate distance between two points */ +static inline double ddist(dpoint_t p, dpoint_t q) +{ + return sqrt(sq(p.x - q.x) + sq(p.y - q.y)); +} + +/* calculate point of a bezier curve */ +static inline dpoint_t bezier(double t, dpoint_t p0, dpoint_t p1, dpoint_t p2, dpoint_t p3) +{ + double s = 1 - t; + dpoint_t res; + + /* Note: a good optimizing compiler (such as gcc-3) reduces the + following to 16 multiplications, using common subexpression + elimination. */ + + res.x = s * s * s * p0.x + 3 * (s * s * t) * p1.x + 3 * (t * t * s) * p2.x + t * t * t * p3.x; + res.y = s * s * s * p0.y + 3 * (s * s * t) * p1.y + 3 * (t * t * s) * p2.y + t * t * t * p3.y; + + return res; +} + +/* calculate the point t in [0..1] on the (convex) bezier curve + (p0,p1,p2,p3) which is tangent to q1-q0. Return -1.0 if there is no + solution in [0..1]. */ +static double tangent(dpoint_t p0, dpoint_t p1, dpoint_t p2, dpoint_t p3, dpoint_t q0, dpoint_t q1) +{ + double A, B, C; /* (1-t)^2 A + 2(1-t)t B + t^2 C = 0 */ + double a, b, c; /* a t^2 + b t + c = 0 */ + double d, s, r1, r2; + + A = cprod(p0, p1, q0, q1); + B = cprod(p1, p2, q0, q1); + C = cprod(p2, p3, q0, q1); + + a = A - 2 * B + C; + b = -2 * A + 2 * B; + c = A; + + d = b * b - 4 * a * c; + + if (a == 0 || d < 0) { + return -1.0; + } + + s = sqrt(d); + + r1 = (-b + s) / (2 * a); + r2 = (-b - s) / (2 * a); + + if (r1 >= 0 && r1 <= 1) { + return r1; + } + else if (r2 >= 0 && r2 <= 1) { + return r2; + } + else { + return -1.0; + } +} + +/* ---------------------------------------------------------------------- */ +/* Preparation: fill in the sum* fields of a path (used for later + rapid summing). Return 0 on success, 1 with errno set on + failure. */ +static int calc_sums(privpath_t * pp) +{ + int i, x, y; + int n = pp->len; + + SAFE_MALLOC(pp->sums, pp->len + 1, sums_t); + + /* origin */ + pp->x0 = pp->pt[0].x; + pp->y0 = pp->pt[0].y; + + /* preparatory computation for later fast summing */ + pp->sums[0].x2 = pp->sums[0].xy = pp->sums[0].y2 = pp->sums[0].x = pp->sums[0].y = 0; + for (i = 0; i < n; i++) { + x = pp->pt[i].x - pp->x0; + y = pp->pt[i].y - pp->y0; + pp->sums[i + 1].x = pp->sums[i].x + x; + pp->sums[i + 1].y = pp->sums[i].y + y; + pp->sums[i + 1].x2 = pp->sums[i].x2 + x * x; + pp->sums[i + 1].xy = pp->sums[i].xy + x * y; + pp->sums[i + 1].y2 = pp->sums[i].y2 + y * y; + } + return 0; + +malloc_error: + return 1; +} + +/* ---------------------------------------------------------------------- */ +/* Stage 1: determine the straight subpaths (Sec. 2.2.1). Fill in the + "lon" component of a path object (based on pt/len). For each i, + lon[i] is the furthest index such that a straight line can be drawn + from i to lon[i]. Return 1 on error with errno set, else 0. */ + +/* this algorithm depends on the fact that the existence of straight + subpaths is a triplewise property. I.e., there exists a straight + line through squares i0,...,in iff there exists a straight line + through i,j,k, for all i0<=i= 0 and xprod(constraint[1], + cur) <= 0. */ + +/* Remark for Potrace 1.1: the current implementation of calc_lon is + more complex than the implementation found in Potrace 1.0, but it + is considerably faster. The introduction of the "nc" data structure + means that we only have to test the constraints for "corner" + points. On a typical input file, this speeds up the calc_lon + function by a factor of 31.2, thereby decreasing its time share + within the overall Potrace algorithm from 72.6% to 7.82%, and + speeding up the overall algorithm by a factor of 3.36. On another + input file, calc_lon was sped up by a factor of 6.7, decreasing its + time share from 51.4% to 13.61%, and speeding up the overall + algorithm by a factor of 1.78. In any case, the savings are + substantial. */ + +/* returns 0 on success, 1 on error with errno set */ +static int calc_lon(privpath_t * pp) +{ + point_t *pt = pp->pt; + int n = pp->len; + int i, j, k, k1; + int ct[4], dir; + point_t constraint[2]; + point_t cur; + point_t off; + int *pivk = NULL; /* pivk[n] */ + int *nc = NULL; /* nc[n]: next corner */ + point_t dk; /* direction of k-k1 */ + int a, b, c, d; + + SAFE_MALLOC(pivk, n, int); + SAFE_MALLOC(nc, n, int); + + /* initialize the nc data structure. Point from each point to the + furthest future point to which it is connected by a vertical or + horizontal segment. We take advantage of the fact that there is + always a direction change at 0 (due to the path decomposition + algorithm). But even if this were not so, there is no harm, as + in practice, correctness does not depend on the word "furthest" + above. */ + k = 0; + for (i = n - 1; i >= 0; i--) { + if (pt[i].x != pt[k].x && pt[i].y != pt[k].y) { + k = i + 1; /* necessarily ilon, n, int); + + /* determine pivot points: for each i, let pivk[i] be the furthest k + such that all j with i= 0; i--) { + ct[0] = ct[1] = ct[2] = ct[3] = 0; + + /* keep track of "directions" that have occurred */ + dir = (3 + 3 * (pt[mod(i + 1, n)].x - pt[i].x) + (pt[mod(i + 1, n)].y - pt[i].y)) / 2; + ct[dir]++; + + constraint[0].x = 0; + constraint[0].y = 0; + constraint[1].x = 0; + constraint[1].y = 0; + + /* find the next k such that no straight line from i to k */ + k = nc[i]; + k1 = i; + while (1) { + + dir = (3 + 3 * sign(pt[k].x - pt[k1].x) + sign(pt[k].y - pt[k1].y)) / 2; + ct[dir]++; + + /* if all four "directions" have occurred, cut this path */ + if (ct[0] && ct[1] && ct[2] && ct[3]) { + pivk[i] = k1; + goto foundk; + } + + cur.x = pt[k].x - pt[i].x; + cur.y = pt[k].y - pt[i].y; + + /* see if current constraint is violated */ + if (xprod(constraint[0], cur) < 0 || xprod(constraint[1], cur) > 0) { + goto constraint_viol; + } + + /* else, update constraint */ + if (abs(cur.x) <= 1 && abs(cur.y) <= 1) { + /* no constraint */ + } + else { + off.x = cur.x + ((cur.y >= 0 && (cur.y > 0 || cur.x < 0)) ? 1 : -1); + off.y = cur.y + ((cur.x <= 0 && (cur.x < 0 || cur.y < 0)) ? 1 : -1); + if (xprod(constraint[0], off) >= 0) { + constraint[0] = off; + } + off.x = cur.x + ((cur.y <= 0 && (cur.y < 0 || cur.x < 0)) ? 1 : -1); + off.y = cur.y + ((cur.x >= 0 && (cur.x > 0 || cur.y < 0)) ? 1 : -1); + if (xprod(constraint[1], off) <= 0) { + constraint[1] = off; + } + } + k1 = k; + k = nc[k1]; + if (!cyclic(k, i, k1)) { + break; + } + } + constraint_viol: + /* k1 was the last "corner" satisfying the current constraint, and + k is the first one violating it. We now need to find the last + point along k1..k which satisfied the constraint. */ + dk.x = sign(pt[k].x - pt[k1].x); + dk.y = sign(pt[k].y - pt[k1].y); + cur.x = pt[k1].x - pt[i].x; + cur.y = pt[k1].y - pt[i].y; + /* find largest integer j such that xprod(constraint[0], cur+j*dk) + >= 0 and xprod(constraint[1], cur+j*dk) <= 0. Use bilinearity + of xprod. */ + a = xprod(constraint[0], cur); + b = xprod(constraint[0], dk); + c = xprod(constraint[1], cur); + d = xprod(constraint[1], dk); + /* find largest integer j such that a+j*b>=0 and c+j*d<=0. This + can be solved with integer arithmetic. */ + j = INFTY; + if (b < 0) { + j = floordiv(a, -b); + } + if (d > 0) { + j = min(j, floordiv(-c, d)); + } + pivk[i] = mod(k1 + j, n); + foundk: + ; + } /* for i */ + + /* clean up: for each i, let lon[i] be the largest k such that for + all i' with i<=i'lon[n - 1] = j; + for (i = n - 2; i >= 0; i--) { + if (cyclic(i + 1, pivk[i], j)) { + j = pivk[i]; + } + pp->lon[i] = j; + } + + for (i = n - 1; cyclic(mod(i + 1, n), j, pp->lon[i]); i--) { + pp->lon[i] = j; + } + + free(pivk); + free(nc); + return 0; + +malloc_error: + free(pivk); + free(nc); + return 1; +} + + +/* ---------------------------------------------------------------------- */ +/* Stage 2: calculate the optimal polygon (Sec. 2.2.2-2.2.4). */ + +/* Auxiliary function: calculate the penalty of an edge from i to j in + the given path. This needs the "lon" and "sum*" data. */ + +static double penalty3(privpath_t * pp, int i, int j) +{ + int n = pp->len; + point_t *pt = pp->pt; + sums_t *sums = pp->sums; + + /* assume 0<=i= n) { + j -= n; + r += 1; + } + + x = sums[j + 1].x - sums[i].x + r * sums[n].x; + y = sums[j + 1].y - sums[i].y + r * sums[n].y; + x2 = sums[j + 1].x2 - sums[i].x2 + r * sums[n].x2; + xy = sums[j + 1].xy - sums[i].xy + r * sums[n].xy; + y2 = sums[j + 1].y2 - sums[i].y2 + r * sums[n].y2; + k = j + 1 - i + r * n; + + px = (pt[i].x + pt[j].x) / 2.0 - pt[0].x; + py = (pt[i].y + pt[j].y) / 2.0 - pt[0].y; + ey = (pt[j].x - pt[i].x); + ex = -(pt[j].y - pt[i].y); + + a = ((x2 - 2 * x * px) / k + px * px); + b = ((xy - x * py - y * px) / k + px * py); + c = ((y2 - 2 * y * py) / k + py * py); + + s = ex * ex * a + 2 * ex * ey * b + ey * ey * c; + + return sqrt(s); +} + +/* find the optimal polygon. Fill in the m and po components. Return 1 + on failure with errno set, else 0. Non-cyclic version: assumes i=0 + is in the polygon. Fixme: ### implement cyclic version. */ +static int bestpolygon(privpath_t * pp) +{ + int i, j, m, k; + int n = pp->len; + double *pen = NULL; /* pen[n+1]: penalty vector */ + int *prev = NULL; /* prev[n+1]: best path pointer vector */ + int *clip0 = NULL; /* clip0[n]: longest segment pointer, non-cyclic */ + int *clip1 = NULL; /* clip1[n+1]: backwards segment pointer, non-cyclic */ + int *seg0 = NULL; /* seg0[m+1]: forward segment bounds, m<=n */ + int *seg1 = NULL; /* seg1[m+1]: backward segment bounds, m<=n */ + double thispen; + double best; + int c; + + SAFE_MALLOC(pen, n + 1, double); + SAFE_MALLOC(prev, n + 1, int); + SAFE_MALLOC(clip0, n, int); + SAFE_MALLOC(clip1, n + 1, int); + SAFE_MALLOC(seg0, n + 1, int); + SAFE_MALLOC(seg1, n + 1, int); + + /* calculate clipped paths */ + for (i = 0; i < n; i++) { + c = mod(pp->lon[mod(i - 1, n)] - 1, n); + if (c == i) { + c = mod(i + 1, n); + } + if (c < i) { + clip0[i] = n; + } + else { + clip0[i] = c; + } + } + + /* calculate backwards path clipping, non-cyclic. j <= clip0[i] iff + clip1[j] <= i, for i,j=0..n. */ + j = 1; + for (i = 0; i < n; i++) { + while (j <= clip0[i]) { + clip1[j] = i; + j++; + } + } + + /* calculate seg0[j] = longest path from 0 with j segments */ + i = 0; + for (j = 0; i < n; j++) { + seg0[j] = i; + i = clip0[i]; + } + seg0[j] = n; + m = j; + + /* calculate seg1[j] = longest path to n with m-j segments */ + i = n; + for (j = m; j > 0; j--) { + seg1[j] = i; + i = clip1[i]; + } + seg1[0] = 0; + + /* now find the shortest path with m segments, based on penalty3 */ + /* note: the outer 2 loops jointly have at most n interations, thus + the worst-case behavior here is quadratic. In practice, it is + close to linear since the inner loop tends to be short. */ + pen[0] = 0; + for (j = 1; j <= m; j++) { + for (i = seg1[j]; i <= seg0[j]; i++) { + best = -1; + for (k = seg0[j - 1]; k >= clip1[i]; k--) { + thispen = penalty3(pp, k, i) + pen[k]; + if (best < 0 || thispen < best) { + prev[i] = k; + best = thispen; + } + } + pen[i] = best; + } + } + + pp->m = m; + SAFE_MALLOC(pp->po, m, int); + + /* read off shortest path */ + for (i = n, j = m - 1; i > 0; j--) { + i = prev[i]; + pp->po[j] = i; + } + + free(pen); + free(prev); + free(clip0); + free(clip1); + free(seg0); + free(seg1); + return 0; + +malloc_error: + free(pen); + free(prev); + free(clip0); + free(clip1); + free(seg0); + free(seg1); + return 1; +} + +/* ---------------------------------------------------------------------- */ +/* Stage 3: vertex adjustment (Sec. 2.3.1). */ + +/* Adjust vertices of optimal polygon: calculate the intersection of + the two "optimal" line segments, then move it into the unit square + if it lies outside. Return 1 with errno set on error; 0 on + success. */ + +static int adjust_vertices(privpath_t * pp) +{ + int m = pp->m; + int *po = pp->po; + int n = pp->len; + point_t *pt = pp->pt; + int x0 = pp->x0; + int y0 = pp->y0; + + dpoint_t *ctr = NULL; /* ctr[m] */ + dpoint_t *dir = NULL; /* dir[m] */ + quadform_t *q = NULL; /* q[m] */ + double v[3]; + double d; + int i, j, k, l; + dpoint_t s; + int r; + + SAFE_MALLOC(ctr, m, dpoint_t); + SAFE_MALLOC(dir, m, dpoint_t); + SAFE_MALLOC(q, m, quadform_t); + + r = privcurve_init(&pp->curve, m); + if (r) { + goto malloc_error; + } + + /* calculate "optimal" point-slope representation for each line + segment */ + for (i = 0; i < m; i++) { + j = po[mod(i + 1, m)]; + j = mod(j - po[i], n) + po[i]; + pointslope(pp, po[i], j, &ctr[i], &dir[i]); + } + + /* represent each line segment as a singular quadratic form; the + distance of a point (x,y) from the line segment will be + (x,y,1)Q(x,y,1)^t, where Q=q[i]. */ + for (i = 0; i < m; i++) { + d = sq(dir[i].x) + sq(dir[i].y); + if (d == 0.0) { + for (j = 0; j < 3; j++) { + for (k = 0; k < 3; k++) { + q[i][j][k] = 0; + } + } + } + else { + v[0] = dir[i].y; + v[1] = -dir[i].x; + v[2] = -v[1] * ctr[i].y - v[0] * ctr[i].x; + for (l = 0; l < 3; l++) { + for (k = 0; k < 3; k++) { + q[i][l][k] = v[l] * v[k] / d; + } + } + } + } + + /* now calculate the "intersections" of consecutive segments. + Instead of using the actual intersection, we find the point + within a given unit square which minimizes the square distance to + the two lines. */ + for (i = 0; i < m; i++) { + quadform_t Q; + dpoint_t w; + double dx, dy; + double det; + double min, cand; /* minimum and candidate for minimum of quad. form */ + double xmin, ymin; /* coordinates of minimum */ + int z; + + /* let s be the vertex, in coordinates relative to x0/y0 */ + s.x = pt[po[i]].x - x0; + s.y = pt[po[i]].y - y0; + + /* intersect segments i-1 and i */ + + j = mod(i - 1, m); + + /* add quadratic forms */ + for (l = 0; l < 3; l++) { + for (k = 0; k < 3; k++) { + Q[l][k] = q[j][l][k] + q[i][l][k]; + } + } + + while (1) { + /* minimize the quadratic form Q on the unit square */ + /* find intersection */ + +#ifdef HAVE_GCC_LOOP_BUG + /* work around gcc bug #12243 */ + free(NULL); +#endif + + det = Q[0][0] * Q[1][1] - Q[0][1] * Q[1][0]; + if (det != 0.0) { + w.x = (-Q[0][2] * Q[1][1] + Q[1][2] * Q[0][1]) / det; + w.y = (Q[0][2] * Q[1][0] - Q[1][2] * Q[0][0]) / det; + break; + } + + /* matrix is singular - lines are parallel. Add another, + orthogonal axis, through the center of the unit square */ + if (Q[0][0] > Q[1][1]) { + v[0] = -Q[0][1]; + v[1] = Q[0][0]; + } + else if (Q[1][1]) { + v[0] = -Q[1][1]; + v[1] = Q[1][0]; + } + else { + v[0] = 1; + v[1] = 0; + } + d = sq(v[0]) + sq(v[1]); + v[2] = -v[1] * s.y - v[0] * s.x; + for (l = 0; l < 3; l++) { + for (k = 0; k < 3; k++) { + Q[l][k] += v[l] * v[k] / d; + } + } + } + dx = fabs(w.x - s.x); + dy = fabs(w.y - s.y); + if (dx <= .5 && dy <= .5) { + pp->curve.vertex[i].x = w.x + x0; + pp->curve.vertex[i].y = w.y + y0; + continue; + } + + /* the minimum was not in the unit square; now minimize quadratic + on boundary of square */ + min = quadform(Q, s); + xmin = s.x; + ymin = s.y; + + if (Q[0][0] == 0.0) { + goto fixx; + } + for (z = 0; z < 2; z++) { /* value of the y-coordinate */ + w.y = s.y - 0.5 + z; + w.x = -(Q[0][1] * w.y + Q[0][2]) / Q[0][0]; + dx = fabs(w.x - s.x); + cand = quadform(Q, w); + if (dx <= .5 && cand < min) { + min = cand; + xmin = w.x; + ymin = w.y; + } + } + fixx: + if (Q[1][1] == 0.0) { + goto corners; + } + for (z = 0; z < 2; z++) { /* value of the x-coordinate */ + w.x = s.x - 0.5 + z; + w.y = -(Q[1][0] * w.x + Q[1][2]) / Q[1][1]; + dy = fabs(w.y - s.y); + cand = quadform(Q, w); + if (dy <= .5 && cand < min) { + min = cand; + xmin = w.x; + ymin = w.y; + } + } + corners: + /* check four corners */ + for (l = 0; l < 2; l++) { + for (k = 0; k < 2; k++) { + w.x = s.x - 0.5 + l; + w.y = s.y - 0.5 + k; + cand = quadform(Q, w); + if (cand < min) { + min = cand; + xmin = w.x; + ymin = w.y; + } + } + } + + pp->curve.vertex[i].x = xmin + x0; + pp->curve.vertex[i].y = ymin + y0; + continue; + } + + free(ctr); + free(dir); + free(q); + return 0; + +malloc_error: + free(ctr); + free(dir); + free(q); + return 1; +} + +/* ---------------------------------------------------------------------- */ +/* Stage 4: smoothing and corner analysis (Sec. 2.3.3) */ + +/* Always succeeds and returns 0 */ +static int +ATTRIBUTE_UNUSED smooth(privcurve_t * curve, int sign, double alphamax) +{ + int m = curve->n; + + int i, j, k; + double dd, denom, alpha; + dpoint_t p2, p3, p4; + + if (sign == '-') { + /* reverse orientation of negative paths */ + for (i = 0, j = m - 1; i < j; i++, j--) { + dpoint_t tmp; + tmp = curve->vertex[i]; + curve->vertex[i] = curve->vertex[j]; + curve->vertex[j] = tmp; + } + } + + /* examine each vertex and find its best fit */ + for (i = 0; i < m; i++) { + j = mod(i + 1, m); + k = mod(i + 2, m); + p4 = interval(1 / 2.0, curve->vertex[k], curve->vertex[j]); + + denom = ddenom(curve->vertex[i], curve->vertex[k]); + if (denom != 0.0) { + dd = dpara(curve->vertex[i], curve->vertex[j], curve->vertex[k]) / denom; + dd = fabs(dd); + alpha = dd > 1 ? (1 - 1.0 / dd) : 0; + alpha = alpha / 0.75; + } + else { + alpha = 4 / 3.0; + } + curve->alpha0[j] = alpha; /* remember "original" value of alpha */ + + if (alpha > alphamax) { /* pointed corner */ + curve->tag[j] = POTRACE_CORNER; + curve->c[j][1] = curve->vertex[j]; + curve->c[j][2] = p4; + } + else { + if (alpha < 0.55) { + alpha = 0.55; + } + else if (alpha > 1) { + alpha = 1; + } + p2 = interval(.5 + .5 * alpha, curve->vertex[i], curve->vertex[j]); + p3 = interval(.5 + .5 * alpha, curve->vertex[k], curve->vertex[j]); + curve->tag[j] = POTRACE_CURVETO; + curve->c[j][0] = p2; + curve->c[j][1] = p3; + curve->c[j][2] = p4; + } + curve->alpha[j] = alpha; /* store the "cropped" value of alpha */ + curve->beta[j] = 0.5; + } + curve->alphacurve = 1; + + return 0; +} + +/* ---------------------------------------------------------------------- */ +/* Stage 5: Curve optimization (Sec. 2.4) */ + +/* a private type for the result of opti_penalty */ +struct opti_s { + double pen; /* penalty */ + dpoint_t c[2]; /* curve parameters */ + double t, s; /* curve parameters */ + double alpha; /* curve parameter */ +}; +typedef struct opti_s opti_t; + +/* calculate best fit from i+.5 to j+.5. Assume icurve.n; + int k, k1, k2, conv, i1; + double area, alpha, d, d1, d2; + dpoint_t p0, p1, p2, p3, pt; + double A, R, A1, A2, A3, A4; + double s, t; + + /* check convexity, corner-freeness, and maximum bend < 179 degrees */ + + if (i == j) { /* sanity - a full loop can never be an opticurve */ + return 1; + } + + k = i; + i1 = mod(i + 1, m); + k1 = mod(k + 1, m); + conv = convc[k1]; + if (conv == 0) { + return 1; + } + d = ddist(pp->curve.vertex[i], pp->curve.vertex[i1]); + for (k = k1; k != j; k = k1) { + k1 = mod(k + 1, m); + k2 = mod(k + 2, m); + if (convc[k1] != conv) { + return 1; + } + if (sign(cprod(pp->curve.vertex[i], pp->curve.vertex[i1], pp->curve.vertex[k1], pp->curve.vertex[k2])) != conv) { + return 1; + } + if (iprod1 + (pp->curve.vertex[i], pp->curve.vertex[i1], pp->curve.vertex[k1], + pp->curve.vertex[k2]) < d * ddist(pp->curve.vertex[k1], pp->curve.vertex[k2]) * COS179) { + return 1; + } + } + + /* the curve we're working in: */ + p0 = pp->curve.c[mod(i, m)][2]; + p1 = pp->curve.vertex[mod(i + 1, m)]; + p2 = pp->curve.vertex[mod(j, m)]; + p3 = pp->curve.c[mod(j, m)][2]; + + /* determine its area */ + area = areac[j] - areac[i]; + area -= dpara(pp->curve.vertex[0], pp->curve.c[i][2], pp->curve.c[j][2]) / 2; + if (i >= j) { + area += areac[m]; + } + + /* find intersection o of p0p1 and p2p3. Let t,s such that o = + interval(t,p0,p1) = interval(s,p3,p2). Let A be the area of the + triangle (p0,o,p3). */ + + A1 = dpara(p0, p1, p2); + A2 = dpara(p0, p1, p3); + A3 = dpara(p0, p2, p3); + /* A4 = dpara(p1, p2, p3); */ + A4 = A1 + A3 - A2; + + if (A2 == A1) { /* this should never happen */ + return 1; + } + + t = A3 / (A3 - A4); + s = A2 / (A2 - A1); + A = A2 * t / 2.0; + + if (A == 0.0) { /* this should never happen */ + return 1; + } + + R = area / A; /* relative area */ + alpha = 2 - sqrt(4 - R / 0.3); /* overall alpha for p0-o-p3 curve */ + + res->c[0] = interval(t * alpha, p0, p1); + res->c[1] = interval(s * alpha, p3, p2); + res->alpha = alpha; + res->t = t; + res->s = s; + + p1 = res->c[0]; + p2 = res->c[1]; /* the proposed curve is now (p0,p1,p2,p3) */ + + res->pen = 0; + + /* calculate penalty */ + /* check tangency with edges */ + for (k = mod(i + 1, m); k != j; k = k1) { + k1 = mod(k + 1, m); + t = tangent(p0, p1, p2, p3, pp->curve.vertex[k], pp->curve.vertex[k1]); + if (t < -.5) { + return 1; + } + pt = bezier(t, p0, p1, p2, p3); + d = ddist(pp->curve.vertex[k], pp->curve.vertex[k1]); + if (d == 0.0) { /* this should never happen */ + return 1; + } + d1 = dpara(pp->curve.vertex[k], pp->curve.vertex[k1], pt) / d; + if (fabs(d1) > opttolerance) { + return 1; + } + if (iprod(pp->curve.vertex[k], pp->curve.vertex[k1], pt) < 0 || iprod(pp->curve.vertex[k1], pp->curve.vertex[k], pt) < 0) { + return 1; + } + res->pen += sq(d1); + } + + /* check corners */ + for (k = i; k != j; k = k1) { + k1 = mod(k + 1, m); + t = tangent(p0, p1, p2, p3, pp->curve.c[k][2], pp->curve.c[k1][2]); + if (t < -.5) { + return 1; + } + pt = bezier(t, p0, p1, p2, p3); + d = ddist(pp->curve.c[k][2], pp->curve.c[k1][2]); + if (d == 0.0) { /* this should never happen */ + return 1; + } + d1 = dpara(pp->curve.c[k][2], pp->curve.c[k1][2], pt) / d; + d2 = dpara(pp->curve.c[k][2], pp->curve.c[k1][2], pp->curve.vertex[k1]) / d; + d2 *= 0.75 * pp->curve.alpha[k1]; + if (d2 < 0) { + d1 = -d1; + d2 = -d2; + } + if (d1 < d2 - opttolerance) { + return 1; + } + if (d1 < d2) { + res->pen += sq(d1 - d2); + } + } + + return 0; +} + +/* optimize the path p, replacing sequences of Bezier segments by a + single segment when possible. Return 0 on success, 1 with errno set + on failure. */ +static int +ATTRIBUTE_UNUSED opticurve(privpath_t * pp, double opttolerance) +{ + int m = pp->curve.n; + int *pt = NULL; /* pt[m+1] */ + double *pen = NULL; /* pen[m+1] */ + int *len = NULL; /* len[m+1] */ + opti_t *opt = NULL; /* opt[m+1] */ + int om; + int i, j, r; + opti_t o; + dpoint_t p0; + int i1; + double area; + double alpha; + double *s = NULL; + double *t = NULL; + + int *convc = NULL; /* conv[m]: pre-computed convexities */ + double *areac = NULL; /* cumarea[m+1]: cache for fast area computation */ + + SAFE_MALLOC(pt, m + 1, int); + SAFE_MALLOC(pen, m + 1, double); + SAFE_MALLOC(len, m + 1, int); + SAFE_MALLOC(opt, m + 1, opti_t); + SAFE_MALLOC(convc, m, int); + SAFE_MALLOC(areac, m + 1, double); + + /* pre-calculate convexity: +1 = right turn, -1 = left turn, 0 = corner */ + for (i = 0; i < m; i++) { + if (pp->curve.tag[i] == POTRACE_CURVETO) { + convc[i] = sign(dpara(pp->curve.vertex[mod(i - 1, m)], pp->curve.vertex[i], pp->curve.vertex[mod(i + 1, m)])); + } + else { + convc[i] = 0; + } + } + + /* pre-calculate areas */ + area = 0.0; + areac[0] = 0.0; + p0 = pp->curve.vertex[0]; + for (i = 0; i < m; i++) { + i1 = mod(i + 1, m); + if (pp->curve.tag[i1] == POTRACE_CURVETO) { + alpha = pp->curve.alpha[i1]; + area += 0.3 * alpha * (4 - alpha) * dpara(pp->curve.c[i][2], pp->curve.vertex[i1], pp->curve.c[i1][2]) / 2; + area += dpara(p0, pp->curve.c[i][2], pp->curve.c[i1][2]) / 2; + } + areac[i + 1] = area; + } + + pt[0] = -1; + pen[0] = 0; + len[0] = 0; + + /* Fixme: we always start from a fixed point -- should find the best + curve cyclically ### */ + + for (j = 1; j <= m; j++) { + /* calculate best path from 0 to j */ + pt[j] = j - 1; + pen[j] = pen[j - 1]; + len[j] = len[j - 1] + 1; + + for (i = j - 2; i >= 0; i--) { + r = opti_penalty(pp, i, mod(j, m), &o, opttolerance, convc, areac); + if (r) { + break; + } + if (len[j] > len[i] + 1 || (len[j] == len[i] + 1 && pen[j] > pen[i] + o.pen)) { + pt[j] = i; + pen[j] = pen[i] + o.pen; + len[j] = len[i] + 1; + opt[j] = o; + } + } + } + om = len[m]; + r = privcurve_init(&pp->ocurve, om); + if (r) { + goto malloc_error; + } + SAFE_MALLOC(s, om, double); + SAFE_MALLOC(t, om, double); + + j = m; + for (i = om - 1; i >= 0; i--) { + if (pt[j] == j - 1) { + pp->ocurve.tag[i] = pp->curve.tag[mod(j, m)]; + pp->ocurve.c[i][0] = pp->curve.c[mod(j, m)][0]; + pp->ocurve.c[i][1] = pp->curve.c[mod(j, m)][1]; + pp->ocurve.c[i][2] = pp->curve.c[mod(j, m)][2]; + pp->ocurve.vertex[i] = pp->curve.vertex[mod(j, m)]; + pp->ocurve.alpha[i] = pp->curve.alpha[mod(j, m)]; + pp->ocurve.alpha0[i] = pp->curve.alpha0[mod(j, m)]; + pp->ocurve.beta[i] = pp->curve.beta[mod(j, m)]; + s[i] = t[i] = 1.0; + } + else { + pp->ocurve.tag[i] = POTRACE_CURVETO; + pp->ocurve.c[i][0] = opt[j].c[0]; + pp->ocurve.c[i][1] = opt[j].c[1]; + pp->ocurve.c[i][2] = pp->curve.c[mod(j, m)][2]; + pp->ocurve.vertex[i] = interval(opt[j].s, pp->curve.c[mod(j, m)][2], pp->curve.vertex[mod(j, m)]); + pp->ocurve.alpha[i] = opt[j].alpha; + pp->ocurve.alpha0[i] = opt[j].alpha; + s[i] = opt[j].s; + t[i] = opt[j].t; + } + j = pt[j]; + } + + /* calculate beta parameters */ + for (i = 0; i < om; i++) { + i1 = mod(i + 1, om); + pp->ocurve.beta[i] = s[i] / (s[i] + t[i1]); + } + pp->ocurve.alphacurve = 1; + + free(pt); + free(pen); + free(len); + free(opt); + free(s); + free(t); + free(convc); + free(areac); + return 0; + +malloc_error: + free(pt); + free(pen); + free(len); + free(opt); + free(s); + free(t); + free(convc); + free(areac); + return 1; +} + +/* ---------------------------------------------------------------------- */ +double plotpolygon(privpath_t * pp, FILE * f, double scale) +{ + int i; + int m = pp->m; + int *po = pp->po; + point_t *pt = pp->pt; + /* double scale=1.0/dpi; */ + double dm = 0; + + if (!m) + return 0; + + po = pp->po; + pt = pp->pt; + + fprintf(f, "G0 X%f Y%f (start point)\n", pt[po[0]].x * scale, pt[po[0]].y * scale); + fprintf(f, "G1 Z#101\n"); + for (i = 1; i < m; i++) { + fprintf(f, "G1 X%f Y%f\n", pt[po[i]].x * scale, pt[po[i]].y * scale); + dm += + sqrt((pt[po[i]].x - pt[po[i - 1]].x) * scale * (pt[po[i]].x - + pt[po[i - 1]].x) * + scale + (pt[po[i]].y - pt[po[i - 1]].y) * scale * (pt[po[i]].y - pt[po[i - 1]].y) * scale); + } + fprintf(f, "G1 X%f Y%f\n", pt[po[0]].x * scale, pt[po[0]].y * scale); + fprintf(f, "G0 Z#100\n"); + dm += + sqrt((pt[po[m - 1]].x - pt[po[0]].x) * scale * (pt[po[m - 1]].x - + pt[po[0]].x) * scale + + (pt[po[m - 1]].y - pt[po[0]].y) * scale * (pt[po[m - 1]].y - pt[po[0]].y) * scale); + fprintf(f, "(polygon end, distance %.2f)\n", dm); + return dm; +} + +#define TRY(x) if (x) goto try_error + +/* return distance on success, -1 on error with errno set. */ +double process_path(path_t * plist, const potrace_param_t * param, const potrace_bitmap_t * bm, FILE * f, double scale) +{ + path_t *p; + double dm = 0; + int n = 0; + /* call downstream function with each path */ + list_forall(p, plist) { + TRY(calc_sums(p->priv)); + TRY(calc_lon(p->priv)); + TRY(bestpolygon(p->priv)); + TRY(adjust_vertices(p->priv)); + fprintf(f, "(polygon %d)\n", ++n); + dm += plotpolygon(p->priv, f, scale); +/* No need to extract curves + TRY(smooth(&p->priv->curve, p->sign, param->alphamax)); + if (param->opticurve) { + TRY(opticurve(p->priv, param->opttolerance)); + p->priv->fcurve = &p->priv->ocurve; + } else { + p->priv->fcurve = &p->priv->curve; + } + privcurve_to_curve(p->priv->fcurve, &p->curve);*/ + } +/* fprintf(f,"(end, total distance %.2fmm = %.2fin)\n",25.4*dm,dm); */ + return dm; + +try_error: + return -1; +} Index: 1.0.8/src/hid/gcode/trace.h =================================================================== --- 1.0.8/src/hid/gcode/trace.h (nonexistent) +++ 1.0.8/src/hid/gcode/trace.h (revision 1136) @@ -0,0 +1,14 @@ +/* Copyright (C) 2001-2007 Peter Selinger. + This file is part of Potrace. It is free software and it is covered + by the GNU General Public License. See the file COPYING for details. */ + +/* $Id: trace.h 147 2007-04-09 00:44:09Z selinger $ */ + +#ifndef TRACE_H +#define TRACE_H + +#include "potracelib.h" + +double process_path(path_t * plist, const potrace_param_t * param, const potrace_bitmap_t * bm, FILE * f, double scale); + +#endif /* TRACE_H */ Index: 1.0.8/src/hid/gerber/gerber.c =================================================================== --- 1.0.8/src/hid/gerber/gerber.c (nonexistent) +++ 1.0.8/src/hid/gerber/gerber.c (revision 1136) @@ -0,0 +1,1202 @@ +/* $Id$ */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_PWD_H +#include +#endif + +#include + +#include "config.h" +#include "global.h" +#include "data.h" +#include "misc.h" +#include "error.h" +#include "draw.h" +#include "pcb-printf.h" + +#include "hid.h" +#include "../hidint.h" +#include "hid/common/hidnogui.h" +#include "hid/common/draw_helpers.h" +#include "hid/common/hidinit.h" + + +RCSID("$Id$"); + +#define CRASH fprintf(stderr, "HID error: pcb called unimplemented Gerber function %s.\n", __FUNCTION__); abort() + +/*----------------------------------------------------------------------------*/ +/* Function prototypes */ +/*----------------------------------------------------------------------------*/ + +static HID_Attribute *gerber_get_export_options(int *n); +static void gerber_do_export(HID_Attr_Val * options); +static void gerber_parse_arguments(int *argc, char ***argv); +static int gerber_set_layer(const char *name, int group, int empty); +static hidGC gerber_make_gc(void); +static void gerber_destroy_gc(hidGC gc); +static void gerber_use_mask(int use_it); +static void gerber_set_color(hidGC gc, const char *name); +static void gerber_set_line_cap(hidGC gc, EndCapStyle style); +static void gerber_set_line_width(hidGC gc, Coord width); +static void gerber_set_draw_xor(hidGC gc, int _xor); +static void gerber_draw_line(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2); +static void gerber_draw_arc(hidGC gc, Coord cx, Coord cy, Coord width, Coord height, Angle start_angle, Angle delta_angle); +static void gerber_draw_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2); +static void gerber_fill_circle(hidGC gc, Coord cx, Coord cy, Coord radius); +static void gerber_fill_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2); +static void gerber_calibrate(double xval, double yval); +static void gerber_set_crosshair(int x, int y, int action); +static void gerber_fill_polygon(hidGC gc, int n_coords, Coord * x, Coord * y); + +/*----------------------------------------------------------------------------*/ +/* Utility routines */ +/*----------------------------------------------------------------------------*/ + +/* These are for films */ +#define gerberX(pcb, x) ((Coord) (x)) +#define gerberY(pcb, y) ((Coord) ((pcb)->MaxHeight - (y))) +#define gerberXOffset(pcb, x) ((Coord) (x)) +#define gerberYOffset(pcb, y) ((Coord) (-(y))) + +/* These are for drills (printed as mils but are really 1/10th mil) */ +#define gerberDrX(pcb, x) ((Coord) (x) * 10) +#define gerberDrY(pcb, y) ((Coord) ((pcb)->MaxHeight - (y)) * 10) + +/*----------------------------------------------------------------------------*/ +/* Private data structures */ +/*----------------------------------------------------------------------------*/ + +static int verbose; +static int all_layers; +static int is_mask, was_drill; +static int is_drill; +static int current_mask; +static int flash_drills; +static int copy_outline_mode; +static int name_style; +static LayerTypePtr outline_layer; + +enum ApertureShape { + ROUND, /* Shaped like a circle */ + OCTAGON, /* octagonal shape */ + SQUARE, /* Shaped like a square */ + ROUNDCLEAR, /* clearance in negatives */ + SQUARECLEAR, + THERMAL /* negative thermal relief */ +}; +typedef enum ApertureShape ApertureShape; + +/* This is added to the global aperture array indexes to get gerber + dcode and macro numbers. */ +#define DCODE_BASE 11 + +typedef struct aperture { + int dCode; /* The RS-274X D code */ + Coord width; /* Size in pcb units */ + ApertureShape shape; /* ROUND/SQUARE etc */ + struct aperture *next; +} Aperture; + +typedef struct { + Aperture *data; + int count; +} ApertureList; + +static ApertureList *layer_aptr_list; +static ApertureList *curr_aptr_list; +static int layer_list_max; +static int layer_list_idx; + +typedef struct { + Coord diam; + Coord x; + Coord y; +} PendingDrills; +PendingDrills *pending_drills = NULL; +int n_pending_drills = 0, max_pending_drills = 0; + +/*----------------------------------------------------------------------------*/ +/* Defined Constants */ +/*----------------------------------------------------------------------------*/ +#define AUTO_OUTLINE_WIDTH MIL_TO_COORD(8) /* Auto-geneated outline width of 8 mils */ + +/*----------------------------------------------------------------------------*/ +/* Aperture Routines */ +/*----------------------------------------------------------------------------*/ + +/* Initialize aperture list */ +static void initApertureList(ApertureList * list) +{ + list->data = NULL; + list->count = 0; +} + +static void deinitApertureList(ApertureList * list) +{ + Aperture *search = list->data; + Aperture *next; + while (search) { + next = search->next; + free(search); + search = next; + } + initApertureList(list); +} + +static void resetApertures() +{ + int i; + for (i = 0; i < layer_list_max; ++i) + deinitApertureList(&layer_aptr_list[i]); + free(layer_aptr_list); + layer_aptr_list = NULL; + curr_aptr_list = NULL; + layer_list_max = 0; + layer_list_idx = 0; +} + +/* Create and add a new aperture to the list */ +static Aperture *addAperture(ApertureList * list, Coord width, ApertureShape shape) +{ + static int aperture_count; + + Aperture *app = (Aperture *) malloc(sizeof *app); + if (app == NULL) + return NULL; + + app->width = width; + app->shape = shape; + app->dCode = DCODE_BASE + aperture_count++; + app->next = list->data; + + list->data = app; + ++list->count; + + return app; +} + +/* Fetch an aperture from the list with the specified + * width/shape, creating a new one if none exists */ +static Aperture *findAperture(ApertureList * list, Coord width, ApertureShape shape) +{ + Aperture *search; + + /* we never draw zero-width lines */ + if (width == 0) + return NULL; + + /* Search for an appropriate aperture. */ + for (search = list->data; search; search = search->next) + if (search->width == width && search->shape == shape) + return search; + + /* Failing that, create a new one */ + return addAperture(list, width, shape); +} + +/* Output aperture data to the file */ +static void fprintAperture(FILE * f, Aperture * aptr) +{ + switch (aptr->shape) { + case ROUND: + pcb_fprintf(f, "%%ADD%dC,%.4mi*%%\r\n", aptr->dCode, aptr->width); + break; + case SQUARE: + pcb_fprintf(f, "%%ADD%dR,%.4miX%.4mi*%%\r\n", aptr->dCode, aptr->width, aptr->width); + break; + case OCTAGON: + pcb_fprintf(f, "%%AMOCT%d*5,0,8,0,0,%.4mi,22.5*%%\r\n" + "%%ADD%dOCT%d*%%\r\n", aptr->dCode, (Coord) ((double) aptr->width / COS_22_5_DEGREE), aptr->dCode, aptr->dCode); + break; +#if 0 + case THERMAL: + fprintf(f, "%%AMTHERM%d*7,0,0,%.4f,%.4f,%.4f,45*%%\r\n" + "%%ADD%dTHERM%d*%%\r\n", dCode, gap / 100000.0, width / 100000.0, finger / 100000.0, dCode, dCode); + break; + case ROUNDCLEAR: + fprintf(f, "%%ADD%dC,%.4fX%.4f*%%\r\n", dCode, gap / 100000.0, width / 100000.0); + break; + case SQUARECLEAR: + fprintf(f, "%%ADD%dR,%.4fX%.4fX%.4fX%.4f*%%\r\n", + dCode, gap / 100000.0, gap / 100000.0, width / 100000.0, width / 100000.0); + break; +#else + default: + break; +#endif + } +} + +/* Set the aperture list for the current layer, + * expanding the list buffer if needed */ +static ApertureList *setLayerApertureList(int layer_idx) +{ + if (layer_idx >= layer_list_max) { + int i = layer_list_max; + layer_list_max = 2 * (layer_idx + 1); + layer_aptr_list = (ApertureList *) + realloc(layer_aptr_list, layer_list_max * sizeof(*layer_aptr_list)); + for (; i < layer_list_max; ++i) + initApertureList(&layer_aptr_list[i]); + } + curr_aptr_list = &layer_aptr_list[layer_idx]; + return curr_aptr_list; +} + +/* --------------------------------------------------------------------------- */ + +static HID gerber_hid; + +typedef struct hid_gc_struct { + EndCapStyle cap; + int width; + int color; + int erase; + int drill; +} hid_gc_struct; + +static FILE *f = NULL; +static char *filename = NULL; +static char *filesuff = NULL; +static char *layername = NULL; +static int lncount = 0; + +static int finding_apertures = 0; +static int pagecount = 0; +static int linewidth = -1; +static int lastgroup = -1; +static int lastcap = -1; +static int lastcolor = -1; +static int print_group[MAX_LAYER]; +static int print_layer[MAX_LAYER]; +static int lastX, lastY; /* the last X and Y coordinate */ + +static const char *copy_outline_names[] = { +#define COPY_OUTLINE_NONE 0 + "none", +#define COPY_OUTLINE_MASK 1 + "mask", +#define COPY_OUTLINE_SILK 2 + "silk", +#define COPY_OUTLINE_ALL 3 + "all", + NULL +}; + +static const char *name_style_names[] = { +#define NAME_STYLE_FIXED 0 + "fixed", +#define NAME_STYLE_SINGLE 1 + "single", +#define NAME_STYLE_FIRST 2 + "first", +#define NAME_STYLE_EAGLE 3 + "eagle", + NULL +}; + +static HID_Attribute gerber_options[] = { + +/* %start-doc options "90 Gerber Export" +@ftable @code +@item --gerberfile +Gerber output file prefix. Can include a path. +@end ftable +%end-doc +*/ + {"gerberfile", "Gerber output file base", + HID_String, 0, 0, {0, 0, 0}, 0, 0}, +#define HA_gerberfile 0 + +/* %start-doc options "90 Gerber Export" +@ftable @code +@item --all-layers +Output contains all layers, even empty ones. +@end ftable +%end-doc +*/ + {"all-layers", "Output all layers, even empty ones", + HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, +#define HA_all_layers 1 + +/* %start-doc options "90 Gerber Export" +@ftable @code +@item --verbose +Print file names and aperture counts on stdout. +@end ftable +%end-doc +*/ + {"verbose", "Print file names and aperture counts on stdout", + HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, +#define HA_verbose 2 + {"copy-outline", "Copy outline onto other layers", + HID_Enum, 0, 0, {0, 0, 0}, copy_outline_names, 0}, +#define HA_copy_outline 3 + {"name-style", "Naming style for individual gerber files", + HID_Enum, 0, 0, {0, 0, 0}, name_style_names, 0}, +#define HA_name_style 4 +}; + +#define NUM_OPTIONS (sizeof(gerber_options)/sizeof(gerber_options[0])) + +static HID_Attr_Val gerber_values[NUM_OPTIONS]; + +static HID_Attribute *gerber_get_export_options(int *n) +{ + static char *last_made_filename = NULL; + if (PCB) + derive_default_filename(PCB->Filename, &gerber_options[HA_gerberfile], "", &last_made_filename); + + if (n) + *n = NUM_OPTIONS; + return gerber_options; +} + +static int group_for_layer(int l) +{ + if (l < max_copper_layer + 2 && l >= 0) + return GetLayerGroupNumberByNumber(l); + /* else something unique */ + return max_group + 3 + l; +} + +static int layer_sort(const void *va, const void *vb) +{ + int a = *(int *) va; + int b = *(int *) vb; + int d = group_for_layer(b) - group_for_layer(a); + if (d) + return d; + return b - a; +} + +static void maybe_close_f(FILE * f) +{ + if (f) { + if (was_drill) + fprintf(f, "M30\r\n"); + else + fprintf(f, "M02*\r\n"); + fclose(f); + } +} + +static BoxType region; + +/* Very similar to layer_type_to_file_name() but appends only a + three-character suffix compatible with Eagle's defaults. */ +static void assign_eagle_file_suffix(char *dest, int idx) +{ + int group; + int nlayers; + char *suff = "out"; + + switch (idx) { + case SL(SILK, TOP): + suff = "plc"; + break; + case SL(SILK, BOTTOM): + suff = "pls"; + break; + case SL(MASK, TOP): + suff = "stc"; + break; + case SL(MASK, BOTTOM): + suff = "sts"; + break; + case SL(PDRILL, 0): + suff = "drd"; + break; + case SL(UDRILL, 0): + suff = "dru"; + break; + case SL(PASTE, TOP): + suff = "crc"; + break; + case SL(PASTE, BOTTOM): + suff = "crs"; + break; + case SL(INVISIBLE, 0): + suff = "inv"; + break; + case SL(FAB, 0): + suff = "fab"; + break; + case SL(ASSY, TOP): + suff = "ast"; + break; + case SL(ASSY, BOTTOM): + suff = "asb"; + break; + + default: + group = GetLayerGroupNumberByNumber(idx); + nlayers = PCB->LayerGroups.Number[group]; + if (group == GetLayerGroupNumberByNumber(component_silk_layer)) { + suff = "cmp"; + } + else if (group == GetLayerGroupNumberByNumber(solder_silk_layer)) { + suff = "sol"; + } + else if (nlayers == 1 + && (strcmp(PCB->Data->Layer[idx].Name, "route") == 0 || strcmp(PCB->Data->Layer[idx].Name, "outline") == 0)) { + suff = "oln"; + } + else { + static char buf[20]; + sprintf(buf, "ly%d", group); + suff = buf; + } + break; + } + + strcpy(dest, suff); +} + +static void assign_file_suffix(char *dest, int idx) +{ + int fns_style; + const char *sext = ".gbr"; + + switch (name_style) { + default: + case NAME_STYLE_FIXED: + fns_style = FNS_fixed; + break; + case NAME_STYLE_SINGLE: + fns_style = FNS_single; + break; + case NAME_STYLE_FIRST: + fns_style = FNS_first; + break; + case NAME_STYLE_EAGLE: + assign_eagle_file_suffix(dest, idx); + return; + } + + switch (idx) { + case SL(PDRILL, 0): + sext = ".cnc"; + break; + case SL(UDRILL, 0): + sext = ".cnc"; + break; + } + + strcpy(dest, layer_type_to_file_name(idx, fns_style)); + strcat(dest, sext); +} + +static void gerber_do_export(HID_Attr_Val * options) +{ + const char *fnbase; + int i; + static int saved_layer_stack[MAX_LAYER]; + int save_ons[MAX_LAYER + 2]; + FlagType save_thindraw; + + save_thindraw = PCB->Flags; + CLEAR_FLAG(THINDRAWFLAG, PCB); + CLEAR_FLAG(THINDRAWPOLYFLAG, PCB); + CLEAR_FLAG(CHECKPLANESFLAG, PCB); + + if (!options) { + gerber_get_export_options(NULL); + for (i = 0; i < NUM_OPTIONS; i++) + gerber_values[i] = gerber_options[i].default_val; + options = gerber_values; + } + + fnbase = options[HA_gerberfile].str_value; + if (!fnbase) + fnbase = "pcb-out"; + + verbose = options[HA_verbose].int_value; + all_layers = options[HA_all_layers].int_value; + + copy_outline_mode = options[HA_copy_outline].int_value; + name_style = options[HA_name_style].int_value; + + outline_layer = NULL; + + for (i = 0; i < max_copper_layer; i++) { + LayerType *layer = PCB->Data->Layer + i; + if (strcmp(layer->Name, "outline") == 0 || strcmp(layer->Name, "route") == 0) { + outline_layer = layer; + } + } + + i = strlen(fnbase); + filename = (char *) realloc(filename, i + 40); + strcpy(filename, fnbase); + strcat(filename, "."); + filesuff = filename + strlen(filename); + + if (all_layers) { + memset(print_group, 1, sizeof(print_group)); + memset(print_layer, 1, sizeof(print_layer)); + } + else { + memset(print_group, 0, sizeof(print_group)); + memset(print_layer, 0, sizeof(print_layer)); + } + + hid_save_and_show_layer_ons(save_ons); + for (i = 0; i < max_copper_layer; i++) { + LayerType *layer = PCB->Data->Layer + i; + if (layer->LineN || layer->TextN || layer->ArcN || layer->PolygonN) + print_group[GetLayerGroupNumberByNumber(i)] = 1; + } + print_group[GetLayerGroupNumberByNumber(solder_silk_layer)] = 1; + print_group[GetLayerGroupNumberByNumber(component_silk_layer)] = 1; + for (i = 0; i < max_copper_layer; i++) + if (print_group[GetLayerGroupNumberByNumber(i)]) + print_layer[i] = 1; + + memcpy(saved_layer_stack, LayerStack, sizeof(LayerStack)); + qsort(LayerStack, max_copper_layer, sizeof(LayerStack[0]), layer_sort); + linewidth = -1; + lastcap = -1; + lastgroup = -1; + lastcolor = -1; + + region.X1 = 0; + region.Y1 = 0; + region.X2 = PCB->MaxWidth; + region.Y2 = PCB->MaxHeight; + + pagecount = 1; + resetApertures(); + + lastgroup = -1; + layer_list_idx = 0; + finding_apertures = 1; + hid_expose_callback(&gerber_hid, ®ion, 0); + + layer_list_idx = 0; + finding_apertures = 0; + hid_expose_callback(&gerber_hid, ®ion, 0); + + memcpy(LayerStack, saved_layer_stack, sizeof(LayerStack)); + + maybe_close_f(f); + f = NULL; + hid_restore_layer_ons(save_ons); + PCB->Flags = save_thindraw; +} + +static void gerber_parse_arguments(int *argc, char ***argv) +{ + hid_register_attributes(gerber_options, NUM_OPTIONS); + hid_parse_command_line(argc, argv); +} + +static int drill_sort(const void *va, const void *vb) +{ + PendingDrills *a = (PendingDrills *) va; + PendingDrills *b = (PendingDrills *) vb; + if (a->diam != b->diam) + return a->diam - b->diam; + if (a->x != b->x) + return a->x - a->x; + return b->y - b->y; +} + +static int gerber_set_layer(const char *name, int group, int empty) +{ + int want_outline; + char *cp; + int idx = (group >= 0 && group < max_group) ? PCB->LayerGroups.Entries[group][0] : group; + + if (name == NULL) + name = PCB->Data->Layer[idx].Name; + + if (idx >= 0 && idx < max_copper_layer && !print_layer[idx]) + return 0; + + if (strcmp(name, "invisible") == 0) + return 0; + if (SL_TYPE(idx) == SL_ASSY) + return 0; + + flash_drills = 0; + if (strcmp(name, "outline") == 0 || strcmp(name, "route") == 0) + flash_drills = 1; + + if (is_drill && n_pending_drills) { + int i; + /* dump pending drills in sequence */ + qsort(pending_drills, n_pending_drills, sizeof(pending_drills[0]), drill_sort); + for (i = 0; i < n_pending_drills; i++) { + if (i == 0 || pending_drills[i].diam != pending_drills[i - 1].diam) { + Aperture *ap = findAperture(curr_aptr_list, pending_drills[i].diam, ROUND); + fprintf(f, "T%02d\r\n", ap->dCode); + } + pcb_fprintf(f, "X%06.0mlY%06.0ml\r\n", gerberDrX(PCB, pending_drills[i].x), gerberDrY(PCB, pending_drills[i].y)); + } + free(pending_drills); + n_pending_drills = max_pending_drills = 0; + pending_drills = NULL; + } + + is_drill = (SL_TYPE(idx) == SL_PDRILL || SL_TYPE(idx) == SL_UDRILL); + is_mask = (SL_TYPE(idx) == SL_MASK); + current_mask = 0; +#if 0 + printf("Layer %s group %d drill %d mask %d\n", name, group, is_drill, is_mask); +#endif + + if (group < 0 || group != lastgroup) { + time_t currenttime; + char utcTime[64]; +#ifdef HAVE_GETPWUID + struct passwd *pwentry; +#endif + ApertureList *aptr_list; + Aperture *search; + + lastgroup = group; + lastX = -1; + lastY = -1; + lastcolor = 0; + linewidth = -1; + lastcap = -1; + + aptr_list = setLayerApertureList(layer_list_idx++); + + if (finding_apertures) + goto emit_outline; + + if (aptr_list->count == 0 && !all_layers) + return 0; + + maybe_close_f(f); + f = NULL; + + pagecount++; + assign_file_suffix(filesuff, idx); + f = fopen(filename, "wb"); /* Binary needed to force CR-LF */ + if (f == NULL) { + Message("Error: Could not open %s for writing.\n", filename); + return 1; + } + + was_drill = is_drill; + + if (verbose) { + int c = aptr_list->count; + printf("Gerber: %d aperture%s in %s\n", c, c == 1 ? "" : "s", filename); + } + + if (is_drill) { + /* We omit the ,TZ here because we are not omitting trailing zeros. Our format is + always six-digit 0.1 mil resolution (i.e. 001100 = 0.11") */ + fprintf(f, "M48\r\n" "INCH\r\n"); + for (search = aptr_list->data; search; search = search->next) + pcb_fprintf(f, "T%02dC%.3mi\r\n", search->dCode, search->width); + fprintf(f, "%%\r\n"); + /* FIXME */ + return 1; + } + + fprintf(f, "G04 start of page %d for group %d idx %d *\r\n", pagecount, group, idx); + + /* Create a portable timestamp. */ + currenttime = time(NULL); + { + /* avoid gcc complaints */ + const char *fmt = "%c UTC"; + strftime(utcTime, sizeof utcTime, fmt, gmtime(¤ttime)); + } + /* Print a cute file header at the beginning of each file. */ + fprintf(f, "G04 Title: %s, %s *\r\n", UNKNOWN(PCB->Name), UNKNOWN(name)); + fprintf(f, "G04 Creator: %s " VERSION " *\r\n", Progname); + fprintf(f, "G04 CreationDate: %s *\r\n", utcTime); + +#ifdef HAVE_GETPWUID + /* ID the user. */ + pwentry = getpwuid(getuid()); + fprintf(f, "G04 For: %s *\r\n", pwentry->pw_name); +#endif + + fprintf(f, "G04 Format: Gerber/RS-274X *\r\n"); + pcb_fprintf(f, "G04 PCB-Dimensions: %.0mc %.0mc *\r\n", PCB->MaxWidth, PCB->MaxHeight); + fprintf(f, "G04 PCB-Coordinate-Origin: lower left *\r\n"); + + /* Signal data in inches. */ + fprintf(f, "%%MOIN*%%\r\n"); + + /* Signal Leading zero suppression, Absolute Data, 2.5 format */ + fprintf(f, "%%FSLAX25Y25*%%\r\n"); + + /* build a legal identifier. */ + if (layername) + free(layername); + layername = strdup(filesuff); + if (strrchr(layername, '.')) + *strrchr(layername, '.') = 0; + + for (cp = layername; *cp; cp++) { + if (isalnum((int) *cp)) + *cp = toupper((int) *cp); + else + *cp = '_'; + } + fprintf(f, "%%LN%s*%%\r\n", layername); + lncount = 1; + + for (search = aptr_list->data; search; search = search->next) + fprintAperture(f, search); + if (aptr_list->count == 0) + /* We need to put *something* in the file to make it be parsed + as RS-274X instead of RS-274D. */ + fprintf(f, "%%ADD11C,0.0100*%%\r\n"); + } + +emit_outline: + /* If we're printing a copper layer other than the outline layer, + and we want to "print outlines", and we have an outline layer, + print the outline layer on this layer also. */ + want_outline = 0; + if (copy_outline_mode == COPY_OUTLINE_MASK && SL_TYPE(idx) == SL_MASK) + want_outline = 1; + if (copy_outline_mode == COPY_OUTLINE_SILK && SL_TYPE(idx) == SL_SILK) + want_outline = 1; + if (copy_outline_mode == COPY_OUTLINE_ALL + && (SL_TYPE(idx) == SL_SILK + || SL_TYPE(idx) == SL_MASK || SL_TYPE(idx) == SL_FAB || SL_TYPE(idx) == SL_ASSY || SL_TYPE(idx) == 0)) + want_outline = 1; + + if (want_outline && strcmp(name, "outline") + && strcmp(name, "route")) { + if (outline_layer && outline_layer != PCB->Data->Layer + idx) + DrawLayer(outline_layer, ®ion); + else if (!outline_layer) { + hidGC gc = gui->make_gc(); + printf("name %s idx %d\n", name, idx); + if (SL_TYPE(idx) == SL_SILK) + gui->set_line_width(gc, PCB->minSlk); + else if (group >= 0) + gui->set_line_width(gc, PCB->minWid); + else + gui->set_line_width(gc, AUTO_OUTLINE_WIDTH); + gui->draw_line(gc, 0, 0, PCB->MaxWidth, 0); + gui->draw_line(gc, 0, 0, 0, PCB->MaxHeight); + gui->draw_line(gc, PCB->MaxWidth, 0, PCB->MaxWidth, PCB->MaxHeight); + gui->draw_line(gc, 0, PCB->MaxHeight, PCB->MaxWidth, PCB->MaxHeight); + gui->destroy_gc(gc); + } + } + + return 1; +} + +static hidGC gerber_make_gc(void) +{ + hidGC rv = (hidGC) calloc(1, sizeof(*rv)); + rv->cap = Trace_Cap; + return rv; +} + +static void gerber_destroy_gc(hidGC gc) +{ + free(gc); +} + +static void gerber_use_mask(int use_it) +{ + current_mask = use_it; +} + +static void gerber_set_color(hidGC gc, const char *name) +{ + if (strcmp(name, "erase") == 0) { + gc->color = 1; + gc->erase = 1; + gc->drill = 0; + } + else if (strcmp(name, "drill") == 0) { + gc->color = 1; + gc->erase = 0; + gc->drill = 1; + } + else { + gc->color = 0; + gc->erase = 0; + gc->drill = 0; + } +} + +static void gerber_set_line_cap(hidGC gc, EndCapStyle style) +{ + gc->cap = style; +} + +static void gerber_set_line_width(hidGC gc, Coord width) +{ + gc->width = width; +} + +static void gerber_set_draw_xor(hidGC gc, int xor_) +{ + ; +} + +static void use_gc(hidGC gc, int radius) +{ + if (radius) { + radius *= 2; + if (radius != linewidth || lastcap != Round_Cap) { + Aperture *aptr = findAperture(curr_aptr_list, radius, ROUND); + if (aptr == NULL) + pcb_fprintf(stderr, "error: aperture for radius %$mS type ROUND is null\n", radius); + else if (f && !is_drill) + fprintf(f, "G54D%d*", aptr->dCode); + linewidth = radius; + lastcap = Round_Cap; + } + } + else if (linewidth != gc->width || lastcap != gc->cap) { + Aperture *aptr; + ApertureShape shape; + + linewidth = gc->width; + lastcap = gc->cap; + switch (gc->cap) { + case Round_Cap: + case Trace_Cap: + shape = ROUND; + break; + default: + case Square_Cap: + shape = SQUARE; + break; + } + aptr = findAperture(curr_aptr_list, linewidth, shape); + if (aptr == NULL) + pcb_fprintf(stderr, "error: aperture for width %$mS type %s is null\n", linewidth, shape == ROUND ? "ROUND" : "SQUARE"); + if (f) + fprintf(f, "G54D%d*", aptr->dCode); + } +#if 0 + if (lastcolor != gc->color) { + c = gc->color; + if (is_drill) + return; + if (is_mask) + c = (gc->erase ? 0 : 1); + lastcolor = gc->color; + if (f) { + if (c) { + fprintf(f, "%%LN%s_C%d*%%\r\n", layername, lncount++); + fprintf(f, "%%LPC*%%\r\n"); + } + else { + fprintf(f, "%%LN%s_D%d*%%\r\n", layername, lncount++); + fprintf(f, "%%LPD*%%\r\n"); + } + } + } +#endif +} + +static void gerber_draw_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ + gerber_draw_line(gc, x1, y1, x1, y2); + gerber_draw_line(gc, x1, y1, x2, y1); + gerber_draw_line(gc, x1, y2, x2, y2); + gerber_draw_line(gc, x2, y1, x2, y2); +} + +static void gerber_draw_line(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ + bool m = false; + + if (x1 != x2 && y1 != y2 && gc->cap == Square_Cap) { + Coord x[5], y[5]; + double tx, ty, theta; + + theta = atan2(y2 - y1, x2 - x1); + + /* T is a vector half a thickness long, in the direction of + one of the corners. */ + tx = gc->width / 2.0 * cos(theta + M_PI / 4) * sqrt(2.0); + ty = gc->width / 2.0 * sin(theta + M_PI / 4) * sqrt(2.0); + + x[0] = x1 - tx; + y[0] = y1 - ty; + x[1] = x2 + ty; + y[1] = y2 - tx; + x[2] = x2 + tx; + y[2] = y2 + ty; + x[3] = x1 - ty; + y[3] = y1 + tx; + + x[4] = x[0]; + y[4] = y[0]; + gerber_fill_polygon(gc, 5, x, y); + return; + } + + use_gc(gc, 0); + if (!f) + return; + + if (x1 != lastX) { + m = true; + lastX = x1; + pcb_fprintf(f, "X%.0mc", gerberX(PCB, lastX)); + } + if (y1 != lastY) { + m = true; + lastY = y1; + pcb_fprintf(f, "Y%.0mc", gerberY(PCB, lastY)); + } + if ((x1 == x2) && (y1 == y2)) + fprintf(f, "D03*\r\n"); + else { + if (m) + fprintf(f, "D02*"); + if (x2 != lastX) { + lastX = x2; + pcb_fprintf(f, "X%.0mc", gerberX(PCB, lastX)); + } + if (y2 != lastY) { + lastY = y2; + pcb_fprintf(f, "Y%.0mc", gerberY(PCB, lastY)); + + } + fprintf(f, "D01*\r\n"); + } + +} + +static void gerber_draw_arc(hidGC gc, Coord cx, Coord cy, Coord width, Coord height, Angle start_angle, Angle delta_angle) +{ + bool m = false; + double arcStartX, arcStopX, arcStartY, arcStopY; + + /* we never draw zero-width lines */ + if (gc->width == 0) + return; + + use_gc(gc, 0); + if (!f) + return; + + arcStartX = cx - width * cos(TO_RADIANS(start_angle)); + arcStartY = cy + height * sin(TO_RADIANS(start_angle)); + + /* I checked three different gerber viewers, and they all disagreed + on how ellipses should be drawn. The spec just calls G74/G75 + "circular interpolation" so there's a chance it just doesn't + support ellipses at all. Thus, we draw them out with line + segments. Note that most arcs in pcb are circles anyway. */ + if (width != height) { + double step, angle; + Coord max = width > height ? width : height; + Coord minr = max - gc->width / 10; + int nsteps; + Coord x0, y0, x1, y1; + + if (minr >= max) + minr = max - 1; + step = acos((double) minr / (double) max) * 180.0 / M_PI; + if (step > 5) + step = 5; + nsteps = abs(delta_angle) / step + 1; + step = (double) delta_angle / nsteps; + + x0 = arcStartX; + y0 = arcStartY; + angle = start_angle; + while (nsteps > 0) { + nsteps--; + x1 = cx - width * cos(TO_RADIANS(angle + step)); + y1 = cy + height * sin(TO_RADIANS(angle + step)); + gerber_draw_line(gc, x0, y0, x1, y1); + x0 = x1; + y0 = y1; + angle += step; + } + return; + } + + arcStopX = cx - width * cos(TO_RADIANS(start_angle + delta_angle)); + arcStopY = cy + height * sin(TO_RADIANS(start_angle + delta_angle)); + if (arcStartX != lastX) { + m = true; + lastX = arcStartX; + pcb_fprintf(f, "X%.0mc", gerberX(PCB, lastX)); + } + if (arcStartY != lastY) { + m = true; + lastY = arcStartY; + pcb_fprintf(f, "Y%.0mc", gerberY(PCB, lastY)); + } + if (m) + fprintf(f, "D02*"); + pcb_fprintf(f, + "G75*G0%1dX%.0mcY%.0mcI%.0mcJ%.0mcD01*G01*\r\n", + (delta_angle < 0) ? 2 : 3, + gerberX(PCB, arcStopX), gerberY(PCB, arcStopY), + gerberXOffset(PCB, cx - arcStartX), gerberYOffset(PCB, cy - arcStartY)); + lastX = arcStopX; + lastY = arcStopY; +} + +static void gerber_fill_circle(hidGC gc, Coord cx, Coord cy, Coord radius) +{ + if (radius <= 0) + return; + if (is_drill) + radius = 50 * round(radius / 50.0); + use_gc(gc, radius); + if (!f) + return; + if (is_drill) { + if (n_pending_drills >= max_pending_drills) { + max_pending_drills += 100; + pending_drills = (PendingDrills *) realloc(pending_drills, max_pending_drills * sizeof(pending_drills[0])); + } + pending_drills[n_pending_drills].x = cx; + pending_drills[n_pending_drills].y = cy; + pending_drills[n_pending_drills].diam = radius * 2; + n_pending_drills++; + return; + } + else if (gc->drill && !flash_drills) + return; + if (cx != lastX) { + lastX = cx; + pcb_fprintf(f, "X%.0mc", gerberX(PCB, lastX)); + } + if (cy != lastY) { + lastY = cy; + pcb_fprintf(f, "Y%.0mc", gerberY(PCB, lastY)); + } + fprintf(f, "D03*\r\n"); +} + +static void gerber_fill_polygon(hidGC gc, int n_coords, Coord * x, Coord * y) +{ + bool m = false; + int i; + int firstTime = 1; + Coord startX = 0, startY = 0; + + if (is_mask && current_mask == HID_MASK_BEFORE) + return; + + use_gc(gc, 10 * 100); + if (!f) + return; + fprintf(f, "G36*\r\n"); + for (i = 0; i < n_coords; i++) { + if (x[i] != lastX) { + m = true; + lastX = x[i]; + pcb_fprintf(f, "X%.0mc", gerberX(PCB, lastX)); + } + if (y[i] != lastY) { + m = true; + lastY = y[i]; + pcb_fprintf(f, "Y%.0mc", gerberY(PCB, lastY)); + } + if (firstTime) { + firstTime = 0; + startX = x[i]; + startY = y[i]; + if (m) + fprintf(f, "D02*"); + } + else if (m) + fprintf(f, "D01*\r\n"); + m = false; + } + if (startX != lastX) { + m = true; + lastX = startX; + pcb_fprintf(f, "X%.0mc", gerberX(PCB, startX)); + } + if (startY != lastY) { + m = true; + lastY = startY; + pcb_fprintf(f, "Y%.0mc", gerberY(PCB, lastY)); + } + if (m) + fprintf(f, "D01*\r\n"); + fprintf(f, "G37*\r\n"); +} + +static void gerber_fill_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ + Coord x[5]; + Coord y[5]; + x[0] = x[4] = x1; + y[0] = y[4] = y1; + x[1] = x1; + y[1] = y2; + x[2] = x2; + y[2] = y2; + x[3] = x2; + y[3] = y1; + gerber_fill_polygon(gc, 5, x, y); +} + +static void gerber_calibrate(double xval, double yval) +{ + CRASH; +} + +static void gerber_set_crosshair(int x, int y, int action) +{ +} + +void hid_gerber_init() +{ + memset(&gerber_hid, 0, sizeof(gerber_hid)); + + common_nogui_init(&gerber_hid); + common_draw_helpers_init(&gerber_hid); + + gerber_hid.struct_size = sizeof(gerber_hid); + gerber_hid.name = "gerber"; + gerber_hid.description = "RS-274X (Gerber) export"; + gerber_hid.exporter = 1; + + gerber_hid.get_export_options = gerber_get_export_options; + gerber_hid.do_export = gerber_do_export; + gerber_hid.parse_arguments = gerber_parse_arguments; + gerber_hid.set_layer = gerber_set_layer; + gerber_hid.make_gc = gerber_make_gc; + gerber_hid.destroy_gc = gerber_destroy_gc; + gerber_hid.use_mask = gerber_use_mask; + gerber_hid.set_color = gerber_set_color; + gerber_hid.set_line_cap = gerber_set_line_cap; + gerber_hid.set_line_width = gerber_set_line_width; + gerber_hid.set_draw_xor = gerber_set_draw_xor; + gerber_hid.draw_line = gerber_draw_line; + gerber_hid.draw_arc = gerber_draw_arc; + gerber_hid.draw_rect = gerber_draw_rect; + gerber_hid.fill_circle = gerber_fill_circle; + gerber_hid.fill_polygon = gerber_fill_polygon; + gerber_hid.fill_rect = gerber_fill_rect; + gerber_hid.calibrate = gerber_calibrate; + gerber_hid.set_crosshair = gerber_set_crosshair; + + hid_register_hid(&gerber_hid); +} Index: 1.0.8/src/hid/gerber/hid.conf =================================================================== --- 1.0.8/src/hid/gerber/hid.conf (nonexistent) +++ 1.0.8/src/hid/gerber/hid.conf (revision 1136) @@ -0,0 +1 @@ +type=export Index: 1.0.8/src/hid/gtk/ghid-cell-renderer-visibility.c =================================================================== --- 1.0.8/src/hid/gtk/ghid-cell-renderer-visibility.c (nonexistent) +++ 1.0.8/src/hid/gtk/ghid-cell-renderer-visibility.c (revision 1136) @@ -0,0 +1,255 @@ +/*! \file + * \brief Implementation of GtkCellRenderer for layer visibility toggler + * \par More Information + * For details on the functions implemented here, see the Gtk + * documentation for the GtkCellRenderer object, which defines + * the interface we are implementing. + */ + +#include +#include +#include + +#include "gtkhid.h" +#include "gui.h" + +#include "ghid-cell-renderer-visibility.h" + +enum { + TOGGLED, + LAST_SIGNAL +}; +static guint toggle_cell_signals[LAST_SIGNAL] = { 0 }; + +enum { + PROP_ACTIVE = 1, + PROP_COLOR +}; + +struct _GHidCellRendererVisibility { + GtkCellRenderer parent; + + gboolean active; + gchar *color; +}; + +struct _GHidCellRendererVisibilityClass { + GtkCellRendererClass parent_class; + + void (*toggled) (GHidCellRendererVisibility * cell, const gchar * path); +}; + +/* RENDERER FUNCTIONS */ +/*! \brief Calculates the window area the renderer will use */ +static void +ghid_cell_renderer_visibility_get_size(GtkCellRenderer * cell, + GtkWidget * widget, + GdkRectangle * cell_area, gint * x_offset, gint * y_offset, gint * width, gint * height) +{ + GtkStyle *style = gtk_widget_get_style(widget); + gint w, h; + gint xpad, ypad; + gfloat xalign, yalign; + + gtk_cell_renderer_get_padding(cell, &xpad, &ypad); + gtk_cell_renderer_get_alignment(cell, &xalign, &yalign); + + w = VISIBILITY_TOGGLE_SIZE + 2 * (xpad + style->xthickness); + h = VISIBILITY_TOGGLE_SIZE + 2 * (ypad + style->ythickness); + + if (width) + *width = w; + if (height) + *height = h; + + if (cell_area) { + if (x_offset) { + if (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL) + xalign = 1. - xalign; + *x_offset = MAX(0, xalign * (cell_area->width - w)); + } + if (y_offset) + *y_offset = MAX(0, yalign * (cell_area->height - h)); + } +} + +/*! \brief Actually renders the swatch */ +static void +ghid_cell_renderer_visibility_render(GtkCellRenderer * cell, + GdkWindow * window, + GtkWidget * widget, + GdkRectangle * background_area, + GdkRectangle * cell_area, GdkRectangle * expose_area, GtkCellRendererState flags) +{ + GHidCellRendererVisibility *pcb_cell; + GdkRectangle toggle_rect; + GdkRectangle draw_rect; + gint xpad, ypad; + + pcb_cell = GHID_CELL_RENDERER_VISIBILITY(cell); + ghid_cell_renderer_visibility_get_size(cell, widget, cell_area, + &toggle_rect.x, &toggle_rect.y, &toggle_rect.width, &toggle_rect.height); + gtk_cell_renderer_get_padding(cell, &xpad, &ypad); + + toggle_rect.x += cell_area->x + xpad; + toggle_rect.y += cell_area->y + ypad; + toggle_rect.width -= xpad * 2; + toggle_rect.height -= ypad * 2; + + if (toggle_rect.width <= 0 || toggle_rect.height <= 0) + return; + + if (gdk_rectangle_intersect(expose_area, cell_area, &draw_rect)) { + GdkColor color; + cairo_t *cr = gdk_cairo_create(window); + if (expose_area) { + gdk_cairo_rectangle(cr, expose_area); + cairo_clip(cr); + } + cairo_set_line_width(cr, 1); + + cairo_rectangle(cr, toggle_rect.x + 0.5, toggle_rect.y + 0.5, toggle_rect.width - 1, toggle_rect.height - 1); + cairo_set_source_rgb(cr, 1, 1, 1); + cairo_fill_preserve(cr); + cairo_set_source_rgb(cr, 0, 0, 0); + cairo_stroke(cr); + + gdk_color_parse(pcb_cell->color, &color); + if (flags & GTK_CELL_RENDERER_PRELIT) { + color.red = (4 * color.red + 65535) / 5; + color.green = (4 * color.green + 65535) / 5; + color.blue = (4 * color.blue + 65535) / 5; + } + gdk_cairo_set_source_color(cr, &color); + if (pcb_cell->active) + cairo_rectangle(cr, toggle_rect.x + 0.5, toggle_rect.y + 0.5, toggle_rect.width - 1, toggle_rect.height - 1); + else { + cairo_move_to(cr, toggle_rect.x + 1, toggle_rect.y + 1); + cairo_rel_line_to(cr, toggle_rect.width / 2, 0); + cairo_rel_line_to(cr, -toggle_rect.width / 2, toggle_rect.width / 2); + cairo_close_path(cr); + } + cairo_fill(cr); + + cairo_destroy(cr); + } +} + +/*! \brief Toggless the swatch */ +static gint +ghid_cell_renderer_visibility_activate(GtkCellRenderer * cell, + GdkEvent * event, + GtkWidget * widget, + const gchar * path, + GdkRectangle * background_area, GdkRectangle * cell_area, GtkCellRendererState flags) +{ + g_signal_emit(cell, toggle_cell_signals[TOGGLED], 0, path); + return TRUE; +} + +/* Setter/Getter */ +static void ghid_cell_renderer_visibility_get_property(GObject * object, guint param_id, GValue * value, GParamSpec * pspec) +{ + GHidCellRendererVisibility *pcb_cell = GHID_CELL_RENDERER_VISIBILITY(object); + + switch (param_id) { + case PROP_ACTIVE: + g_value_set_boolean(value, pcb_cell->active); + break; + case PROP_COLOR: + g_value_set_string(value, pcb_cell->color); + break; + } +} + +static void +ghid_cell_renderer_visibility_set_property(GObject * object, guint param_id, const GValue * value, GParamSpec * pspec) +{ + GHidCellRendererVisibility *pcb_cell = GHID_CELL_RENDERER_VISIBILITY(object); + + switch (param_id) { + case PROP_ACTIVE: + pcb_cell->active = g_value_get_boolean(value); + break; + case PROP_COLOR: + g_free(pcb_cell->color); + pcb_cell->color = g_value_dup_string(value); + break; + } +} + + +/* CONSTRUCTOR */ +static void ghid_cell_renderer_visibility_init(GHidCellRendererVisibility * ls) +{ + g_object_set(ls, "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL); +} + +static void ghid_cell_renderer_visibility_class_init(GHidCellRendererVisibilityClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS(klass); + GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS(klass); + + object_class->get_property = ghid_cell_renderer_visibility_get_property; + object_class->set_property = ghid_cell_renderer_visibility_set_property; + + cell_class->get_size = ghid_cell_renderer_visibility_get_size; + cell_class->render = ghid_cell_renderer_visibility_render; + cell_class->activate = ghid_cell_renderer_visibility_activate; + + g_object_class_install_property(object_class, PROP_ACTIVE, + g_param_spec_boolean("active", + _("Visibility state"), + _("Visibility of the layer"), FALSE, G_PARAM_READWRITE)); + g_object_class_install_property(object_class, PROP_COLOR, + g_param_spec_string("color", _("Layer color"), _("Layer color"), FALSE, G_PARAM_READWRITE)); + + + /** + * GHidCellRendererVisibility::toggled: + * @cell_renderer: the object which received the signal + * @path: string representation of #GtkTreePath describing the + * event location + * + * The ::toggled signal is emitted when the cell is toggled. + **/ + toggle_cell_signals[TOGGLED] = + g_signal_new(_("toggled"), + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(GHidCellRendererVisibilityClass, toggled), + NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); +} + +/* PUBLIC FUNCTIONS */ +GType ghid_cell_renderer_visibility_get_type(void) +{ + static GType ls_type = 0; + + if (!ls_type) { + const GTypeInfo ls_info = { + sizeof(GHidCellRendererVisibilityClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) ghid_cell_renderer_visibility_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(GHidCellRendererVisibility), + 0, /* n_preallocs */ + (GInstanceInitFunc) ghid_cell_renderer_visibility_init, + }; + + ls_type = g_type_register_static(GTK_TYPE_CELL_RENDERER, "GHidCellRendererVisibility", &ls_info, 0); + } + + return ls_type; +} + +GtkCellRenderer *ghid_cell_renderer_visibility_new(void) +{ + GHidCellRendererVisibility *rv = g_object_new(GHID_CELL_RENDERER_VISIBILITY_TYPE, NULL); + + rv->active = FALSE; + + return GTK_CELL_RENDERER(rv); +} Index: 1.0.8/src/hid/gtk/ghid-cell-renderer-visibility.h =================================================================== --- 1.0.8/src/hid/gtk/ghid-cell-renderer-visibility.h (nonexistent) +++ 1.0.8/src/hid/gtk/ghid-cell-renderer-visibility.h (revision 1136) @@ -0,0 +1,21 @@ +#ifndef GHID_CELL_RENDERER_VISIBILITY_H__ +#define GHID_CELL_RENDERER_VISIBILITY_H__ + +#include +#include + +G_BEGIN_DECLS /* keep c++ happy */ +#define VISIBILITY_TOGGLE_SIZE 16 +#define GHID_CELL_RENDERER_VISIBILITY_TYPE (ghid_cell_renderer_visibility_get_type ()) +#define GHID_CELL_RENDERER_VISIBILITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GHID_CELL_RENDERER_VISIBILITY_TYPE, GHidCellRendererVisibility)) +#define GHID_CELL_RENDERER_VISIBILITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GHID_CELL_RENDERER_VISIBILITY_TYPE, GHidCellRendererVisibilityClass)) +#define IS_GHID_CELL_RENDERER_VISIBILITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GHID_CELL_RENDERER_VISIBILITY_TYPE)) +#define IS_GHID_CELL_RENDERER_VISIBILITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GHID_CELL_RENDERER_VISIBILITY_TYPE)) +typedef struct _GHidCellRendererVisibility GHidCellRendererVisibility; +typedef struct _GHidCellRendererVisibilityClass GHidCellRendererVisibilityClass; + +GType ghid_cell_renderer_visibility_get_type(void); +GtkCellRenderer *ghid_cell_renderer_visibility_new(void); + +G_END_DECLS /* keep c++ happy */ +#endif Index: 1.0.8/src/hid/gtk/ghid-coord-entry.c =================================================================== --- 1.0.8/src/hid/gtk/ghid-coord-entry.c (nonexistent) +++ 1.0.8/src/hid/gtk/ghid-coord-entry.c (revision 1136) @@ -0,0 +1,281 @@ +/*! \file + * \brief Implementation of GHidCoordEntry widget + * \par Description + * This widget is a modified spinbox for the user to enter + * pcb coords. It is assigned a default unit (for display), + * but this can be changed by the user by typing a new one + * or right-clicking on the box. + * + * Internally, it keeps track of its value in pcb coords. + * From the user's perspective, it uses natural human units. + */ + +#include +#include +#include + +#include "gtkhid.h" +#include "gui.h" +#include "pcb-printf.h" + +#include "ghid-coord-entry.h" + +enum { + UNIT_CHANGE_SIGNAL, + LAST_SIGNAL +}; + +static guint ghid_coord_entry_signals[LAST_SIGNAL] = { 0 }; + +struct _GHidCoordEntry { + GtkSpinButton parent; + + Coord min_value; + Coord max_value; + Coord value; + + enum ce_step_size step_size; + const Unit *unit; +}; + +struct _GHidCoordEntryClass { + GtkSpinButtonClass parent_class; + + void (*change_unit) (GHidCoordEntry *, const Unit *); +}; + +/* SIGNAL HANDLERS */ +/*! \brief Callback for "Change Unit" menu click */ +static void menu_item_activate_cb(GtkMenuItem * item, GHidCoordEntry * ce) +{ + const char *text = gtk_menu_item_get_label(item); + const Unit *unit = get_unit_struct(text); + + g_signal_emit(ce, ghid_coord_entry_signals[UNIT_CHANGE_SIGNAL], 0, unit); +} + +/*! \brief Callback for context menu creation */ +static void ghid_coord_entry_popup_cb(GHidCoordEntry * ce, GtkMenu * menu, gpointer data) +{ + int i, n; + const Unit *unit_list; + GtkWidget *menu_item, *submenu; + + /* Build submenu */ + n = get_n_units(); + unit_list = get_unit_list(); + + submenu = gtk_menu_new(); + for (i = 0; i < n; ++i) { + menu_item = gtk_menu_item_new_with_label(unit_list[i].suffix); + g_signal_connect(G_OBJECT(menu_item), "activate", G_CALLBACK(menu_item_activate_cb), ce); + gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menu_item); + gtk_widget_show(menu_item); + } + + /* Add submenu to menu */ + menu_item = gtk_separator_menu_item_new(); + gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), menu_item); + gtk_widget_show(menu_item); + + menu_item = gtk_menu_item_new_with_label(_("Change Units")); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), submenu); + gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), menu_item); + gtk_widget_show(menu_item); +} + +/*! \brief Callback for user output */ +static gboolean ghid_coord_entry_output_cb(GHidCoordEntry * ce, gpointer data) +{ + GtkAdjustment *adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(ce)); + double value = gtk_adjustment_get_value(adj); + gchar *text; + + text = pcb_g_strdup_printf("%.*f %s", ce->unit->default_prec, value, ce->unit->suffix); + gtk_entry_set_text(GTK_ENTRY(ce), text); + g_free(text); + + return TRUE; +} + +/*! \brief Callback for user input */ +static gboolean ghid_coord_text_changed_cb(GHidCoordEntry * entry, gpointer data) +{ + const char *text; + char *suffix; + const Unit *new_unit; + double value; + + /* Check if units have changed */ + text = gtk_entry_get_text(GTK_ENTRY(entry)); + value = strtod(text, &suffix); + new_unit = get_unit_struct(suffix); + if (new_unit && new_unit != entry->unit) { + entry->value = unit_to_coord(new_unit, value); + g_signal_emit(entry, ghid_coord_entry_signals[UNIT_CHANGE_SIGNAL], 0, new_unit); + } + + return FALSE; +} + +/*! \brief Callback for change in value (input or ^v clicks) */ +static gboolean ghid_coord_value_changed_cb(GHidCoordEntry * ce, gpointer data) +{ + GtkAdjustment *adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(ce)); + + /* Re-calculate internal value */ + double value = gtk_adjustment_get_value(adj); + ce->value = unit_to_coord(ce->unit, value); + /* Handle potential unit changes */ + ghid_coord_text_changed_cb(ce, data); + + return FALSE; +} + +/*! \brief Change the unit used by a coord entry + * + * \param [in] ce The entry to be acted on + * \parin [in] new_unit The new unit to be used + */ +static void ghid_coord_entry_change_unit(GHidCoordEntry * ce, const Unit * new_unit) +{ + double climb_rate = 0.0; + GtkAdjustment *adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(ce)); + + ce->unit = new_unit; + /* Re-calculate min/max values for spinbox */ + gtk_adjustment_configure(adj, coord_to_unit(new_unit, ce->value), + coord_to_unit(new_unit, ce->min_value), + coord_to_unit(new_unit, ce->max_value), ce->unit->step_small, ce->unit->step_medium, 0.0); + + switch (ce->step_size) { + case CE_TINY: + climb_rate = new_unit->step_tiny; + break; + case CE_SMALL: + climb_rate = new_unit->step_small; + break; + case CE_MEDIUM: + climb_rate = new_unit->step_medium; + break; + case CE_LARGE: + climb_rate = new_unit->step_large; + break; + } + gtk_spin_button_configure(GTK_SPIN_BUTTON(ce), adj, climb_rate, new_unit->default_prec + strlen(new_unit->suffix)); +} + +/* CONSTRUCTOR */ +static void ghid_coord_entry_init(GHidCoordEntry * ce) +{ + /* Hookup signal handlers */ + g_signal_connect(G_OBJECT(ce), "focus_out_event", G_CALLBACK(ghid_coord_text_changed_cb), NULL); + g_signal_connect(G_OBJECT(ce), "value_changed", G_CALLBACK(ghid_coord_value_changed_cb), NULL); + g_signal_connect(G_OBJECT(ce), "populate_popup", G_CALLBACK(ghid_coord_entry_popup_cb), NULL); + g_signal_connect(G_OBJECT(ce), "output", G_CALLBACK(ghid_coord_entry_output_cb), NULL); +} + +static void ghid_coord_entry_class_init(GHidCoordEntryClass * klass) +{ + klass->change_unit = ghid_coord_entry_change_unit; + + /* GtkAutoComplete *ce : the object acted on */ + /* const Unit *new_unit: the new unit that was set */ + ghid_coord_entry_signals[UNIT_CHANGE_SIGNAL] = + g_signal_new("change-unit", + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET(GHidCoordEntryClass, change_unit), + NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); + +} + +/* PUBLIC FUNCTIONS */ +GType ghid_coord_entry_get_type(void) +{ + static GType ce_type = 0; + + if (!ce_type) { + const GTypeInfo ce_info = { + sizeof(GHidCoordEntryClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) ghid_coord_entry_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(GHidCoordEntry), + 0, /* n_preallocs */ + (GInstanceInitFunc) ghid_coord_entry_init, + }; + + ce_type = g_type_register_static(GTK_TYPE_SPIN_BUTTON, "GHidCoordEntry", &ce_info, 0); + } + + return ce_type; +} + +/*! \brief Create a new GHidCoordEntry + * + * \param [in] min_val The minimum allowed value, in pcb coords + * \param [in] max_val The maximum allowed value, in pcb coords + * \param [in] value The default value, in pcb coords + * \param [in] unit The default unit + * \param [in] step_size How large the default increments should be + * + * \return a freshly-allocated GHidCoordEntry + */ +GtkWidget *ghid_coord_entry_new(Coord min_val, Coord max_val, Coord value, const Unit * unit, enum ce_step_size step_size) +{ + /* Setup spinbox min/max values */ + double small_step, big_step; + GtkAdjustment *adj; + GHidCoordEntry *ce = g_object_new(GHID_COORD_ENTRY_TYPE, NULL); + + ce->unit = unit; + ce->min_value = min_val; + ce->max_value = max_val; + ce->value = value; + + ce->step_size = step_size; + switch (step_size) { + case CE_TINY: + small_step = unit->step_tiny; + big_step = unit->step_small; + break; + case CE_SMALL: + small_step = unit->step_small; + big_step = unit->step_medium; + break; + case CE_MEDIUM: + small_step = unit->step_medium; + big_step = unit->step_large; + break; + case CE_LARGE: + small_step = unit->step_large; + big_step = unit->step_huge; + break; + default: + small_step = big_step = 0; + break; + } + + adj = GTK_ADJUSTMENT(gtk_adjustment_new(coord_to_unit(unit, value), + coord_to_unit(unit, min_val), + coord_to_unit(unit, max_val), small_step, big_step, 0.0)); + gtk_spin_button_configure(GTK_SPIN_BUTTON(ce), adj, small_step, unit->default_prec + strlen(unit->suffix)); + gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(ce), FALSE); + + return GTK_WIDGET(ce); +} + +/*! \brief Gets a GHidCoordEntry's value, in pcb coords */ +Coord ghid_coord_entry_get_value(GHidCoordEntry * ce) +{ + return ce->value; +} + +/*! \brief Sets a GHidCoordEntry's value, in pcb coords */ +void ghid_coord_entry_set_value(GHidCoordEntry * ce, Coord val) +{ + gtk_spin_button_set_value(GTK_SPIN_BUTTON(ce), coord_to_unit(ce->unit, val)); +} Index: 1.0.8/src/hid/gtk/ghid-coord-entry.h =================================================================== --- 1.0.8/src/hid/gtk/ghid-coord-entry.h (nonexistent) +++ 1.0.8/src/hid/gtk/ghid-coord-entry.h (revision 1136) @@ -0,0 +1,32 @@ +/* This is the modified GtkSpinbox used for entering Coords. + * Hopefully it can be used as a template whenever we migrate the + * rest of the Gtk HID to use GObjects and GtkWidget subclassing. + */ +#ifndef GHID_COORD_ENTRY_H__ +#define GHID_COORD_ENTRY_H__ + +#include +#include + +G_BEGIN_DECLS /* keep c++ happy */ +#define GHID_COORD_ENTRY_TYPE (ghid_coord_entry_get_type ()) +#define GHID_COORD_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GHID_COORD_ENTRY_TYPE, GHidCoordEntry)) +#define GHID_COORD_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GHID_COORD_ENTRY_TYPE, GHidCoordEntryClass)) +#define IS_GHID_COORD_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GHID_COORD_ENTRY_TYPE)) +#define IS_GHID_COORD_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GHID_COORD_ENTRY_TYPE)) +typedef struct _GHidCoordEntry GHidCoordEntry; +typedef struct _GHidCoordEntryClass GHidCoordEntryClass; + +/* Step sizes */ +enum ce_step_size { CE_TINY, CE_SMALL, CE_MEDIUM, CE_LARGE }; + +GType ghid_coord_entry_get_type(void); +GtkWidget *ghid_coord_entry_new(Coord min_val, Coord max_val, Coord value, const Unit * unit, enum ce_step_size step_size); +void ghid_coord_entry_add_entry(GHidCoordEntry * ce, const gchar * name, const gchar * desc); +gchar *ghid_coord_entry_get_last_command(GHidCoordEntry * ce); + +Coord ghid_coord_entry_get_value(GHidCoordEntry * ce); +void ghid_coord_entry_set_value(GHidCoordEntry * ce, Coord val); + +G_END_DECLS /* keep c++ happy */ +#endif Index: 1.0.8/src/hid/gtk/ghid-layer-selector.c =================================================================== --- 1.0.8/src/hid/gtk/ghid-layer-selector.c (nonexistent) +++ 1.0.8/src/hid/gtk/ghid-layer-selector.c (revision 1136) @@ -0,0 +1,806 @@ +/*! \file + * \brief Implementation of GHidLayerSelector widget + * \par Description + * This widget is the layer selector on the left side of the Gtk + * GUI. It also builds the relevant sections of the menu for layer + * selection and visibility toggling, and keeps these in sync. + */ + +#include +#include +#include +#include + +#include "gtkhid.h" +#include "gui.h" +#include "pcb-printf.h" + +#include "ghid-layer-selector.h" +#include "ghid-cell-renderer-visibility.h" + +#define INITIAL_ACTION_MAX 40 + +/* Forward dec'ls */ +struct _layer; +static void ghid_layer_selector_finalize(GObject * object); +static void menu_pick_cb(GtkRadioAction * action, struct _layer *ldata); + +/*! \brief Signals exposed by the widget */ +enum { + SELECT_LAYER_SIGNAL, + TOGGLE_LAYER_SIGNAL, + LAST_SIGNAL +}; + +/*! \brief Columns used for internal data store */ +enum { + STRUCT_COL, + USER_ID_COL, + VISIBLE_COL, + COLOR_COL, + TEXT_COL, + FONT_COL, + ACTIVATABLE_COL, + SEPARATOR_COL, + N_COLS +}; + +static GtkTreeView *ghid_layer_selector_parent_class; +static guint ghid_layer_selector_signals[LAST_SIGNAL] = { 0 }; + +struct _GHidLayerSelector { + GtkTreeView parent; + + GtkListStore *list_store; + GtkTreeSelection *selection; + GtkTreeViewColumn *visibility_column; + + GtkActionGroup *action_group; + GtkAccelGroup *accel_group; + + GSList *radio_group; + int n_actions; + + gboolean accel_available[20]; + + gboolean last_activatable; + + gulong selection_changed_sig_id; +}; + +struct _GHidLayerSelectorClass { + GtkTreeViewClass parent_class; + + void (*select_layer) (GHidLayerSelector *, gint); + void (*toggle_layer) (GHidLayerSelector *, gint); +}; + +struct _layer { + gint accel_index; /* Index into ls->accel_available */ + GtkWidget *pick_item; + GtkWidget *view_item; + GtkToggleAction *view_action; + GtkRadioAction *pick_action; + GtkTreeRowReference *rref; +}; + +/*! \brief Deletes the action and accelerator from a layer */ +static void free_ldata(GHidLayerSelector * ls, struct _layer *ldata) +{ + if (ldata->pick_action) { + gtk_action_disconnect_accelerator(GTK_ACTION(ldata->pick_action)); + gtk_action_group_remove_action(ls->action_group, GTK_ACTION(ldata->pick_action)); +/* TODO: make this work without wrecking the radio action group + * g_object_unref (G_OBJECT (ldata->pick_action)); + * */ + } + if (ldata->view_action) { + gtk_action_disconnect_accelerator(GTK_ACTION(ldata->view_action)); + gtk_action_group_remove_action(ls->action_group, GTK_ACTION(ldata->view_action)); + g_object_unref(G_OBJECT(ldata->view_action)); + } + gtk_tree_row_reference_free(ldata->rref); + if (ldata->accel_index >= 0) + ls->accel_available[ldata->accel_index] = TRUE; + g_free(ldata); + +} + +/*! \brief internal set-visibility function -- emits no signals */ +static void set_visibility(GHidLayerSelector * ls, GtkTreeIter * iter, struct _layer *ldata, gboolean state) +{ + gtk_list_store_set(ls->list_store, iter, VISIBLE_COL, state, -1); + + if (ldata) { + gtk_action_block_activate(GTK_ACTION(ldata->view_action)); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ldata->view_item), state); + gtk_action_unblock_activate(GTK_ACTION(ldata->view_action)); + } +} + +/*! \brief Flip the visibility state of a given layer + * \par Function Description + * Changes the internal toggle state and menu checkbox state + * of the layer pointed to by iter. Emits a toggle-layer signal. + * + * \param [in] ls The selector to be acted on + * \param [in] iter A GtkTreeIter pointed at the relevant layer + * \param [in] emit Whether or not to emit a signal + */ +static void toggle_visibility(GHidLayerSelector * ls, GtkTreeIter * iter, gboolean emit) +{ + gint user_id; + struct _layer *ldata; + gboolean toggle; + gtk_tree_model_get(GTK_TREE_MODEL(ls->list_store), iter, USER_ID_COL, &user_id, VISIBLE_COL, &toggle, STRUCT_COL, &ldata, -1); + set_visibility(ls, iter, ldata, !toggle); + if (emit) + g_signal_emit(ls, ghid_layer_selector_signals[TOGGLE_LAYER_SIGNAL], 0, user_id); +} + +/*! \brief Decide if a GtkListStore entry is a layer or separator */ +static gboolean tree_view_separator_func(GtkTreeModel * model, GtkTreeIter * iter, gpointer data) +{ + gboolean ret_val; + gtk_tree_model_get(model, iter, SEPARATOR_COL, &ret_val, -1); + return ret_val; +} + +/*! \brief Decide if a GtkListStore entry may be selected */ +static gboolean +tree_selection_func(GtkTreeSelection * selection, GtkTreeModel * model, GtkTreePath * path, gboolean selected, gpointer data) +{ + GtkTreeIter iter; + + if (gtk_tree_model_get_iter(model, &iter, path)) { + gboolean activatable; + gtk_tree_model_get(model, &iter, ACTIVATABLE_COL, &activatable, -1); + return activatable; + } + + return FALSE; +} + +/* SIGNAL HANDLERS */ +/*! \brief Callback for mouse-click: toggle visibility */ +static gboolean button_press_cb(GHidLayerSelector * ls, GdkEventButton * event) +{ + /* Handle visibility independently to prevent changing the active + * layer, which will happen if we let this event propagate. */ + GtkTreeViewColumn *column; + GtkTreePath *path; + + /* Ignore the synthetic presses caused by double and tripple clicks, and + * also ignore all but left-clicks + */ + if (event->type != GDK_BUTTON_PRESS || event->button != 1) + return TRUE; + + if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(ls), event->x, event->y, &path, &column, NULL, NULL)) { + GtkTreeIter iter; + gboolean activatable, separator; + gtk_tree_model_get_iter(GTK_TREE_MODEL(ls->list_store), &iter, path); + gtk_tree_model_get(GTK_TREE_MODEL(ls->list_store), &iter, ACTIVATABLE_COL, &activatable, SEPARATOR_COL, &separator, -1); + /* Toggle visibility for non-activatable layers no matter + * where you click. */ + if (!separator && (column == ls->visibility_column || !activatable)) { + toggle_visibility(ls, &iter, TRUE); + return TRUE; + } + } + return FALSE; +} + +/*! \brief Callback for layer selection change: sync menu, emit signal */ +static void selection_changed_cb(GtkTreeSelection * selection, GHidLayerSelector * ls) +{ + GtkTreeIter iter; + if (gtk_tree_selection_get_selected(selection, NULL, &iter)) { + gint user_id; + struct _layer *ldata; + gtk_tree_model_get(GTK_TREE_MODEL(ls->list_store), &iter, STRUCT_COL, &ldata, USER_ID_COL, &user_id, -1); + + if (ldata && ldata->pick_action) { + gtk_action_block_activate(GTK_ACTION(ldata->pick_action)); + gtk_radio_action_set_current_value(ldata->pick_action, user_id); + gtk_action_unblock_activate(GTK_ACTION(ldata->pick_action)); + } + g_signal_emit(ls, ghid_layer_selector_signals[SELECT_LAYER_SIGNAL], 0, user_id); + } +} + +/*! \brief Callback for menu actions: sync layer selection list, emit signal */ +static void menu_view_cb(GtkToggleAction * action, struct _layer *ldata) +{ + GHidLayerSelector *ls; + GtkTreeModel *model = gtk_tree_row_reference_get_model(ldata->rref); + GtkTreePath *path = gtk_tree_row_reference_get_path(ldata->rref); + gboolean state = gtk_toggle_action_get_active(action); + GtkTreeIter iter; + gint user_id; + + gtk_tree_model_get_iter(model, &iter, path); + gtk_list_store_set(GTK_LIST_STORE(model), &iter, VISIBLE_COL, state, -1); + gtk_tree_model_get(model, &iter, USER_ID_COL, &user_id, -1); + + ls = g_object_get_data(G_OBJECT(model), "layer-selector"); + g_signal_emit(ls, ghid_layer_selector_signals[TOGGLE_LAYER_SIGNAL], 0, user_id); +} + +/*! \brief Callback for menu actions: sync layer selection list, emit signal */ +static void menu_pick_cb(GtkRadioAction * action, struct _layer *ldata) +{ + /* We only care about the activation signal (as opposed to deactivation). + * A row we are /deactivating/ might not even exist anymore! */ + if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action))) { + GHidLayerSelector *ls; + GtkTreeModel *model = gtk_tree_row_reference_get_model(ldata->rref); + GtkTreePath *path = gtk_tree_row_reference_get_path(ldata->rref); + GtkTreeIter iter; + gint user_id; + + gtk_tree_model_get_iter(model, &iter, path); + gtk_tree_model_get(model, &iter, USER_ID_COL, &user_id, -1); + + ls = g_object_get_data(G_OBJECT(model), "layer-selector"); + g_signal_handler_block(ls->selection, ls->selection_changed_sig_id); + gtk_tree_selection_select_path(ls->selection, path); + g_signal_handler_unblock(ls->selection, ls->selection_changed_sig_id); + g_signal_emit(ls, ghid_layer_selector_signals[SELECT_LAYER_SIGNAL], 0, user_id); + } +} + +/* CONSTRUCTOR */ +static void ghid_layer_selector_init(GHidLayerSelector * ls) +{ + /* Hookup signal handlers */ +} + +static void ghid_layer_selector_class_init(GHidLayerSelectorClass * klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + ghid_layer_selector_signals[SELECT_LAYER_SIGNAL] = + g_signal_new("select-layer", + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET(GHidLayerSelectorClass, select_layer), + NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); + ghid_layer_selector_signals[TOGGLE_LAYER_SIGNAL] = + g_signal_new("toggle-layer", + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET(GHidLayerSelectorClass, toggle_layer), + NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); + + object_class->finalize = ghid_layer_selector_finalize; +} + +/*! \brief Clean up object before garbage collection + */ +static void ghid_layer_selector_finalize(GObject * object) +{ + GtkTreeIter iter; + GHidLayerSelector *ls = (GHidLayerSelector *) object; + + g_object_unref(ls->accel_group); + g_object_unref(ls->action_group); + + gtk_tree_model_get_iter_first(GTK_TREE_MODEL(ls->list_store), &iter); + do { + struct _layer *ldata; + gtk_tree_model_get(GTK_TREE_MODEL(ls->list_store), &iter, STRUCT_COL, &ldata, -1); + free_ldata(ls, ldata); + } + while (gtk_tree_model_iter_next(GTK_TREE_MODEL(ls->list_store), &iter)); + + G_OBJECT_CLASS(ghid_layer_selector_parent_class)->finalize(object); +} + +/* PUBLIC FUNCTIONS */ +GType ghid_layer_selector_get_type(void) +{ + static GType ls_type = 0; + + if (!ls_type) { + const GTypeInfo ls_info = { + sizeof(GHidLayerSelectorClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) ghid_layer_selector_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(GHidLayerSelector), + 0, /* n_preallocs */ + (GInstanceInitFunc) ghid_layer_selector_init, + }; + + ls_type = g_type_register_static(GTK_TYPE_TREE_VIEW, "GHidLayerSelector", &ls_info, 0); + } + + return ls_type; +} + +/*! \brief Create a new GHidLayerSelector + * + * \return a freshly-allocated GHidLayerSelector. + */ +GtkWidget *ghid_layer_selector_new(void) +{ + int i; + GtkCellRenderer *renderer1 = ghid_cell_renderer_visibility_new(); + GtkCellRenderer *renderer2 = gtk_cell_renderer_text_new(); + GtkTreeViewColumn *opacity_col = gtk_tree_view_column_new_with_attributes("", renderer1, + "active", VISIBLE_COL, + "color", COLOR_COL, NULL); + GtkTreeViewColumn *name_col = gtk_tree_view_column_new_with_attributes("", renderer2, + "text", TEXT_COL, + "font", FONT_COL, + NULL); + + GHidLayerSelector *ls = g_object_new(GHID_LAYER_SELECTOR_TYPE, NULL); + + /* action index, active, color, text, font, is_separator */ + ls->list_store = gtk_list_store_new(N_COLS, G_TYPE_POINTER, G_TYPE_INT, + G_TYPE_BOOLEAN, G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN); + gtk_tree_view_insert_column(GTK_TREE_VIEW(ls), opacity_col, -1); + gtk_tree_view_insert_column(GTK_TREE_VIEW(ls), name_col, -1); + gtk_tree_view_set_model(GTK_TREE_VIEW(ls), GTK_TREE_MODEL(ls->list_store)); + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(ls), FALSE); + + ls->last_activatable = TRUE; + ls->visibility_column = opacity_col; + ls->selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(ls)); + ls->accel_group = gtk_accel_group_new(); + ls->action_group = gtk_action_group_new("LayerSelector"); + ls->n_actions = 0; + for (i = 0; i < 20; ++i) + ls->accel_available[i] = TRUE; + + gtk_tree_view_set_row_separator_func(GTK_TREE_VIEW(ls), tree_view_separator_func, NULL, NULL); + gtk_tree_selection_set_select_function(ls->selection, tree_selection_func, NULL, NULL); + gtk_tree_selection_set_mode(ls->selection, GTK_SELECTION_BROWSE); + + g_object_set_data(G_OBJECT(ls->list_store), "layer-selector", ls); + g_signal_connect(ls, "button_press_event", G_CALLBACK(button_press_cb), NULL); + ls->selection_changed_sig_id = g_signal_connect(ls->selection, "changed", G_CALLBACK(selection_changed_cb), ls); + + g_object_ref(ls->accel_group); + + return GTK_WIDGET(ls); +} + +/*! \brief Add a layer to a GHidLayerSelector. + * \par Function Description + * This function adds an entry to a GHidLayerSelector, which will + * appear in the layer-selection list as well as visibility and selection + * menus (assuming this is a selectable layer). For the first 20 layers, + * keyboard accelerators will be added for selection/visibility toggling. + * + * If the user_id passed already exists in the layer selector, that layer + * will have its data overwritten with the new stuff. + * + * \param [in] ls The selector to be acted on + * \param [in] user_id An ID used to identify the layer; will be passed to selection/visibility callbacks + * \param [in] name The name of the layer; will be used on selector and menus + * \param [in] color_string The color of the layer on selector + * \param [in] visibile Whether the layer is visible + * \param [in] activatable Whether the layer appears in menus and can be selected + */ +void +ghid_layer_selector_add_layer(GHidLayerSelector * ls, + gint user_id, + const gchar * name, const gchar * color_string, gboolean visible, gboolean activatable) +{ + struct _layer *new_layer = NULL; + gchar *pname, *vname; + gboolean new_iter = TRUE; + gboolean last_activatable = TRUE; + GtkTreePath *path; + GtkTreeIter iter; + int i; + + /* Look for existing layer with this ID */ + if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(ls->list_store), &iter)) + do { + gboolean is_sep, active; + gint read_id; + gtk_tree_model_get(GTK_TREE_MODEL(ls->list_store), + &iter, USER_ID_COL, &read_id, SEPARATOR_COL, &is_sep, ACTIVATABLE_COL, &active, -1); + if (!is_sep) { + last_activatable = active; + if (read_id == user_id) { + new_iter = FALSE; + break; + } + } + } + while (gtk_tree_model_iter_next(GTK_TREE_MODEL(ls->list_store), &iter)); + + /* Handle separator addition */ + if (new_iter) { + if (activatable != last_activatable) { + /* Add separator between activatable/non-activatable boundaries */ + gtk_list_store_append(ls->list_store, &iter); + gtk_list_store_set(ls->list_store, &iter, STRUCT_COL, NULL, SEPARATOR_COL, TRUE, -1); + } + /* Create new layer */ + new_layer = malloc(sizeof(*new_layer)); + gtk_list_store_append(ls->list_store, &iter); + gtk_list_store_set(ls->list_store, &iter, + STRUCT_COL, new_layer, + USER_ID_COL, user_id, + VISIBLE_COL, visible, + COLOR_COL, color_string, + TEXT_COL, name, + FONT_COL, activatable ? NULL : "Italic", ACTIVATABLE_COL, activatable, SEPARATOR_COL, FALSE, -1); + } + else { + /* If the row exists, we clear out its ldata to create + * a new action, accelerator and menu item. */ + gtk_tree_model_get(GTK_TREE_MODEL(ls->list_store), &iter, STRUCT_COL, &new_layer, -1); + free_ldata(ls, new_layer); + new_layer = malloc(sizeof(*new_layer)); + + gtk_list_store_set(ls->list_store, &iter, + STRUCT_COL, new_layer, + VISIBLE_COL, visible, + COLOR_COL, color_string, + TEXT_COL, name, FONT_COL, activatable ? NULL : "Italic", ACTIVATABLE_COL, activatable, -1); + } + + /* -- Setup new actions -- */ + vname = g_strdup_printf("LayerView%d", ls->n_actions); + pname = g_strdup_printf("LayerPick%d", ls->n_actions); + + /* Create row reference for actions */ + path = gtk_tree_model_get_path(GTK_TREE_MODEL(ls->list_store), &iter); + new_layer->rref = gtk_tree_row_reference_new(GTK_TREE_MODEL(ls->list_store), path); + gtk_tree_path_free(path); + + /* Create selection action */ + if (activatable) { + new_layer->pick_action = gtk_radio_action_new(pname, name, NULL, NULL, user_id); + gtk_radio_action_set_group(new_layer->pick_action, ls->radio_group); + ls->radio_group = gtk_radio_action_get_group(new_layer->pick_action); + } + else + new_layer->pick_action = NULL; + + /* Create visibility action */ + new_layer->view_action = gtk_toggle_action_new(vname, name, NULL, NULL); + gtk_toggle_action_set_active(new_layer->view_action, visible); + + /* Determine keyboard accelerators */ + for (i = 0; i < 20; ++i) + if (ls->accel_available[i]) + break; + if (i < 20) { + /* Map 1-0 to actions 1-10 (with '0' meaning 10) */ + gchar *accel1 = g_strdup_printf("%s%d", + i < 10 ? "" : "", + (i + 1) % 10); + gchar *accel2 = g_strdup_printf("%s%d", + i < 10 ? "" : "", + (i + 1) % 10); + + if (activatable) { + GtkAction *action = GTK_ACTION(new_layer->pick_action); + gtk_action_set_accel_group(action, ls->accel_group); + gtk_action_group_add_action_with_accel(ls->action_group, action, accel1); + gtk_action_connect_accelerator(action); + g_signal_connect(G_OBJECT(action), "activate", G_CALLBACK(menu_pick_cb), new_layer); + } + gtk_action_set_accel_group(GTK_ACTION(new_layer->view_action), ls->accel_group); + gtk_action_group_add_action_with_accel(ls->action_group, GTK_ACTION(new_layer->view_action), accel2); + gtk_action_connect_accelerator(GTK_ACTION(new_layer->view_action)); + g_signal_connect(G_OBJECT(new_layer->view_action), "activate", G_CALLBACK(menu_view_cb), new_layer); + + ls->accel_available[i] = FALSE; + new_layer->accel_index = i; + g_free(accel2); + g_free(accel1); + } + else { + new_layer->accel_index = -1; + } + /* finalize new layer struct */ + new_layer->pick_item = new_layer->view_item = NULL; + + /* cleanup */ + g_free(vname); + g_free(pname); + + ls->n_actions++; +} + +/*! \brief Install the "Current Layer" menu items for a layer selector + * \par Function Description + * Takes a menu shell and installs menu items for layer selection in + * the shell, at the given position. + * + * \param [in] ls The selector to be acted on + * \param [in] shell The menu to install the items in + * \param [in] pos The position in the menu to install items + * + * \return the number of items installed + */ +gint ghid_layer_selector_install_pick_items(GHidLayerSelector * ls, GtkMenuShell * shell, gint pos) +{ + GtkTreeIter iter; + int n = 0; + + gtk_tree_model_get_iter_first(GTK_TREE_MODEL(ls->list_store), &iter); + do { + struct _layer *ldata; + gtk_tree_model_get(GTK_TREE_MODEL(ls->list_store), &iter, STRUCT_COL, &ldata, -1); + if (ldata && ldata->pick_action) { + GtkAction *action = GTK_ACTION(ldata->pick_action); + ldata->pick_item = gtk_action_create_menu_item(action); + gtk_menu_shell_insert(shell, ldata->pick_item, pos + n); + ++n; + } + } + while (gtk_tree_model_iter_next(GTK_TREE_MODEL(ls->list_store), &iter)); + + return n; +} + +/*! \brief Install the "Shown Layers" menu items for a layer selector + * \par Function Description + * Takes a menu shell and installs menu items for layer selection in + * the shell, at the given position. + * + * \param [in] ls The selector to be acted on + * \param [in] shell The menu to install the items in + * \param [in] pos The position in the menu to install items + * + * \return the number of items installed + */ +gint ghid_layer_selector_install_view_items(GHidLayerSelector * ls, GtkMenuShell * shell, gint pos) +{ + GtkTreeIter iter; + int n = 0; + + gtk_tree_model_get_iter_first(GTK_TREE_MODEL(ls->list_store), &iter); + do { + struct _layer *ldata; + gtk_tree_model_get(GTK_TREE_MODEL(ls->list_store), &iter, STRUCT_COL, &ldata, -1); + if (ldata && ldata->view_action) { + GtkAction *action = GTK_ACTION(ldata->view_action); + ldata->view_item = gtk_action_create_menu_item(action); + gtk_menu_shell_insert(shell, ldata->view_item, pos + n); + ++n; + } + } + while (gtk_tree_model_iter_next(GTK_TREE_MODEL(ls->list_store), &iter)); + + return n; +} + +/*! \brief Returns the GtkAccelGroup of a layer selector + * \par Function Description + * + * \param [in] ls The selector to be acted on + * + * \return the accel group of the selector + */ +GtkAccelGroup *ghid_layer_selector_get_accel_group(GHidLayerSelector * ls) +{ + return ls->accel_group; +} + +/*! \brief used internally */ +static gboolean toggle_foreach_func(GtkTreeModel * model, GtkTreePath * path, GtkTreeIter * iter, gpointer data) +{ + gint id; + GHidLayerSelector *ls = g_object_get_data(G_OBJECT(model), + "layer-selector"); + + gtk_tree_model_get(model, iter, USER_ID_COL, &id, -1); + if (id == *(gint *) data) { + toggle_visibility(ls, iter, TRUE); + return TRUE; + } + return FALSE; +} + +/*! \brief Toggle a layer's visibility + * \par Function Description + * Toggle the layer indicated by user_id, emitting a layer-toggle signal. + * + * \param [in] ls The selector to be acted on + * \param [in] user_id The ID of the layer to be affected + */ +void ghid_layer_selector_toggle_layer(GHidLayerSelector * ls, gint user_id) +{ + gtk_tree_model_foreach(GTK_TREE_MODEL(ls->list_store), toggle_foreach_func, &user_id); +} + +/*! \brief used internally */ +static gboolean select_foreach_func(GtkTreeModel * model, GtkTreePath * path, GtkTreeIter * iter, gpointer data) +{ + gint id; + GHidLayerSelector *ls = g_object_get_data(G_OBJECT(model), + "layer-selector"); + + gtk_tree_model_get(model, iter, USER_ID_COL, &id, -1); + if (id == *(gint *) data) { + gtk_tree_selection_select_path(ls->selection, path); + return TRUE; + } + return FALSE; +} + +/*! \brief Select a layer + * \par Function Description + * Select the layer indicated by user_id, emitting a layer-select signal. + * + * \param [in] ls The selector to be acted on + * \param [in] user_id The ID of the layer to be affected + */ +void ghid_layer_selector_select_layer(GHidLayerSelector * ls, gint user_id) +{ + gtk_tree_model_foreach(GTK_TREE_MODEL(ls->list_store), select_foreach_func, &user_id); +} + +/*! \brief Selects the next visible layer + * \par Function Description + * Used to ensure hidden layers are not active; if the active layer is + * visible, this function is a noop. Otherwise, it will look for the + * next layer that IS visible, and select that. Failing that, it will + * return FALSE. + * + * \param [in] ls The selector to be acted on + * + * \return TRUE on success, FALSE if all selectable layers are hidden + */ +gboolean ghid_layer_selector_select_next_visible(GHidLayerSelector * ls) +{ + GtkTreeIter iter; + if (gtk_tree_selection_get_selected(ls->selection, NULL, &iter)) { + /* Scan forward, looking for selectable iter */ + do { + gboolean visible, activatable; + gtk_tree_model_get(GTK_TREE_MODEL(ls->list_store), &iter, VISIBLE_COL, &visible, ACTIVATABLE_COL, &activatable, -1); + if (visible && activatable) { + gtk_tree_selection_select_iter(ls->selection, &iter); + return TRUE; + } + } + while (gtk_tree_model_iter_next(GTK_TREE_MODEL(ls->list_store), &iter)); + /* Move iter to start, and repeat. */ + gtk_tree_model_get_iter_first(GTK_TREE_MODEL(ls->list_store), &iter); + do { + gboolean visible, activatable; + gtk_tree_model_get(GTK_TREE_MODEL(ls->list_store), &iter, VISIBLE_COL, &visible, ACTIVATABLE_COL, &activatable, -1); + if (visible && activatable) { + gtk_tree_selection_select_iter(ls->selection, &iter); + return TRUE; + } + } + while (gtk_tree_model_iter_next(GTK_TREE_MODEL(ls->list_store), &iter)); + /* Failing this, just emit a selected signal on the original layer. */ + selection_changed_cb(ls->selection, ls); + } + /* If we get here, nothing is selectable, so fail. */ + return FALSE; +} + +/*! \brief Makes the selected layer visible + * \par Function Description + * Used to ensure hidden layers are not active; un-hides the currently + * selected layer. + * + * \param [in] ls The selector to be acted on + */ +void ghid_layer_selector_make_selected_visible(GHidLayerSelector * ls) +{ + GtkTreeIter iter; + if (gtk_tree_selection_get_selected(ls->selection, NULL, &iter)) { + gboolean visible; + gtk_tree_model_get(GTK_TREE_MODEL(ls->list_store), &iter, VISIBLE_COL, &visible, -1); + if (!visible) + toggle_visibility(ls, &iter, FALSE); + } +} + +/*! \brief Sets the colors of all layers in a layer-selector + * \par Function Description + * Updates the colors of a layer selector via a callback mechanism: + * the user_id of each layer is passed to the callback function, + * which returns a color string to update the layer's color, or NULL + * to leave it alone. + * + * \param [in] ls The selector to be acted on + * \param [in] callback Takes the user_id of the layer and returns a color string + */ +void ghid_layer_selector_update_colors(GHidLayerSelector * ls, const gchar * (*callback) (int user_id)) +{ + GtkTreeIter iter; + gtk_tree_model_get_iter_first(GTK_TREE_MODEL(ls->list_store), &iter); + do { + gint user_id; + const gchar *new_color; + gtk_tree_model_get(GTK_TREE_MODEL(ls->list_store), &iter, USER_ID_COL, &user_id, -1); + new_color = callback(user_id); + if (new_color != NULL) + gtk_list_store_set(ls->list_store, &iter, COLOR_COL, new_color, -1); + } + while (gtk_tree_model_iter_next(GTK_TREE_MODEL(ls->list_store), &iter)); +} + +/*! \brief Deletes layers from a layer selector + * \par Function Description + * Deletes layers according to a callback function: a return value of TRUE + * means delete, FALSE means leave it alone. Do not try to delete all layers + * using this function; with nothing left to select, pcb will likely go into + * an infinite recursion between hid_action() and g_signal(). + * + * Separators will be deleted if the layer AFTER them is deleted. + * + * \param [in] ls The selector to be acted on + * \param [in] callback Takes the user_id of the layer and returns a boolean + */ +void ghid_layer_selector_delete_layers(GHidLayerSelector * ls, gboolean(*callback) (int user_id)) +{ + GtkTreeIter iter, last_iter; + + gboolean iter_valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(ls->list_store), &iter); + while (iter_valid) { + struct _layer *ldata; + gboolean sep, was_sep = FALSE; + gint user_id; + + /* Find next iter to delete */ + while (iter_valid) { + gtk_tree_model_get(GTK_TREE_MODEL(ls->list_store), + &iter, USER_ID_COL, &user_id, STRUCT_COL, &ldata, SEPARATOR_COL, &sep, -1); + if (!sep && callback(user_id)) + break; + + /* save iter in case it's a bad separator */ + was_sep = sep; + last_iter = iter; + /* iterate */ + iter_valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(ls->list_store), &iter); + } + + if (iter_valid) { + /* remove preceeding separator */ + if (was_sep) + gtk_list_store_remove(ls->list_store, &last_iter); + + /*** remove row ***/ + iter_valid = gtk_list_store_remove(ls->list_store, &iter); + free_ldata(ls, ldata); + } + last_iter = iter; + } +} + +/*! \brief Sets the visibility toggle-state of all layers + * \par Function Description + * Shows layers according to a callback function: a return value of TRUE + * means show, FALSE means hide. + * + * \param [in] ls The selector to be acted on + * \param [in] callback Takes the user_id of the layer and returns a boolean + */ +void ghid_layer_selector_show_layers(GHidLayerSelector * ls, gboolean(*callback) (int user_id)) +{ + GtkTreeIter iter; + gtk_tree_model_get_iter_first(GTK_TREE_MODEL(ls->list_store), &iter); + do { + struct _layer *ldata; + gboolean sep; + gint user_id; + + gtk_tree_model_get(GTK_TREE_MODEL(ls->list_store), + &iter, USER_ID_COL, &user_id, STRUCT_COL, &ldata, SEPARATOR_COL, &sep, -1); + if (!sep) + set_visibility(ls, &iter, ldata, callback(user_id)); + } + while (gtk_tree_model_iter_next(GTK_TREE_MODEL(ls->list_store), &iter)); +} Index: 1.0.8/src/hid/gtk/ghid-layer-selector.h =================================================================== --- 1.0.8/src/hid/gtk/ghid-layer-selector.h (nonexistent) +++ 1.0.8/src/hid/gtk/ghid-layer-selector.h (revision 1136) @@ -0,0 +1,38 @@ +#ifndef GHID_LAYER_SELECTOR_H__ +#define GHID_LAYER_SELECTOR_H__ + +#include +#include +#include + +G_BEGIN_DECLS /* keep c++ happy */ +#define GHID_LAYER_SELECTOR_TYPE (ghid_layer_selector_get_type ()) +#define GHID_LAYER_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GHID_LAYER_SELECTOR_TYPE, GHidLayerSelector)) +#define GHID_LAYER_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GHID_LAYER_SELECTOR_TYPE, GHidLayerSelectorClass)) +#define IS_GHID_LAYER_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GHID_LAYER_SELECTOR_TYPE)) +#define IS_GHID_LAYER_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GHID_LAYER_SELECTOR_TYPE)) +typedef struct _GHidLayerSelector GHidLayerSelector; +typedef struct _GHidLayerSelectorClass GHidLayerSelectorClass; + +GType ghid_layer_selector_get_type(void); +GtkWidget *ghid_layer_selector_new(void); + +void ghid_layer_selector_add_layer(GHidLayerSelector * ls, + gint user_id, + const gchar * name, const gchar * color_string, gboolean visible, gboolean activatable); + +gint ghid_layer_selector_install_pick_items(GHidLayerSelector * ls, GtkMenuShell * shell, gint pos); +gint ghid_layer_selector_install_view_items(GHidLayerSelector * ls, GtkMenuShell * shell, gint pos); + +GtkAccelGroup *ghid_layer_selector_get_accel_group(GHidLayerSelector * ls); + +void ghid_layer_selector_toggle_layer(GHidLayerSelector * ls, gint user_id); +void ghid_layer_selector_select_layer(GHidLayerSelector * ls, gint user_id); +gboolean ghid_layer_selector_select_next_visible(GHidLayerSelector * ls); +void ghid_layer_selector_make_selected_visible(GHidLayerSelector * ls); +void ghid_layer_selector_update_colors(GHidLayerSelector * ls, const gchar * (*callback) (int user_id)); +void ghid_layer_selector_delete_layers(GHidLayerSelector * ls, gboolean(*callback) (int user_id)); +void ghid_layer_selector_show_layers(GHidLayerSelector * ls, gboolean(*callback) (int user_id)); + +G_END_DECLS /* keep c++ happy */ +#endif Index: 1.0.8/src/hid/gtk/ghid-main-menu.c =================================================================== --- 1.0.8/src/hid/gtk/ghid-main-menu.c (nonexistent) +++ 1.0.8/src/hid/gtk/ghid-main-menu.c (revision 1136) @@ -0,0 +1,602 @@ +/*! \file + * \brief Implementation of GHidMainMenu widget + * \par Description + * This widget is the main pcb menu. + */ + +#include +#include +#include + +#include "gtkhid.h" +#include "gui.h" +#include "pcb-printf.h" + +#include "ghid-main-menu.h" +#include "ghid-layer-selector.h" +#include "ghid-route-style-selector.h" + +void Message(const char *, ...); + +static int action_counter; + +struct _GHidMainMenu { + GtkMenuBar parent; + + GtkActionGroup *action_group; + GtkAccelGroup *accel_group; + + gint layer_view_pos; + gint layer_pick_pos; + gint route_style_pos; + + GtkMenuShell *layer_view_shell; + GtkMenuShell *layer_pick_shell; + GtkMenuShell *route_style_shell; + + GList *actions; + GHashTable *popup_table; + + gint n_layer_views; + gint n_layer_picks; + gint n_route_styles; + + GCallback action_cb; + void (*special_key_cb) (const char *accel, GtkAction * action, const Resource * node); +}; + +struct _GHidMainMenuClass { + GtkMenuBarClass parent_class; +}; + +/* TODO: write finalize function */ + +/* SIGNAL HANDLERS */ + +/* RESOURCE HANDLER */ +/* \brief Translate gpcb-menu.res accelerators to gtk ones + * \par Function Description + * Some keys need to be replaced by a name for the gtk accelerators to + * work. This table contains the translations. The "in" character is + * what would appear in gpcb-menu.res and the "out" string is what we + * have to feed to gtk. I was able to find these by using xev to find + * the keycode and then looked at gtk+-2.10.9/gdk/keynames.txt (from the + * gtk source distribution) to figure out the names that go with the + * codes. + */ +static gchar *translate_accelerator(const char *text) +{ + GString *ret_val = g_string_new(""); + static struct { + const char *in, *out; + } key_table[] = { + { + "Enter", "Return"}, { + "Alt", ""}, { + "Shift", ""}, { + "Ctrl", ""}, { + " ", ""}, { + ":", "colon"}, { + "=", "equal"}, { + "/", "slash"}, { + "[", "bracketleft"}, { + "]", "bracketright"}, { + ".", "period"}, { + "|", "bar"}, { + NULL, NULL} + }; + + enum { MOD, KEY } state = MOD; + while (*text != '\0') { + static gboolean gave_msg; + gboolean found = FALSE; + int i; + + if (state == MOD && strncmp(text, "", 5) == 0) { + state = KEY; + text += 5; + } + for (i = 0; key_table[i].in != NULL; ++i) { + int len = strlen(key_table[i].in); + if (strncmp(text, key_table[i].in, len) == 0) { + found = TRUE; + g_string_append(ret_val, key_table[i].out); + text += len; + } + } + if (found == FALSE) + switch (state) { + case MOD: + Message(_("Don't know how to parse \"%s\" as an " "accelerator in the menu resource file.\n"), text); + if (!gave_msg) { + gave_msg = TRUE; + Message(_("Format is:\n" + "modifiersk\n" + "where \"modifiers\" is a space " + "separated list of key modifiers\n" + "and \"k\" is the name of the key.\n" + "Allowed modifiers are:\n" " Ctrl\n" " Shift\n" " Alt\n" "Please note that case is important.\n")); + } + text++; + break; + case KEY: + g_string_append_c(ret_val, *text); + ++text; + break; + } + } + return g_string_free(ret_val, FALSE); +} + +/*! \brief Check that translated accelerators are unique; warn otherwise. */ +static const char *check_unique_accel(const char *accelerator) +{ + static GHashTable *accel_table; + + if (!accelerator || *accelerator) + return accelerator; + + if (!accel_table) + accel_table = g_hash_table_new(g_str_hash, g_str_equal); + + if (g_hash_table_lookup(accel_table, accelerator)) { + Message(_("Duplicate accelerator found: \"%s\"\n" "The second occurance will be dropped\n"), accelerator); + return NULL; + } + + g_hash_table_insert(accel_table, (gpointer) accelerator, (gpointer) accelerator); + + return accelerator; +} + +void ghid_main_menu_real_add_resource(GHidMainMenu * menu, GtkMenuShell * shell, const Resource * res, const char *path); + + +static GHashTable *menu_hash = NULL; /* path->GtkWidget */ + +static GtkAction *ghid_add_menu(GHidMainMenu * menu, GtkMenuShell * shell, const Resource * sub_res, const char *path) +{ + const char *res_val; + const Resource *tmp_res; + gchar mnemonic = 0; + int j; + GtkAction *action = NULL; + const gchar *accel = NULL; + char *menu_label; + char *npath; + + if (!menu_hash) + menu_hash = g_hash_table_new(g_str_hash, g_str_equal); + + + tmp_res = resource_subres(sub_res, "a"); /* accelerator */ + res_val = resource_value(sub_res, "m"); /* mnemonic */ + + + + if (res_val) + mnemonic = res_val[0]; + /* The accelerator resource will have two values, like + * a={"Ctrl-Q" "Ctrlq"} + * The first Gtk ignores. The second needs to be translated. */ + if (tmp_res) + accel = check_unique_accel(translate_accelerator(tmp_res->v[1].value)); + + /* Now look for the first unnamed value (not a subresource) to + * figure out the name of the menu or the menuitem. */ + res_val = "button"; + for (j = 0; j < sub_res->c; ++j) + if (resource_type(sub_res->v[j]) == 10) { + res_val = sub_res->v[j].value; + break; + } + /* Hack '_' in based on mnemonic value */ + if (!mnemonic) + menu_label = g_strdup(res_val); + else { + char *post_ = strchr(res_val, mnemonic); + if (post_ == NULL) + menu_label = g_strdup(res_val); + else { + GString *tmp = g_string_new(""); + g_string_append_len(tmp, res_val, post_ - res_val); + g_string_append_c(tmp, '_'); + g_string_append(tmp, post_); + menu_label = g_string_free(tmp, FALSE); + } + } + + npath = Concat(path, "/", res_val, NULL); + + /* If the subresource we're processing also has unnamed + * subresources, it's a submenu, not a regular menuitem. */ + if (sub_res->flags & FLAG_S) { + /* SUBMENU */ + GtkWidget *submenu = gtk_menu_new(); + GtkWidget *item = gtk_menu_item_new_with_mnemonic(menu_label); + GtkWidget *tearoff = gtk_tearoff_menu_item_new(); + + gtk_menu_shell_append(shell, item); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); + + /* add tearoff to menu */ + gtk_menu_shell_append(GTK_MENU_SHELL(submenu), tearoff); + + + g_hash_table_insert(menu_hash, (gpointer) npath, (gpointer) submenu); + + /* recurse on the newly-added submenu */ + ghid_main_menu_real_add_resource(menu, GTK_MENU_SHELL(submenu), sub_res, npath); + + } + else { + /* NON-SUBMENU: MENU ITEM */ + const char *checked = resource_value(sub_res, "checked"); + const char *label = resource_value(sub_res, "sensitive"); + const char *tip = resource_value(sub_res, "tip"); + if (checked) { + /* TOGGLE ITEM */ + gchar *name = g_strdup_printf("MainMenuAction%d", + action_counter++); + + action = GTK_ACTION(gtk_toggle_action_new(name, menu_label, tip, NULL)); + /* checked=foo is a binary flag (checkbox) + * checked=foo,bar is a flag compared to a value (radio) */ + gtk_toggle_action_set_draw_as_radio(GTK_TOGGLE_ACTION(action), ! !strchr(checked, ',')); + } + else if (label && strcmp(label, "false") == 0) { + /* INSENSITIVE ITEM */ + GtkWidget *item = gtk_menu_item_new_with_label(menu_label); + gtk_widget_set_sensitive(item, FALSE); + gtk_menu_shell_append(shell, item); + g_hash_table_insert(menu_hash, (gpointer) npath, (gpointer) item); + } + else { + /* NORMAL ITEM */ + gchar *name = g_strdup_printf("MainMenuAction%d", action_counter++); + action = gtk_action_new(name, menu_label, tip, NULL); + } + } + + /* Connect accelerator, if there is one */ + if (action) { + GtkWidget *item; + gtk_action_set_accel_group(action, menu->accel_group); + gtk_action_group_add_action_with_accel(menu->action_group, action, accel); + gtk_action_connect_accelerator(action); + g_signal_connect(G_OBJECT(action), "activate", menu->action_cb, (gpointer) sub_res); + g_object_set_data(G_OBJECT(action), "resource", (gpointer) sub_res); + item = gtk_action_create_menu_item(action); + gtk_menu_shell_append(shell, item); + menu->actions = g_list_append(menu->actions, action); + menu->special_key_cb(accel, action, sub_res); + + g_hash_table_insert(menu_hash, (gpointer) npath, (gpointer) item); + } + +/* keep npath for the hash so do not free(npath); */ + return action; +} + + +/*! \brief Translate a resource tree into a menu structure + * + * \param [in] menu The GHidMainMenu widget to be acted on + * \param [in] shall The base menu shell (a menu bar or popup menu) + * \param [in] res The base of the resource tree + * */ +void ghid_main_menu_real_add_resource(GHidMainMenu * menu, GtkMenuShell * shell, const Resource * res, const char *path) +{ + int i, j; + GtkAction *action = NULL; + + for (i = 0; i < res->c; ++i) { + const Resource *sub_res = res->v[i].subres; + + switch (resource_type(res->v[i])) { + case 101: /* name, subres: passthrough */ + ghid_main_menu_real_add_resource(menu, shell, sub_res, path); + break; + case 1: /* no name, subres */ + action = ghid_add_menu(menu, shell, sub_res, path); + /* Scan rest of resource in case there is more work */ + for (j = 0; j < sub_res->c; j++) { + const char *res_name; + /* named value = X resource */ + if (resource_type(sub_res->v[j]) == 110) { + res_name = sub_res->v[j].name; + + /* translate bg, fg to background, foreground */ + if (strcmp(res_name, "fg") == 0) + res_name = "foreground"; + if (strcmp(res_name, "bg") == 0) + res_name = "background"; + + /* ignore special named values (m, a, sensitive) */ + if (strcmp(res_name, "m") == 0 + || strcmp(res_name, "a") == 0 || strcmp(res_name, "sensitive") == 0 || strcmp(res_name, "tip") == 0) + break; + + /* log checked and active special values */ + if (action && strcmp(res_name, "checked") == 0) + g_object_set_data(G_OBJECT(action), "checked-flag", sub_res->v[j].value); + else if (action && strcmp(res_name, "active") == 0) + g_object_set_data(G_OBJECT(action), "active-flag", sub_res->v[j].value); + else + /* if we got this far it is supposed to be an X + * resource. For now ignore it and warn the user */ + Message(_("The gtk gui currently ignores \"%s\"" + "as part of a menuitem resource.\n" "Feel free to provide patches\n"), sub_res->v[j].value); + } + } + break; + case 10: /* no name, value */ + /* If we get here, the resource is "-" or "@foo" for some foo */ + if (res->v[i].value[0] == '@') { + GList *children; + int pos; + + children = gtk_container_get_children(GTK_CONTAINER(shell)); + pos = g_list_length(children); + g_list_free(children); + + if (strcmp(res->v[i].value, "@layerview") == 0) { + menu->layer_view_shell = shell; + menu->layer_view_pos = pos; + } + else if (strcmp(res->v[i].value, "@layerpick") == 0) { + menu->layer_pick_shell = shell; + menu->layer_pick_pos = pos; + } + else if (strcmp(res->v[i].value, "@routestyles") == 0) { + menu->route_style_shell = shell; + menu->route_style_pos = pos; + } + else + Message(_("GTK GUI currently ignores \"%s\" in the menu\n" "resource file.\n"), res->v[i].value); + } + else if (strcmp(res->v[i].value, "-") == 0) { + GtkWidget *item = gtk_separator_menu_item_new(); + gtk_menu_shell_append(shell, item); + } + else if (i > 0) { + /* This is an action-less menuitem. It is really only useful + * when you're starting to build a new menu and you're looking + * to get the layout right. */ + GtkWidget *item = gtk_menu_item_new_with_label(res->v[i].value); + gtk_menu_shell_append(shell, item); + } + break; + } + } +} + +/* CONSTRUCTOR */ +static void ghid_main_menu_init(GHidMainMenu * mm) +{ + /* Hookup signal handlers */ +} + +static void ghid_main_menu_class_init(GHidMainMenuClass * klass) +{ +} + +/* PUBLIC FUNCTIONS */ +GType ghid_main_menu_get_type(void) +{ + static GType mm_type = 0; + + if (!mm_type) { + const GTypeInfo mm_info = { + sizeof(GHidMainMenuClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) ghid_main_menu_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(GHidMainMenu), + 0, /* n_preallocs */ + (GInstanceInitFunc) ghid_main_menu_init, + }; + + mm_type = g_type_register_static(GTK_TYPE_MENU_BAR, "GHidMainMenu", &mm_info, 0); + } + + return mm_type; +} + +/*! \brief Create a new GHidMainMenu + * + * \return a freshly-allocated GHidMainMenu + */ +GtkWidget *ghid_main_menu_new(GCallback action_cb, + void (*special_key_cb) (const char *accel, GtkAction * action, const Resource * node)) +{ + GHidMainMenu *mm = g_object_new(GHID_MAIN_MENU_TYPE, NULL); + + mm->accel_group = gtk_accel_group_new(); + mm->action_group = gtk_action_group_new("MainMenu"); + + mm->layer_view_pos = 0; + mm->layer_pick_pos = 0; + mm->route_style_pos = 0; + mm->n_layer_views = 0; + mm->n_layer_picks = 0; + mm->n_route_styles = 0; + mm->layer_view_shell = NULL; + mm->layer_pick_shell = NULL; + mm->route_style_shell = NULL; + + mm->special_key_cb = special_key_cb; + mm->action_cb = action_cb; + mm->actions = NULL; + mm->popup_table = g_hash_table_new(g_str_hash, g_str_equal); + + return GTK_WIDGET(mm); +} + +/*! \brief Turn a pcb resource into the main menu */ +void ghid_main_menu_add_resource(GHidMainMenu * menu, const Resource * res) +{ + ghid_main_menu_real_add_resource(menu, GTK_MENU_SHELL(menu), res, ""); +} + +/*! \brief Turn a pcb resource into a popup menu */ +void ghid_main_menu_add_popup_resource(GHidMainMenu * menu, const char *name, const Resource * res) +{ + GtkWidget *new_menu = gtk_menu_new(); + g_object_ref_sink(new_menu); + ghid_main_menu_real_add_resource(menu, GTK_MENU_SHELL(new_menu), res, ""); + g_hash_table_insert(menu->popup_table, (gpointer) name, new_menu); + gtk_widget_show_all(new_menu); +} + +/*! \brief Returns a registered popup menu by name */ +GtkMenu *ghid_main_menu_get_popup(GHidMainMenu * menu, const char *name) +{ + return g_hash_table_lookup(menu->popup_table, name); +} + + +/*! \brief Updates the toggle/active state of all items + * \par Function Description + * Loops through all actions, passing the action, its toggle + * flag (maybe NULL), and its active flag (maybe NULL), to a + * callback function. It is the responsibility of the function + * to actually change the state of the action. + * + * \param [in] menu The menu to be acted on. + * \param [in] cb The callback that toggles the actions + */ +void +ghid_main_menu_update_toggle_state(GHidMainMenu * menu, + void (*cb) (GtkAction *, const char *toggle_flag, const char *active_flag)) +{ + GList *list; + for (list = menu->actions; list; list = list->next) { + Resource *res = g_object_get_data(G_OBJECT(list->data), "resource"); + const char *tf = g_object_get_data(G_OBJECT(list->data), + "checked-flag"); + const char *af = g_object_get_data(G_OBJECT(list->data), + "active-flag"); + g_signal_handlers_block_by_func(G_OBJECT(list->data), menu->action_cb, res); + cb(GTK_ACTION(list->data), tf, af); + g_signal_handlers_unblock_by_func(G_OBJECT(list->data), menu->action_cb, res); + } +} + +/*! \brief Installs or updates layer selector items */ +void ghid_main_menu_install_layer_selector(GHidMainMenu * mm, GHidLayerSelector * ls) +{ + GList *children, *iter; + + /* @layerview */ + if (mm->layer_view_shell) { + /* Remove old children */ + children = gtk_container_get_children(GTK_CONTAINER(mm->layer_view_shell)); + for (iter = g_list_nth(children, mm->layer_view_pos); + iter != NULL && mm->n_layer_views > 0; iter = g_list_next(iter), mm->n_layer_views--) + gtk_container_remove(GTK_CONTAINER(mm->layer_view_shell), iter->data); + g_list_free(children); + + /* Install new ones */ + mm->n_layer_views = ghid_layer_selector_install_view_items(ls, mm->layer_view_shell, mm->layer_view_pos); + } + + /* @layerpick */ + if (mm->layer_pick_shell) { + /* Remove old children */ + children = gtk_container_get_children(GTK_CONTAINER(mm->layer_pick_shell)); + for (iter = g_list_nth(children, mm->layer_pick_pos); + iter != NULL && mm->n_layer_picks > 0; iter = g_list_next(iter), mm->n_layer_picks--) + gtk_container_remove(GTK_CONTAINER(mm->layer_pick_shell), iter->data); + g_list_free(children); + + /* Install new ones */ + mm->n_layer_picks = ghid_layer_selector_install_pick_items(ls, mm->layer_pick_shell, mm->layer_pick_pos); + } +} + +/*! \brief Installs or updates route style selector items */ +void ghid_main_menu_install_route_style_selector(GHidMainMenu * mm, GHidRouteStyleSelector * rss) +{ + GList *children, *iter; + /* @routestyles */ + if (mm->route_style_shell) { + /* Remove old children */ + children = gtk_container_get_children(GTK_CONTAINER(mm->route_style_shell)); + for (iter = g_list_nth(children, mm->route_style_pos); + iter != NULL && mm->n_route_styles > 0; iter = g_list_next(iter), mm->n_route_styles--) + gtk_container_remove(GTK_CONTAINER(mm->route_style_shell), iter->data); + g_list_free(children); + /* Install new ones */ + mm->n_route_styles = ghid_route_style_selector_install_items(rss, mm->route_style_shell, mm->route_style_pos); + } +} + +/*! \brief Returns the menu bar's accelerator group */ +GtkAccelGroup *ghid_main_menu_get_accel_group(GHidMainMenu * menu) +{ + if (menu == NULL) { + Message("ghid: can't initialize the menu - is your gpcb-menu.res valid?\n"); + exit(1); + } + return menu->accel_group; +} + + +void ghid_create_menu(const char *menu[], const char *action, const char *mnemonic, const char *accel, const char *tip) +{ + char *path, *path_end; + int n, plen; + + plen = 1; /* for the \0 */ + for (n = 0; menu[n] != NULL; n++) + plen += strlen(menu[n]) + 1; /* +1 for the leading slash */ + + path = path_end = malloc(plen); + *path = '\0'; + + for (n = 0; menu[n] != NULL; n++) { + int last = (menu[n + 1] == NULL); + int first = (n == 0); + GtkWidget *w; + Resource *res; + + /* check if the current node exists */ + *path_end = '/'; + path_end++; + strcpy(path_end, menu[n]); + if (g_hash_table_lookup(menu_hash, path) != NULL) { + path_end += strlen(menu[n]); + continue; + } + + /* if not, revert path to the parent's path */ + path_end--; + *path_end = '\0'; + + /* look up the parent */ + if (first) + w = ghidgui->menu_bar; + else + w = g_hash_table_lookup(menu_hash, path); + + if (!last) { + int flags = first ? (FLAG_S | FLAG_NV | FLAG_V) /* 7 */ : (FLAG_V | FLAG_S) /* 5 */ ; + res = resource_create_menu(menu[n], NULL, NULL, NULL, NULL, flags); + } + else + res = resource_create_menu(menu[n], action, mnemonic, accel, tip, FLAG_NS | FLAG_NV | FLAG_V); + + ghid_main_menu_real_add_resource(GHID_MAIN_MENU(ghidgui->menu_bar), GTK_MENU_SHELL(w), res, path); + + *path_end = '/'; + path_end += strlen(menu[n]) + 1; + } + +/* make sure new menu items appear on screen */ + gtk_widget_show_all(ghidgui->menu_bar); + + free(path); +} Index: 1.0.8/src/hid/gtk/ghid-main-menu.h =================================================================== --- 1.0.8/src/hid/gtk/ghid-main-menu.h (nonexistent) +++ 1.0.8/src/hid/gtk/ghid-main-menu.h (revision 1136) @@ -0,0 +1,38 @@ +#ifndef GHID_MAIN_MENU_H__ +#define GHID_MAIN_MENU_H__ + +#include +#include +#include + +#include "ghid-layer-selector.h" +#include "ghid-route-style-selector.h" +#include "resource.h" + +G_BEGIN_DECLS /* keep c++ happy */ +#define GHID_MAIN_MENU_TYPE (ghid_main_menu_get_type ()) +#define GHID_MAIN_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GHID_MAIN_MENU_TYPE, GHidMainMenu)) +#define GHID_MAIN_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GHID_MAIN_MENU_TYPE, GHidMainMenuClass)) +#define IS_GHID_MAIN_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GHID_MAIN_MENU_TYPE)) +#define IS_GHID_MAIN_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GHID_MAIN_MENU_TYPE)) +typedef struct _GHidMainMenu GHidMainMenu; +typedef struct _GHidMainMenuClass GHidMainMenuClass; + +GType ghid_main_menu_get_type(void); +GtkWidget *ghid_main_menu_new(GCallback action_cb, + void (*special_key_cb) (const char *accel, GtkAction * action, const Resource * node)); +void ghid_main_menu_add_resource(GHidMainMenu * menu, const Resource * res); +GtkAccelGroup *ghid_main_menu_get_accel_group(GHidMainMenu * menu); +void ghid_main_menu_update_toggle_state(GHidMainMenu * menu, + void (*cb) (GtkAction *, const char *toggle_flag, const char *active_flag)); + +void ghid_main_menu_add_popup_resource(GHidMainMenu * menu, const char *name, const Resource * res); +GtkMenu *ghid_main_menu_get_popup(GHidMainMenu * menu, const char *name); + +void ghid_main_menu_install_layer_selector(GHidMainMenu * mm, GHidLayerSelector * ls); +void ghid_main_menu_install_route_style_selector(GHidMainMenu * mm, GHidRouteStyleSelector * rss); + +void ghid_create_menu(const char *menu[], const char *action, const char *mnemonic, const char *accel, const char *tip); + +G_END_DECLS /* keep c++ happy */ +#endif Index: 1.0.8/src/hid/gtk/ghid-route-style-selector.c =================================================================== --- 1.0.8/src/hid/gtk/ghid-route-style-selector.c (nonexistent) +++ 1.0.8/src/hid/gtk/ghid-route-style-selector.c (revision 1136) @@ -0,0 +1,529 @@ +/*! \file + * \brief Implementation of GHidRouteStyleSelector widget + * \par Description + * Please write description here. + */ + +#include +#include +#include +#include + +#include "global.h" +#include "gtkhid.h" +#include "gui.h" +#include "pcb-printf.h" + +#include "ghid-route-style-selector.h" + +/* Forward dec'ls */ +struct _route_style; +struct _route_style *ghid_route_style_selector_real_add_route_style(GHidRouteStyleSelector *, RouteStyleType *, gboolean temp); +static void ghid_route_style_selector_finalize(GObject * object); + +/*! \brief Global action creation counter */ +static gint action_count; + +/*! \brief Signals exposed by the widget */ +enum { + SELECT_STYLE_SIGNAL, + STYLE_EDITED_SIGNAL, + LAST_SIGNAL +}; + +/*! \brief Columns used for internal data store */ +enum { + TEXT_COL, + DATA_COL, + N_COLS +}; + +static GtkVBox *ghid_route_style_selector_parent_class; +static guint ghid_route_style_selector_signals[LAST_SIGNAL] = { 0 }; + +struct _GHidRouteStyleSelector { + GtkVBox parent; + + GSList *button_radio_group; + GSList *action_radio_group; + GtkWidget *edit_button; + + GtkActionGroup *action_group; + GtkAccelGroup *accel_group; + + GtkListStore *model; + struct _route_style *active_style; +}; + +struct _GHidRouteStyleSelectorClass { + GtkVBoxClass parent_class; + + void (*select_style) (GHidRouteStyleSelector *, RouteStyleType *); + void (*style_edited) (GHidRouteStyleSelector *, gboolean); +}; + +struct _route_style { + gboolean temporary; /* TODO: actually use this for something */ + GtkRadioAction *action; + GtkWidget *button; + GtkWidget *menu_item; + GtkTreeRowReference *rref; + RouteStyleType *rst; + gulong sig_id; +}; + +/* SIGNAL HANDLERS */ +/*! \brief Callback for user selection of a route style */ +static void radio_select_cb(GtkToggleAction * action, GHidRouteStyleSelector * rss) +{ + rss->active_style = g_object_get_data(G_OBJECT(action), "route-style"); + if (gtk_toggle_action_get_active(action)) + g_signal_emit(rss, ghid_route_style_selector_signals[SELECT_STYLE_SIGNAL], 0, rss->active_style->rst); +} + +/* EDIT DIALOG */ +struct _dialog { + GHidRouteStyleSelector *rss; + GtkWidget *name_entry; + GtkWidget *line_entry; + GtkWidget *via_hole_entry; + GtkWidget *via_size_entry; + GtkWidget *clearance_entry; +}; + +/*! \brief Callback for dialog box's combobox being changed + * \par Function Description + * When a different layer is selected, this function loads + * that layer's data into the dialog. Alternately, if the + * "New layer" option is selected, this loads a new name + * but no other data. + * + * \param [in] combo The combobox + * \param [in] dialog The rest of the widgets to be updated + */ +static void dialog_style_changed_cb(GtkComboBox * combo, struct _dialog *dialog) +{ + struct _route_style *style; + GtkTreeIter iter; + gtk_combo_box_get_active_iter(combo, &iter); + gtk_tree_model_get(GTK_TREE_MODEL(dialog->rss->model), &iter, DATA_COL, &style, -1); + + if (style == NULL) { + gtk_entry_set_text(GTK_ENTRY(dialog->name_entry), _("New Style")); + return; + } + + gtk_entry_set_text(GTK_ENTRY(dialog->name_entry), style->rst->Name); + ghid_coord_entry_set_value(GHID_COORD_ENTRY(dialog->line_entry), style->rst->Thick); + ghid_coord_entry_set_value(GHID_COORD_ENTRY(dialog->via_hole_entry), style->rst->Hole); + ghid_coord_entry_set_value(GHID_COORD_ENTRY(dialog->via_size_entry), style->rst->Diameter); + ghid_coord_entry_set_value(GHID_COORD_ENTRY(dialog->clearance_entry), style->rst->Keepaway); + +} + +/* \brief Helper for edit_button_cb */ +static void _table_attach(GtkWidget * table, gint row, const gchar * label, GtkWidget ** entry, Coord min, Coord max) +{ + GtkWidget *label_w = gtk_label_new(label); + gtk_misc_set_alignment(GTK_MISC(label_w), 1.0, 0.5); + + *entry = ghid_coord_entry_new(min, max, 0, Settings.grid_unit, CE_SMALL); + gtk_table_attach(GTK_TABLE(table), label_w, 0, 1, row, row + 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2); + gtk_table_attach(GTK_TABLE(table), *entry, 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2); +} + +/* \brief Builds and runs the "edit route styles" dialog */ +void ghid_route_style_selector_edit_dialog(GHidRouteStyleSelector * rss) +{ + GtkTreePath *path; + GtkTreeIter iter, tmp_iter; + struct _dialog dialog_data; + GtkCellRenderer *renderer = gtk_cell_renderer_text_new(); + GtkWidget *window = gtk_widget_get_toplevel(GTK_WIDGET(rss)); + GtkWidget *dialog; + GtkWidget *content_area; + GtkWidget *vbox, *hbox, *sub_vbox, *table; + GtkWidget *label, *select_box, *check_box; + + /* Build dialog */ + dialog = gtk_dialog_new_with_buttons(_("Edit Route Styles"), + GTK_WINDOW(window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CANCEL, GTK_RESPONSE_NONE, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); + + label = gtk_label_new(_("Edit Style:")); + gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); + + select_box = gtk_combo_box_new_with_model(GTK_TREE_MODEL(rss->model)); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(select_box), renderer, TRUE); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(select_box), renderer, "text", TEXT_COL, NULL); + + content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); + + hbox = gtk_hbox_new(FALSE, 4); + gtk_box_pack_start(GTK_BOX(content_area), hbox, TRUE, TRUE, 4); + vbox = gtk_vbox_new(FALSE, 4); + gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 4); + + hbox = gtk_hbox_new(FALSE, 4); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 4); + gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hbox), select_box, TRUE, TRUE, 0); + + sub_vbox = ghid_category_vbox(vbox, _("Route Style Data"), 4, 2, TRUE, TRUE); + table = gtk_table_new(5, 2, FALSE); + gtk_box_pack_start(GTK_BOX(sub_vbox), table, TRUE, TRUE, 4); + label = gtk_label_new(_("Name:")); + gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); + dialog_data.name_entry = gtk_entry_new(); + gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2); + gtk_table_attach(GTK_TABLE(table), dialog_data.name_entry, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2); + + _table_attach(table, 1, _("Line width:"), &dialog_data.line_entry, MIN_LINESIZE, MAX_LINESIZE); + _table_attach(table, 2, _("Via hole size:"), + &dialog_data.via_hole_entry, MIN_PINORVIAHOLE, MAX_PINORVIASIZE - MIN_PINORVIACOPPER); + _table_attach(table, 3, _("Via ring size:"), + &dialog_data.via_size_entry, MIN_PINORVIAHOLE + MIN_PINORVIACOPPER, MAX_PINORVIASIZE); + _table_attach(table, 4, _("Clearance:"), &dialog_data.clearance_entry, MIN_LINESIZE, MAX_LINESIZE); + + sub_vbox = ghid_category_vbox(vbox, _("Set as Default"), 4, 2, TRUE, TRUE); + check_box = gtk_check_button_new_with_label(_("Save route style settings as default")); + gtk_box_pack_start(GTK_BOX(sub_vbox), check_box, TRUE, TRUE, 0); + + /* Add "new style" option to list */ + gtk_list_store_append(rss->model, &tmp_iter); + gtk_list_store_set(rss->model, &tmp_iter, TEXT_COL, _("New (this session only)"), DATA_COL, NULL, -1); + + /* Display dialog */ + dialog_data.rss = rss; + path = gtk_tree_row_reference_get_path(rss->active_style->rref); + gtk_tree_model_get_iter(GTK_TREE_MODEL(rss->model), &iter, path); + g_signal_connect(G_OBJECT(select_box), "changed", G_CALLBACK(dialog_style_changed_cb), &dialog_data); + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(select_box), &iter); + gtk_widget_show_all(dialog); + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) { + RouteStyleType *rst; + struct _route_style *style; + gboolean save; + gtk_combo_box_get_active_iter(GTK_COMBO_BOX(select_box), &iter); + gtk_tree_model_get(GTK_TREE_MODEL(rss->model), &iter, DATA_COL, &style, -1); + if (style == NULL) + rst = g_malloc(sizeof *rst); + else { + rst = style->rst; + free(rst->Name); + } + + rst->Name = StripWhiteSpaceAndDup(gtk_entry_get_text(GTK_ENTRY(dialog_data.name_entry))); + rst->Thick = ghid_coord_entry_get_value(GHID_COORD_ENTRY(dialog_data.line_entry)); + rst->Hole = ghid_coord_entry_get_value(GHID_COORD_ENTRY(dialog_data.via_hole_entry)); + rst->Diameter = ghid_coord_entry_get_value(GHID_COORD_ENTRY(dialog_data.via_size_entry)); + rst->Keepaway = ghid_coord_entry_get_value(GHID_COORD_ENTRY(dialog_data.clearance_entry)); + save = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_box)); + + if (style == NULL) + style = ghid_route_style_selector_real_add_route_style(rss, rst, TRUE); + else { + gtk_action_set_label(GTK_ACTION(style->action), rst->Name); + gtk_list_store_set(rss->model, &iter, TEXT_COL, rst->Name, -1); + } + + /* Cleanup */ + gtk_widget_destroy(dialog); + gtk_list_store_remove(rss->model, &tmp_iter); + /* Emit change signals */ + ghid_route_style_selector_select_style(rss, rst); + g_signal_emit(rss, ghid_route_style_selector_signals[STYLE_EDITED_SIGNAL], 0, save); + } + else { + gtk_widget_destroy(dialog); + gtk_list_store_remove(rss->model, &tmp_iter); + } +} + +/* end EDIT DIALOG */ + +static void edit_button_cb(GtkButton * btn, GHidRouteStyleSelector * rss) +{ + ghid_route_style_selector_edit_dialog(rss); +} + +/* CONSTRUCTOR */ +static void ghid_route_style_selector_init(GHidRouteStyleSelector * rss) +{ +} + +static void ghid_route_style_selector_class_init(GHidRouteStyleSelectorClass * klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + ghid_route_style_selector_parent_class = g_type_class_peek_parent(klass); + + ghid_route_style_selector_signals[SELECT_STYLE_SIGNAL] = + g_signal_new("select-style", + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET(GHidRouteStyleSelectorClass, select_style), + NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); + ghid_route_style_selector_signals[STYLE_EDITED_SIGNAL] = + g_signal_new("style-edited", + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET(GHidRouteStyleSelectorClass, style_edited), + NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); + + object_class->finalize = ghid_route_style_selector_finalize; +} + +/*! \brief Clean up object before garbage collection + */ +static void ghid_route_style_selector_finalize(GObject * object) +{ + GHidRouteStyleSelector *rss = (GHidRouteStyleSelector *) object; + + ghid_route_style_selector_empty(rss); + + g_object_unref(rss->accel_group); + g_object_unref(rss->action_group); + + G_OBJECT_CLASS(ghid_route_style_selector_parent_class)->finalize(object); +} + +/* PUBLIC FUNCTIONS */ +GType ghid_route_style_selector_get_type(void) +{ + static GType rss_type = 0; + + if (!rss_type) { + const GTypeInfo rss_info = { + sizeof(GHidRouteStyleSelectorClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) ghid_route_style_selector_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(GHidRouteStyleSelector), + 0, /* n_preallocs */ + (GInstanceInitFunc) ghid_route_style_selector_init, + }; + + rss_type = g_type_register_static(GTK_TYPE_VBOX, "GHidRouteStyleSelector", &rss_info, 0); + } + + return rss_type; +} + +/*! \brief Create a new GHidRouteStyleSelector + * + * \return a freshly-allocated GHidRouteStyleSelector. + */ +GtkWidget *ghid_route_style_selector_new() +{ + GHidRouteStyleSelector *rss = g_object_new(GHID_ROUTE_STYLE_SELECTOR_TYPE, NULL); + + rss->active_style = NULL; + rss->action_radio_group = NULL; + rss->button_radio_group = NULL; + rss->model = gtk_list_store_new(N_COLS, G_TYPE_STRING, G_TYPE_POINTER); + + rss->accel_group = gtk_accel_group_new(); + rss->action_group = gtk_action_group_new("RouteStyleSelector"); + + /* Create edit button */ + rss->edit_button = gtk_button_new_with_label(_("Route Styles")); + g_signal_connect(G_OBJECT(rss->edit_button), "clicked", G_CALLBACK(edit_button_cb), rss); + gtk_box_pack_start(GTK_BOX(rss), rss->edit_button, FALSE, FALSE, 0); + + return GTK_WIDGET(rss); +} + +/*! \brief Create a new GHidRouteStyleSelector + * + * \param [in] rss The selector to be acted on + * \param [in] data PCB's route style object that will be edited + * \param [in] temp Whether the style is "real" or session-only + */ +struct _route_style *ghid_route_style_selector_real_add_route_style(GHidRouteStyleSelector * rss, + RouteStyleType * data, gboolean temp) +{ + GtkTreeIter iter; + GtkTreePath *path; + gchar *action_name = g_strdup_printf("RouteStyle%d", action_count); + struct _route_style *new_style = g_malloc(sizeof(*new_style)); + + /* Key the route style data with the RouteStyleType it controls */ + new_style->rst = data; + new_style->temporary = temp; + new_style->action = gtk_radio_action_new(action_name, data->Name, NULL, NULL, action_count); + gtk_radio_action_set_group(new_style->action, rss->action_radio_group); + rss->action_radio_group = gtk_radio_action_get_group(new_style->action); + new_style->button = gtk_radio_button_new(rss->button_radio_group); + rss->button_radio_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(new_style->button)); + gtk_activatable_set_related_action(GTK_ACTIVATABLE(new_style->button), GTK_ACTION(new_style->action)); + + gtk_list_store_append(rss->model, &iter); + gtk_list_store_set(rss->model, &iter, TEXT_COL, data->Name, DATA_COL, new_style, -1); + path = gtk_tree_model_get_path(GTK_TREE_MODEL(rss->model), &iter); + new_style->rref = gtk_tree_row_reference_new(GTK_TREE_MODEL(rss->model), path); + gtk_tree_path_free(path); + + /* Setup accelerator */ + if (action_count < 12) { + gchar *accel = g_strdup_printf("F%d", action_count + 1); + gtk_action_set_accel_group(GTK_ACTION(new_style->action), rss->accel_group); + gtk_action_group_add_action_with_accel(rss->action_group, GTK_ACTION(new_style->action), accel); + g_free(accel); + } + + /* Hookup and install radio button */ + g_object_set_data(G_OBJECT(new_style->action), "route-style", new_style); + new_style->sig_id = g_signal_connect(G_OBJECT(new_style->action), "activate", G_CALLBACK(radio_select_cb), rss); + gtk_box_pack_start(GTK_BOX(rss), new_style->button, FALSE, FALSE, 0); + + g_free(action_name); + ++action_count; + return new_style; +} + +/*! \brief Adds a route style to a GHidRouteStyleSelector + * \par Function Description + * Adds a new route style to be managed by this selector. Note + * that the route style object passed to this function will be + * updated directly. + * + * \param [in] rss The selector to be acted on + * \param [in] data PCB's route style object describing the style + */ +void ghid_route_style_selector_add_route_style(GHidRouteStyleSelector * rss, RouteStyleType * data) +{ + ghid_route_style_selector_real_add_route_style(rss, data, FALSE); +} + + +/*! \brief Install the "Route Style" menu items + * \par Function Description + * Takes a menu shell and installs menu items for route style selection in + * the shell, at the given position. Note that we aren't really guaranteed + * the ordering of these items, since our internal data structure is a hash + * table. This shouldn't be a problem. + * + * \param [in] rss The selector to be acted on + * \param [in] shell The menu to install the items in + * \param [in] pos The position in the menu to install items + * + * \return the number of items installed + */ +gint ghid_route_style_selector_install_items(GHidRouteStyleSelector * rss, GtkMenuShell * shell, gint pos) +{ + gint n = 0; + GtkTreeIter iter; + + gtk_tree_model_get_iter_first(GTK_TREE_MODEL(rss->model), &iter); + do { + GtkAction *action; + struct _route_style *style; + + gtk_tree_model_get(GTK_TREE_MODEL(rss->model), &iter, DATA_COL, &style, -1); + action = GTK_ACTION(style->action); + style->menu_item = gtk_action_create_menu_item(action); + gtk_menu_shell_insert(shell, style->menu_item, pos + n); + ++n; + } + while (gtk_tree_model_iter_next(GTK_TREE_MODEL(rss->model), &iter)); + + return n; +} + +/*! \brief Selects a route style and emits a select-style signal + * + * \param [in] rss The selector to be acted on + * \param [in] rst The style to select + * + * \return TRUE if a style was selected, FALSE otherwise + */ +gboolean ghid_route_style_selector_select_style(GHidRouteStyleSelector * rss, RouteStyleType * rst) +{ + GtkTreeIter iter; + gtk_tree_model_get_iter_first(GTK_TREE_MODEL(rss->model), &iter); + do { + struct _route_style *style; + gtk_tree_model_get(GTK_TREE_MODEL(rss->model), &iter, DATA_COL, &style, -1); + if (style->rst == rst) { + g_signal_handler_block(G_OBJECT(style->action), style->sig_id); + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(style->action), TRUE); + g_signal_handler_unblock(G_OBJECT(style->action), style->sig_id); + rss->active_style = style; + g_signal_emit(rss, ghid_route_style_selector_signals[SELECT_STYLE_SIGNAL], 0, rss->active_style->rst); + return TRUE; + } + } + while (gtk_tree_model_iter_next(GTK_TREE_MODEL(rss->model), &iter)); + + return FALSE; +} + +/*! \brief Returns the GtkAccelGroup of a route style selector + * \par Function Description + * + * \param [in] rss The selector to be acted on + * + * \return the accel group of the selector + */ +GtkAccelGroup *ghid_route_style_selector_get_accel_group(GHidRouteStyleSelector * rss) +{ + return rss->accel_group; +} + +/*! \brief Sets a GHidRouteStyleSelector selection to given values + * \par Function Description + * Given the line thickness, via size and clearance values of a route + * style, this function selects a route style with the given values. + * If there is no such style registered with the selector, nothing + * will happen. This function does not emit any signals. + * + * \param [in] rss The selector to be acted on + * \param [in] Thick Coord to match selection to + * \param [in] Hole Coord to match selection to + * \param [in] Diameter Coord to match selection to + * \param [in] Keepaway Coord to match selection to + */ +void ghid_route_style_selector_sync(GHidRouteStyleSelector * rss, Coord Thick, Coord Hole, Coord Diameter, Coord Keepaway) +{ + GtkTreeIter iter; + gtk_tree_model_get_iter_first(GTK_TREE_MODEL(rss->model), &iter); + do { + struct _route_style *style; + gtk_tree_model_get(GTK_TREE_MODEL(rss->model), &iter, DATA_COL, &style, -1); + if (style->rst->Thick == Thick && + style->rst->Hole == Hole && style->rst->Diameter == Diameter && style->rst->Keepaway == Keepaway) { + g_signal_handler_block(G_OBJECT(style->action), style->sig_id); + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(style->action), TRUE); + g_signal_handler_unblock(G_OBJECT(style->action), style->sig_id); + rss->active_style = style; + } + } + while (gtk_tree_model_iter_next(GTK_TREE_MODEL(rss->model), &iter)); +} + +/*! \brief Removes all styles from a route style selector */ +void ghid_route_style_selector_empty(GHidRouteStyleSelector * rss) +{ + GtkTreeIter iter; + gtk_tree_model_get_iter_first(GTK_TREE_MODEL(rss->model), &iter); + do { + struct _route_style *rsdata; + gtk_tree_model_get(GTK_TREE_MODEL(rss->model), &iter, DATA_COL, &rsdata, -1); + if (rsdata->action) { + gtk_action_disconnect_accelerator(GTK_ACTION(rsdata->action)); + gtk_action_group_remove_action(rss->action_group, GTK_ACTION(rsdata->action)); + g_object_unref(G_OBJECT(rsdata->action)); + } + if (rsdata->button) + gtk_widget_destroy(GTK_WIDGET(rsdata->button));; + gtk_tree_row_reference_free(rsdata->rref); + free(rsdata); + } + while (gtk_list_store_remove(rss->model, &iter)); + rss->action_radio_group = NULL; + rss->button_radio_group = NULL; +} Index: 1.0.8/src/hid/gtk/ghid-route-style-selector.h =================================================================== --- 1.0.8/src/hid/gtk/ghid-route-style-selector.h (nonexistent) +++ 1.0.8/src/hid/gtk/ghid-route-style-selector.h (revision 1136) @@ -0,0 +1,34 @@ +#ifndef GHID_ROUTE_STYLE_SELECTOR_H__ +#define GHID_ROUTE_STYLE_SELECTOR_H__ + +#include +#include +#include + +#include "global.h" + +G_BEGIN_DECLS /* keep c++ happy */ +#define GHID_ROUTE_STYLE_SELECTOR_TYPE (ghid_route_style_selector_get_type ()) +#define GHID_ROUTE_STYLE_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GHID_ROUTE_STYLE_SELECTOR_TYPE, GHidRouteStyleSelector)) +#define GHID_ROUTE_STYLE_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GHID_ROUTE_STYLE_SELECTOR_TYPE, GHidRouteStyleSelectorClass)) +#define IS_GHID_ROUTE_STYLE_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GHID_ROUTE_STYLE_SELECTOR_TYPE)) +#define IS_GHID_ROUTE_STYLE_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GHID_ROUTE_STYLE_SELECTOR_TYPE)) +typedef struct _GHidRouteStyleSelector GHidRouteStyleSelector; +typedef struct _GHidRouteStyleSelectorClass GHidRouteStyleSelectorClass; + +GType ghid_route_style_selector_get_type(void); +GtkWidget *ghid_route_style_selector_new(void); + +gint ghid_route_style_selector_install_items(GHidRouteStyleSelector * rss, GtkMenuShell * shell, gint pos); + +void ghid_route_style_selector_add_route_style(GHidRouteStyleSelector * rss, RouteStyleType * data); +gboolean ghid_route_style_selector_select_style(GHidRouteStyleSelector * rss, RouteStyleType * rst); +void ghid_route_style_selector_edit_dialog(GHidRouteStyleSelector * rss); + +GtkAccelGroup *ghid_route_style_selector_get_accel_group(GHidRouteStyleSelector * rss); + +void ghid_route_style_selector_sync(GHidRouteStyleSelector * rss, Coord Thick, Coord Hole, Coord Diameter, Coord Keepaway); +void ghid_route_style_selector_empty(GHidRouteStyleSelector * rss); + +G_END_DECLS /* keep c++ happy */ +#endif Index: 1.0.8/src/hid/gtk/gtk_debug.h =================================================================== --- 1.0.8/src/hid/gtk/gtk_debug.h (nonexistent) +++ 1.0.8/src/hid/gtk/gtk_debug.h (revision 1136) @@ -0,0 +1,26 @@ +/* #include this file to get widget print functions */ + +#include +#include + +static void print_widget(GtkWidget * w) +{ + fprintf(stderr, " %p %d;%d %d;%d %d;%d\n", w, w->allocation.x, w->allocation.y, w->allocation.width, w->allocation.height, + w->requisition.width, w->requisition.height); + fprintf(stderr, " flags=%x typ=%d realized=%d vis=%d\n", GTK_WIDGET_FLAGS(w), GTK_WIDGET_TYPE(w), GTK_WIDGET_REALIZED(w), + GTK_WIDGET_VISIBLE(w)); +} + + +static void print_menu_shell_cb(void *obj, void *ud) +{ + GtkWidget *w = obj; + print_widget(w); +} + +static void print_menu_shell(GtkMenuShell * sh) +{ + GList *children; + children = gtk_container_get_children(GTK_CONTAINER(sh)); + g_list_foreach(children, print_menu_shell_cb, NULL); +} Index: 1.0.8/src/hid/gtk/gtkhid-gdk.c =================================================================== --- 1.0.8/src/hid/gtk/gtkhid-gdk.c (nonexistent) +++ 1.0.8/src/hid/gtk/gtkhid-gdk.c (revision 1136) @@ -0,0 +1,1253 @@ +/* $Id$ */ + +#include "config.h" + +#include + +#include "crosshair.h" +#include "clip.h" +#include "../hidint.h" +#include "gui.h" +#include "hid/common/draw_helpers.h" + + + +RCSID("$Id$"); + + +extern HID ghid_hid; + +/* Sets priv->u_gc to the "right" GC to use (wrt mask or window) +*/ +#define USE_GC(gc) if (!use_gc(gc)) return + +static int cur_mask = -1; +static int mask_seq = 0; + +typedef struct render_priv { + GdkGC *bg_gc; + GdkGC *offlimits_gc; + GdkGC *mask_gc; + GdkGC *u_gc; + GdkGC *grid_gc; + bool clip; + GdkRectangle clip_rect; + int attached_invalidate_depth; + int mark_invalidate_depth; + + /* Feature for leading the user to a particular location */ + guint lead_user_timeout; + GTimer *lead_user_timer; + bool lead_user; + Coord lead_user_radius; + Coord lead_user_x; + Coord lead_user_y; + +} render_priv; + + +typedef struct hid_gc_struct { + HID *me_pointer; + GdkGC *gc; + + gchar *colorname; + Coord width; + gint cap, join; + gchar xor_mask; + gint mask_seq; +} hid_gc_struct; + + +static void draw_lead_user(render_priv * priv); + + +int ghid_set_layer(const char *name, int group, int empty) +{ + int idx = group; + if (idx >= 0 && idx < max_group) { + int n = PCB->LayerGroups.Number[group]; + for (idx = 0; idx < n - 1; idx++) { + int ni = PCB->LayerGroups.Entries[group][idx]; + if (ni >= 0 && ni < max_copper_layer + 2 && PCB->Data->Layer[ni].On) + break; + } + idx = PCB->LayerGroups.Entries[group][idx]; + } + + if (idx >= 0 && idx < max_copper_layer + 2) + return /*pinout ? 1 : */ PCB->Data->Layer[idx].On; + if (idx < 0) { + switch (SL_TYPE(idx)) { + case SL_INVISIBLE: + return /* pinout ? 0 : */ PCB->InvisibleObjectsOn; + case SL_MASK: + if (SL_MYSIDE(idx) /*&& !pinout */ ) + return TEST_FLAG(SHOWMASKFLAG, PCB); + return 0; + case SL_SILK: + if (SL_MYSIDE(idx) /*|| pinout */ ) + return PCB->ElementOn; + return 0; + case SL_ASSY: + return 0; + case SL_PDRILL: + case SL_UDRILL: + return 1; + case SL_RATS: + return PCB->RatOn; + } + } + return 0; +} + +void ghid_destroy_gc(hidGC gc) +{ + if (gc->gc) + g_object_unref(gc->gc); + if (gc->colorname != NULL) + g_free(gc->colorname); + g_free(gc); +} + +hidGC ghid_make_gc(void) +{ + hidGC rv; + + rv = g_new0(hid_gc_struct, 1); + rv->me_pointer = &ghid_hid; + rv->colorname = g_strdup(Settings.BackgroundColor); + return rv; +} + +static void set_clip(render_priv * priv, GdkGC * gc) +{ + if (gc == NULL) + return; + + if (priv->clip) + gdk_gc_set_clip_rectangle(gc, &priv->clip_rect); + else + gdk_gc_set_clip_mask(gc, NULL); +} + +static void ghid_draw_grid(void) +{ + static GdkPoint *points = 0; + static int npoints = 0; + Coord x1, y1, x2, y2, x, y; + int n, i; + render_priv *priv = gport->render_priv; + + if (!Settings.DrawGrid) + return; + if (Vz(PCB->Grid) < MIN_GRID_DISTANCE) + return; + if (!priv->grid_gc) { + if (gdk_color_parse(Settings.GridColor, &gport->grid_color)) { + gport->grid_color.red ^= gport->bg_color.red; + gport->grid_color.green ^= gport->bg_color.green; + gport->grid_color.blue ^= gport->bg_color.blue; + gdk_color_alloc(gport->colormap, &gport->grid_color); + } + priv->grid_gc = gdk_gc_new(gport->drawable); + gdk_gc_set_function(priv->grid_gc, GDK_XOR); + gdk_gc_set_foreground(priv->grid_gc, &gport->grid_color); + gdk_gc_set_clip_origin(priv->grid_gc, 0, 0); + set_clip(priv, priv->grid_gc); + } + x1 = GridFit(SIDE_X(gport->view.x0), PCB->Grid, PCB->GridOffsetX); + y1 = GridFit(SIDE_Y(gport->view.y0), PCB->Grid, PCB->GridOffsetY); + x2 = GridFit(SIDE_X(gport->view.x0 + gport->view.width - 1), PCB->Grid, PCB->GridOffsetX); + y2 = GridFit(SIDE_Y(gport->view.y0 + gport->view.height - 1), PCB->Grid, PCB->GridOffsetY); + if (x1 > x2) { + Coord tmp = x1; + x1 = x2; + x2 = tmp; + } + if (y1 > y2) { + Coord tmp = y1; + y1 = y2; + y2 = tmp; + } + if (Vx(x1) < 0) + x1 += PCB->Grid; + if (Vy(y1) < 0) + y1 += PCB->Grid; + if (Vx(x2) >= gport->width) + x2 -= PCB->Grid; + if (Vy(y2) >= gport->height) + y2 -= PCB->Grid; + n = (x2 - x1) / PCB->Grid + 1; + if (n > npoints) { + npoints = n + 10; + points = (GdkPoint *) realloc(points, npoints * sizeof(GdkPoint)); + } + n = 0; + for (x = x1; x <= x2; x += PCB->Grid) { + points[n].x = Vx(x); + n++; + } + if (n == 0) + return; + for (y = y1; y <= y2; y += PCB->Grid) { + for (i = 0; i < n; i++) + points[i].y = Vy(y); + gdk_draw_points(gport->drawable, priv->grid_gc, points, n); + } +} + +/* ------------------------------------------------------------ */ +static void ghid_draw_bg_image(void) +{ + static GdkPixbuf *pixbuf; + GdkInterpType interp_type; + gint x, y, w, h, w_src, h_src; + static gint w_scaled, h_scaled; + render_priv *priv = gport->render_priv; + + if (!ghidgui->bg_pixbuf) + return; + + w = PCB->MaxWidth / gport->view.coord_per_px; + h = PCB->MaxHeight / gport->view.coord_per_px; + x = gport->view.x0 / gport->view.coord_per_px; + y = gport->view.y0 / gport->view.coord_per_px; + + if (w_scaled != w || h_scaled != h) { + if (pixbuf) + g_object_unref(G_OBJECT(pixbuf)); + + w_src = gdk_pixbuf_get_width(ghidgui->bg_pixbuf); + h_src = gdk_pixbuf_get_height(ghidgui->bg_pixbuf); + if (w > w_src && h > h_src) + interp_type = GDK_INTERP_NEAREST; + else + interp_type = GDK_INTERP_BILINEAR; + + pixbuf = gdk_pixbuf_scale_simple(ghidgui->bg_pixbuf, w, h, interp_type); + w_scaled = w; + h_scaled = h; + } + if (pixbuf) + gdk_pixbuf_render_to_drawable(pixbuf, gport->drawable, priv->bg_gc, x, y, 0, 0, w - x, h - y, GDK_RGB_DITHER_NORMAL, 0, 0); +} + +#define WHICH_GC(gc) (cur_mask == HID_MASK_CLEAR ? priv->mask_gc : (gc)->gc) + +void ghid_use_mask(int use_it) +{ + static int mask_seq_id = 0; + GdkColor color; + render_priv *priv = gport->render_priv; + + if (!gport->pixmap) + return; + if (use_it == cur_mask) + return; + switch (use_it) { + case HID_MASK_OFF: + gport->drawable = gport->pixmap; + mask_seq = 0; + break; + + case HID_MASK_BEFORE: + /* The HID asks not to receive this mask type, so warn if we get it */ + g_return_if_reached(); + + case HID_MASK_CLEAR: + if (!gport->mask) + gport->mask = gdk_pixmap_new(0, gport->width, gport->height, 1); + gport->drawable = gport->mask; + mask_seq = 0; + if (!priv->mask_gc) { + priv->mask_gc = gdk_gc_new(gport->drawable); + gdk_gc_set_clip_origin(priv->mask_gc, 0, 0); + set_clip(priv, priv->mask_gc); + } + color.pixel = 1; + gdk_gc_set_foreground(priv->mask_gc, &color); + gdk_draw_rectangle(gport->drawable, priv->mask_gc, TRUE, 0, 0, gport->width, gport->height); + color.pixel = 0; + gdk_gc_set_foreground(priv->mask_gc, &color); + break; + + case HID_MASK_AFTER: + mask_seq_id++; + if (!mask_seq_id) + mask_seq_id = 1; + mask_seq = mask_seq_id; + + gport->drawable = gport->pixmap; + break; + + } + cur_mask = use_it; +} + + +typedef struct { + int color_set; + GdkColor color; + int xor_set; + GdkColor xor_color; +} ColorCache; + + + /* Config helper functions for when the user changes color preferences. + | set_special colors used in the gtkhid. + */ +static void set_special_grid_color(void) +{ + render_priv *priv = gport->render_priv; + + if (!gport->colormap) + return; + gport->grid_color.red ^= gport->bg_color.red; + gport->grid_color.green ^= gport->bg_color.green; + gport->grid_color.blue ^= gport->bg_color.blue; + gdk_color_alloc(gport->colormap, &gport->grid_color); + if (priv->grid_gc) + gdk_gc_set_foreground(priv->grid_gc, &gport->grid_color); +} + +void ghid_set_special_colors(HID_Attribute * ha) +{ + render_priv *priv = gport->render_priv; + + if (!ha->name || !ha->value) + return; + if (!strcmp(ha->name, "background-color") && priv->bg_gc) { + ghid_map_color_string(*(char **) ha->value, &gport->bg_color); + gdk_gc_set_foreground(priv->bg_gc, &gport->bg_color); + set_special_grid_color(); + } + else if (!strcmp(ha->name, "off-limit-color") && priv->offlimits_gc) { + ghid_map_color_string(*(char **) ha->value, &gport->offlimits_color); + gdk_gc_set_foreground(priv->offlimits_gc, &gport->offlimits_color); + } + else if (!strcmp(ha->name, "grid-color") && priv->grid_gc) { + ghid_map_color_string(*(char **) ha->value, &gport->grid_color); + set_special_grid_color(); + } +} + +void ghid_set_color(hidGC gc, const char *name) +{ + static void *cache = 0; + hidval cval; + + if (name == NULL) { + fprintf(stderr, "%s(): name = NULL, setting to magenta\n", __FUNCTION__); + name = "magenta"; + } + + if (name != gc->colorname) { + if (gc->colorname != NULL) + g_free(gc->colorname); + gc->colorname = g_strdup(name); + } + + if (!gc->gc) + return; + if (gport->colormap == 0) + gport->colormap = gtk_widget_get_colormap(gport->top_window); + + if (strcmp(name, "erase") == 0) { + gdk_gc_set_foreground(gc->gc, &gport->bg_color); + } + else if (strcmp(name, "drill") == 0) { + gdk_gc_set_foreground(gc->gc, &gport->offlimits_color); + } + else { + ColorCache *cc; + if (hid_cache_color(0, name, &cval, &cache)) + cc = (ColorCache *) cval.ptr; + else { + cc = (ColorCache *) malloc(sizeof(ColorCache)); + memset(cc, 0, sizeof(*cc)); + cval.ptr = cc; + hid_cache_color(1, name, &cval, &cache); + } + + if (!cc->color_set) { + if (gdk_color_parse(name, &cc->color)) + gdk_color_alloc(gport->colormap, &cc->color); + else + gdk_color_white(gport->colormap, &cc->color); + cc->color_set = 1; + } + if (gc->xor_mask) { + if (!cc->xor_set) { + cc->xor_color.red = cc->color.red ^ gport->bg_color.red; + cc->xor_color.green = cc->color.green ^ gport->bg_color.green; + cc->xor_color.blue = cc->color.blue ^ gport->bg_color.blue; + gdk_color_alloc(gport->colormap, &cc->xor_color); + cc->xor_set = 1; + } + gdk_gc_set_foreground(gc->gc, &cc->xor_color); + } + else { + gdk_gc_set_foreground(gc->gc, &cc->color); + } + } +} + +void ghid_set_line_cap(hidGC gc, EndCapStyle style) +{ + render_priv *priv = gport->render_priv; + + switch (style) { + case Trace_Cap: + case Round_Cap: + gc->cap = GDK_CAP_ROUND; + gc->join = GDK_JOIN_ROUND; + break; + case Square_Cap: + case Beveled_Cap: + gc->cap = GDK_CAP_PROJECTING; + gc->join = GDK_JOIN_MITER; + break; + } + if (gc->gc) + gdk_gc_set_line_attributes(WHICH_GC(gc), Vz(gc->width), GDK_LINE_SOLID, (GdkCapStyle) gc->cap, (GdkJoinStyle) gc->join); +} + +void ghid_set_line_width(hidGC gc, Coord width) +{ + render_priv *priv = gport->render_priv; + + gc->width = width; + if (gc->gc) + gdk_gc_set_line_attributes(WHICH_GC(gc), Vz(gc->width), GDK_LINE_SOLID, (GdkCapStyle) gc->cap, (GdkJoinStyle) gc->join); +} + +void ghid_set_draw_xor(hidGC gc, int xor_mask) +{ + gc->xor_mask = xor_mask; + if (!gc->gc) + return; + gdk_gc_set_function(gc->gc, xor_mask ? GDK_XOR : GDK_COPY); + ghid_set_color(gc, gc->colorname); +} + +static int use_gc(hidGC gc) +{ + render_priv *priv = gport->render_priv; + GdkWindow *window = gtk_widget_get_window(gport->top_window); + + if (gc->me_pointer != &ghid_hid) { + fprintf(stderr, "Fatal: GC from another HID passed to GTK HID\n"); + abort(); + } + + if (!gport->pixmap) + return 0; + if (!gc->gc) { + gc->gc = gdk_gc_new(window); + ghid_set_color(gc, gc->colorname); + ghid_set_line_width(gc, gc->width); + ghid_set_line_cap(gc, (EndCapStyle) gc->cap); + ghid_set_draw_xor(gc, gc->xor_mask); + gdk_gc_set_clip_origin(gc->gc, 0, 0); + } + if (gc->mask_seq != mask_seq) { + if (mask_seq) + gdk_gc_set_clip_mask(gc->gc, gport->mask); + else + set_clip(priv, gc->gc); + gc->mask_seq = mask_seq; + } + priv->u_gc = WHICH_GC(gc); + return 1; +} + +void ghid_draw_line(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ + double dx1, dy1, dx2, dy2; + render_priv *priv = gport->render_priv; + + dx1 = Vx((double) x1); + dy1 = Vy((double) y1); + dx2 = Vx((double) x2); + dy2 = Vy((double) y2); + + if (!ClipLine(0, 0, gport->width, gport->height, &dx1, &dy1, &dx2, &dy2, gc->width / gport->view.coord_per_px)) + return; + + USE_GC(gc); + gdk_draw_line(gport->drawable, priv->u_gc, dx1, dy1, dx2, dy2); +} + +void ghid_draw_arc(hidGC gc, Coord cx, Coord cy, Coord xradius, Coord yradius, Angle start_angle, Angle delta_angle) +{ + gint vrx, vry; + gint w, h, radius; + render_priv *priv = gport->render_priv; + + w = gport->width * gport->view.coord_per_px; + h = gport->height * gport->view.coord_per_px; + radius = (xradius > yradius) ? xradius : yradius; + if (SIDE_X(cx) < gport->view.x0 - radius + || SIDE_X(cx) > gport->view.x0 + w + radius + || SIDE_Y(cy) < gport->view.y0 - radius || SIDE_Y(cy) > gport->view.y0 + h + radius) + return; + + USE_GC(gc); + vrx = Vz(xradius); + vry = Vz(yradius); + + if (gport->view.flip_x) { + start_angle = 180 - start_angle; + delta_angle = -delta_angle; + } + if (gport->view.flip_y) { + start_angle = -start_angle; + delta_angle = -delta_angle; + } + /* make sure we fall in the -180 to +180 range */ + start_angle = NormalizeAngle(start_angle); + if (start_angle >= 180) + start_angle -= 360; + + gdk_draw_arc(gport->drawable, priv->u_gc, 0, + Vx(cx) - vrx, Vy(cy) - vry, vrx * 2, vry * 2, (start_angle + 180) * 64, delta_angle * 64); +} + +void ghid_draw_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ + gint w, h, lw; + render_priv *priv = gport->render_priv; + + lw = gc->width; + w = gport->width * gport->view.coord_per_px; + h = gport->height * gport->view.coord_per_px; + + if ((SIDE_X(x1) < gport->view.x0 - lw && SIDE_X(x2) < gport->view.x0 - lw) + || (SIDE_X(x1) > gport->view.x0 + w + lw && SIDE_X(x2) > gport->view.x0 + w + lw) + || (SIDE_Y(y1) < gport->view.y0 - lw && SIDE_Y(y2) < gport->view.y0 - lw) + || (SIDE_Y(y1) > gport->view.y0 + h + lw && SIDE_Y(y2) > gport->view.y0 + h + lw)) + return; + + x1 = Vx(x1); + y1 = Vy(y1); + x2 = Vx(x2); + y2 = Vy(y2); + + if (x1 > x2) { + gint xt = x1; + x1 = x2; + x2 = xt; + } + if (y1 > y2) { + gint yt = y1; + y1 = y2; + y2 = yt; + } + + USE_GC(gc); + gdk_draw_rectangle(gport->drawable, priv->u_gc, FALSE, x1, y1, x2 - x1 + 1, y2 - y1 + 1); +} + + +void ghid_fill_circle(hidGC gc, Coord cx, Coord cy, Coord radius) +{ + gint w, h, vr; + render_priv *priv = gport->render_priv; + + w = gport->width * gport->view.coord_per_px; + h = gport->height * gport->view.coord_per_px; + if (SIDE_X(cx) < gport->view.x0 - radius + || SIDE_X(cx) > gport->view.x0 + w + radius + || SIDE_Y(cy) < gport->view.y0 - radius || SIDE_Y(cy) > gport->view.y0 + h + radius) + return; + + USE_GC(gc); + vr = Vz(radius); + gdk_draw_arc(gport->drawable, priv->u_gc, TRUE, Vx(cx) - vr, Vy(cy) - vr, vr * 2, vr * 2, 0, 360 * 64); +} + +void ghid_fill_polygon(hidGC gc, int n_coords, Coord * x, Coord * y) +{ + static GdkPoint *points = 0; + static int npoints = 0; + int i; + render_priv *priv = gport->render_priv; + USE_GC(gc); + + if (npoints < n_coords) { + npoints = n_coords + 1; + points = (GdkPoint *) realloc(points, npoints * sizeof(GdkPoint)); + } + for (i = 0; i < n_coords; i++) { + points[i].x = Vx(x[i]); + points[i].y = Vy(y[i]); + } + gdk_draw_polygon(gport->drawable, priv->u_gc, 1, points, n_coords); +} + +void ghid_fill_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ + gint w, h, lw, xx, yy; + render_priv *priv = gport->render_priv; + + lw = gc->width; + w = gport->width * gport->view.coord_per_px; + h = gport->height * gport->view.coord_per_px; + + if ((SIDE_X(x1) < gport->view.x0 - lw && SIDE_X(x2) < gport->view.x0 - lw) + || (SIDE_X(x1) > gport->view.x0 + w + lw && SIDE_X(x2) > gport->view.x0 + w + lw) + || (SIDE_Y(y1) < gport->view.y0 - lw && SIDE_Y(y2) < gport->view.y0 - lw) + || (SIDE_Y(y1) > gport->view.y0 + h + lw && SIDE_Y(y2) > gport->view.y0 + h + lw)) + return; + + x1 = Vx(x1); + y1 = Vy(y1); + x2 = Vx(x2); + y2 = Vy(y2); + if (x2 < x1) { + xx = x1; + x1 = x2; + x2 = xx; + } + if (y2 < y1) { + yy = y1; + y1 = y2; + y2 = yy; + } + USE_GC(gc); + gdk_draw_rectangle(gport->drawable, priv->u_gc, TRUE, x1, y1, x2 - x1 + 1, y2 - y1 + 1); +} + +static void redraw_region(GdkRectangle * rect) +{ + int eleft, eright, etop, ebottom; + BoxType region; + render_priv *priv = gport->render_priv; + + if (!gport->pixmap) + return; + + if (rect != NULL) { + priv->clip_rect = *rect; + priv->clip = true; + } + else { + priv->clip_rect.x = 0; + priv->clip_rect.y = 0; + priv->clip_rect.width = gport->width; + priv->clip_rect.height = gport->height; + priv->clip = false; + } + + set_clip(priv, priv->bg_gc); + set_clip(priv, priv->offlimits_gc); + set_clip(priv, priv->mask_gc); + set_clip(priv, priv->grid_gc); + + region.X1 = MIN(Px(priv->clip_rect.x), Px(priv->clip_rect.x + priv->clip_rect.width + 1)); + region.Y1 = MIN(Py(priv->clip_rect.y), Py(priv->clip_rect.y + priv->clip_rect.height + 1)); + region.X2 = MAX(Px(priv->clip_rect.x), Px(priv->clip_rect.x + priv->clip_rect.width + 1)); + region.Y2 = MAX(Py(priv->clip_rect.y), Py(priv->clip_rect.y + priv->clip_rect.height + 1)); + + region.X1 = MAX(0, MIN(PCB->MaxWidth, region.X1)); + region.X2 = MAX(0, MIN(PCB->MaxWidth, region.X2)); + region.Y1 = MAX(0, MIN(PCB->MaxHeight, region.Y1)); + region.Y2 = MAX(0, MIN(PCB->MaxHeight, region.Y2)); + + eleft = Vx(0); + eright = Vx(PCB->MaxWidth); + etop = Vy(0); + ebottom = Vy(PCB->MaxHeight); + if (eleft > eright) { + int tmp = eleft; + eleft = eright; + eright = tmp; + } + if (etop > ebottom) { + int tmp = etop; + etop = ebottom; + ebottom = tmp; + } + + if (eleft > 0) + gdk_draw_rectangle(gport->drawable, priv->offlimits_gc, 1, 0, 0, eleft, gport->height); + else + eleft = 0; + if (eright < gport->width) + gdk_draw_rectangle(gport->drawable, priv->offlimits_gc, 1, eright, 0, gport->width - eright, gport->height); + else + eright = gport->width; + if (etop > 0) + gdk_draw_rectangle(gport->drawable, priv->offlimits_gc, 1, eleft, 0, eright - eleft + 1, etop); + else + etop = 0; + if (ebottom < gport->height) + gdk_draw_rectangle(gport->drawable, priv->offlimits_gc, 1, eleft, ebottom, eright - eleft + 1, gport->height - ebottom); + else + ebottom = gport->height; + + gdk_draw_rectangle(gport->drawable, priv->bg_gc, 1, eleft, etop, eright - eleft + 1, ebottom - etop + 1); + + ghid_draw_bg_image(); + + hid_expose_callback(&ghid_hid, ®ion, 0); + ghid_draw_grid(); + + /* In some cases we are called with the crosshair still off */ + if (priv->attached_invalidate_depth == 0) + DrawAttached(); + + /* In some cases we are called with the mark still off */ + if (priv->mark_invalidate_depth == 0) + DrawMark(); + + draw_lead_user(priv); + + priv->clip = false; + + /* Rest the clip for bg_gc, as it is used outside this function */ + gdk_gc_set_clip_mask(priv->bg_gc, NULL); +} + +void ghid_invalidate_lr(int left, int right, int top, int bottom) +{ + int dleft, dright, dtop, dbottom; + int minx, maxx, miny, maxy; + GdkRectangle rect; + + dleft = Vx(left); + dright = Vx(right); + dtop = Vy(top); + dbottom = Vy(bottom); + + minx = MIN(dleft, dright); + maxx = MAX(dleft, dright); + miny = MIN(dtop, dbottom); + maxy = MAX(dtop, dbottom); + + rect.x = minx; + rect.y = miny; + rect.width = maxx - minx; + rect.height = maxy - miny; + + redraw_region(&rect); + ghid_screen_update(); +} + + +void ghid_invalidate_all() +{ + redraw_region(NULL); + ghid_screen_update(); +} + +void ghid_notify_crosshair_change(bool changes_complete) +{ + render_priv *priv = gport->render_priv; + + /* We sometimes get called before the GUI is up */ + if (gport->drawing_area == NULL) + return; + + if (changes_complete) + priv->attached_invalidate_depth--; + + if (priv->attached_invalidate_depth < 0) { + priv->attached_invalidate_depth = 0; + /* A mismatch of changes_complete == false and == true notifications + * is not expected to occur, but we will try to handle it gracefully. + * As we know the crosshair will have been shown already, we must + * repaint the entire view to be sure not to leave an artaefact. + */ + ghid_invalidate_all(); + return; + } + + if (priv->attached_invalidate_depth == 0) + DrawAttached(); + + if (!changes_complete) { + priv->attached_invalidate_depth++; + } + else if (gport->drawing_area != NULL) { + /* Queue a GTK expose when changes are complete */ + ghid_draw_area_update(gport, NULL); + } +} + +void ghid_notify_mark_change(bool changes_complete) +{ + render_priv *priv = gport->render_priv; + + /* We sometimes get called before the GUI is up */ + if (gport->drawing_area == NULL) + return; + + if (changes_complete) + priv->mark_invalidate_depth--; + + if (priv->mark_invalidate_depth < 0) { + priv->mark_invalidate_depth = 0; + /* A mismatch of changes_complete == false and == true notifications + * is not expected to occur, but we will try to handle it gracefully. + * As we know the mark will have been shown already, we must + * repaint the entire view to be sure not to leave an artaefact. + */ + ghid_invalidate_all(); + return; + } + + if (priv->mark_invalidate_depth == 0) + DrawMark(); + + if (!changes_complete) { + priv->mark_invalidate_depth++; + } + else if (gport->drawing_area != NULL) { + /* Queue a GTK expose when changes are complete */ + ghid_draw_area_update(gport, NULL); + } +} + +static void draw_right_cross(GdkGC * xor_gc, gint x, gint y) +{ + GdkWindow *window = gtk_widget_get_window(gport->drawing_area); + + gdk_draw_line(window, xor_gc, x, 0, x, gport->height); + gdk_draw_line(window, xor_gc, 0, y, gport->width, y); +} + +static void draw_slanted_cross(GdkGC * xor_gc, gint x, gint y) +{ + GdkWindow *window = gtk_widget_get_window(gport->drawing_area); + gint x0, y0, x1, y1; + + x0 = x + (gport->height - y); + x0 = MAX(0, MIN(x0, gport->width)); + x1 = x - y; + x1 = MAX(0, MIN(x1, gport->width)); + y0 = y + (gport->width - x); + y0 = MAX(0, MIN(y0, gport->height)); + y1 = y - x; + y1 = MAX(0, MIN(y1, gport->height)); + gdk_draw_line(window, xor_gc, x0, y0, x1, y1); + + x0 = x - (gport->height - y); + x0 = MAX(0, MIN(x0, gport->width)); + x1 = x + y; + x1 = MAX(0, MIN(x1, gport->width)); + y0 = y + x; + y0 = MAX(0, MIN(y0, gport->height)); + y1 = y - (gport->width - x); + y1 = MAX(0, MIN(y1, gport->height)); + gdk_draw_line(window, xor_gc, x0, y0, x1, y1); +} + +static void draw_dozen_cross(GdkGC * xor_gc, gint x, gint y) +{ + GdkWindow *window = gtk_widget_get_window(gport->drawing_area); + gint x0, y0, x1, y1; + gdouble tan60 = sqrt(3); + + x0 = x + (gport->height - y) / tan60; + x0 = MAX(0, MIN(x0, gport->width)); + x1 = x - y / tan60; + x1 = MAX(0, MIN(x1, gport->width)); + y0 = y + (gport->width - x) * tan60; + y0 = MAX(0, MIN(y0, gport->height)); + y1 = y - x * tan60; + y1 = MAX(0, MIN(y1, gport->height)); + gdk_draw_line(window, xor_gc, x0, y0, x1, y1); + + x0 = x + (gport->height - y) * tan60; + x0 = MAX(0, MIN(x0, gport->width)); + x1 = x - y * tan60; + x1 = MAX(0, MIN(x1, gport->width)); + y0 = y + (gport->width - x) / tan60; + y0 = MAX(0, MIN(y0, gport->height)); + y1 = y - x / tan60; + y1 = MAX(0, MIN(y1, gport->height)); + gdk_draw_line(window, xor_gc, x0, y0, x1, y1); + + x0 = x - (gport->height - y) / tan60; + x0 = MAX(0, MIN(x0, gport->width)); + x1 = x + y / tan60; + x1 = MAX(0, MIN(x1, gport->width)); + y0 = y + x * tan60; + y0 = MAX(0, MIN(y0, gport->height)); + y1 = y - (gport->width - x) * tan60; + y1 = MAX(0, MIN(y1, gport->height)); + gdk_draw_line(window, xor_gc, x0, y0, x1, y1); + + x0 = x - (gport->height - y) * tan60; + x0 = MAX(0, MIN(x0, gport->width)); + x1 = x + y * tan60; + x1 = MAX(0, MIN(x1, gport->width)); + y0 = y + x / tan60; + y0 = MAX(0, MIN(y0, gport->height)); + y1 = y - (gport->width - x) / tan60; + y1 = MAX(0, MIN(y1, gport->height)); + gdk_draw_line(window, xor_gc, x0, y0, x1, y1); +} + +static void draw_crosshair(GdkGC * xor_gc, gint x, gint y) +{ + static enum crosshair_shape prev = Basic_Crosshair_Shape; + + draw_right_cross(xor_gc, x, y); + if (prev == Union_Jack_Crosshair_Shape) + draw_slanted_cross(xor_gc, x, y); + if (prev == Dozen_Crosshair_Shape) + draw_dozen_cross(xor_gc, x, y); + prev = Crosshair.shape; +} + +static void show_crosshair(gboolean paint_new_location) +{ + render_priv *priv = gport->render_priv; + GdkWindow *window = gtk_widget_get_window(gport->drawing_area); + GtkStyle *style = gtk_widget_get_style(gport->drawing_area); + gint x, y; + static gint x_prev = -1, y_prev = -1; + static GdkGC *xor_gc; + static GdkColor cross_color; + + if (gport->crosshair_x < 0 || ghidgui->creating || !gport->has_entered) + return; + + if (!xor_gc) { + xor_gc = gdk_gc_new(window); + gdk_gc_copy(xor_gc, style->white_gc); + gdk_gc_set_function(xor_gc, GDK_XOR); + gdk_gc_set_clip_origin(xor_gc, 0, 0); + set_clip(priv, xor_gc); + /* FIXME: when CrossColor changed from config */ + ghid_map_color_string(Settings.CrossColor, &cross_color); + } + x = DRAW_X(gport->crosshair_x); + y = DRAW_Y(gport->crosshair_y); + + gdk_gc_set_foreground(xor_gc, &cross_color); + + if (x_prev >= 0 && !paint_new_location) + draw_crosshair(xor_gc, x_prev, y_prev); + + if (x >= 0 && paint_new_location) { + draw_crosshair(xor_gc, x, y); + x_prev = x; + y_prev = y; + } + else + x_prev = y_prev = -1; +} + +void ghid_init_renderer(int *argc, char ***argv, GHidPort * port) +{ + /* Init any GC's required */ + port->render_priv = g_new0(render_priv, 1); +} + +void ghid_shutdown_renderer(GHidPort * port) +{ + ghid_cancel_lead_user(); + g_free(port->render_priv); + port->render_priv = NULL; +} + +void ghid_init_drawing_widget(GtkWidget * widget, GHidPort * port) +{ +} + +void ghid_drawing_area_configure_hook(GHidPort * port) +{ + static int done_once = 0; + render_priv *priv = port->render_priv; + + if (!done_once) { + priv->bg_gc = gdk_gc_new(port->drawable); + gdk_gc_set_foreground(priv->bg_gc, &port->bg_color); + gdk_gc_set_clip_origin(priv->bg_gc, 0, 0); + + priv->offlimits_gc = gdk_gc_new(port->drawable); + gdk_gc_set_foreground(priv->offlimits_gc, &port->offlimits_color); + gdk_gc_set_clip_origin(priv->offlimits_gc, 0, 0); + done_once = 1; + } + + if (port->mask) { + gdk_pixmap_unref(port->mask); + port->mask = gdk_pixmap_new(0, port->width, port->height, 1); + } +} + +void ghid_screen_update(void) +{ + render_priv *priv = gport->render_priv; + GdkWindow *window = gtk_widget_get_window(gport->drawing_area); + + if (gport->pixmap == NULL) + return; + + gdk_draw_drawable(window, priv->bg_gc, gport->pixmap, 0, 0, 0, 0, gport->width, gport->height); + show_crosshair(TRUE); +} + +gboolean ghid_drawing_area_expose_cb(GtkWidget * widget, GdkEventExpose * ev, GHidPort * port) +{ + render_priv *priv = port->render_priv; + GdkWindow *window = gtk_widget_get_window(gport->drawing_area); + + gdk_draw_drawable(window, priv->bg_gc, port->pixmap, + ev->area.x, ev->area.y, ev->area.x, ev->area.y, ev->area.width, ev->area.height); + show_crosshair(TRUE); + return FALSE; +} + +void ghid_port_drawing_realize_cb(GtkWidget * widget, gpointer data) +{ +} + +gboolean ghid_pinout_preview_expose(GtkWidget * widget, GdkEventExpose * ev) +{ + GhidPinoutPreview *pinout = GHID_PINOUT_PREVIEW(widget); + GdkWindow *window = gtk_widget_get_window(widget); + GdkDrawable *save_drawable; + GtkAllocation allocation; + view_data save_view; + int save_width, save_height; + double xz, yz; + render_priv *priv = gport->render_priv; + + /* Setup drawable and zoom factor for drawing routines + */ + save_drawable = gport->drawable; + save_view = gport->view; + save_width = gport->width; + save_height = gport->height; + + gtk_widget_get_allocation(widget, &allocation); + xz = (double) pinout->x_max / allocation.width; + yz = (double) pinout->y_max / allocation.height; + if (xz > yz) + gport->view.coord_per_px = xz; + else + gport->view.coord_per_px = yz; + + gport->drawable = window; + gport->width = allocation.width; + gport->height = allocation.height; + gport->view.width = allocation.width * gport->view.coord_per_px; + gport->view.height = allocation.height * gport->view.coord_per_px; + gport->view.x0 = (pinout->x_max - gport->view.width) / 2; + gport->view.y0 = (pinout->y_max - gport->view.height) / 2; + + /* clear background */ + gdk_draw_rectangle(window, priv->bg_gc, TRUE, 0, 0, allocation.width, allocation.height); + + /* call the drawing routine */ + hid_expose_callback(&ghid_hid, NULL, &pinout->element); + + gport->drawable = save_drawable; + gport->view = save_view; + gport->width = save_width; + gport->height = save_height; + + return FALSE; +} + +GdkPixmap *ghid_render_pixmap(int cx, int cy, double zoom, int width, int height, int depth) +{ + GdkPixmap *pixmap; + GdkDrawable *save_drawable; + view_data save_view; + int save_width, save_height; + BoxType region; + render_priv *priv = gport->render_priv; + + save_drawable = gport->drawable; + save_view = gport->view; + save_width = gport->width; + save_height = gport->height; + + pixmap = gdk_pixmap_new(NULL, width, height, depth); + + /* Setup drawable and zoom factor for drawing routines + */ + + gport->drawable = pixmap; + gport->view.coord_per_px = zoom; + gport->width = width; + gport->height = height; + gport->view.width = width * gport->view.coord_per_px; + gport->view.height = height * gport->view.coord_per_px; + gport->view.x0 = gport->view.flip_x ? PCB->MaxWidth - cx : cx; + gport->view.x0 -= gport->view.height / 2; + gport->view.y0 = gport->view.flip_y ? PCB->MaxHeight - cy : cy; + gport->view.y0 -= gport->view.width / 2; + + /* clear background */ + gdk_draw_rectangle(pixmap, priv->bg_gc, TRUE, 0, 0, width, height); + + /* call the drawing routine */ + region.X1 = MIN(Px(0), Px(gport->width + 1)); + region.Y1 = MIN(Py(0), Py(gport->height + 1)); + region.X2 = MAX(Px(0), Px(gport->width + 1)); + region.Y2 = MAX(Py(0), Py(gport->height + 1)); + + region.X1 = MAX(0, MIN(PCB->MaxWidth, region.X1)); + region.X2 = MAX(0, MIN(PCB->MaxWidth, region.X2)); + region.Y1 = MAX(0, MIN(PCB->MaxHeight, region.Y1)); + region.Y2 = MAX(0, MIN(PCB->MaxHeight, region.Y2)); + + hid_expose_callback(&ghid_hid, ®ion, NULL); + + gport->drawable = save_drawable; + gport->view = save_view; + gport->width = save_width; + gport->height = save_height; + + return pixmap; +} + +HID *ghid_request_debug_draw(void) +{ + /* No special setup requirements, drawing goes into + * the backing pixmap. */ + return &ghid_hid; +} + +void ghid_flush_debug_draw(void) +{ + ghid_screen_update(); + gdk_flush(); +} + +void ghid_finish_debug_draw(void) +{ + ghid_flush_debug_draw(); + /* No special tear down requirements + */ +} + +bool ghid_event_to_pcb_coords(int event_x, int event_y, Coord * pcb_x, Coord * pcb_y) +{ + *pcb_x = EVENT_TO_PCB_X(event_x); + *pcb_y = EVENT_TO_PCB_Y(event_y); + + return true; +} + +bool ghid_pcb_to_event_coords(Coord pcb_x, Coord pcb_y, int *event_x, int *event_y) +{ + *event_x = DRAW_X(pcb_x); + *event_y = DRAW_Y(pcb_y); + + return true; +} + + +#define LEAD_USER_WIDTH 0.2 /* millimeters */ +#define LEAD_USER_PERIOD (1000 / 5) /* 5fps (in ms) */ +#define LEAD_USER_VELOCITY 3. /* millimeters per second */ +#define LEAD_USER_ARC_COUNT 3 +#define LEAD_USER_ARC_SEPARATION 3. /* millimeters */ +#define LEAD_USER_INITIAL_RADIUS 10. /* millimetres */ +#define LEAD_USER_COLOR_R 1. +#define LEAD_USER_COLOR_G 1. +#define LEAD_USER_COLOR_B 0. + +static void draw_lead_user(render_priv * priv) +{ + GdkWindow *window = gtk_widget_get_window(gport->drawing_area); + GtkStyle *style = gtk_widget_get_style(gport->drawing_area); + int i; + Coord radius = priv->lead_user_radius; + Coord width = MM_TO_COORD(LEAD_USER_WIDTH); + Coord separation = MM_TO_COORD(LEAD_USER_ARC_SEPARATION); + static GdkGC *lead_gc = NULL; + GdkColor lead_color; + + if (!priv->lead_user) + return; + + if (lead_gc == NULL) { + lead_gc = gdk_gc_new(window); + gdk_gc_copy(lead_gc, style->white_gc); + gdk_gc_set_function(lead_gc, GDK_XOR); + gdk_gc_set_clip_origin(lead_gc, 0, 0); + lead_color.pixel = 0; + lead_color.red = (int) (65535. * LEAD_USER_COLOR_R); + lead_color.green = (int) (65535. * LEAD_USER_COLOR_G); + lead_color.blue = (int) (65535. * LEAD_USER_COLOR_B); + gdk_color_alloc(gport->colormap, &lead_color); + gdk_gc_set_foreground(lead_gc, &lead_color); + } + + set_clip(priv, lead_gc); + gdk_gc_set_line_attributes(lead_gc, Vz(width), GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER); + + /* arcs at the approrpriate radii */ + + for (i = 0; i < LEAD_USER_ARC_COUNT; i++, radius -= separation) { + if (radius < width) + radius += MM_TO_COORD(LEAD_USER_INITIAL_RADIUS); + + /* Draw an arc at radius */ + gdk_draw_arc(gport->drawable, lead_gc, FALSE, + Vx(priv->lead_user_x - radius), Vy(priv->lead_user_y - radius), Vz(2. * radius), Vz(2. * radius), 0, 360 * 64); + } +} + +gboolean lead_user_cb(gpointer data) +{ + render_priv *priv = data; + Coord step; + double elapsed_time; + + /* Queue a redraw */ + ghid_invalidate_all(); + + /* Update radius */ + elapsed_time = g_timer_elapsed(priv->lead_user_timer, NULL); + g_timer_start(priv->lead_user_timer); + + step = MM_TO_COORD(LEAD_USER_VELOCITY * elapsed_time); + if (priv->lead_user_radius > step) + priv->lead_user_radius -= step; + else + priv->lead_user_radius = MM_TO_COORD(LEAD_USER_INITIAL_RADIUS); + + return TRUE; +} + +void ghid_lead_user_to_location(Coord x, Coord y) +{ + render_priv *priv = gport->render_priv; + + ghid_cancel_lead_user(); + + priv->lead_user = true; + priv->lead_user_x = x; + priv->lead_user_y = y; + priv->lead_user_radius = MM_TO_COORD(LEAD_USER_INITIAL_RADIUS); + priv->lead_user_timeout = g_timeout_add(LEAD_USER_PERIOD, lead_user_cb, priv); + priv->lead_user_timer = g_timer_new(); +} + +void ghid_cancel_lead_user(void) +{ + render_priv *priv = gport->render_priv; + + if (priv->lead_user_timeout) + g_source_remove(priv->lead_user_timeout); + + if (priv->lead_user_timer) + g_timer_destroy(priv->lead_user_timer); + + if (priv->lead_user) + ghid_invalidate_all(); + + priv->lead_user_timeout = 0; + priv->lead_user_timer = NULL; + priv->lead_user = false; +} Index: 1.0.8/src/hid/gtk/gtkhid-gl.c =================================================================== --- 1.0.8/src/hid/gtk/gtkhid-gl.c (nonexistent) +++ 1.0.8/src/hid/gtk/gtkhid-gl.c (revision 1136) @@ -0,0 +1,1255 @@ +/* $Id$ */ + +#include "config.h" + +#include + +#include "crosshair.h" +#include "clip.h" +#include "../hidint.h" +#include "gui.h" +#include "gui-pinout-preview.h" + +/* The Linux OpenGL ABI 1.0 spec requires that we define + * GL_GLEXT_PROTOTYPES before including gl.h or glx.h for extensions + * in order to get prototypes: + * http://www.opengl.org/registry/ABI/ + */ + +#define GL_GLEXT_PROTOTYPES 1 +#ifdef HAVE_OPENGL_GL_H +#include +#else +#include +#endif + +#include +#include "hid/common/hidgl.h" +#include "hid/common/draw_helpers.h" + + +RCSID("$Id$"); + + +extern HID ghid_hid; + +static hidGC current_gc = NULL; + +/* Sets gport->u_gc to the "right" GC to use (wrt mask or window) +*/ +#define USE_GC(gc) if (!use_gc(gc)) return + +static int cur_mask = -1; + +typedef struct render_priv { + GdkGLConfig *glconfig; + bool trans_lines; + bool in_context; + int subcomposite_stencil_bit; + char *current_colorname; + double current_alpha_mult; + + /* Feature for leading the user to a particular location */ + guint lead_user_timeout; + GTimer *lead_user_timer; + bool lead_user; + Coord lead_user_radius; + Coord lead_user_x; + Coord lead_user_y; + +} render_priv; + + +typedef struct hid_gc_struct { + HID *me_pointer; + + const char *colorname; + double alpha_mult; + Coord width; + gint cap, join; + gchar xor; +} hid_gc_struct; + + +static void draw_lead_user(render_priv * priv); + + +static void start_subcomposite(void) +{ + render_priv *priv = gport->render_priv; + int stencil_bit; + + /* Flush out any existing geoemtry to be rendered */ + hidgl_flush_triangles(&buffer); + + glEnable(GL_STENCIL_TEST); /* Enable Stencil test */ + glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); /* Stencil pass => replace stencil value (with 1) */ + + stencil_bit = hidgl_assign_clear_stencil_bit(); /* Get a new (clean) bitplane to stencil with */ + glStencilMask(stencil_bit); /* Only write to our subcompositing stencil bitplane */ + glStencilFunc(GL_GREATER, stencil_bit, stencil_bit); /* Pass stencil test if our assigned bit is clear */ + + priv->subcomposite_stencil_bit = stencil_bit; +} + +static void end_subcomposite(void) +{ + render_priv *priv = gport->render_priv; + + /* Flush out any existing geoemtry to be rendered */ + hidgl_flush_triangles(&buffer); + + hidgl_return_stencil_bit(priv->subcomposite_stencil_bit); /* Relinquish any bitplane we previously used */ + + glStencilMask(0); + glStencilFunc(GL_ALWAYS, 0, 0); /* Always pass stencil test */ + glDisable(GL_STENCIL_TEST); /* Disable Stencil test */ + + priv->subcomposite_stencil_bit = 0; +} + + +int ghid_set_layer(const char *name, int group, int empty) +{ + render_priv *priv = gport->render_priv; + int idx = group; + if (idx >= 0 && idx < max_group) { + int n = PCB->LayerGroups.Number[group]; + for (idx = 0; idx < n - 1; idx++) { + int ni = PCB->LayerGroups.Entries[group][idx]; + if (ni >= 0 && ni < max_copper_layer + 2 && PCB->Data->Layer[ni].On) + break; + } + idx = PCB->LayerGroups.Entries[group][idx]; + } + + end_subcomposite(); + start_subcomposite(); + + if (idx >= 0 && idx < max_copper_layer + 2) { + priv->trans_lines = true; + return PCB->Data->Layer[idx].On; + } + if (idx < 0) { + switch (SL_TYPE(idx)) { + case SL_INVISIBLE: + return PCB->InvisibleObjectsOn; + case SL_MASK: + if (SL_MYSIDE(idx)) + return TEST_FLAG(SHOWMASKFLAG, PCB); + return 0; + case SL_SILK: + priv->trans_lines = true; + if (SL_MYSIDE(idx)) + return PCB->ElementOn; + return 0; + case SL_ASSY: + return 0; + case SL_PDRILL: + case SL_UDRILL: + return 1; + case SL_RATS: + if (PCB->RatOn) + priv->trans_lines = true; + return PCB->RatOn; + } + } + return 0; +} + +static void ghid_end_layer(void) +{ + end_subcomposite(); +} + +void ghid_destroy_gc(hidGC gc) +{ + g_free(gc); +} + +hidGC ghid_make_gc(void) +{ + hidGC rv; + + rv = g_new0(hid_gc_struct, 1); + rv->me_pointer = &ghid_hid; + rv->colorname = Settings.BackgroundColor; + rv->alpha_mult = 1.0; + return rv; +} + +static void ghid_draw_grid(BoxTypePtr drawn_area) +{ + if (Vz(PCB->Grid) < MIN_GRID_DISTANCE) + return; + + if (gdk_color_parse(Settings.GridColor, &gport->grid_color)) { + gport->grid_color.red ^= gport->bg_color.red; + gport->grid_color.green ^= gport->bg_color.green; + gport->grid_color.blue ^= gport->bg_color.blue; + } + + glEnable(GL_COLOR_LOGIC_OP); + glLogicOp(GL_XOR); + + glColor3f(gport->grid_color.red / 65535., gport->grid_color.green / 65535., gport->grid_color.blue / 65535.); + + hidgl_draw_grid(drawn_area); + + glDisable(GL_COLOR_LOGIC_OP); +} + +static void ghid_draw_bg_image(void) +{ + static GLuint texture_handle = 0; + + if (!ghidgui->bg_pixbuf) + return; + + if (texture_handle == 0) { + int width = gdk_pixbuf_get_width(ghidgui->bg_pixbuf); + int height = gdk_pixbuf_get_height(ghidgui->bg_pixbuf); + int rowstride = gdk_pixbuf_get_rowstride(ghidgui->bg_pixbuf); + int bits_per_sample = gdk_pixbuf_get_bits_per_sample(ghidgui->bg_pixbuf); + int n_channels = gdk_pixbuf_get_n_channels(ghidgui->bg_pixbuf); + unsigned char *pixels = gdk_pixbuf_get_pixels(ghidgui->bg_pixbuf); + + g_warn_if_fail(bits_per_sample == 8); + g_warn_if_fail(rowstride == width * n_channels); + + glGenTextures(1, &texture_handle); + glBindTexture(GL_TEXTURE_2D, texture_handle); + + /* XXX: We should proabbly determine what the maxmimum texture supported is, + * and if our image is larger, shrink it down using GDK pixbuf routines + * rather than having it fail below. + */ + + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, (n_channels == 4) ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE, pixels); + } + + glBindTexture(GL_TEXTURE_2D, texture_handle); + + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glEnable(GL_TEXTURE_2D); + + /* Render a quad with the background as a texture */ + + glBegin(GL_QUADS); + glTexCoord2d(0., 0.); + glVertex3i(0, 0, 0); + glTexCoord2d(1., 0.); + glVertex3i(PCB->MaxWidth, 0, 0); + glTexCoord2d(1., 1.); + glVertex3i(PCB->MaxWidth, PCB->MaxHeight, 0); + glTexCoord2d(0., 1.); + glVertex3i(0, PCB->MaxHeight, 0); + glEnd(); + + glDisable(GL_TEXTURE_2D); +} + +void ghid_use_mask(int use_it) +{ + static int stencil_bit = 0; + + if (use_it == cur_mask) + return; + + /* Flush out any existing geoemtry to be rendered */ + hidgl_flush_triangles(&buffer); + + switch (use_it) { + case HID_MASK_BEFORE: + /* The HID asks not to receive this mask type, so warn if we get it */ + g_return_if_reached(); + + case HID_MASK_CLEAR: + /* Write '1' to the stencil buffer where the solder-mask should not be drawn. */ + glColorMask(0, 0, 0, 0); /* Disable writting in color buffer */ + glEnable(GL_STENCIL_TEST); /* Enable Stencil test */ + stencil_bit = hidgl_assign_clear_stencil_bit(); /* Get a new (clean) bitplane to stencil with */ + glStencilFunc(GL_ALWAYS, stencil_bit, stencil_bit); /* Always pass stencil test, write stencil_bit */ + glStencilMask(stencil_bit); /* Only write to our subcompositing stencil bitplane */ + glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); /* Stencil pass => replace stencil value (with 1) */ + break; + + case HID_MASK_AFTER: + /* Drawing operations as masked to areas where the stencil buffer is '0' */ + glColorMask(1, 1, 1, 1); /* Enable drawing of r, g, b & a */ + glStencilFunc(GL_GEQUAL, 0, stencil_bit); /* Draw only where our bit of the stencil buffer is clear */ + glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); /* Stencil buffer read only */ + break; + + case HID_MASK_OFF: + /* Disable stenciling */ + hidgl_return_stencil_bit(stencil_bit); /* Relinquish any bitplane we previously used */ + glDisable(GL_STENCIL_TEST); /* Disable Stencil test */ + break; + } + cur_mask = use_it; +} + + + /* Config helper functions for when the user changes color preferences. + | set_special colors used in the gtkhid. + */ +static void set_special_grid_color(void) +{ + if (!gport->colormap) + return; + gport->grid_color.red ^= gport->bg_color.red; + gport->grid_color.green ^= gport->bg_color.green; + gport->grid_color.blue ^= gport->bg_color.blue; +} + +void ghid_set_special_colors(HID_Attribute * ha) +{ + if (!ha->name || !ha->value) + return; + if (!strcmp(ha->name, "background-color")) { + ghid_map_color_string(*(char **) ha->value, &gport->bg_color); + set_special_grid_color(); + } + else if (!strcmp(ha->name, "off-limit-color")) { + ghid_map_color_string(*(char **) ha->value, &gport->offlimits_color); + } + else if (!strcmp(ha->name, "grid-color")) { + ghid_map_color_string(*(char **) ha->value, &gport->grid_color); + set_special_grid_color(); + } +} + +typedef struct { + int color_set; + GdkColor color; + int xor_set; + GdkColor xor_color; + double red; + double green; + double blue; +} ColorCache; + +static void set_gl_color_for_gc(hidGC gc) +{ + render_priv *priv = gport->render_priv; + static void *cache = NULL; + hidval cval; + ColorCache *cc; + double r, g, b, a; + + if (priv->current_colorname != NULL && + strcmp(priv->current_colorname, gc->colorname) == 0 && priv->current_alpha_mult == gc->alpha_mult) + return; + + free(priv->current_colorname); + priv->current_colorname = strdup(gc->colorname); + priv->current_alpha_mult = gc->alpha_mult; + + if (gport->colormap == NULL) + gport->colormap = gtk_widget_get_colormap(gport->top_window); + if (strcmp(gc->colorname, "erase") == 0) { + r = gport->bg_color.red / 65535.; + g = gport->bg_color.green / 65535.; + b = gport->bg_color.blue / 65535.; + a = 1.0; + } + else if (strcmp(gc->colorname, "drill") == 0) { + r = gport->offlimits_color.red / 65535.; + g = gport->offlimits_color.green / 65535.; + b = gport->offlimits_color.blue / 65535.; + a = 0.85; + } + else { + if (hid_cache_color(0, gc->colorname, &cval, &cache)) + cc = (ColorCache *) cval.ptr; + else { + cc = (ColorCache *) malloc(sizeof(ColorCache)); + memset(cc, 0, sizeof(*cc)); + cval.ptr = cc; + hid_cache_color(1, gc->colorname, &cval, &cache); + } + + if (!cc->color_set) { + if (gdk_color_parse(gc->colorname, &cc->color)) + gdk_color_alloc(gport->colormap, &cc->color); + else + gdk_color_white(gport->colormap, &cc->color); + cc->red = cc->color.red / 65535.; + cc->green = cc->color.green / 65535.; + cc->blue = cc->color.blue / 65535.; + cc->color_set = 1; + } + if (gc->xor) { + if (!cc->xor_set) { + cc->xor_color.red = cc->color.red ^ gport->bg_color.red; + cc->xor_color.green = cc->color.green ^ gport->bg_color.green; + cc->xor_color.blue = cc->color.blue ^ gport->bg_color.blue; + gdk_color_alloc(gport->colormap, &cc->xor_color); + cc->red = cc->color.red / 65535.; + cc->green = cc->color.green / 65535.; + cc->blue = cc->color.blue / 65535.; + cc->xor_set = 1; + } + } + r = cc->red; + g = cc->green; + b = cc->blue; + a = 0.7; + } + if (1) { + double maxi, mult; + a *= gc->alpha_mult; + if (!priv->trans_lines) + a = 1.0; + maxi = r; + if (g > maxi) + maxi = g; + if (b > maxi) + maxi = b; + mult = MIN(1 / a, 1 / maxi); +#if 1 + r = r * mult; + g = g * mult; + b = b * mult; +#endif + } + + if (!priv->in_context) + return; + + hidgl_flush_triangles(&buffer); + glColor4d(r, g, b, a); +} + +void ghid_set_color(hidGC gc, const char *name) +{ + gc->colorname = name; + set_gl_color_for_gc(gc); +} + +void ghid_set_alpha_mult(hidGC gc, double alpha_mult) +{ + gc->alpha_mult = alpha_mult; + set_gl_color_for_gc(gc); +} + +void ghid_set_line_cap(hidGC gc, EndCapStyle style) +{ + gc->cap = style; +} + +void ghid_set_line_width(hidGC gc, Coord width) +{ + gc->width = width; +} + + +void ghid_set_draw_xor(hidGC gc, int xor) +{ + /* NOT IMPLEMENTED */ + + /* Only presently called when setting up a crosshair GC. + * We manage our own drawing model for that anyway. */ +} + +void ghid_set_draw_faded(hidGC gc, int faded) +{ + printf("ghid_set_draw_faded(%p,%d) -- not implemented\n", gc, faded); +} + +void ghid_set_line_cap_angle(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ + printf("ghid_set_line_cap_angle() -- not implemented\n"); +} + +static void ghid_invalidate_current_gc(void) +{ + current_gc = NULL; +} + +static int use_gc(hidGC gc) +{ + if (gc->me_pointer != &ghid_hid) { + fprintf(stderr, "Fatal: GC from another HID passed to GTK HID\n"); + abort(); + } + + if (current_gc == gc) + return 1; + + current_gc = gc; + + set_gl_color_for_gc(gc); + return 1; +} + +void ghid_draw_line(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ + USE_GC(gc); + + hidgl_draw_line(gc->cap, gc->width, x1, y1, x2, y2, gport->view.coord_per_px); +} + +void ghid_draw_arc(hidGC gc, Coord cx, Coord cy, Coord xradius, Coord yradius, Angle start_angle, Angle delta_angle) +{ + USE_GC(gc); + + hidgl_draw_arc(gc->width, cx, cy, xradius, yradius, start_angle, delta_angle, gport->view.coord_per_px); +} + +void ghid_draw_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ + USE_GC(gc); + + hidgl_draw_rect(x1, y1, x2, y2); +} + + +void ghid_fill_circle(hidGC gc, Coord cx, Coord cy, Coord radius) +{ + USE_GC(gc); + + hidgl_fill_circle(cx, cy, radius, gport->view.coord_per_px); +} + + +void ghid_fill_polygon(hidGC gc, int n_coords, Coord * x, Coord * y) +{ + USE_GC(gc); + + hidgl_fill_polygon(n_coords, x, y); +} + +void ghid_fill_pcb_polygon(hidGC gc, PolygonType * poly, const BoxType * clip_box) +{ + USE_GC(gc); + + hidgl_fill_pcb_polygon(poly, clip_box, gport->view.coord_per_px); +} + +void ghid_thindraw_pcb_polygon(hidGC gc, PolygonType * poly, const BoxType * clip_box) +{ + common_thindraw_pcb_polygon(gc, poly, clip_box); + ghid_set_alpha_mult(gc, 0.25); + ghid_fill_pcb_polygon(gc, poly, clip_box); + ghid_set_alpha_mult(gc, 1.0); +} + +void ghid_fill_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) +{ + USE_GC(gc); + + hidgl_fill_rect(x1, y1, x2, y2); +} + +void ghid_invalidate_lr(int left, int right, int top, int bottom) +{ + ghid_invalidate_all(); +} + +void ghid_invalidate_all() +{ + ghid_draw_area_update(gport, NULL); +} + +void ghid_notify_crosshair_change(bool changes_complete) +{ + /* We sometimes get called before the GUI is up */ + if (gport->drawing_area == NULL) + return; + + /* FIXME: We could just invalidate the bounds of the crosshair attached objects? */ + ghid_invalidate_all(); +} + +void ghid_notify_mark_change(bool changes_complete) +{ + /* We sometimes get called before the GUI is up */ + if (gport->drawing_area == NULL) + return; + + /* FIXME: We could just invalidate the bounds of the mark? */ + ghid_invalidate_all(); +} + +static void draw_right_cross(gint x, gint y, gint z) +{ + glVertex3i(x, 0, z); + glVertex3i(x, PCB->MaxHeight, z); + glVertex3i(0, y, z); + glVertex3i(PCB->MaxWidth, y, z); +} + +static void draw_slanted_cross(gint x, gint y, gint z) +{ + gint x0, y0, x1, y1; + + x0 = x + (PCB->MaxHeight - y); + x0 = MAX(0, MIN(x0, PCB->MaxWidth)); + x1 = x - y; + x1 = MAX(0, MIN(x1, PCB->MaxWidth)); + y0 = y + (PCB->MaxWidth - x); + y0 = MAX(0, MIN(y0, PCB->MaxHeight)); + y1 = y - x; + y1 = MAX(0, MIN(y1, PCB->MaxHeight)); + glVertex3i(x0, y0, z); + glVertex3i(x1, y1, z); + + x0 = x - (PCB->MaxHeight - y); + x0 = MAX(0, MIN(x0, PCB->MaxWidth)); + x1 = x + y; + x1 = MAX(0, MIN(x1, PCB->MaxWidth)); + y0 = y + x; + y0 = MAX(0, MIN(y0, PCB->MaxHeight)); + y1 = y - (PCB->MaxWidth - x); + y1 = MAX(0, MIN(y1, PCB->MaxHeight)); + glVertex3i(x0, y0, z); + glVertex3i(x1, y1, z); +} + +static void draw_dozen_cross(gint x, gint y, gint z) +{ + gint x0, y0, x1, y1; + gdouble tan60 = sqrt(3); + + x0 = x + (PCB->MaxHeight - y) / tan60; + x0 = MAX(0, MIN(x0, PCB->MaxWidth)); + x1 = x - y / tan60; + x1 = MAX(0, MIN(x1, PCB->MaxWidth)); + y0 = y + (PCB->MaxWidth - x) * tan60; + y0 = MAX(0, MIN(y0, PCB->MaxHeight)); + y1 = y - x * tan60; + y1 = MAX(0, MIN(y1, PCB->MaxHeight)); + glVertex3i(x0, y0, z); + glVertex3i(x1, y1, z); + + x0 = x + (PCB->MaxHeight - y) * tan60; + x0 = MAX(0, MIN(x0, PCB->MaxWidth)); + x1 = x - y * tan60; + x1 = MAX(0, MIN(x1, PCB->MaxWidth)); + y0 = y + (PCB->MaxWidth - x) / tan60; + y0 = MAX(0, MIN(y0, PCB->MaxHeight)); + y1 = y - x / tan60; + y1 = MAX(0, MIN(y1, PCB->MaxHeight)); + glVertex3i(x0, y0, z); + glVertex3i(x1, y1, z); + + x0 = x - (PCB->MaxHeight - y) / tan60; + x0 = MAX(0, MIN(x0, PCB->MaxWidth)); + x1 = x + y / tan60; + x1 = MAX(0, MIN(x1, PCB->MaxWidth)); + y0 = y + x * tan60; + y0 = MAX(0, MIN(y0, PCB->MaxHeight)); + y1 = y - (PCB->MaxWidth - x) * tan60; + y1 = MAX(0, MIN(y1, PCB->MaxHeight)); + glVertex3i(x0, y0, z); + glVertex3i(x1, y1, z); + + x0 = x - (PCB->MaxHeight - y) * tan60; + x0 = MAX(0, MIN(x0, PCB->MaxWidth)); + x1 = x + y * tan60; + x1 = MAX(0, MIN(x1, PCB->MaxWidth)); + y0 = y + x / tan60; + y0 = MAX(0, MIN(y0, PCB->MaxHeight)); + y1 = y - (PCB->MaxWidth - x) / tan60; + y1 = MAX(0, MIN(y1, PCB->MaxHeight)); + glVertex3i(x0, y0, z); + glVertex3i(x1, y1, z); +} + +static void draw_crosshair(gint x, gint y, gint z) +{ + static enum crosshair_shape prev = Basic_Crosshair_Shape; + + draw_right_cross(x, y, z); + if (prev == Union_Jack_Crosshair_Shape) + draw_slanted_cross(x, y, z); + if (prev == Dozen_Crosshair_Shape) + draw_dozen_cross(x, y, z); + prev = Crosshair.shape; +} + +void ghid_show_crosshair(gboolean paint_new_location) +{ + gint x, y, z; + static int done_once = 0; + static GdkColor cross_color; + + if (!paint_new_location) + return; + + if (!done_once) { + done_once = 1; + /* FIXME: when CrossColor changed from config */ + ghid_map_color_string(Settings.CrossColor, &cross_color); + } + x = gport->crosshair_x; + y = gport->crosshair_y; + z = 0; + + glEnable(GL_COLOR_LOGIC_OP); + glLogicOp(GL_XOR); + + glColor3f(cross_color.red / 65535., cross_color.green / 65535., cross_color.blue / 65535.); + + if (x >= 0 && paint_new_location) { + glBegin(GL_LINES); + draw_crosshair(x, y, z); + glEnd(); + } + + glDisable(GL_COLOR_LOGIC_OP); +} + +void ghid_init_renderer(int *argc, char ***argv, GHidPort * port) +{ + render_priv *priv; + + port->render_priv = priv = g_new0(render_priv, 1); + + gtk_gl_init(argc, argv); + + /* setup GL-context */ + priv->glconfig = gdk_gl_config_new_by_mode(GDK_GL_MODE_RGBA | GDK_GL_MODE_STENCIL | GDK_GL_MODE_DOUBLE); + if (!priv->glconfig) { + printf("Could not setup GL-context!\n"); + return; /* Should we abort? */ + } + + /* Setup HID function pointers specific to the GL renderer */ + ghid_hid.end_layer = ghid_end_layer; + ghid_hid.fill_pcb_polygon = ghid_fill_pcb_polygon; + ghid_hid.thindraw_pcb_polygon = ghid_thindraw_pcb_polygon; +} + +void ghid_shutdown_renderer(GHidPort * port) +{ + ghid_cancel_lead_user(); + g_free(port->render_priv); + port->render_priv = NULL; +} + +void ghid_init_drawing_widget(GtkWidget * widget, GHidPort * port) +{ + render_priv *priv = port->render_priv; + + gtk_widget_set_gl_capability(widget, priv->glconfig, NULL, TRUE, GDK_GL_RGBA_TYPE); +} + +void ghid_drawing_area_configure_hook(GHidPort * port) +{ +} + +gboolean ghid_start_drawing(GHidPort * port) +{ + GtkWidget *widget = port->drawing_area; + GdkGLContext *pGlContext = gtk_widget_get_gl_context(widget); + GdkGLDrawable *pGlDrawable = gtk_widget_get_gl_drawable(widget); + + /* make GL-context "current" */ + if (!gdk_gl_drawable_gl_begin(pGlDrawable, pGlContext)) + return FALSE; + + port->render_priv->in_context = true; + + return TRUE; +} + +void ghid_end_drawing(GHidPort * port) +{ + GtkWidget *widget = port->drawing_area; + GdkGLDrawable *pGlDrawable = gtk_widget_get_gl_drawable(widget); + + if (gdk_gl_drawable_is_double_buffered(pGlDrawable)) + gdk_gl_drawable_swap_buffers(pGlDrawable); + else + glFlush(); + + port->render_priv->in_context = false; + + /* end drawing to current GL-context */ + gdk_gl_drawable_gl_end(pGlDrawable); +} + +void ghid_screen_update(void) +{ +} + +#define Z_NEAR 3.0 +gboolean ghid_drawing_area_expose_cb(GtkWidget * widget, GdkEventExpose * ev, GHidPort * port) +{ + render_priv *priv = port->render_priv; + GtkAllocation allocation; + BoxType region; + + gtk_widget_get_allocation(widget, &allocation); + + ghid_start_drawing(port); + + hidgl_init(); + + /* If we don't have any stencil bits available, + we can't use the hidgl polygon drawing routine */ + /* TODO: We could use the GLU tessellator though */ + if (hidgl_stencil_bits() == 0) + ghid_hid.fill_pcb_polygon = common_fill_pcb_polygon; + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glViewport(0, 0, allocation.width, allocation.height); + + glEnable(GL_SCISSOR_TEST); + glScissor(ev->area.x, allocation.height - ev->area.height - ev->area.y, ev->area.width, ev->area.height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, allocation.width, allocation.height, 0, 0, 100); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0f, 0.0f, -Z_NEAR); + + glScalef((port->view.flip_x ? -1. : 1.) / port->view.coord_per_px, + (port->view.flip_y ? -1. : 1.) / port->view.coord_per_px, + ((port->view.flip_x == port->view.flip_y) ? 1. : -1.) / port->view.coord_per_px); + glTranslatef(port->view.flip_x ? port->view.x0 - PCB->MaxWidth : + -port->view.x0, port->view.flip_y ? port->view.y0 - PCB->MaxHeight : -port->view.y0, 0); + + glEnable(GL_STENCIL_TEST); + glClearColor(port->offlimits_color.red / 65535., + port->offlimits_color.green / 65535., port->offlimits_color.blue / 65535., 1.); + glStencilMask(~0); + glClearStencil(0); + glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + hidgl_reset_stencil_usage(); + + /* Disable the stencil test until we need it - otherwise it gets dirty */ + glDisable(GL_STENCIL_TEST); + glStencilMask(0); + glStencilFunc(GL_ALWAYS, 0, 0); + + region.X1 = MIN(Px(ev->area.x), Px(ev->area.x + ev->area.width + 1)); + region.X2 = MAX(Px(ev->area.x), Px(ev->area.x + ev->area.width + 1)); + region.Y1 = MIN(Py(ev->area.y), Py(ev->area.y + ev->area.height + 1)); + region.Y2 = MAX(Py(ev->area.y), Py(ev->area.y + ev->area.height + 1)); + + region.X1 = MAX(0, MIN(PCB->MaxWidth, region.X1)); + region.X2 = MAX(0, MIN(PCB->MaxWidth, region.X2)); + region.Y1 = MAX(0, MIN(PCB->MaxHeight, region.Y1)); + region.Y2 = MAX(0, MIN(PCB->MaxHeight, region.Y2)); + + glColor3f(port->bg_color.red / 65535., port->bg_color.green / 65535., port->bg_color.blue / 65535.); + + glBegin(GL_QUADS); + glVertex3i(0, 0, 0); + glVertex3i(PCB->MaxWidth, 0, 0); + glVertex3i(PCB->MaxWidth, PCB->MaxHeight, 0); + glVertex3i(0, PCB->MaxHeight, 0); + glEnd(); + + ghid_draw_bg_image(); + + hidgl_init_triangle_array(&buffer); + ghid_invalidate_current_gc(); + hid_expose_callback(&ghid_hid, ®ion, 0); + hidgl_flush_triangles(&buffer); + + ghid_draw_grid(®ion); + + ghid_invalidate_current_gc(); + + DrawAttached(); + DrawMark(); + hidgl_flush_triangles(&buffer); + + ghid_show_crosshair(TRUE); + + hidgl_flush_triangles(&buffer); + + draw_lead_user(priv); + + ghid_end_drawing(port); + + return FALSE; +} + +/* This realize callback is used to work around a crash bug in some mesa + * versions (observed on a machine running the intel i965 driver. It isn't + * obvious why it helps, but somehow fiddling with the GL context here solves + * the issue. The problem appears to have been fixed in recent mesa versions. + */ +void ghid_port_drawing_realize_cb(GtkWidget * widget, gpointer data) +{ + GdkGLContext *glcontext = gtk_widget_get_gl_context(widget); + GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable(widget); + + if (!gdk_gl_drawable_gl_begin(gldrawable, glcontext)) + return; + + gdk_gl_drawable_gl_end(gldrawable); + return; +} + +gboolean ghid_pinout_preview_expose(GtkWidget * widget, GdkEventExpose * ev) +{ + GdkGLContext *pGlContext = gtk_widget_get_gl_context(widget); + GdkGLDrawable *pGlDrawable = gtk_widget_get_gl_drawable(widget); + GhidPinoutPreview *pinout = GHID_PINOUT_PREVIEW(widget); + GtkAllocation allocation; + view_data save_view; + int save_width, save_height; + double xz, yz; + + save_view = gport->view; + save_width = gport->width; + save_height = gport->height; + + /* Setup zoom factor for drawing routines */ + + gtk_widget_get_allocation(widget, &allocation); + xz = (double) pinout->x_max / allocation.width; + yz = (double) pinout->y_max / allocation.height; + if (xz > yz) + gport->view.coord_per_px = xz; + else + gport->view.coord_per_px = yz; + + gport->width = allocation.width; + gport->height = allocation.height; + gport->view.width = allocation.width * gport->view.coord_per_px; + gport->view.height = allocation.height * gport->view.coord_per_px; + gport->view.x0 = (pinout->x_max - gport->view.width) / 2; + gport->view.y0 = (pinout->y_max - gport->view.height) / 2; + + /* make GL-context "current" */ + if (!gdk_gl_drawable_gl_begin(pGlDrawable, pGlContext)) { + return FALSE; + } + gport->render_priv->in_context = true; + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glViewport(0, 0, allocation.width, allocation.height); + + glEnable(GL_SCISSOR_TEST); + glScissor(ev->area.x, allocation.height - ev->area.height - ev->area.y, ev->area.width, ev->area.height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, allocation.width, allocation.height, 0, 0, 100); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0f, 0.0f, -Z_NEAR); + + glClearColor(gport->bg_color.red / 65535., gport->bg_color.green / 65535., gport->bg_color.blue / 65535., 1.); + glStencilMask(~0); + glClearStencil(0); + glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + + hidgl_reset_stencil_usage(); + + /* call the drawing routine */ + hidgl_init_triangle_array(&buffer); + ghid_invalidate_current_gc(); + glPushMatrix(); + glScalef((gport->view.flip_x ? -1. : 1.) / gport->view.coord_per_px, + (gport->view.flip_y ? -1. : 1.) / gport->view.coord_per_px, 1); + glTranslatef(gport->view.flip_x ? gport->view.x0 - PCB->MaxWidth : + -gport->view.x0, gport->view.flip_y ? gport->view.y0 - PCB->MaxHeight : -gport->view.y0, 0); + hid_expose_callback(&ghid_hid, NULL, &pinout->element); + hidgl_flush_triangles(&buffer); + glPopMatrix(); + + if (gdk_gl_drawable_is_double_buffered(pGlDrawable)) + gdk_gl_drawable_swap_buffers(pGlDrawable); + else + glFlush(); + + /* end drawing to current GL-context */ + gport->render_priv->in_context = false; + gdk_gl_drawable_gl_end(pGlDrawable); + + gport->view = save_view; + gport->width = save_width; + gport->height = save_height; + + return FALSE; +} + + +GdkPixmap *ghid_render_pixmap(int cx, int cy, double zoom, int width, int height, int depth) +{ + GdkGLConfig *glconfig; + GdkPixmap *pixmap; + GdkGLPixmap *glpixmap; + GdkGLContext *glcontext; + GdkGLDrawable *gldrawable; + view_data save_view; + int save_width, save_height; + BoxType region; + + save_view = gport->view; + save_width = gport->width; + save_height = gport->height; + + /* Setup rendering context for drawing routines + */ + + glconfig = gdk_gl_config_new_by_mode(GDK_GL_MODE_RGB | GDK_GL_MODE_STENCIL | GDK_GL_MODE_SINGLE); + + pixmap = gdk_pixmap_new(NULL, width, height, depth); + glpixmap = gdk_pixmap_set_gl_capability(pixmap, glconfig, NULL); + gldrawable = GDK_GL_DRAWABLE(glpixmap); + glcontext = gdk_gl_context_new(gldrawable, NULL, FALSE, GDK_GL_RGBA_TYPE); + + /* Setup zoom factor for drawing routines */ + + gport->view.coord_per_px = zoom; + gport->width = width; + gport->height = height; + gport->view.width = width * gport->view.coord_per_px; + gport->view.height = height * gport->view.coord_per_px; + gport->view.x0 = gport->view.flip_x ? PCB->MaxWidth - cx : cx; + gport->view.x0 -= gport->view.height / 2; + gport->view.y0 = gport->view.flip_y ? PCB->MaxHeight - cy : cy; + gport->view.y0 -= gport->view.width / 2; + + /* make GL-context "current" */ + if (!gdk_gl_drawable_gl_begin(gldrawable, glcontext)) { + return NULL; + } + gport->render_priv->in_context = true; + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glViewport(0, 0, width, height); + + glEnable(GL_SCISSOR_TEST); + glScissor(0, 0, width, height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, width, height, 0, 0, 100); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0f, 0.0f, -Z_NEAR); + + glClearColor(gport->bg_color.red / 65535., gport->bg_color.green / 65535., gport->bg_color.blue / 65535., 1.); + glStencilMask(~0); + glClearStencil(0); + glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + hidgl_reset_stencil_usage(); + + /* call the drawing routine */ + hidgl_init_triangle_array(&buffer); + ghid_invalidate_current_gc(); + glPushMatrix(); + glScalef((gport->view.flip_x ? -1. : 1.) / gport->view.coord_per_px, + (gport->view.flip_y ? -1. : 1.) / gport->view.coord_per_px, 1); + glTranslatef(gport->view.flip_x ? gport->view.x0 - PCB->MaxWidth : + -gport->view.x0, gport->view.flip_y ? gport->view.y0 - PCB->MaxHeight : -gport->view.y0, 0); + + region.X1 = MIN(Px(0), Px(gport->width + 1)); + region.Y1 = MIN(Py(0), Py(gport->height + 1)); + region.X2 = MAX(Px(0), Px(gport->width + 1)); + region.Y2 = MAX(Py(0), Py(gport->height + 1)); + + region.X1 = MAX(0, MIN(PCB->MaxWidth, region.X1)); + region.X2 = MAX(0, MIN(PCB->MaxWidth, region.X2)); + region.Y1 = MAX(0, MIN(PCB->MaxHeight, region.Y1)); + region.Y2 = MAX(0, MIN(PCB->MaxHeight, region.Y2)); + + hid_expose_callback(&ghid_hid, ®ion, NULL); + hidgl_flush_triangles(&buffer); + glPopMatrix(); + + glFlush(); + + /* end drawing to current GL-context */ + gport->render_priv->in_context = false; + gdk_gl_drawable_gl_end(gldrawable); + + gdk_pixmap_unset_gl_capability(pixmap); + + g_object_unref(glconfig); + g_object_unref(glcontext); + + gport->view = save_view; + gport->width = save_width; + gport->height = save_height; + + return pixmap; +} + +HID *ghid_request_debug_draw(void) +{ + GHidPort *port = gport; + GtkWidget *widget = port->drawing_area; + GtkAllocation allocation; + + gtk_widget_get_allocation(widget, &allocation); + + ghid_start_drawing(port); + + glViewport(0, 0, allocation.width, allocation.height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, allocation.width, allocation.height, 0, 0, 100); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0f, 0.0f, -Z_NEAR); + + hidgl_init_triangle_array(&buffer); + ghid_invalidate_current_gc(); + + /* Setup stenciling */ + glDisable(GL_STENCIL_TEST); + + glPushMatrix(); + glScalef((port->view.flip_x ? -1. : 1.) / port->view.coord_per_px, + (port->view.flip_y ? -1. : 1.) / port->view.coord_per_px, (port->view.flip_x == port->view.flip_y) ? 1. : -1.); + glTranslatef(port->view.flip_x ? port->view.x0 - PCB->MaxWidth : + -port->view.x0, port->view.flip_y ? port->view.y0 - PCB->MaxHeight : -port->view.y0, 0); + + return &ghid_hid; +} + +void ghid_flush_debug_draw(void) +{ + GtkWidget *widget = gport->drawing_area; + GdkGLDrawable *pGlDrawable = gtk_widget_get_gl_drawable(widget); + + hidgl_flush_triangles(&buffer); + + if (gdk_gl_drawable_is_double_buffered(pGlDrawable)) + gdk_gl_drawable_swap_buffers(pGlDrawable); + else + glFlush(); +} + +void ghid_finish_debug_draw(void) +{ + hidgl_flush_triangles(&buffer); + glPopMatrix(); + + ghid_end_drawing(gport); +} + +bool ghid_event_to_pcb_coords(int event_x, int event_y, Coord * pcb_x, Coord * pcb_y) +{ + *pcb_x = EVENT_TO_PCB_X(event_x); + *pcb_y = EVENT_TO_PCB_Y(event_y); + + return true; +} + +bool ghid_pcb_to_event_coords(Coord pcb_x, Coord pcb_y, int *event_x, int *event_y) +{ + *event_x = DRAW_X(pcb_x); + *event_y = DRAW_Y(pcb_y); + + return true; +} + + +#define LEAD_USER_WIDTH 0.2 /* millimeters */ +#define LEAD_USER_PERIOD (1000 / 20) /* 20fps (in ms) */ +#define LEAD_USER_VELOCITY 3. /* millimeters per second */ +#define LEAD_USER_ARC_COUNT 3 +#define LEAD_USER_ARC_SEPARATION 3. /* millimeters */ +#define LEAD_USER_INITIAL_RADIUS 10. /* millimetres */ +#define LEAD_USER_COLOR_R 1. +#define LEAD_USER_COLOR_G 1. +#define LEAD_USER_COLOR_B 0. + +static void draw_lead_user(render_priv * priv) +{ + int i; + double radius = priv->lead_user_radius; + double width = MM_TO_COORD(LEAD_USER_WIDTH); + double separation = MM_TO_COORD(LEAD_USER_ARC_SEPARATION); + + if (!priv->lead_user) + return; + + glPushAttrib(GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT); + glEnable(GL_COLOR_LOGIC_OP); + glLogicOp(GL_XOR); + glColor3f(LEAD_USER_COLOR_R, LEAD_USER_COLOR_G, LEAD_USER_COLOR_B); + + + /* arcs at the approrpriate radii */ + + for (i = 0; i < LEAD_USER_ARC_COUNT; i++, radius -= separation) { + if (radius < width) + radius += MM_TO_COORD(LEAD_USER_INITIAL_RADIUS); + + /* Draw an arc at radius */ + hidgl_draw_arc(width, priv->lead_user_x, priv->lead_user_y, radius, radius, 0, 360, gport->view.coord_per_px); + } + + hidgl_flush_triangles(&buffer); + glPopAttrib(); +} + +gboolean lead_user_cb(gpointer data) +{ + render_priv *priv = data; + Coord step; + double elapsed_time; + + /* Queue a redraw */ + ghid_invalidate_all(); + + /* Update radius */ + elapsed_time = g_timer_elapsed(priv->lead_user_timer, NULL); + g_timer_start(priv->lead_user_timer); + + step = MM_TO_COORD(LEAD_USER_VELOCITY * elapsed_time); + if (priv->lead_user_radius > step) + priv->lead_user_radius -= step; + else + priv->lead_user_radius = MM_TO_COORD(LEAD_USER_INITIAL_RADIUS); + + return TRUE; +} + +void ghid_lead_user_to_location(Coord x, Coord y) +{ + render_priv *priv = gport->render_priv; + + ghid_cancel_lead_user(); + + priv->lead_user = true; + priv->lead_user_x = x; + priv->lead_user_y = y; + priv->lead_user_radius = MM_TO_COORD(LEAD_USER_INITIAL_RADIUS); + priv->lead_user_timeout = g_timeout_add(LEAD_USER_PERIOD, lead_user_cb, priv); + priv->lead_user_timer = g_timer_new(); +} + +void ghid_cancel_lead_user(void) +{ + render_priv *priv = gport->render_priv; + + if (priv->lead_user_timeout) + g_source_remove(priv->lead_user_timeout); + + if (priv->lead_user_timer) + g_timer_destroy(priv->lead_user_timer); + + if (priv->lead_user) + ghid_invalidate_all(); + + priv->lead_user_timeout = 0; + priv->lead_user_timer = NULL; + priv->lead_user = false; +} Index: 1.0.8/src/hid/gtk/gtkhid-main.c =================================================================== --- 1.0.8/src/hid/gtk/gtkhid-main.c (nonexistent) +++ 1.0.8/src/hid/gtk/gtkhid-main.c (revision 1136) @@ -0,0 +1,1986 @@ +/* $Id$ */ + +#include "config.h" + +#include +#include +#ifdef HAVE_STRING_H +#include +#endif +#include +#include +#include + + +#include "action.h" +#include "crosshair.h" +#include "error.h" +#include "../hidint.h" +#include "gui.h" +#include "hid/common/hidnogui.h" +#include "hid/common/draw_helpers.h" +#include "pcb-printf.h" + + + +RCSID("$Id$"); + + +static void pan_common(GHidPort * port) +{ + int event_x, event_y; + + /* We need to fix up the PCB coordinates corresponding to the last + * event so convert it back to event coordinates temporarily. */ + ghid_pcb_to_event_coords(gport->pcb_x, gport->pcb_y, &event_x, &event_y); + + /* Don't pan so far the board is completely off the screen */ + port->view.x0 = MAX(-port->view.width, port->view.x0); + port->view.y0 = MAX(-port->view.height, port->view.y0); + port->view.x0 = MIN(port->view.x0, PCB->MaxWidth); + port->view.y0 = MIN(port->view.y0, PCB->MaxHeight); + + /* Fix up noted event coordinates to match where we clamped. Alternatively + * we could call ghid_note_event_location (NULL); to get a new pointer + * location, but this costs us an xserver round-trip (on X11 platforms) + */ + ghid_event_to_pcb_coords(event_x, event_y, &gport->pcb_x, &gport->pcb_y); + + ghidgui->adjustment_changed_holdoff = TRUE; + gtk_range_set_value(GTK_RANGE(ghidgui->h_range), gport->view.x0); + gtk_range_set_value(GTK_RANGE(ghidgui->v_range), gport->view.y0); + ghidgui->adjustment_changed_holdoff = FALSE; + + ghid_port_ranges_changed(); +} + +static void ghid_pan_view_abs(Coord pcb_x, Coord pcb_y, int widget_x, int widget_y) +{ + gport->view.x0 = SIDE_X(pcb_x) - widget_x * gport->view.coord_per_px; + gport->view.y0 = SIDE_Y(pcb_y) - widget_y * gport->view.coord_per_px; + + pan_common(gport); +} + +void ghid_pan_view_rel(Coord dx, Coord dy) +{ + gport->view.x0 += dx; + gport->view.y0 += dy; + + pan_common(gport); +} + + +/* gport->view.coord_per_px: + * zoom value is PCB units per screen pixel. Larger numbers mean zooming + * out - the largest value means you are looking at the whole board. + * + * gport->view_width and gport->view_height are in PCB coordinates + */ + +#define ALLOW_ZOOM_OUT_BY 10 /* Arbitrary, and same as the lesstif HID */ +static void ghid_zoom_view_abs(Coord center_x, Coord center_y, double new_zoom) +{ + double min_zoom, max_zoom; + double xtmp, ytmp; + + /* Limit the "minimum" zoom constant (maximum zoom), at 1 pixel per PCB + * unit, and set the "maximum" zoom constant (minimum zoom), such that + * the entire board just fits inside the viewport + */ + min_zoom = 1; + max_zoom = MAX(PCB->MaxWidth / gport->width, PCB->MaxHeight / gport->height) * ALLOW_ZOOM_OUT_BY; + new_zoom = MIN(MAX(min_zoom, new_zoom), max_zoom); + + if (gport->view.coord_per_px == new_zoom) + return; + + xtmp = (SIDE_X(center_x) - gport->view.x0) / (double) gport->view.width; + ytmp = (SIDE_Y(center_y) - gport->view.y0) / (double) gport->view.height; + + gport->view.coord_per_px = new_zoom; + pixel_slop = new_zoom; + ghid_port_ranges_scale(); + + gport->view.x0 = SIDE_X(center_x) - xtmp * gport->view.width; + gport->view.y0 = SIDE_Y(center_y) - ytmp * gport->view.height; + + pan_common(gport); + + ghid_set_status_line_label(); +} + +static void ghid_zoom_view_rel(Coord center_x, Coord center_y, double factor) +{ + ghid_zoom_view_abs(center_x, center_y, gport->view.coord_per_px * factor); +} + +static void ghid_zoom_view_fit(void) +{ + ghid_pan_view_abs(SIDE_X(0), SIDE_Y(0), 0, 0); + ghid_zoom_view_abs(SIDE_X(0), SIDE_Y(0), MAX(PCB->MaxWidth / gport->width, PCB->MaxHeight / gport->height)); +} + +static void ghid_flip_view(Coord center_x, Coord center_y, bool flip_x, bool flip_y) +{ + int widget_x, widget_y; + + /* Work out where on the screen the flip point is */ + ghid_pcb_to_event_coords(center_x, center_y, &widget_x, &widget_y); + + gport->view.flip_x = gport->view.flip_x != flip_x; + gport->view.flip_y = gport->view.flip_y != flip_y; + + /* Pan the board so the center location remains in the same place */ + ghid_pan_view_abs(center_x, center_y, widget_x, widget_y); + + ghid_invalidate_all(); +} + +/* ------------------------------------------------------------ */ + +static const char zoom_syntax[] = "Zoom()\n" "Zoom(factor)"; + + +static const char zoom_help[] = N_("Various zoom factor changes."); + +/* %start-doc actions Zoom +Changes the zoom (magnification) of the view of the board. If no +arguments are passed, the view is scaled such that the board just fits +inside the visible window (i.e. ``view all''). Otherwise, +@var{factor} specifies a change in zoom factor. It may be prefixed by +@code{+}, @code{-}, or @code{=} to change how the zoom factor is +modified. The @var{factor} is a floating point number, such as +@code{1.5} or @code{0.75}. + +@table @code + +@item +@var{factor} +Values greater than 1.0 cause the board to be drawn smaller; more of +the board will be visible. Values between 0.0 and 1.0 cause the board +to be drawn bigger; less of the board will be visible. + +@item -@var{factor} +Values greater than 1.0 cause the board to be drawn bigger; less of +the board will be visible. Values between 0.0 and 1.0 cause the board +to be drawn smaller; more of the board will be visible. + +@item =@var{factor} + +The @var{factor} is an absolute zoom factor; the unit for this value +is "PCB units per screen pixel". Since PCB units are 0.01 mil, a +@var{factor} of 1000 means 10 mils (0.01 in) per pixel, or 100 DPI, +about the actual resolution of most screens - resulting in an "actual +size" board. Similarly, a @var{factor} of 100 gives you a 10x actual +size. + +@end table + +Note that zoom factors of zero are silently ignored. + + + +%end-doc */ + +static int Zoom(int argc, char **argv, Coord x, Coord y) +{ + const char *vp; + double v; + + if (argc > 1) + AFAIL(zoom); + + if (argc < 1) { + ghid_zoom_view_fit(); + return 0; + } + + vp = argv[0]; + if (*vp == '+' || *vp == '-' || *vp == '=') + vp++; + v = g_ascii_strtod(vp, 0); + if (v <= 0) + return 1; + switch (argv[0][0]) { + case '-': + ghid_zoom_view_rel(x, y, 1 / v); + break; + default: + case '+': + ghid_zoom_view_rel(x, y, v); + break; + case '=': + ghid_zoom_view_abs(x, y, v); + break; + } + + return 0; +} + +/* ------------------------------------------------------------ */ + +void ghid_calibrate(double xval, double yval) +{ + printf(_("ghid_calibrate() -- not implemented\n")); +} + +static int ghid_gui_is_up = 0; + +void ghid_notify_gui_is_up() +{ + ghid_gui_is_up = 1; +} + +int ghid_shift_is_pressed() +{ + GdkModifierType mask; + GHidPort *out = &ghid_port; + + if (!ghid_gui_is_up) + return 0; + + gdk_window_get_pointer(gtk_widget_get_window(out->drawing_area), NULL, NULL, &mask); + return (mask & GDK_SHIFT_MASK) ? TRUE : FALSE; +} + +int ghid_control_is_pressed() +{ + GdkModifierType mask; + GHidPort *out = &ghid_port; + + if (!ghid_gui_is_up) + return 0; + + gdk_window_get_pointer(gtk_widget_get_window(out->drawing_area), NULL, NULL, &mask); + return (mask & GDK_CONTROL_MASK) ? TRUE : FALSE; +} + +int ghid_mod1_is_pressed() +{ + GdkModifierType mask; + GHidPort *out = &ghid_port; + + if (!ghid_gui_is_up) + return 0; + + gdk_window_get_pointer(gtk_widget_get_window(out->drawing_area), NULL, NULL, &mask); +#ifdef __APPLE__ + return (mask & (1 << 13)) ? TRUE : FALSE; /* The option key is not MOD1, although it should be... */ +#else + return (mask & GDK_MOD1_MASK) ? TRUE : FALSE; +#endif +} + +void ghid_set_crosshair(int x, int y, int action) +{ + GdkDisplay *display; + GdkScreen *screen; + int offset_x, offset_y; + int widget_x, widget_y; + int pointer_x, pointer_y; + Coord pcb_x, pcb_y; + + if (gport->crosshair_x != x || gport->crosshair_y != y) { + ghid_set_cursor_position_labels(); + gport->crosshair_x = x; + gport->crosshair_y = y; + + /* FIXME - does this trigger the idle_proc stuff? It is in the + * lesstif HID. Maybe something is needed here? + * + * need_idle_proc (); + */ + } + + if (action != HID_SC_PAN_VIEWPORT && action != HID_SC_WARP_POINTER) + return; + + /* Find out where the drawing area is on the screen. gdk_display_get_pointer + * and gdk_display_warp_pointer work relative to the whole display, whilst + * our coordinates are relative to the drawing area origin. + */ + gdk_window_get_origin(gtk_widget_get_window(gport->drawing_area), &offset_x, &offset_y); + display = gdk_display_get_default(); + + switch (action) { + case HID_SC_PAN_VIEWPORT: + /* Pan the board in the viewport so that the crosshair (who's location + * relative on the board was set above) lands where the pointer is. + * We pass the request to pan a particular point on the board to a + * given widget coordinate of the viewport into the rendering code + */ + + /* Find out where the pointer is relative to the display */ + gdk_display_get_pointer(display, NULL, &pointer_x, &pointer_y, NULL); + + widget_x = pointer_x - offset_x; + widget_y = pointer_y - offset_y; + + ghid_event_to_pcb_coords(widget_x, widget_y, &pcb_x, &pcb_y); + ghid_pan_view_abs(pcb_x, pcb_y, widget_x, widget_y); + + /* Just in case we couldn't pan the board the whole way, + * we warp the pointer to where the crosshair DID land. + */ + /* Fall through */ + + case HID_SC_WARP_POINTER: + screen = gdk_display_get_default_screen(display); + + ghid_pcb_to_event_coords(x, y, &widget_x, &widget_y); + + pointer_x = offset_x + widget_x; + pointer_y = offset_y + widget_y; + + gdk_display_warp_pointer(display, screen, pointer_x, pointer_y); + + break; + } +} + +typedef struct { + void (*func) (hidval); + guint id; + hidval user_data; +} GuiTimer; + + /* We need a wrapper around the hid timer because a gtk timer needs + | to return FALSE else the timer will be restarted. + */ +static gboolean ghid_timer(GuiTimer * timer) +{ + (*timer->func) (timer->user_data); + ghid_mode_cursor(Settings.Mode); + return FALSE; /* Turns timer off */ +} + +hidval ghid_add_timer(void (*func) (hidval user_data), unsigned long milliseconds, hidval user_data) +{ + GuiTimer *timer = g_new0(GuiTimer, 1); + hidval ret; + + timer->func = func; + timer->user_data = user_data; + timer->id = g_timeout_add(milliseconds, (GSourceFunc) ghid_timer, timer); + ret.ptr = (void *) timer; + return ret; +} + +void ghid_stop_timer(hidval timer) +{ + void *ptr = timer.ptr; + + g_source_remove(((GuiTimer *) ptr)->id); + g_free(ptr); +} + +typedef struct { + void (*func) (hidval, int, unsigned int, hidval); + hidval user_data; + int fd; + GIOChannel *channel; + gint id; +} GuiWatch; + + /* We need a wrapper around the hid file watch to pass the correct flags + */ +static gboolean ghid_watch(GIOChannel * source, GIOCondition condition, gpointer data) +{ + unsigned int pcb_condition = 0; + hidval x; + GuiWatch *watch = (GuiWatch *) data; + + if (condition & G_IO_IN) + pcb_condition |= PCB_WATCH_READABLE; + if (condition & G_IO_OUT) + pcb_condition |= PCB_WATCH_WRITABLE; + if (condition & G_IO_ERR) + pcb_condition |= PCB_WATCH_ERROR; + if (condition & G_IO_HUP) + pcb_condition |= PCB_WATCH_HANGUP; + + x.ptr = (void *) watch; + watch->func(x, watch->fd, pcb_condition, watch->user_data); + ghid_mode_cursor(Settings.Mode); + + return TRUE; /* Leave watch on */ +} + +hidval +ghid_watch_file(int fd, unsigned int condition, void (*func) (hidval watch, int fd, unsigned int condition, hidval user_data), + hidval user_data) +{ + GuiWatch *watch = g_new0(GuiWatch, 1); + hidval ret; + unsigned int glib_condition = 0; + + if (condition & PCB_WATCH_READABLE) + glib_condition |= G_IO_IN; + if (condition & PCB_WATCH_WRITABLE) + glib_condition |= G_IO_OUT; + if (condition & PCB_WATCH_ERROR) + glib_condition |= G_IO_ERR; + if (condition & PCB_WATCH_HANGUP) + glib_condition |= G_IO_HUP; + + watch->func = func; + watch->user_data = user_data; + watch->fd = fd; + watch->channel = g_io_channel_unix_new(fd); + watch->id = g_io_add_watch(watch->channel, (GIOCondition) glib_condition, ghid_watch, watch); + + ret.ptr = (void *) watch; + return ret; +} + +void ghid_unwatch_file(hidval data) +{ + GuiWatch *watch = (GuiWatch *) data.ptr; + + g_io_channel_shutdown(watch->channel, TRUE, NULL); + g_io_channel_unref(watch->channel); + g_free(watch); +} + +typedef struct { + GSource source; + void (*func) (hidval user_data); + hidval user_data; +} BlockHookSource; + +static gboolean ghid_block_hook_prepare(GSource * source, gint * timeout); +static gboolean ghid_block_hook_check(GSource * source); +static gboolean ghid_block_hook_dispatch(GSource * source, GSourceFunc callback, gpointer user_data); + +static GSourceFuncs ghid_block_hook_funcs = { + ghid_block_hook_prepare, + ghid_block_hook_check, + ghid_block_hook_dispatch, + NULL /* No destroy notification */ +}; + +static gboolean ghid_block_hook_prepare(GSource * source, gint * timeout) +{ + hidval data = ((BlockHookSource *) source)->user_data; + ((BlockHookSource *) source)->func(data); + return FALSE; +} + +static gboolean ghid_block_hook_check(GSource * source) +{ + return FALSE; +} + +static gboolean ghid_block_hook_dispatch(GSource * source, GSourceFunc callback, gpointer user_data) +{ + return FALSE; +} + +static hidval ghid_add_block_hook(void (*func) (hidval data), hidval user_data) +{ + hidval ret; + BlockHookSource *source; + + source = (BlockHookSource *) g_source_new(&ghid_block_hook_funcs, sizeof(BlockHookSource)); + + source->func = func; + source->user_data = user_data; + + g_source_attach((GSource *) source, NULL); + + ret.ptr = (void *) source; + return ret; +} + +static void ghid_stop_block_hook(hidval mlpoll) +{ + GSource *source = (GSource *) mlpoll.ptr; + g_source_destroy(source); +} + +int ghid_confirm_dialog(const char *msg, ...) +{ + int rv = 0; + va_list ap; + char *cancelmsg = NULL, *okmsg = NULL; + static gint x = -1, y = -1; + GtkWidget *dialog; + GHidPort *out = &ghid_port; + + va_start(ap, msg); + cancelmsg = va_arg(ap, char *); + okmsg = va_arg(ap, char *); + va_end(ap); + + if (!cancelmsg) { + cancelmsg = _("_Cancel"); + okmsg = _("_OK"); + } + + dialog = gtk_message_dialog_new(GTK_WINDOW(out->top_window), + (GtkDialogFlags) (GTK_DIALOG_MODAL | + GTK_DIALOG_DESTROY_WITH_PARENT), + GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, "%s", msg); + gtk_dialog_add_button(GTK_DIALOG(dialog), cancelmsg, GTK_RESPONSE_CANCEL); + if (okmsg) { + gtk_dialog_add_button(GTK_DIALOG(dialog), okmsg, GTK_RESPONSE_OK); + } + + if (x != -1) { + gtk_window_move(GTK_WINDOW(dialog), x, y); + } + + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) + rv = 1; + + gtk_window_get_position(GTK_WINDOW(dialog), &x, &y); + + gtk_widget_destroy(dialog); + return rv; +} + +int ghid_close_confirm_dialog() +{ + switch (ghid_dialog_close_confirm()) { + case GUI_DIALOG_CLOSE_CONFIRM_SAVE: + { + if (hid_actionl("Save", NULL)) { /* Save failed */ + return 0; /* Cancel */ + } + else { + return 1; /* Close */ + } + } + case GUI_DIALOG_CLOSE_CONFIRM_NOSAVE: + { + return 1; /* Close */ + } + case GUI_DIALOG_CLOSE_CONFIRM_CANCEL: + default: + { + return 0; /* Cancel */ + } + } +} + +void ghid_report_dialog(const char *title, const char *msg) +{ + ghid_dialog_report(title, msg); +} + +char *ghid_prompt_for(const char *msg, const char *default_string) +{ + char *rv; + + rv = ghid_dialog_input(msg, default_string); + return rv; +} + +/* FIXME -- implement a proper file select dialog */ +#ifdef FIXME +char *ghid_fileselect(const char *title, const char *descr, + char *default_file, char *default_ext, const char *history_tag, int flags) +{ + char *rv; + + rv = ghid_dialog_input(title, default_file); + return rv; +} +#endif + +void ghid_show_item(void *item) +{ + ghid_pinout_window_show(&ghid_port, (ElementTypePtr) item); +} + +void ghid_beep() +{ + gdk_beep(); +} + +struct progress_dialog { + GtkWidget *dialog; + GtkWidget *message; + GtkWidget *progress; + gint response_id; + GMainLoop *loop; + gboolean destroyed; + gboolean started; + GTimer *timer; + + gulong response_handler; + gulong destroy_handler; + gulong delete_handler; +}; + +static void run_response_handler(GtkDialog * dialog, gint response_id, gpointer data) +{ + struct progress_dialog *pd = data; + + pd->response_id = response_id; +} + +static gint run_delete_handler(GtkDialog * dialog, GdkEventAny * event, gpointer data) +{ + struct progress_dialog *pd = data; + + pd->response_id = GTK_RESPONSE_DELETE_EVENT; + + return TRUE; /* Do not destroy */ +} + +static void run_destroy_handler(GtkDialog * dialog, gpointer data) +{ + struct progress_dialog *pd = data; + + pd->destroyed = TRUE; +} + +static struct progress_dialog *make_progress_dialog(void) +{ + struct progress_dialog *pd; + GtkWidget *content_area; + GtkWidget *alignment; + GtkWidget *vbox; + + pd = g_new0(struct progress_dialog, 1); + pd->response_id = GTK_RESPONSE_NONE; + + pd->dialog = gtk_dialog_new_with_buttons(_("Progress"), GTK_WINDOW(gport->top_window), + /* Modal so nothing else can get events whilst + the main mainloop isn't running */ + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); + + gtk_window_set_deletable(GTK_WINDOW(pd->dialog), FALSE); + gtk_window_set_skip_pager_hint(GTK_WINDOW(pd->dialog), TRUE); + gtk_window_set_skip_taskbar_hint(GTK_WINDOW(pd->dialog), TRUE); + gtk_widget_set_size_request(pd->dialog, 300, -1); + + pd->message = gtk_label_new(NULL); + gtk_misc_set_alignment(GTK_MISC(pd->message), 0., 0.); + + pd->progress = gtk_progress_bar_new(); + gtk_widget_set_size_request(pd->progress, -1, 26); + + vbox = gtk_vbox_new(false, 0); + gtk_box_pack_start(GTK_BOX(vbox), pd->message, true, true, 8); + gtk_box_pack_start(GTK_BOX(vbox), pd->progress, false, true, 8); + + alignment = gtk_alignment_new(0., 0., 1., 1.); + gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 8, 8, 8, 8); + gtk_container_add(GTK_CONTAINER(alignment), vbox); + + content_area = gtk_dialog_get_content_area(GTK_DIALOG(pd->dialog)); + gtk_box_pack_start(GTK_BOX(content_area), alignment, true, true, 0); + + gtk_widget_show_all(alignment); + + g_object_ref(pd->dialog); + gtk_window_present(GTK_WINDOW(pd->dialog)); + + pd->response_handler = g_signal_connect(pd->dialog, "response", G_CALLBACK(run_response_handler), pd); + pd->delete_handler = g_signal_connect(pd->dialog, "delete-event", G_CALLBACK(run_delete_handler), pd); + pd->destroy_handler = g_signal_connect(pd->dialog, "destroy", G_CALLBACK(run_destroy_handler), pd); + + pd->loop = g_main_loop_new(NULL, FALSE); + pd->timer = g_timer_new(); + + return pd; +} + +static void destroy_progress_dialog(struct progress_dialog *pd) +{ + if (pd == NULL) + return; + + if (!pd->destroyed) { + g_signal_handler_disconnect(pd->dialog, pd->response_handler); + g_signal_handler_disconnect(pd->dialog, pd->delete_handler); + g_signal_handler_disconnect(pd->dialog, pd->destroy_handler); + } + + g_timer_destroy(pd->timer); + g_object_unref(pd->dialog); + g_main_loop_unref(pd->loop); + + gtk_widget_destroy(pd->dialog); + + pd->loop = NULL; + g_free(pd); +} + +static void handle_progress_dialog_events(struct progress_dialog *pd) +{ + GMainContext *context = g_main_loop_get_context(pd->loop); + + /* Process events */ + while (g_main_context_pending(context)) { + g_main_context_iteration(context, FALSE); + } +} + +#define MIN_TIME_SEPARATION (50./1000.) /* 50ms */ +static int ghid_progress(int so_far, int total, const char *message) +{ + static struct progress_dialog *pd = NULL; + + /* If we are finished, destroy any dialog */ + if (so_far == 0 && total == 0 && message == NULL) { + destroy_progress_dialog(pd); + pd = NULL; + return 0; + } + + if (pd == NULL) + pd = make_progress_dialog(); + + /* We don't want to keep the underlying process too busy whilst we + * process events. If we get called quickly after the last progress + * update, wait a little bit before we respond - perhaps the next + * time progress is reported. + + * The exception here is that we always want to process the first + * batch of events after having shown the dialog for the first time + */ + if (pd->started && g_timer_elapsed(pd->timer, NULL) < MIN_TIME_SEPARATION) + return 0; + + gtk_label_set_text(GTK_LABEL(pd->message), message); + gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pd->progress), (double) so_far / (double) total); + + handle_progress_dialog_events(pd); + g_timer_start(pd->timer); + + pd->started = TRUE; + + return (pd->response_id == GTK_RESPONSE_CANCEL || pd->response_id == GTK_RESPONSE_DELETE_EVENT) ? 1 : 0; +} + +/* ---------------------------------------------------------------------- */ + + +typedef struct { + GtkWidget *del; + GtkWidget *w_name; + GtkWidget *w_value; +} AttrRow; + +static AttrRow *attr_row = 0; +static int attr_num_rows = 0; +static int attr_max_rows = 0; +static AttributeListType *attributes_list; +static GtkWidget *attributes_dialog, *attr_table; + +static void attributes_delete_callback(GtkWidget * w, void *v); + +#define GA_RESPONSE_REVERT 1 +#define GA_RESPONSE_NEW 2 + +static void ghid_attr_set_table_size() +{ + gtk_table_resize(GTK_TABLE(attr_table), attr_num_rows > 0 ? attr_num_rows : 1, 3); +} + +static void ghid_attributes_need_rows(int new_max) +{ + if (attr_max_rows < new_max) { + if (attr_row) + attr_row = (AttrRow *) realloc(attr_row, new_max * sizeof(AttrRow)); + else + attr_row = (AttrRow *) malloc(new_max * sizeof(AttrRow)); + } + while (attr_max_rows < new_max) { + /* add [attr_max_rows] */ + attr_row[attr_max_rows].del = gtk_button_new_with_label("del"); + gtk_table_attach(GTK_TABLE(attr_table), attr_row[attr_max_rows].del, + 0, 1, attr_max_rows, attr_max_rows + 1, (GtkAttachOptions) (GTK_FILL | GTK_EXPAND), GTK_FILL, 0, 0); + g_signal_connect(G_OBJECT(attr_row[attr_max_rows].del), "clicked", + G_CALLBACK(attributes_delete_callback), GINT_TO_POINTER(attr_max_rows)); + + attr_row[attr_max_rows].w_name = gtk_entry_new(); + gtk_table_attach(GTK_TABLE(attr_table), attr_row[attr_max_rows].w_name, + 1, 2, attr_max_rows, attr_max_rows + 1, (GtkAttachOptions) (GTK_FILL | GTK_EXPAND), GTK_FILL, 0, 0); + + attr_row[attr_max_rows].w_value = gtk_entry_new(); + gtk_table_attach(GTK_TABLE(attr_table), attr_row[attr_max_rows].w_value, + 2, 3, attr_max_rows, attr_max_rows + 1, (GtkAttachOptions) (GTK_FILL | GTK_EXPAND), GTK_FILL, 0, 0); + + attr_max_rows++; + } + + /* Manage any previously unused rows we now need to show. */ + while (attr_num_rows < new_max) { + /* manage attr_num_rows */ + gtk_widget_show(attr_row[attr_num_rows].del); + gtk_widget_show(attr_row[attr_num_rows].w_name); + gtk_widget_show(attr_row[attr_num_rows].w_value); + attr_num_rows++; + } +} + +static void ghid_attributes_revert() +{ + int i; + + ghid_attributes_need_rows(attributes_list->Number); + + /* Unmanage any previously used rows we don't need. */ + while (attr_num_rows > attributes_list->Number) { + attr_num_rows--; + gtk_widget_hide(attr_row[attr_num_rows].del); + gtk_widget_hide(attr_row[attr_num_rows].w_name); + gtk_widget_hide(attr_row[attr_num_rows].w_value); + } + + /* Fill in values */ + for (i = 0; i < attributes_list->Number; i++) { + /* create row [i] */ + gtk_entry_set_text(GTK_ENTRY(attr_row[i].w_name), attributes_list->List[i].name); + gtk_entry_set_text(GTK_ENTRY(attr_row[i].w_value), attributes_list->List[i].value); +#if 0 +#endif + } + ghid_attr_set_table_size(); +} + +static void attributes_delete_callback(GtkWidget * w, void *v) +{ + int i, n; + + n = GPOINTER_TO_INT(v); + + for (i = n; i < attr_num_rows - 1; i++) { + gtk_entry_set_text(GTK_ENTRY(attr_row[i].w_name), gtk_entry_get_text(GTK_ENTRY(attr_row[i + 1].w_name))); + gtk_entry_set_text(GTK_ENTRY(attr_row[i].w_value), gtk_entry_get_text(GTK_ENTRY(attr_row[i + 1].w_value))); + } + attr_num_rows--; + + gtk_widget_hide(attr_row[attr_num_rows].del); + gtk_widget_hide(attr_row[attr_num_rows].w_name); + gtk_widget_hide(attr_row[attr_num_rows].w_value); + + ghid_attr_set_table_size(); +} + +static void ghid_attributes(char *owner, AttributeListType * attrs) +{ + GtkWidget *content_area; + int response; + + attributes_list = attrs; + + attr_max_rows = 0; + attr_num_rows = 0; + + attributes_dialog = gtk_dialog_new_with_buttons(owner, + GTK_WINDOW(ghid_port.top_window), + GTK_DIALOG_MODAL, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + "Revert", GA_RESPONSE_REVERT, + "New", GA_RESPONSE_NEW, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); + + attr_table = gtk_table_new(attrs->Number, 3, 0); + + content_area = gtk_dialog_get_content_area(GTK_DIALOG(attributes_dialog)); + gtk_box_pack_start(GTK_BOX(content_area), attr_table, FALSE, FALSE, 0); + + gtk_widget_show(attr_table); + + ghid_attributes_revert(); + + while (1) { + response = gtk_dialog_run(GTK_DIALOG(attributes_dialog)); + + if (response == GTK_RESPONSE_CANCEL) + break; + + if (response == GTK_RESPONSE_OK) { + int i; + /* Copy the values back */ + for (i = 0; i < attributes_list->Number; i++) { + if (attributes_list->List[i].name) + free(attributes_list->List[i].name); + if (attributes_list->List[i].value) + free(attributes_list->List[i].value); + } + if (attributes_list->Max < attr_num_rows) { + int sz = attr_num_rows * sizeof(AttributeType); + if (attributes_list->List == NULL) + attributes_list->List = (AttributeType *) malloc(sz); + else + attributes_list->List = (AttributeType *) realloc(attributes_list->List, sz); + attributes_list->Max = attr_num_rows; + } + for (i = 0; i < attr_num_rows; i++) { + attributes_list->List[i].name = strdup(gtk_entry_get_text(GTK_ENTRY(attr_row[i].w_name))); + attributes_list->List[i].value = strdup(gtk_entry_get_text(GTK_ENTRY(attr_row[i].w_value))); + attributes_list->Number = attr_num_rows; + } + + break; + } + + if (response == GA_RESPONSE_REVERT) { + /* Revert */ + ghid_attributes_revert(); + } + + if (response == GA_RESPONSE_NEW) { + ghid_attributes_need_rows(attr_num_rows + 1); /* also bumps attr_num_rows */ + + gtk_entry_set_text(GTK_ENTRY(attr_row[attr_num_rows - 1].w_name), ""); + gtk_entry_set_text(GTK_ENTRY(attr_row[attr_num_rows - 1].w_value), ""); + + ghid_attr_set_table_size(); + } + } + + gtk_widget_destroy(attributes_dialog); + free(attr_row); + attr_row = NULL; +} + +/* ---------------------------------------------------------------------- */ + +HID_DRC_GUI ghid_drc_gui = { + 1, /* log_drc_overview */ + 0, /* log_drc_details */ + ghid_drc_window_reset_message, + ghid_drc_window_append_violation, + ghid_drc_window_throw_dialog, +}; + +extern HID_Attribute *ghid_get_export_options(int *); + + +/* ------------------------------------------------------------ + * + * Actions specific to the GTK HID follow from here + * + */ + + +/* ------------------------------------------------------------ */ +static const char about_syntax[] = "About()"; + +static const char about_help[] = N_("Tell the user about this version of PCB."); + +/* %start-doc actions About + +This just pops up a dialog telling the user which version of +@code{pcb} they're running. + +%end-doc */ + + +static int About(int argc, char **argv, Coord x, Coord y) +{ + ghid_dialog_about(); + return 0; +} + +/* ------------------------------------------------------------ */ +static const char getxy_syntax[] = "GetXY()"; + +static const char getxy_help[] = N_("Get a coordinate."); + +/* %start-doc actions GetXY + +Prompts the user for a coordinate, if one is not already selected. + +%end-doc */ + +static int GetXY(int argc, char **argv, Coord x, Coord y) +{ + return 0; +} + +/* ---------------------------------------------------------------------- */ + +static int PointCursor(int argc, char **argv, Coord x, Coord y) +{ + if (!ghidgui) + return 0; + + if (argc > 0) + ghid_point_cursor(); + else + ghid_mode_cursor(Settings.Mode); + return 0; +} + +/* ---------------------------------------------------------------------- */ + +static int RouteStylesChanged(int argc, char **argv, Coord x, Coord y) +{ + if (!ghidgui || !ghidgui->route_style_selector) + return 0; + + ghid_route_style_selector_sync + (GHID_ROUTE_STYLE_SELECTOR(ghidgui->route_style_selector), + Settings.LineThickness, Settings.ViaDrillingHole, Settings.ViaThickness, Settings.Keepaway); + + return 0; +} + +/* ---------------------------------------------------------------------- */ + +int PCBChanged(int argc, char **argv, Coord x, Coord y) +{ + if (!ghidgui) + return 0; + + if (PCB != NULL) + ghid_window_set_name_label(PCB->Name); + + if (!gport->pixmap) + return 0; + + if (ghidgui->route_style_selector) { + ghid_route_style_selector_empty(GHID_ROUTE_STYLE_SELECTOR(ghidgui->route_style_selector)); + make_route_style_buttons(GHID_ROUTE_STYLE_SELECTOR(ghidgui->route_style_selector)); + } + RouteStylesChanged(0, NULL, 0, 0); + + ghid_port_ranges_scale(); + ghid_zoom_view_fit(); + ghid_sync_with_new_layout(); + return 0; +} + +/* ---------------------------------------------------------------------- */ + +static int LayerGroupsChanged(int argc, char **argv, Coord x, Coord y) +{ + printf(_("LayerGroupsChanged -- not implemented\n")); + return 0; +} + +/* ---------------------------------------------------------------------- */ + +static int LibraryChanged(int argc, char **argv, Coord x, Coord y) +{ + /* No need to show the library window every time it changes... + * ghid_library_window_show (&ghid_port, FALSE); + */ + return 0; +} + +/* ---------------------------------------------------------------------- */ + +static int Command(int argc, char **argv, Coord x, Coord y) +{ + ghid_handle_user_command(TRUE); + return 0; +} + +/* ---------------------------------------------------------------------- */ + +static int Load(int argc, char **argv, Coord x, Coord y) +{ + char *function; + char *name = NULL; + + static gchar *current_element_dir = NULL; + static gchar *current_layout_dir = NULL; + static gchar *current_netlist_dir = NULL; + + if (!current_element_dir) + current_element_dir = get_current_dir_name(); + if (!current_layout_dir) + current_layout_dir = get_current_dir_name(); + if (!current_netlist_dir) + current_netlist_dir = get_current_dir_name(); + + /* we've been given the file name */ + if (argc > 1) + return hid_actionv("LoadFrom", argc, argv); + + function = argc ? argv[0] : (char *) "Layout"; + + if (strcasecmp(function, "Netlist") == 0) { + name = ghid_dialog_file_select_open(_("Load netlist file"), ¤t_netlist_dir, Settings.FilePath); + } + else if (strcasecmp(function, "ElementToBuffer") == 0) { + name = ghid_dialog_file_select_open(_("Load element to buffer"), ¤t_element_dir, Settings.LibrarySearchPaths); + } + else if (strcasecmp(function, "LayoutToBuffer") == 0) { + name = ghid_dialog_file_select_open(_("Load layout file to buffer"), ¤t_layout_dir, Settings.FilePath); + } + else if (strcasecmp(function, "Layout") == 0) { + name = ghid_dialog_file_select_open(_("Load layout file"), ¤t_layout_dir, Settings.FilePath); + } + + if (name) { + if (Settings.verbose) + fprintf(stderr, "%s: Calling LoadFrom(%s, %s)\n", __FUNCTION__, function, name); + hid_actionl("LoadFrom", function, name, NULL); + g_free(name); + } + + return 0; +} + + +/* ---------------------------------------------------------------------- */ +static const char save_syntax[] = + "Save()\n" "Save(Layout|LayoutAs)\n" "Save(AllConnections|AllUnusedPins|ElementConnections)\n" "Save(PasteBuffer)"; + +static const char save_help[] = N_("Save layout and/or element data to a user-selected file."); + +/* %start-doc actions Save + +This action is a GUI front-end to the core's @code{SaveTo} action +(@pxref{SaveTo Action}). If you happen to pass a filename, like +@code{SaveTo}, then @code{SaveTo} is called directly. Else, the +user is prompted for a filename to save, and then @code{SaveTo} is +called with that filename. + +%end-doc */ + +static int Save(int argc, char **argv, Coord x, Coord y) +{ + char *function; + char *name; + char *prompt; + + static gchar *current_dir = NULL; + + if (!current_dir) + current_dir = get_current_dir_name(); + + if (argc > 1) + return hid_actionv("SaveTo", argc, argv); + + function = argc ? argv[0] : (char *) "Layout"; + + if (strcasecmp(function, "Layout") == 0) + if (PCB->Filename) + return hid_actionl("SaveTo", "Layout", PCB->Filename, NULL); + + if (strcasecmp(function, "PasteBuffer") == 0) + prompt = _("Save element as"); + else + prompt = _("Save layout as"); + + name = ghid_dialog_file_select_save(prompt, ¤t_dir, PCB->Filename, Settings.FilePath); + + if (name) { + if (Settings.verbose) + fprintf(stderr, "%s: Calling SaveTo(%s, %s)\n", __FUNCTION__, function, name); + + if (strcasecmp(function, "PasteBuffer") == 0) + hid_actionl("PasteBuffer", "Save", name, NULL); + else { + /* + * if we got this far and the function is Layout, then + * we really needed it to be a LayoutAs. Otherwise + * ActionSaveTo() will ignore the new file name we + * just obtained. + */ + if (strcasecmp(function, "Layout") == 0) + hid_actionl("SaveTo", "LayoutAs", name, NULL); + else + hid_actionl("SaveTo", function, name, NULL); + } + g_free(name); + } + else { + return 1; + } + + return 0; +} + +/* ---------------------------------------------------------------------- */ +static const char swapsides_syntax[] = "SwapSides(|v|h|r)"; + +static const char swapsides_help[] = N_("Swaps the side of the board you're looking at."); + +/* %start-doc actions SwapSides + +This action changes the way you view the board. + +@table @code + +@item v +Flips the board over vertically (up/down). + +@item h +Flips the board over horizontally (left/right), like flipping pages in +a book. + +@item r +Rotates the board 180 degrees without changing sides. + +@end table + +If no argument is given, the board isn't moved but the opposite side +is shown. + +Normally, this action changes which pads and silk layer are drawn as +true silk, and which are drawn as the "invisible" layer. It also +determines which solder mask you see. + +As a special case, if the layer group for the side you're looking at +is visible and currently active, and the layer group for the opposite +is not visible (i.e. disabled), then this action will also swap which +layer group is visible and active, effectively swapping the ``working +side'' of the board. + +%end-doc */ + + +static int SwapSides(int argc, char **argv, Coord x, Coord y) +{ + int active_group = GetLayerGroupNumberByNumber(LayerStack[0]); + int comp_group = GetLayerGroupNumberByNumber(component_silk_layer); + int solder_group = GetLayerGroupNumberByNumber(solder_silk_layer); + bool comp_on = LAYER_PTR(PCB->LayerGroups.Entries[comp_group][0])->On; + bool solder_on = LAYER_PTR(PCB->LayerGroups.Entries[solder_group][0])->On; + + if (argc > 0) { + switch (argv[0][0]) { + case 'h': + case 'H': + ghid_flip_view(gport->pcb_x, gport->pcb_y, true, false); + break; + case 'v': + case 'V': + ghid_flip_view(gport->pcb_x, gport->pcb_y, false, true); + break; + case 'r': + case 'R': + ghid_flip_view(gport->pcb_x, gport->pcb_y, true, true); + Settings.ShowSolderSide = !Settings.ShowSolderSide; /* Swapped back below */ + break; + default: + return 1; + } + } + + Settings.ShowSolderSide = !Settings.ShowSolderSide; + + if ((active_group == comp_group && comp_on && !solder_on) || (active_group == solder_group && solder_on && !comp_on)) { + bool new_solder_vis = Settings.ShowSolderSide; + + ChangeGroupVisibility(PCB->LayerGroups.Entries[comp_group][0], !new_solder_vis, !new_solder_vis); + ChangeGroupVisibility(PCB->LayerGroups.Entries[solder_group][0], new_solder_vis, new_solder_vis); + } + + return 0; +} + +/* ------------------------------------------------------------ */ + +static const char print_syntax[] = "Print()"; + +static const char print_help[] = N_("Print the layout."); + +/* %start-doc actions Print + +This will find the default printing HID, prompt the user for its +options, and print the layout. + +%end-doc */ + +static int Print(int argc, char **argv, Coord x, Coord y) +{ + HID **hids; + int i; + HID *printer = NULL; + + hids = hid_enumerate(); + for (i = 0; hids[i]; i++) { + if (hids[i]->printer) + printer = hids[i]; + } + + if (printer == NULL) { + gui->log(_("Can't find a suitable printer HID")); + return -1; + } + + /* check if layout is empty */ + if (!IsDataEmpty(PCB->Data)) { + ghid_dialog_print(printer); + } + else + gui->log(_("Can't print empty layout")); + + return 0; +} + + +/* ------------------------------------------------------------ */ + +static HID_Attribute printer_calibrate_attrs[] = { + {N_("Enter Values here:"), "", + HID_Label, 0, 0, {0, 0, 0}, 0, 0}, + {N_("x-calibration"), N_("X scale for calibrating your printer"), + HID_Real, 0.5, 25, {0, 0, 1.00}, 0, 0}, + {N_("y-calibration"), N_("Y scale for calibrating your printer"), + HID_Real, 0.5, 25, {0, 0, 1.00}, 0, 0} +}; + +static HID_Attr_Val printer_calibrate_values[3]; + +static const char printcalibrate_syntax[] = "PrintCalibrate()"; + +static const char printcalibrate_help[] = N_("Calibrate the printer."); + +/* %start-doc actions PrintCalibrate + +This will print a calibration page, which you would measure and type +the measurements in, so that future printouts will be more precise. + +%end-doc */ + +static int PrintCalibrate(int argc, char **argv, Coord x, Coord y) +{ + HID *printer = hid_find_printer(); + printer->calibrate(0.0, 0.0); + + if (gui->attribute_dialog(printer_calibrate_attrs, 3, + printer_calibrate_values, + _("Printer Calibration Values"), _("Enter calibration values for your printer"))) + return 1; + printer->calibrate(printer_calibrate_values[1].real_value, printer_calibrate_values[2].real_value); + return 0; +} + +/* ------------------------------------------------------------ */ + +static int Export(int argc, char **argv, Coord x, Coord y) +{ + + /* check if layout is empty */ + if (!IsDataEmpty(PCB->Data)) { + ghid_dialog_export(); + } + else + gui->log(_("Can't export empty layout")); + + return 0; +} + +/* ------------------------------------------------------------ */ + +static int Benchmark(int argc, char **argv, Coord x, Coord y) +{ + int i = 0; + time_t start, end; + GdkDisplay *display; + + display = gdk_drawable_get_display(gport->drawable); + + gdk_display_sync(display); + time(&start); + do { + ghid_invalidate_all(); + gdk_window_process_updates(gtk_widget_get_window(gport->drawing_area), FALSE); + time(&end); + i++; + } + while (end - start < 10); + + printf(_("%g redraws per second\n"), i / 10.0); + + return 0; +} + +/* ------------------------------------------------------------ */ + +static const char center_syntax[] = "Center()\n"; + +static const char center_help[] = N_("Moves the pointer to the center of the window."); + +/* %start-doc actions Center + +Move the pointer to the center of the window, but only if it's +currently within the window already. + +%end-doc */ + +static int Center(int argc, char **argv, Coord pcb_x, Coord pcb_y) +{ + GdkDisplay *display; + GdkScreen *screen; + int offset_x, offset_y; + int widget_x, widget_y; + int pointer_x, pointer_y; + + if (argc != 0) + AFAIL(center); + + /* Aim to put the given x, y PCB coordinates in the center of the widget */ + widget_x = gport->width / 2; + widget_y = gport->height / 2; + + ghid_pan_view_abs(pcb_x, pcb_y, widget_x, widget_y); + + /* Now move the mouse pointer to the place where the board location + * actually ended up. + * + * XXX: Should only do this if we confirm we are inside our window? + */ + + ghid_pcb_to_event_coords(pcb_x, pcb_y, &widget_x, &widget_y); + gdk_window_get_origin(gtk_widget_get_window(gport->drawing_area), &offset_x, &offset_y); + + pointer_x = offset_x + widget_x; + pointer_y = offset_y + widget_y; + + display = gdk_display_get_default(); + screen = gdk_display_get_default_screen(display); + gdk_display_warp_pointer(display, screen, pointer_x, pointer_y); + + return 0; +} + +/* ------------------------------------------------------------ */ +static const char cursor_syntax[] = "Cursor(Type,DeltaUp,DeltaRight,Units)"; + +static const char cursor_help[] = N_("Move the cursor."); + +/* %start-doc actions Cursor + +This action moves the mouse cursor. Unlike other actions which take +coordinates, this action's coordinates are always relative to the +user's view of the board. Thus, a positive @var{DeltaUp} may move the +cursor towards the board origin if the board is inverted. + +Type is one of @samp{Pan} or @samp{Warp}. @samp{Pan} causes the +viewport to move such that the crosshair is under the mouse cursor. +@samp{Warp} causes the mouse cursor to move to be above the crosshair. + +@var{Units} can be one of the following: + +@table @samp + +@item mil +@itemx mm +The cursor is moved by that amount, in board units. + +@item grid +The cursor is moved by that many grid points. + +@item view +The values are percentages of the viewport's view. Thus, a pan of +@samp{100} would scroll the viewport by exactly the width of the +current view. + +@item board +The values are percentages of the board size. Thus, a move of +@samp{50,50} moves you halfway across the board. + +@end table + +%end-doc */ + +static int CursorAction(int argc, char **argv, Coord x, Coord y) +{ + UnitList extra_units_x = { + {"grid", PCB->Grid, 0}, + {"view", gport->view.width, UNIT_PERCENT}, + {"board", PCB->MaxWidth, UNIT_PERCENT}, + {"", 0, 0} + }; + UnitList extra_units_y = { + {"grid", PCB->Grid, 0}, + {"view", gport->view.height, UNIT_PERCENT}, + {"board", PCB->MaxHeight, UNIT_PERCENT}, + {"", 0, 0} + }; + int pan_warp = HID_SC_DO_NOTHING; + double dx, dy; + + if (argc != 4) + AFAIL(cursor); + + if (strcasecmp(argv[0], "pan") == 0) + pan_warp = HID_SC_PAN_VIEWPORT; + else if (strcasecmp(argv[0], "warp") == 0) + pan_warp = HID_SC_WARP_POINTER; + else + AFAIL(cursor); + + dx = GetValueEx(argv[1], argv[3], NULL, extra_units_x, ""); + if (gport->view.flip_x) + dx = -dx; + dy = GetValueEx(argv[2], argv[3], NULL, extra_units_y, ""); + if (!gport->view.flip_y) + dy = -dy; + + EventMoveCrosshair(Crosshair.X + dx, Crosshair.Y + dy); + gui->set_crosshair(Crosshair.X, Crosshair.Y, pan_warp); + + return 0; +} + +/* ------------------------------------------------------------ */ + +static const char dowindows_syntax[] = "DoWindows(1|2|3|4|5|6)\n" "DoWindows(Layout|Library|Log|Netlist|Preferences|DRC)"; + +static const char dowindows_help[] = N_("Open various GUI windows."); + +/* %start-doc actions DoWindows + +@table @code + +@item 1 +@itemx Layout +Open the layout window. Since the layout window is always shown +anyway, this has no effect. + +@item 2 +@itemx Library +Open the library window. + +@item 3 +@itemx Log +Open the log window. + +@item 4 +@itemx Netlist +Open the netlist window. + +@item 5 +@itemx Preferences +Open the preferences window. + +@item 6 +@itemx DRC +Open the DRC violations window. + +@end table + +%end-doc */ + +static int DoWindows(int argc, char **argv, Coord x, Coord y) +{ + char *a = argc == 1 ? argv[0] : (char *) ""; + + if (strcmp(a, "1") == 0 || strcasecmp(a, "Layout") == 0) { + } + else if (strcmp(a, "2") == 0 || strcasecmp(a, "Library") == 0) { + ghid_library_window_show(gport, TRUE); + } + else if (strcmp(a, "3") == 0 || strcasecmp(a, "Log") == 0) { + ghid_log_window_show(TRUE); + } + else if (strcmp(a, "4") == 0 || strcasecmp(a, "Netlist") == 0) { + ghid_netlist_window_show(gport, TRUE); + } + else if (strcmp(a, "5") == 0 || strcasecmp(a, "Preferences") == 0) { + ghid_config_window_show(); + } + else if (strcmp(a, "6") == 0 || strcasecmp(a, "DRC") == 0) { + ghid_drc_window_show(TRUE); + } + else { + AFAIL(dowindows); + } + + return 0; +} + +/* ------------------------------------------------------------ */ +static const char setunits_syntax[] = "SetUnits(mm|mil)"; + +static const char setunits_help[] = N_("Set the default measurement units."); + +/* %start-doc actions SetUnits + +@table @code + +@item mil +Sets the display units to mils (1/1000 inch). + +@item mm +Sets the display units to millimeters. + +@end table + +%end-doc */ + +static int SetUnits(int argc, char **argv, Coord x, Coord y) +{ + const Unit *new_unit; + if (argc == 0) + return 0; + + new_unit = get_unit_struct(argv[0]); + if (new_unit != NULL && new_unit->allow != NO_PRINT) { + Settings.grid_unit = new_unit; + Settings.increments = get_increments_struct(Settings.grid_unit->suffix); + AttributePut(PCB, "PCB::grid::unit", argv[0]); + } + + ghid_config_handle_units_changed(); + + ghid_set_status_line_label(); + + /* FIXME ? + * lesstif_sizes_reset (); + * lesstif_styles_update_values (); + */ + return 0; +} + +/* ------------------------------------------------------------ */ +static const char scroll_syntax[] = "Scroll(up|down|left|right, [div])"; + +static const char scroll_help[] = N_("Scroll the viewport."); + +/* % start-doc actions Scroll + +@item up|down|left|right +Specifies the direction to scroll + +@item div +Optional. Specifies how much to scroll by. The viewport is scrolled +by 1/div of what is visible, so div = 1 scrolls a whole page. If not +default is given, div=40. + +%end-doc */ + +static int ScrollAction(int argc, char **argv, Coord x, Coord y) +{ + gdouble dx = 0.0, dy = 0.0; + int div = 40; + + if (!ghidgui) + return 0; + + if (argc != 1 && argc != 2) + AFAIL(scroll); + + if (argc == 2) + div = atoi(argv[1]); + + if (strcasecmp(argv[0], "up") == 0) + dy = -gport->view.height / div; + else if (strcasecmp(argv[0], "down") == 0) + dy = gport->view.height / div; + else if (strcasecmp(argv[0], "right") == 0) + dx = gport->view.width / div; + else if (strcasecmp(argv[0], "left") == 0) + dx = -gport->view.width / div; + else + AFAIL(scroll); + + ghid_pan_view_rel(dx, dy); + + return 0; +} + +/* ------------------------------------------------------------ */ +static const char pan_syntax[] = "Pan([thumb], Mode)"; + +static const char pan_help[] = +N_("Start or stop panning (Mode = 1 to start, 0 to stop)\n" "Optional thumb argument is ignored for now in gtk hid.\n"); + +/* %start-doc actions Pan + +Start or stop panning. To start call with Mode = 1, to stop call with +Mode = 0. + +%end-doc */ + +static int PanAction(int argc, char **argv, Coord x, Coord y) +{ + int mode; + + if (!ghidgui) + return 0; + + if (argc != 1 && argc != 2) + AFAIL(pan); + + if (argc == 1) + mode = atoi(argv[0]); + else { + mode = atoi(argv[1]); + Message(_("The gtk gui currently ignores the optional first argument " + "to the Pan action.\nFeel free to provide patches.\n")); + } + + gport->panning = mode; + + return 0; +} + +/* ------------------------------------------------------------ */ +static const char popup_syntax[] = "Popup(MenuName, [Button])"; + +static const char popup_help[] = +N_("Bring up the popup menu specified by @code{MenuName}.\n" + "If called by a mouse event then the mouse button number\n" "must be specified as the optional second argument."); + +/* %start-doc actions Popup + +This just pops up the specified menu. The menu must have been defined +as a named subresource of the Popups resource in the menu resource +file. + +%end-doc */ + + +static int Popup(int argc, char **argv, Coord x, Coord y) +{ + GtkMenu *menu; + + if (argc != 1 && argc != 2) + AFAIL(popup); + + menu = ghid_main_menu_get_popup(GHID_MAIN_MENU(ghidgui->menu_bar), argv[0]); + if (!GTK_IS_MENU(menu)) { + Message(_("The specified popup menu \"%s\" has not been defined.\n"), argv[0]); + return 1; + } + else { + ghidgui->in_popup = TRUE; + gtk_widget_grab_focus(ghid_port.drawing_area); + gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time()); + } + return 0; +} + +/* ------------------------------------------------------------ */ +static const char importgui_syntax[] = "ImportGUI()"; + +static const char importgui_help[] = N_("Asks user which schematics to import into PCB.\n"); + +/* %start-doc actions ImportGUI + +Asks user which schematics to import into PCB. + +%end-doc */ + + +static int ImportGUI(int argc, char **argv, Coord x, Coord y) +{ + char *name = NULL; + static gchar *current_layout_dir = NULL; + static int I_am_recursing = 0; + int rv; + + if (!current_layout_dir) + current_layout_dir = get_current_dir_name(); + + if (I_am_recursing) + return 1; + + + name = ghid_dialog_file_select_open(_("Load schematics"), ¤t_layout_dir, Settings.FilePath); + +#ifdef DEBUG + printf("File selected = %s\n", name); +#endif + + AttributePut(PCB, "import::src0", name); + free(name); + + I_am_recursing = 1; + rv = hid_action("Import"); + I_am_recursing = 0; + + return rv; +} + +/* ------------------------------------------------------------ */ +static int Busy(int argc, char **argv, Coord x, Coord y) +{ + ghid_watch_cursor(); + return 0; +} + +HID_Action ghid_main_action_list[] = { + {"About", 0, About, about_help, about_syntax} + , + {"Benchmark", 0, Benchmark} + , + {"Busy", 0, Busy} + , + {"Center", N_("Click on a location to center"), Center, center_help, center_syntax} + , + {"Command", 0, Command} + , + {"Cursor", 0, CursorAction, cursor_help, cursor_syntax} + , + {"DoWindows", 0, DoWindows, dowindows_help, dowindows_syntax} + , + {"Export", 0, Export} + , + {"GetXY", "", GetXY, getxy_help, getxy_syntax} + , + {"ImportGUI", 0, ImportGUI, importgui_help, importgui_syntax} + , + {"LayerGroupsChanged", 0, LayerGroupsChanged} + , + {"LibraryChanged", 0, LibraryChanged} + , + {"Load", 0, Load} + , + {"Pan", 0, PanAction, pan_help, pan_syntax} + , + {"PCBChanged", 0, PCBChanged} + , + {"PointCursor", 0, PointCursor} + , + {"Popup", 0, Popup, popup_help, popup_syntax} + , + {"Print", 0, Print, + print_help, print_syntax} + , + {"PrintCalibrate", 0, PrintCalibrate, + printcalibrate_help, printcalibrate_syntax} + , + {"RouteStylesChanged", 0, RouteStylesChanged} + , + {"Save", 0, Save, save_help, save_syntax} + , + {"Scroll", N_("Click on a place to scroll"), ScrollAction, scroll_help, scroll_syntax} + , + {"SetUnits", 0, SetUnits, setunits_help, setunits_syntax} + , + {"SwapSides", 0, SwapSides, swapsides_help, swapsides_syntax} + , + {"Zoom", N_("Click on zoom focus"), Zoom, zoom_help, zoom_syntax} +}; + +REGISTER_ACTIONS(ghid_main_action_list) + + + static int + flag_flipx(int x) +{ + return gport->view.flip_x; +} + +static int flag_flipy(int x) +{ + return gport->view.flip_y; +} + +HID_Flag ghid_main_flag_list[] = { + {"flip_x", flag_flipx, 0} + , + {"flip_y", flag_flipy, 0} +}; + +REGISTER_FLAGS(ghid_main_flag_list) +#include "dolists.h" +/* + * We will need these for finding the windows installation + * directory. Without that we can't find our fonts and + * footprint libraries. + */ +#ifdef WIN32 +#include +#include +#endif + HID ghid_hid; + + void + hid_gtk_init() +{ +#ifdef WIN32 + char *tmps; + char *share_dir; + char *loader_cache; + FILE *loader_file; +#endif + +#ifdef WIN32 + tmps = g_win32_get_package_installation_directory(PACKAGE "-" VERSION, NULL); +#define REST_OF_PATH G_DIR_SEPARATOR_S "share" G_DIR_SEPARATOR_S PACKAGE +#define REST_OF_CACHE G_DIR_SEPARATOR_S "loaders.cache" + share_dir = (char *) malloc(strlen(tmps) + strlen(REST_OF_PATH) + 1); + sprintf(share_dir, "%s%s", tmps, REST_OF_PATH); + + /* Point to our gdk-pixbuf loader cache. */ + loader_cache = (char *) malloc(strlen(bindir) + strlen(REST_OF_CACHE) + 1); + sprintf(loader_cache, "%s%s", bindir, REST_OF_CACHE); + loader_file = fopen(loader_cache, "r"); + if (loader_file) { + fclose(loader_file); + g_setenv("GDK_PIXBUF_MODULE_FILE", loader_cache, TRUE); + } + + free(tmps); +#undef REST_OF_PATH + printf("\"Share\" installation path is \"%s\"\n", share_dir); +#endif + + memset(&ghid_hid, 0, sizeof(HID)); + + common_nogui_init(&ghid_hid); + common_draw_helpers_init(&ghid_hid); + + ghid_hid.struct_size = sizeof(HID); + ghid_hid.name = "gtk"; + ghid_hid.description = "Gtk - The Gimp Toolkit"; + ghid_hid.gui = 1; + ghid_hid.poly_after = 1; + + ghid_hid.get_export_options = ghid_get_export_options; + ghid_hid.do_export = ghid_do_export; + ghid_hid.parse_arguments = ghid_parse_arguments; + ghid_hid.invalidate_lr = ghid_invalidate_lr; + ghid_hid.invalidate_all = ghid_invalidate_all; + ghid_hid.notify_crosshair_change = ghid_notify_crosshair_change; + ghid_hid.notify_mark_change = ghid_notify_mark_change; + ghid_hid.set_layer = ghid_set_layer; + ghid_hid.make_gc = ghid_make_gc; + ghid_hid.destroy_gc = ghid_destroy_gc; + ghid_hid.use_mask = ghid_use_mask; + ghid_hid.set_color = ghid_set_color; + ghid_hid.set_line_cap = ghid_set_line_cap; + ghid_hid.set_line_width = ghid_set_line_width; + ghid_hid.set_draw_xor = ghid_set_draw_xor; + ghid_hid.draw_line = ghid_draw_line; + ghid_hid.draw_arc = ghid_draw_arc; + ghid_hid.draw_rect = ghid_draw_rect; + ghid_hid.fill_circle = ghid_fill_circle; + ghid_hid.fill_polygon = ghid_fill_polygon; + ghid_hid.fill_rect = ghid_fill_rect; + + ghid_hid.calibrate = ghid_calibrate; + ghid_hid.shift_is_pressed = ghid_shift_is_pressed; + ghid_hid.control_is_pressed = ghid_control_is_pressed; + ghid_hid.mod1_is_pressed = ghid_mod1_is_pressed, ghid_hid.get_coords = ghid_get_coords; + ghid_hid.set_crosshair = ghid_set_crosshair; + ghid_hid.add_timer = ghid_add_timer; + ghid_hid.stop_timer = ghid_stop_timer; + ghid_hid.watch_file = ghid_watch_file; + ghid_hid.unwatch_file = ghid_unwatch_file; + ghid_hid.add_block_hook = ghid_add_block_hook; + ghid_hid.stop_block_hook = ghid_stop_block_hook; + + ghid_hid.log = ghid_log; + ghid_hid.logv = ghid_logv; + ghid_hid.confirm_dialog = ghid_confirm_dialog; + ghid_hid.close_confirm_dialog = ghid_close_confirm_dialog; + ghid_hid.report_dialog = ghid_report_dialog; + ghid_hid.prompt_for = ghid_prompt_for; + ghid_hid.fileselect = ghid_fileselect; + ghid_hid.attribute_dialog = ghid_attribute_dialog; + ghid_hid.show_item = ghid_show_item; + ghid_hid.beep = ghid_beep; + ghid_hid.progress = ghid_progress; + ghid_hid.drc_gui = &ghid_drc_gui, ghid_hid.edit_attributes = ghid_attributes; + + ghid_hid.request_debug_draw = ghid_request_debug_draw; + ghid_hid.flush_debug_draw = ghid_flush_debug_draw; + ghid_hid.finish_debug_draw = ghid_finish_debug_draw; + + ghid_hid.notify_save_pcb = ghid_notify_save_pcb; + ghid_hid.notify_filename_changed = ghid_notify_filename_changed; + + ghid_hid.create_menu = ghid_create_menu; + + hid_register_hid(&ghid_hid); +} Index: 1.0.8/src/hid/gtk/gtkhid.h =================================================================== --- 1.0.8/src/hid/gtk/gtkhid.h (nonexistent) +++ 1.0.8/src/hid/gtk/gtkhid.h (revision 1136) @@ -0,0 +1,8 @@ +/* $Id$ */ + +#ifndef PCB_HID_GTK_GTKHID_H +#define PCB_HID_GTK_GTKHID_H + +void ghid_notify_gui_is_up(void); + +#endif /* PCB_HID_GTK_GTKHID_H */ Index: 1.0.8/src/hid/gtk/gui-command-window.c =================================================================== --- 1.0.8/src/hid/gtk/gui-command-window.c (nonexistent) +++ 1.0.8/src/hid/gtk/gui-command-window.c (revision 1136) @@ -0,0 +1,434 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* This file written by Bill Wilson for the PCB Gtk port */ + +#include "config.h" + +#include "gui.h" +#include + +#include "command.h" +#include "crosshair.h" + + +RCSID("$Id$"); + +static GtkWidget *command_window; +static GtkWidget *combo_vbox; +static GList *history_list; +static gchar *command_entered; +static GMainLoop *loop; + + +/* gui-command-window.c provides two interfaces for getting user input +| for executing a command. +| +| As the Xt PCB was ported to Gtk, the traditional user entry in the +| status line window presented some focus problems which require that +| there can be no menu key shortcuts that might be a key the user would +| type in. It also requires a coordinating flag so the drawing area +| won't grab focus while the command entry is up. +| +| I thought the interface should be cleaner, so so I made an alternate +| command window interface which works better I think as a gui interface. +| The user must focus onto the command window, but since it's a separate +| window, there's no confusion. It has the restriction that objects to +| be operated on must be selected, but that actually seems a better user +| interface than one where typing into one location requires the user to +| be careful about which object might be under the cursor somewhere else. +| +| In any event, both interfaces are here to work with. +*/ + + + /* When using a command window for command entry, provide a quick and + | abbreviated reference to available commands. + | This is currently just a start and can be expanded if it proves useful. + */ +static gchar *command_ref_text[] = { + N_("Common commands easily accessible via the gui may not be included here.\n"), + "\n", + N_("In user commands below, 'size' values may be absolute or relative\n" + "if preceded by a '+' or '-'. Where 'units' are indicated, use \n" + "'mil' or 'mm' otherwise PCB internal units will be used.\n"), + "\n", + "changesize(target, size, units)\n", + "\ttarget = {selectedlines | selectedpins | selectedvias | selectedpads \n" + "\t\t\t| selectedtexts | selectednames | selectedelements | selected}\n", + "\n", + "changedrillsize(target, size, units)\n", + "\ttarget = {selectedpins | selectedvias | selectedobjects | selected}\n", + "\n", + "changeclearsize(target, size, units)\n", + "\ttarget = {selectedpins | selectedpads | selectedvias | selectedlines\n" + "\t\t\t| selectedarcs | selectedobjects | selected}\n", + N_("\tChanges the clearance of objects.\n"), + "\n", + "setvalue(target, size, units)\n", + "\ttarget = {grid | zoom | line | textscale | viadrillinghole\n" "\t\t\t| viadrillinghole | via}\n", + N_("\tChanges values. Omit 'units' for 'grid' and 'zoom'.\n"), + "\n", + "changejoin(target)\n", + "\ttarget = {object | selectedlines | selectedarcs | selected}\n", + N_("\tChanges the join (clearance through polygons) of objects.\n"), + "\n", + "changesquare(target)\n", + "setsquare(target)\n", + "clearsquare(target)\n", + "\ttarget = {object | selectedelements | selectedpins | selected}\n", + N_("\tToggles, sets, or clears the square flag of objects.\n"), + "\n", + "changeoctagon(target)\n", + "setoctagon(target)\n", + "clearoctagon(target)\n", + "\ttarget = {object | selectedelements | selectedpins selectedvias | selected}\n", + N_("\tToggles, sets, or clears the octagon flag of objects.\n"), + "\n", + "changehole(target)\n", + "\ttarget = {object | selectedvias | selected}\n", + N_("\tChanges the hole flag of objects.\n"), + "\n", + "flip(target)\n", + "\ttarget = {object | selectedelements | selected}\n", + N_("\tFlip elements to the opposite side of the board.\n"), + "\n", + "togglethermal(target)\n", + "setthermal(target)\n", + "clearthermal(target)\n", + "\ttarget = {object | selectedpins | selectedvias | selected}\n", + N_("\tToggle, set or clear a thermal (on the current layer) to pins or vias.\n"), + "\n", + "loadvendor(target)\n", + "\ttarget = [filename]\n", + N_("\tLoad a vendor file. If 'filename' omitted, pop up file select dialog.\n"), +}; + + + /* Put an allocated string on the history list and combo text list + | if it is not a duplicate. The history_list is just a shadow of the + | combo list, but I think is needed because I don't see an api for reading + | the combo strings. The combo box strings take "const gchar *", so the + | same allocated string can go in both the history list and the combo list. + | If removed from both lists, a string can be freed. + */ +static void command_history_add(gchar * cmd) +{ + GList *list; + gchar *s; + gint i; + + if (!cmd || !*cmd) + return; + + /* Check for a duplicate command. If found, move it to the + | top of the list and similarly modify the combo box strings. + */ + for (i = 0, list = history_list; list; list = list->next, ++i) { + s = (gchar *) list->data; + if (!strcmp(cmd, s)) { + history_list = g_list_remove(history_list, s); + history_list = g_list_prepend(history_list, s); + gtk_combo_box_remove_text(GTK_COMBO_BOX(ghidgui->command_combo_box), i); + gtk_combo_box_prepend_text(GTK_COMBO_BOX(ghidgui->command_combo_box), s); + return; + } + } + + /* Not a duplicate, so put first in history list and combo box text list. + */ + s = g_strdup(cmd); + history_list = g_list_prepend(history_list, s); + gtk_combo_box_prepend_text(GTK_COMBO_BOX(ghidgui->command_combo_box), s); + + /* And keep the lists trimmed! + */ + if (g_list_length(history_list) > ghidgui->history_size) { + s = (gchar *) g_list_nth_data(history_list, ghidgui->history_size); + history_list = g_list_remove(history_list, s); + gtk_combo_box_remove_text(GTK_COMBO_BOX(ghidgui->command_combo_box), ghidgui->history_size); + g_free(s); + } +} + + + /* Called when user hits "Enter" key in command entry. The action to take + | depends on where the combo box is. If it's in the command window, we can + | immediately execute the command and carry on. If it's in the status + | line hbox, then we need stop the command entry g_main_loop from running + | and save the allocated string so it can be returned from + | ghid_command_entry_get() + */ +static void command_entry_activate_cb(GtkWidget * widget, gpointer data) +{ + gchar *command; + + command = g_strdup(ghid_entry_get_text(GTK_WIDGET(ghidgui->command_entry))); + gtk_entry_set_text(ghidgui->command_entry, ""); + + if (*command) + command_history_add(command); + + if (ghidgui->use_command_window) { + hid_parse_command(command); + g_free(command); + } + else { + if (loop && g_main_loop_is_running(loop)) /* should always be */ + g_main_loop_quit(loop); + command_entered = command; /* Caller will free it */ + } +} + + /* Create the command_combo_box. Called once, either by + | ghid_command_window_show() or ghid_command_entry_get(). Then as long as + | ghidgui->use_command_window is TRUE, the command_combo_box will live + | in a command window vbox or float if the command window is not up. + | But if ghidgui->use_command_window is FALSE, the command_combo_box + | will live in the status_line_hbox either shown or hidden. + | Since it's never destroyed, the combo history strings never need + | rebuilding and history is maintained if the combo box location is moved. + */ +static void command_combo_box_entry_create(void) +{ + ghidgui->command_combo_box = gtk_combo_box_entry_new_text(); + ghidgui->command_entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(ghidgui->command_combo_box))); + + gtk_entry_set_width_chars(ghidgui->command_entry, 40); + gtk_entry_set_activates_default(ghidgui->command_entry, TRUE); + + g_signal_connect(G_OBJECT(ghidgui->command_entry), "activate", G_CALLBACK(command_entry_activate_cb), NULL); + + g_object_ref(G_OBJECT(ghidgui->command_combo_box)); /* so can move it */ +} + +static void command_window_close_cb(void) +{ + if (command_window) { + gtk_container_remove(GTK_CONTAINER(combo_vbox), /* Float it */ + ghidgui->command_combo_box); + gtk_widget_destroy(command_window); + } + combo_vbox = NULL; + command_window = NULL; +} + +static void command_destroy_cb(GtkWidget * widget, gpointer data) +{ + command_window = NULL; +} + + /* If ghidgui->use_command_window toggles, the config code calls + | this to ensure the command_combo_box is set up for living in the + | right place. + */ +void ghid_command_use_command_window_sync(void) +{ + /* The combo box will be NULL and not living anywhere until the + | first command entry. + */ + if (!ghidgui->command_combo_box) + return; + + if (ghidgui->use_command_window) + gtk_container_remove(GTK_CONTAINER(ghidgui->status_line_hbox), ghidgui->command_combo_box); + else { + /* Destroy the window (if it's up) which floats the command_combo_box + | so we can pack it back into the status line hbox. If the window + | wasn't up, the command_combo_box was already floating. + */ + command_window_close_cb(); + gtk_widget_hide(ghidgui->command_combo_box); + gtk_box_pack_start(GTK_BOX(ghidgui->status_line_hbox), ghidgui->command_combo_box, FALSE, FALSE, 0); + } +} + + /* If ghidgui->use_command_window is TRUE this will get called from + | ActionCommand() to show the command window. + */ +void ghid_command_window_show(gboolean raise) +{ + GtkWidget *vbox, *vbox1, *hbox, *button, *expander, *text; + gint i; + + if (command_window) { + if (raise) + gtk_window_present(GTK_WINDOW(command_window)); + return; + } + command_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + g_signal_connect(G_OBJECT(command_window), "destroy", G_CALLBACK(command_destroy_cb), NULL); + gtk_window_set_title(GTK_WINDOW(command_window), _("PCB Command Entry")); + gtk_window_set_wmclass(GTK_WINDOW(command_window), "PCB_Command", "PCB"); + gtk_window_set_resizable(GTK_WINDOW(command_window), FALSE); + + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); + gtk_container_add(GTK_CONTAINER(command_window), vbox); + + if (!ghidgui->command_combo_box) + command_combo_box_entry_create(); + + gtk_box_pack_start(GTK_BOX(vbox), ghidgui->command_combo_box, FALSE, FALSE, 0); + combo_vbox = vbox; + + /* Make the command reference scrolled text view. Use high level + | utility functions in gui-utils.c + */ + expander = gtk_expander_new(_("Command Reference")); + gtk_box_pack_start(GTK_BOX(vbox), expander, TRUE, TRUE, 2); + vbox1 = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(expander), vbox1); + gtk_widget_set_size_request(vbox1, -1, 350); + + text = ghid_scrolled_text_view(vbox1, NULL, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + for (i = 0; i < sizeof(command_ref_text) / sizeof(gchar *); ++i) + ghid_text_view_append(text, _(command_ref_text[i])); + + /* The command window close button. + */ + hbox = gtk_hbutton_box_new(); + gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 3); + button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(command_window_close_cb), NULL); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + + gtk_widget_show_all(command_window); +} + + +static gboolean command_escape_cb(GtkWidget * widget, GdkEventKey * kev, gpointer data) +{ + gint ksym = kev->keyval; + + if (ksym != GDK_Escape) + return FALSE; + + if (loop && g_main_loop_is_running(loop)) /* should always be */ + g_main_loop_quit(loop); + command_entered = NULL; /* We are aborting */ + + return TRUE; +} + + + /* This is the command entry function called from ActionCommand() when + | ghidgui->use_command_window is FALSE. The command_combo_box is already + | packed into the status line label hbox in this case. + */ +gchar *ghid_command_entry_get(gchar * prompt, gchar * command) +{ + gchar *s; + gint escape_sig_id; + GHidPort *out = &ghid_port; + + /* If this is the first user command entry, we have to create the + | command_combo_box and pack it into the status_line_hbox. + */ + if (!ghidgui->command_combo_box) { + command_combo_box_entry_create(); + gtk_box_pack_start(GTK_BOX(ghidgui->status_line_hbox), ghidgui->command_combo_box, FALSE, FALSE, 0); + } + + /* Make the prompt bold and set the label before showing the combo to + | avoid window resizing wider. + */ + s = g_strdup_printf("%s", prompt ? prompt : ""); + ghid_status_line_set_text(s); + g_free(s); + + /* Flag so output drawing area won't try to get focus away from us and + | so resetting the status line label can be blocked when resize + | callbacks are invokded from the resize caused by showing the combo box. + */ + ghidgui->command_entry_status_line_active = TRUE; + + gtk_entry_set_text(ghidgui->command_entry, command ? command : ""); + gtk_widget_show_all(ghidgui->command_combo_box); + + /* Remove the top window accel group so keys intended for the entry + | don't get intercepted by the menu system. Set the interface + | insensitive so all the user can do is enter a command, grab focus + | and connect a handler to look for the escape key. + */ + ghid_remove_accel_groups(GTK_WINDOW(gport->top_window), ghidgui); + ghid_interface_input_signals_disconnect(); + ghid_interface_set_sensitive(FALSE); + gtk_widget_grab_focus(GTK_WIDGET(ghidgui->command_entry)); + escape_sig_id = g_signal_connect(G_OBJECT(ghidgui->command_entry), "key_press_event", G_CALLBACK(command_escape_cb), NULL); + + loop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(loop); + + g_main_loop_unref(loop); + loop = NULL; + + ghidgui->command_entry_status_line_active = FALSE; + + /* Restore the damage we did before entering the loop. + */ + g_signal_handler_disconnect(ghidgui->command_entry, escape_sig_id); + ghid_interface_input_signals_connect(); + ghid_interface_set_sensitive(TRUE); + ghid_install_accel_groups(GTK_WINDOW(gport->top_window), ghidgui); + + /* Restore the status line label and give focus back to the drawing area + */ + gtk_widget_hide(ghidgui->command_combo_box); + gtk_widget_grab_focus(out->drawing_area); + + return command_entered; +} + + +void ghid_handle_user_command(gboolean raise) +{ + char *command; + static char *previous = NULL; + + if (ghidgui->use_command_window) + ghid_command_window_show(raise); + else { + command = ghid_command_entry_get(_("Enter command:"), (Settings.SaveLastCommand && previous) ? previous : (gchar *) ""); + if (command != NULL) { + /* copy new comand line to save buffer */ + g_free(previous); + previous = g_strdup(command); + hid_parse_command(command); + g_free(command); + } + else if (previous) { + command = g_strdup(previous); + hid_parse_command(command); + g_free(command); + } + } + ghid_window_set_name_label(PCB->Name); + ghid_set_status_line_label(); +} Index: 1.0.8/src/hid/gtk/gui-config.c =================================================================== --- 1.0.8/src/hid/gtk/gui-config.c (nonexistent) +++ 1.0.8/src/hid/gtk/gui-config.c (revision 1136) @@ -0,0 +1,1927 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* This file written by Bill Wilson for the PCB Gtk port. +*/ + +#include "config.h" + + +#ifdef HAVE_STDLIB_H +#include +#endif + +#include "gui.h" +#include "hid.h" +#include "../hidint.h" +#include "gtkhid.h" + +#include "global.h" +#include "action.h" +#include "change.h" +#include "file.h" +#include "error.h" +#include "draw.h" +#include "misc.h" +#include "portability.h" /* MKDIR() */ +#include "pcb-printf.h" +#include "set.h" + +#if 0 +#include +#endif + +extern int MoveLayerAction(int argc, char **argv, int x, int y); + + +RCSID("$Id$"); + +enum ConfigType { + CONFIG_Boolean, + CONFIG_Integer, + CONFIG_Coord, + CONFIG_Real, + CONFIG_String, + CONFIG_Unused +}; + +typedef struct { + gchar *name; + enum ConfigType type; + void *value; +} ConfigAttribute; + + +enum ColorTypes { + MISC_COLOR, + MISC_SELECTED_COLOR, + LAYER_COLOR, + LAYER_SELECTED_COLOR +}; + +typedef struct { + HID_Attribute *attributes; + enum ColorTypes type; + GdkColor color; + gboolean color_is_mapped; +} ConfigColor; + +static GList *config_color_list, *lib_newlib_list; + +static gchar *lib_newlib_config, *board_size_override; + + +static gchar *color_file; + +extern void ghid_set_special_colors(HID_Attribute * ha); + + +#define PCB_CONFIG_DIR ".pcb" +#define PCB_CONFIG_FILE "preferences" +#define PCB_COLORS_DIR "colors" + +static gchar *config_dir, *color_dir; + + /* CONFIG_Unused types are expected to be found in main_attribute_list and + | will be assigned the type found there. NULL value pointers here are + | also expected to be assigned values from the main_attribute_list. + */ + /* PinoutFont also not used anymore */ + +static ConfigAttribute config_attributes[] = { + {"gui-compact-horizontal", CONFIG_Boolean, &_ghidgui.compact_horizontal}, + {"gui-compact-vertical", CONFIG_Boolean, &_ghidgui.compact_vertical}, + {"use-command-window", CONFIG_Boolean, &_ghidgui.use_command_window}, + {"save-in-tmp", CONFIG_Unused, NULL}, + {"grid-units", CONFIG_Unused, NULL}, + {"grid", CONFIG_Unused, NULL}, + + {"history-size", CONFIG_Integer, &_ghidgui.history_size}, + {"top-window-width", CONFIG_Integer, &_ghidgui.top_window_width}, + {"top-window-height", CONFIG_Integer, &_ghidgui.top_window_height}, + {"log-window-width", CONFIG_Integer, &_ghidgui.log_window_width}, + {"log-window-height", CONFIG_Integer, &_ghidgui.log_window_height}, + {"drc-window-width", CONFIG_Integer, &_ghidgui.drc_window_width}, + {"drc-window-height", CONFIG_Integer, &_ghidgui.drc_window_height}, + {"library-window-width", CONFIG_Integer, &_ghidgui.library_window_width}, + {"library-window-height", CONFIG_Integer, &_ghidgui.library_window_height}, + {"netlist-window-height", CONFIG_Integer, &_ghidgui.netlist_window_height}, + {"keyref-window-width", CONFIG_Integer, &_ghidgui.keyref_window_width}, + {"keyref-window-height", CONFIG_Integer, &_ghidgui.keyref_window_height}, + {"text-scale", CONFIG_Unused, NULL}, + {"via-thickness", CONFIG_Unused, NULL}, + {"via-drilling-hole", CONFIG_Unused, NULL}, + {"backup-interval", CONFIG_Unused, NULL}, + {"line-thickness", CONFIG_Unused, NULL}, + {"rat-thickness", CONFIG_Unused, NULL}, + {"bloat", CONFIG_Unused, NULL}, + {"shrink", CONFIG_Unused, NULL}, + {"min-width", CONFIG_Unused, NULL}, + {"min-silk", CONFIG_Unused, NULL}, + {"min-drill", CONFIG_Unused, NULL}, + {"min-ring", CONFIG_Unused, NULL}, + {"default-PCB-width", CONFIG_Unused, NULL}, + {"default-PCB-height", CONFIG_Unused, NULL}, + + {"groups", CONFIG_Unused, NULL}, + {"route-styles", CONFIG_Unused, NULL}, + {"library-newlib", CONFIG_String, &lib_newlib_config}, + {"color-file", CONFIG_String, &color_file}, +/* FIXME: construct layer-names- in a list */ + {"layer-name-1", CONFIG_Unused, NULL}, + {"layer-name-2", CONFIG_Unused, NULL}, + {"layer-name-3", CONFIG_Unused, NULL}, + {"layer-name-4", CONFIG_Unused, NULL}, + {"layer-name-5", CONFIG_Unused, NULL}, + {"layer-name-6", CONFIG_Unused, NULL}, + {"layer-name-7", CONFIG_Unused, NULL}, + {"layer-name-8", CONFIG_Unused, NULL}, +}; + + +static FILE *config_file_open(gchar * mode) +{ + FILE *f; + gchar *homedir, *fname; + + + homedir = (gchar *) g_get_home_dir(); + if (!homedir) { + g_message("config_file_open: Can't get home directory!"); + return NULL; + } + + if (!config_dir) { + config_dir = g_build_path(G_DIR_SEPARATOR_S, homedir, PCB_CONFIG_DIR, NULL); + if (!g_file_test(config_dir, G_FILE_TEST_IS_DIR) + && MKDIR(config_dir, 0755) < 0) { + g_message("config_file_open: Can't make \"%s\" directory!", config_dir); + g_free(config_dir); + config_dir = NULL; + return NULL; + } + } + + if (!color_dir) { /* Convenient to make the color dir here */ + color_dir = g_build_path(G_DIR_SEPARATOR_S, config_dir, PCB_COLORS_DIR, NULL); + if (!g_file_test(color_dir, G_FILE_TEST_IS_DIR)) { + if (MKDIR(color_dir, 0755) < 0) { + g_message("config_file_open: Can't make \"%s\" directory!", color_dir); + g_free(color_dir); + color_dir = NULL; + } + fname = g_build_path(G_DIR_SEPARATOR_S, color_dir, "Default", NULL); + dup_string(&color_file, fname); + g_free(fname); + } + } + + fname = g_build_path(G_DIR_SEPARATOR_S, config_dir, PCB_CONFIG_FILE, NULL); + f = fopen(fname, mode); + + g_free(fname); + return f; +} + +static ConfigAttribute *lookup_config_attribute(gchar * name, gboolean if_null_value) +{ + ConfigAttribute *ca; + + for (ca = &config_attributes[0]; ca < &config_attributes[0] + G_N_ELEMENTS(config_attributes); ++ca) { + if (name && (!strcmp(name, ca->name))) { + if (ca->value && if_null_value) + break; + return ca; + } + } + return NULL; +} + +void ghid_config_init(void) +{ + HID_AttrNode *ha; + HID_Attribute *a; + ConfigAttribute *ca, dummy_attribute; + ConfigColor *cc; + gint len; + + ghidgui->n_mode_button_columns = 3; + ghidgui->small_label_markup = TRUE; + ghidgui->history_size = 5; + dup_string(&color_file, ""); + + for (ha = hid_attr_nodes; ha; ha = ha->next) { + for (a = ha->attributes; a < ha->attributes + ha->n; ++a) { + if (!a->value) + continue; + if ((ca = lookup_config_attribute(a->name, TRUE)) == NULL) + ca = &dummy_attribute; + ca->value = a->value; /* Typically &Setting.xxx */ + ca->type = CONFIG_Unused; + switch (a->type) { + case HID_Boolean: + *(char *) a->value = a->default_val.int_value; + ca->type = CONFIG_Boolean; + break; + case HID_Integer: + *(int *) a->value = a->default_val.int_value; + ca->type = CONFIG_Integer; + break; + case HID_Coord: + *(Coord *) a->value = a->default_val.coord_value; + ca->type = CONFIG_Coord; + break; + case HID_Real: + *(double *) a->value = a->default_val.real_value; + ca->type = CONFIG_Real; + break; + + case HID_String: + if (!a->name) + break; + *(char **) a->value = g_strdup(a->default_val.str_value); + ca->type = CONFIG_String; + + len = strlen(a->name); + if (len < 7 || strstr(a->name, "color") == NULL) + break; + + cc = g_new0(ConfigColor, 1); + cc->attributes = a; + + if (!strncmp(a->name, "layer-color", 11)) + cc->type = LAYER_COLOR; + else if (!strncmp(a->name, "layer-selected-color", 20)) + cc->type = LAYER_SELECTED_COLOR; + else if (!strncmp(a->name + len - 14, "selected-color", 14)) + cc->type = MISC_SELECTED_COLOR; + else + cc->type = MISC_COLOR; + + config_color_list = g_list_append(config_color_list, cc); + break; + + case HID_Enum: + case HID_Unit: + *(int *) a->value = a->default_val.int_value; + break; + + case HID_Label: + case HID_Mixed: + case HID_Path: + break; + default: + abort(); + } + } + } +} + +static gint parse_option_line(gchar * line, gchar ** option_result, gchar ** arg_result) +{ + gchar *s, *ss, option[64], arg[512]; + gint argc = 1; + + if (option_result) + *option_result = NULL; + if (arg_result) + *arg_result = NULL; + + s = line; + while (*s == ' ' || *s == '\t') + ++s; + if (!*s || *s == '\n' || *s == '#' || *s == '[') + return 0; + if ((ss = strchr(s, '\n')) != NULL) + *ss = '\0'; + arg[0] = '\0'; + sscanf(s, "%63s %511[^\n]", option, arg); + + s = option; /* Strip trailing ':' or '=' */ + while (*s && *s != ':' && *s != '=') + ++s; + *s = '\0'; + + s = arg; /* Strip leading ':', '=', and whitespace */ + while (*s == ' ' || *s == '\t' || *s == ':' || *s == '=' || *s == '"') + ++s; + if ((ss = strchr(s, '"')) != NULL) + *ss = '\0'; + + if (option_result) + *option_result = g_strdup(option); + if (arg_result && *s) { + *arg_result = g_strdup(s); + ++argc; + } + return argc; +} + +static gboolean set_config_attribute(gchar * option, gchar * arg) +{ + ConfigAttribute *ca; +#if 0 + struct lconv *lc; + gchar locale_point, *comma_point, *period_point; + + /* Until LC_NUMERIC is totally resolved, check if we need to decimal + | point convert. Ultimately, data files will be POSIX and gui + | presentation (hence the config file reals) will be in the users locale. + */ + lc = localeconv(); + locale_point = *lc->decimal_point; +#endif + + if ((ca = lookup_config_attribute(option, FALSE)) == NULL) + return FALSE; + switch (ca->type) { + case CONFIG_Boolean: + *(gchar *) ca->value = (gchar) atoi(arg); + break; + + case CONFIG_Integer: + *(gint *) ca->value = atoi(arg); + break; + + case CONFIG_Real: + /* Hopefully temporary locale decimal point check: + */ +#if 0 + comma_point = strrchr(arg, ','); + period_point = strrchr(arg, '.'); + if (comma_point && *comma_point != locale_point) + *comma_point = locale_point; + else if (period_point && *period_point != locale_point) + *period_point = locale_point; +#endif + *(double *) ca->value = atof(arg); + break; + + case CONFIG_String: + dup_string((gchar **) ca->value, arg ? arg : (gchar *) ""); + break; + case CONFIG_Coord: + *(Coord *) ca->value = GetValue(arg, NULL, NULL); + break; + default: + break; + } + return TRUE; +} + +static void config_file_read(void) +{ + FILE *f; + gchar buf[512], *option, *arg; + + if ((f = config_file_open("r")) == NULL) + return; + + buf[0] = '\0'; + while (fgets(buf, sizeof(buf), f)) { + if (parse_option_line(buf, &option, &arg) > 0) + set_config_attribute(option, arg); + g_free(option); + g_free(arg); + } + + fclose(f); +} + +static void config_colors_write(gchar * path) +{ + FILE *f; + GList *list; + HID_Attribute *ha; + ConfigColor *cc; + + if ((f = fopen(path, "w")) == NULL) + return; + for (list = config_color_list; list; list = list->next) { + cc = (ConfigColor *) list->data; + ha = cc->attributes; + fprintf(f, "%s =\t%s\n", ha->name, *(char **) ha->value); + } + fclose(f); +} + +static gboolean config_colors_read(gchar * path) +{ + FILE *f; + GList *list; + ConfigColor *cc; + HID_Attribute *ha; + gchar *s, buf[512], option[64], arg[512]; + + if (!path || !*path || (f = fopen(path, "r")) == NULL) + return FALSE; + + while (fgets(buf, sizeof(buf), f)) { + sscanf(buf, "%63s %511[^\n]", option, arg); + s = option; /* Strip trailing ':' or '=' */ + while (*s && *s != ':' && *s != '=') + ++s; + *s = '\0'; + s = arg; /* Strip leading ':', '=', and whitespace */ + while (*s == ' ' || *s == '\t' || *s == ':' || *s == '=') + ++s; + + for (list = config_color_list; list; list = list->next) { + cc = (ConfigColor *) list->data; + ha = cc->attributes; + if (!strcmp(option, ha->name)) { + *(char **) ha->value = g_strdup(s); + cc->color_is_mapped = FALSE; + ghid_set_special_colors(ha); + break; + } + } + } + fclose(f); + + return TRUE; +} + +static gchar *expand_dir(gchar * dir) +{ + gchar *s; + + if (*dir == '~') + s = g_build_filename((gchar *) g_get_home_dir(), dir + 1, NULL); + else + s = g_strdup(dir); + return s; +} + +static void add_to_paths_list(GList ** list, gchar * path_string) +{ + gchar *p, *paths; + + paths = g_strdup(path_string); + for (p = strtok(paths, PCB_PATH_DELIMETER); p && *p; p = strtok(NULL, PCB_PATH_DELIMETER)) + *list = g_list_prepend(*list, expand_dir(p)); + g_free(paths); +} + + /* Parse command line code borrowed from hid/common/hidinit.c + */ +static void parse_optionv(gint * argc, gchar *** argv, gboolean from_cmd_line) +{ + HID_AttrNode *ha; + HID_Attribute *a; + const Unit *unit; + gchar *ep; + gint e, ok, offset; + gboolean matched = FALSE; + + offset = from_cmd_line ? 2 : 0; + + while (*argc && (((*argv)[0][0] == '-' && (*argv)[0][1] == '-') + || !from_cmd_line)) { + for (ha = hid_attr_nodes; ha; ha = ha->next) { + for (a = ha->attributes; a < ha->attributes + ha->n; ++a) { + if (!a->name || strcmp((*argv)[0] + offset, a->name)) + continue; + switch (a->type) { + case HID_Label: + break; + case HID_Integer: + if (a->value) + *(int *) a->value = strtol((*argv)[1], 0, 0); + else + a->default_val.int_value = strtol((*argv)[1], 0, 0); + (*argc)--; + (*argv)++; + break; + case HID_Coord: + if (a->value) + *(Coord *) a->value = GetValue((*argv)[1], 0, 0); + else + a->default_val.coord_value = GetValue((*argv)[1], 0, 0); + (*argc)--; + (*argv)++; + break; + case HID_Real: + if (a->value) + *(double *) a->value = strtod((*argv)[1], 0); + else + a->default_val.real_value = strtod((*argv)[1], 0); + (*argc)--; + (*argv)++; + break; + case HID_String: + if (a->value) + *(char **) a->value = g_strdup((*argv)[1]); + else + a->default_val.str_value = g_strdup((*argv)[1]); + (*argc)--; + (*argv)++; + break; + case HID_Boolean: + if (a->value) + *(char *) a->value = 1; + else + a->default_val.int_value = 1; + break; + case HID_Mixed: + a->default_val.real_value = strtod((*argv)[1], &ep); + goto do_enum; + case HID_Enum: + ep = (*argv)[1]; + do_enum: + ok = 0; + for (e = 0; a->enumerations[e]; e++) + if (strcmp(a->enumerations[e], ep) == 0) { + ok = 1; + a->default_val.int_value = e; + a->default_val.str_value = ep; + break; + } + if (!ok) { + fprintf(stderr, "ERROR: \"%s\" is an unknown value for the --%s option\n", (*argv)[1], a->name); + exit(1); + } + (*argc)--; + (*argv)++; + break; + case HID_Path: + abort(); + a->default_val.str_value = (*argv)[1]; + (*argc)--; + (*argv)++; + break; + case HID_Unit: + unit = get_unit_struct((*argv)[1]); + if (unit == NULL) { + fprintf(stderr, "ERROR: unit \"%s\" is unknown to pcb (option --%s)\n", (*argv)[1], a->name); + exit(1); + } + a->default_val.int_value = unit->index; + a->default_val.str_value = unit->suffix; + (*argc)--; + (*argv)++; + break; + } + (*argc)--; + (*argv)++; + ha = 0; + goto got_match; + } + if (a < ha->attributes + ha->n) + matched = TRUE; + } + if (!matched) { + if (from_cmd_line) { + fprintf(stderr, "unrecognized option: %s\n", (*argv)[0]); + exit(1); + } + else +/* ghid_log("unrecognized option: %s\n", (*argv)[0]);*/ + fprintf(stderr, "unrecognized option: %s\n", (*argv)[0]); + } + got_match:; + } + (*argc)++; + (*argv)--; +} + +static void load_rc_file(gchar * path) +{ + FILE *f; + gchar buf[1024], *av[2], **argv; + gint argc; + + f = fopen(path, "r"); + if (!f) + return; + + if (Settings.verbose) + printf("Loading pcbrc file: %s\n", path); + while (fgets(buf, sizeof(buf), f)) { + argv = &(av[0]); + if ((argc = parse_option_line(buf, &av[0], &av[1])) > 0) + parse_optionv(&argc, &argv, FALSE); + g_free(av[0]); + g_free(av[1]); + } + fclose(f); +} + +static void load_rc_files(void) +{ + gchar *path; + + load_rc_file("/etc/pcbrc"); + load_rc_file("/usr/local/etc/pcbrc"); + + path = g_build_filename(pcblibdir, "pcbrc", NULL); + load_rc_file(path); + g_free(path); + + path = g_build_filename((gchar *) g_get_home_dir(), ".pcb/pcbrc", NULL); + load_rc_file(path); + g_free(path); + + load_rc_file("pcbrc"); +} + + +void ghid_config_files_read(gint * argc, gchar *** argv) +{ + GList *list; + gchar *str, *dir; + gint width, height; + + ghidgui = &_ghidgui; + + ghid_config_init(); + load_rc_files(); + config_file_read(); + config_colors_read(color_file); + (*argc)--; + (*argv)++; + parse_optionv(argc, argv, TRUE); + + if (board_size_override && sscanf(board_size_override, "%dx%d", &width, &height) == 2) { + Settings.MaxWidth = TO_PCB_UNITS(width); + Settings.MaxHeight = TO_PCB_UNITS(height); + } + + if (lib_newlib_config && *lib_newlib_config) + add_to_paths_list(&lib_newlib_list, lib_newlib_config); + + for (list = lib_newlib_list; list; list = list->next) { + str = Settings.LibrarySearchPaths; + dir = expand_dir((gchar *) list->data); + Settings.LibrarySearchPaths = g_strconcat(str, PCB_PATH_DELIMETER, dir, NULL); + g_free(dir); + g_free(str); + } +} + +void ghid_config_files_write(void) +{ + FILE *f; + ConfigAttribute *ca; + + if (!ghidgui->config_modified || (f = config_file_open("w")) == NULL) + return; + + fprintf(f, "### PCB configuration file. ###\n"); + + for (ca = &config_attributes[0]; ca < &config_attributes[0] + G_N_ELEMENTS(config_attributes); ++ca) { + switch (ca->type) { + case CONFIG_Boolean: + fprintf(f, "%s = %d\n", ca->name, (gint) * (gchar *) ca->value); + break; + + case CONFIG_Integer: + fprintf(f, "%s = %d\n", ca->name, *(gint *) ca->value); + break; + + case CONFIG_Real: + fprintf(f, "%s = %f\n", ca->name, *(double *) ca->value); + break; + + case CONFIG_String: + if (*(char **) ca->value == NULL) + fprintf(f, "# %s = NULL\n", ca->name); + else + fprintf(f, "%s = %s\n", ca->name, *(char **) ca->value); + break; + default: + break; + } + } + fclose(f); + + ghidgui->config_modified = FALSE; +} + +/* =================== OK, now the gui stuff ====================== +*/ +static GtkWidget *config_window; + + /* -------------- The General config page ---------------- + */ + +static void config_command_window_toggle_cb(GtkToggleButton * button, gpointer data) +{ + gboolean active = gtk_toggle_button_get_active(button); + static gboolean holdoff; + + if (holdoff) + return; + + /* Can't toggle into command window mode if the status line command + | entry is active. + */ + if (ghidgui->command_entry_status_line_active) { + holdoff = TRUE; + gtk_toggle_button_set_active(button, FALSE); + holdoff = FALSE; + return; + } + ghidgui->use_command_window = active; + ghid_command_use_command_window_sync(); +} + + +static void config_compact_horizontal_toggle_cb(GtkToggleButton * button, gpointer data) +{ + gboolean active = gtk_toggle_button_get_active(button); + + ghidgui->compact_horizontal = active; + ghid_set_status_line_label(); + ghidgui->config_modified = TRUE; +} + +static void config_compact_vertical_toggle_cb(GtkToggleButton * button, gpointer data) +{ + gboolean active = gtk_toggle_button_get_active(button); + + ghidgui->compact_vertical = active; + ghid_pack_mode_buttons(); + ghidgui->config_modified = TRUE; +} + +static void config_general_toggle_cb(GtkToggleButton * button, void *setting) +{ + *(gint *) setting = gtk_toggle_button_get_active(button); + ghidgui->config_modified = TRUE; +} + +static void config_backup_spin_button_cb(GtkSpinButton * spin_button, gpointer data) +{ + Settings.BackupInterval = gtk_spin_button_get_value_as_int(spin_button); + EnableAutosave(); + ghidgui->config_modified = TRUE; +} + +static void config_history_spin_button_cb(GtkSpinButton * spin_button, gpointer data) +{ + ghidgui->history_size = gtk_spin_button_get_value_as_int(spin_button); + ghidgui->config_modified = TRUE; +} + +static void config_general_tab_create(GtkWidget * tab_vbox) +{ + GtkWidget *vbox; + + gtk_container_set_border_width(GTK_CONTAINER(tab_vbox), 6); + + vbox = ghid_category_vbox(tab_vbox, _("Enables"), 4, 2, TRUE, TRUE); + + ghid_check_button_connected(vbox, NULL, ghidgui->use_command_window, + TRUE, FALSE, FALSE, 2, + config_command_window_toggle_cb, NULL, _("Use separate window for command entry")); + + ghid_check_button_connected(vbox, NULL, ghidgui->compact_horizontal, + TRUE, FALSE, FALSE, 2, + config_compact_horizontal_toggle_cb, NULL, + _("Alternate window layout to allow smaller horizontal size")); + + ghid_check_button_connected(vbox, NULL, ghidgui->compact_vertical, + TRUE, FALSE, FALSE, 2, + config_compact_vertical_toggle_cb, NULL, + _("Alternate window layout to allow smaller vertical size")); + + vbox = ghid_category_vbox(tab_vbox, _("Backups"), 4, 2, TRUE, TRUE); + ghid_check_button_connected(vbox, NULL, Settings.SaveInTMP, + TRUE, FALSE, FALSE, 2, + config_general_toggle_cb, &Settings.SaveInTMP, + _("If layout is modified at exit, save into PCB.%i.save")); + ghid_spin_button(vbox, NULL, Settings.BackupInterval, 0.0, 60 * 60, 60.0, + 600.0, 0, 0, config_backup_spin_button_cb, NULL, FALSE, + _("Seconds between auto backups\n" "(set to zero to disable auto backups)")); + + vbox = ghid_category_vbox(tab_vbox, _("Misc"), 4, 2, TRUE, TRUE); + ghid_spin_button(vbox, NULL, ghidgui->history_size, + 5.0, 25.0, 1.0, 1.0, 0, 0, + config_history_spin_button_cb, NULL, FALSE, _("Number of commands to remember in the history list")); +} + + +static void config_general_apply(void) +{ + /* save the settings */ + ghid_config_files_write(); +} + + + /* -------------- The Sizes config page ---------------- + */ + +static GtkWidget *config_sizes_vbox, *config_sizes_tab_vbox, *config_text_spin_button; + +static GtkWidget *use_board_size_default_button, *use_drc_sizes_default_button; + +static Coord new_board_width, new_board_height; + +static void config_sizes_apply(void) +{ + gboolean active; + + active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(use_board_size_default_button)); + if (active) { + Settings.MaxWidth = new_board_width; + Settings.MaxHeight = new_board_height; + ghidgui->config_modified = TRUE; + } + + active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(use_drc_sizes_default_button)); + if (active) { + Settings.Bloat = PCB->Bloat; + Settings.Shrink = PCB->Shrink; + Settings.minWid = PCB->minWid; + Settings.minSlk = PCB->minSlk; + Settings.IsleArea = PCB->IsleArea; + Settings.minDrill = PCB->minDrill; + Settings.minRing = PCB->minRing; + ghidgui->config_modified = TRUE; + } + + if (PCB->MaxWidth != new_board_width || PCB->MaxHeight != new_board_height) + ChangePCBSize(new_board_width, new_board_height); +} + +static void text_spin_button_cb(GtkSpinButton * spin, void *dst) +{ + *(gint *) dst = gtk_spin_button_get_value_as_int(spin); + ghidgui->config_modified = TRUE; + ghid_set_status_line_label(); +} + +static void coord_entry_cb(GHidCoordEntry * ce, void *dst) +{ + *(Coord *) dst = ghid_coord_entry_get_value(ce); + ghidgui->config_modified = TRUE; +} + +static void config_sizes_tab_create(GtkWidget * tab_vbox) +{ + GtkWidget *table, *vbox, *hbox; + + /* Need a vbox we can destroy if user changes grid units. + */ + if (!config_sizes_vbox) { + vbox = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(tab_vbox), vbox, FALSE, FALSE, 0); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); + config_sizes_vbox = vbox; + config_sizes_tab_vbox = tab_vbox; + } + + /* ---- Board Size ---- */ + vbox = ghid_category_vbox(config_sizes_vbox, _("Board Size"), 4, 2, TRUE, TRUE); + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + table = gtk_table_new(2, 2, FALSE); + gtk_box_pack_start(GTK_BOX(hbox), table, FALSE, FALSE, 0); + gtk_table_set_col_spacings(GTK_TABLE(table), 6); + gtk_table_set_row_spacings(GTK_TABLE(table), 3); + + new_board_width = PCB->MaxWidth; + new_board_height = PCB->MaxHeight; + ghid_table_coord_entry(table, 0, 0, NULL, + PCB->MaxWidth, MIN_SIZE, MAX_COORD, CE_LARGE, 0, coord_entry_cb, &new_board_width, FALSE, _("Width")); + + ghid_table_coord_entry(table, 1, 0, NULL, + PCB->MaxHeight, MIN_SIZE, MAX_COORD, + CE_LARGE, 0, coord_entry_cb, &new_board_height, FALSE, _("Height")); + ghid_check_button_connected(vbox, &use_board_size_default_button, FALSE, + TRUE, FALSE, FALSE, 0, NULL, NULL, _("Use this board size as the default for new layouts")); + + /* ---- Text Scale ---- */ + vbox = ghid_category_vbox(config_sizes_vbox, _("Text Scale"), 4, 2, TRUE, TRUE); + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + table = gtk_table_new(4, 2, FALSE); + gtk_box_pack_start(GTK_BOX(hbox), table, FALSE, FALSE, 0); + gtk_table_set_col_spacings(GTK_TABLE(table), 6); + gtk_table_set_row_spacings(GTK_TABLE(table), 3); + + ghid_table_spin_button(table, 0, 0, &config_text_spin_button, + Settings.TextScale, + MIN_TEXTSCALE, MAX_TEXTSCALE, 10.0, 10.0, 0, 0, text_spin_button_cb, &Settings.TextScale, FALSE, "%"); + + + /* ---- DRC Sizes ---- */ + vbox = ghid_category_vbox(config_sizes_vbox, _("Design Rule Checking"), 4, 2, TRUE, TRUE); + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + table = gtk_table_new(4, 2, FALSE); + gtk_box_pack_start(GTK_BOX(hbox), table, FALSE, FALSE, 0); + gtk_table_set_col_spacings(GTK_TABLE(table), 6); + gtk_table_set_row_spacings(GTK_TABLE(table), 3); + + ghid_table_coord_entry(table, 0, 0, NULL, + PCB->Bloat, MIN_DRC_VALUE, MAX_DRC_VALUE, + CE_SMALL, 0, coord_entry_cb, &PCB->Bloat, FALSE, _("Minimum copper spacing")); + + ghid_table_coord_entry(table, 1, 0, NULL, + PCB->minWid, MIN_DRC_VALUE, MAX_DRC_VALUE, + CE_SMALL, 0, coord_entry_cb, &PCB->minWid, FALSE, _("Minimum copper width")); + + ghid_table_coord_entry(table, 2, 0, NULL, + PCB->Shrink, MIN_DRC_VALUE, MAX_DRC_VALUE, + CE_SMALL, 0, coord_entry_cb, &PCB->Shrink, FALSE, _("Minimum touching copper overlap")); + + ghid_table_coord_entry(table, 3, 0, NULL, + PCB->minSlk, MIN_DRC_VALUE, MAX_DRC_VALUE, + CE_SMALL, 0, coord_entry_cb, &PCB->minSlk, FALSE, _("Minimum silk width")); + + ghid_table_coord_entry(table, 4, 0, NULL, + PCB->minDrill, MIN_DRC_VALUE, MAX_DRC_VALUE, + CE_SMALL, 0, coord_entry_cb, &PCB->minDrill, FALSE, _("Minimum drill diameter")); + + ghid_table_coord_entry(table, 5, 0, NULL, + PCB->minRing, MIN_DRC_VALUE, MAX_DRC_VALUE, + CE_SMALL, 0, coord_entry_cb, &PCB->minRing, FALSE, _("Minimum annular ring")); + + ghid_check_button_connected(vbox, &use_drc_sizes_default_button, FALSE, + TRUE, FALSE, FALSE, 0, NULL, NULL, _("Use DRC values as the default for new layouts")); + + gtk_widget_show_all(config_sizes_vbox); +} + + + /* -------------- The Increments config page ---------------- + */ + /* Increment/decrement values are kept in mil and mm units and not in + | PCB units. + */ +static GtkWidget *config_increments_vbox, *config_increments_tab_vbox; + +static void increment_spin_button_cb(GHidCoordEntry * ce, void *dst) +{ + *(Coord *) dst = ghid_coord_entry_get_value(ce); + ghidgui->config_modified = TRUE; +} + +static void config_increments_tab_create(GtkWidget * tab_vbox) +{ + GtkWidget *vbox; + Coord *target; + + /* Need a vbox we can destroy if user changes grid units. + */ + if (!config_increments_vbox) { + vbox = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(tab_vbox), vbox, FALSE, FALSE, 0); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); + config_increments_vbox = vbox; + config_increments_tab_vbox = tab_vbox; + } + + /* ---- Grid Increment/Decrement ---- */ + vbox = ghid_category_vbox(config_increments_vbox, _("Grid Increment/Decrement"), 4, 2, TRUE, TRUE); + + target = &Settings.increments->grid; + ghid_coord_entry(vbox, NULL, + Settings.increments->grid, + Settings.increments->grid_min, + Settings.increments->grid_max, + CE_SMALL, 0, increment_spin_button_cb, target, FALSE, _("For 'g' and 'g' grid change actions")); + + + /* ---- Size Increment/Decrement ---- */ + vbox = ghid_category_vbox(config_increments_vbox, _("Size Increment/Decrement"), 4, 2, TRUE, TRUE); + + target = &Settings.increments->size; + ghid_coord_entry(vbox, NULL, + Settings.increments->size, + Settings.increments->size_min, + Settings.increments->size_max, + CE_SMALL, 0, increment_spin_button_cb, + target, FALSE, + _("For 's' and 's' size change actions on lines,\n" + "pads, pins and text.\n" "Use 's' and 's' for drill holes.")); + + /* ---- Line Increment/Decrement ---- */ + vbox = ghid_category_vbox(config_increments_vbox, _("Line Increment/Decrement"), 4, 2, TRUE, TRUE); + + target = &Settings.increments->line; + ghid_coord_entry(vbox, NULL, + Settings.increments->line, + Settings.increments->line_min, + Settings.increments->line_max, + CE_SMALL, 0, increment_spin_button_cb, + target, FALSE, _("For 'l' and 'l' routing line width change actions")); + + /* ---- Clear Increment/Decrement ---- */ + vbox = ghid_category_vbox(config_increments_vbox, _("Clear Increment/Decrement"), 4, 2, TRUE, TRUE); + + target = &Settings.increments->clear; + ghid_coord_entry(vbox, NULL, + Settings.increments->clear, + Settings.increments->clear_min, + Settings.increments->clear_max, + CE_SMALL, 0, increment_spin_button_cb, + target, FALSE, _("For 'k' and 'k' line clearance inside polygon size\n" "change actions")); + + gtk_widget_show_all(config_increments_vbox); +} + + /* -------------- The Library config page ---------------- + */ +static GtkWidget *library_newlib_entry; + +static void config_library_apply(void) +{ + if (dup_string(&lib_newlib_config, ghid_entry_get_text(library_newlib_entry))) + ghidgui->config_modified = TRUE; +} + +static void config_library_tab_create(GtkWidget * tab_vbox) +{ + GtkWidget *vbox, *label, *entry; + + gtk_container_set_border_width(GTK_CONTAINER(tab_vbox), 6); + vbox = ghid_category_vbox(tab_vbox, _("Element Directories"), 4, 2, TRUE, TRUE); + label = gtk_label_new(""); + gtk_label_set_use_markup(GTK_LABEL(label), TRUE); + gtk_label_set_markup(GTK_LABEL(label), + _ + ("Enter a \"" + PCB_PATH_DELIMETER + "\" separated list of custom top level\n" + "element directories. For example:\n" + "\t~/gaf/pcb-elements" + PCB_PATH_DELIMETER + "packages" + PCB_PATH_DELIMETER + "/usr/local/pcb-elements\n" + "Elements should be organized into subdirectories below each\n" + "top level directory. Restart program for changes to take effect." "")); + + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); + entry = gtk_entry_new(); + library_newlib_entry = entry; + gtk_entry_set_text(GTK_ENTRY(entry), lib_newlib_config); + gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 4); +} + + + /* -------------- The Layers Group config page ---------------- + */ +static GtkWidget *config_groups_table, *config_groups_vbox, *config_groups_window; + +static GtkWidget *layer_entry[MAX_LAYER]; +static GtkWidget *group_button[MAX_LAYER + 2][MAX_LAYER]; + +#if FIXME +static GtkWidget *use_layer_default_button; +#endif + +static gint config_layer_group[MAX_LAYER + 2]; + +static LayerGroupType layer_groups, /* Working copy */ + *lg_monitor; /* Keep track if our working copy */ + /* needs to be changed (new layout) */ + +static gboolean groups_modified, groups_holdoff, layers_applying; + +static gchar *layer_info_text[] = { + N_("Layer Names\n"), + N_("You may enter layer names for the layers drawn on the screen.\n" + "The special 'component side' and 'solder side' are layers which\n" + "will be printed out, so they must have in their group at least one\n" + "of the other layers that are drawn on the screen.\n"), + "\n", + N_("Layer Groups\n"), + N_("Each layer on the screen may be in its own group which allows the\n" + "maximum number of board layers. However, for boards with fewer\n" + "layers, you may group layers together which will then print as a\n" + "single layer on a printout. This allows a visual color distinction\n" + "to be displayed on the screen for signal groups which will print as\n" "a single layer\n"), + "\n", + N_("For example, for a 4 layer board a useful layer group arrangement\n" + "can be to have 3 screen displayed layers grouped into the same group\n" + "as the 'component side' and 'solder side' printout layers. Then\n" + "groups such as signals, ground, and supply traces can be color\n" + "coded on the screen while printing as a single layer. For this\n" + "you would select buttons and enter names on the Setup page to\n" "structure four layer groups similar to this:\n"), + "\n", + N_("Group 1:"), + "\n\t", + N_("solder"), + "\n\t", + N_("GND-solder"), + "\n\t", + N_("Vcc-solder"), + "\n\t", + N_("solder side"), + "\n", + N_("Group 2:"), + "\n\t", + N_("component"), + "\n\t", + N_("GND-component"), + "\n\t", + N_("Vcc-component"), + "\n\t", + N_("component side"), + "\n", + N_("Group 3:"), + "\n\t", + N_("signal1"), + "\n", + N_("Group 4:"), + "\n\t", + N_("signal2"), + "\n" +}; + +static void config_layer_groups_radio_button_cb(GtkToggleButton * button, gpointer data) +{ + gint layer = GPOINTER_TO_INT(data) >> 8; + gint group = GPOINTER_TO_INT(data) & 0xff; + + if (!gtk_toggle_button_get_active(button) || groups_holdoff) + return; + config_layer_group[layer] = group; + groups_modified = TRUE; + ghidgui->config_modified = TRUE; +} + + /* Construct a layer group string. Follow logic in WritePCBDataHeader(), + | but use g_string functions. + */ +static gchar *make_layer_group_string(LayerGroupType * lg) +{ + GString *string; + gint group, entry, layer; + + string = g_string_new(""); + + for (group = 0; group < max_group; group++) { + if (lg->Number[group] == 0) + continue; + for (entry = 0; entry < lg->Number[group]; entry++) { + layer = lg->Entries[group][entry]; + if (layer == component_silk_layer) + string = g_string_append(string, "c"); + else if (layer == solder_silk_layer) + string = g_string_append(string, "s"); + else + g_string_append_printf(string, "%d", layer + 1); + + if (entry != lg->Number[group] - 1) + string = g_string_append(string, ","); + } + if (group != max_group - 1) + string = g_string_append(string, ":"); + } + return g_string_free(string, FALSE); /* Don't free string->str */ +} + +static void config_layers_apply(void) +{ + LayerType *layer; + gchar *s; + gint group, i; + gint componentgroup = 0, soldergroup = 0; + gboolean use_as_default = FALSE, layers_modified = FALSE; + +#if FIXME + use_as_default = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(use_layer_default_button)); +#endif + + /* Get each layer name entry and dup if modified into the PCB layer names + | and, if to use as default, the Settings layer names. + */ + for (i = 0; i < max_copper_layer; ++i) { + layer = &PCB->Data->Layer[i]; + s = ghid_entry_get_text(layer_entry[i]); + if (dup_string(&layer->Name, s)) + layers_modified = TRUE; +/* FIXME */ + if (use_as_default && dup_string(&Settings.DefaultLayerName[i], s)) + ghidgui->config_modified = TRUE; + + } + /* Layer names can be changed from the menus and that can update the + | config. So holdoff the loop. + */ + layers_applying = TRUE; + if (layers_modified) + ghid_layer_buttons_update(); + layers_applying = FALSE; + + if (groups_modified) { /* If any group radio buttons were toggled. */ + /* clear all entries and read layer by layer + */ + for (group = 0; group < max_group; group++) + layer_groups.Number[group] = 0; + + for (i = 0; i < max_copper_layer + 2; i++) { + group = config_layer_group[i] - 1; + layer_groups.Entries[group][layer_groups.Number[group]++] = i; + + if (i == component_silk_layer) + componentgroup = group; + else if (i == solder_silk_layer) + soldergroup = group; + } + + /* do some cross-checking + | solder-side and component-side must be in different groups + | solder-side and component-side must not be the only one in the group + */ + if (layer_groups.Number[soldergroup] <= 1 || layer_groups.Number[componentgroup] <= 1) { + Message(_("Both 'solder side' or 'component side' layers must have at least\n" "\tone other layer in their group.\n")); + return; + } + else if (soldergroup == componentgroup) { + Message(_("The 'solder side' and 'component side' layers are not allowed\n" "\tto be in the same layer group #\n")); + return; + } + PCB->LayerGroups = layer_groups; + ghid_invalidate_all(); + groups_modified = FALSE; + } + if (use_as_default) { + s = make_layer_group_string(&PCB->LayerGroups); + if (dup_string(&Settings.Groups, s)) { + ParseGroupString(Settings.Groups, &Settings.LayerGroups, max_copper_layer); + ghidgui->config_modified = TRUE; + } + g_free(s); + } +} + +static void config_layer_group_button_state_update(void) +{ + gint g, i; + + /* Set button active corresponding to layer group state. + */ + groups_holdoff = TRUE; + for (g = 0; g < max_group; g++) + for (i = 0; i < layer_groups.Number[g]; i++) { +/* printf("layer %d in group %d\n", layer_groups.Entries[g][i], g +1); */ + config_layer_group[layer_groups.Entries[g][i]] = g + 1; + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(group_button[layer_groups.Entries[g][i]][g]), TRUE); + } + groups_holdoff = FALSE; +} + +static void layer_name_entry_cb(GtkWidget * entry, gpointer data) +{ + gint i = GPOINTER_TO_INT(data); + LayerType *layer; + gchar *name; + + layer = &PCB->Data->Layer[i]; + name = ghid_entry_get_text(entry); + if (dup_string(&layer->Name, name)) + ghid_layer_buttons_update(); +} + +void ghid_config_groups_changed(void) +{ + GtkWidget *vbox, *table, *button, *label, *scrolled_window; + GSList *group; + gchar buf[32], *name; + gint layer, i; + + if (!config_groups_vbox) + return; + vbox = config_groups_vbox; + + if (config_groups_table) + gtk_widget_destroy(config_groups_table); + if (config_groups_window) + gtk_widget_destroy(config_groups_window); + + config_groups_window = scrolled_window = gtk_scrolled_window_new(NULL, NULL); + gtk_widget_set_size_request(scrolled_window, 34, 408); + gtk_container_set_border_width(GTK_CONTAINER(scrolled_window), 3); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); + gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0); + gtk_widget_show(scrolled_window); + + + table = gtk_table_new(max_copper_layer + 3, max_group + 1, FALSE); + config_groups_table = table; + gtk_table_set_row_spacings(GTK_TABLE(table), 3); + gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window), table); + gtk_widget_show(table); + + layer_groups = PCB->LayerGroups; /* working copy */ + lg_monitor = &PCB->LayerGroups; /* So can know if PCB changes on us */ + + label = gtk_label_new(_("Group #")); + gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); + gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); + + for (i = 1; i < max_group + 1; ++i) { + if (i < 10) + snprintf(buf, sizeof(buf), " %d", i); + else + snprintf(buf, sizeof(buf), "%d", i); + label = gtk_label_new(buf); + gtk_table_attach_defaults(GTK_TABLE(table), label, i, i + 1, 0, 1); + } + + /* Create a row of radio toggle buttons for layer. So each layer + | can have an active radio button set for the group it needs to be in. + */ + for (layer = 0; layer < max_copper_layer + 2; ++layer) { + if (layer == component_silk_layer) + name = _("component side"); + else if (layer == solder_silk_layer) + name = _("solder side"); + else + name = (gchar *) UNKNOWN(PCB->Data->Layer[layer].Name); + + if (layer >= max_copper_layer) { + label = gtk_label_new(name); + gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); + gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, layer + 1, layer + 2); + } + else { + layer_entry[layer] = gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(layer_entry[layer]), name); + gtk_table_attach_defaults(GTK_TABLE(table), layer_entry[layer], 0, 1, layer + 1, layer + 2); + g_signal_connect(G_OBJECT(layer_entry[layer]), "activate", G_CALLBACK(layer_name_entry_cb), GINT_TO_POINTER(layer)); + } + + group = NULL; + for (i = 0; i < max_group; ++i) { + snprintf(buf, sizeof(buf), "%2.2d", i + 1); + button = gtk_radio_button_new_with_label(group, buf); + + gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button), FALSE); + group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button)); + gtk_table_attach_defaults(GTK_TABLE(table), button, i + 1, i + 2, layer + 1, layer + 2); + g_signal_connect(G_OBJECT(button), "toggled", + G_CALLBACK(config_layer_groups_radio_button_cb), GINT_TO_POINTER((layer << 8) | (i + 1))); + group_button[layer][i] = button; + } + } + gtk_widget_show_all(config_groups_vbox); + config_layer_group_button_state_update(); +} + + +static void edit_layer_button_cb(GtkWidget * widget, gchar * data) +{ + gchar **argv; + + if (PCB->RatDraw || PCB->SilkActive) + return; + + argv = g_strsplit(data, ",", -1); + MoveLayerAction(2, argv, 0, 0); + g_strfreev(argv); +} + +static void config_layers_tab_create(GtkWidget * tab_vbox) +{ + GtkWidget *tabs, *vbox, *vbox1, *button, *text, *sep; + GtkWidget *hbox, *arrow; + gint i; + + tabs = gtk_notebook_new(); + gtk_box_pack_start(GTK_BOX(tab_vbox), tabs, TRUE, TRUE, 0); + +/* -- Change tab */ + vbox = ghid_notebook_page(tabs, _("Change"), 0, 6); + vbox1 = ghid_category_vbox(vbox, _("Operations on currently selected layer:"), 4, 2, TRUE, TRUE); + + button = gtk_button_new(); + arrow = gtk_arrow_new(GTK_ARROW_UP, GTK_SHADOW_ETCHED_IN); + gtk_container_add(GTK_CONTAINER(button), arrow); + g_signal_connect(G_OBJECT(button), (gchar *) "clicked", G_CALLBACK(edit_layer_button_cb), (gchar *) "c,up"); + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox1), hbox, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + + button = gtk_button_new(); + arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_ETCHED_IN); + gtk_container_add(GTK_CONTAINER(button), arrow); + g_signal_connect(G_OBJECT(button), (gchar *) "clicked", G_CALLBACK(edit_layer_button_cb), (gchar *) "c,down"); + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox1), hbox, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + + button = gtk_button_new_from_stock(GTK_STOCK_DELETE); + g_signal_connect(G_OBJECT(button), (gchar *) "clicked", G_CALLBACK(edit_layer_button_cb), (gchar *) "c,-1"); + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox1), hbox, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + + vbox1 = ghid_category_vbox(vbox, _("Add new layer above currently selected layer:"), 4, 2, TRUE, TRUE); + button = gtk_button_new_from_stock(GTK_STOCK_ADD); + g_signal_connect(G_OBJECT(button), (gchar *) "clicked", G_CALLBACK(edit_layer_button_cb), (gchar *) "-1,c"); + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox1), hbox, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + +/* -- Groups tab */ + vbox = ghid_notebook_page(tabs, _("Groups"), 0, 6); + config_groups_vbox = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), config_groups_vbox, FALSE, FALSE, 0); + ghid_config_groups_changed(); + + sep = gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 4); + +#if FIXME + ghid_check_button_connected(vbox, &use_layer_default_button, FALSE, + TRUE, FALSE, FALSE, 8, NULL, NULL, ("Use these layer settings as the default for new layouts")); +#endif + + +/* -- Info tab */ + vbox = ghid_notebook_page(tabs, _("Info"), 0, 6); + + text = ghid_scrolled_text_view(vbox, NULL, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + for (i = 0; i < sizeof(layer_info_text) / sizeof(gchar *); ++i) + ghid_text_view_append(text, _(layer_info_text[i])); +} + + +void ghid_config_layer_name_update(gchar * name, gint layer) +{ + if (!config_window || layers_applying || !name) + return; + gtk_entry_set_text(GTK_ENTRY(layer_entry[layer]), name); + + /* If we get a config layer name change because a new PCB is loaded + | or new layout started, need to change our working layer group copy. + */ + if (lg_monitor != &PCB->LayerGroups) { + layer_groups = PCB->LayerGroups; + lg_monitor = &PCB->LayerGroups; + config_layer_group_button_state_update(); + groups_modified = FALSE; + } +} + + /* -------------- The Colors config page ---------------- + */ +static GtkWidget *config_colors_vbox, + *config_colors_tab_vbox, *config_colors_save_button, *config_color_file_label, *config_color_warn_label; + +static void config_colors_tab_create(GtkWidget * tab_vbox); + +static gboolean config_colors_modified; + +static void config_color_file_set_label(void) +{ + gchar *str, *name; + + if (!*color_file) + name = g_strdup("defaults"); + else + name = g_path_get_basename(color_file); + + str = g_strdup_printf(_("Current colors loaded: %s"), name); + gtk_label_set_markup(GTK_LABEL(config_color_file_label), str); + g_free(name); + g_free(str); +} + +static void config_color_defaults_cb(gpointer data) +{ + GList *list; + ConfigColor *cc; + HID_Attribute *ha; + + for (list = config_color_list; list; list = list->next) { + cc = (ConfigColor *) list->data; + ha = cc->attributes; + dup_string((char **) ha->value, ha->default_val.str_value); + cc->color_is_mapped = FALSE; + ghid_set_special_colors(ha); + } + + dup_string(&color_file, ""); + ghidgui->config_modified = TRUE; + + gtk_widget_set_sensitive(config_colors_save_button, FALSE); + gtk_widget_set_sensitive(config_color_warn_label, FALSE); + config_color_file_set_label(); + config_colors_modified = FALSE; + + ghid_layer_buttons_color_update(); + + /* Receate the colors config page to pick up new colors. + */ + gtk_widget_destroy(config_colors_vbox); + config_colors_tab_create(config_colors_tab_vbox); + + ghid_invalidate_all(); +} + +static void config_color_load_cb(gpointer data) +{ + gchar *path, *dir = g_strdup(color_dir); + + path = ghid_dialog_file_select_open(_("Load Color File"), &dir, NULL); + if (path) { + config_colors_read(path); + dup_string(&color_file, path); + ghidgui->config_modified = TRUE; + + gtk_widget_set_sensitive(config_colors_save_button, FALSE); + gtk_widget_set_sensitive(config_color_warn_label, FALSE); + config_color_file_set_label(); + config_colors_modified = FALSE; + } + g_free(path); + g_free(dir); + + /* Receate the colors config page to pick up new colors. + */ + gtk_widget_destroy(config_colors_vbox); + config_colors_tab_create(config_colors_tab_vbox); + + ghid_layer_buttons_color_update(); + ghid_invalidate_all(); +} + +static void config_color_save_cb(gpointer data) +{ + gchar *name, *path, *dir = g_strdup(color_dir); + + path = ghid_dialog_file_select_save(_("Save Color File"), &dir, NULL, NULL); + if (path) { + name = g_path_get_basename(path); + if (!strcmp(name, "default")) + ghid_dialog_message(_("Sorry, not overwriting the default color file!")); + else { + config_colors_write(path); + dup_string(&color_file, path); + ghidgui->config_modified = TRUE; + + gtk_widget_set_sensitive(config_colors_save_button, FALSE); + gtk_widget_set_sensitive(config_color_warn_label, FALSE); + config_color_file_set_label(); + config_colors_modified = FALSE; + } + g_free(name); + } + g_free(path); + g_free(dir); +} + +static void config_color_set_cb(GtkWidget * button, ConfigColor * cc) +{ + GdkColor new_color; + HID_Attribute *ha = cc->attributes; + gchar *str; + + gtk_color_button_get_color(GTK_COLOR_BUTTON(button), &new_color); + str = ghid_get_color_name(&new_color); + ghid_map_color_string(str, &cc->color); + *(char **) ha->value = str; +/* g_free(str); Memory leak */ + + config_colors_modified = TRUE; + gtk_widget_set_sensitive(config_colors_save_button, TRUE); + gtk_widget_set_sensitive(config_color_warn_label, TRUE); + + ghid_set_special_colors(ha); + ghid_layer_buttons_color_update(); + ghid_invalidate_all(); +} + +static void config_color_button_create(GtkWidget * box, ConfigColor * cc) +{ + GtkWidget *button, *hbox, *label; + HID_Attribute *ha = cc->attributes; + gchar *title; + + hbox = gtk_hbox_new(FALSE, 6); + gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); + + if (!cc->color_is_mapped) + ghid_map_color_string(*(char **) ha->value, &cc->color); + cc->color_is_mapped = TRUE; + + title = g_strdup_printf(_("PCB %s Color"), ha->name); + button = gtk_color_button_new_with_color(&cc->color); + gtk_color_button_set_title(GTK_COLOR_BUTTON(button), title); + g_free(title); + + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + label = gtk_label_new(ha->name); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + g_signal_connect(G_OBJECT(button), "color-set", G_CALLBACK(config_color_set_cb), cc); +} + +static void config_colors_tab_create(GtkWidget * tab_vbox) +{ + GtkWidget *scrolled_vbox, *vbox, *hbox, *expander, *sep; + GList *list; + ConfigColor *cc; + + vbox = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(tab_vbox), vbox, TRUE, TRUE, 0); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); + + config_colors_vbox = vbox; /* can be destroyed if color file loaded */ + config_colors_tab_vbox = tab_vbox; + + scrolled_vbox = ghid_scrolled_vbox(config_colors_vbox, NULL, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + + /* ---- Main colors ---- */ + expander = gtk_expander_new(_("Main colors")); + gtk_box_pack_start(GTK_BOX(scrolled_vbox), expander, FALSE, FALSE, 2); + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(expander), vbox); + vbox = ghid_category_vbox(vbox, NULL, 0, 2, TRUE, FALSE); + + for (list = config_color_list; list; list = list->next) { + cc = (ConfigColor *) list->data; + if (cc->type != MISC_COLOR) + continue; + config_color_button_create(vbox, cc); + } + + /* ---- Layer colors ---- */ + expander = gtk_expander_new(_("Layer colors")); + gtk_box_pack_start(GTK_BOX(scrolled_vbox), expander, FALSE, FALSE, 2); + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(expander), vbox); + vbox = ghid_category_vbox(vbox, NULL, 0, 2, TRUE, FALSE); + + for (list = config_color_list; list; list = list->next) { + cc = (ConfigColor *) list->data; + if (cc->type != LAYER_COLOR) + continue; + config_color_button_create(vbox, cc); + } + + /* ---- Selected colors ---- */ + expander = gtk_expander_new(_("Selected colors")); + gtk_box_pack_start(GTK_BOX(scrolled_vbox), expander, FALSE, FALSE, 2); + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(expander), vbox); + vbox = ghid_category_vbox(vbox, NULL, 0, 2, TRUE, FALSE); + + for (list = config_color_list; list; list = list->next) { + cc = (ConfigColor *) list->data; + if (cc->type != MISC_SELECTED_COLOR) + continue; + config_color_button_create(vbox, cc); + } + sep = gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 2); + for (list = config_color_list; list; list = list->next) { + cc = (ConfigColor *) list->data; + if (cc->type != LAYER_SELECTED_COLOR) + continue; + config_color_button_create(vbox, cc); + } + + config_color_warn_label = gtk_label_new(""); + gtk_label_set_use_markup(GTK_LABEL(config_color_warn_label), TRUE); + gtk_label_set_markup(GTK_LABEL(config_color_warn_label), + _("Warning: unsaved color changes will be lost" " at program exit.")); + gtk_box_pack_start(GTK_BOX(config_colors_vbox), config_color_warn_label, FALSE, FALSE, 4); + + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(config_colors_vbox), hbox, FALSE, FALSE, 6); + + config_color_file_label = gtk_label_new(""); + gtk_label_set_use_markup(GTK_LABEL(config_color_file_label), TRUE); + config_color_file_set_label(); + gtk_box_pack_start(GTK_BOX(hbox), config_color_file_label, FALSE, FALSE, 0); + + ghid_button_connected(hbox, NULL, FALSE, FALSE, FALSE, 4, config_color_load_cb, NULL, _("Load")); + ghid_button_connected(hbox, &config_colors_save_button, FALSE, FALSE, FALSE, 4, config_color_save_cb, NULL, _("Save")); + ghid_button_connected(hbox, NULL, FALSE, FALSE, FALSE, 4, config_color_defaults_cb, NULL, _("Defaults")); + + gtk_widget_set_sensitive(config_colors_save_button, config_colors_modified); + gtk_widget_set_sensitive(config_color_warn_label, config_colors_modified); + gtk_widget_show_all(config_colors_vbox); +} + + + /* --------------- The main config page ----------------- + */ +enum { + CONFIG_NAME_COLUMN, + CONFIG_PAGE_COLUMN, + N_CONFIG_COLUMNS +}; + +static GtkNotebook *config_notebook; + +static GtkWidget *config_page_create(GtkTreeStore * tree, GtkTreeIter * iter, GtkNotebook * notebook) +{ + GtkWidget *vbox; + gint page; + + vbox = gtk_vbox_new(FALSE, 0); + gtk_notebook_append_page(notebook, vbox, NULL); + page = gtk_notebook_get_n_pages(notebook) - 1; + gtk_tree_store_set(tree, iter, CONFIG_PAGE_COLUMN, page, -1); + return vbox; +} + +void ghid_config_handle_units_changed(void) +{ + gchar *text = pcb_g_strdup_printf("%s", + Settings.grid_unit->in_suffix); + ghid_set_cursor_position_labels(); + gtk_label_set_markup(GTK_LABEL(ghidgui->grid_units_label), text); + g_free(text); + + if (config_sizes_vbox) { + gtk_widget_destroy(config_sizes_vbox); + config_sizes_vbox = NULL; + config_sizes_tab_create(config_sizes_tab_vbox); + } + if (config_increments_vbox) { + gtk_widget_destroy(config_increments_vbox); + config_increments_vbox = NULL; + config_increments_tab_create(config_increments_tab_vbox); + } + ghidgui->config_modified = TRUE; +} + +void ghid_config_text_scale_update(void) +{ + if (config_window) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(config_text_spin_button), (gdouble) Settings.TextScale); +} + +static void config_close_cb(gpointer data) +{ + /* Config pages may need to check for modified entries, use as default + | options, etc when the config window is closed. + */ + config_sizes_apply(); + config_layers_apply(); + config_library_apply(); + config_general_apply(); + + config_sizes_vbox = NULL; + config_increments_vbox = NULL; + + config_groups_vbox = config_groups_table = NULL; + config_groups_window = NULL; + + gtk_widget_destroy(config_window); + config_window = NULL; +} + +static void config_destroy_cb(gpointer data) +{ + config_sizes_vbox = NULL; + config_increments_vbox = NULL; + config_groups_vbox = config_groups_table = NULL; + config_groups_window = NULL; + gtk_widget_destroy(config_window); + config_window = NULL; +} + +static void config_selection_changed_cb(GtkTreeSelection * selection, gpointer data) +{ + GtkTreeIter iter; + GtkTreeModel *model; + gint page; + + if (!gtk_tree_selection_get_selected(selection, &model, &iter)) + return; + gtk_tree_model_get(model, &iter, CONFIG_PAGE_COLUMN, &page, -1); + gtk_notebook_set_current_page(config_notebook, page); +} + +void ghid_config_window_show(void) +{ + GtkWidget *widget, *main_vbox, *vbox, *config_hbox, *hbox; + GtkWidget *scrolled; + GtkWidget *button; + GtkTreeStore *model; + GtkTreeView *treeview; + GtkTreeIter iter; + GtkCellRenderer *renderer; + GtkTreeViewColumn *column; + GtkTreeSelection *select; + + if (config_window) { + gtk_window_present(GTK_WINDOW(config_window)); + return; + } + + config_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + g_signal_connect(G_OBJECT(config_window), "delete_event", G_CALLBACK(config_destroy_cb), NULL); + + gtk_window_set_title(GTK_WINDOW(config_window), _("PCB Preferences")); + gtk_window_set_wmclass(GTK_WINDOW(config_window), "Pcb_Conf", "PCB"); + gtk_container_set_border_width(GTK_CONTAINER(config_window), 2); + + config_hbox = gtk_hbox_new(FALSE, 4); + gtk_container_add(GTK_CONTAINER(config_window), config_hbox); + + scrolled = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + gtk_box_pack_start(GTK_BOX(config_hbox), scrolled, FALSE, FALSE, 0); + + main_vbox = gtk_vbox_new(FALSE, 4); + gtk_box_pack_start(GTK_BOX(config_hbox), main_vbox, TRUE, TRUE, 0); + + widget = gtk_notebook_new(); + gtk_box_pack_start(GTK_BOX(main_vbox), widget, TRUE, TRUE, 0); + config_notebook = GTK_NOTEBOOK(widget); + gtk_notebook_set_show_tabs(config_notebook, FALSE); + + model = gtk_tree_store_new(N_CONFIG_COLUMNS, G_TYPE_STRING, G_TYPE_INT); + + + /* -- General -- */ + gtk_tree_store_append(model, &iter, NULL); + gtk_tree_store_set(model, &iter, CONFIG_NAME_COLUMN, _("General"), -1); + vbox = config_page_create(model, &iter, config_notebook); + config_general_tab_create(vbox); + + + /* -- Sizes -- */ + gtk_tree_store_append(model, &iter, NULL); + gtk_tree_store_set(model, &iter, CONFIG_NAME_COLUMN, _("Sizes"), -1); + vbox = config_page_create(model, &iter, config_notebook); + config_sizes_tab_create(vbox); + + /* -- Increments -- */ + gtk_tree_store_append(model, &iter, NULL); + gtk_tree_store_set(model, &iter, CONFIG_NAME_COLUMN, _("Increments"), -1); + vbox = config_page_create(model, &iter, config_notebook); + config_increments_tab_create(vbox); + + /* -- Library -- */ + gtk_tree_store_append(model, &iter, NULL); + gtk_tree_store_set(model, &iter, CONFIG_NAME_COLUMN, _("Library"), -1); + vbox = config_page_create(model, &iter, config_notebook); + config_library_tab_create(vbox); + + /* -- Layer names and groups -- */ + gtk_tree_store_append(model, &iter, NULL); + gtk_tree_store_set(model, &iter, CONFIG_NAME_COLUMN, _("Layers"), -1); + vbox = config_page_create(model, &iter, config_notebook); + config_layers_tab_create(vbox); + + + /* -- Colors -- */ + gtk_tree_store_append(model, &iter, NULL); + gtk_tree_store_set(model, &iter, CONFIG_NAME_COLUMN, _("Colors"), -1); + vbox = config_page_create(model, &iter, config_notebook); + config_colors_tab_create(vbox); + + + /* Create the tree view + */ + treeview = GTK_TREE_VIEW(gtk_tree_view_new_with_model(GTK_TREE_MODEL(model))); + g_object_unref(G_OBJECT(model)); /* Don't need the model anymore */ + + renderer = gtk_cell_renderer_text_new(); + column = gtk_tree_view_column_new_with_attributes(NULL, renderer, "text", CONFIG_NAME_COLUMN, NULL); + gtk_tree_view_append_column(treeview, column); + gtk_container_add(GTK_CONTAINER(scrolled), GTK_WIDGET(treeview)); + + + select = gtk_tree_view_get_selection(treeview); + gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE); + g_signal_connect(G_OBJECT(select), "changed", G_CALLBACK(config_selection_changed_cb), NULL); + + + hbox = gtk_hbutton_box_new(); + gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END); + gtk_box_set_spacing(GTK_BOX(hbox), 5); + gtk_box_pack_start(GTK_BOX(main_vbox), hbox, FALSE, FALSE, 0); + + button = gtk_button_new_from_stock(GTK_STOCK_OK); + gtk_widget_set_can_default(button, TRUE); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(config_close_cb), NULL); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + gtk_widget_grab_default(button); + + gtk_widget_show_all(config_window); +} Index: 1.0.8/src/hid/gtk/gui-dialog-print.c =================================================================== --- 1.0.8/src/hid/gtk/gui-dialog-print.c (nonexistent) +++ 1.0.8/src/hid/gtk/gui-dialog-print.c (revision 1136) @@ -0,0 +1,409 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* This file written by Bill Wilson for the PCB Gtk port. */ + +#include "config.h" + +#ifdef HAVE_STDLIB_H +#include +#endif + +#include "gui.h" +#include "pcb-printf.h" + + +RCSID("$Id$"); + +static GtkWidget *export_dialog = NULL; + +static void set_flag_cb(GtkToggleButton * button, void *flag) +{ + *(gboolean *) flag = gtk_toggle_button_get_active(button); +} + + +static void intspinner_changed_cb(GtkSpinButton * spin_button, gpointer data) +{ + int *ival = (int *) data; + + *ival = gtk_spin_button_get_value(GTK_SPIN_BUTTON((GtkWidget *) spin_button)); +} + +static void coordentry_changed_cb(GtkEntry * entry, Coord * res) +{ + const gchar *s = gtk_entry_get_text(entry); + *res = GetValue(s, NULL, NULL); +} + +static void dblspinner_changed_cb(GtkSpinButton * spin_button, gpointer data) +{ + double *dval = (double *) data; + + *dval = gtk_spin_button_get_value(GTK_SPIN_BUTTON((GtkWidget *) spin_button)); +} + + +static void entry_changed_cb(GtkEntry * entry, char **str) +{ + const gchar *s; + + s = gtk_entry_get_text(entry); + + if (*str) + free(*str); + *str = strdup(s); +} + +static void enum_changed_cb(GtkWidget * combo_box, int *val) +{ + gint active; + + active = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box)); + *val = active; +} + + +int ghid_attribute_dialog(HID_Attribute * attrs, int n_attrs, HID_Attr_Val * results, const char *title, const char *descr) +{ + GtkWidget *dialog; + GtkWidget *content_area; + GtkWidget *main_vbox, *vbox, *vbox1, *hbox, *entry; + GtkWidget *combo; + GtkWidget *widget; + GHidPort *out = &ghid_port; + int i, j, n; + int rc = 0; + + dialog = gtk_dialog_new_with_buttons(_(title), + GTK_WINDOW(out->top_window), + (GtkDialogFlags) (GTK_DIALOG_MODAL + | GTK_DIALOG_DESTROY_WITH_PARENT), + GTK_STOCK_CANCEL, GTK_RESPONSE_NONE, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); + gtk_window_set_wmclass(GTK_WINDOW(dialog), "PCB_attribute_editor", "PCB"); + + content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); + + main_vbox = gtk_vbox_new(FALSE, 6); + gtk_container_set_border_width(GTK_CONTAINER(main_vbox), 6); + gtk_container_add(GTK_CONTAINER(content_area), main_vbox); + + vbox = ghid_category_vbox(main_vbox, descr != NULL ? descr : "", 4, 2, TRUE, TRUE); + + /* + * Iterate over all the export options and build up a dialog box + * that lets us control all of the options. By doing things this + * way, any changes to the exporter HID's automatically are + * reflected in this dialog box. + */ + for (j = 0; j < n_attrs; j++) { + const Unit *unit_list; + if (attrs[j].help_text == ATTR_UNDOCUMENTED) + continue; + switch (attrs[j].type) { + case HID_Label: + widget = gtk_label_new(attrs[j].name); + gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, FALSE, 0); + gtk_widget_set_tooltip_text(widget, attrs[j].help_text); + break; + + case HID_Integer: + hbox = gtk_hbox_new(FALSE, 4); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + + /* + * FIXME + * need to pick the "digits" argument based on min/max + * values + */ + ghid_spin_button(hbox, &widget, attrs[j].default_val.int_value, + attrs[j].min_val, attrs[j].max_val, 1.0, 1.0, 0, 0, + intspinner_changed_cb, &(attrs[j].default_val.int_value), FALSE, NULL); + gtk_widget_set_tooltip_text(widget, attrs[j].help_text); + + widget = gtk_label_new(attrs[j].name); + gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0); + break; + + case HID_Coord: + hbox = gtk_hbox_new(FALSE, 4); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + + entry = ghid_coord_entry_new(attrs[j].min_val, attrs[j].max_val, + attrs[j].default_val.coord_value, Settings.grid_unit, CE_SMALL); + gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); + if (attrs[j].default_val.str_value != NULL) + gtk_entry_set_text(GTK_ENTRY(entry), attrs[j].default_val.str_value); + gtk_widget_set_tooltip_text(entry, attrs[j].help_text); + g_signal_connect(G_OBJECT(entry), "changed", G_CALLBACK(coordentry_changed_cb), &(attrs[j].default_val.coord_value)); + + widget = gtk_label_new(attrs[j].name); + gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0); + break; + + case HID_Real: + hbox = gtk_hbox_new(FALSE, 4); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + + /* + * FIXME + * need to pick the "digits" and step size argument more + * intelligently + */ + ghid_spin_button(hbox, &widget, attrs[j].default_val.real_value, + attrs[j].min_val, attrs[j].max_val, 0.01, 0.01, 3, + 0, dblspinner_changed_cb, &(attrs[j].default_val.real_value), FALSE, NULL); + + gtk_widget_set_tooltip_text(widget, attrs[j].help_text); + + widget = gtk_label_new(attrs[j].name); + gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0); + break; + + case HID_String: + hbox = gtk_hbox_new(FALSE, 4); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + + entry = gtk_entry_new(); + gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); + if (attrs[j].default_val.str_value != NULL) + gtk_entry_set_text(GTK_ENTRY(entry), attrs[j].default_val.str_value); + gtk_widget_set_tooltip_text(entry, attrs[j].help_text); + g_signal_connect(G_OBJECT(entry), "changed", G_CALLBACK(entry_changed_cb), &(attrs[j].default_val.str_value)); + + widget = gtk_label_new(attrs[j].name); + gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0); + break; + + case HID_Boolean: + /* put this in a check button */ + ghid_check_button_connected(vbox, &widget, + attrs[j].default_val.int_value, + TRUE, FALSE, FALSE, 0, set_flag_cb, &(attrs[j].default_val.int_value), attrs[j].name); + gtk_widget_set_tooltip_text(widget, attrs[j].help_text); + break; + + case HID_Enum: + hbox = gtk_hbox_new(FALSE, 4); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + + do_enum: + combo = gtk_combo_box_new_text(); + gtk_widget_set_tooltip_text(combo, attrs[j].help_text); + gtk_box_pack_start(GTK_BOX(hbox), combo, FALSE, FALSE, 0); + g_signal_connect(G_OBJECT(combo), "changed", G_CALLBACK(enum_changed_cb), &(attrs[j].default_val.int_value)); + + + /* + * Iterate through each value and add them to the + * combo box + */ + i = 0; + while (attrs[j].enumerations[i]) { + gtk_combo_box_append_text(GTK_COMBO_BOX(combo), attrs[j].enumerations[i]); + i++; + } + gtk_combo_box_set_active(GTK_COMBO_BOX(combo), attrs[j].default_val.int_value); + widget = gtk_label_new(attrs[j].name); + gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0); + break; + + case HID_Mixed: + hbox = gtk_hbox_new(FALSE, 4); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + + /* + * FIXME + * need to pick the "digits" and step size argument more + * intelligently + */ + ghid_spin_button(hbox, &widget, attrs[j].default_val.real_value, + attrs[j].min_val, attrs[j].max_val, 0.01, 0.01, 3, + 0, dblspinner_changed_cb, &(attrs[j].default_val.real_value), FALSE, NULL); + gtk_widget_set_tooltip_text(widget, attrs[j].help_text); + + goto do_enum; + break; + + case HID_Path: + vbox1 = ghid_category_vbox(vbox, attrs[j].name, 4, 2, TRUE, TRUE); + entry = gtk_entry_new(); + gtk_box_pack_start(GTK_BOX(vbox1), entry, FALSE, FALSE, 0); + gtk_entry_set_text(GTK_ENTRY(entry), attrs[j].default_val.str_value); + g_signal_connect(G_OBJECT(entry), "changed", G_CALLBACK(entry_changed_cb), &(attrs[j].default_val.str_value)); + + gtk_widget_set_tooltip_text(entry, attrs[j].help_text); + break; + + case HID_Unit: + unit_list = get_unit_list(); + n = get_n_units(); + + hbox = gtk_hbox_new(FALSE, 4); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + + combo = gtk_combo_box_new_text(); + gtk_widget_set_tooltip_text(combo, attrs[j].help_text); + gtk_box_pack_start(GTK_BOX(hbox), combo, FALSE, FALSE, 0); + g_signal_connect(G_OBJECT(combo), "changed", G_CALLBACK(enum_changed_cb), &(attrs[j].default_val.int_value)); + + /* + * Iterate through each value and add them to the + * combo box + */ + for (i = 0; i < n; ++i) + gtk_combo_box_append_text(GTK_COMBO_BOX(combo), unit_list[i].in_suffix); + gtk_combo_box_set_active(GTK_COMBO_BOX(combo), attrs[j].default_val.int_value); + widget = gtk_label_new(attrs[j].name); + gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0); + break; + default: + printf("%s: unknown type of HID attribute\n", __FUNCTION__); + break; + } + } + + + gtk_widget_show_all(dialog); + + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) { + /* copy over the results */ + for (i = 0; i < n_attrs; i++) { + results[i] = attrs[i].default_val; + if (results[i].str_value) + results[i].str_value = strdup(results[i].str_value); + } + rc = 0; + } + else + rc = 1; + + gtk_widget_destroy(dialog); + + return rc; +} + + + +static void exporter_clicked_cb(GtkButton * button, HID * exporter) +{ + ghid_dialog_print(exporter); +} + +void ghid_dialog_print(HID * hid) +{ + HID_Attribute *attr; + int n = 0; + int i; + HID_Attr_Val *results = NULL; + + /* signal the initial export select dialog that it should close */ + if (export_dialog) + gtk_dialog_response(GTK_DIALOG(export_dialog), GTK_RESPONSE_CANCEL); + + exporter = hid; + + attr = exporter->get_export_options(&n); + if (n > 0) { + results = (HID_Attr_Val *) malloc(n * sizeof(HID_Attr_Val)); + if (results == NULL) { + fprintf(stderr, "%s() -- malloc failed\n", __FUNCTION__); + exit(1); + } + + /* non-zero means cancel was picked */ + if (ghid_attribute_dialog(attr, n, results, _("PCB Print Layout"), exporter->description)) + return; + + } + + exporter->do_export(results); + + for (i = 0; i < n; i++) { + if (results[i].str_value) + free((void *) results[i].str_value); + } + + if (results) + free(results); + + exporter = NULL; +} + +void ghid_dialog_export(void) +{ + GtkWidget *content_area; + GtkWidget *vbox, *button; + GHidPort *out = &ghid_port; + int i; + HID **hids; + gboolean no_exporter = TRUE; + + export_dialog = gtk_dialog_new_with_buttons(_("PCB Export Layout"), + GTK_WINDOW(out->top_window), + (GtkDialogFlags) (GTK_DIALOG_MODAL + | + GTK_DIALOG_DESTROY_WITH_PARENT), + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); + gtk_window_set_wmclass(GTK_WINDOW(export_dialog), "PCB_Export", "PCB"); + + content_area = gtk_dialog_get_content_area(GTK_DIALOG(export_dialog)); + + vbox = gtk_vbox_new(FALSE, 6); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); + gtk_container_add(GTK_CONTAINER(content_area), vbox); + + /* + * Iterate over all the export HID's and build up a dialog box that + * lets us choose which one we want to use. + * This way, any additions to the exporter HID's automatically are + * reflected in this dialog box. + */ + + hids = hid_enumerate(); + for (i = 0; hids[i]; i++) { + if (hids[i]->exporter) { + no_exporter = FALSE; + button = gtk_button_new_with_label(hids[i]->name); + gtk_widget_set_tooltip_text(button, hids[i]->description); + gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(exporter_clicked_cb), hids[i]); + } + } + + if (no_exporter) { + gui->log(_("Can't find a suitable exporter HID")); + } + + gtk_widget_show_all(export_dialog); + gtk_dialog_run(GTK_DIALOG(export_dialog)); + + if (export_dialog != NULL) + gtk_widget_destroy(export_dialog); + export_dialog = NULL; +} Index: 1.0.8/src/hid/gtk/gui-dialog.c =================================================================== --- 1.0.8/src/hid/gtk/gui-dialog.c (nonexistent) +++ 1.0.8/src/hid/gtk/gui-dialog.c (revision 1136) @@ -0,0 +1,532 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* This file written by Bill Wilson for the PCB Gtk port. +*/ + +#include "config.h" + + +#include "data.h" +#include "gui.h" +#include "command.h" + + +RCSID("$Id$"); + +/* ---------------------------------------------- */ +gchar *ghid_dialog_input(const char *prompt, const char *initial) +{ + GtkWidget *dialog; + GtkWidget *content_area; + GtkWidget *vbox, *label, *entry; + gchar *string; + gboolean response; + GHidPort *out = &ghid_port; + + dialog = gtk_dialog_new_with_buttons("PCB User Input", + GTK_WINDOW(out->top_window), + GTK_DIALOG_MODAL, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); + + gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); + vbox = gtk_vbox_new(FALSE, 4); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 4); + label = gtk_label_new(""); + gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); + + gtk_label_set_use_markup(GTK_LABEL(label), TRUE); + gtk_label_set_markup(GTK_LABEL(label), prompt ? prompt : "Enter something"); + + entry = gtk_entry_new(); + if (initial) + gtk_entry_set_text(GTK_ENTRY(entry), initial); + + gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); + gtk_box_pack_start(GTK_BOX(vbox), entry, TRUE, TRUE, 0); + + content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); + gtk_container_add(GTK_CONTAINER(content_area), vbox); + gtk_widget_show_all(dialog); + + response = gtk_dialog_run(GTK_DIALOG(dialog)); + if (response != GTK_RESPONSE_OK) + string = g_strdup(initial ? initial : ""); + else + string = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); + + gtk_widget_destroy(dialog); + return string; +} + +/* ---------------------------------------------- */ +void ghid_dialog_about(void) +{ + GtkWidget *dialog; + GHidPort *out = &ghid_port; + dialog = gtk_message_dialog_new(GTK_WINDOW(out->top_window), + (GtkDialogFlags) (GTK_DIALOG_MODAL + | GTK_DIALOG_DESTROY_WITH_PARENT), + GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "%s", GetInfoString()); + + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); +} + +/* ---------------------------------------------- */ +gint ghid_dialog_confirm_all(gchar * all_message) +{ + GtkWidget *dialog; + GtkWidget *content_area; + GtkWidget *label, *vbox; + gint response; + GHidPort *out = &ghid_port; + + dialog = gtk_dialog_new_with_buttons("Confirm", + GTK_WINDOW(out->top_window), + (GtkDialogFlags) (GTK_DIALOG_MODAL | + GTK_DIALOG_DESTROY_WITH_PARENT), + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, "Sequence OK", GUI_DIALOG_RESPONSE_ALL, NULL); + + content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); + vbox = ghid_framed_vbox(content_area, NULL, 6, FALSE, 4, 6); + + label = gtk_label_new(all_message); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 3); + gtk_widget_show_all(dialog); + + response = gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + + return response; +} + +/* ---------------------------------------------- */ +void ghid_dialog_message(gchar * message) +{ + GtkWidget *dialog; + GHidPort *out = &ghid_port; + + dialog = gtk_message_dialog_new(GTK_WINDOW(out->top_window), + (GtkDialogFlags) (GTK_DIALOG_MODAL | + GTK_DIALOG_DESTROY_WITH_PARENT), + GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, "%s", message); + + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); +} + +/* ---------------------------------------------- */ +gboolean ghid_dialog_confirm(gchar * message, gchar * cancelmsg, gchar * okmsg) +{ + static gint x = -1, y = -1; + GtkWidget *dialog; + gboolean confirm = FALSE; + GHidPort *out = &ghid_port; + + if (cancelmsg == NULL) { + cancelmsg = _("_Cancel"); + } + if (okmsg == NULL) { + okmsg = _("_OK"); + } + + dialog = gtk_message_dialog_new(GTK_WINDOW(out->top_window), + (GtkDialogFlags) (GTK_DIALOG_MODAL | + GTK_DIALOG_DESTROY_WITH_PARENT), + GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, "%s", message); + gtk_dialog_add_buttons(GTK_DIALOG(dialog), cancelmsg, GTK_RESPONSE_CANCEL, okmsg, GTK_RESPONSE_OK, NULL); + + if (x != -1) { + gtk_window_move(GTK_WINDOW(dialog), x, y); + } + + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) + confirm = TRUE; + + gtk_window_get_position(GTK_WINDOW(dialog), &x, &y); + + gtk_widget_destroy(dialog); + return confirm; +} + +/* ---------------------------------------------- */ +gint ghid_dialog_close_confirm() +{ + GtkWidget *dialog; + gint rv; + GHidPort *out = &ghid_port; + gchar *tmp; + gchar *str; + + if (PCB->Filename == NULL) { + tmp = g_strdup_printf(_("Save the changes to layout before closing?")); + } + else { + tmp = g_strdup_printf(_("Save the changes to layout \"%s\" before closing?"), PCB->Filename); + } + str = g_strconcat("", tmp, "", NULL); + g_free(tmp); + tmp = _("If you don't save, all your changes will be permanently lost."); + str = g_strconcat(str, "\n\n", tmp, NULL); + + dialog = gtk_message_dialog_new(GTK_WINDOW(out->top_window), + (GtkDialogFlags) (GTK_DIALOG_MODAL | + GTK_DIALOG_DESTROY_WITH_PARENT), + GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, NULL); + gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dialog), str); + gtk_dialog_add_buttons(GTK_DIALOG(dialog), + _("Close _without saving"), GTK_RESPONSE_NO, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_YES, NULL); + + /* Set the alternative button order (ok, cancel, help) for other systems */ + gtk_dialog_set_alternative_button_order(GTK_DIALOG(dialog), GTK_RESPONSE_YES, GTK_RESPONSE_NO, GTK_RESPONSE_CANCEL, -1); + + switch (gtk_dialog_run(GTK_DIALOG(dialog))) { + case GTK_RESPONSE_NO: + { + rv = GUI_DIALOG_CLOSE_CONFIRM_NOSAVE; + break; + } + case GTK_RESPONSE_YES: + { + rv = GUI_DIALOG_CLOSE_CONFIRM_SAVE; + break; + } + case GTK_RESPONSE_CANCEL: + default: + { + rv = GUI_DIALOG_CLOSE_CONFIRM_CANCEL; + break; + } + } + gtk_widget_destroy(dialog); + return rv; +} + +/* ---------------------------------------------- */ +/* Caller must g_free() the returned filename.*/ +gchar *ghid_dialog_file_select_open(gchar * title, gchar ** path, gchar * shortcuts) +{ + GtkWidget *dialog; + gchar *result = NULL, *folder, *seed; + GHidPort *out = &ghid_port; + GtkFileFilter *no_filter; + + dialog = gtk_file_chooser_dialog_new(title, + GTK_WINDOW(out->top_window), + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); + + gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); + + /* add a default filter for not filtering files */ + no_filter = gtk_file_filter_new(); + gtk_file_filter_set_name(no_filter, "all"); + gtk_file_filter_add_pattern(no_filter, "*.*"); + gtk_file_filter_add_pattern(no_filter, "*"); + gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), no_filter); + + /* in case we have a dialog for loading a footprint file */ + if (strcmp(title, _("Load element to buffer")) == 0) { + /* add a filter for footprint files */ + GtkFileFilter *fp_filter; + fp_filter = gtk_file_filter_new(); + gtk_file_filter_set_name(fp_filter, "fp"); + gtk_file_filter_add_mime_type(fp_filter, "application/x-pcb-footprint"); + gtk_file_filter_add_pattern(fp_filter, "*.fp"); + gtk_file_filter_add_pattern(fp_filter, "*.FP"); + gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), fp_filter); + } + + /* in case we have a dialog for loading a layout file */ + if ((strcmp(title, _("Load layout file")) == 0) + || (strcmp(title, _("Load layout file to buffer")) == 0)) { + /* add a filter for layout files */ + GtkFileFilter *pcb_filter; + pcb_filter = gtk_file_filter_new(); + gtk_file_filter_set_name(pcb_filter, "pcb"); + gtk_file_filter_add_mime_type(pcb_filter, "application/x-pcb-layout"); + gtk_file_filter_add_pattern(pcb_filter, "*.pcb"); + gtk_file_filter_add_pattern(pcb_filter, "*.PCB"); + gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), pcb_filter); + } + + /* in case we have a dialog for loading a netlist file */ + if (strcmp(title, _("Load netlist file")) == 0) { + /* add a filter for netlist files */ + GtkFileFilter *net_filter; + net_filter = gtk_file_filter_new(); + gtk_file_filter_set_name(net_filter, "netlist"); + gtk_file_filter_add_mime_type(net_filter, "application/x-pcb-netlist"); + gtk_file_filter_add_pattern(net_filter, "*.net"); + gtk_file_filter_add_pattern(net_filter, "*.NET"); + gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), net_filter); + } + + if (path && *path) + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), *path); + + if (shortcuts && *shortcuts) { + folder = g_strdup(shortcuts); + seed = folder; + while ((folder = strtok(seed, ":")) != NULL) { + gtk_file_chooser_add_shortcut_folder(GTK_FILE_CHOOSER(dialog), folder, NULL); + seed = NULL; + } + g_free(folder); + } + + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) { + result = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); + folder = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog)); + if (folder && path) { + dup_string(path, folder); + g_free(folder); + } + } + gtk_widget_destroy(dialog); + + + return result; +} + +/* ---------------------------------------------- */ +/* Caller must g_free() the returned filename. */ +gchar *ghid_dialog_file_select_save(gchar * title, gchar ** path, gchar * file, gchar * shortcuts) +{ + GtkWidget *dialog; + gchar *result = NULL, *folder, *seed; + GHidPort *out = &ghid_port; + + dialog = gtk_file_chooser_dialog_new(title, + GTK_WINDOW(out->top_window), + GTK_FILE_CHOOSER_ACTION_SAVE, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); + + gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE); + gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); + + if (path && *path && **path) + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), *path); + + if (file && *file) { + gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), g_path_get_basename(file)); + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), g_path_get_dirname(file)); + } + + if (shortcuts && *shortcuts) { + folder = g_strdup(shortcuts); + seed = folder; + while ((folder = strtok(seed, ":")) != NULL) { + gtk_file_chooser_add_shortcut_folder(GTK_FILE_CHOOSER(dialog), folder, NULL); + seed = NULL; + } + g_free(folder); + } + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) { + result = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); + folder = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog)); + if (folder && path) { + dup_string(path, folder); + g_free(folder); + } + } + gtk_widget_destroy(dialog); + + + return result; +} + + +/* ---------------------------------------------- */ +/* how many files and directories to keep for the shortcuts */ +#define NHIST 8 +typedef struct ghid_file_history_struct { + /* + * an identifier as to which recent files pool this is. For example + * "boards", "eco", "netlists", etc. + */ + char *id; + + /* + * the array of files or directories + */ + char *history[NHIST]; +} ghid_file_history; + +static int n_recent_dirs = 0; +static ghid_file_history *recent_dirs = NULL; + +/* ---------------------------------------------- */ +/* Caller must g_free() the returned filename. */ +gchar *ghid_fileselect(const char *title, const char *descr, + char *default_file, char *default_ext, const char *history_tag, int flags) +{ + GtkWidget *dialog; + gchar *result = NULL; + GHidPort *out = &ghid_port; + gchar *path = NULL, *base = NULL; + int history_pool = -1; + int i; + + if (history_tag && *history_tag) { + /* + * I used a simple linear search here because the number of + * entries in the array is likely to be quite small (5, maybe 10 at + * the absolute most) and this function is used when pulling up + * a file dialog box instead of something called over and over + * again as part of moving elements or autorouting. So, keep it + * simple.... + */ + history_pool = 0; + while (history_pool < n_recent_dirs && strcmp(recent_dirs[history_pool].id, history_tag) != 0) { + history_pool++; + } + + /* + * If we counted all the way to n_recent_dirs, that means we + * didn't find our entry + */ + if (history_pool >= n_recent_dirs) { + n_recent_dirs++; + + recent_dirs = (ghid_file_history *) realloc(recent_dirs, n_recent_dirs * sizeof(ghid_file_history)); + + if (recent_dirs == NULL) { + fprintf(stderr, "%s(): realloc failed\n", __FUNCTION__); + exit(1); + } + + recent_dirs[history_pool].id = strdup(history_tag); + + /* Initialize the entries in our history list to all be NULL */ + for (i = 0; i < NHIST; i++) { + recent_dirs[history_pool].history[i] = NULL; + } + } + } + + if (default_file && *default_file) { + path = g_path_get_dirname(default_file); + base = g_path_get_basename(default_file); + } + + dialog = gtk_file_chooser_dialog_new(title, + GTK_WINDOW(out->top_window), + (flags & HID_FILESELECT_READ) ? + GTK_FILE_CHOOSER_ACTION_OPEN : + GTK_FILE_CHOOSER_ACTION_SAVE, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); + + gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); + + if (path && *path) { + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), path); + g_free(path); + } + + if (base && *base) { + /* default file is only supposed to be for writing, not reading */ + if (!(flags & HID_FILESELECT_READ)) { + gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), base); + } + g_free(base); + } + + for (i = 0; i < NHIST && recent_dirs[history_pool].history[i] != NULL; i++) { + gtk_file_chooser_add_shortcut_folder(GTK_FILE_CHOOSER(dialog), recent_dirs[history_pool].history[i], NULL); + } + + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) { + result = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); + if (result != NULL) + path = g_path_get_dirname(result); + else + path = NULL; + + /* update the history list */ + if (path != NULL) { + char *tmps, *tmps2; + int k = 0; + + /* + * Put this at the top of the list and bump everything else + * down but skip any old entry of this directory + * + */ + while (k < NHIST && + recent_dirs[history_pool].history[k] != NULL && strcmp(recent_dirs[history_pool].history[k], path) == 0) { + k++; + } + tmps = recent_dirs[history_pool].history[k]; + recent_dirs[history_pool].history[0] = path; + for (i = 1; i < NHIST; i++) { + /* store our current entry, but skip duplicates */ + while (i + k < NHIST && + recent_dirs[history_pool].history[i + k] != NULL && + strcmp(recent_dirs[history_pool].history[i + k], path) == 0) { + k++; + } + + if (i + k < NHIST) + tmps2 = recent_dirs[history_pool].history[i + k]; + else + tmps2 = NULL; + + /* move down the one we stored last time */ + recent_dirs[history_pool].history[i] = tmps; + + /* and remember the displace entry */ + tmps = tmps2; + } + + /* + * the last one has fallen off the end of the history list + * so we need to free() it. + */ + if (tmps) { + free(tmps); + } + } + +#ifdef DEBUG + printf("\n\n-----\n\n"); + for (i = 0; i < NHIST; i++) { + printf("After update recent_dirs[%d].history[%d] = \"%s\"\n", + history_pool, i, recent_dirs[history_pool].history[i] != NULL ? recent_dirs[history_pool].history[i] : "NULL"); + } +#endif + + } + gtk_widget_destroy(dialog); + + + return result; +} Index: 1.0.8/src/hid/gtk/gui-drc-window.c =================================================================== --- 1.0.8/src/hid/gtk/gui-drc-window.c (nonexistent) +++ 1.0.8/src/hid/gtk/gui-drc-window.c (revision 1136) @@ -0,0 +1,813 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +#include "config.h" + +#include "error.h" +#include "search.h" +#include "draw.h" +#include "pcb-printf.h" +#include "undo.h" +#include "set.h" +#include "gui.h" +#include "gui-drc-window.h" + + +#define VIOLATION_PIXMAP_PIXEL_SIZE 100 +#define VIOLATION_PIXMAP_PIXEL_BORDER 5 +#define VIOLATION_PIXMAP_PCB_SIZE MIL_TO_COORD (100) + +RCSID("$Id$"); + +static GtkWidget *drc_window, *drc_list; +static GtkListStore *drc_list_model = NULL; +static int num_violations = 0; + +/* Remember user window resizes. */ +static gint drc_window_configure_event_cb(GtkWidget * widget, GdkEventConfigure * ev, gpointer data) +{ + GtkAllocation allocation; + + gtk_widget_get_allocation(widget, &allocation); + ghidgui->drc_window_width = allocation.width; + ghidgui->drc_window_height = allocation.height; + ghidgui->config_modified = TRUE; + + return FALSE; +} + +static void drc_close_cb(gpointer data) +{ + gtk_widget_destroy(drc_window); + drc_window = NULL; +} + +static void drc_refresh_cb(gpointer data) +{ + hid_actionl("DRC", NULL); +} + +static void drc_destroy_cb(GtkWidget * widget, gpointer data) +{ + drc_window = NULL; +} + +enum { + DRC_VIOLATION_NUM_COL = 0, + DRC_VIOLATION_OBJ_COL, + NUM_DRC_COLUMNS +}; + + +static void unset_found_flags(int AndDraw) +{ + int flag = FOUNDFLAG; + int change = 0; + + VIA_LOOP(PCB->Data); + { + if (TEST_FLAG(flag, via)) { + AddObjectToFlagUndoList(VIA_TYPE, via, via, via); + CLEAR_FLAG(flag, via); + DrawVia(via); + change = true; + } + } + END_LOOP; + ELEMENT_LOOP(PCB->Data); + { + PIN_LOOP(element); + { + if (TEST_FLAG(flag, pin)) { + AddObjectToFlagUndoList(PIN_TYPE, element, pin, pin); + CLEAR_FLAG(flag, pin); + DrawPin(pin); + change = true; + } + } + END_LOOP; + PAD_LOOP(element); + { + if (TEST_FLAG(flag, pad)) { + AddObjectToFlagUndoList(PAD_TYPE, element, pad, pad); + CLEAR_FLAG(flag, pad); + DrawPad(pad); + change = true; + } + } + END_LOOP; + } + END_LOOP; + RAT_LOOP(PCB->Data); + { + if (TEST_FLAG(flag, line)) { + AddObjectToFlagUndoList(RATLINE_TYPE, line, line, line); + CLEAR_FLAG(flag, line); + DrawRat(line); + change = true; + } + } + END_LOOP; + COPPERLINE_LOOP(PCB->Data); + { + if (TEST_FLAG(flag, line)) { + AddObjectToFlagUndoList(LINE_TYPE, layer, line, line); + CLEAR_FLAG(flag, line); + DrawLine(layer, line); + change = true; + } + } + ENDALL_LOOP; + COPPERARC_LOOP(PCB->Data); + { + if (TEST_FLAG(flag, arc)) { + AddObjectToFlagUndoList(ARC_TYPE, layer, arc, arc); + CLEAR_FLAG(flag, arc); + DrawArc(layer, arc); + change = true; + } + } + ENDALL_LOOP; + COPPERPOLYGON_LOOP(PCB->Data); + { + if (TEST_FLAG(flag, polygon)) { + AddObjectToFlagUndoList(POLYGON_TYPE, layer, polygon, polygon); + CLEAR_FLAG(flag, polygon); + DrawPolygon(layer, polygon); + change = true; + } + } + ENDALL_LOOP; + if (change) { + SetChangedFlag(true); + if (AndDraw) { + IncrementUndoSerialNumber(); + Draw(); + } + } +} + +static void selection_changed_cb(GtkTreeSelection * selection, gpointer user_data) +{ + GtkTreeModel *model; + GtkTreeIter iter; + GhidDrcViolation *violation; + int i; + + if (!gtk_tree_selection_get_selected(selection, &model, &iter)) { + unset_found_flags(true); + return; + } + + /* Check the selected node has children, if so; return. */ + if (gtk_tree_model_iter_has_child(model, &iter)) + return; + + gtk_tree_model_get(model, &iter, DRC_VIOLATION_OBJ_COL, &violation, -1); + + unset_found_flags(false); + + if (violation == NULL) + return; + + /* Flag the objects listed against this DRC violation */ + for (i = 0; i < violation->object_count; i++) { + int object_id = violation->object_id_list[i]; + int object_type = violation->object_type_list[i]; + int found_type; + void *ptr1, *ptr2, *ptr3; + + found_type = SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, object_id, object_type); + if (found_type == NO_TYPE) { + Message(_("Object ID %i identified during DRC was not found. Stale DRC window?\n"), object_id); + continue; + } + AddObjectToFlagUndoList(object_type, ptr1, ptr2, ptr3); + SET_FLAG(FOUNDFLAG, (AnyObjectType *) ptr2); + switch (violation->object_type_list[i]) { + case LINE_TYPE: + case ARC_TYPE: + case POLYGON_TYPE: + ChangeGroupVisibility(GetLayerNumber(PCB->Data, (LayerTypePtr) ptr1), true, true); + } + DrawObject(object_type, ptr1, ptr2); + } + SetChangedFlag(true); + IncrementUndoSerialNumber(); + Draw(); +} + +static void row_activated_cb(GtkTreeView * view, GtkTreePath * path, GtkTreeViewColumn * column, gpointer user_data) +{ + GtkTreeModel *model = gtk_tree_view_get_model(view); + GtkTreeIter iter; + GhidDrcViolation *violation; + + gtk_tree_model_get_iter(model, &iter, path); + + gtk_tree_model_get(model, &iter, DRC_VIOLATION_OBJ_COL, &violation, -1); + + if (violation == NULL) + return; + + CenterDisplay(violation->x_coord, violation->y_coord); +} + + +enum { + PROP_TITLE = 1, + PROP_EXPLANATION, + PROP_X_COORD, + PROP_Y_COORD, + PROP_ANGLE, + PROP_HAVE_MEASURED, + PROP_MEASURED_VALUE, + PROP_REQUIRED_VALUE, + PROP_OBJECT_LIST, + PROP_PIXMAP +}; + + +static GObjectClass *ghid_drc_violation_parent_class = NULL; + + +/*! \brief GObject finalise handler + * + * \par Function Description + * Just before the GhidDrcViolation GObject is finalized, free our + * allocated data, and then chain up to the parent's finalize handler. + * + * \param [in] widget The GObject being finalized. + */ +static void ghid_drc_violation_finalize(GObject * object) +{ + GhidDrcViolation *violation = GHID_DRC_VIOLATION(object); + + g_free(violation->title); + g_free(violation->explanation); + g_free(violation->object_id_list); + g_free(violation->object_type_list); + if (violation->pixmap != NULL) + g_object_unref(violation->pixmap); + + G_OBJECT_CLASS(ghid_drc_violation_parent_class)->finalize(object); +} + +typedef struct object_list { + int count; + long int *id_list; + int *type_list; +} object_list; + +/*! \brief GObject property setter function + * + * \par Function Description + * Setter function for GhidDrcViolation's GObject properties, + * "settings-name" and "toplevel" + * + * \param [in] object The GObject whose properties we are setting + * \param [in] property_id The numeric id. under which the property was + * registered with g_object_class_install_property() + * \param [in] value The GValue the property is being set from + * \param [in] pspec A GParamSpec describing the property being set + */ +static void ghid_drc_violation_set_property(GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) +{ + GhidDrcViolation *violation = GHID_DRC_VIOLATION(object); + object_list *obj_list; + + switch (property_id) { + case PROP_TITLE: + g_free(violation->title); + violation->title = g_value_dup_string(value); + break; + case PROP_EXPLANATION: + g_free(violation->explanation); + violation->explanation = g_value_dup_string(value); + break; + case PROP_X_COORD: + violation->x_coord = g_value_get_int(value); + break; + case PROP_Y_COORD: + violation->y_coord = g_value_get_int(value); + break; + case PROP_ANGLE: + violation->angle = g_value_get_double(value); + break; + case PROP_HAVE_MEASURED: + violation->have_measured = g_value_get_boolean(value); + break; + case PROP_MEASURED_VALUE: + violation->measured_value = g_value_get_int(value); + break; + case PROP_REQUIRED_VALUE: + violation->required_value = g_value_get_int(value); + break; + case PROP_OBJECT_LIST: + /* Copy the passed data to make new lists */ + g_free(violation->object_id_list); + g_free(violation->object_type_list); + obj_list = (object_list *) g_value_get_pointer(value); + violation->object_count = obj_list->count; + violation->object_id_list = g_new(long int, obj_list->count); + violation->object_type_list = g_new(int, obj_list->count); + memcpy(violation->object_id_list, obj_list->id_list, sizeof(long int) * obj_list->count); + memcpy(violation->object_type_list, obj_list->type_list, sizeof(int) * obj_list->count); + break; + case PROP_PIXMAP: + if (violation->pixmap) + g_object_unref(violation->pixmap); /* Frees our old reference */ + violation->pixmap = (GdkDrawable *) g_value_dup_object(value); /* Takes a new reference */ + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); + return; + } +} + + +/*! \brief GObject property getter function + * + * \par Function Description + * Getter function for GhidDrcViolation's GObject properties, + * "settings-name" and "toplevel". + * + * \param [in] object The GObject whose properties we are getting + * \param [in] property_id The numeric id. under which the property was + * registered with g_object_class_install_property() + * \param [out] value The GValue in which to return the value of the property + * \param [in] pspec A GParamSpec describing the property being got + */ +static void ghid_drc_violation_get_property(GObject * object, guint property_id, GValue * value, GParamSpec * pspec) +{ + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); + } + +} + + +/*! \brief GType class initialiser for GhidDrcViolation + * + * \par Function Description + * GType class initialiser for GhidDrcViolation. We override our parent + * virtual class methods as needed and register our GObject properties. + * + * \param [in] klass The GhidDrcViolationClass we are initialising + */ +static void ghid_drc_violation_class_init(GhidViolationRendererClass * klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS(klass); + + gobject_class->finalize = ghid_drc_violation_finalize; + gobject_class->set_property = ghid_drc_violation_set_property; + gobject_class->get_property = ghid_drc_violation_get_property; + + ghid_drc_violation_parent_class = (GObjectClass *) g_type_class_peek_parent(klass); + + g_object_class_install_property(gobject_class, PROP_TITLE, g_param_spec_string("title", "", "", "", G_PARAM_WRITABLE)); + g_object_class_install_property(gobject_class, PROP_EXPLANATION, + g_param_spec_string("explanation", "", "", "", G_PARAM_WRITABLE)); + g_object_class_install_property(gobject_class, PROP_X_COORD, + g_param_spec_int("x-coord", "", "", G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); + g_object_class_install_property(gobject_class, PROP_Y_COORD, + g_param_spec_int("y-coord", "", "", G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); + g_object_class_install_property(gobject_class, PROP_ANGLE, + g_param_spec_double("angle", "", "", G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); + g_object_class_install_property(gobject_class, PROP_HAVE_MEASURED, + g_param_spec_boolean("have-measured", "", "", 0, G_PARAM_WRITABLE)); + g_object_class_install_property(gobject_class, PROP_MEASURED_VALUE, + g_param_spec_int("measured-value", "", "", G_MININT, G_MAXINT, 0., G_PARAM_WRITABLE)); + g_object_class_install_property(gobject_class, PROP_REQUIRED_VALUE, + g_param_spec_int("required-value", "", "", G_MININT, G_MAXINT, 0., G_PARAM_WRITABLE)); + g_object_class_install_property(gobject_class, PROP_OBJECT_LIST, + g_param_spec_pointer("object-list", "", "", G_PARAM_WRITABLE)); + g_object_class_install_property(gobject_class, PROP_PIXMAP, + g_param_spec_object("pixmap", "", "", GDK_TYPE_DRAWABLE, G_PARAM_WRITABLE)); +} + + + +/*! \brief Function to retrieve GhidViolationRenderer's GType identifier. + * + * \par Function Description + * Function to retrieve GhidViolationRenderer's GType identifier. + * Upon first call, this registers the GhidViolationRenderer in the GType system. + * Subsequently it returns the saved value from its first execution. + * + * \return the GType identifier associated with GhidViolationRenderer. + */ +GType ghid_drc_violation_get_type() +{ + static GType ghid_drc_violation_type = 0; + + if (!ghid_drc_violation_type) { + static const GTypeInfo ghid_drc_violation_info = { + sizeof(GhidDrcViolationClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) ghid_drc_violation_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(GhidDrcViolation), + 0, /* n_preallocs */ + NULL, /* instance_init */ + }; + + ghid_drc_violation_type = + g_type_register_static(G_TYPE_OBJECT, "GhidDrcViolation", &ghid_drc_violation_info, (GTypeFlags) 0); + } + + return ghid_drc_violation_type; +} + + +GhidDrcViolation *ghid_drc_violation_new(DrcViolationType * violation, GdkDrawable * pixmap) +{ + object_list obj_list; + + obj_list.count = violation->object_count; + obj_list.id_list = violation->object_id_list; + obj_list.type_list = violation->object_type_list; + + return (GhidDrcViolation *) g_object_new(GHID_TYPE_DRC_VIOLATION, + "title", violation->title, + "explanation", violation->explanation, + "x-coord", violation->x, + "y-coord", violation->y, + "angle", violation->angle, + "have-measured", violation->have_measured, + "measured-value", violation->measured_value, + "required-value", violation->required_value, + "object-list", &obj_list, "pixmap", pixmap, NULL); +} + +enum { + PROP_VIOLATION = 1, +}; + + +static GObjectClass *ghid_violation_renderer_parent_class = NULL; + + +/*! \brief GObject finalise handler + * + * \par Function Description + * Just before the GhidViolationRenderer GObject is finalized, free our + * allocated data, and then chain up to the parent's finalize handler. + * + * \param [in] widget The GObject being finalized. + */ +static void ghid_violation_renderer_finalize(GObject * object) +{ + GhidViolationRenderer *renderer = GHID_VIOLATION_RENDERER(object); + + if (renderer->violation != NULL) + g_object_unref(renderer->violation); + + G_OBJECT_CLASS(ghid_violation_renderer_parent_class)->finalize(object); +} + + +/*! \brief GObject property setter function + * + * \par Function Description + * Setter function for GhidViolationRenderer's GObject properties, + * "settings-name" and "toplevel". + * + * \param [in] object The GObject whose properties we are setting + * \param [in] property_id The numeric id. under which the property was + * registered with g_object_class_install_property() + * \param [in] value The GValue the property is being set from + * \param [in] pspec A GParamSpec describing the property being set + */ +static void ghid_violation_renderer_set_property(GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) +{ + GhidViolationRenderer *renderer = GHID_VIOLATION_RENDERER(object); + char *markup; + + switch (property_id) { + case PROP_VIOLATION: + if (renderer->violation != NULL) + g_object_unref(renderer->violation); + renderer->violation = (GhidDrcViolation *) g_value_dup_object(value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); + return; + } + + if (renderer->violation == NULL) + return; + + if (renderer->violation->have_measured) { + markup = pcb_g_strdup_printf("%m+%s (%$mS)\n" + " \n" + "" + "%s\n" + " \n" + "Required: %$mS" + "", + Settings.grid_unit->allow, + renderer->violation->title, + renderer->violation->measured_value, + renderer->violation->explanation, renderer->violation->required_value); + } + else { + markup = pcb_g_strdup_printf("%m+%s\n" + " \n" + "" + "%s\n" + " \n" + "Required: %$mS" + "", + Settings.grid_unit->allow, + renderer->violation->title, + renderer->violation->explanation, renderer->violation->required_value); + } + + g_object_set(object, "markup", markup, NULL); + g_free(markup); +} + + +/*! \brief GObject property getter function + * + * \par Function Description + * Getter function for GhidViolationRenderer's GObject properties. + * + * \param [in] object The GObject whose properties we are getting + * \param [in] property_id The numeric id. under which the property was + * registered with g_object_class_install_property() + * \param [out] value The GValue in which to return the value of the property + * \param [in] pspec A GParamSpec describing the property being got + */ +static void ghid_violation_renderer_get_property(GObject * object, guint property_id, GValue * value, GParamSpec * pspec) +{ + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); + } + +} + +static void +ghid_violation_renderer_get_size(GtkCellRenderer * cell, + GtkWidget * widget, + GdkRectangle * cell_area, gint * x_offset, gint * y_offset, gint * width, gint * height) +{ + GTK_CELL_RENDERER_CLASS(ghid_violation_renderer_parent_class)->get_size(cell, + widget, cell_area, x_offset, y_offset, width, height); + if (width != NULL) + *width += VIOLATION_PIXMAP_PIXEL_SIZE; + if (height != NULL) + *height = MAX(*height, VIOLATION_PIXMAP_PIXEL_SIZE); +} + + +static void +ghid_violation_renderer_render(GtkCellRenderer * cell, + GdkDrawable * window, + GtkWidget * widget, + GdkRectangle * background_area, + GdkRectangle * cell_area, GdkRectangle * expose_area, GtkCellRendererState flags) +{ + GdkDrawable *mydrawable; + GtkStyle *style = gtk_widget_get_style(widget); + GhidViolationRenderer *renderer = GHID_VIOLATION_RENDERER(cell); + GhidDrcViolation *violation = renderer->violation; + int pixmap_size = VIOLATION_PIXMAP_PIXEL_SIZE - 2 * VIOLATION_PIXMAP_PIXEL_BORDER; + + cell_area->width -= VIOLATION_PIXMAP_PIXEL_SIZE; + GTK_CELL_RENDERER_CLASS(ghid_violation_renderer_parent_class)->render(cell, + window, + widget, background_area, cell_area, expose_area, flags); + + if (violation == NULL) + return; + + if (violation->pixmap == NULL) { + GdkPixmap *pixmap = ghid_render_pixmap(violation->x_coord, + violation->y_coord, + VIOLATION_PIXMAP_PCB_SIZE / pixmap_size, + pixmap_size, pixmap_size, + gdk_drawable_get_depth(window)); + g_object_set(violation, "pixmap", pixmap, NULL); + g_object_unref(pixmap); + } + + if (violation->pixmap == NULL) + return; + + mydrawable = GDK_DRAWABLE(violation->pixmap); + + gdk_draw_drawable(window, style->fg_gc[gtk_widget_get_state(widget)], + mydrawable, 0, 0, + cell_area->x + cell_area->width + VIOLATION_PIXMAP_PIXEL_BORDER, + cell_area->y + VIOLATION_PIXMAP_PIXEL_BORDER, -1, -1); +} + + +/*! \brief GType class initialiser for GhidViolationRenderer + * + * \par Function Description + * GType class initialiser for GhidViolationRenderer. We override our parent + * virtual class methods as needed and register our GObject properties. + * + * \param [in] klass The GhidViolationRendererClass we are initialising + */ +static void ghid_violation_renderer_class_init(GhidViolationRendererClass * klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS(klass); + GtkCellRendererClass *cellrenderer_class = GTK_CELL_RENDERER_CLASS(klass); + + gobject_class->finalize = ghid_violation_renderer_finalize; + gobject_class->set_property = ghid_violation_renderer_set_property; + gobject_class->get_property = ghid_violation_renderer_get_property; + + cellrenderer_class->get_size = ghid_violation_renderer_get_size; + cellrenderer_class->render = ghid_violation_renderer_render; + + ghid_violation_renderer_parent_class = (GObjectClass *) g_type_class_peek_parent(klass); + + g_object_class_install_property(gobject_class, PROP_VIOLATION, + g_param_spec_object("violation", "", "", GHID_TYPE_DRC_VIOLATION, G_PARAM_WRITABLE)); +} + + +/*! \brief Function to retrieve GhidViolationRenderer's GType identifier. + * + * \par Function Description + * Function to retrieve GhidViolationRenderer's GType identifier. + * Upon first call, this registers the GhidViolationRenderer in the GType system. + * Subsequently it returns the saved value from its first execution. + * + * \return the GType identifier associated with GhidViolationRenderer. + */ +GType ghid_violation_renderer_get_type() +{ + static GType ghid_violation_renderer_type = 0; + + if (!ghid_violation_renderer_type) { + static const GTypeInfo ghid_violation_renderer_info = { + sizeof(GhidViolationRendererClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) ghid_violation_renderer_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(GhidViolationRenderer), + 0, /* n_preallocs */ + NULL, /* instance_init */ + }; + + ghid_violation_renderer_type = + g_type_register_static(GTK_TYPE_CELL_RENDERER_TEXT, "GhidViolationRenderer", + &ghid_violation_renderer_info, (GTypeFlags) 0); + } + + return ghid_violation_renderer_type; +} + + +/*! \brief Convenience function to create a new violation renderer + * + * \par Function Description + * Convenience function which creates a GhidViolationRenderer. + * + * \return The GhidViolationRenderer created. + */ +GtkCellRenderer *ghid_violation_renderer_new(void) +{ + GhidViolationRenderer *renderer; + + renderer = (GhidViolationRenderer *) g_object_new(GHID_TYPE_VIOLATION_RENDERER, "ypad", 6, NULL); + + return GTK_CELL_RENDERER(renderer); +} + + +void ghid_drc_window_show(gboolean raise) +{ + GtkWidget *vbox, *hbox, *button, *scrolled_window; + GtkCellRenderer *violation_renderer; + + if (drc_window) { + if (raise) + gtk_window_present(GTK_WINDOW(drc_window)); + return; + } + + drc_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + g_signal_connect(G_OBJECT(drc_window), "destroy", G_CALLBACK(drc_destroy_cb), NULL); + g_signal_connect(G_OBJECT(drc_window), "configure_event", G_CALLBACK(drc_window_configure_event_cb), NULL); + gtk_window_set_title(GTK_WINDOW(drc_window), _("PCB DRC")); + gtk_window_set_wmclass(GTK_WINDOW(drc_window), "PCB_DRC", "PCB"); + gtk_window_set_default_size(GTK_WINDOW(drc_window), ghidgui->drc_window_width, ghidgui->drc_window_height); + + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(drc_window), vbox); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); + gtk_box_set_spacing(GTK_BOX(vbox), 6); + + drc_list_model = gtk_list_store_new(NUM_DRC_COLUMNS, G_TYPE_INT, /* DRC_VIOLATION_NUM_COL */ + G_TYPE_OBJECT); /* DRC_VIOLATION_OBJ_COL */ + + scrolled_window = gtk_scrolled_window_new(NULL, NULL); + gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE /* EXPAND */ , TRUE /* FILL */ , 0 /* PADDING */ ); + + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + + drc_list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(drc_list_model)); + gtk_container_add(GTK_CONTAINER(scrolled_window), drc_list); + + gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(drc_list), TRUE); + g_signal_connect(gtk_tree_view_get_selection(GTK_TREE_VIEW(drc_list)), "changed", G_CALLBACK(selection_changed_cb), NULL); + g_signal_connect(drc_list, "row-activated", G_CALLBACK(row_activated_cb), NULL); + + violation_renderer = gtk_cell_renderer_text_new(); + gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(drc_list), -1, /* APPEND */ + _("No."), /* TITLE */ + violation_renderer, "text", DRC_VIOLATION_NUM_COL, NULL); + + violation_renderer = ghid_violation_renderer_new(); + gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(drc_list), -1, /* APPEND */ + _("Violation details"), /* TITLE */ + violation_renderer, "violation", DRC_VIOLATION_OBJ_COL, NULL); + + hbox = gtk_hbutton_box_new(); + gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + + gtk_box_set_spacing(GTK_BOX(hbox), 6); + + button = gtk_button_new_from_stock(GTK_STOCK_REFRESH); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(drc_refresh_cb), NULL); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + + button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(drc_close_cb), NULL); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + + gtk_widget_realize(drc_window); + if (Settings.AutoPlace) + gtk_window_move(GTK_WINDOW(drc_window), 10, 10); + gtk_widget_show_all(drc_window); +} + +void ghid_drc_window_append_violation(DrcViolationType * violation) +{ + GhidDrcViolation *violation_obj; + GtkTreeIter iter; + + /* Ensure the required structures are setup */ + ghid_drc_window_show(FALSE); + + num_violations++; + + violation_obj = ghid_drc_violation_new(violation, /* pixmap */ NULL); + + gtk_list_store_append(drc_list_model, &iter); + gtk_list_store_set(drc_list_model, &iter, DRC_VIOLATION_NUM_COL, num_violations, DRC_VIOLATION_OBJ_COL, violation_obj, -1); + + g_object_unref(violation_obj); /* The list store takes its own reference */ +} + +void ghid_drc_window_reset_message(void) +{ + if (drc_list_model != NULL) + gtk_list_store_clear(drc_list_model); + num_violations = 0; +} + +int ghid_drc_window_throw_dialog(void) +{ + ghid_drc_window_show(TRUE); + return 1; +} Index: 1.0.8/src/hid/gtk/gui-drc-window.h =================================================================== --- 1.0.8/src/hid/gtk/gui-drc-window.h (nonexistent) +++ 1.0.8/src/hid/gtk/gui-drc-window.h (revision 1136) @@ -0,0 +1,95 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +#ifndef PCB_HID_GTK_GUI_DRC_WINDOW_H +#define PCB_HID_GTK_GUI_DRC_WINDOW_H + + +#define GHID_TYPE_DRC_VIOLATION (ghid_drc_violation_get_type()) +#define GHID_DRC_VIOLATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GHID_TYPE_DRC_VIOLATION, GhidDrcViolation)) +#define GHID_DRC_VIOLATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GHID_TYPE_DRC_VIOLATION, GhidDrcViolationClass)) +#define GHID_IS_DRC_VIOLATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GHID_TYPE_DRC_VIOLATION)) +#define GHID_DRC_VIOLATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GHID_TYPE_DRC_VIOLATION, GhidDrcViolationClass)) + +typedef struct _GhidDrcViolationClass GhidDrcViolationClass; +typedef struct _GhidDrcViolation GhidDrcViolation; + + +struct _GhidDrcViolationClass { + GObjectClass parent_class; +}; + +struct _GhidDrcViolation { + GObject parent_instance; + + char *title; + char *explanation; + Coord x_coord; + Coord y_coord; + Angle angle; + bool have_measured; + Coord measured_value; + Coord required_value; + int object_count; + long int *object_id_list; + int *object_type_list; + GdkDrawable *pixmap; +}; + + +GType ghid_drc_violation_get_type(void); + +GhidDrcViolation *ghid_drc_violation_new(DrcViolationType * violation, GdkDrawable * pixmap); + + +#define GHID_TYPE_VIOLATION_RENDERER (ghid_violation_renderer_get_type()) +#define GHID_VIOLATION_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GHID_TYPE_VIOLATION_RENDERER, GhidViolationRenderer)) +#define GHID_VIOLATION_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GHID_TYPE_VIOLATION_RENDERER, GhidViolationRendererClass)) +#define GHID_IS_VIOLATION_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GHID_TYPE_VIOLATION_RENDERER)) +#define GHID_VIOLATION_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GHID_TYPE_VIOLATION_RENDERER, GhidViolationRendererClass)) + +typedef struct _GhidViolationRendererClass GhidViolationRendererClass; +typedef struct _GhidViolationRenderer GhidViolationRenderer; + + +struct _GhidViolationRendererClass { + GtkCellRendererTextClass parent_class; +}; + +struct _GhidViolationRenderer { + GtkCellRendererText parent_instance; + + GhidDrcViolation *violation; +}; + + +GType ghid_violation_renderer_get_type(void); + +GtkCellRenderer *ghid_violation_renderer_new(void); + +#endif /* PCB_HID_GTK_GUI_DRC_WINDOW_H */ Index: 1.0.8/src/hid/gtk/gui-icons-misc.data =================================================================== --- 1.0.8/src/hid/gtk/gui-icons-misc.data (nonexistent) +++ 1.0.8/src/hid/gtk/gui-icons-misc.data (revision 1136) @@ -0,0 +1,111 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + * RCS: $Id$ + */ + + +/* XPM */ +static char *icon_bits[] = { +/* columns rows colors chars-per-pixel */ +"32 32 6 1", +" c black", +". c #53E336", +"X c #E34736", +"o c #BED7E3", +"O c #E7E3E7", +"+ c None", +/* pixels */ +"++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++", +"+ +", +"+ o oo o oo o oo o +", +"+ o + oo + o + oo + o + oo + o +", +"+ o oo o oo o oo o +", +"+ oooooooooooooooooooooooooooo +", +"+ oooooooooooooooooooooooooo +", +"+ oooooooooooooooooooooooooo +", +"+ oooooooooooooooooooooooooo +", +"+ oooooooooooooooooooooooooo +", +"+ oooooooooooooooooooooooooooo +", +"+ o oo o oo o oo o +", +"+ o + oo + o + oo + o + oo + o +", +"+ o oo . o oo o oo X o +", +"+ . X +", +"+++++++++.+++++++++++++++++X++++", +"+++++++++.+++++++++++++++++X++++", +"+++++++++.+++++++++++++++++X++++", +"+++++++++.+++++++++++++++++X++++", +"++++++++.++++++++++++++++++X++++", +"+++++++.++++ +++ ++++++++++X++++", +"+++++++.++++ ++ +++++++++XX++++", +"++++++ . +++ + o ++++ +XX+++++", +"++++++ . oo XXXX++++++", +"++++++ +++ + o ++++ ++++++++", +"++++++++++++ ++ +++++++++++++++", +"++++++++++++ +++ +++++++++++++++", +"++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++" +}; + +#define rotateIcon_width 16 +#define rotateIcon_height 16 +static unsigned char rotateIcon_bits[] = { + 0xf0, 0x03, 0xf8, 0x87, 0x0c, 0xcc, 0x06, 0xf8, 0x03, 0xb0, 0x01, 0x98, + 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x19, 0x80, 0x0d, 0xc0, + 0x1f, 0x60, 0x3b, 0x30, 0xe1, 0x3f, 0xc0, 0x0f}; + +#define rotateMask_width 16 +#define rotateMask_height 16 +static unsigned char rotateMask_bits[] = { + 0xf0, 0x03, 0xf8, 0x87, 0x0c, 0xcc, 0x06, 0xf8, 0x03, 0xf0, 0x01, 0xf8, + 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x1f, 0x80, 0x0f, 0xc0, + 0x1f, 0x60, 0x3b, 0x30, 0xe1, 0x3f, 0xc0, 0x0f}; + +#define handIcon_width 16 +#define handIcon_height 16 +static unsigned char handIcon_bits[] = { + 0x80, 0x00, 0x48, 0x09, 0x54, 0x15, 0x54, 0x15, 0x54, 0x15, 0x64, 0xcb, + 0x68, 0xab, 0x2b, 0x5b, 0x05, 0x58, 0x05, 0x20, 0x01, 0x20, 0x02, 0x20, + 0x02, 0x30, 0x04, 0x10, 0x08, 0x08, 0xf0, 0x0f}; +#define handMask_width 16 +#define handMask_height 16 +static unsigned char handMask_bits[] = { + 0x80, 0x00, 0xc8, 0x09, 0xdc, 0x1d, 0xdc, 0x1d, 0xdc, 0x1d, 0xfc, 0xcf, + 0x38, 0xee, 0x1f, 0x78, 0x0f, 0x78, 0x07, 0x30, 0x07, 0x30, 0x0e, 0x38, + 0x1e, 0x3c, 0x3c, 0x1e, 0xf8, 0x0f, 0xf0, 0x0f}; +#define lockIcon_width 16 +#define lockIcon_height 16 +static unsigned char lockIcon_bits[] = { + 0x00, 0x00, 0xe0, 0x07, 0x30, 0x0c, 0x10, 0x08, 0x18, 0x18, 0x08, 0x10, + 0x08, 0x00, 0xfc, 0x3f, 0x04, 0x20, 0xfc, 0x3f, 0x04, 0x20, 0xfc, 0x3f, + 0x04, 0x20, 0xfc, 0x3f, 0x04, 0x20, 0xfc, 0x3f}; +#define lockMask_width 16 +#define lockMask_height 16 +static unsigned char lockMask_bits[] = { + 0xf0, 0x0f, 0xf0, 0x0f, 0xf8, 0x1f, 0x38, 0x1c, 0x1c, 0x3c, 0x1c, 0x38, + 0x1c, 0x30, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, + 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f}; Index: 1.0.8/src/hid/gtk/gui-icons-mode-buttons.data =================================================================== --- 1.0.8/src/hid/gtk/gui-icons-mode-buttons.data (nonexistent) +++ 1.0.8/src/hid/gtk/gui-icons-mode-buttons.data (revision 1136) @@ -0,0 +1,510 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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. + * + */ + +/* XPM */ +static char *arc[] = { +/* columns rows colors chars-per-pixel */ +"21 21 4 1", +" c black", +". c #4E85b7", +"X c gray100", +"o c None", +/* pixels */ +"ooooo.ooooooooooooooo", +"ooooo.ooooooooooooooo", +"ooooo.ooooooooooooooo", +"ooooo.ooooooooooooooo", +"oooooo.oooooooooooooo", +"oooooo.oooooooooooooo", +"ooooooo.ooooooooooooo", +"ooooooo..oooooooooooo", +"oooooooo..ooooooooooo", +"oooooooooo..ooooooooo", +"oooooooooooo....ooooo", +"ooooooooooooooooooooo", +"ooo oooo oooo oo", +"oo o ooo ooo oo ooo o", +"oo o ooo ooo oo ooo o", +"o ooo oo ooo ooooo", +"o oo ooooo ooooo", +"o ooo oo o oooo ooooo", +"o ooo oo oo ooo ooo o", +"o ooo oo ooo ooo oo", +"ooooooooooooooooooooo" +}; + + +/* XPM */ +static char *buf[] = { +/* columns rows colors chars-per-pixel */ +"21 21 4 1", +" c black", +". c #D0C7AD", +"X c gray100", +"o c None", +/* pixels */ +"oooooooo oo ooooooo", +"oooooo.. o o ..ooooo", +"oooooooo oooo ooooooo", +"oooooo.. oooo ..ooooo", +"oooooooo oooo ooooooo", +"oooooo.. oooo ..ooooo", +"oooooooo oooo ooooooo", +"oooooo.. oooo ..ooooo", +"oooooooo oooo ooooooo", +"oooooo.. oooo ..ooooo", +"oooooooo ooooooo", +"ooooooooooooooooooooo", +"oo oo ooo o o", +"ooo ooo o ooo o ooooo", +"ooo ooo o ooo o ooooo", +"ooo ooo o ooo o oo", +"ooo oo ooo o ooooo", +"ooo ooo o ooo o ooooo", +"ooo ooo o ooo o ooooo", +"oo ooo oo ooooo", +"ooooooooooooooooooooo" +}; + + +/* XPM */ +static char *del[] = { +/* columns rows colors chars-per-pixel */ +"21 21 3 1", +" c black", +". c gray100", +"X c None", +/* pixels */ +"XXX XXXXXXXXXXXX XXXX", +"XXXX XXX XXX XXXXX", +"XXXXX X X XXXXXX", +"XXXXXX XX XX XXXXXXX", +"XXXXX XX XX XXXXXX", +"XXXXX XXXXXX", +"XXXXXX XXXXXXX", +"XXXXXXX XX XXXXXXXX", +"XXXXXXX XX XXXXXXXXX", +"XXXXXX X XX XXXXXXXX", +"XXXX XX X XXXXXX", +"XX XXXXX XXXX XXXX", +"XXXXXXXXXXXXXXXXXXXXX", +"XX XX X XXXXX", +"XXX XXX X XXXXX XXXXX", +"XXX XXX X XXXXX XXXXX", +"XXX XXX X XXXXX XXXXX", +"XXX XXX X XX XXXXX", +"XXX XXX X XXXXX XXXXX", +"XXX XXX X XXXXX XXXXX", +"XX XX X X" +}; + + +/* XPM */ +static char *ins[] = { +/* columns rows colors chars-per-pixel */ +"21 21 4 1", +" c black", +". c #7A8584", +"X c gray100", +"o c None", +/* pixels */ +"oooooo...oooooooooooo", +"ooooo.ooo.ooooooooooo", +"ooooo.o.o.ooooooooooo", +"oooooo....ooooooooooo", +"ooooooooooooooooooooo", +"oooo ooooo oooooooo", +"ooooooooooooooooooooo", +"oo...ooooooooooo...oo", +"o.oo..ooooooooo.ooo.o", +"o.o o...........o o.o", +"o.ooo.ooooooooo.ooo.o", +"oo...ooooooooooo...oo", +"ooooooooooooooooooooo", +"ooo o ooo oo ooo", +"oooo oo ooo o ooooooo", +"oooo oo oo o ooooooo", +"oooo oo o o oo oooo", +"oooo oo oo ooooo ooo", +"oooo oo ooo ooooo ooo", +"oooo oo ooo ooooo ooo", +"ooo o ooo o oooo" +}; + + +/* XPM */ +static char *line[] = { +/* columns rows colors chars-per-pixel */ +"21 21 5 1", +" c black", +". c #7A8584", +"X c #4E85b7", +"o c gray100", +"O c None", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOO", +"OO...OOOOOOOOOOOOOOOO", +"O.OOO.OOOOOOOOOOOOOOO", +"O.OXXXOOOOOOOOOOOOOOO", +"O.OOO.XXXOOOOOOOOOOOO", +"OO...OOOOXXXOOOO...OO", +"OOOOOOOOOOOOXXX.OOO.O", +"OOOOOOOOOOOOOOOXXXO.O", +"OOOOOOOOOOOOOOO.OOO.O", +"OOOOOOOOOOOOOOOO...OO", +"OOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOO", +" OOOO O OOOO O O", +" OOOOO OO OOO O OOOO", +" OOOOO OO O OO O OOOO", +" OOOOO OO O OO O OOOO", +" OOOOO OO OO O O OO", +" OOOOO OO OO O O OOOO", +" OOOOO OO OOO O OOOO", +" O O OOOO O O", +"OOOOOOOOOOOOOOOOOOOOO" +}; + + +/* XPM */ +static char *lock[] = { +/* columns rows colors chars-per-pixel */ +"21 21 3 1", +" c black", +". c gray100", +"X c None", +/* pixels */ +"XXXXXXXX XXXXXXXX", +"XXXXXXX XXX XXXXXXX", +"XXXXXXX XXXXX XXXXXXX", +"XXXXXX XXXXX XXXXXX", +"XXXXXX XXXXXXX XXXXXX", +"XXXXXX XXXXXXX XXXXXX", +"XXXX XXXX", +"XXXX XXXXXXXXXXX XXXX", +"XXXX XXXX", +"XXXX XXXXXXXXXXX XXXX", +"XXXX XXXX", +"XXXX XXXXXXXXXXX XXXX", +"XXXX XXXX", +"XXXXXXXXXXXXXXXXXXXXX", +"XX XXXX XXX X XX XX", +"XX XXX XX X XXX XX XX", +"XX XXX XX X XXX X XXX", +"XX XXX XX X XXX XXXX", +"XX XXX XX X XXX X XXX", +"XX XXX XX X XXX XX XX", +"XX XX XXX X XX XX" +}; + +#if 0 +/* XPM */ +static char *pan[] = { +/* columns rows colors chars-per-pixel */ +"21 21 3 1", +" c black", +". c #E7E3E7", +"X c None", +/* pixels */ +"XXXXXXXXXX XXXXXXXXXX", +"XXXXXX XX X XX XXXXXX", +"XXXXX X X X X X XX XX", +"XXXXX X X X X X X X X", +"XXXXX X X X X X X X X", +"X XX X XX X X X X", +"X X X XX XXX XX XX XX", +"X XX XXXXXXXXX X XXX", +"XX XX XXXXXXXXXXX XXX", +"XXX XXXXXXXXXXXX XXXX", +"XXXX XXXXXXXXXXX XXXX", +"XXXXX XXXXXXXXXX XXXX", +"XXXXXX XXXXX", +"XXXXXXXXXXXXXXXXXXXXX", +"XXXX XXX XX XXX XX", +"XXXX XX X XX X XX XX", +"XXXX XX X XX X X XX", +"XXXX XX X X X XX", +"XXXX XXXX XX X X XX", +"XXXX XXXX XX X XX XX", +"XXXX XXXX XX X XXX XX" +}; + +#endif +/* XPM */ +static char *poly[] = { +/* columns rows colors chars-per-pixel */ +"21 21 4 1", +" c black", +". c #6EA5D7", +"X c gray100", +"o c None", +/* pixels */ +"ooooooooooo.ooooooooo", +"oooooooooo..ooooooooo", +"ooooooooo...ooooooooo", +"oooooooo....ooooooooo", +"ooooooo.....ooooooooo", +"oooooo.......oooooooo", +"ooooo.........ooooooo", +"oooo...........oooooo", +"oooo............ooooo", +"oooo.............oooo", +"oooo..............ooo", +"ooooooooooooooooooooo", +"o ooo oo oo ooo ", +"o ooo o ooo o oo ooo ", +"o ooo o ooo o ooo o o", +"o oo ooo o oooo oo", +"o ooooo ooo o oooo oo", +"o ooooo ooo o oooo oo", +"o ooooo ooo o oooo oo", +"o oooooo oo o oo", +"ooooooooooooooooooooo" +}; + +/* XPM */ +static char * polyhole[] = { +"21 21 3 1", +" c None", +". c #6EA5D7", +"+ c #000000", +" .. ", +" ... ", +" ..... ", +" ....... ", +" ......... ", +" ....+++++... ", +" ....+ +.... ", +" ...+ +..... ", +" ...++++++...... ", +" ................ ", +" ................. ", +" ", +" + + ++ + +++ ", +" + + + + + + ", +" + + + + + + ", +" ++++ + + + +++ ", +" + + + + + + ", +" + + + + + + ", +" + + + + + + ", +" + + ++ +++ +++ ", +" " +}; + +/* XPM */ +static char *rect[] = { +/* columns rows colors chars-per-pixel */ +"21 21 4 1", +" c black", +". c #6EA5D7", +"X c gray100", +"o c None", +/* pixels */ +"ooooooooooooooooooooo", +"oo..................o", +"oo..................o", +"oo..................o", +"oo..................o", +"oo..................o", +"oo..................o", +"oo..................o", +"oo..................o", +"oo..................o", +"ooooooooooooooooooooo", +"ooooooooooooooooooooo", +"o oo oo oo ", +"o oo o oooo oo ooo oo", +"o oo o oooo oooooo oo", +"o oo oooo oooooo oo", +"o o oo oo oooooo oo", +"o oo o oooo oooooo oo", +"o oo o oooo oo ooo oo", +"o oo o oo oooo oo", +"ooooooooooooooooooooo" +}; + + +/* XPM */ +static char *rot[] = { +/* columns rows colors chars-per-pixel */ +"21 21 4 1", +" c black", +". c #4E85b7", +"X c gray100", +"o c None", +/* pixels */ +"ooooooooooo.ooooooooo", +"oooooooooo..ooooooooo", +"ooooooooo....oooooooo", +"oooooooooo..o.ooooooo", +"ooooooooooo.oo.oooooo", +"oooooooooooooo.oooooo", +"oooooooooooooo.oooooo", +"oooooooooooooo.oooooo", +"oooooooooooooo.oooooo", +"ooooooooooooo.ooooooo", +"oooooooooooo.oooooooo", +"oooooooooo..ooooooooo", +"ooooooooooooooooooooo", +"ooo ooo oo o", +"ooo ooo o ooo ooo ooo", +"ooo ooo o ooo ooo ooo", +"ooo oo ooo ooo ooo", +"ooo ooo ooo ooo ooo", +"ooo o oo ooo ooo ooo", +"ooo oo o ooo ooo ooo", +"ooo ooo oo oooo ooo" +}; + + +/* XPM */ +static char *sel[] = { +/* columns rows colors chars-per-pixel */ +"21 21 4 1", +" c black", +". c #6EA5D7", +"X c gray100", +"o c None", +/* pixels */ +"oo .. ooooooooooooooo", +"oo .... ooooooooooooo", +"ooo ...... oooooooooo", +"ooo ........ oooooooo", +"ooo ....... ooooooooo", +"oooo ..... oooooooooo", +"oooo ...... ooooooooo", +"ooooo .. ... oooooooo", +"ooooo . o ... ooooooo", +"oooooooooo ... oooooo", +"ooooooooooo .. oooooo", +"oooooooooooo ooooooo", +"ooooooooooooooooooooo", +"ooo oo o oooooo", +"oo ooo o ooooo oooooo", +"ooo oooo ooooo oooooo", +"oooo ooo oo oooooo", +"ooooo oo ooooo oooooo", +"oooooo o ooooo oooooo", +"oo ooo o ooooo oooooo", +"ooo oo o oo" +}; + + +/* XPM */ +static char *text[] = { +/* columns rows colors chars-per-pixel */ +"21 21 4 1", +" c black", +". c #4E85b7", +"X c gray100", +"o c None", +/* pixels */ +"ooooooooooooooooooooo", +"ooooooooooooooooooooo", +"ooooooooooooooooooooo", +"oo.ooo.ooo.ooo.ooo.oo", +"o.o.o.o.o.o.o.o.o.o.o", +"oo.ooo.ooo.ooo.ooo.oo", +"ooooooooooooooooooooo", +"ooooooooooooooooooooo", +"ooooooooooooooooooooo", +"ooooooooooooooooooooo", +"ooooooooooooooooooooo", +"ooooooooooooooooooooo", +" o o ooo o ", +"oo ooo ooo ooo ooo oo", +"oo ooo oooo o oooo oo", +"oo ooo ooooo ooooo oo", +"oo ooo ooo o oooo oo", +"oo ooo ooo ooo ooo oo", +"oo ooo ooo ooo ooo oo", +"oo ooo o ooo ooo oo", +"ooooooooooooooooooooo" +}; + + +/* XPM */ +static char *thrm[] = { +/* columns rows colors chars-per-pixel */ +"21 21 4 1", +" c black", +". c #69E1B0", +"X c gray100", +"o c None", +/* pixels */ +"ooooooooooooooooooooo", +"oooo ooooooooo oooooo", +"ooooo ooooooo ooooooo", +"oooooo o...o oooooooo", +"ooooooo ooo ooooooooo", +"oooooo.ooooo.oooooooo", +"oooooo.ooooo.oooooooo", +"oooooo.ooooo.oooooooo", +"ooooooo ooo ooooooooo", +"oooooo o...o oooooooo", +"ooooo ooooooo ooooooo", +"oooo ooooooooo oooooo", +"ooooooooooooooooooooo", +" o oo o oo ooo ", +"oo ooo oo o oo o o ", +"oo ooo oo o oo o o o ", +"oo ooo oo o oo o o ", +"oo ooo o o oo ooo ", +"oo ooo oo o oo o ooo ", +"oo ooo oo o oo o ooo ", +"oo ooo oo o oo o ooo " +}; + + +/* XPM */ +static char *via[] = { +/* columns rows colors chars-per-pixel */ +"21 21 4 1", +" c black", +". c #7A8584", +"X c gray100", +"o c None", +/* pixels */ +"ooooooooooooooooooooo", +"ooooooooo...ooooooooo", +"oooooooo.....oooooooo", +"ooooooo..ooo..ooooooo", +"oooooo..ooooo..oooooo", +"oooooo..ooooo..oooooo", +"oooooo..ooooo..oooooo", +"ooooooo..ooo..ooooooo", +"oooooooo.....oooooooo", +"ooooooooo...ooooooooo", +"ooooooooooooooooooooo", +"ooooooooooooooooooooo", +"ooooooooooooooooooooo", +"ooo ooo o ooo ooooo", +"ooo ooo oo ooo o oooo", +"ooo ooo oo oo ooo ooo", +"oooo o ooo oo ooo ooo", +"oooo o ooo oo ooo", +"oooo o ooo oo ooo ooo", +"ooooo ooo o ooo ooo", +"ooooooooooooooooooooo" +}; Index: 1.0.8/src/hid/gtk/gui-keyref-window.c =================================================================== --- 1.0.8/src/hid/gtk/gui-keyref-window.c (nonexistent) +++ 1.0.8/src/hid/gtk/gui-keyref-window.c (revision 1136) @@ -0,0 +1,362 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* This file written by Bill Wilson for the PCB Gtk port */ + +#include "config.h" + +#include "gui.h" + + +RCSID("$Id$"); + +static GtkWidget *keyref_window; + + +static gchar *key_ref_text[] = { + "", + N_("Keyboard\n"), + N_("Keyboard shortcuts and actions available in PCB.\n"), + N_("In below key actions, is , is \n"), + N_("and is or \n"), + "\n", + + "\ta\t", + N_("Set layer and size from line or arc\n"), + "\n", + + "a ", + N_("Unselect all objects\n"), + "\n", + + "\tb\t", + N_("Flip element to opposite side of the board\n"), + "\tb\t", + N_("Flip selected objects to opposite side of the board\n"), + "\n", + + "\tc\t", + N_("Copy selected to buffer and unselect\n"), + "\n", + + "\td\t", + N_("Display pin/pad names (numbers with View->Enable pinout shows number)\n"), + "\td\t", + N_("Open pinout window for element under cursor\n"), + "\n", + + "\te\t", + N_("Delete all rats\n"), + "\te\t", + N_("Delete selected rats\n"), + "\n", + + "\tf\t", + N_("Highlight connections to object\n"), + "\tf\t", + N_("Reset highlighted connections\n"), + "\tf\t", + N_("Cumulative highlight connections to object\n"), + "\n", + + "\tg\t", + N_("Increment grid by configured grid increment\n"), + + "\tg\t", + N_("Decrement grid by configured grid increment\n"), + "\n", + + "\th\t", + N_("Toggle visibility of element name under cursor\n"), + + "\th\t", + N_("Toggle visibility of selected element names\n"), + + "\th\t", + N_("Toggle the hole flag of object under cursor\n"), + "\n", + + "\tj\t", + N_("Toggle line/arc should clear polygons flag of object under cursor\n"), + + "\tj\t", + N_("Toggle line/arc should clear polygons flag of selected\n"), + "\n", + + "\tk\t", + N_("Increase clearance of object by configured clearance\n"), + + "\tk\t", + N_("Decrease clearance of object by configured clearance\n"), + + "\tk\t", + N_("Increase clearance of selected objects by configured clearance\n"), + + "k ", + N_("Decrease clearance of selected objects by configured clearance\n"), + "\n", + + "\tl\t", + N_("Increment current route style line size by configured line increment\n"), + + "\tl\t", + N_("Decrement current route style line size by configured line increment\n"), + "\n", + + "\tm\t", + N_("Move object to current layer\n"), + + "\tm\t", + N_("Move selected objects to current layer\n"), + + "\tm\t", + N_("Mark at cursor location for showing relative offsets\n"), + "\n", + + "\tn\t", + N_("Select the shortest unselected rat on the board\n"), + "\n", + + "\to\t", + N_("Optimize and draw all rats\n"), + + "\to\t", + N_("Optimize and draw selected rats\n"), + "\n", + + "\to\t", + N_("Change octagon flag of object\n"), + "\n", + + "\tp\t", + N_("Backup polygon drawing to previous point\n"), + + "\tp\t", + N_("Close polygon\n"), + "\n", + + "\tq\t", + N_("Toggle the square flag of an object\n"), + "\n", + + "\tr\t", + N_("Redo last undone operation\n"), + "\n", + + "\ts\t", + N_("Increment size of an object by configured size increment\n"), + "\ts\t", + N_("Decrement size of an object by configured size increment\n"), + "\ts\t", + N_("Increment drill size of a pin or via\n"), + "s ", + N_("Decrement drill size of a pin or via\n"), + "\n", + + "\tt\t", + N_("Adjust text scale so new text increases by the configured size increment\n"), + "\tt\t", + N_("Adjust text scale so new text decreases by the configured size increment\n"), + "\n", + + "\tu\t", + N_("Undo last operation\n"), + "\n", + + "\tv\t", + N_("Zoom to board extents\n"), + "\tv\t", + N_("Increment current route style via size\n"), + "v ", + N_("Decrement current route style via size\n"), + "\tv\t", + N_("Increment current route style via hole size\n"), + "v ", + N_("Decrement current route style via hole size\n"), + "\n", + + "\tx\t", + N_("Copy selection to buffer and enter pastebuffer mode\n"), + "x ", + N_("Cut selection to buffer and enter pastebuffer mode\n"), + "\n", + + "\tz\t", + N_("Zoom in\n"), + "\tz\t", + N_("Zoom out\n"), + "\n", + + "\t|\t", + N_("Toggle thin draw mode\n"), + "\n", + + "\t/\t", + N_("Cycle multiline mode (Using overrides)\n"), + "\n", + + "\t.\t", + N_("Toggle all direction lines mode\n"), + "\n", + + "\tEsc\t", + N_("If drawing an object, return to a neutral state.\n"), + "\n", + + "\tTab\t", + N_("Switch view to other side\n"), + "\n", + + " Space\t", + N_("Switch to select mode\n"), + "\n", + + "\t:\t", + N_("Enter user command or pop up command window\n"), + "\n", + + "\tDEL\t", + N_("Delete object\n"), + "\n", + + "\t1-9\t", + N_("Select drawing layers\n"), + "\n", + + "\t1-5\t", + N_("Select current buffer\n"), + "\n", + "\n", + "", + N_("Mouse\n"), + N_("Modifier key use can be combined with mouse button presses\n" "to modify mouse button actions.\n"), + "\n", + N_("Left button\n"), + N_("\tPerform or initiate action determined by current mode.\n"), + "\n", + "\t", + N_(""), + N_(" - change rotation direction for rotation tool actions.\n"), + "\n", + N_("\tAfter a draw operation has been left mouse button initiated,\n" "\tmodifier key effects:\n"), + "\t", + N_(""), + N_(" - change line 45 degree direction and arc angle direction,\n"), + "\n", + N_("Middle button\n"), + N_("\tIf a line, arc, rectangle, or polygon draw operation has been\n" + "\tinitiated, a click restarts the draw operation at the cursor position.\n"), + "\n", + N_("\tIf such a draw has not been initiated, a click selects objects and\n" "\ta press and drag moves objects.\n"), + "\n", + N_("Right button\n"), + N_("\tPress and drag to pan.\n" "\tWhile drawing or moving, a click without a drag toggles auto pan mode.\n"), + "\n\t", + N_(""), + N_(" - Popup a menu.\n"), + "\n", + N_("Scroll wheel\n"), + N_("\tZoom in/out.\n"), + "\n\t", + N_(""), + N_(" - pan vertically.\n"), + "\t", + N_(""), + N_(" - pan horizontally.\n"), + "\n", + N_("Usage:\n"), + N_("\tMouse actions can typically be combined. For example: while moving\n" + "\tan object (with left or middle press and drag), the right button may\n" + "\tbe simultaneously clicked to toggle auto pan or pressed and dragged\n" + "\tto manually pan. Mouse moving or drawing may also be combined with\n" "\tkey actions.\n"), +}; + + + + + /* Remember user window resizes. + */ +static gint keyref_window_configure_event_cb(GtkWidget * widget, GdkEventConfigure * ev, gpointer data) +{ + GtkAllocation allocation; + + gtk_widget_get_allocation(widget, &allocation); + ghidgui->keyref_window_width = allocation.width; + ghidgui->keyref_window_height = allocation.height; + ghidgui->config_modified = TRUE; + return FALSE; +} + +static void keyref_close_cb(gpointer data) +{ + gtk_widget_destroy(keyref_window); + keyref_window = NULL; +} + +static void keyref_destroy_cb(GtkWidget * widget, gpointer data) +{ + keyref_window = NULL; +} + +void ghid_keyref_window_show(gboolean raise) +{ + GtkWidget *vbox, *hbox, *button, *text; + gint i; + + if (keyref_window) { + if (raise) + gtk_window_present(GTK_WINDOW(keyref_window)); + return; + } + keyref_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + g_signal_connect(G_OBJECT(keyref_window), "destroy", G_CALLBACK(keyref_destroy_cb), NULL); + g_signal_connect(G_OBJECT(keyref_window), "configure_event", G_CALLBACK(keyref_window_configure_event_cb), NULL); + gtk_window_set_title(GTK_WINDOW(keyref_window), _("PCB Key Reference")); + gtk_window_set_wmclass(GTK_WINDOW(keyref_window), "PCB_Keyref", "PCB"); + gtk_window_set_default_size(GTK_WINDOW(keyref_window), ghidgui->keyref_window_width, ghidgui->keyref_window_height); + + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); + gtk_container_add(GTK_CONTAINER(keyref_window), vbox); + + text = ghid_scrolled_text_view(vbox, NULL, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + for (i = 0; i < sizeof(key_ref_text) / sizeof(gchar *); ++i) + ghid_text_view_append(text, _(key_ref_text[i])); + + /* The keyref window close button. + */ + hbox = gtk_hbutton_box_new(); + gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 3); + button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(keyref_close_cb), NULL); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + + gtk_widget_show_all(keyref_window); + +} Index: 1.0.8/src/hid/gtk/gui-library-window.c =================================================================== --- 1.0.8/src/hid/gtk/gui-library-window.c (nonexistent) +++ 1.0.8/src/hid/gtk/gui-library-window.c (revision 1136) @@ -0,0 +1,897 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* This file originally from the PCB Gtk port by Bill Wilson. It has + * since been combined with modified code from the gEDA project: + * + * gschem/src/ghid_library_window.c, checked out by Peter Clifton + * from gEDA/gaf commit 72581a91da08c9d69593c24756144fc18940992e + * on 3rd Jan, 2008. + * + * gEDA - GPL Electronic Design Automation + * gschem - gEDA Schematic Capture + * Copyright (C) 1998-2007 Ales Hvezda + * Copyright (C) 1998-2007 gEDA Contributors (see ChangeLog for details) + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111 USA + */ + +#include "config.h" + +#include "gui.h" +#include "global.h" +#include "buffer.h" +#include "data.h" +#include "set.h" + +#include + + +RCSID("$Id$"); + +static GtkWidget *library_window; + +#include "gui-pinout-preview.h" +#include "gui-library-window.h" + +/*! \def LIBRARY_FILTER_INTERVAL + * \brief The time interval between request and actual filtering + * + * This constant is the time-lag between user modifications in the + * filter entry and the actual evaluation of the filter which + * ultimately update the display. It helps reduce the frequency of + * evaluation of the filter as user types. + * + * Unit is milliseconds. + */ +#define LIBRARY_FILTER_INTERVAL 200 + + +static gint library_window_configure_event_cb(GtkWidget * widget, GdkEventConfigure * ev, gpointer data) +{ + GtkAllocation allocation; + + gtk_widget_get_allocation(widget, &allocation); + ghidgui->library_window_width = allocation.width; + ghidgui->library_window_height = allocation.height; + ghidgui->config_modified = TRUE; + return FALSE; +} + + +enum { + MENU_NAME_COLUMN, /* Text to display in the tree */ + MENU_LIBRARY_COLUMN, /* Pointer to the LibraryMenuType */ + MENU_ENTRY_COLUMN, /* Pointer to the LibraryEntryType */ + N_MENU_COLUMNS +}; + + +/*! \brief Process the response returned by the library dialog. + * \par Function Description + * This function handles the response arg1 of the library + * dialog dialog. + * + * Parameter user_data is a pointer on the relevant toplevel + * structure. + * + * \param [in] dialog The library dialog. + * \param [in] arg1 The response ID. + * \param [in] user_data + */ +static void library_window_callback_response(GtkDialog * dialog, gint arg1, gpointer user_data) +{ + switch (arg1) { + case GTK_RESPONSE_CLOSE: + case GTK_RESPONSE_DELETE_EVENT: + gtk_widget_destroy(GTK_WIDGET(library_window)); + library_window = NULL; + break; + + default: + /* Do nothing, in case there's another handler function which + can handle the response ID received. */ + break; + } +} + + +/*! \brief Creates a library dialog. + * \par Function Description + * This function create the library dialog if it is not already created. + * It does not show the dialog, use ghid_library_window_show for that. + * + */ +void ghid_library_window_create(GHidPort * out) +{ + GtkWidget *current_tab, *entry_filter; + GtkNotebook *notebook; + + if (library_window) + return; + + library_window = (GtkWidget *) g_object_new(GHID_TYPE_LIBRARY_WINDOW, NULL); + + g_signal_connect(library_window, "response", G_CALLBACK(library_window_callback_response), NULL); + g_signal_connect(G_OBJECT(library_window), "configure_event", G_CALLBACK(library_window_configure_event_cb), NULL); + gtk_window_set_default_size(GTK_WINDOW(library_window), ghidgui->library_window_width, ghidgui->library_window_height); + + gtk_window_set_title(GTK_WINDOW(library_window), _("PCB Library")); + gtk_window_set_wmclass(GTK_WINDOW(library_window), "PCB_Library", "PCB"); + + gtk_widget_realize(library_window); + if (Settings.AutoPlace) + gtk_window_move(GTK_WINDOW(library_window), 10, 10); + + gtk_editable_select_region(GTK_EDITABLE(GHID_LIBRARY_WINDOW(library_window)->entry_filter), 0, -1); + + /* Set the focus to the filter entry only if it is in the current + displayed tab */ + notebook = GTK_NOTEBOOK(GHID_LIBRARY_WINDOW(library_window)->viewtabs); + current_tab = gtk_notebook_get_nth_page(notebook, gtk_notebook_get_current_page(notebook)); + entry_filter = GTK_WIDGET(GHID_LIBRARY_WINDOW(library_window)->entry_filter); + if (gtk_widget_is_ancestor(entry_filter, current_tab)) { + gtk_widget_grab_focus(entry_filter); + } +} + +/*! \brief Show the library dialog. + * \par Function Description + * This function show the library dialog, creating it if it is not + * already created, and presents it to the user (brings it to the + * front with focus). + */ +void ghid_library_window_show(GHidPort * out, gboolean raise) +{ + ghid_library_window_create(out); + gtk_widget_show_all(library_window); + if (raise) + gtk_window_present(GTK_WINDOW(library_window)); +} + +static GObjectClass *library_window_parent_class = NULL; + + +/*! \brief Determines visibility of items of the library treeview. + * \par Function Description + * This is the function used to filter entries of the footprint + * selection tree. + * + * \param [in] model The current selection in the treeview. + * \param [in] iter An iterator on a footprint or folder in the tree. + * \param [in] data The library dialog. + * \returns TRUE if item should be visible, FALSE otherwise. + */ +static gboolean lib_model_filter_visible_func(GtkTreeModel * model, GtkTreeIter * iter, gpointer data) +{ + GhidLibraryWindow *library_window = (GhidLibraryWindow *) data; + const gchar *compname; + gchar *compname_upper, *text_upper, *pattern; + const gchar *text_; + char text[1024]; + gboolean ret; + char *p, *tags; + int len, is_para = 0; + + g_assert(GHID_IS_LIBRARY_WINDOW(data)); + + text_ = gtk_entry_get_text(library_window->entry_filter); + if (g_ascii_strcasecmp(text_, "") == 0) { + return TRUE; + } + +/* TODO: do these only once.... */ + p = strchr(text_, '('); + if (p != NULL) { + len = p - text_; + is_para = 1; + } + else + len = sizeof(text) - 1; + + strncpy(text, text_, len); + text[len] = '\0'; + + /* apply tags on non-parametrics */ + if (!is_para) { + tags = strchr(text, ' '); + if (tags != NULL) { + *tags = '\0'; + tags++; + while (isspace(*tags)) + tags++; + if (*tags == '\0') + tags = NULL; + } + } + else + tags = NULL; + + /* If this is a source, only display it if it has children that + * match */ + if (gtk_tree_model_iter_has_child(model, iter)) { + GtkTreeIter iter2; + + gtk_tree_model_iter_children(model, &iter2, iter); + ret = FALSE; + do { + if (lib_model_filter_visible_func(model, &iter2, data)) { + ret = TRUE; + break; + } + } + while (gtk_tree_model_iter_next(model, &iter2)); + } + else { + gtk_tree_model_get(model, iter, MENU_NAME_COLUMN, &compname, -1); + /* Do a case insensitive comparison, converting the strings + to uppercase */ + compname_upper = g_ascii_strup(compname, -1); + text_upper = g_ascii_strup(text, -1); + if (is_para) + pattern = g_strconcat("*", text_upper, "(*", NULL); + else + pattern = g_strconcat("*", text_upper, "*", NULL); + + ret = g_pattern_match_simple(pattern, compname_upper); + + if ((tags != NULL) && ret) { + LibraryEntryType *entry = NULL; + gtk_tree_model_get(model, iter, MENU_ENTRY_COLUMN, &entry, -1); + if ((entry != NULL) && (entry->Tags != NULL)) { + char *next, *tag; + int found; + void **t; + const void *need; + + for (tag = tags; tag != NULL; tag = next) { + next = strpbrk(tag, " \t\r\n"); + if (next != NULL) { + *next = '\0'; + next++; + while (isspace(*next)) + next++; + } + need = pcb_fp_tag(tag, 0); + fprintf(stderr, "TAG: '%s' %p\n", tag, need); + if (need == NULL) { + ret = FALSE; + break; + } + found = 0; + for (t = entry->Tags; *t != NULL; t++) { + if (*t == need) { + found = 1; + break; + } + } + if (!found) { + ret = FALSE; + break; + } + } + } + else + ret = FALSE; + } + + g_free(compname_upper); + g_free(text_upper); + g_free(pattern); + } + + return ret; +} + + +/*! \brief Handles activation (e.g. double-clicking) of a component row + * \par Function Description + * Component row activated handler: + * As a convenince to the user, expand / contract any node with children. + * + * \param [in] tree_view The component treeview. + * \param [in] path The GtkTreePath to the activated row. + * \param [in] column The GtkTreeViewColumn in which the activation occurre + * \param [in] user_data The component selection dialog. + */ +static void tree_row_activated(GtkTreeView * tree_view, GtkTreePath * path, GtkTreeViewColumn * column, gpointer user_data) +{ + GtkTreeModel *model; + GtkTreeIter iter; + + model = gtk_tree_view_get_model(tree_view); + gtk_tree_model_get_iter(model, &iter, path); + + if (!gtk_tree_model_iter_has_child(model, &iter)) + return; + + if (gtk_tree_view_row_expanded(tree_view, path)) + gtk_tree_view_collapse_row(tree_view, path); + else + gtk_tree_view_expand_row(tree_view, path, FALSE); +} + +/*! \brief Handles CTRL-C keypress in the TreeView + * \par Function Description + * Keypress activation handler: + * If CTRL-C is pressed, copy footprint name into the clipboard. + * + * \param [in] tree_view The component treeview. + * \param [in] event The GdkEventKey with keypress info. + * \param [in] user_data Not used. + * \return TRUE if CTRL-C event was handled, FALSE otherwise. + */ +static gboolean tree_row_key_pressed(GtkTreeView * tree_view, GdkEventKey * event, gpointer user_data) +{ + GtkTreeSelection *selection; + GtkTreeModel *model; + GtkTreeIter iter; + GtkClipboard *clipboard; + const gchar *compname; + guint default_mod_mask = gtk_accelerator_get_default_mod_mask(); + + /* Handle both lower- and uppercase `c' */ + if (((event->state & default_mod_mask) != GDK_CONTROL_MASK) + || ((event->keyval != GDK_c) && (event->keyval != GDK_C))) + return FALSE; + + selection = gtk_tree_view_get_selection(tree_view); + g_return_val_if_fail(selection != NULL, TRUE); + + if (!gtk_tree_selection_get_selected(selection, &model, &iter)) + return TRUE; + + gtk_tree_model_get(model, &iter, MENU_NAME_COLUMN, &compname, -1); + + clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); + g_return_val_if_fail(clipboard != NULL, TRUE); + + gtk_clipboard_set_text(clipboard, compname, -1); + + return TRUE; +} + +static void library_window_preview_refresh(GhidLibraryWindow * library_window, const char *name, LibraryEntryType * entry) +{ + GString *pt; + + /* -1 flags this is an element file part and the file path is in + | entry->AllocateMemory. + */ + if (LoadElementToBuffer(PASTEBUFFER, name == NULL ? entry->AllocatedMemory : name)) + SetMode(PASTEBUFFER_MODE); + + /* update the preview with new symbol data */ + if ((PASTEBUFFER->Data != NULL) && (PASTEBUFFER->Data->Element != NULL) && (PASTEBUFFER->Data->Element->data != NULL)) + g_object_set(library_window->preview, "element-data", PASTEBUFFER->Data->Element->data, NULL); + else { + g_object_set(library_window->preview, "element-data", NULL, NULL); + } + + /* update the text */ + pt = g_string_new("Tags:"); + if ((entry != NULL) && (entry->Tags != NULL)) { + void **t; + + + for (t = entry->Tags; *t != NULL; t++) { + const char *name = pcb_fp_tagname(*t); + if (name != NULL) { + g_string_append(pt, "\n "); + g_string_append(pt, name); + } + } + } + g_string_append(pt, "\n"); + gtk_label_set_text(GTK_LABEL(library_window->preview_text), g_string_free(pt, FALSE)); +} + +/*! \brief Handles changes in the treeview selection. + * \par Function Description + * This is the callback function that is called every time the user + * select a row the library treeview of the dialog. + * + * If the selection is not a selection of a footprint, it does + * nothing. Otherwise it updates the preview and Element data. + * + * \param [in] selection The current selection in the treeview. + * \param [in] user_data The library dialog. + */ +static void library_window_callback_tree_selection_changed(GtkTreeSelection * selection, gpointer user_data) +{ + GtkTreeModel *model; + GtkTreeIter iter; + GhidLibraryWindow *library_window = (GhidLibraryWindow *) user_data; + LibraryEntryType *entry = NULL; + + if (!gtk_tree_selection_get_selected(selection, &model, &iter)) + return; + + gtk_tree_model_get(model, &iter, MENU_ENTRY_COLUMN, &entry, -1); + + if (entry == NULL) + return; + + library_window_preview_refresh(library_window, NULL, entry); +} + +/*! \brief Requests re-evaluation of the filter. + * \par Function Description + * This is the timeout function for the filtering of footprint + * in the tree of the dialog. + * + * The timeout this callback is attached to is removed after the + * function. + * + * \param [in] data The library dialog. + * \returns FALSE to remove the timeout. + */ +static gboolean library_window_filter_timeout(gpointer data) +{ + GhidLibraryWindow *library_window = GHID_LIBRARY_WINDOW(data); + GtkTreeModel *model; + + /* resets the source id in library_window */ + library_window->filter_timeout = 0; + + model = gtk_tree_view_get_model(library_window->libtreeview); + + if (model != NULL) { + const gchar *text = gtk_entry_get_text(library_window->entry_filter); + gtk_tree_model_filter_refilter((GtkTreeModelFilter *) model); + if (strcmp(text, "") != 0) { + /* filter text not-empty */ + gtk_tree_view_expand_all(library_window->libtreeview); + + /* parametric footprints need to be refreshed on edit */ + if (strchr(text, ')') != NULL) + library_window_preview_refresh(library_window, text, NULL); + + } + else { + /* filter text is empty, collapse expanded tree */ + gtk_tree_view_collapse_all(library_window->libtreeview); + } + + + + } + + + /* return FALSE to remove the source */ + return FALSE; +} + +/*! \brief Callback function for the changed signal of the filter entry. + * \par Function Description + * This function monitors changes in the entry filter of the dialog. + * + * It specifically manages the sensitivity of the clear button of the + * entry depending on its contents. It also requests an update of the + * footprint list by re-evaluating filter at every changes. + * + * \param [in] editable The filter text entry. + * \param [in] user_data The library dialog. + */ +static void library_window_callback_filter_entry_changed(GtkEditable * editable, gpointer user_data) +{ + GhidLibraryWindow *library_window = GHID_LIBRARY_WINDOW(user_data); + GtkWidget *button; + gboolean sensitive; + + /* turns button off if filter entry is empty */ + /* turns it on otherwise */ + button = GTK_WIDGET(library_window->button_clear); + sensitive = (g_ascii_strcasecmp(gtk_entry_get_text(library_window->entry_filter), "") != 0); + gtk_widget_set_sensitive(button, sensitive); + + /* Cancel any pending update of the footprint list filter */ + if (library_window->filter_timeout != 0) + g_source_remove(library_window->filter_timeout); + + /* Schedule an update of the footprint list filter in + * LIBRARY_FILTER_INTERVAL milliseconds */ + library_window->filter_timeout = g_timeout_add(LIBRARY_FILTER_INTERVAL, library_window_filter_timeout, library_window); + +} + +/*! \brief Handles a click on the clear button. + * \par Function Description + * This is the callback function called every time the user press the + * clear button associated with the filter. + * + * It resets the filter entry, indirectly causing re-evaluation + * of the filter on the list of symbols to update the display. + * + * \param [in] editable The filter text entry. + * \param [in] user_data The library dialog. + */ +static void library_window_callback_filter_button_clicked(GtkButton * button, gpointer user_data) +{ + GhidLibraryWindow *library_window = GHID_LIBRARY_WINDOW(user_data); + + /* clears text in text entry for filter */ + gtk_entry_set_text(library_window->entry_filter, ""); + +} + +/* \brief Create the tree model for the "Library" view. + * \par Function Description + * Creates a tree where the branches are the available library + * sources and the leaves are the footprints. + */ +static GtkTreeModel *create_lib_tree_model(GhidLibraryWindow * library_window) +{ + GtkTreeStore *tree; + GtkTreeIter iter, p_iter, e_iter, c_iter; + gchar *name; + gboolean exists; + + tree = gtk_tree_store_new(N_MENU_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_POINTER); + + MENU_LOOP(&Library); + { + /* Watch for directory changes of library parts and create new + | parent iter at each change. + */ + if (!menu->directory) /* Shouldn't happen */ + menu->directory = g_strdup("???"); + + exists = FALSE; + if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(tree), &e_iter)) + do { + gtk_tree_model_get(GTK_TREE_MODEL(tree), &e_iter, MENU_NAME_COLUMN, &name, -1); + if (!strcmp(name, menu->directory)) { + exists = TRUE; + break; + } + } + while (gtk_tree_model_iter_next(GTK_TREE_MODEL(tree), &e_iter)); + + if (exists) + p_iter = e_iter; + else { + gtk_tree_store_append(tree, &p_iter, NULL); + gtk_tree_store_set(tree, &p_iter, + MENU_NAME_COLUMN, menu->directory, MENU_LIBRARY_COLUMN, NULL, MENU_ENTRY_COLUMN, NULL, -1); + } + gtk_tree_store_append(tree, &iter, &p_iter); + gtk_tree_store_set(tree, &iter, MENU_NAME_COLUMN, menu->Name, MENU_LIBRARY_COLUMN, menu, MENU_ENTRY_COLUMN, NULL, -1); + ENTRY_LOOP(menu); + { + gtk_tree_store_append(tree, &c_iter, &iter); + gtk_tree_store_set(tree, &c_iter, + MENU_NAME_COLUMN, entry->ListEntry, MENU_LIBRARY_COLUMN, menu, MENU_ENTRY_COLUMN, entry, -1); + } + END_LOOP; + + } + END_LOOP; + + return (GtkTreeModel *) tree; +} + + +#if 0 +/* \brief On-demand refresh of the footprint library. + * \par Function Description + * Requests a rescan of the footprint library in order to pick up any + * new signals, and then updates the library window. + */ +static void library_window_callback_refresh_library(GtkButton * button, gpointer user_data) +{ + GhidLibraryWindow *library_window = GHID_LIBRARY_WINDOW(user_data); + GtkTreeModel *model; + + /* Rescan the libraries for symbols */ + /* TODO: How do we do this in PCB? */ + + /* Refresh the "Library" view */ + model = (GtkTreeModel *) + g_object_new(GTK_TYPE_TREE_MODEL_FILTER, "child-model", create_lib_tree_model(library_window), "virtual-root", NULL, NULL); + + gtk_tree_model_filter_set_visible_func((GtkTreeModelFilter *) model, lib_model_filter_visible_func, library_window, NULL); + + gtk_tree_view_set_model(library_window->libtreeview, model); +} +#endif + + +/*! \brief Creates the treeview for the "Library" view */ +static GtkWidget *create_lib_treeview(GhidLibraryWindow * library_window) +{ + GtkWidget *libtreeview, *vbox, *scrolled_win, *label, *hbox, *entry, *button; + GtkTreeModel *child_model, *model; + GtkTreeSelection *selection; + GtkCellRenderer *renderer; + GtkTreeViewColumn *column; + + /* -- library selection view -- */ + + /* vertical box for footprint selection and search entry */ + vbox = GTK_WIDGET(g_object_new(GTK_TYPE_VBOX, + /* GtkContainer */ + "border-width", 5, + /* GtkBox */ + "homogeneous", FALSE, "spacing", 5, NULL)); + + child_model = create_lib_tree_model(library_window); + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(child_model), MENU_NAME_COLUMN, GTK_SORT_ASCENDING); + model = (GtkTreeModel *) g_object_new(GTK_TYPE_TREE_MODEL_FILTER, "child-model", child_model, "virtual-root", NULL, NULL); + + scrolled_win = GTK_WIDGET(g_object_new(GTK_TYPE_SCROLLED_WINDOW, + /* GtkScrolledWindow */ + "hscrollbar-policy", + GTK_POLICY_AUTOMATIC, + "vscrollbar-policy", GTK_POLICY_ALWAYS, "shadow-type", GTK_SHADOW_ETCHED_IN, NULL)); + /* create the treeview */ + libtreeview = GTK_WIDGET(g_object_new(GTK_TYPE_TREE_VIEW, + /* GtkTreeView */ + "model", model, "rules-hint", TRUE, "headers-visible", FALSE, NULL)); + + g_signal_connect(libtreeview, "row-activated", G_CALLBACK(tree_row_activated), NULL); + + g_signal_connect(libtreeview, "key-press-event", G_CALLBACK(tree_row_key_pressed), NULL); + + /* connect callback to selection */ + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(libtreeview)); + gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); + g_signal_connect(selection, "changed", G_CALLBACK(library_window_callback_tree_selection_changed), library_window); + + /* insert a column to treeview for library/symbol name */ + renderer = GTK_CELL_RENDERER(g_object_new(GTK_TYPE_CELL_RENDERER_TEXT, + /* GtkCellRendererText */ + "editable", FALSE, NULL)); + column = GTK_TREE_VIEW_COLUMN(g_object_new(GTK_TYPE_TREE_VIEW_COLUMN, + /* GtkTreeViewColumn */ + "title", _("Components"), NULL)); + gtk_tree_view_column_pack_start(column, renderer, TRUE); + gtk_tree_view_column_set_attributes(column, renderer, "text", MENU_NAME_COLUMN, NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW(libtreeview), column); + + /* add the treeview to the scrolled window */ + gtk_container_add(GTK_CONTAINER(scrolled_win), libtreeview); + /* set directory/footprint treeview of library_window */ + library_window->libtreeview = GTK_TREE_VIEW(libtreeview); + + /* add the scrolled window for directories to the vertical box */ + gtk_box_pack_start(GTK_BOX(vbox), scrolled_win, TRUE, TRUE, 0); + + + /* -- filter area -- */ + hbox = GTK_WIDGET(g_object_new(GTK_TYPE_HBOX, + /* GtkBox */ + "homogeneous", FALSE, "spacing", 3, NULL)); + + /* create the entry label */ + label = GTK_WIDGET(g_object_new(GTK_TYPE_LABEL, + /* GtkMisc */ + "xalign", 0.0, + /* GtkLabel */ + "label", _("Filter:"), NULL)); + /* add the search label to the filter area */ + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + + /* create the text entry for filter in footprints */ + entry = GTK_WIDGET(g_object_new(GTK_TYPE_ENTRY, + /* GtkEntry */ + "text", "", NULL)); + g_signal_connect(entry, "changed", G_CALLBACK(library_window_callback_filter_entry_changed), library_window); + + /* now that that we have an entry, set the filter func of model */ + gtk_tree_model_filter_set_visible_func((GtkTreeModelFilter *) model, lib_model_filter_visible_func, library_window, NULL); + + /* add the filter entry to the filter area */ + gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 0); + /* set filter entry of library_window */ + library_window->entry_filter = GTK_ENTRY(entry); + /* and init the event source for footprint filter */ + library_window->filter_timeout = 0; + + /* create the erase button for filter entry */ + button = GTK_WIDGET(g_object_new(GTK_TYPE_BUTTON, + /* GtkWidget */ + "sensitive", FALSE, + /* GtkButton */ + "relief", GTK_RELIEF_NONE, NULL)); + + gtk_container_add(GTK_CONTAINER(button), gtk_image_new_from_stock(GTK_STOCK_CLEAR, GTK_ICON_SIZE_SMALL_TOOLBAR)); + g_signal_connect(button, "clicked", G_CALLBACK(library_window_callback_filter_button_clicked), library_window); + /* add the clear button to the filter area */ + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + /* set clear button of library_window */ + library_window->button_clear = GTK_BUTTON(button); + +#if 0 + /* create the refresh button */ + button = GTK_WIDGET(g_object_new(GTK_TYPE_BUTTON, + /* GtkWidget */ + "sensitive", TRUE, + /* GtkButton */ + "relief", GTK_RELIEF_NONE, NULL)); + gtk_container_add(GTK_CONTAINER(button), gtk_image_new_from_stock(GTK_STOCK_REFRESH, GTK_ICON_SIZE_SMALL_TOOLBAR)); + /* add the refresh button to the filter area */ + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + g_signal_connect(button, "clicked", G_CALLBACK(library_window_callback_refresh_library), library_window); +#endif + + /* add the filter area to the vertical box */ + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + + library_window->libtreeview = GTK_TREE_VIEW(libtreeview); + + return vbox; +} + + +static GObject *library_window_constructor(GType type, guint n_construct_properties, GObjectConstructParam * construct_params) +{ + GObject *object; + GhidLibraryWindow *library_window; + GtkWidget *content_area; + GtkWidget *hpaned, *notebook; + GtkWidget *libview; + GtkWidget *preview, *preview_text; + GtkWidget *alignment, *frame; + + /* chain up to constructor of parent class */ + object = G_OBJECT_CLASS(library_window_parent_class)->constructor(type, n_construct_properties, construct_params); + library_window = GHID_LIBRARY_WINDOW(object); + + /* dialog initialization */ + g_object_set(object, + /* GtkWindow */ + "type", GTK_WINDOW_TOPLEVEL, + "title", _("Select Footprint..."), + "default-height", 300, "default-width", 400, "modal", FALSE, "window-position", GTK_WIN_POS_NONE, + /* GtkDialog */ + "has-separator", TRUE, NULL); + g_object_set(gtk_dialog_get_content_area(GTK_DIALOG(library_window)), "homogeneous", FALSE, NULL); + + /* horizontal pane containing selection and preview */ + hpaned = GTK_WIDGET(g_object_new(GTK_TYPE_HPANED, + /* GtkContainer */ + "border-width", 5, NULL)); + library_window->hpaned = hpaned; + + /* notebook for library views */ + notebook = GTK_WIDGET(g_object_new(GTK_TYPE_NOTEBOOK, "show-tabs", FALSE, NULL)); + library_window->viewtabs = GTK_NOTEBOOK(notebook); + + libview = create_lib_treeview(library_window); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), libview, gtk_label_new(_("Libraries"))); + + /* include the vertical box in horizontal box */ + gtk_paned_pack1(GTK_PANED(hpaned), notebook, TRUE, FALSE); + + + /* -- preview area -- */ + frame = GTK_WIDGET(g_object_new(GTK_TYPE_FRAME, + /* GtkFrame */ + "label", _("Preview"), NULL)); + alignment = GTK_WIDGET(g_object_new(GTK_TYPE_ALIGNMENT, + /* GtkAlignment */ + "left-padding", 5, + "right-padding", 5, + "top-padding", 5, + "bottom-padding", 5, "xscale", 1.0, "yscale", 1.0, "xalign", 0.5, "yalign", 0.5, NULL)); + preview = (GtkWidget *) g_object_new(GHID_TYPE_PINOUT_PREVIEW, + /* GhidPinoutPreview */ + "element-data", NULL, + /* GtkWidget */ + "width-request", 150, "height-request", 150, NULL); + + preview_text = gtk_label_new(""); + + { + GtkWidget *vbox = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), preview, TRUE, TRUE, 0); + gtk_box_pack_end(GTK_BOX(vbox), preview_text, FALSE, FALSE, 0); + + gtk_container_add(GTK_CONTAINER(alignment), vbox); + gtk_container_add(GTK_CONTAINER(frame), alignment); + } + + /* set preview of library_window */ + library_window->preview = preview; + library_window->preview_text = preview_text; + + gtk_paned_pack2(GTK_PANED(hpaned), frame, FALSE, FALSE); + + /* add the hpaned to the dialog content area */ + content_area = gtk_dialog_get_content_area(GTK_DIALOG(library_window)); + gtk_box_pack_start(GTK_BOX(content_area), hpaned, TRUE, TRUE, 0); + gtk_widget_show_all(hpaned); + + + /* now add buttons in the action area */ + gtk_dialog_add_buttons(GTK_DIALOG(library_window), + /* - close button */ + GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); + + return object; +} + +static void library_window_finalize(GObject * object) +{ + GhidLibraryWindow *library_window = GHID_LIBRARY_WINDOW(object); + + if (library_window->filter_timeout != 0) { + g_source_remove(library_window->filter_timeout); + library_window->filter_timeout = 0; + } + + G_OBJECT_CLASS(library_window_parent_class)->finalize(object); +} + + +static void library_window_class_init(GhidLibraryWindowClass * klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS(klass); + + gobject_class->constructor = library_window_constructor; + gobject_class->finalize = library_window_finalize; + + library_window_parent_class = (GObjectClass *) g_type_class_peek_parent(klass); +} + + +GType ghid_library_window_get_type() +{ + static GType library_window_type = 0; + + if (!library_window_type) { + static const GTypeInfo library_window_info = { + sizeof(GhidLibraryWindowClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) library_window_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(GhidLibraryWindow), + 0, /* n_preallocs */ + NULL /* instance_init */ + }; + + library_window_type = g_type_register_static(GTK_TYPE_DIALOG, "GhidLibraryWindow", &library_window_info, (GTypeFlags) 0); + } + + return library_window_type; +} Index: 1.0.8/src/hid/gtk/gui-library-window.h =================================================================== --- 1.0.8/src/hid/gtk/gui-library-window.h (nonexistent) +++ 1.0.8/src/hid/gtk/gui-library-window.h (revision 1136) @@ -0,0 +1,59 @@ +/* gEDA - GPL Electronic Design Automation + * gschem - gEDA Schematic Capture + * Copyright (C) 1998-2004 Ales V. Hvezda + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Library 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. + */ + + +#ifndef PCB_HID_GTK_GUI_LIBRARY_WINDOW_H +#define PCB_HID_GTK_GUI_LIBRARY_WINDOW_H + + +/* + * GhidLibraryWindow + */ + +#define GHID_TYPE_LIBRARY_WINDOW (ghid_library_window_get_type()) +#define GHID_LIBRARY_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GHID_TYPE_LIBRARY_WINDOW, GhidLibraryWindow)) +#define GHID_LIBRARY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GHID_TYPE_LIBRARY_WINDOW, GhidLibraryWindowClass)) +#define GHID_IS_LIBRARY_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GHID_TYPE_LIBRARY_WINDOW)) +#define GHID_GET_LIBRARY_WINDOW_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GHID_TYPE_LIBRARY, GhidLibraryWindowClass)) + +typedef struct _GhidLibraryWindowClass GhidLibraryWindowClass; +typedef struct _GhidLibraryWindow GhidLibraryWindow; + + +struct _GhidLibraryWindowClass { + GtkDialogClass parent_class; +}; + +struct _GhidLibraryWindow { + GtkDialog parent_instance; + + GtkWidget *hpaned; + GtkTreeView *libtreeview; + GtkNotebook *viewtabs; + GtkWidget *preview; + GtkWidget *preview_text; + GtkEntry *entry_filter; + GtkButton *button_clear; + guint filter_timeout; +}; + + +GType ghid_library_window_get_type(void); + +#endif /* PCB_HID_GTK_GUI_LIBRARY_WINDOW_H */ Index: 1.0.8/src/hid/gtk/gui-log-window.c =================================================================== --- 1.0.8/src/hid/gtk/gui-log-window.c (nonexistent) +++ 1.0.8/src/hid/gtk/gui-log-window.c (revision 1136) @@ -0,0 +1,156 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* This file written by Bill Wilson for the PCB Gtk port +*/ + +#include "config.h" + +#include "gui.h" +#include "pcb-printf.h" + + +RCSID("$Id$"); + +static GtkWidget *log_window, *log_text; +static gboolean log_show_on_append = FALSE; + +/* Remember user window resizes. */ +static gint log_window_configure_event_cb(GtkWidget * widget, GdkEventConfigure * ev, gpointer data) +{ + GtkAllocation allocation; + + gtk_widget_get_allocation(widget, &allocation); + ghidgui->log_window_width = allocation.width; + ghidgui->log_window_height = allocation.height; + ghidgui->config_modified = TRUE; + + return FALSE; +} + +static void log_close_cb(gpointer data) +{ + gtk_widget_destroy(log_window); + log_window = NULL; +} + +static void log_destroy_cb(GtkWidget * widget, gpointer data) +{ + log_window = NULL; +} + +void ghid_log_window_create() +{ + GtkWidget *vbox, *hbox, *button; + + if ((log_window) || (ghidgui == NULL)) + return; + + log_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + g_signal_connect(G_OBJECT(log_window), "destroy", G_CALLBACK(log_destroy_cb), NULL); + g_signal_connect(G_OBJECT(log_window), "configure_event", G_CALLBACK(log_window_configure_event_cb), NULL); + gtk_window_set_title(GTK_WINDOW(log_window), _("PCB Log")); + gtk_window_set_wmclass(GTK_WINDOW(log_window), "PCB_Log", "PCB"); + gtk_window_set_default_size(GTK_WINDOW(log_window), ghidgui->log_window_width, ghidgui->log_window_height); + + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); + gtk_container_add(GTK_CONTAINER(log_window), vbox); + + log_text = ghid_scrolled_text_view(vbox, NULL, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + + hbox = gtk_hbutton_box_new(); + gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(log_close_cb), NULL); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + + gtk_widget_realize(log_window); + if (Settings.AutoPlace) + gtk_window_move(GTK_WINDOW(log_window), 10, 10); +} + +void ghid_log_window_show(gboolean raise) +{ + ghid_log_window_create(); + gtk_widget_show_all(log_window); + if (raise) + gtk_window_present(GTK_WINDOW(log_window)); +} + +static void ghid_log_append_string(gchar * s) +{ + if (log_show_on_append) + ghid_log_window_show(FALSE); + else + ghid_log_window_create(); + ghid_text_view_append(log_text, s); +} + +void ghid_log(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + ghid_logv(fmt, ap); + va_end(ap); +} + +void ghid_logv(const char *fmt, va_list args) +{ + gchar *msg = pcb_vprintf(fmt, args); + ghid_log_append_string(msg); + g_free(msg); +} + +static const char logshowonappend_syntax[] = "LogShowOnAppend(true|false)"; + +static const char logshowonappend_help[] = "If true, the log window will be shown whenever something is appended \ +to it. If false, the log will still be updated, but the window won't \ +be shown."; + +static gint GhidLogShowOnAppend(int argc, char **argv, Coord x, Coord y) +{ + char *a = argc == 1 ? argv[0] : (char *) ""; + + if (strncasecmp(a, "t", 1) == 0) { + log_show_on_append = TRUE; + } + else if (strncasecmp(a, "f", 1) == 0) { + log_show_on_append = FALSE; + } + return 0; +} + +HID_Action ghid_log_action_list[] = { + {"LogShowOnAppend", 0, GhidLogShowOnAppend, + logshowonappend_help, logshowonappend_syntax} + , +}; + +REGISTER_ACTIONS(ghid_log_action_list) Index: 1.0.8/src/hid/gtk/gui-misc.c =================================================================== --- 1.0.8/src/hid/gtk/gui-misc.c (nonexistent) +++ 1.0.8/src/hid/gtk/gui-misc.c (revision 1136) @@ -0,0 +1,402 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* This file was originally written by Bill Wilson for the PCB Gtk port */ + +#include "config.h" + +#include "global.h" +#include "crosshair.h" +#include "data.h" +#include "misc.h" +#include "action.h" +#include "set.h" +#include "pcb-printf.h" + +#include "gui.h" +#include + + +RCSID("$Id$"); + +#define CUSTOM_CURSOR_CLOCKWISE (GDK_LAST_CURSOR + 10) +#define CUSTOM_CURSOR_DRAG (GDK_LAST_CURSOR + 11) +#define CUSTOM_CURSOR_LOCK (GDK_LAST_CURSOR + 12) + +#define ICON_X_HOT 8 +#define ICON_Y_HOT 8 + + +GdkPixmap *XC_clock_source, *XC_clock_mask, *XC_hand_source, *XC_hand_mask, *XC_lock_source, *XC_lock_mask; + + +static GdkCursorType oldCursor; + +void ghid_status_line_set_text(const gchar * text) +{ + if (ghidgui->command_entry_status_line_active) + return; + + ghid_label_set_markup(ghidgui->status_line_label, text); +} + +void ghid_cursor_position_label_set_text(gchar * text) +{ + ghid_label_set_markup(ghidgui->cursor_position_absolute_label, text); +} + +void ghid_cursor_position_relative_label_set_text(gchar * text) +{ + ghid_label_set_markup(ghidgui->cursor_position_relative_label, text); +} + +static GdkCursorType gport_set_cursor(GdkCursorType shape) +{ + GdkWindow *window; + GdkCursorType old_shape = gport->X_cursor_shape; + GdkColor fg = { 0, 65535, 65535, 65535 }; /* white */ + GdkColor bg = { 0, 0, 0, 0 }; /* black */ + + if (gport->drawing_area == NULL) + return GDK_X_CURSOR; + + window = gtk_widget_get_window(gport->drawing_area); + + if (gport->X_cursor_shape == shape) + return shape; + + /* check if window exists to prevent from fatal errors */ + if (window == NULL) + return GDK_X_CURSOR; + + gport->X_cursor_shape = shape; + if (shape > GDK_LAST_CURSOR) { + if (shape == CUSTOM_CURSOR_CLOCKWISE) + gport->X_cursor = gdk_cursor_new_from_pixmap(XC_clock_source, XC_clock_mask, &fg, &bg, ICON_X_HOT, ICON_Y_HOT); + else if (shape == CUSTOM_CURSOR_DRAG) + gport->X_cursor = gdk_cursor_new_from_pixmap(XC_hand_source, XC_hand_mask, &fg, &bg, ICON_X_HOT, ICON_Y_HOT); + else if (shape == CUSTOM_CURSOR_LOCK) + gport->X_cursor = gdk_cursor_new_from_pixmap(XC_lock_source, XC_lock_mask, &fg, &bg, ICON_X_HOT, ICON_Y_HOT); + } + else + gport->X_cursor = gdk_cursor_new(shape); + + gdk_window_set_cursor(window, gport->X_cursor); + gdk_cursor_unref(gport->X_cursor); + + return old_shape; +} + +void ghid_point_cursor(void) +{ + oldCursor = gport_set_cursor(GDK_DRAPED_BOX); +} + +void ghid_hand_cursor(void) +{ + oldCursor = gport_set_cursor(GDK_HAND2); +} + +void ghid_watch_cursor(void) +{ + GdkCursorType tmp; + + tmp = gport_set_cursor(GDK_WATCH); + if (tmp != GDK_WATCH) + oldCursor = tmp; +} + +void ghid_mode_cursor(int Mode) +{ + switch (Mode) { + case NO_MODE: + gport_set_cursor((GdkCursorType) CUSTOM_CURSOR_DRAG); + break; + + case VIA_MODE: + gport_set_cursor(GDK_ARROW); + break; + + case LINE_MODE: + gport_set_cursor(GDK_PENCIL); + break; + + case ARC_MODE: + gport_set_cursor(GDK_QUESTION_ARROW); + break; + + case ARROW_MODE: + gport_set_cursor(GDK_LEFT_PTR); + break; + + case POLYGON_MODE: + case POLYGONHOLE_MODE: + gport_set_cursor(GDK_SB_UP_ARROW); + break; + + case PASTEBUFFER_MODE: + gport_set_cursor(GDK_HAND1); + break; + + case TEXT_MODE: + gport_set_cursor(GDK_XTERM); + break; + + case RECTANGLE_MODE: + gport_set_cursor(GDK_UL_ANGLE); + break; + + case THERMAL_MODE: + gport_set_cursor(GDK_IRON_CROSS); + break; + + case REMOVE_MODE: + gport_set_cursor(GDK_PIRATE); + break; + + case ROTATE_MODE: + if (ghid_shift_is_pressed()) + gport_set_cursor((GdkCursorType) CUSTOM_CURSOR_CLOCKWISE); + else + gport_set_cursor(GDK_EXCHANGE); + break; + + case COPY_MODE: + case MOVE_MODE: + gport_set_cursor(GDK_CROSSHAIR); + break; + + case INSERTPOINT_MODE: + gport_set_cursor(GDK_DOTBOX); + break; + + case LOCK_MODE: + gport_set_cursor((GdkCursorType) CUSTOM_CURSOR_LOCK); + } +} + +void ghid_corner_cursor(void) +{ + GdkCursorType shape; + + if (Crosshair.Y <= Crosshair.AttachedBox.Point1.Y) + shape = (Crosshair.X >= Crosshair.AttachedBox.Point1.X) ? GDK_UR_ANGLE : GDK_UL_ANGLE; + else + shape = (Crosshair.X >= Crosshair.AttachedBox.Point1.X) ? GDK_LR_ANGLE : GDK_LL_ANGLE; + if (gport->X_cursor_shape != shape) + gport_set_cursor(shape); +} + +void ghid_restore_cursor(void) +{ + gport_set_cursor(oldCursor); +} + + + + /* =============================================================== */ +static gboolean got_location; + + /* If user hits a key instead of the mouse button, we'll abort unless + | it's the enter key (which accepts the current crosshair location). + */ +static gboolean loop_key_press_cb(GtkWidget * drawing_area, GdkEventKey * kev, GMainLoop ** loop) +{ + gint ksym = kev->keyval; + + if (ghid_is_modifier_key_sym(ksym)) + return TRUE; + + switch (ksym) { + case GDK_Return: /* Accept cursor location */ + if (g_main_loop_is_running(*loop)) + g_main_loop_quit(*loop); + break; + + default: /* Abort */ + got_location = FALSE; + if (g_main_loop_is_running(*loop)) + g_main_loop_quit(*loop); + break; + } + return TRUE; +} + + /* User hit a mouse button in the Output drawing area, so quit the loop + | and the cursor values when the button was pressed will be used. + */ +static gboolean loop_button_press_cb(GtkWidget * drawing_area, GdkEventButton * ev, GMainLoop ** loop) +{ + if (g_main_loop_is_running(*loop)) + g_main_loop_quit(*loop); + ghid_note_event_location(ev); + return TRUE; +} + + /* Run a glib GMainLoop which intercepts key and mouse button events from + | the top level loop. When a mouse or key is hit in the Output drawing + | area, quit the loop so the top level loop can continue and use the + | the mouse pointer coordinates at the time of the mouse button event. + */ +static gboolean run_get_location_loop(const gchar * message) +{ + GMainLoop *loop; + gulong button_handler, key_handler; + gint oldObjState, oldLineState, oldBoxState; + + ghid_status_line_set_text(message); + + oldObjState = Crosshair.AttachedObject.State; + oldLineState = Crosshair.AttachedLine.State; + oldBoxState = Crosshair.AttachedBox.State; + notify_crosshair_change(false); + Crosshair.AttachedObject.State = STATE_FIRST; + Crosshair.AttachedLine.State = STATE_FIRST; + Crosshair.AttachedBox.State = STATE_FIRST; + ghid_hand_cursor(); + notify_crosshair_change(true); + + /* Stop the top level GMainLoop from getting user input from keyboard + | and mouse so we can install our own handlers here. Also set the + | control interface insensitive so all the user can do is hit a key + | or mouse button in the Output drawing area. + */ + ghid_interface_input_signals_disconnect(); + ghid_interface_set_sensitive(FALSE); + + got_location = TRUE; /* Will be unset by hitting most keys */ + button_handler = + g_signal_connect(G_OBJECT(gport->drawing_area), "button_press_event", G_CALLBACK(loop_button_press_cb), &loop); + key_handler = g_signal_connect(G_OBJECT(gport->top_window), "key_press_event", G_CALLBACK(loop_key_press_cb), &loop); + + loop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(loop); + + g_main_loop_unref(loop); + + g_signal_handler_disconnect(gport->drawing_area, button_handler); + g_signal_handler_disconnect(gport->top_window, key_handler); + + ghid_interface_input_signals_connect(); /* return to normal */ + ghid_interface_set_sensitive(TRUE); + + notify_crosshair_change(false); + Crosshair.AttachedObject.State = oldObjState; + Crosshair.AttachedLine.State = oldLineState; + Crosshair.AttachedBox.State = oldBoxState; + notify_crosshair_change(true); + ghid_restore_cursor(); + + ghid_set_status_line_label(); + + return got_location; +} + + + +/* ---------------------------------------------------------------------------*/ +void ghid_get_user_xy(const char *msg) +{ + run_get_location_loop(msg); +} + + /* XXX The abort dialog isn't implemented yet in the Gtk port + */ +void ghid_create_abort_dialog(char *msg) +{ +} + +gboolean ghid_check_abort(void) +{ + return FALSE; /* Abort isn't implemented, so never abort */ +} + +void ghid_end_abort(void) +{ +} + +void ghid_get_pointer(int *x, int *y) +{ + gint xp, yp; + + gdk_window_get_pointer(gtk_widget_get_window(gport->drawing_area), &xp, &yp, NULL); + if (x) + *x = xp; + if (y) + *y = yp; +} + +/* --------------------------------------------------------------------------- + * output of status line + */ +void ghid_set_status_line_label(void) +{ + gchar *flag = TEST_FLAG(ALLDIRECTIONFLAG, PCB) + ? "all" : (PCB->Clipping == 0 ? "45" : (PCB->Clipping == 1 ? "45_/" : "45\\_")); + gchar *text = pcb_g_strdup_printf(_("%m+view=%s " + "grid=%$mS " + "%s%s " + "line=%mS " + "via=%mS (%mS) %s" + "clearance=%mS " "text=%i%% " "buffer=#%i"), + Settings.grid_unit->allow, + Settings.ShowSolderSide ? _("solder") : _("component"), + PCB->Grid, + flag, TEST_FLAG(RUBBERBANDFLAG, PCB) ? ",R " : " ", + Settings.LineThickness, + Settings.ViaThickness, + Settings.ViaDrillingHole, + ghidgui->compact_horizontal ? "\n" : "", + Settings.Keepaway, + Settings.TextScale, Settings.BufferNumber + 1); + + ghid_status_line_set_text(text); + g_free(text); +} + +/* --------------------------------------------------------------------------- + * output of cursor position + */ +void ghid_set_cursor_position_labels(void) +{ + gchar *text; + + if (Marked.status) { + Coord dx = Crosshair.X - Marked.X; + Coord dy = Crosshair.Y - Marked.Y; + Coord r = Distance(Crosshair.X, Crosshair.Y, Marked.X, Marked.Y); + double a = atan2(dy, dx) * RAD_TO_DEG; + + text = pcb_g_strdup_printf("%m+r %-mS; phi %-.1f; %-mS %-mS", Settings.grid_unit->allow, r, a, dx, dy); + ghid_cursor_position_relative_label_set_text(text); + g_free(text); + } + else + ghid_cursor_position_relative_label_set_text("r __.__; phi __._; __.__ __.__"); + + + text = pcb_g_strdup_printf("%m+%-mS %-mS", Settings.grid_unit->allow, Crosshair.X, Crosshair.Y); + ghid_cursor_position_label_set_text(text); + g_free(text); +} Index: 1.0.8/src/hid/gtk/gui-netlist-window.c =================================================================== --- 1.0.8/src/hid/gtk/gui-netlist-window.c (nonexistent) +++ 1.0.8/src/hid/gtk/gui-netlist-window.c (revision 1136) @@ -0,0 +1,971 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996,1997,1998 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* + * This file written by Bill Wilson for the PCB Gtk port + */ + +#include "config.h" + +#include +#include +#ifdef HAVE_STRING_H +#include +#endif + +#include "global.h" + +#include "create.h" +#include "data.h" +#include "draw.h" +#include "error.h" +#include "find.h" +#include "misc.h" +#include "mymem.h" +#include "rats.h" +#include "remove.h" +#include "search.h" +#include "select.h" +#include "set.h" +#include "undo.h" + +#include "gui.h" + + +#define NET_HIERARCHY_SEPARATOR "/" + +RCSID("$Id$"); + +static GtkWidget *netlist_window; +static GtkWidget *disable_all_button; + +static GtkTreeModel *node_model; +static GtkTreeView *node_treeview; +static GtkTreeSelection *node_selection; + +static gboolean selection_holdoff; + +static LibraryMenuType *selected_net; +static LibraryMenuType *node_selected_net; + + +/* The Netlist window displays all the layout nets in a left treeview + | When one of the nets is selected, all of its nodes (or connections) + | will be displayed in a right treeview. If a "Select on layout" button + | is pressed, the net that is selected in the left treeview will be + | drawn selected on the layout. + | + | Gtk separates the data model from the view in its treeview widgets so + | here we maintain two data models. The net data model has pointers to + | all the nets in the layout and the node data model keeps pointers to all + | the nodes for the currently selected net. By updating the data models + | the net and node gtk treeviews handle displaying the results. + | + | The netlist window code has a public interface providing hooks so PCB + | code can control the net and node treeviews: + | + | ghid_get_net_from_node_name gchar *node_name, gboolean enabled_only) + | Given a node name (eg C101-1), walk through the nets in the net + | data model and search each net for the given node_name. If found + | and enabled_only is true, make the net treeview scroll to and + | highlight (select) the found net. Return the found net. + | + | ghid_netlist_highlight_node() + | Given some PCB internal pointers (not really a good gui api here) + | look up a node name determined by the pointers and highlight the node + | in the node treeview. By using ghid_get_net_from_node_name() to + | look up the node, the net the node belongs to will also be + | highlighted in the net treeview. + | + | ghid_netlist_window_update(gboolean init_nodes) + | PCB calls this to tell the gui netlist code the layout net has + | changed and the gui data structures (net and optionally node data + | models) should be rebuilt. +*/ + + +/* -------- The netlist nodes (LibraryEntryType) data model ---------- + | Each time a net is selected in the left treeview, this node model + | is recreated containing all the nodes (pins/pads) that are connected + | to the net. Loading the new model will update the right treeview with + | all the new node names (C100-1, R100-1, etc). + | + | The terminology is a bit confusing because the PCB netlist data + | structures are generic structures used for library elements, netlist + | data, and possibly other things also. The mapping is that + | the layout netlist data structure is a LibraryType which + | contains an allocated array of LibraryMenuType structs. Each of these + | structs represents a net in the netlist and contains an array + | of LibraryEntryType structs which represent the nodes connecting to + | the net. So we have: + | + | Nets Nodes + | LibraryType LibraryMenuType LibraryEntryType + | ------------------------------------------------------- + | PCB->NetlistLib------Menu[0]-----------Entry[0] + | | Entry[1] + | | ... + | | + | --Menu[1]-----------Entry[0] + | | Entry[1] + | | ... + | | + | -- ... + | + | Where for example Menu[] names would be nets GND, Vcc, etc and Entry[] + | names would be nodes C101-1, R101-2, etc +*/ + +LibraryEntryType *node_get_node_from_name(gchar * node_name, LibraryMenuType ** node_net); + +enum { + NODE_NAME_COLUMN, /* Name to show in the treeview */ + NODE_LIBRARY_COLUMN, /* Pointer to this node (LibraryEntryType) */ + N_NODE_COLUMNS +}; + +/* Given a net in the netlist (a LibraryMenuType) put all the Entry[] + | names (the nodes) into a newly created node tree model. +*/ +static GtkTreeModel *node_model_create(LibraryMenuType * menu) +{ + GtkListStore *store; + GtkTreeIter iter; + + store = gtk_list_store_new(N_NODE_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER); + + if (menu == NULL) + return GTK_TREE_MODEL(store); + + ENTRY_LOOP(menu); + { + if (!entry->ListEntry) + continue; + gtk_list_store_append(store, &iter); + gtk_list_store_set(store, &iter, NODE_NAME_COLUMN, entry->ListEntry, NODE_LIBRARY_COLUMN, entry, -1); + } + END_LOOP; + + return GTK_TREE_MODEL(store); +} + +/* When there's a new node to display in the node treeview, call this. + | Create a new model containing the nodes of the given net, insert + | the model into the treeview and unref the old model. +*/ +static void node_model_update(LibraryMenuType * menu) +{ + GtkTreeModel *model; + + model = node_model; + node_model = node_model_create(menu); + gtk_tree_view_set_model(node_treeview, node_model); + + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(node_model), NODE_NAME_COLUMN, GTK_SORT_ASCENDING); + + /* We could be using gtk_list_store_clear() on the same model, but it's + | just as easy that we've created a new one and here unref the old one. + */ + if (model) + g_object_unref(G_OBJECT(model)); +} + +static void toggle_pin_selected(LibraryEntryType * entry) +{ + ConnectionType conn; + + if (!SeekPad(entry, &conn, false)) + return; + + AddObjectToFlagUndoList(conn.type, conn.ptr1, conn.ptr2, conn.ptr2); + TOGGLE_FLAG(SELECTEDFLAG, (AnyObjectType *) conn.ptr2); + DrawObject(conn.type, conn.ptr1, conn.ptr2); +} + + +/* Callback when the user clicks on a PCB node in the right node treeview. + */ +static void node_selection_changed_cb(GtkTreeSelection * selection, gpointer data) +{ + GtkTreeIter iter; + GtkTreeModel *model; + LibraryMenuType *node_net; + LibraryEntryType *node; + ConnectionType conn; + Coord x, y; + static gchar *node_name; + + if (selection_holdoff) /* PCB is highlighting, user is not selecting */ + return; + + /* Toggle off the previous selection. Look up node_name to make sure + | it still exists. This toggling can get out of sync if a node is + | toggled selected, then the net that includes the node is selected + | then unselected. + */ + if ((node = node_get_node_from_name(node_name, &node_net)) != NULL) { + /* If net node belongs to has been highlighted/unhighighed, toggling + | if off here will get our on/off toggling out of sync. + */ + if (node_net == node_selected_net) { + toggle_pin_selected(node); + ghid_cancel_lead_user(); + } + g_free(node_name); + node_name = NULL; + } + + /* Get the selected treeview row. + */ + if (!gtk_tree_selection_get_selected(selection, &model, &iter)) { + if (node) + ghid_invalidate_all(); + return; + } + + /* From the treeview row, extract the node pointer stored there and + | we've got a pointer to the LibraryEntryType (node) the row + | represents. + */ + gtk_tree_model_get(model, &iter, NODE_LIBRARY_COLUMN, &node, -1); + + dup_string(&node_name, node->ListEntry); + node_selected_net = selected_net; + + /* Now just toggle a select of the node on the layout + */ + toggle_pin_selected(node); + IncrementUndoSerialNumber(); + + /* And lead the user to the location */ + if (SeekPad(node, &conn, false)) + switch (conn.type) { + case PIN_TYPE: + { + PinTypePtr pin = (PinTypePtr) conn.ptr2; + x = pin->X; + y = pin->Y; + gui->set_crosshair(x, y, 0); + ghid_lead_user_to_location(x, y); + break; + } + case PAD_TYPE: + { + PadTypePtr pad = (PadTypePtr) conn.ptr2; + x = pad->Point1.X + (pad->Point2.X - pad->Point1.X) / 2; + y = pad->Point1.Y + (pad->Point2.Y - pad->Point2.Y) / 2; + gui->set_crosshair(x, y, 0); + ghid_lead_user_to_location(x, y); + break; + } + } +} + + +/* -------- The net (LibraryMenuType) data model ---------- + */ +/* TODO: the enable and disable all nets. Can't seem to get how that's + | supposed to work, but it'll take updating the NET_ENABLED_COLUMN in + | the net_model. Probably it should be made into a gpointer and make + | a text renderer for it and just write a '*' or a ' ' similar to the + | the Xt PCB scheme. Or better, since it's an "all nets" function, just + | have a "Disable all nets" toggle button and don't mess with the + | model/treeview at all. +*/ +enum { + NET_ENABLED_COLUMN, /* If enabled will be ' ', if disable '*' */ + NET_NAME_COLUMN, /* Name to show in the treeview */ + NET_LIBRARY_COLUMN, /* Pointer to this net (LibraryMenuType) */ + N_NET_COLUMNS +}; + +static GtkTreeModel *net_model = NULL; +static GtkTreeView *net_treeview; + +static gboolean loading_new_netlist; + +static GtkTreeModel *net_model_create(void) +{ + GtkTreeModel *model; + GtkTreeStore *store; + GtkTreeIter new_iter; + GtkTreeIter parent_iter; + GtkTreeIter *parent_ptr; + GtkTreePath *path; + GtkTreeRowReference *row_ref; + GHashTable *prefix_hash; + char *display_name; + char *hash_string; + char **join_array; + char **path_segments; + int path_depth; + int try_depth; + + store = gtk_tree_store_new(N_NET_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); + + model = GTK_TREE_MODEL(store); + + /* Hash table stores GtkTreeRowReference for given path prefixes */ + prefix_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) + gtk_tree_row_reference_free); + + MENU_LOOP(&PCB->NetlistLib[NETLIST_EDITED]); + { + if (!menu->Name) + continue; + + if (loading_new_netlist) + menu->flag = TRUE; + + parent_ptr = NULL; + + path_segments = g_strsplit(menu->Name, NET_HIERARCHY_SEPARATOR, 0); + path_depth = g_strv_length(path_segments); + + for (try_depth = path_depth - 1; try_depth > 0; try_depth--) { + join_array = g_new0(char *, try_depth + 1); + memcpy(join_array, path_segments, sizeof(char *) * try_depth); + + /* See if this net's parent node is in the hash table */ + hash_string = g_strjoinv(NET_HIERARCHY_SEPARATOR, join_array); + g_free(join_array); + + row_ref = (GtkTreeRowReference *) g_hash_table_lookup(prefix_hash, hash_string); + g_free(hash_string); + + /* If we didn't find the path at this level, keep looping */ + if (row_ref == NULL) + continue; + + path = gtk_tree_row_reference_get_path(row_ref); + gtk_tree_model_get_iter(model, &parent_iter, path); + parent_ptr = &parent_iter; + break; + } + + /* NB: parent_ptr may still be NULL if we reached the toplevel */ + + /* Now walk up the desired path, adding the nodes */ + + for (; try_depth < path_depth - 1; try_depth++) { + display_name = g_strconcat(path_segments[try_depth], NET_HIERARCHY_SEPARATOR, NULL); + gtk_tree_store_append(store, &new_iter, parent_ptr); + gtk_tree_store_set(store, &new_iter, NET_ENABLED_COLUMN, "", NET_NAME_COLUMN, display_name, NET_LIBRARY_COLUMN, NULL, -1); + g_free(display_name); + + path = gtk_tree_model_get_path(model, &new_iter); + row_ref = gtk_tree_row_reference_new(model, path); + parent_iter = new_iter; + parent_ptr = &parent_iter; + + join_array = g_new0(char *, try_depth + 2); + memcpy(join_array, path_segments, sizeof(char *) * (try_depth + 1)); + + hash_string = g_strjoinv(NET_HIERARCHY_SEPARATOR, join_array); + g_free(join_array); + + /* Insert those node in the hash table */ + g_hash_table_insert(prefix_hash, hash_string, row_ref); + /* Don't free hash_string, it is now oened by the hash table */ + } + + gtk_tree_store_append(store, &new_iter, parent_ptr); + gtk_tree_store_set(store, &new_iter, + NET_ENABLED_COLUMN, menu->flag ? "" : "*", + NET_NAME_COLUMN, path_segments[path_depth - 1], NET_LIBRARY_COLUMN, menu, -1); + g_strfreev(path_segments); + } + END_LOOP; + + g_hash_table_destroy(prefix_hash); + + return model; +} + + +/* Called when the user double clicks on a net in the left treeview. + */ +static void net_selection_double_click_cb(GtkTreeView * treeview, GtkTreePath * path, GtkTreeViewColumn * col, gpointer data) +{ + GtkTreeModel *model; + GtkTreeIter iter; + gchar *str; + LibraryMenuType *menu; + + model = gtk_tree_view_get_model(treeview); + if (gtk_tree_model_get_iter(model, &iter, path)) { + + /* Expand / contract nodes with children */ + if (gtk_tree_model_iter_has_child(model, &iter)) { + if (gtk_tree_view_row_expanded(treeview, path)) + gtk_tree_view_collapse_row(treeview, path); + else + gtk_tree_view_expand_row(treeview, path, FALSE); + return; + } + + /* Get the current enabled string and toggle it between "" and "*" + */ + gtk_tree_model_get(model, &iter, NET_ENABLED_COLUMN, &str, -1); + gtk_tree_store_set(GTK_TREE_STORE(model), &iter, NET_ENABLED_COLUMN, !strcmp(str, "*") ? "" : "*", -1); + /* set/clear the flag which says the net is enabled or disabled */ + gtk_tree_model_get(model, &iter, NET_LIBRARY_COLUMN, &menu, -1); + menu->flag = strcmp(str, "*") == 0 ? 1 : 0; + g_free(str); + } +} + +/* Called when the user clicks on a net in the left treeview. + */ +static void net_selection_changed_cb(GtkTreeSelection * selection, gpointer data) +{ + GtkTreeIter iter; + GtkTreeModel *model; + LibraryMenuType *net; + + if (selection_holdoff) /* PCB is highlighting, user is not selecting */ + return; + + if (!gtk_tree_selection_get_selected(selection, &model, &iter)) { + selected_net = NULL; + + return; + } + + /* Get a pointer, net, to the LibraryMenuType of the newly selected + | netlist row, and create a new node model from the net entries + | and insert that model into the node view. Delete old entry model. + */ + gtk_tree_model_get(model, &iter, NET_LIBRARY_COLUMN, &net, -1); + node_model_update(net); + + selected_net = net; +} + +static void netlist_disable_all_cb(GtkToggleButton * button, gpointer data) +{ + GtkTreeIter iter; + gboolean active = gtk_toggle_button_get_active(button); + LibraryMenuType *menu; + + /* Get each net iter and change the NET_ENABLED_COLUMN to a "*" or "" + | to flag it as disabled or enabled based on toggle button state. + */ + if (gtk_tree_model_get_iter_first(net_model, &iter)) + do { + gtk_tree_store_set(GTK_TREE_STORE(net_model), &iter, NET_ENABLED_COLUMN, active ? "*" : "", -1); + /* set/clear the flag which says the net is enabled or disabled */ + gtk_tree_model_get(net_model, &iter, NET_LIBRARY_COLUMN, &menu, -1); + menu->flag = active ? 0 : 1; + } + while (gtk_tree_model_iter_next(net_model, &iter)); +} + +/* Select on the layout the current net treeview selection + */ +static void netlist_select_cb(GtkWidget * widget, gpointer data) +{ + LibraryEntryType *entry; + ConnectionType conn; + gint i; + gboolean select_flag = GPOINTER_TO_INT(data); + + if (!selected_net) + return; + if (selected_net == node_selected_net) + node_selected_net = NULL; + + InitConnectionLookup(); + ResetConnections(true); + + for (i = selected_net->EntryN, entry = selected_net->Entry; i; i--, entry++) + if (SeekPad(entry, &conn, false)) + RatFindHook(conn.type, conn.ptr1, conn.ptr2, conn.ptr2, true, true); + + SelectConnection(select_flag); + ResetConnections(false); + FreeConnectionLookupMemory(); + IncrementUndoSerialNumber(); + Draw(); +} + +static void netlist_find_cb(GtkWidget * widget, gpointer data) +{ + char *name = NULL; + + if (!selected_net) + return; + + name = selected_net->Name + 2; + hid_actionl("connection", "reset", NULL); + hid_actionl("netlist", "find", name, NULL); +} + +static void netlist_rip_up_cb(GtkWidget * widget, gpointer data) +{ + + if (!selected_net) + return; + netlist_find_cb(widget, data); + + VISIBLELINE_LOOP(PCB->Data); + { + if (TEST_FLAG(FOUNDFLAG, line) && !TEST_FLAG(LOCKFLAG, line)) + RemoveObject(LINE_TYPE, layer, line, line); + } + ENDALL_LOOP; + + VISIBLEARC_LOOP(PCB->Data); + { + if (TEST_FLAG(FOUNDFLAG, arc) && !TEST_FLAG(LOCKFLAG, arc)) + RemoveObject(ARC_TYPE, layer, arc, arc); + } + ENDALL_LOOP; + + if (PCB->ViaOn) + VIA_LOOP(PCB->Data); + { + if (TEST_FLAG(FOUNDFLAG, via) && !TEST_FLAG(LOCKFLAG, via)) + RemoveObject(VIA_TYPE, via, via, via); + } + END_LOOP; + +} + + /**/ typedef struct { + LibraryEntryType *ret_val; + LibraryMenuType *node_net; + const gchar *node_name; + bool found; +} node_get_node_from_name_state; + +static gboolean node_get_node_from_name_helper(GtkTreeModel * model, GtkTreePath * path, GtkTreeIter * iter, gpointer data) +{ + LibraryMenuType *net; + LibraryEntryType *node; + node_get_node_from_name_state *state = data; + + gtk_tree_model_get(net_model, iter, NET_LIBRARY_COLUMN, &net, -1); + /* Ignore non-nets (category headers) */ + if (net == NULL) + return FALSE; + + /* Look for the node name in this net. */ + for (node = net->Entry; node - net->Entry < net->EntryN; node++) + if (node->ListEntry && !strcmp(state->node_name, node->ListEntry)) { + state->node_net = net; + state->ret_val = node; + /* stop iterating */ + state->found = TRUE; + return TRUE; + } + return FALSE; +} + +LibraryEntryType *node_get_node_from_name(gchar * node_name, LibraryMenuType ** node_net) +{ + node_get_node_from_name_state state; + + if (!node_name) + return NULL; + + /* Have to force the netlist window created because we need the treeview + | models constructed to do the search. + */ + ghid_netlist_window_create(gport); + + /* Now walk through node entries of each net in the net model looking for + | the node_name. + */ + state.found = 0; + state.node_name = node_name; + gtk_tree_model_foreach(net_model, node_get_node_from_name_helper, &state); + if (state.found) { + if (node_net) + *node_net = state.node_net; + return state.ret_val; + } + return NULL; +} + + /**/ +/* ---------- Manage the GUI treeview of the data models ----------- + */ +static gint netlist_window_configure_event_cb(GtkWidget * widget, GdkEventConfigure * ev, gpointer data) +{ + GtkAllocation allocation; + + gtk_widget_get_allocation(widget, &allocation); + ghidgui->netlist_window_height = allocation.height; + ghidgui->config_modified = TRUE; + return FALSE; +} + +static void netlist_close_cb(GtkWidget * widget, gpointer data) +{ + gtk_widget_destroy(netlist_window); + selected_net = NULL; + netlist_window = NULL; + + /* For now, we are the only consumer of this API, so we can just do this */ + ghid_cancel_lead_user(); +} + + +static void netlist_destroy_cb(GtkWidget * widget, GHidPort * out) +{ + selected_net = NULL; + netlist_window = NULL; +} + +void ghid_netlist_window_create(GHidPort * out) +{ + GtkWidget *vbox, *hbox, *button, *label, *sep; + GtkTreeView *treeview; + GtkTreeModel *model; + GtkTreeSelection *selection; + GtkCellRenderer *renderer; + GtkTreeViewColumn *column; + + /* No point in putting up the window if no netlist is loaded. + */ + if (!PCB->NetlistLib[NETLIST_EDITED].MenuN) + return; + + if (netlist_window) + return; + + netlist_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + g_signal_connect(G_OBJECT(netlist_window), "destroy", G_CALLBACK(netlist_destroy_cb), out); + gtk_window_set_title(GTK_WINDOW(netlist_window), _("PCB Netlist")); + gtk_window_set_wmclass(GTK_WINDOW(netlist_window), "PCB_Netlist", "PCB"); + g_signal_connect(G_OBJECT(netlist_window), "configure_event", G_CALLBACK(netlist_window_configure_event_cb), NULL); + gtk_window_set_default_size(GTK_WINDOW(netlist_window), -1, ghidgui->netlist_window_height); + + gtk_container_set_border_width(GTK_CONTAINER(netlist_window), 2); + + vbox = gtk_vbox_new(FALSE, 4); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); + gtk_container_add(GTK_CONTAINER(netlist_window), vbox); + hbox = gtk_hbox_new(FALSE, 8); + gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 4); + + + model = net_model_create(); + treeview = GTK_TREE_VIEW(gtk_tree_view_new_with_model(model)); + net_model = model; + net_treeview = treeview; + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(net_model), NET_NAME_COLUMN, GTK_SORT_ASCENDING); + + gtk_tree_view_set_rules_hint(treeview, FALSE); + g_object_set(treeview, "enable-tree-lines", TRUE, NULL); + + renderer = gtk_cell_renderer_text_new(); + gtk_tree_view_insert_column_with_attributes(treeview, -1, _(" "), renderer, "text", NET_ENABLED_COLUMN, NULL); + + renderer = gtk_cell_renderer_text_new(); + column = gtk_tree_view_column_new_with_attributes(_("Net Name"), renderer, "text", NET_NAME_COLUMN, NULL); + gtk_tree_view_insert_column(treeview, column, -1); + gtk_tree_view_set_expander_column(treeview, column); + + /* TODO: dont expand all, but record expanded states when window is + | destroyed and restore state here. + */ + gtk_tree_view_expand_all(treeview); + + selection = ghid_scrolled_selection(treeview, hbox, + GTK_SELECTION_SINGLE, + GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC, net_selection_changed_cb, NULL); + + /* Connect to the double click event. + */ + g_signal_connect(G_OBJECT(treeview), "row-activated", G_CALLBACK(net_selection_double_click_cb), NULL); + + + + /* Create the elements treeview and wait for a callback to populate it. + */ + treeview = GTK_TREE_VIEW(gtk_tree_view_new()); + node_treeview = treeview; + + gtk_tree_view_set_rules_hint(treeview, FALSE); + + renderer = gtk_cell_renderer_text_new(); + gtk_tree_view_insert_column_with_attributes(treeview, -1, _("Nodes"), renderer, "text", NODE_NAME_COLUMN, NULL); + + selection = ghid_scrolled_selection(treeview, hbox, + GTK_SELECTION_SINGLE, + GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC, node_selection_changed_cb, NULL); + node_selection = selection; + + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + label = gtk_label_new(_("Operations on selected 'Net Name':")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 4); + gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); + + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 4); + + button = gtk_button_new_with_label(_("Select")); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(netlist_select_cb), GINT_TO_POINTER(1)); + + button = gtk_button_new_with_label(_("Unselect")); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(netlist_select_cb), GINT_TO_POINTER(0)); + + button = gtk_button_new_with_label(_("Find")); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(netlist_find_cb), GINT_TO_POINTER(0)); + + button = gtk_button_new_with_label(_("Rip Up")); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(netlist_rip_up_cb), GINT_TO_POINTER(0)); + + ghid_check_button_connected(vbox, &disable_all_button, FALSE, TRUE, FALSE, + FALSE, 0, netlist_disable_all_cb, NULL, _("Disable all nets for adding rats")); + + sep = gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 3); + + hbox = gtk_hbutton_box_new(); + gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 4); + button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(netlist_close_cb), NULL); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + + + gtk_widget_realize(netlist_window); + if (Settings.AutoPlace) + gtk_window_move(GTK_WINDOW(netlist_window), 10, 10); + +} + +void ghid_netlist_window_show(GHidPort * out, gboolean raise) +{ + ghid_netlist_window_create(out); + gtk_widget_show_all(netlist_window); + ghid_netlist_window_update(TRUE); + if (raise) + gtk_window_present(GTK_WINDOW(netlist_window)); +} + +struct ggnfnn_task { + gboolean enabled_only; + gchar *node_name; + LibraryMenuType *found_net; + GtkTreeIter iter; +}; + +static gboolean hunt_named_node(GtkTreeModel * model, GtkTreePath * path, GtkTreeIter * iter, gpointer data) +{ + struct ggnfnn_task *task = (struct ggnfnn_task *) data; + LibraryMenuType *net; + LibraryEntryType *node; + gchar *str; + gint j; + gboolean is_disabled; + + /* We only want to inspect leaf nodes in the tree */ + if (gtk_tree_model_iter_has_child(model, iter)) + return FALSE; + + gtk_tree_model_get(model, iter, NET_LIBRARY_COLUMN, &net, -1); + gtk_tree_model_get(model, iter, NET_ENABLED_COLUMN, &str, -1); + is_disabled = !strcmp(str, "*"); + g_free(str); + + /* Don't check net nodes of disabled nets. */ + if (task->enabled_only && is_disabled) + return FALSE; + + /* Look for the node name in this net. */ + for (j = net->EntryN, node = net->Entry; j; j--, node++) + if (node->ListEntry && !strcmp(task->node_name, node->ListEntry)) { + task->found_net = net; + task->iter = *iter; + return TRUE; + } + + return FALSE; +} + +LibraryMenuType *ghid_get_net_from_node_name(gchar * node_name, gboolean enabled_only) +{ + GtkTreePath *path; + struct ggnfnn_task task; + + if (!node_name) + return NULL; + + /* Have to force the netlist window created because we need the treeview + | models constructed so we can find the LibraryMenuType pointer the + | caller wants. + */ + ghid_netlist_window_create(gport); + + /* If no netlist is loaded the window doesn't appear. */ + if (netlist_window == NULL) + return NULL; + + task.enabled_only = enabled_only; + task.node_name = node_name; + task.found_net = NULL; + + /* Now walk through node entries of each net in the net model looking for + | the node_name. + */ + gtk_tree_model_foreach(net_model, hunt_named_node, &task); + + /* We are asked to highlight the found net if enabled_only is TRUE. + | Set holdoff TRUE since this is just a highlight and user is not + | expecting normal select action to happen? Or should the node + | treeview also get updated? Original PCB code just tries to highlight. + */ + if (task.found_net && enabled_only) { + selection_holdoff = TRUE; + path = gtk_tree_model_get_path(net_model, &task.iter); + gtk_tree_view_scroll_to_cell(net_treeview, path, NULL, TRUE, 0.5, 0.5); + gtk_tree_selection_select_path(gtk_tree_view_get_selection(net_treeview), path); + selection_holdoff = FALSE; + } + return task.found_net; +} + +/* PCB LookupConnection code in find.c calls this if it wants a node + | and its net highlighted. +*/ +void ghid_netlist_highlight_node(gchar * node_name) +{ + GtkTreePath *path; + GtkTreeIter iter; + LibraryMenuType *net; + gchar *name; + + if (!node_name) + return; + + if ((net = ghid_get_net_from_node_name(node_name, TRUE)) == NULL) + return; + + /* We've found the net containing the node, so update the node treeview + | to contain the nodes from the net. Then we have to find the node + | in the new node model so we can highlight it. + */ + node_model_update(net); + + if (gtk_tree_model_get_iter_first(node_model, &iter)) + do { + gtk_tree_model_get(node_model, &iter, NODE_NAME_COLUMN, &name, -1); + + if (!strcmp(node_name, name)) { /* found it, so highlight it */ + selection_holdoff = TRUE; + selected_net = net; + path = gtk_tree_model_get_path(node_model, &iter); + gtk_tree_view_scroll_to_cell(node_treeview, path, NULL, TRUE, 0.5, 0.5); + gtk_tree_selection_select_path(gtk_tree_view_get_selection(node_treeview), path); + selection_holdoff = FALSE; + } + g_free(name); + } + while (gtk_tree_model_iter_next(node_model, &iter)); +} + +/* If code in PCB should change the netlist, call this to update + | what's in the netlist window. +*/ +void ghid_netlist_window_update(gboolean init_nodes) +{ + GtkTreeModel *model; + + /* Make sure there is something to update */ + ghid_netlist_window_create(gport); + + model = net_model; + net_model = net_model_create(); + gtk_tree_view_set_model(net_treeview, net_model); + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(net_model), NET_NAME_COLUMN, GTK_SORT_ASCENDING); + if (model) { + gtk_tree_store_clear(GTK_TREE_STORE(model)); + g_object_unref(model); + } + + selected_net = NULL; + + /* XXX Check if the select callback does this for us */ + if (init_nodes) + node_model_update((&PCB->NetlistLib[NETLIST_EDITED])->Menu); +} + +static gint GhidNetlistChanged(int argc, char **argv, Coord x, Coord y) +{ + loading_new_netlist = TRUE; + ghid_netlist_window_update(TRUE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(disable_all_button), FALSE); + loading_new_netlist = FALSE; + return 0; +} + +static const char netlistshow_syntax[] = "NetlistShow(pinname|netname)"; + +static const char netlistshow_help[] = "Selects the given pinname or netname in the netlist window. Does not \ +show the window if it isn't already shown."; + +static gint GhidNetlistShow(int argc, char **argv, Coord x, Coord y) +{ + ghid_netlist_window_create(gport); + if (argc > 0) + ghid_netlist_highlight_node(argv[0]); + return 0; +} + +static const char netlistpresent_syntax[] = "NetlistPresent()"; + +static const char netlistpresent_help[] = "Presents the netlist window."; + +static gint GhidNetlistPresent(int argc, char **argv, Coord x, Coord y) +{ + ghid_netlist_window_show(gport, TRUE); + return 0; +} + +HID_Action ghid_netlist_action_list[] = { + {"NetlistChanged", 0, GhidNetlistChanged, + netlistchanged_help, netlistchanged_syntax} + , + {"NetlistShow", 0, GhidNetlistShow, + netlistshow_help, netlistshow_syntax} + , + {"NetlistPresent", 0, GhidNetlistPresent, + netlistpresent_help, netlistpresent_syntax} + , +}; + +REGISTER_ACTIONS(ghid_netlist_action_list) Index: 1.0.8/src/hid/gtk/gui-output-events.c =================================================================== --- 1.0.8/src/hid/gtk/gui-output-events.c (nonexistent) +++ 1.0.8/src/hid/gtk/gui-output-events.c (revision 1136) @@ -0,0 +1,569 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996,1997,1998,1999 Thomas Nau + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact addresses for paper mail and Email: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* This file written by Bill Wilson for the PCB Gtk port */ + +#include "config.h" + +#include "gui.h" +#include "gtkhid.h" +#include "hid/common/hid_resource.h" + +#include + +#include "action.h" +#include "crosshair.h" +#include "draw.h" +#include "error.h" +#include "misc.h" +#include "set.h" +#include "find.h" +#include "search.h" +#include "rats.h" + + +#define TOOLTIP_UPDATE_DELAY 200 + +void ghid_port_ranges_changed(void) +{ + GtkAdjustment *h_adj, *v_adj; + + h_adj = gtk_range_get_adjustment(GTK_RANGE(ghidgui->h_range)); + v_adj = gtk_range_get_adjustment(GTK_RANGE(ghidgui->v_range)); + gport->view.x0 = gtk_adjustment_get_value(h_adj); + gport->view.y0 = gtk_adjustment_get_value(v_adj); + + ghid_invalidate_all(); +} + +/* Do scrollbar scaling based on current port drawing area size and + | overall PCB board size. + */ +void ghid_port_ranges_scale(void) +{ + GtkAdjustment *adj; + gdouble page_size; + + /* Update the scrollbars with PCB units. So Scale the current + | drawing area size in pixels to PCB units and that will be + | the page size for the Gtk adjustment. + */ + gport->view.width = gport->width * gport->view.coord_per_px; + gport->view.height = gport->height * gport->view.coord_per_px; + + adj = gtk_range_get_adjustment(GTK_RANGE(ghidgui->h_range)); + page_size = MIN(gport->view.width, PCB->MaxWidth); + gtk_adjustment_configure(adj, gtk_adjustment_get_value(adj), /* value */ + -gport->view.width, /* lower */ + PCB->MaxWidth + page_size, /* upper */ + page_size / 100.0, /* step_increment */ + page_size / 10.0, /* page_increment */ + page_size); /* page_size */ + + adj = gtk_range_get_adjustment(GTK_RANGE(ghidgui->v_range)); + page_size = MIN(gport->view.height, PCB->MaxHeight); + gtk_adjustment_configure(adj, gtk_adjustment_get_value(adj), /* value */ + -gport->view.height, /* lower */ + PCB->MaxHeight + page_size, /* upper */ + page_size / 100.0, /* step_increment */ + page_size / 10.0, /* page_increment */ + page_size); /* page_size */ +} + + +/* ---------------------------------------------------------------------- + * handles all events from PCB drawing area + */ + +void ghid_get_coords(const char *msg, Coord * x, Coord * y) +{ + if (!ghid_port.has_entered && msg) + ghid_get_user_xy(msg); + if (ghid_port.has_entered) { + *x = gport->pcb_x; + *y = gport->pcb_y; + } +} + +gboolean ghid_note_event_location(GdkEventButton * ev) +{ + gint event_x, event_y; + gboolean moved; + + if (!ev) { + gdk_window_get_pointer(gtk_widget_get_window(ghid_port.drawing_area), &event_x, &event_y, NULL); + } + else { + event_x = ev->x; + event_y = ev->y; + } + + ghid_event_to_pcb_coords(event_x, event_y, &gport->pcb_x, &gport->pcb_y); + + EventMoveCrosshair(gport->pcb_x, gport->pcb_y); + ghid_set_cursor_position_labels(); + return moved; +} + +static gboolean ghid_idle_cb(gpointer data) +{ + if (Settings.Mode == NO_MODE) + SetMode(ARROW_MODE); + ghid_mode_cursor(Settings.Mode); + if (ghidgui->settings_mode != Settings.Mode) { + ghid_mode_buttons_update(); + } + ghidgui->settings_mode = Settings.Mode; + + ghid_update_toggle_flags(); + return FALSE; +} + +gboolean ghid_port_key_release_cb(GtkWidget * drawing_area, GdkEventKey * kev, gpointer data) +{ + gint ksym = kev->keyval; + + if (ghid_is_modifier_key_sym(ksym)) + ghid_note_event_location(NULL); + + AdjustAttachedObjects(); + ghid_invalidate_all(); + g_idle_add(ghid_idle_cb, NULL); + return FALSE; +} + +/* Handle user keys in the output drawing area. + * Note that the default is for all hotkeys to be handled by the + * menu accelerators. + * + * Key presses not handled by the menus will show up here. This means + * the key press was either not defined in the menu resource file or + * that the key press is special in that gtk doesn't allow the normal + * menu code to ever see it. We capture those here (like Tab and the + * arrow keys) and feed it back to the normal menu callback. + */ + +gboolean ghid_port_key_press_cb(GtkWidget * drawing_area, GdkEventKey * kev, gpointer data) +{ + ModifierKeysState mk; + gint ksym = kev->keyval; + gboolean handled; + extern void ghid_hotkey_cb(int); + GdkModifierType state; + + if (ghid_is_modifier_key_sym(ksym)) + ghid_note_event_location(NULL); + + state = (GdkModifierType) (kev->state); + mk = ghid_modifier_keys_state(&state); + + handled = TRUE; /* Start off assuming we handle it */ + switch (ksym) { + case GDK_Alt_L: + case GDK_Alt_R: + case GDK_Control_L: + case GDK_Control_R: + case GDK_Shift_L: + case GDK_Shift_R: + case GDK_Shift_Lock: + case GDK_ISO_Level3_Shift: + break; + + case GDK_Up: + ghid_hotkey_cb(GHID_KEY_UP); + break; + + case GDK_Down: + ghid_hotkey_cb(GHID_KEY_DOWN); + break; + case GDK_Left: + ghid_hotkey_cb(GHID_KEY_LEFT); + break; + case GDK_Right: + ghid_hotkey_cb(GHID_KEY_RIGHT); + break; + + case GDK_ISO_Left_Tab: + case GDK_3270_BackTab: + switch (mk) { + case NONE_PRESSED: + ghid_hotkey_cb(GHID_KEY_SHIFT | GHID_KEY_TAB); + break; + case CONTROL_PRESSED: + ghid_hotkey_cb(GHID_KEY_CONTROL | GHID_KEY_SHIFT | GHID_KEY_TAB); + break; + case MOD1_PRESSED: + ghid_hotkey_cb(GHID_KEY_ALT | GHID_KEY_SHIFT | GHID_KEY_TAB); + break; + case SHIFT_PRESSED: + ghid_hotkey_cb(GHID_KEY_SHIFT | GHID_KEY_TAB); + break; + case SHIFT_CONTROL_PRESSED: + ghid_hotkey_cb(GHID_KEY_CONTROL | GHID_KEY_SHIFT | GHID_KEY_TAB); + break; + case SHIFT_MOD1_PRESSED: + ghid_hotkey_cb(GHID_KEY_ALT | GHID_KEY_SHIFT | GHID_KEY_TAB); + break; + + default: + handled = FALSE; + break; + } + break; + + case GDK_Tab: + switch (mk) { + case NONE_PRESSED: + ghid_hotkey_cb(GHID_KEY_TAB); + break; + case CONTROL_PRESSED: + ghid_hotkey_cb(GHID_KEY_CONTROL | GHID_KEY_TAB); + break; + case MOD1_PRESSED: + ghid_hotkey_cb(GHID_KEY_ALT | GHID_KEY_TAB); + break; + case SHIFT_PRESSED: + ghid_hotkey_cb(GHID_KEY_SHIFT | GHID_KEY_TAB); + break; + case SHIFT_CONTROL_PRESSED: + ghid_hotkey_cb(GHID_KEY_CONTROL | GHID_KEY_SHIFT | GHID_KEY_TAB); + break; + case SHIFT_MOD1_PRESSED: + ghid_hotkey_cb(GHID_KEY_ALT | GHID_KEY_SHIFT | GHID_KEY_TAB); + break; + + default: + handled = FALSE; + break; + } + break; + + default: + handled = FALSE; + } + + return handled; +} + +gboolean ghid_port_button_press_cb(GtkWidget * drawing_area, GdkEventButton * ev, gpointer data) +{ + ModifierKeysState mk; + GdkModifierType state; + + /* Reject double and triple click events */ + if (ev->type != GDK_BUTTON_PRESS) + return TRUE; + + ghid_note_event_location(ev); + state = (GdkModifierType) (ev->state); + mk = ghid_modifier_keys_state(&state); + + do_mouse_action(ev->button, mk); + + ghid_invalidate_all(); + ghid_window_set_name_label(PCB->Name); + ghid_set_status_line_label(); + if (!gport->panning) + g_idle_add(ghid_idle_cb, NULL); + return TRUE; +} + + +gboolean ghid_port_button_release_cb(GtkWidget * drawing_area, GdkEventButton * ev, gpointer data) +{ + ModifierKeysState mk; + GdkModifierType state; + + ghid_note_event_location(ev); + state = (GdkModifierType) (ev->state); + mk = ghid_modifier_keys_state(&state); + + do_mouse_action(ev->button, mk + M_Release); + + AdjustAttachedObjects(); + ghid_invalidate_all(); + + ghid_window_set_name_label(PCB->Name); + ghid_set_status_line_label(); + g_idle_add(ghid_idle_cb, NULL); + return TRUE; +} + + +gboolean ghid_port_drawing_area_configure_event_cb(GtkWidget * widget, GdkEventConfigure * ev, GHidPort * out) +{ + static gboolean first_time_done; + + gport->width = ev->width; + gport->height = ev->height; + + if (gport->pixmap) + gdk_pixmap_unref(gport->pixmap); + + gport->pixmap = gdk_pixmap_new(gtk_widget_get_window(widget), gport->width, gport->height, -1); + gport->drawable = gport->pixmap; + + if (!first_time_done) { + gport->colormap = gtk_widget_get_colormap(gport->top_window); + if (gdk_color_parse(Settings.BackgroundColor, &gport->bg_color)) + gdk_color_alloc(gport->colormap, &gport->bg_color); + else + gdk_color_white(gport->colormap, &gport->bg_color); + + if (gdk_color_parse(Settings.OffLimitColor, &gport->offlimits_color)) + gdk_color_alloc(gport->colormap, &gport->offlimits_color); + else + gdk_color_white(gport->colormap, &gport->offlimits_color); + first_time_done = TRUE; + ghid_drawing_area_configure_hook(out); + PCBChanged(0, NULL, 0, 0); + } + else { + ghid_drawing_area_configure_hook(out); + } + + ghid_port_ranges_scale(); + ghid_invalidate_all(); + return 0; +} + + +static char *describe_location(Coord X, Coord Y) +{ + void *ptr1, *ptr2, *ptr3; + int type; + int Range = 0; + char *elename = ""; + char *pinname; + char *netname = NULL; + char *description; + + /* check if there are any pins or pads at that position */ + + type = SearchObjectByLocation(PIN_TYPE | PAD_TYPE, &ptr1, &ptr2, &ptr3, X, Y, Range); + if (type == NO_TYPE) + return NULL; + + /* don't mess with silk objects! */ + if (type & SILK_TYPE && GetLayerNumber(PCB->Data, (LayerTypePtr) ptr1) >= max_copper_layer) + return NULL; + + if (type == PIN_TYPE || type == PAD_TYPE) + elename = (char *) UNKNOWN(NAMEONPCB_NAME((ElementTypePtr) ptr1)); + + pinname = ConnectionName(type, ptr1, ptr2); + + if (pinname == NULL) + return NULL; + + /* Find netlist entry */ + MENU_LOOP(&PCB->NetlistLib[NETLIST_EDITED]); + { + if (!menu->Name) + continue; + + ENTRY_LOOP(menu); + { + if (!entry->ListEntry) + continue; + + if (strcmp(entry->ListEntry, pinname) == 0) { + netname = g_strdup(menu->Name); + /* For some reason, the netname has spaces in front of it, strip them */ + g_strstrip(netname); + break; + } + } + END_LOOP; + + if (netname != NULL) + break; + } + END_LOOP; + + description = g_strdup_printf("Element name: %s\n" + "Pinname : %s\n" + "Netname : %s", + elename, (pinname != NULL) ? pinname : "--", (netname != NULL) ? netname : "--"); + + g_free(netname); + + return description; +} + + +static gboolean check_object_tooltips(GHidPort * out) +{ + char *description; + + /* check if there are any pins or pads at that position */ + description = describe_location(out->crosshair_x, out->crosshair_y); + + if (description == NULL) + return FALSE; + + gtk_widget_set_tooltip_text(out->drawing_area, description); + g_free(description); + + return FALSE; +} + +static int tooltip_update_timeout_id = 0; + +static void cancel_tooltip_update() +{ + if (tooltip_update_timeout_id) + g_source_remove(tooltip_update_timeout_id); + tooltip_update_timeout_id = 0; +} + +/* FIXME: If the GHidPort is ever destroyed, we must call + * cancel_tooltip_update (), otherwise the timeout might + * fire after the data it utilises has been free'd. + */ +static void queue_tooltip_update(GHidPort * out) +{ + /* Zap the old tool-tip text and force it to be removed from the screen */ + gtk_widget_set_tooltip_text(out->drawing_area, NULL); + gtk_widget_trigger_tooltip_query(out->drawing_area); + + cancel_tooltip_update(); + + tooltip_update_timeout_id = g_timeout_add(TOOLTIP_UPDATE_DELAY, (GSourceFunc) check_object_tooltips, out); +} + +gint ghid_port_window_motion_cb(GtkWidget * widget, GdkEventMotion * ev, GHidPort * out) +{ + gdouble dx, dy; + static gint x_prev = -1, y_prev = -1; + + gdk_event_request_motions(ev); + + if (out->panning) { + dx = gport->view.coord_per_px * (x_prev - ev->x); + dy = gport->view.coord_per_px * (y_prev - ev->y); + if (x_prev > 0) + ghid_pan_view_rel(dx, dy); + x_prev = ev->x; + y_prev = ev->y; + return FALSE; + } + x_prev = y_prev = -1; + ghid_note_event_location((GdkEventButton *) ev); + + queue_tooltip_update(out); + + return FALSE; +} + +gint ghid_port_window_enter_cb(GtkWidget * widget, GdkEventCrossing * ev, GHidPort * out) +{ + /* printf("enter: mode: %d detail: %d\n", ev->mode, ev->detail); */ + + /* See comment in ghid_port_window_leave_cb() */ + + if (ev->mode != GDK_CROSSING_NORMAL && ev->detail != GDK_NOTIFY_NONLINEAR) { + return FALSE; + } + + if (!ghidgui->command_entry_status_line_active) { + out->has_entered = TRUE; + /* Make sure drawing area has keyboard focus when we are in it. + */ + gtk_widget_grab_focus(out->drawing_area); + } + ghidgui->in_popup = FALSE; + + /* Following expression is true if a you open a menu from the menu bar, + * move the mouse to the viewport and click on it. This closes the menu + * and moves the pointer to the viewport without the pointer going over + * the edge of the viewport */ + if (ev->mode == GDK_CROSSING_UNGRAB && ev->detail == GDK_NOTIFY_NONLINEAR) { + ghid_screen_update(); + } + return FALSE; +} + +gint ghid_port_window_leave_cb(GtkWidget * widget, GdkEventCrossing * ev, GHidPort * out) +{ + /* printf("leave mode: %d detail: %d\n", ev->mode, ev->detail); */ + + /* Window leave events can also be triggered because of focus grabs. Some + * X applications occasionally grab the focus and so trigger this function. + * At least GNOME's window manager is known to do this on every mouse click. + * + * See http://bugzilla.gnome.org/show_bug.cgi?id=102209 + */ + + if (ev->mode != GDK_CROSSING_NORMAL) { + return FALSE; + } + + out->has_entered = FALSE; + + ghid_screen_update(); + + return FALSE; +} + + + /* Mouse scroll wheel events + */ +gint ghid_port_window_mouse_scroll_cb(GtkWidget * widget, GdkEventScroll * ev, GHidPort * out) +{ + ModifierKeysState mk; + GdkModifierType state; + int button; + + state = (GdkModifierType) (ev->state); + mk = ghid_modifier_keys_state(&state); + + /* X11 gtk hard codes buttons 4, 5, 6, 7 as below in + * gtk+/gdk/x11/gdkevents-x11.c:1121, but quartz and windows have + * special mouse scroll events, so this may conflict with a mouse + * who has buttons 4 - 7 that aren't the scroll wheel? + */ + switch (ev->direction) { + case GDK_SCROLL_UP: + button = 4; + break; + case GDK_SCROLL_DOWN: + button = 5; + break; + case GDK_SCROLL_LEFT: + button = 6; + break; + case GDK_SCROLL_RIGHT: + button = 7; + break; + default: + button = -1; + } + + do_mouse_action(button, mk); + + return TRUE; +} Index: 1.0.8/src/hid/gtk/gui-pinout-preview.c =================================================================== --- 1.0.8/src/hid/gtk/gui-pinout-preview.c (nonexistent) +++ 1.0.8/src/hid/gtk/gui-pinout-preview.c (revision 1136) @@ -0,0 +1,301 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* This file copied and modified by Peter Clifton, starting from + * gui-pinout-window.c, written by Bill Wilson for the PCB Gtk port */ + +#include "config.h" + +#include "global.h" + +#include "gui.h" + +#include "copy.h" +#include "data.h" +#include "draw.h" +#include "mymem.h" +#include "move.h" +#include "rotate.h" +#include "gui-pinout-preview.h" + + +RCSID("$Id$"); + +/* Just define a sensible scale, lets say (for example), 100 pixel per 150 mil */ +#define SENSIBLE_VIEW_SCALE (100. / MIL_TO_COORD (150.)) +static void pinout_set_view(GhidPinoutPreview * pinout) +{ + float scale = SENSIBLE_VIEW_SCALE; + + pinout->x_max = pinout->element.BoundingBox.X2 + Settings.PinoutOffsetX; + pinout->y_max = pinout->element.BoundingBox.Y2 + Settings.PinoutOffsetY; + pinout->w_pixels = scale * (pinout->element.BoundingBox.X2 - pinout->element.BoundingBox.X1); + pinout->h_pixels = scale * (pinout->element.BoundingBox.Y2 - pinout->element.BoundingBox.Y1); +} + + +static void pinout_set_data(GhidPinoutPreview * pinout, ElementType * element) +{ + if (element == NULL) { + FreeElementMemory(&pinout->element); + pinout->w_pixels = 0; + pinout->h_pixels = 0; + return; + } + + /* + * copy element data + * enable output of pin and padnames + * move element to a 5% offset from zero position + * set all package lines/arcs to zero width + */ + CopyElementLowLevel(NULL, &pinout->element, element, FALSE, 0, 0); + PIN_LOOP(&pinout->element); + { + SET_FLAG(DISPLAYNAMEFLAG, pin); + } + END_LOOP; + + PAD_LOOP(&pinout->element); + { + SET_FLAG(DISPLAYNAMEFLAG, pad); + } + END_LOOP; + + + MoveElementLowLevel(NULL, &pinout->element, + Settings.PinoutOffsetX - + pinout->element.BoundingBox.X1, Settings.PinoutOffsetY - pinout->element.BoundingBox.Y1); + + pinout_set_view(pinout); + + ELEMENTLINE_LOOP(&pinout->element); + { + line->Thickness = 0; + } + END_LOOP; + + ARC_LOOP(&pinout->element); + { + /* + * for whatever reason setting a thickness of 0 causes the arcs to + * not display so pick 1 which does display but is still quite + * thin. + */ + arc->Thickness = 1; + } + END_LOOP; +} + + +enum { + PROP_ELEMENT_DATA = 1, +}; + + +static GObjectClass *ghid_pinout_preview_parent_class = NULL; + + +/*! \brief GObject constructed + * + * \par Function Description + * Initialise the pinout preview object once it is constructed. + * Chain up in case the parent class wants to do anything too. + * + * \param [in] object The pinout preview object + */ +static void ghid_pinout_preview_constructed(GObject * object) +{ + /* chain up to the parent class */ + if (G_OBJECT_CLASS(ghid_pinout_preview_parent_class)->constructed != NULL) + G_OBJECT_CLASS(ghid_pinout_preview_parent_class)->constructed(object); + + ghid_init_drawing_widget(GTK_WIDGET(object), gport); +} + + + +/*! \brief GObject finalise handler + * + * \par Function Description + * Just before the GhidPinoutPreview GObject is finalized, free our + * allocated data, and then chain up to the parent's finalize handler. + * + * \param [in] widget The GObject being finalized. + */ +static void ghid_pinout_preview_finalize(GObject * object) +{ + GhidPinoutPreview *pinout = GHID_PINOUT_PREVIEW(object); + + /* Passing NULL for element data will free the old memory */ + pinout_set_data(pinout, NULL); + + G_OBJECT_CLASS(ghid_pinout_preview_parent_class)->finalize(object); +} + + +/*! \brief GObject property setter function + * + * \par Function Description + * Setter function for GhidPinoutPreview's GObject properties, + * "settings-name" and "toplevel". + * + * \param [in] object The GObject whose properties we are setting + * \param [in] property_id The numeric id. under which the property was + * registered with g_object_class_install_property() + * \param [in] value The GValue the property is being set from + * \param [in] pspec A GParamSpec describing the property being set + */ +static void ghid_pinout_preview_set_property(GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) +{ + GhidPinoutPreview *pinout = GHID_PINOUT_PREVIEW(object); + GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(pinout)); + + switch (property_id) { + case PROP_ELEMENT_DATA: + pinout_set_data(pinout, (ElementType *) g_value_get_pointer(value)); + if (window != NULL) + gdk_window_invalidate_rect(window, NULL, FALSE); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); + } + +} + + +/*! \brief GObject property getter function + * + * \par Function Description + * Getter function for GhidPinoutPreview's GObject properties, + * "settings-name" and "toplevel". + * + * \param [in] object The GObject whose properties we are getting + * \param [in] property_id The numeric id. under which the property was + * registered with g_object_class_install_property() + * \param [out] value The GValue in which to return the value of the property + * \param [in] pspec A GParamSpec describing the property being got + */ +static void ghid_pinout_preview_get_property(GObject * object, guint property_id, GValue * value, GParamSpec * pspec) +{ + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); + } + +} + + +/*! \brief GType class initialiser for GhidPinoutPreview + * + * \par Function Description + * GType class initialiser for GhidPinoutPreview. We override our parent + * virtual class methods as needed and register our GObject properties. + * + * \param [in] klass The GhidPinoutPreviewClass we are initialising + */ +static void ghid_pinout_preview_class_init(GhidPinoutPreviewClass * klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS(klass); + GtkWidgetClass *gtk_widget_class = GTK_WIDGET_CLASS(klass); + + gobject_class->finalize = ghid_pinout_preview_finalize; + gobject_class->set_property = ghid_pinout_preview_set_property; + gobject_class->get_property = ghid_pinout_preview_get_property; + gobject_class->constructed = ghid_pinout_preview_constructed; + + gtk_widget_class->expose_event = ghid_pinout_preview_expose; + + ghid_pinout_preview_parent_class = (GObjectClass *) g_type_class_peek_parent(klass); + + g_object_class_install_property(gobject_class, PROP_ELEMENT_DATA, + g_param_spec_pointer("element-data", "", "", G_PARAM_WRITABLE)); +} + + +/*! \brief Function to retrieve GhidPinoutPreview's GType identifier. + * + * \par Function Description + * Function to retrieve GhidPinoutPreview's GType identifier. + * Upon first call, this registers the GhidPinoutPreview in the GType system. + * Subsequently it returns the saved value from its first execution. + * + * \return the GType identifier associated with GhidPinoutPreview. + */ +GType ghid_pinout_preview_get_type() +{ + static GType ghid_pinout_preview_type = 0; + + if (!ghid_pinout_preview_type) { + static const GTypeInfo ghid_pinout_preview_info = { + sizeof(GhidPinoutPreviewClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) ghid_pinout_preview_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(GhidPinoutPreview), + 0, /* n_preallocs */ + NULL, /* instance_init */ + }; + + ghid_pinout_preview_type = + g_type_register_static(GTK_TYPE_DRAWING_AREA, "GhidPinoutPreview", &ghid_pinout_preview_info, (GTypeFlags) 0); + } + + return ghid_pinout_preview_type; +} + + +/*! \brief Convenience function to create a new pinout preview + * + * \par Function Description + * Convenience function which creates a GhidPinoutPreview. + * + * \return The GhidPinoutPreview created. + */ +GtkWidget *ghid_pinout_preview_new(ElementType * element) +{ + GhidPinoutPreview *pinout_preview; + + pinout_preview = (GhidPinoutPreview *) g_object_new(GHID_TYPE_PINOUT_PREVIEW, "element-data", element, NULL); + + return GTK_WIDGET(pinout_preview); +} + + +/*! \brief Query the natural size of a pinout preview + * + * \par Function Description + * Convenience function to query the natural size of a pinout preview + */ +void ghid_pinout_preview_get_natural_size(GhidPinoutPreview * pinout, int *width, int *height) +{ + *width = pinout->w_pixels; + *height = pinout->h_pixels; +} Index: 1.0.8/src/hid/gtk/gui-pinout-preview.h =================================================================== --- 1.0.8/src/hid/gtk/gui-pinout-preview.h (nonexistent) +++ 1.0.8/src/hid/gtk/gui-pinout-preview.h (revision 1136) @@ -0,0 +1,63 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* This file written by Peter Clifton */ + +#ifndef PCB_HID_GTK_GUI_PINOUT_PREVIEW_H +#define PCB_HID_GTK_GUI_PINOUT_PREVIEW_H + + +#define GHID_TYPE_PINOUT_PREVIEW (ghid_pinout_preview_get_type()) +#define GHID_PINOUT_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GHID_TYPE_PINOUT_PREVIEW, GhidPinoutPreview)) +#define GHID_PINOUT_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GHID_TYPE_PINOUT_PREVIEW, GhidPinoutPreviewClass)) +#define GHID_IS_PINOUT_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GHID_TYPE_PINOUT_PREVIEW)) +#define GHID_PINOUT_PREVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GHID_TYPE_PINOUT_PREVIEW, GhidPinoutPreviewClass)) + +typedef struct _GhidPinoutPreviewClass GhidPinoutPreviewClass; +typedef struct _GhidPinoutPreview GhidPinoutPreview; + + +struct _GhidPinoutPreviewClass { + GtkDrawingAreaClass parent_class; +}; + +struct _GhidPinoutPreview { + GtkDrawingArea parent_instance; + + ElementType element; /* element data to display */ + gint x_max, y_max; + gint w_pixels, h_pixels; /* natural size of element preview */ +}; + + +GType ghid_pinout_preview_get_type(void); + +GtkWidget *ghid_pinout_preview_new(ElementType * element); +void ghid_pinout_preview_get_natural_size(GhidPinoutPreview * pinout, int *width, int *height); + +#endif /* PCB_HID_GTK_GUI_PINOUT_PREVIEW_H */ Index: 1.0.8/src/hid/gtk/gui-pinout-window.c =================================================================== --- 1.0.8/src/hid/gtk/gui-pinout-window.c (nonexistent) +++ 1.0.8/src/hid/gtk/gui-pinout-window.c (revision 1136) @@ -0,0 +1,95 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* This file written by Bill Wilson for the PCB Gtk port */ + +#include "config.h" + +#include "global.h" + +#include "gui.h" + +#include "copy.h" +#include "data.h" +#include "draw.h" +#include "mymem.h" +#include "move.h" +#include "rotate.h" + +#include "gui-pinout-preview.h" + + +RCSID("$Id$"); + + +static void pinout_close_cb(GtkWidget * widget, GtkWidget * top_window) +{ + gtk_widget_destroy(top_window); +} + + +void ghid_pinout_window_show(GHidPort * out, ElementType * element) +{ + GtkWidget *button, *vbox, *hbox, *preview, *top_window; + gchar *title; + int width, height; + + if (!element) + return; + title = g_strdup_printf("%s [%s,%s]", + UNKNOWN(DESCRIPTION_NAME(element)), UNKNOWN(NAMEONPCB_NAME(element)), UNKNOWN(VALUE_NAME(element))); + + top_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(top_window), title); + g_free(title); + gtk_window_set_wmclass(GTK_WINDOW(top_window), "PCB_Pinout", "PCB"); + gtk_container_set_border_width(GTK_CONTAINER(top_window), 4); + + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(top_window), vbox); + + + preview = ghid_pinout_preview_new(element); + gtk_box_pack_start(GTK_BOX(vbox), preview, TRUE, TRUE, 0); + + ghid_pinout_preview_get_natural_size(GHID_PINOUT_PREVIEW(preview), &width, &height); + + gtk_window_set_default_size(GTK_WINDOW(top_window), width + 50, height + 50); + + hbox = gtk_hbutton_box_new(); + gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(pinout_close_cb), top_window); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + + gtk_widget_realize(top_window); + if (Settings.AutoPlace) + gtk_window_move(GTK_WINDOW(top_window), 10, 10); + gtk_widget_show_all(top_window); +} Index: 1.0.8/src/hid/gtk/gui-top-window.c =================================================================== --- 1.0.8/src/hid/gtk/gui-top-window.c (nonexistent) +++ 1.0.8/src/hid/gtk/gui-top-window.c (revision 1136) @@ -0,0 +1,1888 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* #define DEBUG_MENUS */ + +#ifdef DAN_FIXME +TODO: + +-figure out when we need to call this: +ghid_set_status_line_label(); +Everytime ? -the old quit callback had : ghid_config_files_write(); +hid_action("Quit"); + +-what about stuff like this: + + /* Set to ! because ActionDisplay toggles it */ +Settings.DrawGrid = !gtk_toggle_action_get_active(action); +ghidgui->config_modified = TRUE; +hid_actionl("Display", "Grid", "", NULL); +ghid_set_status_line_label(); + + +I NEED TO DO THE STATUS LINE THING.for example shift - alt - v to change the + via size.NOte the status line label does not get updated properly until a zoom in / out. +#endif +/* This file was originally written by Bill Wilson for the PCB Gtk + * port. It was later heavily modified by Dan McMahill to provide + * user customized menus. +*/ +/* gui-top-window.c +| This handles creation of the top level window and all its widgets. +| events for the Output.drawing_area widget are handled in a separate +| file gui-output-events.c +| +| Some caveats with menu shorcut keys: Some keys are trapped out by Gtk +| and can't be used as shortcuts (eg. '|', TAB, etc). For these cases +| we have our own shortcut table and capture the keys and send the events +| there in ghid_port_key_press_cb(). +*/ +#include "config.h" +#include +#ifdef HAVE_LOCALE_H +#include +#endif +#include "ghid-layer-selector.h" +#include "ghid-route-style-selector.h" +#include "gtkhid.h" +#include "gui.h" +#include "hid.h" +#include "../hidint.h" +#include "hid/common/hid_resource.h" +#include "action.h" +#include "buffer.h" +#include "change.h" +#include "command.h" +#include "copy.h" +#include "create.h" +#include "crosshair.h" +#include "draw.h" +#include "error.h" +#include "file.h" +#include "find.h" +#include "gpcb-menu.h" +#include "insert.h" +#include "line.h" +#include "mymem.h" +#include "misc.h" +#include "move.h" +#include "pcb-printf.h" +#include "polygon.h" +#include "rats.h" +#include "remove.h" +#include "report.h" +#include "resource.h" +#include "rotate.h" +#include "rubberband.h" +#include "search.h" +#include "select.h" +#include "set.h" +#include "undo.h" +#include "event.h" +#include "free_atexit.h" +#include "paths.h" +#include "gui-icons-mode-buttons.data" +#include "gui-icons-misc.data" + RCSID("$Id$"); + +static bool ignore_layer_update; + +static GtkWidget *ghid_load_menus(void); + +GhidGui _ghidgui, *ghidgui = NULL; + +GHidPort ghid_port, *gport; + +static gchar *bg_image_file; + +static struct { + GtkAction *action; + const Resource *node; +} ghid_hotkey_actions[256]; +#define N_HOTKEY_ACTIONS \ + (sizeof (ghid_hotkey_actions) / sizeof (ghid_hotkey_actions[0])) + + +/*! \brief callback for ghid_main_menu_update_toggle_state () */ +void menu_toggle_update_cb(GtkAction * act, const char *tflag, const char *aflag) +{ + if (tflag != NULL) { + int v = hid_get_flag(tflag); + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act), ! !v); + } + if (aflag != NULL) { + int v = hid_get_flag(aflag); + gtk_action_set_sensitive(act, ! !v); + } +} + +/*! \brief sync the menu checkboxes with actual pcb state */ +void ghid_update_toggle_flags() +{ + ghid_main_menu_update_toggle_state(GHID_MAIN_MENU(ghidgui->menu_bar), menu_toggle_update_cb); +} + +static void h_adjustment_changed_cb(GtkAdjustment * adj, GhidGui * g) +{ + if (g->adjustment_changed_holdoff) + return; + + ghid_port_ranges_changed(); +} + +static void v_adjustment_changed_cb(GtkAdjustment * adj, GhidGui * g) +{ + if (g->adjustment_changed_holdoff) + return; + + ghid_port_ranges_changed(); +} + + /* Save size of top window changes so PCB can restart at its size at exit. + */ +static gint top_window_configure_event_cb(GtkWidget * widget, GdkEventConfigure * ev, GHidPort * port) +{ + GtkAllocation allocation; + gboolean new_w, new_h; + + gtk_widget_get_allocation(widget, &allocation); + + new_w = (ghidgui->top_window_width != allocation.width); + new_h = (ghidgui->top_window_height != allocation.height); + + ghidgui->top_window_width = allocation.width; + ghidgui->top_window_height = allocation.height; + + if (new_w || new_h) + ghidgui->config_modified = TRUE; + + return FALSE; +} + +static void info_bar_response_cb(GtkInfoBar * info_bar, gint response_id, GhidGui * _gui) +{ + gtk_widget_destroy(_gui->info_bar); + _gui->info_bar = NULL; + + if (response_id == GTK_RESPONSE_ACCEPT) + RevertPCB(); +} + +static void close_file_modified_externally_prompt(void) +{ + if (ghidgui->info_bar != NULL) + gtk_widget_destroy(ghidgui->info_bar); + ghidgui->info_bar = NULL; +} + +static void show_file_modified_externally_prompt(void) +{ + GtkWidget *button; + GtkWidget *button_image; + GtkWidget *icon; + GtkWidget *label; + GtkWidget *content_area; + char *file_path_utf8; + char *secondary_text; + char *markup; + + close_file_modified_externally_prompt(); + + ghidgui->info_bar = gtk_info_bar_new(); + + button = gtk_info_bar_add_button(GTK_INFO_BAR(ghidgui->info_bar), _("Reload"), GTK_RESPONSE_ACCEPT); + button_image = gtk_image_new_from_stock(GTK_STOCK_REFRESH, GTK_ICON_SIZE_BUTTON); + gtk_button_set_image(GTK_BUTTON(button), button_image); + + gtk_info_bar_add_button(GTK_INFO_BAR(ghidgui->info_bar), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); + gtk_info_bar_set_message_type(GTK_INFO_BAR(ghidgui->info_bar), GTK_MESSAGE_WARNING); + gtk_box_pack_start(GTK_BOX(ghidgui->vbox_middle), ghidgui->info_bar, FALSE, FALSE, 0); + gtk_box_reorder_child(GTK_BOX(ghidgui->vbox_middle), ghidgui->info_bar, 0); + + + g_signal_connect(ghidgui->info_bar, "response", G_CALLBACK(info_bar_response_cb), ghidgui); + + file_path_utf8 = g_filename_to_utf8(PCB->Filename, -1, NULL, NULL, NULL); + + secondary_text = PCB->Changed ? "Do you want to drop your changes and reload the file?" : "Do you want to reload the file?"; + + markup = g_markup_printf_escaped(_("The file %s has changed on disk\n\n%s"), file_path_utf8, secondary_text); + g_free(file_path_utf8); + + content_area = gtk_info_bar_get_content_area(GTK_INFO_BAR(ghidgui->info_bar)); + + icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG); + gtk_box_pack_start(GTK_BOX(content_area), icon, FALSE, FALSE, 0); + + label = gtk_label_new(""); + gtk_box_pack_start(GTK_BOX(content_area), label, TRUE, TRUE, 6); + + gtk_label_set_use_markup(GTK_LABEL(label), TRUE); + gtk_label_set_markup(GTK_LABEL(label), markup); + g_free(markup); + + gtk_misc_set_alignment(GTK_MISC(label), 0., 0.5); + + gtk_widget_show_all(ghidgui->info_bar); +} + +static bool check_externally_modified(void) +{ + GFile *file; + GFileInfo *info; + GTimeVal timeval; + + /* Treat zero time as a flag to indicate we've not got an mtime yet */ + if (PCB->Filename == NULL || (ghidgui->our_mtime.tv_sec == 0 && ghidgui->our_mtime.tv_usec == 0)) + return false; + + file = g_file_new_for_path(PCB->Filename); + info = g_file_query_info(file, G_FILE_ATTRIBUTE_TIME_MODIFIED, G_FILE_QUERY_INFO_NONE, NULL, NULL); + g_object_unref(file); + + if (info == NULL || !g_file_info_has_attribute(info, G_FILE_ATTRIBUTE_TIME_MODIFIED)) + return false; + + g_file_info_get_modification_time(info, &timeval); /*&ghidgui->last_seen_mtime); */ + g_object_unref(info); + + /* Ignore when the file on disk is the same age as when we last looked */ + if (timeval.tv_sec == ghidgui->last_seen_mtime.tv_sec && timeval.tv_usec == ghidgui->last_seen_mtime.tv_usec) + return false; + + ghidgui->last_seen_mtime = timeval; + + return (ghidgui->last_seen_mtime.tv_sec > ghidgui->our_mtime.tv_sec) || + (ghidgui->last_seen_mtime.tv_sec == ghidgui->our_mtime.tv_sec && + ghidgui->last_seen_mtime.tv_usec > ghidgui->our_mtime.tv_usec); +} + +static gboolean top_window_enter_cb(GtkWidget * widget, GdkEvent * event, GHidPort * port) +{ + if (check_externally_modified()) + show_file_modified_externally_prompt(); + + return FALSE; +} + +/*! \brief Menu action callback function + * \par Function Description + * This is the main menu callback function. The callback receives + * the original Resource pointer containing the HID actions to be + * executed. + * + * All hotkeys go through the menus which means they go through here. + * Some, such as tab, are caught by Gtk instead of passed here, so + * pcb calls this function directly through ghid_hotkey_cb() for them. + * + * \param [in] The action that was activated + * \param [in] The menu resource associated with the action + */ + +static void ghid_menu_cb(GtkAction * action, const Resource * node) +{ + int i; + + if (action == NULL || node == NULL) + return; + + for (i = 1; i < node->c; i++) + if (resource_type(node->v[i]) == 10) { +#ifdef DEBUG_MENUS + printf(" %s\n", node->v[i].value); +#endif + hid_parse_actions(node->v[i].value); + } + + /* Sync gui widgets with pcb state */ + ghid_update_toggle_flags(); + ghid_mode_buttons_update(); + + /* Sync gui status display with pcb state */ + AdjustAttachedObjects(); + ghid_invalidate_all(); + ghid_window_set_name_label(PCB->Name); + ghid_set_status_line_label(); +} + +/* \brief Accelerator callback for accelerators gtk tries to hide from us */ +void ghid_hotkey_cb(int which) +{ + if (ghid_hotkey_actions[which].action != NULL) + ghid_menu_cb(ghid_hotkey_actions[which].action, (gpointer) ghid_hotkey_actions[which].node); +} + +static void update_board_mtime_from_disk(void) +{ + GFile *file; + GFileInfo *info; + + ghidgui->our_mtime.tv_sec = 0; + ghidgui->our_mtime.tv_usec = 0; + ghidgui->last_seen_mtime = ghidgui->our_mtime; + + if (PCB->Filename == NULL) + return; + + file = g_file_new_for_path(PCB->Filename); + info = g_file_query_info(file, G_FILE_ATTRIBUTE_TIME_MODIFIED, G_FILE_QUERY_INFO_NONE, NULL, NULL); + g_object_unref(file); + + if (info == NULL || !g_file_info_has_attribute(info, G_FILE_ATTRIBUTE_TIME_MODIFIED)) + return; + + g_file_info_get_modification_time(info, &ghidgui->our_mtime); + g_object_unref(info); + + ghidgui->last_seen_mtime = ghidgui->our_mtime; +} + + /* Sync toggle states that were saved with the layout and notify the + | config code to update Settings values it manages. + */ +void ghid_sync_with_new_layout(void) +{ + pcb_use_route_style(&PCB->RouteStyle[0]); + ghid_route_style_selector_select_style(GHID_ROUTE_STYLE_SELECTOR(ghidgui->route_style_selector), &PCB->RouteStyle[0]); + + ghid_config_handle_units_changed(); + + ghid_window_set_name_label(PCB->Name); + ghid_set_status_line_label(); + close_file_modified_externally_prompt(); + update_board_mtime_from_disk(); +} + +void ghid_notify_save_pcb(const char *filename, bool done) +{ + /* Do nothing if it is not the active PCB file that is being saved. + */ + if (PCB->Filename == NULL || strcmp(filename, PCB->Filename) != 0) + return; + + if (done) + update_board_mtime_from_disk(); +} + +void ghid_notify_filename_changed(void) +{ + /* Pick up the mtime of the new PCB file */ + update_board_mtime_from_disk(); +} + +/* --------------------------------------------------------------------------- + * + * layer_process() + * + * Takes the index into the layers and produces the text string for + * the layer and if the layer is currently visible or not. This is + * used by a couple of functions. + * + */ +static void layer_process(gchar ** color_string, char **text, int *set, int i) +{ + int tmp; + char *tmps; + gchar *tmpc; + + /* cheap hack to let users pass in NULL for either text or set if + * they don't care about the result + */ + + if (color_string == NULL) + color_string = &tmpc; + + if (text == NULL) + text = &tmps; + + if (set == NULL) + set = &tmp; + + switch (i) { + case LAYER_BUTTON_SILK: + *color_string = Settings.ElementColor; + *text = _("silk"); + *set = PCB->ElementOn; + break; + case LAYER_BUTTON_RATS: + *color_string = Settings.RatColor; + *text = _("rat lines"); + *set = PCB->RatOn; + break; + case LAYER_BUTTON_PINS: + *color_string = Settings.PinColor; + *text = _("pins/pads"); + *set = PCB->PinOn; + break; + case LAYER_BUTTON_VIAS: + *color_string = Settings.ViaColor; + *text = _("vias"); + *set = PCB->ViaOn; + break; + case LAYER_BUTTON_FARSIDE: + *color_string = Settings.InvisibleObjectsColor; + *text = _("far side"); + *set = PCB->InvisibleObjectsOn; + break; + case LAYER_BUTTON_MASK: + *color_string = Settings.MaskColor; + *text = _("solder mask"); + *set = TEST_FLAG(SHOWMASKFLAG, PCB); + break; + default: /* layers */ + *color_string = Settings.LayerColor[i]; + *text = (char *) UNKNOWN(PCB->Data->Layer[i].Name); + *set = PCB->Data->Layer[i].On; + break; + } +} + +/*! \brief Callback for GHidLayerSelector layer selection */ +static void layer_selector_select_callback(GHidLayerSelector * ls, int layer, gpointer d) +{ + ignore_layer_update = true; + /* Select Layer */ + PCB->SilkActive = (layer == LAYER_BUTTON_SILK); + PCB->RatDraw = (layer == LAYER_BUTTON_RATS); + if (layer == LAYER_BUTTON_SILK) { + PCB->ElementOn = true; + hid_action("LayersChanged"); + } + else if (layer == LAYER_BUTTON_RATS) { + PCB->RatOn = true; + hid_action("LayersChanged"); + } + else if (layer < max_copper_layer) + ChangeGroupVisibility(layer, TRUE, true); + + ignore_layer_update = false; + + ghid_invalidate_all(); +} + +/*! \brief Callback for GHidLayerSelector layer toggling */ +static void layer_selector_toggle_callback(GHidLayerSelector * ls, int layer, gpointer d) +{ + gboolean redraw = FALSE; + gboolean active; + layer_process(NULL, NULL, &active, layer); + + active = !active; + ignore_layer_update = true; + switch (layer) { + case LAYER_BUTTON_SILK: + PCB->ElementOn = active; + PCB->Data->SILKLAYER.On = PCB->ElementOn; + PCB->Data->BACKSILKLAYER.On = PCB->ElementOn; + redraw = 1; + break; + case LAYER_BUTTON_RATS: + PCB->RatOn = active; + redraw = 1; + break; + case LAYER_BUTTON_PINS: + PCB->PinOn = active; + redraw |= (PCB->Data->ElementN != 0); + break; + case LAYER_BUTTON_VIAS: + PCB->ViaOn = active; + redraw |= (PCB->Data->ViaN != 0); + break; + case LAYER_BUTTON_FARSIDE: + PCB->InvisibleObjectsOn = active; + PCB->Data->BACKSILKLAYER.On = (active && PCB->ElementOn); + redraw = TRUE; + break; + case LAYER_BUTTON_MASK: + if (active) + SET_FLAG(SHOWMASKFLAG, PCB); + else + CLEAR_FLAG(SHOWMASKFLAG, PCB); + redraw = TRUE; + break; + default: + /* Flip the visibility */ + ChangeGroupVisibility(layer, active, false); + redraw = TRUE; + break; + } + + /* Select the next visible layer. (If there is none, this will + * select the currently-selected layer, triggering the selection + * callback, which will turn the visibility on.) This way we + * will never have an invisible layer selected. + */ + if (!active) + ghid_layer_selector_select_next_visible(ls); + + ignore_layer_update = false; + + if (redraw) + ghid_invalidate_all(); +} + +/*! \brief Install menu bar and accelerator groups */ +void ghid_install_accel_groups(GtkWindow * window, GhidGui * gui) +{ + gtk_window_add_accel_group(window, ghid_main_menu_get_accel_group(GHID_MAIN_MENU(gui->menu_bar))); + gtk_window_add_accel_group(window, ghid_layer_selector_get_accel_group(GHID_LAYER_SELECTOR(gui->layer_selector))); + gtk_window_add_accel_group + (window, ghid_route_style_selector_get_accel_group(GHID_ROUTE_STYLE_SELECTOR(gui->route_style_selector))); +} + +/*! \brief Remove menu bar and accelerator groups */ +void ghid_remove_accel_groups(GtkWindow * window, GhidGui * gui) +{ + gtk_window_remove_accel_group(window, ghid_main_menu_get_accel_group(GHID_MAIN_MENU(gui->menu_bar))); + gtk_window_remove_accel_group(window, ghid_layer_selector_get_accel_group(GHID_LAYER_SELECTOR(gui->layer_selector))); + gtk_window_remove_accel_group + (window, ghid_route_style_selector_get_accel_group(GHID_ROUTE_STYLE_SELECTOR(gui->route_style_selector))); +} + +/* Refreshes the window title bar and sets the PCB name to the + * window title bar or to a seperate label + */ +void ghid_window_set_name_label(gchar * name) +{ + gchar *str; + gchar *filename; + + /* FIXME -- should this happen? It does... */ + /* This happens if we're calling an exporter from the command line */ + if (ghidgui == NULL) + return; + + dup_string(&(ghidgui->name_label_string), name); + if (!ghidgui->name_label_string || !*ghidgui->name_label_string) + ghidgui->name_label_string = g_strdup(_("Unnamed")); + + if (!PCB->Filename || !*PCB->Filename) + filename = g_strdup(_("Unsaved.pcb")); + else + filename = g_strdup(PCB->Filename); + + str = g_strdup_printf("%s%s (%s) - PCB", PCB->Changed ? "*" : "", ghidgui->name_label_string, filename); + gtk_window_set_title(GTK_WINDOW(gport->top_window), str); + g_free(str); + g_free(filename); +} + +static void grid_units_button_cb(GtkWidget * widget, gpointer data) +{ + /* Button only toggles between mm and mil */ + if (Settings.grid_unit == get_unit_struct("mm")) + hid_actionl("SetUnits", "mil", NULL); + else + hid_actionl("SetUnits", "mm", NULL); +} + +/* + * The two following callbacks are used to keep the absolute + * and relative cursor labels from growing and shrinking as you + * move the cursor around. + */ +static void absolute_label_size_req_cb(GtkWidget * widget, GtkRequisition * req, gpointer data) +{ + + static gint w = 0; + if (req->width > w) + w = req->width; + else + req->width = w; +} + +static void relative_label_size_req_cb(GtkWidget * widget, GtkRequisition * req, gpointer data) +{ + + static gint w = 0; + if (req->width > w) + w = req->width; + else + req->width = w; +} + +static void make_cursor_position_labels(GtkWidget * hbox, GHidPort * port) +{ + GtkWidget *frame, *label; + + /* The grid units button next to the cursor position labels. + */ + ghidgui->grid_units_button = gtk_button_new(); + label = gtk_label_new(""); + gtk_label_set_markup(GTK_LABEL(label), Settings.grid_unit->in_suffix); + ghidgui->grid_units_label = label; + gtk_label_set_use_markup(GTK_LABEL(label), TRUE); + gtk_container_add(GTK_CONTAINER(ghidgui->grid_units_button), label); + gtk_box_pack_end(GTK_BOX(hbox), ghidgui->grid_units_button, FALSE, TRUE, 0); + g_signal_connect(ghidgui->grid_units_button, "clicked", G_CALLBACK(grid_units_button_cb), NULL); + + /* The absolute cursor position label + */ + frame = gtk_frame_new(NULL); + gtk_box_pack_end(GTK_BOX(hbox), frame, FALSE, TRUE, 0); + gtk_container_set_border_width(GTK_CONTAINER(frame), 2); + gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_OUT); + + label = gtk_label_new(""); + gtk_container_add(GTK_CONTAINER(frame), label); + ghidgui->cursor_position_absolute_label = label; + g_signal_connect(G_OBJECT(label), "size-request", G_CALLBACK(absolute_label_size_req_cb), NULL); + + + /* The relative cursor position label + */ + frame = gtk_frame_new(NULL); + gtk_box_pack_end(GTK_BOX(hbox), frame, FALSE, TRUE, 0); + gtk_container_set_border_width(GTK_CONTAINER(frame), 2); + gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_OUT); + label = gtk_label_new(" __.__ __.__ "); + gtk_container_add(GTK_CONTAINER(frame), label); + ghidgui->cursor_position_relative_label = label; + g_signal_connect(G_OBJECT(label), "size-request", G_CALLBACK(relative_label_size_req_cb), NULL); + +} + +/* \brief Add "virtual layers" to a layer selector */ +static void make_virtual_layer_buttons(GtkWidget * layer_selector) +{ + GHidLayerSelector *layersel = GHID_LAYER_SELECTOR(layer_selector); + gchar *text; + gchar *color_string; + gboolean active; + + layer_process(&color_string, &text, &active, LAYER_BUTTON_SILK); + ghid_layer_selector_add_layer(layersel, LAYER_BUTTON_SILK, text, color_string, active, TRUE); + layer_process(&color_string, &text, &active, LAYER_BUTTON_RATS); + ghid_layer_selector_add_layer(layersel, LAYER_BUTTON_RATS, text, color_string, active, TRUE); + layer_process(&color_string, &text, &active, LAYER_BUTTON_PINS); + ghid_layer_selector_add_layer(layersel, LAYER_BUTTON_PINS, text, color_string, active, FALSE); + layer_process(&color_string, &text, &active, LAYER_BUTTON_VIAS); + ghid_layer_selector_add_layer(layersel, LAYER_BUTTON_VIAS, text, color_string, active, FALSE); + layer_process(&color_string, &text, &active, LAYER_BUTTON_FARSIDE); + ghid_layer_selector_add_layer(layersel, LAYER_BUTTON_FARSIDE, text, color_string, active, FALSE); + layer_process(&color_string, &text, &active, LAYER_BUTTON_MASK); + ghid_layer_selector_add_layer(layersel, LAYER_BUTTON_MASK, text, color_string, active, FALSE); +} + +/*! \brief callback for ghid_layer_selector_update_colors */ +const gchar *get_layer_color(gint layer) +{ + gchar *rv; + layer_process(&rv, NULL, NULL, layer); + return rv; +} + +/*! \brief Update a layer selector's color scheme */ +void ghid_layer_buttons_color_update(void) +{ + ghid_layer_selector_update_colors(GHID_LAYER_SELECTOR(ghidgui->layer_selector), get_layer_color); + pcb_colors_from_settings(PCB); +} + +/*! \brief Populate a layer selector with all layers Gtk is aware of */ +static void make_layer_buttons(GtkWidget * layersel) +{ + gint i; + gchar *text; + gchar *color_string; + gboolean active = TRUE; + + for (i = 0; i < max_copper_layer; ++i) { + layer_process(&color_string, &text, &active, i); + ghid_layer_selector_add_layer(GHID_LAYER_SELECTOR(layersel), i, text, color_string, active, TRUE); + } +} + + +/*! \brief callback for ghid_layer_selector_delete_layers */ +gboolean get_layer_delete(gint layer) +{ + return layer >= max_copper_layer; +} + +/*! \brief Synchronize layer selector widget with current PCB state + * \par Function Description + * Called when user toggles layer visibility or changes drawing layer, + * or when layer visibility is changed programatically. + */ +void ghid_layer_buttons_update(void) +{ + gint layer; + + if (ignore_layer_update) + return; + + ghid_layer_selector_delete_layers(GHID_LAYER_SELECTOR(ghidgui->layer_selector), get_layer_delete); + make_layer_buttons(ghidgui->layer_selector); + make_virtual_layer_buttons(ghidgui->layer_selector); + ghid_main_menu_install_layer_selector(GHID_MAIN_MENU(ghidgui->menu_bar), GHID_LAYER_SELECTOR(ghidgui->layer_selector)); + + /* Sync selected layer with PCB's state */ + if (PCB->RatDraw) + layer = LAYER_BUTTON_RATS; + else if (PCB->SilkActive) + layer = LAYER_BUTTON_SILK; + else + layer = LayerStack[0]; + + ghid_layer_selector_select_layer(GHID_LAYER_SELECTOR(ghidgui->layer_selector), layer); +} + +/*! \brief Called when user clicks OK on route style dialog */ +static void route_styles_edited_cb(GHidRouteStyleSelector * rss, gboolean save, gpointer data) +{ + if (save) { + g_free(Settings.Routes); + Settings.Routes = make_route_string(PCB->RouteStyle, NUM_STYLES); + ghidgui->config_modified = TRUE; + ghid_config_files_write(); + } + ghid_main_menu_install_route_style_selector + (GHID_MAIN_MENU(ghidgui->menu_bar), GHID_ROUTE_STYLE_SELECTOR(ghidgui->route_style_selector)); +} + +/*! \brief Called when a route style is selected */ +static void route_style_changed_cb(GHidRouteStyleSelector * rss, RouteStyleType * rst, gpointer data) +{ + pcb_use_route_style(rst); + ghid_set_status_line_label(); +} + +/*! \brief Configure the route style selector */ +void make_route_style_buttons(GHidRouteStyleSelector * rss) +{ + int i; + for (i = 0; i < NUM_STYLES; ++i) + ghid_route_style_selector_add_route_style(rss, &PCB->RouteStyle[i]); + g_signal_connect(G_OBJECT(rss), "select_style", G_CALLBACK(route_style_changed_cb), NULL); + g_signal_connect(G_OBJECT(rss), "style_edited", G_CALLBACK(route_styles_edited_cb), NULL); +} + +/* + * --------------------------------------------------------------- + * Mode buttons + */ +typedef struct { + GtkWidget *button; + GtkWidget *toolbar_button; + guint button_cb_id; + guint toolbar_button_cb_id; + gchar *name; + gint mode; + gchar **xpm; +} ModeButton; + + +static ModeButton mode_buttons[] = { + {NULL, NULL, 0, 0, "via", VIA_MODE, via}, + {NULL, NULL, 0, 0, "line", LINE_MODE, line}, + {NULL, NULL, 0, 0, "arc", ARC_MODE, arc}, + {NULL, NULL, 0, 0, "text", TEXT_MODE, text}, + {NULL, NULL, 0, 0, "rectangle", RECTANGLE_MODE, rect}, + {NULL, NULL, 0, 0, "polygon", POLYGON_MODE, poly}, + {NULL, NULL, 0, 0, "polygonhole", POLYGONHOLE_MODE, polyhole}, + {NULL, NULL, 0, 0, "buffer", PASTEBUFFER_MODE, buf}, + {NULL, NULL, 0, 0, "remove", REMOVE_MODE, del}, + {NULL, NULL, 0, 0, "rotate", ROTATE_MODE, rot}, + {NULL, NULL, 0, 0, "insertPoint", INSERTPOINT_MODE, ins}, + {NULL, NULL, 0, 0, "thermal", THERMAL_MODE, thrm}, + {NULL, NULL, 0, 0, "select", ARROW_MODE, sel}, + {NULL, NULL, 0, 0, "lock", LOCK_MODE, lock} +}; + +static gint n_mode_buttons = G_N_ELEMENTS(mode_buttons); + +static void do_set_mode(int mode) +{ + SetMode(mode); + ghid_mode_cursor(mode); + ghidgui->settings_mode = mode; +} + +static void mode_toolbar_button_toggled_cb(GtkToggleButton * button, ModeButton * mb) +{ + gboolean active = gtk_toggle_button_get_active(button); + + if (mb->button != NULL) { + g_signal_handler_block(mb->button, mb->button_cb_id); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mb->button), active); + g_signal_handler_unblock(mb->button, mb->button_cb_id); + } + + if (active) + do_set_mode(mb->mode); +} + +static void mode_button_toggled_cb(GtkWidget * widget, ModeButton * mb) +{ + gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); + + if (mb->toolbar_button != NULL) { + g_signal_handler_block(mb->toolbar_button, mb->toolbar_button_cb_id); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mb->toolbar_button), active); + g_signal_handler_unblock(mb->toolbar_button, mb->toolbar_button_cb_id); + } + + if (active) + do_set_mode(mb->mode); +} + +void ghid_mode_buttons_update(void) +{ + ModeButton *mb; + gint i; + + for (i = 0; i < n_mode_buttons; ++i) { + mb = &mode_buttons[i]; + if (Settings.Mode == mb->mode) { + g_signal_handler_block(mb->button, mb->button_cb_id); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mb->button), TRUE); + g_signal_handler_unblock(mb->button, mb->button_cb_id); + + g_signal_handler_block(mb->toolbar_button, mb->toolbar_button_cb_id); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mb->toolbar_button), TRUE); + g_signal_handler_unblock(mb->toolbar_button, mb->toolbar_button_cb_id); + break; + } + } +} + +void ghid_pack_mode_buttons(void) +{ + if (ghidgui->compact_vertical) { + gtk_widget_hide(ghidgui->mode_buttons_frame); + gtk_widget_show_all(ghidgui->mode_toolbar); + } + else { + gtk_widget_hide(ghidgui->mode_toolbar); + gtk_widget_show_all(ghidgui->mode_buttons_frame); + } +} + +static void make_mode_buttons_and_toolbar(GtkWidget ** mode_frame, GtkWidget ** mode_toolbar) +{ + GtkToolItem *tool_item; + GtkWidget *vbox, *hbox = NULL; + GtkWidget *image; + GdkPixbuf *pixbuf; + GSList *group = NULL; + GSList *toolbar_group = NULL; + ModeButton *mb; + int i; + + *mode_toolbar = gtk_toolbar_new(); + + *mode_frame = gtk_frame_new(NULL); + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(*mode_frame), vbox); + + for (i = 0; i < n_mode_buttons; ++i) { + mb = &mode_buttons[i]; + + /* Create tool button for mode frame */ + mb->button = gtk_radio_button_new(group); + group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(mb->button)); + gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(mb->button), FALSE); + + /* Create tool button for toolbar */ + mb->toolbar_button = gtk_radio_button_new(toolbar_group); + toolbar_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(mb->toolbar_button)); + gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(mb->toolbar_button), FALSE); + + /* Pack mode-frame button into the frame */ + if ((i % ghidgui->n_mode_button_columns) == 0) { + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + } + gtk_box_pack_start(GTK_BOX(hbox), mb->button, FALSE, FALSE, 0); + + /* Create a container for the toolbar button and add that */ + tool_item = gtk_tool_item_new(); + gtk_container_add(GTK_CONTAINER(tool_item), mb->toolbar_button); + gtk_toolbar_insert(GTK_TOOLBAR(*mode_toolbar), tool_item, -1); + + /* Load the image for the button, create GtkImage widgets for both + * the grid button and the toolbar button, then pack into the buttons + */ + pixbuf = gdk_pixbuf_new_from_xpm_data((const char **) mb->xpm); + image = gtk_image_new_from_pixbuf(pixbuf); + gtk_container_add(GTK_CONTAINER(mb->button), image); + image = gtk_image_new_from_pixbuf(pixbuf); + gtk_container_add(GTK_CONTAINER(mb->toolbar_button), image); + g_object_unref(pixbuf); + + if (strcmp(mb->name, "select") == 0) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mb->button), TRUE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mb->toolbar_button), TRUE); + } + + mb->button_cb_id = g_signal_connect(mb->button, "toggled", G_CALLBACK(mode_button_toggled_cb), mb); + mb->toolbar_button_cb_id = g_signal_connect(mb->toolbar_button, "toggled", G_CALLBACK(mode_toolbar_button_toggled_cb), mb); + } +} + + +/* + * --------------------------------------------------------------- + * Top window + * --------------------------------------------------------------- + */ + +static gint delete_chart_cb(GtkWidget * widget, GdkEvent * event, GHidPort * port) +{ + ghid_config_files_write(); + hid_action("Quit"); + + /* + * Return TRUE to keep our app running. A FALSE here would let the + * delete signal continue on and kill our program. + */ + return TRUE; +} + +static void destroy_chart_cb(GtkWidget * widget, GHidPort * port) +{ + ghid_shutdown_renderer(port); + gtk_main_quit(); +} + +static void get_widget_styles(GtkStyle ** menu_bar_style, GtkStyle ** tool_button_style, GtkStyle ** tool_button_label_style) +{ + GtkWidget *tool_button; + GtkWidget *tool_button_label; + GtkToolItem *tool_item; + + /* Build a tool item to extract the theme's styling for a toolbar button with text */ + tool_item = gtk_tool_item_new(); + gtk_toolbar_insert(GTK_TOOLBAR(ghidgui->mode_toolbar), tool_item, 0); + tool_button = gtk_button_new(); + gtk_container_add(GTK_CONTAINER(tool_item), tool_button); + tool_button_label = gtk_label_new(""); + gtk_container_add(GTK_CONTAINER(tool_button), tool_button_label); + + /* Grab the various styles we need */ + gtk_widget_ensure_style(ghidgui->menu_bar); + *menu_bar_style = gtk_widget_get_style(ghidgui->menu_bar); + + gtk_widget_ensure_style(tool_button); + *tool_button_style = gtk_widget_get_style(tool_button); + + gtk_widget_ensure_style(tool_button_label); + *tool_button_label_style = gtk_widget_get_style(tool_button_label); + + gtk_widget_destroy(GTK_WIDGET(tool_item)); +} + +static void do_fix_topbar_theming(void) +{ + GtkWidget *rel_pos_frame; + GtkWidget *abs_pos_frame; + GtkStyle *menu_bar_style; + GtkStyle *tool_button_style; + GtkStyle *tool_button_label_style; + + get_widget_styles(&menu_bar_style, &tool_button_style, &tool_button_label_style); + + /* Style the top bar background as if it were all a menu bar */ + gtk_widget_set_style(ghidgui->top_bar_background, menu_bar_style); + + /* Style the cursor position labels using the menu bar style as well. + * If this turns out to cause problems with certain gtk themes, we may + * need to grab the GtkStyle associated with an actual menu item to + * get a text color to render with. + */ + gtk_widget_set_style(ghidgui->cursor_position_relative_label, menu_bar_style); + gtk_widget_set_style(ghidgui->cursor_position_absolute_label, menu_bar_style); + + /* Style the units button as if it were a toolbar button - hopefully + * this isn't too ugly sitting on a background themed as a menu bar. + * It is unlikely any theme defines colours for a GtkButton sitting on + * a menu bar. + */ + rel_pos_frame = gtk_widget_get_parent(ghidgui->cursor_position_relative_label); + abs_pos_frame = gtk_widget_get_parent(ghidgui->cursor_position_absolute_label); + gtk_widget_set_style(rel_pos_frame, menu_bar_style); + gtk_widget_set_style(abs_pos_frame, menu_bar_style); + gtk_widget_set_style(ghidgui->grid_units_button, tool_button_style); + gtk_widget_set_style(ghidgui->grid_units_label, tool_button_label_style); +} + +/* Attempt to produce a conststent style for our extra menu-bar items by + * copying aspects from the menu bar style set by the user's GTK theme. + * Setup signal handlers to update our efforts if the user changes their + * theme whilst we are running. + */ +static void fix_topbar_theming(void) +{ + GtkSettings *settings; + + do_fix_topbar_theming(); + + settings = gtk_widget_get_settings(ghidgui->top_bar_background); + g_signal_connect(settings, "notify::gtk-theme-name", G_CALLBACK(do_fix_topbar_theming), NULL); + g_signal_connect(settings, "notify::gtk-font-name", G_CALLBACK(do_fix_topbar_theming), NULL); +} + +/* + * Create the top_window contents. The config settings should be loaded + * before this is called. + */ +static void ghid_build_pcb_top_window(void) +{ + GtkWidget *window; + GtkWidget *vbox_main, *hbox_middle, *hbox; + GtkWidget *vbox, *frame; + GtkWidget *label; + GHidPort *port = &ghid_port; + GtkWidget *scrolled; + + window = gport->top_window; + + vbox_main = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(window), vbox_main); + + /* -- Top control bar */ + ghidgui->top_bar_background = gtk_event_box_new(); + gtk_box_pack_start(GTK_BOX(vbox_main), ghidgui->top_bar_background, FALSE, FALSE, 0); + + ghidgui->top_hbox = gtk_hbox_new(FALSE, 4); + gtk_container_add(GTK_CONTAINER(ghidgui->top_bar_background), ghidgui->top_hbox); + + /* + * menu_hbox will be made insensitive when the gui needs + * a modal button GetLocation button press. + */ + ghidgui->menu_hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(ghidgui->top_hbox), ghidgui->menu_hbox, FALSE, FALSE, 0); + + ghidgui->menubar_toolbar_vbox = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(ghidgui->menu_hbox), ghidgui->menubar_toolbar_vbox, FALSE, FALSE, 0); + + /* Build layer menus */ + ghidgui->layer_selector = ghid_layer_selector_new(); + make_layer_buttons(ghidgui->layer_selector); + make_virtual_layer_buttons(ghidgui->layer_selector); + g_signal_connect(G_OBJECT(ghidgui->layer_selector), "select_layer", G_CALLBACK(layer_selector_select_callback), NULL); + g_signal_connect(G_OBJECT(ghidgui->layer_selector), "toggle_layer", G_CALLBACK(layer_selector_toggle_callback), NULL); + /* Build main menu */ + ghidgui->menu_bar = ghid_load_menus(); + gtk_box_pack_start(GTK_BOX(ghidgui->menubar_toolbar_vbox), ghidgui->menu_bar, FALSE, FALSE, 0); + + make_mode_buttons_and_toolbar(&ghidgui->mode_buttons_frame, &ghidgui->mode_toolbar); + gtk_box_pack_start(GTK_BOX(ghidgui->menubar_toolbar_vbox), ghidgui->mode_toolbar, FALSE, FALSE, 0); + + + ghidgui->position_hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_end(GTK_BOX(ghidgui->top_hbox), ghidgui->position_hbox, FALSE, FALSE, 4); + + make_cursor_position_labels(ghidgui->position_hbox, port); + + hbox_middle = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox_main), hbox_middle, TRUE, TRUE, 3); + + fix_topbar_theming(); /* Must be called after toolbar is created */ + + /* -- Left control bar */ + /* + * This box will be made insensitive when the gui needs + * a modal button GetLocation button press. + */ + ghidgui->left_toolbar = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox_middle), ghidgui->left_toolbar, FALSE, FALSE, 3); + + vbox = ghid_scrolled_vbox(ghidgui->left_toolbar, &scrolled, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + gtk_box_pack_start(GTK_BOX(vbox), ghidgui->layer_selector, FALSE, FALSE, 0); + + /* ghidgui->mode_buttons_frame was created above in the call to + * make_mode_buttons_and_toolbar (...); + */ + gtk_box_pack_start(GTK_BOX(ghidgui->left_toolbar), ghidgui->mode_buttons_frame, FALSE, FALSE, 0); + + frame = gtk_frame_new(NULL); + gtk_box_pack_end(GTK_BOX(ghidgui->left_toolbar), frame, FALSE, FALSE, 0); + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(frame), vbox); + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 1); + ghidgui->route_style_selector = ghid_route_style_selector_new(); + make_route_style_buttons(GHID_ROUTE_STYLE_SELECTOR(ghidgui->route_style_selector)); + gtk_box_pack_start(GTK_BOX(hbox), ghidgui->route_style_selector, FALSE, FALSE, 4); + + ghidgui->vbox_middle = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox_middle), ghidgui->vbox_middle, TRUE, TRUE, 0); + + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(ghidgui->vbox_middle), hbox, TRUE, TRUE, 0); + + /* -- The PCB layout output drawing area */ + + gport->drawing_area = gtk_drawing_area_new(); + ghid_init_drawing_widget(gport->drawing_area, gport); + + gtk_widget_add_events(gport->drawing_area, GDK_EXPOSURE_MASK + | GDK_LEAVE_NOTIFY_MASK | GDK_ENTER_NOTIFY_MASK + | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK + | GDK_KEY_RELEASE_MASK | GDK_KEY_PRESS_MASK + | GDK_FOCUS_CHANGE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK); + + /* + * This is required to get the drawing_area key-press-event. Also the + * enter and button press callbacks grab focus to be sure we have it + * when in the drawing_area. + */ + gtk_widget_set_can_focus(gport->drawing_area, TRUE); + + gtk_box_pack_start(GTK_BOX(hbox), gport->drawing_area, TRUE, TRUE, 0); + + ghidgui->v_adjustment = gtk_adjustment_new(0.0, 0.0, 100.0, 10.0, 10.0, 10.0); + ghidgui->v_range = gtk_vscrollbar_new(GTK_ADJUSTMENT(ghidgui->v_adjustment)); + + gtk_box_pack_start(GTK_BOX(hbox), ghidgui->v_range, FALSE, FALSE, 0); + + g_signal_connect(G_OBJECT(ghidgui->v_adjustment), "value_changed", G_CALLBACK(v_adjustment_changed_cb), ghidgui); + + ghidgui->h_adjustment = gtk_adjustment_new(0.0, 0.0, 100.0, 10.0, 10.0, 10.0); + ghidgui->h_range = gtk_hscrollbar_new(GTK_ADJUSTMENT(ghidgui->h_adjustment)); + gtk_box_pack_start(GTK_BOX(ghidgui->vbox_middle), ghidgui->h_range, FALSE, FALSE, 0); + + g_signal_connect(G_OBJECT(ghidgui->h_adjustment), "value_changed", G_CALLBACK(h_adjustment_changed_cb), ghidgui); + + /* -- The bottom status line label */ + ghidgui->status_line_hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(ghidgui->vbox_middle), ghidgui->status_line_hbox, FALSE, FALSE, 2); + + label = gtk_label_new(""); + gtk_label_set_use_markup(GTK_LABEL(label), TRUE); + gtk_box_pack_start(GTK_BOX(ghidgui->status_line_hbox), label, FALSE, FALSE, 0); + ghidgui->status_line_label = label; + + /* Depending on user setting, the command_combo_box may get packed into + | the status_line_hbox, but it will happen on demand the first time + | the user does a command entry. + */ + + g_signal_connect(G_OBJECT(gport->drawing_area), "realize", G_CALLBACK(ghid_port_drawing_realize_cb), port); + g_signal_connect(G_OBJECT(gport->drawing_area), "expose_event", G_CALLBACK(ghid_drawing_area_expose_cb), port); + g_signal_connect(G_OBJECT(gport->top_window), "configure_event", G_CALLBACK(top_window_configure_event_cb), port); + g_signal_connect(gport->top_window, "enter-notify-event", G_CALLBACK(top_window_enter_cb), port); + g_signal_connect(G_OBJECT(gport->drawing_area), "configure_event", + G_CALLBACK(ghid_port_drawing_area_configure_event_cb), port); + + + /* Mouse and key events will need to be intercepted when PCB needs a + | location from the user. + */ + + ghid_interface_input_signals_connect(); + + g_signal_connect(G_OBJECT(gport->drawing_area), "scroll_event", G_CALLBACK(ghid_port_window_mouse_scroll_cb), port); + g_signal_connect(G_OBJECT(gport->drawing_area), "enter_notify_event", G_CALLBACK(ghid_port_window_enter_cb), port); + g_signal_connect(G_OBJECT(gport->drawing_area), "leave_notify_event", G_CALLBACK(ghid_port_window_leave_cb), port); + g_signal_connect(G_OBJECT(gport->drawing_area), "motion_notify_event", G_CALLBACK(ghid_port_window_motion_cb), port); + + + + g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(delete_chart_cb), port); + g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(destroy_chart_cb), port); + + ghidgui->creating = FALSE; + + gtk_widget_show_all(gport->top_window); + ghid_pack_mode_buttons(); + gdk_window_set_back_pixmap(gtk_widget_get_window(gport->drawing_area), NULL, FALSE); +} + + + /* Connect and disconnect just the signals a g_main_loop() will need. + | Cursor and motion events still need to be handled by the top level + | loop, so don't connect/reconnect these. + | A g_main_loop will be running when PCB wants the user to select a + | location or if command entry is needed in the status line hbox. + | During these times normal button/key presses are intercepted, either + | by new signal handlers or the command_combo_box entry. + */ +static gulong button_press_handler, button_release_handler, key_press_handler, key_release_handler; + +void ghid_interface_input_signals_connect(void) +{ + button_press_handler = + g_signal_connect(G_OBJECT(gport->drawing_area), "button_press_event", G_CALLBACK(ghid_port_button_press_cb), NULL); + + button_release_handler = + g_signal_connect(G_OBJECT(gport->drawing_area), "button_release_event", G_CALLBACK(ghid_port_button_release_cb), NULL); + + key_press_handler = + g_signal_connect(G_OBJECT(gport->drawing_area), "key_press_event", G_CALLBACK(ghid_port_key_press_cb), NULL); + + key_release_handler = + g_signal_connect(G_OBJECT(gport->drawing_area), "key_release_event", G_CALLBACK(ghid_port_key_release_cb), NULL); +} + +void ghid_interface_input_signals_disconnect(void) +{ + if (button_press_handler) + g_signal_handler_disconnect(gport->drawing_area, button_press_handler); + + if (button_release_handler) + g_signal_handler_disconnect(gport->drawing_area, button_release_handler); + + if (key_press_handler) + g_signal_handler_disconnect(gport->drawing_area, key_press_handler); + + if (key_release_handler) + g_signal_handler_disconnect(gport->drawing_area, key_release_handler); + + button_press_handler = button_release_handler = 0; + key_press_handler = key_release_handler = 0; + +} + + + /* We'll set the interface insensitive when a g_main_loop is running so the + | Gtk menus and buttons don't respond and interfere with the special entry + | the user needs to be doing. + */ +void ghid_interface_set_sensitive(gboolean sensitive) +{ + gtk_widget_set_sensitive(ghidgui->left_toolbar, sensitive); + gtk_widget_set_sensitive(ghidgui->menu_hbox, sensitive); +} + + +/* ---------------------------------------------------------------------- + * initializes icon pixmap and also cursor bit maps + */ +static void ghid_init_icons(GHidPort * port) +{ + GdkWindow *window = gtk_widget_get_window(gport->top_window); + + XC_clock_source = gdk_bitmap_create_from_data(window, (char *) rotateIcon_bits, rotateIcon_width, rotateIcon_height); + XC_clock_mask = gdk_bitmap_create_from_data(window, (char *) rotateMask_bits, rotateMask_width, rotateMask_height); + + XC_hand_source = gdk_bitmap_create_from_data(window, (char *) handIcon_bits, handIcon_width, handIcon_height); + XC_hand_mask = gdk_bitmap_create_from_data(window, (char *) handMask_bits, handMask_width, handMask_height); + + XC_lock_source = gdk_bitmap_create_from_data(window, (char *) lockIcon_bits, lockIcon_width, lockIcon_height); + XC_lock_mask = gdk_bitmap_create_from_data(window, (char *) lockMask_bits, lockMask_width, lockMask_height); +} + +void ghid_create_pcb_widgets(void) +{ + GHidPort *port = &ghid_port; + GError *err = NULL; + + if (bg_image_file) + ghidgui->bg_pixbuf = gdk_pixbuf_new_from_file(bg_image_file, &err); + if (err) { + g_error("%s", err->message); + g_error_free(err); + } + ghid_build_pcb_top_window(); + ghid_install_accel_groups(GTK_WINDOW(port->top_window), ghidgui); + ghid_update_toggle_flags(); + + ghid_init_icons(port); + SetMode(ARROW_MODE); + ghid_mode_buttons_update(); +} + +static gboolean ghid_listener_cb(GIOChannel * source, GIOCondition condition, gpointer data) +{ + GIOStatus status; + gchar *str; + gsize len; + gsize term; + GError *err = NULL; + + + if (condition & G_IO_HUP) { + gui->log("Read end of pipe died!\n"); + return FALSE; + } + + if (condition == G_IO_IN) { + status = g_io_channel_read_line(source, &str, &len, &term, &err); + switch (status) { + case G_IO_STATUS_NORMAL: + hid_parse_actions(str); + g_free(str); + break; + + case G_IO_STATUS_ERROR: + gui->log("ERROR status from g_io_channel_read_line\n"); + return FALSE; + break; + + case G_IO_STATUS_EOF: + gui->log("Input pipe returned EOF. The --listen option is \n" "probably not running anymore in this session.\n"); + return FALSE; + break; + + case G_IO_STATUS_AGAIN: + gui->log("AGAIN status from g_io_channel_read_line\n"); + return FALSE; + break; + + default: + fprintf(stderr, "ERROR: unhandled case in ghid_listener_cb\n"); + return FALSE; + break; + } + + } + else + fprintf(stderr, "Unknown condition in ghid_listener_cb\n"); + + return TRUE; +} + +static void ghid_create_listener(void) +{ + GIOChannel *channel; + int fd = fileno(stdin); + + channel = g_io_channel_unix_new(fd); + g_io_add_watch(channel, G_IO_IN, ghid_listener_cb, NULL); +} + + +/* ------------------------------------------------------------ */ + +static int stdin_listen = 0; +static const char *pcbmenu_paths_in[] = { "gpcb-menu.res", "gpcb-menu.res", PCBSHAREDIR "/gpcb-menu.res", NULL }; + +static char **pcbmenu_paths = NULL; + +HID_Attribute ghid_attribute_list[] = { + +/* %start-doc options "21 GTK+ GUI Options" +@ftable @code +@item --listen +Listen for actions on stdin. +@end ftable +%end-doc +*/ + {"listen", "Listen for actions on stdin", + HID_Boolean, 0, 0, {0, 0, 0}, 0, &stdin_listen}, +#define HA_listen 0 + +/* %start-doc options "21 GTK+ GUI Options" +@ftable @code +@item --bg-image +File name of an image to put into the background of the GUI canvas. The image must +be a color PPM image, in binary (not ASCII) format. It can be any size, and will be +automatically scaled to fit the canvas. +@end ftable +%end-doc +*/ + {"bg-image", "Background Image", + HID_String, 0, 0, {0, 0, 0}, 0, &bg_image_file}, +#define HA_bg_image 1 + +/* %start-doc options "21 GTK+ GUI Options" +@ftable @code +@item --pcb-menu +Location of the @file{gpcb-menu.res} file which defines the menu for the GTK+ GUI. +@end ftable +%end-doc +*/ + {"pcb-menu", "Location of gpcb-menu.res file", + HID_String, 0, 0, {0, "gpcb-menu.res", 0}, 0, &pcbmenu_paths_in[0]} +#define HA_pcbmenu 2 +}; + +REGISTER_ATTRIBUTES(ghid_attribute_list) + + HID_Attribute *ghid_get_export_options(int *n_ret) +{ + *n_ret = sizeof(ghid_attribute_list) / sizeof(HID_Attribute); + return ghid_attribute_list; +} + + /* Create top level window for routines that will need top_window + | before ghid_create_pcb_widgets() is called. + */ +void ghid_parse_arguments(int *argc, char ***argv) +{ + GtkWidget *window; + gint i; + GdkPixbuf *icon; + + /* on windows we need to figure out the installation directory */ +#ifdef WIN32 + char *tmps; + char *libdir; + tmps = g_win32_get_package_installation_directory(PACKAGE "-" VERSION, NULL); +#define REST_OF_PATH G_DIR_SEPARATOR_S "share" G_DIR_SEPARATOR_S PACKAGE G_DIR_SEPARATOR_S "pcblib" + libdir = (char *) malloc(strlen(tmps) + strlen(REST_OF_PATH) + 1); + sprintf(libdir, "%s%s", tmps, REST_OF_PATH); + free(tmps); + + Settings.LibraryTree = libdir; + +#undef REST_OF_PATH + +#endif + +#if defined (DEBUG) + for (i = 0; i < *argc; i++) { + printf("ghid_parse_arguments(): *argv[%d] = \"%s\"\n", i, (*argv)[i]); + } +#endif + + /* Threads aren't used in PCB, but this call would go here. + */ + /* g_thread_init (NULL); */ + +#if defined (ENABLE_NLS) + /* Do our own setlocale() stufff since we want to override LC_NUMERIC + */ + gtk_set_locale(); + setlocale(LC_NUMERIC, "C"); /* use decimal point instead of comma */ +#endif + + /* + * Prevent gtk_init() and gtk_init_check() from automatically + * calling setlocale (LC_ALL, "") which would undo LC_NUMERIC if ENABLE_NLS + * We also don't want locale set if no ENABLE_NLS to keep "C" LC_NUMERIC. + */ + gtk_disable_setlocale(); + + gtk_init(argc, argv); + + gport = &ghid_port; + gport->view.coord_per_px = 300.0; + pixel_slop = 300; + + ghid_init_renderer(argc, argv, gport); + + ghid_config_files_read(argc, argv); + + Settings.AutoPlace = 0; + for (i = 0; i < *argc; i++) { + if (strcmp((*argv)[i], "-auto-place") == 0) + Settings.AutoPlace = 1; + } + +#ifdef ENABLE_NLS +#ifdef LOCALEDIR + bindtextdomain(PACKAGE, LOCALEDIR); +#endif + textdomain(PACKAGE); + bind_textdomain_codeset(PACKAGE, "UTF-8"); +#endif /* ENABLE_NLS */ + + icon = gdk_pixbuf_new_from_xpm_data((const gchar **) icon_bits); + gtk_window_set_default_icon(icon); + + window = gport->top_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "PCB"); + gtk_window_set_default_size(GTK_WINDOW(window), ghidgui->top_window_width, ghidgui->top_window_height); + + if (Settings.AutoPlace) + gtk_window_move(GTK_WINDOW(window), 10, 10); + + gtk_widget_show_all(gport->top_window); + ghidgui->creating = TRUE; +} + +void ghid_do_export(HID_Attr_Val * options) +{ + ghid_create_pcb_widgets(); + + /* These are needed to make sure the @layerpick and @layerview menus + * are properly initialized and synchronized with the current PCB. + */ + ghid_layer_buttons_update(); + ghid_main_menu_install_route_style_selector + (GHID_MAIN_MENU(ghidgui->menu_bar), GHID_ROUTE_STYLE_SELECTOR(ghidgui->route_style_selector)); + + if (stdin_listen) + ghid_create_listener(); + + ghid_notify_gui_is_up(); + + event(EVENT_GUI_INIT, NULL); + + gtk_main(); + ghid_config_files_write(); + +} + +/*! \brief callback for */ +static gboolean get_layer_visible_cb(int id) +{ + int visible; + layer_process(NULL, NULL, &visible, id); + return visible; +} + +gint LayersChanged(int argc, char **argv, Coord x, Coord y) +{ + if (!ghidgui || !ghidgui->menu_bar) + return 0; + + ghid_config_groups_changed(); + ghid_layer_buttons_update(); + ghid_layer_selector_show_layers(GHID_LAYER_SELECTOR(ghidgui->layer_selector), get_layer_visible_cb); + + /* FIXME - if a layer is moved it should retain its color. But layers + | currently can't do that because color info is not saved in the + | pcb file. So this makes a moved layer change its color to reflect + | the way it will be when the pcb is reloaded. + */ + pcb_colors_from_settings(PCB); + return 0; +} + +static const char toggleview_syntax[] = + "ToggleView(1..MAXLAYER)\n" "ToggleView(layername)\n" "ToggleView(Silk|Rats|Pins|Vias|Mask|BackSide)"; + +static const char toggleview_help[] = "Toggle the visibility of the specified layer or layer group."; + +/* %start-doc actions ToggleView + +If you pass an integer, that layer is specified by index (the first +layer is @code{1}, etc). If you pass a layer name, that layer is +specified by name. When a layer is specified, the visibility of the +layer group containing that layer is toggled. + +If you pass a special layer name, the visibility of those components +(silk, rats, etc) is toggled. Note that if you have a layer named +the same as a special layer, the layer is chosen over the special layer. + +%end-doc */ + +static int ToggleView(int argc, char **argv, Coord x, Coord y) +{ + int i, l; + +#ifdef DEBUG_MENUS + puts("Starting ToggleView()."); +#endif + + if (argc == 0) { + AFAIL(toggleview); + } + if (isdigit((int) argv[0][0])) { + l = atoi(argv[0]) - 1; + } + else if (strcmp(argv[0], "Silk") == 0) + l = LAYER_BUTTON_SILK; + else if (strcmp(argv[0], "Rats") == 0) + l = LAYER_BUTTON_RATS; + else if (strcmp(argv[0], "Pins") == 0) + l = LAYER_BUTTON_PINS; + else if (strcmp(argv[0], "Vias") == 0) + l = LAYER_BUTTON_VIAS; + else if (strcmp(argv[0], "Mask") == 0) + l = LAYER_BUTTON_MASK; + else if (strcmp(argv[0], "BackSide") == 0) + l = LAYER_BUTTON_FARSIDE; + else { + l = -1; + for (i = 0; i < max_copper_layer + 2; i++) + if (strcmp(argv[0], PCB->Data->Layer[i].Name) == 0) { + l = i; + break; + } + if (l == -1) { + AFAIL(toggleview); + } + + } + + /* Now that we've figured out which toggle button ought to control + * this layer, simply hit the button and let the pre-existing code deal + */ + ghid_layer_selector_toggle_layer(GHID_LAYER_SELECTOR(ghidgui->layer_selector), l); + return 0; +} + +static const char selectlayer_syntax[] = "SelectLayer(1..MAXLAYER|Silk|Rats)"; + +static const char selectlayer_help[] = "Select which layer is the current layer."; + +/* %start-doc actions SelectLayer + +The specified layer becomes the currently active layer. It is made +visible if it is not already visible + +%end-doc */ + +static int SelectLayer(int argc, char **argv, Coord x, Coord y) +{ + int newl; + if (argc == 0) + AFAIL(selectlayer); + + if (strcasecmp(argv[0], "silk") == 0) + newl = LAYER_BUTTON_SILK; + else if (strcasecmp(argv[0], "rats") == 0) + newl = LAYER_BUTTON_RATS; + else + newl = atoi(argv[0]) - 1; + +#ifdef DEBUG_MENUS + printf("SelectLayer(): newl = %d\n", newl); +#endif + + /* Now that we've figured out which radio button ought to select + * this layer, simply hit the button and let the pre-existing code deal + */ + ghid_layer_selector_select_layer(GHID_LAYER_SELECTOR(ghidgui->layer_selector), newl); + + return 0; +} + + +HID_Action gtk_topwindow_action_list[] = { + {"LayersChanged", 0, LayersChanged, + layerschanged_help, layerschanged_syntax} + , + {"SelectLayer", 0, SelectLayer, + selectlayer_help, selectlayer_syntax} + , + {"ToggleView", 0, ToggleView, + toggleview_help, toggleview_syntax} +}; + +REGISTER_ACTIONS(gtk_topwindow_action_list) + +/* + * This function is used to check if a specified hotkey in the menu + * resource file is "special". In this case "special" means that gtk + * assigns a particular meaning to it and the normal menu setup will + * never see these key presses. We capture those and feed them back + * into the menu callbacks. This function is called as new + * accelerators are added when the menus are being built + */ + static void + ghid_check_special_key(const char *accel, GtkAction * action, const Resource * node) +{ + size_t len; + unsigned int mods; + unsigned int ind; + + if (action == NULL || accel == NULL || *accel == '\0') + return; + +#ifdef DEBUG_MENUS + printf("%s(\"%s\", \"%s\")\n", __FUNCTION__, accel, name); +#endif + + mods = 0; + if (strstr(accel, "")) { + mods |= GHID_KEY_ALT; + } + if (strstr(accel, "")) { + mods |= GHID_KEY_CONTROL; + } + if (strstr(accel, "")) { + mods |= GHID_KEY_SHIFT; + } + + + len = strlen(accel); + +#define CHECK_KEY(a) ((len >= strlen (a)) && (strcmp (accel + len - strlen (a), (a)) == 0)) + + ind = 0; + if (CHECK_KEY("Tab")) { + ind = mods | GHID_KEY_TAB; + } + else if (CHECK_KEY("Up")) { + ind = mods | GHID_KEY_UP; + } + else if (CHECK_KEY("Down")) { + ind = mods | GHID_KEY_DOWN; + } + else if (CHECK_KEY("Left")) { + ind = mods | GHID_KEY_LEFT; + } + else if (CHECK_KEY("Right")) { + ind = mods | GHID_KEY_RIGHT; + } + + if (ind > 0) { + if (ind >= N_HOTKEY_ACTIONS) { + fprintf(stderr, "ERROR: overflow of the ghid_hotkey_actions array. Index = %d\n" "Please report this.\n", ind); + exit(1); + } + + ghid_hotkey_actions[ind].action = action; + ghid_hotkey_actions[ind].node = node; +#ifdef DEBUG_MENUS + printf("Adding \"special\" hotkey to ghid_hotkey_actions[%u] :" " %s (%s)\n", ind, accel, name); +#endif + } +} + +/*! \brief Finds the gpcb-menu.res file */ +char *get_menu_filename(void) +{ + char **s, *rv = NULL; + char *home_pcbmenu = NULL; + + /* homedir is set by the core */ + if (homedir) { + Message(_("Note: home directory is \"%s\"\n"), homedir); + home_pcbmenu = Concat(homedir, PCB_DIR_SEPARATOR_S, ".pcb", PCB_DIR_SEPARATOR_S, "gpcb-menu.res", NULL); + } + else + Message(_("Warning: could not determine home directory\n")); + + resolve_all_paths(pcbmenu_paths_in, pcbmenu_paths); + + for (s = pcbmenu_paths; *s != NULL; s++) { + if (access(*s, R_OK) == 0) + return strdup(*s); + } + + if (home_pcbmenu != NULL && (access(home_pcbmenu, R_OK) == 0)) + rv = home_pcbmenu; + + return rv; +} + +static GtkWidget *ghid_load_menus(void) +{ + char *filename; + const Resource *r = 0, *bir; + const Resource *mr; + GtkWidget *menu_bar = NULL; + int i; + + for (i = 0; i < N_HOTKEY_ACTIONS; i++) { + ghid_hotkey_actions[i].action = NULL; + ghid_hotkey_actions[i].node = NULL; + } + + bir = resource_parse(0, gpcb_menu_default); + if (!bir) { + fprintf(stderr, _("Error: internal menu resource didn't parse\n")); + exit(1); + } + + filename = get_menu_filename(); + if (filename) { + Message("Loading menus from %s\n", filename); + r = resource_parse(filename, 0); + } + + if (!r) { + Message("Using default menus\n"); + r = bir; + } + free(filename); + + mr = resource_subres(r, "MainMenu"); + if (!mr) + mr = resource_subres(bir, "MainMenu"); + + if (mr) { + menu_bar = ghid_main_menu_new(G_CALLBACK(ghid_menu_cb), ghid_check_special_key); + ghid_main_menu_add_resource(GHID_MAIN_MENU(menu_bar), mr); + } + + mr = resource_subres(r, "PopupMenus"); + if (!mr) + mr = resource_subres(bir, "PopupMenus"); + + if (mr) { + int i; + for (i = 0; i < mr->c; i++) + if (resource_type(mr->v[i]) == 101) + /* This is a named resource which defines a popup menu */ + ghid_main_menu_add_popup_resource(GHID_MAIN_MENU(menu_bar), mr->v[i].name, mr->v[i].subres); + } + +#ifdef DEBUG_MENUS + puts("Finished loading menus."); +#endif + + mr = resource_subres(r, "Mouse"); + if (!mr) + mr = resource_subres(bir, "Mouse"); + if (mr) + load_mouse_resource(mr); + + return menu_bar; +} + +/* ------------------------------------------------------------ */ + +static const char adjuststyle_syntax[] = "AdjustStyle()\n"; + +static const char adjuststyle_help[] = "Open the window which allows editing of the route styles."; + +/* %start-doc actions AdjustStyle + +Opens the window which allows editing of the route styles. + +%end-doc */ + +static int AdjustStyle(int argc, char **argv, Coord x, Coord y) +{ + if (argc > 1) + AFAIL(adjuststyle); + + ghid_route_style_selector_edit_dialog(GHID_ROUTE_STYLE_SELECTOR(ghidgui->route_style_selector)); + return 0; +} + +/* ------------------------------------------------------------ */ + +static const char editlayergroups_syntax[] = "EditLayerGroups()\n"; + +static const char editlayergroups_help[] = "Open the preferences window which allows editing of the layer groups."; + +/* %start-doc actions EditLayerGroups + +Opens the preferences window which is where the layer groups +are edited. This action is primarily provides to provide menu +resource compatibility with the lesstif HID. + +%end-doc */ + +static int EditLayerGroups(int argc, char **argv, Coord x, Coord y) +{ + + if (argc != 0) + AFAIL(editlayergroups); + + hid_actionl("DoWindows", "Preferences", NULL); + + return 0; +} + +/* ------------------------------------------------------------ */ + +HID_Action ghid_menu_action_list[] = { + {"AdjustStyle", 0, AdjustStyle, adjuststyle_help, adjuststyle_syntax} + , + {"EditLayerGroups", 0, EditLayerGroups, editlayergroups_help, editlayergroups_syntax} +}; + +REGISTER_ACTIONS(ghid_menu_action_list) Index: 1.0.8/src/hid/gtk/gui-utils.c =================================================================== --- 1.0.8/src/hid/gtk/gui-utils.c (nonexistent) +++ 1.0.8/src/hid/gtk/gui-utils.c (revision 1136) @@ -0,0 +1,752 @@ +/* $Id$ */ + +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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. + * + */ + +/* This module, gui-utils.c, was written by Bill Wilson and the functions + * here are Copyright (C) 2004 by Bill Wilson. These functions are utility + * functions which are taken from my other GPL'd projects gkrellm and + * gstocks and are copied here for the Gtk PCB port. + */ + +#include "config.h" + +#include "gui.h" +#include + + +RCSID("$Id$"); + +/* Not a gui function, but no better place to put it... + */ +gboolean dup_string(gchar ** dst, const gchar * src) +{ + if ((dst == NULL) || ((*dst == NULL) && (src == NULL))) + return FALSE; + if (*dst) { + if (src && !strcmp(*dst, src)) + return FALSE; + g_free(*dst); + } + *dst = g_strdup(src); + return TRUE; +} + +void free_glist_and_data(GList ** list_head) +{ + GList *list; + + if (*list_head == NULL) + return; + for (list = *list_head; list; list = list->next) + if (list->data) + g_free(list->data); + g_list_free(*list_head); + *list_head = NULL; +} + + +gboolean ghid_is_modifier_key_sym(gint ksym) +{ + if (ksym == GDK_Shift_R || ksym == GDK_Shift_L || ksym == GDK_Control_R || ksym == GDK_Control_L) + return TRUE; + return FALSE; +} + + +ModifierKeysState ghid_modifier_keys_state(GdkModifierType * state) +{ + GdkModifierType mask; + ModifierKeysState mk; + gboolean shift, control, mod1; + GHidPort *out = &ghid_port; + + if (!state) + gdk_window_get_pointer(gtk_widget_get_window(out->drawing_area), NULL, NULL, &mask); + else + mask = *state; + + shift = (mask & GDK_SHIFT_MASK); + control = (mask & GDK_CONTROL_MASK); + mod1 = (mask & GDK_MOD1_MASK); + + if (shift && !control && !mod1) + mk = SHIFT_PRESSED; + else if (!shift && control && !mod1) + mk = CONTROL_PRESSED; + else if (!shift && !control && mod1) + mk = MOD1_PRESSED; + else if (shift && control && !mod1) + mk = SHIFT_CONTROL_PRESSED; + else if (shift && !control && mod1) + mk = SHIFT_MOD1_PRESSED; + else if (!shift && control && mod1) + mk = CONTROL_MOD1_PRESSED; + else if (shift && control && mod1) + mk = SHIFT_CONTROL_MOD1_PRESSED; + else + mk = NONE_PRESSED; + + return mk; +} + +ButtonState ghid_button_state(GdkModifierType * state) +{ + GdkModifierType mask; + ButtonState bs; + gboolean button1, button2, button3; + GHidPort *out = &ghid_port; + + if (!state) + gdk_window_get_pointer(gtk_widget_get_window(out->drawing_area), NULL, NULL, &mask); + else + mask = *state; + + button1 = (mask & GDK_BUTTON1_MASK); + button2 = (mask & GDK_BUTTON2_MASK); + button3 = (mask & GDK_BUTTON3_MASK); + + if (button1) + bs = BUTTON1_PRESSED; + else if (button2) + bs = BUTTON2_PRESSED; + else if (button3) + bs = BUTTON3_PRESSED; + else + bs = NO_BUTTON_PRESSED; + + return bs; +} + +void ghid_draw_area_update(GHidPort * port, GdkRectangle * rect) +{ + gdk_window_invalidate_rect(gtk_widget_get_window(port->drawing_area), rect, FALSE); +} + + +gchar *ghid_get_color_name(GdkColor * color) +{ + gchar *name; + + if (!color) + name = g_strdup("#000000"); + else + name = g_strdup_printf("#%2.2x%2.2x%2.2x", (color->red >> 8) & 0xff, (color->green >> 8) & 0xff, (color->blue >> 8) & 0xff); + return name; +} + +void ghid_map_color_string(char *color_string, GdkColor * color) +{ + static GdkColormap *colormap = NULL; + GHidPort *out = &ghid_port; + + if (!color || !out->top_window) + return; + if (colormap == NULL) + colormap = gtk_widget_get_colormap(out->top_window); + if (color->red || color->green || color->blue) + gdk_colormap_free_colors(colormap, color, 1); + gdk_color_parse(color_string, color); + gdk_color_alloc(colormap, color); +} + + +gchar *ghid_entry_get_text(GtkWidget * entry) +{ + gchar *s = ""; + + if (entry) + s = (gchar *) gtk_entry_get_text(GTK_ENTRY(entry)); + while (*s == ' ' || *s == '\t') + ++s; + return s; +} + + + +void +ghid_check_button_connected(GtkWidget * box, + GtkWidget ** button, + gboolean active, + gboolean pack_start, + gboolean expand, + gboolean fill, + gint pad, void (*cb_func) (GtkToggleButton *, gpointer), gpointer data, gchar * string) +{ + GtkWidget *b; + + if (!string) + return; + b = gtk_check_button_new_with_label(string); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b), active); + if (box && pack_start) + gtk_box_pack_start(GTK_BOX(box), b, expand, fill, pad); + else if (box && !pack_start) + gtk_box_pack_end(GTK_BOX(box), b, expand, fill, pad); + + if (cb_func) + g_signal_connect(b, "clicked", G_CALLBACK(cb_func), data); + if (button) + *button = b; +} + +void +ghid_button_connected(GtkWidget * box, GtkWidget ** button, + gboolean pack_start, gboolean expand, gboolean fill, + gint pad, void (*cb_func) (gpointer), gpointer data, gchar * string) +{ + GtkWidget *b; + + if (!string) + return; + b = gtk_button_new_with_label(string); + if (box && pack_start) + gtk_box_pack_start(GTK_BOX(box), b, expand, fill, pad); + else if (box && !pack_start) + gtk_box_pack_end(GTK_BOX(box), b, expand, fill, pad); + + if (cb_func) + g_signal_connect(b, "clicked", G_CALLBACK(cb_func), data); + if (button) + *button = b; +} + +void +ghid_coord_entry(GtkWidget * box, GtkWidget ** coord_entry, Coord value, + Coord low, Coord high, enum ce_step_size step_size, + gint width, void (*cb_func) (GHidCoordEntry *, gpointer), gpointer data, gboolean right_align, gchar * string) +{ + GtkWidget *hbox = NULL, *label, *entry_widget; + GHidCoordEntry *entry; + + if (string && box) { + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 2); + box = hbox; + } + + entry_widget = ghid_coord_entry_new(low, high, value, Settings.grid_unit, step_size); + if (coord_entry) + *coord_entry = entry_widget; + if (width > 0) + gtk_widget_set_size_request(entry_widget, width, -1); + entry = GHID_COORD_ENTRY(entry_widget); + if (data == NULL) + data = (gpointer) entry; + if (cb_func) + g_signal_connect(G_OBJECT(entry_widget), "value_changed", G_CALLBACK(cb_func), data); + if (box) { + if (right_align && string) { + label = gtk_label_new(string); + gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); + gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 2); + } + gtk_box_pack_start(GTK_BOX(box), entry_widget, FALSE, FALSE, 2); + if (!right_align && string) { + label = gtk_label_new(string); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 2); + } + } +} + +void +ghid_spin_button(GtkWidget * box, GtkWidget ** spin_button, gfloat value, + gfloat low, gfloat high, gfloat step0, gfloat step1, + gint digits, gint width, + void (*cb_func) (GtkSpinButton *, gpointer), gpointer data, gboolean right_align, gchar * string) +{ + GtkWidget *hbox = NULL, *label, *spin_but; + GtkSpinButton *spin; + GtkAdjustment *adj; + + if (string && box) { + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 2); + box = hbox; + } + adj = (GtkAdjustment *) gtk_adjustment_new(value, low, high, step0, step1, 0.0); + spin_but = gtk_spin_button_new(adj, 0.5, digits); + if (spin_button) + *spin_button = spin_but; + if (width > 0) + gtk_widget_set_size_request(spin_but, width, -1); + spin = GTK_SPIN_BUTTON(spin_but); + gtk_spin_button_set_numeric(spin, TRUE); + if (data == NULL) + data = (gpointer) spin; + if (cb_func) + g_signal_connect(G_OBJECT(spin_but), "value_changed", G_CALLBACK(cb_func), data); + if (box) { + if (right_align && string) { + label = gtk_label_new(string); + gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); + gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 2); + } + gtk_box_pack_start(GTK_BOX(box), spin_but, FALSE, FALSE, 2); + if (!right_align && string) { + label = gtk_label_new(string); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 2); + } + } +} + +void +ghid_table_coord_entry(GtkWidget * table, gint row, gint column, + GtkWidget ** coord_entry, Coord value, + Coord low, Coord high, enum ce_step_size step_size, + gint width, void (*cb_func) (GHidCoordEntry *, gpointer), + gpointer data, gboolean right_align, gchar * string) +{ + GtkWidget *label, *entry_widget; + GHidCoordEntry *entry; + + if (!table) + return; + + entry_widget = ghid_coord_entry_new(low, high, value, Settings.grid_unit, step_size); + if (coord_entry) + *coord_entry = entry_widget; + if (width > 0) + gtk_widget_set_size_request(entry_widget, width, -1); + entry = GHID_COORD_ENTRY(entry_widget); + if (data == NULL) + data = (gpointer) entry; + if (cb_func) + g_signal_connect(G_OBJECT(entry), "value_changed", G_CALLBACK(cb_func), data); + + if (right_align) { + gtk_table_attach_defaults(GTK_TABLE(table), entry_widget, column + 1, column + 2, row, row + 1); + if (string) { + label = gtk_label_new(string); + gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); + gtk_table_attach_defaults(GTK_TABLE(table), label, column, column + 1, row, row + 1); + } + } + else { + gtk_table_attach_defaults(GTK_TABLE(table), entry_widget, column, column + 1, row, row + 1); + if (string) { + label = gtk_label_new(string); + gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); + gtk_table_attach_defaults(GTK_TABLE(table), label, column + 1, column + 2, row, row + 1); + } + } +} + + +void +ghid_table_spin_button(GtkWidget * table, gint row, gint column, + GtkWidget ** spin_button, gfloat value, + gfloat low, gfloat high, gfloat step0, gfloat step1, + gint digits, gint width, + void (*cb_func) (GtkSpinButton *, gpointer), gpointer data, gboolean right_align, gchar * string) +{ + GtkWidget *label, *spin_but; + GtkSpinButton *spin; + GtkAdjustment *adj; + + if (!table) + return; + + adj = (GtkAdjustment *) gtk_adjustment_new(value, low, high, step0, step1, 0.0); + spin_but = gtk_spin_button_new(adj, 0.5, digits); + + if (spin_button) + *spin_button = spin_but; + if (width > 0) + gtk_widget_set_size_request(spin_but, width, -1); + spin = GTK_SPIN_BUTTON(spin_but); + gtk_spin_button_set_numeric(spin, TRUE); + if (data == NULL) + data = (gpointer) spin; + if (cb_func) + g_signal_connect(G_OBJECT(spin_but), "value_changed", G_CALLBACK(cb_func), data); + + if (right_align) { + gtk_table_attach_defaults(GTK_TABLE(table), spin_but, column + 1, column + 2, row, row + 1); + if (string) { + label = gtk_label_new(string); + gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); + gtk_table_attach_defaults(GTK_TABLE(table), label, column, column + 1, row, row + 1); + } + } + else { + gtk_table_attach_defaults(GTK_TABLE(table), spin_but, column, column + 1, row, row + 1); + if (string) { + label = gtk_label_new(string); + gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); + gtk_table_attach_defaults(GTK_TABLE(table), label, column + 1, column + 2, row, row + 1); + } + } +} + +void +ghid_range_control(GtkWidget * box, GtkWidget ** scale_res, + gboolean horizontal, GtkPositionType pos, + gboolean set_draw_value, gint digits, gboolean pack_start, + gboolean expand, gboolean fill, guint pad, gfloat value, + gfloat low, gfloat high, gfloat step0, gfloat step1, void (*cb_func) (), gpointer data) +{ + GtkWidget *scale; + GtkAdjustment *adj; + + adj = (GtkAdjustment *) gtk_adjustment_new(value, low, high, step0, step1, 0.0); + + if (horizontal) + scale = gtk_hscale_new(GTK_ADJUSTMENT(adj)); + else + scale = gtk_vscale_new(GTK_ADJUSTMENT(adj)); + gtk_scale_set_value_pos(GTK_SCALE(scale), pos); + gtk_scale_set_draw_value(GTK_SCALE(scale), set_draw_value); + gtk_scale_set_digits(GTK_SCALE(scale), digits); + + /* Increments don't make sense, use -1,1 because that does closest to + | what I want: scroll down decrements slider value. + */ + gtk_range_set_increments(GTK_RANGE(scale), -1, 1); + + if (pack_start) + gtk_box_pack_start(GTK_BOX(box), scale, expand, fill, pad); + else + gtk_box_pack_end(GTK_BOX(box), scale, expand, fill, pad); + + if (data == NULL) + data = (gpointer) adj; + if (cb_func) + g_signal_connect(G_OBJECT(adj), "value_changed", G_CALLBACK(cb_func), data); + if (scale_res) + *scale_res = scale; +} + +GtkWidget *ghid_scrolled_vbox(GtkWidget * box, GtkWidget ** scr, GtkPolicyType h_policy, GtkPolicyType v_policy) +{ + GtkWidget *scrolled, *vbox; + + scrolled = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), h_policy, v_policy); + gtk_box_pack_start(GTK_BOX(box), scrolled, TRUE, TRUE, 0); + vbox = gtk_vbox_new(FALSE, 0); + gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled), vbox); + if (scr) + *scr = scrolled; + return vbox; +} + +/* frame_border_width - border around outside of frame. + | vbox_pad - pad between widgets to be packed in returned vbox. + | vbox_border_width - border between returned vbox and frame. +*/ +GtkWidget *ghid_framed_vbox(GtkWidget * box, gchar * label, gint frame_border_width, + gboolean frame_expand, gint vbox_pad, gint vbox_border_width) +{ + GtkWidget *frame; + GtkWidget *vbox; + + frame = gtk_frame_new(label); + gtk_container_set_border_width(GTK_CONTAINER(frame), frame_border_width); + gtk_box_pack_start(GTK_BOX(box), frame, frame_expand, frame_expand, 0); + vbox = gtk_vbox_new(FALSE, vbox_pad); + gtk_container_set_border_width(GTK_CONTAINER(vbox), vbox_border_width); + gtk_container_add(GTK_CONTAINER(frame), vbox); + return vbox; +} + +GtkWidget *ghid_framed_vbox_end(GtkWidget * box, gchar * label, gint frame_border_width, + gboolean frame_expand, gint vbox_pad, gint vbox_border_width) +{ + GtkWidget *frame; + GtkWidget *vbox; + + frame = gtk_frame_new(label); + gtk_container_set_border_width(GTK_CONTAINER(frame), frame_border_width); + gtk_box_pack_end(GTK_BOX(box), frame, frame_expand, frame_expand, 0); + vbox = gtk_vbox_new(FALSE, vbox_pad); + gtk_container_set_border_width(GTK_CONTAINER(vbox), vbox_border_width); + gtk_container_add(GTK_CONTAINER(frame), vbox); + return vbox; +} + +GtkWidget *ghid_category_vbox(GtkWidget * box, const gchar * category_header, + gint header_pad, gint box_pad, gboolean pack_start, gboolean bottom_pad) +{ + GtkWidget *vbox, *vbox1, *hbox, *label; + gchar *s; + + vbox = gtk_vbox_new(FALSE, 0); + if (pack_start) + gtk_box_pack_start(GTK_BOX(box), vbox, FALSE, FALSE, 0); + else + gtk_box_pack_end(GTK_BOX(box), vbox, FALSE, FALSE, 0); + + if (category_header) { + label = gtk_label_new(NULL); + s = g_strconcat("", category_header, "", NULL); + gtk_label_set_markup(GTK_LABEL(label), s); + gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, header_pad); + g_free(s); + } + + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + label = gtk_label_new(" "); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + vbox1 = gtk_vbox_new(FALSE, box_pad); + gtk_box_pack_start(GTK_BOX(hbox), vbox1, TRUE, TRUE, 0); + + if (bottom_pad) { + label = gtk_label_new(""); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); + } + return vbox1; +} + +GtkTreeSelection *ghid_scrolled_selection(GtkTreeView * treeview, GtkWidget * box, + GtkSelectionMode s_mode, + GtkPolicyType h_policy, GtkPolicyType v_policy, + void (*func_cb) (GtkTreeSelection *, gpointer), gpointer data) +{ + GtkTreeSelection *selection; + GtkWidget *scrolled; + + if (!box || !treeview) + return NULL; + + scrolled = gtk_scrolled_window_new(NULL, NULL); + gtk_box_pack_start(GTK_BOX(box), scrolled, TRUE, TRUE, 0); + gtk_container_add(GTK_CONTAINER(scrolled), GTK_WIDGET(treeview)); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), h_policy, v_policy); + selection = gtk_tree_view_get_selection(treeview); + gtk_tree_selection_set_mode(selection, s_mode); + if (func_cb) + g_signal_connect(G_OBJECT(selection), "changed", G_CALLBACK(func_cb), data); + return selection; +} + +GtkWidget *ghid_notebook_page(GtkWidget * tabs, char *name, gint pad, gint border) +{ + GtkWidget *label; + GtkWidget *vbox; + + vbox = gtk_vbox_new(FALSE, pad); + gtk_container_set_border_width(GTK_CONTAINER(vbox), border); + + label = gtk_label_new(name); + gtk_notebook_append_page(GTK_NOTEBOOK(tabs), vbox, label); + + return vbox; +} + +GtkWidget *ghid_framed_notebook_page(GtkWidget * tabs, char *name, gint border, + gint frame_border, gint vbox_pad, gint vbox_border) +{ + GtkWidget *vbox; + + vbox = ghid_notebook_page(tabs, name, 0, border); + vbox = ghid_framed_vbox(vbox, NULL, frame_border, TRUE, vbox_pad, vbox_border); + return vbox; +} + +void ghid_dialog_report(const gchar * title, const gchar * message) +{ + GtkWidget *top_win; + GtkWidget *dialog; + GtkWidget *content_area; + GtkWidget *scrolled; + GtkWidget *vbox, *vbox1; + GtkWidget *label; + const gchar *s; + gint nlines; + GHidPort *out = &ghid_port; + + if (!message) + return; + top_win = out->top_window; + dialog = gtk_dialog_new_with_buttons(title ? title : "PCB", + GTK_WINDOW(top_win), + GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_NONE, NULL); + g_signal_connect_swapped(GTK_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(dialog)); + gtk_window_set_wmclass(GTK_WINDOW(dialog), "PCB_Dialog", "PCB"); + + content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); + + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 8); + gtk_box_pack_start(GTK_BOX(content_area), vbox, FALSE, FALSE, 0); + + label = gtk_label_new(message); + gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); + + for (nlines = 0, s = message; *s; ++s) + if (*s == '\n') + ++nlines; + if (nlines > 20) { + vbox1 = ghid_scrolled_vbox(vbox, &scrolled, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + gtk_widget_set_size_request(scrolled, -1, 300); + gtk_box_pack_start(GTK_BOX(vbox1), label, FALSE, FALSE, 0); + } + else + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); + + gtk_widget_show_all(dialog); +} + + +void ghid_label_set_markup(GtkWidget * label, const gchar * text) +{ + if (label) + gtk_label_set_markup(GTK_LABEL(label), text ? text : ""); +} + + +static void text_view_append(GtkWidget * view, gchar * s) +{ + GtkTextIter iter; + GtkTextBuffer *buffer; + GtkTextMark *mark; + + buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view)); + gtk_text_buffer_get_end_iter(buffer, &iter); + /* gtk_text_iter_forward_to_end(&iter); */ + + if (strncmp(s, "", 3) == 0) + gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, s + 3, -1, "bold", NULL); + else if (strncmp(s, "", 3) == 0) + gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, s + 3, -1, "italic", NULL); + else if (strncmp(s, "", 3) == 0) + gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, s + 3, -1, "heading", NULL); + else if (strncmp(s, "", 3) == 0) + gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, s + 3, -1, "center", NULL); + else if (strncmp(s, "