DIRECTORY Atom USING [PutPropOnList], BasicTime USING [GMT], ImagerInterpress USING [Ref], IO USING [STREAM], Rope USING [ROPE], ViewerClasses USING [Viewer, ViewerClass], ViewerOps USING [AddProp], XNSPrint USING [Properties]; XTSetter: CEDAR DEFINITIONS IMPORTS Atom, ViewerOps ~ BEGIN ROPE: TYPE ~ Rope.ROPE; Tool: TYPE ~ REF ToolRep; ToolRep: TYPE; Options: TYPE ~ REF OptionsRep; OptionsRep: TYPE ~ RECORD [ keepIP: BOOL ฌ FALSE, -- TRUE when interpress files generated by XTSetter should be kept instead of thrown away compress: BOOL ฌ FALSE, -- TRUE when compresed files should be sent to printer copyCount: CARD16 ฌ 1, -- number of copies to be printed device: ROPE ฌ NIL, -- device propertoy to be assigned to root node (if any) pageFirst: CARD16 ฌ 1, -- first page number to be printed pageLast: CARD16 ฌ LAST [CARD16], -- last page number to be printed mediumHint: ROPE ฌ NIL, -- Describes the paper size (or more generally print support) to be used. Defaults to UsLetter format stapled: BOOL ฌ FALSE, -- TRUE when printer output should be stapled (if supported) twoSided: BOOL ฌ FALSE, -- TRUE when printer should print on both sides of the paper (if supported) telephone: ROPE ฌ NIL, -- Phone number to be used to telefax documents - Not yet supported tiogaStyle: ROPE ฌ NIL, -- Tioga style to be applied if formatting a Tioga document. NIL or "" means use style specified in root node of document tiogaScale: REAL ฌ 1.0 -- Scale factor to be applied if formatting a Tioga document. ]; Error: ERROR[why: ROPE]; -- Raised if unable to access printer GetTool: PROC [printer: ROPE ฌ NIL, new: BOOL ฌ FALSE] RETURNS [tool: Tool]; DestroyTool: PROC [tool: Tool]; DefaultOptions: PROC [] RETURNS [options: Options]; GetOptions: PROC [tool: Tool, reset: BOOL ฌ TRUE] RETURNS [options: Options]; Position: TYPE = RECORD [start, length: CARDINAL]; ComponentPositions: TYPE = RECORD [server, dir, subDirs, base, ext, ver: Position]; ExpandName: PROC[name: ROPE, wDir: ROPE ฌ NIL] RETURNS [fullFName: ROPE ฌ NIL, cp: ComponentPositions, dirOmitted: BOOL]; SetOptions: PROC [tool: Tool, options: Options]; GetProperties: PROC [tool: Tool] RETURNS [printerProperties: XNSPrint.Properties]; CreateOptionsViewer: PROC [tool: Tool]; DestroyOptionsViewer: PROC [tool: Tool]; CreateServerStatusViewer: PROC [tool: Tool]; DestroyServerStatusViewer: PROC [tool: Tool]; PrintFile: PROC [tool: Tool, file: ROPE, options: Options ฌ NIL]; PrintViewer: PROC [tool: Tool, v: ViewerClasses.Viewer, options: Options ฌ NIL]; Screen: TYPE ~ {bw, left, right, color}; -- the four flavors that may be printed PrintScreen: PROC [tool: Tool, screen: Screen, options: Options ฌ NIL]; Info: TYPE ~ REF InfoRep; InfoRep: TYPE ~ RECORD [ date: BasicTime.GMT, -- creation date that should be used on the printed document. title: ROPE, -- document name that should be used on the printed document. keptFile: ROPE -- Name of the IP file if it is kept. ]; ProductionProgressProc: TYPE ~ PROC [percent: REAL] RETURNS [stop: BOOL]; IPProducer: TYPE ~ PROC [source: REF, options: Options, info: Info, master: ImagerInterpress.Ref, err: IO.STREAM, progress: ProductionProgressProc] RETURNS [pages: INT ฌ 0]; SetClassGenerator: PROC [class: ViewerClasses.ViewerClass, producer: IPProducer] ~ INLINE { class.props ฌ Atom.PutPropOnList[class.props, $IPProducer, NEW [IPProducer ฌ producer]]; }; SetGenerator: PROC [v: ViewerClasses.Viewer, producer: IPProducer] ~ INLINE { ViewerOps.AddProp[v, $IPProducer, NEW [IPProducer ฌ producer]]; }; GetGenerator: PROC [v: ViewerClasses.Viewer] RETURNS [producer: IPProducer]; PaperSize: PROC [paper: ROPE] RETURNS [length: REAL, width: REAL]; END. ภ XTSetter.mesa Copyright ำ 1987, 1992 by Xerox Corporation. All rights reserved. Jean-Marc Frailong, February 8, 1989 9:24:26 pm PST Viewer tool for XNS formatting and printing Weiser, January 21, 1991 11:32 pm PST Tool structure A Tool is the user handle onto an XNS printer through XTSetter. Internal details of the tool structure are not accessible to the user. Options describe the current settings of options in an XTSetter tool. Returns a tool for this printer (use default printer from profile if NIL). If new is FALSE, will try to get an already existing tool. If new is TRUE or no tool for this printer already exists, will try to create a new tool with default options. Will raise Error if the printer does not respond. Destroy this tool. Any print request in progress will not be affected, but there will be no more user feedback since the viewer will be destroyed. This tool will never be returned by GetTool, but may still be used by programs still having a handle onto it. Destroying a tool actually destroys the viewer, the tool really vanishes only when there are no more pointers onto it. Returns a set of default options taken from the user profile. Returns a copy of the current options for a tool. The returned options may be modified by the user without any effect on the tool. Use SetOptions to modify tool options. If reset is TRUE, some volatile options (copyCount, pageFirst, pageLast) are reset to default values (1, first, last). Forces the current options for a tool. Forces the properties of the printer associated to the tool. Printer properties are invariant during the lifetime of a tool. Makes the options viewer appear in the tool Makes the options viewer disappear in the tool Makes the printer status viewer appear in the tool Makes the printer status viewer disappear in the tool Printing requests All print requests do whatever is possible to do something. No error is ever passed back onto the user, except if an invalid tool is passed along. Instead, errors are printed on the tool feedback typescript or in the message window if the tool has been destroyed. All print requests use the current tool settings if their options argument is NIL (default value), but users may override current options by passing a specific set of options that will be in effect for this request only and will not change the current tool options. If a print request results in the creation of an IP master and the keepIP option is TRUE, the IP master will be stored at some reasonable place. Control is returned to the user before the print object has been formatted and sent to the printer. This implies that users should not destroy the print object after initiating a print requests. If the need arises, it would be possible to provide a call back mechanism informing the user of the completion of a print request. Print a file using the tool. The file may be an IP master (file name ending in .IP or .Interpress), or a tioga document. In the latter case, it will be formatted first into an IP master and stored in the same directory as the source if possible, else in a temporary directory. The options passed override for this request the current tool settings. If options is NIL, the current tool settings will be used instead. Print a viewer using the tool. First, the viewer is transformed into its top-level ancestor. If the viewer is a tioga document, it will be formatted. If the viewer class has an IP printing property (c.f. IPGenerator), it will be used to format it. In other cases, an attempt will be made to display what can be seen of the viewer onto a single page. The options passed override for this request the current tool settings. If options is NIL, the current tool settings will be used instead. Print the requested screen or screen portion on a single page. Viewer to IP mechanism This section of the interface of of interest only to Viewer class implementors. It provides a generic mechanism for viewer implementations that require a special viewer -> IP master processing. The printing mechanism is an inherited property: it is first looked up on the specific viewer, then on the viewer class if not found. A default IPProducer is provided by XTSetter that approximates the viewer's paint mechanism (the default IPProducer will not work properly on viewer classes that do not use the Imager in a device-independant fashion to paint heir viewers). As mentionned above, this property is used only for top-level viewers. A IPProducer is expected to produce a complete IP master in the passed master and close it upon completion. The error stream may be used to indicate errors. The progress proc should be called regularly to notify of relative progress expressed in % (i.e. 0.0 at first, increasing to 100.0%). The producer should terminate immediately should the progress proc return TRUE. Source will always NARROW into a ViewerClasses.Viewer. The producer has access to the options as they may impact the formatting process (especially paper size and one/two sided printing). The info parameter contains values that will be used for the printing process itself. They may be modified by the producer if the defaults provided are not adequate. The producer must return the number of pages produced, or a non-positive number if it failed to produce valid results. Set the IPProducer for a class of viewers. This procedure is INLINE to allow clients to set generators prior to loading XTSetter. Set the IPProducer property for a specific viewer. This procedure is INLINE to allow clients to set generators prior to loading XTSetter. Returns the producer used for a specific viewer, using the inheritance mechanism. Computes the size in millimeters of the type of paper given. length will be 0 for roll paper. width will be 0 if the paper is not known. ส๋•NewlineDelimiter –(cedarcode) style™codešœ ™ Kšœ ฯeœ6™BKšœ3™3K™K™+K™%K™—šฯk ˜ Kšœžœ˜Kšœ žœžœ˜Kšœžœ˜Kšžœžœžœ˜Kšœžœžœ˜Kšœžœ˜*Kšœ žœ ˜Kšœ žœ˜—K˜Kšัblnœžœž ˜Kšžœ˜šœž˜K˜Kšžœžœžœ˜—head™Kšœžœžœ ˜šœ žœ˜Kšœ"žœa™†—Kšœ žœžœ ˜šœ žœžœ˜KšœžœžœฯcY˜oKšœ žœžœ 6˜NKšœ ฯsœ !˜8Kšœžœžœ 8˜LKšœ กœ "˜9Kšœ กœžœกœ !˜CKšœ žœžœ e˜}Kšœ žœžœ <˜SKšœ žœžœ K˜cKšœ žœžœ 2ะbc˜ZKšœ žœžœ y˜‘Kšœ žœ =˜TKšœ˜K™E—K˜šฯnœžœžœ %˜>K˜—šฃœžœ žœžœžœžœžœ˜LKšœEžœ žœ6žœ’™ฆK™—šฃ œžœ˜Kšœ๗™๗K™—šฃœžœžœ˜3K™=K™—š ฃ œžœžœžœžœ˜MKšœถžœf™ K™—Kšœ žœžœžœ˜2Kšœžœžœ2˜SK˜š ฃ œžœžœžœžœ˜/Kšžœ žœžœ&žœ˜J—K˜šฃ œžœ ˜0Kšœ&™&K™—šฃ œžœžœ*˜RKšœ|™|K™—šฃœžœ˜'K™+K™—šฃœžœ˜(K™.K™—šฃœžœ˜,K™2K™—šฃœžœ˜-K™5——™J™‡JšœNžœธ™‰Jšœ2žœ!žœžœ0™‘Jšœ ฯbœ]คœฟ™ลK™K˜šฃ œžœžœžœ˜AKš œ0žœžœ^žœนžœ1™ŸK™—šฃ œžœ:žœ˜PKšœฑžœžœ1™่K™—šœžœ '˜PK˜—šฃ œžœ1žœ˜GK™>——šœ žœ ™JšคO™OJšœ\žœ“คœฌ™ฎK™Kšœžœžœ ˜šœ žœžœ˜Kšœžœ =˜RKšœžœ =˜JKšœ žœ %˜4Kšœ˜—Kš œžœžœ žœžœžœ˜Išœ žœžœ žœCžœžœ$žœ žœ˜ญKšœ/žœผžœžœฟ™ห—K˜šฃœžœ<žœ˜[J™*J™VKšœ;žœ˜XK˜K™—šฃ œžœ3žœ˜MK™2J™VKšœ"žœ˜?K˜K™—šฃ œžœžœ˜LK™QK™—š ฃ œžœ žœžœ žœ žœ˜BK™ˆ——K˜Kšžœ˜—…—P*๛