CDMenusImpl.mesa
Copyright © 1984, 1986 by Xerox Corporation. All rights reserved.
Created by: Ch. Jacobi, September 18, 1984 3:24:53 pm PDT
Last Edited by: Ch. Jacobi, March 25, 1986 1:41:47 pm PST
Last Edited by: Jacobi June 12, 1986 1:46:42 pm PDT
Last Edited by: Christian Jacobi, August 24, 1986 7:47:32 pm PDT
DIRECTORY
Atom,
CD USING [Technology],
CDMenus,
CDMenusExtras,
CDPopUpMenus,
CDProperties,
CDSequencer,
IO,
PopUpMenus,
Rope,
TerminalIO;
CDMenusImpl: CEDAR MONITOR
IMPORTS Atom, CDPopUpMenus, CDSequencer, IO, PopUpMenus, TerminalIO
EXPORTS CDMenus, CDMenusExtras
SHARES CDPopUpMenus =
BEGIN
ROPE: TYPE = Rope.ROPE;
Menu: TYPE = PopUpMenus.Menu;
CreateMenu: PUBLIC PROC [label: ROPENIL, globalKey: ATOMNIL] RETURNS [menu: REF] = {
menu ← CDPopUpMenus.MakeMenu[globalKey, label, NIL]
};
CreateMenuExtra: PUBLIC PROC [label: ROPENIL, globalKey: ATOMNIL, doc: ROPENIL] RETURNS [menu: REF] = {
menu ← CDPopUpMenus.MakeMenu[globalKey, label, doc]
};
GetMenu: PUBLIC PROC [globalKey: ATOM] RETURNS [menu: REF] = {
menu ← CDPopUpMenus.GetMenu[globalKey]
};
CreateEntry: PUBLIC PROC [menu: REF, entry: ROPENIL, key: REF] = {
m: Menu ← CDPopUpMenus.GetMenu[menu];
[] ← PopUpMenus.Entry[m, entry, NIL, key];
};
CreateEntryExtra: PUBLIC PROC [menu: REF, entry: ROPENIL, key: REF, doc: ROPENIL] = {
m: Menu ← CDPopUpMenus.GetMenu[menu];
[] ← PopUpMenus.Entry[m, entry, NIL, key, doc];
};
CallMenu: PUBLIC PROC [menu: REF] RETURNS [key: REFNIL] = {
m: Menu ← CDPopUpMenus.GetMenu[menu];
key ← PopUpMenus.Call[m];
WHILE key#NIL AND ISTYPE[key, Menu] DO
key ← PopUpMenus.Call[NARROW[key]];
ENDLOOP;
};
CallMenuAndExecute: PUBLIC PROC [menu: REF, comm: CDSequencer.Command] = {
key: REF = CallMenu[menu].key;
WITH key SELECT FROM
a: ATOM => CDSequencer.ExecuteCommand[comm: comm, key: a];
ENDCASE => IF key#NIL THEN TerminalIO.WriteRope["** bad menu; not a command\n"];
};
ImplementCommandToCallMenu: PUBLIC ENTRY PROC[key: ATOM, menu: REF, technology: CD.Technology←NIL] = {
IF key#menu THEN ERROR;
};
count: INT ← 0;
ImplementEntryCommand: PUBLIC PROC [menu: REF, entry: ROPENIL, p: CDSequencer.CommandProc, key: ATOMNIL, queue: CDSequencer.QueueMethod ← doQueue, technology: CD.Technology ← NIL] = {
IF key=NIL THEN key ← Atom.MakeAtom[IO.PutFR1["a%g", IO.int[count ← count+1]]];
CDSequencer.ImplementCommand[key: key, proc: p, queue: queue, technology: technology];
CreateEntry[menu: menu, entry: entry, key: key];
};
END.