-- File: WalnutNuts.mesa
-- Contents: Interface for Nut Procs for displaying msgs & msgsets.
-- Created by: Willie-Sue, March 15, 1983
-- Last edited by:
-- Willie-Sue on: August 11, 1983 9:51 am
-- Donahue, July 27, 1983 3:15 pm
-- Cattell, June 8, 1983 3:54 pm

DIRECTORY
Nut,
NutViewer USING[ SetIcon ],
Runtime USING [IsBound],
WalnutSendOps,
WalnutDB,
WalnutDisplayerOps,
ViewerClasses;

WalnutNuts: CEDAR PROGRAM
IMPORTS
Nut, NutViewer, Runtime,
WalnutDisplayerOps, WalnutSendOps, WalnutDB =

BEGIN

----------------------------
MsgDisplayerCreate: Nut.CreateProc =
{ IF nutType=editor THEN
RETURN[WalnutSendOps.BuildSendViewer[paint: FALSE, iconic: FALSE]]
ELSE RETURN[WalnutDisplayerOps.CreateMsgViewer[eName]] };

-- this is logically the Nut.DisplayProc, but it is defined as an EditProc, 'cause it needs to pass in a rope rather than an Entity
MsgDisplayer: Nut.EditProc = { WalnutDisplayerOps.DisplayMsgInViewer[eName, newV] };

MsgEdit: Nut.EditProc = { };

MsgSetDisplayerCreate: Nut.CreateProc =
{ RETURN[WalnutDisplayerOps.CreateMsgSetViewer[eName]]};

-- like MsgDisplayer
MsgSetDisplayer: Nut.EditProc = {WalnutDisplayerOps.DisplayMsgSetInViewer[eName, newV]};

RegisterNutProcs: PROC =
BEGIN
TRUSTED {IF ~Runtime.IsBound[Nut.Register] THEN RETURN};
NutViewer.SetIcon[ WalnutDB.MsgDomain, "/Indigo/Cedar/Walnut/Walnut.icons", 2 ];
NutViewer.SetIcon[ WalnutDB.MsgSetDomain, "/Indigo/Cedar/Walnut/Walnut.icons", 1 ];
 Nut.Register[ domain: "Msg", segment: $Walnut,
     display: MsgDisplayer, create: MsgDisplayerCreate];

 Nut.Register[domain: "MsgSet", segment: $Walnut,
     display: MsgSetDisplayer, create: MsgSetDisplayerCreate];
END;

DeregisterNutProcs: PROC =
BEGIN
TRUSTED {IF ~Runtime.IsBound[Nut.Register] THEN RETURN};
 Nut.DeRegister[$Walnut, "Msg"];
 Nut.DeRegister[$Walnut, "MsgSet"];
END;

TRUSTED {
IF Runtime.IsBound[WalnutDisplayerOps.CreateMsgViewer] THEN RegisterNutProcs[] };
END.