ColorDisplayManager.mesa
Contents: completely stubbed out ColorDisplayManager interface for PCedar.
Copyright Ó 1988, 1991 by Xerox Corporation. All rights reserved.
Pier, November 21, 1988 5:51:54 pm PST
ColorDisplayManager:
CEDAR
DEFINITIONS ~
BEGIN
ROPE: TYPE ~ Rope.ROPE;
Side: TYPE ~ {left, right};
Resolution:
TYPE ~ {
none, -- no color display
standard, -- standard resolution display, approx. 640 by 480 pixels
highResolution -- high resolution display, approx. 1024 by 768 pixels
};
Level: TYPE ~ {off, allocated, visible, mouse, viewers};
Error:
ERROR [explanation:
ROPE];
Raised when unable to start in the requested mode.
Turning the color display on and off
Start:
PROC [type:
ATOM, side: Side, level: Level ¬ viewers, resolution: Resolution ¬ none];
Turns on the color display and optionally enables viewers to be displayed there; resolution~none leaves actual resolution unchanged.
Stop:
PROC;
Moves all color viewers to the b&w display and shuts down the color display.
Registering new kinds of color contexts
ColorContextCreator: TYPE ~ REF ColorContextCreatorRep;
ColorContextCreatorRep:
TYPE ~
RECORD [
documentation: ROPE,
init: InitProc, create: CreateProc, data: REF
];
InitProc:
TYPE ~
PROC [self: ColorContextCreator, vt: Virtual];
Should set color display in the correct mode, initialize color maps, etc.
If unable to initialize, should raise Error, above.
CreateProc:
TYPE ~
PROC [self: ColorContextCreator, vt: Virtual]
RETURNS [Imager.Context];
Should create a new Context for the color display; this is expected to always succeed if the corresponding InitProc succeeded.
RegisterCreator:
PROC [type:
ATOM, creator: ColorContextCreator];
Registers a ColorContextCreator. Use creator=NIL to unregister.
Refer to documentation on CedarChest for information about packages that register creators
FetchCreator:
PROC [type:
ATOM]
RETURNS [ColorContextCreator];
Fetches a registered creator; returns NIL if not found.
GetContext:
PROC
RETURNS [Imager.Context];
Returns a context for the color display, or NIL if the color display is not enabled
State information
State: TYPE ~ REF StateRep;
StateRep:
TYPE ~
RECORD [type:
ATOM, side: Side, level: Level, resolution: Resolution, registered:
LIST
OF
ATOM, next: State];
type is the current creator type, or NIL if the color display is not enabled
registered is a list of the currently registered types; refer to documentation on CedarChest for information about packages that register
NextState:
PROC [old: State ¬
NIL]
RETURNS [State];
This is for clients that need to keep up-to-date on the current state of the color display, for example a color display tool. If old=NIL, this returns immediately with the current state description; otherwise it waits until the state changes before returning.
CallWhileCurrentStateLocked:
PROC [action:
PROC [current: State]];
For the duration of the call to action, current is guaranteed to be the current State.
Note that calls from beneath action to any other procedures in this interface may cause the monitor to hang.