CDOps.mesa (part of ChipNDale)
Copyright © 1983, 1986 by Xerox Corporation. All rights reserved.
Created by: Christian Jacobi, February 24, 1984 2:03 pm
Last edited by: Christian Jacobi, October 21, 1986 12:56:18 pm PDT
DIRECTORY
CD,
Rope USING [ROPE];
CDOps: CEDAR DEFINITIONS =
BEGIN
simple operation on ChipNDale designs.
All procedures do not queue; proper synchronization by the caller is assumed.
(Except CreateDesign, Redraw, or ImmediateRedraw, and the printing procs,
which can be called anytime)
--basics
CreateDesign:
PROC [technology:
CD.Technology]
RETURNS [design:
CD.Design];
--Creates a new, empty design; does not open a viewer yet.
--Caller holds the synchronization lock until a viewer is opened.
ResetDesign:
PROC [design:
CD.Design];
--Makes design empty
RealTopCell:
PROC [design:
CD.Design]
RETURNS [dummyCell:
CD.Object];
--Returns dummy cell which represents the top level of the design.
--Do not reposition dummyCell; dummyCell can be changed without
-- calling CDDirectory.PropagateChange.
--Do not include dummyCell in directory
PushedTopCell:
PROC [design:
CD.Design]
RETURNS [dummyCell:
CD.Object];
--Returns dummy cell which represents the pushed in cell of the design;
--- (The level where all the interactive edits happen)
--Do not reposition dummyCell; represents can be changed without
-- calling CDDirectory.PropagateChange
--Do not include dummyCell in directory
--printing
LambdaRope:
PROC [n:
CD.Number, lambda:
CD.Number]
RETURNS [Rope.
ROPE];
--For printing purposes
InstRope:
PROC[inst:
CD.Instance, verbosity:
INT𡤁]
RETURNS [Rope.
ROPE];
--For printing purposes
ObjectRope:
PROC [ob:
CD.Object]
RETURNS [Rope.
ROPE]
;
--For printing purposes; use in cases where instance is not available
LayerRope:
PROC [layer:
CD.Layer]
RETURNS [Rope.
ROPE];
--For printing purposes
ToRope:
PROC [x:
REF, whenFailed:
REF←
NIL]
RETURNS [Rope.
ROPE];
--Tries hard to make rope; for printing purposes
--drawing
DrawDesign:
PROC [design:
CD.Design, pr:
CD.DrawRef];
--Draws a design into a device
--No shortcuts, usefull for abstract devices
--drawing into viewers
QuickDrawDesign:
PROC [design:
CD.Design, pr:
CD.DrawRef];
--Draw a design into a device, using the quick draw procedures
--Shortcuts are taken; suits the implementation of viewers
ImmediateRedraw:
PROC [design:
CD.Design, r:
CD.Rect𡤊ll, eraseFirst:
BOOL←
TRUE];
--Refreshes the the area r in all viewers without extra delay [drawing is forked]
Redraw:
PROC [design:
CD.Design, r:
CD.Rect𡤊ll, eraseFirst:
BOOL←
TRUE];
--Refreshes the the area r in all viewers
--Is delayed until the current command is finished
--Efficiency hint:
-- if a lot of small rectangles need to be redrawn, it can be more efficient
-- to call a redraw of a big rectangle first.
all: PRIVATE CD.Rect = [FIRST[CD.Number], FIRST[CD.Number], LAST[CD.Number], LAST[CD.Number]];
DoTheDelayedRedraws:
PROC [design:
CD.Design];
--Forwards all Redraw requests which have not yet been drawn to the viewers.
--Should be called from the command sequencer
RedrawInstance:
PROC [design:
CD.Design, inst:
CD.Instance←
NIL, erase:
BOOL←
TRUE];
--Redraws the instance (delayed)
--handling instances on a design basis
SetInstList:
PROC [design:
CD.Design, instList: CD.InstanceList ←
NIL] =
INLINE {
--Sets instance list of the currently pushed in cell of the design
design^.actual.first.specific.contents ← instList
};
InstList:
PROC [design:
CD.Design]
RETURNS [CD.InstanceList] =
INLINE {
--Returns instance list of the currently pushed in cell of the design
RETURN[design^.actual.first.specific.contents]
};
IncludeInstance:
PROC [design:
CD.Design, inst:
CD.Instance, draw:
BOOL ←
TRUE];
--Includes instance into design [pushed cell]
IncludeInstanceList:
PROC [design:
CD.Design, il:
CD.InstanceList, draw:
BOOL ←
TRUE];
--Includes instances into design [pushed cell]
RemoveInstance:
PROC [design:
CD.Design, inst:
CD.Instance, draw:
BOOL ←
TRUE];
--Removes instance from design [pushed cell]
ReOrderInstance:
PROC [design:
CD.Design, inst:
CD.Instance];
--Puts instance at the end [pushed cell]
--Used to make next selection finding different instance
IncludeObject:
PROC [design:
CD.Design, ob:
CD.Object, trans:
CD.Transformation←[[0,0], original]];
--Conveniance: Includes object into design [pushed cell]
--Side effect: Sets selection according to internal selection mode
FitObjectI:
PROC [ob:
CD.Object, location:
CD.Position ← [0, 0], orientation:
CD.Orientation ←
CD.Orientation[original]]
RETURNS [trans:
CD.Transformation];
--returns a transformation which would fit the object's base of interestrect
--into point "location"
IncludeObjectI:
PROC [design:
CD.Design, ob:
CD.Object, location:
CD.Position ← [0, 0], orientation:
CD.Orientation ←
CD.Orientation[original]];
--Conveniance: Includes object into design [pushed cell]
--Fancy coordinate transformation:
-- fits oriented objects lower left corner of interest rect to location
--Side effect: Sets selection according to internal selection mode
SelectedInstance:
PROC [design:
CD.Design]
RETURNS [first:
CD.Instance, multiple:
BOOL];
--first: returns ref to any selected instance if there is one or more, otherwise NIL.
--multiple: more than one instance is selected
TheInstance:
PROC [design:
CD.Design, text: Rope.
ROPE←
NIL]
RETURNS [inst:
CD.Instance];
-- Finds the single selected instance of a design
-- if returned instance is nil, all messages are made and caller might return quietly
-- if returned instance is not nil; text line is written.
PlaceInst:
PROC [design:
CD.Design, ob:
CD.Object, hint:
REF←
NIL]
RETURNS [inst:
CD.Instance];
--Places ob down, somewhere into design and returns the instance made
--Makes a guess for a good position
--hint: hint to find gridding information
-- use NIL, ViewerClasses.Viewer, or CDSequencer.Command
BoundingBox:
PROC [design:
CD.Design, onlySelected:
BOOL ←
FALSE]
RETURNS [
CD.Rect];
--Bounding box of whole design
--Empty for empty design
END.