<> <> <> <> <> <> 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: ROPE_NIL, globalKey: ATOM_NIL] RETURNS [menu: REF] = { menu _ CDPopUpMenus.MakeMenu[globalKey, label, NIL] }; CreateMenuExtra: PUBLIC PROC [label: ROPE_NIL, globalKey: ATOM_NIL, doc: ROPE_NIL] 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: ROPE_NIL, key: REF] = { m: Menu _ CDPopUpMenus.GetMenu[menu]; [] _ PopUpMenus.Entry[m, entry, NIL, key]; }; CreateEntryExtra: PUBLIC PROC [menu: REF, entry: ROPE_NIL, key: REF, doc: ROPE_NIL] = { m: Menu _ CDPopUpMenus.GetMenu[menu]; [] _ PopUpMenus.Entry[m, entry, NIL, key, doc]; }; CallMenu: PUBLIC PROC [menu: REF] RETURNS [key: REF_NIL] = { 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: ROPE _ NIL, p: CDSequencer.CommandProc, key: ATOM _ NIL, 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.