GGCaret.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Last edited by Bier on January 14, 1987 5:35:27 pm PST
Contents: Facilities for moving the caret and storing information about the neighborhood it inhabits (such as what trajectory it is sitting on).
Pier, August 22, 1986 2:33:02 pm PDT
DIRECTORY
GGBasicTypes, GGBoundBox, GGInterfaceTypes, GGModelTypes, GGSegmentTypes;
GGCaret: CEDAR DEFINITIONS = BEGIN
Caret: TYPE = GGInterfaceTypes.Caret;
CaretOn: TYPE = GGInterfaceTypes.CaretOn;
GargoyleData: TYPE = GGInterfaceTypes.GargoyleData;
Joint: TYPE = GGModelTypes.Joint;
Point: TYPE = GGBasicTypes.Point;
Segment: TYPE = GGSegmentTypes.Segment;
Sequence: TYPE = GGModelTypes.Sequence;
SliceDescriptor: TYPE = GGModelTypes.SliceDescriptor;
Traj: TYPE = GGModelTypes.Traj;
caretWidth: REAL = 6.0;
caretHeight: REAL = 8.0;
anchorWidth: REAL = 16.0;
anchorHeight: REAL = 16.0;
The story of the Caret.
There are two carets in Gargoyle (so far): THE caret, and the anchor. Someday there will also be a copy caret.
If the caret exists, it is drawn whenever the scene is painted. Some operations put the caret on the overlay plane so that it can move (See GGMouseEventImpl.DuringSelectPoint for example). Update causes the caret to exist. Kill makes it cease to exist. Exists checks. SetAttractor tells the caret where its new position is. GetPoint retrieves the current position.
TellOnOverlay tells the caret it is on (or off) the overlay. This does not actually put the caret on the overlay. GGRefresh.MoveToOverlay[caret] does that. Only GGRefresh should call TellOnOverlay.
The caret moves for several reasons. The $SelectPoint operations move the caret, using gravity to help it point to joints, segments, control points, and alignment lines. The $Drag operations allow the caret to pick up some object (which jumps to the caret at the beginning) and then allow the caret to be attracted by gravity as usual. During all of this, the caret remembers the object it has picked up (called the Chair) and the object it is currently being attracted to (called the Attractor). SitOnJoint, SitOnSegment, and DoNotSit tell the caret about the chair (or lack of one). SetAttractor tells the caret about the attractor.
At the end of a dragging operation, the caret knows if two trajectories have just become touching. Hence, it was natural to put MakeChairTouchAttractor, and MakeChairTouchTrajJoint in this module. These procedures call GGTouch to create the actual touching relationships.
Copy: PROC [to, from: Caret];
Used for placing the anchor, for instance.
Kill: PROC [caret: Caret];
This caret no longer exists. It should disappear from the screen.
Exists: PROC [caret: Caret] RETURNS [BOOL];
BoundBoxOfCaret: PROC [caret: Caret, gargoyleData: GargoyleData] RETURNS [box: GGBoundBox.BoundBox]; -- returns NIL if caret not either gargoyleData.caret or gargoyleData.anchor
For use by GGRefreshImpl.
TellOnOverlay: PROC [caret: Caret, onOverlay: BOOL];
IsOnOverlay: PROC [caret: Caret] RETURNS [BOOL];
The Chair.
SitOn: PROC [caret: Caret, chair: REF ANY];
GetChair: PROC [caret: Caret] RETURNS [chair: REF ANY];
SittingOnEnd: PROC [caret: Caret] RETURNS [BOOL];
The Attractor.
SetAttractor: PROC [caret: Caret, point: Point, attractor: REF ANY];
Moves the caret to a new point. If an attractor is specified some joints on the attractor will be highlighted.
NoAttractor: PROC [caret: Caret];
Leave the caret where it is. Remove any references to an attractor. No attractor joints will be highlighted.
GetAttractor: PROC [caret: Caret] RETURNS [attractor: REF ANY];
GetPoint: PROC [caret: Caret] RETURNS [point: Point];
END.