-- NewCalcGlobal.mesa
--  last edit          July 22, 1984 2:31:52 pm PDT  Sturgis

DIRECTORY 
	Dependencies USING[DependencySet],
	Expressions USING[HCellIdSet, IdTable],
	IO USING[STREAM],
	Rope USING[ROPE],
	StructureNodes USING[Action, StructureNode],
	ViewerClasses USING[Viewer];
     

NewCalcGlobal: DEFINITIONS =

BEGIN

Document: TYPE = REF DocumentPublicBody;

DocumentPublicBody: TYPE = RECORD[
	dSet: Dependencies.DependencySet,
	ids: Expressions.IdTable,
	hCellIds: Expressions.HCellIdSet,
	private: REF ANY,
	procs: REF DocumentProcs];
	
DocumentProcs: TYPE = RECORD[
	executeInMonitor: PROCEDURE[Document, PROCEDURE],
	computeTotals: PROCEDURE[Document],
	doOperatorOrStructureAct: PROCEDURE[Document, StructureNodes.Action, REF ANY, REF ANY],
	adjust: PROCEDURE[Document], 
	getControlRope: PROCEDURE[Document, ControlRopeType] RETURNS[Rope.ROPE]];

ControlRopeType: TYPE = {newPageId}; 

-- following exported by DisplayerImpl, the associated procedures are declared in Displayer, but the record is declared here to avoid loops in the defs files

Displayer: TYPE = REF DisplayerBody;
DisplayerBody: TYPE;


-- following are currently exported by PageListImpl, should be declared in PageList

LoadPageList: PROCEDURE[document: Document, displayer: Displayer, vParent: ViewerClasses.Viewer, from: IO.STREAM, version: CARDINAL] RETURNS[StructureNodes.StructureNode];

CreatePageList: PROCEDURE[document: Document, displayer: Displayer, vParent: ViewerClasses.Viewer] RETURNS[StructureNodes.StructureNode];

RepaintAllOpenPages: PROCEDURE[info: StructureNodes.StructureNode];

CheckForDirtyDataInPages: PROCEDURE[info: StructureNodes.StructureNode];

SavePageList: PROCEDURE[info: StructureNodes.StructureNode, to: IO.STREAM];

ShowPageList: PROCEDURE[info: StructureNodes.StructureNode, out: IO.STREAM];

AbandonPageList: PROCEDURE[info: StructureNodes.StructureNode];

-- following are currently exported by NewCalcImpl, should be exported by PageDisplayerImpl

PageDisplayer: TYPE = REF PageDisplayerBody;
PageDisplayerBody: TYPE;

PageMode: TYPE = {individual, groupItem, groupSummary};


LoadPageDisplayer: PROCEDURE[document: Document, pageNumber: CARDINAL, pageName: Rope.ROPE, mode: PageMode, from: IO.STREAM, version: CARDINAL] RETURNS[PageDisplayer];

CreatePageDisplayer: PROCEDURE[document: Document, pageNumber: CARDINAL, pageName: Rope.ROPE, mode: PageMode] RETURNS[PageDisplayer];

ShowPageDisplayer: PROCEDURE[page: PageDisplayer, out: IO.STREAM];

CheckForDirtyDataInPage: PROCEDURE[page: PageDisplayer];

SavePageDisplayer: PROCEDURE[page: PageDisplayer, to: IO.STREAM];

NoteNewPageNumber: PROCEDURE[page: PageDisplayer, newNumber: CARDINAL];

NoteNewPageName: PROCEDURE[page: PageDisplayer, newName: Rope.ROPE];

NoteNewPageMode: PROCEDURE[page: PageDisplayer, newMode: PageMode];

CountOpenSlotsInPage: PROCEDURE[page: PageDisplayer] RETURNS[CARDINAL];

InstallHCellArrayAtOpenSlot: PROCEDURE[page: PageDisplayer, rowNumber, colNumber: CARDINAL, createIt: PROCEDURE[displayer: NewCalcGlobal.Displayer, vParent: ViewerClasses.Viewer, pageName: Rope.ROPE] RETURNS[StructureNodes.StructureNode]];

InstallHCellArrayAtAnOpenSlot: PROCEDURE[page: PageDisplayer, createIt: PROCEDURE[displayer: NewCalcGlobal.Displayer, vParent: ViewerClasses.Viewer, pageName: Rope.ROPE, rowNumber, colNumber: CARDINAL] RETURNS[StructureNodes.StructureNode]];

GetHCellArrayAtSlot: PROCEDURE[page: PageDisplayer, rowNumber, colNumber: CARDINAL] RETURNS[StructureNodes.StructureNode];

ConnectInstalledItemArrays: PROCEDURE[page: PageDisplayer, connectOneItemArray: PROCEDURE[itemHcaSn: StructureNodes.StructureNode, row, col: CARDINAL]];

GenerateSummaryArrays: PROCEDURE[page: PageDisplayer, seeOneArray: PROCEDURE[summaryHcaSn: StructureNodes.StructureNode, summaryKey: LONG CARDINAL] RETURNS[continue: BOOLEAN]];

ConnectLoadedItemArrays: PROCEDURE[page: PageDisplayer, connectOneItemArray: PROCEDURE[itemHcaSn: StructureNodes.StructureNode, itemKey: LONG CARDINAL, atRow: CARDINAL]];

RepaintOpenPage: PROCEDURE[page: PageDisplayer];

DestroyPageDisplayer: PROCEDURE[page: PageDisplayer] RETURNS[PageDisplayer]; -- always returns NIL

VerifyPageDisplayer: PROCEDURE[page: PageDisplayer, mode: PageMode];

	

END..

-- new: August 7, 1982 4:10 pm: Sturgis
-- change: October 2, 1982 4:49 pm: export WorldBody, and add a World field to NCGLobal.
-- change: October 3, 1982 1:55 pm: add a procedure to execute in monitor.  There may have been a race involving viewers, and I want to be sure not.
-- change: T: change world to REF ANY, move executeInMonitor into the global record.
-- Major change: July 10, 1984 6:55:49 pm PDT: restructure, using a document record as root.
-- Change: July 22, 1984 2:31:32 pm PDT: add assorted procedures for eealing with item and summary pages.