-- TJaMGraphicsContexts.mesa
-- Last edit by Stone, March 18, 1983 6:05 pm
--for clients who want to use alternate contexts in TJaMGraphics

DIRECTORY
JaMInternal USING [Frame],
Graphics USING [Context];

TJaMGraphicsContexts: DEFINITIONS = {

Frame: TYPE = JaMInternal.Frame;

DCList: TYPE = REF DCRec;
DCRec: TYPE = RECORD [next: DCList, init: PROC RETURNS[Graphics.Context],
 dc: Graphics.Context, enabled, initOnErase: BOOLEAN, name: ATOM];
GProc: TYPE = PROC [dc: Graphics.Context];

ForAllDCs
: PROC [list: DCList, proc: GProc];

--replaces Establish and ForgetNonViewerContext. Pick any name ie: $PD.
--if a context with the name already exists for that frame, AddContext will replace
--the old context with the new one.
--the proc init will be called initially and each time .initdc is called.
--initOnErase calls init if .erase is called
--you must Enable the context to cause things to be displayed in it.
--do not pass a viewer context in here!!
AddContext: PROC [frame: Frame, init: PROC RETURNS[Graphics.Context], name: ATOM, enabled, initOnErase: BOOLEAN ← TRUE];
RemoveContext: PROC [frame: Frame, name: ATOM] RETURNS [context: Graphics.Context];

--turns display to context on and off
.
EnableContext: PROC [frame: Frame, name: ATOM];
DisableContext: PROC [frame: Frame, name: ATOM];
EnableViewer: PROC [frame: Frame];
DisableViewer: PROC [frame: Frame];

NotFound: SIGNAL; --raised by RemoveContext, EnableContext and DisableContext
}.