/* LAYEPS (LAY) -- Layout EPS/PDF Output */ /* LAYEPS (LAY) -- Layout EPS/PDF Ausgabe */ /* // Copyright (c) 1994-2012 Oliver Bartels F+E, Muenchen // Authors: Manfred Baumeister, Roman Ludwig // Changes History: // rl (120510) ENHANCEMENT: // Added A0/A1/A2 paper size selection support. // rl (120427) RELEASED FOR BAE V7.8. // rl (120425) ENHANCEMENT: // Added item browser masked output option. // rl (120227) ENHANCEMENT: // Added element specific group/layer name ignore option to // layer setup. // rl (110511) BUGFIX: // Fixed problem with import of pre V7.6 defined batches. // rl (101027) RELEASED FOR BAE V7.6. // rl (100118) ENHANCEMENT: // Added part list part side output support. // rl (100108) ENHANCEMENT: // Added batch output page query support. // Added batch output layer query support. // rl (091027) RELEASED FOR BAE V7.4. // rl (091027) ENHANCEMENT: // Added fixed layer color output option. // Added part color attribute evaluation option. // jw/rl (090518) ENHANCEMENT: // Added drill center dot output option. // rl (090212) ENHANCEMENT: // Added case conversion options to partlist output. // rl (081014) RELEASED FOR BAE V7.2. // rl (080801) ENHANCEMENT: // Added RGB color spec. check to prevent invalid output file. // rl (080502) ENHANCEMENT: // Added colored nets output support. // rl (080423) ENHANCEMENT: // Added part predicate dependant file names support. // rl (080220) ENHANCEMENT: // Added variant files options to batch output. // rl (071029) RELEASED FOR BAE V7.0. // rl (071002) ENHANCEMENT: // Added full drill class output support. // rl (070727) ENHANCEMENT: // Added background grid PDF output support. // rl (061221) ENHANCEMENT: // Added CAM power layer settings usage option to batch output. // rl (061124) ENHANCEMENT: // Added automatic PDF display tool call option. // rl (061115) ENHANCEMENT: // Added variant specific output file name support. // rl (060829) RELEASED FOR BAE V6.8. // rl (060601) ENHANCEMENT: // Added PDF page boundary marker support. // rl (060505) ENHANCEMENT: // Added variant/page tree output option. // Added unplaced elements plot option to batch layers. // rl (060420) ENHANCEMENT: // Added PDF page mosaic output option. // rl (060320) ENHANCEMENT: // Added support for padstack drill output disable rules. // rl (060217) BUGFIX: // Fixed problem with missing isolations on direct // connection power layers. // rl (060214) CHANGE: // Added output page display attribute $pdfpage. // rl (060123) CHANGE: // Added font name specification for batch output files. // rl (060119) BUGFIX: // Fixed problem with missing negation line width specification. // rl (060116) CHANGE: // Changed abort request from page to complete output abort. // rl (051214) ENHANCEMENT: // Added compressed output support. // rl (051102) BUGFIX: // Fixed bug in batch page delete function. // rl (050906) RELEASED FOR BAE V6.6. // rl (050414) ENHANCEMENT: // Added alternate postscript font support. // rl (050113) ENHANCEMENT: // Added plan specific file name preservation. // rl (050107) ENHANCEMENT: // Added batch derivation from current settings. // Added white to black color conversion option. // Added special layers output support. // rl (041122) ENHANCEMENT: // Added PDF layer support for Acrobat >=6.0. // rl (041025) ENHANCEMENT: // Added configurable output device selection. // rl (040928) ENHANCEMENT: // Added batch name sorting. // rl (040923) ENHANCEMENT: // Enabled drills in manual layer selection. // rl (040907) ENHANCEMENT: // Added PDF sheets for parts/padstacks/pad output options. // rl (040811) RELEASED FOR BAE V6.4. // rl (040428) ENHANCEMENT: // Added PDF A3 output option. // rl (040414) BUGFIX: // Fixed problem in dervie batch file step function. // rl (040302) BUGFIX: // Fixed problem in copy batch function. // rl (040227) BUGFIX: // Fixed offset problem with rotated mirrored pages. // rl (040205) BUGFIX: // Fixed problem with multipage line scale growth. // rl (031124) BUGFIX: // Fixed problem with erroneous paper size selection. // rl (030912) RELEASED FOR BAE V6.2. // rl (030730) ENHANCEMENT: // Added output to folder option. // rl (030730) ENHANCEMENT: // Added remote controlled output support. // rl (030704) ENHANCEMENT: // Added fit to page open action to PDF output files. // rl (030630) ENHANCEMENT: // Added SQL batch database support. // rl (030526) ENHANCEMENT: // Added black & white output with visible layers control. // Added font selection option to dialog box. // rl (030507) ENHANCEMENT: // Added support for new dash options and dashed wide lines. // Enforced usage of BAE vector font for multiline texts. // rl (030312) ENHANCEMENT: // Added automatic rotation preselection for landscape // oriented elements. // rl (030116) ENHANCEMENT: // Added direct printer output support. // Improved A3/A4 paper selection. // rl (021209) RELEASED FOR BAE V6.0. // rl (021112) BUGFIX: // Fixed erroneous outline plot of split power plane // full isolation areas. // rl (020821) BUGFIX: // Enabled line scale selection for n:1 outputs. // rl (020814) ENHANCEMENT: // Added old DOS umlaut codes to Postscript character // translation table. // rl (020618) RELEASED FOR BAE V5.4. // rl (020305) BUGFIX: // Fixed problem with power layer output of drills // with heat trap / power layer mask definitions. // rl (010912) ENHANCEMENT: // Changed 1:1 scaling output options to n:1. // rl (010718) BUGFIX/PATCH: // EPS/PDF special layer color assignment problem for // Vis. with Outline option fixed. // rl (010626) RELEASED FOR BAE V5.0. // rl (010531) ENHANCEMENT: // Added optional parameter settings from bae.ini file. // rl (010330) ENHANCEMENT: // Added individual layer mirroring for single programm // layer field output. // rl (010123) BUGFIX: // Fixed problem with automatic output rotation. // rl (001115) BUGFIX: // Fixed rotated arc PDF output problem. // rl (000717) RELEASED FOR BAE V4.6. // rl (000717) BUGFIX: // Fixed rotated and mirrored text output problem. // rl (000508) ENHANCEMENT: // Added dialog box parameter selection. // rl (000315) BUGFIX: // Fixed various postscript font mirroring problems. // rl (000307) BUGFIX: // Fixed output rotation bug. // rl (000209) ENHANCEMENT: // Added A3 paper size. // rl (000126) ENHANCEMENT: // Added PDF A4 scaling option. // rl (991221) ENHANCEMENT: // Support of all layer, border and marker mode for single // layer output. // Fixed rotated drill output problem. // rl (991207) ENHANCEMENT: // Support of mirrored postscript fonts introduced. // rl (991126) RELEASED FOR BAE V4.4. // rl (991126) ENHANCEMENT: // Color support introduced. Trace outline problem fixed. // rl (991119) ENHANCEMENT: // Output of mouse selectable layers introduced. // rl (990903) ENHANCEMENT: // Added support of rules for element specific plot line width // and dash mode. // rl (990411) ENHANCEMENT: // Introduced PDF output option. // Introduced command abbreviations to reduce output size. // Added umlaut character font redefinition support. // rl (990223) ENHANCEMENT: // Derive power drill tree number from level to ensure // correct output of part level vias. // mb (981229) ENHANCEMENT: // Letter output format introduced. // rl (980929) RELEASED FOR BAE V4.2. // mb (980710) ENHANCEMENT: // Pulldown menu delimiters introduced. // mb (980710) ENHANCEMENT: // Dynamic multi-language support introduced. // rl (970929) RELEASED FOR BAE V4.0. // mb (961001) RELEASED FOR BAE V3.4. // mb (961001) IMPROVEMENT: // EPS file headers/footers changed in order to comply // with PS-Adobe-3.0 EPSF-3.0 format. // mb (951012) IMPROVEMENT: // Performing BAE_Demo_check(2) before starting output. // mb (950913) IMPROVEMENT/BUGFIX: // Introduced "%!PS" first line/column output for supporting // PostScript recognition by output device. // mb (95) RELEASED FOR BAE V3.2. // mb (950421) ENHANCEMENT: // Introduced feature for setting layer-specific polygon // and text line widths on program layer output. // mb (950113) ENHANCEMENT: // Implemented keepout areas output. // Implemented copper fill workareas output. // mb (950113) BUGFIX: // Absolute test coords for lay_getpowplanetree() // (i.e. no scan offset!). // mb (950105) ENHANCEMENT: // Implemented drill hole (display item) output. // Introduced feature for output stop on key hit. // mb (950104) ENHANCEMENT: // Introduced option for plotting either visible // or programmed layers. // mb (941216) ENHANCEMENT: // Introduced mirror plot options. // Introduced clipping plot features. // mb (940614) BUGFIX: // Layer output field corrected for output of doc layers 4/5/9. // mb (94) RELEASED FOR BAE V3.0. // mb (94) ORIGINAL CODING; retrieved from POSTOUT. // // DESCRIPTION // // The layeps User Language program produces either Adobe // Portable Document Format (PDF) or Encapsulated PostScript (EPS) // output of the currently loaded layout element, featuring different // scaling modes for output and optional clipping window selection. // Several layers and/or display items are plotted simultaneously with // layer-specific options for fill mode, RGB values, hatching, dashed // lines, and standard line widths respectively. The output layers as // well as the layer-specific plot options are defined in a special // layeps source code variable which is intended for customization; // layeps also supports plot mirror options, plot rotate options // (for 1:1 scale output), and an option for plotting the currently // visible layers (with automatic color) instead of the // predefined layer set. // // WARNINGS // // Display items Workarea, Origin, Error, Highlight // will be ignored on visible layers output! */ // Enforce LAY caller type #pragma ULCALLERLAY // Disable undo state request #pragma ULCALLERNOUNDO // Includes #include "baeparam.ulh" // User Language BAE param. access #include "pop.ulh" // User Language popup utilities #include "lay.ulh" // User Language layout utilities #include "sql.ulh" // User Language SQL utilities // Messages string UPRABORT = M_UPRABORT(); string REPPSWRLAY = M("EPS/PostScript-Ausgabe %s...", "EPS/PostScript output %s..."); string REPPDFWRLAY = M("PDF-Ausgabe %s...","PDF output %s..."); string REPHEADER = M("EPS/PDF Batch Report:","EPS/PDF Batch Report:"); string REPJOB = M(" Projektdatei : '%s'"," Project File : '%s'"); string REPEPSFILE = M(" EPS Datei : '%s'"," EPS Plotfile : '%s'"); string REPPDFFILE = M(" PDF Datei : '%s'"," PDF File : '%s'"); string REPPDFVARIANT = M(" Variante %s :"," Variant %s :"); string REPPDFPAGE = M(" %s"," %s"); string REPPSDONE = M("EPS/PostScript-Daten ausgegeben auf '%s'.", "EPS/PostScript data written to '%s'."); string REPPDFDONE = M("PDF-Daten ausgegeben auf '%s'.", "PDF data written to '%s'."); string REPBATCHDONE = M("Batchausgabe '%s' durchgefuehrt.", "Batch output '%s' completed."); string REPOUTABORT = M("Ausgabe abgebrochen. Ausgabedatei '%s' invollstaendig.", "Output aborted. Output file '%s' incomplete."); string REPBATCHSTORE = M("Batch '%s' gespeichert.","Batch '%s' written."); string REPSIDE1 = M("Seite 1:","Side 1:"); string REPSIDE2 = M("Seite 2:","Side 2:"); string REPBOTH = M("Beide:","Both:"); string REPLAYSTEP = M("%s","%s"); string REPELEMNAME = M("Elementname","Element name"); string REPVARELEMNAME = M("Varianten zu Elementname", "Variant for element name"); string REPALLLELEM = M(" fuer alle Dateilayouts"," for all File Layouts"); string REPALLPELEM = M(" fuer alle Dateibauteile"," for all File Parts"); string REPALLSELEM = M(" fuer alle Dateipadstacks", " for all File Padstacks"); string REPALLDELEM = M(" fuer alle Dateipads"," for all File Pads"); string REPPARTLIST = M(" fuer alle Bauteillistenseiten", " for all Part List Pages"); string REPFONT = M(" Zeichensatz, "," Font, "); string REPLINEWP = M("Linienbreite ","Line Width "); string REPLINEWT = M("Textlinienbreite ","Text Line Width "); string REPVARBASE = M("Basisvariante","Base Variant"); string REPVARUNNAMED = M("Variante %d","Variant %d"); string REPPART = M("Bauteil %s","Part %s"); string REPSYMMACRO = M("Symbolmakro","Symbol Macro"); string REPSYMPIN = M("Symbolpin","Symbol Pin"); string REPPARTMACRO = M("Gehaeuse","Part Macro"); string REPPIN = M("Pin","Pin"); string REPPADSTACK = M("Padstack","Padstack"); string REPNET = M("Netz","Net"); string REPANNOTENT = M("%s : %s","%s : %s"); string REPFORMAT1 = M("Postscript Skalierung ","Postscript Scale "); string REPFORMAT6 = M("PDF Skalierung ","PDF Scale "); string REPFORMAT8 = M("PDF A4 Skalierung ","PDF A4 Scale "); string REPFORMAT10 = M("PDF A4-Mosaik Skalierung ","PDF A4 Mosaic Scale "); string REPGRID = M("Raster %s","Grid %s"); string UPRPSFILE = M("Ausgabedatei ? ","Output File ? "); string UPRDPSFILE = M("Ausgabedatei :","Output File :"); string UPRBPSFILE = M("!Ausgabedatei","!Output File"); string UPRSDIR = M("Biblikotheksverzeichnis ? ", "Library Directory ? "); string UPRSELFILE = M("Layout-Datei ? ","Layout File ? "); string UPRSELDEV = M("Ausgabedevice waehlen!","Select Output Device!"); string UPRLAYER = M("Lagen fuer Ausgabe waehlen!", "Select Layers for Output!"); string UPRSLAYER = M("Lage fuer Ausgabe waehlen!", "Select Layer for Output!"); string UPRDLAYER = M("Ausgabelagen :","Output Layers :"); string UPRLAYVIS = M("&Sichtbare Lagen","&Visible Layers"); string UPRLAYVISB = M("Sichtbare mit &Rand","Visible with &Outline"); string UPRLAYPROG = M("&Programm Lagen","&Program Layers"); string UPRLAYSEL = M("&Lagenauswahl","&Layer Selection"); string UPRLAYVISSW = M("Sichtbare Sch&warz/Weiss","Visible &Black/White"); string UPRPOPEXIT = M("[Ende]" ,"[Exit]"); string UPRPOPRESET = M("[Loeschen]","[Clear]"); string UPRPOPSIGL = M("[Signallagen]","[Signal Layers]"); string UPRPOPDOCL = M("[Dokumentarlagen]","[Documentary Layers]"); string UPRSELLAY = M("Lage(n) selektieren ? ","Select Layers(s) ? "); string UPRSIDE1 = M("(1)","(1)"); string UPRSIDE2 = M("(2)","(2)"); string UPRBOTH = M("(B)","(B)"); string UPRFORMAT = M("Ausgabeformat waehlen!","Select Output Format!"); string UPRDFORMAT = M("Ausgabeformat :","Output Format :"); string UPRFORMAT1 = M("Postscript &n:1","Postscript &n:1"); string UPRFORMAT2 = M("Postscript A&4","Postscript A&4"); string UPRFORMAT3 = M("Postscript A&3","Postscript A&3"); string UPRFORMAT4 = M("Postscript 1&60*240","Postscript 1&60*240"); string UPRFORMAT5 = M("Postscript &Letter","Postscript &Letter"); string UPRFORMAT6 = M("%&PDF n:1","%&PDF n:1"); string UPRFORMAT7 = M("P&DF A4 hoch","P&DF A4 portrait"); string UPRFORMAT8 = M("PD&F n:1 A4","PD&F n:1 A4"); string UPRFORMAT9 = M("PDF &A3 hoch","PDF &A3 portrait"); string UPRFORMAT10 = M("&PDF n:1 A4-Mosaik","&PDF n:1 A4 Mosaic"); string UPRFORMAT11 = M("PDF A4 quer","PDF A4 landscape"); string UPRFORMAT12 = M("PDF A3 quer","PDF A3 landscape"); string UPRDOUTMODE = M("Ausgabeauswahlstatus :", "Output Selection State :"); string UPROUTMODE1 = M("Default &aus","Default o&ff"); string UPROUTMODE2 = M("Default &ein","Default &on"); string UPROUTMODE3 = M("&Immer ein","&Always on"); string UPROUTALL = M("&Alle","&All"); string UPROUTNONE = M("&Keine","&None"); string UPRSELPAGES = M("Seitenauswahl Datei '%s'", "Page Selection File '%s'"); string UPRSELLAYS = M("Lagenauswahl Seite '%s'", "Layer Selection Page '%s'"); string UPRPDFLGRP = M("PDF Lagenebenen","PDF Layers"); string UPRPDFPQRY = M("Abfrage Seitenausgabe :","Page Output Query :"); string UPRPDFLQRY = M("Abfrage Lagenausgabe :","Layer Output Query :"); string UPRDON = M("Ein","On"); string UPRPDFPSCALE = M("Druckbereichseinpassung :","Fit to Paper :"); string UPRPDFPSCALEN = M("Keine","None"); string UPRPDFPSCALED = M("Default","Default"); string UPRPDFARUN = M("Kontrollaufruf","Control Output"); string UPRPLAN = M("Ausgabeelement(e) waehlen!", "Select Output Element(s)!"); string UPRDPLAN = M("Ausgabeelement(e) :","Output Element(s) :"); string UPRPLAN0 = M("Aktuelles &Element","&Current Element"); string UPRPLAN1 = M("&Lagen zu aktuellem Element", "&Layers of current Element"); string UPRPLAN2 = M("La&youts zu Datei","&All layouts of file"); string UPRPLAN3 = M("&Bauteile zu Datei","All &parts of file"); string UPRPLAN4 = M("&Padstacks zu Datei","All pad&stacks of file"); string UPRPLAN5 = M("Pa&ds zu Datei","All pa&ds of file"); string UPRPLAN6 = M("&Varianten zu &Element","&Variant for element"); string UPRPLAN7 = M("Dateien zu Elementvarianten", "Files for element variants"); string UPRLINEMOD = M("Linienskalierungs-Modus waehlen!", "Select Line Scale Mode!"); string UPRDLINEMOD = M("Linienskalierungs-Modus :","Line Scale Mode :"); string UPRLINESCL = M("Linien &skaliert","Lines &Scaled"); string UPRLINEABS = M("&Linien absolut","&Lines Absolute"); string UPRLINEW = M("Standardlinienbreite waehlen!", "Select Standard Line Width!"); string UPRDLINEW = M("Standardlinienbreite :","Standard Line Width :"); string UPRDLINEWH = M("Standardlinienbreite [mm]", "Standard Line Width [mm]"); string UPRDLINEWP = M("Polygonlinien :","Polygon Lines :"); string UPRDLINEWT = M("Texte :","Texts :"); string UPRLINEW1 = M("Linienbreite 0.&1mm","Line Width 0.&1mm"); string UPRLINEW2 = M("Linienbreite 0.&2mm","Line Width 0.&2mm"); string UPRLINEW3 = M("Linienbreite 0.&3mm","Line Width 0.&3mm"); string UPRDOFFSET = M("Offset [mm]","Offset [mm]"); string UPRDX = M("X :","X :"); string UPRDY = M("Y :","Y :"); string UPRROTMOD = M("Plot-Rotation selektieren!", "Select Plot Rotation!"); string UPRDROTMOD = M("Plot-Rotation :","Plot Rotation :"); string UPRROT0 = M("Drehung &0 Grad","Rotate &0 Degrees"); string UPRROTBF = M("Drehung &Best Fit","Rotate &Best Fit"); string UPRROT90 = M("Drehung &90 Grad","Rotate &90 Fit"); string UPRROT180 = M("Drehung &180 Grad","Rotate &180 Degrees"); string UPRMIRRMOD = M("Spiegelungsmodus selektieren!", "Select Mirror Mode!"); string UPRDMIRRMOD = M("Spiegelungsmodus :","Mirror Mode :"); string UPRMIRR00 = M("Spiegeln &aus","Mirroring &Off"); string UPRMIRR01 = M("&Spiegeln ein","&Mirroring On"); string UPRMIRR02 = M("%&X-Ruecks. (S:aus)","%&X-Backside (M:Off)"); string UPRMIRR03 = M("X-Ruecks. (S:&ein)","X-&Backside (M:On)"); string UPRMIRR04 = M("%&Y-Ruecks. (S:aus)","%&Y-Backside (M:Off)"); string UPRMIRR05 = M("Y-Ruecks. (S:e&in)","Y-Ba&ckside (M:On)"); string UPRDCENTPAGE = M("zentriert","centered"); string UPRCLIPMOD = M("Clippingmodus selektieren!", "Select Clipping Mode!"); string UPRDCLIPMOD = M("Clipping :","Clipping :"); string UPRCLIPOFF = M("Clipping &aus","Clipping &Off"); string UPRCLIPON = M("&Clipping ein","&Clipping On"); string UPRRCORNER1 = M("Clipping-Fenster-Startpunkt waehlen!", "Select clipping window start point!"); string UPRRCORNER2 = M("Clipping-Fenster-Endpunkt waehlen!", "Select clipping window end point!"); string UPRDPMODE = M("Flaechendarstellung :","Area Draw Mode :"); string UPRDDMODE = M("Bohrungsdarstellung :","Drill Draw Mode :"); string UPRDCMODE = M("Bohrklassenanzeige","Drill Class Display"); string UPRDPFILL = M("gefuellte Flaechen","filled areas"); string UPRDPOUTL = M("Randlinien","Border lines"); string UPRDDCROSS = M("Kreis mit Kreuz","Circle with Cross"); string UPRDDOUTL = M("Kreislinie","Circle Outline"); string UPRDDFILL = M("Kreisflaeche","Filled Circle"); string UPRDDDOT = M("Mittelpunkt","Center Dot"); string UPRDRLDOTRAD = M("Punktradius :","Dot Radius :"); string UPRDEPLOTVIS = M("Plotsichtbarkeit :","Plot Visibility :"); string UPRDEPLOTV1 = M("sichtbar","visible"); string UPRDEPLOTV0 = M("unsichtbar","invisible"); string UPRDEPLOTV2 = M("platziert","placed"); string UPRDEPLOTV3 = M("unplatziert","unplaced"); string UPRDFONT = M("Zeichensatz :","Font :"); string UPRTEXT = M("Text","Text"); string UPRPATH = M("Leiterbahn","Trace"); string UPRICLASS1 = M("L","L"); string UPRICLASS2 = M("B","P"); string UPRICLASS3 = M("S","S"); string UPRICLASS4 = M("P","D"); string UPRIALL = M("Alle","All"); string UPRINONE = M("Keine","None"); string UPRDLAYGRP = M("Ebenenname :","PDF Layer Name :"); string UPRDLAYGIGN = M("Elementebenen ignorieren", "Ignore Element PDF Layers"); string UPRDLAYACT = M("Initialanzeige","Initial Display"); string UPRGDISP = M("Rasteranzeige :","Grid Display :"); string UPRGDISP0 = M("Initial &aus","Initial O&FF"); string UPRGDISP1 = M("Initial &ein","Initial &ON"); string UPRGDISP2 = M("&Zoomabhaengig","&Zoom dependant"); string UPRGPRT = M("Druckausgabe :","Printer Output :"); string UPRGPRT0 = M("Immer &aus","Always O&FF"); string UPRGPRT1 = M("Immer &ein","Always &ON"); string UPRGPRT2 = M("E&benenabhaengig","&Layer dependant"); string UPRDGRID = M("Raster","Grids"); string UPRGLINES = M("Linien","Lines"); string UPRFONTBAE = M("&BAE","&BAE"); string UPRDBACKCOL = M("Hintergrundfarbe [0.0,1.0] :", "Background Color [0.0,1.0] :"); string UPRDANNO = M("Notizausgabe :","Annotation Output :"); string UPRANNO00 = M("Keine","None"); string UPRANNO01 = M("Bauteile oben","Top Parts"); string UPRANNO02 = M("Bauteile unten","Bottom Parts"); string UPRANNO03 = M("Alle Bauteile","All Parts"); string UPRANNO04 = M("Pins oben","Top Pins"); string UPRANNO05 = M("Pins unten","Bottom Pins"); string UPRANNO06 = M("Alle Pins","All Pins"); string UPRDANNOCOL = M("Notizrahmenfarbe [0.0,1.0] :", "Annotation Color [0.0,1.0] :"); string UPRDCOLOR = M("Farbwerte [0.0,1.0]","Color Values [0.0,1.0]"); string UPRDECOLOR = M("Fehleranzeige [0.0,1.0]", "Error Display [0.0,1.0]"); string UPRDCR = M("R :","R :"); string UPRDCG = M("G :","G :"); string UPRDCB = M("B :","B :"); string UPRDFORCECOL = M("fest","fix"); string UPRDOUTLFILL = M("Umrandung fuellen","Fill Board Outline"); string UPRDCLINEFILL = M("Geschlossene Linien fuellen","Fill Closed Lines"); string UPRDDASH = M("Strichelung (0.0 aus) [mm] :", "Dash Values (0.0 off) [mm] :"); string UPRDHANGLE = M("Schraffurwinkel (0.0 aus) :", "Hatch Angle (0.0 off) :"); string UPRDHSPACE = M("Schraffurabstand [mm] :","Hatch Spacing [mm] :"); string UPRLGRID01 = M("%1/&10 Zoll","%1/&10 Inch"); string UPRLGRID02 = M("1/&20 Zoll","1/&20 Inch"); string UPRLGRID03 = M("1/&40 Zoll","1/&40 Inch"); string UPRLGRID04 = M("1/&60 Zoll","1/&60 Inch"); string UPRLGRID05 = M("1/&80 Zoll","1/&80 Inch"); string UPRLGRID06 = M("1/100 Zoll","1/100 Inch"); string UPRLGRID07 = M("1/120 Zoll","1/120 Inch"); string UPRLGRID08 = M("1/160 Zoll","1/160 Inch"); string UPRLGRID09 = M("1/200 Zoll","1/200 Inch"); string UPRLGRID10 = M("1/240 Zoll","1/240 Inch"); string UPRLGRID11 = M("1/480 Zoll","1/480 Inch"); string UPRLMGRID01 = M("%0.05 mm","%0.05 mm"); string UPRLMGRID02 = M("0.1 mm","0.1 mm"); string UPRLMGRID03 = M("0.125 mm","0.125 mm"); string UPRLMGRID04 = M("0.25 mm","0.25 mm"); string UPRLMGRID05 = M("0.5 mm","0.5 mm"); string UPRLMGRID06 = M("0.625 mm","0.625 mm"); string UPRLMGRID07 = M("1.0 mm","1.0 mm"); string UPRLMGRID08 = M("1.25 mm","1.25 mm"); string UPRLMGRID09 = M("2.0 mm","2.0 mm"); string UPRLMGRID10 = M("2.5 mm","2.5 mm"); string UPRLMGRID11 = M("10.0 mm","10.0 mm"); string UPRUGRID = M("Anderes &Grid","Select &Grid"); string UPRDUNITMM = M("&mm","&mm"); string UPRDUNITMIL = M("m&il","m&il"); string UPRSCALE = M("Ausgabeskalierungsfaktor ? ", "Output Scale Factor ? "); string UPRDSCALE = M("Skalierungsfaktor :","Scale Factor :"); string UPRSTOP = M("EPS/PDF-Ausgabe abbrechen ? ", "Abort EPS/PDF Output ? "); string UPRDBATCH = M("Batchausgabe","Batch Output"); string UPRDBATCHC = M("Batch ableiten","Derive Batch"); string UPRSAVEPAR = M("Defaults Speichern","Save defaults"); string UPRDPAGE = M("Seiten","Pages"); string UPRDLAY = M("Lagen","Layers"); string UPRPARAMDIAL = M("Parametereinstellungen","Settings"); string UPRNIL = "--------"; string UPRBROWSE = M("Browse","Browse"); string UPRBRWDEVNAME = M("&Liste","&List"); string UPRDEFFILENAME = M("&Default","&Default"); string UPRBRWCOLOR = M("BAE-Auswahl","BAE-Selection"); string UPRBRWCOLORP = M("PDF-Farbe selektieren!","Select PDF Color!"); string UPRBFCT1 = M("&Starten","&Run"); string UPRBFCT2 = M("&Anlegen","&New"); string UPRBFCT3 = M("A&endern","&Edit"); string UPRBFCT4 = M("&Kopieren","&Copy"); string UPRBFCT5 = M("&Import","&Import"); string UPRBFCT6 = M("E&xport","E&xport"); string UPRBFCT7 = M("&Loeschen","&Delete"); string UPRBATNAME = M("Batchauswahl","Batch Selection"); string UPRBATFILE = M("Batch '%s' / Ausgabedateien", "Batch '%s' / Output Files"); string UPRNBATNAME = M("Neuer Batchname :","New Batch Name :"); string UPRBATSTEPS = M("Batch Ausgabedateien :","Batch Output Files :"); string UPRBATDEL = M("Batch '%s' loeschen?","Delete Batch '%s'?"); string UPRFILEDEL = M("Dateiausgabe '%s' loeschen?", "Delete File Output '%s'?"); string UPRFTYP1 = M("&EPS-Ausgabe","&EPS Output"); string UPRFTYP2 = M("&PDF-Ausgabe","&PDF Output"); string UPRFTYPL = M(" mit Lageninfo"," with layer info"); string UPRFTYPNP = M(" keine Druckskalierung"," no paper fit"); string UPRDFTYP = M("Ausgabetyp :","Output Type :"); string UPRDFONT1 = M("Name Font 1 :","Font 1 Name :"); string UPRDFONT1B = M("Font 1 Basislinie :","Font 1 Base Line :"); string UPRDFONT1S = M("Font 1 rel. Strichstaerke:", "Font 1 rel. Stroke Width :"); string UPRDFONT2 = M("Name Font 2 :","Font 2 Name :"); string UPRDFONT2B = M("Font 2 Basislinie :","Font 2 Base Line :"); string UPRDFONT2S = M("Font 2 rel. Strichstaerke:", "Font 2 rel. Stroke Width :"); string UPRSFCT1 = M("A&endern","&Edit"); string UPRSFCT2 = M("&Neu","&New"); string UPRSFCT3 = M("&Ableiten/Kopieren","Deri&ve/Copy"); string UPRSFCT4 = M("&Loeschen","&Delete"); string UPRSFCT5 = M("&Fertig","D&one"); string UPRDIALOFPAR = M("Batch '%s' / Ausgabedatei %d", "Batch '%s' / Output File %d"); string UPRDIALOPPAR = M("Batch '%s' / Seiten zu Datei %d (%s)", "Batch %s' / Pages of File %d (%s)"); string UPRPAGEMOVDST = M("Neue Position fuer Seite '%s' selektieren", "Select new position for page '%s'"); string UPRDIALOPDEF = M("Batch '%s' / Datei %d / Seitenausgabe %d", "Batch '%s' / File %d / Page Output %d"); string UPRDIALOLPAR = M("Batch '%s' / Datei %d / Seite %d (%s) / Ausgabelagen", "Batch '%s' / File %d / Page %d (%s) / Output Layers"); string UPRDIALOGPAR = M("Batch '%s' / Datei %d / Seite %d (%s) / Ausgaberaster", "Batch '%s' / File %d / Page %d (%s) / Output Grids"); string UPRDIALLAYPAR = M("Batch '%s' / Datei %d / Seite %d (%s)", "Batch '%s' / File %d / Page %d (%s)"); string UPRLAYMOVDST = M("Neue Position fuer Lage '%s' selektieren", "Select new position for layer '%s'"); string UPRDIALGRIDPAR = M("Batch '%s' / Datei %d / Seite %d (%s) / Rasterdefinition", "Batch '%s' / File %d / Page %d (%s) / Grid Definition"); string UPRGRIDMOVDST = M("Neue Position fuer Raster '%s' selektieren", "Select new position for grid '%s'"); string UPRDOUTFILE = M("Ausgabedatei :","Output File :"); string UPRDOUTEXT = M("Dateiendung :","File Extension :"); string UPRDOUTMAC = M("Makro :","Macro :"); string UPRDOUTATTR = M("Attribute","Attributes"); string UPRDOUTATTR1 = M("1:","1:"); string UPRDOUTATTR2 = M("2:","2:"); string UPRDOUTATTR3 = M("3:","3:"); string UPRDOUTATTR4 = M("4:","4:"); string UPRDOUTATTRD = M("Defaultwert:","Default Value"); string UPRDFVMODE = M("Einzeldatei zu jeder Variante", "Single File for every Variant"); string UPRDFMODE = M("Dateinamensmodus: ","File Name Mode :"); string UPRFMODE0 = M("Dateiendung","File Extension"); string UPRFMODE1 = M("Fester Dateiname","Fix File Name"); string UPRFMODE2 = M("Komplettverzeichnis mit Dateiendung", "Folder Files with Extension"); string UPRFMODE3 = M("Variantenname+Dateiendung", "Variant Name+Extension"); string UPRFMODE4 = M("Variantenattribut+Dateiendung", "Variant Attribute+Extension"); string UPRFMODE5 = M("Variantenname/attribut+Dateiendung", "Variant Name/Attribute+Extension"); string UPRFMODE6 = M("Projekt+Variantenname+Dateiendung", "Project+Variant Name+Extension"); string UPRDOUTDIR = M("Ausgabeverzeichnis :","Output Folder :"); string UPRDPAGENM = M("Seitenbenennung :","Page Naming :"); string UPRPNMODE0 = M("Elementname","Element Name"); string UPRPNMODE1 = M("Elementname+Extension","Element Name+Extension"); string UPRPNMODE2 = M("Fester Seitenname","Fix Page Name"); string UPRPNMODE3 = M("Alle Layoutnamen aus Datei", "All Layout names of File"); string UPRPNMODE4 = M("Alle Layoutnamen aus Datei+Extension", "All Layout names of File+Extension"); string UPRPNMODE5 = M("Alle Bauteilnamen aus Datei", "All Part names of File"); string UPRPNMODE6 = M("Alle Bauteilnamen aus Datei+Extension", "All Part names of File+Extension"); string UPRPNMODE7 = M("Alle Padstacknamen aus Datei", "All Padstack names of File"); string UPRPNMODE8 = M("Alle Padstacknamen aus Datei+Extension", "All Padstack names of File+Extension"); string UPRPNMODE9 = M("Alle Padnamen aus Datei","All Pad names of File"); string UPRPNMODE10 = M("Alle Padnamen aus Datei+Extension", "All Pad names of File+Extension"); string UPRPNMODE11 = M("&Varianten zu Elementname", "&Variant for element name"); string UPRPNMODE12 = M("%Stuecklistenseiten zu Element", "%Part List Pages for Element"); string UPRDPAGENAME = M("Seitenname :","Page Name :"); string UPRDPAGEMACRO = M("Seitenmakro :","Page Makro :"); string UPRPAGEMACRO = M("Seitenmakro in '%s' :","Page Makro in '%s' :"); string UPRDPAGENEXT = M("Seitennamensext. :","Page Name Ext. :"); string UPRDELEMNCOMM = M("Elementname + Elementkommentar", "Element Name + Element Comment"); string UPRDELEMCOMM = M("ggf. Elementkommentar statt Elementname", "Use Element Comment as Element Name"); string UPRDELEMPURE = M("Nur Elementname","Element Name"); string UPRDMOVE = M("&Verschieben","&Move"); string UPRDADD = M("&Hinzufuegen","&Add"); string UPRDEDIT = M("&Aendern","&Edit"); string UPRDDERIVE = M("A&bleiten","Deri&ve"); string UPRDDEL = M("&Loeschen","&Delete"); string UPRPOWLAYPAR = M("Versorgungslagen","Power layers"); string UPRPOWCAMPAR = M("CAM-Einstellungen","Use CAM Settings"); string UPRPOWHWIDTH = M("WF-Strichstaerke :","HT Line Width :"); string UPRPOWHTDIST = M("V-WF-Abstand :","P-HT Distance :"); string UPRPOWHTANG = M("V-WF-Basiswinkel","P-HT Base Angle :"); string UPRPOWDRDIST = M("V-IS-Abstand :","P-IS Distance :"); string UPRPOWBWIDTH = M("V-Lagen-Umrandung :","Power Layer Border :"); string UPRPOWPWIDTH = M("V-&agen-Isolation :","Power Layer Isol. :"); string UPRPOWHTANG0 = M("&0","&0"); string UPRPOWHTANG1 = M("&45 Grad","&45 Degree"); string UPRSRCFILE = M("Quelldatei ? ","Source File ? "); string UPRDSTFILE = M("!Zieldatei ? ","!Destination File ? "); string UPRCOMBLAYER = M("Mehrlagenplot durch Einzellagen aufbauen!", "Multi layer plot by single layers!"); string ERRNOFILEN = M("Kein Ausgabename definiert!", "No Output Name defined!"); string ERRNOBATCH = M("Batch '%s' nicht gefunden!", "Batch '%s' not found!"); string ERRNOPARTPAGE = M("Bauteillistenvorlage '%s' in '%s' nicht gefunden!", "Part List Template '%s' not found in '%s'!"); string ERRINVELEM = M("Operation fuer dieses Element nicht erlaubt!", "Operation not allowed for this element!"); string ERRDBLBATCH = M("Batch '%s' bereits vorhanden!", "Batch '%s' already defined!"); string ERRNOMOVPAGE = M("Keine Quellseite fuer die Verschiebung selektiert!", "No move source page selected!"); string ERRNOMOVLAY = M("Keine Quelllage fuer die Verschiebung selektiert!", "No move source layer selected!"); string ERRNOMOVGRID = M("Kein Quellraster fuer die Verschiebung selektiert!", "No move source grid selected!"); string ERRNOWIN = M("Nur in Windowsumgebungen verfuegbar!", "Windows Environment needed!"); string ERRDBINIT = M("SQL/DB-Datei '%s' kann nicht initialisiert werden!", "Error initialyzing SQL/DB file '%s'!"); string ERROFILENAME = M("Ungueltiger Ausgabedateiname!", "Invalid Output File Name!"); string ERRINPVAL = M_ERRINPVAL(); // INI file parameter name definitions #define PAR_EPSFEXT "EPSFEXT_LAY" // Encaps. postscript file name ext. #define PAR_PSTMPFILE "PSTMPFILE_LAY" // Postscript temporary file name #define PAR_PRTCMD "PSPRTCMD_LAY" // Postscript print command #define PAR_AUTORUN "PDFARUN_STD" // Automatic PDF display tool run flag #define PAR_PDFCMD "PDFCMD_STD" // PDF display tool location #define PAR_PDFFEXT "PDFFEXT_LAY" // PDF output file name extension #define PAR_PDFVARSEP "PDFVARSEP_LAY" // PDF file variant name separator #define PAR_BFONTNAME "BFONTNAME_LAY" // Bitmap font name #define PAR_BFONTBASE "BFONTBASE_LAY" // Bitmap font relativ base line off. #define PAR_BFONTSTROKE "BFONTSTROKE_LAY" // Bitmap font relative text stroke #define PAR_AFONTNAME "AFONTNAME_LAY" // Alternate bitmap font name #define PAR_AFONTBASE "AFONTBASE_LAY" // Alt. bitmap font rel. base line off. #define PAR_AFONTSTROKE "AFONTSTROKE_LAY" // Bitmap alt. font rel. text stroke #define PAR_FONTMODE "PSFONTMODE_LAY" // Output font mode #define PAR_ALLLAY "PSALLLAY_LAY" // Output all layer mode #define PAR_BORDMODE "PSBORDMODE_LAY" // Output border mode #define PAR_MARKMODE "PSMARKMODE_LAY" // Output marker mode #define PAR_XOFF "PSXOFF_LAY" // Paper/sheet X offset #define PAR_YOFF "PSYOFF_LAY" // Paper/sheet Y offset #define PAR_LINEW "PSLINEWIDTH_LAY" // Line width index #define PAR_LINEABS "PSLINEABS_LAY" // Line width absolute flag #define PAR_MIRROR "PSMIRROR_LAY" // Output mirror mode #define PAR_FORMAT "PSFORMAT_LAY" // Output format #define PAR_SCALE "PSSCALE_LAY" // Output scale factor #define PAR_FONTSCALE "PSFSCALE_LAY" // Postscript font extra scale factor #define PAR_LAYMODE "PSLAYMODE_LAY" // Output layer mode #define PAR_PLANMODE "PSPLANMODE_LAY"// Output plan(s) mode #define PAR_POWBWIDTH "POWBWIDTH_LAY" // Pow.lay board outline width #define PAR_POWPWIDTH "POWPWIDTH_LAY" // Pow.lay plane isolation width #define PAR_POWHWIDTH "POWHWIDTH_LAY" // Pow.lay heat-trap width #define PAR_POWHTDIST "POWHTDIST_LAY" // Pow.lay heat-trap-drill distance #define PAR_POWHTANG "POWHTANG_LAY" // Pow.lay heat trap angle #define PAR_POWDRDIST "POWDRDIST_LAY" // Pow.lay isolation drill distance #define PAR_ANNOTMODE "PDFANNOTMOD_LAY"// Annotation mode #define PAR_ANNOTCOL "PDFANNOTCOL_LAY"// Annotation color #define PAR_PDFLAYGRP "PDFLAYGRP_LAY" // PDF layer group support #define PAR_PDFGRPNLAY "PDFGRPNLAY_LAY"// PDF group name layer flag #define PAR_LISTDCNT "LISTDCNT_STD" // Max. dialog list items count #define PAR_AUTOPROJ "AUTOPROJSEL_STD"// Automatic project file name sel. #define PAR_PDFMINCHK "PDFMINCHK_STD" // PDF minimum size check #define PAR_PRTDEVLST "PRTDEVLST_STD" // Printer device name list #define PAR_PSVISW2B "PSVISW2B_STD" // Postscript vis. layer b/w toggle #define PAR_PDFCOMP "PDFCOMP_STD" // PDF compression flag #define PAR_A0INPSLOT "PSA0INPSLOT_STD" // A0 InputSlot specification #define PAR_A0MEDIAPOS "PSA0MEDIAPOS_STD" // A0 MediaPosition specification #define PAR_A1INPSLOT "PSA1INPSLOT_STD" // A1 InputSlot specification #define PAR_A1MEDIAPOS "PSA1MEDIAPOS_STD" // A1 MediaPosition specification #define PAR_A2INPSLOT "PSA2INPSLOT_STD" // A2 InputSlot specification #define PAR_A2MEDIAPOS "PSA2MEDIAPOS_STD" // A2 MediaPosition specification #define PAR_A3INPSLOT "PSA3INPSLOT_STD" // A3 InputSlot specification #define PAR_A3MEDIAPOS "PSA3MEDIAPOS_STD" // A3 MediaPosition specification #define PAR_A4INPSLOT "PSA4INPSLOT_STD" // A4 InputSlot specification #define PAR_A4MEDIAPOS "PSA4MEDIAPOS_STD" // A4 MediaPosition specification #define PAR_PDFLIB "PDFPAGELIB_LAY"// PDF page library name #define PAR_PLPTOP "PLPTOP_LAY" // Part name list part top side string #define PAR_PLPBOT "PLPBOT_LAY" // Part name list part bot. side string #define PAR_PLPUPLC "PLPUPLC_LAY" // Part name list part unplaced string #define PAR_SHORTFN "REPSHORTFN_CAM" // Short file names in report flag #define PAR_DRLDOTRAD "DRLDOTRAD_LAY" // Drill dot radius #define PAR_RGBATTR "PSRGBATTR_LAY" // Plot color part attribute #define PAR_ATTRCOMMP "ATTR_%s_STD" // Attribute comment pattern #define PAR_ATTRORDP "ATTR_ORD_%s_STD" // Attribute order pattern // PostScript format strings #define FMTEPSHEAD "%%!PS-Adobe-3.0\n" #define FMTEPSBOUNDBOX "%%%%BoundingBox: %.0f %.0f %.0f %.0f\n" #define FMTEPSA0MEDIA "%%%%DocumentMedia: (Default) 2384 3370 0 () ()\n" #define FMTEPSA1MEDIA "%%%%DocumentMedia: (Default) 1684 2384 0 () ()\n" #define FMTEPSA2MEDIA "%%%%DocumentMedia: (Default) 1191 1684 0 () ()\n" #define FMTEPSA3MEDIA "%%%%DocumentMedia: (Default) 842 1191 0 () ()\n" #define FMTEPSA4MEDIA "%%%%DocumentMedia: (Default) 595 842 0 () ()\n" #define FMTEPSORIENT "%%%%Orientation: Portrait\n" #define FMTEPSPAGEBOX1 "%%%%BeginDefaults\n" #define FMTEPSPAGEBOX2 "%%%%PageBoundingBox: %.0f %.0f %.0f %.0f\n" #define FMTEPSPAGEBOX3 "%%%%EndDefaults\n" #define FMTEPSBEGINSET "%%%%BeginSetup\n" #define FMTEPSBEGINFEAT "[{\n%%%%BeginFeature: " #define FMTEPSA0DOC "*PageSize A0\n\n" #define FMTEPSA0DOCA "*PageRegion A0\n\n" #define FMTEPSA1DOC "*PageSize A1\n\n" #define FMTEPSA1DOCA "*PageRegion A1\n\n" #define FMTEPSA2DOC "*PageSize A2\n\n" #define FMTEPSA2DOCA "*PageRegion A2\n\n" #define FMTEPSA3DOC "*PageSize A3\n\n" #define FMTEPSA3DOCA "*PageRegion A3\n\n" #define FMTEPSA4DOC "*PageSize A4\n\n" #define FMTEPSA4DOCA "*PageRegion A4\n\n" #define FMTEPSA0PAPER "\t<> setpagedevice\n" #define FMTEPSMFEED1 "*ManualFeed False\n\n" #define FMTEPSMFEED2 "\t<> setpagedevice\n" #define FMTEPSINPSLOT1 "*InputSlot %s\n" #define FMTEPSINPSLOT2 "<> setpagedevice\n" #define FMTEPSENDFEAT "%%%%EndFeature\n} stopped cleartomark\n" #define FMTEPSENDSET "%%%%EndSetup\n" #define FMTEPSTITLE "%%%%Title: %s\n" #define FMTEPSCREATOR "%%%%Creator: BAE/Layout %s from %s, %s\n" #define FMTEPSCREADATE "%%%%CreationDate: %s\n" #define FMTEPSPAGES "%%%%Pages: 1\n" #define FMTEPSENDCMTS "%%%%EndComments\n" #define FMTEPSPAGE "%%%%Page: 1 1\n" #define FMTEPSLANGLEVEL "%%%%LanguageLevel: 3\n" #define FMTEPSBEGINDOC "%%%%BeginDocument: %s\n" #define FMTEPSENDDOC "\n%%%%EndDocument\n" #define FMTEPSTRAILER "%%%%Trailer\n" #define FMTEPSFOOT "\nshowpage\nQ\n" #define FMTEPSCONCAT " [1 0 0 -1 0 %.5f] concat\n" #define FMTEPSCONCATR " [-1 0 0 1 0 0] concat\n" #define FMTCLOSEPATH "h\n" #define FMTSTROKE "S\n" #define FMTFILL "f\n" #define FMTMOVETO " m\n" #define FMTLINETO " l\n" #define FMTCURVETO " c\n" #define FMTARC " arc\n" #define FMTARCN " arcn\n" #define FMTSETLINEWIDTH " w\n" #define FMTSETLINECAP "1 J 1 j\n" #define FMTSETDASH1 "[" #define FMTSETDASH2 "] 0 d\n" #define FMTRESETDASH "[] 0 d\n" #define FMTSETRGB1 " rg\n" #define FMTSETRGB2 " RG\n" #define FMTGSAVE "q\n" #define FMTCLIP "W\nn\n" #define FMTFONT1 "(F%d) findfont " #define FMTFONT2 " scalefont setfont\n" #define FMTTEXT "(%s) show\n" #define FMTROTON " rotate\n" #define FMTGSAVECLIP "q\n"+FMTCLIP #define FMTGRESTORE "Q\n" #define FMTEPSCMDDEF01 "/d {setdash} bind def\n" #define FMTEPSCMDDEF02 "/f {fill} bind def\n" #define FMTEPSCMDDEF03 "/rg {setrgbcolor} bind def\n" #define FMTEPSCMDDEF04 "/h {closepath} bind def\n" #define FMTEPSCMDDEF05 "/j {setlinejoin} bind def\n" #define FMTEPSCMDDEF06 "/J {setlinecap} bind def\n" #define FMTEPSCMDDEF07 "/l {lineto} bind def\n" #define FMTEPSCMDDEF08 "/m {moveto} bind def\n" #define FMTEPSCMDDEF09 "/n {newpath} bind def\n" #define FMTEPSCMDDEF10 "/q {gsave} bind def\n" #define FMTEPSCMDDEF11 "/Q {grestore} bind def\n" #define FMTEPSCMDDEF12 "/S {stroke} bind def\n" #define FMTEPSCMDDEF13 "/w {setlinewidth} bind def\n" #define FMTEPSCMDDEF14 "/W {clip} bind def\n" #define FMTEPSFONTRD01 "[0\n /grave/acute/circumflex/tilde/macron\n"// 0 #define FMTEPSFONTRD02 "/breve/dotaccent/dieresis/ring/cedilla\n"// 5 #define FMTEPSFONTRD03 "/hungarumlat/ogonek/caron/dotlessi/fi/fl/Lslash\n"// 10 #define FMTEPSFONTRD04 "/lslash/Zcaron/zcaron/minus/.notdef/.notdef\n"// 17 #define FMTEPSFONTRD05 "/.notdef/.notdef/.notdef/.notdef/.notdef\n"// 23 #define FMTEPSFONTRD06 "/.notdef/.notdef/.notdef/.notdef/space/exclam\n"// 28 #define FMTEPSFONTRD07 "/quotedbl/numbersign/dollar/percent/ampersand\n"// 34 #define FMTEPSFONTRD08 "/quotesingle/parenleft/parenright/asterisk/plus\n"// 39 #define FMTEPSFONTRD09 "/comma/hyphen/period/slash/zero/one/two/three\n"// 44 #define FMTEPSFONTRD10 "/four/five/six/seven/eight/nine/colon/semicolon\n"// 52 #define FMTEPSFONTRD11 "/less/equal/greater/question/at/A/B/C/D/E/F/G\n"// 60 #define FMTEPSFONTRD12 "/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z\n"// 72 #define FMTEPSFONTRD13 "/bracketleft/backslash/bracketright/asciicircum\n"// 91 #define FMTEPSFONTRD14 "/underscore/grave/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o\n"// 95 #define FMTEPSFONTRD15 "/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright\n"//112 #define FMTEPSFONTRD16 "/asciitilde/.notdef/.notdef/udieresis\n"// 126 #define FMTEPSFONTRD17 "/quotesinglbase/florin/adieresis/ellipsis\n"// 130 #define FMTEPSFONTRD18 "/dagger/daggerdbl/circumflex/perthousand/Scaron\n"//134 #define FMTEPSFONTRD19 "/guilsinglleft/OE/.notdef/Adieresis/.notdef\n"// 139 #define FMTEPSFONTRD20 "/.notdef/quoteleft/quoteright/quotedblleft\n"// 144 #define FMTEPSFONTRD21 "/quotedblright/bullet/endash/emdash/tilde\n"// 148 #define FMTEPSFONTRD22 "/trademark/scaron/guilsinglright/oe/.notdef\n"// 153 #define FMTEPSFONTRD23 "/.notdef/Ydieresis/.notdef/exclamdown/cent\n"// 158 #define FMTEPSFONTRD24 "/sterling/currency/yen/brokenbar/section\n"// 163 #define FMTEPSFONTRD25 "/dieresis/copyright/ordfeminine/guillemotleft\n"// 168 #define FMTEPSFONTRD26 "/logicalnot/hyphen/registered/macron/degree\n"// 172 #define FMTEPSFONTRD27 "/plusminus/twosuperior/threesuperior/acute/mu\n"// 177 #define FMTEPSFONTRD28 "/paragraph/periodcentered/cedilla/onesuperior\n"// 182 #define FMTEPSFONTRD29 "/ordmasculine/guillemotright/onequarter/onehalf\n"//186 #define FMTEPSFONTRD30 "/threequarters/questiondown/Agrave/Aacute\n"// 190 #define FMTEPSFONTRD31 "/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla\n"//194 #define FMTEPSFONTRD32 "/Egrave/Eacute/Ecircumflex/Edieresis/Igrave\n"// 200 #define FMTEPSFONTRD33 "/Iacute/Icircumflex/Idieresis/Eth/Ntilde/Ograve\n"//205 #define FMTEPSFONTRD34 "/Oacute/Ocircumflex/Otilde/Odieresis/multiply\n"// 211 #define FMTEPSFONTRD35 "/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis\n"// 216 #define FMTEPSFONTRD36 "/Yacute/Thorn/germandbls/agrave/aacute\n"// 221 #define FMTEPSFONTRD37 "/acircumflex/atilde/adieresis/aring/ae\n"// 226 #define FMTEPSFONTRD38 "/ccedilla/egrave/eacute/ecircumflex/edieresis\n"// 231 #define FMTEPSFONTRD39 "/igrave/iacute/icircumflex/idieresis/eth/ntilde\n"//236 #define FMTEPSFONTRD40 "/ograve/oacute/ocircumflex/otilde/odieresis\n"// 242 #define FMTEPSFONTRD41 "/divide/oslash/ugrave/uacute/ucircumflex\n"// 247 #define FMTEPSFONTRD42 "/udieresis/yacute/thorn/ydieresis]\n"// 252 #define FMTEPSFONTRD43 "/F%d /%s findfont begin currentdict dup length\n" #define FMTEPSFONTRD44 "dict begin { 1 index /FID ne {def} {pop pop} \n" #define FMTEPSFONTRD45 "ifelse} forall /FontName exch def dup length 0 \n" #define FMTEPSFONTRD46 "ne {/Encoding Encoding 256 array copy def 0 \n" #define FMTEPSFONTRD47 "exch { dup type /nametype eq {Encoding 2 index \n" #define FMTEPSFONTRD48 "2 index put pop 1 add }{exch pop} ifelse} \n" #define FMTEPSFONTRD49 "forall} if pop currentdict dup end end \n" #define FMTEPSFONTRD50 "/FontName get exch definefont pop\n" // PDF definitions #define FMTPDFHEAD "%PDF-1.0\n" #define FMTPDFHEADL "%PDF-1.5\n" #define FMTPDFPAGE1A "%d 0 obj\n<< " #define FMTPDFPAGE1Z "/Filter /LZWDecode " #define FMTPDFPAGE1B "/Length %d 0 R\n>>\nstream\n" #define FMTPDFPAGE1C "BX /GS1 gs EX\n" #define FMTPDFPAGE2 "\nendstream\nendobj\n" #define FMTPDFPAGE3 "%d 0 obj\n%d\nendobj\n" #define FMTPDFPAGE4 "%d 0 obj\n<<\n/Type /Page\n" #define FMTPDFPAGE4A "/Annots [\n" #define FMTPDFPAGE4B " %d 0 R" #define FMTPDFPAGE4C "]\n" #define FMTPDFPAGE4D "/MediaBox [0 0 %.3f %.3f]\n" #define FMTPDFPAGE5 "/Parent 2 0 R\n/Resources << /Font << /F1 4 0 R " #define FMTPDFPAGE6 "/F2 5 0 R >> /ProcSet [/PDF /Text] /ExtGState <<\n" #define FMTPDFPAGE6B "/GS1 7 0 R >>\n" #define FMTPDFPAGE7 ">>\n/Contents %d 0 R\n>>\nendobj\n" #define FMTPDFPAGE8 "%d 0 obj\n<<\n/Dest [%d 0 R /Fit ]\n/Title (%s)\n" #define FMTPDFPAGE9 "/Parent %d 0 R\n>>\nendobj\n" #define FMTPDFPAGE10 "%d 0 obj\n<< /Subtype /Square /Rect [" #define FMTPDFPAGE11 "] /C[%s] /Border [0 0 0[4 2]] " #define FMTPDFPAGE12 "/OC %d 0 R " #define FMTPDFPAGE13 "/Contents (%s) /T (%s)>>endobj\n" #define FMTPDFROOT1 "1 0 obj\n<< /Type /Catalog /Pages 2 0 R\n" #define FMTPDFROOT2 "/Outlines 6 0 R\n/OpenAction [%d 0 R /Fit ]\n" #define FMTPDFROOT3 "/PageMode /UseOutlines\n" #define FMTPDFROOT3P "/ViewerPreferences << /PrintScaling /None >>\n" #define FMTPDFROOT3D "/ViewerPreferences << /PrintScaling /AppDefault >>\n" #define FMTPDFROOT4 ">>\nendobj\n" #define FMTPDFGSTATE1 "7 0 obj\n<< /Type /ExtGState\n/BM /Screen\n" #define FMTPDFGSTATE2 "/CA 1.0 /ca 1.0\n>>\nendobj\n" #define FMTPDFTREE1 "2 0 obj\n<< /Type /Pages /Kids [\n" #define FMTPDFTREE2 "] /Count %d\n>>\nendobj\n" #define FMTPDFTREEENT "%d 0 R\n" #define FMTPDFCREA1 "3 0 obj\n<< /CreationDate (D:%4d%02d%02d%02d%02d%02d)" #define FMTPDFCREA2 "\n/Producer (Bartels AutoEngineer %s)\n>>\nendobj\n" #define FMTPDFFONT1 "%d 0 obj\n<<\n/Type /Font\n/Subtype /Type1\n" #define FMTPDFFONT2 "/Name /F%d\n/BaseFont /%s\n" #define FMTPDFFONT3 "/Encoding /WinAnsiEncoding\n>>\nendobj\n" #define FMTPDFOUTL1 "6 0 obj\n<<\n/Count %d\n" #define FMTPDFOUTL2 "/First %d 0 R\n/Last %d 0 R\n>>\nendobj\n" #define FMTPDFOUTLT "/First %d 0 R\n/Last %d 0 R\n/Count %d\n" #define FMTPDFLGRPD "%d 0 obj\n<<\n/Intent[/View/Design]/Type /OCG\n/Name (%s)" #define FMTPDFLGRPDGU " /Usage<<" #define FMTPDFLGRPDGZ " /Zoom<<" #define FMTPDFLGRPDGZL " /min %.3f" #define FMTPDFLGRPDGZU " /max %.3f" #define FMTPDFLGRPDGZE ">>" #define FMTPDFLGRPDGP " /Print << /PrintState /%s>>" #define FMTPDFLGRPDGE " >>\n" #define FMTPDFLGRPDE "\n>>\nendobj\n" #define FMTPDFLGRPL1 "/Properties <<" #define FMTPDFLGRPL2 " /ocl%d %d 0 R" #define FMTPDFLGRPL2N " /ocn%d %d 0 R" #define FMTPDFLGRPL2G " /ocr%d %d 0 R" #define FMTPDFLGRPL3 " >>\n" #define FMTPDFLGRPG1 "/OCProperties <> /OCGs[" #define FMTPDFLGRPG3 "] >>\n" #define FMTPDFLGRPOREF " %d 0 R" #define FMTPDFLGRPGS "/OFF[" #define FMTPDFLGRPGE "] " #define FMTPDFLGRPGAS "/AS[" #define FMTPDFLGRPGVS " <>" #define FMTPDFLGRPGPS " <>" #define FMTPDFLGRPGAE " ] " #define FMTPDFLGRPO1 "%d 0 obj[" #define FMTPDFLGRPO3 "]\nendobj\n" #define FMTPDFXREF "xref\n0 %d\n0000000000 65535 f \n" #define FMTPDFXREFENT "%010d 00000 n \n" #define FMTPDFTRAIL "trailer\n<< /Size %d /Root 1 0 R /Info 3 0 R\n>>\n" #define FMTPDFEND "startxref\n%d\n%%%%EOF\n" #define FMTPDFTEXT1 "BT\n/F%d %.3f Tf\n" #define FMTPDFTEXT2 " Td\n" #define FMTPDFNEXT "/Next %d 0 R\n" #define FMTPDFPREV "/Prev %d 0 R\n" #define FMTPDFTEXT3 "(%s) Tj\n" #define FMTPDFTEXT4 "ET\n" #define FMTPDFTROT " Tm\n" #define FMTPDFCONCAT1 " 1 0 0 -1 0 " #define FMTPDFCONCAT1R " -1 0 0 1 0 0" #define FMTPDFCONCAT2 " cm\n" #define FMTPDFBOCG "/OC /ocl%d BDC\n" #define FMTPDFBOCGN "/OC /ocn%d BDC\n" #define FMTPDFBOCGG "/OC /ocr%d BDC\n" #define FMTPDFEOCG "EMC\n" #define PDFOBJROOT 1 // PDF Root Object #define PDFOBJCAT 2 // PDF Catalog Object #define PDFOBJCREA 3 // PDF Creation info Object #define PDFOBJFONT1 4 // PDF 1st Font Object #define PDFOBJFONT2 5 // PDF 2nd Font Object #define PDFOBJOUTL 6 // PDF Outline Object #define PDFOBJGSTATE 7 // PDF Graphic State Object #define PDFN 7 // PDF special object count static int pdfobjpos[] /* PDF special object positions */; #define PDFP 4 // PDF page object count // Font size information double arial_charw [] = { // Arial font character width table 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.416, 0.530, 0.832, 0.832, 1.332, 1.000, 0.290, // ' ' - ''' 0.504, 0.504, 0.588, 0.878, 0.416, 0.500, 0.415, 0.416, // '(' - '/' 0.832, 0.832, 0.832, 0.832, 0.832, 0.832, 0.832, 0.832, // '0' - '7' 0.832, 0.832, 0.416, 0.416, 0.878, 0.878, 0.878, 0.832, // '8' - '?' 1.518, 1.000, 1.000, 1.084, 1.084, 1.000, 0.916, 1.168, // '@' - 'G' 1.084, 0.416, 0.748, 1.000, 0.832, 1.252, 1.084, 1.168, // 'H' - 'O' 1.000, 1.168, 1.084, 1.000, 0.916, 1.084, 1.000, 1.416, // 'P' - 'W' 1.000, 1.000, 0.916, 0.416, 0.416, 0.416, 0.702, 0.832, // 'X' - '_' 0.496, 0.832, 0.832, 0.748, 0.832, 0.832, 0.416, 0.832, // '`' - 'g' 0.832, 0.336, 0.336, 0.748, 0.336, 1.244, 0.832, 0.832, // 'h' - 'o' 0.832, 0.832, 0.504, 0.748, 0.416, 0.832, 0.748, 1.084, // 'p' - 'w' 0.748, 0.748, 0.748, 0.504, 0.389, 0.504, 0.878, 0.527, // 'x' 0.832, 0.527, 0.340, 0.832, 0.504, 1.518, 0.832, 0.832, 0.504, 1.518, 1.000, 0.504, 1.518, 0.527, 0.916, 0.527, 0.527, 0.336, 0.336, 0.504, 0.504, 0.527, 0.832, 1.518, 0.504, 1.518, 0.748, 0.504, 1.412, 0.527, 0.748, 1.000, 0.832, 0.496, 0.832, 0.832, 0.832, 0.832, 0.389, 0.832, 0.504, 1.107, 0.553, 0.832, 0.877, 0.504, 1.107, 0.504, 0.595, 0.870, 0.504, 0.504, 0.504, 0.863, 0.809, 0.416, 0.504, 0.504, 0.550, 0.832, 1.250 ,1.250, 1.250, 0.916, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.496, 1.084, 1.000, 1.000, 1.000, 1.000, 0.416, 0.416, 0.416, 0.416, 1.084, 1.084, 1.168, 1.168, 1.168, 1.168, 1.168, 0.870, 1.168, 1.084, 1.084, 1.084, 1.084, 1.000, 1.000, 0.916, 0.832, 0.832, 0.832, 0.832, 0.832, 0.832, 1.328, 0.748, 0.832, 0.832, 0.832, 0.832, 0.416, 0.416, 0.416, 0.416, 0.832, 0.832, 0.832, 0.832, 0.832, 0.832, 0.832, 0.870, 0.916, 0.832, 0.832, 0.832, 0.832, 0.748, 0.832, 0.748 }; double times_roman_charw [] = { // Times-Roman font char. width table 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.376, 0.496, 0.611, 0.748, 0.748, 1.252, 1.168, 0.267, // ' ' - ''' 0.504, 0.504, 0.748, 0.847, 0.374, 0.496, 0.374, 0.420, // '(' - '/' 0.748, 0.748, 0.748, 0.748, 0.748, 0.748, 0.748, 0.748, // '0' - '7' 0.748, 0.748, 0.420, 0.420, 0.847, 0.847, 0.847, 0.672, // '8' - '?' 1.381, 1.084, 1.000, 1.000, 1.084, 0.916, 0.840, 1.084, // '@' - 'G' 1.084, 0.504, 0.588, 1.084, 0.916, 1.336, 1.084, 1.084, // 'H' - 'O' 0.832, 1.084, 1.000, 0.832, 0.916, 1.084, 1.084, 1.420, // 'P' - 'W' 1.084, 1.084, 0.916, 0.496, 0.420, 0.496, 0.702, 0.748, // 'X' - '_' 0.496, 0.664, 0.748, 0.664, 0.748, 0.664, 0.504, 0.748, // '`' - 'g' 0.748, 0.420, 0.420, 0.748, 0.420, 1.168, 0.748, 0.748, // 'h' - 'o' 0.748, 0.748, 0.504, 0.588, 0.420, 0.748, 0.748, 1.084, // 'p' - 'w' 0.748, 0.748, 0.664, 0.718, 0.298, 0.718, 0.809, 0.527, // 'x' 0.748, 0.527, 0.496, 0.748, 0.664, 1.496, 0.748, 0.748, 0.496, 1.496, 0.832, 0.496, 1.328, 0.527, 0.916, 0.527, 0.527, 0.496, 0.496, 0.664, 0.664, 0.527, 0.748, 1.496, 0.504, 1.466, 0.588, 0.496, 1.084, 0.527, 0.664, 1.084, 1.084, 0.496, 0.748, 0.748, 0.748, 0.748, 0.298, 0.748, 0.504, 1.137, 0.412, 0.748, 0.847, 0.496, 1.137, 0.504, 0.603, 0.847, 0.450, 0.450, 0.504, 0.764, 0.679, 0.412, 0.496, 0.443, 0.466, 0.748, 1.130, 1.130, 1.130, 0.664, 1.084, 1.084, 1.084, 1.084, 1.084, 1.084, 1.336, 1.000, 0.916, 0.916, 0.916, 0.916, 0.504, 0.504, 0.504, 0.504, 1.084, 1.084, 1.084, 1.084, 1.084, 1.084, 1.084, 0.840, 1.084, 1.084, 1.084, 1.084, 1.084, 1.084, 0.832, 0.756, 0.664, 0.664, 0.664, 0.664, 0.664, 0.664, 1.000, 0.664, 0.664, 0.664, 0.664, 0.664, 0.420, 0.420, 0.420, 0.420, 0.748, 0.748, 0.748, 0.748, 0.748, 0.748, 0.748, 0.847, 0.748, 0.748, 0.748, 0.748, 0.748, 0.748, 0.748, 0.748 }; // Color definitions #define COLBLACK 0 // Black color value #define COLLGREY 7 // Light grey color value #define COLWHITE 15 // White color value static string colidxstr[] = { // Color index to color strinf conv. "0 0 0","0 0 0.6","0 0.6 0","0 0.6 0.6","0.6 0 0","0.6 0 0.6", "0.6 0.6 0","0.8 0.8 0.8","0.4 0.4 0.4","0 0 1","0 1 0","0 1 1", "1 0 0","1 0 1","1 1 0","1 1 1" }; // Dialog box definitions #define SB_WIDTHF 12.0 // File param. selection box width #define SB_WIDTHP 20.0 // Page param. selection box width #define ED_WIDTHF 40.0 // File param. edit field width #define ED_WIDTHP 40.0 // Page param. edit field width #define ED_WIDTHL 8.0 // Layer param. edit field width #define CCOLOFFF 20.0 // File param. 2nd ctrl. column offset #define CCOLOFFFP 40.0 // File pages. 2nd ctrl. column offset #define CCOLOFFP 20.0 // Page param. 2nd ctrl. column offset #define CCOLOFFPL 70.0 // Page layers 2nd ctrl. column offset #define CCOLOFFL 19.0 // Layer param. 2nd ctrl. col. offset #define CCOLOFFL2 66.0 // Layer param. 3rd ctrl. col. offset #define CCOLOFFL3 81.5 // Layer param. 4th ctrl. col. offset #define CCOLOFFG 16.0 // Grid param. 2nd ctrl. col. offset #define BBUTWIDTH 8.0 // Batch menu action button width #define BBUTXSTEP 10.0 // Batch menu action button x step #define MBUTWIDTH 13.0 // Menu action button width #define MBUTXSTEP 15.0 // Menu action button x step #define SELBOXWIDTHBS 80.0 // Batch selection box width #define SELBOXWIDTHBE 80.0 // Batch edit box width #define SELBOXWIDTHPS 80.0 // Page selection box width #define SELBOXWIDTHLS 90.0 // Layer selection box width #define SELBOXWIDTHLE 98.0 // Layer edit box width #define SELBOXWIDTHGE 66.0 // Grid edit box width // Globals #define DRLOUTLDISP 0x02 // Drill outline display flag #define DRLFILLDISP 0x04 // Drill filled display flag #define DRLDOTDISP 0x10 // Drill center dot display flag #define DRLDISPMASK (DRLOUTLDISP|DRLFILLDISP|DRLDOTDISP) // Drill display mode mask #define DRLTXTDISP 0x08 // Drill class text display flag #define SMALLVAL 0.00000001 // Small compare value #define SMALLANG 0.00001 // Small angle compare value #define SMALLTEXT 0.000001 // Small text size #define SIZETOL 0.0001 // Size compare tolerance static int psfh /* PS output file handle */; static string os /* Output string */; static int opos = 0 /* Output position */; static int opagen = 0 /* Output page element count */; static int pageobjoff /* Output page object offset */; static int outlobjoff /* Output outline object offset */; static int opagesl[] /* Output page stream offset list */; static int opagell[] /* Output page length offset list */; static int opagefl[] /* Output page frame offset list */; static int opageol[] /* Output page outline offset list */; static int curopage = 0 /* Current output page */; static int totpagen = 0 /* Total page count */; static int cursstart /* Current stream start */; static double deflinewidth /* PS default polygon line width */; static double deftlinewidth /* PS default text line width */; static double pslinewidth /* PS polygon output line width */; static double pstlinewidth /* PS text output line width */; static string pstmline = "" /* PS multiline text */; static double psconcaty /* PS output concat y offset */; static double psbred = 1.0 /* PS background color red comp. */; static double psbgreen = 1.0 /* PS background color green comp. */; static double psbblue = 1.0 /* PS background color blue comp. */; static index L_FIGURE curfig /* Current figure list index */; static index L_CPART curcpart /* Current connection part index */; static int curcpflag /* Current connection part flag */; static int curpidx /* Current scan padstack index */; static int curpstkn /* Current padstack min. index */; static int curruleid /* Current scan rule object ID */; static int curgngrpidx /* Current group name layer index */; static int curplgrpidx /* Current PDF layer index */; static int pscurlay /* Cur. PS output layer */; static int pscurmode /* Cur. PS output mode */; static int psdeffont /* Cur. PS default font mode */; static int pscurfont /* Cur. PS current font mode */; static double fontbase /* Font baseline correction */; static double fontstroke /* Font line stroke width */; static double pscurang /* Cur. PS output hatch angle */; static double pscurspc /* Cur. PS output hatch spacing */; static double pscurdash1 /* Cur. PS output dash 1 length */; static double pscurdash2 /* Cur. PS output dash 2 length */; static double pscurdash3 /* Cur. PS output dash 3 length */; static double pscurdash4 /* Cur. PS output dash 4 length */; static double psfontsize /* Cur. PostScript font size */; static double psxoff /* Cur. PostScript x offset */; static double psyoff /* Cur. PostScript y offset */; static double psm1,psm2,psm3,psm4 /* Cur. PostScript matrix values */; static double psscale /* Cur. PostScript scale factor */; static double psrot /* Cur. PostScript rotation angle */; static int psnetcol = uliptype()!=ULIPGED ? 0 : 1 /* PS net color output flag */; static int pssinglay /* PS single layer output flag */; static int psmarklay /* PS marker layer */; static int psmirr = 0 /* Cur. PostScript mirror flag */; static int pspvis /* Cur. PostScript plot vis. mode */; static int pstextflag /* PS text output flag */; static int psoutlfill = 0 /* PS outline fill flag */; static int psclinefill = 0 /* PS closed line fill flag */; static int psgrpign = 0 /* PS element group ignore flag */; static int pspowflag /* PS power layer output flag */; static int pspowbit /* PS power layer bit field value */; static int psdrlflag /* PS drill holes output flag */; static int psdrlclass /* PS current drill class */; static string defcolor /* Output default color */; static int forcecolor = 0 /* Force output of default color */; static int textdisp /* Text display class bits */; static int pathdisp /* Path display class bits */; static int polydisp[] /* Polygon display class bits */; static string curcolor /* Output current color */; static double wslx,wsly /* Workspace lower boundary */; static double wsux,wsuy /* Workspace upper boundary */; static int toplay /* Plan top player */; static int ilaylb /* Inner layer lower boundary */; static int ilayub /* Inner layer upper boundary */; struct vardesc { // Variant descriptor int varnum /* Variant number */; string varname /* Variant name */; } varl[] /* Variant list */; static int varn = 0 /* Variant count */; static int act_flag = 0 /* Active variant defined flag */; static int curvarnum /* Current variant number */; static int varnumber = 0 /* Variant number */; static string varattr /* Variant attribute */; struct annotdesc { // Annotation object descriptor int obj /* Annotation object number */; string title /* Annotation title text */; string text /* Annotation text */; double lx,ly /* Annotation lower boundary */; double ux,uy /* Annotation upper boundary */; int lgrpidx /* Annotation layer group index */; } annotl[] /* Annotation list */; static int annotn = 0 /* Annotation count */; static int annotol[] /* Annotation object list */; static int annoton = 0 /* Annotation object total count */; static int annotmatch /* Annotation match */; static int lastobj /* Last object */; static string atitle /* Current annotation title */; static string atext /* Current annotation text */; // Constants string BAEEPSBDAT = strgetconffilename(EPSBLIBVNAME,EPSBLIBNAME,1); // BAE EPS batch data file name #define DATEXT ".dat" // Data file extension #define ATTRPDFPAGE "$pdfpage" // PDF page number #define ATTRPDFPAGEN "$pdfpagecnt" // PDF total page count #define ATTRPDFPPAGE "$pdfplpage" // PDF part list page number #define ATTRPDFPPAGEN "$pdfplpagecnt" // PDF total part list page count #define ATTRPDFPLPOS "$pdfplpos" // PDF part list position number #define ATTRPDFPLCNT "$pdfplcnt" // PDF part list cur. part count #define ATTRPDFPSIDE "$pdfpside" // PDF part list placement side #define ATTRPDFPLSEP "$pdfplsep" // PDF part list seperator #define PDFLXMARKER "pdf_lx" // PDF lower boundary marker name #define PDFUYMARKER "pdf_uy" // PDF upper boundary marker name #define GV_EPSBAT "EPS_BATNAME" // Remote control operation batch name #define GV_BATREPCNT "BAT_REPCNT" // Remote control op. report count #define GV_BATREPLINE "BAT_REPL_" // Remote control op. report line string PSEXT = bae_inistrval(PAR_EPSFEXT,".ps"); // Postscript output file name ext. string TEMPFNAME = bae_inistrval(PAR_PSTMPFILE,"eps_tmp.tmp"); // Temporary file name string PRTCMD = bae_inistrval(PAR_PRTCMD,"print /d:"); // Print command string string PDFCOMMAND = bae_inistrval(PAR_PDFCMD,"") /* PDF file access command name */; string A0INPSLOT = bae_inistrval(PAR_A0INPSLOT,"") /* A0 InputSlot specification */; string A0MEDIAPOS = bae_inistrval(PAR_A0MEDIAPOS,"") /* A0 MediaPosition specification */; string A1INPSLOT = bae_inistrval(PAR_A1INPSLOT,"") /* A1 InputSlot specification */; string A1MEDIAPOS = bae_inistrval(PAR_A1MEDIAPOS,"") /* A1 MediaPosition specification */; string A2INPSLOT = bae_inistrval(PAR_A2INPSLOT,"") /* A2 InputSlot specification */; string A2MEDIAPOS = bae_inistrval(PAR_A2MEDIAPOS,"") /* A2 MediaPosition specification */; string A3INPSLOT = bae_inistrval(PAR_A3INPSLOT,"") /* A3 InputSlot specification */; string A3MEDIAPOS = bae_inistrval(PAR_A3MEDIAPOS,"") /* A3 MediaPosition specification */; string A4INPSLOT = bae_inistrval(PAR_A4INPSLOT,"") /* A4 InputSlot specification */; string A4MEDIAPOS = bae_inistrval(PAR_A4MEDIAPOS,"") /* A4 MediaPosition specification */; int AUTORUN = bae_iniintval(PAR_AUTORUN,0) /* Auto. PDF display tool run flag */; string PDFEXT = bae_inistrval(PAR_PDFFEXT,".pdf"); // PDF output file name ext. string PDFVARSEP = bae_inistrval(PAR_PDFVARSEP,"_"); // PDF file variant name separator int SHORTFN = bae_iniintval(PAR_SHORTFN,0); // Report short file names flag string PDFLIB = bae_inistrval(PAR_PDFLIB,"pdfpage.ddb"); // PDF page library file name string ITMTOP = bae_inistrval(PAR_PLPTOP,M("Bestueckseite","Component Side")); // Top side part specification string ITMBOTTOM = bae_inistrval(PAR_PLPBOT,M("Loetseite","Solder Side")); // Bottom side part specification string ITMUNPLACED = bae_inistrval(PAR_PLPUPLC,M("unplatziert","unplaced")); // Unplaced part specification string PSFONTNAME = bae_inistrval(PAR_BFONTNAME,"Courier"); // Postscript font name double PSFONTBASE = bae_inidblval(PAR_BFONTBASE,0.2); // Postscript font baseline double PSFONTSTROKE = bae_inidblval(PAR_BFONTSTROKE,0.05); // Postscript font text stroke string PSAFONTNAME = bae_inistrval(PAR_AFONTNAME,"Arial"); // Postscript alternate font name double PSAFONTBASE = bae_inidblval(PAR_AFONTBASE,0.2); // Postscript alternate font baseline double PSAFONTSTROKE = bae_inidblval(PAR_AFONTSTROKE,0.09); // Postscript alt. font text stroke #define PSFONTASP (2.0/3.0) // Postscript font aspect ratio int DEFPSFONTMODE = bae_iniintval(PAR_FONTMODE,1); // Default postscript font mode int PSFONTMODE = DEFPSFONTMODE /* Postscript font mode */; double FONTSCALE = bae_inidblval(PAR_FONTSCALE,1.0); // PS font extra scaling factor STRINGS DEFPRTDEVL = { // Default printer devices "&lpt", "&prn" }; STRINGS PRTDEVL /* Printer device list */; int PRTDEVN /* Printer device count */; int PSALLLAY = bae_iniintval(PAR_ALLLAY,1); // Postscript all layer mode int PSBORDMODE = bae_iniintval(PAR_BORDMODE,1); // Postscript border mode int PSMARKMODE = bae_iniintval(PAR_MARKMODE,1); // Postscript marker mode #define MMTOPS 72.0/25.4 // mm to PostScript units factor #define PSTOMM 25.4/72.0 // PostScript to mm units factor double XOFF = bae_inidblval(PAR_XOFF,15.0); // Paper/sheet X offset [mm] double YOFF = bae_inidblval(PAR_YOFF,8.0); // Paper/sheet Y offset [mm] #define A4W 210 // A4 width [mm] #define A4H 297 // A4 height [mm] #define A3W 297 // A3 width [mm] #define A3H 420 // A3 height [mm] #define A2W 420 // A2 frameless width [mm] #define A2H 594 // A2 frameless height [mm] #define A1W 594 // A1 frameless width [mm] #define A1H 841 // A1 frameless height [mm] #define A0W 841 // A0 frameless width [mm] #define A0H 1189 // A0 frameless height [mm] #define A16x24W 160 // 160*240mm width [mm] #define A16x24H 240 // 160*240mm height [mm] #define LETTERW 215.9 // Letter width [mm] #define LETTERH 279.4 // Letter height [mm] #define PDFMINSIZE 0.0254 // PDF minimum page dimension double PWIDTH = A4W /* Paper width */; double PHEIGHT = A4H /* Paper height */; double MTOMM = cvtlength(1.0,0,2) /* PostScript output scale */; double PI = cvtangle(180.0,1,2) /* PI-value */; double PI2 = cvtangle(90.0,1,2) /* Pi half value */; // Parameters double LINEWIDTH = 0.0001 /* Polygon line width [mm] */; double TLINEWIDTH = 0.0001 /* Text line width [mm] */; int LINEABS = bae_iniintval(PAR_LINEABS,1); // Line width absolute flag int LINEWIDX = bae_iniintval(PAR_LINEW,0); // Default line width index int SCALEMODE = 0 /* Scale mode : 0 = Original (1:1) scaling 1 = Scale to paper size 2 = Scale with given factor 3 = Scale with given factor but use fix paper size */; int SCALEROT = 0 /* Scale with rotation flag : 0 = Scale without rotation 1 = Scale with best fit rot. 2 = Scale with 90 deg. rot. 3 = Scale with 180 deg. rot. */; int MIRROR = bae_iniintval(PAR_MIRROR,0); // Plot mirror mode int FORMAT = bae_iniintval(PAR_FORMAT,0); // Plot default format int PDFLAYGRP = bae_iniintval(PAR_PDFLAYGRP,0); // PDF layer group support int PDFGRPNLAY = bae_iniintval(PAR_PDFGRPNLAY,0); // PDF group name layer flag double SCALEFACTOR = bae_inidblval(PAR_SCALE,1.0); // Scaling factor int LAYMODE = bae_iniintval(PAR_LAYMODE,0); // Plot default output layer mode int VISW2B = bae_iniintval(PAR_PSVISW2B,1); // Visible layer white black conv. int ANNOTMODE = bae_iniintval(PAR_ANNOTMODE,0); // Annotation mode string ANNOTCOL = bae_inistrval(PAR_ANNOTCOL,"0.8 0.8 0.8"); // Annotation color int PDFBLEND = 0 /* PDF color blending */; int PDFCOMP = bae_iniintval(PAR_PDFCOMP,1); // PDF compressed output int compflag = 0 /* Compressed output flag */; // PDF compressed output int PLANMODE = bae_iniintval(PAR_PLANMODE,0); // Plot default output plan(s) mode int CLIP = 0 /* Plot clipping flag : 0 = Clipping Off 1 = Clipping Window 2 = Clipped matrix element 3 = Part list page macro */; int PDF = 0 /* PDF output flag : 0 = EPS output 1 = PDF output 2 = PDF mosaic output */; int PDFFIT = 1 /* PDF print settings fit to page flag : 0 = don't scale 1 = fit to page */; int FILLOUTLINE = 0 /* Fill outline flag : 0 = No fill outline 1 = Fill outline */; int CENTERPAGE = 0 /* Center page image flag : 0 = No page centering 1 = Center page image */; double DEFPOWBWIDTH = bae_inidblval(PAR_POWBWIDTH,0.0005); // Def. pow.lay board outl. width [m] double DEFPOWPWIDTH = bae_inidblval(PAR_POWPWIDTH,0.0003); // Def. pow.lay plane isol. width [m] double DEFPOWHWIDTH = bae_inidblval(PAR_POWHWIDTH,0.0001); // Def. pow.lay heat-trap width [m] double DEFPOWHTDIST = bae_inidblval(PAR_POWHTDIST,0.0004); // Def. pow.lay heat-trap-drl.dist. [m] int DEFPOWHTANG = bae_iniintval(PAR_POWHTANG,1); // Def. pow.lay heat trap angle double DEFPOWDRDIST = bae_inidblval(PAR_POWDRDIST,0.0004); // Def. pow.lay isol. drill dist. [m] double POWBWIDTH = DEFPOWBWIDTH; // Pow.lay board outl. width [m] double POWPWIDTH = DEFPOWPWIDTH; // Pow.lay plane isol. width [m] double POWHWIDTH = DEFPOWHWIDTH; // Pow.lay heat-trap width [m] double POWHTDIST = DEFPOWHTDIST; // Pow.lay heat-trap-drl.dist. [m] int POWHTANG = DEFPOWHTANG; // Pow.lay heat-trap angle double POWDRDIST = DEFPOWDRDIST; // Pow.lay isol. drill dist. [m] double DRLDOTRAD = bae_inidblval(PAR_DRLDOTRAD,0.00015); // Drill dot radius [m] string RGBATTR = bae_inistrval(PAR_RGBATTR,"$plotrgb"); // Plot color part attribute // Layer output info structure struct laydes { // Layer descriptor int num /* Layer number */; int mode /* Layer fill flag : 1 = fill 0 = outline */; int outlfill /* Layer outline fill flag : 1 = outline fill 0 = no outline fill */; int clinefill /* Layer close line fill flag : 1 = closed line fill 0 = no closed line fill */; int pvis /* Layer plot visibility mode : 0 = plot invisible 1 = plot visible 2 = plot placed 3 = plot unplaced */; int mirrmode /* Layer mirror mode : (-1) = use default mirror mode >=0 = other mirror mode */; double red /* Red color value : 1.0 = red 0.0 = black */; double green /* Green color value : 1.0 = green 0.0 = black */; double blue /* Blue color value : 1.0 = blue 0.0 = black */; int forcecolor /* Layer color forced output flag */; int errdisp /* Layer error display mode */; double ered /* Error red color value : 1.0 = red 0.0 = black */; double egreen /* Error green color value : 1.0 = green 0.0 = black */; double eblue /* Error blue color value : 1.0 = blue 0.0 = black */; double angle /* Hatch angle */; double spc /* Hatch spacing [m] : 0.0 = hatching off */; double dash1 /* Dash value 1 [m] (0=dash off) */; double dash2 /* Dash value 2 [m] */; double dash3 /* Dash value 3 [m] */; double dash4 /* Dash value 4 [m] */; double plw /* Polygon line width */; double tlw /* Text line width */; int font /* Font mode (<0 default) */; double powbw /* Pow.lay board outl. width [m] */; double powpw /* Pow.lay plane isol. width [m] */; double powhw /* Pow.lay heat-trap width [m] */; double powhtd /* Pow.lay heat-trap-drl.dist. [m] */; int powhtang /* Pow.lay heat-trap angle */; double powdrd /* Pow.lay isol. drill dist. [m] */; int powcam /* Pow.lay CAM parameters */; double drldot /* Drill dot radius */; string grp /* Layer group name */; int grpign /* Layer element group ignore flag */; int textdisp /* Text display class bits */; int pathdisp /* Path display class bits */; int polydisp[] /* Polygon display class bits */; }; struct laydes mlayfield[] = { // Multi layer output info field {LAYERALL,1,0,0,1,(-1),0.9,0.9,0.9,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Signal All {LAYERALL,0,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Signal All {LAYERBTW,1,0,0,1,(-1),0.9,0.9,0.9,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Sig. Inside {LAYERBTW,0,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Sig. Inside { 0,1,0,0,1,(-1),0.8,0.8,0.8,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Signal 1 { 0,0,0,0,1,(-1),0.1,0.1,0.1,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Signal 1 { 1,1,0,0,1,(-1),0.6,0.6,0.6,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Signal 2 { 1,0,0,0,1,(-1),0.1,0.1,0.1,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Signal 2 { 2,1,0,0,1,(-1),0.4,0.4,0.4,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Signal 3 { 2,0,0,0,1,(-1),0.1,0.1,0.1,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Signal 3 { 3,1,0,0,1,(-1),0.2,0.2,0.2,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Signal 4 { 3,0,0,0,1,(-1),0.1,0.1,0.1,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Signal 4 { 0x0400,1,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Doc. 1 (1) { 0x0401,1,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Doc. 1 (2) { 0x0432,1,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Doc. 4 (B) { 0x0442,1,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Doc. 5 (B) { 0x0481,1,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Doc. 9 (2) {LAYERBRD,0,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Outline {LAYERUNR,0,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0} // Unroutes }; struct laydes slayfield[] = { // Single layer output info field {LAYERALL,1,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Signal All {LAYERBTW,1,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Sig. Inside { 0,1,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Signal 1 { 1,1,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Signal 2 { 2,1,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Signal 3 { 3,1,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Signal 4 { 0x0400,1,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Doc. 1 (1) { 0x0401,1,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Doc. 1 (2) { 0x0432,1,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Doc. 4 (B) { 0x0442,1,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Doc. 5 (B) { 0x0481,1,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0}, // Doc. 9 (2) {LAYERBRD,0,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,0.0,"",0} // Outline }; struct laydes layfield[] /* Layer output info field */; int layfieldn /* Layer output info field length */; int lgrpl[] /* Layer number group list */; int lgrpul[] /* Layer number group usage list */; int lgrpsl[] /* Layer number start pos. list */; int lgrpvl[] /* Layer number visibility list */; int lgrpn = 0 /* Layer number group count */; int usedlgrpn = 0 /* Used layer number groups count */; string ngrpl[] /* Layer name group list */; int ngrpul[] /* Layer name group usage list */; int ngrpsl[] /* Layer name start pos. list */; int ngrpvl[] /* Layer name visibility list */; int ngrpn = 0 /* Layer name group count */; int usedngrpn = 0 /* Used layer name groups count */; int inslgrpidx /* Layer group insert index */; int insggrpidx /* Grid group insert index */; struct gridgdes { // Grid group descriptor int idx /* Grid group sort index */; string name /* Grid group name */; int vismode /* Grid group visibility ctrl. mode */; int prtmode /* Grid group print mode */; int lineflag /* Grid lines flag */; int actflag /* Grid currently active flag */; double min, max /* Grid visibility zoom range */; double x,y /* Grid step values */; double red, green, blue /* RGB color values */; } ggrpl[] /* Grid group list */; int ggrpsl[] /* Layer grid start pos. list */; int ggrpn = 0 /* Layer grid group count */; int gridfieldn /* Grid output info field length */; struct laydes laydefault = { // Default layer output info LAYERINV,0,0,0,1,(-1),0.0,0.0,0.0,0,0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0,0.0,0.0,(-1),0.0,0.0,0.0,0.0,(-1),0.0,0,"" }; /* EXAMPLE LAYER ENTRIES : Draw signal layer 1 structures filled with light gray color (0.9,0.9,0.9) : {0,1,(-1),0.9,0.9,0.9,0,0,0,0, 0, 0,0,0,0,0,(-1),0,0,0,0,0,0,"" } Draw signal layer 1 structures as outline in dark gray color (0.2,0.2,0.2) : {0,0,(-1),0.2,0.2,0.2,0,0,0,0, 0, 0,0,0,0,0,(-1),0,0,0,0,0,0,"" } Draw signal layer 2 structures as outline filled with 45 degree hatch in black color (0.0,0.0,0.0) : {1,0,(-1),0.0,0.0,0.0,0,0,0,0, 45, 0.0002,0,0,0,0,(-1),0,0,0,0,0,0,"" } Draw signal layer 2 structures as 0.0002 m dashed outline filled with 45 degree hatch in dark grey color (0.2,0.2,0.2) : {1,0,(-1),0.2,0.2,0.2,0,0,0,0, 45,0.0002,0.0002,0.0002,0.0002,0.0002,(-1),0,0,0,0,0,0,"" } NOTE : Hatching yields long processing time and large data output files. Drawing RGB with fill mode set yields most efficient output time and data amounts. */ // Polygon point data definition struct ptdes { // Point descriptor double x,y /* Point coordinate */; int typ /* Point type */; }; // Grid data definitions struct gvaldes { // Grid value descriptor double gdim /* Grid dimension */; string name /* Grid menu name */; }; struct gvaldes gridvall[] = { // Layout grid list { 0.0254/10.0, UPRLGRID01 }, { 0.0254/20.0, UPRLGRID02 }, { 0.0254/40.0, UPRLGRID03 }, { 0.0254/60.0, UPRLGRID04 }, { 0.0254/80.0, UPRLGRID05 }, { 0.0254/100.0, UPRLGRID06 }, { 0.0254/120.0, UPRLGRID07 }, { 0.0254/160.0, UPRLGRID08 }, { 0.0254/200.0, UPRLGRID09 }, { 0.0254/240.0, UPRLGRID10 }, { 0.0254/480.0, UPRLGRID11 }, { 0.00005, UPRLMGRID01 }, { 0.0001, UPRLMGRID02 }, { 0.000125, UPRLMGRID03 }, { 0.00025, UPRLMGRID04 }, { 0.0005, UPRLMGRID05 }, { 0.000625, UPRLMGRID06 }, { 0.0010, UPRLMGRID07 }, { 0.00125, UPRLMGRID08 }, { 0.002, UPRLMGRID09 }, { 0.0025, UPRLMGRID10 }, { 0.01, UPRLMGRID11 } }; int gridvaln = arylength(gridvall) /* Grid value list count */; // Batch output file parameters #define PAROUTFILE 0 // Output file name #define PAROUTFMODE 1 // Output file mode #define PAROUTFDIR 2 // Output file directory #define PAROUTFTYP 3 // Output file type #define PAROUTFLAY 4 // Output file layer support #define PAROUTFONT1 5 // Output 1st font name #define PAROUTFONT2 6 // Output 2nd font name #define PAROUTFONT1B 7 // Output 1st font base line #define PAROUTFONT2B 8 // Output 2nd font base line #define PAROUTFONT1S 9 // Output 1st font stroke width #define PAROUTFONT2S 10 // Output 2nd font stroke width #define PAROUTFDISP 11 // Output file display call #define PAROUTFPSCALE 12 // Output file printer out. scale flag #define PAROUTFVAR 13 // Output files for all variants #define PAROUTFMACRO 14 // Output file name macro #define PAROUTFATTR1 15 // Output file name 1st attribute #define PAROUTFATTR2 16 // Output file name 2nd attribute #define PAROUTFATTR3 17 // Output file name 3rd attribute #define PAROUTFATTR4 18 // Output file name 4th attribute #define PAROUTFATTRD 19 // Output file name default attribute #define PAROUTFPQRY 20 // Output file page query #define PAROUTFCNT 21 // Output file parameter count // Batch output page parameters #define PARPAGEMODE 0 // Output page mode #define PARPAGEXOFF 1 // Output page X offset #define PARPAGEYOFF 2 // Output page Y offset #define PARPAGENAME 3 // Output page name #define PARPAGEIDX 4 // Output page index #define PARPAGEMIRR 5 // Output page mirror mode #define PARPAGESCAL 6 // Output page scale factor #define PARPAGEFMT 7 // Output page format #define PARPAGERMOD 8 // Output page rotation mode #define PARPAGELMOD 9 // Output page line scale mode #define PARPAGECENT 10 // Output page centered mode #define PARPAGEBRED 11 // Output page bg. red color value #define PARPAGEBGREEN 12 // Output page bg. green color value #define PARPAGEBBLUE 13 // Output page bg. blue color value #define PARPAGEECOMM 14 // Output page element comment mode #define PARPAGEMACRO 15 // Output page macro #define PARPAGEANNO 16 // Output page annotation mode #define PARPAGEARED 17 // Output page anno. red color value #define PARPAGEAGREEN 18 // Output page anno. green color value #define PARPAGEABLUE 19 // Output page anno. blue color value #define PARPAGEOUT 20 // Output page flag #define PARPAGELQRY 21 // Output page layer query #define PARPAGECNT 22 // Output page parameter count // Batch output layer parameters #define PARLAYNUM 0 // Output layer number #define PARLAYFILL 1 // Output layer fill mode #define PARLAYRED 2 // Output layer red color value #define PARLAYGREEN 3 // Output layer green color value #define PARLAYBLUE 4 // Output layer blue color value #define PARLAYHANGLE 5 // Output layer hatch angle #define PARLAYHSPACE 6 // Output layer hatch spacing #define PARLAYDASH1 7 // Output layer dash 1 length #define PARLAYDASH2 8 // Output layer dash 2 length #define PARLAYDASH3 9 // Output layer dash 3 length #define PARLAYDASH4 10 // Output layer dash 4 length #define PARLAYPOLYW 11 // Output layer polygon line width #define PARLAYTEXTW 12 // Output layer text line width #define PARLAYPOWBW 13 // Out. pow.lay. board outline width #define PARLAYPOWPW 14 // Out. pow.lay. plane isolation width #define PARLAYPOWHW 15 // Out. pow.lay. heat-trap width #define PARLAYPOWHTD 16 // Out. pow.lay. heat-trap-drill dist. #define PARLAYPOWDRD 17 // Out. pow.lay. isolation drill dist. #define PARLAYIDX 18 // Output layer index #define PARLAYFONT 19 // Output layer font mode #define PARLAYGNAME 20 // Output layer group name #define PARLAYEDSP 21 // Output layer error display flag #define PARLAYERED 22 // Output error red color value #define PARLAYEGREEN 23 // Output error green color value #define PARLAYEBLUE 24 // Output error blue color value #define PARLAYPVIS 25 // Output layer plot vis. mode #define PARLAYPOWCAM 26 // Output pow.lay. with CAM settings #define PARLAYPOWHTANG 27 // Output pow.lay. heat angle #define PARLAYDRLDOT 28 // Output drill dot radius #define PARLAYFORCECOL 29 // Output force layer color #define PARLAYACT 30 // Output layer active flag #define PARLAYOUT 31 // Output layer flag #define PARLAYOUTLF 32 // Output outline fill flag #define PARLAYCLFILL 33 // Output closed line fill flag #define PARLAYGIGN 34 // Output elem. layer group ignore flag #define PARLAYPATHCL 35 // Output text class flags #define PARLAYPOLYCL 36 // Output polygon class flags base #define PARLAYTEXTCL 46 // Output text class flags #define PARLAYCNT 47 // Output layer parameter count // Batch output grid parameters #define PARGRIDX 0 // Output grid x step #define PARGRIDY 1 // Output grid y step #define PARGRIDRED 2 // Output grid red color value #define PARGRIDGREEN 3 // Output grid green color value #define PARGRIDBLUE 4 // Output grid blue color value #define PARGRIDGNAME 5 // Output grid group name #define PARGRIDACT 6 // Output grid active mode #define PARGRIDPRT 7 // Output grid print flag #define PARGRIDLINE 8 // Output grid lines #define PARGRIDIDX 9 // Output grid index #define PARGRIDCNT 10 // Output grid parameter count // SQL command definitions #define B_CREATE "create table epsbatches (batchname string);" #define B_INSERT "insert into epsbatches values(%s);" #define B_SELECT "select batchname from epsbatches;" #define B_DELETE "delete from epsbatches where batchname=%s;" #define B_HELP "help epsbatches;" #define I_CREATE "create table epsid (maxepsid integer);" #define I_HELP "help epsid;" #define I_INSERT "insert into epsid values(%d);" #define I_SELECT "select maxepsid from epsid;" #define I_DELETE "delete from epsid;" #define F_CREATE "create table epsbatchfiles (batchname string,id integer);" #define F_HELP "help epsbatchfiles;" #define F_INSERT "insert into epsbatchfiles values(%s,%d);" #define F_SELECT "select id from epsbatchfiles where batchname=%s;" #define F_DELETE "delete from epsbatchfiles where batchname=%s;" #define F_DELETES "delete from epsbatchfiles where batchname=%s AND id=%d;" #define P_CREATE "create table epsbatchpages (fileid integer,id integer);" #define P_HELP "help epsbatchpages;" #define P_INSERT "insert into epsbatchpages values(%d,%d);" #define P_SELECT "select id from epsbatchpages where fileid=%d;" #define P_DELETE "delete from epsbatchpages where fileid=%d;" #define P_DELETES "delete from epsbatchpages where id=%d;" #define L_CREATE "create table epsbatchlayers (pageid integer,id integer);" #define L_HELP "help epsbatchlayers;" #define L_INSERT "quickinsert into epsbatchlayers values(%d,%d);" #define L_SELECT "select id from epsbatchlayers where pageid=%d;" #define L_DELETE "delete from epsbatchlayers where pageid=%d;" #define L_DELETES "delete from epsbatchlayers where id=%d;" #define L_INDEX "index table epsbatchlayers;" #define G_CREATE "create table epsbatchgrids (pageid integer,id integer);" #define G_HELP "help epsbatchgrids;" #define G_INSERT "quickinsert into epsbatchgrids values(%d,%d);" #define G_SELECT "select id from epsbatchgrids where pageid=%d;" #define G_DELETE "delete from epsbatchgrids where pageid=%d;" #define G_DELETES "delete from epsbatchgrids where id=%d;" #define G_INDEX "index table epsbatchgrids;" #define PP_CREATE1 "create table epsparamtab (id integer," #define PP_CREATE2 "pidx integer,ival integer,dval float,sval string);" #define PP_HELP "help epsparamtab;" #define PP_INSERT "quickinsert into epsparamtab values(%d,%d,%d,%.20f,%s);" #define PP_SELECT "select pidx,ival,dval,sval from epsparamtab where id=%d;" #define PP_DELETE "delete from epsparamtab where id=%d;" #define PP_INDEX "index table epsparamtab;" #define FN_CREATE1 "create table lepspdf_data (ftyp integer," #define FN_CREATE2 "elemname string,filename string);" #define FN_DELETE "delete from lepspdf_data where ftyp=%d AND elemname=%s;" #define FN_INSERT "insert into lepspdf_data values(%d,%s,%s);" #define FN_SELECT1 "select filename from lepspdf_data where " #define FN_SELECT2 "ftyp=%d AND elemname=%s;" #define V_SELECTA "select from varinfo;" string sqlcommand /* SQL command string */; int queryid = 0 /* ID query buffer */; string queryname = "" /* Name query buffer */; // Batch definitions #define FILE_EPS 0 // EPS output file #define FILE_PDF 1 // PDF output file #define PAGE_SINGLE 0 // Single element page #define PAGE_SINGLEEXT 1 // Single named element ext. page #define PAGE_SINGLEN 2 // Single named element page #define PAGE_ALLL 3 // Page for every file layout element #define PAGE_ALLLEXT 4 // Ext. page for all file layout elem. #define PAGE_ALLP 5 // Page for every file part element #define PAGE_ALLPEXT 6 // Ext. page for all file part element #define PAGE_ALLS 7 // Page for every file padstack element #define PAGE_ALLSEXT 8 // Ext. page for all file padstack elem. #define PAGE_ALLD 9 // Page for every file pad element #define PAGE_ALLDEXT 10 // Ext. page for all file pad element #define PAGE_SINGLEV 11 // Page for every element variant #define PAGE_PARTLIST 12 // Pages of part list // Part list definitions struct pldes { // Part list entry descriptor string vall[] /* Part value list */; string namel[] /* Part name list */; int namen /* Part name count */; } partl[] /* Part list */; int partn /* Part count */; struct pentrydes { // Part list entry descriptor int partidx /* Part index */; string nlist /* Part name list string */; int first /* Part first item flag */; int start /* Part item list start flag */; } pentryl[] /* Part entry list */; int pentryn /* Part entry count */; struct attrdes { // Output attribute descriptor string name /* Attribute name list */; int casemode /* Attribute case conversion mode */; } attrl[] /* Attribute list */; int attrn /* Attribute count */; static index L_POOL pspool /* PS pool element index */; static double plwslx, plwsly /* Part list element lower boundary */; static double plwsux, plwsuy /* Part list element upper boundary */; static int pspoolflag = 0 /* PS pool element flag */; static int partoff /* Part list page offset */; static int partpagen /* Part list page count */; static int partpageidx /* Current part list page index */; static int partprow /* Part list page row count */; static int partcntflag /* Part list count output flag */; static int partcntfont /* Part list font mode */; static int partnamecase /* Part name case conversion mode */; static double partcntw /* Part list name field width */; static double partsepw /* Part list seperator width */; string batl[] /* Batch name list */; int batn /* Batch count */; STRINGS el /* Popup entry list */; int en = 0 /* Popup entry count */; int curlayer = (-1) /* Current batch layer */; int chklayer /* Output check layer */; int layerused /* Layer used flag */; int curgrid = (-1) /* Current batch grid */; int curpage = (-1) /* Current batch page */; int curfile = (-1) /* Current batch file */; int remoteflag = 0 /* Remote control operation flag */; int remotecnt = 0 /* Remote control op. file count */; string envvar /* Environment variable name */; int curpar /* Current parameter index */; struct pardes { // Batch step parameter descriptor int ival /* Batch step integer parameter */; double dval /* Batch step double parameter */; string sval /* Batch step string parameter */; }; struct griddes { // Batch output grid descriptor int id /* Batch output grid ID */; int parn /* Batch output grid param. count */; struct pardes parl[] /* Batch output grid param. list */; }; struct layerdes { // Batch output layer descriptor int id /* Batch output layer ID */; int parn /* Batch output layer param. count */; struct pardes parl[] /* Batch output layer param. list */; }; struct pagedes { // Batch step descriptor int id /* Batch output page ID */; int layn /* Batch output layer count */; struct layerdes layl[] /* Batch output layer list */; int gridn /* Batch output grid count */; struct griddes gridl[] /* Batch output grid list */; int parn /* Batch output page parameter count */; struct pardes parl[] /* Batch output page parameter list */; }; struct filedes { // Batch output file descriptor int id /* Batch output file ID */; int pagen /* Batch output file page count */; struct pagedes pagel[] /* Batch output file page list */; int parn /* Batch output file parameter count */; struct pardes parl[] /* Batch output file parameter list */; } filel[] /* Batch output file list */; int filen = 0 /* Batch output file count */; int playl[] /* Batch page layer list */; int playn = 0 /* Batch page layer count */; int pgridl[] /* Batch page grid list */; int pgridn = 0 /* Batch page grid count */; int ddbclass = bae_planddbclass() /* Layout plan DDB class */; int abortflag = 0 /* Output abort request flag */; // Main program void main() { struct filedes file /* File step data */; struct pagedes page /* Page data */; struct layerdes layer /* Layer data */; struct pardes parl[] /* Current param. list */; string psname /* PS output file name */; string psvoutname /* PS variant output file name */; string psroutname /* PS report output file name */; string printername = "" /* PS printer name */; string batname /* Batch name */; STRINGS outl /* Menu entry string list */; string fbname /* File base name */; int fblen /* File base name length */; string fname /* Current DDB file name */; string ename /* Current element name */; string nameext = "" /* Page name extension */; string plname /* PDF layer name */; string e_dis /* Element disable */; double swap /* Coordinate swap buffer */; double w, h /* Mosaic element size */; double pcol = 23.0 /* Parameter column */; double cy /* Dialog box current y coordinate */; int repflag /* Dialog box repeat flag */; int gridlock /* Grid lock flag */; int rangedis /* Range check disabled flag */; int res /* Query result */; int varidx /* INI variable index */; int outfidx = (-1) /* Output file parameter index */; int modeidx = (-1) /* Output mode parameter index */; int callidx = (-1) /* Control call parameter index */; int aruntype /* Control call parameter type */; int lgrpidx = (-1) /* Layer group parameter index */; int fmtidx = (-1) /* Output format parameter index */; int loidx = (-1) /* Layer output parameter index */; int linwidx = (-1) /* Line width parameter index */; int linsidx = (-1) /* Line scale parameter index */; int mirridx = (-1) /* Mirror mode parameter index */; int rotidx = (-1) /* Rotation parameter index */; int scalidx = (-1) /* Scale factor parameter index */; int clipidx = (-1) /* Clip mode parameter index */; int fontidx = (-1) /* Font mode parameter index */; int annidx = (-1) /* Symbol annotation parameter index */; int xoffidx /* X offset parameter index */; int yoffidx /* Y offset parameter index */; int class /* Output class */; int cmode /* Output class mode */; int lomode /* Layer output mode */; int lwmode /* Line width mode */; int mirrbak /* Mirror mode backup */; int devidx /* Device name index */; int mxn, myn /* Mosaic matrix dimensions */; int nx, ny /* Matrix scan variables */; int i,j /* Loop control variables */; // Perform BAE Demo check with abort BAE_Demo_check(2); // Assume whole plan output CLIP=0; getwsbound(); if (uliptype()==ULIPGED) { ged_getintpar(117,pathdisp); ged_getintpar(118,textdisp); for (i=L_POLYCOPPASS;i<=L_POLYSPPAREA;i++) ged_getintpar(119+i-L_POLYCOPPASS,polydisp[i]); } else { pathdisp=textdisp=0xF; for (i=0;i<=L_POLYSPPAREA;i++) polydisp[i]=0xF; } if (PDFCOMMAND=="") getextprog(".pdf",PDFCOMMAND); // Check if remote control operation if (varget(GV_EPSBAT,batname)==0) { vardelete(GV_EPSBAT); // Perform requested batch remoteflag=1; runbatch(batname); varset(GV_BATREPCNT,remotecnt); exit(0); } // Check if direct batch selection else if (bae_peekiact()) { remoteflag=2; batname=askstr("",MAXTEXTLEN); runbatch(batname); exit(0); } // Get the printer device name list for (PRTDEVN=0;PRTDEVN<16;PRTDEVN++) { if ((PRTDEVL[PRTDEVN]=bae_inistrval( bae_iniarrayvarname(PAR_PRTDEVLST,PRTDEVN),""))=="") { // Check if list defined at all if (PRTDEVN==0) { // Use default printer device name list PRTDEVL=DEFPRTDEVL; PRTDEVN=arylength(PRTDEVL); } break; } } PRTDEVL[PRTDEVN]=UPRABORT; aruntype=PDFCOMMAND!="" ? PA_TOGGLE : PA_NIL; // Init. the file name database fndbinit(); // Check for dialog support if (bae_dialclr()) { // Get the output mode bae_promptdialog(UPRPLAN); e_dis=ddbclass==DDBCLUNDEF ? "," : ""; if ((cmode=bae_askmenu(8,e_dis+UPRPLAN0,e_dis+UPRPLAN1, UPRPLAN2,UPRPLAN3,UPRPLAN4,UPRPLAN5,e_dis+UPRPLAN6,UPRPLAN7, UPRABORT))<0 || cmode>7) // Abort error_abort(); // Select layers for output bae_promptdialog(UPRLAYER); if ((lomode=bae_askmenu(5,UPRLAYVIS,UPRLAYVISB,UPRLAYPROG, UPRLAYSEL,UPRLAYVISSW,UPRABORT))<0 || lomode>4) // Abort error_abort(); // Select the output file name bae_setmousetext(""); if ((psname=bae_readedittext(UPRPSFILE,"",MAXPATHLEN))=="" || psname==UINPOPABORT) error_abort(); // Get the output format bae_promptdialog(UPRFORMAT); switch (bae_askmenu(13,UPRFORMAT1,UPRFORMAT2,UPRFORMAT3, UPRFORMAT4,UPRFORMAT5,UPRFORMAT6,UPRFORMAT7,UPRFORMAT8, UPRFORMAT9,UPRFORMAT10,UPRFORMAT11,UPRFORMAT12,UPRABORT)) { // PDF mosaic, scaling n:1 case 9 : PDF++; // PDF, scaling n:1 case 5 : PDF++; // Scaling n:1 case 0 : SCALEMODE=2; // Get the scale factor if (askdbl(SCALEFACTOR,UPRSCALE,10)) error(ERRINPVAL); LINEABS=1; if (SCALEFACTOR==1.0) SCALEMODE=0; break; // PDF, scaling A4 portrait case 6 : PDF=1; // Scaling A4 portrait case 1 : PWIDTH=A4W; PHEIGHT=A4H; SCALEMODE=1; break; // PDF, scaling A4 landscape case 10 : PDF=1; PWIDTH=A4H; PHEIGHT=A4W; SCALEMODE=1; break; // PDF, scaling A3 case 8 : PDF=1; // Scaling A3 portrait case 2 : PWIDTH=A3W; PHEIGHT=A3H; SCALEMODE=1; break; // PDF, scaling A3 landscape case 11 : PDF=1; PWIDTH=A3H; PHEIGHT=A3W; SCALEMODE=1; break; // Scaling 160*240 case 3 : PWIDTH=A16x24W; PHEIGHT=A16x24H; SCALEMODE=1; break; // Scaling Letter (8.5"*11.0") case 4 : PWIDTH=LETTERW; PHEIGHT=LETTERH; SCALEMODE=1; break; // PDF, scaling n:1 paper size A4 case 7 : PWIDTH=A4W; PHEIGHT=A4H; SCALEMODE=3; // Get the scale factor if (askdbl(SCALEFACTOR,UPRSCALE,10)) error(ERRINPVAL); LINEABS=1; PDF=1; break; // Abort default : error_abort(); } // Get the plot rotation mode bae_promptdialog(UPRROTMOD); if ((SCALEROT=bae_askmenu(5,UPRROT0,UPRROTBF,UPRROT90, UPRROT180,UPRABORT))<0 || SCALEROT>3) error_abort(); // Get the line width bae_promptdialog(UPRLINEW); if ((lwmode=bae_askmenu(4,UPRLINEW1,UPRLINEW2,UPRLINEW3, UPRABORT))<0 || lwmode>2) // Abort error_abort(); // Test if line scaling is required if (SCALEMODE) { // Get the line scale mode bae_promptdialog(UPRLINEMOD); switch (bae_askmenu(3, UPRLINESCL,UPRLINEABS,UPRABORT)) { /* Scaled */ case 0 : LINEABS=0; break; /* Absolute */ case 1 : LINEABS=1; break; /* Abort */ default : error_abort(); } } // Select plot mirror mode bae_promptdialog(UPRMIRRMOD); if ((MIRROR=bae_askmenu(7,UPRMIRR00,UPRMIRR01,UPRMIRR02, UPRMIRR03,UPRMIRR04,UPRMIRR05,UPRABORT))<0 || MIRROR>5) error_abort(); // Check if current element output if (cmode<2 || cmode==6 || cmode==7) { // Select plot clipping mode bae_promptdialog(UPRCLIPMOD); switch (CLIP= bae_askmenu(3,UPRCLIPOFF,UPRCLIPON,UPRABORT)) { // Whole plan case 0 : break; // Clip rectangle case 1 : // Disable range check bae_getintpar(0,rangedis); bae_setintpar(0,1); // Free grid lock gridlock=bae_getgridlock(); bae_setgridlock(0); // Select clip rectangle if ((bae_promptdialog(UPRRCORNER1), bae_inpoint(bae_planwsnx(),bae_planwsny(), wslx,wsly,0)) || (bae_promptdialog(UPRRCORNER2), bae_inpoint(wslx,wsly,wsux,wsuy,1)) || wslx==wsux || wsly==wsuy) { // Restore old range check state bae_setintpar(0,rangedis); // Restore grid lock bae_setgridlock(gridlock); error_abort(); } // Restore old range check state bae_setintpar(0,rangedis); // Restore grid lock bae_setgridlock(gridlock); // Sort workspace coordinates if (wslx>wsux) { swap=wslx; wslx=wsux; wsux=swap; } if (wsly>wsuy) { swap=wsly; wsly=wsuy; wsuy=swap; } break; // Abort default : error_abort(); } } } else { // Set default format dependant parameters switch (FORMAT) { // Scaling n:1 case 0 : SCALEMODE=2; if (ddbclass!=DDBCLUNDEF && (wsux-wslx)>(wsuy-wsly)) SCALEROT=0; break; // Scaling A4 case 1 : PWIDTH=A4W; PHEIGHT=A4H; SCALEMODE=1; SCALEROT=1; break; // Scaling A3 case 2 : PWIDTH=A3W; PHEIGHT=A3H; SCALEMODE=1; SCALEROT=1; break; // Scaling 160*240 case 3 : PWIDTH=A16x24W; PHEIGHT=A16x24H; SCALEMODE=1; SCALEROT=0; break; // Scaling Letter (8.5"*11.0") case 4 : PWIDTH=LETTERW; PHEIGHT=LETTERH; SCALEMODE=1; SCALEROT=1; break; // PDF, scaling n:1 A4 mosaic case 9 : PWIDTH=A4W; PHEIGHT=A4H; // PDF, scaling n:1 case 5 : SCALEMODE=2; SCALEROT=0; PDF= FORMAT==9 ? 2 : 1; break; // PDF, scaling A4 portrait case 6 : PWIDTH=A4W; PHEIGHT=A4H; SCALEMODE=1; SCALEROT=1; PDF=1; break; // PDF, scaling A4 landscape case 10 : PWIDTH=A4H; PHEIGHT=A4W; SCALEMODE=1; SCALEROT=1; PDF=1; break; // PDF, scaling n:1 paper size A4 case 7 : PWIDTH=A4W; PHEIGHT=A4H; SCALEMODE=3; SCALEROT=0; PDF=1; break; // PDF, scaling A3 protrait case 8 : PWIDTH=A3W; PHEIGHT=A3H; SCALEMODE=1; SCALEROT=1; PDF=1; break; // PDF, scaling A3 landscape case 11 : PWIDTH=A3H; PHEIGHT=A3W; SCALEMODE=1; SCALEROT=1; PDF=1; break; } // Init. the y coordinate cy=DIAL_TOPMARG; // Store the OK and abort button with seperator bae_dialaddcontrol(PA_OK,0,0,0,0.0,0.0,0.0,"", 0,DIAL_LEFTMARG,cy,0.0,""); bae_dialaddcontrol(PA_ABORT,0,0,0,0.0,0.0,0.0,"", 0,DIAL_LEFTMARG+5.0,cy,0.0,""); bae_dialaddcontrol(PA_ACT,0,14,0,0.0,0.0,0.0,"", 0,DIAL_LEFTMARG+20.0,cy,0.0,UPRDBATCH); bae_dialaddcontrol(PA_ACT,0,17,0,0.0,0.0,0.0,"", 0,DIAL_LEFTMARG+32.0,cy,0.0,UPRDBATCHC); cy+=DIAL_BUTVSTEP; dial_hsep(cy); // Store output file controls dial_label(0.0,cy,UPRDPSFILE); callidx=bae_dialaddcontrol(FORMAT>4 ? aruntype : PA_NIL, 0,0,AUTORUN,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+10.0,cy,0.0,UPRPDFARUN); cy+=DIAL_CTRVSTEP; queryname=""; sprintf(sqlcommand,FN_SELECT1+FN_SELECT2,PDF, sql_quotestr(bae_planename())); sqlcmd(bae_planfname(),sqlcommand,namefunc); outfidx=dial_string(queryname!="" ? queryname : convstring( bae_planfname(),0)+(PDF ? PDFEXT : PSEXT),MAXPATHLEN,0.0,cy); bae_dialaddcontrol(PA_ACT,0,1,0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG,cy,8.0,UPRBROWSE); bae_dialaddcontrol(PA_ACT,0,16,0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+10.0,cy,8.0,UPRBRWDEVNAME); bae_dialaddcontrol(PA_ACT,0,19,0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+20.0,cy,8.0,UPRDEFFILENAME); lgrpidx=bae_dialaddcontrol(FORMAT>4 ? PA_TOGGLE : PA_NIL, 0,0,PDFLAYGRP,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+30.0,cy,0.0,UPRPDFLGRP); cy+=DIAL_BUTVSTEP; // Store a seperator dial_hsep(cy); // Store output format controls dial_label(0.0,cy,UPRDFORMAT); fmtidx=dial_selbox(FORMAT,pcol,cy); dial_sbentry(4,0,UPRFORMAT1); dial_sbentry(5,1,UPRFORMAT2); dial_sbentry(6,2,UPRFORMAT3); dial_sbentry(7,3,UPRFORMAT4); dial_sbentry(8,4,UPRFORMAT5); dial_sbentry(9,5,UPRFORMAT6); dial_sbentry(10,6,UPRFORMAT7); dial_sbentry(21,10,UPRFORMAT11); dial_sbentry(11,7,UPRFORMAT8); dial_sbentry(15,8,UPRFORMAT9); dial_sbentry(22,11,UPRFORMAT12); dial_sbentry(18,9,UPRFORMAT10); // Store page offset controls dial_label(0.0,cy,UPRDOFFSET); dial_label(21.0,cy,UPRDX); xoffidx=bae_dialaddcontrol(PA_DBL|PA_DIST,0,3,0,0.0,0.0, XOFF/1000.0,"",0,DIAL_LEFTMARG+pcol,cy,ED_WIDTHL,""); dial_label(33.0,cy,UPRDY); yoffidx=bae_dialaddcontrol( PA_DBL|PA_DIST|PA_HBRDREL,0,3,0,0.0,0.0,YOFF/1000.0,"",0, DIAL_LEFTMARG+35.0,cy,DIAL_RIGHTEMARG,""); cy+=DIAL_CTRVSTEP; // Store scaling factor controls dial_label(0.0,cy,UPRDSCALE); scalidx=bae_dialaddcontrol( (SCALEMODE!=1 ? (PA_DBL|PA_CHKLL|PA_HBRDREL) : PA_LAB), 0,5,0,0.0,0.0,SCALEFACTOR,"",0, DIAL_LEFTMARG+pcol,cy,DIAL_RIGHTEMARG,UPRNIL); cy+=DIAL_CTRVSTEP; // Store plan output mode controls dial_label(0.0,cy,UPRDPLAN); if ((ddbclass==DDBCLUNDEF && (PLANMODE==0 || PLANMODE==1)) || (ddbclass!=DDBCLLAY && PLANMODE==6)) PLANMODE=2; modeidx=dial_selbox(PLANMODE,pcol,cy); if (ddbclass!=DDBCLUNDEF) { dial_sbentry(13,0,UPRPLAN0); dial_sbentry(13,1,UPRPLAN1); } if (ddbclass==DDBCLLAY) { dial_sbentry(13,6,UPRPLAN6); dial_sbentry(13,7,UPRPLAN7); } dial_sbentry(12,2,UPRPLAN2); dial_sbentry(12,3,UPRPLAN3); dial_sbentry(12,4,UPRPLAN4); dial_sbentry(12,5,UPRPLAN5); // Store layer output mode controls dial_label(0.0,cy,UPRDLAYER); loidx=dial_selbox(LAYMODE,pcol,cy); dial_sbentry(0,0,UPRLAYVIS); dial_sbentry(0,1,UPRLAYVISB); dial_sbentry(0,4,UPRLAYVISSW); dial_sbentry(0,2,UPRLAYPROG); dial_sbentry(0,3,UPRLAYSEL); // Store line width controls dial_label(0.0,cy,UPRDLINEW); linwidx=dial_selbox(LINEWIDX,pcol,cy); dial_sbentry(0,0,UPRLINEW1); dial_sbentry(0,1,UPRLINEW2); dial_sbentry(0,2,UPRLINEW3); // Store line scaling controls dial_label(0.0,cy,UPRDLINEMOD); linsidx=dial_selbox(LINEABS,pcol,cy); dial_sbentry(0,0,UPRLINESCL); dial_sbentry(0,1,UPRLINEABS); // Store mirror mode controls dial_label(0.0,cy,UPRDMIRRMOD); mirridx=dial_selbox(MIRROR,pcol,cy); dial_sbentry(0,0,UPRMIRR00); dial_sbentry(0,1,UPRMIRR01); dial_sbentry(0,2,UPRMIRR02); dial_sbentry(0,3,UPRMIRR03); dial_sbentry(0,4,UPRMIRR04); dial_sbentry(0,5,UPRMIRR05); // Store rotation controls dial_label(0.0,cy,UPRDROTMOD); rotidx=dial_selbox(SCALEROT,pcol,cy); dial_sbentry(0,0,UPRROT0); dial_sbentry(0,1,UPRROTBF); dial_sbentry(0,2,UPRROT90); dial_sbentry(0,3,UPRROT180); // Store clipping controls dial_label(0.0,cy,UPRDCLIPMOD); clipidx=bae_dialaddcontrol( (PLANMODE==2 ? PA_LAB : (PA_SB|PA_HBRDREL)),0,0,CLIP,0.0,0.0, 0.0,"",0,DIAL_LEFTMARG+pcol,cy,DIAL_RIGHTEMARG,UPRNIL); dial_sbentry(2,0,UPRCLIPOFF); dial_sbentry(3,1,UPRCLIPON); cy+=DIAL_CTRVSTEP; // Store font controls dial_label(0.0,cy,UPRDFONT); fontidx=bae_dialaddcontrol(PA_RBF,0,0,DEFPSFONTMODE, 0.0,0.0,0.0,"",0,DIAL_LEFTMARG+pcol,cy,0.0,UPRFONTBAE); bae_dialaddcontrol(PA_RBN,1,0,0,0.0,0.0,0.0,"", 0,DIAL_LEFTMARG+pcol+6.0,cy,0.0,PSFONTNAME); bae_dialaddcontrol(PA_RBN,2,0,0,0.0,0.0,0.0,"", 0,DIAL_LEFTMARG+pcol+14.0,cy,0.0,PSAFONTNAME); cy+=DIAL_CTRVSTEP; // Store annotation color controls dial_label(0.0,cy,UPRDANNO); annidx=bae_dialaddcontrol(PA_SB|PA_HBRDREL,0,0,ANNOTMODE, 0.0,0.0,0.0,"",0,DIAL_LEFTMARG+pcol,cy,DIAL_RIGHTEMARG,""); dial_sbentry(0,0,UPRANNO00); dial_sbentry(0,1,UPRANNO01); dial_sbentry(0,2,UPRANNO02); dial_sbentry(0,3,UPRANNO03); dial_sbentry(0,4,UPRANNO04); dial_sbentry(0,5,UPRANNO05); dial_sbentry(0,6,UPRANNO06); cy+=DIAL_CTRVSTEP; dial_hsep(cy); bae_dialaddcontrol(PA_ACT,0,20,0,0.0,0.0,0.0,"",0,DIAL_LEFTMARG+ pcol+20.0+DIAL_RIGHTSMARG-bae_dialgettextlen(0,UPRSAVEPAR)- DIAL_RIGHTEMARG,cy,0.0,UPRSAVEPAR); cy+=DIAL_BUTVSTEP+DIAL_SEPVSTEP; // Perform the dialog input loop repflag=1; do { // Call the dialog function bae_setintpar(16,4004); switch (res=bae_dialaskparams(UPRPARAMDIAL, 0,DIAL_LEFTMARG+pcol+20.0+DIAL_RIGHTSMARG,cy)) { // Done case 0 : case 17 : case 20 : // Get data from dialog box entries bae_dialgetdata(outfidx,0,0.0,psname); if (res!=20 && bae_chkoutfname(psname)) { bae_msgbox(2,ERROFILENAME,""); continue; } bae_dialgetdata(fmtidx,FORMAT,0.0,""); bae_dialgetdata(lgrpidx,PDFLAYGRP,0.0,""); bae_dialgetdata(callidx,AUTORUN,0.0,""); bae_dialgetdata(scalidx,0,SCALEFACTOR,""); bae_dialgetdata(modeidx,cmode,0.0,""); bae_dialgetdata(linwidx,lwmode,0.0,""); bae_dialgetdata(linsidx,LINEABS,0.0,""); bae_dialgetdata(loidx,lomode,0.0,""); bae_dialgetdata(mirridx,MIRROR,0.0,""); bae_dialgetdata(fontidx,DEFPSFONTMODE,0.0,""); bae_dialgetdata(xoffidx,0,XOFF,""); bae_dialgetdata(yoffidx,0,YOFF,""); bae_dialgetdata(annidx,ANNOTMODE,0.0,""); XOFF*=1000.0; YOFF*=1000.0; bae_dialgetdata(rotidx,SCALEROT,0.0,""); if (SCALEMODE==2 && SCALEFACTOR==1.0) SCALEMODE=0; if (res!=20) { repflag=0; break; } varidx=0; bae_iniintset(varidx,PAR_FORMAT,FORMAT); bae_iniflagset(varidx,PAR_PDFLAYGRP,PDFLAYGRP); bae_iniflagset(varidx,PAR_AUTORUN,AUTORUN); bae_inidblset(varidx,PAR_SCALE,SCALEFACTOR); bae_iniintset(varidx,PAR_PLANMODE,cmode); bae_iniintset(varidx,PAR_LAYMODE,lwmode); bae_iniflagset(varidx,PAR_LINEABS,LINEABS); bae_iniintset(varidx,PAR_MIRROR,MIRROR); bae_iniintset(varidx, PAR_FONTMODE,DEFPSFONTMODE); bae_iniintset(varidx,PAR_ANNOTMODE,ANNOTMODE); bae_inidblset(varidx,PAR_XOFF,XOFF); bae_inidblset(varidx,PAR_YOFF,YOFF); bae_iniwrite(varidx); break; // Browse file name case 1 : // Get the output file name bae_dialgetdata(outfidx,0,0.0,psname); if (bae_askfilename(psname, bae_swversion(3),UPRBPSFILE)==0 && psname!="") bae_dialsetdata(outfidx, PA_STR|PA_HBRDREL,0,0.0,psname); break; // Clipping off case 2 : CLIP=0; getwsbound(); break; // Clipping on case 3 : CLIP=1; // Disable range check bae_getintpar(0,rangedis); bae_setintpar(0,1); // Free grid lock gridlock=bae_getgridlock(); bae_setgridlock(0); // Select clip rectangle if ((bae_promptdialog(UPRRCORNER1), bae_inpoint(bae_planwsnx(),bae_planwsny(), wslx,wsly,0)) || (bae_promptdialog(UPRRCORNER2), bae_inpoint(wslx,wsly,wsux,wsuy,1)) || wslx==wsux || wsly==wsuy) { // Restore old range check state bae_setintpar(0,rangedis); // Restore grid lock bae_setgridlock(gridlock); error_abort(); } // Restore old range check state bae_setintpar(0,rangedis); // Restore grid lock bae_setgridlock(gridlock); // Sort workspace coordinates if (wslx>wsux) { swap=wslx; wslx=wsux; wsux=swap; } if (wsly>wsuy) { swap=wsly; wsly=wsuy; wsuy=swap; } break; // Scaling n:1 case 4 : SCALEMODE=2; bae_dialgetdata(scalidx,0,SCALEFACTOR,""); bae_dialsetdata(scalidx, PA_DBL|PA_CHKLL|PA_HBRDREL,0,SCALEFACTOR,""); bae_dialsetdata( rotidx,PA_SB|PA_HBRDREL,0,0.0,""); bae_dialgetdata(lgrpidx,PDFLAYGRP,0.0,""); bae_dialsetdata( lgrpidx,PA_NIL,PDFLAYGRP,0.0,UPRPDFLGRP); bae_dialgetdata(callidx,AUTORUN,0.0,""); bae_dialsetdata( callidx,PA_NIL,AUTORUN,0.0,UPRPDFARUN); adjfname(outfidx,0,PDF!=0 ? 1 : 0); PDF=0; break; // Scaling A4 case 5 : PWIDTH=A4W; PHEIGHT=A4H; SCALEMODE=1; bae_dialsetdata( rotidx,PA_SB|PA_HBRDREL,1,0.0,""); bae_dialsetdata( scalidx,PA_LAB,0,SCALEFACTOR,UPRNIL); bae_dialgetdata(lgrpidx,PDFLAYGRP,0.0,""); bae_dialsetdata( lgrpidx,PA_NIL,PDFLAYGRP,0.0,UPRPDFLGRP); bae_dialgetdata(callidx,AUTORUN,0.0,""); bae_dialsetdata( callidx,PA_NIL,AUTORUN,0.0,UPRPDFARUN); adjfname(outfidx,0,PDF!=0 ? 1 : 0); PDF=0; break; // Scaling A3 case 6 : PWIDTH=A3W; PHEIGHT=A3H; SCALEMODE=1; bae_dialsetdata( rotidx,PA_SB|PA_HBRDREL,1,0.0,""); bae_dialsetdata( scalidx,PA_LAB,0,SCALEFACTOR,UPRNIL); bae_dialgetdata(lgrpidx,PDFLAYGRP,0.0,""); bae_dialsetdata( lgrpidx,PA_NIL,PDFLAYGRP,0.0,UPRPDFLGRP); bae_dialgetdata(callidx,AUTORUN,0.0,""); bae_dialsetdata( callidx,PA_NIL,AUTORUN,0.0,UPRPDFARUN); adjfname(outfidx,0,PDF!=0 ? 1 : 0); PDF=0; break; // Scaling 160*240 case 7 : PWIDTH=A16x24W; PHEIGHT=A16x24H; SCALEMODE=1; bae_dialsetdata( rotidx,PA_SB|PA_HBRDREL,0,0.0,""); bae_dialsetdata( scalidx,PA_LAB,0,SCALEFACTOR,UPRNIL); bae_dialgetdata(lgrpidx,PDFLAYGRP,0.0,""); bae_dialsetdata( lgrpidx,PA_NIL,PDFLAYGRP,0.0,UPRPDFLGRP); bae_dialgetdata(callidx,AUTORUN,0.0,""); bae_dialsetdata( callidx,PA_NIL,AUTORUN,0.0,UPRPDFARUN); adjfname(outfidx,0,PDF!=0 ? 1 : 0); PDF=0; break; // Scaling Letter (8.5"*11.0") case 8 : PWIDTH=LETTERW; PHEIGHT=LETTERH; SCALEMODE=1; bae_dialsetdata( rotidx,PA_SB|PA_HBRDREL,1,0.0,""); bae_dialsetdata( scalidx,PA_LAB,0,SCALEFACTOR,UPRNIL); bae_dialgetdata(lgrpidx,PDFLAYGRP,0.0,""); bae_dialsetdata( lgrpidx,PA_NIL,PDFLAYGRP,0.0,UPRPDFLGRP); bae_dialgetdata(callidx,AUTORUN,0.0,""); bae_dialsetdata( callidx,PA_NIL,AUTORUN,0.0,UPRPDFARUN); adjfname(outfidx,0,PDF!=0 ? 1 : 0); PDF=0; break; // PDF, scaling n:1 case 9 : case 18 : if (PDF==0) { bae_dialsetdata(xoffidx, PA_DBL|PA_DIST,0,0.0,""); bae_dialsetdata(yoffidx, PA_DBL|PA_DIST|PA_HBRDREL,0,0.0,""); } SCALEMODE=2; bae_dialsetdata( rotidx,PA_SB|PA_HBRDREL,0,0.0,""); adjfname(outfidx,1,PDF==0 ? 1 : 0); PDF= res==9 ? 1 : 2; bae_dialgetdata(scalidx,0,SCALEFACTOR,""); bae_dialsetdata(scalidx, PA_DBL|PA_CHKLL|PA_HBRDREL,0,SCALEFACTOR,""); bae_dialgetdata(lgrpidx,PDFLAYGRP,0.0,""); bae_dialsetdata( lgrpidx,PA_TOGGLE,PDFLAYGRP,0.0,UPRPDFLGRP); bae_dialgetdata(callidx,AUTORUN,0.0,""); bae_dialsetdata( callidx,aruntype,AUTORUN,0.0,UPRPDFARUN); PWIDTH=A4W; PHEIGHT=A4H; break; // PDF, scaling A4 portrait case 10 : if (PDF==0) { bae_dialsetdata(xoffidx, PA_DBL|PA_DIST,0,0.0,""); bae_dialsetdata(yoffidx, PA_DBL|PA_DIST|PA_HBRDREL,0,0.0,""); } PWIDTH=A4W; PHEIGHT=A4H; SCALEMODE=1; bae_dialsetdata( rotidx,PA_SB|PA_HBRDREL,1,0.0,""); bae_dialsetdata( scalidx,PA_LAB,0,SCALEFACTOR,UPRNIL); bae_dialgetdata(lgrpidx,PDFLAYGRP,0.0,""); bae_dialsetdata( lgrpidx,PA_TOGGLE,PDFLAYGRP,0.0,UPRPDFLGRP); bae_dialgetdata(callidx,AUTORUN,0.0,""); bae_dialsetdata( callidx,aruntype,AUTORUN,0.0,UPRPDFARUN); adjfname(outfidx,1,PDF==0 ? 1 : 0); PDF=1; break; // PDF, scaling A4 landscape case 21 : if (PDF==0) { bae_dialsetdata(xoffidx, PA_DBL|PA_DIST,0,0.0,""); bae_dialsetdata(yoffidx, PA_DBL|PA_DIST|PA_HBRDREL,0,0.0,""); } PWIDTH=A4H; PHEIGHT=A4W; SCALEMODE=1; bae_dialsetdata( rotidx,PA_SB|PA_HBRDREL,1,0.0,""); bae_dialsetdata( scalidx,PA_LAB,0,SCALEFACTOR,UPRNIL); bae_dialgetdata(lgrpidx,PDFLAYGRP,0.0,""); bae_dialsetdata( lgrpidx,PA_TOGGLE,PDFLAYGRP,0.0,UPRPDFLGRP); bae_dialgetdata(callidx,AUTORUN,0.0,""); bae_dialsetdata( callidx,aruntype,AUTORUN,0.0,UPRPDFARUN); adjfname(outfidx,1,PDF==0 ? 1 : 0); PDF=1; break; // PDF, scaling n:1 paper size A4 case 11 : if (PDF==0) { bae_dialsetdata(xoffidx, PA_DBL|PA_DIST,0,0.0,""); bae_dialsetdata(yoffidx, PA_DBL|PA_DIST|PA_HBRDREL,0,0.0,""); } PWIDTH=A4W; PHEIGHT=A4H; SCALEMODE=3; bae_dialsetdata( rotidx,PA_SB|PA_HBRDREL,1,0.0,""); adjfname(outfidx,1,PDF==0 ? 1 : 0); PDF=1; bae_dialgetdata(scalidx,0,SCALEFACTOR,""); bae_dialsetdata(scalidx, PA_DBL|PA_CHKLL|PA_HBRDREL,0,SCALEFACTOR,""); bae_dialgetdata(lgrpidx,PDFLAYGRP,0.0,""); bae_dialsetdata( lgrpidx,PA_TOGGLE,PDFLAYGRP,0.0,UPRPDFLGRP); bae_dialgetdata(callidx,AUTORUN,0.0,""); bae_dialsetdata( callidx,aruntype,AUTORUN,0.0,UPRPDFARUN); break; // Multiple plan output case 12 : CLIP=0; getwsbound(); bae_dialsetdata(clipidx,PA_LAB,0,0.0,UPRNIL); break; // Current plan output case 13 : bae_dialsetdata( clipidx,PA_SB|PA_HBRDREL,0,0.0,""); break; // Batch processing case 14 : batchoutput(); break; // PDF, scaling A3 portrait case 15 : if (PDF==0) { bae_dialsetdata(xoffidx, PA_DBL|PA_DIST,0,0.0,""); bae_dialsetdata(yoffidx, PA_DBL|PA_DIST|PA_HBRDREL,0,0.0,""); } PWIDTH=A3W; PHEIGHT=A3H; SCALEMODE=1; bae_dialsetdata( rotidx,PA_SB|PA_HBRDREL,1,0.0,""); bae_dialsetdata( scalidx,PA_LAB,0,SCALEFACTOR,UPRNIL); bae_dialgetdata(lgrpidx,PDFLAYGRP,0.0,""); bae_dialsetdata( lgrpidx,PA_TOGGLE,PDFLAYGRP,0.0,UPRPDFLGRP); bae_dialgetdata(callidx,AUTORUN,0.0,""); bae_dialsetdata( callidx,aruntype,AUTORUN,0.0,UPRPDFARUN); adjfname(outfidx,1,PDF==0 ? 1 : 0); PDF=1; break; // PDF, scaling A3 landscape case 22 : if (PDF==0) { bae_dialsetdata(xoffidx, PA_DBL|PA_DIST,0,0.0,""); bae_dialsetdata(yoffidx, PA_DBL|PA_DIST|PA_HBRDREL,0,0.0,""); } PWIDTH=A3H; PHEIGHT=A3W; SCALEMODE=1; bae_dialsetdata( rotidx,PA_SB|PA_HBRDREL,1,0.0,""); bae_dialsetdata( scalidx,PA_LAB,0,SCALEFACTOR,UPRNIL); bae_dialgetdata(lgrpidx,PDFLAYGRP,0.0,""); bae_dialsetdata( lgrpidx,PA_TOGGLE,PDFLAYGRP,0.0,UPRPDFLGRP); bae_dialgetdata(callidx,AUTORUN,0.0,""); bae_dialsetdata( callidx,aruntype,AUTORUN,0.0,UPRPDFARUN); adjfname(outfidx,1,PDF==0 ? 1 : 0); PDF=1; break; // Select printer device name case 16 : bae_promptdialog(UPRSELDEV); if ((devidx=bae_askmenu(PRTDEVN+1,PRTDEVL[0], PRTDEVL[1],PRTDEVL[2],PRTDEVL[3],PRTDEVL[4], PRTDEVL[5],PRTDEVL[6],PRTDEVL[7],PRTDEVL[8], PRTDEVL[9],PRTDEVL[10],PRTDEVL[11], PRTDEVL[12],PRTDEVL[13],PRTDEVL[14], PRTDEVL[15],PRTDEVL[16]))>=0 && devidx0;i--) { if (numstrcmp(ename,outl[i-1])>0) break; outl[i]=outl[i-1]; } outl[i]=ename; opagen++; } break; // Abort default : error_abort(); } // Build layer output field switch (lomode) { // Visible layers with outline case 1: FILLOUTLINE=1; // Visible layers case 0 : buildvislayfield((cmode==1 ? 1 : 0),res==17 ? 1 : 0); break; // Programmed layers case 2 : if (cmode==1) layfield=slayfield; else layfield=mlayfield; layfieldn=arylength(layfield); break; // Selected layers case 3 : buildsellayfield(); break; // Visible layers B/W case 4 : buildvislayfield(1,res==17 ? 1 : 0); break; // Abort on default default : error_abort(); } for (i=0;istrlen(psname)) { printername=psname; psname=TEMPFNAME; } mirrbak=MIRROR; // Check if batch creation if (res==17) { // Select the new batch name if ((batname=selbatchname())=="") return; // Store new batch name sprintf(sqlcommand,B_INSERT,sql_quotestr(batname)); if (sqlcmd(BAEEPSBDAT,sqlcommand,NULL)!=0) // SQL/DB error sql_dberror(0); // Set default data initfile(file); parl=file.parl; parl[PAROUTFILE].sval=PDF ? PDFEXT : PSEXT; parl[PAROUTFTYP].ival=PDF ? FILE_PDF : FILE_EPS; parl[PAROUTFVAR].ival=cmode==7 ? 1 : 0; parl[PAROUTFMACRO].sval=""; parl[PAROUTFATTR1].sval=""; parl[PAROUTFATTR2].sval=""; parl[PAROUTFATTR3].sval=""; parl[PAROUTFATTR4].sval=""; parl[PAROUTFATTRD].sval="_1"; parl[PAROUTFLAY].ival=PDFLAYGRP; parl[PAROUTFPSCALE].ival=PDFFIT; parl[PAROUTFDISP].ival= (PDF && AUTORUN) ? 1 : 0 ; // Get new ID file.id=allocid(BAEEPSBDAT); sprintf(sqlcommand,F_INSERT,sql_quotestr(batname),file.id); if (sqlcmd(BAEEPSBDAT,sqlcommand,NULL)!=0) // SQL/DB error sql_dberror(0); // Store file parameter data for (i=0;i=0 && lay_rulequery(RS_OCFIG,curfig,RS_PCBSUBJ,RS_PDFLAY, "?s",plname)>0 && plname!="") storelgrpname(plname,LAYERINV,1); if (PDFGRPNLAY) forall (curfig where curfig.RULEOBJID>=0 && lay_rulequery(RS_OCFIG,curfig,RS_PCBSUBJ,RS_GROUPNAME, "?s",plname)>0 && plname!="") storelgrpname(plname,LAYERINV,1); } // Check if PDF mosaic output if (PDF==2 && !CLIP) { totpagen=0; for (curpage=0;curpage0 && (allout || dataonlayer(laynum))) { if (VISW2B && color==15) color=0; // Store layer info (with fill) if (mode) newlayentry(laynum,0.0,0.0,0.0); else newlayentry(laynum,coltored(color), coltogreen(color),coltoblue(color)); } // Loop thru all power layers for (laynum=POWLAYBASE;laynum0 && (allout || dataonlayer(laynum))) { if (VISW2B && color==15) color=0; // Store layer info (with fill) if (mode) newlayentry(laynum,0.0,0.0,0.0); else newlayentry(laynum,coltored(color), coltogreen(color),coltoblue(color)); } // Test if inside signal layer is visible if ((color=getpurecolor(LAYERBTW))>0 && (allout || dataonlayer(LAYERBTW))) { if (VISW2B && color==15) color=0; // Store layer info (with fill) if (mode) newlayentry(LAYERBTW,0.0,0.0,0.0); else newlayentry(LAYERBTW,coltored(color), coltogreen(color),coltoblue(color)); } // Test if all signal layer is visible if ((color=getpurecolor(LAYERALL))>0 && (allout || dataonlayer(LAYERALL))) { if (VISW2B && color==15) color=0; // Store layer info (with fill) if (mode) newlayentry(LAYERALL,0.0,0.0,0.0); else newlayentry(LAYERALL,coltored(color), coltogreen(color),coltoblue(color)); } // Loop thru all documentary layers for (i=0;i0 && (allout || dataonlayer(laynum))) { if (VISW2B && color==15) color=0; // Store layer info (with fill) if (mode) newlayentry(laynum,0.0,0.0,0.0); else newlayentry(laynum,coltored(color), coltogreen(color),coltoblue(color)); } // Test if side 2 doc layer is visible if ((color=getpurecolor(laynum+1))>0 && (allout || dataonlayer(laynum+1))) { if (VISW2B && color==15) color=0; // Store layer info (with fill) if (mode) newlayentry(laynum+1,0.0,0.0,0.0); else newlayentry(laynum+1,coltored(color), coltogreen(color),coltoblue(color)); } // Test if both sides doc layer is visible if ((color=getpurecolor(laynum+2))>0 && (allout || dataonlayer(laynum+2))) { if (VISW2B && color==15) color=0; // Store layer info (with fill) if (mode) newlayentry(laynum+2,0.0,0.0,0.0); else newlayentry(laynum+2,coltored(color), coltogreen(color),coltoblue(color)); } } // Test if board outline layer is visible if ((color=getpurecolor(LAYERBRD))>0 && (allout || dataonlayer(LAYERBRD))) { if (VISW2B && color==15) color=0; // Store layer info (no fill) if (mode) newlayentry(LAYERBRD,0.0,0.0,0.0); else newlayentry(LAYERBRD,coltored(color), coltogreen(color),coltoblue(color)); } // Test if unroutes layer is visible if ((color=getpurecolor(LAYERUNR))>0 && (allout || dataonlayer(LAYERUNR))) { if (VISW2B && color==15) color=0; // Store layer info (no fill) if (mode) newlayentry(LAYERUNR,0.0,0.0,0.0); else newlayentry(LAYERUNR,coltored(color), coltogreen(color),coltoblue(color)); } // Test if drill holes are visible if ((color=getpurecolor(LAYERDRL))>0) for (laynum=LAYERDRLZ;laynum<=LAYERDRLD;laynum++) if (color!=getpurecolor(laynum)) color=(-1); // Check if common drill color if (color>0) { if (VISW2B && color==15) color=0; // Store layer info (no fill) if (mode) newlayentry(LAYERDRL,0.0,0.0,0.0); else newlayentry(LAYERDRL,coltored(color), coltogreen(color),coltoblue(color)); } else { for (laynum=LAYERDRLZ;laynum<=LAYERDRLD;laynum++) { if ((color=getpurecolor(laynum))<=0) continue; if (VISW2B && color==15) color=0; // Store layer info (no fill) if (mode) newlayentry(laynum,0.0,0.0,0.0); else newlayentry(laynum,coltored(color), coltogreen(color),coltoblue(color)); } } // Test if error markers are visible if ((color=getpurecolor(LAYERERR))>0 && (allout || dataonlayer(LAYERERR))) { if (VISW2B && color==15) color=0; // Store layer info (no fill) if (mode) newlayentry(LAYERERR,0.0,0.0,0.0); else newlayentry(LAYERERR,coltored(color), coltogreen(color),coltoblue(color)); } // Test if origin marker is visible if ((color=getpurecolor(LAYERORG))>0) { if (VISW2B && color==15) color=0; // Store layer info (no fill) if (mode) newlayentry(LAYERORG,0.0,0.0,0.0); else newlayentry(LAYERORG,coltored(color), coltogreen(color),coltoblue(color)); if (PDF && PDFLAYGRP) { bae_getintpar(25,inpdisp); bae_getinpgrid(xgrid,ygrid); if (inpdisp && xgrid>0.0 && ygrid>0.0) { sprintf(gname,REPGRID,gridname("",xgrid,ygrid)); i=ggrpn; storeggrpname(i,gname,2,2,0, 0.003/(SCALEFACTOR*xgrid),0.0,xgrid,ygrid, coltored(color),coltogreen(color), coltoblue(color)); } } } // Test if workspace is visible if ((color=getpurecolor(LAYERWAR))>0) { if (VISW2B && color==15) color=0; // Store layer info (no fill) if (mode) newlayentry(LAYERWAR,0.0,0.0,0.0); else newlayentry(LAYERWAR,coltored(color), coltogreen(color),coltoblue(color)); if (PDF && PDFLAYGRP) { bae_getbackgrid(xgrid,ygrid); if (xgrid>0.0 && ygrid>0.0) { bae_getintpar(23,lineflag); sprintf(gname,REPGRID,gridname("",xgrid,ygrid)); i=ggrpn; storeggrpname(i,gname,2,2,lineflag, 0.003/(SCALEFACTOR*xgrid),0.0,xgrid,ygrid, coltored(color),coltogreen(color), coltoblue(color)); } } } // Mark grids as active for (i=0;isigclen) sigclen=strlen(siglayl[laynum].name); } // Loop thru all power layers for (laynum=0;laynumpowclen) powclen=strlen(powlayl[laynum].name); } // Set all special layers spclayl[0].num=LAYERALL; spclayl[0].sel="a"; spclayl[1].num=LAYERBTW; spclayl[1].sel="m"; spclayl[2].num=LAYERBRD; spclayl[2].sel="b"; spclayl[3].num=LAYERUNR; spclayl[3].sel="u"; spclayl[4].num=LAYERDRL; spclayl[4].sel="d"; spclayl[5].num=LAYERWAR; spclayl[5].sel="w"; spclayl[6].num=LAYERORG; spclayl[6].sel="o"; spclayl[7].num=LAYERERR; spclayl[7].sel="e"; spclayn=8; for (laynum=LAYERDRLD;laynum>=LAYERDRLZ;laynum--) { spclayl[spclayn].num=laynum; spclayl[spclayn].sel="dr"+itoa(LAYERDRLD-laynum); spclayn++; } for (laynum=0;laynumspcclen) spcclen=strlen(spclayl[laynum].name); } // Loop thru all documentary layers for (i=0;idocclen) docclen=strlen(doclayl[doclayn].name); doclayn++; } // Set the popup rows and column counts bae_mtpsize(poprows,popcols); poprows-=1; popcols=sigclen+powclen+spcclen+3*5+1; if (popcols<(docclen+28)) popcols=docclen+28; // Calculate popup height and width height=calcpopheight(poprows); width=calcpopwidth(popcols); // Set the popup boundaries mlx=(1.0-width)/2.0; mly=0.5*POPMIN; mux=mlx+width; muy=mly+height; // Show the popup menu bae_popshow(poprows,popcols,mlx,mly,mux,muy); // Run the layer selection menu do { // Check if new popup contents if (disppage!=lastpage) { // Clear the popup contents bae_popshow(poprows,popcols,mlx,mly,mux,muy); lastpage=disppage; } // Check the display page if (disppage) { // Display header elements bae_poptext(1.8,docclen+2,REPSIDE1); bae_poptext(1.8,docclen+11,REPSIDE2); bae_poptext(1.8,docclen+20,REPBOTH); // Display documentary layers for (i=0;i=doclayn) break; // Display layer name bae_poptext(i+3,curcol,doclayl[i].name); curcol+=docclen+1; // Display side 1 elements bae_poptextchoice( i+3,curcol,UPRSIDE1,doclayl[i].sel[0]); bae_popcolchoice( i+3,curcol+4,i+3,curcol+6, doclayl[i].state[0] ? COLLGREY: COLBLACK, doclayl[i].sel[0]); curcol+=9; // Display side 2 elements bae_poptextchoice( i+3,curcol,UPRSIDE2,doclayl[i].sel[1]); bae_popcolchoice( i+3,curcol+4,i+3,curcol+6, doclayl[i].state[1] ? COLLGREY: COLBLACK, doclayl[i].sel[1]); curcol+=9; // Display both sides elements bae_poptextchoice( i+3,curcol,UPRBOTH,doclayl[i].sel[2]); bae_popcolchoice( i+3,curcol+4,i+3,curcol+6, doclayl[i].state[2] ? COLLGREY: COLBLACK, doclayl[i].sel[2]); } // Display the signal layer button curcol=1; bae_poptextchoice(0,curcol,UPRPOPSIGL,UPRPOPSIGL); curcol+=strlen(UPRPOPSIGL)+1; } else { // Display signal layers for (i=0;i>16)/15.0); colidx=color&0x0F; if (bae_getinvcolor()) { if (colidx==0) colidx=15; else if (colidx==15) colidx=0; } // Return red scale value return(1.0-col_red[colidx]); } double coltogreen(int color) /* // Transform color index/value to green color value // Return value : // green scale value // Parameters : // int color : Color index/value */ { double col_green[] = { // Color index to green col. transform. 1.0, 1.0, 0.4, 0.4, 1.0, 1.0, 0.4, 0.2, 0.6, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0 }; int colidx /* Color table index */; // Return invisible color value if invalid color index if (color<0) return(1.0); if (color&32) return(((color&0x0F000)>>12)/15.0); colidx=color&0x0F; if (bae_getinvcolor()) { if (colidx==0) colidx=15; else if (colidx==15) colidx=0; } // Return green scale value return(1.0-col_green[colidx]); } double coltoblue(int color) /* // Transform color index/value to blue color value // Return value : // blue scale value // Parameters : // int color : Color index/value */ { double col_blue[] = { // Color index to blue col. transform. 1.0, 0.4, 1.0, 0.4, 1.0, 0.4, 1.0, 0.2, 0.6, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 }; int colidx /* Color table index */; // Return invisible color value if invalid color index if (color<0) return(1.0); if (color&32) return(((color&0x0F00)>>8)/15.0); colidx=color&0x0F; if (bae_getinvcolor()) { if (colidx==0) colidx=15; else if (colidx==15) colidx=0; } // Return blue scale value return(1.0-col_blue[colidx]); } int getpurecolor(int layer) /* // Get pure layer color without pattern code // Return value : // color value // Parameters : // int layer : BAE layer */ { int color /* Color value */; // Check if faded in if ((color=bae_getcolor(layer))>0) // Mask out the pattern code color&=0x0FFFFF; // Return color value return(color); } void newlayentry(int laynum,double red,double green, double blue) /* // Append layer info to end of layer info field // Parameters : // int laynum : Layer number // double red : Red color value // double green : Green color value // double blue : Blue color value */ { struct laydes layinfo /* Layer info */; // Reset the layer info to default layinfo=laydefault; // Set the layer number layinfo.num=laynum; layinfo.grp=""; layinfo.grpign=0; // Set the fill modes layinfo.mode=1; layinfo.outlfill=0; layinfo.clinefill=0; // Set the mirror mode layinfo.mirrmode=(-1); // Set the font mode layinfo.font=(-1); layinfo.angle=layinfo.spc=0.0; layinfo.dash1=layinfo.dash2=layinfo.dash3=layinfo.dash4=0.0; layinfo.plw=layinfo.tlw=0.0; layinfo.powbw=layinfo.powpw=layinfo.powhw=0.0; layinfo.powhtd=layinfo.powdrd=0.0; layinfo.drldot=DRLDOTRAD; // Set the RGB values layinfo.red=red; layinfo.green=green; layinfo.blue=blue; layinfo.errdisp=0; layinfo.ered=layinfo.egreen=layinfo.eblue=0.0; layinfo.pvis=1; layinfo.forcecolor=0; // Store layer info at end of layer info field layfield[layfieldn++]=layinfo; // Test if optional outline layer mode is required if (FILLOUTLINE && (red!=0.0 || green!=0.0 || blue!=0.0)) { // Reset the layer info to default layinfo=laydefault; // Set the layer number layinfo.num=laynum; // Store layer info at end of layer info field layfield[layfieldn++]=layinfo; } } // EPS/PostScript output routines void epsout(string psname,string pagename,int lfidx,int prevpage,int nextpage, int parent,int varreq) /* // Perform the EPS/PostScript output // Parameters : // string psname : PostScript output file name // string pagename : Page name // int lfidx : Layer field index // int prevpage : Previous page index // int nextpage : Next page index // int parent : Parent catalog index // int varreq : Variant request number */ { struct laydes laybakl[] /* Layer output info field backup */; double width,height /* Plan dimensions */; double uwidth,uheight /* Usable paper dimensions */; double xgrid, ygrid /* Grid step values */; double xmin, ymin /* Grid lower boundary */; double xmax, ymax /* Grid upper boundary */; double x, y /* Grid scan coordinates */; index L_CNET net /* Net index */; index L_ATTRIBUTE attr /* Attribute index */; index L_DRCERROR drcerr /* DRC error index */; double scale = 1.0 /* Scale factor */; double upx,upy /* Upper boundary coordinates */; double centx,centy /* Center offset coordinates */; int rotate /* Rotation flag */; int lfs,lfe /* Layer field boundaries */; int grpidx /* Layer group index */; int laygrp /* Layer group used flag */; string tbuf /* Text buffer */; string aval /* Attribute value */; string attrcommn /* Attribute comment name */; string attrcommv /* Attribute comment value */; string attrname /* Attribute name */; string attruname /* Attribute upper case name */; string attrdisp /* Attribute display string */; int varnum /* Attribute variant number */; int attrord /* Attribute sort order */; int len /* Attribute name length */; struct attrdata { // Attribute data descriptor string name /* Attribute name */; string disp /* Attribute display string */; string val /* Attribute value */; int order /* Attribute order */; } al[] /* Attribute list */; int an = 0 /* Attribute count */; string plname /* Part layer name */; int netcolor /* Net color index */; int oldwarnmode /* Old warning mode */; int i,j /* Loop control variable */; // Query the current active variant if (ddbclass!=DDBCLLAY || lay_rulequery(RS_OCPLAN,0,RS_PCBSUBJ,RS_VARIANT,"?d",varnumber)<1) // Set default variant varnumber=0; toplay=lay_plantoplay(); // Check if variant set request if (varreq>=0) { // Set variant name and number varnumber=varl[varreq].varnum; rs_assplanintpred(RS_VARIANT,varnumber,0,"lay_variant_*"); rs_assplanstrpred(RS_VARNAME,varl[varreq].varname,"",""); bae_postprocess(); } // Get the plan size if (CLIP==0) getwsbound(); // Ensure min. PDF page dimensions if (PDF) { if (bae_iniintval(PAR_PDFMINCHK,0)!=0) { if ((width=wsux-wslx)=2) { scale=SCALEFACTOR; } // Set scale to max. value else if (uheight/width>uwidth/height) { // Set scale value scale=uwidth/height; } else { // Set scale value scale=uheight/width; } if (CENTERPAGE) { if (SCALEMODE==3) { centx=0.5*(uheight/scale-height); centy=0.5*(uwidth/scale-width); } else { centx=0.5*(uwidth/scale-height); centy=0.5*(uheight/scale-width); } } } else if (SCALEROT!=2 && (SCALEROT!=1 || (height>width && uheight>uwidth) || (heightuwidth/width) { // Set scale value scale=uwidth/width; // Set upper boundary if (SCALEMODE==2) upy=height*scale; } else { // Set scale value scale=uheight/height; // Set upper boundary if (SCALEMODE==2) upx=width*scale; } } else { scale=SCALEFACTOR; } if (CENTERPAGE) { centx=0.5*(uwidth/scale-width); centy=0.5*(uheight/scale-height); } } else { // Set 90 degree rotation flag rotate=1; // Check if scaling by factor if (SCALEMODE>=2) { scale=SCALEFACTOR; upx=PHEIGHT-2*XOFF; upy=PWIDTH-2*YOFF; } // Set scale to max. value else if (uheight/width>uwidth/height) { // Set scale value scale=uwidth/height; } else { // Set scale value scale=uheight/width; } if (CENTERPAGE) { if (SCALEMODE==3) { centx=0.5*(uheight/scale-height); centy=0.5*(uwidth/scale-width); } else { centx=0.5*(uwidth/scale-height); centy=0.5*(uheight/scale-width); } } } // Write file header writehead(psname,XOFF*MMTOPS,YOFF*MMTOPS, (upx+XOFF)*MMTOPS,(upy+YOFF)*MMTOPS); // Set rotation and offset switch (rotate) { // 90 degree rotation case 1 : case 2 : psm1=0.0; psm2=(-MTOMM); psm3=MTOMM; psm4=0.0; psxoff=height+YOFF/scale; psyoff=XOFF/scale; psrot=PI2; // Store mirror transformation matrix psconcaty=(2.0*height*scale+2.0*XOFF+2.0*YOFF)*MMTOPS; if (CENTERPAGE) { if (uheight/width>uwidth/height) psconcaty+=2.0*centy*scale*MMTOPS; else psconcaty+=2.0*centx*scale*MMTOPS; } break; // 180 degree rotation case 3 : psm1=(-MTOMM); psm2=0.0; psm3=0.0; psm4=(-MTOMM); psxoff=width+XOFF/scale; psyoff=height+YOFF/scale; psrot=PI; // Store mirror transformation matrix psconcaty=2.0*psyoff*scale*MMTOPS; break; // No rotation case 0 : default : psxoff=XOFF/scale; psyoff=YOFF/scale; // Store mirror transformation matrix psconcaty=(upy+2*YOFF)*MMTOPS; } psxoff+=centx; psyoff+=centy; // Check if mirrored if (((MIRROR&1)!=0)!=(MIRROR>=2)) { if (PDF) { os=FMTPDFCONCAT1; outstr(); if (psrot!=0.0) outval((upy+2.0*YOFF)*MMTOPS); else outval(psconcaty); os=FMTPDFCONCAT2; outstr(); psmirr=1; } else { if (psrot!=0.0) sprintf(os,FMTEPSCONCAT, (upy+2.0*YOFF)*MMTOPS); else sprintf(os,FMTEPSCONCAT,psconcaty); outstr(); } } // Set line widths deflinewidth=(LINEABS? LINEWIDTH/scale : LINEWIDTH); deftlinewidth=(LINEABS? TLINEWIDTH/scale : TLINEWIDTH); setscale(scale*MMTOPS); // Set layer-specific line width values for (i=0;i0.0) layfield[i].plw= (LINEABS ? layfield[i].plw/scale : layfield[i].plw); else layfield[i].plw=deflinewidth; if (layfield[i].tlw>0.0) layfield[i].tlw= (LINEABS ? layfield[i].tlw/scale : layfield[i].tlw); else layfield[i].tlw=deftlinewidth; } } else { // Write EPS file header if (PDF==2 && SCALEROT==2) { rotate=1; writehead(psname,XOFF*MMTOPS,YOFF*MMTOPS, (width+XOFF)*MMTOPS,(height+YOFF)*MMTOPS); } else if (SCALEROT==2 || (SCALEROT==1 && width>=height)) { rotate=1; writehead(psname,YOFF*MMTOPS,XOFF*MMTOPS, (height+XOFF)*MMTOPS,(width+YOFF)*MMTOPS); } else { rotate= SCALEROT==1 ? 0 : SCALEROT; writehead(psname,XOFF*MMTOPS,YOFF*MMTOPS, (width+XOFF)*MMTOPS,(height+YOFF)*MMTOPS); } // Rotate plot on request switch (rotate) { // 90 degree case 1 : case 2 : psm1=0.0; psm2=(-MTOMM); psm3=MTOMM; psm4=0.0; psxoff=height+YOFF; psyoff=XOFF; psrot=PI2; upx=height; upy=width; // Store mirror transformation matrix psconcaty=((2.0*height+2.0*XOFF+2.0*YOFF)*MMTOPS); break; // 180 degree case 3 : psm1=(-MTOMM); psm2=0.0; psm3=0.0; psm4=(-MTOMM); psxoff=width+XOFF; psyoff=height+YOFF; psrot=PI; upx=width; upy=height; // Store mirror transformation matrix psconcaty=2.0*psyoff*MMTOPS; break; // No rotation case 0 : default : psxoff=XOFF; psyoff=YOFF; upx=width; upy=height; // Store mirror transformation matrix psconcaty=(height+2.0*YOFF)*MMTOPS; } // Check if mirrored if (((MIRROR&1)!=0)!=(MIRROR>=2)) { if (PDF) { os=FMTPDFCONCAT1; outstr(); if (psrot!=0.0) outval((upy+2.0*YOFF)*MMTOPS); else outval(psconcaty); os=FMTPDFCONCAT2; outstr(); psmirr=1; } else { if (psrot!=0.0) sprintf(os,FMTEPSCONCAT, (upy+2.0*YOFF)*MMTOPS); else sprintf(os,FMTEPSCONCAT,psconcaty); outstr(); } } // Set line width deflinewidth=LINEWIDTH; deftlinewidth=TLINEWIDTH; setscale(MMTOPS); // Set default layer-specific line width values for (i=0;i0 && plname!="") curplgrpidx=findlgrpname(plname); else curplgrpidx=(-1); // Check if part annotation if (ANNOTMODE>=1 && ANNOTMODE<=3) { if (curcpflag) { an=0; forall (attr of curcpart) { // Get attribute base name attrname=attr.NAME; if (strmatch(attrname,"*\003*\003")) { len=strlen(attrname); varnum=atoi( strextract(attrname,len-3,len-1)); attrname[len-4]='\0'; } else { varnum=0; } if (varnum!=varnumber || attrname=="$llname" || (attrname=="$plname" && attr.VALUE[0]!='[')) continue; // Get upper case attribute name attruname=attrname; strupper(attruname); // Build comment variable name sprintf(attrcommn,PAR_ATTRCOMMP, strextract(attruname,1,strlen(attruname))); // Query comment variable if (varget(attrcommn,attrcommv)!=0 || attrcommv=="") // No comment available attrcommn=attrname; else // Attach comment to variable name sprintf(attrcommn,"%s %s", attrname,attrcommv); sprintf(attrdisp,REPANNOTENT,attrcommn, attr.VALUE); // Build order variable name sprintf(attrcommn,PAR_ATTRORDP, strextract(attruname,1,strlen(attruname))); // Query order variable if (varget(attrcommn,attrord)!=0) // No order id available attrord=9999; for (i=an;i>0;i--) if (al[i-1].order>attrord || (al[i-1].order==attrord && (numstrcmp(al[i-1].name,attrname)>0))) al[i]=al[i-1]; else break; // Store new attribute al[i].name=attrname; al[i].disp=attrdisp; al[i].order=attrord; an++; } for (i=0;i=2)) // Rotate annotation on request switch (rotate) { // 90 degree case 1 : case 2 : annotl[annotn].lx=width*MMTOPS/psscale- annotl[annotn].lx; annotl[annotn].ux=width*MMTOPS/psscale- annotl[annotn].ux; break; // 180 degree case 3 : annotl[annotn].ly=height*MMTOPS/psscale- annotl[annotn].ly; annotl[annotn].uy=height*MMTOPS/psscale- annotl[annotn].uy; break; // No rotation case 0 : default : annotl[annotn].ly= (psconcaty-2.0*psyoff)/ psscale-annotl[annotn].ly; annotl[annotn].uy= (psconcaty-2.0*psyoff)/ psscale-annotl[annotn].uy; } annotl[annotn].lgrpidx=curplgrpidx; annotn++; lastobj++; } // Check if part annotation if (ANNOTMODE>=4 && ANNOTMODE<=6) { if (lay_scanfelem(curfig,0.0,0.0,0.0,1,1, pinmac,NULL,NULL,NULL,NULL,NULL,NULL)!=0) error_scan(); } } } // Write top level data for all PS layers for (i=lfs;i<=lfe;i++) { // Print progress message message(PDF ? REPPDFWRLAY : REPPSWRLAY, layername(layfield[i].num)); // Get layer data pscurlay=layfield[i].num; if (pscurlay==LAYERTOP) pscurlay=toplay; pscurmode=layfield[i].mode; pspvis=layfield[i].pvis; psoutlfill=layfield[i].outlfill; psclinefill=layfield[i].clinefill; psgrpign=layfield[i].grpign; textdisp=layfield[i].textdisp; pathdisp=layfield[i].pathdisp; for (j=0;j<=L_POLYSPPAREA;j++) polydisp[j]=layfield[i].polydisp[j]; bae_setintpar(9,pspvis==0 ? 1 : 0); pscurspc=layfield[i].spc; pscurdash1=layfield[i].dash1; pscurdash2=layfield[i].dash2; pscurdash3=layfield[i].dash3; pscurdash4=layfield[i].dash4; pslinewidth=layfield[i].plw; pstlinewidth=layfield[i].tlw; PSFONTMODE=psdeffont=layfield[i].font; POWBWIDTH=layfield[i].powbw; POWPWIDTH=layfield[i].powpw; POWHWIDTH=layfield[i].powhw; POWHTDIST=layfield[i].powhtd; POWHTANG=layfield[i].powhtang; POWDRDIST=layfield[i].powdrd; pspowflag=(pscurlay>=POWLAYBASE && pscurlay<(POWLAYBASE+POWLAYMAX)) ? 1 : 0 ; pspowbit= pspowflag ? (1<<(pscurlay-POWLAYBASE)) : 0; psdrlflag= (pscurlay==LAYERDRL || (pscurlay>=LAYERDRLZ && pscurlay<=LAYERDRLD)) ? 1 : 0 ; psdrlclass=-pscurlay+LAYERDRLD; DRLDOTRAD=layfield[i].drldot; // Adjust angle to [0,180] range pscurang=fmod(cvtangle(layfield[i].angle,1,2),PI); if (pscurang<0.0) pscurang+=PI; // Write the layer group info laygrp=0; if (PDFLAYGRP) if (layfield[i].grp=="") { if ((grpidx=findlgrpnum(pscurlay))>=0) { sprintf(os,FMTPDFBOCG,grpidx); outstr(); lgrpul[grpidx]=1; laygrp=1; } } else { if ((grpidx=findlgrpname(layfield[i].grp))>=0) { sprintf(os,FMTPDFBOCGN,grpidx); outstr(); ngrpul[grpidx]=1; laygrp=1; } } // Set polygon line width outval(pslinewidth*psscale); os=FMTSETLINEWIDTH; outstr(); // Set dashed line data if (pscurdash1!=0.0) { os=FMTSETDASH1; outstr(); outval(pscurdash1*psscale); os=" "; outstr(); outval(pscurdash2*psscale); os=" "; outstr(); outval(pscurdash3*psscale); os=" "; outstr(); outval(pscurdash4*psscale); os=FMTSETDASH2; } else { os=FMTRESETDASH; } outstr(); // Initialize scan flags pstextflag=0; // Set layer RGB values sprintf(defcolor,"%.2f %.2f %.2f", layfield[i].red,layfield[i].green,layfield[i].blue); outcolor(defcolor); forcecolor=layfield[i].forcecolor; // Test if special layer if (pscurlay==(LAYERUNR)) { curpidx=curruleid=(-1); curpstkn=0; curplgrpidx=curgngrpidx=(-1); // Scan unroutes forall (net where net.PINN>1 && net.UNRPOOL>=0) { if (ged_gethighlnet(net.NUMBER,0,netcolor)==1) { netcolor=netcolor&(~(0x1FF<<5)); if (netcolor>0 && netcolor<16) curcolor=colidxstr[netcolor]; else if (netcolor>15) curcolor= bae_numstring(((netcolor& 0x0F000000)>>24)/15.0,3)+" "+ bae_numstring(((netcolor& 0x0F00000)>>20)/15.0,3)+" "+ bae_numstring(((netcolor& 0x0F0000)>>16)/15.0,3); else curcolor=defcolor; } else { curcolor=defcolor; } // Scan the unroutes pool if (lay_scanpool(net.UNRPOOL, wslx,wsly,0.0,1,1,psmac,pspoly,pspath, pstext,NULL,pslchk,NULL)!=0) error_scan(); } } else if (pspowflag) { // Scan layer data if (CLIP) { forall (curfig where chkrange(curfig) && figplotstat(curfig)) { curpidx=(-1); curpstkn=lay_getscstkcnt()+ (curfig.TYP==L_FIGNREF ? (wslx==0.0 && wsly==0.0 ? 2 : 3) : 0); if (getfigruledata()) continue; if (lay_scanfelem(curfig,wslx,wsly, 0.0,1,1,psmac,pspoly,pspath, pstext,psdrill,pslchk,NULL)!=0) error_scan(); if (PDFLAYGRP) closelaygrp(); } } else { forall (curfig where figplotstat(curfig)) { curpidx=(-1); curpstkn=lay_getscstkcnt()+ (curfig.TYP==L_FIGNREF ? (wslx==0.0 && wsly==0.0 ? 2 : 3) : 0); if (getfigruledata()) continue; if (lay_scanfelem(curfig,wslx,wsly,0.0, 1,1,psmac,pspoly,pspath,pstext, psdrill,pslchk,NULL)!=0) error_scan(); if (PDFLAYGRP) closelaygrp(); } } } else if (psdrlflag) { // Scan drill data if (CLIP) { forall (curfig where chkrange(curfig) && figplotstat(curfig)) { curpidx=(-1); curpstkn=lay_getscstkcnt()+ (curfig.TYP==L_FIGNREF ? (wslx==0.0 && wsly==0.0 ? 2 : 3) : 0); if (getfigruledata()) continue; if (lay_scanfelem(curfig, wslx,wsly,0.0,1,1,psmac,NULL,NULL, NULL,psdrill,NULL,NULL)!=0) error_scan(); if (PDFLAYGRP) closelaygrp(); } } else { forall (curfig where figplotstat(curfig)) { curpidx=(-1); curpstkn=lay_getscstkcnt()+ (curfig.TYP==L_FIGNREF ? (wslx==0.0 && wsly==0.0 ? 2 : 3) : 0); if (getfigruledata()) continue; if (lay_scanfelem(curfig,wslx,wsly,0.0, 1,1,psmac,NULL,NULL,NULL,psdrill, NULL,NULL)!=0) error_scan(); if (PDFLAYGRP) closelaygrp(); } } } else if (pscurlay==LAYERERR) { curcolor=defcolor; forall (drcerr where (drcerr.TYP&DRC_ERRHIDE)==0) write_errormarker(drcerr.TYP, drcerr.RLX,drcerr.RLY,drcerr.RUX,drcerr.RUY); } else if (pscurlay==LAYERORG) { outmoveto( bae_planwsnx()-wslx-0.005,bae_planwsny()-wsly); outlineto( bae_planwsnx()-wslx+0.005,bae_planwsny()-wsly); os=FMTSTROKE; outstr(); outmoveto( bae_planwsnx()-wslx,bae_planwsny()-wsly-0.005); outlineto( bae_planwsnx()-wslx,bae_planwsny()-wsly+0.005); os=FMTSTROKE; outstr(); } else if (pscurlay==LAYERWAR) { outmoveto(bae_planwslx()-wslx,bae_planwsly()-wsly); outlineto(bae_planwsux()-wslx,bae_planwsly()-wsly); outlineto(bae_planwsux()-wslx,bae_planwsuy()-wsly); outlineto(bae_planwslx()-wslx,bae_planwsuy()-wsly); outlineto(bae_planwslx()-wslx,bae_planwsly()-wsly); os=FMTSTROKE; outstr(); } else if (CLIP==3) { curcolor=defcolor; pscurfont=psdeffont; curpidx=curruleid=(-1); curpstkn= lay_getscstkcnt()+(wslx==0.0 && wsly==0.0 ? 2 : 3); curplgrpidx=curgngrpidx=(-1); if (lay_scanpool(pspool,wslx,wsly,0.0,1,1, psmac,pspoly,pspath,pstext,NULL,pslchk,NULL)!=0) error_scan(); } else { // Scan layer data if (CLIP) { forall (curfig where chkrange(curfig) && figplotstat(curfig)) { curpidx=(-1); curpstkn=lay_getscstkcnt()+ (curfig.TYP==L_FIGNREF ? (wslx==0.0 && wsly==0.0 ? 2 : 3) : 0); if (getfigruledata()) continue; if (lay_scanfelem(curfig,wslx,wsly, 0.0,1,1,psmac,pspoly,pspath, pstext,NULL,pslchk,NULL)!=0) error_scan(); if (PDFLAYGRP) closelaygrp(); } } else { forall (curfig where figplotstat(curfig)) { curpidx=(-1); curpstkn=lay_getscstkcnt()+ (curfig.TYP==L_FIGNREF ? (wslx==0.0 && wsly==0.0 ? 2 : 3) : 0); if (getfigruledata()) continue; if (lay_scanfelem(curfig,wslx,wsly,0.0, 1,1,psmac,pspoly,pspath,pstext, NULL,pslchk,NULL)!=0) error_scan(); if (PDFLAYGRP) closelaygrp(); } } if (layfield[i].errdisp) { // Set layer error RGB values sprintf(curcolor,"%.2f %.2f %.2f", layfield[i].ered,layfield[i].egreen, layfield[i].eblue); outcolor(curcolor); forall (drcerr where drcerr.LAYER==pscurlay && (drcerr.TYP&DRC_ERRHIDE)==0) write_errormarker(drcerr.TYP, drcerr.RLX,drcerr.RLY, drcerr.RUX,drcerr.RUY); } } // Write the layer group end if (PDF && PDFLAYGRP && laygrp) { os=FMTPDFEOCG; outstr(); } // Stop on request if (kbhit()) { getchr(); if (verify(UPRSTOP,0)) { abortflag=1; break; } } } for (i=0;i=0) { if (uliptype()==ULIPGED) { ged_getintpar(10,oldwarnmode); ged_setintpar(10,oldwarnmode|0x01); } bae_setintpar(22,2); bae_loadelem(bae_planfname(),bae_planename(),DDBCLLAY); if (uliptype()==ULIPGED) ged_setintpar(10,oldwarnmode); } } void writehead(string fn,double xs,double ys,double xe,double ye) /* // Write header to output file // Parameters : // string fn : EPS output file name // double xs,ys,xe,ye : Bounding box boundaries */ { double pwidth /* Page width */; int objbase /* Page object base */; int i /* Loop control variable */; // Check the output format if (PDF) { // Check if document start if (curopage==0) { os=PDFLAYGRP ? FMTPDFHEADL : FMTPDFHEAD; outstr(); } // Store the page offset opagesl[curopage]=opos; // Write the page data start objbase=curopage*PDFP+pageobjoff; sprintf(os,FMTPDFPAGE1A,objbase); outstr(); if (PDFCOMP) { // Write the compression info os=FMTPDFPAGE1Z; outstr(); } // Write the page length data object sprintf(os,FMTPDFPAGE1B,objbase+1); outstr(); // Store the stream start offset cursstart=opos; if (PDFCOMP) { fsetcompmode(1); compflag=1; } // Write the graphic state reference if (PDFBLEND) { os=FMTPDFPAGE1C; outstr(); } } else { if (curopage==0) { fprintf(psfh,FMTEPSHEAD); fprintf(psfh,FMTEPSTITLE,strgetvarfilename(fn)); } fprintf(psfh,FMTEPSCREATOR, bae_swversion(0),bae_planfname(),bae_planename()); if (curopage==0) { fprintf(psfh,FMTEPSCREADATE,getdatetime()); fprintf(psfh,FMTEPSPAGES,totpagen); fprintf(psfh,FMTEPSLANGLEVEL); } fprintf(psfh,FMTEPSENDCMTS); fprintf(psfh,FMTEPSPAGEBOX1); fprintf(psfh,FMTEPSPAGEBOX2,xs,ys,xe,ye); fprintf(psfh,FMTEPSPAGEBOX3); pwidth=xe-xs; if (pwidth>(A1W*MMTOPS+SIZETOL)) fprintf(psfh,FMTEPSA0MEDIA); else if (pwidth>(A2W*MMTOPS+SIZETOL)) fprintf(psfh,FMTEPSA1MEDIA); else if (pwidth>(A3W*MMTOPS+SIZETOL)) fprintf(psfh,FMTEPSA2MEDIA); else if (pwidth>(A4W*MMTOPS+SIZETOL)) fprintf(psfh,FMTEPSA3MEDIA); else fprintf(psfh,FMTEPSA4MEDIA); fprintf(psfh,FMTEPSORIENT); fprintf(psfh,FMTEPSBEGINSET); fprintf(psfh,FMTEPSBEGINFEAT); if (pwidth>(A1W*MMTOPS+SIZETOL)) { fprintf(psfh,FMTEPSA0DOC); fprintf(psfh,FMTEPSA0PAPER); } else if (pwidth>(A2W*MMTOPS+SIZETOL)) { fprintf(psfh,FMTEPSA1DOC); fprintf(psfh,FMTEPSA1PAPER); } else if (pwidth>(A3W*MMTOPS+SIZETOL)) { fprintf(psfh,FMTEPSA2DOC); fprintf(psfh,FMTEPSA2PAPER); } else if (pwidth>(A4W*MMTOPS+SIZETOL)) { fprintf(psfh,FMTEPSA3DOC); fprintf(psfh,FMTEPSA3PAPER); } else { fprintf(psfh,FMTEPSA4DOC); fprintf(psfh,FMTEPSA4PAPER); } fprintf(psfh,FMTEPSPAPERSEL); fprintf(psfh,FMTEPSENDFEAT); fprintf(psfh,FMTEPSBEGINFEAT); if (pwidth>(A1W*MMTOPS+SIZETOL)) { fprintf(psfh,FMTEPSMFEED1); fprintf(psfh,FMTEPSMFEED2); fprintf(psfh,FMTEPSENDFEAT); fprintf(psfh,FMTEPSBEGINFEAT); fprintf(psfh,FMTEPSA0DOCA); fprintf(psfh,FMTEPSA0PAPER); } else if (pwidth>(A2W*MMTOPS+SIZETOL)) { fprintf(psfh,FMTEPSMFEED1); fprintf(psfh,FMTEPSMFEED2); fprintf(psfh,FMTEPSENDFEAT); fprintf(psfh,FMTEPSBEGINFEAT); fprintf(psfh,FMTEPSA1DOCA); fprintf(psfh,FMTEPSA1PAPER); } else if (pwidth>(A3W*MMTOPS+SIZETOL)) { fprintf(psfh,FMTEPSMFEED1); fprintf(psfh,FMTEPSMFEED2); fprintf(psfh,FMTEPSENDFEAT); fprintf(psfh,FMTEPSBEGINFEAT); fprintf(psfh,FMTEPSA2DOCA); fprintf(psfh,FMTEPSA2PAPER); } else if (pwidth>(A4W*MMTOPS+SIZETOL)) { fprintf(psfh,FMTEPSMFEED1); fprintf(psfh,FMTEPSMFEED2); fprintf(psfh,FMTEPSENDFEAT); fprintf(psfh,FMTEPSBEGINFEAT); fprintf(psfh,FMTEPSA3DOCA); fprintf(psfh,FMTEPSA3PAPER); } else { fprintf(psfh,FMTEPSA4DOCA); fprintf(psfh,FMTEPSA4PAPER); } fprintf(psfh,FMTEPSPAPERSEL); fprintf(psfh,FMTEPSENDFEAT); if (fabs(PWIDTH-A0W)=0) { sprintf(os,FMTPDFPREV,prevpage*PDFP+pageobjoff+3); outstr(); } if (nextpage>=0) { sprintf(os,FMTPDFNEXT,nextpage*PDFP+pageobjoff+3); outstr(); } sprintf(os,FMTPDFPAGE9,parent==(-1) ? 6 : (parent+outlobjoff)); outstr(); for (i=0;i=0) { sprintf(os,FMTPDFPAGE12, PDFN+annotl[i].lgrpidx+lgrpn+2); outstr(); } sprintf(os,FMTPDFPAGE13,convstr(annotl[i].text), convstr(annotl[i].title)); outstr(); } annotn=0; } else { // Write the EPS trailer fprintf(psfh,FMTEPSENDDOC); fprintf(psfh,FMTEPSFOOT); } } void writetrailer(int varflag,int pagen) /* // Write trailer to output file // Parameters : // int varflag : Variant PDF flag // int pagen : Single variant page count */ { string grpname /* Group name */; int sec,min,hour /* Time values */; int day,month,year /* Date values */; int weekday,yearday /* Day values */; int grpopos /* Layer group offset */; int xref /* Reference table offset */; int cl[] /* Catalog object list */; int cn = 0 /* Catalog element count */; int first /* First item flag */; int firstaction /* First action item flag */; int firstldis /* First layer disabled item flag */; char c /* Character buffer */; int i, j /* Loop control variables */; // Check if PDF output if (PDF) { // Write the root object pdfobjpos[PDFOBJROOT]=opos; os=FMTPDFROOT1; outstr(); sprintf(os,FMTPDFROOT2,pageobjoff+2); outstr(); os=FMTPDFROOT3; outstr(); os= PDFFIT ? FMTPDFROOT3D : FMTPDFROOT3P; outstr(); // Write the layer group info if (PDFLAYGRP) { sprintf(os,FMTPDFLGRPG1,PDFN+1); outstr(); // Scan zoom dependant grid groups first=firstaction=1; for (i=0;i0) { sprintf(os,FMTPDFPREV,outlobjoff+i-1); outstr(); } if (i<(varn-1)) { sprintf(os,FMTPDFNEXT,outlobjoff+i+1); outstr(); } sprintf(os,FMTPDFOUTLT, pageobjoff+i*pagen*PDFP+3, pageobjoff+(i*pagen+pagen-1)*PDFP+3,pagen); outstr(); sprintf(os,FMTPDFPAGE9,6); outstr(); } cn=varn; } else { sprintf(os,FMTPDFOUTL1,curopage); outstr(); sprintf(os,FMTPDFOUTL2,pageobjoff+3, pageobjoff+3+(curopage-1)*PDFP); outstr(); } // Write the graphic state object pdfobjpos[PDFOBJGSTATE]=opos; os=FMTPDFGSTATE1+FMTPDFGSTATE2; outstr(); if (PDFLAYGRP) { grpopos=opos; sprintf(os,FMTPDFLGRPO1,PDFN+1); outstr(); for (i=0;i=0) { sprintf(tbuf,REPANNOTENT,REPNET, cpin.CNET.NAME); ptext+="\n"+tbuf; } sprintf(tbuf,REPANNOTENT, REPPADSTACK,macro.NAME); ptext+="\n"+tbuf; forall (attr of cpin where attr.NAME!="$llname" && attr.NAME!="$net") { sprintf(tbuf,REPANNOTENT,attr.NAME, attr.VALUE); ptext+="\n"+tbuf; } } else { sprintf(tbuf,REPANNOTENT, REPPADSTACK,macro.NAME); ptext+="\n"+tbuf; } lay_maccoords(px,py,0.0,0,0); w=macro.MUX-macro.MLX; h=macro.MUY-macro.MLY; if (w>h) w=h; annotl[annotn].obj=lastobj; annotl[annotn].title=atitle; annotl[annotn].text=atext+"\n"+ptext; annotl[annotn].lx=px-0.5*w-wslx; annotl[annotn].ly=py-0.5*w-wsly; annotl[annotn].ux=px+0.5*w-wslx; annotl[annotn].uy=py+0.5*w-wsly; annotl[annotn].lgrpidx=curplgrpidx; annotn++; lastobj++; } break; } // Abort scan return(0); } int padpoly(index L_POLY poly,int layer, int polyinws,int tree,index L_LEVEL level) /* // Output an already transformed polygon data block to PS file // Return value : // zero if done or (-1) on error // Parameters : // index L_POLY poly : Polygon // int layer : Polygon layer // int polyinws : Poly in workspace flag // int tree : Polygon tree number // index L_LEVEL level : Polygon level */ { // Test if the polygon type is valid if (poly.TYP!=L_POLYCOPPASS) return(0); if (layer==LAYERALL) { annotmatch=1; return(-1); } if (layer==0 && (ANNOTMODE==2 || ANNOTMODE==3 || ANNOTMODE==5 || ANNOTMODE==6)) { annotmatch=1; return(-1); } if (layer==toplay && (ANNOTMODE==1 || ANNOTMODE==3 || ANNOTMODE==4 || ANNOTMODE==6)) { annotmatch=1; return(-1); } // Return without errors return(0); } int padlchk(int layer) /* // PostScript layer output check routine // Return value : // zero if scan break requested, 1 if scan allowed // Parameters : // int layer : Layer code */ { // Enable if signal layer and layer equal all-layer if (layer==LAYERALL || layer==0 || layer==toplay) return(1); // No layer of interest return(0); } int psmac(index L_MACRO macro,index L_POOL pool, int macinws,string refname,index L_LEVEL level) /* // PS layer data output macro function // Return value : // 0 if out of workspace, 1 if inside, 2 if unknown, or (-1) on error // Parameters : // index L_MACRO macro : Macro index // index L_POOL pool : Macro pool index // int macinws : Macro in workspace flag // string refname : Macro reference name // index L_LEVEL level : Macro level */ { if (macro.CLASS==DDBCLLSTK) // Update padstack index curpidx++; // Continue scan return(1); } int pspoly(index L_POLY poly,int layer, int polyinws,int tree,index L_LEVEL level) /* // Output an already transformed polygon data block to PS file // Return value : // zero if done or (-1) on error // Parameters : // index L_POLY poly : Polygon // int layer : Polygon layer // int polyinws : Poly in workspace flag // int tree : Polygon tree number // index L_LEVEL level : Polygon level */ { string rulename /* Rule name */; int pstkdis /* Padstack disable flag */; index L_POINT point /* Polygon point */; struct ptdes lpoint /* Last output point */; struct ptdes cpoint /* Current output point */; struct ptdes npoint /* Next output point */; struct ptdes tpoints[] /* Test points */; double rx,ry /* Radius vector */; double r /* Radius */; double ang1,ang2 /* Arc angles */; double polyxmin /* Polygon lower X boundary */; double polyymin /* Polygon lower Y boundary */; double polyxmax /* Polygon upper X boundary */; double polyymax /* Polygon upper Y boundary */; double rlinewidth = poly.WIDTH /* Requested plot line width */; int rdashmode = poly.MVIS&0x0C /* Requested plot dash mode */; int powtree = (-1) /* Power plane tree number */; int shiftflag /* Coordinate shift flag */; string elemcolor /* Element color */; int netcolor /* Net color index */; int polytree /* Polygon tree number */; int polytyp = poly.TYP /* Polygon type */; int pn = poly.PN /* Polygon point count */; int i /* Loop variable */; // Check if disabled padstack (double drill mark) */ if (curruleid>=0 && layer>=DOCLAYBASE && lay_getscstkcnt()>=curpstkn && curpidx>=0) { sprintf(rulename,RS_PSTKDDFLAG,curpidx); if (lay_rulequery(RS_OCFIG,curfig,RS_PCBSUBJ, rulename,"?d",pstkdis)>0 && pstkdis) // Padstack disabled return(0); } // Check if disabled class level if (polytyp>0 && polytyp<=L_POLYMAX && (polydisp[polytyp]&(1<=0 || curgngrpidx>=0) openlaygrp(); // Test if the polygon type is valid switch (polytyp) { // Documentary line case L_POLYDOCLINE : // Check if wide line plot requested if (rlinewidth!=0.0) { // Set line width outval(rlinewidth*psscale); os=FMTSETLINEWIDTH; outstr(); } if (rdashmode) rdashmode|=2; break; // Copper case L_POLYCOPPASS : // Connected copper case L_POLYCOPACT : break; // Documentary area case L_POLYDOCAREA : // Check if rule assignment area if (layer=0 && ged_gethighlnet(polytree,0,netcolor)==1) { netcolor=netcolor&(~(0x1FF<<5)); if (netcolor>0 && netcolor<16) elemcolor=colidxstr[netcolor]; else if (netcolor>15) elemcolor= bae_numstring(((netcolor&0x0F000000)>>24)/15.0,3)+" "+ bae_numstring(((netcolor&0x0F00000)>>20)/15.0,3)+" "+ bae_numstring(((netcolor&0x0F0000)>>16)/15.0,3); } if (elemcolor!=defcolor) outcolor(elemcolor); // Check if dash line output if ((rdashmode&0x0C)!=0) { // Override layer dash line values if (pscurdash1!=0.0) { os=FMTRESETDASH; pstextflag=1; outstr(); } bae_clearpoints(); for (i=0;i=0.5 ? 0.0 : poly.DASHSPC,psline,psarc)) // Vectorization failed return(-1); // Restore original dash line values if (pscurdash1!=0.0) { os=FMTSETDASH1; outstr(); outval(pscurdash1*psscale); os=" "; outstr(); outval(pscurdash2*psscale); os=" "; outstr(); outval(pscurdash3*psscale); os=" "; outstr(); outval(pscurdash4*psscale); os=FMTSETDASH2; outstr(); pstextflag=0; } // Check if plot width changed if (rlinewidth!=0.0) { // Restore polygon line width outval(pslinewidth*psscale); os=FMTSETLINEWIDTH; outstr(); } // Restore element color if (elemcolor!=defcolor) outcolor(defcolor); // Output done return(0); } else if (pstextflag && !pscurmode && pscurdash1!=0.0) { // Restore original dash line values os=FMTSETDASH1; outstr(); outval(pscurdash1*psscale); os=" "; outstr(); outval(pscurdash2*psscale); os=" "; outstr(); outval(pscurdash3*psscale); os=" "; outstr(); outval(pscurdash4*psscale); os=FMTSETDASH2; outstr(); pstextflag=0; } // Polygon output // Check if first point arc center shiftflag=(tpoints[0].typ!=0)?1:0; // Set last point pointer to end of point list lpoint=tpoints[shiftflag?0:pn-1]; // Store the polygon point list for (i=0;i=0) { // Close polygon os=FMTCLOSEPATH+FMTSTROKE; outstr(); // Restore line width if power layer or wide line plot if (pspowflag || rlinewidth!=0.0) { outval(pslinewidth*psscale); os=FMTSETLINEWIDTH; outstr(); } break; } // Close polygon os=FMTCLOSEPATH; outstr(); // Check fill mode if (pscurmode) { // Simple area fill os=FMTFILL; outstr(); break; } // Check hatching mode if (pscurspc==0.0) { // Draw only outline os=FMTSTROKE; outstr(); break; } // Scan area range bae_clearpoints(); for (i=0;i=0 || curgngrpidx>=0) openlaygrp(); // Copy points to array i=0; forall (point of path) { tpoints[i].x=point.X; tpoints[i].y=point.Y; tpoints[i++].typ=point.TYP; } // Query the color if (lay_rulequery(RS_OCPOOL,path,RS_PCBSUBJ, RS_PLOTRGB,"?s",elemcolor)<1 || chkcolor(elemcolor,0.0,0.0,0.0)) elemcolor=curcolor; // Get the tree number from level if (psnetcol && (pathtree=lay_getlevtreenum(level))>=0 && ged_gethighlnet(pathtree,0,netcolor)==1) { netcolor=netcolor&(~(0x1FF<<5)); if (netcolor>0 && netcolor<16) elemcolor=colidxstr[netcolor]; else if (netcolor>15) elemcolor= bae_numstring(((netcolor&0x0F000000)>>24)/15.0,3)+" "+ bae_numstring(((netcolor&0x0F00000)>>20)/15.0,3)+" "+ bae_numstring(((netcolor&0x0F0000)>>16)/15.0,3); } if (elemcolor!=defcolor) outcolor(elemcolor); // Get transformed path width pwidth=path.WIDTH; // Path output // Check if simple fill draw if (pscurmode) { // Set line width to path width outval(pwidth*psscale); os=FMTSETLINEWIDTH; outstr(); // Set last point to first for arc backward check lpoint=tpoints[0]; // Write the path point list for (i=0;ilpoint.x) { psegxmax=cpoint.x+pwidth; psegxmin=lpoint.x-pwidth; } else { psegxmax=lpoint.x+pwidth; psegxmin=cpoint.x-pwidth; } if (cpoint.y>lpoint.y) { psegymax=cpoint.y+pwidth; psegymin=lpoint.y-pwidth; } else { psegymax=lpoint.y+pwidth; psegymin=cpoint.y-pwidth; } } else { // Write path arc segment npoint=tpoints[i+1]; // Get radius vector rx=npoint.x-cpoint.x; ry=npoint.y-cpoint.y; r=sqrt(rx*rx+ry*ry); // Get the arc angles ang1=atan2(ry,rx); ang2= atan2(lpoint.y-cpoint.y,lpoint.x-cpoint.x); // Get the inner radius scale factor rfac=(r-0.5*pwidth)/r; // Skip to first point outmoveto(cpoint.x+rx*rfac,cpoint.y+ry*rfac); // Write inner arc outarc(cpoint.x,cpoint.y,r-0.5*pwidth, ang1+psrot,ang2+psrot,cpoint.typ==2 ? 0 : 1); // Write segment end arc outarc(lpoint.x,lpoint.y,0.5*pwidth, ang2+psrot+PI,ang2+psrot, cpoint.typ==2 ? 1 : 0); // Write outer arc outarc(cpoint.x,cpoint.y,r+0.5*pwidth, ang2+psrot,ang1+psrot,cpoint.typ==2 ? 1 : 0); // Write segment end arc outarc(npoint.x,npoint.y,0.5*pwidth,ang1+psrot, ang1+psrot+PI,cpoint.typ==2 ? 1 : 0); os=FMTCLOSEPATH; outstr(); // Set path segment boundary psegxmin=cpoint.x-r-pwidth; psegxmax=cpoint.x+r+pwidth; psegymin=cpoint.y-r-pwidth; psegymax=cpoint.y+r+pwidth; } // Set last point lpoint=cpoint; // Check hatching mode if (pscurspc==0.0) { // Draw simple area outline os=FMTSTROKE; outstr(); } else { // Hatch polygon hatchrect( psegxmin,psegymin,psegxmax,psegymax); } } } // Check if line width reset required if (pscurmode) { outval(pslinewidth*psscale); os=FMTSETLINEWIDTH; outstr(); } // Restore element color if (elemcolor!=defcolor) outcolor(defcolor); // Return without errors return(0); } int pstext(index L_TEXT textp,double tx,double ty,double tangle, int mirrflag,int layer,double tsize,string tstr,int textinws) /* // Vectorize a text data block // Return value : // zero if done or (-1) on error // Parameters : // index L_TEXT textp : Text index // double tx : Text X coordinate // double ty : Text Y coordinate // double tangle : Text rotation angle // int mirrflag : Text mirror flag // int layer : Text layer code // double tsize : Text size // string tstr : Text string // int textinws : Text in workspace flag */ { index L_FIGURE fig /* Figure list index */; string otstr /* Output text string */; string rulename /* Rule name */; int pstkdis /* Padstack disable flag */; string attrname /* Attribute name */; int prow /* Part entry list row */; int pidx /* Part entry list index */; int partidx /* Part index */; int tlen /* Text string length */; double folen /* Text frame original length */; double flen /* Text frame length */; double vx,vy /* Text angle vector */; double ftx,fty /* Text frame top vector */; double frx,fry /* Text frame right vector */; double sina,cosa /* Angle trig. values */; double rang /* Rotation corrected angle */; double rlinewidth = textp.WIDTH /* Requested plot line width */; double sl /* Text scan length */; double d /* Double value */; char c /* Character buffer */; char nc /* Next character buffer */; int negrange /* Negative range pending flag */; int mmatflag = 0 /* Mirror text matrix flag */; int laymirr /* Layer mirroring mode */; int mirrxchar /* Mirror chars. at x-axis flag */; int mirrychar /* Mirror chars. at y-axis flag */; int negflag /* Negated text flag */; int cnegflag /* Charcter negated text flag */; int flipframe /* Flip frame flag */; index L_POOL pool /* Pool index */; string elemcolor /* Element color */; int elemfont /* Element font mode */; string mtext[] /* Multiline text buffers */; int mrow /* Multiline text row */; int row /* Current text row */; int col /* Current text column */; int maxcol /* Max. text column */; string mtextid /* Multiline text ID */; string textid /* Current text ID */; int textmode = textp.MODE /* Text mode */; int i /* Loop control variable */; // Abort scan if empty string if (tstr=="" || tstr=="/" || tsize<=SMALLTEXT) return(0); // Check if disabled padstack (double drill mark) */ if (curruleid>=0 && layer>=DOCLAYBASE && lay_getscstkcnt()>=curpstkn && curpidx>=0) { sprintf(rulename,RS_PSTKDDFLAG,curpidx); if (lay_rulequery(RS_OCFIG,curfig,RS_PCBSUBJ, rulename,"?d",pstkdis)>0 && pstkdis) // Padstack disabled return(0); } // Check if disabled class level if ((textdisp&(1<0 && mtextid!="" && lay_rulequery(RS_OCPOOL,textp, RS_PCBSUBJ,RS_MTEXTCOL,"?d",col)>0 && lay_rulequery(RS_OCPOOL,textp, RS_PCBSUBJ,RS_MTEXTROW,"?d",mrow)>0) { // Check if start of multiline text if (col!=0) return(0); // Scan all related multiline texts maxcol=(-1); forall (pool where pool.TYP==18 && lay_rulequery(RS_OCPOOL,pool,RS_PCBSUBJ, RS_MTEXTID,"?s",textid)>0 && textid==mtextid && lay_rulequery(RS_OCPOOL,pool, RS_PCBSUBJ,RS_MTEXTROW,"?d",row)>0 && mrow==row && lay_rulequery(RS_OCPOOL,pool, RS_PCBSUBJ,RS_MTEXTCOL,"?d",col)>0) { mtext[col]=pool.TEXT.STR; if (col>maxcol) maxcol=col; } tstr=mtext[0]; for (i=1;i<=maxcol;i++) tstr+=mtext[i]; } else if (tstr==ATTRPDFPAGE) { sprintf(tstr,"%d",curopage+1); } else if (tstr==ATTRPDFPAGEN) { sprintf(tstr,"%d",totpagen); } else if (tstr==ATTRPDFPPAGE) { sprintf(tstr,"%d",partpageidx+1); } else if (tstr==ATTRPDFPPAGEN) { sprintf(tstr,"%d",partpagen); } else if (pspoolflag && tstr[0]=='$' && (attrname=attrindex(tstr,prow,0.0,0))!="") { if ((pidx=(prow+partoff))>=pentryn) return(0); if (attrname=="$") { tstr=pentryl[pidx].nlist; if (partnamecase==1) strupper(tstr); else if (partnamecase==2) strlower(tstr); } else if (attrname==ATTRPDFPSIDE) { strlower(tstr=pentryl[pidx].nlist); if (lay_nrefsearch(tstr,fig)) tstr=ITMUNPLACED; else if (fig.MIRROR) tstr=ITMBOTTOM; else tstr=ITMTOP; } else if (attrname==ATTRPDFPLSEP) { if ((pidx+1)=0 || curgngrpidx>=0) openlaygrp(); // Query the color if (lay_rulequery(RS_OCPOOL,textp,RS_PCBSUBJ, RS_PLOTRGB,"?s",elemcolor)<1 || chkcolor(elemcolor,0.0,0.0,0.0)) elemcolor=curcolor; if (elemcolor!=defcolor) outcolor(elemcolor); // Check if wide line plot requested if (rlinewidth!=0.0) { // Set requested line width outval(rlinewidth*psscale); os=FMTSETLINEWIDTH; outstr(); } else if (pstlinewidth!=pslinewidth) { // Set standard text line width outval(pstlinewidth*psscale); os=FMTSETLINEWIDTH; outstr(); } // Draw the attribute line if (psline(tx,ty,tx+partsepw*cos(tangle), ty+partsepw*sin(tangle))) // Line draw failed return(-1); // Restore polygon line width if (rlinewidth!=0.0 || pstlinewidth!=pslinewidth) { outval(pslinewidth*psscale); os=FMTSETLINEWIDTH; outstr(); } // Restore element color if (elemcolor!=defcolor) outcolor(defcolor); return(0); } else if (pentryl[pidx].first) { partidx=pentryl[pidx].partidx; if (attrname==ATTRPDFPLPOS) { sprintf(tstr,"%d",partidx+1); } else if (attrname==ATTRPDFPLCNT) { sprintf(tstr,"%d",partl[partidx].namen); } else { tstr=""; for (i=0;i=0 || curgngrpidx>=0) openlaygrp(); // Query the color if (lay_rulequery(RS_OCPOOL,textp,RS_PCBSUBJ, RS_PLOTRGB,"?s",elemcolor)<1 || chkcolor(elemcolor,0.0,0.0,0.0)) elemcolor=curcolor; if (elemcolor!=defcolor) outcolor(elemcolor); // Get the layer mirror mode laymirr=MIRROR>>1; // Check if postscript font if (elemfont) { // Check if attribute line display if (lay_getsctextdest(vx,vy)==1) { // Check if wide line plot requested if (rlinewidth!=0.0) { // Set requested line width outval(rlinewidth*psscale); os=FMTSETLINEWIDTH; outstr(); } else if (pstlinewidth!=pslinewidth) { // Set standard text line width outval(pstlinewidth*psscale); os=FMTSETLINEWIDTH; outstr(); } // Draw the attribute line if (psline(tx,ty,vx,vy)) // Line draw failed return(-1); // Restore polygon line width if (rlinewidth!=0.0 || pstlinewidth!=pslinewidth) { outval(pslinewidth*psscale); os=FMTSETLINEWIDTH; outstr(); } } // Get the text length otstr=textstrextract(tstr,tlen,negflag,cnegflag); // Correct text length according to font folen=tlen; flen=text_length(otstr,elemfont); // Adjust angle to [0,2*PI[ while (tangle<0.0) tangle+=2.0*PI; while (tangle>=2.0*PI) tangle-=2.0*PI; // Get the text angle vector vx=cos(tangle)*tsize; vy=sin(tangle)*tsize; if (textmode&TEXTHCENT) { d=0.5*(folen-flen)*PSFONTASP; tx+=vx*d; ty+=vy*d; } // Correct the text origin if mirroring is required if (mirrflag && (textmode&TEXTOMSK)!=TEXTPHYS) { tx+=vy; ty-=vx; } if (laymirr==1) { if (mirrflag && (textmode&TEXTOMSK)==TEXTPHYS) { tx+=vy; ty-=vx; } else { tx-=vy; ty+=vx; } } // Check if character mirroring is required mirrxchar= (textmode&TEXTOMSK)==TEXTPHYS ? mirrflag : 0 ; // Check if layer mirroring is required mirrxchar= laymirr==1 ? (!mirrxchar) : mirrxchar ; mirrychar= laymirr==2 ; // Adjust the logical text readability if ((textmode&TEXTOMSK)!=TEXTPHYS && ((laymirr!=0 && (tangle-PI2)>=(-SMALLANG) && (tangle-3.0*PI2)<(-SMALLANG)) || (laymirr==0 && (tangle-PI2)>SMALLANG && (tangle-3.0*PI2)<=SMALLANG))) { // Get text diagonal coordinates d=flen*PSFONTASP; tx+=vx*d-vy; ty+=vy*d+vx; // Rotate text tangle+=PI; // Adjust angle to [0,2*PI[ while (tangle<0.0) tangle+=2.0*PI; while (tangle>=2.0*PI) tangle-=2.0*PI; // Get the new text angle vector vx=cos(tangle)*tsize; vy=sin(tangle)*tsize; if (laymirr==1) { tx-=2.0*vy; ty+=2.0*vx; } flipframe=1; } else { flipframe=0; } // Mirror the text if necessary if (mirrxchar) { // Request mirror matrix mmatflag=1; // Mirror angle tangle=2.0*PI-tangle; // Adjust angle to [0,2*PI[ while (tangle<0.0) tangle+=2.0*PI; while (tangle>=2.0*PI) tangle-=2.0*PI; // Get the new text angle vector vx=cos(tangle)*tsize; vy=sin(tangle)*tsize; // Avoid double text shifting if (mirrychar) ty-=2.0*vy*flen*PSFONTASP; } if (mirrychar) { d=flen*PSFONTASP; tx+=vx*d; ty+=vy*d; tangle=PI-tangle; // Adjust angle to [0,2*PI[ while (tangle<0.0) tangle+=2.0*PI; while (tangle>=2.0*PI) tangle-=2.0*PI; // Get the new text angle vector vx=cos(tangle)*tsize; vy=sin(tangle)*tsize; // Toggle mirror matrix state mmatflag=!mmatflag; } // Check if size change if (!PDF && tsize!=psfontsize) { // Store the new font size psfontsize=tsize; // Write the font selection command sprintf(os,FMTFONT1,elemfont); outstr(); outval(psfontsize*psscale*FONTSCALE); os=FMTFONT2; outstr(); } // Check if mirror matrix requested if (mmatflag) { os=FMTGSAVE; outstr(); if (PDF) { if (psrot==PI2) { os=FMTPDFCONCAT1R; outstr(); } else { os=FMTPDFCONCAT1; outstr(); outval(psconcaty); } os=FMTPDFCONCAT2; outstr(); } else { if (psrot==PI2) os=FMTEPSCONCATR; else sprintf(os,FMTEPSCONCAT,psconcaty); outstr(); } ty=(psconcaty-2.0*psyoff)/psscale-ty; } // Avoid the 90/270 degree text mirroring problem // in the Acrobat Reader if (psmirr && PDF && (fabs(tangle-PI/2.0)<0.001 || fabs(tangle-3.0*PI/2.0)<0.001)) tangle+=0.001; // Get the new text angle vector vx=cos(tangle)*tsize; vy=sin(tangle)*tsize; // Get the frame side vectors ftx=(-vy); fty=vx; frx=vx*PSFONTASP; fry=vy*PSFONTASP; // Check if negation lines if (negflag || cnegflag) { // Check if dash line change needed if (!pstextflag && !pscurmode && pscurdash1!=0.0) { // Set undashed line os=FMTRESETDASH; outstr(); pstextflag=1; } // Set line width according to text stroke width outval(tsize*fontstroke*psscale); os=FMTSETLINEWIDTH; outstr(); } // Check if negated string if (negflag) { outmoveto(tx+ftx,ty+fty); outlineto(tx+flen*frx+ftx,ty+flen*fry+fty); os=FMTSTROKE; outstr(); } if (cnegflag) { sl=0.0; negrange=0; for (i=0;(c=tstr[i])!='\0';i++) if (c=='\\' && ((nc=tstr[i+1])=='/' || nc=='(' || (negrange && nc==')'))) { if (nc!=')') outmoveto( tx+sl*frx+ftx,ty+sl*fry+fty); if (nc!='(') { d=sl; if (nc!=')') d+=charwidth( tstr[i+2],elemfont); outlineto( tx+d*frx+ftx,ty+d*fry+fty); os=FMTSTROKE; outstr(); } i++; negrange= nc=='(' ? 1 : 0 ; } else { sl+=charwidth(c,elemfont); } } if (negflag || cnegflag) { // Restore polygon line width outval(pslinewidth*psscale); os=FMTSETLINEWIDTH; outstr(); } // Check if first frame output if (textmode&TEXTFRM1) { // Set line width according to text stroke width outval(tsize*fontstroke*psscale); os=FMTSETLINEWIDTH; outstr(); // Draw the frame outmoveto( tx-FRM1XOFF*frx-FRM1YOFF*ftx, ty-FRM1XOFF*fry-FRM1YOFF*fty); outlineto( tx+(flen+FRM1XOFF)*frx-FRM1YOFF*ftx, ty+(flen+FRM1XOFF)*fry-FRM1YOFF*fty); if (flipframe && (textmode&TEXTOFRM)) { os=FMTSTROKE; outstr(); outmoveto( tx+(flen+FRM1XOFF)*frx+(1.0+FRM1YOFF)*ftx, ty+(flen+FRM1XOFF)*fry+(1.0+FRM1YOFF)*fty); } else { outlineto( tx+(flen+FRM1XOFF)*frx+(1.0+FRM1YOFF)*ftx, ty+(flen+FRM1XOFF)*fry+(1.0+FRM1YOFF)*fty); } outlineto( tx-FRM1XOFF*frx+(1.0+FRM1YOFF)*ftx, ty-FRM1XOFF*fry+(1.0+FRM1YOFF)*fty); if (flipframe || !(textmode&TEXTOFRM)) outlineto( tx-FRM1XOFF*frx-FRM1YOFF*ftx, ty-FRM1XOFF*fry-FRM1YOFF*fty); os=FMTSTROKE; outstr(); } // Check if second frame output if (textmode&TEXTFRM2) { // Set line width according to text stroke width outval(tsize*fontstroke*psscale); os=FMTSETLINEWIDTH; outstr(); // Draw the frame outmoveto( tx-FRM2XOFF*frx-FRM2YOFF*ftx, ty-FRM2XOFF*fry-FRM2YOFF*fty); outlineto( tx+(flen+FRM2XOFF)*frx-FRM2YOFF*ftx, ty+(flen+FRM2XOFF)*fry-FRM2YOFF*fty); if (flipframe && (textmode&TEXTOFRM)) { os=FMTSTROKE; outstr(); outmoveto( tx+(flen+FRM2XOFF)*frx+(1.0+FRM2YOFF)*ftx, ty+(flen+FRM2XOFF)*fry+(1.0+FRM2YOFF)*fty); } else { outlineto( tx+(flen+FRM2XOFF)*frx+(1.0+FRM2YOFF)*ftx, ty+(flen+FRM2XOFF)*fry+(1.0+FRM2YOFF)*fty); } outlineto( tx-FRM2XOFF*frx+(1.0+FRM2YOFF)*ftx, ty-FRM2XOFF*fry+(1.0+FRM2YOFF)*fty); if (flipframe || !(textmode&TEXTOFRM)) outlineto( tx-FRM2XOFF*frx-FRM2YOFF*ftx, ty-FRM2XOFF*fry-FRM2YOFF*fty); os=FMTSTROKE; outstr(); } // Check if PDF output if (PDF) { // Check if rotated text if (fabs(tangle+psrot)>0.0001) { // Write the text position with rotation sprintf(os,FMTPDFTEXT1,elemfont, tsize*psscale*FONTSCALE); outstr(); rang=tangle+psrot; sina=sin(rang); cosa=cos(rang); outval(cosa); os=" "; outstr(); outval(sina); os=" "; outstr(); outval(-sina); os=" "; outstr(); outval(cosa); os=" "; outstr(); outxy(tx+fontbase*ftx,ty+fontbase*fty); os=FMTPDFTROT; outstr(); } else { // Write the text position with cor. baseline sprintf(os,FMTPDFTEXT1,elemfont, tsize*psscale*FONTSCALE); outstr(); outxy(tx+fontbase*ftx,ty+fontbase*fty); os=FMTPDFTEXT2; outstr(); } } else { // Write the text position with corrected baseline outmoveto(tx+fontbase*ftx,ty+fontbase*fty); if (fabs(tangle+psrot)>0.0001) { os=FMTGSAVE; outstr(); outval(cvtangle(tangle+psrot,0,1)); os=FMTROTON; outstr(); } } // Write the text string sprintf(os,PDF ? FMTPDFTEXT3 : FMTTEXT,convstr(otstr)); outstr(); if (PDF) { // Close text object os=FMTPDFTEXT4; outstr(); } else if (fabs(tangle+psrot)>0.0001) { // Reset rotation os=FMTGRESTORE; outstr(); } if (mmatflag) { os=FMTGRESTORE; outstr(); } } else { // Check if wide line plot requested if (rlinewidth!=0.0) { // Set requested line width outval(rlinewidth*psscale); os=FMTSETLINEWIDTH; outstr(); } else if (pstlinewidth!=pslinewidth) { // Set standard text line width outval(pstlinewidth*psscale); os=FMTSETLINEWIDTH; outstr(); } // Check if attribute line display if (lay_getsctextdest(vx,vy)==1) // Draw the attribute line if (psline(tx,ty,vx,vy)) // Line draw failed return(-1); // Vectorize the text (if not empty string) if (lay_vecttext(tx,ty,tangle,mirrflag,tsize, (textmode&TEXTOMSK)==TEXTPHYS,laymirr,textmode,tstr,psline)) // Vectorization failed return(-1); // Restore polygon line width if (rlinewidth!=0.0 || pstlinewidth!=pslinewidth) { outval(pslinewidth*psscale); os=FMTSETLINEWIDTH; outstr(); } } // Restore element color if (elemcolor!=defcolor) outcolor(defcolor); // Return without errors return(0); } int psdrill(index L_DRILL drill,double x,double y, int drillinws,int tree,index L_LEVEL level) /* // Process drill for power layer output // Return value : // zero if done or (-1) on error // Parameters : // index L_DRILL drill : Drill data block // double x : Drill X coordinate // double y : Drill Y coordinate // int drillinws : Drill in workspace flag // int tree : Drill tree number // index L_LEVEL level : Drill level */ { index L_NREF nref /* Named reference index */; string rulename /* Rule name */; int pstkdis /* Padstack disable flag */; double dx,dy /* Drill scaled output coords. */; double drad /* Drill scaled radius */; int drltree /* Drill tree number */; int drlhtmask /* Drill heat trap mask */; int drlplmask /* Drill power layer mask */; int drlclass /* Drill class */; string elemcolor /* Element color */; // Check if disabled padstack (double drill mark) */ if (curruleid>=0 && curpidx>=0) { sprintf(rulename,RS_PSTKDDFLAG,curpidx); if (lay_rulequery(RS_OCFIG,curfig,RS_PCBSUBJ, rulename,"?d",pstkdis)>0 && pstkdis) // Padstack disabled return(0); } // Get the tree number from level if ((drltree=lay_getlevtreenum(level))<0) // Invalid level tree, use supplied tree drltree=tree; // Get PostScript coordinates dx=x; dy=y; drad=drill.RAD; // Check if drill hole scan if (psdrlflag) { // Get the effective drill class drlclass= ((drill.CLASS&DRLCMIRR) && (nref=lay_getscpartrpidx())>=0 && nref.MIRROR) ? (drill.CLASS&DRLCMASK2)>>DRLCSHFT2 : drill.CLASS&DRLCMASK1 ; // Check if drill class specific output if (pscurlay!=LAYERDRL && drlclass!=psdrlclass) return(0); // Open element specific layer content group if (curplgrpidx>=0 || curgngrpidx>=0) openlaygrp(); // Query the color if (lay_rulequery(RS_OCPOOL,drill,RS_PCBSUBJ, RS_PLOTRGB,"?s",elemcolor)<1 || chkcolor(elemcolor,0.0,0.0,0.0)) elemcolor=curcolor; if (elemcolor!=defcolor) outcolor(elemcolor); // Write drill hole write_drillhole(dx,dy,drad,drlclass,drill); // Restore element color if (elemcolor!=defcolor) outcolor(defcolor); // Done return(0); } // Query the drill power layer mask if (lay_rulequery(RS_OCPOOL,drill,RS_PCBSUBJ,RS_DRLPOWLMASK,"?d", drlplmask)<1) // Set default power layer mask drlplmask=0; // Check if drill crosses power layer if (drlplmask&pspowbit) // Done return(0); // Query the color if (lay_rulequery(RS_OCPOOL,drill,RS_PCBSUBJ, RS_PLOTRGB,"?s",elemcolor)<1 || chkcolor(elemcolor,0.0,0.0,0.0)) elemcolor=curcolor; // Check if heat trap or isolated drill // (Scan offset must be added to test coordinates!) if (lay_getpowplanetree(x+wslx,y+wsly,pscurlay,drad)==drltree) { // Query the drill heat trap mask if (lay_rulequery(RS_OCPOOL,drill,RS_PCBSUBJ,RS_DRLHTMASK,"?d", drlhtmask)<1) // Set default heat trap mask drlhtmask=0; // Check if direct connection if (drlhtmask&pspowbit) // Done return(0); // Open element specific layer content group if (curplgrpidx>=0 || curgngrpidx>=0) openlaygrp(); if (elemcolor!=defcolor) outcolor(elemcolor); // Write heat trap write_heattrap(dx,dy,drad+POWHTDIST); } else { // Open element specific layer content group if (curplgrpidx>=0 || curgngrpidx>=0) openlaygrp(); if (elemcolor!=defcolor) outcolor(elemcolor); // Write isolation circle outmoveto(dx+drad+POWDRDIST,dy); outarc(dx,dy,drad+POWDRDIST,psrot,2.0*PI+psrot,0); // Close polygon shape, fill isolation circle os=FMTCLOSEPATH+FMTFILL; outstr(); } // Restore element color if (elemcolor!=defcolor) outcolor(defcolor); // Return without errors return(0); } int pslchk(int layer) /* // PostScript layer output check routine // Return value : // zero if scan break requested, 1 if scan allowed // Parameters : // int layer : Layer code */ { // Check if single layer output mode if (pssinglay) { // Enable if layer equal current layer if (layer==pscurlay) return(1); // Enable if signal layer and layer equal all-layer if (PSALLLAY && layer==LAYERALL && pscurlay>=0 && pscurlayilaylb && pscurlay=DOCLAYBASE && pscurlay>=DOCLAYBASE && ((pscurlay-DOCLAYBASE)&(~DOCLAYSMASK)|2)==(layer-DOCLAYBASE)) return(1); // Enable if border if (PSBORDMODE && layer==LAYERBRD) return(1); // Enable if marker layer if (PSMARKMODE && layer==psmarklay && psmarklay!=LAYERINV) return(1); } else { // Check PostScript layer return(layer==pscurlay || (pspowflag && layer==LAYERBRD)); } // No layer of interest return(0); } int psline(double x1,double y1,double x2,double y2) /* // Draw a PostScript line as path // Return value : // zero if done or (-1) on error // Parameters : // double x1 : First line point X coordinate // double y1 : First line point Y coordinate // double x2 : Second line point X coordinate // double y2 : Second line point Y coordinate */ { // Check if dash line change needed if (!pstextflag && !pscurmode && pscurdash1!=0.0) { // Set undashed line os=FMTRESETDASH; outstr(); pstextflag=1; } // Write the text segment as path outmoveto(x1,y1); outlineto(x2,y2); os=FMTSTROKE; outstr(); // Return without errors return(0); } int psarc( double xs,double ys,double xe,double ye,double xc,double yc,int cwflag) /* // Draw a PostScript arc as path // Return value : // zero if done or (-1) on error // Parameters : // double xs : Arc start point X coordinate // double ys : Arc start point Y coordinate // double xe : Arc end point X coordinate // double ye : Arc end point Y coordinate // double xc : Arc center point X coordinate // double yc : Arc center point Y coordinate // int cwflag : Arc clockwise flag */ { double rx,ry /* Radius vector */; double r /* Radius */; double ang1,ang2 /* Arc angles */; // Check if dash line change needed if (!pstextflag && !pscurmode && pscurdash1!=0.0) { // Set undashed line os=FMTRESETDASH; outstr(); pstextflag=1; } // Write the arc segment as path outmoveto(xs,ys); // Get radius vector rx=xe-xc; ry=ye-yc; r=sqrt(rx*rx+ry*ry); ang1=atan2(ys-yc,xs-xc); ang2=atan2(ry,rx); if (ang1==ang2) { outarc(xc,yc,r,ang1,ang1+PI,cwflag); outarc(xc,yc,r,ang1+PI,ang1+2.0*PI,cwflag); } else { outarc(xc,yc,r,ang1+psrot,ang2+psrot,cwflag); } os=FMTSTROKE; outstr(); // Return without errors return(0); } void hatchrect(double xmin,double ymin,double xmax,double ymax) /* // Hatch the given rectangle // Parameters : // double xmin : Rectangle left boundary // double ymin : Rectangle lower boundary // double xmax : Rectangle right boundary // double ymax : Rectangle upper boundary */ { double hmin,hmax /* Hatch range */; double hlen /* Hatch line length */; double hnx,hny /* Hatch origin offset */; double hoff /* Hatch origin offset */; double hx,hy /* Hatch line vector */; double sx,sy /* Hatch line start point */; double angsin,angcos /* Angle trig. values */; // Save status and store path as clip. area os=FMTGSAVECLIP+FMTSTROKE; outstr(); // Get angle values angsin=sin(pscurang); angcos=cos(pscurang); // Get hatch line length hx=wsux-wslx; hy=wsuy-wsly; hlen=sqrt(hx*hx+hy*hy); // Get hatch vector hx=hlen*angcos; hy=hlen*angsin; // Check if hatch upward or downward if (pscuranghmax) { hoff=hmin; hmin=hmax; hmax=hoff; } // Adjust hatch bound. to next spacing grid hmin=pscurspc*ceil(hmin/pscurspc); hmax=pscurspc*floor(hmax/pscurspc); // Loop for all hatch lines for (hoff=hmin;hoff<=hmax;hoff+=pscurspc) { // Get hatch line start point sx=(-hoff*angsin)+hnx; sy=hoff*angcos+hny; // Write hatch line outmoveto(sx,sy); outlineto(sx+hx,sy+hy); os=FMTSTROKE; outstr(); } // Restore old clipping area os=FMTGRESTORE; outstr(); } void write_cline(double x1,double y1,double x2,double y2,double width) /* // Write circle drawn line // Parameters : // double x1 : Start point X coordinate // double y1 : Start point Y coordinate // double x2 : End point X coordinate // double y2 : End point Y coordinate // double width : Line width */ { double dfac /* Factor for circle points calc. */; double d /* Line length */; double dx,dy /* Line vector */; double ang /* Line angle */; // Start and end points not identical ? if ((x1!=x2)||(y1!=y2)) { // Get line vector dx=x2-x1; dy=y2-y1; // Get line length and angle d=sqrt(dx*dx+dy*dy); ang=atan2(dy,dx); // Write polygon points dfac=0.5*width/d; outmoveto(x1-dy*dfac,y1+dx*dfac); outlineto(x2-dy*dfac,y2+dx*dfac); outarc(x2,y2,width/2,ang+PI2+psrot,ang+1.5*PI+psrot,1); outlineto(x1+dy*dfac,y1-dx*dfac); outarc(x1,y1,width/2,ang-PI2+psrot,ang+PI2+psrot,1); } else { // Write circle outmoveto(x1+width/2.0,y1); outarc(x1,y1,width/2,0.0,2.0*PI,1); } // Close polygon shape os=FMTCLOSEPATH; outstr(); } void write_drillhole( double x,double y,double rad,int class,index L_DRILL drill) /* // Write drill hole at given position // Parameters : // double x : Center point X coordinate // double y : Center point Y coordinate // double rad : Drill hole radius // int class : Drill class // index L_DRILL drill : Drill data block */ { string classstr /* Class name string */; double tx,ty /* Text position */; double tangle /* Text rotation angle */; double tsize /* Text size */; double vx /* Text angle vector */; double fty /* Text frame top vector */; double flen /* Text frame length */; double sina,cosa /* Angle trig. values */; double rang /* Rotation corrected angle */; int mmatflag = 0 /* Mirror text matrix flag */; int laymirr /* Layer mirroring mode */; int mirrxchar /* Mirror chars. at x-axis flag */; int mirrychar /* Mirror chars. at y-axis flag */; int elemfont /* Element font mode */; // Check if fixed output radius if ((pscurmode&DRLDISPMASK)==DRLDOTDISP) rad=DRLDOTRAD; // Write circle outmoveto(x+rad,y); outarc(x,y,rad,0.0+psrot,2.0*PI+psrot,0); switch (pscurmode&DRLDISPMASK) { case DRLOUTLDISP : os=FMTSTROKE; outstr(); break; case DRLFILLDISP : case DRLDOTDISP : os=FMTCLOSEPATH+FMTFILL; outstr(); break; default : os=FMTSTROKE; outstr(); // Write cross horizontal line outmoveto(x-rad,y); outlineto(x+rad,y); os=FMTSTROKE; outstr(); // Write cross vertical line outmoveto(x,y-rad); outlineto(x,y+rad); os=FMTSTROKE; outstr(); } if ((pscurmode&DRLTXTDISP) && class>=1 && class<=DRLCLASSMAX) { tsize=rad*0.5; // Get the layer mirror mode laymirr=MIRROR>>1; // Build the class display string classstr[0]='A'+class-1; classstr[1]='\0'; // Query the font if (lay_rulequery(RS_OCPOOL,drill,RS_PCBSUBJ, RS_PLOTFONT,"?d",elemfont)<1 || elemfont<0) elemfont=pscurfont; if (elemfont) { // Correct text length according to font flen=text_length(classstr,elemfont); // Get the default text data tx=x; ty=y; tangle=0.0; if ((pscurmode&DRLDISPMASK)!=0) { ty-=1.41*tsize; tx-=1.41*tsize*flen*0.5; tsize*=2.82; } // Get the new text angle vector vx=tsize; // Check if layer mirroring is required mirrxchar= laymirr==1 ? 1 : 0 ; mirrychar= laymirr==2 ; // Mirror the text if necessary if (mirrxchar) // Request mirror matrix mmatflag=1; if (mirrychar) { tx+=vx*flen*PSFONTASP; tangle=PI; // Get the new text angle vector vx=-tsize; // Toggle mirror matrix state mmatflag=!mmatflag; } // Check if size change if (!PDF && tsize!=psfontsize) { // Store the new font size psfontsize=tsize; // Write the font selection command sprintf(os,FMTFONT1,elemfont); outstr(); outval(psfontsize*psscale*FONTSCALE); os=FMTFONT2; outstr(); } // Check if mirror matrix requested if (mmatflag) { os=FMTGSAVE; outstr(); if (PDF) { if (psrot==PI2) { os=FMTPDFCONCAT1R; outstr(); } else { os=FMTPDFCONCAT1; outstr(); outval(psconcaty); } os=FMTPDFCONCAT2; outstr(); } else { if (psrot==PI2) os=FMTEPSCONCATR; else sprintf(os,FMTEPSCONCAT, psconcaty); outstr(); } ty=(psconcaty-2.0*psyoff)/psscale-ty; } // Get the frame side vectors fty=vx; // Check if PDF output if (PDF) { // Check if rotated text if (fabs(tangle+psrot)>0.0001) { // Write the text pos. with rotation sprintf(os,FMTPDFTEXT1,elemfont, tsize*psscale*FONTSCALE); outstr(); rang=tangle+psrot; sina=sin(rang); cosa=cos(rang); outval(cosa); os=" "; outstr(); outval(sina); os=" "; outstr(); outval(-sina); os=" "; outstr(); outval(cosa); os=" "; outstr(); outxy(tx,ty+fontbase*fty); os=FMTPDFTROT; outstr(); } else { // Write the text pos. with cor. base sprintf(os,FMTPDFTEXT1,elemfont, tsize*psscale*FONTSCALE); outstr(); outxy(tx,ty+fontbase*fty); os=FMTPDFTEXT2; outstr(); } } else { // Write the text pos. with corrected baseline outmoveto(tx,ty+fontbase*fty); if (fabs(tangle+psrot)>0.0001) { os=FMTGSAVE; outstr(); outval(cvtangle(tangle+psrot,0,1)); os=FMTROTON; outstr(); } } // Write the text string sprintf(os,PDF ? FMTPDFTEXT3 : FMTTEXT,classstr); outstr(); if (PDF) { // Close text object os=FMTPDFTEXT4; outstr(); } else if (fabs(tangle+psrot)>0.0001) { // Reset rotation os=FMTGRESTORE; outstr(); } if (mmatflag) { os=FMTGRESTORE; outstr(); } } else { if (pstlinewidth!=pslinewidth) { // Set standard text line width outval(pstlinewidth*psscale); os=FMTSETLINEWIDTH; outstr(); } // Vectorize the text lay_vecttext(x,y,0.0,0,tsize, 1,laymirr,TEXTPHYS,classstr,psline); // Restore polygon line width if (pstlinewidth!=pslinewidth) { outval(pslinewidth*psscale); os=FMTSETLINEWIDTH; outstr(); } } } } void write_heattrap(double x,double y,double rad) /* // Write heat trap at given position // Parameters : // double x : Center point X coordinate // double y : Center point Y coordinate // double rad : Heat trap radius */ { double angoff = POWHTANG ? 0.0 : 0.25*PI /* Heat trap angle offset */; double penangle /* Pen width correction angle */; double stang, endang /* Arc start and end angles */; int i /* Loop control variable */; // Calculate the pen width correction angle penangle=acos(1.0-(POWHWIDTH*POWHWIDTH)/(8.0*rad*rad)); outval(POWHWIDTH*psscale); os=FMTSETLINEWIDTH; outstr(); // Avoid draw if pen angle is too large if (penangle<((PI/6.0)-SMALLANG)) for (i=0;i<4;i++) { // Calc. the start and end angles */ stang=(-PI/6.0)+(i*PI/2.0)+penangle+angoff; endang=(PI/6.0)+(i*PI/2.0)-penangle+angoff; // Store the arc start point outmoveto(x+rad*cos(stang),y+rad*sin(stang)); outarc(x,y,rad,stang+psrot,endang+psrot,0); os=FMTSTROKE; outstr(); } outval(pslinewidth*psscale); os=FMTSETLINEWIDTH; outstr(); } void write_errormarker(int typ,double xmin,double ymin,double xmax,double ymax) /* // Write error marker // Parameters : // int typ : Error type // double xmin : Error rectangle left boundary // double ymin : Error rectangle lower boundary // double xmax : Error rectangle right boundary // double ymax : Error rectangle upper boundary */ { // Adjust coordinates xmin-=wslx; ymin-=wsly; xmax-=wslx; ymax-=wsly; switch (typ) { // Documentary layer height violation case DRC_ERRMHGT : // Write error marker cross outmoveto(xmin,ymin); outlineto(xmax,ymax); outmoveto(xmin,ymax); outlineto(xmax,ymin); // Distance violation case DRC_ERRMCOP : // Double trace segment case DRC_ERRMTDBL : // HF DRC violation case DRC_ERRMHFD : // Write error marker rectangle outmoveto(xmin,ymin); outlineto(xmax,ymin); outlineto(xmax,ymax); outlineto(xmin,ymax); outlineto(xmin,ymin); os=FMTSTROKE; outstr(); break; // Documentary layer forbidden area violation case DRC_ERRMDOC : bae_clearpoints(); bae_storepoint(xmin,ymin,0); bae_storepoint(xmax,ymin,0); bae_storepoint(xmax,ymax,0); bae_storepoint(xmin,ymax,0); bae_storepoint(xmin,ymin,0); bae_dashpolyline(4,0.002,0.0004,psline,psarc); break; } } // Element range routines int chkrange(index L_FIGURE fig) /* // Check if figure list element inside current range // Return value : // zero if element surely outside workspace or nonzero else // Parameters : // index L_FIGURE fig : Figure list element */ { // Perform the figure box test return(lay_figboxtest(fig,wslx,wsly,wsux,wsuy)==1); } // Data conversion and formatting routines string getdatetime() /* // Get current date and time string // Return value : // date time string */ { string datetime /* Date time string */; int sec,min,hour /* Time values */; int day,month,year /* Date values */; int weekday,yearday /* Day values */; string dname,mname /* Day name, month name */; // Get date and time localtime(sec,min,hour,day,month,year,weekday,yearday); // Get the weekday name switch (weekday) { case 0 : dname="Sun"; break; case 1 : dname="Mon"; break; case 2 : dname="Tue"; break; case 3 : dname="Wed"; break; case 4 : dname="Thu"; break; case 5 : dname="Fri"; break; case 6 : dname="Sat"; break; } // Get the month name switch (month) { case 0 : mname="Jan"; break; case 1 : mname="Feb"; break; case 2 : mname="Mar"; break; case 3 : mname="Apr"; break; case 4 : mname="May"; break; case 5 : mname="Jun"; break; case 6 : mname="Jul"; break; case 7 : mname="Aug"; break; case 8 : mname="Sep"; break; case 9 : mname="Oct"; break; case 10 : mname="Nov"; break; case 11 : mname="Dec"; break; } // Build the date time string sprintf(datetime,"%s %s %d %02d:%02d:%02d %d", dname,mname,day,hour,min,sec,1900+year); // Return the date time string return(datetime); } // Postscript matrix routines void setscale(double scale) /* // Set postscript output scale factor */ { // Scale the matrix psm1*=scale; psm2*=scale; psm3*=scale; psm4*=scale; psxoff*=scale; psyoff*=scale; psscale*=scale; } // Data output routines void outmoveto(double x,double y) /* // Output moveto command // Parameters : // double x,y : Coordinates */ { // Output the coordinates outxy(x,y); // Output the command os=FMTMOVETO; outstr(); } void outlineto(double x,double y) /* // Output lineto command // Parameters : // double x,y : Coordinates */ { // Output the coordinates outxy(x,y); // Output the command os=FMTLINETO; outstr(); } void outarc(double x,double y,double r,double angs,double ange,int ori) /* // Output arc command // Parameters : // double x,y : Arc center coordinates // double r : Arc radius // double angs,ange : Arc start end angle // int ori : Arc orientation */ { double ang1,ang2 /* Arc angle values */; double sina1,cosa1 /* Trig. arc values */; double sina2,cosa2 /* Trig. arc values */; double sin0,cos0 /* Arc radius vector */; double x0,y0 /* Arc start coordinates */; double x3r,y3r /* Arc vector coordinates */; double adiff /* Arc difference value */; double swap /* Swap buffer */; double trad /* Tangent radius */; // Check the output format if (PDF) { // Get the arc data ang1=angs-psrot; ang2=ange-psrot; sina1=sin(ang1); cosa1=cos(ang1); sina2=sin(ang2); cosa2=cos(ang2); sin0=r*sina1; cos0=r*cosa1; x0=x+cos0; y0=y+sin0; if (ori) { while (ang10.5*PI) { swap=cos0; cos0=-sin0; sin0=swap; x3r=x+cos0; y3r=y+sin0; outarccurve(r,x0,y0,x3r,y3r,x0+cos0,y0+sin0); x0=x3r; y0=y3r; ang1+=0.5*PI; } } trad=tan(0.5*adiff); outarccurve( r,x0,y0,x+r*cosa2,y+r*sina2,x0-trad*sin0,y0+trad*cos0); } else { // Output the center coordinates outxy(x,y); // Output the command os=" "; outstr(); outval(r*psscale); os=" "; outstr(); outval(cvtangle(angs,2,1)); os=" "; outstr(); outval(cvtangle(ange,2,1)); os=ori ? FMTARCN : FMTARC; outstr(); } } void outarccurve( double r,double x0,double y0,double x3,double y3,double xt,double yt) /* // Output arc curve command // Parameters : // double r : Arc radius // double x0,y0 : Arc curve start coordinates // double x3,y3 : Arc curve end coordinates // double xt,yt : Arc tangents cross point */ { double dx,dy /* Distance vector */; double dist /* Distance value */; double r2 /* Squared radius value */; double frac /* Tangent fraction */; // Get the distance vector dx=xt-x0; dy=yt-y0; dist=dx*dx+dy*dy; r2=r*r; frac= (dist>=r2*1.0e8) ? 0.0 : 4.0/(3.0*(1+sqrt(1+dist/r2))) ; // Output the curve command outxy(x0+frac*(xt-x0),y0+frac*(yt-y0)); os=" "; outstr(); outxy(x3+frac*(xt-x3),y3+frac*(yt-y3)); os=" "; outstr(); outxy(x3,y3); os=FMTCURVETO; outstr(); } void outxy(double x,double y) /* // Output x/y coordinate pair // Parameters : // double x,y : Coordinates */ { // Output the transformed coordinates outval(x*psm1+y*psm2+psxoff); os=" "; outstr(); outval(x*psm3+y*psm4+psyoff); } void outval(double val) /* // Output value // Parameters : // double val : Value */ { int len /* Output string length */; // Build the output string sprintf(os,"%.3f",val); len=strlen(os)-1; // Delete trailing zeros while (os[len]=='0') { os[len]='\0'; len--; } // Delete trailing dot if (os[len]=='.') { os[len]='\0'; len--; } // Handle negative zero value if (os=="-0") os="0"; // Output the value string outstr(); } void outcolor(string colstr) /* // Output a color specification // Parameter : // string colstr : Color RGB string */ { os=colstr; outstr(); os=FMTSETRGB1; outstr(); if (PDF) { os=colstr; outstr(); os=FMTSETRGB2; outstr(); } } void outstr() /* // Output the string buffer */ { fputs(os,psfh); // Update the file position if (!compflag) opos+=strlen(os); } void adjfname(int fidx,int ftyp,int querydb) /* // Adjust file name extension // Parameters : // int fidx : File name dialog box index // int ftyp : New file type // int querydb : Query job database for name flag */ { string filename /* File name */; int len /* File name length */; int elen /* Extension name length */; queryname=""; if (querydb) { sprintf(sqlcommand,FN_SELECT1+FN_SELECT2,ftyp, sql_quotestr(bae_planename())); sqlcmd(bae_planfname(),sqlcommand,namefunc); } if (queryname!="") { filename=queryname; } else { // Get the file name bae_dialgetdata(fidx,0,0.0,filename); len=strlen(filename); if (ftyp) { elen=strlen(PSEXT); if (len==elen) { if (filename==PSEXT) filename=PDFEXT; } else if (strextract(filename,len-elen,len)==PSEXT) { filename=strextract(filename,0,len-elen-1)+PDFEXT; } } else { elen=strlen(PDFEXT); if (len==elen) { if (filename==PDFEXT) filename=PSEXT; } else if (strextract(filename,len-elen,len)==PDFEXT) { filename=strextract(filename,0,len-elen-1)+PSEXT; } } } bae_dialsetdata(fidx,PA_STR|PA_HBRDREL,0,0.0,filename); } // Batch output routines void batchoutput() /* // Edit/process output batches */ { double butx /* Dialog box button x coordinate */; double cy /* Dialog box current y coordinate */; double dialwidth /* Dialog box width */; double dialheight /* Dialog box height */; double baseheight /* Dialog box base height */; int lbidx = (-1) /* List box item index */; int dialres /* Dialog box result buffer */; int repflag = 1 /* Dialog box repeat flag */; int i /* Loop control variable */; // Check if dialog box support if (bae_dialclr()) error(ERRNOWIN); // Init. the batch database batdbinit(BAEEPSBDAT); baseheight=DIAL_TOPMARG+DIAL_BUTVSTEP+DIAL_SEPVSTEP; // Perform input loop do { // Get batch entries batn=0; if (sqlcmd(BAEEPSBDAT,B_SELECT,batnamefunc)!=0) // SQL/DB error sql_dberror(0); bae_dialclr(); dial_getboxsizemin(4005,dialwidth,dialheight, DIAL_LEFTMARG+SELBOXWIDTHBS+DIAL_RIGHTSMARG, baseheight+16.0,DIAL_LEFTMARG+8.0*BBUTXSTEP+DIAL_RIGHTSMARG, baseheight+2.0); cy=DIAL_TOPMARG; // Store function buttons butx=DIAL_LEFTMARG+BBUTXSTEP; bae_dialaddcontrol( PA_ACT,0,0,0,0.0,0.0,0.0,"",0,butx,cy,BBUTWIDTH,UPRBFCT1); butx+=BBUTXSTEP; bae_dialaddcontrol( PA_ACT,0,1,0,0.0,0.0,0.0,"",0,butx,cy,BBUTWIDTH,UPRBFCT2); butx+=BBUTXSTEP; bae_dialaddcontrol( PA_ACT,0,2,0,0.0,0.0,0.0,"",0,butx,cy,BBUTWIDTH,UPRBFCT3); butx+=BBUTXSTEP; bae_dialaddcontrol( PA_ACT,0,3,0,0.0,0.0,0.0,"",0,butx,cy,BBUTWIDTH,UPRBFCT4); butx+=BBUTXSTEP; bae_dialaddcontrol( PA_ACT,0,4,0,0.0,0.0,0.0,"",0,butx,cy,BBUTWIDTH,UPRBFCT5); butx+=BBUTXSTEP; bae_dialaddcontrol( PA_ACT,0,5,0,0.0,0.0,0.0,"",0,butx,cy,BBUTWIDTH,UPRBFCT6); butx+=BBUTXSTEP; bae_dialaddcontrol( PA_ACT,0,6,0,0.0,0.0,0.0,"",0,butx,cy,BBUTWIDTH,UPRBFCT7); butx+=BBUTXSTEP; // Store abort button bae_dialaddcontrol(PA_ACT,0,(-1),0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG,cy,0.0,UPRSFCT5); cy+=DIAL_BUTVSTEP; // Store list box lbidx=bae_dialadvcontrol(PA_LB|PA_OKSEL|PA_HBRDREL|PA_HSCROLL, (-1),0,(-1),0.0,0.0,0.0,"",0,DIAL_LEFTMARG,cy,DIAL_RIGHTSMARG, dialheight-baseheight,""); // Store list box entries for (i=0;i=0 && i0;i--) if (batl[i-1]>dstr) batl[i]=batl[i-1]; else break; batl[i]=dstr; batn++; break; } // Return without errors return(0); } int filefunc(string dstr,int dint,double ddbl, int dval,int dtype,string dtable,string dfield,int didx) /* // File list callback function // Return value : // zero if done or (-1) on data error // Parameters : // string dstr : String/Date data // int dint : Integer/Boolean data // double ddbl : Float data // int dval : Data valid flag // int dtype : Data type // string dtable : Data table name // string dfield : Data field name // int didx : Data output field index */ { filel[filen].id=dint; filen++; // Return without errors return(0); } int pagefunc(string dstr,int dint,double ddbl, int dval,int dtype,string dtable,string dfield,int didx) /* // Step list callback function // Return value : // zero if done or (-1) on data error // Parameters : // string dstr : String/Date data // int dint : Integer/Boolean data // double ddbl : Float data // int dval : Data valid flag // int dtype : Data type // string dtable : Data table name // string dfield : Data field name // int didx : Data output field index */ { filel[curfile].pagel[filel[curfile].pagen].id=dint; filel[curfile].pagen++; // Return without errors return(0); } int layerfunc(string dstr,int dint,double ddbl, int dval,int dtype,string dtable,string dfield,int didx) /* // Layer ID list build callback function // Return value : // zero if done or (-1) on data error // Parameters : // string dstr : String/Date data // int dint : Integer/Boolean data // double ddbl : Float data // int dval : Data valid flag // int dtype : Data type // string dtable : Data table name // string dfield : Data field name // int didx : Data output field index */ { filel[curfile].pagel[curpage].layl[ filel[curfile].pagel[curpage].layn].id=dint; filel[curfile].pagel[curpage].layn++; // Return without errors return(0); } int playerfunc(string dstr,int dint,double ddbl, int dval,int dtype,string dtable,string dfield,int didx) /* // Page layer ID list callback function // Return value : // zero if done or (-1) on data error // Parameters : // string dstr : String/Date data // int dint : Integer/Boolean data // double ddbl : Float data // int dval : Data valid flag // int dtype : Data type // string dtable : Data table name // string dfield : Data field name // int didx : Data output field index */ { playl[playn]=dint; playn++; // Return without errors return(0); } int gridfunc(string dstr,int dint,double ddbl, int dval,int dtype,string dtable,string dfield,int didx) /* // Grid ID list build callback function // Return value : // zero if done or (-1) on data error // Parameters : // string dstr : String/Date data // int dint : Integer/Boolean data // double ddbl : Float data // int dval : Data valid flag // int dtype : Data type // string dtable : Data table name // string dfield : Data field name // int didx : Data output field index */ { filel[curfile].pagel[curpage].gridl[ filel[curfile].pagel[curpage].gridn].id=dint; filel[curfile].pagel[curpage].gridn++; // Return without errors return(0); } int pgridfunc(string dstr,int dint,double ddbl, int dval,int dtype,string dtable,string dfield,int didx) /* // Page grid ID list callback function // Return value : // zero if done or (-1) on data error // Parameters : // string dstr : String/Date data // int dint : Integer/Boolean data // double ddbl : Float data // int dval : Data valid flag // int dtype : Data type // string dtable : Data table name // string dfield : Data field name // int didx : Data output field index */ { pgridl[pgridn]=dint; pgridn++; // Return without errors return(0); } int fparamfunc(string dstr,int dint,double ddbl, int dval,int dtype,string dtable,string dfield,int didx) /* // File parameter list callback function // Return value : // zero if done or (-1) on data error // Parameters : // string dstr : String/Date data // int dint : Integer/Boolean data // double ddbl : Float data // int dval : Data valid flag // int dtype : Data type // string dtable : Data table name // string dfield : Data field name // int didx : Data output field index */ { switch (didx) { // Parameter index case 1 : curpar=dint; break; // Integer value case 2 : filel[curfile].parl[curpar].ival=dint; break; // Double value case 3 : filel[curfile].parl[curpar].dval=ddbl; break; // String value case 4 : filel[curfile].parl[curpar].sval=dstr; break; } // Return without errors return(0); } int pparamfunc(string dstr,int dint,double ddbl, int dval,int dtype,string dtable,string dfield,int didx) /* // Page parameter list callback function // Return value : // zero if done or (-1) on data error // Parameters : // string dstr : String/Date data // int dint : Integer/Boolean data // double ddbl : Float data // int dval : Data valid flag // int dtype : Data type // string dtable : Data table name // string dfield : Data field name // int didx : Data output field index */ { switch (didx) { // Parameter index case 1 : curpar=dint; break; // Integer value case 2 : filel[curfile].pagel[curpage].parl[curpar].ival=dint; break; // Double value case 3 : filel[curfile].pagel[curpage].parl[curpar].dval=ddbl; break; // String value case 4 : filel[curfile].pagel[curpage].parl[curpar].sval=dstr; break; } // Return without errors return(0); } int lparamfunc(string dstr,int dint,double ddbl, int dval,int dtype,string dtable,string dfield,int didx) /* // Layer parameter list callback function // Return value : // zero if done or (-1) on data error // Parameters : // string dstr : String/Date data // int dint : Integer/Boolean data // double ddbl : Float data // int dval : Data valid flag // int dtype : Data type // string dtable : Data table name // string dfield : Data field name // int didx : Data output field index */ { switch (didx) { // Parameter index case 1 : curpar=dint; break; // Integer value case 2 : filel[curfile].pagel[curpage].layl[curlayer].parl[curpar].ival= dint; break; // Double value case 3 : filel[curfile].pagel[curpage].layl[curlayer].parl[curpar].dval= ddbl; break; // String value case 4 : filel[curfile].pagel[curpage].layl[curlayer].parl[curpar].sval= dstr; break; } // Return without errors return(0); } int gparamfunc(string dstr,int dint,double ddbl, int dval,int dtype,string dtable,string dfield,int didx) /* // Grid parameter list callback function // Return value : // zero if done or (-1) on data error // Parameters : // string dstr : String/Date data // int dint : Integer/Boolean data // double ddbl : Float data // int dval : Data valid flag // int dtype : Data type // string dtable : Data table name // string dfield : Data field name // int didx : Data output field index */ { switch (didx) { // Parameter index case 1 : curpar=dint; break; // Integer value case 2 : filel[curfile].pagel[curpage].gridl[curgrid].parl[curpar].ival= dint; break; // Double value case 3 : filel[curfile].pagel[curpage].gridl[curgrid].parl[curpar].dval= ddbl; break; // String value case 4 : filel[curfile].pagel[curpage].gridl[curgrid].parl[curpar].sval= dstr; break; } // Return without errors return(0); } void getvardata(string fname,string ename,int class) /* // Get variant data // Parameters : // string fname : Project file name // string ename : Element name // int class : Element class */ { int i /* Loop control variable */; // Get first plan if (bae_planfname()!=fname || bae_planename()!=ename || ddbclass!=class) { if (bae_planfname()==fname || class!=DDBCLLAY) bae_setintpar(22,1); bae_loadelem(fname,ename,class); } // Query the current active variant if (class!=DDBCLLAY || lay_rulequery(RS_OCPLAN,0,RS_PCBSUBJ,RS_VARIANT,"?d",varnumber)<1) // Set default variant varnumber=0; act_flag=0; // Select all table entries varn=0; sqlcmd(fname,V_SELECTA,datafunc); // Check if active variant defined if (!act_flag && varnumber!=0) { for (i=varn;i>0;i--) if (varl[i-1].varnum0;i--) varl[i]=varl[i-1]; // Insert variant data varl[0].varnum=0; varl[0].varname=REPVARBASE; varn++; } } int datafunc(string dstr,int dint,double ddbl, int dval,int dtype,string dtable,string dfield,int didx) /* // Data query callback function // Return value : // zero if done or (-1) on data error // Parameters : // string dstr : String/Date data // int dint : Integer/Boolean data // double ddbl : Float data // int dval : Data valid flag // int dtype : Data type // string dtable : Data table name // string dfield : Data field name // int didx : Data output field index */ { int i /* Loop control variable */; // Check the data field switch (didx) { case 1 : curvarnum=dint; break; case 2 : // Search the insert position for (i=varn;i>0;i--) if (varl[i-1].varnum0 && attval!="" && attval!=" ") break; if (lay_rulequery(RS_OCFIG,fig,RS_PCBSUBJ, predname2,"?s",attval)>0 && attval!="" && attval!=" ") break; if (lay_rulequery(RS_OCFIG,fig,RS_PCBSUBJ, predname3,"?s",attval)>0 && attval!="" && attval!=" ") break; if (lay_rulequery(RS_OCFIG,fig,RS_PCBSUBJ, predname4,"?s",attval)>0 && attval!="" && attval!=" ") break; } } else { // Query the current active variant if (varreq<0) if (class!=DDBCLLAY || lay_rulequery( RS_OCPLAN,0,RS_PCBSUBJ,RS_VARIANT,"?d",varnumber)<1) // Set default variant varnumber=0; forall (cpart where strmatch(cpart.MACRO.NAME,macname)) { if ((attval= getlayattribval(cpart,attname))!="" && attval!=" ") break; else if ((attval= getlayattribval(cpart,attname2))!="" && attval!=" ") break; else if ((attval= getlayattribval(cpart,attname3))!="" && attval!=" ") break; else if ((attval= getlayattribval(cpart,attname4))!="" && attval!=" ") break; } } // Store the variant attribute value varattr= (attval=="" || attval==" ") ? (attdef=="" ? varl[varnumber].varname : attdef) : attval; } void readbatch(string dbname,string batname) /* // Read and sort batch steps // Parameters : // string dbname : Database name // string batname : Batch name */ { struct pagedes mpage /* Minimum page buffer */; struct layerdes mlayer /* Minimum layer buffer */; struct griddes mgrid /* Minimum grid buffer */; int minsrc /* Min. source index */; int i /* Loop control variable */; // Query the batch files filen=0; sprintf(sqlcommand,F_SELECT,sql_quotestr(batname)); if (sqlcmd(dbname,sqlcommand,filefunc)!=0) // SQL/DB error sql_dberror(0); for (curfile=0;curfile=i;curlayer--) if (filel[curfile].pagel[ curpage].layl[curlayer].parl[ PARLAYIDX].ival=i;curgrid--) if (filel[curfile].pagel[ curpage].gridl[curgrid].parl[ PARGRIDIDX].ival=5) filel[curfile].pagel[ curpage].parl[PARPAGEFMT].ival=0; } } // Sort the pages for (i=0;i=i;curpage--) if (filel[curfile].pagel[curpage].parl[ PARPAGEIDX].ival< mpage.parl[PARPAGEIDX].ival) { minsrc=curpage; mpage=filel[curfile].pagel[curpage]; } if (minsrc!=i) { // Swap pages filel[curfile].pagel[minsrc]= filel[curfile].pagel[i]; filel[curfile].pagel[i]=mpage; } } } } void runbatch(string batname) /* // Perform a batch run // Parameters : // string batname : Batch name */ { string scandir = "" /* Scan directory name */; string fname = "" /* Scan file name */; string jobfname = "" /* Job file name */; string ename /* Scan element name */; string msg /* Message buffer */; STRINGS hl /* Popup header list */; int hn /* Popup header count */; int i /* Loop control variable */; // Abort if invalid plan class if (ddbclass!=DDBCLLAY) error(ERRINVELEM); // Print the report header hl[0]=REPHEADER; hl[1]=""; hn=2; en=0; // Perform all batch file steps readbatch(BAEEPSBDAT,batname); if (filen==0) { sprintf(msg,ERRNOBATCH,batname); bae_msgbox(2,msg,""); exit(0); } abortflag=0; for (i=0;i0;i--) { if (numstrcmp(ename, loutl[i-1])>0) break; loutl[i]=loutl[i-1]; } loutl[i]=ename; if (FORMAT==9) { if (bae_planfname()!=fname || bae_planename()!=ename || bae_planddbclass()!=DDBCLLAY) { if (bae_planfname()==fname) bae_setintpar(22,1); bae_loadelem( fname,ename,DDBCLLAY); } getwsbound(); // Get mosaic matrix size mxn=ceil((wsux-wslx)* SCALEFACTOR*1000.0/(A4W-2.0*XOFF)); myn=ceil((wsuy-wsly)* SCALEFACTOR*1000.0/(A4H-2.0*YOFF)); loutpn+=mxn*myn; } else { loutpn++; } loutn++; } lelemscan=1; } totpagen+=loutpn; break; case PAGE_ALLP : case PAGE_ALLPEXT : if (!pelemscan) { // Save cur. element with verification on req. verifysave(); // Ask for DDB file name if (fname=="" && (fname= askddbfile(UPRSELFILE,DDBCLLPRT))=="") error_abort(); // Loop for all parts ename=""; while (scanddbenames( fname,DDBCLLPRT,ename)==1) { for (i=poutn;i>0;i--) { if (numstrcmp(ename, poutl[i-1])>0) break; poutl[i]=poutl[i-1]; } poutl[i]=ename; if (FORMAT==9) { if (bae_planfname()!=fname || bae_planename()!=ename || bae_planddbclass()!=DDBCLLPRT) { bae_setintpar(22,1); bae_loadelem( fname,ename,DDBCLLPRT); } getwsbound(); // Get mosaic matrix size mxn=ceil((wsux-wslx)* SCALEFACTOR*1000.0/(A4W-2.0*XOFF)); myn=ceil((wsuy-wsly)* SCALEFACTOR*1000.0/(A4H-2.0*YOFF)); poutpn+=mxn*myn; } else { poutpn++; } poutn++; } pelemscan=1; } totpagen+=poutpn; break; case PAGE_ALLS : case PAGE_ALLSEXT : if (!selemscan) { // Save cur. element with verification on req. verifysave(); // Ask for DDB file name if (fname=="" && (fname= askddbfile(UPRSELFILE,DDBCLLSTK))=="") error_abort(); // Loop for all padstacks ename=""; while (scanddbenames( fname,DDBCLLSTK,ename)==1) { for (i=soutn;i>0;i--) { if (numstrcmp(ename, soutl[i-1])>0) break; soutl[i]=soutl[i-1]; } soutl[i]=ename; if (FORMAT==9) { if (bae_planfname()!=fname || bae_planename()!=ename || bae_planddbclass()!=DDBCLLSTK) { bae_setintpar(22,1); bae_loadelem( fname,ename,DDBCLLSTK); } getwsbound(); // Get mosaic matrix size mxn=ceil((wsux-wslx)* SCALEFACTOR*1000.0/(A4W-2.0*XOFF)); myn=ceil((wsuy-wsly)* SCALEFACTOR*1000.0/(A4H-2.0*YOFF)); soutpn+=mxn*myn; } else { soutpn++; } soutn++; } selemscan=1; } totpagen+=soutpn; break; case PAGE_ALLD : case PAGE_ALLDEXT : if (!delemscan) { // Save cur. element with verification on req. verifysave(); // Ask for DDB file name if (fname=="" && (fname= askddbfile(UPRSELFILE,DDBCLLPAD))=="") error_abort(); // Loop for all pads ename=""; while (scanddbenames( fname,DDBCLLPAD,ename)==1) { for (i=doutn;i>0;i--) { if (numstrcmp(ename, doutl[i-1])>0) break; doutl[i]=doutl[i-1]; } doutl[i]=ename; if (FORMAT==9) { if (bae_planfname()!=fname || bae_planename()!=ename || bae_planddbclass()!=DDBCLLPAD) { bae_setintpar(22,1); bae_loadelem( fname,ename,DDBCLLPAD); } getwsbound(); // Get mosaic matrix size mxn=ceil((wsux-wslx)* SCALEFACTOR*1000.0/(A4W-2.0*XOFF)); myn=ceil((wsuy-wsly)* SCALEFACTOR*1000.0/(A4H-2.0*YOFF)); doutpn+=mxn*myn; } else { doutpn++; } doutn++; } delemscan=1; } totpagen+=doutpn; break; case PAGE_PARTLIST : if (strextractfilepath(PDFLIB)=="") pdflib=strextractfilepath(lay_deflibname())+PDFLIB; else pdflib=PDFLIB; // Load the partlist layoput macro if (lay_macload(pspool,pdflib, parl[PARPAGEMACRO].sval,DDBCLLAY)<0) { // Load error sprintf(msg,ERRNOPARTPAGE, parl[PARPAGEMACRO].sval,pdflib); error(msg); } partprow=(-1); attrn=0; partcntflag=0; partcntw=partsepw=0.0; partnamecase=0; plwslx=pspool.MACRO.MLX; plwsly=pspool.MACRO.MLY; plwsux=pspool.MACRO.MUX; plwsuy=pspool.MACRO.MUY; if (lay_scanpool(pspool,0.0,0.0,0.0,1,1, attrmac,NULL,NULL,attrtext,NULL,NULL,NULL)!=0) error_scan(); pspoolflag=1; if (partprow==(-1)) break; if (varreq>=0) varnumber=varreq; // Query the current active variant else if (ddbclass!=DDBCLLAY || lay_rulequery( RS_OCPLAN,0,RS_PCBSUBJ,RS_VARIANT,"?d",varnumber)<1) // Set default variant varnumber=0; partn=0; forall (cpart) { if (getlayattribval(cpart,"$noplc")!="") continue; partname=cpart.NAME; for (i=0;i=attrn) break; } if (i0;j--) { if (numstrcmp(partname, partl[i].namel[j-1])>0) break; partl[i].namel[j]= partl[i].namel[j-1]; } partl[i].namel[j]=partname; partl[i].namen++; continue; } } for (i=partn;i>0;i--) { if (numstrcmp(partname,partl[i-1].namel[0])>0) break; partl[i]=partl[i-1]; } partl[i].namel[0]=partname; partl[i].namen=1; partl[i].vall=vall; partn++; } if (partcntflag && partcntw!=0.0) { pentryn=0; pentryl[0].start=1; for (i=0;i partcntw) { pentryl[pentryn].partidx=i; pentryl[pentryn].first=first; pentryl[pentryn].nlist=fbuf+","; pentryn++; pentryl[pentryn].start=0; fbuf=partl[i].namel[j]; first=0; } else { fbuf+=","+partl[i].namel[j]; } } } if (fbuf!="") { pentryl[pentryn].partidx=i; pentryl[pentryn].first=first; pentryl[pentryn].nlist=fbuf; pentryn++; pentryl[pentryn].start=1; } } } else { for (i=0;i1 ? ",..." : ""); } pentryn=partn; } partpagen=(pentryn+partprow)/(partprow+1); totpagen+=partpagen; break; case PAGE_SINGLEV : if (varreq<0) { getvardata(bae_planfname(),bae_planename(),DDBCLLAY); varflag=1; } default : if (FORMAT==9) { getwsbound(); // Get mosaic matrix size mxn=ceil((wsux-wslx)*SCALEFACTOR*1000.0/(A4W-2.0*XOFF)); myn=ceil((wsuy-wsly)*SCALEFACTOR*1000.0/(A4H-2.0*YOFF)); totpagen+=varflag ? (mxn*myn*varn) : mxn*myn; } else { totpagen+=varflag ? varn : 1; } } } // Check if printer output if (!PDF && strscannext(outfname,".",0,1)>strlen(outfname)) { printername=outfname; outfname=TEMPFNAME; } // Open the output file psfh=bae_fopen(outfname,4); opagen=0; opos=0; // Build the used layer number list lgrpn=ngrpn=ggrpn=0; if (PDFLAYGRP) { for (curpage=opagen=0;curpage=0 && lay_rulequery(RS_OCFIG,curfig,RS_PCBSUBJ,RS_PDFLAY, "?s",gname)>0 && gname!="") storelgrpname(gname,LAYERINV,1); if (PDFGRPNLAY) forall (curfig where curfig.RULEOBJID>=0 && lay_rulequery(RS_OCFIG,curfig,RS_PCBSUBJ,RS_GROUPNAME, "?s",gname)>0 && gname!="") storelgrpname(gname,LAYERINV,1); SCALEFACTOR=page.parl[PARPAGESCAL].dval; gridfieldn=page.gridn; for (curgrid=0;curgrid=0) ggrpl[i].actflag=1; } // Output page(s) switch (page.parl[PARPAGEMODE].ival) { case PAGE_SINGLE : case PAGE_SINGLEEXT : case PAGE_SINGLEN : case PAGE_SINGLEV : switch (page.parl[PARPAGEMODE].ival) { case PAGE_SINGLE : case PAGE_SINGLEV : pagename= outelemname(page.parl[PARPAGEECOMM].ival); break; case PAGE_SINGLEEXT : pagename=outelemname( page.parl[PARPAGEECOMM].ival)+ page.parl[PARPAGENAME].sval; break; case PAGE_SINGLEN : pagename=page.parl[PARPAGENAME].sval; break; } if (PDF==2) { getwsbound(); // Get mosaic matrix size mxn=ceil((wsux-wslx)* SCALEFACTOR*1000.0/(A4W-2.0*XOFF)); myn=ceil((wsuy-wsly)* SCALEFACTOR*1000.0/(A4H-2.0*YOFF)); // Check if mosaic necessary at all CLIP= (mxn!=1 || myn!=1) ? 2 : 0 ; } else { mxn=myn=1; CLIP=0; } nameext=""; if (varflag) { for (i=0;i=0 && i2) { // Store variant file mode control fvidx=bae_dialaddcontrol(PA_TOGGLE, 0,1,parl[PAROUTFVAR].ival,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFF,cy,0.0,UPRDFVMODE); cy+=DIAL_CTRVSTEP; } else { fvidx=(-1); } // Store file name mode controls dial_label(0.0,cy,UPRDFMODE); fmidx=dial_selbox(parl[PAROUTFMODE].ival,CCOLOFFF,cy); if (!parl[PAROUTFVAR].ival) { dial_sbentry(1,0,UPRFMODE0); dial_sbentry(1,1,UPRFMODE1); dial_sbentry(1,2,UPRFMODE2); } dial_sbentry(1,3,UPRFMODE3); dial_sbentry(1,6,UPRFMODE6); dial_sbentry(1,4,UPRFMODE4); dial_sbentry(1,5,UPRFMODE5); // Store folder name controls dial_label(0.0,cy,UPRDOUTDIR); fdidx=dial_string(parl[PAROUTFDIR].sval,MAXPATHLEN,CCOLOFFF,cy); dial_hsep(cy); // Store file format controls dial_label(0.0,cy,UPRDFTYP); ffidx=bae_dialaddcontrol(PA_SB,0,0,parl[PAROUTFTYP].ival, 0.0,0.0,0.0,"",0,DIAL_LEFTMARG+CCOLOFFF,cy,SB_WIDTHF,""); dial_sbentry(2,FILE_EPS,UPRFTYP1); dial_sbentry(2,FILE_PDF,UPRFTYP2); lgrpidx=bae_dialaddcontrol( parl[PAROUTFTYP].ival==FILE_PDF ? PA_TOGGLE : PA_NIL, 0,0,parl[PAROUTFLAY].ival,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFF+SB_WIDTHF+2.0,cy,0.0,UPRPDFLGRP); callidx=bae_dialaddcontrol( parl[PAROUTFTYP].ival==FILE_PDF ? PA_TOGGLE : PA_NIL, 0,0,parl[PAROUTFDISP].ival,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFF+SB_WIDTHF+16.0,cy,0.0,UPRPDFARUN); cy+=DIAL_CTRVSTEP; dial_label(0.0,cy,UPRPDFPQRY); pqryidx=dial_toggle(parl[PAROUTFPQRY].ival,CCOLOFFF,cy,UPRDON); if (parl[PAROUTFTYP].ival==FILE_PDF) { dial_label(0.0,cy,UPRPDFPSCALE); psclidx=bae_dialaddcontrol(PA_RBF, 0,0,parl[PAROUTFPSCALE].ival,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFF,cy,0.0,UPRPDFPSCALEN); bae_dialaddcontrol(PA_RBN,1,0,0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFF+14.0,cy,0.0,UPRPDFPSCALED); cy+=DIAL_CTRVSTEP; } else { psclidx=bae_dialaddcontrol(PA_NIL, 0,0,parl[PAROUTFPSCALE].ival,0.0,0.0,0.0,"",0, 0.0,cy,0.0,""); } // Store font name controls dial_label(0.0,cy,UPRDFONT1); f1idx=dial_string( parl[PAROUTFONT1].sval,MAXPATHLEN,CCOLOFFF,cy); dial_label(0.0,cy,UPRDFONT1B); f1bidx=bae_dialaddcontrol(PA_DBL|PA_HBRDREL,0,2,0,0.0,0.0, parl[PAROUTFONT1B].dval,"",0, DIAL_LEFTMARG+CCOLOFFF,cy,DIAL_RIGHTEMARG,""); cy+=DIAL_CTRVSTEP; dial_label(0.0,cy,UPRDFONT1S); f1sidx=dial_double(3,parl[PAROUTFONT1S].dval,CCOLOFFF,cy); dial_label(0.0,cy,UPRDFONT2); f2idx=dial_string( parl[PAROUTFONT2].sval,MAXPATHLEN,CCOLOFFF,cy); dial_label(0.0,cy,UPRDFONT2B); f2bidx=bae_dialaddcontrol(PA_DBL|PA_HBRDREL,0,2,0,0.0,0.0, parl[PAROUTFONT2B].dval,"",0, DIAL_LEFTMARG+CCOLOFFF,cy,DIAL_RIGHTEMARG,""); cy+=DIAL_CTRVSTEP; dial_label(0.0,cy,UPRDFONT2S); f2sidx=dial_double(3,parl[PAROUTFONT2S].dval,CCOLOFFF,cy); // Call the dialog function sprintf(msg,UPRDIALOFPAR,batname,fileidx+1); bae_setintpar(16,4007); switch (res=bae_dialaskparams(msg,0,DIAL_LEFTMARG+CCOLOFFF+ ED_WIDTHF+DIAL_RIGHTSMARG,cy+DIAL_SEPVSTEP)) { case 0 : case 1 : case 2 : case 3 : // Get data from dialog box entries bae_dialgetdata(fnidx,0,0.0,parl[PAROUTFILE].sval); if (res==0 && parl[PAROUTFILE].sval=="") { bae_msgbox(2,ERRNOFILEN,""); break; } bae_dialgetdata(fdidx,0,0.0,parl[PAROUTFDIR].sval); if (fvidx!=(-1)) bae_dialgetdata( fvidx,parl[PAROUTFVAR].ival,0.0,""); else parl[PAROUTFVAR].ival=0; if (maidx!=(-1)) { bae_dialgetdata( maidx,0,0.0,parl[PAROUTFMACRO].sval); bae_dialgetdata( a1idx,0,0.0,parl[PAROUTFATTR1].sval); bae_dialgetdata( a2idx,0,0.0,parl[PAROUTFATTR2].sval); bae_dialgetdata( a3idx,0,0.0,parl[PAROUTFATTR3].sval); bae_dialgetdata( a4idx,0,0.0,parl[PAROUTFATTR4].sval); bae_dialgetdata( adidx,0,0.0,parl[PAROUTFATTRD].sval); } else { parl[PAROUTFMACRO].sval=""; parl[PAROUTFATTR1].sval=""; parl[PAROUTFATTR2].sval=""; parl[PAROUTFATTR3].sval=""; parl[PAROUTFATTR4].sval=""; parl[PAROUTFATTRD].sval="_1"; } bae_dialgetdata(fmidx,parl[PAROUTFMODE].ival,0.0,""); bae_dialgetdata(ffidx,parl[PAROUTFTYP].ival,0.0,""); bae_dialgetdata(lgrpidx,parl[PAROUTFLAY].ival,0.0,""); bae_dialgetdata( psclidx,parl[PAROUTFPSCALE].ival,0.0,""); bae_dialgetdata(callidx,parl[PAROUTFDISP].ival,0.0,""); bae_dialgetdata(pqryidx,parl[PAROUTFPQRY].ival,0.0,""); bae_dialgetdata(f1idx,0,0.0,PSFONTNAME); bae_dialgetdata(f2idx,0,0.0,PSAFONTNAME); bae_dialgetdata(f1bidx,0,PSFONTBASE,""); bae_dialgetdata(f2bidx,0,PSAFONTBASE,""); bae_dialgetdata(f1sidx,0,PSFONTSTROKE,""); bae_dialgetdata(f2sidx,0,PSAFONTSTROKE,""); parl[PAROUTFONT1].sval=PSFONTNAME; parl[PAROUTFONT2].sval=PSAFONTNAME; parl[PAROUTFONT1B].dval=PSFONTBASE; parl[PAROUTFONT2B].dval=PSAFONTBASE; parl[PAROUTFONT1S].dval=PSFONTSTROKE; parl[PAROUTFONT2S].dval=PSAFONTSTROKE; switch (res) { // File name mode change case 1 : break; // File format change case 2 : adjfname(fnidx,parl[PAROUTFTYP].ival,0); break; // Page editor case 3 : filepages(file,fileidx,batname); break; case 0 : default : repflag=0; } break; // Fail/abort case (-1) : default : if (newflag) { // Delete new file deletefile(batname,file); return(-1); } return(0); } file.parl=parl; // Stop if no further repeat requests } while (repflag); // Delete the old batch file parameters sprintf(sqlcommand,PP_DELETE,file.id); if (sqlcmd(BAEEPSBDAT,sqlcommand,NULL)!=0) // SQL/DB error sql_dberror(29); // Store new file parameter data for (i=0;i1) { bae_dialaddcontrol(PA_ACT,0,3,0,0.0,0.0,0.0, "",0,butx,cy,MBUTWIDTH,UPRDMOVE); butx+=MBUTXSTEP; } // Store done button bae_dialaddcontrol(PA_ACT,0,(-1),0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG,cy,MBUTWIDTH,UPRSFCT5); cy+=DIAL_BUTVSTEP; // Store list box lbidx=bae_dialadvcontrol(PA_LB|PA_OKSEL|PA_HBRDREL|PA_HSCROLL, (-1),0,(-1),0.0,0.0,0.0,"",0, DIAL_LEFTMARG,cy,DIAL_RIGHTSMARG,dialheight-baseheight,""); // Store list box entries for (i=0;i=0 && i=5) file.pagel[ file.pagen].parl[PARPAGEFMT].ival=0; } // Edit file data file.pagel[file.pagen].id=(-1); if (editpage(file.pagel[file.pagen], file.parl[PAROUTFTYP].ival,file.parl[PAROUTFPQRY].ival, file.parl[PAROUTFLAY].ival,file.id,fileidx, file.pagen,batname)==0) file.pagen++; break; // Delete page case 2 : bae_dialgetdata(lbidx,i,0.0,""); if (i>=0 && i=file.pagen) { bae_msgbox(2,ERRNOMOVPAGE,""); break; } baseheight=DIAL_TOPMARG+DIAL_SEPVSTEP+DIAL_BUTVSTEP; do { bae_dialclr(); dial_getboxsizemin(4008,dialwidth,dialheight, DIAL_LEFTMARG+SELBOXWIDTHPS+DIAL_RIGHTSMARG, baseheight+16.0, DIAL_LEFTMARG+5.0*MBUTXSTEP+DIAL_RIGHTSMARG, baseheight+2.0); cy=DIAL_TOPMARG; // Store the OK and abort button with seperator dial_okabort(cy); cy-=DIAL_SEPVSTEP; // Store list box lbidx=bae_dialadvcontrol(PA_LB|PA_OKSEL| PA_HBRDREL|PA_HSCROLL|PA_VBRDREL,(-1),0,(-1), 0.0,0.0,0.0,"",0,DIAL_LEFTMARG,cy, DIAL_RIGHTSMARG,DIAL_SEPVSTEP,""); // Store list box entries for (i=0;ito) for (i=from;i>to;i--) { file.pagel[i]=file.pagel[i-1]; file.pagel[i].parl[PARPAGEIDX].ival=i; // Update the page data updatepage(file.pagel[i]); } else for (i=from;i0) centidx=bae_dialaddcontrol(PA_TOGGLE,0,0, parl[PARPAGECENT].ival,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFP+SB_WIDTHP+1.0, cy,0.0,UPRDCENTPAGE); else centidx=(-1); } cy+=DIAL_CTRVSTEP; // Store scaling factor controls dial_label(0.0,cy,UPRDSCALE); scalidx=bae_dialaddcontrol((parl[PARPAGEFMT].ival==0 || parl[PARPAGEFMT].ival==5 || parl[PARPAGEFMT].ival==7 || parl[PARPAGEFMT].ival==9) ? PA_DBL|PA_CHKLL : PA_LAB,0,5,0,0.0,0.0,parl[PARPAGESCAL].dval, "",0,DIAL_LEFTMARG+CCOLOFFP,cy,SB_WIDTHP,UPRNIL); cy+=DIAL_CTRVSTEP; // Store line scaling controls dial_label(0.0,cy,UPRDLINEMOD); lmodidx=bae_dialaddcontrol(PA_SB,0,0,parl[PARPAGELMOD].ival, 0.0,0.0,0.0,"",0,DIAL_LEFTMARG+CCOLOFFP,cy,SB_WIDTHP,UPRNIL); dial_sbentry(0,0,UPRLINESCL); dial_sbentry(0,1,UPRLINEABS); cy+=DIAL_CTRVSTEP; // Store rotation controls dial_label(0.0,cy,UPRDROTMOD); rmodidx=bae_dialaddcontrol(PA_SB,0,0,parl[PARPAGERMOD].ival, 0.0,0.0,0.0,"",0,DIAL_LEFTMARG+CCOLOFFP,cy,SB_WIDTHP,UPRNIL); dial_sbentry(0,0,UPRROT0); dial_sbentry(0,1,UPRROTBF); dial_sbentry(0,2,UPRROT90); dial_sbentry(0,3,UPRROT180); cy+=DIAL_CTRVSTEP; // Store page offset controls dial_label(0.0,cy,UPRDOFFSET); dial_label(CCOLOFFP-2.0,cy,UPRDX); xoffidx=bae_dialaddcontrol(PA_DBL|PA_DIST,0,3,0,0.0,0.0, parl[PARPAGEXOFF].dval,"",0,DIAL_LEFTMARG+CCOLOFFP,cy, ED_WIDTHL,""); dial_label(CCOLOFFP+10.0,cy,UPRDY); yoffidx=bae_dialaddcontrol(PA_DBL|PA_DIST,0,3,0,0.0,0.0, parl[PARPAGEYOFF].dval,"",0,DIAL_LEFTMARG+CCOLOFFP+12.0,cy, ED_WIDTHL,""); cy+=DIAL_CTRVSTEP; // Store mirror mode controls dial_label(0.0,cy,UPRDMIRRMOD); mirridx=bae_dialaddcontrol(PA_SB,0,0,parl[PARPAGEMIRR].ival, 0.0,0.0,0.0,"",0,DIAL_LEFTMARG+CCOLOFFP,cy,SB_WIDTHP,""); dial_sbentry(0,0,UPRMIRR00); dial_sbentry(0,1,UPRMIRR01); dial_sbentry(0,2,UPRMIRR02); dial_sbentry(0,3,UPRMIRR03); dial_sbentry(0,4,UPRMIRR04); dial_sbentry(0,5,UPRMIRR05); cy+=DIAL_CTRVSTEP; dial_label(0.0,cy,UPRPDFLQRY); lqryidx=dial_toggle(parl[PARPAGELQRY].ival,CCOLOFFP,cy,UPRDON); // Store color controls dial_label(0.0,cy,UPRDBACKCOL); dial_label(CCOLOFFP-2.0,cy,UPRDCR); colridx=bae_dialaddcontrol(PA_DBL|PA_CHKLL|PA_CHKUL,0,2, 0,-SMALLVAL,1.0+SMALLVAL,parl[PARPAGEBRED].dval,"",0, DIAL_LEFTMARG+CCOLOFFP,cy,ED_WIDTHL,""); dial_label(CCOLOFFP+10.0,cy,UPRDCG); colgidx=bae_dialaddcontrol(PA_DBL|PA_CHKLL|PA_CHKUL,0,2, 0,-SMALLVAL,1.0+SMALLVAL,parl[PARPAGEBGREEN].dval,"",0, DIAL_LEFTMARG+CCOLOFFP+12.0,cy,ED_WIDTHL,""); dial_label(CCOLOFFP+22.0,cy,UPRDCB); colbidx=bae_dialaddcontrol(PA_DBL|PA_CHKLL|PA_CHKUL,0,2, 0,-SMALLVAL,1.0+SMALLVAL,parl[PARPAGEBBLUE].dval,"",0, DIAL_LEFTMARG+CCOLOFFP+24.0,cy,ED_WIDTHL,""); bae_dialaddcontrol(PA_ACT,0,3,0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFP+34.0,cy,0.0,UPRBRWCOLOR); cy+=DIAL_CTRVSTEP; // Store annotation color controls dial_label(0.0,cy,UPRDANNO); annidx=bae_dialaddcontrol(PA_SB,0,0,parl[PARPAGEANNO].ival, 0.0,0.0,0.0,"",0,DIAL_LEFTMARG+CCOLOFFP,cy,SB_WIDTHP,""); dial_sbentry(1,0,UPRANNO00); dial_sbentry(1,1,UPRANNO01); dial_sbentry(1,2,UPRANNO02); dial_sbentry(1,3,UPRANNO03); dial_sbentry(1,4,UPRANNO04); dial_sbentry(1,5,UPRANNO05); dial_sbentry(1,6,UPRANNO06); cy+=DIAL_CTRVSTEP; dial_label(0.0,cy,UPRDANNOCOL); dial_label(CCOLOFFP-2.0,cy,UPRDCR); cmode=(parl[PARPAGEANNO].ival ? 0 : PA_GRAYED)| PA_DBL|PA_CHKLL|PA_CHKUL; acridx=bae_dialaddcontrol(cmode,0,2,0,-SMALLVAL,1.0+SMALLVAL, parl[PARPAGEARED].dval,"",0,DIAL_LEFTMARG+CCOLOFFP,cy, ED_WIDTHL,""); dial_label(CCOLOFFP+10.0,cy,UPRDCG); acgidx=bae_dialaddcontrol(cmode,0,2,0,-SMALLVAL,1.0+SMALLVAL, parl[PARPAGEAGREEN].dval,"",0,DIAL_LEFTMARG+CCOLOFFP+12.0,cy, ED_WIDTHL,""); dial_label(CCOLOFFP+22.0,cy,UPRDCB); acbidx=bae_dialaddcontrol(cmode,0,2,0,-SMALLVAL,1.0+SMALLVAL, parl[PARPAGEABLUE].dval,"",0,DIAL_LEFTMARG+CCOLOFFP+24.0,cy, ED_WIDTHL,""); bae_dialaddcontrol(PA_ACT,0,5,0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFP+34.0,cy,0.0,UPRBRWCOLOR); cy+=DIAL_CTRVSTEP; // Call the dialog function sprintf(msg,UPRDIALOPDEF,batname,fileidx+1,pageidx+1); bae_setintpar(16,4009); switch (res=bae_dialaskparams(msg,0,DIAL_LEFTMARG+CCOLOFFP+ ED_WIDTHP+5.0+DIAL_RIGHTSMARG,cy+DIAL_SEPVSTEP)) { case 0 : case 1 : case 2 : case 3 : case 4 : case 5 : case 6 : // Get data from dialog box entries if (pnidx==(-1)) parl[PARPAGENAME].sval=""; else bae_dialgetdata( pnidx,0,0.0,parl[PARPAGENAME].sval); if (maidx==(-1)) parl[PARPAGEMACRO].sval=""; else bae_dialgetdata( maidx,0,0.0,parl[PARPAGEMACRO].sval); if (centidx==(-1)) parl[PARPAGECENT].ival=0; else bae_dialgetdata( centidx,parl[PARPAGECENT].ival,0.0,""); if (ecidx==(-1)) parl[PARPAGEECOMM].ival=0; else bae_dialgetdata( ecidx,parl[PARPAGEECOMM].ival,0.0,""); bae_dialgetdata(pmidx,parl[PARPAGEMODE].ival,0.0,""); if (pageqry) bae_dialgetdata( outsidx,parl[PARPAGEOUT].ival,0.0,""); else parl[PARPAGEOUT].ival=1; bae_dialgetdata(fmtidx,parl[PARPAGEFMT].ival,0.0,""); bae_dialgetdata(lmodidx,parl[PARPAGELMOD].ival,0.0,""); bae_dialgetdata(rmodidx,parl[PARPAGERMOD].ival,0.0,""); bae_dialgetdata(mirridx,parl[PARPAGEMIRR].ival,0.0,""); bae_dialgetdata(xoffidx,0,parl[PARPAGEXOFF].dval,""); bae_dialgetdata(yoffidx,0,parl[PARPAGEYOFF].dval,""); bae_dialgetdata(scalidx,0,parl[PARPAGESCAL].dval,""); bae_dialgetdata(lqryidx,parl[PARPAGELQRY].ival,0.0,""); bae_dialgetdata(colridx,0,parl[PARPAGEBRED].dval,""); bae_dialgetdata(colgidx,0,parl[PARPAGEBGREEN].dval,""); bae_dialgetdata(colbidx,0,parl[PARPAGEBBLUE].dval,""); bae_dialgetdata(annidx,parl[PARPAGEANNO].ival,0.0,""); if (parl[PARPAGEANNO].ival) { bae_dialgetdata( acridx,0,parl[PARPAGEARED].dval,""); bae_dialgetdata( acgidx,0,parl[PARPAGEAGREEN].dval,""); bae_dialgetdata( acbidx,0,parl[PARPAGEABLUE].dval,""); } switch (res) { case 0 : repflag=0; break; // Page name/annotation mode change case 1 : break; // Layer editor case 2 : pagelayers(page,lgrp,fileidx,pageidx,batname); break; // Browse background color case 3 : browsecolor(parl[PARPAGEBRED].dval, parl[PARPAGEBGREEN].dval, parl[PARPAGEBBLUE].dval); break; // Browse page template macro case 4 : if (strextractfilepath(PDFLIB)=="") pdflib=strextractfilepath( lay_deflibname())+PDFLIB; else pdflib=PDFLIB; pagetemp=parl[PARPAGEMACRO].sval; if (bae_askddbename(pagetemp,pdflib,DDBCLLAY, msgstring(UPRPAGEMACRO, convstring(pdflib,1)))!=0) break; parl[PARPAGEMACRO].sval=pagetemp; break; // Browse annotation color case 5 : browsecolor(parl[PARPAGEARED].dval, parl[PARPAGEAGREEN].dval, parl[PARPAGEABLUE].dval); break; // Grid editor case 6 : pagegrids(page,lgrp,fileidx,pageidx,batname); break; } break; // Fail/abort case (-1) : default : if (newflag) { // Delete new page deletepage(page.id); return(-1); } return(0); } page.parl=parl; // Stop if no further repeat requests } while (repflag); // Update the page data updatepage(page); return(0); } void pagelayers( struct pagedes page,int lgrp,int fileidx,int pageidx,string batname) /* // Edit batch file page layers, store result to batch database // Parameters : // struct pagedes page : Page data // int lgrp : Layer group flag // int fileidx : File index // int pageidx : Page index // string batname : Batch name */ { string msg /* Message buffer */; struct layerdes swaplay /* Layer swap buffer */; double cy /* Current y value */; double butx /* Current button position */; double dialwidth /* Dialog box width */; double dialheight /* Dialog box height */; double baseheight /* Dialog box base height */; int res /* Selection result */; int repflag = 1 /* Repeat flag */; int lbidx /* List box item index */; int from /* From index */; int to /* To index */; int i /* Loop control variable */; // Perform the input loop do { baseheight=DIAL_TOPMARG+DIAL_BUTVSTEP+DIAL_SEPVSTEP; bae_dialclr(); dial_getboxsizemin(4010,dialwidth,dialheight, DIAL_LEFTMARG+SELBOXWIDTHLS+DIAL_RIGHTSMARG, baseheight+16.0,DIAL_LEFTMARG+6.0*MBUTXSTEP+DIAL_RIGHTSMARG, baseheight+2.0); cy=DIAL_TOPMARG; butx=DIAL_LEFTMARG+MBUTXSTEP; // Store function buttons // Edit layer if (page.layn) { bae_dialaddcontrol(PA_ACT,0,0,0,0.0,0.0,0.0, "",0,butx,cy,MBUTWIDTH,UPRDEDIT); butx+=MBUTXSTEP; } // Add layer bae_dialaddcontrol(PA_ACT,0,1,0,0.0,0.0,0.0,"",0, butx,cy,MBUTWIDTH,UPRDADD); butx+=MBUTXSTEP; // Derive layer bae_dialaddcontrol(PA_ACT,0,4,0,0.0,0.0,0.0,"",0, butx,cy,MBUTWIDTH,UPRDDERIVE); butx+=MBUTXSTEP; // Delete layer if (page.layn) { bae_dialaddcontrol(PA_ACT,0,2,0,0.0,0.0,0.0, "",0,butx,cy,MBUTWIDTH,UPRDDEL); butx+=MBUTXSTEP; } // Move layer if (page.layn>1) { bae_dialaddcontrol(PA_ACT,0,3,0,0.0,0.0,0.0, "",0,butx,cy,MBUTWIDTH,UPRDMOVE); butx+=MBUTXSTEP; } // Store done button bae_dialaddcontrol(PA_ACT,0,(-1),0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG,cy,MBUTWIDTH,UPRSFCT5); cy+=DIAL_BUTVSTEP; // Store list box lbidx=bae_dialadvcontrol(PA_LB|PA_OKSEL|PA_HBRDREL|PA_HSCROLL, (-1),0,(-1),0.0,0.0,0.0,"",0, DIAL_LEFTMARG,cy,DIAL_RIGHTSMARG,dialheight-baseheight,""); // Store list box entries for (i=0;i=0 && i=0 && i=page.layn) { bae_msgbox(2,ERRNOMOVLAY,""); break; } baseheight=DIAL_TOPMARG+DIAL_SEPVSTEP+DIAL_BUTVSTEP; do { bae_dialclr(); cy=DIAL_TOPMARG; dial_getboxsizemin(4010,dialwidth,dialheight, DIAL_LEFTMARG+SELBOXWIDTHLS+DIAL_RIGHTSMARG, baseheight+16.0, DIAL_LEFTMARG+5.0*MBUTXSTEP+DIAL_RIGHTSMARG, baseheight+2.0); // Store the OK and abort button with seperator dial_okabort(cy); cy-=DIAL_SEPVSTEP; // Store list box lbidx=bae_dialadvcontrol(PA_LB|PA_OKSEL| PA_HBRDREL|PA_HSCROLL|PA_VBRDREL,(-1),0,(-1), 0.0,0.0,0.0,"",0,DIAL_LEFTMARG,cy, DIAL_RIGHTSMARG,DIAL_SEPVSTEP,""); // Store list box entries for (i=0;ito) for (i=from;i>to;i--) { page.layl[i]=page.layl[i-1]; page.layl[i].parl[PARLAYIDX].ival=i; updatelayer(page.layl[i]); } else for (i=from;i=0 && i=LAYERDRLZ && laynum<=LAYERDRLD)) ? 1 : 0 ; // Perform the dialog input loop repflag=1; do { bae_dialclr(); // Init. the y coordinate cy=DIAL_TOPMARG; dial_label(CCOLOFFL+2.0,cy,layername(laynum)); // Store the OK and abort button with seperator dial_okabort(cy); cy-=DIAL_SEPVSTEP; bae_dialaddcontrol(PA_HSEP,0,0,0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG,cy,CCOLOFFL2-1.0,""); cy+=DIAL_SEPVSTEP; parl=layer.parl; if (psdrlflag) { // Store drill display mode controls dial_label(0.0,cy,UPRDDMODE); fillidx=bae_dialaddcontrol(PA_RBF,0,4, parl[PARLAYFILL].ival&DRLDISPMASK,0.0,0.0,0.0, "",0,DIAL_LEFTMARG+CCOLOFFL,cy,0.0,UPRDDCROSS); bae_dialaddcontrol(PA_RBN,DRLOUTLDISP,4,0,0.0,0.0,0.0, "",0,DIAL_LEFTMARG+CCOLOFFL+13.0,cy,0.0,UPRDDOUTL); bae_dialaddcontrol(PA_RBN,DRLFILLDISP,4,0,0.0,0.0,0.0, "",0,DIAL_LEFTMARG+CCOLOFFL+24.0,cy,0.0,UPRDDFILL); bae_dialaddcontrol(PA_RBN,DRLDOTDISP,4,0,0.0,0.0,0.0, "",0,DIAL_LEFTMARG+CCOLOFFL+35.0,cy,0.0,UPRDDDOT); cy+=DIAL_CTRVSTEP; dial_label(0.0,cy,UPRDRLDOTRAD); drdoidx=bae_dialaddcontrol(PA_DBL|PA_DIST|PA_CHKLL| ((parl[PARLAYFILL].ival&DRLDOTDISP) ? 0 : PA_GRAYED), 0,3,0,0.0,0.0,parl[PARLAYDRLDOT].dval,"",0, DIAL_LEFTMARG+CCOLOFFL+2.0,cy,ED_WIDTHL,""); } else { // Store fill mode controls if (laynum==LAYERBRD) { ofidx=bae_dialaddcontrol(PA_TOGGLE,0,0, parl[PARLAYOUTLF].ival,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFL+2.0,cy,0.0, UPRDOUTLFILL); } else { dial_label(0.0,cy,UPRDPMODE); fillidx=bae_dialaddcontrol(PA_RBF,1,4, parl[PARLAYFILL].ival,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFL+2.0,cy,0.0,UPRDPFILL); bae_dialaddcontrol( PA_RBN,0,4,0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFL+24.0,cy,0.0,UPRDPOUTL); } drdoidx=(-1); } cy+=DIAL_CTRVSTEP; if (laynum>=DOCLAYBASE) { clfidx=bae_dialaddcontrol(PA_TOGGLE,0,0, parl[PARLAYCLFILL].ival,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFL+2.0,cy,0.0, UPRDCLINEFILL); cy+=DIAL_CTRVSTEP; // Store plot visibility mode controls dial_label(0.0,cy,UPRDEPLOTVIS); pvisidx=bae_dialaddcontrol(PA_RBF,1,0, parl[PARLAYPVIS].ival,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFL+2.0,cy,0.0,UPRDEPLOTV1); bae_dialaddcontrol(PA_RBN,0,0,0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFL+13.0,cy,0.0,UPRDEPLOTV0); bae_dialaddcontrol(PA_RBN,2,0,0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFL+24.0,cy,0.0,UPRDEPLOTV2); bae_dialaddcontrol(PA_RBN,3,0,0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFL+35.0,cy,0.0,UPRDEPLOTV3); cy+=DIAL_CTRVSTEP; } // Store line width controls dial_label(0.0,cy,UPRDLINEWH); dial_label(CCOLOFFL+2.0,cy,UPRDLINEWP); pwididx=bae_dialaddcontrol(PA_DBL|PA_DIST|PA_CHKLL,0,3, 0,-SMALLVAL,0.0,parl[PARLAYPOLYW].dval,"",0, DIAL_LEFTMARG+CCOLOFFL+13.0,cy,ED_WIDTHL,""); dial_label(CCOLOFFL+22.0,cy,UPRDLINEWT); twididx=bae_dialaddcontrol(PA_DBL|PA_DIST|PA_CHKLL,0,3, 0,-SMALLVAL,0.0,parl[PARLAYTEXTW].dval,"",0, DIAL_LEFTMARG+CCOLOFFL+35.0,cy,ED_WIDTHL,""); cy+=DIAL_CTRVSTEP; if (!psdrlflag) { // Store hatch controls dial_label(0.0,cy,UPRDHANGLE); hangidx=bae_dialaddcontrol(PA_DBL|PA_ANGLE,0,2, 0,0.0,0.0,parl[PARLAYHANGLE].dval,"",0, DIAL_LEFTMARG+CCOLOFFL+2.0,cy,ED_WIDTHL,""); dial_label(CCOLOFFL+13.0,cy,UPRDHSPACE); hspcidx=bae_dialaddcontrol(PA_DBL|PA_DIST|PA_CHKLL,0,3, 0,-SMALLVAL,0.0,parl[PARLAYHSPACE].dval,"",0, DIAL_LEFTMARG+CCOLOFFL+35.0,cy,ED_WIDTHL,""); cy+=DIAL_CTRVSTEP; // Store dash controls dial_label(0.0,cy,UPRDDASH); dsh1idx=bae_dialaddcontrol(PA_DBL|PA_DIST|PA_CHKLL,0,3, 0,-SMALLVAL,0.0,parl[PARLAYDASH1].dval,"",0, DIAL_LEFTMARG+CCOLOFFL+2.0,cy,ED_WIDTHL,""); dsh2idx=bae_dialaddcontrol(PA_DBL|PA_DIST|PA_CHKLL,0,3, 0,-SMALLVAL,0.0,parl[PARLAYDASH2].dval,"",0, DIAL_LEFTMARG+CCOLOFFL+13.0,cy,ED_WIDTHL,""); dsh3idx=bae_dialaddcontrol(PA_DBL|PA_DIST|PA_CHKLL,0,3, 0,-SMALLVAL,0.0,parl[PARLAYDASH3].dval,"",0, DIAL_LEFTMARG+CCOLOFFL+24.0,cy,ED_WIDTHL,""); dsh4idx=bae_dialaddcontrol(PA_DBL|PA_DIST|PA_CHKLL,0,3, 0,-SMALLVAL,0.0,parl[PARLAYDASH4].dval,"",0, DIAL_LEFTMARG+CCOLOFFL+35.0,cy,ED_WIDTHL,""); cy+=DIAL_CTRVSTEP; } // Store output format controls if (layerqry) { dial_label(0.0,cy,UPRDOUTMODE); outsidx=bae_dialaddcontrol(PA_SB,0,0, parl[PARLAYOUT].ival,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFL+2.0,cy,SB_WIDTHP,""); dial_sbentry(0,0,UPROUTMODE1); dial_sbentry(0,1,UPROUTMODE2); dial_sbentry(0,2,UPROUTMODE3); cy+=DIAL_CTRVSTEP; } // Store color controls dial_label(0.0,cy,UPRDCOLOR); fcolidx=bae_dialaddcontrol(PA_TOGGLE,0,0, parl[PARLAYFORCECOL].ival,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+13.0,cy,0.0,UPRDFORCECOL); dial_label(CCOLOFFL,cy,UPRDCR); colridx=bae_dialaddcontrol(PA_DBL|PA_CHKLL|PA_CHKUL,0,2, 0,-SMALLVAL,1.0+SMALLVAL,parl[PARLAYRED].dval,"",0, DIAL_LEFTMARG+CCOLOFFL+2.0,cy,ED_WIDTHL,""); dial_label(CCOLOFFL+11.0,cy,UPRDCG); colgidx=bae_dialaddcontrol(PA_DBL|PA_CHKLL|PA_CHKUL,0,2, 0,-SMALLVAL,1.0+SMALLVAL,parl[PARLAYGREEN].dval,"",0, DIAL_LEFTMARG+CCOLOFFL+13.0,cy,ED_WIDTHL,""); dial_label(CCOLOFFL+22.0,cy,UPRDCB); colbidx=bae_dialaddcontrol(PA_DBL|PA_CHKLL|PA_CHKUL,0,2, 0,-SMALLVAL,1.0+SMALLVAL,parl[PARLAYBLUE].dval,"",0, DIAL_LEFTMARG+CCOLOFFL+24.0,cy,ED_WIDTHL,""); bae_dialaddcontrol(PA_ACT,0,1,0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFL+35.0,cy,0.0,UPRBRWCOLOR); cy+=DIAL_CTRVSTEP; if (!psdrlflag) { // Store error color controls errdisp=parl[PARLAYEDSP].ival; edspidx=bae_dialaddcontrol(PA_TOGGLE,0,3,errdisp,0.0, 0.0,0.0,"",0,DIAL_LEFTMARG,cy,0.0,UPRDECOLOR); dial_label(CCOLOFFL,cy,UPRDCR); ecolridx=bae_dialaddcontrol(errdisp ? (PA_DBL|PA_CHKLL|PA_CHKUL) : PA_LAB,0,2,0, -SMALLVAL,1.0+SMALLVAL,parl[PARLAYERED].dval,"", 0,DIAL_LEFTMARG+CCOLOFFL+2.0,cy,ED_WIDTHL,UPRNIL); dial_label(CCOLOFFL+11.0,cy,UPRDCG); ecolgidx=bae_dialaddcontrol(errdisp ? (PA_DBL|PA_CHKLL|PA_CHKUL) : PA_LAB,0,2,0, -SMALLVAL,1.0+SMALLVAL,parl[PARLAYEGREEN].dval, "",0,DIAL_LEFTMARG+CCOLOFFL+13.0,cy,ED_WIDTHL,UPRNIL); dial_label(CCOLOFFL+22.0,cy,UPRDCB); ecolbidx=bae_dialaddcontrol(errdisp ? (PA_DBL|PA_CHKLL|PA_CHKUL) : PA_LAB,0,2,0, -SMALLVAL,1.0+SMALLVAL,parl[PARLAYEBLUE].dval, "",0,DIAL_LEFTMARG+CCOLOFFL+24.0,cy,ED_WIDTHL,UPRNIL); ebrwidx=bae_dialaddcontrol(errdisp ? PA_ACT : PA_NIL,0, 2,0,0.0,0.0,0.0,"",0,DIAL_LEFTMARG+CCOLOFFL+35.0,cy, 0.0,UPRBRWCOLOR); cy+=DIAL_CTRVSTEP; } if (lgrp) { dial_label(0.0,cy,UPRDLAYGRP); lgrpidx=bae_dialaddcontrol(PA_STR,0,0,0,0.0,0.0,0.0, parl[PARLAYGNAME].sval,MAXPATHLEN,DIAL_LEFTMARG+ CCOLOFFL+2.0,cy,22.0+ED_WIDTHL,""); lactidx=bae_dialaddcontrol(PA_TOGGLE,0,0, parl[PARLAYACT].ival,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFL+35.0,cy,0.0,UPRDLAYACT); cy+=DIAL_CTRVSTEP; lgiidx=bae_dialaddcontrol(PA_TOGGLE,0,0, parl[PARLAYGIGN].ival,0.0,0.0,0.0, "",0,DIAL_LEFTMARG+CCOLOFFL+2.0,cy,0.0,UPRDLAYGIGN); cy+=DIAL_CTRVSTEP; } // Store font controls if (psdrlflag && laynum!=LAYERDRLD) { dcidx=bae_dialaddcontrol(PA_TOGGLE,0,0, (parl[PARLAYFILL].ival&DRLTXTDISP) ? 1 : 0,0.0,0.0,0.0, "",0,DIAL_LEFTMARG+CCOLOFFL+2.0,cy,0.0,UPRDCMODE); cy+=DIAL_CTRVSTEP; } else { dcidx=(-1); } dial_label(0.0,cy,UPRDFONT); fontidx=bae_dialaddcontrol(PA_RBF,0,0,parl[PARLAYFONT].ival,0.0, 0.0,0.0,"",0,DIAL_LEFTMARG+CCOLOFFL+2.0,cy,0.0,UPRFONTBAE); bae_dialaddcontrol(PA_RBN,1,0,0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFL+13.0,cy,0.0,PSFONTNAME); bae_dialaddcontrol(PA_RBN,2,0,0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFL+24.0,cy,0.0,PSAFONTNAME); cy+=DIAL_CTRVSTEP; if (laynum>=POWLAYBASE && laynum=0 && laynum1 || (laytypclass<YPDOCSIG)==0 || parl[PARLAYFILL].ival) { polyidxa[i][j]=(-1); bitval<<=1; continue; } break; case L_POLYHTCHCOP : if (i>1 || (laytypclass<YPDOCSIG)==0) { polyidxa[i][j]=(-1); bitval<<=1; continue; } break; case L_POLYDOCLINE : if ((laytypclass<YPDOC)==0) { polyidxa[i][j]=(-1); bitval<<=1; continue; } break; case L_POLYDOCAREA : if ((laytypclass<YPDOCSIG)==0) { polyidxa[i][j]=(-1); bitval<<=1; continue; } break; default : ; } if (labflag==0) dial_label(CCOLOFFL2,iy, bae_plainmenutext(polytypename(j))); labflag=1; polyidxa[i][j]=bae_dialaddcontrol(PA_TOGGLE,0,0, (parl[PARLAYPOLYCL+j].ival&bitval) ? 1 : 0,0.0, 0.0,0.0,"",0,DIAL_LEFTMARG+CCOLOFFL3+i*4.0,iy, 0.0,classlst[i]); bitval<<=1; } if (labflag) iy+=DIAL_CTRVSTEP; } if (!psdrlflag) { dial_label(CCOLOFFL2,iy,UPRTEXT); bitval=1; for (i=0;i<4;i++) { textidxl[i]=bae_dialaddcontrol(PA_TOGGLE,0,0, (parl[PARLAYTEXTCL].ival&bitval) ? 1 : 0,0.0, 0.0,0.0,"",0,DIAL_LEFTMARG+CCOLOFFL3+i*4.0,iy, 0.0,classlst[i]); bitval<<=1; } iy+=DIAL_CTRVSTEP; } else { for (i=0;i<4;i++) textidxl[i]=(-1); } bae_dialaddcontrol(PA_ACT,0,5,0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFL2,iy,0.0,UPRIALL); bae_dialaddcontrol(PA_ACT,0,6,0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFL2+bae_dialgettextlen(0,UPRIALL)+ (bae_swconfig(3)==2 ? 2.0 : 1.0),iy,0.0,UPRINONE); iy+=DIAL_BUTVSTEP; if (iy>cy) cy=iy; cy+=DIAL_SEPVSTEP; bae_dialaddcontrol(PA_VSEP,0,0,0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFL2-1.0,0,cy,""); // Call the dialog function sprintf(msg,UPRDIALLAYPAR,batname,fileidx+1,pageidx+1, pagename(filel[fileidx].pagel[pageidx],1)); bae_setintpar(16,4011); switch (res=bae_dialaskparams(msg,0, DIAL_LEFTMARG+SELBOXWIDTHLE+DIAL_RIGHTSMARG,cy)) { case 0 : case 1 : case 2 : case 3 : case 4 : case 5 : case 6 : // Get data from dialog box entries if (fillidx!=(-1)) bae_dialgetdata( fillidx,parl[PARLAYFILL].ival,0.0,""); if (ofidx!=(-1)) bae_dialgetdata( ofidx,parl[PARLAYOUTLF].ival,0.0,""); if (clfidx!=(-1)) bae_dialgetdata( clfidx,parl[PARLAYCLFILL].ival,0.0,""); if (dcidx!=(-1)) { bae_dialgetdata(dcidx,drlcdisp,0.0,""); if (drlcdisp) parl[PARLAYFILL].ival|=DRLTXTDISP; } if (pvisidx!=(-1)) bae_dialgetdata( pvisidx,parl[PARLAYPVIS].ival,0.0,""); if (layerqry) bae_dialgetdata( outsidx,parl[PARLAYOUT].ival,0.0,""); else parl[PARLAYOUT].ival=1; bae_dialgetdata(colridx,0,parl[PARLAYRED].dval,""); bae_dialgetdata(colgidx,0,parl[PARLAYGREEN].dval,""); bae_dialgetdata(colbidx,0,parl[PARLAYBLUE].dval,""); bae_dialgetdata( fcolidx,parl[PARLAYFORCECOL].ival,0.0,""); if (!psdrlflag) { bae_dialgetdata( edspidx,parl[PARLAYEDSP].ival,0.0,""); bae_dialgetdata( ecolridx,0,parl[PARLAYERED].dval,""); bae_dialgetdata( ecolgidx,0,parl[PARLAYEGREEN].dval,""); bae_dialgetdata( ecolbidx,0,parl[PARLAYEBLUE].dval,""); bae_dialgetdata( hangidx,0,parl[PARLAYHANGLE].dval,""); bae_dialgetdata( hspcidx,0,parl[PARLAYHSPACE].dval,""); bae_dialgetdata( dsh1idx,0,parl[PARLAYDASH1].dval,""); bae_dialgetdata( dsh2idx,0,parl[PARLAYDASH2].dval,""); bae_dialgetdata( dsh3idx,0,parl[PARLAYDASH3].dval,""); bae_dialgetdata( dsh4idx,0,parl[PARLAYDASH4].dval,""); } bae_dialgetdata(pwididx,0,parl[PARLAYPOLYW].dval,""); bae_dialgetdata(twididx,0,parl[PARLAYTEXTW].dval,""); if (lgrpidx>=0) { bae_dialgetdata( lgrpidx,0,0.0,parl[PARLAYGNAME].sval); bae_dialgetdata( lactidx,parl[PARLAYACT].ival,0.0,""); bae_dialgetdata( lgiidx,parl[PARLAYGIGN].ival,0.0,""); } if (pwbwidx>=0) { bae_dialgetdata( pwbwidx,0,parl[PARLAYPOWBW].dval,""); bae_dialgetdata( pwpwidx,0,parl[PARLAYPOWPW].dval,""); bae_dialgetdata( pwhwidx,0,parl[PARLAYPOWHW].dval,""); bae_dialgetdata( pwhdidx,0,parl[PARLAYPOWHTD].dval,""); bae_dialgetdata(pwhaidx, parl[PARLAYPOWHTANG].ival,0.0,""); bae_dialgetdata( pwddidx,0,parl[PARLAYPOWDRD].dval,""); } if (pwcmidx>=0) bae_dialgetdata( pwcmidx,parl[PARLAYPOWCAM].ival,0.0,""); if (drdoidx>=0) bae_dialgetdata( drdoidx,0,parl[PARLAYDRLDOT].dval,""); bae_dialgetdata(fontidx,parl[PARLAYFONT].ival,0.0,""); bitval=1; parl[PARLAYPATHCL].ival=0xC; for (i=0;i<2;i++) { if (pathidxl[i]>=0) bae_dialgetdata( pathidxl[i],intval,0.0,""); else intval=1; if (intval) parl[PARLAYPATHCL].ival|=bitval; bitval<<=1; } for (j=L_POLYCOPPASS;j<=L_POLYSPPAREA;j++) { parl[PARLAYPOLYCL+j].ival=0; bitval=1; for (i=0;i<4;i++) { if (polyidxa[i][j]>=0) bae_dialgetdata( polyidxa[i][j],intval,0.0,""); else intval=1; if (intval) parl[PARLAYPOLYCL+j].ival|= bitval; bitval<<=1; } } bitval=1; parl[PARLAYTEXTCL].ival=0; for (i=0;i<4;i++) { if (textidxl[i]>=0) bae_dialgetdata( textidxl[i],intval,0.0,""); else intval=1; if (intval) parl[PARLAYTEXTCL].ival|=bitval; bitval<<=1; } switch (res) { case 0 : repflag=0; break; // Browse layer color case 1 : browsecolor(parl[PARLAYRED].dval, parl[PARLAYGREEN].dval,parl[PARLAYBLUE].dval); break; // Browse layer error color case 2 : browsecolor(parl[PARLAYERED].dval, parl[PARLAYEGREEN].dval, parl[PARLAYEBLUE].dval); break; // Toggle error display case 3 : errdisp=parl[PARLAYEDSP].ival; bae_dialsetdata(ecolridx,errdisp ? (PA_DBL|PA_CHKLL|PA_CHKUL) : PA_LAB,0, parl[PARLAYERED].dval,UPRNIL); bae_dialsetdata(ecolgidx,errdisp ? (PA_DBL|PA_CHKLL|PA_CHKUL) : PA_LAB,0, parl[PARLAYEGREEN].dval,UPRNIL); bae_dialsetdata(ecolbidx,errdisp ? (PA_DBL|PA_CHKLL|PA_CHKUL) : PA_LAB,0, parl[PARLAYEBLUE].dval,UPRNIL); bae_dialsetdata(ebrwidx,errdisp ? PA_ACT : PA_NIL,0,0.0,UPRBRWCOLOR); break; // Power/drill layer parameter items update case 4 : break; // Set all items case 5 : parl[PARLAYPATHCL].ival=0xF; for (j=L_POLYCOPPASS;j<=L_POLYSPPAREA;j++) parl[PARLAYPOLYCL+j].ival=0xF; parl[PARLAYTEXTCL].ival=0xF; break; // Clear all items case 6 : parl[PARLAYPATHCL].ival=0; for (j=L_POLYCOPPASS;j<=L_POLYSPPAREA;j++) parl[PARLAYPOLYCL+j].ival=0; parl[PARLAYTEXTCL].ival=0; break; } break; // Fail/abort case (-1) : default : if (newflag) { // Delete new layer sprintf(sqlcommand,L_DELETES,layer.id); if (sqlcmd(BAEEPSBDAT,sqlcommand,NULL)!=0) // SQL/DB error sql_dberror(29); return(-1); } return(0); } layer.parl=parl; // Stop if no further repeat requests } while (repflag); // Update the layer data updatelayer(layer); return(0); } void pagegrids( struct pagedes page,int lgrp,int fileidx,int pageidx,string batname) /* // Edit batch file page grids, store result to batch database // Parameters : // struct pagedes page : Page data // int lgrp : Layer group flag // int fileidx : File index // int pageidx : Page index // string batname : Batch name */ { string msg /* Message buffer */; struct griddes swapgrid /* Grid swap buffer */; double cy /* Current y value */; double butx /* Current button position */; double dialwidth /* Dialog box width */; double dialheight /* Dialog box height */; double baseheight /* Dialog box base height */; int res /* Selection result */; int repflag = 1 /* Repeat flag */; int lbidx /* List box item index */; int from /* From index */; int to /* To index */; int i /* Loop control variable */; // Perform the input loop do { baseheight=DIAL_TOPMARG+DIAL_BUTVSTEP+DIAL_SEPVSTEP; bae_dialclr(); cy=DIAL_TOPMARG; dial_getboxsizemin(4043,dialwidth,dialheight, DIAL_LEFTMARG+SELBOXWIDTHLS+DIAL_RIGHTSMARG, baseheight+16.0,DIAL_LEFTMARG+5.0*MBUTXSTEP+DIAL_RIGHTSMARG, baseheight+2.0); butx=DIAL_LEFTMARG+MBUTXSTEP; // Store function buttons // Edit grid if (page.gridn) { bae_dialaddcontrol(PA_ACT,0,0,0,0.0,0.0,0.0, "",0,butx,cy,MBUTWIDTH,UPRDEDIT); butx+=MBUTXSTEP; } // Add grid bae_dialaddcontrol(PA_ACT,0,1,0,0.0,0.0,0.0,"",0, butx,cy,MBUTWIDTH,UPRDADD); butx+=MBUTXSTEP; // Delete grid if (page.gridn) { bae_dialaddcontrol(PA_ACT,0,2,0,0.0,0.0,0.0, "",0,butx,cy,MBUTWIDTH,UPRDDEL); butx+=MBUTXSTEP; } // Move page if (page.gridn>1) { bae_dialaddcontrol(PA_ACT,0,3,0,0.0,0.0,0.0, "",0,butx,cy,MBUTWIDTH,UPRDMOVE); butx+=MBUTXSTEP; } // Store done button bae_dialaddcontrol(PA_ACT,0,(-1),0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG,cy,MBUTWIDTH,UPRSFCT5); cy+=DIAL_BUTVSTEP; // Store list box lbidx=bae_dialadvcontrol(PA_LB|PA_OKSEL|PA_HBRDREL|PA_HSCROLL, (-1),0,(-1),0.0,0.0,0.0,"",0, DIAL_LEFTMARG,cy,DIAL_RIGHTSMARG,dialheight-baseheight,""); // Store list box entries for (i=0;i=0 && i=0 && i=page.gridn) { bae_msgbox(2,ERRNOMOVGRID,""); break; } baseheight=DIAL_TOPMARG+DIAL_SEPVSTEP+DIAL_BUTVSTEP; do { bae_dialclr(); dial_getboxsizemin(4043,dialwidth,dialheight, DIAL_LEFTMARG+SELBOXWIDTHLS+DIAL_RIGHTSMARG, baseheight+16.0, DIAL_LEFTMARG+5.0*MBUTXSTEP+DIAL_RIGHTSMARG, baseheight+2.0); cy=DIAL_TOPMARG; // Store the OK and abort button with seperator dial_okabort(cy); cy-=DIAL_SEPVSTEP; // Store list box lbidx=bae_dialadvcontrol(PA_LB|PA_OKSEL| PA_HBRDREL|PA_HSCROLL|PA_VBRDREL,(-1),0,(-1), 0.0,0.0,0.0,"",0,DIAL_LEFTMARG,cy, DIAL_RIGHTSMARG,DIAL_SEPVSTEP,""); // Store list box entries for (i=0;ito) for (i=from;i>to;i--) { page.gridl[i]=page.gridl[i-1]; page.gridl[i].parl[PARGRIDIDX].ival=i; updategrid(page.gridl[i]); } else for (i=from;i=0) { bae_dialgetdata( grpidx,0,0.0,grid.parl[PARGRIDGNAME].sval); bae_dialgetdata( actidx,grid.parl[PARGRIDACT].ival,0.0,""); } bae_dialgetdata( prtidx,grid.parl[PARGRIDPRT].ival,0.0,""); switch (res) { case 0 : repflag=0; break; // Grid display color case 1 : browsecolor(grid.parl[PARGRIDRED].dval, grid.parl[PARGRIDGREEN].dval, grid.parl[PARGRIDBLUE].dval); break; // Switch to mm units case 2 : cunits=0; break; // Switch to mil units case 3 : cunits=2; break; } break; // Fail/abort case (-1) : default : if (newflag) { // Delete new grid sprintf(sqlcommand,G_DELETES,grid.id); if (sqlcmd(BAEEPSBDAT,sqlcommand,NULL)!=0) // SQL/DB error sql_dberror(29); return(-1); } return(0); } // Stop if no further repeat requests } while (repflag); // Update the grid data updategrid(grid); return(0); } void initfile(struct filedes file) /* // Init. batch page parameters // Parameters : // struct filedes file : File data */ { int i /* Loop control variable */; file.pagen=0; file.parn=PAROUTFCNT; // Clear all parameters for (i=0;i=batn) errormsg(ERRNOBATCH,batname); } newbatname=batname; // Get batch entries batn=0; if (sqlcmd(dstdb,B_SELECT,batnamefunc)!=0) // SQL/DB error sql_dberror(0); // Search batch for (i=0;i=LAYERDRLZ && lay.parl[PARLAYNUM].ival<=LAYERDRLD)) { switch (lay.parl[PARLAYFILL].ival&DRLDISPMASK) { case DRLOUTLDISP : msg=msg+UPRDDOUTL; break; case DRLFILLDISP : msg=msg+UPRDDFILL; break; case DRLDOTDISP : msg=msg+UPRDDDOT; break; default : msg=msg+UPRDDCROSS; } } else { msg=msg+(lay.parl[PARLAYFILL].ival ? UPRDPFILL : UPRDPOUTL); } msg=msg+", "+(lay.parl[PARLAYFONT].ival==2 ? PSAFONTNAME : (lay.parl[PARLAYFONT].ival==1 ? PSFONTNAME : bae_plainmenutext(UPRFONTBAE)))+REPFONT+REPLINEWP+ bae_numstring(cvtlength(lay.parl[PARLAYPOLYW].dval,0,2),3)+"mm, "+ REPLINEWT+ bae_numstring(cvtlength(lay.parl[PARLAYTEXTW].dval,0,2),3)+"mm"; return(msg); } string outfilename(int nmode,string nspec,string dir) /* // Build output file name string // Return value : // Output file name string // Parameters : // int nmode : File name mode // string nspec : File name specification // string dir : Directory name */ { string fname /* File name */; string fpath = "" /* File path name */; int vquery = 0 /* Variant queried flag */; int i /* Loop control variable */; // Set text environment variables forall (curfig) { if (curfig.RULEOBJID<0 || lay_rulequery(RS_OCFIG,curfig, RS_PCBSUBJ,RS_ENVVAR,"?s",envvar)<1) envvar=""; if (lay_scanfelem(curfig,0.0,0.0,0.0,1,1,NULL,NULL,NULL, envtext,NULL,NULL,NULL)!=0) error_scan(); } // Search folder delimiter in file name fname=bae_planfname(); for (i=strlen(fname)-1;i>=0;i--) if (fname[i]=='/' || fname[i]=='\\' || fname[i]==':') // Delimiter found break; if (i>=0) fpath=strextract(bae_planfname(),0,i); // Check if output to folder if (dir!="") { // Check if sub folder if (fpath!="" && dir[0]!='\\' && dir[0]!='/' && dir[0]!='$' && (strlen(dir)<2 || dir[1]!=':')) dir=fpath+dir; // Check if output folder exists if (filetype(dir)!=0) bae_createdir(dir); } switch (nmode) { // File extension */ case 0 : // File extension for folder */ case 2 : fname=convstring(bae_planfname(),0)+nspec; if (dir!="") // Combine path and pure file name fname=dir+bae_swversion(4)+ strextract(fname,i+1,strlen(fname)); break; // Variante name with extension case 3 : if (varn==0) { getvardata( bae_planfname(),bae_planename(),bae_planddbclass()); vquery=1; } fname=fpath+varl[varnumber].varname+nspec; if (dir!="") // Combine path and pure file name fname=dir+bae_swversion(4)+ strextract(fname,i+1,strlen(fname)); if (vquery) varn=0; break; // Variante attribute with extension case 4 : fname=fpath+varattr+nspec; if (dir!="") // Combine path and pure file name fname=dir+bae_swversion(4)+ strextract(fname,i+1,strlen(fname)); break; // Variante name+attribute with extension case 5 : if (varn==0) { getvardata( bae_planfname(),bae_planename(),bae_planddbclass()); vquery=1; } fname=fpath+varl[varnumber].varname+varattr+nspec; if (dir!="") // Combine path and pure file name fname=dir+bae_swversion(4)+ strextract(fname,i+1,strlen(fname)); if (vquery) varn=0; break; // Project+variante name with extension case 6 : if (varn==0) { getvardata( bae_planfname(),bae_planename(),bae_planddbclass()); vquery=1; } fname=convstring(bae_planfname(),0)+PDFVARSEP+ varl[varnumber].varname+nspec; if (dir!="") // Combine path and pure file name fname=dir+bae_swversion(4)+ strextract(fname,i+1,strlen(fname)); if (vquery) varn=0; break; // Fixed file name */ case 1 : default : fname=nspec; if (dir!="") fname=dir+bae_swversion(4)+nspec; else if (strscannext(fname,".",0,1)<=strlen(fname)) fname=fpath+nspec; } return(strgetvarfilename(fname)); } int envtext(index L_TEXT textp,double tx,double ty,double tangle, int mirrflag,int layer,double tsize,string tstr,int textinws) /* // Scan environment variable texts // Return value : // zero if done or (-1) on error // Parameters : // index L_TEXT textp : Text index // double tx : Text X coordinate // double ty : Text Y coordinate // double tangle : Text rotation angle // int mirrflag : Text mirror flag // int layer : Text layer code // double tsize : Text size // string tstr : Text string // int textinws : Text in workspace flag */ { // Query the variable name if (envvar!="" || lay_rulequery(RS_OCPOOL,textp,RS_PCBSUBJ,RS_ENVVAR,"?s",envvar)>0) { putenv(envvar,tstr); envvar=""; } return(0); } string outelemname(int cmode) /* // Build output element name string // Return value : // Output element name string // Parameters : // int cmode : Element comment mode */ { string ename /* Element name */; bae_getstrpar(0,ename); if (cmode==0 && ename!="") ename=bae_planename()+" "+ename; else if (cmode==2 || ename=="") ename=bae_planename(); return(ename); } void storelgrpnum(int layer,int active) /* // Store layer number to layer number group list // Parameters : // int layer : Layer number // int active : Layer active flag */ { int i /* Loop control variable */; // Try to find the layer number if ((i=findlgrpnum(layer))>=0) // Layer number found return; // Update the layer number list lgrpn++; for (i=(lgrpn-1)-1;i>=inslgrpidx;i--) { lgrpl[i+1]=lgrpl[i]; lgrpvl[i+1]=lgrpvl[i]; lgrpul[i+1]=lgrpul[i]; } lgrpl[inslgrpidx]=layer; lgrpvl[inslgrpidx]=active; lgrpul[inslgrpidx]= opagen>1 ? 1 : dataonlayer(layer); } int findlgrpnum(int layer) /* // Search layer number // Return value : // layer group list index or (-1) if not found // Parameters : // int layer : Layer number */ { int slb = 0 /* Search lower boundary */; int sub = lgrpn-1 /* Search upper boundary */; int sidx /* Search index */; // Loop until search area empty while (slb<=sub) { // Get the search index sidx=(slb+sub)>>1; // Test if layer number if (layer==lgrpl[sidx]) // Layer number found return(sidx); // Update the search area if (layer=0) { // Layer name found if (!ngrpul[i] && (layer==LAYERINV || (opagen<2 && dataonlayer(layer)))) ngrpul[i]=1; return; } // Update the layer name list ngrpn++; for (i=(ngrpn-1)-1;i>=inslgrpidx;i--) { ngrpl[i+1]=ngrpl[i]; ngrpvl[i+1]=ngrpvl[i]; ngrpul[i+1]=ngrpul[i]; } ngrpl[inslgrpidx]=name; ngrpvl[inslgrpidx]=active; ngrpul[inslgrpidx]= (opagen>1 || layer==LAYERINV) ? 1 : dataonlayer(layer); } int findlgrpname(string name) /* // Search layer name // Return value : // layer group list index or (-1) if not found // Parameters : // string name : Layer name */ { int slb = 0 /* Search lower boundary */; int sub = ngrpn-1 /* Search upper boundary */; int sidx /* Search index */; int compres /* Compare result */; // Loop until search area empty while (slb<=sub) { // Get the search index sidx=(slb+sub)>>1; // Test if layer number if ((compres=numstrcmp(name,ngrpl[sidx]))==0) // Layer name found return(sidx); // Update the search area if (compres<0) sub=sidx-1; else slb=sidx+1; } // Store the insert layer group index inslgrpidx=slb; // Layer name not found return(-1); } void storeggrpname(int idx,string name,int vismode,int prtmode,int lineflag, double min,double max,double x,double y,double red,double green,double blue) /* // Store grid name to grid name group list // Parameters : // int idx : Grid group index // string name : Grid group name // int vismode : Grid group visibility ctrl. mode // int prtmode : Grid group print mode // int lineflag : Grid lines flag // double min, max : Grid visibility zoom range // double x,y : Grid step values // double red, green, blue : RGB color values */ { int i /* Loop control variable */; // Try to find the layer name if ((i=findggrpname( idx,name,vismode,prtmode,lineflag,min,max,x,y,red,green,blue))>=0) // Grid group already stored return; // Update the grid group list ggrpn++; for (i=(ggrpn-1)-1;i>=insggrpidx;i--) ggrpl[i+1]=ggrpl[i]; ggrpl[insggrpidx].idx=idx; ggrpl[insggrpidx].name=name; ggrpl[insggrpidx].x=x; ggrpl[insggrpidx].y=y; ggrpl[insggrpidx].vismode=vismode; ggrpl[insggrpidx].min=min; ggrpl[insggrpidx].max=max; ggrpl[insggrpidx].lineflag=lineflag; ggrpl[insggrpidx].actflag=0; ggrpl[insggrpidx].prtmode=prtmode; ggrpl[insggrpidx].red=red; ggrpl[insggrpidx].green=green; ggrpl[insggrpidx].blue=blue; } int findggrpname(int idx,string name,int vismode,int prtmode,int lineflag, double min,double max,double x,double y,double red,double green,double blue) /* // Search grid group name // Return value : // grid group list index or (-1) if not found // Parameters : // int idx : Grid group index // string name : Grid group name // int vismode : Grid group visibility ctrl. mode // int prtmode : Grid group print mode // int lineflag : Grid lines flag // double min, max : Grid visibility zoom range // double x,y : Grid step values // double red, green, blue : RGB color values */ { int slb = 0 /* Search lower boundary */; int sub = ggrpn-1 /* Search upper boundary */; int sidx /* Search index */; int compres /* Compare result */; // Loop until search area empty while (slb<=sub) { // Get the search index sidx=(slb+sub)>>1; // Test if grid name if (idx==ggrpl[sidx].idx) { if ((compres=numstrcmp(name,ggrpl[sidx].name))==0) { if (vismode==ggrpl[sidx].vismode) { if (prtmode==ggrpl[sidx].prtmode) { if (lineflag==ggrpl[sidx].lineflag) { if (min==ggrpl[sidx].min) { if (max==ggrpl[sidx].max) { if (x==ggrpl[sidx].x) { if (y==ggrpl[sidx].y) { if (red==ggrpl[sidx].red) { if (green==ggrpl[sidx].green) { if (blue==ggrpl[sidx].blue) { return(sidx); } else { compres=blue1 && net.UNRPOOL>=0) return(1); return(0); } if (laynum==LAYERDRL || laynum==LAYERWAR || laynum==LAYERORG) // Assume data on layer return(1); // Check on power layer if (laynum>=POWLAYBASE && laynum-POWLAYBASE=0 && lay_rulequery(RS_OCFIG,fig,RS_PCBSUBJ, RS_LAYSCANIGN,"?d",layscanign)>0 && layscanign) continue; lay_scanfelem(fig,0.0,0.0,0.0,1,1,layhmacro,layhpoly, layhpath,layhtext,layhdrill,layhlchk,NULL); if (layerused) break; } // Return the layer usage return(layerused); } int layhmacro(index L_MACRO macro,index L_POOL pool, int macinws,string refname,index L_LEVEL level) /* // Check a macro data block for layer hit // Return value : // 0 if out of workspace, 1 if inside, 2 if unknown, or (-1) on error // Parameters : // index L_MACRO macro : Macro index // index L_POOL pool : Macro pool index // int macinws : Macro in workspace flag // string refname : Macro reference name // index L_LEVEL level : Macro level */ { int layscanign /* Layer scan ignore */; // Query the macro layer scan status if (lay_rulequery(RS_OCPOOL,pool,RS_PCBSUBJ, RS_LAYSCANIGN,"?d",layscanign)<1) // Set default layer scan mode layscanign=0; // Return macro scan status return(layscanign ? 0 : 1); } int layhpoly(index L_POLY poly,int layer, int polyinws,int tree,index L_LEVEL level) /* // Check a polygon data block for layer hit // Return value : // zero if done or (-1) on scan abort // Parameters : // index L_POLY poly : Polygon // int layer : Polygon layer // int polyinws : Poly in workspace flag // int tree : Polygon tree number // index L_LEVEL level : Polygon level */ { int layscanign /* Layer scan ignore */; // Check the polygon type switch (poly.TYP) { // Copper case L_POLYCOPPASS : // Connected copper case L_POLYCOPACT : // Split power plane area case L_POLYSPPAREA : // Hatched copper case L_POLYHTCHCOP : // Documentary line case L_POLYDOCLINE : // Documentary area case L_POLYDOCAREA : // Board outline case L_POLYBRDOUT : // Query the polygon layer scan status if (lay_rulequery(RS_OCPOOL,poly,RS_PCBSUBJ, RS_LAYSCANIGN,"?d",layscanign)<1) // Set default layer scan mode layscanign=0; if (!layscanign) layerused=1; // Abort the scan return(-1); break; // Others default : ; } // Return without errors return(0); } int layhpath(index L_LINE path,int layer,int pathinws,index L_LEVEL level) /* // Check a path data block for layer usage // Return value : // zero if done or (-1) on scan abort // Parameters : // index L_LINE path : Path // int layer : Path layer // int pathinws : Path in workspace flag // index L_LEVEL level : Path level */ { int layscanign /* Layer scan ignore */; // Query the path layer scan status if (lay_rulequery(RS_OCPOOL,path,RS_PCBSUBJ, RS_LAYSCANIGN,"?d",layscanign)<1) // Set default layer scan mode layscanign=0; // Set the layer usage flag if (!layscanign) layerused=1; // Abort the scan return(-1); } int layhtext(index L_TEXT textp,double tx,double ty,double tangle, int mirrflag,int layer,double tsize,string tstr,int textinws) /* // Check a text data block for layer usage // Return value : // zero if done or (-1) on error // Parameters : // index L_TEXT textp : Text index // double tx : Text X coordinate // double ty : Text Y coordinate // double tangle : Text rotation angle // int mirrflag : Text mirror flag // int layer : Text layer code // double tsize : Text size // string tstr : Text string // int textinws : Text in workspace flag */ { int layscanign /* Layer scan ignore */; // Query the text layer scan status if (lay_rulequery(RS_OCPOOL,textp,RS_PCBSUBJ, RS_LAYSCANIGN,"?d",layscanign)<1) // Set default layer scan mode layscanign=0; // Set the layer usage flag if (!layscanign) layerused=1; // Abort the scan return(-1); } int layhdrill(index L_DRILL drill,double x,double y, int drillinws,int tree,index L_LEVEL level) /* // Check a drill layer block for layer usage // Return value : // zero if done or (-1) on error // Parameters : // index L_DRILL drill : Drill data block // double x : Drill X coordinate // double y : Drill Y coordinate // int drillinws : Drill in workspace flag // int tree : Drill tree number // index L_LEVEL level : Drill level */ { index L_NREF nref /* Named reference index */; int drlclass /* Drill class */; int layscanign /* Layer scan ignore */; // Query the drill layer scan status if (lay_rulequery(RS_OCPOOL,drill,RS_PCBSUBJ, RS_LAYSCANIGN,"?d",layscanign)<1) // Set default layer scan mode layscanign=0; if (!layscanign) { if (chklayer==LAYERDRL) { layerused=1; } else { // Get the effective drill class drlclass= ((drill.CLASS&DRLCMIRR) && (nref=lay_getscpartrpidx())>=0 && nref.MIRROR) ? (drill.CLASS&DRLCMASK2)>>DRLCSHFT2 : drill.CLASS&DRLCMASK1 ; if (chklayer==(LAYERDRLD-drlclass)) layerused=1; } } // Return without errors return(0); } int layhlchk(int layer) /* // Layer usage check routine // Return value : // zero if scan break requested, 1 if scan allowed // Parameters : // int layer : Layer code */ { // Check the layer return(layer==chklayer); } int figplotstat(index L_FIGURE fig) /* // Get figure list element plot status // Return value : // One if element plot, else zero // Parameters : // index L_FIGURE fig : Figure list index */ { index L_CPART cpart /* Connection part index */; int plcflag = 1 /* Placement flag */; if (pspvis<2) return(1); plcflag= (fig.TYP==L_FIGNREF && lay_findconpart(fig.NAME,cpart)==0 && getlayattribval(cpart,"$noplc")!="") ? 0 : 1 ; return(pspvis==2 ? plcflag : (1-plcflag)); } void mlinetext(index L_FIGURE fig) /* // Get multline text from figure list element // Parameters : // index L_FIGURE fig : Figure list index */ { index L_FIGURE tfig /* Text figure list index */; string mtext[] /* Multiline text buffers */; int mrow /* Multiline text row */; int row /* Current text row */; int col /* Current text column */; int maxcol /* Max. text column */; string mtextid /* Multiline text ID */; string textid /* Current text ID */; int i /* Loop control variable */; // Query the multi-line text status if (lay_rulequery(RS_OCFIG,fig,RS_PCBSUBJ,RS_MTEXTID, "?s",mtextid)<1 || mtextid=="" || lay_rulequery(RS_OCFIG,fig,RS_PCBSUBJ,RS_MTEXTCOL,"?d",col)<1 || lay_rulequery(RS_OCFIG,fig,RS_PCBSUBJ,RS_MTEXTROW,"?d",mrow)<1) { pstmline=""; return; } // Scan all related multiline texts maxcol=(-1); forall (tfig where tfig.RULEOBJID>=0 && tfig.TYP==L_FIGTEXT && lay_rulequery(RS_OCFIG,tfig,RS_PCBSUBJ,RS_MTEXTID,"?s",textid)>0 && textid==mtextid && lay_rulequery(RS_OCFIG,tfig,RS_PCBSUBJ,RS_MTEXTROW,"?d",row)>0 && mrow==row && lay_rulequery(RS_OCFIG,tfig,RS_PCBSUBJ,RS_MTEXTCOL,"?d",col)>0) { mtext[col]=tfig.NAME; if (col>maxcol) maxcol=col; } pstmline=mtext[0]; for (i=1;i<=maxcol;i++) pstmline+=mtext[i]; } double charwidth(char c,int fontmode) /* // Get text character width // Return value : // character length in base units // Parameters : // char c : Character // int fontmode : Text font mode */ { switch (fontmode) { case 1 : switch (PSFONTNAME) { case "Courier" : return(0.9); case "Arial" : return(arial_charw[(c&0xFF)]); case "Times-Roman" : return(times_roman_charw[(c&0xFF)]); break; default : } break; case 2 : switch (PSAFONTNAME) { case "Courier" : return(0.9); case "Arial" : return(arial_charw[(c&0xFF)]); case "Times-Roman" : return(times_roman_charw[(c&0xFF)]); default : } break; default : } return(1.0); } double arial_length(string tstr) /* // Return length of text string with arial font */ { double len = 0.0 /* String length */; int c /* Character buffer */; int i /* Loop control variable */; // Scan string characters for (i=0;(c=tstr[i])!='\0';i++) len+=arial_charw[(c&0xFF)]; // Return string length return(len); } double times_roman_length(string tstr) /* // Return length of text string with Times-Roman font */ { double len = 0.0 /* String length */; int c /* Character buffer */; int i /* Loop control variable */; // Scan string characters for (i=0;(c=tstr[i])!='\0';i++) len+=times_roman_charw[(c&0xFF)]; // Return string length return(len); } string textstrextract(string textstr,int dslen,int negflag,int cnegflag) /* // Extract actual drawing text string // Return value : // drawing string // Parameter : // string textstr[] : Text string // int dslen : Drawing string length return // int negflag : String negation flag return // int cnegflag : Character negation flag return */ { string res = "" /* Result string */; int sidx /* Scan start index */; char c /* String character */; char nc /* Next string character */; int negrange /* Negative range pending flag */; int i /* Loop control variable */; negflag=cnegflag=0; // Test if module port sidx= (textstr[0]=='?' && textstr[1]!='\0' && textstr[1]!=' ') ? 1 : 0 ; // Test if overlined text if (textstr[sidx]=='/' && textstr[sidx+1]!=' ') { negflag=1; sidx++; } // Count characters dslen=negrange=0; for (i=sidx;(c=textstr[i])!='\0';i++) if (c=='\\' && ((nc=textstr[i+1])=='/' || nc=='(' || (negrange && nc==')'))) { // Skip negator character i++; cnegflag=1; negrange= nc=='(' ? 1 : 0 ; } else { res+=c; dslen++; } // Return drawing string */ return(res); } double text_length(string tstr,int fontidx) /* // Return length of text string with given font */ { double folen /* Text original length */; double flen /* Text length */; // Correct text length according to font folen=strlen(tstr); switch (fontidx) { case 1 : switch (PSFONTNAME) { case "Courier" : flen=folen*0.9; break; case "Arial" : flen=arial_length(tstr); break; case "Times-Roman" : flen=times_roman_length(tstr); break; default : flen=folen; } fontbase=PSFONTBASE; fontstroke=PSFONTSTROKE; break; case 2 : switch (PSAFONTNAME) { case "Courier" : flen=folen*0.9; break; case "Arial" : flen=arial_length(tstr); break; case "Times-Roman" : flen=times_roman_length(tstr); break; default : flen=folen; } fontbase=PSAFONTBASE; fontstroke=PSAFONTSTROKE; break; default : flen=folen; fontbase=PSFONTBASE; fontstroke=PSFONTSTROKE; } return(flen); } string getlayattribval(index L_CPART part,string attname) /* // Get attribute value // Return value : // attribute value or empty string if not found // Parameters : // index L_CPART part : Part index // string attname : Attribute name */ { index L_ATTRIBUTE att /* Attribute index */; string battname /* Base attribute name */; string vattname /* Variant attribute name */; string attval /* Attribute value */; string attpref /* Attribute value prefix */; char c /* Character buffer */; int i /* Loop control variable */; // Search attribute name start for (i=0;(c=attname[i])!='\0';i++) if (c=='$') break; // Extract attribute name and prefix battname=strextract(attname,i,strlen(attname)); attpref= i==0 ? "" : strextract(attname,0,i-1); // Set default attribute value attval=""; // Build the variant attribute name vattname=varattrname(battname,varnumber); // Search for first attribute forall (att of part where att.NAME==vattname || att.NAME==battname) { // Check if active variant attribute if (att.NAME==vattname) { // Attribute value found attval=att.VALUE; break; } // Store the base variant attribute value attval=att.VALUE; } if (battname=="$plname" && attval=="") return(attpref+part.PLNAME); // Return the prefixed attribute value return((attval!="" && attval!=" ") ? (attpref+attval) : attval); } void getwsbound() /* // Determine the workspace boundaries */ { // Default to element boundaries wslx=bae_planwslx(); wsly=bae_planwsly(); wsux=bae_planwsux(); wsuy=bae_planwsuy(); // Scan any boundary markers if (lay_scanall( 0.0,0.0,0.0,0,0,plotrangemac,NULL,NULL,NULL,NULL,NULL,NULL)!=0) // Scan error error_scan(); } int plotrangemac(index L_MACRO macro,index L_POOL pool, int macinws,string refname,index L_LEVEL level) /* // PS layer data output macro function // Return value : // 0 if out of workspace, 1 if inside, 2 if unknown, or (-1) on error // Parameters : // index L_MACRO macro : Macro index // index L_POOL pool : Macro pool index // int macinws : Macro in workspace flag // string refname : Macro reference name // index L_LEVEL level : Macro level */ { switch (macro.CLASS) { case DDBCLLPRT : case DDBCLLSTK : if (refname==PDFLXMARKER) lay_maccoords(wslx,wsly,0.0,0,0); else if (refname==PDFUYMARKER) lay_maccoords(wsux,wsuy,0.0,0,0); break; default : return(0); } // Continue scan return(1); } int attrmac(index L_MACRO macro,index L_POOL pool, int macinws,string refname,index L_LEVEL level) /* // PS layer data output macro function // Return value : // 0 if out of workspace, 1 if inside, 2 if unknown, or (-1) on error // Parameters : // index L_MACRO macro : Macro index // index L_POOL pool : Macro pool index // int macinws : Macro in workspace flag // string refname : Macro reference name // index L_LEVEL level : Macro level */ { switch (macro.CLASS) { case DDBCLLAY : break; case DDBCLLPRT : case DDBCLLSTK : if (refname==PDFLXMARKER) lay_maccoords(plwslx,plwsly,0.0,0,0); else if (refname==PDFUYMARKER) lay_maccoords(plwsux,plwsuy,0.0,0,0); break; default : return(0); } // Continue scan return(1); } int attrtext(index L_TEXT textp,double tx,double ty,double tangle, int mirrflag,int layer,double tsize,string tstr,int textinws) /* // Partlist template attribute text scan // Return value : // zero if done or (-1) on error // Parameters : // index L_TEXT textp : Text index // double tx : Text X coordinate // double ty : Text Y coordinate // double tangle : Text rotation angle // int mirrflag : Text mirror flag // int layer : Text layer code // double tsize : Text size // string tstr : Text string // int textinws : Text in workspace flag */ { string attrname /* Attribute name */; double acwidth /* Attribute column width */; int casemode /* Attribute case conversion mode */; int row /* Part list row */; int cmpres /* Name compare result */; int slb = 0 /* Search lower boundary */; int sub = attrn-1 /* Search upper boundary */; int sidx /* Search index */; int i /* Loop control variable */; // Abort scan if non-attribute string if (tstr[0]!='$') return(0); // Update part row if ((attrname=attrindex(tstr,row,acwidth,casemode))!="") { if (row>partprow) partprow=row; if (row==0) { if (attrname==ATTRPDFPLSEP) { partsepw=acwidth; } else if (attrname=="$") { partcntw=acwidth/(tsize*PSFONTASP); partnamecase=casemode; // Query the font if (lay_rulequery(RS_OCPOOL,textp,RS_PCBSUBJ, RS_PLOTFONT,"?d",partcntfont)<1 || partcntfont<0) { partcntfont=psdeffont; // Search layer specific font for (i=0; i>1; // Test if attribut found if ((cmpres=strcmp(attrname,attrl[sidx].name))==0) { if (row==0) attrl[sidx].casemode=casemode; return(0); } // Update the search area if (cmpres<0) sub=sidx-1; else slb=sidx+1; } for (i=attrn;i>slb;i--) attrl[i]=attrl[i-1]; attrl[slb].name=attrname; attrl[slb].casemode= row==0 ? casemode : 0 ; attrn++; } // Return without errors return(0); } string attrindex(string attrstr,int row,double width,int casemode) /* // Get attribute row and name of a index attribute name string // Return value : // attribute name string // Parameters : // string attrstr : Indexed attribute name string // int row : Attribute row index return // double width : Attribute column width // int casemode : Attribute case mode */ { int sidx, sidx2 /* Search index */; int len /* String length */; len=strlen(attrstr); // Check if valid index string */ if (len<4 || attrstr[len-1]!=':') return(""); sidx=len-2; if (tolower(attrstr[sidx])=='u') { casemode=1; sidx--; } else if (tolower(attrstr[sidx])=='l') { casemode=2; sidx--; } else { casemode=0; } for (;sidx>0;sidx--) if (!isdigit(attrstr[sidx])) break; if (attrstr[sidx]!=':') return(""); for (sidx2=sidx-1;sidx2>0;sidx2--) if (!isdigit(attrstr[sidx2]) && attrstr[sidx2]!='.') break; if (attrstr[sidx2]==':') { width=cvtlength(atof(strextract(attrstr,sidx2+1,sidx-1)),2,0); } else { width=0.0; sidx2=sidx; } row=atoi(strextract(attrstr,sidx+1,len-2))-1; return(strextract(attrstr,0,sidx2-1)); } string gridname(string grpname,double xgrid,double ygrid) /* // Get grid name // Return value : // zero if done or (-1) on error // Parameters : // string grpname : Grid group name // double xgrid : X grid step // double ygrid : Y grid step */ { string msg /* Message string */; int gidx /* Grid definition index */; // Check the grid values for (gidx=0;gidx1.0) return(-1); for (;(c=colstr[i])!='\0';i++) if (c!=' ' && c!='\t') break; sidx=i; // Scan second number for (;(c=colstr[i])!='\0';i++) if (!isdigit(c) && c!='.') break; if (c!=' ' && c!='\t') return(-1); if ((g=atof(strextract(colstr,sidx,i)))<0.0 || r>1.0) return(-1); for (;(c=colstr[i])!='\0';i++) if (c!=' ' && c!='\t') break; if (!isdigit(c) && c!='.') return(-1); sidx=i; // Scan third number for (;(c=colstr[i])!='\0';i++) if (!isdigit(c) && c!='.') break; if ((b=atof(strextract(colstr,sidx,i)))<0.0 || r>1.0) return(-1); for (;(c=colstr[i])!='\0';i++) if (c!=' ' && c!='\t') break; return(c!='\0' ? 1 : 0); } void browsecolor(double r,double g,double b) /* // Get color RGB values via BAE palette selection // Parameters : // double r : Red color value // double g : Green color value // double b : Blue color value */ { int oldcol /* Old color index */; int newcol /* New color index */; // Process any redraw event bae_wsmouse(0.0,0.0,0); // Temporarily use layer 90 for color query if (uliptype()==ULIPGED) ged_setstrpar(8,UPRBRWCOLORP); oldcol=bae_getcolor(89); bae_setcolor(89,0); bae_clriactqueue(); bae_storetextiact(1,"90"); bae_storemouseiact(0,0.0,0.0,0,LMB); bae_storetextiact(1,""); bae_callmenu(uliptype()==ULIPCAM ? 107 : 108); if (uliptype()==ULIPGED) ged_setstrpar(8,""); if ((newcol=bae_getcolor(89))>=0 && newcol<=15) { r=coltored(newcol); g=coltogreen(newcol); b=coltoblue(newcol); } else if (newcol&32) { r=((newcol&0x0F0000)>>16)/15.0; g=((newcol&0x0F000)>>12)/15.0; b=((newcol&0x0F00)>>8)/15.0; } // Restore layer 90 color bae_setcolor(89,oldcol); } void openlaygrp() /* // Open element specific layer group(s) */ { if (curplgrpidx>=0) { sprintf(os,FMTPDFBOCGN,curplgrpidx); outstr(); curplgrpidx=(-2); } if (curgngrpidx>=0) { sprintf(os,FMTPDFBOCGN,curgngrpidx); outstr(); curgngrpidx=(-2); } } void closelaygrp() /* // Close element specific layer group(s) */ { if (curplgrpidx==(-2)) { os=FMTPDFEOCG; outstr(); } if (curgngrpidx==(-2)) { os=FMTPDFEOCG; outstr(); } } int getfigruledata() /* // Get the rule specific plot data // Return value : // one if multiline text fraction else zero */ { index L_CPART cpart /* Connection part index */; string partcolor /* Netlist part color */; string plname /* Part layer name */; int col /* Multiline text columns */; if (curfig.TYP!=L_FIGNREF || lay_findconpart(curfig.NAME,cpart)!=0 || (partcolor=getlayattribval(cpart,RGBATTR))=="" || chkcolor(partcolor,0.0,0.0,0.0)) partcolor=defcolor; curruleid=curfig.RULEOBJID; if (curruleid>=0) { // Query the multi-line text status if (!pscurfont || curfig.TYP!=L_FIGTEXT || lay_rulequery( RS_OCFIG,curfig,RS_PCBSUBJ,RS_MTEXTCOL,"?d",col)<1) pstmline=""; else if (col!=0) return(1); else mlinetext(curfig); // Query plot color predicate if (lay_rulequery(RS_OCFIG,curfig,RS_PCBSUBJ,RS_PLOTRGB,"?s", curcolor)<1 || chkcolor(curcolor,0.0,0.0,0.0)) curcolor=partcolor; // Query plot font predicate if (lay_rulequery(RS_OCFIG,curfig,RS_PCBSUBJ,RS_PLOTFONT,"?d", pscurfont)<1 || pscurfont<0) pscurfont=psdeffont; // Query PDF layer predicate if (PDFLAYGRP && !psgrpign && lay_rulequery(RS_OCFIG,curfig, RS_PCBSUBJ,RS_PDFLAY,"?s",plname)>0 && plname!="") { if ((curplgrpidx=findlgrpname(plname))>=0) ngrpul[curplgrpidx]=1; } else { curplgrpidx=(-1); } // Query group name predicate if (PDFGRPNLAY && PDFLAYGRP && !psgrpign && lay_rulequery(RS_OCFIG,curfig, RS_PCBSUBJ,RS_GROUPNAME,"?s",plname)>0 && plname!="") { if ((curgngrpidx=findlgrpname(plname))>=0) ngrpul[curgngrpidx]=1; } else { curgngrpidx=(-1); } } else { curcolor=partcolor; pscurfont=psdeffont; pstmline=""; curplgrpidx=curgngrpidx=(-1); } return(0); } // User Language program end