<> <> <> <> <> <<>> <> DIRECTORY Atom USING [PutPropOnList], CD USING [Design, Layer, LayerKey, Number, Position, Rect, undefLayer], CDBasics USING [SizeOfRect], CDCommandOps USING [DoWithResource], CDIO USING [ReadDesign], CDLayers USING [CurrentLayer], CDOps USING [BoundingBox], CDPanel USING [Button, Info, Line, Text, TakeDownText], CDProperties USING [PutDesignProp, RegisterProperty], CDSequencer USING [Command, ImplementCommand, UseAbortFlag], CDValue USING [RegisterKey, Store], CDViewer USING [ViewerList, ViewersOf, VisibleRect], Commander USING [CommandProc, Handle, Register], CommandTool USING [NextArgument], Convert USING [IntFromRope, Error], CStitching USING [NewTesselation, Tesselation, FindTile], FS USING [ComponentPositions, Error, ExpandName, FileInfo], FSExtras USING [GetWDir], Imager USING [metersPerPoint, Rectangle], IO USING [atom, card, GetBool, GetInt, GetReal, int, PutF, PutFR, real, RIS, rope], MessageWindow USING [Append, Blink, Clear], Nectarine USING [DoInterpress, invalidPrinter, Print], NectarinePd USING [field], PrintingP4V3, Process USING [Detach], Real USING [Fix, Float, Round], Rope USING [ActionType, Cat, Concat, Equal, IsEmpty, Map, ROPE, Substr], RopeFile USING [Create], RuntimeError USING [UNCAUGHT], SafeStorage USING [GetCanonicalReferentType, Type], SweepCollectableStorage USING [EnumerateCollectableStorage, InfoProc], TEditDocument USING [Selection], TEditInputOps USING [Break, CallWithLocks], TerminalIO USING [PutF, PutRope], TextNode USING [Ref], TiogaAccess USING [Create, GetInternalProp, Put, TiogaChar, Writer, WriteSelection, WriteViewer], UserProfile USING [Boolean, Token], VFonts USING [StringWidth], ViewerClasses USING [Viewer], ViewerOps USING [BlinkDisplay, BlinkIcon, CreateViewer], XNSPrint USING [Error, FormatterStatus, GetPaperDimensions, GetPrinterStatus, MarkingEngineStatus, PaperDimensions, PrinterStatus, SpoolerStatus]; NectarineCommand: CEDAR PROGRAM IMPORTS Atom, CD, CDBasics, CDCommandOps, CDIO, CDLayers, CDOps, CDPanel, CDProperties, CDSequencer, CDValue, CDViewer, Commander, CommandTool, Convert, CStitching, FS, FSExtras, IO, MessageWindow, Nectarine, NectarinePd, Process, Real, Rope, RopeFile, RuntimeError, SafeStorage, SweepCollectableStorage, TEditInputOps, TerminalIO, TiogaAccess, UserProfile, VFonts, ViewerOps, XNSPrint ~ BEGIN OPEN Real; masterKey: ATOM ~ $Nectarine; whatKey: ATOM ~ $NectarineWhat; whereKey: ATOM ~ $NectarineWhere; copiesKey: ATOM ~ $NectarineCopies; scaleKey: ATOM ~ $NectarineScale; monoLayerKey: ATOM ~ $NectarineMonoLayer; CSTile: SafeStorage.Type; ROPE: TYPE ~ Rope.ROPE; lastPrint: RECORD [ip: ROPE, key: ATOM, q: INT, l, r: BOOL, w: Imager.Rectangle]; <> maxHoldedArea: REF Imager.Rectangle _ NIL; NectarineCommand: PROC [comm: CDSequencer.Command] ~ BEGIN <> abort: REF BOOL _ NEW [BOOL _ FALSE]; DoIt: PROC [comm: CDSequencer.Command] ~ BEGIN <> what: ROPE ~ CDPanel.TakeDownText [comm.design, whatKey]; where: ROPE ~ CDPanel.TakeDownText [comm.design, whereKey]; howMany: INT _ 0; -- number of copies scale: REAL _ 0.0; -- lambda in millimetres monoLayer: BOOL _ FALSE; -- only the layer of interset will be printed layerOfInterest: CD.Layer _ CD.undefLayer; cropKey, printKey: ATOM; masterName: ROPE _ NIL; usedField: Imager.Rectangle; rollPaperDeviceHint: REF Imager.Rectangle _ NIL; isPagePrinter: BOOL; <> IF where.Equal ["Explain", FALSE] THEN {ExplainGoals []; RETURN}; <> <> SELECT TRUE FROM what.Equal ["Design", FALSE] => cropKey _ $NectarineAll; what.Equal ["Wysiwyg", FALSE] => cropKey _ $NectarineWysiwyg; what.Equal ["Selection", FALSE] => cropKey _ $NectarineSel; ENDCASE => BEGIN TerminalIO.PutRope ["Unknown cropping option.\n"]; ERROR ABORTED END; <> SELECT TRUE FROM where.Equal ["ColorVersatec", FALSE] => BEGIN <> printKey _ $NColorVersatec END; where.Equal ["Color400", FALSE] => printKey _ $NColor400; where.Equal ["Raven300", FALSE] => printKey _ $NRaven300; where.Equal ["Raven384", FALSE] => printKey _ $NRaven384; where.Equal ["C2700", FALSE] => printKey _ $C2700; where.Equal ["Bw400", FALSE] => printKey _ $NBw400; where.Equal ["Versatec", FALSE] => printKey _ $NVersatec; where.Equal ["Erie", FALSE] => printKey _ $NPlateMaker; where.Equal ["Tioga doc", FALSE] => printKey _ $NPasteInTioga; where.Equal ["IP only", FALSE] => printKey _ $NmasterOnly; where.Equal ["hold", FALSE] => printKey _ $Nhold; where.Equal ["PeachExpand", FALSE] => BEGIN TerminalIO.PutRope ["I will create an Interpress master, which I will use to produce a PD file. I will then send it to the expansion server to create a bitmap, and from there I will send it to the color Versatec. You will have to delete the temporary files manually.\n"]; printKey _ $NPeachExpand END; ENDCASE => {TerminalIO.PutRope ["Unknown printer.\n"]; ERROR ABORTED}; isPagePrinter _ (printKey = $NRaven300) OR (printKey = $NRaven384) OR (printKey = $NmasterOnly) OR (printKey = $NPlateMaker) OR (printKey = $NColor400) OR (printKey = $NBw400) OR (printKey = $C2700); <> BEGIN r: ROPE ~ CDPanel.TakeDownText [comm.design, copiesKey]; <> IF r.IsEmpty THEN howMany _ 1 ELSE howMany _ IO.GetInt [IO.RIS [r] ! RuntimeError.UNCAUGHT => {howMany _ 1; CONTINUE}] END; <> BEGIN r: ROPE ~ CDPanel.TakeDownText [comm.design, scaleKey]; <> IF r.IsEmpty THEN scale _ 0.0 ELSE scale _ IO.GetReal [IO.RIS [r] ! RuntimeError.UNCAUGHT => {scale _ 0.0; CONTINUE}]; IF (scale # 0.0) THEN TerminalIO.PutF ["Fixed scale  = %g mm.\n", IO.real [scale]] ELSE TerminalIO.PutRope ["Will scale to fit page.\n"] END; <> BEGIN r: ROPE ~ CDPanel.TakeDownText [comm.design, monoLayerKey]; <> IF r.IsEmpty THEN monoLayer _ FALSE ELSE monoLayer _ IO.GetBool [IO.RIS [r] ! RuntimeError.UNCAUGHT => {monoLayer _ FALSE; CONTINUE}]; IF monoLayer THEN BEGIN layerOfInterest _ CDLayers.CurrentLayer [comm.design]; TerminalIO.PutF ["Will print only the current layer (%g).\n", IO.atom [CD.LayerKey [layerOfInterest]]] END END; <> IF (masterName.IsEmpty []) THEN BEGIN cW: CD.Rect; -- ChipNDale window SELECT cropKey FROM $NectarineAll => cW _ CDOps.BoundingBox [comm.design]; $NectarineSel => BEGIN size: CD.Position; cW _ CDOps.BoundingBox [comm.design, TRUE]; size _ CDBasics.SizeOfRect [cW]; IF (size.x <= 0) OR (size.y <= 0) THEN BEGIN TerminalIO.PutRope ["You do not have a selection in this design !\n"]; ERROR ABORTED END END; $NectarineWysiwyg => BEGIN viewers: CDViewer.ViewerList = CDViewer.ViewersOf [comm.design]; goodViewer: ViewerClasses.Viewer; good: INT _ 0; IF (viewers = NIL) THEN BEGIN TerminalIO.PutRope ["You do not see anything of this design !\n"]; ERROR ABORTED END; FOR v: CDViewer.ViewerList _ viewers, v.rest WHILE v # NIL DO IF NOT v.first.iconic THEN {goodViewer _ v.first; good _ good.SUCC} ENDLOOP; SELECT good FROM 0 => {TerminalIO.PutRope ["You do not see anything !\n"]; ERROR ABORTED}; > 1 => TerminalIO.PutRope ["WARNING: you see more than one viewer. I pick one at random\n"]; ENDCASE => NULL; cW _ CDViewer.VisibleRect [goodViewer] END; ENDCASE => ERROR; <> cW _ [x1: cW.x1 - IF (scale # 0.0) AND isPagePrinter THEN BEGIN <> currentWindow: CD.Rect; medium: Imager.Rectangle ~ [x: 0.0, y: 0.0, w: 215.9, h: 279.4]; -- in mm field: Imager.Rectangle ~ NectarinePd.field; -- in mm windowW: CD.Number ~ Round [field.w / scale] * windowH: CD.Number ~ Round [field.h / scale] * totalWidth: REAL ~ Float [cW.x2 - cW.x1] / totalHeight: REAL ~ Float [cW.y2 - cW.y1] / columns: INTEGER _ Fix [totalWidth / field.w]; -- Fix truncates rows: INTEGER _ Fix [totalHeight / field.h]; -- Fix truncates IF (cW.x1 + windowW * columns < cW.x2) THEN columns _ columns.SUCC; IF (cW.y1 + windowH * rows < cW.y2) THEN rows _ rows.SUCC; TerminalIO.PutF ["Nectarine will break the design in %g A pages.\n", IO.int [columns*rows]]; currentWindow _ [x1 ~ cW.x1, y1 ~ cW.y2 - windowH, x2 ~ cW.x1 + windowW, y2 ~ cW.y2]; FOR i: INTEGER IN [0 .. rows) DO FOR j: INTEGER IN [0 .. columns) DO masterName _ Nectarine.DoInterpress [design: comm.design, chipNDaleWindow: currentWindow, clip: TRUE, onlySel: (cropKey = $NectarineSel), layer: layerOfInterest, singleLayer: monoLayer, register: (printKey = $NPlateMaker), lambda: scale, firstPage: ((i = 0) AND (j = 0)) OR ((printKey = $Nhold) AND (maxHoldedArea = NIL)), lastPage: ((i = rows - 1) AND (j = columns - 1) AND (printKey # $Nhold)), abortFlag: abort].masterName; currentWindow.x1 _ currentWindow.x2; currentWindow.x2 _ currentWindow.x2 + windowW ENDLOOP; currentWindow.x1 _ cW.x1; currentWindow.x2 _ cW.x1 + windowW; currentWindow.y2 _ currentWindow.y1; currentWindow.y1 _ currentWindow.y1 - windowH ENDLOOP; usedField _ [x: 0, y: 0, w: 0, h: -1] -- w > h END ELSE [masterName, usedField] _ Nectarine.DoInterpress [design: comm.design, chipNDaleWindow: cW, clip: (cropKey = $NectarineWysiwyg) OR (cropKey = $NectarineSel), onlySel: (cropKey = $NectarineSel), layer: layerOfInterest, singleLayer: monoLayer, lambda: scale, firstPage: (maxHoldedArea = NIL), lastPage: (printKey # $Nhold), register: (printKey = $NPlateMaker), abortFlag: abort]; IF (printKey = $Nhold) THEN BEGIN IF (maxHoldedArea = NIL) THEN maxHoldedArea _ NEW [Imager.Rectangle _ usedField] ELSE BEGIN <> x1: REAL ~ MAX [maxHoldedArea.x + maxHoldedArea.w, usedField.x + usedField.w]; y1: REAL ~ MAX [maxHoldedArea.y + maxHoldedArea.h, usedField.y + usedField.h]; maxHoldedArea.x _ MIN [maxHoldedArea.x, usedField.x]; maxHoldedArea.y _ MIN [maxHoldedArea.y, usedField.y]; maxHoldedArea.w _ x1 - maxHoldedArea.x; maxHoldedArea.h _ y1 - maxHoldedArea.y END END ELSE BEGIN IF (maxHoldedArea # NIL) THEN {usedField _ maxHoldedArea^; maxHoldedArea _ NIL} END; CDProperties.PutDesignProp [comm.design, masterKey, masterName] END; -- create Interpress master <> lastPrint _ [ip: masterName, key: printKey, q: howMany, l: (scale # 0.0), r: (printKey = $NPlateMaker), w: usedField]; -- for Redo SELECT printKey FROM $NmasterOnly => NULL; $NPasteInTioga => Paste [masterName, usedField]; $Nhold => TerminalIO.PutRope ["Nectarine is holding the result in a buffer until `where' no longer is `hold'.\n"]; ENDCASE => BEGIN rollPaperDeviceHint _ NEW [Imager.Rectangle _ usedField]; [] _ Nectarine.Print [masterName: masterName, printerKey: printKey, copies: howMany, doNotScale: (scale # 0.0), mergeRegister: FALSE, sizeHint: rollPaperDeviceHint, abortFlag: abort ! Nectarine.invalidPrinter => ERROR] END; TerminalIO.PutRope ["Design unlocked by Nectarine.\n"] END; -- DoIt CDSequencer.UseAbortFlag [comm.design, abort]; [] _ CDCommandOps.DoWithResource [DoIt, comm, $Nectarine] <> END; -- NectarineCommand Paste: PROC [name: ROPE, bb: Imager.Rectangle, newViewer: BOOL _ FALSE] ~ BEGIN <> <> master: ROPE ~ RopeFile.Create [name]; -- the Interpress master desguised as a rope document: TiogaAccess.Writer _ TiogaAccess.Create []; -- a working area Tioga doc vanillaChar: TiogaAccess.TiogaChar ~ [0, 0C, ALL [FALSE], NIL, TRUE, FALSE, 0, NIL]; dummy, ip, caption, rule: TiogaAccess.TiogaChar _ vanillaChar; space: REAL ~ 8.0 * Imager.metersPerPoint * 1000.0; -- in mm topCalcRope: ROPE; -- for postfix property calculating top leading and ident cslPublicationStyle: BOOL ~ UserProfile.Boolean ["Nectarine.CSLPublicationStyle", TRUE]; PutRope: PROC [r: ROPE, attr: TiogaAccess.TiogaChar] ~ BEGIN <> PutChar: Rope.ActionType ~ {attr.char _ c; document.Put [attr]}; [] _ Rope.Map [base: r, action: PutChar] END; -- PutRope PutProp: PROC [char: TiogaAccess.TiogaChar, prop: ATOM, val: ROPE] RETURNS [TiogaAccess.TiogaChar] ~ BEGIN <> char.propList _ Atom.PutPropOnList [propList: char.propList, prop: prop, val: TiogaAccess.GetInternalProp [prop, val]]; RETURN [char] END; -- PutProp Stuff: PROC [root: TextNode.Ref, tSel:TEditDocument.Selection] ~ BEGIN <> IF newViewer THEN BEGIN repository: ViewerClasses.Viewer _ ViewerOps.CreateViewer [$Text]; document.WriteViewer [repository]; ViewerOps.BlinkIcon [repository, 0] END ELSE {TEditInputOps.Break []; TiogaAccess.WriteSelection [document]} END; -- Stuff <> dummy.endOfNode _ TRUE; PutRope ["\n", dummy]; IF cslPublicationStyle THEN BEGIN <> dummy.endOfNode _ FALSE; dummy.looks['z] _ TRUE; PutRope ["----------", dummy]; dummy.looks['z] _ FALSE; rule.endOfNode _ TRUE; rule.format _ $unleaded; rule _ PutProp [rule, $ArtworkClass, "Rule"]; rule _ PutProp [rule, $Artwork, "Rule"]; document.Put [rule] END; <> dummy.endOfNode _ FALSE; dummy.looks['n] _ TRUE; dummy.looks['x] _ TRUE; IF cslPublicationStyle THEN PutRope ["[ Nectarine figure; type 'Artwork on' to a CommandTool ]", dummy] ELSE PutRope ["[ Nectarine, fuzzless and sweeter than peaches ]", dummy]; dummy.looks['n] _ FALSE; dummy.looks['x] _ FALSE; ip.char _ '\n; ip.endOfNode _ TRUE; ip.format _ $artworkFigure; -- it is an artwork node <> topCalcRope _ IO.PutFR ["%g the lineLength .mul %g .add", IO.real [bb.h/bb.w], IO.real [space]]; IF cslPublicationStyle THEN ip _ PutProp [ip, $Postfix, IO.PutFR ["%g topLeading %g topIndent %g mm bottomLeading 0.0 0.2 0.90 backgroundColor the topLeading 6 pt .sub backgroundAscent 1 pt backgroundDescent 2 pt outlineBoxThickness 1 pt outlineBoxBearoff", IO.rope [topCalcRope], IO.rope [topCalcRope], IO.real [space/2.0]]] -- margin in the document ELSE ip _ PutProp [ip, $Postfix, IO.PutFR ["%g topLeading %g topIndent %g mm bottomLeading", IO.rope [topCalcRope], IO.rope [topCalcRope], IO.real [space/2.0]]]; ip _ PutProp [ip, $Bounds, IO.PutFR ["%g mm xmin %g mm ymin %g mm xmax %g mm ymax", IO.real [bb.x], IO.real [bb.y], IO.real [bb.x+bb.w], IO.real [bb.y+bb.h]]]; -- set the bounding box ip _ PutProp [ip, $Artwork, "Interpress"]; -- the artwork type is "Interpress" ip _ PutProp [ip, $Interpress, master]; -- the Interpress master desguised as a rope ip _ PutProp [ip, $Fit, "TRUE"]; -- fit the figure to the margins of the sibling node document.Put [ip]; IF cslPublicationStyle THEN BEGIN <> dummy.looks['t] _ TRUE; dummy.char _ '; document.Put [dummy]; PutRope ["Figure 1. [This node is in the format $artworkCaption; if you are using the CedarACMNoReduction style, change the format of this node to $caption, and change the two rules' format to $horizontalrule.]", caption]; dummy.char _ '; document.Put [dummy]; caption.format _ $artworkCaption; caption.char _ 0C; caption.endOfNode _ TRUE; document.Put [caption]; dummy.looks['t] _ FALSE; <> dummy.endOfNode _ FALSE; dummy.looks['z] _ TRUE; PutRope ["----------", dummy]; document.Put [rule] END; <> TEditInputOps.CallWithLocks [Stuff] END; -- Paste Registations: PROC [] ~ BEGIN defaultCrops: LIST OF ROPE ~ LIST ["Design", "Selection", "Wysiwyg"]; <> <> defaultGoals: LIST OF ROPE ~ LIST ["Explain", "Tioga doc", "Raven300", "Raven384", "C2700", "Versatec", "ColorVersatec", "Erie", "IP only", "Hold"]; defaultCopies: ROPE ~ " 1"; defaultScale: ROPE ~ " 0.0"; bool: LIST OF ROPE ~ LIST ["No", "Yes"]; x: NAT _ 0; NewButton: PROC [name: ROPE, key: ATOM, val: REF _ NIL, trigger, newLine, editable: BOOL _ FALSE, x: NAT] RETURNS [xx: NAT _ 0] ~ BEGIN <> n: NAT ~ VFonts.StringWidth ["n"]; m: NAT ~ VFonts.StringWidth ["m"]; -- n & m space i, ii: CDPanel.Info; w, ww: NAT _ 0; ParWidth: PROC [par: REF] RETURNS [l: NAT] ~ BEGIN <> scrollBar: NAT ~ 13; -- may be it is only 12 pixels. l _ NAT.FIRST; WITH par SELECT FROM rope: ROPE => l _ VFonts.StringWidth [rope] + scrollBar; list: LIST OF ROPE => FOR r: LIST OF ROPE _ list, r.rest WHILE r # NIL DO l _ MAX [l, VFonts.StringWidth [r.first]] ENDLOOP; ENDCASE => ERROR END; -- ParWidth w _ VFonts.StringWidth [name] + n; xx _ x + w; i _ [text ~ name, border ~ trigger, width ~ w, space ~ 0, xpos ~ x]; x _ xx; IF trigger THEN CDPanel.Button [button: i, command: key] ELSE BEGIN CDValue.RegisterKey [key: key, registrationKey: masterKey]; CDValue.Store [key: key, value: val]; ww _ ParWidth [val] + n; xx _ x + ww; ii _ [cdValueKey ~ key, border ~ trigger, width ~ ww, space ~ 0, xpos ~ x]; CDPanel.Text [button: i, text: ii, editable: editable] END; IF newLine THEN {CDPanel.Line []; xx _ 0} END; -- NewButton [] _ CDProperties.RegisterProperty [masterKey, masterKey]; x _ NewButton [name ~ "Nectarine", trigger ~ TRUE, key ~ $NectarineCmd, x ~ x]; x _ NewButton [name ~ "What:", key ~ whatKey, val ~ defaultCrops, x ~ x]; x _ NewButton [name ~ "Where:", key ~ whereKey, val ~ defaultGoals, x ~ x]; x _ NewButton [name ~ "Copies:", key ~ copiesKey, val ~ defaultCopies, editable ~ TRUE, x ~ x, newLine ~ TRUE]; x _ NewButton [name ~ " in mm:", key ~ scaleKey, val ~ defaultScale, editable ~ TRUE, x ~ x]; x _ NewButton [name ~ "Current layer only:", key ~ monoLayerKey, val ~ bool, x ~ x, newLine ~ TRUE]; CDSequencer.ImplementCommand [key: $NectarineCmd, proc: NectarineCommand, queue: doQueue]; Commander.Register [key: "NCount", proc: Count, doc: "counts corner stitching tiles."]; Commander.Register [key: "NRedo", proc: Redo, doc: "Syntax: NRedo . Redoes the last Nectarine Print command on the same Interpress master but with the newly specified goal. The goal must be one of those specified in the field of the Nectarine line in the ChipNDale control panel. Default: the same as the last time around."]; Commander.Register [key: "PrintDesignOnVersatec", proc: PrintDesignOnVersatecCmd, doc: " []\nwill read fileName, convert it into an Interpress master, convert it into a PD file, and print it on the color Versatec. Default number of columns: 1."]; Commander.Register [key: "NSetMaxField", proc: SetMaxField, doc: " gets the status of the named XNS printer and sets Nectarine's field size to its medium size.\nHowever, IF printer.Equal [TimsToy, FALSE] THEN use dimensions specified in [Newton-XNS]C2700>C2700MarkerImpl.mesa at implementation time."] END; -- Registrations Count: Commander.CommandProc ~ BEGIN <<[cmd: Commander.Handle] RETURNS [result: REF ANY _ NIL, msg: ROPE _ NIL]>> PerObject: SweepCollectableStorage.InfoProc ~ BEGIN <<[type: SafeStorage.Type, size: INT, object: LONG CARDINAL] RETURNS [continue: BOOLEAN] >> IF type = CODE [CStitching.Tesselation] THEN tessCount _ tessCount + 1 ELSE IF type = CSTile THEN tileCount _ tileCount + 1; RETURN [TRUE] END; -- PerObject tessCount: INT _ 0; tileCount: INT _ 0; TRUSTED { SweepCollectableStorage.EnumerateCollectableStorage [PerObject] }; cmd.out.PutF ["tesselations = %g\n", IO.int [tessCount]]; cmd.out.PutF ["tiles = %g\n", IO.int [tileCount]] END; -- Count Redo: Commander.CommandProc ~ BEGIN <<[cmd: Commander.Handle] RETURNS [result: REF ANY _ NIL, msg: ROPE _ NIL]>> <. Redoes the last Print command on the same Interpress master but on the newly specified goal. The goal must be one of those specified in the field of the Nectarine line in the ChipNDale control panel. Default: the same as the last time around.>> where: ROPE ~ CommandTool.NextArgument [cmd]; savedKey: ATOM ~ lastPrint.key; IF lastPrint.ip.IsEmpty [] THEN BEGIN result _ $Failure; msg _ "No Interpress master cached !"; RETURN END; IF NOT where.IsEmpty [] THEN lastPrint.key _ SELECT TRUE FROM where.Equal ["ColorVersatec", FALSE] => $NColorVersatec, where.Equal ["Color400", FALSE] => $NColor400, where.Equal ["C2700", FALSE] => $C2700, where.Equal ["ThermalTransfer", FALSE] => $C2700, where.Equal ["Raven300", FALSE] => $NRaven300, where.Equal ["Raven384", FALSE] => $NRaven384, where.Equal ["Hornet", FALSE] => $NRaven384, where.Equal ["Bw400", FALSE] => $NBw400, where.Equal ["Versatec", FALSE] => $NVersatec, where.Equal ["Erie", FALSE] => $NPlateMaker, where.Equal ["PlateMaker", FALSE] => $NPlateMaker, where.Equal ["Tioga", FALSE] => $NPasteInTioga, where.Equal ["Tioga doc", FALSE] => $NPasteInTioga, where.Equal ["Paste", FALSE] => $NPasteInTioga, where.Equal ["Stuff", FALSE] => $NPasteInTioga, where.Equal ["IP only", FALSE] => $NmasterOnly, where.Equal ["IP", FALSE] => $NmasterOnly, where.Equal ["PeachExpand", FALSE] => $NPeachExpand, where.Equal ["hold", FALSE] => $Nhold, ENDCASE => $cacca; SELECT lastPrint.key FROM $NmasterOnly => msg _ lastPrint.ip; $NPasteInTioga => BEGIN <> Paste [lastPrint.ip, lastPrint.w, TRUE]; msg _ "Image deposed in temporary blinking iconic Tioga viewer." END; $cacca => BEGIN lastPrint.key _ savedKey; result _ $Failure; msg _ cmd.procData.doc END; ENDCASE => BEGIN rollPaperDeviceHint: REF Imager.Rectangle _ NEW [Imager.Rectangle _ lastPrint.w]; [] _ Nectarine.Print [lastPrint.ip, lastPrint.key, lastPrint.q, lastPrint.l, NOT lastPrint.r, rollPaperDeviceHint, NIL ! Nectarine.invalidPrinter => {result _ $Failure; msg _ cmd.procData.doc}] END END; -- Redo PrintDesignOnVersatec: PROC [name: ROPE, columns: INT] ~ BEGIN <> <> design: CD.Design _ CDIO.ReadDesign [name]; n: ROPE; rollPaperDeviceHint: REF Imager.Rectangle _ NEW [Imager.Rectangle]; IF (columns > 9) THEN ERROR; SELECT columns FROM 0 => RETURN; 1 => BEGIN [n, rollPaperDeviceHint^] _ Nectarine.DoInterpress [ design: design, chipNDaleWindow: CDOps.BoundingBox [design], clip: FALSE, onlySel: FALSE, abortFlag: NIL]; design _ NIL; -- Collect that garbage to make room in physical memory ! [] _ Nectarine.Print [masterName: n, printerKey: $NColorVersatec, mergeRegister: FALSE, sizeHint: rollPaperDeviceHint, abortFlag: NIL] END; ENDCASE => BEGIN bb: CD.Rect ~ CDOps.BoundingBox [design]; -- [x1, y1, x2, y2: INT] width: INT ~ (bb.x2 - bb.x1) / columns; window: CD.Rect _ bb; window.x2 _ window.x1 + width; FOR c: INT IN [1 .. columns] DO [n, rollPaperDeviceHint^] _ Nectarine.DoInterpress [ design: design, chipNDaleWindow: window, clip: TRUE, onlySel: FALSE, abortFlag: NIL]; IF (c = columns) THEN design _ NIL; [] _ Nectarine.Print [masterName: n, printerKey: $NColorVersatec, sizeHint: rollPaperDeviceHint, mergeRegister: FALSE, abortFlag: NIL]; <> window.x1 _ window.x2; window.x2 _ window.x2 + width ENDLOOP END END; -- PrintDesignOnVersatec PrintDesignOnVersatecCmd: Commander.CommandProc ~ BEGIN <<[cmd: Commander.Handle] RETURNS [result: REF ANY _ NIL, msg: ROPE _ NIL]>> WDir: PROC RETURNS [wDir: ROPE] ~ BEGIN <> wDir _ FSExtras.GetWDir []; IF wDir.Equal ["[]<>"] THEN wDir _ cmd.command.Substr [0, FS.ExpandName[cmd.command].cp.base.start-1] END; -- WDir fileName: ROPE _ CommandTool.NextArgument [cmd]; columns: ROPE _ CommandTool.NextArgument [cmd]; cp: FS.ComponentPositions; [fileName, cp, ] _ FS.ExpandName [fileName, WDir []]; IF (cp.ext.length = 0) THEN fileName _ fileName.Concat [".Dale"]; fileName _ FS.FileInfo [name: fileName ! FS.Error => {result _ $Failure; msg _ error.explanation; CONTINUE}].fullFName; IF (result # $Failure) THEN TRUSTED BEGIN col: CARDINAL _ 1; IF NOT columns.IsEmpty THEN col _ Convert.IntFromRope [columns ! Convert.Error => {col _ 1; CONTINUE}]; msg _ IO.PutFR ["%g will be read, converted into an Interpress master, converted into a PD file, and printed in %g columns on %g.", IO.rope [fileName], IO.card [col], IO.rope [UserProfile.Token ["Nectarine.ColorVersatec", "Sleepy"]]]; Process.Detach [FORK PrintDesignOnVersatec [fileName, col]] END END; -- PrintDesignOnVersatecCmd SetMaxField: Commander.CommandProc ~ BEGIN <<[cmd: Commander.Handle] RETURNS [result: REF ANY _ NIL, msg: ROPE _ NIL]>> printer: ROPE ~ CommandTool.NextArgument [cmd]; status: XNSPrint.PrinterStatus; service: ROPE; SpoolerStatusRope: PROC [spooler: XNSPrint.SpoolerStatus] RETURNS [ROPE] ~ {RETURN [SELECT spooler FROM available => "available", busy => "busy", disabled => "disabled", full => "full", ENDCASE => "unknown"]}; FormatterStatusRope: PROC [formatter: XNSPrint.FormatterStatus] RETURNS [ROPE] ~ {RETURN [SELECT formatter FROM available => "available", busy => "busy", disabled => "disabled", ENDCASE => "unknown"]}; PrinterStatusRope: PROC [printer: XNSPrint.MarkingEngineStatus] RETURNS [ROPE] ~ {RETURN [SELECT printer FROM available => "available", busy => "busy", disabled => "disabled", needsAttention => "needs attention", needsKeyOperator => "needs key operator", ENDCASE => "unknown"]}; IF printer.IsEmpty THEN {result _ $Failure; msg _ "Specify a XNS printer name"; RETURN}; [service, status] _ XNSPrint.GetPrinterStatus [printer ! XNSPrint.Error => {result _ $Failure; msg _ explanation; CONTINUE}]; IF (result # $Failure) THEN BEGIN msg _ service.Cat ["\n\tspooler: ", SpoolerStatusRope [status.spooler], "\n\tformatter: ", FormatterStatusRope [status.formatter]]; msg _ msg.Cat ["\n\tprinter: ", PrinterStatusRope [status.printer], "\n\tfirst medium: ", status.media.first]; IF (printer.Equal ["TimsToy", FALSE] OR printer.Equal ["TimsToy:PARC:xerox", FALSE]) THEN BEGIN <C2700>C2700MarkerImpl.MakePrinterSampleMap>> dpi: REAL ~ 300.0; sSize: NAT ~ 2672; fSize: NAT ~ 304*8; -- bits fSizeInMM: REAL ~ fSize/dpi -- in inches -- * 25.4; sSizeInMM: REAL ~ sSize/dpi -- in inches -- * 25.4; bottomOffsetInMM: REAL ~ 0.036 * 1000.0; fudge: REAL ~ 6.5; NectarinePd.field _ [x: fudge, y: bottomOffsetInMM, w: fSizeInMM, h: sSizeInMM-4.0]; IF NOT status.media.first.Equal ["usLetter"] THEN msg _ msg.Cat [", but Nectarine only knows about usLetter"] END ELSE BEGIN size: XNSPrint.PaperDimensions _ XNSPrint.GetPaperDimensions [status.media.first]; NectarinePd.field _ [x: 0.0, y: 0.0, w: Float [size.width], h: Float [size.length]] END; msg _ IO.PutFR ["%g\n\tfield size in mm: [x, y, w, h] = [%g, %g, %g, %g]", IO.rope [msg], IO.real [NectarinePd.field.x], IO.real [NectarinePd.field.y], IO.real [NectarinePd.field.w], IO.real [NectarinePd.field.h]] END END; -- SetMaxField ExplainGoals: PROC [] ~ BEGIN <> Plop: PROC [plup, plip, plap: ROPE] ~ BEGIN <> TerminalIO.PutRope [plup.Cat [": print on ", UserProfile.Token [Rope.Cat ["Nectarine.", plup], plip]]]; TerminalIO.PutRope [Rope.Cat [", a ", plap, " printer.\n"]] END; -- Plop TerminalIO.PutRope ["Tioga doc: copy in the Tioga document at the caret.\n"]; Plop ["Raven300", "Quoth", "black & white XNS Interpress"]; Plop ["Raven384", "your disk", "black & white Press"]; <> Plop ["Versatec", "Sleepy", "black & white Versatec"]; Plop ["ColorVersatec", "Sleepy", "colour Versatec"]; <> Plop ["C2700", "MtFuji", "thermal colour XNS Interpress"]; Plop ["Erie", UserProfile.Token ["Nectarine.PlatemakerSeparations"], "Platemaker"]; TerminalIO.PutRope ["Explain: jot down this explanation.\n"]; TerminalIO.PutRope ["hold: hold the result in form of a page. The next time the 'where' parameter is different from 'hold', prepend to it the previous pages and create a multi-page Interpress master.\n\n"] END; -- ExplainGoals MichaelsMessage: PROC ~ BEGIN <> IF NOT UserProfile.Boolean [key: "Nectarine.SubstituteColors", default: TRUE] THEN BEGIN TerminalIO.PutRope ["Warning, you are using your personal named ChipNDale colors. Nobody else will be able to see your document unless you provide them with your colors. Refer to the documentation for an option to automatically substitute your personal colors by univerally known colors (User profile entry Nectarine.SubstituteColors). Named colors are explained in ColorRegistryDoc.tioga.\n"]; ViewerOps.BlinkDisplay END END; -- MichaelsMessage ImportantMessage: PROC [msg: ROPE] ~ BEGIN <> TerminalIO.PutRope [msg]; TerminalIO.PutRope ["\n"]; MessageWindow.Clear []; MessageWindow.Append [msg]; MessageWindow.Blink [] END; -- ImportantMessage CSTile _ SafeStorage.GetCanonicalReferentType [CStitching.NewTesselation[].FindTile[[0,0]]]; Registations []; TerminalIO.PutRope ["Nectarine package loaded.\n"]; <> <> END. <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <>> <> <> <> <> <> <> <> <<>>