~
BEGIN
OPEN ViewerClasses;
RegisterViewerClass:
PROC [flavor: ViewerFlavor, class: ViewerClass];
Let the Viewers package know about a new class of viewer.
FetchViewerClass:
PROC [flavor: ViewerFlavor]
RETURNS [ViewerClass];
Class information from an existing viewer class.
CreateViewer:
PROC [flavor: ViewerFlavor, info: ViewerRec ← [], paint:
BOOL ←
TRUE]
RETURNS [new: Viewer];
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
OpenIcon:
PROC [icon: Viewer,
closeOthers:
BOOL ←
FALSE, bottom:
BOOL ←
TRUE, paint:
BOOL ←
TRUE];
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.
CloseViewer:
PROC [viewer: Viewer, paint:
BOOL ←
TRUE];
Make iconic.
GrowViewer:
PROC [viewer: Viewer, paint:
BOOL ←
TRUE];
Close all other viewers in the column. Assumes viewer is not iconic.
TopViewer:
PROC [viewer: Viewer, paint:
BOOL ←
TRUE];
Move viewer to top of column.
BottomViewer:
PROC [viewer: Viewer, paint:
BOOL ←
TRUE];
Move viewer to bottom of column.
MoveAboveViewer:
PROC [altered, static: Viewer, paint:
BOOL ←
TRUE];
Move the altered viewer above the static viewer in the column.
MoveBelowViewer:
PROC [altered, static: Viewer, paint:
BOOL ←
TRUE];
Move the altered viewer below the static viewer in the column.
MoveViewer:
PROC [viewer: Viewer, x, y:
INTEGER, w, h:
INTEGER, paint:
BOOL ←
TRUE];
Only meaningful on static or embedded viewers.
DestroyViewer:
PROC [viewer: Viewer, paint:
BOOL ←
TRUE];
Destroy viewer and subordinate children chain.
PaintHint:
TYPE = { all, client, menu, caption };
an accelerator that enables repaint of selective regions of a viewer, as follows
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)
PaintViewer:
PROC [viewer: Viewer, hint: PaintHint,
clearClient:
BOOL ←
TRUE, whatChanged:
REF
ANY ←
NIL];
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.
NotifyViewer:
PROC [viewer: Viewer, input:
LIST
OF
REF
ANY] =
INLINE
{IF viewer.class.notify#NIL THEN viewer.class.notify[viewer, input]};
Mouse and keyboard TIP notifications.
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]};
Set the contents of a viewer.
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]};
Get the contents of a viewer.
SaveViewer:
PROC [viewer: Viewer];
Save viewer data to file.
RestoreViewer:
PROC [viewer: Viewer];
Restore viewer data from original file.
ReplaceViewer:
PROC [new, old: Viewer];
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.
SwapIconAndViewer:
PROC [icon, openViewer: Viewer, paint:
BOOL ←
TRUE];
Swap positions of an icon and an open viewer.
ChangeColumn:
PROC [viewer: Viewer, newColumn: Column];
Move viewer to another column.
EnumProc:
TYPE =
PROC [v: Viewer]
RETURNS [
BOOL ←
TRUE];
Return false to terminate enumeration.
EnumerateViewers:
PROC [enum: EnumProc];
Enumerate all top level viewers.
EnumerateChildren:
PROC [viewer: Viewer, enum: EnumProc];
Enumerate all children bottom up.
FindViewer:
PROC [name: Rope.
ROPE]
RETURNS [viewer: Viewer];
Locate an instance of a named viewer.
AddProp:
PROC [viewer: Viewer, prop:
ATOM, val:
REF
ANY];
Associate a property with a viewer
FetchProp:
PROC [viewer: Viewer, prop:
ATOM]
RETURNS [val:
REF
ANY];
Get back a property associated with a viewer
UserToScreenCoords:
PROC [self: Viewer, vx, vy:
INTEGER ← 0]
RETURNS [sx, sy:
INTEGER];
Maps viewer-relative coords to screen-relative coords.
MouseInViewer:
PROC [tsc: TIPUser.TIPScreenCoords]
RETURNS [viewer: Viewer, client:
BOOL];
Maps screen-relative coords to viewer and viewer-relative coords. Note: modifies tsc^.
SetMenu:
PROC [viewer: Viewer, menu: Menus.Menu ←
NIL, paint:
BOOL ←
TRUE];
Change a viewer menu.
IndicateNewVersion:
PRIVATE
PROC [viewer: Viewer];
SetNewVersion:
PROC [viewer: Viewer]
~ INLINE {IF ~(viewer.newVersion OR viewer.newFile) THEN IndicateNewVersion[viewer]};
Marks a viewer as a new version of the file
SetNewFile:
PROC [viewer: Viewer];
Marks a viewer as a new file
SetOpenHeight:
PROC [viewer: Viewer, clientHeight:
INTEGER];
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.
EstablishViewerPosition:
PROC [viewer: Viewer, x, y, w, h:
INTEGER];
Recomputes client info when changing "scrollable", menu, size, etc. This proc is intended for wizards.
ComputeColumn:
PROC [column: Column, paint:
BOOL ←
TRUE];
Recompute viewer sizes in a column. Useful after calling SetOpenHeight[] on an open viewer.
ViewerColumn:
PROC [viewer: Viewer]
RETURNS [column: Column]
= INLINE {RETURN[IF viewer.iconic THEN static ELSE viewer.column]};
SaveAllEdits:
PROC;
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.
MoveBoundary:
PROC [newLeftWidth:
INTEGER, newBottomY:
INTEGER];
Change the position of the vertical separator bar that controls the width of the right and left documents. This interface is intended for wizards.
Adjust:
PROC [viewer: Viewer, sticky:
BOOL ←
TRUE];
interactively adjust the viewer boundaries
PaintEverything:
PROC;
Repaint the entire screen.
BlinkViewer:
PROC [viewer: Viewer, milliseconds:
NAT ← 400];
Blinks a viewer; the viewer remains inverted for the specified number of milliseconds.
BlinkIcon:
PROC [viewer: Viewer, count:
INT ← 1,
secondsBetweenBlinks:
NAT ← 2, millisecondsPerBlink:
NAT ← 400];
Forks a process to blink an icon count times (0 means forever).
The process stops blinking if the icon is opened or selected.
BlinkDisplay:
PROC;
Blinks the black-and-white display.