DIRECTORY TiogaNode USING [Location, Path, Span], TiogaItemClass USING [Break]; TiogaDisplayTable: CEDAR DEFINITIONS = BEGIN DisplayTable: TYPE = REF DisplayTableRec; DisplayTableRec: TYPE = RECORD [ lastIndexUsed: INTEGER _ 0, lastY: INTEGER _ 0, objects: REF PageRectangleSequenceRec ]; PageRectangleSequenceRec: TYPE = RECORD [ SEQUENCE maxRectangle: INTEGER OF PageRectangle -- sorted in y ]; PageRectangle: TYPE = MACHINE DEPENDENT RECORD [ -- 19 words startPos: TiogaNode.Location, -- first offset in displayed rectangle endPos: TiogaNode.Location, -- last offset in displayed rectangle valid: BOOL _ TRUE, -- metrics valid for this rectangle topLevelItem: BOOL _ TRUE, -- is this rectangle for a top level item instead of a child? startOfComp: BOOL _ TRUE, -- is this rectangle the start of a composing stick load? end: Break _ eon, -- reason for terminating rectangle selectable: BOOL _ TRUE, -- can this entry be selected allInclusive: BOOL _ TRUE, -- no data in span [startPos..endPos] outside of PageRectangle filler: [0..512) _ 0, -- unused bits yBaseline: INTEGER _ 0, -- baseline displacement from top of parent xBaseline: INTEGER _ 0, -- baseline displacement from left of parent topExtent: INTEGER _ 0, -- bounding box extent above yBaseline bottomExtent: INTEGER _ 0, -- bounding box extent below yBaseline leftExtent: INTEGER _ 0, -- bounding box extent left of xBaseline rightExtent: INTEGER _ 0 -- bounding box extent right of xBaseline ]; Break: TYPE = TiogaItemClass.Break; StorePageRectangle: PROC [dt: DisplayTable, index: INTEGER, pr: PageRectangle] ; InvalidateSpan: PROC [dt: DisplayTable, span: TiogaNode.Span]; InvalidateChildren: PROC [dt: DisplayTable, parent: TiogaNode.Path]; InvalidateBranch: PROC [dt: DisplayTable, node: TiogaNode.Path]; VerticalScroll: PROC [dt: DisplayTable, upLines: INTEGER]; Resolve: PROC [dt: DisplayTable, x, y: INTEGER, useClosest: BOOL _ TRUE] RETURNS [index: INTEGER _ notFound, mappedX, mappedY: INTEGER]; notFound: INTEGER = -1; New: PROC [nEntries: INTEGER] RETURNS [dt: DisplayTable] ; Size: PROC [dt: DisplayTable] RETURNS [nEntries: INTEGER] = INLINE {RETURN[dt.objects.maxRectangle+1]}; SetSize: PROC [dt: DisplayTable, nEntries: INTEGER]; LastIndex: PROC [dt: DisplayTable] RETURNS [lastIndex: INTEGER] = INLINE {RETURN[dt.lastIndexUsed]}; SetLastIndex: PROC [dt: DisplayTable, lastIndex: INTEGER] = INLINE {dt.lastIndexUsed _ lastIndex}; LastY: PROC [dt: DisplayTable] RETURNS [lastY: INTEGER] = INLINE {RETURN[dt.lastY]}; SetLastY: PROC [dt: DisplayTable, lastY: INTEGER] = INLINE {dt.lastY _ lastY}; END. -- TiogaDisplayTable.mesa; Written by S. McGregor, May 1983 -- Edited by McGregor, September 1, 1983 11:16 am The data structures herein are used to describe the layout of the nodes in a displayed page. They are typically used for mouse resolving, incremental redisplay and scrolling. The screen layout is assumed to be non-overlapping rectangles, each representing an entire item or branch node, or a span within a text or list node. This data structure may be recursively applied by clients (such as box nodes) who wish to simulate page layout within the box node. ***** Basic DisplayTable data structures ***** It may be useful to be able to associate arbitrary data with a PageRectangle, since item nodes may wish to include their children positions. A property list in the PageRectangle would do the trick here, but is probably too expensive. RefTab? ***** Update entry in display table ***** Store a new value in the table, making room for more entries if needed, and update the lastIndexUsed and lastY fields. ***** Partial invalidation of display tables ***** Invalidate table entries contained within the span Invalidate table entries contained within the children of the parent node Invalidate table entries contained within the branch Update the line table in case of a scrolling operation. If upLines is negative then table will be scrolled downward. Invalidated table entries will be set to startPos [NIL, 0], and yOffsets will be adjusted. ***** Coordinate to rectangle mapping ***** Map DisplayTable relative coordinates to the corresponding selectable display rectangle. If useClosest is TRUE, then the algorithm will choose the closest rectangle in the event that the coordinates are not contained within any rectangle. [needs refinement -SM] ***** Table size management ***** Return a new DisplayTable with room for at least nEntries. Return the current allocated size of the display table. Reallocate the table to a new size with space to hold up to nEntries. New entries are marked valid with startPos [NIL, 0]. Return the index of the last entry in the table (client maintained). Set the index of the last entry in the table (client maintained). Return the lastY value for the table (client maintained). Set the lastY value for the table (client maintained). Êû˜JšÏc3œ™;Jšœ™1J˜šÏk ˜ Jšœ žœ˜'Jšœžœ ˜J˜—Jšœžœž˜,J˜JšË™ËJ™šœ.™.J™Jšœžœžœ˜)šœžœžœ˜ Jšœžœ˜Jšœžœ˜Jšœ žœ˜%J˜J˜—šœžœžœ˜)Jšžœžœžœ˜>Jšœ˜—J˜š œžœžœž œžœ ˜˜YJšœ˜'Jšœ žœ+˜DJšœ žœ,˜EJšœ žœ&˜?Jšœžœ&˜AJšœ žœ(˜BJšœ žœ)˜CJ˜Jšœó™ó—Jšœžœ˜#—J™šœ)™)J˜šÏnœžœžœ˜PJšœv™v——J™šœ2™2J˜šŸœžœ*˜>Jšœ2™2J˜—šŸœžœ,˜DJšœI™I—J˜šŸœžœ*˜@Jšœ4™4J™—šŸœžœžœ˜:Jšœªžœ%™Ò——J™šœ+™+J˜š Ÿœžœžœžœžœ˜HJšžœ žœžœ˜?Jšœ žœ˜Jšœˆ™ˆ——J™šœ!™!J˜šŸœžœ žœžœ˜:Jšœ:™:J˜—š Ÿœžœžœ žœž˜BJšœžœ˜$Jšœ7™7J˜—šŸœžœžœ˜4Jšœsžœ™{J˜—š Ÿ œžœžœ žœž˜HJšœžœ˜JšœD™DJ˜—šŸ œžœžœž˜BJšœ˜JšœA™AJ˜—š Ÿœžœžœ žœž˜@Jšœžœ ˜Jšœ9™9J˜—šŸœžœžœž˜:Jšœ˜Jšœ6™6J˜——Jšžœ˜J˜J˜—…— 63