GGParent.mesa
Contents: Defines procedures that are used by Gargoyle object classes that have children (e.g., Cluster and Outline).
Copyright Ó 1986, 1988, 1992 by Xerox Corporation. All rights reserved.
Bier on October 23, 1988 9:41:24 pm PDT
Pier, June 19, 1992 5:44 pm PDT
Bier, December 2, 1991 3:37 pm PST
DIRECTORY
Basics, FeedbackTypes, GGBasicTypes, GGCoreTypes, GGHistoryTypes, GGInterfaceTypes, GGModelTypes, GGSegmentTypes, Imager, ImagerPath, ImagerTransformation, IO, Rope;
GGParent: CEDAR DEFINITIONS =
BEGIN
BoundBox: TYPE = GGCoreTypes.BoundBox;
Camera: TYPE = GGModelTypes.Camera;
Circle: TYPE = GGBasicTypes.Circle;
Color: TYPE = Imager.Color;
DefaultData: TYPE = GGModelTypes.DefaultData;
EditConstraints: TYPE = GGModelTypes.EditConstraints;
MsgRouter: TYPE = FeedbackTypes.MsgRouter;
HistoryEvent: TYPE = GGHistoryTypes.HistoryEvent;
Line: TYPE = GGCoreTypes.Line;
Orientation: TYPE = GGModelTypes.Orientation;
Point: TYPE = GGBasicTypes.Point;
PointGenerator: TYPE = GGModelTypes.PointGenerator;
PointPairAndDone: TYPE = GGModelTypes.PointPairAndDone;
PointPairGenerator: TYPE = GGModelTypes.PointPairGenerator;
PointWalkProc: TYPE = GGModelTypes.PointWalkProc;
Scene: TYPE = GGModelTypes.Scene;
Segment: TYPE = GGSegmentTypes.Segment;
SegmentGenerator: TYPE = GGModelTypes.SegmentGenerator;
SelectionClass: TYPE = GGSegmentTypes.SelectionClass;
SelectMode: TYPE = GGModelTypes.SelectMode;
SequenceOfReal: TYPE = GGCoreTypes.SequenceOfReal;
Slice: TYPE = GGModelTypes.Slice;
SliceDescriptor: TYPE = GGModelTypes.SliceDescriptor;
SliceDescriptorGenerator: TYPE = GGModelTypes.SliceDescriptorGenerator;
SliceDescriptorTallyProc: TYPE = GGModelTypes.SliceDescriptorTallyProc;
SliceDescriptorWalkProc: TYPE = GGModelTypes.SliceDescriptorWalkProc;
SliceGenerator: TYPE = GGModelTypes.SliceGenerator;
SliceParts: TYPE = GGModelTypes.SliceParts;
SliceTallyProc: TYPE = GGModelTypes.SliceTallyProc;
SliceWalkProc: TYPE = GGModelTypes.SliceWalkProc;
StrokeEnd: TYPE = Imager.StrokeEnd;
StrokeJoint: TYPE = Imager.StrokeJoint;
Transformation: TYPE = ImagerTransformation.Transformation;
Vector: TYPE = GGBasicTypes.Vector;
WalkLevel: TYPE = GGModelTypes.WalkLevel;
WalkProc: TYPE = GGModelTypes.WalkProc;
MoveToProc: TYPE = ImagerPath.MoveToProc;
LineToProc: TYPE = ImagerPath.LineToProc;
CurveToProc: TYPE = ImagerPath.CurveToProc;
ConicToProc: TYPE = ImagerPath.ConicToProc;
ArcToProc: TYPE = ImagerPath.ArcToProc;
Unlink: PROC [slice: Slice];
GetBoundBox: PROC [slice: Slice, parts: SliceParts] RETURNS [box: BoundBox];
GetTransformedBoundBox: PROC [slice: Slice, selectedParts: SliceParts, movingParts: SliceParts, transform: Transformation ¬ NIL] RETURNS [box: BoundBox];
GetTightBox: PROC [slice: Slice, parts: SliceParts] RETURNS [box: BoundBox];
Copy: PUBLIC PROC [slice: Slice, parts: SliceParts ¬ NIL, create: PROC [newSlice: Slice] RETURNS [parent: Slice]] RETURNS [copy: LIST OF Slice];
Restore: PROC [from: Slice, to: Slice];
BuildPath: PROC [slice: Slice, transformParts: SliceParts, transform: Transformation, moveTo: MoveToProc, lineTo: LineToProc, curveTo: CurveToProc, conicTo: ConicToProc, arcTo: ArcToProc, editConstraints: EditConstraints ← none];
DrawBorder: PROC [slice: Slice, drawParts: SliceParts, transformParts: SliceParts, transform: Transformation, dc: Imager.Context, camera: Camera, quick: BOOL ← FALSE, editConstraints: EditConstraints ← none];
DrawParts: PROC [slice: Slice, parts: SliceParts, dc: Imager.Context, camera: Camera, quick: BOOL];
DrawTransform: PROC [slice: Slice, parts: SliceParts ¬ NIL, dc: Imager.Context, camera: Camera, transform: Transformation, editConstraints: EditConstraints];
DrawSelectionFeedback: PROC [slice: Slice, selectedParts: SliceParts, hotParts: SliceParts, dc: Imager.Context, camera: Camera, dragInProgress, caretIsMoving, hideHot, quick: BOOL];
DrawAttractorFeedback: PROC [slice: Slice, attractorParts: SliceParts, selectedParts: SliceParts, dragInProgress: BOOL, dc: Imager.Context, camera: Camera, editConstraints: EditConstraints];
AttractorFeedbackBoundBox: PROC [slice: Slice, attractorParts: SliceParts, selectedParts: SliceParts, dragInProgress: BOOL, camera: Camera, editConstraints: EditConstraints] RETURNS [box: BoundBox];
SaveSelections: PROC [slice: Slice, parts: SliceParts, selectClass: SelectionClass];
RemakeSelections: PROC [slice: Slice, selectClass: SelectionClass] RETURNS [parts: SliceParts];
Transform: PROC [slice: Slice, parts: SliceParts ¬ NIL, transform: ImagerTransformation.Transformation, editConstraints: EditConstraints, history: HistoryEvent];
Describe: PROC [sliceD: SliceDescriptor, className: Rope.ROPE] RETURNS [rope: Rope.ROPE]; -- parameterized to be used from one than one class
DescribeHit: PROC [slice: Slice, hitData: REF ANY] RETURNS [rope: Rope.ROPE];
Fileout: PROC [slice: Slice, f: IO.STREAM];
Filein: PROC [f: IO.STREAM, version: REAL, router: MsgRouter, camera: Camera] RETURNS [children: LIST OF Slice];
IsEmptyParts: PROC [sliceD: SliceDescriptor] RETURNS [BOOL ¬ FALSE];
IsCompleteParts: PROC [sliceD: SliceDescriptor] RETURNS [BOOL ¬ FALSE];
NewParts: PROC [slice: Slice, hitData: REF ANY, mode: SelectMode] RETURNS [sliceD: SliceDescriptor];
UnionParts: PROC [partsA: SliceDescriptor, partsB: SliceDescriptor] RETURNS [aPlusB: SliceDescriptor];
DifferenceParts: PROC [partsA: SliceDescriptor, partsB: SliceDescriptor] RETURNS [aMinusB: SliceDescriptor];
MovingParts: PROC [slice: Slice, selectedParts: SliceParts, treatAsAUnit: BOOL ¬ FALSE, editConstraints: EditConstraints, bezierDrag: GGInterfaceTypes.BezierDragRecord] RETURNS [background, overlay, rubber, drag: SliceDescriptor];
AugmentParts: PROC [sliceD: SliceDescriptor, selectClass: SelectionClass] RETURNS [more: SliceDescriptor];
AlterParts: PROC [sliceD: SliceDescriptor, action: ATOM] RETURNS [movedD: SliceDescriptor];
SetSelectedFields: PROC [sliceD: SliceDescriptor, selected: BOOL, selectClass: SelectionClass];
PointsInDescriptor: PROC [sliceD: SliceDescriptor] RETURNS [pointGen: PointGenerator];
WalkPointsInDescriptor: PROC [sliceD: SliceDescriptor, walkProc: PointWalkProc];
PointPairsInDescriptor: PROC [sliceD: SliceDescriptor] RETURNS [pointPairGen: GGModelTypes.PointPairGenerator];
SegmentsInDescriptor: PROC [sliceD: SliceDescriptor] RETURNS [segGen: SegmentGenerator];
NextSegment: PROC [slice: Slice, segGen: SegmentGenerator] RETURNS [seg: Segment, transform: ImagerTransformation.Transformation];
WalkSegments: PROC [slice: Slice, walkProc: WalkProc] RETURNS [sliceD: SliceDescriptor];
NextPoint: PROC [slice: Slice, pointGen: PointGenerator] RETURNS [pointAndDone: GGModelTypes.PointAndDone];
NextPointPair: PROC [slice: Slice, pointPairGen: PointPairGenerator] RETURNS [pointPairAndDone: PointPairAndDone];
ClosestPoint: PROC [sliceD: SliceDescriptor, testPoint: Point, tolerance: REAL] RETURNS [bestPoint: Point, bestDist: REAL, bestNormal: Vector ¬ [0,-1], hitData: REF ANY, success: BOOL ¬ FALSE];
ClosestJointToHitData: PROC [sliceD: SliceDescriptor, mapPoint, testPoint: Point, hitData: REF ANY] RETURNS [jointD: SliceDescriptor, point: Point, normal: Vector ¬ [0,-1]];
ClosestSegment: PROC [sliceD: SliceDescriptor, testPoint: Point, tolerance: REAL] RETURNS [bestPoint: Point, bestDist: REAL, bestNormal: Vector ¬ [0,-1], hitData: REF ANY, success: BOOL ¬ FALSE];
LineIntersection: PROC [sliceD: SliceDescriptor, line: Line] RETURNS [points: LIST OF Point, pointCount: NAT ¬ 0];
CircleIntersection: PROC [sliceD: SliceDescriptor, circle: Circle] RETURNS [points: LIST OF Point, pointCount: NAT ¬ 0];
HitDataAsSimpleCurve: PROC [slice: Slice, hitData: REF ANY] RETURNS [simpleCurve: REF ANY];
PathOfHitData:
PROC [slice: Slice, hitData:
REF
ANY]
RETURNS [path: Slice, pathHitData:
REF
ANY];
A hit on a cluster or outline must refer to one of its paths. This routine finds out which path is involved.
Style
SetDefaults: PROC [slice: Slice, parts: SliceParts, defaults: DefaultData, history: HistoryEvent];
SetStrokeWidth: PROC [slice: Slice, parts: SliceParts, strokeWidth: REAL, history: HistoryEvent] RETURNS [box: BoundBox];
GetStrokeWidth: PROC [slice: Slice, parts: SliceParts] RETURNS [strokeWidth: REAL, isUnique: BOOL ¬ TRUE];
SetStrokeEnd: PROC [slice: Slice, parts: SliceParts, strokeEnd: StrokeEnd, history: HistoryEvent];
GetStrokeEnd: PROC [slice: Slice, parts: SliceParts] RETURNS [strokeEnd: StrokeEnd, isUnique: BOOL ¬ TRUE];
SetStrokeJoint: PROC [slice: Slice, parts: SliceParts, strokeJoint: StrokeJoint, history: HistoryEvent];
GetStrokeJoint: PROC [slice: Slice, parts: SliceParts] RETURNS [strokeJoint: StrokeJoint, isUnique: BOOL ¬ TRUE];
SetStrokeColor: PROC [slice: Slice, parts: SliceParts, color: Color, setHow: ATOM, history: HistoryEvent];
GetStrokeColor: PROC [slice: Slice, parts: SliceParts] RETURNS [color: Color, isUnique: BOOL ¬ TRUE];
SetFillColor: PROC [slice: Slice, parts: SliceParts, color: Color, setHow: ATOM, history: HistoryEvent];
GetFillColor: PROC [slice: Slice, parts: SliceParts] RETURNS [color: Color, isUnique: BOOL ¬ TRUE];
SetDashed: PROC [slice: Slice, parts: SliceParts, dashed: BOOL, pattern: SequenceOfReal ¬ NIL, offset: REAL ¬ 0.0, length: REAL ¬ -1.0, history: HistoryEvent];
GetDashed: PROC [slice: Slice, parts: SliceParts] RETURNS [dashed: BOOL ¬FALSE, pattern: SequenceOfReal, offset, length: REAL, isUnique: BOOL ¬ TRUE];
SetOrientation: PROC [slice: Slice, parts: SliceParts, orientation: Orientation, history: HistoryEvent] RETURNS [success: BOOL ¬ FALSE];
GetOrientation: PROC [slice: Slice, parts: SliceParts] RETURNS [orientation: Orientation, isUnique: BOOL ¬ TRUE];
Utilities for sub-classes of Parent
CreateParent: PROC [child: Slice, fillColor: Imager.Color] RETURNS [parent: Slice];
IsParent: PROC [slice: Slice] RETURNS [BOOL];
IsParentType: PROC [classType: ATOM] RETURNS [BOOL];
GetParent: PROC [child: Slice] RETURNS [parent: Slice];
GetTopLevelAncestor: PROC [slice: Slice] RETURNS [ancestor: Slice];
GetChildPriority: PROC [parent: Slice, child: Slice] RETURNS [priority: INT];
ComparePriorities:
PROC [slice1, slice2: Slice]
RETURNS [Basics.Comparison];
slice1 and slice2 must be descendents of the same parent slice. However, they can be at different levels within the parent slice's tree.
TopPriority: PROC [parent: Slice] RETURNS [priority: INT];
PutInFront: PROC [parent: Slice, child: Slice, slices: LIST OF Slice];
PutBehind: PROC [parent: Slice, child: Slice, slices: LIST OF Slice];
GetAtPriority: PROC [parent: Slice, priority: INT] RETURNS [child: Slice];
IsLeafOfClass:
PROC [slice: Slice, classType:
ATOM ¬
NIL]
RETURNS [
BOOL];
class=NIL => NOT IsParent. See impl for extensive comments.
WalkChildren: PROC [parent: Slice, level: WalkLevel, walkProc: SliceWalkProc ¬ NIL, classType: ATOM ¬ NIL] RETURNS [aborted: BOOL ¬ FALSE];
WalkIncludedChildren: PROC [parent: Slice, parts: SliceParts, level: WalkLevel, walkProc: SliceDescriptorWalkProc, classType: ATOM ¬ NIL] RETURNS [aborted: BOOL ¬ FALSE];
ListChildren: PROC [parent: Slice, level: WalkLevel, classType: ATOM ¬ NIL] RETURNS [sliceList: LIST OF Slice];
ListIncludedChildren: PROC [parent: Slice, parts: SliceParts, level: WalkLevel, classType: ATOM ¬ NIL] RETURNS [selectedList: LIST OF SliceDescriptor];
FirstChild: PROC [parent: Slice, level: WalkLevel, classType: ATOM ¬ NIL] RETURNS [firstChild: Slice];
FirstIncludedChild: PROC [parent: Slice, parts: SliceParts, level: WalkLevel, classType: ATOM ¬ NIL] RETURNS [childD: SliceDescriptor];
CountChildren: PROC [parent: Slice, level: WalkLevel, classType: ATOM ¬ NIL] RETURNS [count: INT ¬ 0];
TallyChildren:
PROC [parent: Slice, tallyProc: SliceTallyProc]
RETURNS [tallyD: SliceDescriptor, aborted:
BOOL ¬
FALSE];
Walk through the children (and, if requested recursively through the children's children, etc.) building up a descriptor of all parts of parent that meet the criterion defined by the tallyProc.
TallyIncludedChildren: PUBLIC PROC [parent: Slice, parts: SliceParts, tallyProc: SliceDescriptorTallyProc] RETURNS [tallyD: SliceDescriptor, aborted: BOOL ¬ FALSE];
DescriptorFromChildDescriptor: PROC [slice: Slice, childD: SliceDescriptor] RETURNS [sliceD: SliceDescriptor];
DescriptorFromChild: PROC [slice: Slice, child: Slice] RETURNS [sliceD: SliceDescriptor];
TopLevelDescriptorFromChildDescriptor: PROC [childD: SliceDescriptor] RETURNS [ancestorD: SliceDescriptor];
ChildDescriptorFromDescriptor: PROC [sliceD: SliceDescriptor, child: Slice] RETURNS [childD: SliceDescriptor];
RemoveTraj: PROC [sliceD: SliceDescriptor, traj: Slice] RETURNS [newD: SliceDescriptor];
END.