DIRECTORY Stretch, Atom USING [GetPName], CDSequencer USING [Command, ImplementCommand], Rope USING [Cat, ROPE], CDDirectory USING [Include], CDBasics USING [SubPoints], CDOps USING [DelayedRedraw], CDObjectProcs USING [RegisterFurther, FetchFurther], TerminalIO USING [WriteRope], CD USING [Design, Position, ObPtr, ObjectProcs]; StretchImpl: CEDAR PROGRAM IMPORTS Atom, Rope, CDDirectory, CDObjectProcs, CDBasics, TerminalIO, CDSequencer, CDOps EXPORTS Stretch = BEGIN OPEN Stretch; DoStretch: PUBLIC PROC [obj: CD.ObPtr, design: CD.Design, place: INT, dir: Direction, amount: INT] RETURNS [CD.ObPtr, Rope.ROPE] = { proc: REF StretchProc _ NARROW[CDObjectProcs.FetchFurther[obj.p, $StretchProc]]; ob: CD.ObPtr; msg: Rope.ROPE; IF amount = 0 THEN RETURN[obj, NIL]; IF proc = NIL THEN RETURN[NIL, Rope.Cat["Don't know how to stretch objects of type '", Atom.GetPName[obj.p.objectType], "'."]]; [ob, msg] _ proc[obj, design, place, dir, amount]; RETURN[ob, msg]; }; 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; Init[]; END. ςFile: StretchImpl.mesa Copyright c 1984 by Xerox Corporation. All rights reserved. Created by: Mayo, June 26, 1984 12:12:25 pm PDT Last Edited by: Mayo, November 5, 1984 4:46:45 pm PST -- Top-level command routines -- Main body Κ*˜– "Cedar" stylešœ™Jšœ Οmœ1™˜>šžœžœžœ˜J˜J˜,J˜Jšžœ˜J˜—Jšžœžœžœ˜šžœ(žœ˜0J˜OJšžœ˜J˜—Jšœ,˜,Jšœ$žœ˜