=
BEGIN
ROPE: TYPE = Rope.ROPE;
RefTable: TYPE = REF Table;
Table:
TYPE =
RECORD [
branch: TextNode.Ref ← NIL, -- Tioga branch containing table boxes in fillInOrder
emptyNodeTemplateRoot: TextNode.Ref ← NIL, -- Tioga branch containing a node to copy when creating an empty table node
tableGrid: REF CornerStitching.Tesselation ← NIL,
newTableGrid: REF CornerStitching.Tesselation ← NIL,
backgrounds: LIST OF RefTableBackground ← NIL,
newBackgrounds: LIST OF RefTableBackground ← NIL,
rowGrids: GridNumber ← 0,
columnGrids: GridNumber ← 0,
rowGridPositions: REF GridVector ← NIL,
colGridPositions: REF GridVector ← NIL,
rowConstraints: LIST OF RefConstraint ← NIL,
colConstraints: LIST OF RefConstraint ← NIL,
rows: LIST OF AttributeElement ← NIL,
cols: LIST OF AttributeElement ← NIL,
fillInOrder: FillInOrder ← byRowThenColumn,
rowAlignment: VerticalAlignment ← center, -- alignment properties
colAlignment: HorizontalAlignment ← center,
alignChar: CHARACTER ← '.,
bearoffExtents: TSTypes.Dimensions ← [TSTypes.zeroDimn, TSTypes.zeroDimn, TSTypes.zeroDimn, TSTypes.zeroDimn],
gridOverlayThickness: TSTypes.Dimn ← TSTypes.nilDimn,
gridOverlayHue: REAL ← 0.0,
gridOverlaySaturation: REAL ← 0.0,
gridOverlayBrightness: REAL ← 0.5,
originX, originY: TSTypes.Dimn ← TSTypes.zeroDimn,
tableau: LinearSolver.Tableau
];
RefConstraint: TYPE ~ REF Constraint;
Constraint:
TYPE ~
RECORD [
equality: BOOLEAN ← TRUE,
coefficients: LIST OF Coefficient];
Coefficient:
TYPE ~
RECORD [
coefficient: REAL,
unknown: ROPE];
AttributeElement:
TYPE =
RECORD [
grid1, grid2: GridNumber,
rowAlignment: VerticalAlignment ← center, -- alignment properties
colAlignment: HorizontalAlignment ← center,
alignChar: CHARACTER ← '.,
bearoffExtents: TSTypes.Dimensions ← [TSTypes.nilDimn, TSTypes.nilDimn, TSTypes.nilDimn, TSTypes.nilDimn]
];
GridNumber: TYPE = CARDINAL;
GridVector:
TYPE =
RECORD [
grid: SEQUENCE length: NAT OF TSTypes.Dimn
];
RefTableEntry: TYPE = REF TableEntry;
TableEntry:
TYPE =
RECORD [
top, left, bottom, right: GridNumber,
entrySpecs:
SELECT boxType: BoxType
FROM
box => [
node: TextNode.Ref ← NIL, -- the text or graphics contents
nodeExtents: TSTypes.Dimensions ← [TSTypes.zeroDimn, TSTypes.zeroDimn, TSTypes.zeroDimn, TSTypes.zeroDimn], -- [left, right, up, down]
nodeExtentsValid: BOOLEAN ← FALSE, -- hint
rowAlignment: VerticalAlignment ← default, -- alignment properties
colAlignment: HorizontalAlignment ← default,
alignOnChar: BOOLEAN ← FALSE,
alignChar: CHARACTER ← '.,
alignFirst: BOOLEAN ← TRUE,
bearoffExtents: TSTypes.Dimensions ← [TSTypes.nilDimn, TSTypes.nilDimn, TSTypes.nilDimn, TSTypes.nilDimn],
tsObject: TSGraphic.Object ← NIL, -- the object representation of node
boxExtents: TSTypes.Dimensions ← [TSTypes.zeroDimn, TSTypes.zeroDimn, TSTypes.zeroDimn, TSTypes.zeroDimn], -- [left, right, up, down]
xOffset, yOffset: TSTypes.Dimn ← TSTypes.zeroDimn, -- the offset from the nodeExtents origin to the boxExtents alignment point
x, y: TSTypes.Dimn ← TSTypes.zeroDimn -- the position of the table entry relative to the table
],
rule => [
orientation: Orientation ← horizontal,
thickness: TSTypes.Dimn ← TSTypes.zeroDimn
],
background => [
hue, saturation, brightness: REAL ← 0.0
],
ENDCASE
];
RefTableBox: TYPE = REF TableBox;
TableBox: TYPE = box TableEntry;
RefTableRule: TYPE = REF TableRule;
TableRule: TYPE = rule TableEntry;
RefTableBackground: TYPE = REF TableBackground;
TableBackground: TYPE = background TableEntry;
BoxType: TYPE = {box, rule, background};
RowOrColumn: TYPE = {row, column};
FillInOrder: TYPE = {byRowThenColumn, byColumnThenRow};
HorizontalAlignment: TYPE = {default, flushLeft, flushRight, center};
VerticalAlignment: TYPE = {default, flushTop, flushBottom, center, topBaseline, bottomBaseline, centerOnTopBaseline, centerOnBottomBaseline};
Orientation: TYPE = {horizontal, vertical};
ImplementationError: ERROR [ROPE];
UnimplementedCase: ERROR;
BoxFromTile: PROCEDURE [tile: CornerStitching.TilePtr] RETURNS [box: RefTableBox];
TileFromBox: PROCEDURE [box: RefTableBox] RETURNS [tile: CornerStitching.TilePtr];
BranchToTable: PROCEDURE [node: TextNode.Ref] RETURNS [table: RefTable];
TableToBranch: PROCEDURE [table: RefTable] RETURNS [branch: TextNode.Ref];
TableBoxToRope: PROCEDURE [box: RefTableEntry] RETURNS [rope: ROPE ← NIL];
InsertEntryInGrid: PROCEDURE [table: RefTable, entry: RefTableEntry];
InsideGridToRect: PROCEDURE [left, top, right, bottom: GridNumber] RETURNS [rect: CornerStitching.Rect];
OnGridToRect: PROCEDURE [left, top, right, bottom: GridNumber] RETURNS [rect: CornerStitching.Rect];
EnumeratedEntryProc: TYPE = PROCEDURE [table: RefTable, entry: RefTableEntry] RETURNS [stop: BOOLEAN ← FALSE];
EnumerateByRows: PROCEDURE [table: RefTable, entryProc: EnumeratedEntryProc];
EnumerateByColumns: PROCEDURE [table: RefTable, entryProc: EnumeratedEntryProc];
EnumerateTable: PROCEDURE [table: RefTable, entryProc: EnumeratedEntryProc, left: GridNumber ← FIRST[GridNumber], right: GridNumber ← LAST[GridNumber], top: GridNumber ← FIRST[GridNumber], bottom: GridNumber ← LAST[GridNumber]];
WithinGridLines: PROCEDURE [entry: RefTableBox, which: RowOrColumn, grid1, grid2: GridNumber] RETURNS [BOOLEAN];