bool MenuBar::reOrder(SimObject *obj, SimObject *target /*= 0*/) { bool ret = Parent::reOrder(obj, target); if(ret) updateMenuBar(dynamic_cast<PopupMenu *>(obj)); return ret; }
bool VBA::updateRenderMethod0(bool force) { bool initInput = false; if( display != NULL) { if( force ) { toolsLoggingClose(); // close log dialog initInput = true; changingVideoSize = true; shutdownDisplay(); if(input) { delete input; input = NULL; } CWnd *pWnd = m_pMainWnd; m_pMainWnd = NULL; pWnd->DragAcceptFiles(FALSE); pWnd->DestroyWindow(); delete pWnd; display = NULL; } } else { display = newDirect3DDisplay(); } if( preInitialize() ) { if( display->initialize( sizeX, sizeY ) ) { if( initInput ) { if( !this->initInput() ) { changingVideoSize = false; AfxPostQuitMessage(0); return false; } input->checkKeys(); updateMenuBar(); changingVideoSize = false; updateWindowSize(videoOption); m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); m_pMainWnd->SetFocus(); return true; } else { changingVideoSize = false; return true; } } } changingVideoSize = false; return true; }
void MenuBar::insertObject(SimObject *obj, S32 pos) { Parent::addObject(obj); if(pos >= size()) pos = size() - 1; if(pos < size()) { if(pos < 0) pos = 0; Parent::reOrder(obj, at(pos)); } updateMenuBar(dynamic_cast<PopupMenu *>(obj)); }
bool VBA::preInitialize() { switch( cartridgeType ) { case IMAGE_GBA: sizeX = 240; sizeY = 160; break; } switch( videoOption ) { case VIDEO_1X: surfaceSizeX = sizeX; surfaceSizeY = sizeY; break; case VIDEO_2X: surfaceSizeX = sizeX * 2; surfaceSizeY = sizeY * 2; break; case VIDEO_3X: surfaceSizeX = sizeX * 3; surfaceSizeY = sizeY * 3; break; case VIDEO_4X: surfaceSizeX = sizeX * 4; surfaceSizeY = sizeY * 4; break; case VIDEO_320x240: case VIDEO_640x480: case VIDEO_800x600: case VIDEO_1024x768: case VIDEO_1280x1024: case VIDEO_OTHER: float scaleX = (float)fsWidth / sizeX; float scaleY = (float)fsHeight / sizeY; float min = ( scaleX < scaleY ) ? scaleX : scaleY; if( fullScreenStretch ) { surfaceSizeX = fsWidth; surfaceSizeY = fsHeight; } else { surfaceSizeX = (int)( sizeX * min ); surfaceSizeY = (int)( sizeY * min ); } break; } rect.left = 0; rect.top = 0; rect.right = sizeX; rect.bottom = sizeY; dest.left = 0; dest.top = 0; dest.right = surfaceSizeX; dest.bottom = surfaceSizeY; DWORD style = WS_POPUP | WS_VISIBLE; DWORD styleEx = 0; if( videoOption <= VIDEO_4X ) { style |= WS_OVERLAPPEDWINDOW; } else { styleEx = 0; } if( videoOption <= VIDEO_4X ) { AdjustWindowRectEx( &dest, style, TRUE, styleEx ); } else { AdjustWindowRectEx( &dest, style, FALSE, styleEx ); } int winSizeX = dest.right-dest.left; int winSizeY = dest.bottom-dest.top; if( videoOption > VIDEO_4X ) { winSizeX = fsWidth; winSizeY = fsHeight; } int x = 0, y = 0; if( videoOption <= VIDEO_4X ) { x = windowPositionX; y = windowPositionY; } // Create a window MainWnd *pWnd = new MainWnd; m_pMainWnd = pWnd; pWnd->CreateEx( styleEx, wndClass, _T(VBA_NAME_AND_SUBVERSION), style, x, y, winSizeX, winSizeY, NULL, 0 ); if( !((HWND)*pWnd) ) { // error creating window return false; } pWnd->DragAcceptFiles( TRUE ); updateMenuBar(); adjustDestRect(); return true; }
void VBA::winSetLanguageOption(int option, bool force) { if(((option == languageOption) && option != 2) && !force) return; switch(option) { case 0: { char lbuffer[10]; if(GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SABBREVLANGNAME, lbuffer, 10)) { HINSTANCE l = winLoadLanguage(lbuffer); if(l == NULL) { LCID locIdBase = MAKELCID( MAKELANGID( PRIMARYLANGID( GetSystemDefaultLangID() ), SUBLANG_NEUTRAL ), SORT_DEFAULT ); if(GetLocaleInfo(locIdBase, LOCALE_SABBREVLANGNAME, lbuffer, 10)) { l = winLoadLanguage(lbuffer); if(l == NULL) { //printErrorMessage(IDS_FAILED_TO_LOAD_LIBRARY, //"Failed to load library %s", //lbuffer); return; } } } AfxSetResourceHandle(l); if(languageModule != NULL) #ifdef _AFXDLL AfxFreeLibrary( languageModule ); #else FreeLibrary( languageModule ); #endif languageModule = l; } else { //printErrorMessage(IDS_FAILED_TO_GET_LOCINFO, //"Failed to get locale information"); return; } } break; case 1: if(languageModule != NULL) #ifdef _AFXDLL AfxFreeLibrary( languageModule ); #else FreeLibrary( languageModule ); #endif languageModule = NULL; AfxSetResourceHandle(AfxGetInstanceHandle()); break; case 2: { if(!force) { LangSelect dlg; if(dlg.DoModal()) { HINSTANCE l = winLoadLanguage(languageName); if(l == NULL) { //printErrorMessage(IDS_FAILED_TO_LOAD_LIBRARY, //"Failed to load library %s", //languageName); return; } AfxSetResourceHandle(l); if(languageModule != NULL) { #ifdef _AFXDLL AfxFreeLibrary( languageModule ); #else FreeLibrary( languageModule ); #endif } languageModule = l; } } else { if(languageName.IsEmpty()) return; HINSTANCE l = winLoadLanguage(languageName); if(l == NULL) { //printErrorMessage(IDS_FAILED_TO_LOAD_LIBRARY, //"Failed to load library %s", //languageName); return; } AfxSetResourceHandle(l); if(languageModule != NULL) FreeLibrary(languageModule); languageModule = l; } } break; } languageOption = option; updateMenuBar(); }
void MenuBar::popObject() { Parent::popObject(); updateMenuBar(); }
void MenuBar::pushObject(SimObject *obj) { Parent::pushObject(obj); updateMenuBar(dynamic_cast<PopupMenu *>(obj)); }