<> <> <> <> <> <<>> DIRECTORY Atom USING [PropList], Cursors USING [CursorType], Icons USING [IconFlavor], Imager USING [Context], Menus USING [Menu], Rope USING [ROPE], TIPUser USING [TIPTable]; ViewerClasses: CEDAR DEFINITIONS = BEGIN Viewer: TYPE = REF ViewerRec; ViewerRec: TYPE = RECORD [ -- 36 words 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: TIPUser.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: Menus.Menu _ NIL, -- copied from class; set with ViewerOps.SetMenu icon: Icons.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 * ** spare0, spare1, spare2, spare3, spare4, spare5, spare6: 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 ]; <> ViewerClass: TYPE = REF ViewerClassRec; ViewerClassRec: TYPE = 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: Menus.Menu _ NIL, -- template menu used for top-level viewers tipTable: TIPUser.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: Icons.IconFlavor _ document, -- picture to display when small cursor: Cursors.CursorType _ textPointer, -- standard cursor when mouse is in viewer props: Atom.PropList _ NIL ]; <> 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 = {static, left, right, color}; <> 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]; <> 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]; <> END.