ExpandAbut: CDDirectory.AnotherProc
-- [me: CD.Object, from: CD.Design, to: CD.Design] RETURNS [CD.Object] -- = {
pos: CD.Position ← [0, 0];
equivalentCell: CD.Object;
IF to=
NIL
THEN {
ref: REF ← CDProperties.GetPropFromObject[me, $AbutCache];
IF ref#NIL THEN RETURN [NARROW [ref]];
};
equivalentCell ← CDCells.CreateEmptyCell[];
FOR list:
LIST
OF
CD.Object ← GetAbutSubObjects[me], list.rest
WHILE list#
NIL
DO
[] ← CDCells.IncludeOb[design: NIL, cell: equivalentCell, ob: list.first, position: pos, cellCSystem: originCoords, obCSystem: interrestCoords, mode: dontPropagate];
SELECT me.class
FROM
abutXClass => pos.x ← pos.x + CDBasics.SizeOfRect[CD.InterestRect[list.first]].x;
abutYClass => pos.y ← pos.y + CDBasics.SizeOfRect[CD.InterestRect[list.first]].y;
ENDCASE => ERROR;
ENDLOOP;
[] ← CDCells.RepositionCell[equivalentCell, NIL];
IF to#
NIL
THEN [] ← CDDirectory.Include[to, equivalentCell, Rope.Cat[CDDirectory.Name[equivalentCell], "-AbutEquivalent"]]
ELSE CDProperties.PutPropOnObject[me, $AbutCache, equivalentCell];
RETURN [equivalentCell];
};