DIRECTORY Atom USING [PropList], Imager USING [Context], Rope USING [ROPE], TIPTypes USING [TIPTable]; ViewerClasses: CEDAR DEFINITIONS = BEGIN Viewer: TYPE = REF ViewerRec; ViewerRec: TYPE = PACKED RECORD [ class: ViewerClass ¬ NIL, -- static info for all Viewers of this class ** wx, wy: INTEGER ¬ 0, -- position of viewer window wrt parent's client space ww, wh: INTEGER ¬ 0, -- size of viewer window area cx, cy: INTEGER ¬ 0, -- position of client space wrt window ** cw, ch: INTEGER ¬ 0, -- size of viewer client space ** lock: Lock ¬ [NIL, 0], -- locking information used by ViewerLocks * ** tipTable: TIPTable ¬ NIL, -- mouse and keyboard events, initialised from class name: Rope.ROPE ¬ NIL, -- Viewer name, displayed in caption (optional) file: Rope.ROPE ¬ NIL, -- backing file name (optional) label: Rope.ROPE ¬ NIL, -- icon label (optional) menu: Menu ¬ NIL, -- copied from class; set with ViewerOps.SetMenu icon: IconFlavor ¬ unInit, -- picture to display when small, initialised from class column: Column ¬ left, -- screen space algorithm used when viewer is open caption: BOOL ¬ FALSE, -- viewer has a caption bar at the top scrollable: BOOL ¬ TRUE, -- viewer has a vertical scroll bar hscrollable: BOOL ¬ FALSE, -- viewer has a horizontal scroll bar iconic: BOOL ¬ TRUE, -- small or large representation on screen border: BOOL ¬ TRUE, -- viewer has a surrounding black border newVersion: BOOL ¬ FALSE, -- hint that the user has made new edits ** newFile: BOOL ¬ FALSE, -- hint that a backing file does not yet exist ** visible: BOOL ¬ TRUE, -- WMgr maintained hint for repaint use * ** offDeskTop: BOOL ¬ FALSE, -- is viewer off of the current desktop? ** destroyed: BOOL ¬ FALSE, -- hint that viewer has been flushed from window tree ** init: BOOL ¬ FALSE, -- init proc call has been completed after creation * ** saveInProgress: BOOL ¬ FALSE, -- the saveProc has been called but not yet returned ** inhibitDestroy: BOOL ¬ FALSE, -- if TRUE then window menu will not permit destroy guardDestroy: BOOL ¬ FALSE, -- if TRUE then window menu will always guard destroy paintingWedged: BOOL ¬ FALSE, -- used to mark a viewer whose paint proc has died * ** transparentTIP: BOOL ¬ FALSE, -- passes user input events without tip table interpretation spare0, spare1, spare2, spare3, spare4, spare5: BOOL ¬ FALSE, -- spares position: [0..256) ¬ 0, -- icon position * ** openHeight: INTEGER ¬ 0, -- "ideal" height hint for open viewer link: Viewer ¬ NIL, -- ring of linked viewers ** parent: Viewer ¬ NIL, -- NIL if top level viewer ** sibling: Viewer ¬ NIL, -- sibling chain ** child: Viewer ¬ NIL, -- head of children chain ** props: Atom.PropList ¬ NIL, -- clients can associate properties with viewers ** data: REF ANY ¬ NIL, -- data slot for Viewer Class implementor cursor: CursorType ¬ none -- (see comment below) ]; ViewerClass: TYPE = REF ViewerClassRec; ViewerClassRec: TYPE = PACKED RECORD [ flavor: ViewerFlavor ¬ NIL, -- name of viewer's class notify: NotifyProc ¬ NIL, -- TIP input events parsed from tipTable paint: PaintProc ¬ NIL, -- called whenever the Viewer should repaint its contents modify: ModifyProc ¬ NIL, -- reports InputFocus changes destroy: DestroyProc ¬ NIL, -- called before Viewer structures freed on destroy copy: CopyProc ¬ NIL, -- copy data to new Viewer set: SetProc ¬ NIL, -- set the viewer contents get: GetProc ¬ NIL, -- get the viewer contents init: InitProc ¬ NIL, -- called on creation or reset to init client data save: SaveProc ¬ NIL, -- requests client to write contents to disk scroll: ScrollProc ¬ NIL, -- vertical scrolling hscroll: HScrollProc ¬ NIL, -- horizontal scrolling caption: CaptionProc ¬ NIL, -- display caption adjust: AdjustProc ¬ NIL, -- called when viewer size is changed menu: Menu ¬ NIL, -- template menu used for top-level viewers tipTable: TIPTable ¬ NIL, -- table to parse mouse & keyboard events topDownCoordSys: BOOL ¬ FALSE, -- TRUE => children positioned wrt top of client space bltH: HBltRule ¬ none, -- use blt to copy screen contents (see comment below) bltV: VBltRule ¬ none, -- use blt to copy screen contents (see comment below) icon: IconFlavor ¬ document, -- picture to display when small cursor: CursorType ¬ textPointer, -- standard cursor when mouse is in viewer props: Atom.PropList ¬ NIL ]; Menu: TYPE ~ REF MenuRec; MenuRec: TYPE = RECORD [ lines: ARRAY MenuLine OF MenuEntry ¬ ALL[NIL], x, y: INTEGER ¬ 0, linesUsed: [0..maxMenuLines] ¬ 1, lineInverted: MenuLine ¬ 0, inverted: MenuEntry ¬ NIL ]; maxMenuLines: NAT ~ 5; MenuLine: TYPE = [0..maxMenuLines); MenuEntry: TYPE = REF MenuEntryRec; MenuEntryRec: TYPE = PRIVATE MONITORED RECORD [ link: MenuEntry ¬ NIL, name: Rope.ROPE, proc: ClickProc, width: INTEGER ¬ 0, xPos: INTEGER ¬ 0, clientData: REF ANY ¬ NIL, documentation: REF ANY ¬ NIL, fork: BOOL ¬ TRUE, greyed: BOOL ¬ FALSE, guarded: BOOL ¬ FALSE, guardState: GuardState ¬ armed ]; GuardState: TYPE = { guarded, arming, armed }; TIPTable: TYPE ~ TIPTypes.TIPTable; CursorType: TYPE ~ MACHINE DEPENDENT { activate(0), blank(1), bullseye(2), confirm(3), crossHairsCircle(4), ftp(5), typeKey(6), hourGlass(7), move(8), menu(9), mouseRed(10), mouseYellow(11), mouseBlue(12), grow(13), pointDown(14), pointLeft(15), pointRight(16), pointUp(17), questionMark(18), retry(19), scrollDown(20), scrollLeft(21), scrollLeftRight(22), scrollRight(23), scrollUp(24), scrollUpDown(25), textPointer(26), none(27), last(255)}; IconFlavor: TYPE ~ MACHINE DEPENDENT { -- pre-defined icons document(0), dirtyDocument(1), fileCabinet(2), tool(3), typescript(4), private(CARDINAL.LAST-1), -- will cause call of viewer paintProc to paint icon unInit(CARDINAL.LAST) -- flag for unitialised icon type }; PaintHint: TYPE = { all, client, menu, caption }; HBltRule: TYPE = { none, left, center, right }; VBltRule: TYPE = { none, top, center, bottom }; PaintRectangle: TYPE = REF PaintRectangleRec; PaintRectangleRec: TYPE = RECORD[ x, y, w, h: INTEGER ¬ 0 ]; ViewerFlavor: TYPE = ATOM; Lock: TYPE = RECORD [ -- process-reentrant viewer lock process: UNSAFE PROCESS ¬ NIL, -- current write process count: CARDINAL ¬ 0 -- number of locks currently granted for this viewer ]; Column: TYPE = MACHINE DEPENDENT {static(0), left(1), right(2), color(3), (CARDINAL.LAST)}; PaintProc: TYPE = PROC [self: Viewer, context: Imager.Context, whatChanged: REF, clear: BOOL] RETURNS [quit: BOOL ¬ FALSE]; NotifyProc: TYPE = PROC [self: Viewer, input: LIST OF REF ANY, device: REF ¬ NIL, user: REF ¬ NIL, display: REF ¬ NIL]; ModifyProc: TYPE = PROC [self: Viewer, change: ModifyAction]; ModifyAction: TYPE = {set, push, pop, kill}; DestroyProc: TYPE = PROC [self: Viewer]; CopyProc: TYPE = PROC [self, new: Viewer]; SetProc: TYPE = PROC [self: Viewer, data: REF ANY, finalise: BOOL ¬ TRUE, op: ATOM ¬ NIL]; GetProc: TYPE = PROC [self: Viewer, op: ATOM ¬ NIL] RETURNS [data: REF ANY]; InitProc: TYPE = PROC [self: Viewer]; SaveProc: TYPE = PROC [self: Viewer, force: BOOL ¬ FALSE]; SaveAborted: ERROR[error: Rope.ROPE]; ScrollProc: TYPE = PROC [self: Viewer, op: ScrollOp, amount: INTEGER, shift, control: BOOL ¬ FALSE] RETURNS [top, bottom: INTEGER ¬ LAST[INTEGER]]; ScrollOp: TYPE = {query, up, down, thumb}; HScrollProc: TYPE = PROC [self: Viewer, op: HScrollOp, amount: INTEGER, shift, control: BOOL ¬ FALSE] RETURNS [left, right: INTEGER ¬ LAST[INTEGER]]; HScrollOp: TYPE = {query, left, right, thumb}; CaptionProc: TYPE = PROC [self: Viewer, context: Imager.Context]; AdjustProc: TYPE = PROC [self: Viewer] RETURNS [adjusted: BOOL ¬ FALSE]; MouseButton: TYPE = {red, yellow, blue}; ClickProc: TYPE = PROC [parent: Viewer, clientData: REF ANY ¬ NIL, mouseButton: MouseButton ¬ red, shift, control: BOOL ¬ FALSE]; END. > ViewerClasses.mesa Copyright Ó 1985, 1986, 1987, 1989, 1991, 1992 by Xerox Corporation. All rights reserved. Edited by McGregor on October 26, 1982 10:07 am Last Edited by: Maxwell, January 3, 1983 2:14 pm Bier, November 30, 1988 5:36:16 pm PST Pier, November 18, 1988 5:10:10 pm PST Doug Wyatt, January 19, 1987 11:45:00 pm PST Michael Plass, October 23, 1991 2:19 pm PDT Willie-s, October 9, 1991 4:53 pm PDT Christian Jacobi, February 24, 1992 5:17 pm PST The cursor field shows the cursor type that will be used when mouse is in viewer. If this value is "none", the cursor in viewer.class will be used instead. Instance data for a viewer; please treat * entries as PRIVATE and ** entries as READONLY. The bltH and bltV fields in the class request that the window package attempt to save some of the current screen contents of a viewer by moving the bits to the new viewer location (e.g. when the viewer is moved). These rectangle that was thus saved will show up as the whatChanged parameter, as a convenience to clients that keep caches of screen contents. Client that scale their image to fit the viewer bounding box should not use this feature. ViewerFlavors predefined by the Viewer package include: $Label, $MessageWindow, $Button, $Container, $Rule. Tioga implements $Text and $Typescript. Static documents, such as the message window, may not be open/closed. The name "color" is wrong, but it is retained for compatibility pending a cleanup. Called by the window manager when the client should repaint the data on the screen. The context is clipped to the client screen area. whatChanged is just passed from the call to ViewerOps.PaintViewer, but will be NIL when the window manager requires a full repaint after moving a viewer on the screen. clear is a hint that the client background is white, so that the client can paint on the black bits if it so chooses. See comments for paintRectangles bit in the viewer class. Return quit~TRUE to stop without painting children. Input events from the class TIPTable. Mouse events get passed whenever the mouse is over the viewer, keyboard events get passed if the viewer owns the input focus (see the InputFocus interface). N.B. Called at Process.priorityForeground! Called when the input focus ownership is changing so that the client can modify things like selection feedback on the screen or private data structures and state. Called when the viewer has been destroyed for some reason. Copy implementor private data structures. The op atom for SetProc and GetProc is for private client agreements to get things like selection contents or content representations other than ropes. Called by the window manager shortly after a viewer is created so that the client can create and initialise private data structures. Also called on the "Reset" menu command. Requests client to save data structures on the disk. force should only be true when called from the emergency backup code on error recovery and requests that the client consider overriding monitors or locks that might otherwise prevent saving the data. Client scrolling and scrolling feedback. If op is 'query' the client should return the percentage of the scrollable document at the top and bottom of the screen, or default if unknown. If op is 'up' or 'down' then amount is number of pixels to glitch. If op is 'thumb' then amount is percentage into document to scroll. The shift and control information reflects the state of the shift and control keys during the up, down, and thumb ops and may be interpreted by the client as desired. Like ScrollProc, for horizontal scrolling. Allows client to draw caption legend. Called whenever a viewer's size is changed. Return adjusted~TRUE to indicate that children were rearranged; ViewerBLT will assume that a full repaint is required if adjusted=TRUE. Mouse buttons from left to right For menus, the parent field will contain the parent Viewer; for buttons, parent will be the button Viewer itself; mouseButton indicates how the user invoked the button or menu. shift and control indicate the state of the shift and control keys when the menu or button was invoked. Ê ç•NewlineDelimiter –(cedarcode) style™codešÏc™Kšœ ÏeœO™ZKš/™/K™0K™&K™&K™,K™+K™%K™/K™—šÏk ˜ KšœŸœ ˜KšœŸœ ˜KšœŸœŸœ˜Kšœ Ÿœ ˜—K˜KšÐbl œŸ˜ šœŸ˜K˜—KšœŸœŸœ ˜šœ ŸœŸœŸœ˜!KšœŸœ/˜IKšœŸœ6˜KKšœŸœ˜2KšœŸœ)˜>KšœŸœ!˜6KšœŸœ/˜FKšœŸœ4˜NKšœ ŸœŸœ/˜FKšœ ŸœŸœ˜6Kšœ ŸœŸœ˜0Kšœ Ÿœ0˜BKšœ8˜SKšœ2˜IKšœ ŸœŸœ&˜=Kšœ ŸœŸœ#˜Kšœ˜0K˜K˜KšœœœL™œKšœ6ŸœŸœ™YK˜—K˜Kšœ ŸœŸœ˜'šœŸœŸœŸœ˜&KšœŸœ˜5KšœŸœ(˜BKšœŸœ9˜QKšœŸœ˜7KšœŸœ3˜OKšœŸœ˜0KšœŸœ˜.KšœŸœ˜.KšœŸœ2˜HKšœŸœ,˜BKšœŸœ˜/KšœŸœ˜3KšœŸœ˜.KšœŸœ%˜?Kšœ Ÿœ+˜=KšœŸœ)˜CKš œŸœŸœÐckÐcr˜UKšœ6˜MKšœ6˜MKšœ ˜=Kšœ"*˜LKšœŸ˜K˜—K˜KšœŸœŸœ ˜šœ ŸœŸœ˜Kš œŸœ Ÿœ ŸœŸœ˜.KšœŸœ˜K˜!K˜KšœŸ˜K˜K˜—KšœŸœ˜Kšœ Ÿœ˜#K˜Kšœ ŸœŸœ˜#š œŸœŸœŸ œŸœ˜/KšœŸœ˜Kšœ Ÿœ˜K˜KšœŸœ˜KšœŸœ˜Kšœ ŸœŸœŸœ˜KšœŸœŸœŸœ˜KšœŸœŸœ˜KšœŸœŸœ˜Kšœ ŸœŸœ˜K˜K˜K˜—šœ Ÿœ˜.K˜—šœ Ÿœ˜#K˜—šœ ŸœŸœŸ œ˜&K˜DK˜AK˜GK˜IK˜CK˜8K˜—šœ ŸœŸœŸ œ˜;K˜ K˜K˜K˜K˜KšœŸœŸœ4˜NKšœŸœŸœ!˜7K˜K˜—šœ Ÿœ"˜1K™—K˜Kšœ Ÿœ!˜/šœ Ÿœ!˜/KšÀ™ÀK™—KšœŸœŸœ˜-šœŸœŸœ˜!Kšœ Ÿœ˜Kšœ˜K˜—šœŸœŸœ˜Kš”™”K˜—šœŸœŸœ ˜6Kšœ ŸœŸœ˜7KšœŸœ4˜HK˜K˜—š œŸœŸœŸ œ+ŸœŸœ˜[KšE™EK™RK˜—K˜šœ ŸœŸœ6Ÿœ ŸœŸœŸœŸœ˜|Kš×¡ßœ'¡#™–K˜—šœ ŸœŸœŸœŸœŸœŸœ ŸœŸœŸœŸœ ŸœŸœ˜wKšð™ðK˜—Kšœ ŸœŸœ&˜=šœŸœ˜,Kš¢™¢K˜—šœ ŸœŸœ˜(Kš:™:K˜—šœ ŸœŸœ˜*Kš)™)K˜—Kšœ ŸœŸœŸœŸœ ŸœŸœŸœŸœ˜Zšœ ŸœŸœŸœŸœŸœŸœŸœ˜LKš—™—K˜—šœ ŸœŸœ˜%Kš®™®K˜—š œ ŸœŸœŸœŸœ˜:Kšý™ý—šœ Ÿœ Ÿœ˜%K˜—Kšœ ŸœŸœ&ŸœŸœŸœŸœŸœŸœŸœ˜”šœ Ÿœ˜*Kšê™êK˜—Kšœ ŸœŸœ'ŸœŸœŸœŸœŸœŸœŸœ˜–šœ Ÿœ˜.Kš*™*K˜—šœ ŸœŸœ)˜AKš%™%K˜—š œ ŸœŸœŸœ ŸœŸœ˜HKšœ=ŸœnŸœ™´K˜—K˜šœ Ÿœ˜(Kšœ ™ K˜—šœ ŸœŸœŸœŸœŸœ3ŸœŸœ˜‚Kšœ™™™—K˜KšŸœ˜—…—(8M