CDSymbolicObjectsCommands.mesa (part of ChipNDale)
Copyright © 1984, 1986 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, August 6, 1984 6:41:30 pm PDT
Last Edited by: Christian Jacobi, October 21, 1986 1:06:28 pm PDT
DIRECTORY
CD,
CDBasics,
CDLayers,
CDInstances,
CDOps,
CDPrivate,
CDSequencer,
CDSymbolicObjects,
Rope,
TerminalIO;
CDSymbolicObjectsCommands: CEDAR PROGRAM
IMPORTS CDBasics, CDLayers, CDInstances, CDOps, CDSequencer, CDSymbolicObjects, TerminalIO
SHARES CDSymbolicObjects =
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];
layer ← CDLayers.AbstractToPaint[layer];
TerminalIO.PutRopes["draw Pin (", CDOps.LayerRope[layer], ")\n"];
name ← TerminalIO.RequestRope[" type name of pin: "];
inst ← CDSymbolicObjects.CreateSymInst[denotes: r, layer: layer, name: name];
CDOps.IncludeInstance[comm.design, inst];
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.PutRopes["draw Segment (", CDOps.LayerRope[layer], ")\n"];
layer ← CDLayers.AbstractToPaint[layer];
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.PutRope["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] = {
TerminalIO.PutRope["default the interest rect\n"];
IF comm.design.actual.rest=NIL THEN TerminalIO.PutRope[" not pushed in; not done\n"]
ELSE {
oldWir: CD.Rect ← comm.design^.actual.first.specific.ir;
newWir: CD.Rect ← CDInstances.BoundingRectI[CDOps.InstList[comm.design]];
comm.design.actual.first.specific.ir ← newWir;
comm.design.actual.first.specific.specifiedIr ← FALSE;
CDOps.Redraw[comm.design, CDBasics.Surround[oldWir, newWir]];
};
};
SetIRComm: PROC [comm: CDSequencer.Command] = {
TerminalIO.PutRope["set the interest rect\n"];
IF comm.design.actual.rest=NIL THEN TerminalIO.PutRope[" 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.specifiedIr ← TRUE;
CDOps.Redraw[comm.design, CDBasics.Surround[oldWir, newWir]];
};
};
CDSequencer.ImplementCommand[$DrawMark, MakeMarkComm];
CDSequencer.ImplementCommand[$DrawPin, MakePinComm];
CDSequencer.ImplementCommand[$DrawSegment, MakeSegmentComm];
CDSequencer.ImplementCommand[$DefaultIR, DefaultIRComm];
CDSequencer.ImplementCommand[$SetIR, SetIRComm];
END.