MCPcopy Create free account
hub / github.com/NetHack/NetHack / DoMenuEvt

Function DoMenuEvt

outdated/sys/mac/macmenu.c:980–1055  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

978}
979
980void
981DoMenuEvt(long menuEntry)
982{
983 short menuID = HiWord(menuEntry);
984 short menuItem = LoWord(menuEntry);
985
986 switch (menuID - ID1_MBAR) /* all submenus are default case */
987 {
988 case menuApple:
989 if (menuItem == menuAppleAboutBox)
990 aboutNetHack();
991#if !TARGET_API_MAC_CARBON
992 else {
993 unsigned char daName[32];
994
995 GetMenuItemText(MHND_APPLE, menuItem, *(Str255 *) daName);
996 (void) OpenDeskAcc(daName);
997 }
998#endif
999 break;
1000
1001 /*
1002 * Those direct calls are ugly: they should be installed into cmd.c .
1003 * Those AddToKeyQueue() calls are also ugly: they should be put into
1004 * the 'STR#' resource.
1005 */
1006 case menuFile:
1007 switch (menuItem) {
1008 case menuFileRedraw:
1009 AddToKeyQueue('R' & 0x1f, 1);
1010 break;
1011
1012 case menuFilePrevMsg:
1013 AddToKeyQueue('P' & 0x1f, 1);
1014 break;
1015
1016 case menuFileCleanup:
1017 (void) SanePositions();
1018 break;
1019
1020 case menuFileEnterExplore:
1021 AddToKeyQueue('X', 1);
1022 break;
1023
1024 case menuFileSave:
1025 askSave();
1026 break;
1027
1028 case menuFileQuit:
1029 askQuit();
1030 break;
1031 }
1032 break;
1033
1034 case menuEdit:
1035#if !TARGET_API_MAC_CARBON
1036 (void) SystemEdit(menuItem - 1);
1037#endif

Callers 2

HandleKeyFunction · 0.85
HandleClickFunction · 0.85

Calls 5

aboutNetHackFunction · 0.85
AddToKeyQueueFunction · 0.85
SanePositionsFunction · 0.85
askSaveFunction · 0.85
askQuitFunction · 0.85

Tested by

no test coverage detected