CDSymbolicObjectsCommands.mesa (part of ChipNDale)
Copyright © 1984, 1985 by Xerox Corporation. All rights reserved.
by Christian Jacobi, August 6, 1984 6:41:30 pm PDT
last edited Christian Jacobi, February 25, 1986 2:45:35 pm PST
DIRECTORY
CD,
CDBasics,
CDLayers,
CDMenus,
CDOps,
CDSequencer,
CDSymbolicObjects,
Rope,
TerminalIO;
CDSymbolicObjectsCommands:
CEDAR
PROGRAM
IMPORTS CDBasics, CDLayers, CDMenus, CDOps, CDSequencer, CDSymbolicObjects, TerminalIO =
BEGIN
MakePinComm:
PROC [comm: CDSequencer.Command] =
BEGIN
name: Rope.ROPE;
r: CD.Rect = CDBasics.ToRect[comm.pos, comm.sPos];
inst: CD.Instance;
layer: CD.Layer ← CDLayers.CurrentLayer[comm.design];
TerminalIO.WriteRopes["Draw Pin (", CDOps.LayerName[layer], ")\n"];
name ← TerminalIO.RequestRope[" type name of pin: "];
inst ← CDSymbolicObjects.CreateSymInst[denotes: r, layer: layer, name: name];
CDOps.IncludeInstance[comm.design, inst];
END;
ChangePinLayerComm:
PROC [comm: CDSequencer.Command] =
BEGIN
layer: CD.Layer ← CDLayers.CurrentLayer[comm.design];
TerminalIO.WriteRopes["Change layer of symbolic objects to ", CDOps.LayerName[layer], "\n"];
FOR il:
CD.InstanceList ← CDOps.InstList[comm.design], il.rest
WHILE il#
NIL
DO
IF il.first.selected
AND CDSymbolicObjects.IsSymbolicOb[il.first.ob]
THEN {
CDSymbolicObjects.SetLayer[il.first, layer];
};
ENDLOOP
END;
MakeSegmentComm:
PROC [comm: CDSequencer.Command] =
BEGIN
name: Rope.ROPE;
r: CD.Rect = CDBasics.ToRect[comm.pos, comm.sPos];
inst: CD.Instance;
layer: CD.Layer ← CDLayers.CurrentLayer[comm.design];
TerminalIO.WriteRopes["Draw Segment (", CDOps.LayerName[layer], ")\n"];
name ← TerminalIO.RequestRope[" type name of segment: "];
inst ← CDSymbolicObjects.CreateSymInst[denotes: [x1: r.x1, x2: r.x2, y1: r.y1, y2: r.y1], layer: layer, name: name];
CDOps.IncludeInstance[comm.design, inst];
END;
MakeMarkComm:
PROC [comm: CDSequencer.Command] =
BEGIN
name: Rope.ROPE;
inst: CD.Instance;
r: CD.Rect = CDBasics.RectAt[comm.pos, [0, 0]];
TerminalIO.WriteRope["draw mark object\n"];
name ← TerminalIO.RequestRope[" type name of mark: "];
inst ← CDSymbolicObjects.CreateSymInst[denotes: r, name: name];
CDOps.IncludeInstance[comm.design, inst];
END;
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 {
oldWir: CD.Rect ← comm.design^.actual.first.specific.ir;
newWir: CD.Rect ← comm.design^.actual.first.specific.dIr;
comm.design.actual.first.specific.ir ← newWir;
comm.design.actual.first.specific.useDIr ← TRUE;
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 = comm.design^.actual.first.specific.ir;
newWir: CD.Rect = CDBasics.ToRect[comm.pos, comm.sPos]; -- new interest rect
comm.design.actual.first.specific.ir ← newWir;
comm.design.actual.first.specific.useDIr ← FALSE;
CDOps.DelayedRedraw[comm.design, CDBasics.Surround[oldWir, newWir]];
};
END;
CDSequencer.ImplementCommand[$DrawMark, MakeMarkComm];
CDSequencer.ImplementCommand[$DrawPin, MakePinComm];
CDSequencer.ImplementCommand[$DrawSegment, MakeSegmentComm];
CDSequencer.ImplementCommand[$ChangeSymbolicLayer, ChangePinLayerComm];
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 (pushed)", key: $DefaultIR];
CDMenus.CreateEntry[menu: $RectSpecialMenu, entry: "set interest rect (pushed)", key: $SetIR];
CDMenus.CreateEntry[menu: $SpecialMenu, entry: "layer of symbolic obs", key: $ChangeSymbolicLayer];
END.