File: WalnutWindow.Mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Willie-Sue, July 12, 1985 11:12:15 am PDT
Donahue, May 22, 1985 10:41:18 am PDT
Created by: Willie-Sue, May 11, 1983
Last Edited by: Willie-Sue, January 3, 1985 4:32:05 pm PST
Last edited by: Donahue, February 1, 1985 9:46:29 am PST
(Added WalnutActive, regularized Message and Message Set display procs)
(This is now intended to be the high-level programmer's interface to the Walnut Window procedures. Changed operations around and moved some things in from the old Walnut Window.)
DIRECTORY
Menus USING [MenuProc],
Rope USING [ROPE],
ViewerClasses USING [Viewer];
WalnutWindow: CEDAR DEFINITIONS =
BEGIN
Viewer: TYPE = ViewerClasses.Viewer;
ROPE: TYPE = Rope.ROPE;
OutCome: TYPE = {ok, flushed, notRunning};
Msg and MsgSet viewer procedures
GetMsgName:
PROC[v: Viewer]
RETURNS[mName:
ROPE];
If v is a Viewer for a Walnut Msg, then return its name else NIL
GetMsgSetName:
PROC[v: Viewer]
RETURNS[msName:
ROPE];
If v is a Viewer for a Walnut MsgSet, then return its name else NIL
CurrentVersion:
PROC[msName:
ROPE]
RETURNS[version:
INT];
Give the current "expected version" of the message set (-1 means "don't care"). This version may not agree with the database; it is simply the current version that WalnutWindow believes!
AddToMsgMenu:
PROC[label:
ROPE, proc: Menus.MenuProc, clientData:
REF
ANY ←
NIL,
onQueue: BOOL ← FALSE, doReset: BOOL ← TRUE];
adds menu button, synchronised using walnutQueue if onQueue is TRUE; if doReset then after the call to the client proc, walnut's display will be checked and updated if necessary.
Errors from WalnutOps will cause WalnutDefs.Error to be raised.
RemoveFromMsgMenu:
PROC[name:
ROPE];
removes the named button from the msg displayer menu, if such a button exists; no errors
Displaying Msgs and MsgSets
DisplayMsg:
PROC[msg:
ROPE, oldV: Viewer ←
NIL, shift:
BOOL ←
FALSE]
RETURNS[v: Viewer];
displays Msg name (if it exists) in Viewer oldV; if oldV is NIL it creates a viewer
DisplayMsgSet:
PROC[msgSet:
ROPE, shift:
BOOL ←
FALSE, repaint:
BOOL ←
TRUE]
RETURNS[v: Viewer];
returns NIL if msgSet is not a MsgSet. This operation also inserts the viewer into the state recorded by the Walnut control window, so that operations on the messages in the message set are guaranteed to use a consistent version of the set. If the message set is already displayed, then it will be repainted if repaint is TRUE
Other useful operations
StartUp:
PROC[rootFile:
ROPE, scavengeFirst:
BOOL ←
FALSE];
Open up a WalnutWindow on the database named in the root file
Shutdown:
PROC;
Close down the WalnutWindow
QueueCall:
PROC[proc:
PROC[]
RETURNS[doReset:
BOOL]]
RETURNS[outCome: OutCome];
places proc on Walnut's MBQueue; Walnut will do a Reset after the call completes, in case proc has changed the displayed state of Walnut. outCome lets the caller know what happened with the call.
Errors from WalnutOps will cause WalnutDefs.Error to be raised. If proc changed the database then proc should return TRUE, to get Walnut to update the display
GetNewMail:
PROC;
checks if user has changes, then calls DoNewMail
Expunge: PROC;
Scavenge: PROC[rootFile: ROPE];
WriteArchiveFile:
PROC[fileName:
ROPE, msgSetList:
LIST
OF
ROPE];
If the message set list is NIL, then the entire database is dumped
ReadArchiveFile:
PROC[fileName, msgSet:
ROPE, useCategoriesInFile:
BOOL ←
FALSE];
IF msgSet is NIL and useCategoriesInFile is FALSE, then messages go into Active; IF msgSet is NIL and useCategoriesInFile is TRUE, then use the ones specified in the file
IF msgSet is non-NIL THEN put all messages into it
SelectMsgSetsFromMSNames:
PROC [msNames:
LIST
OF
ROPE]
RETURNS[notFound: LIST OF ROPE];
Selects the message set buttons in the Walnut Control viewer which corresponds to the list of msNames given. Returns a list of any not found
EnumWalnutViewers:
PROC[keepSeparate:
BOOL]
RETURNS [msgSetList, msgList: LIST OF Viewer];
END.