CDMoveCopyCommands.mesa (part of Chipndale)
Copyright © 1983, 1984 by Xerox Corporation. All rights reserved.
by Christian Jacobi July 11, 1983 3:42 pm
last edited Christian Jacobi October 24, 1984 3:27:31 pm PDT
DIRECTORY
CD,
CDCommands,
CDOrient,
CDSequencer,
CDValue,
Rope,
TerminalIO;
CDMoveCopyCommands: CEDAR PROGRAM
IMPORTS CDCommands, 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"];
CDCommands.TransformSelected[comm.design, CDOrient.mirrorX]};
2 => {TerminalIO.WriteRope["mirror y\n"];
CDCommands.TransformSelected[comm.design, CDOrient.rotate180];
CDCommands.TransformSelected[comm.design, CDOrient.mirrorX];};
3 => {TerminalIO.WriteRope["rot 90\n"];
CDCommands.TransformSelected[comm.design, CDOrient.rotate90]};
4 => {TerminalIO.WriteRope["rot 180\n"];
CDCommands.TransformSelected[comm.design, CDOrient.rotate180]};
5 => {TerminalIO.WriteRope["rot 270\n"];
CDCommands.TransformSelected[comm.design, CDOrient.rotate270]};
ENDCASE => TerminalIO.WriteRope["Skipped\n"];
END;
RotS: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Rotate selected\n"];
CDCommands.TransformSelected[comm.design, CDOrient.rotate90]
END;
MirrorS: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Mirror selected\n"];
CDCommands.TransformSelected[comm.design, CDOrient.mirrorX]
END;
MirrorYS: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Mirror selected y\n"];
CDCommands.TransformSelected[comm.design, CDOrient.rotate180+CDOrient.mirrorX];
END;
StretchyMoveSCommand: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Move selected stretchy\n"];
CDCommands.MoveSelected[design: comm.design, offset: CD.DesignPosition[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"];
CDCommands.MoveSelected[design: comm.design, offset: CD.DesignPosition[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"];
CDCommands.MoveSelected[design: comm.design, offset: CD.DesignPosition[comm.pos.x-comm.sPos.x, comm.pos.y-comm.sPos.y], stretchy: option]
END;
CopySCommand: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Copy selected\n"];
CDCommands.CopySelected[comm.design, CD.DesignPosition[comm.pos.x-comm.sPos.x, comm.pos.y-comm.sPos.y]]
END;
StepValue: PROC[design: CD.Design] RETURNS [CD.DesignNumber] =
BEGIN
RETURN [CD.lambda*MAX[CDValue.FetchInt[boundTo: design, key: $CDxStepValue, propagation: global], 1]]
END;
LambdaUpS: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Move selected step up\n"];
CDCommands.MoveSelected[comm.design, CD.DesignPosition[0, StepValue[comm.design]], no]
END;
LambdaDownS: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Move selected step down\n"];
CDCommands.MoveSelected[comm.design, CD.DesignPosition[0, -StepValue[comm.design]], no]
END;
LambdaLeftS: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Move selected step left\n"];
CDCommands.MoveSelected[comm.design, CD.DesignPosition[-StepValue[comm.design], 0], no]
END;
LambdaRightS: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Move selected step right\n"];
CDCommands.MoveSelected[comm.design, CD.DesignPosition[StepValue[comm.design], 0], no]
END;
StretchyMoveStepUpS: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Stretchy move selected step up\n"];
CDCommands.MoveSelected[comm.design, CD.DesignPosition[0, StepValue[comm.design]], yes]
END;
StretchyMoveStepDownS: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Stretchy move selected step down\n"];
CDCommands.MoveSelected[comm.design, CD.DesignPosition[0, -StepValue[comm.design]], yes]
END;
StretchyMoveStepLeftS: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Stretchy move step left\n"];
CDCommands.MoveSelected[comm.design, CD.DesignPosition[-StepValue[comm.design], 0], yes]
END;
StretchyMoveStepRightS: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Stretchy move step right\n"];
CDCommands.MoveSelected[comm.design, CD.DesignPosition[StepValue[comm.design], 0], yes]
END;
RenameDesign: PROC [comm: CDSequencer.Command] =
BEGIN ENABLE TerminalIO.UserAbort => CONTINUE;
name: Rope.ROPE;
TerminalIO.WriteRope["Rename design "]; TerminalIO.WriteRope[comm.design.name]; TerminalIO.WriteLn;
name ← TerminalIO.RequestRope["enter name: "];
CDCommands.RenameDesign[comm.design, name];
END;
Impl: PROC [] =
BEGIN
CDValue.StoreInt[boundTo: NIL, key: $CDxStepValue, value: 1];
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.