From 1c398c2b77b9da88b64af323a7e512ebe07503fa Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Sat, 18 Jun 2016 09:05:50 +0100 Subject: [PATCH] gui: Use Bind instead of Connect for menus Also rearrange the order to (mostly) reflect menu ordering and remove some bindings to non-existent menu items. --- pcsx2/gui/MainFrame.cpp | 100 +++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 53 deletions(-) diff --git a/pcsx2/gui/MainFrame.cpp b/pcsx2/gui/MainFrame.cpp index 2ae6b962d2..528b895658 100644 --- a/pcsx2/gui/MainFrame.cpp +++ b/pcsx2/gui/MainFrame.cpp @@ -185,67 +185,61 @@ void MainEmuFrame::OnLogBoxHidden() // ------------------------------------------------------------------------ void MainEmuFrame::ConnectMenus() { - #define ConnectMenu( id, handler ) \ - Connect( id, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainEmuFrame::handler) ) + // System + Bind(wxEVT_MENU, &MainEmuFrame::Menu_BootCdvd_Click, this, MenuId_Boot_CDVD); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_BootCdvd2_Click, this, MenuId_Boot_CDVD2); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_OpenELF_Click, this, MenuId_Boot_ELF); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_SuspendResume_Click, this, MenuId_Sys_SuspendResume); - #define ConnectMenuRange( id_start, inc, handler ) \ - Connect( id_start, id_start + inc, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainEmuFrame::handler) ) + Bind(wxEVT_MENU, &MainEmuFrame::Menu_LoadStates_Click, this, MenuId_State_Load01 + 1, MenuId_State_Load01 + 10); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_LoadStates_Click, this, MenuId_State_LoadBackup); + //Bind(wxEVT_MENU, &MainEmuFrame::Menu_LoadStateOther_Click, this, MenuId_State_LoadOther); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_SaveStates_Click, this, MenuId_State_Save01 + 1, MenuId_State_Save01 + 10); + //Bind(wxEVT_MENU, &MainEmuFrame::Menu_SaveStateOther_Click, this, MenuId_State_SaveOther); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_EnableBackupStates_Click, this, MenuId_EnableBackupStates); - ConnectMenu( MenuId_Config_SysSettings, Menu_SysSettings_Click ); - ConnectMenu( MenuId_Config_McdSettings, Menu_McdSettings_Click ); - ConnectMenu( MenuId_Config_AppSettings, Menu_WindowSettings_Click ); - ConnectMenu( MenuId_Config_GameDatabase,Menu_GameDatabase_Click ); - ConnectMenu( MenuId_Config_BIOS, Menu_SelectPluginsBios_Click ); - ConnectMenu( MenuId_Config_Language, Menu_Language_Click ); - ConnectMenu( MenuId_Config_ResetAll, Menu_ResetAllSettings_Click ); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_EnablePatches_Click, this, MenuId_EnablePatches); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_EnableCheats_Click, this, MenuId_EnableCheats); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_EnableWideScreenPatches_Click, this, MenuId_EnableWideScreenPatches); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_EnableHostFs_Click, this, MenuId_EnableHostFs); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_SysShutdown_Click, this, MenuId_Sys_Shutdown); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_Exit_Click, this, MenuId_Exit); + // No actual menu item for this. + //Bind(wxEVT_MENU, &MainEmuFrame::Menu_SysReset_Click, this, MenuId_Sys_Restart); - ConnectMenu( MenuId_Config_Multitap0Toggle, Menu_MultitapToggle_Click ); - ConnectMenu( MenuId_Config_Multitap1Toggle, Menu_MultitapToggle_Click ); + // CDVD + Bind(wxEVT_MENU, &MainEmuFrame::Menu_IsoBrowse_Click, this, MenuId_IsoBrowse); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_CdvdSource_Click, this, MenuId_Src_Iso); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_CdvdSource_Click, this, MenuId_Src_Plugin); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_CdvdSource_Click, this, MenuId_Src_NoDisc); - ConnectMenu( MenuId_Video_WindowSettings, Menu_WindowSettings_Click ); - ConnectMenu( MenuId_Video_CoreSettings, Menu_GSSettings_Click ); + // Config + Bind(wxEVT_MENU, &MainEmuFrame::Menu_SysSettings_Click, this, MenuId_Config_SysSettings); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_McdSettings_Click, this, MenuId_Config_McdSettings); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_SelectPluginsBios_Click, this, MenuId_Config_BIOS); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_GameDatabase_Click, this, MenuId_Config_GameDatabase); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_GSSettings_Click, this, MenuId_Video_CoreSettings); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_WindowSettings_Click, this, MenuId_Video_WindowSettings); + for (int i = 0; i < PluginId_Count; ++i) + Bind(wxEVT_MENU, &MainEmuFrame::Menu_ConfigPlugin_Click, this, MenuId_PluginBase_Settings + i * PluginMenuId_Interval); - ConnectMenuRange(MenuId_Config_GS, PluginId_Count, Menu_ConfigPlugin_Click); - ConnectMenuRange(MenuId_Src_Iso, 3, Menu_CdvdSource_Click); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_MultitapToggle_Click, this, MenuId_Config_Multitap0Toggle); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_MultitapToggle_Click, this, MenuId_Config_Multitap1Toggle); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_ResetAllSettings_Click, this, MenuId_Config_ResetAll); + // For "appearance" even though it's hinting at language. No menu item exists either. + //Bind(wxEVT_MENU, &MainEmuFrame::Menu_Language_Click, this, MenuId_Config_Language); - for( int i=0; i