-- GCell.mesa -- Last Edited by: Sturgis, July 10, 1984 5:40:59 pm PDT DIRECTORY Dependencies USING[Action], Expressions USING[IdTableSet], NewCalcGlobal USING[Displayer, Document], Rope USING[ROPE], IO USING[STREAM], StructureNodes USING[StructureNode], ViewerClasses USING[Viewer]; GCell: DEFINITIONS = BEGIN OPEN Expressions, NewCalcGlobal, Rope, IO, StructureNodes, ViewerClasses; -- note: in some of the following procedures there is a BOOLEAN parameter named "entry". This should be set true when called from outside the monitor protecting the object of the call, be it a GCell or a GCellArray. These outside calls will generally come from an instance of a GCellTool, or a GCellArrayTool. The called procedure will lock the appropriate monitor for the duration of the call. StandardGCells: TYPE = {null, colTitle, colSum, rowTitle, rowSum, assignment, slot}; GCellItemDescriptor: TYPE = RECORD[ mode: GCellItemMode, justification: GCellItemJustification, rowSumMode: GCellItemRowColSumMode, colSumMode: GCellItemRowColSumMode, valueMode: GCellItemValueMode, id: ROPE, text: ROPE, zeroValText: ROPE -- used in case: mode = ShowValue, value = 0 and not NIL. ]; SetAGCellProc: TYPE = PROCEDURE[nItems: CARDINAL, getOneItem: PROCEDURE RETURNS[GCellItemDescriptor]]; GCellItemMode: TYPE = {showText, showId, showExp, showValue, noShow}; GCellItemJustification: TYPE = {left, centered, right, leftDecimal, rightDecimal}; GCellItemRowColSumMode: TYPE = {addVal, subVal, setZero, noEffect}; GCellItemValueMode: TYPE = {rowSum, colSum, expression}; SelectionDirection: TYPE = {first, next, previous, last}; NarrowGCell: PROCEDURE[REF ANY] RETURNS[StructureNode]; LoadGCell: PROCEDURE[document: NewCalcGlobal.Document, displayer: Displayer, gcaSn: StructureNode, vParent: Viewer, from: STREAM, version: CARDINAL] RETURNS[StructureNode]; CreateGCell: PROCEDURE[document: NewCalcGlobal.Document, displayer: Displayer, gcaSn: StructureNode, vParent: Viewer, type: StandardGCells] RETURNS[StructureNode]; SetGCellIdInfo: PROCEDURE[gcn: StructureNode, idTables: IdTableSet]; NoteSummers: PROCEDURE[gcn: StructureNode, rowSummer, colSummer: Dependencies.Action]; DoRowSum: PROCEDURE[gcn: StructureNode, sumToLeft: REAL] RETURNS[REAL]; DoColSum: PROCEDURE[gcn: StructureNode, sumAbove: REAL] RETURNS[REAL]; SetGCellContents: PROCEDURE[gcn: StructureNode, nItems: CARDINAL, getOneItem: PROCEDURE RETURNS[GCellItemDescriptor], entry: BOOLEAN ← FALSE]; GetGCellContents: PROCEDURE[StructureNode, SetAGCellProc, --entry--BOOLEAN ← FALSE]; StepSelection: PROCEDURE[gcn: StructureNode, itemX: CARDINAL, direction: SelectionDirection] RETURNS[ok: BOOLEAN]; ForceNoteItemSelection: PROCEDURE[itemRef: REF ANY]; -- the following procedure is exported by GCellToolImpl MakeAGCellToolInstance: PROCEDURE[document: NewCalcGlobal.Document]; -- the following procedure is exported by ArrayToolImpl BuildArrayTool: PROCEDURE[]; -- the following are exported by GCellArrayImpl SetAGCellArrayProc: TYPE = PROCEDURE[nColumns, nRows: CARDINAL, GetOneCell: PROCEDURE[SetAGCellProc]]; LoadGCellArray: PROCEDURE[document: NewCalcGlobal.Document, displayer: Displayer, vParent: Viewer, from: IO.STREAM, version: CARDINAL] RETURNS[StructureNode]; CreateGCellArray: PROCEDURE[document: NewCalcGlobal.Document, displayer: Displayer, vParent: Viewer] RETURNS[StructureNode]; SetGCellArray: PROCEDURE[gcaSn: StructureNode, nColumns, nRows: CARDINAL, GetOneCell: PROCEDURE[SetAGCellProc], entry: BOOLEAN ← FALSE]; GetGCellArray: PROCEDURE[StructureNode, SetAGCellArrayProc, --entry--BOOLEAN ← FALSE]; GetGCellArrayShape: PROCEDURE[StructureNode] RETURNS[nRows, nColumns: CARDINAL]; SetGCellArrayRow: PROCEDURE[gcaSn: StructureNode, nColumns: CARDINAL, J: CARDINAL, GetOneCell: PROCEDURE[SetAGCellProc], entry: BOOLEAN]; SetGCellArrayColumn: PROCEDURE[gcaSn: StructureNode, I: CARDINAL, nRows: CARDINAL, GetOneCell: PROCEDURE[SetAGCellProc], entry: BOOLEAN]; GetGCellArrayRow: PROCEDURE[gcaSn: StructureNode, J: CARDINAL, send: SetAGCellArrayProc, entry: BOOLEAN]; GetGCellArrayColumn: PROCEDURE[gcaSn: StructureNode, I: CARDINAL, send: SetAGCellArrayProc, entry: BOOLEAN]; GetIdTableSet: PROCEDURE[gcaSn: StructureNode, I, J: CARDINAL, callBack: PROCEDURE[IdTableSet]]; -- the following are exported by ColumnOfRows SlotCase: TYPE = {slot, GCellArray, individualHCellArray, itemHCellArray, summaryHCellArray, pageId}; SetAColumnOfRowsProc: TYPE = PROCEDURE[nRows: CARDINAL, GetOneRow: PROCEDURE[SetARowOfSlotsProc]]; SetARowOfSlotsProc: TYPE = PROCEDURE[nSlots: CARDINAL, GetOneSlot: PROCEDURE[SetASlotProc]]; SetASlotProc: TYPE = PROCEDURE[case: SlotCase, GetOneArray: PROCEDURE[SetAGCellArrayProc]]; LoadColumnOfRows: PROCEDURE[document: NewCalcGlobal.Document, displayer: Displayer, vParent: Viewer, name: Rope.ROPE, from: IO.STREAM, version: CARDINAL] RETURNS[StructureNode]; CreateColumnOfRows: PROCEDURE[document: NewCalcGlobal.Document, displayer: Displayer, vParent: Viewer, pageName: Rope.ROPE] RETURNS[StructureNode]; ResetPageNameOfColumnOfRows: PROCEDURE[info: StructureNode, pageName: Rope.ROPE]; SetColumnOfRows: PROCEDURE[sn: StructureNode, nRows: CARDINAL, getOneRow: PROCEDURE[SetARowOfSlotsProc], entry: BOOLEAN ← FALSE]; GetColumnOfRows: PROCEDURE[StructureNode, SetAColumnOfRowsProc, --entry--BOOLEAN ← FALSE]; SetColumnOfRowsName: PROCEDURE[StructureNode, Rope.ROPE]; -- following exported by ColumnOfRows for array groups CountOpenSlotsInColumnOfRows: PROCEDURE[StructureNode] RETURNS[CARDINAL]; InstallHCellArrayAtOpenSlotInColumnOfRows: PROCEDURE[sn: StructureNode, rowNumber, colNumber: CARDINAL, case: SlotCase, createIt: PROCEDURE[displayer: NewCalcGlobal.Displayer, vParent: ViewerClasses.Viewer, pageName: Rope.ROPE] RETURNS[StructureNode]]; InstallHCellArrayAtAnOpenSlotInColumnOfRows: PROCEDURE[sn: StructureNode, case: SlotCase, createIt: PROCEDURE[displayer: NewCalcGlobal.Displayer, vParent: ViewerClasses.Viewer, pageName: Rope.ROPE, rowNumber, colNumber: CARDINAL] RETURNS[StructureNode]]; GetHCellArrayAtSlotInColumnOfRows: PROCEDURE[sn: StructureNode, rowNumber, colNumber: CARDINAL] RETURNS[StructureNode]; ConnectInstalledItemArraysInColumnOfRows: PROCEDURE[sn: StructureNode, connectOneItemArray: PROCEDURE[itemHcaSn: StructureNodes.StructureNode, row, col: CARDINAL]]; GenerateSummaryArraysInColumnOfRows: PROCEDURE[sn: StructureNode, seeOneArray: PROCEDURE[summaryHcaSn: StructureNodes.StructureNode, summaryKey: LONG CARDINAL] RETURNS[continue: BOOLEAN]]; ConnectLoadedItemArraysInColumnOfRows: PROCEDURE[sn: StructureNode, connectOneItemArray: PROCEDURE[itemHcaSn: StructureNodes.StructureNode, itemKey: LONG CARDINAL, atRow: CARDINAL]]; -- the following procedures are exported by NewCalcImpl GetItemSelection: PROCEDURE RETURNS[displayer: Displayer, sn: StructureNode, itemX: CARDINAL]; NoteItemSelection: PROCEDURE[displayer: Displayer, sn: StructureNode, itemX: CARDINAL]; GetArraySelection: PROCEDURE RETURNS[displayer: Displayer, gcaSn: StructureNode, I, J: CARDINAL]; NoteArraySelection: PROCEDURE[displayer: Displayer, gcaSn: StructureNode, I, J: CARDINAL]; END.. -- September 22, 1982 6:27 pm: Sturgis, started GCell.mesa, from definitions temporarily in GCellMatrixImpl -- October 4, 1982 2:27 pm: add zero value text to GCellItemDescriptor -- October 6, 1982 5:08 pm: add MakeAGCellToolInstance, NoteSelection, and GetSelection. -- October 8, 1982 12:18 pm: add slot type to standard GCells. -- October 11, 1982 2:28 pm: move in the GCellArray procedures, define SetAGCellProc, and SetAGCellArrayProc. -- October 14, 1982 3:17 pm: cleanup the note and get selection routines, include displayer and GCellArray in the parameters. -- October 16, 1982 3:13 pm: added entry parameter to some calls to indicate that a monitor should be locked. -- October 22, 1982 1:30 pm: add modes to control interaction with row and column summers, add calls for row and collumn summers. -- October 26, 1982 3:29 pm: add selection features. -- November 2, 1982 5:08 pm: add SubstituteInGCell. -- November 3, 1982 3:10 pm: Remove SubstituteInGCell, now a logical node operation. Also add the types for Set and Get a column of rows, and related types and procedures. -- November 14, 1982 1:39 pm: change selection logic, add specific array and item select procedures. Add SetZero to row and column sum modes. -- November 14, 1982 3:20 pm: add Get/Set GCellArray Row/Column -- November 14, 1982 3:40 pm: add GetGCellArrayShape. -- February 25, 1983 2:58 pm: replace DisplayNode and LogicalNode by StructureNode. -- March 3, 1983 2:47 pm: add a procedure for GCellArrays to obtain the IdtableSet appropriate to a particular cell. -- March 4, 1983 12:57 pm: owing to problems in GCellToolImpl, have to remove the new idTables param to SetGCellContents. GCellImplA will have to call GetIdTableSet. -- March 4, 1983 1:07 pm: owing to unsafe large return record, modify GetIdTableSet to use a call back procedure to deliver its intended result.