GGInterfaceImpl.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Last edited by Bier on March 12, 1986 2:54:25 pm PST
Contents: A veneer on top of GGObjects, which keeps the interface level data structures consistent with changes to the modeled objects.
DIRECTORY
GGInterface, GGInterfaceTypes, GGModelTypes, GGObjects, GGOutline, GGSelect, Rope;
GGInterfaceImpl: CEDAR PROGRAM
IMPORTS GGObjects, GGOutline, GGSelect
EXPORTS GGInterface =
BEGIN
Outline: TYPE = GGModelTypes.Outline;
GargoyleData: TYPE = GGInterfaceTypes.GargoyleData;
Scene: TYPE = GGModelTypes.Scene;
Sequence: TYPE = GGInterfaceTypes.Sequence;
Traj: TYPE = GGModelTypes.Traj;
TrajGenerator: TYPE = GGModelTypes.TrajGenerator;
DeleteOutline: PUBLIC PROC [outline: Outline, scene: Scene] = {
GGSelect.DeselectEntityAllClasses[outline, scene];
GGObjects.DeleteOutline[scene, outline];
};
FetchTraj: PROC [outline: Outline, index: NAT] RETURNS [traj: Traj] = {
trajGen: TrajGenerator ← GGOutline.TrajsInOutline[outline];
FOR t: Traj ← GGObjects.NextTraj[trajGen], GGObjects.NextTraj[trajGen] UNTIL t = NIL DO
IF index = 0 THEN RETURN[t];
index ← index - 1;
ENDLOOP;
RETURN[NIL];
};
DeleteSequence: PUBLIC PROC [seq: Sequence, scene: Scene] RETURNS [oldOutline: Outline, newOutlines: LIST OF Outline] = {
Store all selection information about this outline in the outline itself.
GGOutline.SaveSelectionsInOutline[seq.traj.parent, scene];
Perform the delete.
[oldOutline, newOutlines] ← GGObjects.DeleteSequence[seq, scene];
Remove all references to the old outline.
GGSelect.DeselectEntityAllClasses[oldOutline, scene];
Restore references to the new outlines.
FOR list: LIST OF Outline ← newOutlines, list.rest UNTIL list = NIL DO
GGOutline.RemakeSelectionsFromOutline[list.first, scene];
ENDLOOP;
};
IndexOfTraj: PROC [traj: Traj, outline: Outline] RETURNS [index: NAT] = {
trajGen: TrajGenerator;
trajGen ← GGOutline.TrajsInOutline[outline];
index ← 0;
FOR t: Traj ← GGObjects.NextTraj[trajGen], GGObjects.NextTraj[trajGen] UNTIL t = NIL DO
IF t = traj THEN RETURN;
index ← index + 1;
ENDLOOP;
SIGNAL Problem[msg: "trajectory not found"];
};
Problem: PUBLIC SIGNAL [msg: Rope.ROPE] = CODE;
AddHole: PUBLIC PROC [outline: Outline, hole: Traj, scene: Scene] RETURNS [holier: Outline] = {
holeOutline: Outline ← GGOutline.OutlineOfTraj[hole];
IF holeOutline = outline THEN ERROR;
holier ← GGOutline.AddHole[outline, hole];
DeleteOutline[holeOutline, scene];
DeleteOutline[outline, scene];
GGObjects.AddOutline[scene, holier, -1];
};
END.