summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/Frame.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2016-10-21 21:44:56 +0200
committerGitHub <noreply@github.com>2016-10-21 21:44:56 +0200
commita2644cd102efd99db97b4055a9a1e86ad8dd8bd0 (patch)
tree49f961c714919b0909ca6d4c7346301ab0418c52 /Source/Core/DolphinWX/Frame.cpp
parentd62a0368666d35a0660a0dfdf0d0fa75e0ff96d5 (diff)
parent42e1dafd6dc312d85bad2605fb494af0b7895892 (diff)
Merge pull request #4363 from lioncash/wx-menu
DolphinWX: Move main menu creation into a wxMenuBar subclass
Diffstat (limited to 'Source/Core/DolphinWX/Frame.cpp')
-rw-r--r--Source/Core/DolphinWX/Frame.cpp100
1 files changed, 11 insertions, 89 deletions
diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp
index e9182d348e..5978dfc49d 100644
--- a/Source/Core/DolphinWX/Frame.cpp
+++ b/Source/Core/DolphinWX/Frame.cpp
@@ -220,96 +220,17 @@ bool CRenderFrame::ShowFullScreen(bool show, long style)
return result;
}
-// event tables
-// Notice that wxID_HELP will be processed for the 'About' menu and the toolbar
-// help button.
-
wxDEFINE_EVENT(wxEVT_HOST_COMMAND, wxCommandEvent);
wxDEFINE_EVENT(DOLPHIN_EVT_LOCAL_INI_CHANGED, wxCommandEvent);
+// Event tables
BEGIN_EVENT_TABLE(CFrame, CRenderFrame)
-// Menu bar
-EVT_MENU(wxID_OPEN, CFrame::OnOpen)
-EVT_MENU(wxID_EXIT, CFrame::OnQuit)
-EVT_MENU(IDM_HELP_WEBSITE, CFrame::OnHelp)
-EVT_MENU(IDM_HELP_ONLINE_DOCS, CFrame::OnHelp)
-EVT_MENU(IDM_HELP_GITHUB, CFrame::OnHelp)
-EVT_MENU(wxID_ABOUT, CFrame::OnHelp)
-EVT_MENU(wxID_REFRESH, CFrame::OnRefresh)
-EVT_MENU(IDM_PLAY, CFrame::OnPlay)
-EVT_MENU(IDM_STOP, CFrame::OnStop)
-EVT_MENU(IDM_RESET, CFrame::OnReset)
-EVT_MENU(IDM_RECORD, CFrame::OnRecord)
-EVT_MENU(IDM_PLAY_RECORD, CFrame::OnPlayRecording)
-EVT_MENU(IDM_RECORD_EXPORT, CFrame::OnRecordExport)
-EVT_MENU(IDM_RECORD_READ_ONLY, CFrame::OnRecordReadOnly)
-EVT_MENU(IDM_TAS_INPUT, CFrame::OnTASInput)
-EVT_MENU(IDM_TOGGLE_PAUSE_MOVIE, CFrame::OnTogglePauseMovie)
-EVT_MENU(IDM_SHOW_LAG, CFrame::OnShowLag)
-EVT_MENU(IDM_SHOW_FRAME_COUNT, CFrame::OnShowFrameCount)
-EVT_MENU(IDM_SHOW_INPUT_DISPLAY, CFrame::OnShowInputDisplay)
-EVT_MENU(IDM_SHOW_RTC_DISPLAY, CFrame::OnShowRTCDisplay)
-EVT_MENU(IDM_FRAMESTEP, CFrame::OnFrameStep)
-EVT_MENU(IDM_SCREENSHOT, CFrame::OnScreenshot)
-EVT_MENU(IDM_TOGGLE_DUMP_FRAMES, CFrame::OnToggleDumpFrames)
-EVT_MENU(IDM_TOGGLE_DUMP_AUDIO, CFrame::OnToggleDumpAudio)
-EVT_MENU(wxID_PREFERENCES, CFrame::OnConfigMain)
-EVT_MENU(IDM_CONFIG_GFX_BACKEND, CFrame::OnConfigGFX)
-EVT_MENU(IDM_CONFIG_AUDIO, CFrame::OnConfigAudio)
-EVT_MENU(IDM_CONFIG_CONTROLLERS, CFrame::OnConfigControllers)
-EVT_MENU(IDM_CONFIG_HOTKEYS, CFrame::OnConfigHotkey)
-
-EVT_MENU(IDM_SAVE_PERSPECTIVE, CFrame::OnPerspectiveMenu)
-EVT_MENU(IDM_EDIT_PERSPECTIVES, CFrame::OnPerspectiveMenu)
-// Drop down
-EVT_MENU(IDM_PERSPECTIVES_ADD_PANE_TOP, CFrame::OnPerspectiveMenu)
-EVT_MENU(IDM_PERSPECTIVES_ADD_PANE_BOTTOM, CFrame::OnPerspectiveMenu)
-EVT_MENU(IDM_PERSPECTIVES_ADD_PANE_LEFT, CFrame::OnPerspectiveMenu)
-EVT_MENU(IDM_PERSPECTIVES_ADD_PANE_RIGHT, CFrame::OnPerspectiveMenu)
-EVT_MENU(IDM_PERSPECTIVES_ADD_PANE_CENTER, CFrame::OnPerspectiveMenu)
-EVT_MENU_RANGE(IDM_PERSPECTIVES_0, IDM_PERSPECTIVES_100, CFrame::OnSelectPerspective)
-EVT_MENU(IDM_ADD_PERSPECTIVE, CFrame::OnPerspectiveMenu)
-EVT_MENU(IDM_TAB_SPLIT, CFrame::OnPerspectiveMenu)
-EVT_MENU(IDM_NO_DOCKING, CFrame::OnPerspectiveMenu)
-// Drop down float
+// Debugger pane context menu
EVT_MENU_RANGE(IDM_FLOAT_LOG_WINDOW, IDM_FLOAT_CODE_WINDOW, CFrame::OnFloatWindow)
-EVT_MENU(IDM_NETPLAY, CFrame::OnNetPlay)
-EVT_MENU(IDM_MEMCARD, CFrame::OnMemcard)
-EVT_MENU(IDM_IMPORT_SAVE, CFrame::OnImportSave)
-EVT_MENU(IDM_EXPORT_ALL_SAVE, CFrame::OnExportAllSaves)
-EVT_MENU(IDM_CHEATS, CFrame::OnShowCheatsWindow)
-EVT_MENU(IDM_CHANGE_DISC, CFrame::OnChangeDisc)
-EVT_MENU(IDM_MENU_INSTALL_WAD, CFrame::OnInstallWAD)
+// Game list context menu
EVT_MENU(IDM_LIST_INSTALL_WAD, CFrame::OnInstallWAD)
-EVT_MENU(IDM_LOAD_WII_MENU, CFrame::OnLoadWiiMenu)
-EVT_MENU(IDM_FIFOPLAYER, CFrame::OnFifoPlayer)
-
-EVT_MENU(IDM_TOGGLE_FULLSCREEN, CFrame::OnToggleFullscreen)
-EVT_MENU(IDM_TOGGLE_DUAL_CORE, CFrame::OnToggleDualCore)
-EVT_MENU(IDM_TOGGLE_TOOLBAR, CFrame::OnToggleToolbar)
-EVT_MENU(IDM_TOGGLE_STATUSBAR, CFrame::OnToggleStatusbar)
-EVT_MENU_RANGE(IDM_LOG_WINDOW, IDM_VIDEO_WINDOW, CFrame::OnToggleWindow)
-EVT_MENU_RANGE(IDM_SHOW_SYSTEM, IDM_SHOW_STATE, CFrame::OnChangeColumnsVisible)
-
-EVT_MENU(IDM_PURGE_GAME_LIST_CACHE, CFrame::GameListChanged)
-
-EVT_MENU(IDM_SAVE_FIRST_STATE, CFrame::OnSaveFirstState)
-EVT_MENU(IDM_UNDO_LOAD_STATE, CFrame::OnUndoLoadState)
-EVT_MENU(IDM_UNDO_SAVE_STATE, CFrame::OnUndoSaveState)
-EVT_MENU(IDM_LOAD_STATE_FILE, CFrame::OnLoadStateFromFile)
-EVT_MENU(IDM_SAVE_STATE_FILE, CFrame::OnSaveStateToFile)
-EVT_MENU(IDM_SAVE_SELECTED_SLOT, CFrame::OnSaveCurrentSlot)
-EVT_MENU(IDM_LOAD_SELECTED_SLOT, CFrame::OnLoadCurrentSlot)
-
-EVT_MENU_RANGE(IDM_LOAD_SLOT_1, IDM_LOAD_SLOT_10, CFrame::OnLoadState)
-EVT_MENU_RANGE(IDM_LOAD_LAST_1, IDM_LOAD_LAST_10, CFrame::OnLoadLastState)
-EVT_MENU_RANGE(IDM_SAVE_SLOT_1, IDM_SAVE_SLOT_10, CFrame::OnSaveState)
-EVT_MENU_RANGE(IDM_SELECT_SLOT_1, IDM_SELECT_SLOT_10, CFrame::OnSelectSlot)
-EVT_MENU_RANGE(IDM_DRIVE1, IDM_DRIVE24, CFrame::OnBootDrive)
-EVT_MENU_RANGE(IDM_CONNECT_WIIMOTE1, IDM_CONNECT_BALANCEBOARD, CFrame::OnConnectWiimote)
-EVT_MENU_RANGE(IDM_LIST_WAD, IDM_LIST_DRIVES, CFrame::GameListChanged)
// Other
EVT_ACTIVATE(CFrame::OnActive)
@@ -375,6 +296,8 @@ CFrame::CFrame(wxFrame* parent, wxWindowID id, const wxString& title, wxRect geo
UseDebugger(use_debugger), m_bBatchMode(batch_mode),
m_toolbar_bitmap_size(FromDIP(wxSize(32, 32)))
{
+ BindMenuBarEvents();
+
for (int i = 0; i <= IDM_CODE_WINDOW - IDM_LOG_WINDOW; i++)
bFloatWindow[i] = false;
@@ -398,8 +321,7 @@ CFrame::CFrame(wxFrame* parent, wxWindowID id, const wxString& title, wxRect geo
GetStatusBar()->Hide();
// Give it a menu bar
- wxMenuBar* menubar_active = CreateMenuBar();
- SetMenuBar(menubar_active);
+ SetMenuBar(CreateMenuBar());
// Create a menubar to service requests while the real menubar is hidden from the screen
m_menubar_shadow = CreateMenuBar();
@@ -941,7 +863,7 @@ static bool IsHotkey(int id, bool held = false)
return HotkeyManagerEmu::IsPressed(id, held);
}
-int GetCmdForHotkey(unsigned int key)
+static int GetMenuIDFromHotkey(unsigned int key)
{
switch (key)
{
@@ -1363,11 +1285,11 @@ void CFrame::ParseHotkeys()
if (IsHotkey(i))
{
- int cmd = GetCmdForHotkey(i);
- if (cmd >= 0)
+ const int id = GetMenuIDFromHotkey(i);
+ if (id >= 0)
{
- wxCommandEvent evt(wxEVT_MENU, cmd);
- wxMenuItem* item = GetMenuBar()->FindItem(cmd);
+ wxCommandEvent evt(wxEVT_MENU, id);
+ wxMenuItem* item = GetMenuBar()->FindItem(id);
if (item && item->IsCheckable())
{
item->wxMenuItemBase::Toggle();