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, August 6, 1986 11:36:04 am PDT
DIRECTORY
CD,
CDBasics,
CDCallSpecific,
CDLayers,
CDOps,
CDPrivate,
CDSequencer,
CDSymbolicObjects,
Rope,
TerminalIO;
CDSymbolicObjectsCommands: CEDAR PROGRAM
IMPORTS CDBasics, CDCallSpecific, CDLayers, 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.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;
ChangePinLayer: CDCallSpecific.CallProc =
BEGIN
layer: CD.Layer ← WITH x SELECT FROM
lr: CDPrivate.LayerRef => lr.number,
ENDCASE => CDLayers.CurrentLayer[design];
layer ← CDLayers.AbstractToPaint[layer];
repaintMe ← TRUE;
CDSymbolicObjects.SetLayer[inst, layer];
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"];
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.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[$DefaultIR, DefaultIRComm];
CDSequencer.ImplementCommand[$SetIR, SetIRComm];
CDCallSpecific.Register[$ChangeLayer, CDSymbolicObjects.pinClass, ChangePinLayer];
CDCallSpecific.Register[$ChangeLayer, CDSymbolicObjects.segmentClass, ChangePinLayer];
CDCallSpecific.Register[$ChangeLayer, CDSymbolicObjects.markClass, ChangePinLayer];
END.