CDInstances.mesa (A ChipNDale module)
Copyright © 1983, 1986 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, May 12, 1983 12:22 pm
Last edited by: Christian Jacobi, October 30, 1986 10:22:58 am PST
Procedures with vanilla stuff around instances
DIRECTORY
CD;
CDInstances: CEDAR DEFINITIONS =
BEGIN
--Contents
--be careful, InstanceList's are lists of pointers, distinguish between:
--procedures which modify the instance list, from procedures which don't
--procedures which modify the instances pointed to, from procedures which don't
--procedures which modify an instance list, from procedures which modify the instances
--procedures inspecting an instance or a list
PointToO: PROC [pos: CD.Position, inst: CD.Instance] RETURNS [BOOL];
-- Returns "pos points to the inst", using its draw area
PointToI: PROC [pos: CD.Position, inst: CD.Instance] RETURNS [BOOL];
-- Returns "pos points to the instance"
HitInstance: PROC[inst: CD.Instance, hitRect: CD.Rect] RETURNS [BOOL];
-- Returns "hitRect points to the instance"
InstRectO: PROC [inst: CD.Instance] RETURNS [CD.Rect];
-- Returns draw rect
InstRectI: PROC [inst: CD.Instance] RETURNS [CD.Rect];
-- Returns interest rect
BoundingRectO: PROC [list: CD.InstanceList, selectedOnly: BOOLFALSE] RETURNS [CD.Rect];
-- Bounding box, using drawing area
BoundingRectI: PROC [list: CD.InstanceList, selectedOnly: BOOLFALSE] RETURNS [CD.Rect];
-- Bounding box, interest area
InstanceAt: PROC [il: CD.InstanceList, pos: CD.Position, selectedOnly: BOOLFALSE] RETURNS [CD.Instance];
-- Returns a an instance at location pos (or NIL if there is none)
-- Uses interest area's
--procedures which modify the instance or list in place
DeSelectList: PROC [list: CD.InstanceList];
AppendToList: PROC [inst, to: CD.InstanceList] RETURNS [CD.InstanceList];
-- Composes the lists "inst" and "to"
-- The original list "to" might be destroyed and must be replaced by the returned list
-- The original list "inst" is not touched
--procedures which handle the instance list but don't make new the instances
SplitSelected: PROC [il: CD.InstanceList] RETURNS [selected, others: CD.InstanceList];
-- Copy the selected instance refs from "il" to "selected"
-- Copy the non-selected instance refs from "il" to "others"
-- Returns new lists but same instances
OnlySelected: PROC [il: CD.InstanceList] RETURNS [selected: CD.InstanceList];
-- Returns new list but same instances
--procedures which create a new instance list, with new instances
NewInst: PROC [ob: CD.Object, trans: CD.Transformation←[], properties: CD.PropList←NIL, selected: BOOLFALSE] RETURNS [CD.Instance];
-- Creates a new instance, does neither draw nor include it into any world
Copy: PROC [inst: CD.Instance] RETURNS [CD.Instance];
-- Makes a copy
Composed: PROC [inst: CD.Instance, trans: CD.Transformation] RETURNS [CD.Instance];
-- Makes a composed copy
-- Given "inst" an instance inside a cell, computes an instance in world coordinates
DeComposed: PROC [inst: CD.Instance, trans: CD.Transformation] RETURNS [CD.Instance];
-- makes a decomposed copy
-- Given "inst" an instance in world coordinates, computes an instance in cell coordinates
CopyList: PROC [il: CD.InstanceList] RETURNS [CD.InstanceList];
-- Creates a new list with new, copied instances (order not preserved)
ComposedList: PROC [il: CD.InstanceList, trans: CD.Transformation] RETURNS [CD.InstanceList];
-- Makes a copy of "il" with world coordinates assumed that "il" has cell coordinates
-- and trans is the transformation of the cell instance
-- The new list points to new instances (order not preserved)
DeComposedList: PROC [il: CD.InstanceList, trans: CD.Transformation] RETURNS [CD.InstanceList];
-- Makes a copy of "il" with cell coordinates assumed il has world coordinates
-- and trans is the transformation of the cell instance
-- The new list points to new instances (order not preserved)
--vanilla procedures
Member: PROC [inst: CD.Instance, il: CD.InstanceList] RETURNS [BOOL];
-- Returns whether inst is a member of il
Length: PROC [il: CD.InstanceList] RETURNS [INT];
-- Returns number of instances in il
END.