File: Stretch.mesa
Copyright © 1984 by Xerox Corporation. All rights reserved.
Created by: Mayo, June 26, 1984 12:10:18 pm PDT
Last Edited by: Mayo, July 27, 1984 6:13:02 pm PDT
-- Stretch: Stretch an arbitrary object in X or Y.
DIRECTORY
Rope USING [ROPE],
CD USING [ObPtr];
Stretch: CEDAR DEFINITIONS = BEGIN
Direction to stretch (up means slide stuff up, even edges that lie exactly on the stretch line)
Direction: TYPE = {up, down, left, right};   
Every stretchable object must register a $StretchProc proc with CDObjectProcs. It should be of this form: (a negative amount means shrink)
StretchProc: TYPE = PROC [obj: CD.ObPtr, place: INT, dir: Direction, amount: INT] RETURNS [CD.ObPtr, Rope.ROPE];
-- obj is the object to be stretched
-- place is the coordinate to be stretched at
-- dir is the direction in which to stretch. Edges that lie exactly on 'place' are moved in this direction, as well as any edge past 'place' in direction 'dir'
-- amount is the amount of stretch in design coordinates (NOT lambda)
-- return value is either a new object or a rope telling what went wrong.
Make a new object that is just like the old except that it is stretched. Return NIL if it can't be done, along with a message.
DoStretch: PROC [obj: CD.ObPtr, place: INT, dir: Direction, amount: INT] RETURNS [CD.ObPtr, Rope.ROPE];
END.