<> <> <> <> <> <<>> DIRECTORY CD, CDSimpleOps, CDOrient, CDSequencer, CDValue, Rope, TerminalIO; CDMoveCopyCommands: CEDAR PROGRAM IMPORTS CDSimpleOps, CDSequencer, CDValue, TerminalIO = BEGIN TransformS: PROC [comm: CDSequencer.Command] = BEGIN n: CARDINAL; TerminalIO.WriteRope["transform selected: "]; n _ TerminalIO.RequestSelection[ label: "transform selected", choice: LIST["mirror x", "mirror y", "rot 90", "rot 180", "rot 270"]]; SELECT n FROM 1 => {TerminalIO.WriteRope["mirror x\n"]; CDSimpleOps.TransformSelected[comm.design, CDOrient.mirrorX]}; 2 => {TerminalIO.WriteRope["mirror y\n"]; CDSimpleOps.TransformSelected[comm.design, CDOrient.rotate180]; CDSimpleOps.TransformSelected[comm.design, CDOrient.mirrorX];}; 3 => {TerminalIO.WriteRope["rot 90\n"]; CDSimpleOps.TransformSelected[comm.design, CDOrient.rotate90]}; 4 => {TerminalIO.WriteRope["rot 180\n"]; CDSimpleOps.TransformSelected[comm.design, CDOrient.rotate180]}; 5 => {TerminalIO.WriteRope["rot 270\n"]; CDSimpleOps.TransformSelected[comm.design, CDOrient.rotate270]}; ENDCASE => TerminalIO.WriteRope["Skipped\n"]; END; RotS: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["rotate selected\n"]; CDSimpleOps.TransformSelected[comm.design, CDOrient.rotate90] END; MirrorS: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["mirror selected\n"]; CDSimpleOps.TransformSelected[comm.design, CDOrient.mirrorX] END; MirrorYS: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["mirror selected y\n"]; CDSimpleOps.TransformSelected[comm.design, CDOrient.rotate180+CDOrient.mirrorX]; END; StretchyMoveSCommand: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["move selected stretchy\n"]; CDSimpleOps.MoveSelected[design: comm.design, offset: CD.Position[comm.pos.x-comm.sPos.x, comm.pos.y-comm.sPos.y], stretchy: yes] END; SimpleMoveSCommand: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["move selected (no stretch)\n"]; CDSimpleOps.MoveSelected[design: comm.design, offset: CD.Position[comm.pos.x-comm.sPos.x, comm.pos.y-comm.sPos.y], stretchy: no] END; AutoMoveSCommand: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["move selected\n"]; CDSimpleOps.MoveSelected[design: comm.design, offset: CD.Position[comm.pos.x-comm.sPos.x, comm.pos.y-comm.sPos.y], stretchy: option] END; CopySCommand: PROC [comm: CDSequencer.Command] = BEGIN IF comm.pos.x#comm.sPos.x OR comm.pos.y#comm.sPos.y THEN { TerminalIO.WriteRope["copy selected\n"]; CDSimpleOps.CopySelected[comm.design, CD.Position[comm.pos.x-comm.sPos.x, comm.pos.y-comm.sPos.y]] } ELSE TerminalIO.WriteRope["no copy in place\n"]; END; StepValue: PROC[design: CD.Design] RETURNS [n: CD.Number] = BEGIN n _ CDValue.FetchInt[boundTo: design, key: $CDxStepValue, propagation: global]; IF n<=0 THEN n _ design.technology.lambda END; LambdaUpS: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["move selected step up\n"]; CDSimpleOps.MoveSelected[comm.design, CD.Position[0, StepValue[comm.design]], no] END; LambdaDownS: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["move selected step down\n"]; CDSimpleOps.MoveSelected[comm.design, CD.Position[0, -StepValue[comm.design]], no] END; LambdaLeftS: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["move selected step left\n"]; CDSimpleOps.MoveSelected[comm.design, CD.Position[-StepValue[comm.design], 0], no] END; LambdaRightS: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["move selected step right\n"]; CDSimpleOps.MoveSelected[comm.design, CD.Position[StepValue[comm.design], 0], no] END; StretchyMoveStepUpS: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["stretchy move selected step up\n"]; CDSimpleOps.MoveSelected[comm.design, CD.Position[0, StepValue[comm.design]], yes] END; StretchyMoveStepDownS: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["stretchy move selected step down\n"]; CDSimpleOps.MoveSelected[comm.design, CD.Position[0, -StepValue[comm.design]], yes] END; StretchyMoveStepLeftS: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["stretchy move step left\n"]; CDSimpleOps.MoveSelected[comm.design, CD.Position[-StepValue[comm.design], 0], yes] END; StretchyMoveStepRightS: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["stretchy move step right\n"]; CDSimpleOps.MoveSelected[comm.design, CD.Position[StepValue[comm.design], 0], yes] END; RenameDesign: PROC [comm: CDSequencer.Command] = BEGIN ENABLE TerminalIO.UserAbort => CONTINUE; name: Rope.ROPE; TerminalIO.WriteRopes["rename design ", comm.design.name, "\n"]; name _ TerminalIO.RequestRope["enter name: "]; CDSimpleOps.RenameDesign[comm.design, name]; END; Impl: PROC [] = BEGIN CDValue.StoreInt[boundTo: NIL, key: $CDxStepValue, value: 0]; CDSequencer.ImplementCommand[$StretchyMoveS, StretchyMoveSCommand]; CDSequencer.ImplementCommand[$MoveS, SimpleMoveSCommand]; CDSequencer.ImplementCommand[$AutMoveS, AutoMoveSCommand]; CDSequencer.ImplementCommand[$CopyS, CopySCommand]; CDSequencer.ImplementCommand[$LambdaUpS, LambdaUpS]; CDSequencer.ImplementCommand[$StretchyMoveStepUpS, StretchyMoveStepUpS]; CDSequencer.ImplementCommand[$LambdaDownS, LambdaDownS]; CDSequencer.ImplementCommand[$StretchyMoveStepDownS, StretchyMoveStepDownS]; CDSequencer.ImplementCommand[$LambdaLeftS, LambdaLeftS]; CDSequencer.ImplementCommand[$StretchyMoveStepLeftS, StretchyMoveStepLeftS]; CDSequencer.ImplementCommand[$LambdaRightS, LambdaRightS]; CDSequencer.ImplementCommand[$StretchyMoveStepRightS, StretchyMoveStepRightS]; CDSequencer.ImplementCommand[$RotS, RotS]; CDSequencer.ImplementCommand[$MirrorYS, MirrorYS]; CDSequencer.ImplementCommand[$MirrorS, MirrorS]; CDSequencer.ImplementCommand[$TransformS, TransformS]; CDSequencer.ImplementCommand[$RenameDesign, RenameDesign]; END; Impl[]; END.