DIRECTORY ObjectDefs: FROM "ObjectDefs", PointDefs: FROM "PointDefs", GriffinEncoding USING [TranslateEdge, TranslateArea], GriffinGrid USING [MoveGrid], GriffinText USING [GetBoundingBox], MenuDefs: FROM "MenuDefs", XFormDefs: FROM "XFormDefs", GriffinMemoryDefs USING [CZone]; ObjectXForms: CEDAR PROGRAM IMPORTS ObjectDefs,XFormDefs,PointDefs,MenuDefs, GriffinMemoryDefs, GriffinEncoding, GriffinGrid, GriffinText EXPORTS ObjectDefs = BEGIN OPEN ObjectDefs,XFormDefs,GriffinMemoryDefs,PointDefs; MoveObject: PUBLIC PROCEDURE[object: ObjectHandle, from,to: ScrPt]= BEGIN token: REF selectToken Object _ ObjectDefs.ReturnSelectToken[object]; Move[object,from,to]; IF token # NIL THEN Move[token,from,to]; END; Move: PROCEDURE[object: ObjectHandle, from,to: ScrPt]= BEGIN transmatrix: XFMDescriptor _ CZone.NEW[XFormMatrix]; hgrid,vgrid: BOOLEAN _ FALSE; objfrom,objto,dist: ObjPt; dx,dy: INTEGER; moveBB: PROC = { object.tl [X] _ object.tl [X] + dx; object.tl [Y] _ object.tl [Y] + dy; object.br [X] _ object.br [X] + dx; object.br [Y] _ object.br [Y] + dy; }; dx _ to[X]-from[X]; dy _ to[Y]-from[Y]; objfrom _ ScrToObj[from]; objto _ ScrToObj[to]; dist[X] _ objto[X]-objfrom[X]; dist[Y] _ objto[Y]-objfrom[Y]; InitXForms[transmatrix]; Translate[dist,transmatrix]; XForm[object,transmatrix]; WITH object SELECT FROM shape: REF shape Object => BEGIN moveBB[]; GriffinEncoding.TranslateEdge[shape.edgeEncoding, [dx,dy]]; IF shape.areaEncoding#NIL THEN GriffinEncoding.TranslateArea[shape.areaEncoding, [dx,dy]]; END; menu: REF menu Object => BEGIN OPEN MenuDefs; MoveMenuItem: MenuProc = BEGIN item.tl [X] _ item.tl [X] + dx; item.tl [Y] _ item.tl [Y] + dy; item.br [X] _ item.br [X] + dx; item.br [Y] _ item.br [Y] + dy; END; ForAllMenuItems [menu, MoveMenuItem]; moveBB[]; END; token: REF token Object => IF token.tokenType=hgrid OR token.tokenType=vgrid THEN GriffinGrid.MoveGrid[token,dx,dy] ELSE moveBB[]; caption: REF caption Object=> moveBB[]; selectToken: REF selectToken Object=> moveBB[]; ENDCASE; END; XFormObject: PUBLIC PROCEDURE [object: ObjectHandle,matrix: XFMDescriptor] = BEGIN token: REF selectToken Object _ ReturnSelectToken[object]; XForm[object,matrix]; IF token # NIL THEN BEGIN XForm[token,matrix]; [token.tl, token.br] _ GetSelectTokenBoundingBox[token]; END; WITH object SELECT FROM shape: REF shape Object => { ObjectDefs.EncodeObject[shape]; ObjectDefs.AdjustBoxForStyle[shape]; }; caption: REF caption Object => [caption.tl, caption.br] _ GriffinText.GetBoundingBox[caption.text, caption.style, caption.p0]; ENDCASE; END; XForm: PROCEDURE [object: ObjectHandle,matrix: XFMDescriptor] = TRUSTED BEGIN WITH objtype: object SELECT FROM shape => WITH traj: objtype.trajectory SELECT FROM linked => BEGIN link: REF Link _ traj.links; UNTIL link=NIL DO XFormArray[link.knots,matrix]; link _ link.link; ENDLOOP; END; cyclic => XFormArray[traj.knots,matrix]; ENDCASE; caption => objtype.p0 _ XFormPt[objtype.p0,matrix]; selectToken => objtype.p0 _ XFormPt[objtype.p0,matrix]; token => IF NOT (objtype.tokenType=hgrid OR objtype.tokenType=vgrid) THEN objtype.p0 _ XFormPt[objtype.p0,matrix]; --grid is moved in GriffinGridImpl ENDCASE; END; XFormArray: PROCEDURE [array: PointDefs.ObjPtSequence,xform: XFMDescriptor] = BEGIN i: INTEGER; FOR i IN [0..array.length) DO array[i] _ XFormPt[array[i],xform]; ENDLOOP; END; END. \Compiler ObjectXForms Stone May 2, 1981 1:09 PM Last Edited by: Stone, January 28, 1983 6:43 pm does a translation on all control points and on the encoding move bounding boxes move the object in object space Transform the object Transform the select token Recompute the bounding boxes captions and tokens don't do much except on translate Ê3˜J˜Jšœ™Jšœ™Jšœ/™/J˜šÏk ˜ Jšœ œ˜Jšœ œ ˜Jšœœ ˜5Jšœ œ ˜Jšœ œ˜#Jšœ œ ˜Jšœ œ ˜Jšœœ ˜ —J˜Jšœ ˜Jšœf˜mJšœ˜Jšœœ2˜