<> <> <> DIRECTORY FileIO, NodeStyle, PressPrinter, Rope, TEditDocument, TextNode, TSExtras, TSJaMPageBuilder, TSObject, TSOutput, TSOutputPress, TSTranslate, TSViewer, ViewerClasses, UserCredentials, UserProfile; TSExtrasImpl: MONITOR IMPORTS FileIO, PressPrinter, TSJaMPageBuilder, TSOutput, TSOutputPress, TSTranslate, UserCredentials, UserProfile EXPORTS TSExtras = BEGIN PrintTiogaViewer: PUBLIC ENTRY PROCEDURE [ viewer: ViewerClasses.Viewer, nameForSeparatorPage: Rope.ROPE, aborted: REF BOOLEAN, server: Rope.ROPE _ NIL, copies: INT _ 1, messageProc: PROC [Rope.ROPE] _ NIL ] = {ENABLE UNWIND => NULL; node: TextNode.Ref _ NARROW[viewer.data, TEditDocument.TEditDocumentData].text; outputHandle: TSOutput.Handle _ TSOutputPress.CreateWithCursor[ stream: FileIO.Open["temp.press$", overwrite], documentName: nameForSeparatorPage, cursorObject: NIL ]; galley: TSObject.ItemList; style: NodeStyle.Ref; isAborted: PROC RETURNS [BOOLEAN] = {RETURN[IF aborted = NIL THEN FALSE ELSE aborted^]}; progressProc: PressPrinter.ProgressProc = TRUSTED { IF messageProc # NIL THEN messageProc[handle.CurrentStateMessage[]]; IF aborted # NIL AND aborted^ THEN handle.Abort[]; }; IF server = NIL THEN server _ UserProfile.Token["Hardcopy.PressPrinter", ""]; [galley, style] _ TSTranslate.TreeToVlist[node]; [] _ TSJaMPageBuilder.RunPageBuilder[ galley: galley, style: style, output: outputHandle, abortCheckProc: isAborted, documentName: nameForSeparatorPage ]; outputHandle.Close[]; [] _ PressPrinter.SendPressFile[ fileName: "temp.press$", server: server, progressProc: progressProc, copies: copies, userName: UserCredentials.GetUserCredentials[].name ]; }; PrintSuppliedNodes: PUBLIC ENTRY PROCEDURE [ nodeProc: TSExtras.NodeProc, nameForSeparatorPage: Rope.ROPE, aborted: REF BOOLEAN, server: Rope.ROPE _ NIL, copies: INT _ 1, messageProc: PROC [Rope.ROPE] _ NIL] = { ENABLE UNWIND => NULL; outputHandle: TSOutput.Handle _ TSOutputPress.CreateWithCursor[ stream: FileIO.Open["temp.press$", overwrite], documentName: nameForSeparatorPage, cursorObject: NIL ]; node: TextNode.Ref; galley: TSObject.ItemList; style: NodeStyle.Ref; isAborted: PROC RETURNS [BOOLEAN] = {RETURN[IF aborted = NIL THEN FALSE ELSE aborted^]}; progressProc: PressPrinter.ProgressProc = TRUSTED { IF messageProc # NIL THEN messageProc[handle.CurrentStateMessage[]]; IF aborted # NIL AND aborted^ THEN handle.Abort[]; }; IF server = NIL THEN server _ UserProfile.Token["Hardcopy.PressPrinter", ""]; UNTIL (node _ nodeProc[]) = NIL DO [galley, style] _ TSTranslate.TreeToVlist[node]; [] _ TSJaMPageBuilder.RunPageBuilder[ galley: galley, style: style, output: outputHandle, abortCheckProc: isAborted, documentName: nameForSeparatorPage]; ENDLOOP; outputHandle.Close[]; [] _ PressPrinter.SendPressFile[ fileName: "temp.press$", server: server, progressProc: progressProc, copies: copies, userName: UserCredentials.GetUserCredentials[].name ]; }; END. <> <>