From 5ae6c21c2e2537859ff4473b131c4d2f9f2a6e0b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 3 Nov 2016 18:02:53 -0400 Subject: [PATCH 1/4] CodeWindow: Eliminate explicit menu item updating from CodeWindow Gets rid of more menu-related code from CodeWindow and puts it back in CFrame where it belongs. This turns the previous menu update function within CodeWindow into one that simply updates the debugger font for its managed controls. It also improves how the font is actually updated. Previously, fonts would change, however this wouldn't actually reflect onto the respective controls until a refresh or update event occurred. Since codeview, callstack, symbols, callers, and calls windows are all managed by a wxAuiManager instance, calling Update() on it after the font has been set will reflect font changes immediately. --- Source/Core/DolphinWX/Debugger/CodeWindow.cpp | 53 +----------- Source/Core/DolphinWX/Debugger/CodeWindow.h | 2 +- .../Debugger/CodeWindowFunctions.cpp | 1 + Source/Core/DolphinWX/Frame.cpp | 5 -- Source/Core/DolphinWX/Frame.h | 7 ++ Source/Core/DolphinWX/FrameTools.cpp | 81 +++++++++++++++++-- 6 files changed, 88 insertions(+), 61 deletions(-) diff --git a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp index 862af71fb8..a801d59e8b 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp @@ -213,7 +213,6 @@ void CCodeWindow::OnCodeStep(wxCommandEvent& event) break; } - UpdateButtonStates(); // Update all toolbars in the aui manager Parent->UpdateGUI(); } @@ -502,9 +501,6 @@ void CCodeWindow::OnCPUMode(wxCommandEvent& event) // Clear the JIT cache to enable these changes JitInterface::ClearCache(); - - // Update - UpdateButtonStates(); } void CCodeWindow::OnJitMenu(wxCommandEvent& event) @@ -574,63 +570,20 @@ void CCodeWindow::Repopulate(bool refresh_codeview) if (refresh_codeview) codeview->Refresh(); + UpdateCallstack(); - UpdateButtonStates(); // Do not automatically show the current PC position when a breakpoint is hit or // when we pause since this can be called at other times too. // codeview->Center(PC); } -void CCodeWindow::UpdateButtonStates() +void CCodeWindow::UpdateFonts() { - bool Initialized = (Core::GetState() != Core::CORE_UNINITIALIZED); - bool Pause = (Core::GetState() == Core::CORE_PAUSE); - bool Stepping = CPU::IsStepping(); - bool can_step = Initialized && Stepping; - - GetMenuBar()->Enable(IDM_INTERPRETER, Pause); // CPU Mode - - GetMenuBar()->Enable(IDM_STEP, can_step); - GetMenuBar()->Enable(IDM_STEPOVER, can_step); - GetMenuBar()->Enable(IDM_STEPOUT, can_step); - - GetMenuBar()->Enable(IDM_JIT_NO_BLOCK_CACHE, !Initialized); - - GetMenuBar()->Enable(IDM_JIT_OFF, Pause); - GetMenuBar()->Enable(IDM_JIT_LS_OFF, Pause); - GetMenuBar()->Enable(IDM_JIT_LSLXZ_OFF, Pause); - GetMenuBar()->Enable(IDM_JIT_LSLWZ_OFF, Pause); - GetMenuBar()->Enable(IDM_JIT_LSLBZX_OFF, Pause); - GetMenuBar()->Enable(IDM_JIT_LSF_OFF, Pause); - GetMenuBar()->Enable(IDM_JIT_LSP_OFF, Pause); - GetMenuBar()->Enable(IDM_JIT_FP_OFF, Pause); - GetMenuBar()->Enable(IDM_JIT_I_OFF, Pause); - GetMenuBar()->Enable(IDM_JIT_P_OFF, Pause); - GetMenuBar()->Enable(IDM_JIT_SR_OFF, Pause); - - GetMenuBar()->Enable(IDM_CLEAR_CODE_CACHE, Pause); // JIT Menu - GetMenuBar()->Enable(IDM_SEARCH_INSTRUCTION, Initialized); - - GetMenuBar()->Enable(IDM_CLEAR_SYMBOLS, Initialized); // Symbols menu - GetMenuBar()->Enable(IDM_SCAN_FUNCTIONS, Initialized); - GetMenuBar()->Enable(IDM_LOAD_MAP_FILE, Initialized); - GetMenuBar()->Enable(IDM_SAVEMAPFILE, Initialized); - GetMenuBar()->Enable(IDM_LOAD_MAP_FILE_AS, Initialized); - GetMenuBar()->Enable(IDM_SAVE_MAP_FILE_AS, Initialized); - GetMenuBar()->Enable(IDM_LOAD_BAD_MAP_FILE, Initialized); - GetMenuBar()->Enable(IDM_SAVE_MAP_FILE_WITH_CODES, Initialized); - GetMenuBar()->Enable(IDM_CREATE_SIGNATURE_FILE, Initialized); - GetMenuBar()->Enable(IDM_APPEND_SIGNATURE_FILE, Initialized); - GetMenuBar()->Enable(IDM_COMBINE_SIGNATURE_FILES, Initialized); - GetMenuBar()->Enable(IDM_RENAME_SYMBOLS, Initialized); - GetMenuBar()->Enable(IDM_USE_SIGNATURE_FILE, Initialized); - GetMenuBar()->Enable(IDM_PATCH_HLE_FUNCTIONS, Initialized); - - // Update Fonts callstack->SetFont(DebuggerFont); symbols->SetFont(DebuggerFont); callers->SetFont(DebuggerFont); calls->SetFont(DebuggerFont); m_aui_manager.GetArtProvider()->SetFont(wxAUI_DOCKART_CAPTION_FONT, DebuggerFont); + m_aui_manager.Update(); } diff --git a/Source/Core/DolphinWX/Debugger/CodeWindow.h b/Source/Core/DolphinWX/Debugger/CodeWindow.h index 2b230ee5d0..78b51495d9 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindow.h +++ b/Source/Core/DolphinWX/Debugger/CodeWindow.h @@ -95,7 +95,6 @@ public: void Repopulate(bool refresh_codeview = true); void NotifyMapLoaded(); - void UpdateButtonStates(); void OpenPages(); // Menu bar @@ -151,6 +150,7 @@ private: void StepOut(); void ToggleBreakpoint(); + void UpdateFonts(); void UpdateLists(); void UpdateCallstack(); diff --git a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp index ae33abc7ed..e4a0b37da7 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp @@ -447,6 +447,7 @@ void CCodeWindow::OnChangeFont(wxCommandEvent& event) if (dialog.ShowModal() == wxID_OK) DebuggerFont = dialog.GetFontData().GetChosenFont(); + UpdateFonts(); // TODO: Send event to all panels that tells them to reload the font when it changes. } diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index 2d528fc45f..c966bf84f6 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -429,16 +429,11 @@ CFrame::CFrame(wxFrame* parent, wxWindowID id, const wxString& title, wxRect geo X11Utils::XWindowFromHandle(GetHandle())); #endif - // ------------------------- // Connect event handlers - m_Mgr->Bind(wxEVT_AUI_RENDER, &CFrame::OnManagerResize, this); - // ---------- // Update controls UpdateGUI(); - if (g_pCodeWindow) - g_pCodeWindow->UpdateButtonStates(); // check if game is running InitControllers(); diff --git a/Source/Core/DolphinWX/Frame.h b/Source/Core/DolphinWX/Frame.h index 7024469da8..c86899be22 100644 --- a/Source/Core/DolphinWX/Frame.h +++ b/Source/Core/DolphinWX/Frame.h @@ -179,6 +179,8 @@ private: void BindEvents(); void BindMenuBarEvents(); + void BindDebuggerMenuBarEvents(); + void BindDebuggerMenuBarUpdateEvents(); wxToolBar* OnCreateToolBar(long style, wxWindowID id, const wxString& name) override; wxMenuBar* CreateMenuBar() const; @@ -235,6 +237,11 @@ private: void OnReloadThemeBitmaps(wxCommandEvent& event); + void OnEnableMenuItemIfCoreInitialized(wxUpdateUIEvent& event); + void OnEnableMenuItemIfCoreUninitialized(wxUpdateUIEvent& event); + void OnEnableMenuItemIfCorePaused(wxUpdateUIEvent& event); + void OnEnableMenuItemIfCPUCanStep(wxUpdateUIEvent& event); + void OnOpen(wxCommandEvent& event); // File menu void DoOpen(bool Boot); void OnRefresh(wxCommandEvent& event); diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index b48dad0e5f..674d27ab89 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -176,6 +176,18 @@ void CFrame::BindMenuBarEvents() Bind(wxEVT_MENU, &CFrame::GameListChanged, this, IDM_PURGE_GAME_LIST_CACHE); Bind(wxEVT_MENU, &CFrame::OnChangeColumnsVisible, this, IDM_SHOW_SYSTEM, IDM_SHOW_STATE); + // Help menu + Bind(wxEVT_MENU, &CFrame::OnHelp, this, IDM_HELP_WEBSITE); + Bind(wxEVT_MENU, &CFrame::OnHelp, this, IDM_HELP_ONLINE_DOCS); + Bind(wxEVT_MENU, &CFrame::OnHelp, this, IDM_HELP_GITHUB); + Bind(wxEVT_MENU, &CFrame::OnHelp, this, wxID_ABOUT); + + if (UseDebugger) + BindDebuggerMenuBarEvents(); +} + +void CFrame::BindDebuggerMenuBarEvents() +{ // Debug menu Bind(wxEVT_MENU, &CFrame::OnPerspectiveMenu, this, IDM_SAVE_PERSPECTIVE); Bind(wxEVT_MENU, &CFrame::OnPerspectiveMenu, this, IDM_EDIT_PERSPECTIVES); @@ -189,11 +201,50 @@ void CFrame::BindMenuBarEvents() Bind(wxEVT_MENU, &CFrame::OnPerspectiveMenu, this, IDM_TAB_SPLIT); Bind(wxEVT_MENU, &CFrame::OnPerspectiveMenu, this, IDM_NO_DOCKING); - // Help menu - Bind(wxEVT_MENU, &CFrame::OnHelp, this, IDM_HELP_WEBSITE); - Bind(wxEVT_MENU, &CFrame::OnHelp, this, IDM_HELP_ONLINE_DOCS); - Bind(wxEVT_MENU, &CFrame::OnHelp, this, IDM_HELP_GITHUB); - Bind(wxEVT_MENU, &CFrame::OnHelp, this, wxID_ABOUT); + BindDebuggerMenuBarUpdateEvents(); +} + +void CFrame::BindDebuggerMenuBarUpdateEvents() +{ + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCPUCanStep, this, IDM_STEP); + 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::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); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCorePaused, this, IDM_JIT_LSLWZ_OFF); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCorePaused, this, IDM_JIT_LSLBZX_OFF); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCorePaused, this, IDM_JIT_LSF_OFF); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCorePaused, this, IDM_JIT_LSP_OFF); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCorePaused, this, IDM_JIT_FP_OFF); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCorePaused, this, IDM_JIT_I_OFF); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCorePaused, this, IDM_JIT_P_OFF); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCorePaused, this, IDM_JIT_SR_OFF); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCorePaused, this, IDM_CLEAR_CODE_CACHE); + + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCoreInitialized, this, IDM_SEARCH_INSTRUCTION); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCoreInitialized, this, IDM_CLEAR_SYMBOLS); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCoreInitialized, this, IDM_SCAN_FUNCTIONS); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCoreInitialized, this, IDM_LOAD_MAP_FILE); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCoreInitialized, this, IDM_SAVEMAPFILE); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCoreInitialized, this, IDM_LOAD_MAP_FILE_AS); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCoreInitialized, this, IDM_SAVE_MAP_FILE_AS); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCoreInitialized, this, IDM_LOAD_BAD_MAP_FILE); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCoreInitialized, this, + IDM_SAVE_MAP_FILE_WITH_CODES); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCoreInitialized, this, + IDM_CREATE_SIGNATURE_FILE); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCoreInitialized, this, + IDM_APPEND_SIGNATURE_FILE); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCoreInitialized, this, + IDM_COMBINE_SIGNATURE_FILES); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCoreInitialized, this, IDM_RENAME_SYMBOLS); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCoreInitialized, this, IDM_USE_SIGNATURE_FILE); + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCoreInitialized, this, IDM_PATCH_HLE_FUNCTIONS); + + Bind(wxEVT_UPDATE_UI, &CFrame::OnEnableMenuItemIfCoreUninitialized, this, IDM_JIT_NO_BLOCK_CACHE); } wxToolBar* CFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& name) @@ -1015,6 +1066,26 @@ void CFrame::OnReloadThemeBitmaps(wxCommandEvent& WXUNUSED(event)) UpdateGameList(); } +void CFrame::OnEnableMenuItemIfCoreInitialized(wxUpdateUIEvent& event) +{ + event.Enable(Core::GetState() != Core::CORE_UNINITIALIZED); +} + +void CFrame::OnEnableMenuItemIfCoreUninitialized(wxUpdateUIEvent& event) +{ + event.Enable(Core::GetState() == Core::CORE_UNINITIALIZED); +} + +void CFrame::OnEnableMenuItemIfCorePaused(wxUpdateUIEvent& event) +{ + event.Enable(Core::GetState() == Core::CORE_PAUSE); +} + +void CFrame::OnEnableMenuItemIfCPUCanStep(wxUpdateUIEvent& event) +{ + event.Enable(Core::GetState() != Core::CORE_UNINITIALIZED && CPU::IsStepping()); +} + void CFrame::ClearStatusBar() { if (this->GetStatusBar()->IsEnabled()) From 5d4c714662f4bf9e4ef025b85ffd96331e265724 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 3 Nov 2016 23:43:35 -0400 Subject: [PATCH 2/4] 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. --- .../Core/DolphinWX/Config/GeneralConfigPane.cpp | 16 +++------------- Source/Core/DolphinWX/Debugger/CodeWindow.h | 7 +++---- Source/Core/DolphinWX/Frame.h | 1 + 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 #include #include @@ -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()) From 07e3835a49f12ba8dcfc86db8ba0eff2e00b8f35 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 4 Nov 2016 21:57:46 -0400 Subject: [PATCH 3/4] GeneralConfigPane: rename cpu_cores to m_cpu_cores --- Source/Core/DolphinWX/Config/GeneralConfigPane.cpp | 10 +++++----- Source/Core/DolphinWX/Config/GeneralConfigPane.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Core/DolphinWX/Config/GeneralConfigPane.cpp b/Source/Core/DolphinWX/Config/GeneralConfigPane.cpp index 742c551277..86cbe7e84b 100644 --- a/Source/Core/DolphinWX/Config/GeneralConfigPane.cpp +++ b/Source/Core/DolphinWX/Config/GeneralConfigPane.cpp @@ -21,7 +21,7 @@ GeneralConfigPane::GeneralConfigPane(wxWindow* parent, wxWindowID id) : wxPanel(parent, id) { - cpu_cores = { + m_cpu_cores = { {PowerPC::CORE_INTERPRETER, _("Interpreter (slowest)")}, {PowerPC::CORE_CACHEDINTERPRETER, _("Cached Interpreter (slower)")}, #ifdef _M_X86_64 @@ -48,7 +48,7 @@ void GeneralConfigPane::InitializeGUI() m_throttler_array_string.Add(wxString::Format(_("%i%%"), i)); } - for (const CPUCore& cpu_core : cpu_cores) + for (const CPUCore& cpu_core : m_cpu_cores) m_cpu_engine_array_string.Add(cpu_core.name); m_dual_core_checkbox = new wxCheckBox(this, wxID_ANY, _("Enable Dual Core (speedup)")); @@ -154,9 +154,9 @@ void GeneralConfigPane::LoadGUIValues() if (selection < m_throttler_array_string.size()) m_throttler_choice->SetSelection(selection); - for (size_t i = 0; i < cpu_cores.size(); ++i) + for (size_t i = 0; i < m_cpu_cores.size(); ++i) { - if (cpu_cores[i].CPUid == startup_params.iCPUCore) + if (m_cpu_cores[i].CPUid == startup_params.iCPUCore) m_cpu_engine_radiobox->SetSelection(i); } } @@ -198,7 +198,7 @@ void GeneralConfigPane::OnThrottlerChoiceChanged(wxCommandEvent& event) void GeneralConfigPane::OnCPUEngineRadioBoxChanged(wxCommandEvent& event) { - SConfig::GetInstance().iCPUCore = cpu_cores.at(event.GetSelection()).CPUid; + SConfig::GetInstance().iCPUCore = m_cpu_cores.at(event.GetSelection()).CPUid; } void GeneralConfigPane::OnAnalyticsCheckBoxChanged(wxCommandEvent& event) diff --git a/Source/Core/DolphinWX/Config/GeneralConfigPane.h b/Source/Core/DolphinWX/Config/GeneralConfigPane.h index bfe7007ce4..e34565b86a 100644 --- a/Source/Core/DolphinWX/Config/GeneralConfigPane.h +++ b/Source/Core/DolphinWX/Config/GeneralConfigPane.h @@ -24,7 +24,7 @@ private: int CPUid; wxString name; }; - std::vector cpu_cores; + std::vector m_cpu_cores; void InitializeGUI(); void LoadGUIValues(); void RefreshGUI(); From 9543b9d20d3a4557ff6112e38e28cd2cdac16ac1 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 4 Nov 2016 22:02:36 -0400 Subject: [PATCH 4/4] CodeWindow: Rename GetMenuBar() to GetParentMenuBar() --- Source/Core/DolphinWX/Debugger/CodeWindow.cpp | 12 ++++++------ Source/Core/DolphinWX/Debugger/CodeWindow.h | 3 +-- .../Core/DolphinWX/Debugger/CodeWindowFunctions.cpp | 10 +++++----- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp index a801d59e8b..c39efe0047 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp @@ -132,7 +132,7 @@ CCodeWindow::~CCodeWindow() m_aui_manager.UnInit(); } -wxMenuBar* CCodeWindow::GetMenuBar() +wxMenuBar* CCodeWindow::GetParentMenuBar() { return Parent->GetMenuBar(); } @@ -539,27 +539,27 @@ void CCodeWindow::OnJitMenu(wxCommandEvent& event) // Shortcuts bool CCodeWindow::UseInterpreter() { - return GetMenuBar()->IsChecked(IDM_INTERPRETER); + return GetParentMenuBar()->IsChecked(IDM_INTERPRETER); } bool CCodeWindow::BootToPause() { - return GetMenuBar()->IsChecked(IDM_BOOT_TO_PAUSE); + return GetParentMenuBar()->IsChecked(IDM_BOOT_TO_PAUSE); } bool CCodeWindow::AutomaticStart() { - return GetMenuBar()->IsChecked(IDM_AUTOMATIC_START); + return GetParentMenuBar()->IsChecked(IDM_AUTOMATIC_START); } bool CCodeWindow::JITNoBlockCache() { - return GetMenuBar()->IsChecked(IDM_JIT_NO_BLOCK_CACHE); + return GetParentMenuBar()->IsChecked(IDM_JIT_NO_BLOCK_CACHE); } bool CCodeWindow::JITNoBlockLinking() { - return GetMenuBar()->IsChecked(IDM_JIT_NO_BLOCK_LINKING); + return GetParentMenuBar()->IsChecked(IDM_JIT_NO_BLOCK_LINKING); } // Update GUI diff --git a/Source/Core/DolphinWX/Debugger/CodeWindow.h b/Source/Core/DolphinWX/Debugger/CodeWindow.h index e320d9ff39..b3f5bca191 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindow.h +++ b/Source/Core/DolphinWX/Debugger/CodeWindow.h @@ -123,8 +123,7 @@ public: int iNbAffiliation[IDM_DEBUG_WINDOW_LIST_END - IDM_DEBUG_WINDOW_LIST_START]; private: - // Parent interaction - wxMenuBar* GetMenuBar(); + wxMenuBar* GetParentMenuBar(); void OnCPUMode(wxCommandEvent& event); diff --git a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp index e4a0b37da7..3206721851 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp @@ -93,8 +93,8 @@ void CCodeWindow::Save() IniFile::Section* general = ini.GetOrCreateSection("General"); general->Set("DebuggerFont", WxStrToStr(DebuggerFont.GetNativeFontInfoUserDesc())); - general->Set("AutomaticStart", GetMenuBar()->IsChecked(IDM_AUTOMATIC_START)); - general->Set("BootToPause", GetMenuBar()->IsChecked(IDM_BOOT_TO_PAUSE)); + general->Set("AutomaticStart", GetParentMenuBar()->IsChecked(IDM_AUTOMATIC_START)); + general->Set("BootToPause", GetParentMenuBar()->IsChecked(IDM_BOOT_TO_PAUSE)); const char* SettingName[] = {"Log", "LogConfig", "Console", "Registers", "Breakpoints", "Memory", "JIT", "Sound", "Video", "Code"}; @@ -102,7 +102,7 @@ void CCodeWindow::Save() // Save windows settings for (int i = IDM_LOG_WINDOW; i <= IDM_VIDEO_WINDOW; i++) ini.GetOrCreateSection("ShowOnStart") - ->Set(SettingName[i - IDM_LOG_WINDOW], GetMenuBar()->IsChecked(i)); + ->Set(SettingName[i - IDM_LOG_WINDOW], GetParentMenuBar()->IsChecked(i)); // Save notebook affiliations std::string section = "P - " + Parent->Perspectives[Parent->ActivePerspective].Name; @@ -125,7 +125,7 @@ void CCodeWindow::OnProfilerMenu(wxCommandEvent& event) Core::SetState(Core::CORE_PAUSE); if (jit != nullptr) jit->ClearCache(); - Profiler::g_ProfileBlocks = GetMenuBar()->IsChecked(IDM_PROFILE_BLOCKS); + Profiler::g_ProfileBlocks = GetParentMenuBar()->IsChecked(IDM_PROFILE_BLOCKS); Core::SetState(Core::CORE_RUN); break; case IDM_WRITE_PROFILE: @@ -467,7 +467,7 @@ void CCodeWindow::TogglePanel(int id, bool show) wxPanel* panel = GetUntypedPanel(id); // Not all the panels (i.e. CodeWindow) have corresponding menu options. - wxMenuItem* item = GetMenuBar()->FindItem(id); + wxMenuItem* item = GetParentMenuBar()->FindItem(id); if (item) item->Check(show);