<> <> <> <> DIRECTORY Menus USING [Menu, MenuEntryTrigger], MessageWindow USING [Append, Blink], ViewerClasses USING [Column, NotifyProc, Viewer], ViewerOps, ViewerSpecs, WindowManager USING [colorDisplayOn]; ViewerMenusImpl: CEDAR PROGRAM IMPORTS MessageWindow, ViewerOps, WindowManager SHARES ViewerClasses, ViewerOps = BEGIN windowDestroyMenu: Menu = [name: "windowDestroyMenu", beginsActive: TRUE, breakBefore: FALSE, breakAfter: FALSE, notify: ViewerMenuNotifier, entries: LIST[ ["Destroy", FALSE, "Destroy", LIST [ [LIST[all],LIST[$DestroyViewer],"Destroy the Viewer", "", NIL,NIL,NIL] ] ]; windowGuardedDestroyMenu: Menu = [name: "windowGuardedDestroyMenu", beginsActive: TRUE, breakBefore: FALSE, breakAfter: FALSE, notify: ViewerMenuNotifier, entries: LIST[ ["Destroy", TRUE, "Destroy", LIST [ [LIST[all],LIST[$DestroyViewer],"Destroy the Viewer", "Edits will be discarded...", NIL,NIL,NIL] ] ]; windowMovementMenu: Menu = [name: windowMovementMenu", beginsActive: TRUE, breakBefore: FALSE, breakAfter: FALSE, notify: ViewerMenuNotifier, entries: LIST[ ["Adjust", FALSE, "Adjust", LIST[ [LIST[all], LIST[$AdjustViewerSticky], "Adjust Viewer Size", "", NIL, NIL, NIL] ] ], ["Top", FALSE, "Top", LIST[ [LIST[all], LIST[$MoveViewerToTop], "Move Viewer To Top Of Column", "", NIL, NIL, NIL] ] ], ["Left", FALSE, "", LIST[ [LIST[shiftleftup, shiftmiddleupup, shiftrightup], LIST[$MoveViewerToLeftColumn, $GrowViewer], "Move To Left Column and Grow ", "", NIL, NIL, NIL], [LIST[all], LIST[$MoveViewerToLeft], "Move Viewer To Left Column", "", NIL, NIL, NIL] ] ], ["Right", FALSE, "", LIST[ [LIST[shiftleftup, shiftmiddleupup, shiftrightup], LIST[$MoveViewerToRightColumn, $GrowViewer], "Move To Right Column and Grow ", "", NIL, NIL, NIL], [LIST[all], LIST[$MoveViewerToRight], "Move Viewer To Right Column", "", NIL, NIL, NIL] ] ] ] ]; windowColorMenu: Menu = [name: "windowColorMenu", beginsActive: FALSE, breakBefore: FALSE, breakAfter: FALSE, notify: ViewerMenuNotifier, entries: LIST[ ["Color", FALSE, "Color", LIST[ [LIST[shiftleftup, shiftmiddleupup, shiftrightup], LIST[$MoveViewerToColorColumnAndGrow], "Move To Color Display and Grow ", "", NIL, NIL, NIL], [LIST[all], LIST[$MoveViewerToColorColumn], "Move Viewer To Color Display", "", NIL, NIL, NIL] ] ] ] ]; windowSizeMenu: Menu = [name: "windowSizeMenu", beginsActive: FALSE, breakBefore: FALSE, breakAfter: FALSE, notify: ViewerMenuNotifier, entries: LIST[ ["Grow", FALSE, "Grow", LIST[ [LIST[all],LIST[$GrowViewer],"Grow the Viewer", "", NIL,NIL,NIL] ] ], ["Close", FALSE, "Close", LIST[ [LIST[all],LIST[$CloseViewer],"Close the Viewer", "", NIL,NIL,NIL] ] ], ] ]; ViewerMenuNotifier: ViewerClasses.NotifyProc = { <<[self: Viewer, input: LIST OF REF ANY]>> FOR current: LIST OF REF ANY _ input, current.rest UNTIL current = NIL DO SELECT current.first FROM $DestroyViewer => Destroy[self]; $CloseViewer => ViewerOps.CloseViewer[self]; $GrowViewer => ViewerOps.GrowViewer[self]; $MoveViewerToTop => ViewerOps.TopViewer[self]; $AdjustViewer => ViewerOps.Adjust[self]; $MoveViewerToLeftColumn => ViewerOps.ChangeColumn[self, left]; $MoveViewerToRightColumn => ViewerOps.ChangeColumn[self, right]; $MoveViewerToColorColumn => MoveToColorColumn[viewer: self, doGrow: FALSE]; $MoveViewerToColorColumnAndGrow => MoveToColorColumn[viewer: self, doGrow:TRUE]; ENDCASE => ERROR; ENDLOOP; }; Destroy: PROC[viewer: ViewerClasses.Viewer] = { IF ~viewer.inhibitDestroy THEN ViewerOps.DestroyViewer[viewer] ELSE {MessageWindow.Append["Sorry, this viewer can not be destroyed.", TRUE]; MessageWindow.Blink[]}; }; MoveToColorColumn: PRIVATE PROC[viewer: ViewerClasses.Viewer, doGrow: BOOL _ FALSE] = { IF WindowManager.colorDisplayOn THEN { ViewerOps.ChangeColumn[viewer, color]; IF doGrow THEN ViewerOps.GrowViewer[viewer]} ELSE BEGIN MessageWindow.Append["Sorry, the color display is not available.", TRUE]; MessageWindow.Blink[]; END; }; END.