void Menuer::loadMenu() { trayMenu_ = GetSubMenu(LoadMenu(app_hins, MAKEINTRESOURCE(IDR_MENU_TRAY)), 0); floatMenu_ = GetSubMenu(LoadMenu(app_hins, MAKEINTRESOURCE(IDR_MENU_FLOAT)), 0); if (autorun_is_set()) { checkMenu(IDM_AUTORUN, true); } checkMenu(TransMap[option.transparency], true); }
void MolecularFileDialog::onNotify(Message *message) { if (RTTI::isKindOf<ControlSelectionMessage>(message)) { checkMenu(*getMainControl()); } }
void Menuer::checkAutorunMenu() { UINT state = GetMenuState(trayMenu_, IDM_AUTORUN, MF_BYCOMMAND); bool toCheck = !(state & MF_CHECKED); // revert checkMenu(IDM_AUTORUN, toCheck); if (toCheck) { autorun_enable(); } else { autorun_cancel(); } }
void LabelDialog::onNotify(Message *message) { #ifdef BALL_VIEW_DEBUG Log.error() << "LabelDialog " << this << " onNotify " << message << std::endl; #endif // selection => store last selection for later processing if (RTTI::isKindOf<ControlSelectionMessage>(message)) { ControlSelectionMessage* selection = RTTI::castTo<ControlSelectionMessage>(*message); // disabled apply button, if selection is empty const bool filled = !selection->getSelection().empty(); apply_button_->setEnabled(filled); checkMenu(*getMainControl()); } }
void SimTreeView::onCommand( int id, HWND hwndCtl, UINT codeNotify ) { hwndCtl, codeNotify; SimObject *obj; SimSet *prnt; lockManager(); switch( id ) { case IDM_EXIT: destroyWindow(); break; case IDM_CUT: if ( (obj = getSelectedObject()) != NULL ) { // persist selected object obj->fileStore( "temp\\clip.tmp" ); // remove it from parent obj->deleteObject(); delItem( getSelection() ); state.set(STV_MODIFIED); } break; case IDM_COPY: if ( (obj = getSelectedObject()) != NULL ) obj->fileStore( "temp\\clip.tmp" ); break; case IDM_PASTE: { // unpersist object to get a duplicate Persistent::Base::Error err; obj = (SimObject*)Persistent::Base::fileLoad( "temp\\clip.tmp", &err ); if ( err != Ok ) return; // add to simTree HTREEITEM hParent = getSelection(); if ( !isItemFolder(hParent) ) hParent = getParent( hParent ); prnt = (SimSet*)getObject( hParent ); prnt->getManager()->addObject( obj ); prnt->addObject(obj); HTREEITEM hItem = addSet( obj, hParent ); selectItem( hItem ); state.set(STV_MODIFIED); } break; case IDM_DELETE: obj = getSelectedObject(); if ( obj ) { obj->deleteObject(); delItem( getSelection() ); state.set(STV_MODIFIED); } break; case IDM_REMOVE: obj = getSelectedObject(); if ( obj ) { prnt = getSelectedParent(); prnt->removeObject(obj); delItem( getSelection() ); state.set(STV_MODIFIED); } break; case IDM_DUPLICATE: { obj = getSelectedObject(); // persist object to get a duplicate if ( obj->fileStore( "temp\\clip.tmp" ) != Ok ) { unlockManager(); return; } Persistent::Base::Error err; obj = (SimObject*)Persistent::Base::fileLoad( "temp\\clip.tmp", &err ); if ( err != Ok ) { unlockManager(); return; } // perhaps delete clip.tmp to clean up directory HTREEITEM hParent = getSelection(); if ( !isItemFolder(hParent) ) hParent = getParent( hParent ); prnt = (SimSet*)getObject( hParent ); prnt->getManager()->addObject( obj ); prnt->addObject( obj ); HTREEITEM hItem = addSet( obj, getParent(getSelection()) ); selectItem( hItem ); state.set(STV_MODIFIED); } break; case IDM_EDIT: inspectObject( getSelectedObject() ); state.set(STV_MODIFIED); break; case IDM_LOCK: lockObject( getSelectedObject(), true ); state.set( STV_MODIFIED ); break; case IDM_UNLOCK: lockObject( getSelectedObject(), false ); state.set( STV_MODIFIED ); break; default: if ( (id>=IDM_SCRIPT_START) && (id<=scriptMenu_IDM) ) { int scriptIndex = id-IDM_SCRIPT_START; CMDConsole::getLocked()->evaluate( script[scriptIndex], false ); } // let parent handle its default menu items WinParent::handleContextMenuItemSelection( id ); } checkMenu( hMainMenu ); unlockManager(); }
LRESULT CALLBACK WndProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; HWND hDlg; switch(Message) { case WM_KEYDOWN: if(wParam != VK_PAUSE) break; // case WM_SYSKEYDOWN: case WM_CUSTKEYDOWN: { int modifiers = GetModifiers(wParam); if(!HandleKeyMessage(wParam,lParam, modifiers)) return 0; break; } case WM_KEYUP: if(wParam != VK_PAUSE) break; case WM_SYSKEYUP: case WM_CUSTKEYUP: { int modifiers = GetModifiers(wParam); HandleKeyUp(wParam, lParam, modifiers); } break; case WM_SIZE: switch(wParam) { case SIZE_MINIMIZED: break; case SIZE_MAXIMIZED: pcejin.maximized = true; break; case SIZE_RESTORED: pcejin.maximized = false; break; default: break; } return 0; case WM_MOVE: RECT rect; GetWindowRect(hWnd,&rect); WndX = rect.left; WndY = rect.top; return 0; case WM_DROPFILES: { char filename[MAX_PATH] = ""; DragQueryFile((HDROP)wParam,0,filename,MAX_PATH); DragFinish((HDROP)wParam); std::string fileDropped = filename; //------------------------------------------------------- //Check if mcm file, if so auto-convert and play //------------------------------------------------------- if (!(fileDropped.find(".mcm") == std::string::npos) && (fileDropped.find(".mcm") == fileDropped.length()-4)) { if (!pcejin.romLoaded) //If no ROM is loaded, prompt for one { soundDriver->pause(); LoadGame(); pcejin.tempUnPause(); } if (pcejin.romLoaded && !(fileDropped.find(".mcm") == std::string::npos)) LoadMCM(fileDropped.c_str(), true); } //------------------------------------------------------- //Check if Movie file //------------------------------------------------------- else if (!(fileDropped.find(".mc2") == std::string::npos) && (fileDropped.find(".mc2") == fileDropped.length()-4)) { if (!pcejin.romLoaded) //If no ROM is loaded, prompt for one { soundDriver->pause(); LoadGame(); pcejin.tempUnPause(); } if (pcejin.romLoaded && !(fileDropped.find(".mc2") == std::string::npos)) { LoadMovie(fileDropped.c_str(), 1, false, false); RecentMovies.UpdateRecentItems(fileDropped); } } //------------------------------------------------------- //Check if Savestate file //------------------------------------------------------- else if (!(fileDropped.find(".nc") == std::string::npos)) { if (fileDropped.find(".nc") == fileDropped.length()-4) { if ((fileDropped[fileDropped.length()-1] >= '0' && fileDropped[fileDropped.length()-1] <= '9')) { MDFNSS_Load(filename, NULL); UpdateToolWindows(); } } } //------------------------------------------------------- //Check if Lua script file //------------------------------------------------------- else if (!(fileDropped.find(".lua") == std::string::npos) && (fileDropped.find(".lua") == fileDropped.length()-4)) //ROM is already loaded and .dsm in filename { if(LuaScriptHWnds.size() < 16) { char temp [1024]; strcpy(temp, fileDropped.c_str()); HWND IsScriptFileOpen(const char* Path); RecentLua.UpdateRecentItems(fileDropped); if(!IsScriptFileOpen(temp)) { HWND hDlg = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_LUA), hWnd, (DLGPROC) LuaScriptProc); SendDlgItemMessage(hDlg,IDC_EDIT_LUAPATH,WM_SETTEXT,0,(LPARAM)temp); } } } //------------------------------------------------------- //Check if watchlist file //------------------------------------------------------- else if (!(fileDropped.find(".wch") == std::string::npos) && (fileDropped.find(".wch") == fileDropped.length()-4)) //ROM is already loaded and .dsm in filename { if(!RamWatchHWnd) { RamWatchHWnd = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_RAMWATCH), hWnd, (DLGPROC) RamWatchProc); } else SetForegroundWindow(RamWatchHWnd); Load_Watches(true, fileDropped.c_str()); } //------------------------------------------------------- //Else load it as a ROM //------------------------------------------------------- else { ALoad(fileDropped.c_str()); } } return 0; case WM_ENTERMENULOOP: soundDriver->pause(); EnableMenuItem(GetMenu(hWnd), IDM_RECORD_MOVIE, MF_BYCOMMAND | (movieMode == MOVIEMODE_INACTIVE && pcejin.romLoaded) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(GetMenu(hWnd), IDM_PLAY_MOVIE, MF_BYCOMMAND | (movieMode == MOVIEMODE_INACTIVE && pcejin.romLoaded) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(GetMenu(hWnd), IDM_STOPMOVIE, MF_BYCOMMAND | (movieMode != MOVIEMODE_INACTIVE) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(GetMenu(hWnd), IDM_RESTARTMOVIE, MF_BYCOMMAND | (movieMode != MOVIEMODE_INACTIVE) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(GetMenu(hWnd), IDM_FILE_STOPAVI, MF_BYCOMMAND | (DRV_AviIsRecording()) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(GetMenu(hWnd), IDM_FILE_RECORDAVI, MF_BYCOMMAND | (!DRV_AviIsRecording()) ? MF_ENABLED : MF_GRAYED); //Window Size checkMenu(IDC_WINDOW1X, ((pcejin.windowSize==1))); checkMenu(IDC_WINDOW2X, ((pcejin.windowSize==2))); checkMenu(IDC_WINDOW3X, ((pcejin.windowSize==3))); checkMenu(IDC_WINDOW4X, ((pcejin.windowSize==4))); checkMenu(IDC_ASPECT, ((pcejin.aspectRatio))); checkMenu(ID_VIEW_FRAMECOUNTER,Hud.FrameCounterDisplay); checkMenu(ID_VIEW_DISPLAYINPUT,Hud.ShowInputDisplay); checkMenu(ID_VIEW_DISPLAYSTATESLOTS,Hud.DisplayStateSlots); checkMenu(ID_VIEW_DISPLAYLAG,Hud.ShowLagFrameCounter); checkMenu(IDM_MUTE,soundDriver->userMute); break; case WM_EXITMENULOOP: pcejin.tempUnPause(); break; case WM_CLOSE: { SaveIniSettings(); PostQuitMessage(0); } case WM_DESTROY: { PostQuitMessage(0); } // HANDLE_MSG(hWnd, WM_DESTROY, OnDestroy); // HANDLE_MSG(hWnd, WM_PAINT, OnPaint); // HANDLE_MSG(hwnd, WM_COMMAND, OnCommand); case WM_COMMAND: //Recent ROMs if(wParam >= RECENTROM_START && wParam <= RECENTROM_START + RecentROMs.MAX_RECENT_ITEMS - 1) { ALoad(RecentROMs.GetRecentItem(wParam - RECENTROM_START).c_str()); break; } else if (wParam == RecentROMs.GetClearID()) { RecentROMs.ClearRecentItems(); break; } else if (wParam == RecentROMs.GetAutoloadID()) { RecentROMs.FlipAutoLoad(); break; } //Recent Movies if(wParam >= RECENTMOVIE_START && wParam <= RECENTMOVIE_START + RecentMovies.MAX_RECENT_ITEMS - 1) { strcpy(Tmp_Str, RecentMovies.GetRecentItem(wParam - RECENTMOVIE_START).c_str()); RecentMovies.UpdateRecentItems(Tmp_Str); //WIN32_StartMovieReplay(Str_Tmp); break; } else if (wParam == RecentMovies.GetClearID()) { RecentMovies.ClearRecentItems(); break; } else if (wParam == RecentMovies.GetAutoloadID()) { RecentMovies.FlipAutoLoad(); break; } //Recent Lua if(wParam >= RECENTLUA_START && wParam <= RECENTLUA_START + RecentLua.MAX_RECENT_ITEMS - 1) { if(LuaScriptHWnds.size() < 16) { char temp [1024]; strcpy(temp, RecentLua.GetRecentItem(wParam - RECENTLUA_START).c_str()); HWND IsScriptFileOpen(const char* Path); RecentLua.UpdateRecentItems(temp); if(!IsScriptFileOpen(temp)) { HWND hDlg = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_LUA), hWnd, (DLGPROC) LuaScriptProc); SendDlgItemMessage(hDlg,IDC_EDIT_LUAPATH,WM_SETTEXT,0,(LPARAM)temp); } } break; } else if (wParam == RecentLua.GetClearID()) { RecentLua.ClearRecentItems(); break; } else if (wParam == RecentLua.GetAutoloadID()) { RecentLua.FlipAutoLoad(); break; } wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDC_WINDOW1X: pcejin.windowSize=1; ScaleScreen(pcejin.windowSize); break; case IDC_WINDOW2X: pcejin.windowSize=2; ScaleScreen(pcejin.windowSize); break; case IDC_WINDOW3X: pcejin.windowSize=3; ScaleScreen(pcejin.windowSize); break; case IDC_WINDOW4X: pcejin.windowSize=4; ScaleScreen(pcejin.windowSize); break; case IDC_ASPECT: pcejin.aspectRatio ^= 1; ScaleScreen(pcejin.windowSize); break; case IDM_EXIT: SaveIniSettings(); PostQuitMessage(0); break; case IDM_RESET: PCE_Power(); break; case IDM_OPEN_ROM: soundDriver->pause(); LoadGame(); pcejin.tempUnPause(); break; case IDM_RECORD_MOVIE: soundDriver->pause(); MovieRecordTo(); pcejin.tempUnPause(); return 0; case IDM_PLAY_MOVIE: soundDriver->pause(); Replay_LoadMovie(); pcejin.tempUnPause(); return 0; case IDM_INPUT_CONFIG: soundDriver->pause(); DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_INPUTCONFIG), hWnd, DlgInputConfig); pcejin.tempUnPause(); // RunInputConfig(); break; case IDM_HOTKEY_CONFIG: { soundDriver->pause(); DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_KEYCUSTOM), hWnd, DlgHotkeyConfig); pcejin.tempUnPause(); } break; case IDM_BIOS_CONFIG: soundDriver->pause(); DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_BIOS), hWnd, (DLGPROC) BiosSettingsDlgProc); // DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_KEYCUSTOM), hWnd, BiosSettingsDlgProc); pcejin.tempUnPause(); break; case ID_VIEW_FRAMECOUNTER: Hud.FrameCounterDisplay ^= true; WritePrivateProfileBool("Display", "FrameCounter", Hud.FrameCounterDisplay, IniName); return 0; case ID_VIEW_DISPLAYINPUT: Hud.ShowInputDisplay ^= true; WritePrivateProfileBool("Display", "Display Input", Hud.ShowInputDisplay, IniName); osd->clear(); return 0; case ID_VIEW_DISPLAYSTATESLOTS: Hud.DisplayStateSlots ^= true; WritePrivateProfileBool("Display", "Display State Slots", Hud.DisplayStateSlots, IniName); osd->clear(); return 0; case ID_VIEW_DISPLAYLAG: Hud.ShowLagFrameCounter ^= true; WritePrivateProfileBool("Display", "Display Lag Counter", Hud.ShowLagFrameCounter, IniName); osd->clear(); return 0; case IDC_NEW_LUA_SCRIPT: if(LuaScriptHWnds.size() < 16) { CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_LUA), g_hWnd, (DLGPROC) LuaScriptProc); } break; case IDM_CONVERT_MCM: ConvertMCM(hWnd); break; case IDM_MUTE: soundDriver->doUserMute(); break; case IDM_STOPMOVIE: StopMovie(); return 0; break; case IDM_RESTARTMOVIE: PCE_Power(); ResetFrameCount(); movieMode = MOVIEMODE_PLAY; movie_readonly = true; return 0; break; case ID_RAM_SEARCH: if(!RamSearchHWnd) { InitRamSearch(); RamSearchHWnd = CreateDialog(winClass.hInstance, MAKEINTRESOURCE(IDD_RAMSEARCH), hWnd, (DLGPROC) RamSearchProc); } else SetForegroundWindow(RamSearchHWnd); break; case ID_RAM_WATCH: if(!RamWatchHWnd) { RamWatchHWnd = CreateDialog(winClass.hInstance, MAKEINTRESOURCE(IDD_RAMWATCH), hWnd, (DLGPROC) RamWatchProc); } else SetForegroundWindow(RamWatchHWnd); return 0; case IDM_MEMORY: if (!RegWndClass("MemView_ViewBox", MemView_ViewBoxProc, 0, sizeof(CMemView*))) return 0; OpenToolWindow(new CMemView()); return 0; case IDM_ABOUT: soundDriver->pause(); DialogBox(winClass.hInstance, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); pcejin.tempUnPause(); break; case IDM_FILE_RECORDAVI: soundDriver->pause(); RecordAvi(); pcejin.tempUnPause(); break; case IDM_FILE_STOPAVI: StopAvi(); break; } break; } return DefWindowProc(hWnd, Message, wParam, lParam); }
LRESULT CALLBACK WndProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; switch(Message) { case WM_INITMENU: recentromsmenu = LoadMenu(g_hInstance, "RECENTROMS"); GetRecentRoms(); break; case WM_KEYDOWN: if(wParam != VK_PAUSE) break; // case WM_SYSKEYDOWN: case WM_CUSTKEYDOWN: { int modifiers = GetModifiers(wParam); if(!HandleKeyMessage(wParam,lParam, modifiers)) return 0; break; } case WM_KEYUP: if(wParam != VK_PAUSE) break; case WM_SYSKEYUP: case WM_CUSTKEYUP: { int modifiers = GetModifiers(wParam); HandleKeyUp(wParam, lParam, modifiers); } break; case WM_SIZE: switch(wParam) { case SIZE_MINIMIZED: break; case SIZE_MAXIMIZED: pcejin.maximized = true; break; case SIZE_RESTORED: pcejin.maximized = false; break; default: break; } return 0; case WM_MOVE: RECT rect; GetWindowRect(hWnd,&rect); WndX = rect.left; WndY = rect.top; return 0; case WM_DROPFILES: { char filename[MAX_PATH] = ""; DragQueryFile((HDROP)wParam,0,filename,MAX_PATH); DragFinish((HDROP)wParam); std::string fileDropped = filename; //------------------------------------------------------- //Check if Movie file //------------------------------------------------------- if (!(fileDropped.find(".mc2") == std::string::npos) && (fileDropped.find(".mc2") == fileDropped.length()-4)) { if (!pcejin.romLoaded) //If no ROM is loaded, prompt for one { soundDriver->pause(); LoadGame(); pcejin.tempUnPause(); } if (pcejin.romLoaded && !(fileDropped.find(".mc2") == std::string::npos)) FCEUI_LoadMovie(fileDropped.c_str(), 1, false, false); } //------------------------------------------------------- //Check if Savestate file //------------------------------------------------------- else if (!(fileDropped.find(".mc") == std::string::npos)) //Note: potential clash, mc2 will be loaded a movie file first { if (fileDropped.find(".mc") == fileDropped.length()-4) { if ((fileDropped[fileDropped.length()-1] >= '0' && fileDropped[fileDropped.length()-1] <= '9')) { extern int MDFNSS_Load(const char *fname, const char *suffix); MDFNSS_Load(filename, NULL); ClearDirectDrawOutput(); UpdateToolWindows(); } } } //------------------------------------------------------- //Check if Lua script file //------------------------------------------------------- else if (!(fileDropped.find(".lua") == std::string::npos) && (fileDropped.find(".lua") == fileDropped.length()-4)) //ROM is already loaded and .dsm in filename { if(LuaScriptHWnds.size() < 16) { char temp [1024]; strcpy(temp, fileDropped.c_str()); HWND IsScriptFileOpen(const char* Path); if(!IsScriptFileOpen(temp)) { HWND hDlg = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_LUA), hWnd, (DLGPROC) LuaScriptProc); SendDlgItemMessage(hDlg,IDC_EDIT_LUAPATH,WM_SETTEXT,0,(LPARAM)temp); } } } //------------------------------------------------------- //Check if watchlist file //------------------------------------------------------- else if (!(fileDropped.find(".wch") == std::string::npos) && (fileDropped.find(".wch") == fileDropped.length()-4)) //ROM is already loaded and .dsm in filename { if(!RamWatchHWnd) { RamWatchHWnd = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_RAMWATCH), hWnd, (DLGPROC) RamWatchProc); } else SetForegroundWindow(RamWatchHWnd); Load_Watches(true, fileDropped.c_str()); } //------------------------------------------------------- //Else load it as a ROM //------------------------------------------------------- else if(MDFNI_LoadGame(NULL,filename)) { pcejin.romLoaded = true; pcejin.started = true; //TODO: adelikat: This code is copied directly from the LoadGame() function, it should be come a separate function and called in both places //////////////////////////////// if (AutoRWLoad) { //Open Ram Watch if its auto-load setting is checked OpenRWRecentFile(0); RamWatchHWnd = CreateDialog(winClass.hInstance, MAKEINTRESOURCE(IDD_RAMWATCH), g_hWnd, (DLGPROC) RamWatchProc); } UpdateRecentRoms(filename); //////////////////////////////// } } return 0; case WM_ENTERMENULOOP: soundDriver->pause(); EnableMenuItem(GetMenu(hWnd), IDM_RECORD_MOVIE, MF_BYCOMMAND | (movieMode == MOVIEMODE_INACTIVE && pcejin.romLoaded) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(GetMenu(hWnd), ID_RAM_WATCH, MF_BYCOMMAND | (movieMode == MOVIEMODE_INACTIVE && pcejin.romLoaded) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(GetMenu(hWnd), ID_RAM_SEARCH, MF_BYCOMMAND | (movieMode == MOVIEMODE_INACTIVE && pcejin.romLoaded) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(GetMenu(hWnd), IDM_MEMORY, MF_BYCOMMAND | (movieMode == MOVIEMODE_INACTIVE && pcejin.romLoaded) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(GetMenu(hWnd), IDM_PLAY_MOVIE, MF_BYCOMMAND | (movieMode == MOVIEMODE_INACTIVE && pcejin.romLoaded) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(GetMenu(hWnd), IDM_STOPMOVIE, MF_BYCOMMAND | (movieMode != MOVIEMODE_INACTIVE) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(GetMenu(hWnd), IDM_FILE_STOPAVI, MF_BYCOMMAND | (DRV_AviIsRecording()) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(GetMenu(hWnd), IDM_FILE_RECORDAVI, MF_BYCOMMAND | (!DRV_AviIsRecording()) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(GetMenu(hWnd), IDM_FILE_STOPWAV, MF_BYCOMMAND | (DRV_WaveRecordActive()) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(GetMenu(hWnd), IDM_FILE_RECORDWAV, MF_BYCOMMAND | (!DRV_WaveRecordActive()) ? MF_ENABLED : MF_GRAYED); //Window Size checkMenu(IDC_WINDOW1X, ((pcejin.windowSize==1))); checkMenu(IDC_WINDOW15X, ((pcejin.windowSize==65535))); checkMenu(IDC_WINDOW2X, ((pcejin.windowSize==2))); checkMenu(IDC_WINDOW25X, ((pcejin.windowSize==65534))); checkMenu(IDC_WINDOW3X, ((pcejin.windowSize==3))); checkMenu(IDC_WINDOW4X, ((pcejin.windowSize==4))); checkMenu(IDC_ASPECT, ((pcejin.aspectRatio))); checkMenu(ID_VIEW_MIXLEFTRIGHT,MixVideoOutput); checkMenu(ID_COLOR_MODE_REDBLUE, ((MDFN_IEN_VB::GetColorMode()==0))); checkMenu(ID_COLOR_MODE_REDCYAN, ((MDFN_IEN_VB::GetColorMode()==1))); checkMenu(ID_COLOR_MODE_REDELECTRICCYAN, ((MDFN_IEN_VB::GetColorMode()==2))); checkMenu(ID_COLOR_MODE_REDGREEN, ((MDFN_IEN_VB::GetColorMode()==3))); checkMenu(ID_COLOR_MODE_GREENMAGENTA, ((MDFN_IEN_VB::GetColorMode()==4))); checkMenu(ID_COLOR_MODE_YELLOWBLUE, ((MDFN_IEN_VB::GetColorMode()==5))); checkMenu(ID_COLOR_MODE_GREYSCALE, ((MDFN_IEN_VB::GetColorMode()==6))); checkMenu(ID_SPLIT_MODE_ANAGLYPH, ((MDFN_IEN_VB::GetSplitMode()==MDFN_IEN_VB::VB3DMODE_ANAGLYPH))); checkMenu(ID_SPLIT_MODE_CSCOPE, ((MDFN_IEN_VB::GetSplitMode()==MDFN_IEN_VB::VB3DMODE_CSCOPE))); checkMenu(ID_SPLIT_MODE_SIDEBYSIDE, ((MDFN_IEN_VB::GetSplitMode()==MDFN_IEN_VB::VB3DMODE_SIDEBYSIDE))); checkMenu(ID_SPLIT_MODE_PBARRIER, ((MDFN_IEN_VB::GetSplitMode()==MDFN_IEN_VB::VB3DMODE_PBARRIER))); checkMenu(ID_VIEW_DISP_BOTH, ((DisplayLeftRightOutput==0))); checkMenu(ID_VIEW_DISP_LEFT, ((DisplayLeftRightOutput==1))); checkMenu(ID_VIEW_DISP_RIGHT, ((DisplayLeftRightOutput==2))); checkMenu(ID_VIEW_DISP_DISABLE, ((DisplayLeftRightOutput==3))); checkMenu(ID_VIEW_FRAMECOUNTER,Hud.FrameCounterDisplay); checkMenu(ID_VIEW_DISPLAYINPUT,Hud.ShowInputDisplay); checkMenu(ID_VIEW_OPENCONSOLE,OpenConsoleWindow); checkMenu(ID_VIEW_DISPLAYSTATESLOTS,Hud.DisplayStateSlots); checkMenu(ID_VIEW_DISPLAYLAG,Hud.ShowLagFrameCounter); checkMenu(IDM_MUTE,soundDriver->userMute); break; case WM_EXITMENULOOP: pcejin.tempUnPause(); break; case WM_CLOSE: { SaveIniSettings(); PostQuitMessage(0); } case WM_DESTROY: { PostQuitMessage(0); } // HANDLE_MSG(hWnd, WM_DESTROY, OnDestroy); // HANDLE_MSG(hWnd, WM_PAINT, OnPaint); // HANDLE_MSG(hwnd, WM_COMMAND, OnCommand); case WM_COMMAND: if(wParam >= baseid && wParam <= baseid + MAX_RECENT_ROMS - 1) { int x = wParam - baseid; soundDriver->resume(); OpenRecentROM(x); } else if(wParam == clearid) { /* Clear all the recent ROMs */ if(IDOK == MessageBox(g_hWnd, "OK to clear recent ROMs list?","VBJin",MB_OKCANCEL)) ClearRecentRoms(); } wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDC_WINDOW1X: pcejin.windowSize=1; ScaleScreen((float)pcejin.windowSize); break; case IDC_WINDOW15X: pcejin.windowSize=65535; ScaleScreen((float)pcejin.windowSize); break; case IDC_WINDOW2X: pcejin.windowSize=2; ScaleScreen((float)pcejin.windowSize); break; case IDC_WINDOW25X: pcejin.windowSize=65534; ScaleScreen((float)pcejin.windowSize); break; case IDC_WINDOW3X: pcejin.windowSize=3; ScaleScreen((float)pcejin.windowSize); break; case IDC_WINDOW4X: pcejin.windowSize=4; ScaleScreen((float)pcejin.windowSize); break; case IDC_ASPECT: pcejin.aspectRatio ^= 1; ScaleScreen((float)pcejin.windowSize); break; case IDM_EXIT: SaveIniSettings(); PostQuitMessage(0); break; case IDM_RESET: //NEWTODO PCE_Power(); OpenRecentROM(0); break; case IDM_OPEN_ROM: soundDriver->pause(); LoadGame(); pcejin.tempUnPause(); break; case IDM_RECORD_MOVIE: soundDriver->pause(); MovieRecordTo(); pcejin.tempUnPause(); return 0; case IDM_PLAY_MOVIE: soundDriver->pause(); Replay_LoadMovie(); pcejin.tempUnPause(); return 0; case IDM_INPUT_CONFIG: soundDriver->pause(); DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_INPUTCONFIG), hWnd, DlgInputConfig); pcejin.tempUnPause(); // RunInputConfig(); break; case IDM_HOTKEY_CONFIG: { soundDriver->pause(); DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_KEYCUSTOM), hWnd, DlgHotkeyConfig); pcejin.tempUnPause(); } break; case ID_VIEW_MIXLEFTRIGHT: MixVideoOutput ^= true; MDFN_IEN_VB::SetMixVideoOutput(MixVideoOutput); WritePrivateProfileBool("Display", "MixLeftRight", MixVideoOutput, IniName); return 0; case ID_SPLIT_MODE_ANAGLYPH: MDFN_IEN_VB::SetSplitMode(MDFN_IEN_VB::VB3DMODE_ANAGLYPH); WritePrivateProfileInt("Display", "SplitMode", MDFN_IEN_VB::VB3DMODE_ANAGLYPH, IniName); break; case ID_SPLIT_MODE_CSCOPE: MDFN_IEN_VB::SetSplitMode(MDFN_IEN_VB::VB3DMODE_CSCOPE); WritePrivateProfileInt("Display", "SplitMode", MDFN_IEN_VB::VB3DMODE_CSCOPE, IniName); //Clear the DirectDraw buffers ClearDirectDrawOutput(); break; case ID_SPLIT_MODE_SIDEBYSIDE: MDFN_IEN_VB::SetSplitMode(MDFN_IEN_VB::VB3DMODE_SIDEBYSIDE); WritePrivateProfileInt("Display", "SplitMode", MDFN_IEN_VB::VB3DMODE_SIDEBYSIDE, IniName); //Clear the DirectDraw buffers ClearDirectDrawOutput(); break; case ID_SPLIT_MODE_PBARRIER: MDFN_IEN_VB::SetSplitMode(MDFN_IEN_VB::VB3DMODE_PBARRIER); WritePrivateProfileInt("Display", "SplitMode", MDFN_IEN_VB::VB3DMODE_PBARRIER, IniName); break; case ID_PIXEL_SEP_16: SideBySidePixels = 16; MDFN_IEN_VB::SetSideBySidePixels(SideBySidePixels); ClearDirectDrawOutput(); WritePrivateProfileInt("Display", "SideBySidePixels", SideBySidePixels, IniName); break; case ID_PIXEL_SEP_32: SideBySidePixels = 32; MDFN_IEN_VB::SetSideBySidePixels(SideBySidePixels); ClearDirectDrawOutput(); WritePrivateProfileInt("Display", "SideBySidePixels", SideBySidePixels, IniName); break; case ID_PIXEL_SEP_48: SideBySidePixels = 48; MDFN_IEN_VB::SetSideBySidePixels(SideBySidePixels); ClearDirectDrawOutput(); WritePrivateProfileInt("Display", "SideBySidePixels", SideBySidePixels, IniName); break; case ID_PIXEL_SEP_64: SideBySidePixels = 64; MDFN_IEN_VB::SetSideBySidePixels(SideBySidePixels); ClearDirectDrawOutput(); WritePrivateProfileInt("Display", "SideBySidePixels", SideBySidePixels, IniName); break; case ID_PIXEL_SEP_80: SideBySidePixels = 80; MDFN_IEN_VB::SetSideBySidePixels(SideBySidePixels); ClearDirectDrawOutput(); WritePrivateProfileInt("Display", "SideBySidePixels", SideBySidePixels, IniName); break; case ID_PIXEL_SEP_96: SideBySidePixels = 96; MDFN_IEN_VB::SetSideBySidePixels(SideBySidePixels); ClearDirectDrawOutput(); WritePrivateProfileInt("Display", "SideBySidePixels", SideBySidePixels, IniName); break; case ID_COLOR_MODE_REDBLUE: MDFN_IEN_VB::SetColorMode(0); WritePrivateProfileInt("Display", "ColorMode", 0, IniName); break; case ID_COLOR_MODE_REDCYAN: MDFN_IEN_VB::SetColorMode(1); WritePrivateProfileInt("Display", "ColorMode", 1, IniName); break; case ID_COLOR_MODE_REDELECTRICCYAN: MDFN_IEN_VB::SetColorMode(2); WritePrivateProfileInt("Display", "ColorMode", 2, IniName); break; case ID_COLOR_MODE_REDGREEN: MDFN_IEN_VB::SetColorMode(3); WritePrivateProfileInt("Display", "ColorMode", 3, IniName); break; case ID_COLOR_MODE_GREENMAGENTA: MDFN_IEN_VB::SetColorMode(4); WritePrivateProfileInt("Display", "ColorMode", 4, IniName); break; case ID_COLOR_MODE_YELLOWBLUE: MDFN_IEN_VB::SetColorMode(5); WritePrivateProfileInt("Display", "ColorMode", 5, IniName); break; case ID_COLOR_MODE_GREYSCALE: MDFN_IEN_VB::SetColorMode(6); WritePrivateProfileInt("Display", "ColorMode", 6, IniName); break; case ID_VIEW_DISP_BOTH: DisplayLeftRightOutput = 0; MDFN_IEN_VB::SetViewDisp(DisplayLeftRightOutput); WritePrivateProfileInt("Display", "ViewDisplay", DisplayLeftRightOutput, IniName); return 0; case ID_VIEW_DISP_LEFT: DisplayLeftRightOutput = 1; MDFN_IEN_VB::SetViewDisp(DisplayLeftRightOutput); WritePrivateProfileInt("Display", "ViewDisplay", DisplayLeftRightOutput, IniName); return 0; case ID_VIEW_DISP_RIGHT: DisplayLeftRightOutput = 2; MDFN_IEN_VB::SetViewDisp(DisplayLeftRightOutput); WritePrivateProfileInt("Display", "ViewDisplay", DisplayLeftRightOutput, IniName); return 0; case ID_VIEW_DISP_DISABLE: DisplayLeftRightOutput = 3; MDFN_IEN_VB::SetViewDisp(DisplayLeftRightOutput); // We're not saving this. Too many people would set it and forget it, then compain. // Someone can still set it manually in the ini file though. return 0; case ID_VIEW_FRAMECOUNTER: Hud.FrameCounterDisplay ^= true; WritePrivateProfileBool("Display", "FrameCounter", Hud.FrameCounterDisplay, IniName); return 0; case ID_VIEW_DISPLAYINPUT: Hud.ShowInputDisplay ^= true; WritePrivateProfileBool("Display", "Display Input", Hud.ShowInputDisplay, IniName); osd->clear(); return 0; case ID_VIEW_OPENCONSOLE: OpenConsoleWindow ^= true; WritePrivateProfileBool("Display", "OpenConsoleWindow", OpenConsoleWindow, IniName); return 0; case ID_VIEW_DISPLAYSTATESLOTS: Hud.DisplayStateSlots ^= true; WritePrivateProfileBool("Display", "Display State Slots", Hud.DisplayStateSlots, IniName); osd->clear(); return 0; case ID_VIEW_DISPLAYLAG: Hud.ShowLagFrameCounter ^= true; WritePrivateProfileBool("Display", "Display Lag Counter", Hud.ShowLagFrameCounter, IniName); osd->clear(); return 0; case IDC_NEW_LUA_SCRIPT: if(LuaScriptHWnds.size() < 16) { CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_LUA), g_hWnd, (DLGPROC) LuaScriptProc); } break; break; case IDM_MUTE: soundDriver->doUserMute(); break; case IDM_STOPMOVIE: FCEUI_StopMovie(); return 0; break; case ID_RAM_SEARCH: if(!RamSearchHWnd) { if (pcejin.romLoaded) { InitRamSearch(false); RamSearchHWnd = CreateDialog(winClass.hInstance, MAKEINTRESOURCE(IDD_RAMSEARCH), hWnd, (DLGPROC) RamSearchProc); } } else SetForegroundWindow(RamSearchHWnd); break; case ID_RAM_WATCH: if(!RamWatchHWnd) { if(pcejin.romLoaded) RamWatchHWnd = CreateDialog(winClass.hInstance, MAKEINTRESOURCE(IDD_RAMWATCH), hWnd, (DLGPROC) RamWatchProc); } else SetForegroundWindow(RamWatchHWnd); return 0; case IDM_MEMORY: if (!RegWndClass("MemView_ViewBox", MemView_ViewBoxProc, 0, sizeof(CMemView*))) return 0; OpenToolWindow(new CMemView()); return 0; case IDM_ABOUT: soundDriver->pause(); DialogBox(winClass.hInstance, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); pcejin.tempUnPause(); break; case IDM_FILE_RECORDAVI: soundDriver->pause(); RecordAvi(); pcejin.tempUnPause(); break; case IDM_FILE_STOPAVI: StopAvi(); break; case IDM_FILE_RECORDWAV: soundDriver->pause(); CreateSoundSave(); pcejin.tempUnPause(); break; case IDM_FILE_STOPWAV: DRV_EndWaveRecord(); break; } break; } return DefWindowProc(hWnd, Message, wParam, lParam); }
//-------------------------------------------------------------- void testApp::mousePressed(int x, int y, int button){ checkMenu(x,y); fadeOutVids(x,y); }