CDIRCommands.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, September 2, 1985 3:50:08 pm PDT
DIRECTORY
CD,
CDBasics,
CDMenus,
CDOps,
CDOrient,
CDSequencer,
Rope,
TerminalIO;
CDIRCommands:
CEDAR
PROGRAM
IMPORTS CDBasics, CDMenus, CDOps, CDOrient, CDSequencer, TerminalIO =
BEGIN
DefaultIRComm:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["default the interest rect\n"];
IF comm.design.actual.rest=NIL THEN TerminalIO.WriteRope[" not pushed in; not done\n"]
ELSE {
mightReplace: CD.Instance ← comm.design^.actual.first.mightReplace;
newWir: CD.Rect;
oldWir:
CD.Rect = CDOrient.MapRect[
--old interest rect in design coordinates
itemInCell: comm.design^.actual.first.specific.ir,
cellSize: mightReplace.ob.size,
cellInstOrient: mightReplace.orientation,
cellInstPos: mightReplace.location
];
comm.design.actual.first.specific.ir ← comm.design.actual.first.specific.dIr;
comm.design.actual.first.specific.useDIr ← TRUE;
newWir
← CDOrient.MapRect[
--new interest rect in design coordinates
itemInCell: comm.design^.actual.first.specific.ir,
cellSize: mightReplace.ob.size,
cellInstOrient: mightReplace.orientation,
cellInstPos: mightReplace.location
];
CDOps.DelayedRedraw[comm.design, CDBasics.Surround[oldWir, newWir]];
};
END;
SetIRComm:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Set the interest rect\n"];
IF comm.design.actual.rest=NIL THEN TerminalIO.WriteRope[" not pushed in; not done\n"]
ELSE {
mightReplace: CD.Instance ← comm.design^.actual.first.mightReplace;
oldWir:
CD.Rect = CDOrient.MapRect[
--old interest rect in design coordinates
itemInCell: comm.design^.actual.first.specific.ir,
cellSize: mightReplace.ob.size,
cellInstOrient: mightReplace.orientation,
cellInstPos: mightReplace.location
];
newWir: CD.Rect = CDBasics.ToRect[comm.pos, comm.sPos]; -- new interest rect
ir:
CD.Rect = CDOrient.DeMapRect[
itemInWorld: newWir,
cellSize: mightReplace.ob.size,
cellInstOrient: mightReplace.orientation,
cellInstPos: mightReplace.location
];
comm.design.actual.first.specific.ir ← ir;
comm.design.actual.first.specific.useDIr ← FALSE;
CDOps.DelayedRedraw[comm.design, CDBasics.Surround[oldWir, newWir]];
};
END;
CDSequencer.ImplementCommand[$DefaultIR, DefaultIRComm];
CDSequencer.ImplementCommand[$SetIR, SetIRComm];
[] ← CDMenus.CreateMenu["Special commands", $RectSpecialMenu];
CDMenus.ImplementMenuCommand[$RectSpecialMenu, $RectSpecialMenu];
CDMenus.CreateEntry[menu: $RectSpecialMenu, entry: "default interest rect", key: $DefaultIR];
CDMenus.CreateEntry[menu: $RectSpecialMenu, entry: "set interest rect", key: $SetIR];
END.