Compiler Refresh/n
m.stone January 29, 1981 4:45 PM
Last Edited by: Stone, July 5, 1985 1:54:31 pm PDT
DIRECTORY
GriffinDefs: FROM "GriffinDefs",
ObjectDefs: FROM "ObjectDefs",
GriffinDisplay: FROM "GriffinDisplay",
PointDefs: FROM "PointDefs",
RefreshDefs: FROM "RefreshDefs",
GriffinViewer USING [PaintProc, DoPaint],
GriffinMemoryDefs USING [CZone];
Refresh: CEDAR PROGRAM
IMPORTS ObjectDefs,GriffinDisplay,GriffinMemoryDefs, GriffinViewer
EXPORTS RefreshDefs =
BEGIN OPEN ObjectDefs,PointDefs,GriffinMemoryDefs;
Frame: TYPE = REF FrameType;
FrameType: TYPE = RECORD [
tl,br: ScrPt,
obj: ObjectHandle];
FrameList: LIST OF Frame ← NIL;
EraseAndSave: PUBLIC PROCEDURE[obj: ObjectHandle]=
BEGIN
tl,br: ScrPt;
IF obj=NIL THEN RETURN;
[tl,br] ← BoxFromObject[obj];
EraseAndSaveBox[tl,br];
END;
EraseAndSaveBox: PUBLIC PROCEDURE[tl,br: ScrPt]=
BEGIN
paint: GriffinViewer.PaintProc = {
GriffinDisplay.EraseBox[tl,br, dc];
};
AddFrame[tl,br, NIL];
GriffinViewer.DoPaint[paint]; --do it in a paint proc
END;
MarkObject: PUBLIC PROCEDURE[obj: ObjectHandle]=
BEGIN
newframe: Frame ← NIL;
tl, br: ScrPt;
IF obj=NIL THEN RETURN;
[tl,br] ← BoxFromObject[obj];
AddFrame[tl,br,obj];
END;
MarkBox: PUBLIC PROCEDURE[tl,br: ScrPt]=
BEGIN
AddFrame[tl,br, NIL];
END;
BoxFromObject: PROCEDURE[obj: ObjectHandle] RETURNS[tl, br: ScrPt]=
BEGIN
IF obj=NIL THEN ERROR;
tl ← obj.tl;
br ← obj.br;
RETURN[tl,br];
END;
EraseAndSaveAllCPs: PUBLIC PROCEDURE=
BEGIN
EraseCPs: ObjectDefs.ObjectProc = TRUSTED BEGIN
WITH token: obj SELECT FROM
token=> IF token.tokenType=CP OR token.tokenType=open THEN EraseAndSave[obj];
ENDCASE;
END;
ObjectDefs.ForAllVisibleObjects[EraseCPs];
END;
AddFrame: PROCEDURE[tl,br: ScrPt, obj: ObjectHandle]=
BEGIN
newframe: Frame ← CZone.NEW[FrameType ← [tl, br, obj]];
FrameList ← CONS[newframe, FrameList];
END;
RestoreScreen: PUBLIC PROCEDURE=
BEGIN
new: LIST OF Frame ← NIL;
paint: GriffinViewer.PaintProc = {
FOR f: LIST OF Frame ← new, f.rest UNTIL f=NIL DO
frame: Frame ← f.first;
IF frame.obj=NIL THEN ReplotBox[frame.tl,frame.br, dc]
ELSE ReplotBoxFromObject[frame.tl,frame.br,frame.obj, dc];
ENDLOOP;
};
IF FrameList=NIL THEN RETURN;
Reverse the list
FOR f: LIST OF Frame ← FrameList, f.rest UNTIL f=NIL DO
new ← CONS[f.first, new];
ENDLOOP;
GriffinViewer.DoPaint[paint]; --do it in a paint proc
FrameList ← NIL;
END;
END.