DIRECTORY CD, CDApplications, CDBasics, CDCommandOps, CDInterestRects, CDMarkObjects, CDMenus, CDOps, CDOrient, CDSequencer, Rope, TerminalIO; CDMarkObjectsCommands: CEDAR PROGRAM IMPORTS CDApplications, CDBasics, CDCommandOps, CDInterestRects, CDMarkObjects, CDMenus, CDOps, CDOrient, CDSequencer, Rope, TerminalIO = BEGIN DrawMarkComm: PROC [comm: CDSequencer.Command] = BEGIN name: Rope.ROPE; mark: CD.ApplicationPtr; TerminalIO.WriteRope["Draw alignment mark\n"]; name _ TerminalIO.RequestRope[" type name: "]; mark _ CDApplications.NewApplicationI[CDMarkObjects.markOb, comm.pos]; CDMarkObjects.SetMarkName[mark, name]; CDOps.IncludeApplication[comm.design, mark]; END; ReComputeTheInterestRect: PROC [cellOb: CD.ObPtr] = BEGIN rect: CD.DesignRect _ cellOb.p.insideRect[cellOb]; bl, ur: BOOL_FALSE; Enumerate: PROC [markApp: CD.ApplicationPtr] RETURNS [quit: BOOL_FALSE] = BEGIN pos: CD.DesignPosition; name: Rope.ROPE = CDMarkObjects.GetMarkName[markApp]; IF Rope.Equal[name, "BottomLeft"] THEN { IF bl THEN TerminalIO.WriteRope["multiple BottomLeft marks\n"]; bl _ TRUE; pos _ CDMarkObjects.GetMarkPosition[markApp]; rect.x1 _ pos.x; rect.y1 _ pos.y } ELSE IF Rope.Equal[name, "UpperRight"] THEN { IF ur THEN TerminalIO.WriteRope["multiple UpperRight marks\n"]; ur _ TRUE; pos _ CDMarkObjects.GetMarkPosition[markApp]; rect.x2 _ pos.x; rect.y2 _ pos.y } END; [] _ CDMarkObjects.EnumerateMarks[cellOb: cellOb, proc: Enumerate]; IF rect.x1>rect.x2 OR rect.y1>rect.y2 THEN { TerminalIO.WriteRope["bad rectangle\n"]; rect_CDBasics.empty; }; IF rect.x1>rect.x2 OR rect.y1>rect.y2 THEN { TerminalIO.WriteRope["marks are badly placed\n"]; rect _ CDBasics.empty; }; IF ~bl AND ~ur THEN rect_CDBasics.empty; CDInterestRects.SetInterestRect[cellOb, rect] END; SetInterestRectComm: PROC [comm: CDSequencer.Command] = BEGIN aptr: CD.ApplicationPtr = CDCommandOps.TheApplication[comm, "Recompute interestrect"]; IF aptr#NIL THEN { IF ISTYPE[aptr.ob.specificRef, CD.CellPtr] THEN ReComputeTheInterestRect[aptr.ob] ELSE TerminalIO.WriteRope[" not done; Selected object is not cell\n"]; } END; PaintInterestRectComm: PROC [comm: CDSequencer.Command] = BEGIN aptr: CD.ApplicationPtr = CDCommandOps.TheApplication[comm, "Repaint the interestrect"]; IF aptr#NIL THEN { rect: CD.DesignRect = CDBasics.ToRect[comm.pos, comm.sPos]; oRect: CD.DesignRect = CDOrient.DeMapRect[ itemInWorld: rect, cellSize: aptr.ob.size, cellInstOrient: aptr.orientation, cellInstPos: aptr.location ]; IF aptr.ob.p.inDirectory THEN CDInterestRects.SetInterestRect[aptr.ob, oRect] ELSE TerminalIO.WriteRope["only possible for mutable objectclasses\n"]; } END; ClearInterestRectComm: PROC [comm: CDSequencer.Command] = BEGIN aptr: CD.ApplicationPtr = CDCommandOps.TheApplication[comm, "Clear the interestrect"]; IF aptr#NIL THEN IF aptr.ob.p.inDirectory THEN CDInterestRects.SetInterestRect[aptr.ob] ELSE TerminalIO.WriteRope["only possible for mutable objectclasses\n"]; END; CDSequencer.ImplementCommand[$DrawMark, DrawMarkComm]; CDSequencer.ImplementCommand[$SetInterestRect, SetInterestRectComm]; CDSequencer.ImplementCommand[$PaintInterestRect, PaintInterestRectComm]; CDSequencer.ImplementCommand[$ClearInterestRect, ClearInterestRectComm]; CDMenus.CreateEntry[menu: $RectProgramMenu, entry: "Set InterestRect", key: $PaintInterestRect]; CDMenus.CreateEntry[menu: $ProgramMenu, entry: "Clear InterestRect", key: $ClearInterestRect]; END. RCDMarkObjectsCommands.mesa (part of Chipndale) Copyright c 1984 by Xerox Corporation. All rights reserved. by Christian Jacobi September 14, 1984 9:36:44 am PDT last edited Christian Jacobi November 20, 1984 2:47:01 pm PST --uses the marks "BottomLeft" and "UpperRight" to overide --coordinates, initialized with innerrect ʘšœ0™0Jšœ Ïmœ1™