CDInterestRectsImpl.mesa
Copyright © 1984, 1985 by Xerox Corporation. All rights reserved.
Created by: Jacobi, September 13, 1984 3:21:36 pm PDT
Last Edited: Jacobi, April 16, 1985 3:07:49 pm PST
DIRECTORY
CD,
CDBasics,
CDInterestRects,
CDIO,
CDObjectProcs,
CDProperties,
TokenIO;
CDInterestRectsImpl: CEDAR PROGRAM
IMPORTS CDBasics, CDIO, CDObjectProcs, CDProperties, TokenIO
EXPORTS CDInterestRects =
BEGIN
-- InterestRect: A special rectangle associated to an object.
-- It defaults to the objects innerrect.
AdjustInterest: PUBLIC PROC [ob: CD.ObPtr] =
BEGIN
IF ob.p.inDirectory AND CDIO.VersionKey[]<8 THEN {
WITH CDProperties.GetPropFromObject[from: ob, prop: interestRectProperty] SELECT FROM
pp: REF CD.DesignRect =>
IF CDBasics.NonEmpty[pp^] THEN SetInterest[ob, pp^]
ENDCASE => NULL;
};
END;
InternalReadProperty: PROC [prop: ATOM] RETURNS [val: REF] =
BEGIN
x1: INT = TokenIO.ReadInt[];
y1: INT = TokenIO.ReadInt[];
x2: INT = TokenIO.ReadInt[];
y2: INT = TokenIO.ReadInt[];
val ← NEW[CD.DesignRect←[x1, y1, x2, y2]]
END;
SetInterest: CDInterestRects.SetInterestProc =
BEGIN
WITH CDObjectProcs.FetchFurther[ob.p, $SetInterestProc] SELECT FROM
p: REF CDInterestRects.SetInterestProc => p^[ob, r];
ENDCASE => NULL;
END;
InstallOldSetInterest: PUBLIC PROC [type: REF CD.ObjectProcs, proc: CDInterestRects.SetInterestProc] =
BEGIN
CDObjectProcs.StoreFurther[type, $SetInterestProc, NEW[CDInterestRects.SetInterestProc←proc]];
END;
InternalReadOrigin: PROC [prop: ATOM] RETURNS [val: REF] =
BEGIN
x: INT = TokenIO.ReadInt[];
y: INT = TokenIO.ReadInt[];
val ← NIL
END;
originProperty: ATOM = $origin;
interestRectProperty: ATOM = $interestRect;
[] ← CDProperties.RegisterProperty[interestRectProperty];
CDProperties.InstallProcs[prop: interestRectProperty,
new: CDProperties.PropertyProcsRec[
makeCopy: CDProperties.DontCopy,
internalRead: InternalReadProperty,
exclusive: TRUE
]
];
[] ← CDProperties.RegisterProperty[originProperty];
CDProperties.InstallProcs[prop: originProperty,
new: CDProperties.PropertyProcsRec[
makeCopy: CDProperties.DontCopy,
internalRead: InternalReadOrigin,
exclusive: TRUE
]
];
CDObjectProcs.RegisterFurther[$SetInterestProc];
END.