<> <> <> <> DIRECTORY CD, CDApplications, CDBasics, CDCells, CDDirectory, CDCommandOps, CDMarkObjects, CDMenus, CDOps, CDOrient, CDSequencer, Rope, TerminalIO; CDMarkObjectsCommands: CEDAR PROGRAM IMPORTS CDApplications, CDBasics, CDCells, CDCommandOps, CDDirectory, CDMarkObjects, CDMenus, CDOps, CDOrient, CDSequencer, TerminalIO = BEGIN DrawMarkComm: PROC [comm: CDSequencer.Command] = BEGIN name: Rope.ROPE; mark: CD.ApplicationPtr; TerminalIO.WriteRope["draw mark object\n"]; name _ TerminalIO.RequestRope[" type name: "]; mark _ CDApplications.NewApplicationI[CDMarkObjects.markOb, comm.pos]; CDMarkObjects.SetMarkName[mark, name]; CDOps.IncludeApplication[comm.design, mark]; END; SetInterestRect: PROC[ob: CD.ObPtr, design: CD.Design, rect: CD.DesignRect_CDBasics.empty] = BEGIN cptr: CD.CellPtr = NARROW[ob.specificRef]; cptr.useDIr _ ~CDBasics.NonEmpty[rect]; IF cptr.useDIr THEN cptr.ir _ cptr.dIr ELSE cptr.ir _ rect; CDDirectory.RepositionObject[design: design, ob: ob, oldSize: ob.size, baseOff: [0, 0]]; 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 CDCells.IsCell[aptr.ob] THEN SetInterestRect[aptr.ob, comm.design, 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 CDCells.IsCell[aptr.ob] THEN SetInterestRect[aptr.ob, comm.design] ELSE TerminalIO.WriteRope["only possible for mutable objectclasses\n"]; END; CDSequencer.ImplementCommand[$DrawMark, DrawMarkComm]; 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.