home *** CD-ROM | disk | FTP | other *** search
- /*****
- * cheatMenus.c
- *
- *
- *****/
-
- #include "cheatMenus.h"
- #include "cheatWindow.h"
- #include "ResRefs.h"
- #include "main.h"
- #include "cheat.h"
- #include "cheatpreffile.h"
- #include "cheatfile.h"
- #include "error.h"
- #include "showhelp.h"
-
- #define kchecksaves false
-
- MenuHandle appleMenu, fileMenu, editMenu;
-
- void SetUpMenus(void)
-
- {
- Handle menuBar;
-
- menuBar = GetNewMBar(rMenuBar); /* read menus into new menu list */
- SetMenuBar(menuBar); /* set to the current menu list */
- DisposHandle(menuBar);
-
- appleMenu = GetMHandle(mApple);
- fileMenu = GetMHandle(mFile);
- editMenu = GetMHandle(mEdit);
- AddResMenu(appleMenu, 'DRVR'); /* add DA names to Apple menu */
-
- DrawMenuBar();
- }
- /* end SetUpMenus */
-
-
- /****
- * AdjustMenus()
- *
- * Enable or disable the items in the Edit menu if a DA window
- * comes up or goes away. Our application doesn't do anything with
- * the Edit menu.
- *
- ****/
-
- int enable (MenuHandle menu, short item, short ok);
-
- void AdjustMenus(void)
- {
- register WindowPeek wp = (WindowPeek) FrontWindow();
- short kind = wp ? wp->windowKind : 0;
- Boolean DA = kind < 0;
-
- enable(editMenu, 1, DA);
- enable(editMenu, 3, DA);
- enable(editMenu, 4, DA);
- enable(editMenu, 5, DA);
- enable(editMenu, 6, DA);
-
- }
-
- static
- enable(MenuHandle menu, short item, short ok)
- {
- if (ok)
- EnableItem(menu, item);
- else
- DisableItem(menu, item);
- }
-
-
- /*****
- * HandleMenu(mSelect)
- *
- * Handle the menu selection. mSelect is what MenuSelect() and
- * MenuKey() return: the high word is the menu ID, the low word
- * is the menu item
- *
- *****/
- #define BASE_RES_ID 500
- #define BASE_PICT_ID 1000
-
- void HandleMenu (long mSelect)
-
- {
- int menuID = HiWord(mSelect);
- int menuItem = LoWord(mSelect);
- Str255 name;
- GrafPtr savePort;
- WindowPeek frontWindow;
-
- switch (menuID)
- {
- case mApple:
- if (menuItem == iAbout) {
- //Alert(rAboutAlrt, nil);
- Show_help( BASE_RES_ID, BASE_RES_ID, BASE_PICT_ID,
- (StringPtr)"\pCheat II help", (StringPtr)"\pTitle page");
- }
- else {
- GetPort(&savePort);
- GetItem(appleMenu, menuItem, name);
- OpenDeskAcc(name);
- SetPort(savePort);
- }
- break;
-
- case mFile:
- switch (menuItem) {
- case iQuit:
- timeToQuit = true;
- break;
- default: break;
- }
- break;
-
- case mEdit:
- // if (!SystemEdit(menuItem-1))
- // ;
- /* if (FrontWindow() == cheatWindow)
- switch (menuItem) {
- case iCut: DlgCut((DialogPtr) cheatWindow); break;
- case iCopy: DlgCopy((DialogPtr) cheatWindow); break;
- case iPaste: DlgPaste((DialogPtr) cheatWindow); break;
- case iClear: DlgDelete((DialogPtr) cheatWindow); break;
- default: verify(false); break;
- } */
- break;
-
- default: break;
- }
- }
- /* end HandleMenu */
-
-