diff options
| author | Lioncash <mathew1800@gmail.com> | 2016-11-03 23:43:35 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2016-11-04 00:09:47 -0400 |
| commit | 5d4c714662f4bf9e4ef025b85ffd96331e265724 (patch) | |
| tree | 23845e976797b13d596b581b2c593e9735a7e509 /Source | |
| parent | 5ae6c21c2e2537859ff4473b131c4d2f9f2a6e0b (diff) | |
CodeWindow: Hide GetMenuBar()
This eliminates public usage of the GetMenuBar() function in CodeWindow.
The benefit of this is it also gets rid of the need to perform direct
access across the config dialog and the main frame. It also gets rid of
the use of the main_frame global.
GetMenuBar() will be removed entirely from CodeWindow in a follow-up that
also removes any related remnants of code made obsolete with its removal.
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/DolphinWX/Config/GeneralConfigPane.cpp | 16 | ||||
| -rw-r--r-- | Source/Core/DolphinWX/Debugger/CodeWindow.h | 7 | ||||
| -rw-r--r-- | Source/Core/DolphinWX/Frame.h | 1 | ||||
| -rw-r--r-- | Source/Core/DolphinWX/FrameTools.cpp | 13 |
4 files changed, 19 insertions, 18 deletions
diff --git a/Source/Core/DolphinWX/Config/GeneralConfigPane.cpp b/Source/Core/DolphinWX/Config/GeneralConfigPane.cpp index 78501ba14a..742c551277 100644 --- a/Source/Core/DolphinWX/Config/GeneralConfigPane.cpp +++ b/Source/Core/DolphinWX/Config/GeneralConfigPane.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "DolphinWX/Config/GeneralConfigPane.h" + #include <wx/button.h> #include <wx/checkbox.h> #include <wx/choice.h> @@ -16,10 +18,6 @@ #include "Core/ConfigManager.h" #include "Core/Core.h" #include "Core/PowerPC/PowerPC.h" -#include "DolphinWX/Config/GeneralConfigPane.h" -#include "DolphinWX/Debugger/CodeWindow.h" -#include "DolphinWX/Frame.h" -#include "DolphinWX/Main.h" GeneralConfigPane::GeneralConfigPane(wxWindow* parent, wxWindowID id) : wxPanel(parent, id) { @@ -200,15 +198,7 @@ void GeneralConfigPane::OnThrottlerChoiceChanged(wxCommandEvent& event) void GeneralConfigPane::OnCPUEngineRadioBoxChanged(wxCommandEvent& event) { - const int selection = m_cpu_engine_radiobox->GetSelection(); - - if (main_frame->g_pCodeWindow) - { - bool using_interp = (SConfig::GetInstance().iCPUCore == PowerPC::CORE_INTERPRETER); - main_frame->g_pCodeWindow->GetMenuBar()->Check(IDM_INTERPRETER, using_interp); - } - - SConfig::GetInstance().iCPUCore = cpu_cores[selection].CPUid; + SConfig::GetInstance().iCPUCore = cpu_cores.at(event.GetSelection()).CPUid; } void GeneralConfigPane::OnAnalyticsCheckBoxChanged(wxCommandEvent& event) diff --git a/Source/Core/DolphinWX/Debugger/CodeWindow.h b/Source/Core/DolphinWX/Debugger/CodeWindow.h index 78b51495d9..e320d9ff39 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindow.h +++ b/Source/Core/DolphinWX/Debugger/CodeWindow.h @@ -83,9 +83,6 @@ public: void Load(); void Save(); - // Parent interaction - wxMenuBar* GetMenuBar(); - bool UseInterpreter(); bool BootToPause(); bool AutomaticStart(); @@ -97,7 +94,6 @@ public: void NotifyMapLoaded(); void OpenPages(); - // Menu bar // FIXME: This belongs in a separate class. void TogglePanel(int id, bool show); wxPanel* GetUntypedPanel(int id) const; @@ -127,6 +123,9 @@ public: int iNbAffiliation[IDM_DEBUG_WINDOW_LIST_END - IDM_DEBUG_WINDOW_LIST_START]; private: + // Parent interaction + wxMenuBar* GetMenuBar(); + void OnCPUMode(wxCommandEvent& event); void OnChangeFont(wxCommandEvent& event); diff --git a/Source/Core/DolphinWX/Frame.h b/Source/Core/DolphinWX/Frame.h index c86899be22..e2cf78c054 100644 --- a/Source/Core/DolphinWX/Frame.h +++ b/Source/Core/DolphinWX/Frame.h @@ -241,6 +241,7 @@ private: void OnEnableMenuItemIfCoreUninitialized(wxUpdateUIEvent& event); void OnEnableMenuItemIfCorePaused(wxUpdateUIEvent& event); void OnEnableMenuItemIfCPUCanStep(wxUpdateUIEvent& event); + void OnUpdateInterpreterMenuItem(wxUpdateUIEvent& event); void OnOpen(wxCommandEvent& event); // File menu void DoOpen(bool Boot); diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index 674d27ab89..cb4297585f 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -210,7 +210,8 @@ void CFrame::BindDebuggerMenuBarUpdateEvents() Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCPUCanStep, this, IDM_STEPOUT); Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCPUCanStep, this, IDM_STEPOVER); - Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCorePaused, this, IDM_INTERPRETER); + Bind(wxEVT_UPDATE_UI, &CFrame::OnUpdateInterpreterMenuItem, this, IDM_INTERPRETER); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCorePaused, this, IDM_JIT_OFF); Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCorePaused, this, IDM_JIT_LS_OFF); Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCorePaused, this, IDM_JIT_LSLXZ_OFF); @@ -1086,6 +1087,16 @@ void CFrame::OnEnableMenuItemIfCPUCanStep(wxUpdateUIEvent& event) event.Enable(Core::GetState() != Core::CORE_UNINITIALIZED && CPU::IsStepping()); } +void CFrame::OnUpdateInterpreterMenuItem(wxUpdateUIEvent& event) +{ + OnEnableMenuItemIfCorePaused(event); + + if (GetMenuBar()->FindItem(IDM_INTERPRETER)->IsChecked()) + return; + + event.Check(SConfig::GetInstance().iCPUCore == PowerPC::CORE_INTERPRETER); +} + void CFrame::ClearStatusBar() { if (this->GetStatusBar()->IsEnabled()) |
