<> <> <> <> 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]; <> END.