DIRECTORY CD, CDBasics; CDX: CEDAR DEFINITIONS IMPORTS CDBasics = BEGIN ClientPosition: TYPE = CD.Position; ClientRect: TYPE = CD.Rect; ClientOrigin: PROC [ob: CD.ObPtr] RETURNS [pos: CD.DesignPosition]; ClientIRect: PROC [ob: CD.ObPtr] RETURNS [ClientRect]; ClientORect: PROC [ob: CD.ObPtr] RETURNS [ClientRect]; CDToClientPos: PROC [ob: CD.ObPtr, pos: CD.DesignPosition_[0, 0]] RETURNS [cPos: ClientPosition] = INLINE {RETURN [CDBasics.SubPoints[pos, ClientOrigin[ob]]]}; ClientToCDPos: PROC [ob: CD.ObPtr, cPos: ClientPosition_[0, 0]] RETURNS [pos: CD.DesignPosition] = INLINE {RETURN [CDBasics.AddPoints[cPos, ClientOrigin[ob]]]}; CDToClientRect: PROC [ob: CD.ObPtr, rect: CD.DesignRect] RETURNS [cRect: ClientRect] = INLINE BEGIN co: CD.DesignPosition = ClientOrigin[ob]; RETURN [ClientRect[x1: rect.x1-co.x, y1: rect.y1-co.y, x2: rect.x2-co.x, y2: rect.y2-co.y]] END; ClientToCDRect: PROC [ob: CD.ObPtr, cRect: ClientRect] RETURNS [rect: CD.DesignRect] = INLINE BEGIN co: CD.DesignPosition = ClientOrigin[ob]; RETURN [CD.DesignRect[x1: cRect.x1+co.x, y1: cRect.y1+co.y, x2: cRect.x2+co.x, y2: cRect.y2+co.y]] END; MapClientPos: PROC [cPos: ClientPosition_[0, 0], app: CD.ApplicationPtr] RETURNS [globPos: CD.DesignPosition]; DeMapClientPos: PROC [globPos: CD.DesignPosition, app: CD.ApplicationPtr] RETURNS [cPos: ClientPosition]; MapClientRect: PROC [cRect: ClientRect, app: CD.ApplicationPtr] RETURNS [globRect: CD.DesignRect]; DeMapClientRect: PROC [globRect: CD.DesignRect, app: CD.ApplicationPtr] RETURNS [cRect: ClientRect]; PositionFromPairO: PROC [ob: CD.ObPtr, cPos: ClientPosition_[0,0], correspondingGlobPos: CD.DesignPosition_[0,0], orientation: CD.Orientation_0 ] RETURNS [appPos: CD.DesignPosition]; PositionFromPairI: PROC [ob: CD.ObPtr, cPos: ClientPosition_[0,0], correspondingGlobPos: CD.DesignPosition_[0,0], orientation: CD.Orientation_0 ] RETURNS [iPos: CD.DesignPosition]; CoordSystem: TYPE = {cdCoords, interrestCoords, originCoords}; IncludeMode: TYPE = {doit, dontReposition, dontPropagate, dontInclude}; IncludeOb: PROC [design: CD.Design_NIL, cell: CD.ObPtr_NIL, ob: CD.ObPtr, position: CD.Position_[0, 0], --evaluated before an eventual repositioning orientation: CD.Orientation_0, cellCSystem: CoordSystem_originCoords, obCSystem: CoordSystem_originCoords, mode: IncludeMode_doit] RETURNS [newApp: CD.ApplicationPtr, rep: BOOL]; RemoveApp: PROC [design: CD.Design_NIL, cell: CD.ObPtr_NIL, app: CD.ApplicationPtr, mode: IncludeMode_doit] RETURNS [removed: BOOL, rep: BOOL]; SimpleGetOrigin: PRIVATE PROC[ob: CD.ObPtr] RETURNS [CD.DesignPosition]; SimpleSetOrigin: PRIVATE PROC[ob: CD.ObPtr, new: CD.DesignPosition]; END. ¶CDX.mesa (part of ChipNDale) Copyright c 1984, 1985 by Xerox Corporation. All rights reserved. by Ch. Jacobi, September 10, 1984 9:20:09 am PDT last edited by Ch. Jacobi, April 16, 1985 12:43:12 pm PST --Public interface between chipndale and outside clients. --Maps chipndales complex and mutable (but fast on displaying) --positioning mechanism to an immutable(1) "client" cordinate system. --The Origin is a hypothtical point of an object; the client's coordinate --system origin. --(1)Only cells and some few other object classes implement --the client origin really immutable. --Returns the position of the client's object origin in objects internal cd coords --Returns the interest rect in client's relative coords --Returns the real outside (cd coords) rect in client's relative coords --Transfer between chipndale and client coordinates, both relative to the object --Transfer between client object relative coordinates and chipndale global coordinates --Computes a position useable for an application, such that the --client-origin relative point cPos is at the global position correspondingGlobPos --Computes the position of the interest rect, such that the client-origin --relative point cPos is at the global position correspondingGlobPos --Relative placement -- cdCoords: chipndales internal and native coordinate system used for display -- interrestCoords: base of interest-rects. -- originCoords: invariant fake origin which never changes, but might be far off... --design (NIL: allowed, if cell really is not yet part of a design) --cell (NIL: include into design; assumes the designs origin at [0, 0]) -- (design&cell NIL: simply create an application) --ob: object to include in cell --position: ... --orientation: of ob inside cell --cellCSystem: tells reference point in cell (for designs: [0, 0] anyway) --obCSystem: reference point of object --mode: -- doit: normal case everything is done -- dontReposition: speed up hack -- Caution: makes temporary a wrong coordinate system! cell is -- not legal until repositioning is called to clean up. -- Has no effect if cell is NIL. -- Does not cause redrawing of the design. -- dontPropagate: speed up hack. -- does neither reposition nor propagate the changed event; cell gets -- an illegal state until repositioning and change-propagation occurs. -- dontInclude: hack to create applications; cell is not changed at all. --newApp: the new created application --rep: Reposition was done or should be done, depending of mode --design (NIL: allowed, if cell really is not yet part of a design) --cell (NIL: remove from design) -- (design&cell NIL: Error) --ob: object to include in cell --position: ... --orientation: of ob inside cell --cellCSystem: tells reference point in cell (for designs: [0, 0] anyway) --obCSystem: reference point of object --mode: -- doit: normal case everything is done -- dontReposition: speed up hack -- Caution: makes temporary a wrong coordinate system! cell is -- not legal until repositioning is called to clean up. -- Has no effect if cell is NIL. -- Does not cause redrawing of the design. -- dontPropagate: speed up hack. -- does neither reposition nor propagate the changed event; cell gets -- an illegal state until repositioning and change-propagation occurs. -- dontInclude: hack to create applications; cell is not changed at all. --rep: Reposition was done or should be done, depending of mode --implementing the origin --Object class implementors business; calling these procedures for other purposes -- (except if explicitely allowed by the comment of a procedure) will typically -- produce chaos. These procedure implement an origin feature by using properties. --does NOT do any notification Ê¡˜šœ™Jšœ Ïmœ7™BJšœ0™0Jšœ9™9—J˜šÏk ˜ Jšžœ ˜ J˜—šÐbkœžœž œ˜Jšžœ ˜Jšžœ˜J˜Jšœ9™9J™JšœA™AJšœE™EJ™JJšœ™Jšœ;™;J™%J˜Jšœžœžœ ˜#Jšœ žœžœ˜J˜š Ðbn œžœžœžœžœ˜CJšœR™R—J˜šÏn œžœžœžœ˜6Jšœ7™7J˜—š¡ œžœžœžœ˜6JšœG™G—J˜J˜JšœP™PJ™š ¡ œžœžœ žœžœ˜bšžœžœ.˜JšœN™NJšœ+™+JšœS™S—J˜Jšœ žœ6˜GJ˜š¡ œžœ žœžœžœžœžœ˜JJšœ žœÏc,˜KJšœ žœ˜Jšœ(˜(Jšœ%˜%šœ˜Jšžœ žœžœ˜/—JšœC™CJšœG™GJšœ3™3Jšœ#™#Jšœ™Jšœ!™!JšœI™IJšœ&™&Jšœ™Jšœ(™(Jšœ!™!Jšœ¢œ6™AJšœ8™8Jšœ!™!Jšœ+™+Jšœ!™!JšœG™GJšœH™HJšœI™IJšœ%™%Jšœ@™@—J˜š¡ œžœ žœžœžœžœžœ˜TJšœžœ žœžœ˜;JšœC™CJšœ ™ Jšœ™Jšœ#™#Jšœ™Jšœ!™!JšœI™IJšœ&™&Jšœ™Jšœ(™(Jšœ!™!Jšœ¢œ6™AJšœ8™8Jšœ!™!Jšœ+™+Jšœ!™!JšœG™GJšœH™HJšœI™IJšœ@™@—J™J™J™J™JšœQ™QJ™OJ™RJ˜Jš Ïbœž œžœžœžœ˜Hš œž œžœ žœ˜DJšœ™—J˜Jšžœ˜J˜——…— ç