CDMarkObjectsCommands.mesa (part of ChipNDale)
Copyright © 1984, 1985 by Xerox Corporation. All rights reserved.
by Christian Jacobi, September 14, 1984 9:36:44 am PDT
last edited Christian Jacobi, May 9, 1985 12:46:25 pm PDT
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�sics.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.