/* SCMEPS (SCM) -- SCM EPS/PDF Output */ /* SCMEPS (SCM) -- SCM EPS/PDF Ausgabe */ /* // Copyright (c) 1994-2012 Oliver Bartels F+E, Muenchen // Author: Manfred Baumeister // Changes History: // rl (120510) ENHANCEMENT: // Added A0/A1/A2 paper size selection support. // rl (120427) RELEASED FOR BAE V7.8. // rl (101019) RELEASED FOR BAE V7.6. // rl (100525) ENHANCEMENT: // Added label page reference annotation support. // rl (091119) ENHANCEMENT: // Added symbol attribute annotation support. // rl (091021) RELEASED FOR BAE V7.4. // rl (081014) RELEASED FOR BAE V7.2. // rl (080801) ENHANCEMENT: // Added RGB color spec. check to prevent invalid output file. // rl (080220) ENHANCEMENT: // Added variant files options to batch output. // rl (071012) BUGFIX: // Fixed problem with empty library files. // rl (071029) RELEASED FOR BAE V7.0. // rl (070320) ENHANCEMENT: // Added individual text output size factor support. // 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 (060706) BUGFIX: // Fixed bus tap plot visibility problem with shifted boundary. // Added $noplc dependant attribut plot option. // rl (060504) ENHANCEMENT: // Added variant/page tree output option. // rl (060331) ENHANCEMENT: // Added scale factor to EPS/PDF output. // rl (060214) CHANGE: // Added output page display attribute $pdfpage. // rl (060125) CHANGE: // Added text position/length correction for Arial/Courier fonts. // rl (060123) CHANGE: // Added font name specification for batch output files. // rl (060116) CHANGE: // Changed abort request from page to complete output abort. // rl (051214) ENHANCEMENT: // Added compressed output support. // rl (051209) ENHANCEMENT: // Added batch output support. // rl (050906) RELEASED FOR BAE V6.6. // rl (050414) ENHANCEMENT: // Added alternate postscript font support. // rl (050308) ENHANCEMENT: // Added net area ouput. // rl (050113) ENHANCEMENT: // Added plan specific file name preservation. // rl (041025) ENHANCEMENT: // Added configurable output device selection. // rl (040907) ENHANCEMENT: // Added PDF sheets for symbols/labels/markers output options. // rl (040811) RELEASED FOR BAE V6.4. // rl (040211) BUGFIX: // Fixed bus tap plot visibility problem. // rl (030904) RELEASED FOR BAE V6.2. // rl (030708) ENHANCEMENT: // Added commentary text output disable option to dialog box. // rl (030526) ENHANCEMENT: // 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 (030303) BUGFIX: // Fixed erroneous mirrored text negation output with PS font. // rl (030217) BUGFIX: // Fixed erroneous modul port name output with PS font. // Fixed problems with rotated/mirrored text frame output. // rl (030116) ENHANCEMENT: // Added direct printer output support. // rl (030113) ENHANCEMENT: // Added automatic A3/A4 sheet size postscript mode. // rl (021218) ENHANCEMENT: // Now using bus fill mode for bus connections. // rl (021209) RELEASED FOR BAE V6.0. // rl (020618) RELEASED FOR BAE V5.4. // rl (010702) RELEASED FOR BAE V5.0. // rl (010702) ENHANCEMENT: // Added plot disable rule support. // rl (010531) ENHANCEMENT: // Added optional parameter settings from bae.ini file. // rl (000511) RELEASED FOR BAE V4.6. // rl (000511) ENHANCEMENT: // Added dialog box parameter selection. // rl (000209) ENHANCEMENT: // Added A3 paper size. // rl (991126) RELEASED FOR BAE V4.4. // rl (991126) ENHANCEMENT: // Color support introduced. // rl (991014) ENHANCEMENT: // Introduced variant attribute processing. // rl (990326) ENHANCEMENT: // Introduced PDF output option. // rl (990125) ENHANCEMENT: // Introduced command abbreviations to reduce output size. // Added umlaut character font redefinition support. // Fixed transparent output problem in conjunction with // set plot device. // mb (981229) ENHANCEMENT: // Letter output format introduced. // rl (980929) RELEASED FOR BAE V4.2. // rl (980724) ENHANCEMENT: // Postscript text fonts support introduced. // mb (980710) ENHANCEMENT: // Pulldown menu delimiters introduced. // mb (980710) ENHANCEMENT: // Dynamic multi-language support introduced. // rl (971022) IMPROVEMENT // Added tag ouptut support // 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 (950125) ENHANCEMENT: // Introduced clipping plot features. // mb (950105) IMPROVEMENT: // Introduced feature for output stop on key hit. // mb (940614) ENHANCEMENT: // New "Transparent" output option with scale factor query. // mb (94) RELEASED FOR BAE V3.0. // mb (94) ORIGINAL CODING. // // DESCRIPTION // // The scmeps User Language program produces either Adobe // Portable Document Format (PDF) or Encapsulated PostScript (EPS) // output of the currently loaded SCM element, featuring different // scaling modes for output and optional clipping window selection. // scmeps performs plot of different graphic objects (standard text, // comment text, documentary areas, documentary lines, dotted lines, // contact areas, connections, busses) from different DDB hierarchy // levels (sheet, symbol, label, marker). Output options such as fill // mode, RGB values, hatching, and dashed lines may be predefined // for each object type to be plotted. Object-specific plot options // are controlled with a special scmeps source code variable which // is intended for customization. */ // Includes #include "pop.ulh" // User Language popup utilities #include "scm.ulh" // User Language SCM utilities #include "baeparam.ulh" // User Language BAE param. access #include "sql.ulh" // User Language SQL utilities // Disable undo state request #pragma ULCALLERNOUNDO // Messages string UPRABORT = M_UPRABORT(); string REPPSWRITE = M("EPS/PostScript-Ausgabe auf '%s'...", "EPS/PostScript output to '%s'..."); string REPPSWRITM = M("EPS/PostScript-Ausgabe auf '%s' (%d/%d)...", "EPS/PostScript output to '%s' (%d/%d)..."); string REPPDFWRITM = M("PDF-Ausgabe auf '%s' (%d/%d)...", "PDF output to '%s' (%d/%d)..."); 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 REPPSWRLAY = M("EPS/PostScript-Ausgabe %s...", "EPS/PostScript output %s..."); string REPOUTABORT = M("Ausgabe abgebrochen. Ausgabedatei '%s' invollstaendig.", "Output aborted. Output file '%s' incomplete."); 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 REPBATCHSTORE = M("Batch '%s' gespeichert.","Batch '%s' written."); string REPELEMSTEP = M("%s","%s"); string REPELEMNAME = M("Elementname","Element name"); string REPALLPELEM = M(" fuer alle Dateischaltplaene", " for all File Schematic Sheets"); string REPALLVELEM = M(" fuer alle Dateischaltplaene und Varianten", " for all File Schematic Sheets and Variants"); string REPALLSELEM = M(" fuer alle Dateischaltplansymbole", " for all File Schematic Symbols"); string REPALLLELEM = M(" fuer alle Dateischaltplanlabels", " for all File Schematic Labels"); string REPALLMELEM = M(" fuer alle Dateischaltplanmarker", " for all File Schematic Markers"); 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 REPSYMPART = M("Bauteil %s","Part %s"); string REPSYMMACRO = M("Symbolmakro","Symbol Macro"); string REPLABEL = M("Label %s","Label %s"); string REPLABMACRO = M("Labelmakro","Label Macro"); string REPLABPAGE = M("Blaetter","Pages"); string REPPARTMACRO = M("Gehaeuse","Part Macro"); string REPANNOTENT = M("%s : %s","%s : %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("SCM-Jobdatei ? ","SCM Job File ? "); string UPRSELDEV = M("Ausgabedevice waehlen!","Select Output Device!"); string UPRFORMAT = M("Ausgabeformat waehlen!","Select Output Format!"); string UPRDFORMAT = M("Ausgabeformat :","Output Format :"); string UPRSCALE = M("Ausgabeformat/Skalierung waehlen!", "Select Output/Scaling Mode!"); string UPRSCALE0 = M("&Transparent","&Transparent"); string UPRSCALE1 = M("Transparent 1&:1","Transparent 1&:1"); string UPRSCALE2 = M("Transparent &1:2","Transparent &1:2"); string UPRSCALE3 = M("Transparent &2:1","Transparent &2:1"); string UPRFORMAT1 = M("%&Postscript n:1","%&Postscript n:1"); string UPRFORMAT2 = M("Postscript &A4","Postscript &A4"); string UPRFORMAT3 = M("Postscript &A3","Postscript &A3"); 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("%A&uto Postscript A3/A4","%Auto Postscript A3/A4"); 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("&Blaetter zu Datei","&All sheets of file"); string UPRPLAN2 = M("&Symbole zu Datei","All &symbols of file"); string UPRPLAN3 = M("&Label zu Datei","All &labels of file"); string UPRPLAN4 = M("&Marker zu Datei","All &markers of file"); string UPRPLAN5 = M("%&Variantenblaetter zu Datei", "%All &variant sheets of file"); string UPRPLAN6 = M("Dateien zu Varianten","Files for variants"); string UPRPLTSCALE = M("Plot Vergroesserungsfaktor ? ", "Plot Scaling Factor ? "); string UPRDPLTSCALE = M("Plotmassstab :","Plot Scale :"); string UPRROT = M("Drehung waehlen!","Select Rotation Mode!"); string UPRDROTMOD = M("Plot-Rotation :","Plot Rotation :"); string UPRDROT = M("Drehung :","Rotation :"); string UPRROT0 = M("Drehung &0 Grad","Rotation &0 Degrees"); string UPRROT1 = M("Drehung &90 Grad","Rotation &90 Degrees"); string UPRROT2 = M("Drehung &Best Fit","Rotate &Best Fit"); 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("Linienbreite waehlen!","Select Line Width!"); string UPRDLINEW = M("Standardlinienbreite :","Standard Line Width :"); 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 UPRDLINEWH = M("Standardlinienbreite [mm]", "Standard Line Width [mm]"); string UPRDLINEWP = M("Grafiklinien :","Graphic Lines :"); string UPRDLINEWT = M("Texte :","Texts :"); string UPRDOFFSET = M("Offset [mm]","Offset [mm]"); string UPRDX = M("X :","X :"); string UPRDY = M("Y :","Y :"); 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 UPRDECOMMENT = M("Kommentar :","Comment :"); string UPRDESYMBOLS = M("Symbole","Symbols"); string UPRDESTDSYM = M("Standard","Standard"); string UPRDETAGSYM = M("Tag","Tag"); string UPRDETCLASSM = M("Textklassenmaske :","Text Class Mask :"); string UPRDETCLASS0 = M("keine","none"); string UPRDETCLASSN = M("ausblenden","fade out"); string UPRDETCLASSP = M("einblenden","fade in"); string UPRDETCNIL = M("ohne","without"); string UPRDEPLAN = M("Plan","Sheet"); string UPRDESYMBOL = M("Symbol","Symbol"); string UPRDELABEL = M("Label","Label"); string UPRDEMARKER = M("Marker","Marker"); string UPRDETEXT = M("Texte","Texts"); string UPRDECTEXT = M("Kommentartexte :","Commentary texts :"); string UPRDEVTEXT = M("Variantentexte :","Variant texts :"); string UPRDEKTEXT = M("Variantenkommentartexte :", "Variant Commentary texts :"); string UPRDEDOCA = M("Grafikflaechen :","Graphic Areas :"); string UPRDEDOCL = M("Grafiklinien :","Graphic Lines :"); string UPRDEDOCD = M("Punktlinien :","Dotted Lines :"); string UPRDECONA = M("Kontaktbereiche :","Contact Areas :"); string UPRDECON = M("Verbindungen :","Connections :"); string UPRDECONB = M("Busverbindungen :","Bus Connections :"); string UPRDEOUTL = M("Symbolumrandungen :","Symbol Outlines :"); string UPRDETAGL = M("Taglinks :","Tag Links :"); string UPRDEPLOTVIS = M("Plotsichtbarkeit :","Plotvisibility :"); string UPRDEPLOTV1 = M("sichtbar","visible"); string UPRDEPLOTV0 = M("unsichtbar","invisible"); string UPRDPMODE = M("Flaechendarstellung :","Area Draw Mode :"); string UPRDPFILL = M("gefuellte Flaechen","filled areas"); string UPRDPOUTL = M("Randlinien","Border lines"); string UPRDPFALL = M("auch Linien Fuellen","filled areas/lines"); string UPRDFONT = M("Zeichensatz :","Font :"); string UPRDLAYGRP = M("Ebenenname :","PDF Layer Name :"); string UPRDLAYACT = M("Initialanzeige","Initial Display"); string UPRFONTBAE = M("&BAE","&BAE"); string UPRDBACKCOL = M("Hintergrundfarbe [0.0,1.0] :", "Background Color [0.0,1.0] :"); string UPRDSYMANNO = M("Symbolattributnotizen :", "Symbol Attribute Annotations :"); 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 UPRDCR = M("R :","R :"); string UPRDCG = M("G :","G :"); string UPRDCB = M("B :","B :"); 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 UPRDSCALE = M("Skalierungsfaktor :","Scale Factor :"); string UPRDCOMMTEXT = M("Kommentare","Comments"); string UPRDON = M("&ein","&on"); string UPRDOFF = M("aus","off"); string UPRSTOP = M("EPS/PDF-Ausgabe abbrechen ? ", "Abort EPS/PDF Output ? "); string UPRPDFLGRP = M("PDF Lagenebenen","PDF Layers"); string UPRTPLANMASK = M("Textklassen Planmaske fuer Ausgabe deaktivieren", "Deactivate Text Class Plan Mask for 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 UPRDELEM = M("Ausgabeelemente","Ausgabeelemente"); string UPRPARAMDIAL = M("Parametereinstellungen","Settings"); string UPRNIL = "--------"; string UPRBRWFILENAME = M("&Browse","&Browse"); string UPRBRWDEVNAME = M("&Liste","&List"); string UPRDEFFILENAME = M("&Default","&Default"); string UPRBRWCOLOR = M("BAE-Auswahl","BAE-Selection"); 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 UPRBUTALL = M("Alle","All"); string UPRBUTNONE = M("Keine","None"); 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) / Elemente", "Batch '%s' / File %d / Page %d (%s)"); string UPRDIALELEMPAR = M("Batch '%s' / Datei %d / Seite %d (%s) / Elementsatz %d", "Batch '%s' / File %d / Page %d (%s) / Element Set %d"); string UPRELEMMOVDST = M("Neue Position fuer Elemente '%s' selektieren", "Select new position for element set '%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 Schaltplannamen aus Datei", "All Schematic sheet names of File"); string UPRPNMODE4 = M("Alle Schaltplannamen aus Datei+Extension", "All Schematic sheet names of File+Extension"); string UPRPNMODE5 = M("Alle Schaltplansymbolnamen aus Datei", "All Schematic symbol names of File"); string UPRPNMODE6 = M("Alle Schaltplansymbolnamen aus Datei+Extension", "All Schematic symbol names of File+Extension"); string UPRPNMODE7 = M("Alle Schaltplanlabelnamen aus Datei", "All Schematic label names of File"); string UPRPNMODE8 = M("Alle Schaltplanlabelnamen aus Datei+Extension", "All Schematic label names of File+Extension"); string UPRPNMODE9 = M("Alle Schaltplanmarkernamen aus Datei", "All Schematic marker names of File"); string UPRPNMODE10 = M("Alle Schaltplanmarkernamen aus Datei+Extension", "All Schematic marker names of File+Extension"); string UPRPNMODE11 = M("Alle Varianten+Schaltplannamen aus Datei", "All Variant+Schematic sheet names of File"); string UPRDPAGENAME = M("Seitenname :","Page Name :"); 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 UPRSRCFILE = M("Quelldatei ? ","Source File ? "); string UPRDSTFILE = M("!Zieldatei ? ","!Destination File ? "); string UPRDPAGEIPAT = M("Elementnamensmuster :","Element Name Pattern :"); string UPRDPAGEEPAT = M("Elementnamensausschlussmuster :", "Element Name Exclude Pattern :"); string ERRNOFILEN = M("Kein Ausgabename definiert!", "No Output Name defined!"); string ERRNOBATCH = M("Batch '%s' nicht gefunden!", "Batch '%s' not found!"); 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 ERRNOMOVELEM = M("Keine Quellelemente fuer die Verschiebung selektiert!", "No move source element set 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 ERRPSDELETE = M("Temporaer-Datei konnte nicht geloescht werden!", "Error deleting temporary file!"); string ERRPSREAD = M("Fehler beim Lesen der Temporaerdatei!", "Error reading temporary file!"); string ERRPSWRITE = M("Fehler beim Schreiben auf Ausgabedatei!", "Error writing input file!"); string ERRINPVAL = M_ERRINPVAL(); // INI file parameter name definitions #define PAR_PSTMPFILE "PSTMPFILE_SCM" // Postscript temporary file name #define PAR_PRTCMD "PSPRTCMD_SCM" // 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_EPSFEXT "EPSFEXT_SCM" // Encaps. postscript file name ext. #define PAR_PDFFEXT "PDFFEXT_SCM" // PDF output file name extension #define PAR_PDFVARSEP "PDFVARSEP_SCM" // PDF file variant name separator #define PAR_BFONTNAME "BFONTNAME_SCM" // Bitmap font name #define PAR_BFONTBASE "BFONTBASE_SCM" // Bitmap font relativ base line off. #define PAR_BFONTSTROKE "BFONTSTROKE_SCM" // Bitmap font relative text stroke #define PAR_AFONTNAME "AFONTNAME_SCM" // Alternate bitmap font name #define PAR_AFONTBASE "AFONTBASE_SCM" // Alt. bitmap font rel. base line off. #define PAR_AFONTSTROKE "AFONTSTROKE_SCM" // Bitmap alt. font rel. text stroke #define PAR_FONTMODE "PSFONTMODE_SCM" // Output font mode #define PAR_FONTSCALE "PSFSCALE_SCM" // Postscript font extra scale factor #define PAR_PLTNOPLC "PLTNOPLC_SCM" // Plot attributes of unplaced symbols #define PAR_XOFF "PSXOFF_SCM" // Paper/sheet X offset #define PAR_YOFF "PSYOFF_SCM" // Paper/sheet Y offset #define PAR_PWCOMPTOL "PSPWCOMPTOL_SCM" // Paper width relativ comp. tol. #define PAR_LINEW "PSLINEWIDTH_SCM" // Line width index #define PAR_LINEABS "PSLINEABS_SCM" // Line width absolute flag #define PAR_FORMAT "PSFORMAT_SCM" // Output format #define PAR_TPSSCALE "TPSSCALE_SCM" // Transparent postscript scale factor #define PAR_TPSROTATE "TPSROTATE_SCM" // Transparent postscript rotation #define PAR_PLANMODE "PSPLANMODE_SCM"// Output plan(s) mode #define PAR_SYMANNOT "PDFSYMANNOT_SCM"// Symbol annotation mode #define PAR_ANNOTCOL "PDFANNOTCOL_SCM"// Symbol annotation color #define PAR_COMMTEXT "PSCOMMTEXT_SCM"// Commentary text output mode #define PAR_PDFLAYGRP "PDFLAYGRP_SCM" // PDF layer group support #define PAR_PDFGRPNLAY "PDFGRPNLAY_SCM"// PDF group name layer flag #define PAR_AUTOPROJ "AUTOPROJSEL_STD"// Automatic project file name sel. #define PAR_LISTDCNT "LISTDCNT_STD" // Max. dialog list items count #define PAR_PDFMINCHK "PDFMINCHK_STD" // PDF minimum size check #define PAR_PRTDEVLST "PRTDEVLST_STD" // Printer device name list #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_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/SCM %s from %s, %s\n" #define FMTEPSCREADATE "%%%%CreationDate: %s\n" #define FMTEPSPAGES "%%%%Pages: %d\n" #define FMTEPSLANGLEVEL "%%%%LanguageLevel: 3\n" #define FMTEPSENDCMTS "%%%%EndComments\n" #define FMTEPSPAGE "%%%%Page: %d %d\n" #define FMTEPSBEGINDOC "%%%%BeginDocument: %s\n" #define FMTEPSENDDOC "\n%%%%EndDocument\n" #define FMTEPSTRAILER "%%%%Trailer\n" #define FMTEPSFOOT "\nshowpage\nQ\n" #define FMTCLOSEPATH "h\n" #define FMTSTROKE "S\n" #define FMTFILL "f\n" #define FMTCOORD "%s %s" #define FMTMOVETO " m\n" #define FMTLINETO " l\n" #define FMTCURVETO " c\n" #define FMTARC " %f %f %f arc\n" #define FMTARCN " %f %f %f arcn\n" #define FMTSETLINEWIDTH "%f w\n" #define FMTSETLINECAP "1 J 1 j\n" #define FMTSETDASH "[%.3f %.3f %.3f %.3f] 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 FMTFONT "(F%d) findfont %.3f scalefont setfont\n" #define FMTTEXT "(%s) show\n" #define FMTROTON "q\n%.3f 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/quotedblbase/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 FMTPDFPAGE1A "%d 0 obj\n<< " #define FMTPDFPAGE1Z "/Filter /LZWDecode " #define FMTPDFPAGE1B "/Length %d 0 R >>\nstream\n" #define FMTPDFPAGE2 "endstream\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 %d 0 R\n/Resources << /Font << /F1 %d 0 R " #define FMTPDFPAGE6 "/F2 %d 0 R >> /ProcSet [/PDF /Text]\n" #define FMTPDFPAGE7 ">>\n/Contents %d 0 R\n>>\nendobj\n" #define FMTPDFPAGE8 "%d 0 obj\n<<\n/Dest [%d 0 R /FitB ]\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 "%d 0 obj\n<< /Type /Catalog /Pages %d 0 R\n" #define FMTPDFROOT2 "/Outlines %d 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 FMTPDFTREE1 "%d 0 obj\n<< /Type /Pages /Kids [\n" #define FMTPDFTREE2 "] /Count %d\n>>\nendobj\n" #define FMTPDFTREEENT "%d 0 R\n" #define FMTPDFCREA1 "%d 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 "%d 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)\n>>\nendobj\n" #define FMTPDFLGRPL1 "/Properties <<" #define FMTPDFLGRPL2 " /ocn%d %d 0 R" #define FMTPDFLGRPL3 " >>\n" #define FMTPDFLGRPG1 "/OCProperties <> /OCGs[" #define FMTPDFLGRPG3 "] >>\n" #define FMTPDFLGRPO1 "%d 0 obj[" #define FMTPDFLGRPO2 " %d 0 R" #define FMTPDFLGRPO3 "]\nendobj\n" #define FMTPDFLGRPOREF " %d 0 R" #define FMTPDFLGRPGS "/OFF[" #define FMTPDFLGRPGE "] " #define FMTPDFXREF "xref\n0 %d\n0000000000 65535 f \n" #define FMTPDFXREFENT "%010d 00000 n \n" #define FMTPDFTRAIL "trailer\n<< /Size %d /Root %d 0 R /Info %d 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 FMTPDFTROT1 "%.3f %.3f %.3f %.3f " #define FMTPDFTROT2 " Tm\n" #define FMTPDFBOCGN "/OC /ocn%d BDC\n" #define FMTPDFEOCG "EMC\n" #define PDFN 6 // PDF special object count #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, 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 }; // 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_WIDTHE 8.0 // Element 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 CCOLOFFPE 70.0 // Page elem. 2nd ctrl. column offset #define CCOLOFFE 20.0 // Element 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 SELBOXWIDTHES 90.0 // Element selection box width #define SELBOXWIDTHEE 70.0 // Element edit box width // Constant definitions 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 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 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 PSEXT = bae_inistrval(PAR_EPSFEXT,".ps"); // Postscript output file name ext. string PDFEXT = bae_inistrval(PAR_PDFFEXT,".pdf"); // PDF output file name ext. string PDFVARSEP = bae_inistrval(PAR_PDFVARSEP,"_"); // PDF file variant name separator 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 PSFONTMODE = bae_iniintval(PAR_FONTMODE,1); // Postscript font mode int PLTNOPLC = bae_iniintval(PAR_PLTNOPLC,0); // Plot unplaced symbol attributes flag double FONTSCALE = bae_inidblval(PAR_FONTSCALE,1.0); // PS font extra scaling factor int PDFLAYGRP = bae_iniintval(PAR_PDFLAYGRP,0); // PDF layer group support int PDFGRPNLAY = bae_iniintval(PAR_PDFGRPNLAY,0); // PDF group name layer flag int PDFCOMP = bae_iniintval(PAR_PDFCOMP,1); // PDF compressed output int compflag = 0 /* Compressed output flag */; int TPLANMASK = 0 /* Text class plan mask mode */; STRINGS DEFPRTDEVL = { // Default printer devices "lpt", "prn" }; STRINGS PRTDEVL /* Printer device list */; int PRTDEVN /* Printer device count */; #define ATTRNOPLC "$noplc" // Not placed attribute name #define MAXLINELEN 256 // Maximum input line length #define MTOPS 72000/25.4 // m to PostScript units factor #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 A4WABS 0.210 // A4 absolut width [m] double PWCOMPTOL = bae_inidblval(PAR_PWCOMPTOL,0.1); // Paper width rel. compare tolerance #define A4W 210 // A4 frameless width [mm] #define A4H 297 // A4 frameless height [mm] #define A3W 297 // A3 frameless width [mm] #define A3H 420 // A3 frameless 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 frameless width [mm] #define LETTERH 279.4 // Letter frameless height [mm] #define PDFMINSIZE 0.0254 // PDF minimum page dimension #define BUSWIDTH 0.002 // Bus line width [m] #define BUSLWH 0.5*BUSWIDTH // Half bus line width double PWIDTH = A16x24W /* Paper width */; double PHEIGHT = A16x24H /* Paper height */; double MTOMM = cvtlength(1.0,0,2) /* PostScript output scale */; double PI = cvtangle(180.0,1,2) /* PI-value */; double DPI = cvtangle(360.0,1,2) /* Double PI value */; double PI2 = cvtangle(90.0,1,2) /* Pi half value */; #define SMALLANG 0.00001 // Small angle compare value #define SMALLDIST 0.000001 // Small distance compare value #define SMALLTEXT 0.000001 // Small text size // Output parameters int LINEABS = bae_iniintval(PAR_LINEABS,1); // Line width absolute flag int LINEWIDX = bae_iniintval(PAR_LINEW,0); // Default line width index double LINEWIDTH = 0.0003 /* Line width [m] */; double TLINEWIDTH = 0.0001 /* Text line width [mm] */; int FORMAT = bae_iniintval(PAR_FORMAT,0); // Plot default format double SCALEFACTOR = bae_inidblval(PAR_TPSSCALE,1.0); // Transparent postscript scale factor int PLANMODE = bae_iniintval(PAR_PLANMODE,0); // Plot default output plan(s) mode int COMMTEXT = bae_iniintval(PAR_COMMTEXT,1); // Plot default commentary text mode int SYMANNOT = bae_iniintval(PAR_SYMANNOT,0); // Symbol annotation mode int lconload = 0 /* Layout con. list loaded flag */; string ANNOTCOL = bae_inistrval(PAR_ANNOTCOL,"0.8 0.8 0.8"); // Symbol annotation color 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 = bae_iniintval(PAR_TPSROTATE,0); // Scale with rotation flag int CENTERPAGE = 0 /* Center page image flag : 0 = No page centering 1 = Center page image */; int CLIP = 0 /* Plot clipping flag : 0 = Clipping Off 1 = Clipping On */; int PDF = 0 /* PDF output flag : 0 = EPS output 1 = PDF output */; int PDFFIT = 1 /* PDF print settings fit to page flag : 0 = don't scale 1 = fit to page */; 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" }; // Object types #define STEXT 0 // Normal text #define CTEXT 1 // Commentary text #define VTEXT 2 // Variant attribute text #define KTEXT 3 // Variant attribute commentary text #define DOCA 4 // Documentary area #define DOCL 5 // Documentary line #define DOCD 6 // Dotted documentary line #define CONA 7 // Contact area #define CON 8 // Connections #define CONB 9 // Bus connections #define OUTL 10 // Outline #define TAGL 11 // Tag link #define OBJCNT 12 // OBject type count // Output objects info structure struct outdes { // Output object descriptor int obj /* Object type */; int class /* Object macro class */; int mode /* Object poly fill flag : 1 = fill 0 = outline Object text font flag : (-1) = Default font 2 = Alternate Postscript font 1 = Postscript font 0 = BAE vector font */; int tmode /* Object tag output flag : Bit 1 = standard symbol output Bit 2 = tag output */; 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 */; double angle /* Hatch angle */; double spc /* Hatch spacing [mm] (0=no hatch) */; double dash1 /* Dash value 1 [mm] (0=no dash) */; double dash2 /* Dash value 2 [mm] */; double dash3 /* Dash value 3 [mm] */; double dash4 /* Dash value 4 [mm] */; double plw /* Polygon line width */; double tlw /* Text line width */; int tcmode /* Text class mode */; int tcmask /* Text class mask */; int tcnil /* Nil text class flag */; int vismode /* Plot visibility mode */; string grp /* Layer group name */; }; static struct outdes outfield[] = { // Object output info field {DOCD ,DDBCLSCM ,1,1,0.95,0.95,0.95,0,0.0,2.0,2.0,2.0,2.0, 0.0,0.0,0,0,1,1,""}, // Pln dot fill {DOCD ,DDBCLSSYM,1,1,1.0,1.0,1.0,0,0.0,2.0,2.0,2.0,2.0, // Sym dot fill 0.0,0.0,0,0,1,1,""}, {DOCA ,DDBCLSCM ,1,1,0.2,0.2,0.2,0,0.0,0.0,0.0,0.0,0.0, // Pln areas 0.0,0.0,0,0,1,1,""}, {DOCA ,DDBCLSSYM,1,1,0.0,0.0,0.0,0,0.0,0.0,0.0,0.0,0.0, // Prt areas 0.0,0.0,0,0,1,1,""}, {DOCA ,DDBCLSLAB,1,1,0.0,0.0,0.0,0,0.0,0.0,0.0,0.0,0.0, // Lab areas 0.0,0.0,0,0,1,1,""}, {DOCA ,DDBCLSMRK,1,1,0.2,0.2,0.2,0,0.0,0.0,0.0,0.0,0.0, // Mrk areas 0.0,0.0,0,0,1,1,""}, {DOCL ,DDBCLSCM ,0,1,0.0,0.0,0.0,0,0.0,0.0,0.0,0.0,0.0, // Pln lines 0.0,0.0,0,0,1,1,""}, {DOCL ,DDBCLSSYM,0,1,0.0,0.0,0.0,0,0.0,0.0,0.0,0.0,0.0, // Sym lines 0.0,0.0,0,0,1,1,""}, {DOCL ,DDBCLSLAB,0,1,0.0,0.0,0.0,0,0.0,0.0,0.0,0.0,0.0, // Lab lines 0.0,0.0,0,0,1,1,""}, {DOCL ,DDBCLSMRK,0,1,0.0,0.0,0.0,0,0.0,0.0,0.0,0.0,0.0, // Mrk lines 0.0,0.0,0,0,1,1,""}, {DOCD ,DDBCLSCM ,0,1,0.0,0.0,0.0,0,0.0,2.0,2.0,2.0,2.0, // Pln dot lines 0.0,0.0,0,0,1,1,""}, {DOCD ,DDBCLSSYM,0,1,0.0,0.0,0.0,0,0.0,2.0,2.0,2.0,2.0, // Sym dot lines 0.0,0.0,0,0,1,1,""}, {DOCD ,DDBCLSLAB,0,1,0.0,0.0,0.0,0,0.0,2.0,2.0,2.0,2.0, // Lab dot lines 0.0,0.0,0,0,1,1,""}, {DOCD ,DDBCLSMRK,0,1,0.0,0.0,0.0,0,0.0,2.0,2.0,2.0,2.0, // Mrk dot lines 0.0,0.0,0,0,1,1,""}, {STEXT,DDBCLSCM ,(-1),1,0.0,0.0,0.0,0,0.0,0.0,0.0,0.0,0.0, //Plan text 0.0,0.0,0,0,1,1,""}, {STEXT,DDBCLSSYM,(-1),1,0.0,0.0,0.0,0,0.0,0.0,0.0,0.0,0.0, //Symbol text 0.0,0.0,0,0,1,1,""}, {VTEXT,DDBCLSSYM,(-1),1,0.0,0.0,0.0,0,0.0,0.0,0.0,0.0,0.0, // Sym v-text 0.0,0.0,0,0,1,1,""}, {STEXT,DDBCLSLAB,(-1),1,0.0,0.0,0.0,0,0.0,0.0,0.0,0.0,0.0, //Label text 0.0,0.0,0,0,1,1,""}, {STEXT,DDBCLSMRK,(-1),1,0.0,0.0,0.0,0,0.0,0.0,0.0,0.0,0.0, //Marker text 0.0,0.0,0,0,1,1,""}, {CTEXT,DDBCLSCM ,(-1),1,0.4,0.4,0.4,0,0.0,0.0,0.0,0.0,0.0, //Plan c-text 0.0,0.0,0,0,1,1,""}, {CTEXT,DDBCLSSYM,(-1),1,0.4,0.4,0.4,0,0.0,0.0,0.0,0.0,0.0, // Sym c-text 0.0,0.0,0,0,1,1,""}, {KTEXT,DDBCLSSYM,(-1),1,0.4,0.4,0.4,0,0.0,0.0,0.0,0.0,0.0, // Sym c-text 0.0,0.0,0,0,1,1,""}, {CTEXT,DDBCLSLAB,(-1),1,0.4,0.4,0.4,0,0.0,0.0,0.0,0.0,0.0, // Lab c-text 0.0,0.0,0,0,1,1,""}, {CTEXT,DDBCLSMRK,(-1),1,0.4,0.4,0.4,0,0.0,0.0,0.0,0.0,0.0, // Mrk c-text 0.0,0.0,0,0,1,1,""}, {CONB ,DDBCLSCM ,0,1,0.0,0.0,0.0,0,0.0,0.0,0.0,0.0,0.0, // Bus con. 0.0,0.0,0,0,1,1,""}, {CON ,DDBCLSCM ,1,1,0.0,0.0,0.0,0,0.0,0.0,0.0,0.0,0.0, // Connections 0.0,0.0,0,0,1,1,""}, {CONA ,DDBCLSMRK,1,1,0.0,0.0,0.0,0,0.0,0.0,0.0,0.0,0.0, // Contact areas 0.0,0.0,0,0,1,1,""} }; static int outfieldn=arylength(outfield) /* Object output info field length */; /* Example output entries Draw part documentary areas filled with light gray color (0.9,0.9,0.9) : { DOCA,DDBCLSSYM,1,0,0.9,0.9,0.9, 0, 0.0, 0.0, 0.0, 0.0, 0.0 } Draw schematic doc. areas as outline in dark gray color (0.2,0.2,0.2) : { DOCA,DDBCLSCM ,0,0,0.2,0.2,0.2, 0, 0.0, 0.0, 0.0, 0.0, 0.0 } Draw schematic documentary areas as outline filled with 45 degree hatch in black color (0.0,0.0,0.0) : { DOCA,DDBCLSCM ,0,0,0.0,0.0,0.0, 45, 0.2, 0.0, 0.0, 0.0, 0.0 } Draw part documentary areas as 0.2 mm dashed outline filled with 45 degree hatch in dark gray color (0.2,0.2,0.2) : { DOCA,DDBCLSSYM,0,0,0.2,0.2,0.2, 45, 0.2, 0.2, 0.2, 0.2, 0.2 } Draw tag links as dashed lines in black color (0.0,0.0,0.0) {TAGL ,DDBCLSMRK,0,1,0.0,0.0,0.0, 0,0.0,2.0,2.0,2.0,2.0} NOTE : Hatching yields long processing time and large data output files. Drawing gray scale 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 */; }; // 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 PAROUTFTPMASK 5 // Output file text plan mask mode #define PAROUTFONT1 6 // Output 1st font name #define PAROUTFONT2 7 // Output 2nd font name #define PAROUTFONT1B 8 // Output 1st font base line #define PAROUTFONT2B 9 // Output 2nd font base line #define PAROUTFONT1S 10 // Output 1st font stroke width #define PAROUTFONT2S 11 // Output 2nd font stroke width #define PAROUTFDISP 12 // Output file display call #define PAROUTFPSCALE 13 // Output file printer out. scale flag #define PAROUTFVAR 14 // Output files for all variants #define PAROUTFMACRO 15 // Output file name macro #define PAROUTFATTR1 16 // Output file name 1st attribute #define PAROUTFATTR2 17 // Output file name 2nd attribute #define PAROUTFATTR3 18 // Output file name 3rd attribute #define PAROUTFATTR4 19 // Output file name 4th attribute #define PAROUTFATTRD 20 // Output file name default attribute #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 PARPAGESCAL 5 // Output page scale factor #define PARPAGEFMT 6 // Output page format #define PARPAGERMOD 7 // Output page rotation mode #define PARPAGELMOD 8 // Output page line scale mode #define PARPAGECENT 9 // Output page centered mode #define PARPAGEBRED 10 // Output page bg. red color value #define PARPAGEBGREEN 11 // Output page bg. green color value #define PARPAGEBBLUE 12 // Output page bg. blue color value #define PARPAGEECOMM 13 // Output page element comment mode #define PARPAGEIPAT 14 // Output page name include pattern #define PARPAGEEPAT 15 // Output page name exclude pattern #define PARPAGESYMA 16 // Output page symbol 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 PARPAGECNT 20 // Output page parameter count // Batch output element parameters #define PARELEMFILL 0 // Output element fill mode #define PARELEMRED 1 // Output element red color value #define PARELEMGREEN 2 // Output element green color value #define PARELEMBLUE 3 // Output element blue color value #define PARELEMHANGLE 4 // Output element hatch angle #define PARELEMHSPACE 5 // Output element hatch spacing #define PARELEMDASH1 6 // Output element dash 1 length #define PARELEMDASH2 7 // Output element dash 2 length #define PARELEMDASH3 8 // Output element dash 3 length #define PARELEMDASH4 9 // Output element dash 4 length #define PARELEMPOLYW 10 // Output element polygon line width #define PARELEMTEXTW 11 // Output element text line width #define PARELEMIDX 12 // Output element index #define PARELEMFONT 13 // Output element font mode #define PARELEMGNAME 14 // Output element group name #define PARELEMSYMM 15 // Output element symbol mode #define PARELEMPELEM 16 // Output element plan elements #define PARELEMSELEM 17 // Output element symbol elements #define PARELEMLELEM 18 // Output element label elements #define PARELEMMELEM 19 // Output element marker elements #define PARELEMTCMODE 20 // Output element text class mode #define PARELEMTCNIL 21 // Output element text class nil flag #define PARELEMTCMASK 22 // Output element text class mask #define PARELEMCOMM 23 // Output element comment #define PARELEMPVIS 24 // Output element plot vis. mode #define PARELEMACT 25 // Output element group active flag #define PARELEMCNT 26 // Output element parameter count // Globals #define SMALLVAL 0.000000001 // Small compare value #define SIZETOL 0.0001 // Size compare tolerance static int psfh /* PostScript output file handle */; static string os /* Output string */; static int opos = 0 /* Output position */; static int opagen = 0 /* Output page count */; static int pageobjoff /* Output page object offset */; static int outlobjoff /* Output outline object offset */; 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 output line width */; static double pstlinewidth /* PS output text line width */; static string pstmline /* PS multiline text */; static index C_FIGURE pscurfig /* Figure list index */; static int pscurcon /* Cur. PostScript connection flag */; static int pscurobj /* Cur. PostScript object */; static int pscurclass /* Cur. PostScript macro class */; static int psdefmode /* Cur. PostScript default mode */; static int pscurmode /* Cur. PostScript current mode */; static int pscurtmode /* Cur. PostScript tag output mode */; static double pscurtsfac /* Cur. PostScript text size factor */; static int pstcmode = 0 /* Cur. PostScript text class mode */; static int pstcmask = 0 /* Cur. PostScript text class mask */; static int pstcnil = 1 /* Cur. PostScript text nil class */; static int psvismode = 1 /* Cur. PostScript visibility mode */; 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 double pscurang /* Cur. PostScript hatch angle */; static double pscurspc /* Cur. PostScript hatch spacing */; static double pscurdash1 /* Cur. PostScript dash 1 length */; static double pscurdash2 /* Cur. PostScript dash 2 length */; static double pscurdash3 /* Cur. PostScript dash 3 length */; static double pscurdash4 /* Cur. PostScript 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 pstextflag /* PostScript text output flag */; static int psscanjunct /* PostScript junction scan flag */; static int pslinefill /* PostScript line area fill flag */; static int psbusfill /* PostScript bus fill flag */; static int psvarattr /* PS variant attr. output flag */; static double wslx,wsly /* Workspace lower boundary */; static double wsux,wsuy /* Workspace upper boundary */; static index C_POOL junct /* Junction pool index */; static string plotdispred /* Plot disable predicate name */; static string defcolor /* Output default color */; static string curcolor /* Output current color */; static int curtclass /* Current text class */; static string netarea /* Net area name */; static double netareansiz /* Net area name text size */; // Object offset definitions #define ROOTOBJ 1 /* Root object number */ #define CATOBJ 2 /* Catalog object number */ #define CREAOBJ 3 /* Creation date object number */ #define FONT1OBJ 4 /* Font 1 object number */ #define FONT2OBJ 5 /* Font 2 object number */ #define OUTLOBJ 6 /* Outline object number */ #define LAYGRPOBJ 7 /* Layer group object number */ static int objol[] /* Object start offset list */; static int lastobj /* Last object */; 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 */; struct attrdes { // Attribute descriptor string name /* Attribute name */; string disp /* Attribute display name */; string val /* Attribute value */; int ord /* Attribute order */; } attl[] /* Attribute data list */; int attn = 0 /* Attribute count */; string ngrpl[] /* Layer name group list */; int ngrpil[] /* Layer name ID list */; int ngrpol[] /* Layer name object list */; int ngrpvl[] /* Layer name visibility list */; int ngrpn = 0 /* Layer name group count */; int insngrpidx /* Layer name group insert index */; string batl[] /* Batch name list */; int batn /* Batch count */; STRINGS el /* Popup entry list */; int en = 0 /* Popup entry count */; int curelem = (-1) /* Current batch element */; int curelemn /* Current element count */; int curpage = (-1) /* Current batch page */; int curfile = (-1) /* Current batch file */; 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 elemdes { // Batch output element descriptor int id /* Batch output element ID */; int parn /* Batch output element param. count */; struct pardes parl[] /* Batch output element param. list */; }; struct pagedes { // Batch step descriptor int id /* Batch output page ID */; int elemn /* Batch output element count */; struct elemdes eleml[] /* Batch output element 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 peleml[] /* Batch page element list */; int pelemn = 0 /* Batch page element count */; static int ddbclass = bae_planddbclass()/* Schematic plan DDB class */; int abortflag = 0 /* Output abort request flag */; // SQL command definitions #define B_CREATE "create table sepsbatches (batchname string);" #define B_HELP "help sepsbatches;" #define B_INSERT "insert into sepsbatches values(%s);" #define B_SELECT "select batchname from sepsbatches;" #define B_DELETE "delete from sepsbatches where batchname=%s;" #define I_CREATE "create table sepsid (maxepsid integer);" #define I_HELP "help sepsid;" #define I_INSERT "insert into sepsid values(%d);" #define I_SELECT "select maxepsid from sepsid;" #define I_DELETE "delete from sepsid;" #define F_CREATE "create table sepsbatchfiles (batchname string,id integer);" #define F_HELP "help sepsbatchfiles;" #define F_INSERT "insert into sepsbatchfiles values(%s,%d);" #define F_SELECT "select id from sepsbatchfiles where batchname=%s;" #define F_DELETE "delete from sepsbatchfiles where batchname=%s;" #define F_DELETES "delete from sepsbatchfiles where batchname=%s AND id=%d;" #define P_CREATE "create table sepsbatchpages (fileid integer,id integer);" #define P_HELP "help sepsbatchpages;" #define P_INSERT "insert into sepsbatchpages values(%d,%d);" #define P_SELECT "select id from sepsbatchpages where fileid=%d;" #define P_DELETE "delete from sepsbatchpages where fileid=%d;" #define P_DELETES "delete from sepsbatchpages where id=%d;" #define E_CREATE "create table sepsbatchelements (pageid integer,id integer);" #define E_HELP "help sepsbatchelements;" #define E_INSERT "insert into sepsbatchelements values(%d,%d);" #define E_SELECT "select id from sepsbatchelements where pageid=%d;" #define E_DELETE "delete from sepsbatchelements where pageid=%d;" #define E_DELETES "delete from sepsbatchelements where id=%d;" #define PP_CREATE1 "create table sepsparamtab (id integer," #define PP_CREATE2 "pidx integer,ival integer,dval float,sval string);" #define PP_HELP "help sepsparamtab;" #define PP_INSERT "insert into sepsparamtab values(%d,%d,%d,%.20f,%s);" #define PP_SELECT "select pidx,ival,dval,sval from sepsparamtab where id=%d;" #define PP_DELETE "delete from sepsparamtab where id=%d;" #define FN_CREATE1 "create table sepspdf_data (ftyp integer," #define FN_CREATE2 "elemname string,filename string);" #define FN_DELETE "delete from sepspdf_data where ftyp=%d AND elemname=%s;" #define FN_INSERT "insert into sepspdf_data values(%d,%s,%s);" #define FN_SELECT1 "select filename from sepspdf_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 page #define PAGE_SINGLEN 2 // Single named element page #define PAGE_ALLP 3 // Page for every file sheet element #define PAGE_ALLPEXT 4 // Ext. page for all file sheet elem. #define PAGE_ALLS 5 // Page for every file symbol element #define PAGE_ALLSEXT 6 // Ext. page for all file symbol el. #define PAGE_ALLL 7 // Page for every file label element #define PAGE_ALLLEXT 8 // Ext. page for all file label elem. #define PAGE_ALLM 9 // Page for every file marker element #define PAGE_ALLMEXT 10 // Ext. page for all file marker el. #define PAGE_ALLV 11 // Var. page for all file sheet elem. // Main program void main() { string batname /* Batch name */; 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 scalestring /* Scaling string */; int rotflag = 0 /* Rotation flag */; 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 */; double swap /* Coordinate swap buffer */; double pcol = 23.0 /* Parameter column */; double cy /* Dialog box current y coordinate */; int repflag /* Dialog box repeat flag */; int res /* Query result */; int varidx /* INI variable index */; int gridlock /* Grid lock flag */; int rangedis /* Range check disabled flag */; int outfidx = (-1) /* Output file parameter index */; int lgrpidx /* Layer group parameter index */; int fmtidx = (-1) /* Output format parameter index */; int callidx = (-1) /* Control call parameter index */; int aruntype /* Control call parameter type */; int modeidx = (-1) /* Output mode parameter index */; int transidx = (-1) /* Transparent parameter index */; int scalidx = (-1) /* Scale factor parameter index */; int linwidx = (-1) /* Line width parameter index */; int linsidx = (-1) /* Line scaling parameter index */; int rotidx = (-1) /* Rotation parameter index */; int clipidx = (-1) /* Clip mode parameter index */; int fontidx = (-1) /* Font mode parameter index */; int ctxtidx = (-1) /* Commentary text out. par. index */; int sannidx = (-1) /* Symbol annotation parameter index */; int xoffidx /* X offset parameter index */; int yoffidx /* Y offset parameter index */; int class /* Output class */; int format = 4 /* Format */; int cmode /* Output mode */; int lwmode /* Line width mode */; int devidx /* Device name index */; int i /* Loop control variable */; // Perform BAE Demo check with abort option BAE_Demo_check(2); if (PDFCOMMAND=="") getextprog(".pdf",PDFCOMMAND); // Check if direct batch selection if (bae_peekiact()) { 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; // Assume whole plan output CLIP=0; getwsbound(); // Init. the file name database fndbinit(); // Check for dialog support if (bae_dialclr()) { // Get the output mode bae_promptdialog(UPRPLAN); bae_defmenusel(PLANMODE); if ((cmode=bae_askmenu(7, (ddbclass==DDBCLUNDEF ? "," : "")+UPRPLAN0,UPRPLAN1,UPRPLAN2, UPRPLAN3,UPRPLAN4,UPRPLAN5,UPRPLAN6,UPRABORT))<0 || cmode>6) // Abort error_abort(); // Select the output file name bae_setmousetext(""); if ((psname=bae_readedittext(UPRPSFILE,"",MAXPATHLEN))=="" || psname==UINPOPABORT) error_abort(); // Check if transparent EPS output if (cmode==0) { // Get the scaling factor bae_promptdialog(UPRSCALE); format=bae_askmenu(12,UPRSCALE0,UPRSCALE1,UPRSCALE2, UPRSCALE3,UPRFORMAT1,UPRFORMAT2,UPRFORMAT3,UPRFORMAT4, UPRFORMAT5,UPRFORMAT6,UPRFORMAT7,UPRABORT); } else { // Get the scaling factor bae_promptdialog(UPRFORMAT); if ((format=bae_askmenu(8,UPRFORMAT1, UPRFORMAT2,UPRFORMAT3,UPRFORMAT4, UPRFORMAT5,UPRFORMAT6,UPRFORMAT7,UPRABORT))<0) error_abort(); format+=4; } switch (format) { // SCM transparent with scale factor query case 0 : SCALEFACTOR=1.0; scalestring=""; // Ask user for valid scale factor if (askdbl(SCALEFACTOR,UPRPLTSCALE,20)) error_abort(); // Set the scale string scalestring=ftoa(SCALEFACTOR,5); break; // SCM transparent scaling 1:1 case 1 : SCALEFACTOR=1.0; scalestring="1"; break; // SCM transparent scaling 1:2 case 2 : SCALEFACTOR=0.5; scalestring="0.5"; break; // SCM transparent scaling 2:1 case 3 : SCALEFACTOR=2.0; scalestring="2"; break; // PDF, scaling n:1 case 9 : PDF=1; // Scaling n:1 case 4 : SCALEMODE=2; // Get the scale factor if (askdbl(SCALEFACTOR,UPRSCALE,10)) error(ERRINPVAL); SCALEROT=0; LINEABS=1; if (SCALEFACTOR==1.0) SCALEMODE=0; break; // Scaling A4 case 5 : PWIDTH=A4W; PHEIGHT=A4H; SCALEMODE=1; SCALEROT=1; break; // Scaling A3 case 6 : PWIDTH=A3W; PHEIGHT=A3H; SCALEMODE=1; SCALEROT=1; break; // Scaling 160*240 case 7 : PWIDTH=A16x24W; PHEIGHT=A16x24H; SCALEMODE=1; SCALEROT=0; break; // Scaling Letter (8.5"*11.0") case 8 : PWIDTH=LETTERW; PHEIGHT=LETTERH; SCALEMODE=1; SCALEROT=1; break; // Automatic scaling A3/A4 case 10 : // Check if small enough for A4 if ((wsux-wslx)=4) { // Get the line width bae_promptdialog(UPRLINEW); if ((lwmode=bae_askmenu(4,UPRLINEW1,UPRLINEW2, UPRLINEW3,UPRABORT))<0 || lwmode>2) // Abort error_abort(); // Test if 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(); } } // Check if single page output if (opagen==1) { // Select plot clipping mode bae_promptdialog(UPRCLIPMOD); switch (CLIP= bae_askmenu(2,UPRCLIPOFF,UPRCLIPON)) { // 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 chk. state bae_setintpar(0,rangedis); // Restore grid lock bae_setgridlock(gridlock); error_abort(); } // Restore old range chk. 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) { // SCM transparent with scale factor query case 0 : // SCM transparent scaling 1:1 case 1 : // SCM transparent scaling 1:2 case 2 : // SCM transparent scaling 2:1 case 3 : break; // PDF, scaling n:1 case 9 : PDF=1; // Scaling n:1 case 4 : SCALEMODE=2; SCALEROT=0; LINEABS=1; break; // Scaling A4 case 5 : PWIDTH=A4W; PHEIGHT=A4H; SCALEMODE=1; SCALEROT=1; break; // Scaling A3 case 6 : PWIDTH=A3W; PHEIGHT=A3H; SCALEMODE=1; SCALEROT=1; break; // Scaling 160*240 case 7 : PWIDTH=A16x24W; PHEIGHT=A16x24H; SCALEMODE=1; SCALEROT=0; break; // Scaling Letter (8.5"*11.0") case 8 : PWIDTH=LETTERW; PHEIGHT=LETTERH; SCALEMODE=1; SCALEROT=1; break; // Automatic scaling A3/A4 case 10 : // Check if small enough for A4 if ((wsux-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; SCALEROT=0; LINEABS=1; bae_dialsetdata(rotidx,PA_LAB,0,0.0,UPRNIL); bae_dialgetdata(scalidx,0,SCALEFACTOR,""); bae_dialsetdata(scalidx, PA_DBL|PA_CHKLL|PA_HBRDREL,0,SCALEFACTOR,""); bae_dialsetdata( linsidx,PA_LAB,LINEABS,0.0,UPRNIL); bae_dialgetdata(callidx,AUTORUN,0.0,""); bae_dialsetdata( callidx,PA_NIL,AUTORUN,0.0,UPRPDFARUN); bae_dialgetdata(lgrpidx,PDFLAYGRP,0.0,""); bae_dialsetdata( lgrpidx,PA_NIL,PDFLAYGRP,0.0,UPRPDFLGRP); adjfname(outfidx,0,PDF!=0 ? 1 : 0); PDF=0; break; // Scaling A4 case 5 : PWIDTH=A4W; PHEIGHT=A4H; SCALEMODE=1; SCALEROT=1; bae_dialsetdata(rotidx,PA_LAB,0,0.0,UPRNIL); bae_dialsetdata( scalidx,PA_LAB,0,SCALEFACTOR,UPRNIL); bae_dialsetdata( linsidx,PA_SB|PA_HBRDREL,LINEABS,0.0,""); bae_dialgetdata(callidx,AUTORUN,0.0,""); bae_dialsetdata( callidx,PA_NIL,AUTORUN,0.0,UPRPDFARUN); bae_dialgetdata(lgrpidx,PDFLAYGRP,0.0,""); bae_dialsetdata( lgrpidx,PA_NIL,PDFLAYGRP,0.0,UPRPDFLGRP); adjfname(outfidx,0,PDF!=0 ? 1 : 0); PDF=0; break; // Scaling A3 case 6 : PWIDTH=A3W; PHEIGHT=A3H; SCALEMODE=1; SCALEROT=1; bae_dialsetdata(rotidx,PA_LAB,0,0.0,UPRNIL); bae_dialsetdata( scalidx,PA_LAB,0,SCALEFACTOR,UPRNIL); bae_dialsetdata( linsidx,PA_SB|PA_HBRDREL,LINEABS,0.0,""); bae_dialgetdata(callidx,AUTORUN,0.0,""); bae_dialsetdata( callidx,PA_NIL,AUTORUN,0.0,UPRPDFARUN); bae_dialgetdata(lgrpidx,PDFLAYGRP,0.0,""); bae_dialsetdata( lgrpidx,PA_NIL,PDFLAYGRP,0.0,UPRPDFLGRP); adjfname(outfidx,0,PDF!=0 ? 1 : 0); PDF=0; break; // Scaling 160*240 case 7 : PWIDTH=A16x24W; PHEIGHT=A16x24H; SCALEMODE=1; SCALEROT=0; bae_dialsetdata(rotidx,PA_LAB,0,0.0,UPRNIL); bae_dialsetdata( scalidx,PA_LAB,0,SCALEFACTOR,UPRNIL); bae_dialsetdata( linsidx,PA_SB|PA_HBRDREL,LINEABS,0.0,""); bae_dialgetdata(callidx,AUTORUN,0.0,""); bae_dialsetdata( callidx,PA_NIL,AUTORUN,0.0,UPRPDFARUN); bae_dialgetdata(lgrpidx,PDFLAYGRP,0.0,""); bae_dialsetdata( lgrpidx,PA_NIL,PDFLAYGRP,0.0,UPRPDFLGRP); adjfname(outfidx,0,PDF!=0 ? 1 : 0); PDF=0; break; // Scaling Letter (8.5"*11.0") case 8 : PWIDTH=LETTERW; PHEIGHT=LETTERH; SCALEMODE=1; SCALEROT=1; bae_dialsetdata(rotidx,PA_LAB,0,0.0,UPRNIL); bae_dialsetdata( scalidx,PA_LAB,0,SCALEFACTOR,UPRNIL); bae_dialsetdata( linsidx,PA_SB|PA_HBRDREL,LINEABS,0.0,""); bae_dialgetdata(callidx,AUTORUN,0.0,""); bae_dialsetdata( callidx,PA_NIL,AUTORUN,0.0,UPRPDFARUN); bae_dialgetdata(lgrpidx,PDFLAYGRP,0.0,""); bae_dialsetdata( lgrpidx,PA_NIL,PDFLAYGRP,0.0,UPRPDFLGRP); adjfname(outfidx,0,PDF!=0 ? 1 : 0); PDF=0; break; // PDF, scaling n:1 case 9 : SCALEMODE=2; SCALEROT=0; LINEABS=1; bae_dialsetdata(rotidx,PA_LAB,0,0.0,UPRNIL); bae_dialgetdata(scalidx,0,SCALEFACTOR,""); bae_dialsetdata(scalidx, PA_DBL|PA_CHKLL|PA_HBRDREL,0,SCALEFACTOR,""); bae_dialsetdata( linsidx,PA_LAB,LINEABS,0.0,UPRNIL); bae_dialgetdata(callidx,AUTORUN,0.0,""); bae_dialsetdata( callidx,aruntype,AUTORUN,0.0,UPRPDFARUN); bae_dialgetdata(lgrpidx,PDFLAYGRP,0.0,""); bae_dialsetdata( lgrpidx,PA_TOGGLE,PDFLAYGRP,0.0,UPRPDFLGRP); adjfname(outfidx,1,PDF!=1 ? 1 : 0); PDF=1; break; // Automatic scaling A3/A4 case 10 : // Check if small enough for A4 if ((wsux-wslx)=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(); } // Delete old name info sprintf(sqlcommand,FN_DELETE,PDF,sql_quotestr(bae_planename())); sqlcmd(bae_planfname(),sqlcommand,NULL); // Check if extended file base name fbname=convstring(bae_planfname(),0); fblen=strlen(fbname); if (strextract(psname,0,fblen-1)==fbname) // Store reference to project file name instead of plain name fbname="*"+strextract(psname,fblen,strlen(psname)); else fbname=psname; // Store name info sprintf(sqlcommand,FN_INSERT,PDF, sql_quotestr(bae_planename()),sql_quotestr(fbname)); sqlcmd(bae_planfname(),sqlcommand,NULL); // Open the PostScript output file if (format>=4) { // Check if printer output if (strscannext(psname,".",0,1)>strlen(psname)) { printername=psname; psname=TEMPFNAME; } if (cmode!=6) psfh=bae_fopen(psname,4); } else { // Get rotation flag bae_promptdialog(UPRROT); switch (bae_askmenu(3,UPRROT0,UPRROT1,UPRABORT)) { // No rotation case 0 : rotflag=0; break; // Rotate 90 degree case 1 : rotflag=1; break; // Abort default : error_abort(); } } // Output all selected elements abortflag=0; // Check if variant scan if (cmode==5) { getvardata(fname,outl[0],class); outlobjoff=(PDFLAYGRP ? LAYGRPOBJ : OUTLOBJ)+1; pageobjoff=outlobjoff+varn; lastobj=pageobjoff+PDFP*varn*opagen; for (i=0;i=4) { // Check if extended file base name if (strextract(psname,0,fblen-1)==fbname) psvoutname=strextractfilepath(bae_planfname())+ varl[i].varname+ strextract(psname,fblen,strlen(psname)); else psvoutname=strextractfilepath(bae_planfname())+ varl[i].varname+(PDF ? PDFEXT : PSEXT); psfh=bae_fopen(psvoutname,4); opos=0; curopage=0; lastobj=pageobjoff+PDFP*opagen; } for (curpage=0;curpage=4) { // Write the file trailer writetrailer(0,opagen); fclose(psfh); } if (i==0) psroutname=psvoutname; else psroutname+=","+psvoutname; if (abortflag) break; } psname=psroutname; } else { pageobjoff=outlobjoff=(PDFLAYGRP ? LAYGRPOBJ : OUTLOBJ)+1; lastobj=pageobjoff+PDFP*opagen; for (curpage=0;curpage=4 && cmode!=6) { // Write the file trailer writetrailer(cmode==5 ? 1 : 0,opagen); fclose(psfh); } // Check if printer output if (printername!="") { // Perform printer output if (!abortflag) system(PRTCMD+printername+" \""+ strgetvarfilename(psname)+"\""); psname=printername; } // Check if automatic PDF display tool call if (PDF && AUTORUN && PDFCOMMAND!="") launch(PDFCOMMAND+" \""+strgetvarfilename(psname)+"\""); // Done message(abortflag ? REPOUTABORT : PDF ? REPPDFDONE : REPPSDONE, strgetvarfilename(psname)); } // EPS/PostScript output routines void epstransparent( string psname,double scalefactor,string scalestring,int rotflag) /* // Perform SCM transparent EPS output // Parameters : // string psname : PostScript output file name // double scalefactor : Scaling factor // string scalestring : Scaling string // int rotflag : Rotation flag */ { int psifh /* PostScript input file handle */; int psofh /* PostScript output file handle */; string curstr /* Current input string */; string oplotdev /* Old plot device */; // Set the scaling factor bae_clriactqueue(); bae_storetextiact(1,scalestring); call(MNU_SCMPLTSCAL); // Set rotation bae_clriactqueue(); bae_storemenuiact(1,rotflag,LMB); call(MNU_SCMPLTROT); // Buffer the old plot device name oplotdev=scm_plotdev(); // Set the plot device bae_clriactqueue(); bae_storetextiact(1,TEMPFNAME); call(MNU_SCMPLTDEV); // Start the PostScript output call(MNU_SCMPLTPOST); message(REPPSWRITE,psname); // Open the PostScript output file psofh=bae_fopen(psname,4); // Open the PostScript input file psifh=bae_fopen(TEMPFNAME,0); // Write file header writehead(psname, (rotflag ? bae_planwsny()-bae_planwsuy() : bae_planwslx()-bae_planwsnx())*MTOPS*scalefactor, (rotflag ? bae_planwslx()-bae_planwsnx() : bae_planwsly()-bae_planwsny())*MTOPS*scalefactor, (rotflag ? bae_planwsny()-bae_planwsly() : bae_planwsux()-bae_planwsnx())*MTOPS*scalefactor, (rotflag ? bae_planwsux()-bae_planwsnx() : bae_planwsuy()-bae_planwsny())*MTOPS*scalefactor); // Repetively copy string from temporary file to output file while (fgets(curstr,MAXLINELEN,psifh)==0) // Output the current line (ignore comments) if (curstr[0]!='%' && fputs(curstr,psofh)) errormsg(ERRPSWRITE,strgetvarfilename(psname)); // Write file trailer writefoot(outelemname(0), (rotflag ? bae_planwsuy()-bae_planwsly() : bae_planwsux()-bae_planwslx())*MTOPS*scalefactor, (rotflag ? bae_planwsux()-bae_planwslx() : bae_planwsuy()-bae_planwsly())*MTOPS*scalefactor,(-1),(-1),(-1)); // Test on read errors if (!feof(psifh)) error(ERRPSREAD); // Close PS files fclose(psifh); fclose(psofh); // Remove the temporary file if (remove(TEMPFNAME)) error(ERRPSDELETE); // Restore the old plot channel bae_clriactqueue(); if (oplotdev=="") bae_storetextiact(1,"-"); else bae_storetextiact(1,oplotdev); call(MNU_SCMPLTDEV); } void epsout(string psname,string pagename,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 prevpage : Previous page index // int nextpage : Next page index // int parent : Parent catalog index // int varreq : Variant request number */ { index C_FIGURE tfig /* Text figure list index */; index C_NREF nref /* Named reference index */; index CL_CPART cpart /* Connection part index */; index CL_ATTRIBUTE cattr /* Connection part attribute */; index C_CONSEG conseg /* Connection segment index */; double width,height /* Plan dimensions */; double uwidth,uheight /* Usable paper dimensions */; double scale /* Scale factor */; double upx,upy /* Upper boundary coordinates */; string tbuf /* Text buffer */; string aval /* Attribute value */; string atext /* Annotation text */; 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 */; string plname /* PDF layer name */; int rotate /* Rotation flag */; int plotdis /* Plot disable flag */; string msg /* Message buffer */; int grpidx /* Layer group index */; int laygrp /* Layer group used flag */; int oldtcmask /* Old text class mask */; int anpvismode /* Annotation plot visibility mode */; int antagmode /* Annotation tag plot mode */; int curgngrpidx /* Current group name layer index */; int curplgrpidx /* Current PDF layer index */; int i, j /* Loop control variables */; // Perform the EPS output message(REPPSWRITE,psname); // Query the current active variant if (ddbclass!=DDBCLSCM || cap_rulequery(RS_OCSCMDB,0,RS_SCMSUBJ,RS_VARIANT,"?d",varnumber)<1) // Set default variant varnumber=0; // Check if variant set request if (varreq>=0) { // Store new variant rule varnumber=varl[varreq].varnum; // Set variant name and number rsc_assplanintpred(1,RS_VARIANT,varnumber,0,"scm_variant_*"); rsc_assplanstrpred(1,RS_VARNAME,varl[varreq].varname,"",""); bae_postprocess(); } if (SYMANNOT && ddbclass==DDBCLSCM && !lconload && caploadlastcon()==0) lconload=1; // Build the plot disable predicate name sprintf(plotdispred,"%s%d",RS_VARPLOTDIS,varnumber); // Query the current bus display mode if (cap_rulequery(RS_OCSCMDB,0,RS_SCMSUBJ,RS_BUSFILL,"?d",psbusfill)<1) // Set default display mode psbusfill=0; // Query the net area name text size if (ddbclass!=DDBCLSCM || cap_rulequery( RS_OCSCMDB,0,RS_SCMSUBJ,RS_NETAREANSIZ,"?f",netareansiz)<1) // Set default net area name text size netareansiz=0.004; // Check if text class mask reset if (TPLANMASK) { // Query the text class disable mask if (cap_rulequery( RS_OCSCMDB,0,RS_SCMSUBJ,RS_TXTCDIS,"?d",oldtcmask)<1) // Set default mask oldtcmask=0; if (oldtcmask!=0) // Clear the text class mask rsc_assplanintpred(1,RS_TXTCDIS,0,0,""); } // Get the junction point macro pool index junct=cap_pointpoolidx(); // Get conversion factor internal to mm units MTOMM=cvtlength(1.0,0,2); // 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)=0 && pscurfig.TYP!=C_FIGCON && cap_rulequery(RS_OCFIG,pscurfig, RS_SCMSUBJ,RS_PDFLAY,"?s",plname)>0 && plname!="") storelgrpname(plname,1); forall (conseg where conseg.RULEOBJID>=0 && cap_rulequery(RS_OCCON,conseg,RS_SCMSUBJ,RS_PDFLAY, "?s",plname)>0 && plname!="") storelgrpname(plname,1); } } // Get the plan size width=(wsux-wslx)*MTOMM; height=(wsuy-wsly)*MTOMM; // Reset current font size psxoff=psyoff=0.0; psm1=MTOMM; psm2=0.0; psm3=0.0; psm4=MTOMM; psscale=MTOMM; psrot=0.0; // Check scale mode if (SCALEMODE) { // Check if scaling by factor if (SCALEMODE==2) { // Set page size according to scale factor PWIDTH=width*SCALEFACTOR+2*XOFF; PHEIGHT=height*SCALEFACTOR+2*YOFF; } // Get the usable page window size uwidth=PWIDTH-2*XOFF; uheight=PHEIGHT-2*YOFF; // Init the boundary values upx=uwidth; upy=uheight; // Check orientation if (!SCALEROT || height>width) { // Reset the rotation flag rotate=0; // Set scale to max. value if (!SCALEROT || uheight/height>uwidth/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 { // Set the 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; } } // Write file header writehead(psname,XOFF*MMTOPS,YOFF*MMTOPS, (upx+XOFF)*MMTOPS,(upy+YOFF)*MMTOPS); writehead2(); // Set rotation and offset if (rotate) { psm1=0.0; psm2=(-MTOMM); psm3=MTOMM; psm4=0.0; psxoff=height+YOFF/scale; psyoff=XOFF/scale; psrot=PI2; } else { psxoff=XOFF/scale; psyoff=YOFF/scale; } // Set line width deflinewidth=deftlinewidth= (LINEABS ? LINEWIDTH/scale : LINEWIDTH); setscale(scale*MMTOPS); for (i=0;i0.0) outfield[i].plw= (LINEABS ? outfield[i].plw/scale : outfield[i].plw); else outfield[i].plw=deflinewidth; if (outfield[i].tlw>0.0) outfield[i].tlw= (LINEABS ? outfield[i].tlw/scale : outfield[i].tlw); else outfield[i].tlw=deftlinewidth; } } else { // Write file header upx=width; upy=height; writehead(psname,XOFF*MMTOPS,YOFF*MMTOPS, (width+XOFF)*MMTOPS,(height+YOFF)*MMTOPS); writehead2(); psxoff=XOFF; psyoff=YOFF; deflinewidth=deftlinewidth=LINEWIDTH; setscale(MMTOPS); for (i=0;i=0 && cap_rulequery(RS_OCFIG,pscurfig,RS_SCMSUBJ, RS_PDFLAY,"?s",plname)>0 && plname!="") curplgrpidx=findlgrpname(plname); else curplgrpidx=(-1); annotl[annotn].obj=lastobj; annotl[annotn].text=atext; annotl[annotn].lx=pscurfig.RLX-wslx; annotl[annotn].ly=pscurfig.RLY-wsly; annotl[annotn].ux=pscurfig.RUX-wslx; annotl[annotn].uy=pscurfig.RUY-wsly; annotl[annotn].lgrpidx=curplgrpidx; annotn++; lastobj++; } } // Write data for all PS objects for (i=0;i=0) { sprintf(os,FMTPDFBOCGN,ngrpil[grpidx]); outstr(); laygrp=1; } // Set polygon line width sprintf(os,FMTSETLINEWIDTH,pslinewidth*psscale); outstr(); // Set dashed line data sprintf(os,pscurdash1!=0.0 ? FMTSETDASH : FMTRESETDASH, pscurdash1,pscurdash2,pscurdash3,pscurdash4); outstr(); // Initialize scan flags pstextflag=0; psscanjunct=0; // Set the line area fill flag pslinefill=psdefmode==2 && (pscurobj==DOCD || pscurobj==DOCL); // Set element RGB values sprintf(defcolor,"%.2f %.2f %.2f", outfield[i].red,outfield[i].green,outfield[i].blue); outcolor(defcolor); // Loop for all figure list elements forall (pscurfig) { // Query the current active variant netarea=""; plotdis=0; curtclass=0; if (pscurfig.RULEOBJID>=0) { // Get plot visibility if (cap_rulequery(RS_OCFIG,pscurfig,RS_SCMSUBJ, plotdispred,"?d",plotdis)<1) plotdis=0; // Get text class if (cap_rulequery(RS_OCFIG,pscurfig,RS_SCMSUBJ, RS_TXTCLASS,"?d",curtclass)<1) curtclass=0; // Query net area name predicate if (pscurfig.TYP==C_FIGPOLY && cap_rulequery(RS_OCFIG,pscurfig,RS_SCMSUBJ, RS_TNETAREA,"?s",netarea)<1) netarea=""; // Query plot color predicate if (cap_rulequery(RS_OCFIG,pscurfig,RS_SCMSUBJ, RS_PLOTRGB,"?s",curcolor)<1 || chkcolor(curcolor,0.0,0.0,0.0)) curcolor=defcolor; // Query plot font predicate if (cap_rulequery(RS_OCFIG,pscurfig,RS_SCMSUBJ, RS_PLOTFONT,"?d",pscurmode)<1 || pscurmode<0) pscurmode=psdefmode; // Query plot text scale factor predicate if (cap_rulequery(RS_OCFIG,pscurfig,RS_SCMSUBJ, RS_PLOTTSFAC,"?f",pscurtsfac)<1 || pscurtsfac<=0.0) pscurtsfac=1.0; if (PDFLAYGRP && pscurfig.TYP!=C_FIGCON && cap_rulequery(RS_OCFIG,pscurfig,RS_SCMSUBJ, RS_PDFLAY,"?s",plname)>0 && plname!="") { if ((curplgrpidx= findlgrpname(plname))>=0) { sprintf(os,FMTPDFBOCGN, ngrpil[curplgrpidx]); outstr(); } } else { curplgrpidx=(-1); } // Query group name predicate if (PDFGRPNLAY && PDFLAYGRP && pscurfig.TYP!=C_FIGCON && cap_rulequery(RS_OCFIG,pscurfig,RS_SCMSUBJ, RS_GROUPNAME,"?s",plname)>0 && plname!="") { if ((curgngrpidx= findlgrpname(plname))>=0) { sprintf(os,FMTPDFBOCGN, ngrpil[curgngrpidx]); outstr(); } } else { curgngrpidx=(-1); } } else { curcolor=defcolor; pscurmode=psdefmode; pscurtsfac=1.0; curplgrpidx=curgngrpidx=(-1); } if (plotdis==psvismode && pscurfig.TYP!=C_FIGCON) // Plot disabled continue; // Query the multi-line text status if (!pscurmode || pscurfig.RULEOBJID<0 || pscurfig.TYP!=C_FIGTEXT || cap_rulequery(RS_OCFIG,pscurfig,RS_SCMSUBJ,RS_MTEXTID, "?s",mtextid)<1 || mtextid=="" || cap_rulequery(RS_OCFIG,pscurfig, RS_SCMSUBJ,RS_MTEXTCOL,"?d",col)<1 || cap_rulequery(RS_OCFIG,pscurfig, RS_SCMSUBJ,RS_MTEXTROW,"?d",mrow)<1) { pstmline=""; } else { // Check if start of multiline text if (col!=0) continue; // Scan all related multiline texts maxcol=(-1); forall (tfig where tfig.RULEOBJID>=0 && tfig.TYP==C_FIGTEXT && cap_rulequery(RS_OCFIG,tfig,RS_SCMSUBJ, RS_MTEXTID,"?s",textid)>0 && textid==mtextid && cap_rulequery(RS_OCFIG,tfig, RS_SCMSUBJ,RS_MTEXTROW,"?d",row)>0 && mrow==row && cap_rulequery(RS_OCFIG,tfig, RS_SCMSUBJ,RS_MTEXTCOL,"?d",col)>0) { mtext[col]=tfig.NAME; if (col>maxcol) maxcol=col; } pstmline=mtext[0]; for (j=1;j<=maxcol;j++) pstmline+=mtext[j]; } // Get the variant attribute output state psvarattr= PLTNOPLC ? 0 : getattrstate(pscurfig); pscurcon= pscurfig.TYP==C_FIGCON ? 1 : 0 ; // Scan object data if (cap_scanfelem(pscurfig,wslx,wsly,0.0,1, psmac,pscon,pspoly,pstext)!=0) error_scan(); if (PDFLAYGRP) { if (curplgrpidx>=0) { os=FMTPDFEOCG; outstr(); } if (curgngrpidx>=0) { os=FMTPDFEOCG; outstr(); } } } // 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; } } } // Write file trailer writefoot(pagename,(upx+2*XOFF)*MMTOPS,(upy+2*YOFF)*MMTOPS, prevpage,nextpage,parent); curopage++; // Reload plan to dismiss text class mask or variant number change if ((oldtcmask!=0 || varreq>=0) && bae_plannotsaved()) { bae_setintpar(21,0); bae_setintpar(22,2); bae_loadelem(bae_planfname(),bae_planename(),DDBCLSCM); } } 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 */ { int objbase /* Page object base */; // Check the output format if (PDF) { // Check if document start if (curopage==0) { os=FMTPDFHEAD; outstr(); } // Write the page data start objbase=curopage*PDFP+pageobjoff; objol[objbase]=opos; 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; } } 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,opagen); fprintf(psfh,FMTEPSLANGLEVEL); } fprintf(psfh,FMTEPSENDCMTS); fprintf(psfh,FMTEPSPAGEBOX1); fprintf(psfh,FMTEPSPAGEBOX2,xs,ys,xe,ye); fprintf(psfh,FMTEPSPAGEBOX3); if (fabs(PWIDTH-A0W)=STEXT && outfield[i].obj<=KTEXT && (outfield[i].mode>0 || (outfield[i].mode<0 && PSFONTMODE))) { for (j=1;j<=2;j++) { // Write the font character table redefinition os=FMTEPSFONTRD01+FMTEPSFONTRD02; outstr(); os=FMTEPSFONTRD03+FMTEPSFONTRD04; outstr(); os=FMTEPSFONTRD05+FMTEPSFONTRD06; outstr(); os=FMTEPSFONTRD07+FMTEPSFONTRD08; outstr(); os=FMTEPSFONTRD09+FMTEPSFONTRD10; outstr(); os=FMTEPSFONTRD11+FMTEPSFONTRD12; outstr(); os=FMTEPSFONTRD13+FMTEPSFONTRD14; outstr(); os=FMTEPSFONTRD15+FMTEPSFONTRD16; outstr(); os=FMTEPSFONTRD17+FMTEPSFONTRD18; outstr(); os=FMTEPSFONTRD19+FMTEPSFONTRD20; outstr(); os=FMTEPSFONTRD21+FMTEPSFONTRD22; outstr(); os=FMTEPSFONTRD23+FMTEPSFONTRD24; outstr(); os=FMTEPSFONTRD25+FMTEPSFONTRD26; outstr(); os=FMTEPSFONTRD27+FMTEPSFONTRD28; outstr(); os=FMTEPSFONTRD29+FMTEPSFONTRD30; outstr(); os=FMTEPSFONTRD31+FMTEPSFONTRD32; outstr(); os=FMTEPSFONTRD33+FMTEPSFONTRD34; outstr(); os=FMTEPSFONTRD35+FMTEPSFONTRD36; outstr(); os=FMTEPSFONTRD37+FMTEPSFONTRD38; outstr(); os=FMTEPSFONTRD39+FMTEPSFONTRD40; outstr(); os=FMTEPSFONTRD41+FMTEPSFONTRD42; outstr(); sprintf(os,FMTEPSFONTRD43, j,j==1 ? PSFONTNAME : PSAFONTNAME); outstr(); os=FMTEPSFONTRD44+FMTEPSFONTRD45; outstr(); os=FMTEPSFONTRD46+FMTEPSFONTRD47; outstr(); os=FMTEPSFONTRD48+FMTEPSFONTRD49; outstr(); os=FMTEPSFONTRD50; outstr(); } break; } } void writefoot(string pagename,double width, double height, int prevpage,int nextpage,int parent) /* // Write EPS/PDF footer/trailer to output file // Parameters : // string pagename : Page name // double width,height : Page dimensions // int prevpage : Previous page index // int nextpage : Next page index // int parent : Parent catalog index */ { int length /* Stream length */; int objbase /* Page object base */; int i /* Loop control variable */; // Check if PDF output if (PDF) { if (compflag) { opos+=fsetcompmode(0); compflag=0; } // Write the page length object length=opos-cursstart; os=FMTPDFPAGE2; outstr(); objbase=curopage*PDFP+pageobjoff; objol[objbase+1]=opos; sprintf(os,FMTPDFPAGE3,objbase+1,length); outstr(); // Write the page frame object objol[objbase+2]=opos; sprintf(os,FMTPDFPAGE4,objbase+2); outstr(); if (annotn) { os=FMTPDFPAGE4A; outstr(); for (i=0;i=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) ? OUTLOBJ : (parent+outlobjoff)); outstr(); for (i=0;i=0) { sprintf(os,FMTPDFPAGE12, ngrpol[annotl[i].lgrpidx]); 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 xref /* Reference table offset */; 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 objol[ROOTOBJ]=opos; sprintf(os,FMTPDFROOT1,ROOTOBJ,CATOBJ); outstr(); sprintf(os,FMTPDFROOT2,OUTLOBJ,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 default disabled layer name groups firstldis=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(); } } else { sprintf(os,FMTPDFOUTL1,OUTLOBJ,curopage); outstr(); sprintf(os,FMTPDFOUTL2,pageobjoff+3, pageobjoff+3+(curopage-1)*PDFP); outstr(); } if (PDF && PDFLAYGRP) { objol[LAYGRPOBJ]=opos; sprintf(os,FMTPDFLGRPO1,PDFN+1); outstr(); for (i=0;ipscurclass && pscurobj!=CON && pscurobj!=CONB) || (macro.TAGSYM!=0 && class!=DDBCLSLAB && (pscurtmode&2)==0) || (macro.TAGSYM==0 && class!=DDBCLSLAB && (pscurtmode&1)==0)) return(0); // Check if bus tap draw if (pscurcon && class==DDBCLSLAB) if (scm_checkbustapplot( pscurfig,cap_getscbustapidx())==psvismode) // Plot disabled return(0); // Check if outline draw if (pscurobj==OUTL) { // Abort scan if not current macro class if (class!=pscurclass) return(0); // Write outline polygon outmoveto(pscurfig.RLX,pscurfig.RLY); outlineto(pscurfig.RUX,pscurfig.RLY); outlineto(pscurfig.RUX,pscurfig.RUY); outlineto(pscurfig.RLX,pscurfig.RUY); // Check fill mode if (psdefmode) // Simple area fill os=FMTFILL; else // Draw outline os=FMTCLOSEPATH+FMTSTROKE; outstr(); // Abort scan return(0); } // Continue scan return(1); } int pspoly(index C_POLY poly,int polyinws, index C_LEVEL level,int macclass,int bustapidx) /* // Output an already transformed polygon data block to PS file // Return value : // zero if done or (-1) on error // Parameters : // index C_POLY poly : Polygon // int polyinws : Poly in workspace flag // index C_LEVEL level : Polygon level // int macclass : Polygon macro class // int bustapidx : Polygon bustap index */ { index C_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 */; string elemcolor /* Element color */; 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 */; double rdashlen = poly.DASHLEN /* Requested plot dash length */; double rdashspc = poly.DASHSPC /* Requested plot dash spacing */; int rdashmode = poly.DASH /* Requested plot dash mode */; int shiftflag /* Coordinate shift flag */; int linefill = 0 /* Line area fill flag */; int netcolor /* Net color index */; int i /* Loop variable */; // Abort if out of class if (macclass!=pscurclass && !psscanjunct) return(0); // Test if the polygon type is requested for output switch (poly.TYP) { // Documentary line case C_POLYDOCLINE : if (pscurobj!=DOCL && !psscanjunct) return(0); // Check if wide line plot requested if (rlinewidth>0.0) { // Set line width sprintf(os,FMTSETLINEWIDTH,rlinewidth*psscale); outstr(); } else if (rlinewidth<0.0) { // Set scaled standard line width sprintf(os,FMTSETLINEWIDTH, -1000.0*rlinewidth*pslinewidth*psscale); outstr(); } if (rdashmode) rdashmode|=2; break; // Documentary area case C_POLYDOCAREA : if (pscurobj!=DOCA && !psscanjunct) return(0); if (netarea!="") { rdashmode=12; rdashlen=0.002; rdashspc=0.4; forall (point of poly) { // Output the net area name if (textout(point.X,point.Y,0.0,0.0, netareansiz,rlinewidth,netarea,0,pscurmode)) return(-1); break; } } else { rdashmode=0; } break; // Contact area case C_POLYCONAREA : if ((pscurobj!=CONA || level>=0) && !psscanjunct) return(0); break; // Dotted documentary line case C_POLYDOTLINE : if (pscurobj!=DOCD && !psscanjunct) return(0); // Check if wide line plot requested if (rlinewidth>0.0) { // Set line width sprintf(os,FMTSETLINEWIDTH,rlinewidth*psscale); outstr(); } else if (rlinewidth<0.0) { // Set scaled standard line width sprintf(os,FMTSETLINEWIDTH, -1000.0*rlinewidth*pslinewidth*psscale); outstr(); } break; // Internal case 2 : case 3 : if (pscurobj!=DOCD && !psscanjunct) return(0); break; // No output area default : return(0); } // Copy points to array i=0; forall (point of poly) { tpoints[i].x=point.X; tpoints[i].y=point.Y; tpoints[i++].typ=point.TYP; } // Query the color if (cap_rulequery(RS_OCPOOL,poly,RS_SCMSUBJ, RS_PLOTRGB,"?s",elemcolor)<1 || chkcolor(elemcolor,0.0,0.0,0.0)) elemcolor=curcolor; netcolor=level.DISPLAY&(~(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) { // Override element dash line values if (pscurdash1!=0.0) { os=FMTRESETDASH; pstextflag=1; outstr(); } bae_clearpoints(); for (i=0;i=0.5 ? 0.0 : rdashspc,psline,psarc)) // Vectorization failed return(-1); // Check if dash line change needed if (pscurdash1!=0.0) { // Set dashed line data sprintf(os,FMTSETDASH, pscurdash1,pscurdash2,pscurdash3,pscurdash4); outstr(); pstextflag=0; } // Check if plot width changed if (rlinewidth!=0.0) { // Restore polygon line width sprintf(os,FMTSETLINEWIDTH,pslinewidth*psscale); outstr(); } // Restore element color if (elemcolor!=defcolor) outcolor(defcolor); // Output done return(0); } // Check if dot line area fill must be done if (pslinefill && poly.PN>2 && fabs(tpoints[0].x-tpoints[poly.PN-1].x)<=SMALLVAL && fabs(tpoints[0].y-tpoints[poly.PN-1].y)<=SMALLVAL && tpoints[0].typ==tpoints[poly.PN-1].typ) // Set the line area fill flag linefill=1; // Check if dash line change needed if (pstextflag && psdefmode==0 && pscurdash1!=0.0) { // Set dashed line data sprintf(os,FMTSETDASH, pscurdash1,pscurdash2,pscurdash3,pscurdash4); 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:poly.PN-1]; // Store the polygon point list for (i=0;i0 && 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); // Set the junction scan flag psscanjunct=1; // Scan cross marker if (cap_scanpool(junct,wslx-lx,wsly-ly, 0.0,coninws,psmac,pscon,pspoly,pstext)) return(-1); // Reset the junction scan flag psscanjunct=0; curcolor=elemcolor; } // Return without errors return(0); } // Check connection class if (!((busconflag && pscurobj==CONB) || (!busconflag && pscurobj==CON))) // Return without errors return(0); // Search connection segment forall (conseg of conbase) { if (scanidx==segidx) { // Query the visibility if (conseg.RULEOBJID<0 || cap_rulequery(RS_OCCON,conseg,RS_SCMSUBJ, plotdispred,"?d",plotdis)<1) plotdis=0; if (plotdis==psvismode) // Plot disabled return(0); // Query the color if (conseg.RULEOBJID<0 || cap_rulequery(RS_OCCON,conseg,RS_SCMSUBJ, RS_PLOTRGB,"?s",elemcolor)<1 || chkcolor(elemcolor,0.0,0.0,0.0)) elemcolor=curcolor; netcolor=level.DISPLAY&(~(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); if (PDFLAYGRP && cap_rulequery(RS_OCCON,conseg, RS_SCMSUBJ,RS_PDFLAY,"?s",plname)>0 && plname!="") { if ((curplgrpidx=findlgrpname(plname))>=0) { sprintf(os,FMTPDFBOCGN, ngrpil[curplgrpidx]); outstr(); } } else { curplgrpidx=(-1); } // Query group name predicate if (PDFGRPNLAY && PDFLAYGRP && cap_rulequery(RS_OCFIG, pscurfig,RS_SCMSUBJ,RS_GROUPNAME,"?s",plname)>0 && plname!="") { if ((curgngrpidx=findlgrpname(plname))>=0) { sprintf(os,FMTPDFBOCGN, ngrpil[curgngrpidx]); outstr(); } } else { curgngrpidx=(-1); } break; } else if (scanidx>segidx) break; scanidx++; } // Start connection output // Check if bus segment if (busconflag) { outmoveto(lx-BUSLWH-wslx,ly-BUSLWH-wsly); outlineto(ux+BUSLWH-wslx,ly-BUSLWH-wsly); outlineto(ux+BUSLWH-wslx,uy+BUSLWH-wsly); outlineto(lx-BUSLWH-wslx,uy+BUSLWH-wsly); // Fill bus segment on request if (psdefmode || psbusfill) { // Fill bus segment os=FMTFILL; outstr(); // Return without errors return(0); } else { // Draw bus segment os=FMTCLOSEPATH; outstr(); } } else { // Draw normal segment outmoveto(lx-wslx,ly-wsly); outlineto(ux-wslx,uy-wsly); } os=FMTSTROKE; outstr(); // Restore element color if (elemcolor!=defcolor) outcolor(defcolor); if (PDFLAYGRP) { if (curplgrpidx>=0) { os=FMTPDFEOCG; outstr(); } if (curgngrpidx>=0) { os=FMTPDFEOCG; outstr(); } } // Return without errors return(0); } int pstext(index C_TEXT textp,double tx,double ty,double tangle, int mirrflag,double tsize,string tstr,int textinws,int macclass,int varattr) /* // Vectorize a text data block // Return value : // zero if done or (-1) on error // Parameters : // index C_TEXT textp : Text index // double tx : Text X coordinate // double ty : Text Y coordinate // double tangle : Text rotation angle // int mirrflag : Text mirror flag // double tsize : Text size // string tstr : Text string // int textinws : Text in workspace flag // int macclass : Text macro class // int varattr : Text variant attribute flag */ { index C_POOL pool /* Pool index */; string elemcolor /* Element color */; int elemmode /* Element font mode */; double elemtsfac /* Element text size factor */; 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 */; int textcomm /* Text commentary flag */; int tclass /* Text class */; string mtextid /* Multiline text ID */; string textid /* Current text ID */; int i /* Loop control variable */; // Abort scan if out of class or empty string if (macclass!=pscurclass || tstr=="" || tstr=="/" || tsize<=SMALLTEXT) return(0); // Check if text output if (pscurobjKTEXT) // Return without errors return(0); // Check text type textcomm=textp.MODE&TEXTCOMM; if (varattr==0) { if (!((textcomm==0 && pscurobj==STEXT) || (textcomm==TEXTCOMM && pscurobj==CTEXT))) // Return without errors return(0); } else { if (!((textcomm==0 && pscurobj==VTEXT) || (textcomm==TEXTCOMM && pscurobj==KTEXT))) // Return without errors return(0); } // Check if variant attribute skip if (psvarattr && textp.STR[0]=='$' && textp.STR!="$" && textp.STR!=ATTRNOPLC && scm_chkattrname(textp.STR)==0) // Return without errors return(0); // Check if text class mask activated if (pstcmode) { // Get text class if (cap_rulequery(RS_OCPOOL,textp,RS_SCMSUBJ, RS_TXTCLASS,"?d",tclass)<1) tclass=curtclass; // Check if nil text class text if (tclass==0) { if (!pstcnil) return(0); } else { if ((tclass&pstcmask)==0) return(0); } } // Query the font if (cap_rulequery(RS_OCPOOL,textp,RS_SCMSUBJ, RS_PLOTFONT,"?d",elemmode)<1 || elemmode<0) elemmode=pscurmode; // Query the text size scale factor if (cap_rulequery(RS_OCPOOL,textp,RS_SCMSUBJ, RS_PLOTTSFAC,"?f",elemtsfac)<1 || elemtsfac<=0.0) elemtsfac=pscurtsfac; tsize*=elemtsfac; // Check if multiline text if (pstmline=="") { // Query the multi-line text status if (elemmode && cap_rulequery(RS_OCPOOL,textp,RS_SCMSUBJ,RS_MTEXTID, "?s",mtextid)>0 && mtextid!="" && cap_rulequery(RS_OCPOOL,textp, RS_SCMSUBJ,RS_MTEXTCOL,"?d",col)>0 && cap_rulequery(RS_OCPOOL,textp, RS_SCMSUBJ,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==17 && cap_rulequery(RS_OCPOOL,pool,RS_SCMSUBJ, RS_MTEXTID,"?s",textid)>0 && textid==mtextid && cap_rulequery(RS_OCPOOL,pool, RS_SCMSUBJ,RS_MTEXTROW,"?d",row)>0 && mrow==row && cap_rulequery(RS_OCPOOL,pool, RS_SCMSUBJ,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 { // Use combined row string tstr=pstmline; } // Query the color if (cap_rulequery(RS_OCPOOL,textp,RS_SCMSUBJ, RS_PLOTRGB,"?s",elemcolor)<1 || chkcolor(elemcolor,0.0,0.0,0.0)) elemcolor=curcolor; if (elemcolor!=defcolor) outcolor(elemcolor); // Output the text if (textout( tx,ty,tangle,mirrflag,tsize,textp.WIDTH,tstr,textp.MODE,elemmode)) return(-1); // Restore element color if (elemcolor!=defcolor) outcolor(defcolor); // Return without errors return(0); } // Attribute scan routines int amacfunc(index C_MACRO macro,index C_POOL pool,int macinws, string refname,index C_LEVEL level,index C_LEVEL buslevel) /* // Attribute scan macro function // Return value : // 0 if out of workspace, 1 if inside, 2 if unknown, or (-1) on error // Parameters : // index C_MACRO macro : Macro index // index C_POOL pool : Macro pool index // int macinws : Macro in workspace flag // string refname : Macro reference name // index C_LEVEL level : Macro level // index C_LEVEL buslevel : Macro bus level */ { return(macro.CLASS==DDBCLSSYM ? 1 : 0); } int atextfunc(index C_TEXT textp,double tx,double ty,double tangle, int mirrflag,double tsize,string tstr,int textinws,int macclass,int varattr) /* // Scan a text data block for attribute definitions // Return value : // zero if done or (-1) on error // index C_TEXT textp : Text index // double tx : Text X coordinate // double ty : Text Y coordinate // double tangle : Text rotation angle // int mirrflag : Text mirror flag // double tsize : Text size // string tstr : Text string // int textinws : Text in workspace flag // int macclass : Text macro class // int varattr : Text variant attribute flag */ { string str /* Text string */; // Get text string str=textp.STR; if (scm_chkattrname(str)) // No valid attribute name return(0); // Check the rotation visibility if (textp.ROTVIS!=100 && !((textp.ROTVIS&1) && (textp.ROTVIS&0x20))) // Process only base orientation texts return(0); addattr(str,""); // Return without errors return(0); } void addattr(string aname,string aval) /* // Add attribute to list // string aname : Attribute name // string aval : Attribute value */ { string attrcommn /* Attribute comment name */; string attrcommv /* Attribute comment value */; int attrord /* Attribute order value */; string str /* Text string */; int i /* Loop control variable */; // Check if already defined for (i=0;i0;i--) if (attl[i-1].ord>attrord || (attl[i-1].ord==attrord && numstrcmp(attl[i-1].name,str)>0)) attl[i]=attl[i-1]; else break; // Store the attribute to the list attl[i].name=aname; attl[i].ord=attrord; // Build comment variable name sprintf(attrcommn,PAR_ATTRCOMMP, strextract(attrcommv,1,strlen(attrcommv))); // Query comment variable if (SYMANNOT==1 || varget(attrcommn,attrcommv)!=0 || attrcommv=="") // No comment available attl[i].disp=aname; else // Attach comment to variable name sprintf(attl[i].disp,"%s %s",aname,attrcommv); attl[i].val=aval; attn++; } int textout(double tx,double ty,double tangle,int mirrflag, double tsize,double twidth,string tstr,int textmode,int fontmode) /* // Output text // Return value : // zero if done or (-1) on error // Parameters : // double tx : Text X coordinate // double ty : Text Y coordinate // double tangle : Text rotation angle // int mirrflag : Text mirror flag // double tsize : Text size // double twidth : Text line width // string tstr : Text string // int textmode : Text mode // int fontmode : Text font mode */ { string otstr /* Output text string */; 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 fontbase /* Font baseline correction */; double fontstroke /* Font line stroke width */; double sl /* Text scan length */; double d /* Double value */; char c /* Character buffer */; char nc /* Next string character */; int negflag /* Negated text flag */; int cnegflag /* Charcter negated text flag */; int negrange /* Negative range pending flag */; int flipframe /* Flip frame flag */; int i /* Loop control variable */; // Restrict angle to [0,360[ while (tangle<0.0) tangle+=DPI; while (tangle>=DPI) tangle-=DPI; // Check if postscript font if (fontmode) { // Get the text length otstr=textstrextract(tstr,tlen,negflag,cnegflag); // Get the text angle vector vx=cos(tangle); vy=sin(tangle); // Check if logical text mirroring required if (mirrflag) { tx+=vy*tsize; ty-=vx*tsize; } // Correct text length according to font folen=tlen; switch (fontmode) { case 1 : switch (PSFONTNAME) { case "Courier" : flen=folen*0.9; break; case "Arial" : flen=arial_length(otstr); break; case "Times-Roman" : flen=times_roman_length(otstr); 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(otstr); break; case "Times-Roman" : flen=times_roman_length(otstr); break; default : flen=folen; } fontbase=PSAFONTBASE; fontstroke=PSAFONTSTROKE; break; default : flen=folen; fontbase=PSFONTBASE; fontstroke=PSFONTSTROKE; } if (textmode&TEXTHCENT) { d=0.5*(folen-flen)*tsize*PSFONTASP; tx+=vx*d; ty+=vy*d; } // Check if logical text rotation required if (fmod(tangle-PI2+4.0*DPI,DPI)<=(PI+SMALLANG) && fabs(tangle-PI2)>SMALLANG) { // Get text diagonal coordinates d=flen*tsize*PSFONTASP; tx+=vx*d-vy*tsize; ty+=vy*d+vx*tsize; // Adjust angle tangle+=PI; // Adjust angle to [0,2*PI[ while (tangle<0.0) tangle+=DPI; while (tangle>=DPI) tangle-=DPI; flipframe=1; } else { flipframe=0; } // 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 && !psdefmode && pscurdash1!=0.0) { // Set undashed line os=FMTRESETDASH; outstr(); pstextflag=1; } // Set line width according to text stroke width sprintf(os,FMTSETLINEWIDTH,tsize*fontstroke*psscale); 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],fontmode); outlineto( tx+d*frx+ftx,ty+d*fry+fty); os=FMTSTROKE; outstr(); } i++; negrange= nc=='(' ? 1 : 0 ; } else { sl+=charwidth(c,fontmode); } } if (negflag || cnegflag) { // Restore polygon line width sprintf(os,FMTSETLINEWIDTH,pslinewidth*psscale); outstr(); } // Check if first frame output if (textmode&TEXTFRM1) { // Set line width according to text stroke width sprintf(os,FMTSETLINEWIDTH,tsize*fontstroke*psscale); 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 sprintf(os,FMTSETLINEWIDTH,tsize*fontstroke*psscale); 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,fontmode, tsize*psscale*FONTSCALE); outstr(); rang=tangle+psrot; sina=sin(rang); cosa=cos(rang); sprintf(os,FMTPDFTROT1,cosa,sina,-sina,cosa); outstr(); outxy(tx+fontbase*ftx,ty+fontbase*fty); os=FMTPDFTROT2; outstr(); } else { // Write the text position with cor. baseline sprintf(os,FMTPDFTEXT1,fontmode, tsize*psscale*FONTSCALE); outstr(); outxy(tx+fontbase*ftx,ty+fontbase*fty); os=FMTPDFTEXT2; outstr(); } } else { // Check if size change if (tsize!=psfontsize) { // Store the new font size psfontsize=tsize; // Write the font selection command sprintf(os,FMTFONT,fontmode, psfontsize*psscale*FONTSCALE); outstr(); } // Write the text position with corrected baseline outmoveto(tx+fontbase*ftx,ty+fontbase*fty); if (fabs(tangle+psrot)>0.0001) { sprintf(os,FMTROTON,cvtangle(tangle+psrot,0,1)); 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(); } } else { // Check if wide line plot requested if (twidth>0.0) { // Set requested line width sprintf(os,FMTSETLINEWIDTH,twidth*psscale); outstr(); } else if (twidth<0.0) { // Set requested relativ line width sprintf(os,FMTSETLINEWIDTH, -1000.0*twidth*pstlinewidth*psscale); outstr(); } else if (pstlinewidth!=pslinewidth) { // Set standard text line width sprintf(os,FMTSETLINEWIDTH,pstlinewidth*psscale); outstr(); } // Vectorize the text if (cap_vecttext( tx,ty,tangle,mirrflag,tsize,textmode,tstr,psline)) // Vectorization failed return(-1); if (twidth!=0.0 || pstlinewidth!=pslinewidth) { // Restore polygon line width sprintf(os,FMTSETLINEWIDTH,pslinewidth*psscale); outstr(); } } // Return without errors return(0); } 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); } 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 && !psdefmode && 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 && !psdefmode && 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+DPI,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(); } // 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 (ang1PI2) { 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+=PI2; } } 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 sprintf(os,ori ? FMTARCN : FMTARC,r*psscale, cvtangle(angs,2,1),cvtangle(ange,2,1)); 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 sprintf(os,FMTCOORD,bae_numstring(x*psm1+y*psm2+psxoff,3), bae_numstring(x*psm3+y*psm4+psyoff,3)); 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); if (!compflag) // Update the file position opos+=strlen(os); } int getattrstate(index C_FIGURE fig) /* // Get attribute output state for given figure list element // Return value : // zero if normal output, one if restricted attribute output // Parameters : // index C_FIGURE fig : Figure list index */ { index C_NREF nref /* Named reference index */; index C_ATTRIBUTE att /* Attribute index */; string vattname /* Variant attribute name */; string attval /* Attribute value */; // Check the element type if (fig.TYP!=C_FIGNREF) // No attribute processing required return(0); // Get the named reference nref=fig.NREF; // Set default attribute value attval=""; // Build the variant attribute name vattname=varattrname(ATTRNOPLC,varnumber); // Search for attribute forall (att of nref where att.NAME==vattname || att.NAME==ATTRNOPLC) { // Store the attribute value attval=att.VALUE; // Check if active variant attribute if (att.NAME==vattname) // Attribute value found break; } // Return the placement status (attribute set if part not placed) return( attval!="" ? 1 : 0 ); } 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 */; 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) { if (strextract(filename,len-strlen(PSEXT),len)==PSEXT) filename= len==strlen(PSEXT) ? PDFEXT : strextract(filename,0,len-strlen(PSEXT)-1)+PDFEXT; } else { if (strextract(filename,len-strlen(PDFEXT),len)==PDFEXT) filename= len==strlen(PDFEXT) ? PSEXT : strextract(filename,0,len-strlen(PDFEXT)-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(3017,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 elemfunc(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].eleml[ filel[curfile].pagel[curpage].elemn].id=dint; filel[curfile].pagel[curpage].elemn++; // Return without errors return(0); } int pelemfunc(string dstr,int dint,double ddbl, int dval,int dtype,string dtable,string dfield,int didx) /* // Page element 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 */ { peleml[pelemn]=dint; pelemn++; // 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].eleml[curelem].parl[curpar].ival= dint; break; // Double value case 3 : filel[curfile].pagel[curpage].eleml[curelem].parl[curpar].dval= ddbl; break; // String value case 4 : filel[curfile].pagel[curpage].eleml[curelem].parl[curpar].sval= dstr; break; } // Return without errors return(0); } void getvardata(string fname,string ename,int class) /* // Get variant data // Return value : // zero if done or (-1) on data error // 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!=DDBCLSCM) bae_setintpar(22,1); bae_loadelem(fname,ename,class); } // Query the current active variant if (class!=DDBCLSCM || cap_rulequery(RS_OCSCMDB,0,RS_SCMSUBJ,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].varnum=i;curelem--) if (filel[curfile].pagel[ curpage].eleml[curelem].parl[ PARELEMIDX].ival=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 = bae_planfname() /* Job file name */; string ename /* Scan element name */; string cvcmd = "" /* CAM View command string */; STRINGS batl /* Batch name list */; int batn = 1 /* Batch name count */; STRINGS hl /* Popup header list */; int hn /* Popup header count */; int autoproj = 0 /* Automatic project selection */; int fh /* File handle */; int batidx /* Batch index */; int i /* Loop control variable */; // Store batch name batl[0]=batname; if (ddbclass==DDBCLUNDEF && jobfname!="") { autoproj=1; fseterrmode(0); fh=fopen(convstring(jobfname,0)+AUTEXT,0); // Skip already processed first line fgets("",240,fh); do { // Get the batch name fgets(batname,240,fh); i=strlen(batname)-1; if (i>0 && batname[i]=='\n') batname[i]='\0'; if (strextract(batname,0,10)=="cvbatld:s0:") { cvcmd=batname; continue; } if (batname!="") { batl[batn]=batname; batn++; } } while (batname!=""); fclose(fh); remove(convstring(jobfname,0)+AUTEXT); fseterrmode(1); ename=""; if (scanddbenames(jobfname,DDBCLSCM,ename)==1) { bae_loadelem(jobfname,ename,DDBCLSCM); ddbclass=bae_planddbclass(); } } // Print the report header hl[0]=REPHEADER; hl[1]=""; hn=2; en=0; for (batidx=0;batidx0) ? jobfname : "",i); if (abortflag) break; jobfname=bae_planfname(); autoproj=1; } } else { if (filel[curfile].parl[PAROUTFMODE].ival==4 || filel[curfile].parl[PAROUTFMODE].ival==5) getvarattr(bae_planfname(), bae_planename(),DDBCLSCM,(-1), filel[curfile].parl[PAROUTFMACRO].sval, filel[curfile].parl[PAROUTFATTR1].sval, filel[curfile].parl[PAROUTFATTR2].sval, filel[curfile].parl[PAROUTFATTR3].sval, filel[curfile].parl[PAROUTFATTR4].sval, filel[curfile].parl[PAROUTFATTRD].sval); runfile(autoproj ? jobfname : "",-1); if (abortflag) break; autoproj=1; } } } else { while (scandirfnames(scandir,DDBEXT,fname)==1) { // List job file and layout name jobfname=scandir+bae_swversion(4)+fname; sprintf(el[en],REPJOB,jobfname); en++; ename=""; while (scanddbenames(jobfname,DDBCLSCM,ename)==1) { if (bae_planfname()==jobfname) bae_setintpar(22,1); bae_loadelem(jobfname,ename,DDBCLSCM); break; } if (ename=="") continue; for (curfile=0;curfile=0) { // Store new variant rule varnumber=varl[varreq].varnum; // Set variant name and number rsc_assplanintpred(1,RS_VARIANT,varnumber,0,"scm_variant_*"); rsc_assplanstrpred(1,RS_VARNAME,varl[varreq].varname,"",""); bae_postprocess(); } // Check batch type switch (PDF=file.parl[PAROUTFTYP].ival) { case FILE_PDF : // Get the output file name outfname=outfilename(file.parl[PAROUTFMODE].ival, file.parl[PAROUTFILE].sval,file.parl[PAROUTFDIR].sval); PDFLAYGRP=file.parl[PAROUTFLAY].ival; PDFFIT=file.parl[PAROUTFPSCALE].ival; // Print the plot in progress message message(REPPDFWRLAY,outfname); sprintf(el[en],REPPDFFILE,outfname); en++; break; case FILE_EPS : default : // Get the output file name outfname=outfilename(file.parl[PAROUTFMODE].ival, file.parl[PAROUTFILE].sval,file.parl[PAROUTFDIR].sval); // Print the plot in progress message message(REPPSWRLAY,outfname); sprintf(el[en],REPEPSFILE,outfname); en++; } // Get text class plan mask mode TPLANMASK=file.parl[PAROUTFTPMASK].ival; // Reset variant info if (varreq<0) varn=0; // Get total page count for (curpage=curopage=totpagen=0;curpage0;i--) { if (numstrcmp(ename, poutl[i-1])>0) break; poutl[i]=poutl[i-1]; } poutl[i]=ename; poutn++; } pelemscan=1; } if (file.pagel[curpage].parl[PARPAGEMODE].ival== PAGE_ALLV && varreq<0 && poutn>0) { getvardata(fname,poutl[0],DDBCLSCM); totpagen+=poutn*varn; varflag=1; } else { totpagen+=poutn; } break; case PAGE_ALLS : case PAGE_ALLSEXT : if (!selemscan) { // Save cur. element with verification on req. bae_setintpar(21,iniplansave); verifysave(); iniplansave=0; // Ask for DDB file name if (fname=="" && bae_iniintval(PAR_AUTOPROJ,0)) fname=bae_planfname(); if (fname=="" && (fname=askddbfile(UPRSELFILE,DDBCLSSYM))=="") error_abort(); // Loop for all parts ename=""; while (scanddbenames( fname,DDBCLSSYM,ename)==1) { if (!strmatch(ename,incpat) || strmatch(ename,excpat)) continue; for (i=soutn;i>0;i--) { if (numstrcmp(ename, soutl[i-1])>0) break; soutl[i]=soutl[i-1]; } soutl[i]=ename; soutn++; } selemscan=1; } totpagen+=soutn; break; case PAGE_ALLL : case PAGE_ALLLEXT : if (!lelemscan) { // Save cur. element with verification on req. bae_setintpar(21,iniplansave); verifysave(); iniplansave=0; // Ask for DDB file name if (fname=="" && bae_iniintval(PAR_AUTOPROJ,0)) fname=bae_planfname(); if (fname=="" && (fname=askddbfile(UPRSELFILE,DDBCLSLAB))=="") error_abort(); // Loop for all padstacks ename=""; while (scanddbenames( fname,DDBCLSLAB,ename)==1) { if (!strmatch(ename,incpat) || strmatch(ename,excpat)) continue; for (i=loutn;i>0;i--) { if (numstrcmp(ename, loutl[i-1])>0) break; loutl[i]=loutl[i-1]; } loutl[i]=ename; loutn++; } lelemscan=1; } totpagen+=loutn; break; case PAGE_ALLM : case PAGE_ALLMEXT : if (!melemscan) { // Save cur. element with verification on req. bae_setintpar(21,iniplansave); verifysave(); iniplansave=0; // Ask for DDB file name if (fname=="" && bae_iniintval(PAR_AUTOPROJ,0)) fname=bae_planfname(); if (fname=="" && (fname=askddbfile(UPRSELFILE,DDBCLSMRK))=="") error_abort(); // Loop for all markers ename=""; while (scanddbenames( fname,DDBCLSMRK,ename)==1) { if (!strmatch(ename,incpat) || strmatch(ename,excpat)) continue; for (i=moutn;i>0;i--) { if (numstrcmp(ename, moutl[i-1])>0) break; moutl[i]=moutl[i-1]; } moutl[i]=ename; moutn++; } melemscan=1; } totpagen+=moutn; break; default : totpagen++; } } // 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; outlobjoff=(PDFLAYGRP ? LAYGRPOBJ : OUTLOBJ)+1; pageobjoff=outlobjoff+(varflag ? varn : 0); lastobj=pageobjoff+PDFP*totpagen; ngrpn=0; if (PDF && PDFLAYGRP) { for (curpage=0;curpage=STEXT && j<=KTEXT) ? file.pagel[curpage ].eleml[curelem].parl[PARELEMFONT].ival : file.pagel[curpage ].eleml[curelem].parl[PARELEMFILL].ival; outfield[outfieldn].tmode=file.pagel[curpage ].eleml[curelem].parl[PARELEMSYMM].ival; outfield[outfieldn].red=file.pagel[curpage ].eleml[curelem].parl[PARELEMRED].dval; outfield[outfieldn].green=file.pagel[curpage ].eleml[curelem].parl[PARELEMGREEN].dval; outfield[outfieldn].blue=file.pagel[curpage ].eleml[curelem].parl[PARELEMBLUE].dval; outfield[outfieldn].angle=file.pagel[curpage ].eleml[curelem].parl[PARELEMHANGLE].dval; outfield[outfieldn].spc= file.pagel[curpage].eleml[curelem].parl[ PARELEMHSPACE].dval*1000.0; if ((outfield[outfieldn].dash1= file.pagel[curpage].eleml[curelem].parl[ PARELEMDASH1].dval*1000.0)==0.0 && j==DOCD) { outfield[outfieldn].dash1=2.0; outfield[outfieldn].dash2=2.0; outfield[outfieldn].dash3=2.0; outfield[outfieldn].dash4=2.0; } else { outfield[outfieldn].dash2=file.pagel[ curpage].eleml[curelem].parl[ PARELEMDASH2].dval*1000.0; outfield[outfieldn].dash3=file.pagel[ curpage].eleml[curelem].parl[ PARELEMDASH3].dval*1000.0; outfield[outfieldn].dash4=file.pagel[ curpage].eleml[curelem].parl[ PARELEMDASH4].dval*1000.0; } outfield[outfieldn].plw=file.pagel[curpage ].eleml[curelem].parl[PARELEMPOLYW].dval; outfield[outfieldn].tlw=file.pagel[curpage ].eleml[curelem].parl[PARELEMTEXTW].dval; outfield[outfieldn].tcmode=file.pagel[curpage ].eleml[curelem].parl[PARELEMTCMODE].ival; outfield[outfieldn].tcmask=file.pagel[curpage ].eleml[curelem].parl[PARELEMTCMASK].ival; outfield[outfieldn].tcnil=file.pagel[curpage ].eleml[curelem].parl[PARELEMTCNIL].ival; outfield[outfieldn].vismode=file.pagel[curpage ].eleml[curelem].parl[PARELEMPVIS].ival; outfield[outfieldn].grp=file.pagel[curpage ].eleml[curelem].parl[PARELEMGNAME].sval; outfieldn++; } } // Output page(s) switch (file.pagel[curpage].parl[PARPAGEMODE].ival) { case PAGE_SINGLE : epsout(outfname,outelemname( file.pagel[curpage].parl[PARPAGEECOMM].ival), opagen==0 ? (-1) : (opagen-1), opagen==(totpagen-1) ? (-1) : (opagen+1),(-1),varreq); opagen++; break; case PAGE_SINGLEEXT : epsout(outfname,outelemname( file.pagel[curpage].parl[PARPAGEECOMM].ival)+ file.pagel[curpage].parl[PARPAGENAME].sval, opagen==0 ? (-1) : (opagen-1), opagen==(totpagen-1) ? (-1) : (opagen+1),(-1),varreq); opagen++; break; case PAGE_SINGLEN : epsout(outfname, file.pagel[curpage].parl[PARPAGENAME].sval, opagen==0 ? (-1) : (opagen-1), opagen==(totpagen-1) ? (-1) : (opagen+1),(-1),varreq); opagen++; break; case PAGE_ALLP : // Output all page elements for (i=0;i=0 && bae_plannotsaved()) { bae_setintpar(21,0); bae_setintpar(22,2); bae_loadelem(bae_planfname(),bae_planename(),DDBCLSCM); } } void editbatch(string batname,int creaflag) /* // Edit batch in batch database // Parameters : // string batname : Batch name // int creaflag : Create new batch flag */ { string msg /* Message buffer */; 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 */; if (creaflag) { // 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); filen=0; } baseheight=DIAL_TOPMARG+DIAL_BUTVSTEP+DIAL_CTRVSTEP+DIAL_SEPVSTEP; // Perform input loop do { bae_dialclr(); dial_getboxsizemin(3018,dialwidth,dialheight, DIAL_LEFTMARG+SELBOXWIDTHBE+DIAL_RIGHTSMARG, baseheight+16.0,DIAL_LEFTMARG+5.0*MBUTXSTEP+DIAL_RIGHTSMARG, baseheight+2.0); readbatch(BAEEPSBDAT,batname); cy=DIAL_TOPMARG; // Store function buttons butx=DIAL_LEFTMARG+MBUTXSTEP; bae_dialaddcontrol( PA_ACT,0,0,0,0.0,0.0,0.0,"",0,butx,cy,MBUTWIDTH,UPRSFCT1); butx+=MBUTXSTEP; bae_dialaddcontrol( PA_ACT,0,1,0,0.0,0.0,0.0,"",0,butx,cy,MBUTWIDTH,UPRSFCT2); butx+=MBUTXSTEP; bae_dialaddcontrol( PA_ACT,0,2,0,0.0,0.0,0.0,"",0,butx,cy,MBUTWIDTH,UPRSFCT3); butx+=MBUTXSTEP; bae_dialaddcontrol( PA_ACT,0,3,0,0.0,0.0,0.0,"",0,butx,cy,MBUTWIDTH,UPRSFCT4); butx+=MBUTXSTEP; // Store abort button bae_dialaddcontrol(PA_ACT,0,(-1),0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG,cy,MBUTWIDTH,UPRSFCT5); cy+=DIAL_BUTVSTEP; dial_label(0.0,cy,UPRBATSTEPS); cy+=DIAL_CTRVSTEP; // 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 && 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,12.0,""); 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+14.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; 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,""); } tpmidx=bae_dialaddcontrol(PA_TOGGLE, 0,0,parl[PAROUTFTPMASK].ival,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFF,cy,0.0,UPRTPLANMASK); cy+=DIAL_CTRVSTEP; // 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=dial_double(2,parl[PAROUTFONT1B].dval,CCOLOFFF,cy); 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=dial_double(2,parl[PAROUTFONT2B].dval,CCOLOFFF,cy); 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,3019); 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(callidx,parl[PAROUTFDISP].ival,0.0,""); bae_dialgetdata( psclidx,parl[PAROUTFPSCALE].ival,0.0,""); bae_dialgetdata(tpmidx,parl[PAROUTFTPMASK].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[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(3020,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;i=3) { dial_label(0.0,cy,UPRDPAGEIPAT); piidx=dial_string( page.parl[PARPAGEIPAT].sval,MAXKEYLEN,CCOLOFFP,cy); dial_label(0.0,cy,UPRDPAGEEPAT); peidx=dial_string( page.parl[PARPAGEEPAT].sval,MAXKEYLEN,CCOLOFFP,cy); } dial_hsep(cy); // Store output format controls dial_label(0.0,cy,UPRDFORMAT); fmtidx=bae_dialaddcontrol(PA_SB,0,0,page.parl[PARPAGEFMT].ival, 0.0,0.0,0.0,"",0,DIAL_LEFTMARG+CCOLOFFP,cy,SB_WIDTHP,""); if (outftyp==FILE_PDF) { dial_sbentry(1,5,UPRFORMAT6); #ifdef LAYOPTS if (page.parl[PARPAGEFMT].ival>5) centidx=bae_dialaddcontrol(PA_TOGGLE,0,0, page.parl[PARPAGECENT].ival,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFP+SB_WIDTHP+1.0, cy,0.0,UPRDCENTPAGE); else centidx=(-1); #endif } else { dial_sbentry(1,0,UPRFORMAT1); dial_sbentry(1,1,UPRFORMAT2); dial_sbentry(1,2,UPRFORMAT3); dial_sbentry(1,3,UPRFORMAT4); dial_sbentry(1,4,UPRFORMAT5); dial_sbentry(1,6,UPRFORMAT7); #ifdef LAYOPTS if (page.parl[PARPAGEFMT].ival>0) centidx=bae_dialaddcontrol(PA_TOGGLE,0,0, page.parl[PARPAGECENT].ival,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFP+SB_WIDTHP+1.0, cy,0.0,UPRDCENTPAGE); else centidx=(-1); #endif } cy+=DIAL_CTRVSTEP; // Store scaling factor controls dial_label(0.0,cy,UPRDSCALE); scalidx=bae_dialaddcontrol((page.parl[PARPAGEFMT].ival==0 || page.parl[PARPAGEFMT].ival==5) ? PA_DBL|PA_CHKLL : PA_LAB,0,5,0,0.0,0.0,page.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, page.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; #ifdef LAYOPTS // Store rotation controls dial_label(0.0,cy,UPRDROTMOD); rmodidx=bae_dialaddcontrol(PA_SB,0,0, page.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,UPRROT1); dial_sbentry(0,2,UPRROT2); cy+=DIAL_CTRVSTEP; #endif // 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,page.parl[PARPAGEXOFF].dval,"",0, DIAL_LEFTMARG+CCOLOFFP,cy,ED_WIDTHE,""); dial_label(CCOLOFFP+10.0,cy,UPRDY); yoffidx=bae_dialaddcontrol(PA_DBL|PA_DIST,0,3, 0,0.0,0.0,page.parl[PARPAGEYOFF].dval,"",0, DIAL_LEFTMARG+CCOLOFFP+12.0,cy,ED_WIDTHE,""); cy+=DIAL_CTRVSTEP; // Store background 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,page.parl[PARPAGEBRED].dval,"",0, DIAL_LEFTMARG+CCOLOFFP,cy,ED_WIDTHE,""); dial_label(CCOLOFFP+10.0,cy,UPRDCG); colgidx=bae_dialaddcontrol(PA_DBL|PA_CHKLL|PA_CHKUL,0,2, 0,-SMALLVAL,1.0+SMALLVAL,page.parl[PARPAGEBGREEN].dval,"",0, DIAL_LEFTMARG+CCOLOFFP+12.0,cy,ED_WIDTHE,""); dial_label(CCOLOFFP+22.0,cy,UPRDCB); colbidx=bae_dialaddcontrol(PA_DBL|PA_CHKLL|PA_CHKUL,0,2, 0,-SMALLVAL,1.0+SMALLVAL,page.parl[PARPAGEBBLUE].dval,"",0, DIAL_LEFTMARG+CCOLOFFP+24.0,cy,ED_WIDTHE,""); 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; dial_hsep(cy); // Store annotation color controls dial_label(0.0,cy,UPRDSYMANNO); sannidx=bae_dialaddcontrol(PA_TOGGLE,0,1, page.parl[PARPAGESYMA].ival,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFP,cy,0.0,UPRDON); cy+=DIAL_CTRVSTEP; dial_label(0.0,cy,UPRDANNOCOL); dial_label(CCOLOFFP-2.0,cy,UPRDCR); cmode=(page.parl[PARPAGESYMA].ival ? 0 : PA_GRAYED)| PA_DBL|PA_CHKLL|PA_CHKUL; sacridx=bae_dialaddcontrol(cmode,0,2, 0,-SMALLVAL,1.0+SMALLVAL,page.parl[PARPAGEARED].dval,"",0, DIAL_LEFTMARG+CCOLOFFP,cy,ED_WIDTHE,""); dial_label(CCOLOFFP+10.0,cy,UPRDCG); sacgidx=bae_dialaddcontrol(cmode,0,2, 0,-SMALLVAL,1.0+SMALLVAL,page.parl[PARPAGEAGREEN].dval,"",0, DIAL_LEFTMARG+CCOLOFFP+12.0,cy,ED_WIDTHE,""); dial_label(CCOLOFFP+22.0,cy,UPRDCB); sacbidx=bae_dialaddcontrol(cmode,0,2, 0,-SMALLVAL,1.0+SMALLVAL,page.parl[PARPAGEABLUE].dval,"",0, DIAL_LEFTMARG+CCOLOFFP+24.0,cy,ED_WIDTHE,""); bae_dialaddcontrol(PA_ACT,0,4,0,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+CCOLOFFP+34.0,cy,0.0,UPRBRWCOLOR); cy+=DIAL_CTRVSTEP; // Call the dialog function bae_setintpar(16,3021); sprintf(msg,UPRDIALOPDEF,batname,fileidx+1,pageidx+1); switch (res=bae_dialaskparams(msg,0,DIAL_LEFTMARG+CCOLOFFP+ ED_WIDTHP+4.0+DIAL_RIGHTSMARG,cy+DIAL_SEPVSTEP)) { case 0 : case 1 : case 2 : case 3 : case 4 : // Get data from dialog box entries if (pnidx==(-1)) page.parl[PARPAGENAME].sval=""; else bae_dialgetdata( pnidx,0,0.0,page.parl[PARPAGENAME].sval); if (piidx==(-1)) page.parl[PARPAGEIPAT].sval="*"; else bae_dialgetdata( piidx,0,0.0,page.parl[PARPAGEIPAT].sval); if (page.parl[PARPAGEIPAT].sval=="") page.parl[PARPAGEIPAT].sval="*"; if (peidx==(-1)) page.parl[PARPAGEEPAT].sval=""; else bae_dialgetdata( peidx,0,0.0,page.parl[PARPAGEEPAT].sval); #ifdef LAYOPTS if (centidx==(-1)) page.parl[PARPAGECENT].ival=0; else bae_dialgetdata( centidx,page.parl[PARPAGECENT].ival,0.0,""); #endif if (ecidx==(-1)) page.parl[PARPAGEECOMM].ival=0; else bae_dialgetdata( ecidx,page.parl[PARPAGEECOMM].ival,0.0,""); bae_dialgetdata( pmidx,page.parl[PARPAGEMODE].ival,0.0,""); bae_dialgetdata( fmtidx,page.parl[PARPAGEFMT].ival,0.0,""); bae_dialgetdata( lmodidx,page.parl[PARPAGELMOD].ival,0.0,""); #ifdef LAYOPTS bae_dialgetdata( rmodidx,page.parl[PARPAGERMOD].ival,0.0,""); #endif bae_dialgetdata( scalidx,0,page.parl[PARPAGESCAL].dval,""); bae_dialgetdata( xoffidx,0,page.parl[PARPAGEXOFF].dval,""); bae_dialgetdata( yoffidx,0,page.parl[PARPAGEYOFF].dval,""); bae_dialgetdata( colridx,0,page.parl[PARPAGEBRED].dval,""); bae_dialgetdata( colgidx,0,page.parl[PARPAGEBGREEN].dval,""); bae_dialgetdata( colbidx,0,page.parl[PARPAGEBBLUE].dval,""); bae_dialgetdata( sannidx,page.parl[PARPAGESYMA].ival,0.0,""); if (page.parl[PARPAGESYMA].ival) { bae_dialgetdata( sacridx,0,page.parl[PARPAGEARED].dval,""); bae_dialgetdata( sacgidx,0,page.parl[PARPAGEAGREEN].dval,""); bae_dialgetdata( sacbidx,0,page.parl[PARPAGEABLUE].dval,""); } switch (res) { case 0 : repflag=0; break; // Page name mode change case 1 : break; // Layer editor case 2 : pagelayers(page,lgrp,fileidx,pageidx,batname); break; // Browse background color case 3 : browsecolor(page.parl[PARPAGEBRED].dval, page.parl[PARPAGEBGREEN].dval, page.parl[PARPAGEBBLUE].dval); break; // Browse annotation color case 4 : browsecolor(page.parl[PARPAGEARED].dval, page.parl[PARPAGEAGREEN].dval, page.parl[PARPAGEABLUE].dval); break; } break; // Fail/abort case (-1) : default : if (newflag) { // Delete new page deletepage(page.id); return(-1); } return(0); } // 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 elements, 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 elemdes swapelem /* Element 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(3022,dialwidth,dialheight, DIAL_LEFTMARG+SELBOXWIDTHES+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.elemn) { 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.elemn) { bae_dialaddcontrol(PA_ACT,0,2,0,0.0,0.0,0.0, "",0,butx,cy,MBUTWIDTH,UPRDDEL); butx+=MBUTXSTEP; } // Move page if (page.elemn>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.elemn) { bae_msgbox(2,ERRNOMOVELEM,""); break; } baseheight=DIAL_TOPMARG+DIAL_SEPVSTEP+DIAL_BUTVSTEP; do { bae_dialclr(); dial_getboxsizemin(3022,dialwidth,dialheight, DIAL_LEFTMARG+SELBOXWIDTHES+DIAL_RIGHTSMARG, baseheight+16.0, DIAL_LEFTMARG+6.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.eleml[i]=page.eleml[i-1]; page.eleml[i].parl[PARELEMIDX].ival=i; updateelem(page.eleml[i]); } else for (i=from;i=0 && i=0) { bae_dialgetdata( lgrpidx,0,0.0,elem.parl[PARELEMGNAME].sval); bae_dialgetdata( lactidx,elem.parl[PARELEMACT].ival,0.0,""); } bae_dialgetdata( fontidx,elem.parl[PARELEMFONT].ival,0.0,""); bae_dialgetdata( ssidx,elem.parl[PARELEMSYMM].ival,0.0,""); bae_dialgetdata(tsidx,intval,0.0,""); if (intval) elem.parl[PARELEMSYMM].ival|=2; pemask=semask=lemask=memask=0; for (i=0;i=0) { bae_dialgetdata( tcnidx,elem.parl[PARELEMTCNIL].ival,0.0,""); tcmask=0; for (i=0;i<=29;i++) { bae_dialgetdata( tclidx[i],intval,0.0,""); if (intval) tcmask|=1<=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=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()); 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)); 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()); 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)); break; // Project + variante name with extension case 6 : if (varn==0) getvardata( bae_planfname(),bae_planename(),bae_planddbclass()); 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)); 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 C_TEXT textp,double tx,double ty,double tangle, int mirrflag,double tsize,string tstr,int textinws,int macclass,int varattr) /* // Scan environment variable texts // Return value : // zero if done or (-1) on error // Parameters : // index C_TEXT textp : Text index // double tx : Text X coordinate // double ty : Text Y coordinate // double tangle : Text rotation angle // int mirrflag : Text mirror flag // double tsize : Text size // string tstr : Text string // int textinws : Text in workspace flag // int macclass : Text macro class // int varattr : Text variant attribute flag */ { // Query the variable name if (envvar!="" || cap_rulequery(RS_OCPOOL,textp,RS_SCMSUBJ,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 storelgrpname(string name,int active) /* // Store layer name to layer name group list // Parameters : // string name : Layer name // int active : Layer active flag */ { int i /* Loop control variable */; // Try to find the layer name if ((i=findlgrpname(name))>=0) return; // Update the layer name list for (i=ngrpn-1;i>=insngrpidx;i--) { ngrpl[i+1]=ngrpl[i]; ngrpvl[i+1]=ngrpvl[i]; ngrpil[i+1]=ngrpil[i]; ngrpol[i+1]=ngrpol[i]; } ngrpl[insngrpidx]=name; ngrpvl[insngrpidx]=active; ngrpil[insngrpidx]=ngrpn; ngrpol[insngrpidx]=lastobj; lastobj++; ngrpn++; } 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=strcmp(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 insngrpidx=slb; // Layer name not found return(-1); } double coltored(int color) /* // Transform color index/value to red color value // Return value : // red scale value // Parameters : // int color : Color index/value */ { double col_red[] = { // Color index to red col. transform. 1.0, 1.0, 1.0, 1.0, 0.4, 0.4, 0.4, 0.2, 0.6, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0 }; int colidx /* Color table index */; // Return invisible color value if invalid color index if (color<0) return(1.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); 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); 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]); } 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); } void fit_a3_a4() /* // Fit page size to A3/A4 depending on plan size */ { getwsbound(); // Check if small enough for A4 if ((wsux-wslx)1.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 tag links for color query oldcol=bae_getcolor(13); bae_setcolor(13,0); bae_clriactqueue(); bae_storemenuiact(1,11,LMB); bae_storemouseiact(0,0.0,0.0,0,LMB); bae_storemenuiact(1,14,LMB); bae_callmenu(107); if ((newcol=bae_getcolor(13))>=0 && newcol<=15) { r=coltored(newcol); g=coltogreen(newcol); b=coltoblue(newcol); } // Restore tag link color bae_setcolor(13,oldcol); } // User Language program end