static void DoCommand (long mResult) { short temp,theItem,theMenu; Str255 name; theItem = LoWrd(mResult); theMenu = HiWrd(mResult); switch (theMenu) { case appleID : if (theItem==1) { ScheduleCommand(theMenu,theItem); } else { GetMenuItemText(myMenus[appleM],theItem,name); temp = OpenDeskAcc(name); } break; default : ScheduleCommand(theMenu,theItem); break; } HiliteMenu(0); }
/* SetPopMatch(theDialog, popupItemNumber, selStr) Sets currently selected item to that which matches string (case insensitive). Returns item number or zero if there is no match. Thread Safety: SetPopMatch is not thread-safe. */ int SetPopMatch(DialogPtr theDialog, int popupItemNumber, const char *selStr) { ControlHandle controlH; MenuHandle mH; int numMenuItems; int i; unsigned char temp[256]; char itemText[256]; int result; int err; if (err = XOPGetDialogItemAsControl(theDialog, popupItemNumber, &controlH)) return 0; mH = GetPopMenuHandle(theDialog, popupItemNumber); if (mH == NULL) return 0; result = 0; numMenuItems = CountMenuItems(mH); for (i=1; i<=numMenuItems; i++) { GetMenuItemText(mH, i, temp); CopyPascalStringToC(temp, itemText); if (CmpStr(itemText,selStr) == 0) { result = i; SetControlValue(controlH, result); InvalDBox(theDialog, popupItemNumber); // This can move heap. break; } } return result; }
void DoCommand(long mResult) { short theItem; short theMenu; Str255 daName; short daRefNum; theItem = LoWord(mResult); theMenu = HiWord(mResult); switch (theMenu) { case appleID: { if (theItem == 1) { Alert(rUserAlert, nil); } else { /* all non-About items in this menu are DAs */ /* type Str255 is an array in MPW 3 */ GetMenuItemText(GetMenuHandle(appleID), theItem, daName); daRefNum = OpenDeskAcc(daName); } break; } case fileID: { quit = 1; break; } case editID: { if (!SystemEdit(theItem-1)) // call Desk Manager to handle editing command if desk accessory window is the active window { switch (theItem) { case cutCommand: TECut(textH); break; case copyCommand: TECopy(textH); break; case pasteCommand: TEPaste(textH); break; case clearCommand: TEDelete(textH); break; default: break; } } } default: break; } HiliteMenu(0); }
static void DoMenuCommand( long menuAndItem ) { int myMenuNum; int myItemNum; int myResult; Str255 myDAName; WindowPtr myWindow; myMenuNum = HiWord(menuAndItem); myItemNum = LoWord(menuAndItem); GetPort(&myWindow); switch (myMenuNum) { case mApple: switch( myItemNum ) { case iAbout: DoAboutBox(); break; default: GetMenuItemText(GetMenuHandle(mApple), myItemNum, myDAName); myResult = OpenDeskAcc(myDAName); break; } break; case mFile: switch (myItemNum) { case iQuit: Com_Quit_f(); break; } break; } HiliteMenu(0); }
/* GetPopMenu(theDialog,popupItemNumber,selItem,selStr) Returns currently selected item number and string. Pass NULL for selStr if you don't care about it. Thread Safety: GetPopMenu is not thread-safe. */ void GetPopMenu(DialogPtr theDialog, int popupItemNumber, int *selItem, char *selStr) { ControlHandle controlH; MenuHandle mH; int err; *selItem = 1; if (selStr != NULL) *selStr = 0; if (err = XOPGetDialogItemAsControl(theDialog, popupItemNumber, &controlH)) return; *selItem = GetControlValue(controlH); if (selStr != NULL) { mH = GetPopMenuHandle(theDialog, popupItemNumber); if (mH != NULL) { unsigned char temp[256]; GetMenuItemText(mH, *selItem, temp); CopyPascalStringToC(temp, selStr); } } }
static boolean getmenuitem (MenuHandle hmenu, short ixmenu, bigstring bs) { if (ixmenu <= 0) return (false); GetMenuItemText (hmenu, ixmenu, bs); return (true); } /*getmenuitem*/
void wxFontEnumeratorHelper::DoEnumerate() { MenuHandle menu ; short lines ; menu = NewMenu( 32000 , "\pFont" ) ; AppendResMenu( menu , 'FONT' ) ; lines = CountMenuItems( menu ) ; for ( int i = 1 ; i < lines+1 ; i ++ ) { wxString c_name ; #if TARGET_API_MAC_CARBON CFStringRef menutext ; c_name = wxEmptyString ; if ( CopyMenuItemTextAsCFString (menu, i, &menutext) == noErr ) { c_name = wxMacCFStringHolder(menutext).AsString(wxLocale::GetSystemEncoding()); } #else Str255 p_name; GetMenuItemText( menu , i , p_name ) ; c_name = wxMacMakeStringFromPascal( p_name ); #endif /* if ( m_fixedOnly ) { // check that it's a fixed pitch font (there is *no* error here, the // flag name is misleading!) if ( tm->tmPitchAndFamily & TMPF_FIXED_PITCH ) { // not a fixed pitch font return TRUE; } } if ( m_charset != -1 ) { // check that we have the right encoding if ( lf->lfCharSet != m_charset ) { return TRUE; } } */ m_fontEnum->OnFacename( c_name ) ; } DisposeMenu( menu ) ; }
static int MO_RegisterIcon(TMO_IntMenuItem *pmi, void*) { TCHAR *uname = (pmi->UniqName) ? mir_a2t(pmi->UniqName) : mir_tstrdup(pmi->CustomName), *descr = GetMenuItemText(pmi); if (!uname && !descr) return FALSE; if (!pmi->hIcolibItem) { HICON hIcon = ImageList_GetIcon(pmi->parent->m_hMenuIcons, pmi->iconId, 0); TCHAR sectionName[256]; mir_sntprintf(sectionName, LPGENT("Menu icons") _T("/%s"), TranslateTS(pmi->parent->ptszDisplayName)); char iconame[256]; mir_snprintf(iconame, "genmenu_%s_%s", pmi->parent->pszName, uname && *uname ? uname : descr); // remove '&' if (descr) { descr = NEWTSTR_ALLOCA(descr); for (TCHAR *p = descr; *p; p++) { if ((p = _tcschr(p, '&')) == NULL) break; memmove(p, p + 1, sizeof(TCHAR)*(mir_tstrlen(p + 1) + 1)); if (*p == '\0') p++; } } SKINICONDESC sid = { 0 }; sid.flags = SIDF_TCHAR; sid.section.t = sectionName; sid.pszName = iconame; sid.description.t = descr; sid.hDefaultIcon = hIcon; pmi->hIcolibItem = IcoLib_AddIcon(&sid, 0); Safe_DestroyIcon(hIcon); if (hIcon = IcoLib_GetIcon(iconame)) { ImageList_ReplaceIcon(pmi->parent->m_hMenuIcons, pmi->iconId, hIcon); IcoLib_ReleaseIcon(hIcon); } } mir_free(uname); return FALSE; }
short GetWindowMenuItemID( StringPtr title ) { short i; Str255 menuItemTitle; i = CountMenuItems( windowMenu ); while( i ) { GetMenuItemText( windowMenu, i, menuItemTitle ); // if you open more than one file with the same name (or edit the other fork)É if( EqualPStrings( title, menuItemTitle ) ) break; i--; } return( i ); }
static void mac_menucommand(long result) { short menu, item; WindowPtr window; #if !TARGET_API_MAC_CARBON Str255 da; #endif menu = HiWord(result); item = LoWord(result); window = FrontWindow(); /* Things which do the same whatever window we're in. */ switch (menu) { case mApple: switch (item) { case iAbout: mac_openabout(); goto done; #if !TARGET_API_MAC_CARBON default: GetMenuItemText(GetMenuHandle(mApple), item, da); OpenDeskAcc(da); goto done; #endif } break; case mFile: switch (item) { case iNew: mac_newkey(); goto done; case iClose: mac_closewindow(window); goto done; case iQuit: cleanup_exit(0); goto done; } break; } /* If we get here, handling is up to window-specific code. */ if (mac_wininfo(window)->menu != NULL) (*mac_wininfo(window)->menu)(window, menu, item); done: HiliteMenu(0); }
short GetColorMenuResID( short menuItem ) { Handle h; Str255 menuText; short resID; ResType resType; GetMenuItemText( colorMenu, menuItem, menuText ); h = GetNamedResource( 'HEct', menuText ); if( h ) { GetResInfo( h, &resID, &resType, menuText ); return resID; } else return( CM_StartingResourceID ); }
static void set_about_item(void){ Str255 aboutitem; StringHandle abouthandle; GetMenuItemText( GetMenuHandle(mApple), iAbout, aboutitem); abouthandle = NewString( aboutitem); if( abouthandle){ StringPtr curApName = LMGetCurApName(); long len = Munger( (Handle)abouthandle, 1, "MathLink\252", 9, curApName + 1, *curApName); if( len > 0){ **abouthandle = (unsigned char)len; HLock( (Handle)abouthandle); SetMenuItemText( GetMenuHandle(mApple), iAbout, *abouthandle); } DisposeHandle( (Handle)abouthandle); } }
int _handle_user_event( unsigned long ticks) { EventRecord event; if( WaitNextEvent(everyEvent, &event, ticks, nil)){ long menuResult = 0; short menuID, menuItem; WindowPtr window; Str255 daName; switch ( event.what ) { case mouseDown: if( FindWindow(event.where, &window) == inMenuBar) menuResult = MenuSelect(event.where); break; case keyDown: if( event.modifiers & cmdKey ) menuResult = MenuKey((short)event.message & charCodeMask); break; case kHighLevelEvent: AEProcessAppleEvent(&event); break; } menuID = HiWord(menuResult); menuItem = LoWord(menuResult); switch ( menuID ) { case mFile: MLDone = MLAbort = 1; break; case mApple: switch ( menuItem ) { case iAbout: do_about_box(); break; default: GetMenuItemText(GetMenuHandle(mApple), menuItem, daName); break; } HiliteMenu(0); } } return MLDone; }
void wxFontEnumeratorHelper::DoEnumerate() { MenuHandle menu ; Str255 p_name ; short lines ; menu = NewMenu( 32000 , "\pFont" ) ; AppendResMenu( menu , 'FONT' ) ; lines = CountMenuItems( menu ) ; for ( int i = 1 ; i < lines+1 ; i ++ ) { GetMenuItemText( menu , i , p_name ) ; wxString c_name = wxMacMakeStringFromPascal(p_name) ; /* if ( m_fixedOnly ) { // check that it's a fixed pitch font (there is *no* error here, the // flag name is misleading!) if ( tm->tmPitchAndFamily & TMPF_FIXED_PITCH ) { // not a fixed pitch font return TRUE; } } if ( m_charset != -1 ) { // check that we have the right encoding if ( lf->lfCharSet != m_charset ) { return TRUE; } } */ m_fontEnum->OnFacename( c_name ) ; } DisposeMenu( menu ) ; }
void KeyBinder::UpdateMenu(wxMenu* menu) { const wxMenuItemList& list = menu->GetMenuItems(); for (wxMenuItemList::Node* node = list.GetFirst(); node != NULL; node = node->GetNext()) { wxMenuItem* item = node->GetData(); wxString label; if (GetMenuItemText(item, label)) { item->SetText(label); } } }
static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *lpmii) { TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)lpmii->dwItemData), *p; if (pimi == NULL) return; // check for separator before if (uItem) { UINT fType = GetMenuItemTypeData(hMenu, uItem - 1, p); if (p != NULL && fType != MFT_SEPARATOR) { if ((p->mi.position / SEPARATORPOSITIONINTERVAL) != (pimi->mi.position / SEPARATORPOSITIONINTERVAL)) { // but might be supposed to be after the next one instead if (!(uItem < GetMenuItemCount(hMenu) && GetMenuItemType(hMenu, uItem) == MFT_SEPARATOR)) InsertSeparator(hMenu, uItem); uItem++; } } } // check for separator after if (uItem < GetMenuItemCount(hMenu)) { UINT fType = GetMenuItemTypeData(hMenu, uItem, p); if (p != NULL && fType != MFT_SEPARATOR) if ((p->mi.position / SEPARATORPOSITIONINTERVAL) != (pimi->mi.position / SEPARATORPOSITIONINTERVAL)) InsertSeparator(hMenu, uItem); } // create local copy *lpmii so we can change some flags MENUITEMINFO mii = *lpmii; int count = GetMenuItemCount(hMenu); if (count != 0 && (count % 33) == 0 && pimi->mi.root != NULL) { if (!(mii.fMask & MIIM_FTYPE)) mii.fType = 0; mii.fMask |= MIIM_FTYPE; mii.fType |= MFT_MENUBARBREAK; } if (!pimi->CustomName) mii.dwTypeData = GetMenuItemText(pimi); InsertMenuItem(hMenu, uItem, TRUE, &mii); }
void nsNativeViewerApp::DispatchMenuItemWithoutWindow(PRInt32 menuResult) { long menuID = HiWord(menuResult); long menuItem = LoWord(menuResult); switch (menuID) { case menu_Apple: switch (menuItem) { case cmd_About: ::Alert(128, nil); break; default: Str255 daName; GetMenuItemText(GetMenuHandle(menu_Apple), menuItem, daName); #if !TARGET_CARBON OpenDeskAcc(daName); #endif break; } break; case menu_File: switch (menuItem) { case cmd_New: gTheApp->OpenWindow(); break; case cmd_Open: nsBrowserWindow * newWindow; gTheApp->OpenWindow((PRUint32)0, newWindow); newWindow->DoFileOpen(); break; case cmd_Quit: gTheApp->Exit(); break; } break; } }
EXPORT(sqInt) primitiveGetMenuItemText(void) { char * ptr; sqInt oop; sqInt size; MenuHandle menuHandle; sqInt i; Str255 aString; sqInt menuHandleOop; sqInt anInteger; sqInt _return_value; menuHandleOop = interpreterProxy->stackValue(1); anInteger = interpreterProxy->stackIntegerValue(0); if (interpreterProxy->failed()) { return null; } menuHandle = ((MenuHandle) (interpreterProxy->positive64BitValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { _return_value = interpreterProxy->success(0); if (interpreterProxy->failed()) { return null; } interpreterProxy->popthenPush(3, _return_value); return null; } aString[0] = 0; GetMenuItemText(menuHandle,anInteger,aString); size = aString[0]; oop = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classString(), size); ptr = interpreterProxy->firstIndexableField(oop); for (i = 0; i <= (size - 1); i += 1) { ptr[i] = (aString[i + 1]); } if (interpreterProxy->failed()) { return null; } interpreterProxy->popthenPush(3, oop); return null; }
nsEventStatus nsNativeBrowserWindow::DispatchMenuItem(PRInt32 aID) { nsEventStatus status = nsEventStatus_eIgnore; PRInt32 xpID = 0; long menuID = HiWord(aID); long menuItem = LoWord(aID); switch (menuID) { case menu_Apple: switch (menuItem) { case cmd_About: ::Alert(128, nil); break; default: Str255 daName; GetMenuItemText(GetMenuHandle(menu_Apple), menuItem, daName); #if !TARGET_CARBON OpenDeskAcc(daName); #endif break; } break; case menu_File: switch (menuItem) { case cmd_New: xpID = VIEWER_WINDOW_OPEN; break; case cmd_Open: xpID = VIEWER_FILE_OPEN; break; case cmd_Close: CloseFrontWindow(); status = nsEventStatus_eConsumeNoDefault; break; case cmd_ViewSource: xpID = VIEW_SOURCE; break; case cmd_Save: /*n.a.*/ break; case cmd_SaveAs: /*n.a.*/ break; case cmd_Revert: /*n.a.*/ break; case cmd_PageSetup: /*n.a.*/ break; case cmd_Print: xpID = VIEWER_PRINT; break; case cmd_PrintSetup: xpID = VIEWER_PRINT_SETUP; break; case cmd_Quit: xpID = VIEWER_EXIT; break; } break; case menu_Edit: switch (menuItem) { case cmd_Undo: /*n.a.*/ break; case cmd_Cut: xpID = VIEWER_EDIT_CUT; break; case cmd_Copy: xpID = VIEWER_EDIT_COPY; break; case cmd_Paste: xpID = VIEWER_EDIT_PASTE; break; case cmd_Clear: /*n.a.*/ break; case cmd_SelectAll: xpID = VIEWER_EDIT_SELECTALL; break; case cmd_Find: xpID = VIEWER_EDIT_FINDINPAGE; break; case cmd_Preferences: xpID = VIEWER_PREFS; break; } break; case menu_Sample: if ( menuItem < cmd_FirstXPToolkitSample ) xpID = VIEWER_DEMO0 + menuItem - cmd_Sample0; else xpID = VIEWER_XPTOOLKITDEMOBASE + (menuItem - cmd_FirstXPToolkitSample); break; case menu_Debug: switch (menuItem) { case cmd_DebugMode: xpID = VIEWER_VISUAL_DEBUGGING; break; case cmd_ReflowTest: xpID = VIEWER_REFLOW_TEST; break; case cmd_DumpContents: xpID = VIEWER_DUMP_CONTENT; break; case cmd_DumpFrames: xpID = VIEWER_DUMP_FRAMES; break; case cmd_DumpViews: xpID = VIEWER_DUMP_VIEWS; break; case cmd_DumpStyleSheets: xpID = VIEWER_DUMP_STYLE_SHEETS; break; case cmd_DumpStyleContexts: xpID = VIEWER_DUMP_STYLE_CONTEXTS; break; case cmd_DebugSave: xpID = VIEWER_DEBUGSAVE; break; case cmd_DebugOutputText: xpID = VIEWER_DISPLAYTEXT; break; case cmd_DebugOutputHTML: xpID = VIEWER_DISPLAYHTML; break; case cmd_DebugToggleSelection: xpID = VIEWER_TOGGLE_SELECTION; break; case cmd_DebugRobot: xpID = VIEWER_DEBUGROBOT; break; #ifdef GC_LEAK_DETECTOR case cmd_DumpLeaks: { nsresult rv; nsCOMPtr<nsILeakDetector> leakDetector = do_GetService("@mozilla.org/xpcom/leakdetector;1", &rv); if (NS_SUCCEEDED(rv)) leakDetector->DumpLeaks(); } break; #endif case cmd_GFXScrollBars: xpID =VIEWER_GFX_SCROLLBARS_ON; break; case cmd_NativeScrollBars: xpID =VIEWER_GFX_SCROLLBARS_OFF; break; } break; case menu_Tools: switch (menuItem) { case cmd_JSConsole: xpID = JS_CONSOLE; break; case cmd_EditorMode: xpID = EDITOR_MODE; break; case cmd_Top100: xpID = VIEWER_TOP100; break; case cmd_TableInspector: xpID = VIEWER_TABLE_INSPECTOR; break; case cmd_ImageInspector: xpID = VIEWER_IMAGE_INSPECTOR; break; } break; case menu_URLS: switch (menuItem) { case cmd_SaveURL1: xpID = VIEWER_SAVE_TEST_URL1; break; case cmd_SaveURL2: xpID = VIEWER_SAVE_TEST_URL2; break; case cmd_LoadURL1: xpID = VIEWER_GOTO_TEST_URL1; break; case cmd_LoadURL2: xpID = VIEWER_GOTO_TEST_URL2; break; } break; case submenu_Print: xpID = VIEWER_ONE_COLUMN + menuItem - cmd_PrintOneColumn; break; case submenu_CompatibilityMode: switch (menuItem) { case cmd_Compatibility_UseDTD: xpID = VIEWER_USE_DTD_MODE; break; case cmd_Compatibility_NavQuirks: xpID = VIEWER_NAV_QUIRKS_MODE; break; case cmd_Compatibility_Standard: xpID = VIEWER_STANDARD_MODE; break; } break; } // Dispatch xp menu items if (xpID != 0) { // beard: nsBrowserWindow::DispatchMenuItem almost always returns nsEventStatus_eIgnore. // this causes double menu item dispatching for most items except for VIEWER_EXIT! nsBrowserWindow::DispatchMenuItem(xpID); status = nsEventStatus_eConsumeNoDefault; } return status; }
// LR 1.66 -- complete rewrite (basically) of this entire routine...it was UGLY! OSStatus HandleMenu( long mSelect, short modifiers ) { short menuID = HiWord( mSelect ); short menuItem = LoWord( mSelect ); short colorResID; WindowRef frontWindow; DialogPtr dlgRef = NULL; EditWindowPtr dWin = NULL; Str255 currentWindowName, newFrontWindowName; // NS: v1.6.6, for window menu WindowRef currentWindow; // NS: this too // Predetermine what type of window we have to work with frontWindow = FrontNonFloatingWindow(); if( frontWindow ) { DialogPtr dlg = GetDialogFromWindow( frontWindow ); if( kHexEditWindowTag == GetWindowKind( frontWindow ) ) dWin = (EditWindowPtr) GetWRefCon( frontWindow ); else if( g.gotoDlg == dlg || g.searchDlg == dlg ) dlgRef = dlg; } switch( menuID ) { case kAppleMenu: if( menuItem == AM_About ) HexEditAboutBox(); #if !TARGET_API_MAC_CARBON else { GrafPtr savePort; Str255 name; GetPort( &savePort ); GetMenuItemText( appleMenu, menuItem, name ); OpenDeskAcc( name ); SetPort( savePort ); } #endif break; case kFileMenu: switch( menuItem ) { case FM_New: gPrefs.overwrite = false; //LR 190 -- overwrite mode makes no sense in a new document NewEditWindow(); break; case FM_Open: AskEditWindow( kWindowNormal ); break; // HR/LR 050328 - Handle FM_Disassemble menu item case FM_Disassemble: g.disassemble = !g.disassemble; if ( g.disassemble ) { dWin->drawMode = DM_Disassembly; dWin->bytesPerLine = kDisBytesPerLine; dWin->hexStart = kDisHexStart; dWin->asciiStart = kDisASCIIStart; } else { dWin->drawMode = DM_Dump; dWin->bytesPerLine = kHexBytesPerLine; dWin->hexStart = kHexHexStart; dWin->asciiStart = kHexASCIIStart; } /* Make sure the editOffset position starts on a new line */ dWin->editOffset -= dWin->editOffset % dWin->bytesPerLine; UpdateEditWindows(); break; case FM_OtherFork: // LR: I want to see both! if( dWin ) { short fork; //LR 180 EditWindowPtr ewin; if( dWin->fork == FT_Data ) fork = FT_Resource; else fork = FT_Data; /*LR 180 -- OpenEditWindow checks for this if( NULL != (ewin = LocateEditWindow( &dWin->fsSpec, fork )) ) // LR: 1.7 - boolean typecast causes failure! { SelectWindow( ewin->oWin.theWin ); // just select existing theWin } else // try to open other fork in new theWin! */ { g.forkMode = fork; OpenEditWindow( &dWin->fsSpec, kWindowNormal, true ); } } break; case FM_CompareFiles: //LR 180 -- now pass in modifiers to allow select override if( GetCompareFiles( modifiers ) ) DoComparison(); break; //LR: 1.66 - NOTE: dWin == NULL == frontWindow! case FM_Save: if( dWin && dWin->oWin.Save ) dWin->oWin.Save( frontWindow ); break; case FM_SaveAs: if( dWin && dWin->oWin.SaveAs ) dWin->oWin.SaveAs( frontWindow ); break; case FM_Revert: if( dWin && dWin->oWin.Revert ) //LR 1.72 -- check before reverting (could be dangerous!) { ParamText( dWin->fsSpec.name, NULL, NULL, NULL ); switch( CautionAlert( alertRevert, NULL ) ) { case ok: dWin->oWin.Revert( frontWindow ); break; } } break; case FM_Close: if( dWin ) CloseEditWindow( frontWindow ); else if( dlgRef ) { HideWindow( frontWindow ); //LR: 1.7 -- no need.GetDialogWindow( dlgRef ) ); } break; case FM_Quit: if( CloseAllEditWindows() ) g.quitFlag = true; break; case FM_PageSetup: #if TARGET_API_MAC_CARBON // sel - carbon session based printing _doPageSetupDialog(&g.pageFormat); #else PrOpen(); PrStlDialog( g.HPrint ); PrClose(); #endif break; case FM_Print: if( dWin ) PrintWindow( dWin ); break; } break; case kEditMenu: #if !TARGET_API_MAC_CARBON if( !SystemEdit( menuItem -1 ) ) #endif { if( dWin ) switch( menuItem ) { case EM_Undo: UndoOperation(); break; case EM_Cut: CutSelection( dWin ); break; case EM_Copy: CopySelection( dWin ); break; case EM_Paste: PasteSelection( dWin ); break; case EM_Clear: ClearSelection( dWin ); break; case EM_SelectAll: dWin->startSel = 0; dWin->endSel = dWin->fileSize; UpdateOnscreen( dWin->oWin.theWin ); break; } else if( dlgRef ) switch( menuItem ) { case EM_Cut: DialogCut( dlgRef ); TEToScrap(); break; case EM_Copy: DialogCopy( dlgRef ); TEToScrap(); break; case EM_Paste: TEFromScrap(); DialogPaste( dlgRef ); break; case EM_Clear: DialogDelete( dlgRef ); break; case EM_SelectAll: break; } } break; case kFindMenu: switch ( menuItem ) { case SM_Find: openfind: OpenSearchDialog(); break; case SM_FindForward: gPrefs.searchForward = true; PerformTextSearch( dWin, kSearchUpdateUI ); //LR 190 -- if dWin is NULL will operate on first edit window, if any (allows search in find dialog) break; case SM_FindBackward: gPrefs.searchForward = false; PerformTextSearch( dWin, kSearchUpdateUI ); //LR 190 -- if dWin is NULL will operate on first edit window break; case SM_Replace: //LR 190 -- add replace & find next (must have a window with selection to start!) if( !dWin ) dWin = FindFirstEditWindow(); // allow this to work in find dialog, etc. if( dWin && dWin->startSel != dWin->endSel ) { EditChunk **replaceChunk; if( !g.searchBuffer[0] ) // if nothing to find open dialog goto openfind; replaceChunk = NewChunk( g.replaceText[0], 0, 0, CT_Unwritten ); if( replaceChunk ) { // Copy replacement text to chunk buffer BlockMoveData( g.replaceText+1, *(*replaceChunk)->data, g.replaceText[0] ); // Do the replacement (with undo) g.replaceAll = false; RememberOperation( dWin, EO_Paste, &gUndo ); PasteOperation( dWin, replaceChunk ); // We're done with the chunk now DisposeChunk( NULL, replaceChunk ); } // Then try to find the next occurance (in LAST direction searched!) and display it if( !PerformTextSearch( dWin, kSearchUpdateUI ) ) ScrollToSelection( dWin, dWin->startSel, true ); } break; case SM_GotoAddress: OpenGotoAddress(); break; } break; case kOptionsMenu: switch ( menuItem ) { case OM_HiAscii: gPrefs.asciiMode = !gPrefs.asciiMode; if( gPrefs.asciiMode ) g.highChar = 0xFF; else g.highChar = 0x7F; UpdateEditWindows(); break; case OM_DecimalAddr: gPrefs.decimalAddr = !gPrefs.decimalAddr; UpdateEditWindows(); break; case OM_Backups: gPrefs.backupFlag = !gPrefs.backupFlag; break; case OM_WinSize: gPrefs.constrainSize = !gPrefs.constrainSize; break; case OM_Overwrite: gPrefs.overwrite = !gPrefs.overwrite; break; case OM_NonDestructive: gPrefs.nonDestructive = !gPrefs.nonDestructive; break; case OM_MoveOnlyPaging: gPrefs.moveOnlyPaging = !gPrefs.moveOnlyPaging; break; case OM_Unformatted: gPrefs.formatCopies = !gPrefs.formatCopies; break; case OM_VertBars: gPrefs.vertBars = !gPrefs.vertBars; UpdateEditWindows(); break; case OM_ComparePref: // LR: compare options ComparisonPreferences(); break; case OM_OpenOnLaunch: gPrefs.dialogAtLaunch = !gPrefs.dialogAtLaunch; //LR -- 192 break; } break; // LR: Add color scheme menu case kColorMenu: colorResID = GetColorMenuResID( menuItem ); if( menuItem == CM_UseColor ) { gPrefs.useColor = !gPrefs.useColor; // toggle color usage } else if( dWin && dWin->csResID > 0 ) // can't color B&W windows! { if( _cmCheckedItem ) CheckMenuItem( colorMenu, _cmCheckedItem, false ); if( (modifiers & optionKey) ) // option down == change all windows (set default color) { EditWindowPtr eWin = FindFirstEditWindow(); while( eWin ) { if( GetWindowKind( eWin->oWin.theWin ) == kHexEditWindowTag ) { eWin->csResID = colorResID; eWin->csMenuID = menuItem; //LR 181 -- for menu tagging } eWin = FindNextEditWindow( eWin ); } goto savepref; } else //LR 181 -- default is (back) to changing color of a single window! { if( GetWindowKind( dWin->oWin.theWin ) == kHexEditWindowTag ) { dWin->csResID = colorResID; dWin->csMenuID = menuItem; //LR 181 -- for menu tagging } } } else { savepref: //LR 190 -- no window open == set preferred color gPrefs.csResID = colorResID; //LR 180 -- save prefs when changing all gPrefs.csMenuID = menuItem; } UpdateEditWindows(); break; // LR : 1.7 - rewrite with bug checking (could crash accessing NULL window) case kWindowMenu: GetMenuItemText( windowMenu, menuItem, newFrontWindowName ); currentWindow = FrontNonFloatingWindow(); while( currentWindow ) { GetWTitle( currentWindow, currentWindowName ); if( EqualPStrings( currentWindowName, newFrontWindowName ) ) { SelectWindow( currentWindow ); break; } currentWindow = GetNextWindow( currentWindow ); } break; } HiliteMenu( 0 ); AdjustMenus(); return( noErr ); }
/*** ADJUST MENUS ***/ OSStatus AdjustMenus( void ) { register WindowRef theWin; short windowKind; Boolean isDA, isObjectWin, selection, scrapExists, undoExists, isGotoWin, isFindWin; EditWindowPtr dWin = NULL; Str31 menuStr; short i; long scrapSize; // LR: v1.6.5 Str255 frontWindowName, menuItemTitle; Boolean namesMatch; theWin = FrontNonFloatingWindow(); if( theWin ) { isGotoWin = (g.gotoDlg && theWin == GetDialogWindow( g.gotoDlg )); //LR: 1.7 - don't get window info on NULL! isFindWin = (g.searchDlg && theWin == GetDialogWindow( g.searchDlg )); windowKind = GetWindowKind( theWin ); isDA = ( windowKind < 0 ); isObjectWin = GetWindowKind( theWin ) == kHexEditWindowTag; if( isObjectWin ) { dWin = (EditWindowPtr)GetWRefCon( theWin ); //LR: 1.66 - don't set unless an edit window! selection = dWin->endSel > dWin->startSel; } else { selection = (isGotoWin || isFindWin); } } else // LR: v1.6.5 if no window is visible, then nothing is true! { isGotoWin = isFindWin = isObjectWin = isDA = selection = 0; } // LR: v1.6.5 - rewrite of scrap check if( isObjectWin || isFindWin || isGotoWin ) { #if TARGET_API_MAC_CARBON ScrapFlavorFlags flavorFlags; ScrapRef scrapRef; OSErr anErr; anErr = GetCurrentScrap( &scrapRef ); if( !anErr ) anErr = GetScrapFlavorFlags( scrapRef, kScrapFlavorTypeText, &flavorFlags ); // non-blocking check for scrap data if( !anErr ) anErr = GetScrapFlavorSize( scrapRef, kScrapFlavorTypeText, &scrapSize ); // blocking call to get size #else long offset; scrapSize = GetScrap( NULL, 'TEXT', &offset ); #endif scrapExists = scrapSize > 0; } else scrapExists = false; undoExists = (isObjectWin && gUndo.type != 0 && gUndo.theWin == dWin); // check for NULL gUndo! // LR: - enable file menu items during search, via Aaron D. // LR: _enableMenuItem( fileMenu, FM_New, g.searchDlg == NULL ); // LR: _enableMenuItem( fileMenu, FM_Open, g.searchDlg == NULL ); // LR: 1.65 moved print names to string for localization GetIndString( menuStr, strPrint, (isObjectWin && dWin->startSel < dWin->endSel) ? 2 : 1 ); SetMenuItemText( fileMenu, FM_Print, menuStr ); //LR 188 -- page setup should always be enabled // _enableMenuItem( fileMenu, FM_PageSetup, isObjectWin ); //SEL: 1.7 - enabled for carbon _enableMenuItem( fileMenu, FM_Print, isObjectWin ); // HR/LR 050328 - Enable and check FM_Disassemble menu item _enableMenuItem( fileMenu, FM_Disassemble, isObjectWin ); CheckMenuItem( fileMenu, FM_Disassemble, g.disassemble ); _enableMenuItem( fileMenu, FM_OtherFork, isObjectWin ); _enableMenuItem( fileMenu, FM_Close, isDA || isObjectWin || isFindWin || isGotoWin ); // LR: v1.6.5 rewrite via Max Horn _enableMenuItem( fileMenu, FM_Save, isObjectWin && dWin->dirtyFlag ); _enableMenuItem( fileMenu, FM_SaveAs, isObjectWin ); _enableMenuItem( fileMenu, FM_Revert, isObjectWin && dWin->refNum && dWin->dirtyFlag ); _enableMenuItem( editMenu, 0, theWin != NULL ); _enableMenuItem( editMenu, EM_Undo, isDA || undoExists ); _enableMenuItem( editMenu, EM_Cut, isDA || (selection && (!gPrefs.overwrite || (gPrefs.overwrite && !gPrefs.nonDestructive))) ); _enableMenuItem( editMenu, EM_Copy, isDA || selection ); _enableMenuItem( editMenu, EM_Paste, isDA || (scrapExists && (!gPrefs.overwrite || (gPrefs.overwrite && !gPrefs.nonDestructive))) ); _enableMenuItem( editMenu, EM_Clear, isDA || selection ); _enableMenuItem( editMenu, EM_SelectAll, isDA || isObjectWin || isFindWin || isGotoWin ); _enableMenuItem( findMenu, 0, isObjectWin || isFindWin || isGotoWin ); /* 1.65 _enableMenuItem( findMenu, SM_Find, isObjectWin ); _enableMenuItem( findMenu, SM_GotoAddress, isObjectWin ); */ _enableMenuItem( findMenu, SM_FindForward, selection || (isObjectWin && dWin->fileSize && g.searchBuffer[0]) ); //LR 1.72 -- only enable w/something to search :) _enableMenuItem( findMenu, SM_FindBackward, selection || (isObjectWin && dWin->fileSize && g.searchBuffer[0]) ); _enableMenuItem( findMenu, SM_Replace, selection || (isObjectWin && dWin->fileSize && g.searchBuffer[0]) ); _enableMenuItem( optionsMenu, OM_NonDestructive, gPrefs.overwrite ); //LR 1.74 -- only available in overwrite mode CheckMenuItem( optionsMenu, OM_HiAscii, gPrefs.asciiMode ); CheckMenuItem( optionsMenu, OM_DecimalAddr, gPrefs.decimalAddr ); CheckMenuItem( optionsMenu, OM_Backups, gPrefs.backupFlag ); CheckMenuItem( optionsMenu, OM_WinSize, gPrefs.constrainSize ); CheckMenuItem( optionsMenu, OM_Overwrite, gPrefs.overwrite ); CheckMenuItem( optionsMenu, OM_NonDestructive, !gPrefs.nonDestructive ); //LR 190 -- REVERSE (updated text, not code) CheckMenuItem( optionsMenu, OM_MoveOnlyPaging, gPrefs.moveOnlyPaging ); //LR 180 -- optional move only paging CheckMenuItem( optionsMenu, OM_Unformatted, !gPrefs.formatCopies ); CheckMenuItem( optionsMenu, OM_VertBars, gPrefs.vertBars ); CheckMenuItem( optionsMenu, OM_OpenOnLaunch, gPrefs.dialogAtLaunch ); //WD_rpw 12-18-04 // LR: v1.6.5 Lots of re-writing on handling the color scheme menu #if !TARGET_API_MAC_CARBON // no color usage if not displayable! if( !g.colorQDFlag ) gPrefs.useColor = false; #endif // LR: v1.6.5 CheckMenuItem( gColorMenu, CM_UseColor, gPrefs.useColor ); // allow turning on even if not usable // LR: v1.6.5 Try to show status of color in new windows to help "intuitive" nature of menu GetIndString( menuStr, strColor, (gPrefs.useColor) ? 2 : 1 ); SetMenuItemText( colorMenu, CM_UseColor, menuStr ); //LR 181 -- show the current window color (or default if no windows) if( _cmCheckedItem ) CheckMenuItem( colorMenu, _cmCheckedItem, false ); _cmCheckedItem = isObjectWin ? dWin->csMenuID : gPrefs.csMenuID; CheckMenuItem( colorMenu, _cmCheckedItem, true ); selection = gPrefs.useColor; //LR 190 -- && isObjectWin && dWin->csResID > 0; i = CountMenuItems( colorMenu ); do { _enableMenuItem( colorMenu, i, selection ); // LR: v1.6.5 only enable for color windows } while( --i > 2 ); // NS: v1.6.6 checkmark front window in window menu if( theWin ) GetWTitle( theWin, frontWindowName ); //LR: 1.66 - don't use NULL window! else frontWindowName[0] = 0; i = CountMenuItems( windowMenu ); _enableMenuItem(windowMenu, 0, i != 0); // dim out Window menu if no windows up. while( i ) { GetMenuItemText( windowMenu, i, menuItemTitle ); // if you open more than one file with the same name (or edit the other fork)É namesMatch = EqualPStrings( frontWindowName, menuItemTitle ); // Éyou will have multiple items in the menu with the same text, and all will be checkmarked CheckMenuItem( windowMenu, i, namesMatch ); i--; } return( noErr ); }
MenuGameMain::MenuGameMain(std::shared_ptr<Settings> &settings) : Menu((std::shared_ptr<AcedSharedDLL::BaseSettings>)settings) { SetMenuHeader(std::string("Game Main Menu")); SetId(AcedSharedDLL::STATES::EDITORMAINMENU); int widestItem = settings->GetFontWidth(GetMenuHeader()); auto itemStoreNew = std::shared_ptr<AcedSharedDLL::MenuItem>(new AcedSharedDLL::MenuItem()); itemStoreNew->SetId(AcedSharedDLL::STATES::NEW); itemStoreNew->SetMenuItemText(std::string("New Map")); if (widestItem < settings->GetFontWidth(itemStoreNew->GetMenuItemText())) { widestItem = settings->GetFontWidth(itemStoreNew->GetMenuItemText()); } AddMenuItem(itemStoreNew); auto itemStoreLoad = std::shared_ptr<AcedSharedDLL::MenuItem>(new AcedSharedDLL::MenuItem()); itemStoreLoad->SetId(AcedSharedDLL::STATES::LOAD); itemStoreLoad->SetMenuItemText(std::string("Load Map")); if (widestItem < settings->GetFontWidth(itemStoreLoad->GetMenuItemText())) { widestItem = settings->GetFontWidth(itemStoreLoad->GetMenuItemText()); } AddMenuItem(itemStoreLoad); auto itemStoreEdit = std::shared_ptr<AcedSharedDLL::MenuItem>(new AcedSharedDLL::MenuItem()); itemStoreEdit->SetId(AcedSharedDLL::STATES::EDITORMAINMENU); itemStoreEdit->SetMenuItemText(std::string("Edit Mode")); if (widestItem < settings->GetFontWidth(itemStoreEdit->GetMenuItemText())) { widestItem = settings->GetFontWidth(itemStoreEdit->GetMenuItemText()); } AddMenuItem(itemStoreEdit); auto itemStoreOptions = std::shared_ptr<AcedSharedDLL::MenuItem>(new AcedSharedDLL::MenuItem()); itemStoreOptions->SetId(AcedSharedDLL::STATES::OPTIONS); itemStoreOptions->SetMenuItemText(std::string("Options")); if (widestItem < settings->GetFontWidth(itemStoreOptions->GetMenuItemText())) { widestItem = settings->GetFontWidth(itemStoreOptions->GetMenuItemText()); } AddMenuItem(itemStoreOptions); auto itemStoreQuit = std::shared_ptr<AcedSharedDLL::MenuItem>(new AcedSharedDLL::MenuItem()); itemStoreQuit->SetId(AcedSharedDLL::STATES::QUIT); itemStoreQuit->SetMenuItemText(std::string("Quit")); if (widestItem < settings->GetFontWidth(itemStoreQuit->GetMenuItemText())) { widestItem = settings->GetFontWidth(itemStoreQuit->GetMenuItemText()); } AddMenuItem(itemStoreQuit); widestItem += (AcedSharedDLL::Constants::TileSize() * 4); SetMenuX((settings->GetScreenWidth() / 2) - (widestItem / 2) - (AcedSharedDLL::Constants::TileSize() * 4)); SetMenuY(100); SetMenuHeaderX((settings->GetScreenWidth() / 2) - (widestItem / 2) - (AcedSharedDLL::Constants::TileSize() * 4)); SetMenuHeaderY(50 + AcedSharedDLL::Constants::TileSize()); SetMenuHeaderHeight(50 - AcedSharedDLL::Constants::TileSize()); int i = 0; int xloc = settings->GetScreenWidth() /2; int yloc = 100 + AcedSharedDLL::Constants::TileSize(); int yspacing = AcedSharedDLL::Constants::TileSize()*2; auto menuSize = GetMenuItems().size(); for (i = 0; i < menuSize; i++) { GetMenuItems()[i]->SetMenuItemX(xloc); GetMenuItems()[i]->SetMenuItemY(yloc); yloc = yloc + yspacing; } SetMenuWidth(settings->GetScreenWidth() - (2 * GetMenuX())); SetMenuHeaderWidth(settings->GetScreenWidth() - (2 * GetMenuX())); SetMenuHeight(yloc - GetMenuY()); SetCurrentSelection(); }
void do_menu_command( long menuResult) { short menuID; short menuItem; menuID= GET_MENU_ID(menuResult); menuItem= GET_MENU_ITEM(menuResult); switch (menuID) { case mApple: switch (menuItem) { case iAbout: break; default: #if defined(OP_PLATFORM_MAC_CFM) && !defined(OP_PLATFORM_MAC_CARBON_FLAG) { Str255 daName; GetMenuItemText(GetMenuHandle(mApple), menuItem, daName); OpenDeskAcc(daName); } #endif break; } break; case mFile: switch (menuItem) { case iOpen: case iOpenPassive: handle_open(menuItem==iOpen, false); break; case iOpenActiveUI: case iOpenPassiveUI: handle_open(menuItem==iOpenActiveUI, true); break; case iClose: close_front_window(); break; case iQuit: handle_quit(); break; } break; case mSpecial: switch(menuItem) { case iSendPacket: send_packet(); break; case iSendStream: send_stream(); break; case iProtocolAlive: is_alive(); break; case iAcceptingConnections: accepting_connections= !accepting_connections; check_menu_item(menuID, menuItem, accepting_connections); break; case iActiveEnumeration: active_enumeration= !active_enumeration; check_menu_item(menuID, menuItem, active_enumeration); break; case iSetTimeout: set_timeout(); break; case iGetInfo: report_info(); break; case iGetConfigString: // get_config_string(); break; } break; case mWindowMenu: switch(menuItem) { case iCascade: case iTile: cascade_or_tile_windows(menuItem==iCascade); break; } } #if OP_PLATFORM_MAC_CFM || OP_PLATFORM_MAC_MACHO HiliteMenu(0); #endif adjust_menus(); return; }
/**************************************************************** PopDraw() is the function associated with the user item that invokes the popup menu. We draw the box to look like a menu cell, and then call the appropriate drawProc to fill in the cell with the actual contents. If the drawProc is nil, we draw the menu item as text. We gray the cell if the menu is disabled. Finally, we draw a down arrow to indicate that the button is a popup menu. If the popup item is static, we only draw the cell contents. ****************************************************************/ pascal_ifMac void PopDraw(DialogPtr theDialog, short itemNum) { GrafPtr savePort; short theType; Handle itemHandle; Rect itemBox; Rect cellBox; MenuHandle theMenu; //SysEnvRec theWorld; RGBColor SaveBack, SaveFore, DefaultBack, DefaultFore; char name[256]; short i; short drawStringFlag; // Added by Glen to code for support of Type-in Pop-Up menus // if drawStringFlag = 1 then we don't draw text string ... drawStringFlag = 0; for ( i = 0 ; i < sa_numPopUps ; i++ ) if ( (sa_popTable[i].dialogPtr == theDialog) && (sa_popTable[i].popupItemNum == itemNum) ) break; if (i == sa_numPopUps) { SysBeep(1); return; } // should not happen since the dialog must have been registered // for PopDraw to have been called GetPortGrafPtr(&savePort); SetPortDialogPort(theDialog); // SysEnvirons(curSysEnvVers,&theWorld); // if (theWorld.hasColorQD) { if (ColorQDAvailable()) { GetForeColor(&SaveFore); GetBackColor(&SaveBack); DefaultMenuColors(&DefaultFore, &DefaultBack); if (sa_popTable[i].bStatic) { DefaultFore = SaveFore; DefaultBack = SaveBack; } } theMenu = GetMenuHandle(sa_popTable[i].menuID); if (!theMenu) { SysBeep(1); return; } /* change item's width to match the menu */ GetDialogItem(theDialog,itemNum,&theType,&itemHandle,&itemBox); CalcMenuSize(theMenu); if (sa_popTable[i].itemWidth == 0) { if (sa_popTable[i].drawProc == nil) // itemBox.right = itemBox.left + (**theMenu).menuWidth + 20 + 2; itemBox.right = itemBox.left + GetMenuWidth(theMenu) + 20 + 2; else //itemBox.right = itemBox.left + (**theMenu).menuWidth + 2; itemBox.right = itemBox.left + GetMenuWidth(theMenu) + 2; } else if (sa_popTable[i].itemWidth == -1) { // Type-in Pop-Up Menu itemBox.right = itemBox.left + 20 + 2; drawStringFlag = 1; } else itemBox.right = itemBox.left + sa_popTable[i].itemWidth + 2; SetDialogItem(theDialog,itemNum,theType,itemHandle,&itemBox); /* draw the box */ if (TRUE) { // !sa_popTable[i].bStatic // if (theWorld.hasColorQD) RGBBackColor(&DefaultBack); if (ColorQDAvailable()) RGBBackColor(&DefaultBack); EraseRect( &itemBox ); // if (theWorld.hasColorQD) RGBForeColor(&SaveFore); if (ColorQDAvailable()) RGBForeColor(&SaveFore); PenNormal(); // if (sa_popTable[i].bStatic) PenPat((ConstPatternParam)&qd.gray); //if (sa_popTable[i].bStatic) PenPat((ConstPatternParam)&GRAY_BRUSH()); //if (sa_popTable[i].bStatic) PenPat((ConstPatternParam)&GRAY_BRUSH); if (sa_popTable[i].bStatic) PenPatQDGlobalsGray(); FrameRect(&itemBox); /* draw the shadow */ MoveTo(itemBox.left + 3, itemBox.bottom); Line((itemBox.right - itemBox.left) - 3, 0); Line(0, -((itemBox.bottom - itemBox.top) - 2)); PenNormal(); } else EraseRect( &itemBox ); /* draw the current item in the box */ // if (theWorld.hasColorQD) RGBForeColor(&DefaultFore); if (ColorQDAvailable()) RGBForeColor(&DefaultFore); // Draw text if no Type-in Pop-Up if(drawStringFlag == 0){ if (sa_popTable[i].drawProc != nil) { cellBox = itemBox; InsetRect(&cellBox, 1, 1); (* sa_popTable[i].drawProc) (theMenu, sa_popTable[i].lastItemSelected, &cellBox, // so the drawProc gets the same-size rect, // whether it's drawing in the menu or in the pop-box true, // since we are indeed drawing a pop box item //&theWorld, &DefaultFore, &DefaultBack); } else { MoveTo(itemBox.left + 15, itemBox.top + 4 + (itemBox.bottom - itemBox.top)/2); GetMenuItemText(theMenu, sa_popTable[i].lastItemSelected, (unsigned char *)name); DrawString((unsigned char *)name); } } if (TRUE) { // !sa_popTable[i].bStatic /* cover the item in gray if the menu is disabled */ // if (!((**theMenu).enableFlags & ENABLE_BIT)) { #if TARGET_API_MAC_CARBON Boolean menuIsEnabled = IsMenuItemEnabled(theMenu,0); #else Boolean menuIsEnabled = (**theMenu).enableFlags & ENABLE_BIT; #endif if (!menuIsEnabled) { //PenPat((ConstPatternParam)&qd.gray); //PenPat((ConstPatternParam)&GRAY_BRUSH); PenPatQDGlobalsGray(); PenMode(patOr); //if (theWorld.hasColorQD) RGBForeColor(&DefaultBack); if (ColorQDAvailable()) RGBForeColor(&DefaultBack); else ForeColor(whiteColor); PaintRect(&itemBox); PenNormal(); // if (theWorld.hasColorQD) RGBForeColor(&DefaultFore); if (ColorQDAvailable()) RGBForeColor(&DefaultFore); else ForeColor(blackColor); } /* draw the down arrow */ itemBox.left = itemBox.right - 20; DrawArrow(&itemBox, kDown, sa_popTable[i].bStatic); } //if (theWorld.hasColorQD) { if (ColorQDAvailable()) { RGBForeColor(&SaveFore); RGBBackColor(&SaveBack); } SetPortGrafPort(savePort); }
Boolean OverridePopClick(DialogPtr theDialog, short itemHit, long *result) { GrafPtr savePort; MenuHandle theMenu; short count; char name[256],str[256]; short i; if(gVUTrick == gVUTrick2) return false; // we will not override PopClick for ( i = 0 ; i < sa_numPopUps ; i++ ) if ( sa_popTable[i].dialogPtr == theDialog && sa_popTable[i].popupItemNum == itemHit ) break; if (i == sa_numPopUps || sa_popTable[i].bStatic) { *result = 0; return false; // we will not override PopClick } // else we have found the i value theMenu = GetMenuHandle(sa_popTable[i].menuID); GetMenuItemText(theMenu, sa_popTable[i].lastItemSelected, (StringPtr)str); my_p2cstr((StringPtr)str); GetPortGrafPtr(&savePort); if(REQUEST("enter value to select",str,str) == ok) { short numItems = CountMenuItems(theMenu); UpperText(str,strlen(str)); //UppercaseText(str,strlen(str),smSystemScript); //smCurrentScript // find the string for ( count = numItems ; count >= 1 ; count-- ) { GetMenuItemText(theMenu, count, (StringPtr)name); my_p2cstr((StringPtr)name); UpperText(name,strlen(name)); //UppercaseText(name,strlen(name),smSystemScript); //smCurrentScript if (strcmp(str,name) == 0) { if (!MenuItemEnabled(theMenu, count)) { REQUEST("Item found but disabled",str,str); *result = 0; SetPortGrafPort(savePort); return false; } else break; // we found it } } if(count == 0) { // we did not find the string REQUEST("Could not find string in Menu",str,str); *result = 0; SetPortGrafPort(savePort); return false; } else { // count holds the menuItem Num we want SetItemMark(theMenu, sa_popTable[i].lastItemSelected, noMark); sa_popTable[i].lastItemSelected = count; SetItemMark(theMenu, sa_popTable[i].lastItemSelected, kCheckMark); *result = sa_popTable[i].menuID*0x10000 + sa_popTable[i].lastItemSelected; } } SetPortGrafPort(savePort); PopDraw(sa_popTable[i].dialogPtr, sa_popTable[i].popupItemNum); return(true); //we have overriden PopClick }
/**************************************************************** PopClick() gets called when there is a click in a dialog item that might be a popup item. It determines if the click is in a popup and if so handles the click. It brings up the popup on the item that was last selected for this menu. It returns true if the item was a popup item and the mouse was released on a valid item. In that case, it also stores the value returned by PopUpMenuSelect in *result (a long containing the menu and item ID selected). If the item selected was in this menu (as opposed to one of its submenus), that item is stored in the lastItemSelected field for this popup in the popTable. In that case, the item is also checked, and the previously selected item is unchecked. For a click on a static popup item, PopClick returns false, returns 0 in *result and doesn't call PopUpMenuSelect. -- On the IBM, this simply gets the index value of the selected item. ****************************************************************/ Boolean PopClick(DialogPtr theDialog, short itemHit, LONGPTR result) { #ifndef IBM GrafPtr savePort; short theType; Rect popBox; Rect titleBox; MenuHandle theMenu; long res; short count; char name[256]; Handle itemHandle; #else HANDLE itemHandle; #endif short i; #ifndef IBM if (OverridePopClick(theDialog, itemHit, result)) return true; #endif for ( i = 0 ; i < sa_numPopUps ; i++ ) if ( (sa_popTable[i].dialogPtr == theDialog) && (sa_popTable[i].popupItemNum == itemHit) ) break; if (i == sa_numPopUps || sa_popTable[i].bStatic) { *result = 0; return false; } #ifdef IBM itemHandle = GetDlgItem (theDialog, itemHit); sa_popTable[i].lastItemSelected = // (SendMessage (itemHandle, CB_GETCURSEL, 0, 0L)+1); //Combo box item ID's begin at 0 (SendMessage ((HWND)itemHandle, CB_GETCURSEL, 0, 0L)+1); //Combo box item ID's begin at 0 return FALSE; #else GetPortGrafPtr(&savePort); SetPortDialogPort(theDialog); theMenu = GetMenuHandle(sa_popTable[i].menuID); if (sa_popTable[i].drawProc == nil) // grow items to match size of pop-box for ( count = CountMenuItems(theMenu) ; count >= 1 ; count-- ) { GetMenuItemText(theMenu, count, (StringPtr)name); my_p2cstr((StringPtr)name); strcat(name, " "); my_c2pstr(name); SetMenuItemText(theMenu, count, (StringPtr)name); my_p2cstr((StringPtr)name); } if (sa_popTable[i].titleItemNum) { GetDialogItem(theDialog,sa_popTable[i].titleItemNum,&theType,&itemHandle,&titleBox); InvertRect(&titleBox); } GetDialogItem(theDialog,sa_popTable[i].popupItemNum,&theType,&itemHandle,&popBox); LocalToGlobal((Point *)(&popBox.top)); LocalToGlobal((Point *)(&popBox.bottom)); res = PopUpMenuSelect( theMenu, popBox.top + 1, popBox.left + 1, sa_popTable[i].lastItemSelected ); if (sa_popTable[i].titleItemNum) InvertRect(&titleBox); if (LoWord(res) && (HiWord(res) == sa_popTable[i].menuID)) { SetItemMark(theMenu, sa_popTable[i].lastItemSelected, noMark); sa_popTable[i].lastItemSelected = LoWord(res); SetItemMark(theMenu, sa_popTable[i].lastItemSelected, kCheckMark); } if (sa_popTable[i].drawProc == nil) // shrink items back to normal for ( count = CountMenuItems(theMenu) ; count >= 1 ; count-- ) { GetMenuItemText(theMenu, count, (StringPtr)name); my_p2cstr((StringPtr)name); name[strlen(name) - 5] = 0; my_c2pstr(name); SetMenuItemText(theMenu, count, (StringPtr)name); my_p2cstr((StringPtr)name); } *result = res; SetPortGrafPort(savePort); if (LoWord(res)) { PopDraw(sa_popTable[i].dialogPtr, sa_popTable[i].popupItemNum); return true; } return false; #endif //IBM }
static void HandleMenuChoice(long wParam) { UINT update; Str255 applname; #if defined(SUPPORT_STATSAVE) UINT num; char ext[16]; #endif update = 0; switch(wParam) { case IDM_ABOUT: AboutDialogProc(); break; case IDM_RESET: pccore_cfgupdate(); pccore_reset(); break; case IDM_CONFIGURE: ConfigDialogProc(); break; case IDM_NEWDISK: dialog_newdisk(); break; case IDM_FONT: dialog_font(); break; case IDM_EXIT: np2running = FALSE; break; case IDM_FDD1OPEN: dialog_changefdd(0); break; case IDM_FDD1EJECT: diskdrv_setfdd(0, NULL, 0); break; case IDM_FDD2OPEN: dialog_changefdd(1); break; case IDM_FDD2EJECT: diskdrv_setfdd(1, NULL, 0); break; case IDM_FDD3OPEN: dialog_changefdd(2); break; case IDM_FDD3EJECT: diskdrv_setfdd(2, NULL, 0); break; case IDM_FDD4OPEN: dialog_changefdd(3); break; case IDM_FDD4EJECT: diskdrv_setfdd(3, NULL, 0); break; case IDM_SASI1OPEN: dialog_changehdd(0x00); break; case IDM_SASI1REMOVE: diskdrv_sethdd(0x00, NULL); break; case IDM_SASI2OPEN: dialog_changehdd(0x01); break; case IDM_SASI2REMOVE: diskdrv_sethdd(0x01, NULL); break; case IDM_SCSI0OPEN: dialog_changehdd(0x20); break; case IDM_SCSI0REMOVE: diskdrv_sethdd(0x20, NULL); break; case IDM_SCSI1OPEN: dialog_changehdd(0x21); break; case IDM_SCSI1REMOVE: diskdrv_sethdd(0x21, NULL); break; case IDM_SCSI2OPEN: dialog_changehdd(0x22); break; case IDM_SCSI2REMOVE: diskdrv_sethdd(0x22, NULL); break; case IDM_SCSI3OPEN: dialog_changehdd(0x23); break; case IDM_SCSI3REMOVE: diskdrv_sethdd(0x23, NULL); break; case IDM_ROLNORMAL: menu_setrotate(0); changescreen(scrnmode & (~SCRNMODE_ROTATEMASK)); break; case IDM_ROLLEFT: menu_setrotate(1); changescreen((scrnmode & (~SCRNMODE_ROTATEMASK)) | SCRNMODE_ROTATELEFT); break; case IDM_ROLRIGHT: menu_setrotate(2); changescreen((scrnmode & (~SCRNMODE_ROTATEMASK)) | SCRNMODE_ROTATERIGHT); break; case IDM_DISPSYNC: menu_setdispmode(np2cfg.DISPSYNC ^ 1); update |= SYS_UPDATECFG; break; case IDM_RASTER: menu_setraster(np2cfg.RASTER ^ 1); update |= SYS_UPDATECFG; break; case IDM_NOWAIT: menu_setwaitflg(np2oscfg.NOWAIT ^ 1); update |= SYS_UPDATECFG; break; case IDM_AUTOFPS: menu_setframe(0); update |= SYS_UPDATECFG; break; case IDM_60FPS: menu_setframe(1); update |= SYS_UPDATECFG; break; case IDM_30FPS: menu_setframe(2); update |= SYS_UPDATECFG; break; case IDM_20FPS: menu_setframe(3); update |= SYS_UPDATECFG; break; case IDM_15FPS: menu_setframe(4); update |= SYS_UPDATECFG; break; case IDM_SCREENOPT: dialog_scropt(); break; case IDM_MOUSE: mousemng_toggle(MOUSEPROC_SYSTEM); menu_setmouse(np2oscfg.MOUSE_SW ^ 1); update |= SYS_UPDATECFG; break; case IDM_MIDIOPT: MPU98DialogProc(); break; case IDM_MIDIPANIC: rs232c_midipanic(); mpu98ii_midipanic(); pc9861k_midipanic(); break; case IDM_KEY: menu_setkey(0); keystat_resetjoykey(); update |= SYS_UPDATECFG; break; case IDM_JOY1: menu_setkey(1); keystat_resetjoykey(); update |= SYS_UPDATECFG; break; case IDM_JOY2: menu_setkey(2); keystat_resetjoykey(); update |= SYS_UPDATECFG; break; case IDM_MOUSEKEY: menu_setkey(3); keystat_resetjoykey(); update |= SYS_UPDATECFG; break; case IDM_XSHIFT: menu_setxshift(np2cfg.XSHIFT ^ 1); keystat_forcerelease(0x70); update |= SYS_UPDATECFG; break; case IDM_XCTRL: menu_setxshift(np2cfg.XSHIFT ^ 2); keystat_forcerelease(0x74); update |= SYS_UPDATECFG; break; case IDM_XGRPH: menu_setxshift(np2cfg.XSHIFT ^ 4); keystat_forcerelease(0x73); update |= SYS_UPDATECFG; break; case IDM_F11KANA: menu_setf11key(0); mackbd_resetf11(); update |= SYS_UPDATEOSCFG; break; case IDM_F11STOP: menu_setf11key(1); mackbd_resetf11(); update |= SYS_UPDATEOSCFG; break; case IDM_F11NFER: menu_setf11key(3); mackbd_resetf11(); update |= SYS_UPDATEOSCFG; break; case IDM_F11USER: menu_setf11key(4); mackbd_resetf11(); update |= SYS_UPDATEOSCFG; break; case IDM_F12MOUSE: menu_setf12key(0); mackbd_resetf12(); update |= SYS_UPDATEOSCFG; break; case IDM_F12COPY: menu_setf12key(1); mackbd_resetf12(); update |= SYS_UPDATEOSCFG; break; case IDM_F12XFER: menu_setf12key(3); mackbd_resetf12(); update |= SYS_UPDATEOSCFG; break; case IDM_F12USER: menu_setf12key(4); mackbd_resetf12(); update |= SYS_UPDATEOSCFG; break; case IDM_BEEPOFF: menu_setbeepvol(0); beep_setvol(0); update |= SYS_UPDATECFG; break; case IDM_BEEPLOW: menu_setbeepvol(1); beep_setvol(1); update |= SYS_UPDATECFG; break; case IDM_BEEPMID: menu_setbeepvol(2); beep_setvol(2); update |= SYS_UPDATECFG; break; case IDM_BEEPHIGH: menu_setbeepvol(3); beep_setvol(3); update |= SYS_UPDATECFG; break; case IDM_NOSOUND: menu_setsound(0); update |= SYS_UPDATECFG; break; case IDM_PC9801_14: menu_setsound(0x01); update |= SYS_UPDATECFG; break; case IDM_PC9801_26K: menu_setsound(0x02); update |= SYS_UPDATECFG; break; case IDM_PC9801_86: menu_setsound(0x04); update |= SYS_UPDATECFG; break; case IDM_PC9801_26_86: menu_setsound(0x06); update |= SYS_UPDATECFG; break; case IDM_PC9801_86_CB: menu_setsound(0x14); update |= SYS_UPDATECFG; break; case IDM_PC9801_118: menu_setsound(0x08); update |= SYS_UPDATECFG; break; case IDM_SPEAKBOARD: menu_setsound(0x20); update |= SYS_UPDATECFG; break; case IDM_SPARKBOARD: menu_setsound(0x40); update |= SYS_UPDATECFG; break; case IDM_AMD98: menu_setsound(0x80); update |= SYS_UPDATECFG; break; case IDM_JASTSND: menu_setjastsnd(np2oscfg.jastsnd ^ 1); update |= SYS_UPDATEOSCFG; break; case IDM_SEEKSND: menu_setmotorflg(np2cfg.MOTOR ^ 1); update |= SYS_UPDATECFG; break; case IDM_MEM640: menu_setextmem(0); update |= SYS_UPDATECFG; break; case IDM_MEM16: menu_setextmem(1); update |= SYS_UPDATECFG; break; case IDM_MEM36: menu_setextmem(3); update |= SYS_UPDATECFG; break; case IDM_MEM76: menu_setextmem(7); update |= SYS_UPDATECFG; break; case IDM_MEM116: menu_setextmem(11); update |= SYS_UPDATECFG; break; case IDM_MEM136: menu_setextmem(13); update |= SYS_UPDATECFG; break; case IDM_BMPSAVE: dialog_writebmp(); break; case IDM_CALENDAR: CalendarDialogProc(); break; case IDM_DISPCLOCK: menu_setdispclk(np2oscfg.DISPCLK ^ 1); update |= SYS_UPDATECFG; break; case IDM_DISPFLAME: menu_setdispclk(np2oscfg.DISPCLK ^ 2); update |= SYS_UPDATECFG; break; case IDM_JOYX: menu_setbtnmode(np2cfg.BTN_MODE ^ 1); update |= SYS_UPDATECFG; break; case IDM_RAPID: menu_setbtnrapid(np2cfg.BTN_RAPID ^ 1); update |= SYS_UPDATECFG; break; case IDM_I286SAVE: debugsub_status(); break; default: if (HiWord(wParam) == IDM_APPLE) { GetMenuItemText(GetMenuHandle(IDM_APPLE), LoWord(wParam), applname); #if !TARGET_API_MAC_CARBON (void)OpenDeskAcc(applname); #endif } #if defined(SUPPORT_STATSAVE) else if (HiWord(wParam) == IDM_STATSAVE) { num = LoWord(wParam); if ((num >= 1) && (num < (1 + 10))) { SPRINTF(ext, np2flagext, num - 1); flagsave(ext); } else if ((num >= 12) && (num < (12 + 10))) { SPRINTF(ext, np2flagext, num - 12); flagload(ext, TRUE); } } #endif break; } sysmng_update(update); HiliteMenu(0); }
void TkMacHandleMenuSelect( long mResult, int optionKeyPressed) { short theItem = LoWord(mResult); short theMenu = HiWord(mResult); Str255 name; Tk_Window tkwin; Window window; TkDisplay *dispPtr; if (mResult == 0) { TkMacHandleTearoffMenu(); TkMacClearMenubarActive(); return; } switch (theMenu) { case kAppleMenu: switch (theItem) { case kAppleAboutItem: { Tcl_CmdInfo dummy; if (optionKeyPressed || gInterp == NULL || Tcl_GetCommandInfo(gInterp, "tkAboutDialog", &dummy) == 0) { TkAboutDlg(); } else { Tcl_Eval(gInterp, "tkAboutDialog"); } break; } default: GetMenuItemText(tkAppleMenu, theItem, name); HiliteMenu(0); OpenDeskAcc(name); return; } break; case kFileMenu: switch (theItem) { case kSourceItem: /* TODO: source script */ SourceDialog(); break; case kCloseItem: /* Send close event */ if (TkMacHaveAppearance() >= 0x110) { window = TkMacGetXWindow(FrontNonFloatingWindow()); } else { window = TkMacGetXWindow(FrontWindow()); } dispPtr = TkGetDisplayList(); tkwin = Tk_IdToWindow(dispPtr->display, window); TkGenWMDestroyEvent(tkwin); break; case kQuitItem: /* Exit */ if (optionKeyPressed || gInterp == NULL) { Tcl_Exit(0); } else { Tcl_Eval(gInterp, "exit"); } break; } break; case kEditMenu: /* * This implementation just send keysyms * the Tk thinks are associated with function keys that * do Cut, Copy & Paste on a Sun keyboard. */ GenerateEditEvent(theItem); break; default: TkMacDispatchMenuEvent(theMenu, theItem); TkMacClearMenubarActive(); break; } /* * Finally we unhighlight the menu. */ HiliteMenu(0); } /* TkMacHandleMenuSelect */
MenuMapOptions::MenuMapOptions(std::shared_ptr<Settings> &settings, std::shared_ptr<AcedSharedDLL::Map> ¤tMap) : Menu((std::shared_ptr<AcedSharedDLL::BaseSettings>)settings) { SetMap(currentMap); SetMenuHeader(std::string("Map Options")); SetId(AcedSharedDLL::STATES::EDITORMAPOPTIONS); int widestItem = settings->GetFontWidth(GetMenuHeader()); auto itemStoreCurrentWidth = std::shared_ptr<AcedSharedDLL::MenuItem>(new AcedSharedDLL::MenuItem()); itemStoreCurrentWidth->SetMenuItemText(std::string("Current Width:")); //might need to delete this tempval char array? mmm looks to be in stack so should die when method finishs.... std::string tempVal; tempVal = std::to_string(GetMap()->GetMapWidth()); itemStoreCurrentWidth->InitMenuItemProperty(tempVal); itemStoreCurrentWidth->SetMenuItemTargetable(false); if (widestItem < settings->GetFontWidth(itemStoreCurrentWidth->GetMenuItemText())) { widestItem = settings->GetFontWidth(itemStoreCurrentWidth->GetMenuItemText()); } AddMenuItem(itemStoreCurrentWidth); auto itemStoreNewWidth = std::shared_ptr<AcedSharedDLL::MenuItem>(new AcedSharedDLL::MenuItem()); itemStoreNewWidth->InitMenuItemProperty(""); itemStoreNewWidth->SetOptionId(AcedSharedDLL::OPTIONTYPES::WIDTHOPTION); itemStoreNewWidth->SetMenuItemText(std::string("New Width:")); if (widestItem < settings->GetFontWidth(itemStoreNewWidth->GetMenuItemText())) { widestItem = settings->GetFontWidth(itemStoreNewWidth->GetMenuItemText()); } AddMenuItem(itemStoreNewWidth); auto itemStoreCurrentHeight = std::shared_ptr<AcedSharedDLL::MenuItem>(new AcedSharedDLL::MenuItem()); itemStoreCurrentHeight->SetMenuItemText(std::string("Current Height:")); tempVal = std::to_string(GetMap()->GetMapHeight()); itemStoreCurrentHeight->InitMenuItemProperty(tempVal); itemStoreCurrentHeight->SetMenuItemTargetable(false); if (widestItem < settings->GetFontWidth(itemStoreCurrentHeight->GetMenuItemText())) { widestItem = settings->GetFontWidth(itemStoreCurrentHeight->GetMenuItemText()); } AddMenuItem(itemStoreCurrentHeight); auto itemStoreNewHeight = std::shared_ptr<AcedSharedDLL::MenuItem>(new AcedSharedDLL::MenuItem()); itemStoreNewHeight->InitMenuItemProperty(""); itemStoreNewHeight->SetOptionId(AcedSharedDLL::OPTIONTYPES::HEIGHTOPTION); itemStoreNewHeight->SetMenuItemText(std::string("New Height:")); if (widestItem < settings->GetFontWidth(itemStoreNewHeight->GetMenuItemText())) { widestItem = settings->GetFontWidth(itemStoreNewHeight->GetMenuItemText()); } AddMenuItem(itemStoreNewHeight); auto itemStoreSave = std::shared_ptr<AcedSharedDLL::MenuItem>(new AcedSharedDLL::MenuItem()); itemStoreSave->SetId(AcedSharedDLL::STATES::SAVE); itemStoreSave->SetMenuItemText(std::string("Save")); if (widestItem < settings->GetFontWidth(itemStoreSave->GetMenuItemText())) { widestItem = settings->GetFontWidth(itemStoreSave->GetMenuItemText()); } AddMenuItem(itemStoreSave); auto itemStoreReturn = std::shared_ptr<AcedSharedDLL::MenuItem>(new AcedSharedDLL::MenuItem()); itemStoreReturn->SetId(AcedSharedDLL::STATES::RETURN); itemStoreReturn->SetMenuItemText(std::string("Return")); if (widestItem < settings->GetFontWidth(itemStoreReturn->GetMenuItemText())) { widestItem = settings->GetFontWidth(itemStoreReturn->GetMenuItemText()); } AddMenuItem(itemStoreReturn); widestItem += (AcedSharedDLL::Constants::TileSize() * 4); SetMenuX((settings->GetScreenWidth() / 2) - (widestItem / 2) - (AcedSharedDLL::Constants::TileSize() * 4)); SetMenuY(100); SetMenuHeaderX((settings->GetScreenWidth() / 2) - (widestItem / 2) - (AcedSharedDLL::Constants::TileSize() * 4)); SetMenuHeaderY(50 + AcedSharedDLL::Constants::TileSize()); SetMenuHeaderHeight(50 - AcedSharedDLL::Constants::TileSize()); int i = 0; int xloc = settings->GetScreenWidth() / 2; int yloc = 100 + AcedSharedDLL::Constants::TileSize(); int yspacing = AcedSharedDLL::Constants::TileSize() * 2; auto menuSize = GetMenuItems().size(); for (i = 0; i < menuSize; i++) { GetMenuItems()[i]->SetMenuItemX(xloc); GetMenuItems()[i]->SetMenuItemPropertyX(xloc + (settings->GetFontWidth(GetMenuItems()[i]->GetMenuItemText()) / 2) + (AcedSharedDLL::Constants::TileSize() * 1)); GetMenuItems()[i]->SetMenuItemY(yloc); yloc = yloc + yspacing; } SetMenuWidth(settings->GetScreenWidth() - (2 * GetMenuX())); SetMenuHeaderWidth(settings->GetScreenWidth() - (2 * GetMenuX())); SetMenuHeight(yloc - GetMenuY()); SetCurrentSelection(); }
void ProcessMenu(long menuCode) { short theMenu, theItem, daNum, err; Str255 daName; if(menuCode==0) return; theMenu = menuCode>>16; theItem = menuCode&0xffff; switch(theMenu) { case kAppleMenuID: { if(theItem==1) DoAbout(); else { GetMenuItemText(GetMenuHandle(kAppleMenuID), theItem, daName); daNum = OpenDeskAcc(daName); } break; } case kFileMenuID: switch(theItem) { case 1: err = OpenCart(); break; case 2: DoCloseWindow(FrontWindow()); break; case 4: gDone = true; } break; case kEditMenuID: switch(theItem) { case 8: // ROM Header if(ROM_HeaderEdit()) { NES_StoreHeader(); NES_Reset(); FullUpdate(); } break; case 10: // CONTROLS Keys_Edit(); break; case 11: // PREFERENCES Prefs_Edit(); break; } break; case kNESMenuID: switch(theItem) { case 1: // RUN if(!gRunning) { NES_Run(); } break; case 2: // STOP if(gRunning) { Stat_ForceUpdate(); FullUpdate(); NES_Stop(); } break; case 4: // RESET #ifdef GB_DEBUG TF_AddLine("== NES is reset."); #endif NES_Reset(); FullUpdate(); break; } break; #ifdef GB_DEBUG case kExtraMenuID: switch(theItem) { case 1: // PATTERN TABLES if(patWind) { DisposeWindow(patWind); patWind = 0L; } else { patWind = GetNewWindow(kPatWindID,0L,(WindowPtr)-1); NES_PatUpdate(); } break; case 2: // NAME TABLES if(namWind) { DisposeWindow(namWind); namWind = 0L; } else { namWind = GetNewWindow(kNamWindID,0L,(WindowPtr)-1); NES_NamUpdate(); } break; case 3: // PALETTES if(palWind) { DisposeWindow(palWind); palWind = 0L; } else { palWind = GetNewWindow(kPalWindID,0L,(WindowPtr)-1); NES_PalUpdate(); } break; case 5: // FRAME pnes->refreshFlag = 1; NES_Frame((long)pcpu); FullUpdate(); break; case 6: // STEP DisAsmLine(); NES_Step((long)pcpu); FullUpdate(); break; case 7: // EDIT MEM DoEditMem(0); FullUpdate(); break; case 9: // NMI P6502_NMI((long)pcpu); Stat_ForceUpdate(); break; case 10: // IRQ P6502_IRQ((long)pcpu); Stat_ForceUpdate(); break; case 12: // Blub Blub(); break; } break; #endif case kSearchMenuID: switch(theItem) { case 1: // SEARCH MEMORY Srch_Search(); break; case 3: // SAVE WP's WP_SaveWatchPoints(); break; case 5: // SEARCH RESULTS Srch_ShowResultsWindow(); break; case 6: // WATCH POINTS if(wpWind) { DisposeWindow(wpWind); wpWind = 0L; } else { WP_OpenWindow(); WP_Update(); } break; } break; case kLdsMenuID: // Load State SubMenu if((theItem>0) && (theItem<9)) NES_LoadState(theItem-1); // --> UPDATE FRAME case kStsMenuID: // Save State SubMenu if((theItem>0) && (theItem<9)) NES_SaveState(theItem-1); default: break; } if(!gRunning || !Prefs.doubleSize) HiliteMenu(0); }