CDSymbolicObjects.mesa (part of ChipNDale)
Copyright © 1984, 1985 by Xerox Corporation. All rights reserved.
by Christian Jacobi, August 8, 1984 12:41:50 pm PDT
last edited Christian Jacobi, November 8, 1985 3:22:29 pm PST
CDSymbolicObjects: CEDAR DEFINITIONS =
BEGIN
--Symbolic objects denote points, vertical and horizontal line segments and rectangles.
--These objects can make out the interface.
-- It is perfectly ok to create symbolic applications with any means...
-- The denoted dimension is:
-- Points: lower left point of object, [0, 0]
-- Lines: west (left) border of object
-- Rects: complete size of object
-- The origin lies in [0, 0]; The interrest rect is equal to [0, 0, size.x, size.y].
-- The interrest rect's size is of no consequence for Points or Lines
---Create procedures may create objects of different genre if the parameters suggests
CreatePointOb: PROC [dummySize: CD.Number𡤀] RETURNS [CD.Object];
CreateLineOb: PROC [length: CD.Number, dummyWidth: CD.Number𡤀] RETURNS [CD.Object];
CreateRectOb: PROC [size: CD.Position] RETURNS [CD.Object];
IsSymbolicOb: PROC [ob: CD.Object] RETURNS [BOOL];
IsPointOb: PROC [ob: CD.Object] RETURNS [BOOL];
IsLineOb: PROC [ob: CD.Object] RETURNS [BOOL];
IsRectOb: PROC [ob: CD.Object] RETURNS [BOOL];
Kind: TYPE = {notSymbolic, point, line, rect};
SymbolicKind: PROC [ob: CD.Object] RETURNS [Kind];
SetOwner: PROC [symInst: CD.Instance, owner: ATOM←NIL];
GetOwner:
PROC [symInst:
CD.Instance]
RETURNS [
ATOM];
--If owner is not NIL it must be registered with CDProperties
SetName: PROC [symInst: CD.Instance, name: Rope.ROPE];
GetName: PROC [symInst: CD.Instance] RETURNS [Rope.ROPE];
SetLayer: PROC [symInst: CD.Instance, layer: CD.Layer];
GetLayer:
PROC [symInst:
CD.Instance]
RETURNS [
CD.Layer];
--I layer=CD.combined means: not yet determined,
-- or either: object has more complex functionality
--It depends from the application if the layer has meaning
Direction:
TYPE = {west, south, east, north};
--It depends from the application if Direction has meaning...
DirectionFromOrient: PROC [o: CD.Orientation] RETURNS [dir: Direction];
OrientFromDirection: PROC [dir: Direction] RETURNS [o: CD.Orientation];
CreateSymInst:
PROC [name: Rope.
ROPE←NIL, denotes:
CD.Rect, dummySize:
CD.Number ← 0, layer:
CD.Layer ←
CD.combined, owner:
ATOM ←
NIL, approachFrom: Direction ← west]
RETURNS [
CD.Instance];
--Lines will be approached from a direction perpendicular to their length.
Denotes: PROC [symInst: CD.Instance] RETURNS [CD.Rect];
--special procedures for cells
InstEnumerator: TYPE = PROC [inst: CD.Instance] RETURNS [quit: BOOL←FALSE];
EnumerateSymbolicObs:
PROC [cellOb:
CD.Object←
NIL, eachInst: InstEnumerator]
RETURNS [quit:
BOOL];
--Random order; changes on cellOb while the enumeration may or may not be seen
--or may even cause other symbolic to be visited a different number than once.
--The instances are the real instances inside cellOb; modifycations would change cellOb
FindSymbolicObs:
PROC [cellOb:
CD.Object←
NIL, name: Rope.
ROPE]
RETURNS [
CD.InstanceList];
--Returns all symbolic objects with name "name"
--The instances are the real instances inside cellOb; modifycations would change cellOb
--implementors stuff
symbolicRectsClass: PRIVATE READONLY REF CD.ObjectClass;
symbolicLineClass: PRIVATE READONLY REF CD.ObjectClass;
symbolicPointClass: PRIVATE READONLY REF CD.ObjectClass;
END.