MultiCursors.mesa
Copyright Ó 1990, 1991, 1992 by Xerox Corporation. All rights reserved.
Bier, August 13, 1990 3:42 pm PDT
Willie-s, May 31, 1991 10:11 am PDT
Michael Plass, February 25, 1992 12:27 pm PST
Christian Jacobi, March 3, 1992 2:17 pm PST
Contents: Routines to extend Viewers to handle multiple cursors and large cursors
DIRECTORY
CursorTypes, Imager, ViewerClasses, ViewersWorldRefType;
MultiCursors: CEDAR DEFINITIONS = BEGIN
CursorArray: TYPE ~ CursorTypes.CursorArray;
CursorType: TYPE ~ ViewerClasses.CursorType;
PredefinedCursor: TYPE ~ CursorType[activate..textPointer];
ClientCursor: TYPE ~ CursorType(textPointer..last);
CursorInfo: TYPE ~ RECORD [
type: CursorType, -- the unique cursor type
hotX: INTEGER ¬ 0, -- these define a logical "hot-spot", or "activation point" for a cursor
hotY: INTEGER ¬ 0,
inverted: BOOL ¬ FALSE
];
Cursor32Array: TYPE ~ CursorTypes.Cursor32Array;
Cursor32ArrayRef: TYPE ~ CursorTypes.Cursor32ArrayRef;
CornerSide: TYPE ~ {upperSide, lowerSide, leftSide, rightSide, upperLeft, upperRight,
lowerLeft, lowerRight};
VWorld: TYPE ~ ViewersWorldRefType.Ref;
In the routines below, if cursor = NIL, the default mouse cursor is assumed. If vWorld = NIL, the default ViewersWorld in this virtual address space is assumed.
SetACursorColor: PROC [color: Imager.Color, cursor: ATOM, vWorld: VWorld ¬ NIL];
red, green, and blue should be between 0 and 255. "cursor" describes which cursor to recolor. The values of red, green, and blue should not be gamma-corrected. The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
GetACursorColor: PROC [cursor: ATOM, vWorld: VWorld ¬ NIL] RETURNS [color: Imager.Color];
The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
InvertACursor: PROC [cursor: ATOM, vWorld: VWorld ¬ NIL];
Swap the on bits and off bits of the cursor. The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
SetACursor: PROC [type: CursorType, cursor: ATOM, vWorld: VWorld ¬ NIL];
Force bits into the cursor bitmap for the given cursor (window manager use only). The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
GetACursor: PROC [cursor: ATOM, vWorld: VWorld ¬ NIL] RETURNS [CursorType];
The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
GetACursorInfo: PROC [cursor: ATOM, vWorld: VWorld ¬ NIL] RETURNS [CursorInfo];
For info on the current appearance of the given cursor. The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
NewBigCursor: PROC [bits: Cursor32ArrayRef, hotX, hotY: INTEGER ¬ 0] RETURNS [CursorType];
To roll your own cursors; allocates a new unique value of the CursorType enumerated type.
AddACursorCorner: PROC [cornerSide: CornerSide, cursor: ATOM, vWorld: VWorld ¬ NIL];
Adds lines on top, sides, or both to current appearance of the given cursor. The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
Lower-Level Routines. Use with Care
SetACursorOffset: PROC [deltaX, deltaY: INTEGER, enableTracking: BOOL ¬ TRUE, cursor: ATOM, vWorld: VWorld ¬ NIL];
Offsets origin of cursor bitmap by the specified number of screen points. enableTracking ← FALSE to disable automatic cursor tracking. The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
GetACursorOffset: PROC [cursor: ATOM, vWorld: VWorld ¬ NIL] RETURNS [deltaX, deltaY: INTEGER, trackingEnabled: BOOL];
The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
SetACursorPosition: PROC [posX, posY: INTEGER, enableTracking: BOOL ¬ TRUE, cursor: ATOM, vWorld: VWorld ¬ NIL];
Sets the cursor position directly to the desired value (useful for cursor gridding). enableTracking ← FALSE to disable automatic cursor tracking. Position may not be in synch with UserInput fetches. The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
GetACursorPosition: PROC [cursor: ATOM, vWorld: VWorld ¬ NIL] RETURNS [deltaX, deltaY: INTEGER, trackingEnabled: BOOL];
Returns the current cursor position. Position may not be in synch with UserInput fetches. The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
SetAMousePosition: PROC [x, y: INTEGER, display: REF ¬ NIL, cursor: ATOM, vWorld: VWorld ¬ NIL];
Modifies hardware interpretation of mouse position; to be used at own peril!! This is possibly useful for locking mouse into nearby position, etc. "screen" describes which display the mouse is on. The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
GetAMousePosition: PROC [cursor: ATOM, vWorld: VWorld ¬ NIL] RETURNS [x, y: INTEGER, display: REF ¬ NIL];
Returns the current position, may be out of synch with UserInput fetches!! The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
Recording grain hints. This are provided by higher levels at the time those levels are created. Subsequent recorded events will be entered at the specified grain. Unless the higher levels are running in more or less real time, these hints will not be too valuable.
NewCursor: PROC [bits: CursorArray, hotX, hotY: INTEGER ¬ 0] RETURNS [CursorType];
To roll your own cursors; allocates a new unique type
DefaultMouseGrain: PROC RETURNS [ticks: CARD16, dots: INTEGER];
SetAMouseGrain: PROC [ticks: CARD16, dots: INTEGER, cursor: ATOM, vWorld: VWorld ¬ NIL];
The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
SetACursorPattern: PROC [cursorPattern: CursorArray, deltaX, deltaY: INTEGER, cursor: ATOM, vWorld: VWorld ¬ NIL];
Changes the cursor bit array and the offset of the hot spot. The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
SetABigCursorPattern: PROC [cursorPattern: Cursor32ArrayRef, deltaX, deltaY: INTEGER, cursor: ATOM, vWorld: VWorld ¬ NIL];
Changes the cursor bit array and the offset of the hot spot when the cursor is 32 by 32 bits. The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
HasBigPattern: PROC [cursor: ATOM, vWorld: VWorld ¬ NIL] RETURNS [BOOL];
The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
GetACursorPattern: PROC [cursor: ATOM, vWorld: VWorld ¬ NIL] RETURNS [cursorPattern: CursorArray, deltaX, deltaY: INTEGER];
Fetches the cursor bit array, and the offset of the hot spot. The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
GetABigCursorPattern: PROC [cursor: ATOM, vWorld: VWorld ¬ NIL] RETURNS [cursorPattern: Cursor32ArrayRef, deltaX, deltaY: INTEGER];
Fetches the cursor bit array, and the offset of the hot spot when the cursor is 32 by 32 bits. The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
SetACursorPatternOnly: PROC [cursorPattern: CursorArray, cursor: ATOM, vWorld: VWorld ¬ NIL];
Changes the cursor bit array. The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
SetABigCursorPatternOnly: PROC [cursorPattern: Cursor32ArrayRef, cursor: ATOM, vWorld: VWorld ¬ NIL];
Changes the cursor bit array when the cursor is 32 by 32 bits. The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
GetACursorPatternOnly: PROC [cursor: ATOM, vWorld: VWorld ¬ NIL] RETURNS [cursorPattern: CursorArray];
Fetches the cursor bit array. The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
GetABigCursorPatternOnly: PROC [cursor: ATOM, vWorld: VWorld ¬ NIL] RETURNS [cursorPattern: Cursor32ArrayRef];
Fetches the cursor bit array when the cursor is 32 by 32 bits. The (cursor, vWorld) pair names a particular cursor on a particular Viewers desktop.
END.