DIRECTORY Atom USING [GetPropFromList, PutPropOnList], Imager USING [Context], Menus USING [Menu], Rope USING [ROPE], TIPUser USING [TIPScreenCoords], ViewerClasses USING [Viewer, ViewerClass, ViewerFlavor, ViewerRec, Column], ViewerSpecs USING [openBottomY, openLeftWidth]; ViewerOps: CEDAR DEFINITIONS IMPORTS Atom, ViewerSpecs SHARES ViewerClasses = BEGIN OPEN ViewerClasses, ViewerSpecs; RegisterViewerClass: PROC [flavor: ViewerFlavor, class: ViewerClass]; FetchViewerClass: PROC [flavor: ViewerFlavor] RETURNS [ViewerClass]; CreateViewer: PROC [flavor: ViewerFlavor, info: ViewerRec _ [], paint: BOOL _ TRUE] RETURNS [new: Viewer] ; OpenIcon: PROC [icon: Viewer, closeOthers: BOOL _ FALSE, bottom: BOOL _ TRUE, paint: BOOL _ TRUE] ; CloseViewer: PROC [viewer: Viewer, paint: BOOL _ TRUE] ; GrowViewer: PROC [viewer: Viewer, paint: BOOL _ TRUE] ; TopViewer: PROC [viewer: Viewer, paint: BOOL _ TRUE] ; BottomViewer: PROC [viewer: Viewer, paint: BOOL _ TRUE] ; MoveAboveViewer: PROC [altered, static: Viewer, paint: BOOL _ TRUE] ; MoveBelowViewer: PROC [altered, static: Viewer, paint: BOOL _ TRUE] ; CopyViewer: PROC [viewer: Viewer, x, y: INTEGER, w, h: INTEGER] RETURNS [new: Viewer] ; MoveViewer: PROC [viewer: Viewer, x, y: INTEGER, w, h: INTEGER, paint: BOOL _ TRUE] ; DestroyViewer: PROC [viewer: Viewer, paint: BOOL _ TRUE] ; PaintViewer: PROC [viewer: Viewer, hint: PaintHint, clearClient: BOOL _ TRUE, whatChanged: REF ANY _ NIL] ; PaintHint: TYPE = { all, client, menu, caption } ; NotifyViewer: PROC [viewer: Viewer, input: LIST OF REF ANY] = INLINE {IF viewer.class.notify#NIL THEN viewer.class.notify[viewer, input]} ; SetViewer: PROC [viewer: Viewer, data: REF ANY, finalise: BOOL _ TRUE, op: ATOM _ NIL] = INLINE {IF viewer.class.set#NIL THEN viewer.class.set[viewer, data, finalise, op]} ; GetViewer: PROC [viewer: Viewer, op: ATOM _ NIL] RETURNS [data: REF ANY] = INLINE {RETURN[IF viewer.class.get#NIL THEN viewer.class.get[viewer, op] ELSE NIL]} ; SaveViewer: PROC [viewer: Viewer] ; RestoreViewer: PROC [viewer: Viewer] ; ReplaceViewer: PROC [new, old: Viewer] ; SwapIconAndViewer: PROC [icon, openViewer: Viewer, paint: BOOL _ TRUE] ; ChangeColumn: PROC [viewer: Viewer, newColumn: Column] ; EnumerateViewers: PROC [enum: EnumProc] ; EnumerateChildren: PROC [viewer: Viewer, enum: EnumProc] ; EnumProc: TYPE = PROC [v: Viewer] RETURNS [BOOL _ TRUE] ; FindViewer: PROC [name: Rope.ROPE] RETURNS [viewer: Viewer] ; Visible: PROC[viewer: Viewer] RETURNS[BOOLEAN] ; InstallClientContext: PROC [viewer: Viewer, context: Imager.Context] = INLINE {viewer.clientContext _ TRUE; AddProp[viewer, $ViewerClientContext, context]} ; AddProp: PROC [viewer: Viewer, prop: ATOM, val: REF ANY] = INLINE {viewer.props _ Atom.PutPropOnList[viewer.props, prop, val]} ; FetchProp: PROC [viewer: Viewer, prop: ATOM] RETURNS [val: REF ANY] = INLINE {RETURN[Atom.GetPropFromList[viewer.props, prop]]} ; UserToScreenCoords: PROC [self: Viewer, vx, vy: INTEGER _ 0] RETURNS [sx, sy: INTEGER] ; MouseInViewer: PROC [tsc: TIPUser.TIPScreenCoords] RETURNS [viewer: Viewer, client: BOOL] ; Top2Bottom: PROC [v: Viewer, y: INTEGER] RETURNS [INTEGER] = INLINE {RETURN[v.ch - y]}; Bottom2Top: PROC [v: Viewer, y: INTEGER] RETURNS [INTEGER] = INLINE {RETURN[Top2Bottom[v, y]]}; SetMenu: PROC [viewer: Viewer, menu: Menus.Menu _ NIL, paint: BOOL _ TRUE] ; SetNewVersion: PROC [viewer: Viewer] = INLINE {IF ~(viewer.newVersion OR viewer.newFile) THEN IndicateNewVersion[viewer]}; IndicateNewVersion: PRIVATE PROC [viewer: Viewer] ; SetNewFile: PROC [viewer: Viewer] ; SetOpenHeight: PROC [viewer: Viewer, clientHeight: INTEGER] ; EstablishViewerPosition: PROC [viewer: Viewer, x,y,w,h: INTEGER] ; ComputeColumn: PROC [column: Column, paint: BOOL _ TRUE] ; ViewerColumn: PROC [viewer: Viewer] RETURNS [column: Column] = INLINE {RETURN[IF viewer.iconic THEN static ELSE viewer.column]}; SaveAllEdits: PROC ; MoveBoundary: PROC [newLeftWidth: INTEGER _ openLeftWidth, newBottomY: INTEGER _ openBottomY] ; PaintEverything: PROC ; BlinkIcon: PROC [viewer: Viewer, count: NAT _ 1, interval: NAT _ 2000] ; DisablePainting: PRIVATE PROC [wait: BOOL _ TRUE] ; EnablePainting: PRIVATE PROC ; WaitForPaintingToFinish: PRIVATE PROC ; ResetPaintCache: PRIVATE PROC [viewer: Viewer _ NIL, wait: BOOL _ TRUE] ; InitialiseColorPainting: PRIVATE PROC ; InvertForMenus: PRIVATE PROC [viewer: Viewer, x,y: INTEGER, w,h: INTEGER] ; GreyScreen: PRIVATE PROC [x,y,w,h: INTEGER, color, icon: BOOL, stipple: REF CARDINAL _ NIL] ; AcquireContext: PRIVATE PROC [viewer: Viewer, color: BOOL _ FALSE] RETURNS [allocated: Imager.Context] ; InvisiblePaint: SIGNAL ; ReleaseContext: PRIVATE PROC [free: Imager.Context] ; END. bViewerOps.mesa; Written by S. McGregor Edited by McGregor on July 26, 1983 9:58 am Last Edited by: Maxwell, January 13, 1983 2:46 pm Let the Viewers package know about a new class of viewer. Class information from an existing viewer class. Create a new viewer instance. Caller may set selected fields in info. If parent # NIL then the new viewer will be recursively embedded in the parent. Do not directly set the following ViewerRec fields (they are either computed or private): cx, cy, cw, ch, visible, destroyed, unUsed, link, position, sibling, child, props Open an icon. If closeOthers then other viewers in that column will first be closed. If bottom then the newly opened icon will be placed at the bottom of the column, otherwise at the top. If paint is FALSE then the caller has the responsibility to repaint the column via ComputeColumn. Make iconic. Close all other viewers in the column. Assumes viewer is not iconic. Move viewer to top of column. Move viewer to bottom of column. Move the altered viewer above the static viewer in the column. Move the altered viewer below the static viewer in the column. Only meaningful on static or embedded viewers. Destroy viewer and subordinate children chain. Suggests that the window package repaint the contents of a viewer. The whatChanged field is simply passed through to the client. Note that there is no guarantee that the client's paintProc will actually be called; the viewer could be iconic or currently invisible. The hint is an accelerator that enables repaint of selective regions of a viewer, as listed in the table below. all client & menu & caption & borders & children client client (& children if clearClient) menu menu portion of header (clearClient ignored) caption caption portion of header (clearClient ignored) Mouse and keyboard TIP notifications. Set the contents of a viewer. Get the contents of a viewer. Save viewer data to file. Restore viewer data from original file. Replace a current viewer with a new one. (This proc is intended for wizards). The old viewer is destroyed. The new one should not yet be painted. Swap positions of an icon and an open viewer. Move viewer to another column. Enumerate all top level viewers. Enumerate all children bottom up. Return false to terminate enumeration. Locate an instance of a named viewer. is the viewer visible on the screen? Associate a context with a viewer Associate a property with a viewer Get back a property associated with a viewer Maps viewer-relative coords to screen-relative coords. Maps screen-relative coords to viewer and viewer-relative coords. Returns coord relative to top given coord relative to bottom of viewer Returns coord relative to bottom given coord relative to top of viewer Change a viewer menu. Marks a viewer as a new version of the file Marks a viewer as a new file Set a hint for the WMgr. Should be called from InitProc or when viewer is iconic, otherwise call ComputeColumn to reflect new size on the screen. Recomputes client info when changing "scrollable", menu, size, etc. This proc is intended for wizards. Recompute viewer sizes in a column. Useful after calling SetOpenHeight[] on an open viewer. Lives in ViewerOpsImpl. Call this from the debugger if you crash and want a "poor man's" crash recovery. Calls the SaveProc of all viewers that have the NewVersion bit set. Catches all signals and attempts to press on. Change the position of the vertical separator bar that controls the width of the right and left documents. This interface is intended for wizards. Repaint the entire screen. Blinks (inverts twice) a viewer. If count # 1, wait interval millseconds between blinks. If count = 0, blink until the icon is opened or another icon is selected. Private window management stuff; no user serviceable parts below. Blocks further painting attempts and returns when all is quiet. Enables painting to begin again. Returns when all is quiet. Internal monitored reset of context caches; NIL => flush all cached contexts. Enables viewer operations on the color display. See WindowManager.StartColorViewers for client callable interface. Back door for menus to invert screen areas faster than normal paint mechanism Grey an arbitrary rectangle on the black&white or color display. Allocate and configure a cached context. May raise InvisiblePaint in which case the client must UNWIND, then give up or retry. Release a context back to the cache. Κη– "cedar" style˜JšΟc&™&Jš+™+J™1J™šΟk ˜ Jšœžœ"˜,Jšœžœ ˜Jšœžœ˜Jšœžœžœ˜Jšœžœ˜ Jšœžœ8˜KJšœ žœ˜/J˜—Jšœ žœžœžœ˜MJ˜Jšžœžœ˜&J˜šΟnœžœ,˜EJš9™9J˜—šŸœžœžœ˜DJš0™0J˜—šŸ œžœ5žœžœ˜SJšžœ˜JšΕ™ΕJ˜—š Ÿœžœžœžœ žœžœ˜MJšœžœžœ˜Jš ™ J˜—šŸ œžœžœžœ˜8Jš ™ J˜—šŸ œžœžœžœ˜7JšE™EJ˜—šŸ œžœžœžœ˜6Jš™J˜—šŸ œžœžœžœ˜9Jš ™ J˜—šŸœžœ"žœžœ˜EJš>™>J˜—šŸœžœ"žœžœ˜EJš>™>J˜—Jš Ÿ œžœžœžœžœ˜WJ˜š Ÿ œžœžœžœ žœžœ˜UJš.™.J˜—šŸ œžœžœžœ˜:Jš.™.J˜—šŸ œžœ0žœžœ˜MJšœ žœžœžœ˜JšŠ™ŠJšo™oJš2™2Jš*™*Jš2™2Jš7™7J˜—Jšœ žœ#˜2J˜š Ÿ œžœžœžœžœžœž˜DJšœžœžœžœ&˜FJš%™%J˜—šŸ œžœžœžœ žœžœžœžœ˜XJšžœžœžœžœ0˜TJš™J˜—šŸ œžœžœžœžœžœžœž˜QJš œžœžœžœžœžœžœ˜NJš™J˜—šŸ œžœ˜#Jš™J˜—šŸ œžœ˜&Jš'™'J˜—šŸ œžœ˜(Jš”™”J˜—šŸœžœ#žœžœ˜HJš-™-J˜—šŸ œžœ&˜8Jš™J˜—šŸœžœ˜)Jš ™ J˜—šŸœžœ#˜:Jš!™!J˜š Ÿœžœžœ žœžœžœ˜9Jš&™&J˜——šŸ œžœ žœžœ˜=Jš%™%J™—šŸœžœžœžœ˜0Jšœ$™$J˜—šŸœžœ-ž˜MJšœžœ3˜OJš!™!J˜—š Ÿœžœžœžœžœž˜AJ˜>Jš"™"J˜—š Ÿ œžœžœžœžœžœž˜LJšœžœ-˜4Jš,™,J˜—š Ÿœžœžœžœ žœ˜XJš6™6J˜—šŸ œžœ žœžœ˜[JšA™AJ˜—š Ÿ œžœžœžœžœž˜CJšœžœ ˜JšF™FJ˜—š Ÿ œžœžœžœžœž˜CJšœžœ˜JšF™FJ˜—š Ÿœžœ%žœ žœžœ˜LJš™J˜—šŸ œžœž˜-Jšœžœžœžœ˜LJš+™+JšŸœžœžœ˜3J˜—šŸ œžœ˜#Jš™J˜—šŸ œžœ žœ˜=Jš’™’J˜—šŸœžœžœ˜BJšg™gJ˜—šŸ œžœžœžœ˜:Jš\™\J˜—šŸ œžœžœž˜EJš œžœžœžœžœ˜:J˜—šŸ œžœ˜Jšέ™έJ˜—šŸ œžœžœ˜:Jšœ žœ˜$Jš“™“J˜—šŸœžœ˜Jš™J˜—šŸ œžœžœžœ ˜HJš ™ Jšœ7™9JšI™IJ˜J˜—JšA™AJ˜š Ÿœžœžœžœžœ˜3Jš?™?J˜—šŸœžœžœ˜Jš ™ J˜—šŸœžœžœ˜'Jš™J˜—š Ÿœžœžœžœžœžœ˜IJšM™MJ˜—šŸœžœžœ˜'Jšs™sJ˜—š Ÿœžœžœžœžœ˜KJšM™MJ˜—šŸ œžœžœ žœžœ žœžœžœ˜]Jš@™@J˜—š Ÿœžœžœžœžœ˜BJšžœ˜%Jš™Jšœžœ˜J˜—šŸœžœžœ˜5Jš$™$J˜—Jšžœ˜J˜J˜—…—Œ,Υ