CDApplications.mesa (A ChipNDale module)
Copyright © 1983, 1985 by Xerox Corporation. All rights reserved.
by Christian Jacobi, May 12, 1983 12:22 pm
last edited by Christian Jacobi, April 15, 1985 4:04:33 pm PST
--Procedures with vanilla stuff around applications
DIRECTORY
CD,
CDBasics,
CDOrient;
CDApplications:
CEDAR
DEFINITIONS
IMPORTS CDBasics, CDOrient =
BEGIN
--be carefull, ApplicationList's are lists of pointers, distinguish between:
--procedures which modify the application list, from procedures which don't
--procedures which modify the applications pointed to, from procedures which don't
--procedures which modify an application list, from procedures which modify the applications
--procedures around one application
PointToO:
PROC [pos:
CD.DesignPosition, aptr:
CD.ApplicationPtr]
RETURNS [
BOOLEAN] =
--returns "pos points to the application aptr", using its virtual coordinates
INLINE {RETURN [CDBasics.InsidePos[pos, ARectO[aptr]]]};
PointToI:
PROC [pos:
CD.DesignPosition, aptr:
CD.ApplicationPtr]
RETURNS [
BOOLEAN];
--returns "pos points to the application aptr", using its virtual coordinates
ARectO:
PROC [aptr:
CD.ApplicationPtr]
RETURNS [
CD.DesignRect] =
INLINE {RETURN [CDOrient.RectAt[aptr.location, aptr.ob.size, aptr.orientation]]};
ARectI:
PROC [aptr:
CD.ApplicationPtr]
RETURNS [
CD.DesignRect];
--interrest rect
NewApplicationI:
PROC [ob:
CD.ObPtr,
location: CD.DesignPosition←[0,0], orientation: CD.Orientation𡤀,
selected: BOOLEAN ← FALSE, properties: CD.Properties←NIL] RETURNS [CD.ApplicationPtr];
--creates a new application, does neither draw nor include it into any world
--modifies location such that interest-rect is at original location
Transform:
PROC [aptr:
CD.ApplicationPtr,
cellRect: CD.DesignRect, transformation: CD.Orientation];
--performs "transformation" to "aptr"; the transformation occurs to the rect "cellRect".
--"cellRect" and "aptr" in the same coordinate system
--transformation group NOT abelsch
Translate:
PROC [aptr:
CD.ApplicationPtr, offset:
CD.DesignPosition] =
--translates aptr^ by offset; aptr, offset in same coordinate system
INLINE {aptr.location ← CDBasics.AddPoints[aptr.location, offset]};
--procedures inspecting an application list
BoundingRectO:
PROC[list:
CD.ApplicationList, selectedOnly:
BOOLEAN←
FALSE]
RETURNS [CD.DesignRect];
--real coordinates
--uses outer area's
BoundingRectI:
PROC[list:
CD.ApplicationList, selectedOnly:
BOOLEAN←
FALSE]
RETURNS [CD.DesignRect];
--real coordinates
--uses interest area's
AplicationAt:
PROC [al:
CD.ApplicationList, pos:
CD.DesignPosition, selectedOnly:
BOOL←
FALSE]
RETURNS [
CD.ApplicationPtr];
--returns a reference to an application at location pos (or NIL if there is none)
--uses interest area's
--procedures which modify the applications referenced by a list
TransformList:
PROC[al:
CD.ApplicationList,
cellRect: CD.DesignRect, transformation: CD.Orientation];
TranslateList: PROC[al: CD.ApplicationList, offset: CD.DesignPosition];
DeSelectList: PROC [list: CD.ApplicationList];
AppendToList:
PROC [app, to:
CD.ApplicationList]
RETURNS [
CD.ApplicationList];
--composes the lists "app" and "to"
--the original list "to" might be destroyed and must be replaced by the returned list
--the original list "app" is not touched
--procedures which handle the application list but don't modify the applications
SplitPointed:
PROC [from:
CD.ApplicationList, pos:
CD.DesignPosition]
RETURNS [pointed, others:
CD.ApplicationList];
--copyes the pointed application references from "from" to "pointed"
--finds maximal 1 pointed application
--copyes the non-pointed application references from "from" to "others"
--does not make copies of the real applications
SplitSelected:
PROC [from:
CD.ApplicationList]
RETURNS [selected, others:
CD.ApplicationList];
--copyes the selected application references from "from" to "selected"
--copyes the non-selected application references from "from" to "others"
--returns new lists but same applications
OnlySelected:
PROC[al:
CD.ApplicationList]
RETURNS [selected:
CD.ApplicationList];
--returns new list but same applications
--procedures which create a new application list, with new applications
CopyList:
PROC[al:
CD.ApplicationList]
RETURNS [
CD.ApplicationList];
--creates a new list with new applications
ComposedCopy:
PROC[al:
CD.ApplicationList,
cellPos, cellSize: CD.DesignPosition, cellOrient: CD.Orientation] RETURNS [CD.ApplicationList];
--makes a copy of "al" with world coordinates assumed that "al" has cell coordinates
--cellSize in cell coordinates, cellPos in world cordinates
--the new list points to new applications
DeComposedCopy:
PROC[al:
CD.ApplicationList,
cellPos, cellSize: CD.DesignPosition, cellOrient: CD.Orientation] RETURNS [CD.ApplicationList];
--makes a copy of "al" with cell coordinates assumed al has world coordinates
--cellSize in cell coordinates
--cellPos, cellOrient in world coordinates
--the new list points to new applications
END.