-- File: WalnutDisplayerOps.Mesa

-- Created by: Haugeland, May 11, 1983
-- Last Edited by: Willie-Sue, June 7, 1983 3:05 pm


DIRECTORY

 Menus USING [Menu],
 Rope USING [ROPE],
 WalnutDB USING [Msg, MsgSet, Relship],
 WalnutLog USING [MsgRec],
 ViewerClasses USING [Viewer];

WalnutDisplayerOps: CEDAR DEFINITIONS =

BEGIN OPEN WalnutDB, WalnutLog;

Viewer
: TYPE = ViewerClasses.Viewer;
ROPE: TYPE = Rope.ROPE;

msgMenu: Menus.Menu;
msgName: ROPE;
msgMenuAvailable: BOOL;

-- ***********************************************************
-- FieldHandle for msgSet displayers, needed by msg displayers

MsgSetFieldHandle
: TYPE = REF MsgSetFieldObject;

MsgSetFieldObject
: TYPE = RECORD[
relship: Relship,
msgViewer: Viewer← NIL,
msg: Msg,
msgName: ROPE,   -- needed for rebuilding after an abort
msgTOC: ROPE,
posOK: BOOL FALSE,
hasBeenRead: BOOL TRUE,
headersPos, msgLength: INT← 0,
prev, next: Viewer← NIL];

-- ***********************************************************
-- displaying Msgs, from WalnutMsgDisplayerImpl

DisplayMsgFromMsgSet:
PROC[mfh: MsgSetFieldHandle, msViewer: Viewer, shift: BOOL← FALSE] RETURNS[v: Viewer];

MsgCategories: PROC[msg: Msg];
-- lists the MsgSets for msg, in the walnut control window

BuildMsgDisplayer: PROC[msg: Msg, shift: BOOL← FALSE] RETURNS[Viewer];

DisplayMsgInViewer: PROC[msg: Msg, mViewer: Viewer, shift: BOOL← FALSE];

GetMsgName: PROC[v: Viewer] RETURNS[mName: ROPE];
-- of v is a Viewer for a Walnut Entity, then return its name else NIL

StuffMsgContents: PROC[v: Viewer, mName: ROPE] RETURNS[found: BOOLEAN];
-- if mName is the name of a msg, then display that msg in v else return found← FALSE

FixUpMsgViewer: PROC[mName: ROPE, v: Viewer];
-- called after transaction abort

-- ***********************************************************
-- maintaining MsgSet displayers, from WalnutMsgSetDisplayerImpl

BuildMsgSetDisplayer
:
PROC[msgSet: MsgSet, name: ROPE, shift: BOOL← FALSE, initialActive: BOOLFALSE]
  RETURNS[msV: Viewer];

DisplayMsgSetInViewer: PROC[msgSet: MsgSet, msViewer: Viewer, shift: BOOL← FALSE];

UpdateDisplayerEntities:
PROC;
-- called after DB.Aborted, so re-initialize cached entities

AddParsedMsgToMSViewer
: PROC[msg: Msg, msgR: MsgRec, msViewer: Viewer, rel: Relship];
-- used by new mail & old mail file readers

-- the following routines figure out if the referenced MsgSet is being displayed

RemoveFromMsgSetDisplayer
: PROC[msgSet: MsgSet, msg: Msg];

AddMsgToMsgSetDisplayer: PROC[msg: Msg, msgSet: MsgSet, rel: Relship];

FixUpMsgSetViewer: PROC[msName: ROPE, v: Viewer];
-- called after transaction abort

END
.