CDMoveCopyCommands.mesa (part of ChipNDale)
Copyright © 1983, 1985, 1986 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, July 11, 1983 3:42 pm
Last edited by: Christian Jacobi, December 18, 1986 3:36:27 pm PST
DIRECTORY
CD,
CDSimpleOps,
CDSequencer,
CDValue,
PopUpSelection,
Rope,
TerminalIO;
CDMoveCopyCommands:
CEDAR
PROGRAM
IMPORTS CDSimpleOps, CDSequencer, CDValue, PopUpSelection, TerminalIO =
BEGIN
TransformS:
PROC [comm: CDSequencer.Command] = {
n: CARDINAL;
TerminalIO.PutRope["transform selected: "];
n ← PopUpSelection.Request[
header: "transform selected",
choice: LIST["mirror x", "mirror y", "rot 90", "rot 180", "rot 270"]];
SELECT n
FROM
1 => {TerminalIO.PutRope["mirror x\n"];
CDSimpleOps.TransformSelected[comm.design, mirrorX]};
2 => {TerminalIO.PutRope["mirror y\n"];
CDSimpleOps.TransformSelected[comm.design, rotate180];
CDSimpleOps.TransformSelected[comm.design, mirrorX];};
3 => {TerminalIO.PutRope["rot 90\n"];
CDSimpleOps.TransformSelected[comm.design, rotate90]};
4 => {TerminalIO.PutRope["rot 180\n"];
CDSimpleOps.TransformSelected[comm.design, rotate180]};
5 => {TerminalIO.PutRope["rot 270\n"];
CDSimpleOps.TransformSelected[comm.design, rotate270]};
ENDCASE => TerminalIO.PutRope["Skipped\n"];
};
RotS:
PROC [comm: CDSequencer.Command] = {
TerminalIO.PutRope["rotate selected\n"];
CDSimpleOps.TransformSelected[comm.design, rotate90]
};
MirrorS:
PROC [comm: CDSequencer.Command] = {
TerminalIO.PutRope["mirror selected\n"];
CDSimpleOps.TransformSelected[comm.design, mirrorX]
};
MirrorYS:
PROC [comm: CDSequencer.Command] = {
TerminalIO.PutRope["mirror selected y\n"];
CDSimpleOps.TransformSelected[comm.design, CD.mirrorY];
};
SimpleMoveSCommand:
PROC [comm: CDSequencer.Command] = {
TerminalIO.PutRope["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]]
};
CopySCommand:
PROC [comm: CDSequencer.Command] = {
IF comm.pos.x#comm.sPos.x
OR comm.pos.y#comm.sPos.y
THEN {
IF comm.data#
NIL
AND comm.data#comm.design
AND
ISTYPE[comm.data,
CD.Design]
THEN {
--we dont want to import fancy imports; copy is logically deeper in hierachy
p: CDSequencer.CommandProc ← CDSequencer.FetchCommand[$UnqueuedCopyInterDesign].proc;
IF p=NIL THEN TerminalIO.PutRope["failed, command issued in other design\n"]
ELSE CDSequencer.ExecuteProc[p, comm.design, dontQueue, comm];
RETURN
};
TerminalIO.PutRope["copy selected\n"];
CDSimpleOps.CopySelected[comm.design,
CD.Position[comm.pos.x-comm.sPos.x, comm.pos.y-comm.sPos.y]]
}
ELSE TerminalIO.PutRope["no copy in place\n"];
};
StepValue:
PROC[design:
CD.Design]
RETURNS [n:
CD.Number] = {
n ← CDValue.FetchInt[boundTo: design, key: $CDxStepValue, propagation: global];
IF n<=0 THEN n ← design.technology.lambda
};
LambdaUpS:
PROC [comm: CDSequencer.Command] = {
TerminalIO.PutRope["move selected step up\n"];
CDSimpleOps.MoveSelected[comm.design, CD.Position[0, StepValue[comm.design]]]
};
LambdaDownS:
PROC [comm: CDSequencer.Command] = {
TerminalIO.PutRope["move selected step down\n"];
CDSimpleOps.MoveSelected[comm.design, CD.Position[0, -StepValue[comm.design]]]
};
LambdaLeftS:
PROC [comm: CDSequencer.Command] = {
TerminalIO.PutRope["move selected step left\n"];
CDSimpleOps.MoveSelected[comm.design, CD.Position[-StepValue[comm.design], 0]]
};
LambdaRightS:
PROC [comm: CDSequencer.Command] = {
TerminalIO.PutRope["move selected step right\n"];
CDSimpleOps.MoveSelected[comm.design, CD.Position[StepValue[comm.design], 0]]
};
RenameDesign:
PROC [comm: CDSequencer.Command] = {
name: Rope.ROPE; done: BOOL;
TerminalIO.PutRopes["rename design ", comm.design.name, "\n"];
name ← TerminalIO.RequestRope["enter name: "];
done ← CDSimpleOps.RenameDesign[comm.design, name];
IF done THEN TerminalIO.PutRope["done\n"] ELSE TerminalIO.PutRope["not done\n"];
};
CDValue.StoreInt[boundTo: NIL, key: $CDxStepValue, value: 0];
CDSequencer.ImplementCommand[$MoveS, SimpleMoveSCommand];
CDSequencer.ImplementCommand[$CopyS, CopySCommand];
CDSequencer.ImplementCommand[$LambdaUpS, LambdaUpS];
CDSequencer.ImplementCommand[$LambdaDownS, LambdaDownS];
CDSequencer.ImplementCommand[$LambdaLeftS, LambdaLeftS];
CDSequencer.ImplementCommand[$LambdaRightS, LambdaRightS];
CDSequencer.ImplementCommand[$RotS, RotS];
CDSequencer.ImplementCommand[$MirrorYS, MirrorYS];
CDSequencer.ImplementCommand[$MirrorS, MirrorS];
CDSequencer.ImplementCommand[$TransformS, TransformS];
CDSequencer.ImplementCommand[$RenameDesign, RenameDesign];
END.