DIRECTORY Buttons, Containers, GriffinToTA USING [ConvertFile, ConvertFileToJaM, ViewType], Menus, Rope, SirPress USING [NewPressHandle, PressHandle, ClosePress], TACallig USING [ForgetThePressHandle, UseThisPressHandle], TAPrivate USING [FixFileName, InitJaMGraphics, NoJaMGraphicsViewer], TARender USING [DocumentNotFound, NotATiogaArtworkDocument, RenderDocument], TextNode, TiogaArtworkViewer, VFonts USING [StringWidth], ViewerClasses, ViewerOps, ViewerTools, TATypeSetter; TiogaArtworkViewerImpl: CEDAR PROGRAM IMPORTS Buttons, Containers, GriffinToTA, Menus, Rope, SirPress, TACallig, TAPrivate, TARender, VFonts, ViewerOps, ViewerTools, TATypeSetter EXPORTS TiogaArtworkViewer = { ROPE: TYPE = Rope.ROPE; griffinView: GriffinToTA.ViewType _ main; tAContainer: Containers.Container; griffinButton: Buttons.Button; pressButton: Buttons.Button; jamButton: Buttons.Button; graphicsButton: Buttons.Button; fileNameBox: ViewerClasses.Viewer; messageBox: ViewerClasses.Viewer; savedFileName: ROPE _ NIL; griffinToTiogaRope: ROPE = "Griffin -> TiogaArtwork!"; tiogaToPressRope: ROPE = "TiogaArtwork -> Press!"; tiogaToJaMGraphicsRope: ROPE = "TiogaArtwork -> JaMGraphics!"; griffinToJaMRope: ROPE = "Griffin -> JaM!"; leftBorder: INTEGER = 10; gapBetween: INTEGER = 10; smallGap: INTEGER = 5; heightBetween: INTEGER = 18; verticalGap: INTEGER = 5; Line: PROC [line: INTEGER] RETURNS [INTEGER] = INLINE{ RETURN[verticalGap+(line-1)*heightBetween]}; CreateViewer: PUBLIC PROCEDURE = { menu: Menus.Menu _ Menus.CreateMenu[]; longestButton: INTEGER = MAX[ VFonts.StringWidth[griffinToTiogaRope], VFonts.StringWidth[tiogaToPressRope], VFonts.StringWidth[tiogaToJaMGraphicsRope]]; tAContainer _ Containers.Create[ info: [ name: "Tioga Artwork Viewer", column: right, openHeight: Line[8]]]; griffinButton _ Buttons.Create[ info: [ name: griffinToTiogaRope, wx: leftBorder, wy: Line[1], parent: tAContainer ], proc: GriffinToTiogaOp, fork: TRUE, documentation: "Convert the file from Griffin format to Tioga Artwork"]; jamButton _ Buttons.Create[ info: [ name: griffinToJaMRope, wx: leftBorder, wy: Line[2], parent: tAContainer ], proc: GriffinToJaMOp, fork: TRUE, documentation: "Convert the file from Griffin format to a JaM script"]; graphicsButton _ Buttons.Create[ info: [ name: tiogaToJaMGraphicsRope, wx: leftBorder, wy: Line[3], parent: tAContainer ], proc: TiogaToJaMGraphicsOp, fork: TRUE, documentation: "Display the Tioga Artwork file in the JaMGraphics viewer"]; fileNameBox _ ViewerTools.MakeNewTextViewer[ info:[ wx: leftBorder+gapBetween+longestButton, wy: Line[1], ww: 4*72, wh: heightBetween, parent: tAContainer, scrollable: FALSE], paint: FALSE]; Containers.ChildXBound[tAContainer, fileNameBox]; messageBox _ ViewerTools.MakeNewTextViewer[ info: [ wx: leftBorder, wy: Line[4]+heightBetween/2, ww: 4*72, wh: Line[3], parent: tAContainer, scrollable: FALSE, border: FALSE], paint: FALSE]; Containers.ChildXBound[tAContainer, messageBox]; ViewerTools.InhibitUserEdits[messageBox]; ViewerTools.SetContents[messageBox, "Enter filename and bug an operation"]; Menus.InsertMenuEntry[menu: menu, entry: Menus.CreateEntry[name: "GetSelection", proc: GetSelectionButton, fork: FALSE, documentation: "Stuff the selection (or the name of the selected viewer) into the file name box"]]; Menus.InsertMenuEntry[menu: menu, entry: Menus.CreateEntry[name: "HookUpTSetter", proc: TSetterButton, fork: FALSE, documentation: "Sets up the callback procs for the TSetter. Run TSetter first"]]; ViewerOps.SetMenu[tAContainer, menu]; }; GriffinToTiogaOp: Buttons.ButtonProc = TRUSTED { fileName: ROPE; IF ~FileNameBoxOk[] THEN RETURN; fileName _ TAPrivate.FixFileName[ViewerTools.GetContents[fileNameBox], ".Griffin"]; Working[griffinButton, "Converting from ", fileName, " to Tioga Artwork."]; GriffinToTA.ConvertFile[fileName, griffinView]; AllDone[griffinButton, "Completed the Tioga Artwork file: ", fileName]; }; GriffinToJaMOp: Buttons.ButtonProc = TRUSTED { fileName: ROPE; IF ~FileNameBoxOk[] THEN RETURN; fileName _ TAPrivate.FixFileName[ViewerTools.GetContents[fileNameBox], ".Griffin"]; Working[jamButton, "Converting from ", fileName, " to JaM script."]; GriffinToTA.ConvertFileToJaM[fileName, griffinView]; fileName _ TAPrivate.FixFileName[ViewerTools.GetContents[fileNameBox], ".JaM"]; AllDone[jamButton, "Completed the JaM file: ", fileName]; }; TiogaToPressOp: Buttons.ButtonProc = TRUSTED { artFileName, pressFileName: ROPE; pressHandle: SirPress.PressHandle; IF ~FileNameBoxOk[] THEN RETURN; artFileName _ TAPrivate.FixFileName[ViewerTools.GetContents[fileNameBox], ".Artwork"]; pressFileName _ TAPrivate.FixFileName[ViewerTools.GetContents[fileNameBox], ".Press"]; Working[pressButton, "Converting from ", artFileName, " to a press file."]; TAPrivate.InitJaMGraphics[ ! TAPrivate.NoJaMGraphicsViewer => GOTO NoJaMGraphics]; pressHandle _ SirPress.NewPressHandle[pressFileName]; TACallig.UseThisPressHandle[pressHandle]; { ENABLE UNWIND => TACallig.ForgetThePressHandle[]; TARender.RenderDocument[handle: NIL, fileName: artFileName, paint: TRUE ! TARender.DocumentNotFound => {savedFileName _ fileName; GOTO NoFile}; TARender.NotATiogaArtworkDocument => {savedFileName _ fileName; GOTO NotArtwork}]; TACallig.ForgetThePressHandle[]; }; SirPress.ClosePress[pressHandle]; AllDone[pressButton, "Completed the press file: ", pressFileName]; EXITS NoFile => AllDone[pressButton, "The file ", savedFileName, " could not be opened."]; NotArtwork=> AllDone[pressButton, "The file ", savedFileName, " does not have Artwork=TRUE property on the root."]; NoJaMGraphics => AllDone[pressButton, "Either no JaM typescript or TJaMGraphicsPackage could not be loaded."]; }; TiogaToJaMGraphicsOp: Buttons.ButtonProc = TRUSTED { fileName: ROPE; IF ~FileNameBoxOk[] THEN RETURN; fileName _ TAPrivate.FixFileName[ViewerTools.GetContents[fileNameBox], ".Artwork"]; Working[graphicsButton, "Rendering Tioga Artwork in ", fileName]; { ENABLE UNWIND => AllDone[graphicsButton, " -- Aborted."]; TAPrivate.InitJaMGraphics[ ! TAPrivate.NoJaMGraphicsViewer => GOTO NoJaMGraphics]; TARender.RenderDocument[handle: NIL, fileName: fileName, paint: TRUE ! TARender.DocumentNotFound => {savedFileName _ fileName; GOTO NoFile}; TARender.NotATiogaArtworkDocument => {savedFileName _ fileName; GOTO NotArtwork}]; AllDone[graphicsButton, "Completed drawing Tioga Artwork figure."]; }; EXITS NoFile => AllDone[graphicsButton, "The file ", savedFileName, " could not be opened."]; NotArtwork=> AllDone[graphicsButton, "The file ", savedFileName, " does not have Artwork=TRUE property on the root."]; NoJaMGraphics => AllDone[graphicsButton, "Either no JaM typescript or TJaMGraphicsPackage could not be loaded."]; }; FileNameBoxOk: PROC RETURNS[BOOLEAN] = { ViewerTools.SetContents[messageBox, ""]; IF Rope.Size[ViewerTools.GetContents[fileNameBox]] = 0 THEN { ViewerTools.SetContents[messageBox, "Enter the filename in the box first."]; RETURN[FALSE]}; RETURN[TRUE]; }; GetSelectionButton: Menus.MenuProc = TRUSTED { selectedViewer: ViewerClasses.Viewer _ ViewerTools.GetSelectedViewer[]; sourceName: ROPE _ IF selectedViewer = NIL OR selectedViewer.class.get = NIL THEN NIL ELSE NARROW[selectedViewer.class.get[selectedViewer, $SelChars]]; IF sourceName.Length[] <=1 THEN { IF (selectedViewer = NIL) THEN { ViewerTools.SetContents[messageBox, "Selection not in text viewer"]; sourceName _ NIL} ELSE sourceName _ selectedViewer.name; }; ViewerTools.SetContents[fileNameBox, sourceName]; }; TSetterButton: Menus.MenuProc = TRUSTED { TATypeSetter.RegisterProcs[]; TAPrivate.InitJaMGraphics[ ! TAPrivate.NoJaMGraphicsViewer => ViewerTools.SetContents[messageBox, "You must have JaMGraphics running"]]; }; Working: PROCEDURE[button: Buttons.Button, r1, r2, r3, r4, r5: ROPE _ NIL] = { ViewerTools.SetContents[messageBox, Rope.Cat[r1, r2, r3, r4, r5]]; Buttons.SetDisplayStyle[button, $BlackOnGrey, TRUE]; }; AllDone: PROCEDURE[button: Buttons.Button, r1, r2, r3, r4, r5: ROPE _ NIL] = { ViewerTools.SetContents[messageBox, Rope.Cat[r1, r2, r3, r4, r5]]; Buttons.SetDisplayStyle[button, $BlackOnWhite, TRUE]; }; CreateViewer[]; }. ÔTiogaArtworkViewerImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Rick Beach, April 15, 1983 5:23 pm Maureen Stone April 20, 1983 3:22 pm Rick Beach, February 11, 1985 9:06:28 am PST Êœ™Jšœ Ïmœ1™˜LJ˜ J˜Jšœžœ˜J˜J˜ J˜ J˜ J˜—šœž ˜%Jšžœ…˜ŒJšžœ˜J˜—Jšžœžœžœ˜J˜J˜)J˜"J˜J˜J˜J˜J˜"J˜!Jšœžœžœ˜Jšœžœ˜6Jšœžœ˜2Jšœžœ"˜>Jšœžœ˜+J˜J˜Jšœ žœ˜Jšœ žœ˜Jšœ žœ˜Jšœžœ˜Jšœ žœ˜J˜š Ïnœžœžœžœžœžœ˜6Jšžœ&˜,J˜—šŸ œžœž œ˜"J˜&šœžœžœ˜J˜'J˜%J˜,—˜ ˜J˜J˜J˜——˜˜J˜J˜J˜ J˜—J˜Jšœžœ˜ J˜H—˜˜J˜J˜J˜ J˜—J˜Jšœžœ˜ J˜G—˜ ˜J˜J˜J˜ J˜—J˜Jšœžœ˜ J˜K—˜,˜J˜(J˜ J˜ J˜J˜Jšœ žœ˜—Jšœžœ˜—J˜1˜+˜J˜J˜J˜ J˜ J˜Jšœ žœ˜Jšœžœ˜—Jšœžœ˜—J˜0J˜)J˜K˜!JšœOžœ˜UJ˜c—˜!JšœKžœ˜QJ˜R—J˜%J˜J˜—šœ(žœ˜1Jšœ žœ˜Jšžœžœžœ˜ J˜SJ˜KJ˜/J˜GJ˜J˜J˜—šœ&žœ˜/Jšœ žœ˜Jšžœžœžœ˜ J˜SJ˜DJ˜4J˜OJ˜9J˜J˜J˜—šœ&žœ˜/Jšœžœ˜!J˜"Jšžœžœžœ˜ J˜VJ˜VJ˜KJšœ>žœ˜RJ˜5J˜)šœžœžœ$˜3šœ žœ žœ˜IJšœ8žœ ˜EJšœ@žœ˜R—J˜ J˜—J˜!J˜Bšž˜J˜TJ˜sJ˜n—J˜J˜—šœ+žœ˜4Jšœ žœ˜Jšžœžœžœ˜ J˜SJ˜Ašœ˜Jšžœžœ,˜9Jšœ>žœ˜Ršœ žœžœ˜FJšœ8žœ ˜EJšœ@žœ˜R—J˜CJšœ˜—šž˜J˜WJ˜vJ˜q—J˜J˜—šŸ œžœžœžœ˜(J˜(šžœ5žœ˜=J˜LJšžœžœ˜—Jšžœžœ˜ J˜J˜—šœ%žœ˜.J˜Gšœ žœ˜Jš žœžœžœžœžœž˜BJšžœžœ6˜A—šžœžœ˜!šžœžœžœ˜ J˜DJšœ žœ˜—Jšžœ"˜&J˜—J˜1J˜J˜—šœ žœ˜)J˜J˜ˆJ˜J˜J˜—šŸœž œ-žœžœ˜NJ˜BJšœ.žœ˜4J˜J˜—šŸœž œ-žœžœ˜NJ˜BJšœ/žœ˜5J˜J˜—J˜J˜J˜J˜J˜—…—¼&