CDOldInterestRectsImpl.mesa
Copyright © 1984, 1985, 1986 by Xerox Corporation. All rights reserved.
Created by: Christian Jacobi, September 13, 1984 3:21:36 pm PDT
Last edited by: Christian Jacobi, September 23, 1986 4:21:17 pm PDT
DIRECTORY
CD,
CDBasics,
CDCells,
CDImports,
CDOldInterestRects,
CDIO,
CDRepetitions,
CDProperties,
TokenIO;
CDOldInterestRectsImpl: CEDAR PROGRAM
IMPORTS CD, CDBasics, CDCells, CDImports, CDIO, CDProperties, CDRepetitions, TokenIO
EXPORTS CDOldInterestRects =
BEGIN
SetInterestProc: TYPE = PROC [ob: CD.Object, r: CD.Rect];
AdjustInterest: PUBLIC PROC [h: TokenIO.Handle, ob: CD.Object] = {
IF ob.class.mutable AND CDIO.VersionKey[h]<8 THEN {
WITH CDProperties.GetObjectProp[from: ob, prop: interestRectProperty] SELECT FROM
pp: REF CD.Rect => {
IF CDBasics.NonEmpty[pp^] THEN SetInterest[ob, pp^];
CDProperties.PutProp[ob, interestRectProperty, NIL];
};
ENDCASE => NULL;
};
};
InternalReadProperty: PROC [h: TokenIO.Handle, prop: ATOM] RETURNS [val: REF] = {
x1: INT = TokenIO.ReadInt[h];
y1: INT = TokenIO.ReadInt[h];
x2: INT = TokenIO.ReadInt[h];
y2: INT = TokenIO.ReadInt[h];
val ← NEW[CD.Rect←[x1, y1, x2, y2]]
};
InsideRect: PUBLIC PROC [ob: CD.Object] RETURNS [CD.Rect] = {
WITH ob.specific SELECT FROM
cp: CD.CellSpecific => RETURN [cp.dIr];
ENDCASE => RETURN [CD.InterestRect[ob]];
???
RETURN [CD.InterestRect[ob]]
};
SetInterest: SetInterestProc = {
RepOldSetInterest: PROC [ob: CD.Object, r: CD.Rect] = {
cptr: CDRepetitions.RepSpecific = NARROW[ob.specific];
cptr.ir ← r;
};
ImpOldSetInterest: PROC [ob: CD.Object, r: CD.Rect] = {
cptr: CDImports.ImportSpecific = NARROW[ob.specific];
cptr.ir ← r;
};
CellOldSetInterest: PROC [ob: CD.Object, r: CD.Rect] = {
cptr: CD.CellSpecific = NARROW[ob.specific];
cptr.ir ← r;
};
IF CDCells.IsCell[ob] THEN CellOldSetInterest[ob, r]
ELSE IF CDImports.IsImport[ob] THEN ImpOldSetInterest[ob, r]
ELSE IF CDRepetitions.IsRepetition[ob] THEN RepOldSetInterest[ob, r]
ELSE
WITH CDProperties.GetProp[ob.class.properties, $SetInterestProc] SELECT FROM
sp: REF SetInterestProc => sp^[ob, r];
ENDCASE => NULL;
};
InstallOldSetInterest: PROC [type: REF CD.ObjectClass, proc: SetInterestProc] = {
CDProperties.PutProp[onto: type, prop: $SetInterestProc, val: NEW[SetInterestProc←proc]];
};
InternalReadOrigin: PROC [h: TokenIO.Handle, prop: ATOM] RETURNS [val: REF] = {
x: INT = TokenIO.ReadInt[h];
y: INT = TokenIO.ReadInt[h];
val ← NIL
};
originProperty: ATOM = $origin;
interestRectProperty: ATOM = $interestRect;
[] ← CDProperties.RegisterProperty[interestRectProperty];
CDProperties.InstallProcs[prop: interestRectProperty,
procs: CDProperties.PropertyProcsRec[
makeCopy: CDProperties.DontCopy,
internalRead: InternalReadProperty,
exclusive: TRUE
]
];
[] ← CDProperties.RegisterProperty[originProperty];
CDProperties.InstallProcs[prop: originProperty,
procs: CDProperties.PropertyProcsRec[
makeCopy: CDProperties.DontCopy,
internalRead: InternalReadOrigin,
exclusive: TRUE
]
];
[] ← CDProperties.RegisterProperty[$SetInterestProc];
END.