CDViewer.mesa (part of ChipNDale)
Copyright © 1983, 1985 by Xerox Corporation. All rights reserved.
by Christian Jacobi, October 13, 1983 2:51 pm
last edited by Christian Jacobi, April 22, 1985 1:36:16 pm PST
DIRECTORY
CD USING [Rect, Position, Design],
CDSequencer USING [Command],
Rope USING [ROPE],
ViewerClasses USING [Viewer];
CDViewer: CEDAR DEFINITIONS =
BEGIN
--Accessing viewers of ChipNDale designs
CreateViewer: PROC [design: CD.Design] RETURNS [ViewerClasses.Viewer];
--... and displays the design,
--this is a split, if already a viewer exists
GetViewer: PROC [comm: CDSequencer.Command] RETURNS [ViewerClasses.Viewer];
--returns the design viewer from which the command was issued, if detectable
--might return NIL
LastViewer: PROC [] RETURNS [ViewerClasses.Viewer];
--the last ChipNDale design viewer which had the input focus
--might return NIL
--Scaling and paning
ShowPosition: PROC [viewer: ViewerClasses.Viewer, pos: CD.Position];
--moves viewer such that pos is in visible area (does not open closed viewer)
--approximative only
ShowAndScale: PROC [viewer: ViewerClasses.Viewer, rect: CD.Rect];
--moves and scales viewer such that rect is in visible area (does not open closed viewer)
--approximative only
VisibleRect: PROC [viewer: ViewerClasses.Viewer] RETURNS [r: CD.Rect];
--undefined if viewer not open or not ChipNDale design
--Arrow pointing to some position
ShowArrow: PROC [design: CD.Design, pos: CD.Position];
--visible on viewers only
RemoveArrow: PROC[design: CD.Design];
--Transfer
ViewerList: TYPE = LIST OF ViewerClasses.Viewer;
ViewersOf: PROC [design: REF] RETURNS [ViewerList];
--returns the viewers which might display the design;
DesignOf: PROC [viewer: ViewerClasses.Viewer] RETURNS [design: CD.Design];
--NIL if not a ChipNDale design
FindDesign: PROC [name: Rope.ROPE, case: BOOLFALSE] RETURNS [design: CD.Design];
--only designs with viewers can be found;
--if multiple designs have the same name, find arbitrary one
END.