<<-- File: IPCoVerifier.mesa>> <<-- Last Edited by: CSChow, February 2, 1985 1:59:31 am PST>> <> DIRECTORY IPCoTab USING [Component], Imager USING[Context], Misc USING [Rect], IPConstants USING[Gray], OrderedSymbolTableRef USING[Table]; IPCoVerifier: CEDAR DEFINITIONS = BEGIN <<-- Intro: This interface takes a set of components on a place and verifiy if they intersects >> <<-- or not. During the process it also determines the `proper outline' of the components, >> <<-- ie. one that actually contains the component without intersecting other 'outlines'>> Ref: TYPE = REF Rep; CompItem: TYPE = REF CompItemRep; CompItemRep: TYPE = RECORD[comp: IPCoTab.Component, hint: RECORD[sw, se, ne, nw: BOOL _ FALSE]]; Rep: TYPE = RECORD[yOrdered: BOOL, comps: Comps, bRect: Misc.Rect _ NIL]; Comps: TYPE = REF CompsRep; CompsRep: TYPE = RECORD[tab: OrderedSymbolTableRef.Table]; EachCompItemAction: TYPE = PROC[cI: CompItem] RETURNS[quit: BOOL _ FALSE]; Create: PROC[yOrdered: BOOL _ TRUE] RETURNS[Ref]; --If yOrdered is true then the components will ordered by their lower y-coordinates -- else their lower x-coordinates. Destroy: PROC [r: Ref]; --Invalidates r and frees up the space InsertComponent: PROC[r: Ref, co: IPCoTab.Component]; --Add the component to r. CompItems: PROC[r: Ref, p: EachCompItemAction]; --Enumerate the Component Items of r in increasing order until p returns true -- or all Component Items are enumerated. GetBRect: PROC[r: Ref] RETURNS [Misc.Rect]; --Return the rectangle that just contains all the inserted components Verify: PROC [r: Ref] RETURNS[overlaps: LIST OF Misc.Rect]; --Compute any overlappings between the components if any. Also decide on the -- outline for the components, eg. if se in the hint of the component item is true this -- indicates that corner of the component should be retracted. The hints are decided so -- that there are no overlaps between the outline of the components and that the -- componets take on the maximum possible space. (NB: The outline always contains -- the component, but the converse is not true) PaintSelf: PROC[r: Ref, context: Imager.Context, xOffset, yOffset: REAL, scaleFactor: REAL _ 1.0, stipple: CARDINAL _ IPConstants.Gray, drawOutline: BOOL _ TRUE, drawComp:BOOL _ FALSE, showCompName: BOOL _ TRUE]; --if drawOutline is true then the outline (based on the hint) will be drawn; -- if drawComp is true then the shape of the actual component will be drawn. END.