GGContainerImpl.mesa
Last edited by Bier on June 21, 1985 2:44:54 pm PDT
Copyright © 1985 by Xerox Corporation. All rights reserved.
Created on June 5, 1985 11:16:46 pm PDT
A container-type class for Gargoyle.
DIRECTORY
GGModelTypes,
Icons,
GGInterfaceTypes,
ViewerClasses,
ViewerOps;
GGContainerImpl: CEDAR PROGRAM
IMPORTS ViewerOps
SHARES ViewerOps =
BEGIN OPEN ViewerClasses;
Point: TYPE = GGModelTypes.Point;
GargoyleData: TYPE = GGInterfaceTypes.GargoyleData;
GargoyleContainerPaint: PRIVATE PaintProc = CHECKED {
gargoyleData: GargoyleData ← NARROW[self.data];
v: Viewer;
update: BOOLFALSE;
hdiff, wdiff: INTEGER;
FOR l: LIST OF Viewer ← gargoyleData.xBounded, l.rest UNTIL l=NIL DO
v ← l.first;
IF v.destroyed THEN {update ← TRUE; LOOP};
wdiff ← v.ww-v.cw;
v.ww ← MAX[v.parent.cw-v.wx-1, 5];
v.cw ← v.ww-wdiff;
ENDLOOP;
FOR l: LIST OF Viewer ← gargoyleData.yBounded, l.rest UNTIL l=NIL DO
v ← l.first;
IF v.destroyed THEN {update ← TRUE; LOOP};
hdiff ← v.wh-v.ch;
v.wh ← MAX[v.parent.ch-v.wy-1, 5];
v.ch ← v.wh-hdiff;
ENDLOOP;
IF gargoyleData.xBounded#NIL OR gargoyleData.yBounded#NIL
THEN ViewerOps.ResetPaintCache[self, FALSE];
IF update THEN {
oldx: LIST OF Viewer ← gargoyleData.xBounded;
oldy: LIST OF Viewer ← gargoyleData.yBounded;
gargoyleData.xBounded ← gargoyleData.yBounded ← NIL;
FOR l: LIST OF Viewer ← oldx, l.rest UNTIL l=NIL DO
IF ~l.first.destroyed
THEN gargoyleData.xBounded ← CONS[l.first, gargoyleData.xBounded];
ENDLOOP;
FOR l: LIST OF Viewer ← oldy, l.rest UNTIL l=NIL DO
IF ~l.first.destroyed
THEN gargoyleData.yBounded ← CONS[l.first, gargoyleData.yBounded];
ENDLOOP;
};
};
GargoyleContainerDestroy: PRIVATE DestroyProc = CHECKED {
};
GargoyleContainerSet: PRIVATE SetProc = CHECKED {
Add a constrained child to the list.
gargoyleData: GargoyleData ← NARROW[self.data];
child: Viewer = NARROW[data];
IF child.parent#self THEN ERROR;
IF op=$YBound THEN gargoyleData.yBounded ← CONS[child, gargoyleData.yBounded]
ELSE IF op=$XBound THEN gargoyleData.xBounded ← CONS[child, gargoyleData.xBounded]
ELSE ERROR;
};
GargoyleContainerInit: PRIVATE InitProc = CHECKED {};
gargoyleContainerClass: ViewerClasses.ViewerClass ← NEW[ViewerClasses.ViewerClassRec ← [
init: GargoyleContainerInit,
paint: GargoyleContainerPaint,
destroy: GargoyleContainerDestroy,
set: GargoyleContainerSet,
topDownCoordSys: TRUE
icon: Icons.NewIconFromFile["SolidViews.icons", 0]
]];
ViewerOps.RegisterViewerClass[$GargoyleContainer, gargoyleContainerClass]; -- plug in to Viewers
END.