CDVCursorImpl.mesa
Copyright © 1984 by Xerox Corporation. All rights reserved.
by Christian Jacobi, September 6, 1984 9:29:18 am PDT
last edited by Christian Jacobi, March 20, 1986 3:31:23 pm PST
DIRECTORY
CD,
CDVPrivate,
RuntimeError,
ViewerClasses;
CDVCursorImpl: CEDAR MONITOR
IMPORTS CD, CDVPrivate, RuntimeError
EXPORTS CDVPrivate =
BEGIN
VRef: TYPE = CDVPrivate.VRef;
CursorRec: TYPE = RECORD [mode: REF, doit: CDVPrivate.CursorModeProc];
CursorList: TYPE = LIST OF CursorRec;
cursorList: CursorList ← LIST[CursorRec[mode: NIL, doit: UseDefaultCursor]];
--never NIL; used by ImplementACursor
ImplementACursor: PUBLIC ENTRY PROC[mode: ATOM, proc: CDVPrivate.CursorModeProc] =
BEGIN
--invert the order: efficiency hack: the first installed cursor is found the fastest
--cursorList is never NIL
IF proc=NIL THEN RETURN WITH ERROR CD.Error[];
FOR list: CursorList ← cursorList, list.rest DO
IF list.first.mode=mode THEN {list.first.doit ← proc; EXIT}
ELSE IF list.rest=NIL THEN {list.rest ← LIST[CursorRec[mode: mode, doit: proc]]; EXIT}
ENDLOOP
END;
SetCursorMode: PUBLIC PROC[me: VRef, mode: REF] =
BEGIN
ENABLE RuntimeError.UNCAUGHT => {
IF CDVPrivate.ShallContinue[me, TRUE, "CDVCursorImpl.SCM"] THEN GOTO oops;
};
FOR list: CursorList ← cursorList, list.rest WHILE list#NIL DO
IF list.first.mode=mode THEN {
list.first.doit[me, mode];
RETURN
}
ENDLOOP;
--error catch; cursorList is never NIL
cursorList.first.doit[me, NIL];
EXITS oops => NULL;
END;
DefaultOutLine: PUBLIC PROC[me: VRef] =
BEGIN
END;
UseDefaultCursor: CDVPrivate.CursorModeProc = {
me.designRec.outlineProcLC ← DefaultOutLine
};
END.