menutiogatest.mesa; Written by R. Pausch
Last Edited by: Pausch, August 26, 1983 6:55 pm
DIRECTORY
AMTypes,
RTBasic,
Interpreter,
AMBridge,
ViewerSpecs,
ViewerOps,
Containers,
Imager,
ImagerBasic,
MessageWindow,
PressScreen,
Menus,
MenusPrivate,
Rope,
VFonts,
ViewerClasses;
menutest: CEDAR PROGRAM IMPORTS -- Interpreter, AMBridge, -- Containers, Imager, Menus, --VFonts, -- --MenusPrivate, -- MessageWindow, PressScreen, Rope = BEGIN
c: Containers.Container;
Mynotify: ViewerClasses.NotifyProc = {
[self: Viewer, input: LIST OF REF ANY]
MessageWindow.Append["A Tioga No Op, Brought to you by Nabisco", TRUE];
};
StupidNotifyRecord: Menus.EntryNotifyRecord ← [trigger: LIST[all], notifyData: LIST[$NOOP]];
tiogaBasic: Menus.Menu = [
name: "tiogaBasic",
notify: Mynotify,
entries: LIST [
[name: "Clear", actions: LIST[StupidNotifyRecord] ],
[name: "Reset", guarded: TRUE, actions: LIST[StupidNotifyRecord] ],
[name: "Get", actions: LIST[StupidNotifyRecord] ],
[name: "GetImpl", actions: LIST[StupidNotifyRecord] ],
[name: "PrevFile", actions: LIST[StupidNotifyRecord] ],
[name: "Store", guarded: TRUE, actions: LIST[StupidNotifyRecord] ],
[name: "Save", actions: LIST[StupidNotifyRecord] ],
[name: "Time", actions: LIST[StupidNotifyRecord] ],
[name: "Split", actions: LIST[StupidNotifyRecord] ],
[name: "Places", actions: LIST[
[trigger: LIST[all], notifyData: LIST[$NOOP], toggle: LIST["tiogaPlaces"] ]
]
],
[name: "Levels", actions: LIST[
[trigger: LIST[all], notifyData: LIST[$NOOP], toggle: LIST["tiogaLevels"] ]
]
],
[name: "ChangeLog", actions: LIST[StupidNotifyRecord] ]
]
];
tiogaPlaces: Menus.Menu = [
name: "tiogaPlaces",
notify: Mynotify,
beginsActive: TRUE,
entries: LIST [
[name: "Find", displayData: "Find", actions: LIST[StupidNotifyRecord] ],
[name: "Word", displayData: "Word", actions: LIST[StupidNotifyRecord] ],
[name: "Def", displayData: "Def", actions: LIST[StupidNotifyRecord] ],
[name: "Position", displayData: "Position", actions: LIST[StupidNotifyRecord] ],
[name: "Normalize", displayData: "Normalize", actions: LIST[StupidNotifyRecord] ],
[name: "PrevPlace", displayData: "PrevPlace", actions: LIST[StupidNotifyRecord] ],
[name: "Reselect", displayData: "Reselect", actions: LIST[StupidNotifyRecord] ]
]
];
tiogaLevels: Menus.Menu = [
name: "tiogaLevels",
notify: Mynotify,
beginsActive: TRUE,
entries: LIST [
[name: "FirstLevelOnly", displayData: "FirstLevelOnly", actions: LIST[StupidNotifyRecord] ],
[name: "MoreLevels", displayData: "MoreLevels", actions: LIST[StupidNotifyRecord] ],
[name: "FewerLevels", displayData: "FewerLevels", actions: LIST[StupidNotifyRecord] ],
[name: "AllLevels", displayData: "AllLevels", actions: LIST[StupidNotifyRecord] ]
]
];
tiogaMenus: LIST OF Menus.Menu = LIST [tiogaBasic, tiogaPlaces, tiogaLevels];
--note: this would be in an external file, but FileIO hasn't been converted yet — note that
the internal character quotes '"' have to be prefaces with a backslash since it's not in a file
Also note that it's three separate Ropes because the compiler can't deal with long ones (BOGUS!)...
tiogaBasicMenu: Rope.ROPE = "
[tiogaBasicMenu
[Clear =>
[allleft => $Empty ]
[allmiddle => $New ]
[allright => $CloseAndNew ]
]
[Reset guarded:
TRUE =>
[allleft guardResponse: \"about to do $RedReset\" => $RedReset ]
[allmiddle guardResponse: \"about to do $YellowReset\" => $YellowReset ]
[allright guardResponse: \"about to do $BlueReset\" => $BlueReset ]
]
[Get =>
[allleft => $Load ]
[allmiddle => $Open ]
[allright => $CloseAndOpen ]
]
[GetImpl =>
[allleft => $LoadImpl ]
[allmiddle => $OpenImpl ]
[allright => $CloseAndOpenImpl ]
]
[PrevFile =>
[allleft => $Empty ]
[allmiddle => $New ]
[allright => $CloseAndNew ]
]
[Store guarded:
TRUE =>
[allleft guardResponse: \"about to do $RedStore\" => $RedStore ]
[allmiddle guardResponse: \"about to do $YellowStore\" => $RedStore ]
[allright guardResponse: \"about to do $BlueStore\" => $BlueStore ]
]
[Save =>
[allleft => $ClearMessageWindow $RedSave ]
[allmiddle => $ClearMessageWindow $YellowSave ]
[allright => $ClearMessageWindow $BlueSave ]
]
[Time => $Time ]
[Split =>
[allleft => $RedSplit ]
[allmiddle => $YellowSplit ]
[allright => $BlueSplit ]
]
[Places => [all toggle: \"tiogaPlacesMenu\" => $NOOP ] ]
[Levels => [all toggle: \"tiogaLevelsMenu\" => $NOOP ] ]
[ChangeLog => $FUNCTION ]
]";
tiogaPlacesMenu: Rope.ROPE = "
[ tiogaPlacesMenu
[Find =>
[allleft => $FindNext ]
[allmiddle => $FindAny ]
[allright => $FindPrev ]
]
[Word =>
[allleft => $FindNextWord ]
[allmiddle => $FindAnyWord ]
[allright => $FindPrevWord ]
]
[Def =>
[allleft => $FindNextDef ]
[allmiddle => $FindAnyDef ]
[allright => $FindPrevDef ]
]
[Position => $Position ]
[Normalize =>
[allleft => $NormalizeToStart ]
[allmiddle => $NormalizeToCaret ]
[allright => $NormalizeToEnd ]
]
[PrevPlace => $PrevPlace ]
[Reselect => $Reselect ]
]";
tiogaLevelsMenu: Rope.ROPE = "
[ tiogaLevelsMenu
[FirstLevelOnly => $FirstLevelOnly]
[MoreLevels => $MoreLevels]
[FewerLevels => $FewerLevels]
[AllLevels => $AllLevels]
]
";
myDescription: Rope.ROPE = Rope.Cat[tiogaBasicMenu, tiogaPlacesMenu, tiogaLevelsMenu];
tiogaMenus: LIST OF Menus.Menu = Menus.ParseDescription[myDescription];
c ← Containers.Create[[name: "#1 Empty Container #1"]];
FOR m:
LIST
OF Menus.Menu ← tiogaMenus, m.rest
UNTIL m =
NIL
DO
IF NOT Menus.AlreadyRegistered[m.first.name] THEN Menus.RegisterMenu[m.first];
Menus.AddMenu[c, m.first.name, FALSE];
ENDLOOP;
c ← Containers.Create[[name: "#2 Empty PROTECTED Container #2", guardDestroy: TRUE]];
FOR m:
LIST
OF Menus.Menu ← tiogaMenus, m.rest
UNTIL m =
NIL
DO
IF NOT Menus.AlreadyRegistered[m.first.name] THEN Menus.RegisterMenu[m.first];
Menus.AddMenu[c, m.first.name, FALSE];
ENDLOOP;
c ← Containers.Create[[name: "#3 Empty Container #3"]];
FOR m:
LIST
OF Menus.Menu ← tiogaMenus, m.rest
UNTIL m =
NIL
DO
IF NOT Menus.AlreadyRegistered[m.first.name] THEN Menus.RegisterMenu[m.first];
Menus.AddMenu[c, m.first.name, FALSE];
ENDLOOP;
c ← Containers.Create[[name: "#7 Empty Container #7"]];
FOR m:
LIST
OF Menus.Menu ← tiogaMenus, m.rest
UNTIL m =
NIL
DO
IF NOT Menus.AlreadyRegistered[m.first.name] THEN Menus.RegisterMenu[m.first];
Menus.AddMenu[c, m.first.name, FALSE];
ENDLOOP;
c ← Containers.Create[[name: "#8 Empty Container #8"]];
FOR m:
LIST
OF Menus.Menu ← tiogaMenus, m.rest
UNTIL m =
NIL
DO
IF NOT Menus.AlreadyRegistered[m.first.name] THEN Menus.RegisterMenu[m.first];
Menus.AddMenu[c, m.first.name, FALSE];
ENDLOOP;
END.