From 5ae6c21c2e2537859ff4473b131c4d2f9f2a6e0b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 3 Nov 2016 18:02:53 -0400 Subject: 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 ++------------------------- 1 file changed, 3 insertions(+), 50 deletions(-) (limited to 'Source/Core/DolphinWX/Debugger/CodeWindow.cpp') 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(); } -- cgit v1.2.3 From 9543b9d20d3a4557ff6112e38e28cd2cdac16ac1 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 4 Nov 2016 22:02:36 -0400 Subject: CodeWindow: Rename GetMenuBar() to GetParentMenuBar() --- Source/Core/DolphinWX/Debugger/CodeWindow.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Source/Core/DolphinWX/Debugger/CodeWindow.cpp') 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 -- cgit v1.2.3