ViewersWorldClasses.mesa
Copyright Ó 1990, 1991, 1992 by Xerox Corporation. All rights reserved.
Bier, August 13, 1990 3:37 pm PDT
Willie-s, May 31, 1991 10:06 am PDT
Michael Plass, February 25, 1992 12:27 pm PST
Christian Jacobi, March 4, 1992 4:38 pm PST
Contents: Defines those routines needed to implement a new class of ViewersWorld. Existing classes include RawViewers and X11Viewers. These types were previously in ViewersWorldTypes, but were moved here because ViewersWorldTypes contains private (concrete) types, whereas the classes are public.
Last tweaked by Mike Spreitzer March 26, 1992 4:14 pm PST
ViewersWorldClasses:
CEDAR
DEFINITIONS =
BEGIN
CursorArray: TYPE = CursorTypes.CursorArray;
Cursor32Array: TYPE ~ CursorTypes.Cursor32Array;
Cursor32ArrayRef: TYPE ~ CursorTypes.Cursor32ArrayRef;
Ref: TYPE = ViewersWorldRefType.Ref;
ViewersWorldClass: TYPE = REF ViewersWorldClassObj;
ViewersWorldClassObj:
TYPE =
RECORD [
setCursorPattern: SetCursorPatternProc,
getCursorPattern: GetCursorPatternProc,
setBigCursorPattern: SetBigCursorPatternProc,
getBigCursorPattern: GetBigCursorPatternProc,
isBigCursorPattern: IsBigCursorPatternProc,
bigCursorsSupported: BigCursorsSupportedProc,
setCursorColor: SetCursorColorProc,
getCursorColor: GetCursorColorProc,
setMousePosition: SetMousePositionProc,
getMousePosition: GetMousePositionProc,
setCutBuffer: SetCutBufferProc,
getCutBuffer: GetCutBufferProc,
blink: BlinkProc,
getDeviceSize: GetDeviceSizeProc,
creator: ViewerScreenTypes.ContextCreatorProc,
allocateColorMapIndex: AllocateColorMapIndexProc,
freeColorMapIndex: FreeColorMapIndexProc,
setColorMapEntry: SetColorMapEntryProc,
getColorMapEntry: GetColorMapEntryProc,
properties: Atom.PropList ¬ NIL
];
SetCursorPatternProc:
TYPE =
PROC [screenServerData:
REF, deltaX, deltaY:
INTEGER, cursorPattern: CursorArray, patternName:
ATOM ¬ $Unnamed, cursor:
REF ¬
NIL];
"cursor" will be a description of which cursor's pattern to change. If cursor = NIL, the default mouse cursor is intended. [deltaX, deltaY] is the vector displacement of the lower left hand corner to the pattern from the true mouse position. Usually, these numbers will be zero or negative (see global.info in CursorsImpl.SetCursor for examples). patternName is a hint to the class implementor. It should either be $Unnamed, or it should be a distinct name for each distinct pattern -- this allows the server to tell that it has seen this pattern before without actually looking at the bits.
GetCursorPatternProc:
TYPE =
PROC [screenServerData:
REF, cursor:
REF ¬
NIL]
RETURNS [deltaX, deltaY:
INTEGER, cursorPattern: CursorArray, patternName:
ATOM];
"cursor" will be a description of which cursor's pattern to get. If cursor = NIL, the default mouse cursor is intended. [deltaX, deltaY] is the vector displacement of the lower left hand corner to the pattern from the true mouse position. Usually, these numbers will be zero or negative (see global.info in CursorsImpl.SetCursor for examples). patternName should be the same name provided to the SetCursorPatternProc or $Unnamed if the pattern did not originate from a ViewersWorld (or if the name has been forgotten).
SetBigCursorPatternProc: TYPE = PROC [screenServerData: REF, deltaX, deltaY: INTEGER, cursorPattern: Cursor32ArrayRef, patternName: ATOM ¬ $Unnamed, cursor: REF ¬ NIL];
GetBigCursorPatternProc: TYPE = PROC [screenServerData: REF, cursor: REF ¬ NIL] RETURNS [deltaX, deltaY: INTEGER, cursorPattern: Cursor32ArrayRef, patternName: ATOM];
IsBigCursorPatternProc:
TYPE =
PROC [screenServerData:
REF, cursor:
REF ¬
NIL]
RETURNS [
BOOL];
Returns TRUE if cursor is currently a 32 by 32 bit (instead of 16 by 16 bit) pattern.
BigCursorsSupportedProc: TYPE = PROC [screenServerData: REF] RETURNS [BOOL];
SetCursorColorProc:
TYPE =
PROC [screenServerData:
REF, color: Imager.Color, cursor:
REF ¬
NIL];
The 1-bits of the cursor will take on the new color. The 0-bits are transparent. For now, color should be a constant color. "cursor" describes which cursor to recolor. If cursor = NIL, the default mouse cursor is intended.
GetCursorColorProc:
TYPE =
PROC [screenServerData:
REF, cursor:
REF ¬
NIL]
RETURNS [color: Imager.Color];
"cursor" describes which cursor's color to return. If cursor = NIL, the default mouse cursor is intended.
SetMousePositionProc:
TYPE =
PROC [screenServerData:
REF, x, y:
INTEGER, display:
REF ¬
NIL, device:
REF ¬
NIL];
Changes the hardware interpretation of the given device's position. "screen" describes which display it is on. The pointing device may be a mouse, a pen, or something else. If device = NIL, the default mouse is intended.
GetMousePositionProc:
TYPE =
PROC [screenServerData:
REF, device:
REF ¬
NIL]
RETURNS [x, y:
INTEGER, display:
REF ¬
NIL];
Returns the screen and coordinates on that screen of the given pointing device. "device" describes which pointing device's position to return. In fact, the pointing device may be a mouse, a pen, or something else. If device = NIL, the default mouse cursor is intended.
SetCutBufferProc:
TYPE =
PROC [screenServerData:
REF, buffer:
ATOM, data: Rope.
ROPE];
Pushes data into a cut buffer.
GetCutBufferProc:
TYPE =
PROC [screenServerData:
REF, buffer:
ATOM]
RETURNS [data: Rope.
ROPE];
Gets data from cut buffer.
Might or might not flush the contents of the cut buffer.
For buffer = $Ascii data is Ascii string
For buffer = $Tioga data is Tioga formatted node
For buffer = $xterm data is Ascii string. However, the X window implementation will use the cut buffer in a non-standard way which is more compatible with the xterm program.
For unknown buffer atoms procedures might fail but must not crash.
Data of different types might or might not use different cut buffers.
BlinkProc:
TYPE =
PROC [screenServerData:
REF, display:
REF ¬
NIL, frequency:
CARDINAL ¬ 750, duration:
CARDINAL ¬ 500];
Get user's attention. Might flash "screen" or beep. If the beep technique is used, frequency (in Hz.) and duration (in milliseconds) are used. If no feedback is available, does nothing.
GetDeviceSizeProc:
TYPE =
PROC [screenServerData:
REF, display:
REF ¬
NIL]
RETURNS [w, h:
NAT];
Gets from the ViewersWorld class the width and height of the named screen. Screens are refered to by number. The main screen is screen 0.
AllocateColorMapIndexProc:
TYPE =
PROC [screenServerData:
REF, display:
REF ¬
NIL, revokeIndex: RevokeColorMapIndexProc, clientData:
REF ¬
NIL]
RETURNS [index:
CARDINAL];
Returns a colormap index (e.g. a number from 0 to 255 for 8-bit color maps) that the ViewersWorld can use to do color map animation. Any object drawn by placing this index in the frame buffer can be color changed by modifying the color map for that index. This index can be revoked by class implementor (e.g., if an X window is moved to a different display with a different color map). If this occurs, ViewersWorld.RevokeColorMapIndex will be called.
RevokeColorMapIndexProc:
TYPE = ViewersWorld.RevokeColorMapIndexProc;
Called by the screen server when it can no longer guarantee that this color map index won't be mapped by other applications. clientData is the same value that was passed as clientData to AllocateColorMapIndex.
FreeColorMapIndexProc:
TYPE =
PROC [screenServerData:
REF, index:
CARDINAL, display:
REF ¬
NIL];
Gives up the right to draw objects with this index. It can then be allocated to other applications.
SetColorMapEntryProc:
TYPE =
PROC [screenServerData:
REF, index:
CARDINAL, display:
REF ¬
NIL, red, green, blue:
INTEGER];
red, green, blue should be between 0 and 255. They should not be gamma-corrected.
GetColorMapEntryProc:
TYPE =
PROC [screenServerData:
REF, index:
CARDINAL, display:
REF ¬
NIL]
RETURNS [red, green, blue:
INTEGER];
red, green, blue should be between 0 and 255. They should not be gamma-corrected.
CreateViewersWorld: PROC [class: ViewersWorldClass, mapping: KeyMappingTypes.Mapping ¬ NIL, screenServerData: REF ¬ NIL] RETURNS [viewersWorld: Ref];
GetClassProp: PROC [class: ViewersWorldClass, prop: REF] RETURNS [val: REF];
PutClassProp: PROC [class: ViewersWorldClass, prop: REF, val: REF];
RemClassProp: PROC [class: ViewersWorldClass, prop: REF];