StretchArea:
PROC [comm: CDSequencer.Command] =
BEGIN
oldObj: CD.ObPtr ← comm.design.actual.first.dummyCell.ob;
obj: CD.ObPtr;
dist: CD.Position;
xPlace, yPlace: INT;
msg: Rope.ROPE;
obj ← oldObj;
dist ← CDBasics.SubPoints[comm.pos, comm.sPos];
IF dist.x < 0
THEN
xPlace ← comm.pos.x
ELSE
xPlace ← comm.sPos.x;
IF dist.y < 0
THEN
yPlace ← comm.pos.y
ELSE
yPlace ← comm.sPos.y;
[obj, msg] ← DoStretch[obj, comm.design, xPlace, $right, dist.x];
IF obj =
NIL
THEN {
TerminalIO.WriteRope[msg];
TerminalIO.WriteRope[" Stretch not done."];
TerminalIO.WriteRope["\n"];
RETURN;
};
[obj, msg] ← DoStretch[obj, comm.design, yPlace, $up, dist.y];
IF obj =
NIL
THEN {
TerminalIO.WriteRope[msg];
TerminalIO.WriteRope[" Stretch not done."];
TerminalIO.WriteRope["\n"];
RETURN;
};
IF obj = oldObj THEN RETURN;
IF ~CDDirectory.Include[comm.design, obj]
THEN {
TerminalIO.WriteRope["Error: Could not include new object into the design.\n"];
RETURN;
};
comm.design.actual.first.dummyCell.ob ← obj;
comm.design.actual.first.specific ← NARROW[obj.specificRef];
CDOps.DelayedRedraw[design: comm.design, eraseFirst: TRUE];
TerminalIO.WriteRope["Stretch Done.\n"];
END;
Init:
PROC[] =
BEGIN
CDObjectProcs.RegisterFurther[$StretchProc, NIL];
CDSequencer.ImplementCommand[$StretchArea, StretchArea];
END;