CDMoveCopyCommands.mesa (part of Chipndale)
by Christian Jacobi July 11, 1983 3:42 pm
last edited Christian Jacobi February 16, 1984 3:55 pm
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;
TransformP:
PROC [comm: CDSequencer.Command] =
BEGIN
n: CARDINAL;
TerminalIO.WriteRope["Transform pointed: "];
n ← TerminalIO.RequestSelection[
label: "transform pointed",
choice: LIST["mirror x", "mirror y", "rot 90", "rot 180", "rot 270"]];
SELECT n
FROM
1 => {TerminalIO.WriteRope["mirror x\n"];
CDCommands.TransformPointed[comm.design, CDOrient.mirrorX, comm.pos]};
2 => {TerminalIO.WriteRope["mirror y\n"];
CDCommands.TransformPointed[comm.design, CDOrient.rotate180, comm.pos];
CDCommands.TransformPointed[comm.design, CDOrient.mirrorX, comm.pos];};
3 => {TerminalIO.WriteRope["rot 90\n"];
CDCommands.TransformPointed[comm.design, CDOrient.rotate90, comm.pos]};
4 => {TerminalIO.WriteRope["rot 180\n"];
CDCommands.TransformPointed[comm.design, CDOrient.rotate180, comm.pos]};
5 => {TerminalIO.WriteRope["rot 270\n"];
CDCommands.TransformPointed[comm.design, CDOrient.rotate270, comm.pos]};
ENDCASE => TerminalIO.WriteRope["Skipped\n"];
END;
RotS:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Rotate selected\n"];
CDCommands.TransformSelected[comm.design, CDOrient.rotate90]
END;
RotP:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Rotate pointed\n"];
CDCommands.TransformPointed[comm.design, CDOrient.rotate90, comm.pos]
END;
MirrorS:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Mirror selected\n"];
CDCommands.TransformSelected[comm.design, CDOrient.mirrorX]
END;
MirrorP:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Mirror pointed\n"];
CDCommands.TransformPointed[comm.design, CDOrient.mirrorX, comm.pos]
END;
MirrorYS:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Mirror selected y\n"];
CDCommands.TransformSelected[comm.design, CDOrient.rotate180+CDOrient.mirrorX];
END;
MirrorYP:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Mirror pointed y\n"];
CDCommands.TransformPointed[comm.design, CDOrient.rotate180+CDOrient.mirrorX, comm.pos];
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;
StretchyMovePCommand:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Move pointed stretchy\n"];
CDCommands.MovePointed[design: comm.design, offset: CD.DesignPosition[comm.pos.x-comm.sPos.x, comm.pos.y-comm.sPos.y], pos: comm.sPos, 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;
SimpleMovePCommand:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Move pointed (no stretch)\n"];
CDCommands.MovePointed[design: comm.design, offset: CD.DesignPosition[comm.pos.x-comm.sPos.x, comm.pos.y-comm.sPos.y], pos: comm.sPos, 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;
AutoMovePCommand:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Move selected\n"];
CDCommands.MovePointed[design: comm.design, offset: CD.DesignPosition[comm.pos.x-comm.sPos.x, comm.pos.y-comm.sPos.y], pos: comm.sPos, 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;
CopyPCommand:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Copy pointed\n"];
CDCommands.CopyPointed[comm.design, CD.DesignPosition[comm.pos.x-comm.sPos.x, comm.pos.y-comm.sPos.y], comm.sPos]
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]], option]
END;
LambdaDownS:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Move selected step down\n"];
CDCommands.MoveSelected[comm.design, CD.DesignPosition[0, -StepValue[comm.design]], option]
END;
LambdaLeftS:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Move selected step left\n"];
CDCommands.MoveSelected[comm.design, CD.DesignPosition[-StepValue[comm.design], 0], option]
END;
LambdaRightS:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Move selected step right\n"];
CDCommands.MoveSelected[comm.design, CD.DesignPosition[StepValue[comm.design], 0], option]
END;
LambdaUpP:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Move pointed step up\n"];
CDCommands.MovePointed[comm.design, CD.DesignPosition[0, StepValue[comm.design]], comm.pos, option]
END;
LambdaDownP:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Move pointed step down\n"];
CDCommands.MovePointed[comm.design, CD.DesignPosition[0, -StepValue[comm.design]], comm.pos, option]
END;
LambdaLeftP:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Move pointed step left\n"];
CDCommands.MovePointed[comm.design, CD.DesignPosition[-StepValue[comm.design], 0], comm.pos, option]
END;
LambdaRightP:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Move pointed step right\n"];
CDCommands.MovePointed[comm.design, CD.DesignPosition[StepValue[comm.design], 0], comm.pos, option]
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[$StretchyMoveP, StretchyMovePCommand];
CDSequencer.ImplementCommand[$MoveS, SimpleMoveSCommand];
CDSequencer.ImplementCommand[$MoveP, SimpleMovePCommand];
CDSequencer.ImplementCommand[$AutMoveS, AutoMoveSCommand];
CDSequencer.ImplementCommand[$AutMoveP, AutoMovePCommand];
CDSequencer.ImplementCommand[$CopyS, CopySCommand];
CDSequencer.ImplementCommand[$CopyP, CopyPCommand];
CDSequencer.ImplementCommand[$LambdaUpS, LambdaUpS];
CDSequencer.ImplementCommand[$LambdaUpP, LambdaUpP];
CDSequencer.ImplementCommand[$LambdaDownS, LambdaDownS];
CDSequencer.ImplementCommand[$LambdaDownP, LambdaDownP];
CDSequencer.ImplementCommand[$LambdaLeftS, LambdaLeftS];
CDSequencer.ImplementCommand[$LambdaLeftP, LambdaLeftP];
CDSequencer.ImplementCommand[$LambdaRightS, LambdaRightS];
CDSequencer.ImplementCommand[$LambdaRightP, LambdaRightP];
CDSequencer.ImplementCommand[$RotS, RotS];
CDSequencer.ImplementCommand[$RotP, RotP];
CDSequencer.ImplementCommand[$MirrorYS, MirrorYS];
CDSequencer.ImplementCommand[$MirrorS, MirrorS];
CDSequencer.ImplementCommand[$MirrorYP, MirrorYP];
CDSequencer.ImplementCommand[$MirrorP, MirrorP];
CDSequencer.ImplementCommand[$TransformS, TransformS];
CDSequencer.ImplementCommand[$TransformP, TransformP];
CDSequencer.ImplementCommand[$RenameDesign, RenameDesign];
END;
Impl[];
END.