PipalUI.mesa
Copyright Ó 1988 by Xerox Corporation. All rights reserved.
Created by Bertrand Serlet March 17, 1988 2:33:02 pm PST
Bertrand Serlet May 15, 1988 8:41:49 pm PDT
DIRECTORY
CD,
Pipal, PipalInt, PipalOps,
ViewerClasses;
PipalUI: CEDAR DEFINITIONS
= BEGIN
Design
Design: TYPE = REF DesignRec;
DesignRec: PRIVATE TYPE = CD.DesignRec;
DesignRoot: PROC [design: Design] RETURNS [root: Pipal.Object];
Highlight and Viewer
HighlightDesign: PROC [design: Design, transformation: PipalInt.Transformation ← [], object: Pipal.Object ← NIL, viewer: ViewerClasses.Viewer ← NIL, label: Pipal.ROPENIL, rescale: BOOLTRUE];
If highlight is NIL, all previous highlight is removed.
If viewer is NIL then applies to all viewers of design.
If rescale, viewers scale to the best zoom on the highlighted area.
FindViewer: PROC [design: Design, label: Pipal.ROPENIL] RETURNS [viewer: ViewerClasses.Viewer ← NIL];
Finds a single viewer for the design. Picks the last viewer if it belongs to the design, otherwise picks a random viewer belonging to the design if any exist, otherwise creates a viewer for the design. If a viewer is created and the label is not NIL then ViewerOps.SetViewer[viewer: viewer, data: label, op: $Label].
Selection
EachSelectedProc: TYPE = PROC [path: PipalOps.Path, trans: PipalInt.Transformation, child: Pipal.Object] RETURNS [quit: BOOLFALSE];
EnumerateSelectedObjects: PROC [design: Design, each: EachSelectedProc] RETURNS [quit: BOOLFALSE];
Enumerate selected objects in the coordinate system of the design.
The selected objects belong to the deepest pushed cell.
TheSelectedObject: PROC [design: Design] RETURNS [thePath: PipalOps.Path, theTrans: PipalInt.Transformation, theChild: Pipal.Object ← NIL];
Returns the single selected object. Barks if none or several.
SelectInstance: PROC [design: Design, path: PipalOps.Path] RETURNS [done: BOOL];
Selects the object corresponding to object in the currently pushed in cell.
Push
PushInstance: PROC [design: Design, path: PipalOps.Path] RETURNS [done: BOOL];
Replacement
ReplaceMethod: TYPE = {interactive, all, alongPath};
ReplaceInDesign: PROC [design: Design, path: PipalOps.Path, table: PipalOps.ReplaceTable, replaceMethod: ReplaceMethod];
Command Registration
CommandProc: TYPE = PROC [design: Design, pos, spos: PipalInt.Position, data, issuer: REF];
RegisterCommand: PROC [key: ATOM, proc: CommandProc, queue, markChanged: BOOLTRUE, data: REFNIL];
Registers a procedure to be called as command.
key: (TIP-Table) key to call command;
ReplaceCommandProc: TYPE = PROC [design: Design, object: Pipal.Object, table: PipalOps.ReplaceTable, data, issuer: REF];
table: ReplaceTable, initially empty;
data: registration data;
issuer: typically describes issuer the command such as the viewer.
RegisterReplaceSelectionCommand: PROC [key: ATOM, proc: ReplaceCommandProc, allSelected: BOOL, replaceMethod: ReplaceMethod, queue, markChanged: BOOLTRUE, data: REFNIL];
allSelected decides whether proc should be applied to all selections or just to the unique selection (and emit a warnung if there is not a single selection).
Object Comparisons
Contains: PROC [object: Pipal.Object, candidateTrans: PipalInt.Transformation, candidateObject: Pipal.Object] RETURNS [BOOL];
Returns TRUE iff some child of object (or object itself) is REF equal to candidateObject (or REF equal to all its decendants), with the appropriate transformation.
SameInstances: PROC [trans1: PipalInt.Transformation, object1: Pipal.Object, trans2: PipalInt.Transformation, object2: Pipal.Object] RETURNS [BOOL];
Simultaneous Contains
Junk Yard
TopInstanceLists: TYPE = LIST OF RECORD [design: Design, tops: Pipal.Object];
GetTopInstances: PROC [design: Design] RETURNS [topInstances: TopInstanceLists ← NIL];
gets all the top level instances, including for imported designs
Random
schematicLambda: INT;
schematicFudge: INT;
used for example in PatchWork for deciding whether things more or less abut.
FetchKeyLine: PROC [fileName, key: Pipal.ROPE] RETURNS [entry: Pipal.ROPENIL];
Searches for a line starting with key in file. Returns the rest of the line found or NIL if not found.
ExecuteInTerminal: PROC [entry: Pipal.ROPE];
Debug
Draw: PROC [object: Pipal.Object] RETURNS [design: Design];
Creates a new CD viewer that displays the object.
END.