summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp
diff options
context:
space:
mode:
authorshuffle2 <godisgovernment@gmail.com>2016-10-03 20:06:08 -0700
committerGitHub <noreply@github.com>2016-10-03 20:06:08 -0700
commitb8731eb8180d76b4663eaf4188f985b9c5fa6fb2 (patch)
tree40f57e85be3073d528e9e5a5776a905170a3a7ac /Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp
parent4573cc89fa65a867f991c1e592ad47382f1ee0a5 (diff)
parentc4f5ced37ca9eff6a5c62c08f1cc7a9e6dc47f7d (diff)
Merge pull request #4068 from EmptyChaos/wx-hidpi
WX: Comprehensive HiDPI Patch
Diffstat (limited to 'Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp')
-rw-r--r--Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp214
1 files changed, 78 insertions, 136 deletions
diff --git a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp
index 0a1300146b..42a4b8f22c 100644
--- a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp
+++ b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp
@@ -453,7 +453,7 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
break;
case IDM_PATCH_HLE_FUNCTIONS:
HLE::PatchFunctions();
- Update();
+ Repopulate();
break;
}
}
@@ -464,7 +464,6 @@ void CCodeWindow::NotifyMapLoaded()
return;
g_symbolDB.FillInCallers();
- // symbols->Show(false); // hide it for faster filling
symbols->Freeze(); // HyperIris: wx style fast filling
symbols->Clear();
for (const auto& symbol : g_symbolDB.Symbols())
@@ -473,8 +472,7 @@ void CCodeWindow::NotifyMapLoaded()
symbols->SetClientData(idx, (void*)&symbol.second);
}
symbols->Thaw();
- // symbols->Show(true);
- Update();
+ Repopulate();
}
void CCodeWindow::OnSymbolListChange(wxCommandEvent& event)
@@ -487,8 +485,9 @@ void CCodeWindow::OnSymbolListChange(wxCommandEvent& event)
{
if (pSymbol->type == Symbol::Type::Data)
{
- if (m_MemoryWindow) // && m_MemoryWindow->IsVisible())
- m_MemoryWindow->JumpToAddress(pSymbol->address);
+ CMemoryWindow* memory = GetPanel<CMemoryWindow>();
+ if (memory)
+ memory->JumpToAddress(pSymbol->address);
}
else
{
@@ -498,10 +497,6 @@ void CCodeWindow::OnSymbolListChange(wxCommandEvent& event)
}
}
-void CCodeWindow::OnSymbolListContextMenu(wxContextMenuEvent& event)
-{
-}
-
// Change the global DebuggerFont
void CCodeWindow::OnChangeFont(wxCommandEvent& event)
{
@@ -511,157 +506,104 @@ void CCodeWindow::OnChangeFont(wxCommandEvent& event)
wxFontDialog dialog(this, data);
if (dialog.ShowModal() == wxID_OK)
DebuggerFont = dialog.GetFontData().GetChosenFont();
+
+ // TODO: Send event to all panels that tells them to reload the font when it changes.
}
// Toggle windows
-void CCodeWindow::OpenPages()
+wxPanel* CCodeWindow::GetUntypedPanel(int id) const
{
- ToggleCodeWindow(true);
- if (bShowOnStart[0])
- Parent->ToggleLogWindow(true);
- if (bShowOnStart[IDM_LOG_CONFIG_WINDOW - IDM_LOG_WINDOW])
- Parent->ToggleLogConfigWindow(true);
- if (bShowOnStart[IDM_REGISTER_WINDOW - IDM_LOG_WINDOW])
- ToggleRegisterWindow(true);
- if (bShowOnStart[IDM_WATCH_WINDOW - IDM_LOG_WINDOW])
- ToggleWatchWindow(true);
- if (bShowOnStart[IDM_BREAKPOINT_WINDOW - IDM_LOG_WINDOW])
- ToggleBreakPointWindow(true);
- if (bShowOnStart[IDM_MEMORY_WINDOW - IDM_LOG_WINDOW])
- ToggleMemoryWindow(true);
- if (bShowOnStart[IDM_JIT_WINDOW - IDM_LOG_WINDOW])
- ToggleJitWindow(true);
- if (bShowOnStart[IDM_SOUND_WINDOW - IDM_LOG_WINDOW])
- ToggleSoundWindow(true);
- if (bShowOnStart[IDM_VIDEO_WINDOW - IDM_LOG_WINDOW])
- ToggleVideoWindow(true);
+ wxASSERT_MSG(id >= IDM_DEBUG_WINDOW_LIST_START && id < IDM_DEBUG_WINDOW_LIST_END,
+ "ID out of range");
+ wxASSERT_MSG(id != IDM_LOG_WINDOW && id != IDM_LOG_CONFIG_WINDOW,
+ "Log windows are managed separately");
+ return m_sibling_panels.at(id - IDM_DEBUG_WINDOW_LIST_START);
}
-void CCodeWindow::ToggleCodeWindow(bool bShow)
+void CCodeWindow::TogglePanel(int id, bool show)
{
- if (bShow)
- Parent->DoAddPage(this, iNbAffiliation[IDM_CODE_WINDOW - IDM_LOG_WINDOW],
- Parent->bFloatWindow[IDM_CODE_WINDOW - IDM_LOG_WINDOW]);
- else // Hide
- Parent->DoRemovePage(this);
-}
+ wxPanel* panel = GetUntypedPanel(id);
-void CCodeWindow::ToggleRegisterWindow(bool bShow)
-{
- GetMenuBar()->FindItem(IDM_REGISTER_WINDOW)->Check(bShow);
- if (bShow)
- {
- if (!m_RegisterWindow)
- m_RegisterWindow = new CRegisterWindow(Parent, IDM_REGISTER_WINDOW);
- Parent->DoAddPage(m_RegisterWindow, iNbAffiliation[IDM_REGISTER_WINDOW - IDM_LOG_WINDOW],
- Parent->bFloatWindow[IDM_REGISTER_WINDOW - IDM_LOG_WINDOW]);
- }
- else // Close
- {
- Parent->DoRemovePage(m_RegisterWindow, false);
- m_RegisterWindow = nullptr;
- }
-}
+ // Not all the panels (i.e. CodeWindow) have corresponding menu options.
+ wxMenuItem* item = GetMenuBar()->FindItem(id);
+ if (item)
+ item->Check(show);
-void CCodeWindow::ToggleWatchWindow(bool bShow)
-{
- GetMenuBar()->FindItem(IDM_WATCH_WINDOW)->Check(bShow);
- if (bShow)
+ if (show)
{
- if (!m_WatchWindow)
- m_WatchWindow = new CWatchWindow(Parent, IDM_WATCH_WINDOW);
- Parent->DoAddPage(m_WatchWindow, iNbAffiliation[IDM_WATCH_WINDOW - IDM_LOG_WINDOW],
- Parent->bFloatWindow[IDM_WATCH_WINDOW - IDM_LOG_WINDOW]);
+ if (!panel)
+ {
+ panel = CreateSiblingPanel(id);
+ }
+ Parent->DoAddPage(panel, iNbAffiliation[id - IDM_DEBUG_WINDOW_LIST_START],
+ Parent->bFloatWindow[id - IDM_DEBUG_WINDOW_LIST_START]);
}
- else // Close
+ else if (panel) // Close
{
- Parent->DoRemovePage(m_WatchWindow, false);
- m_WatchWindow = nullptr;
+ Parent->DoRemovePage(panel, panel == this);
+ m_sibling_panels[id - IDM_DEBUG_WINDOW_LIST_START] = nullptr;
}
}
-void CCodeWindow::ToggleBreakPointWindow(bool bShow)
+wxPanel* CCodeWindow::CreateSiblingPanel(int id)
{
- GetMenuBar()->FindItem(IDM_BREAKPOINT_WINDOW)->Check(bShow);
- if (bShow)
- {
- if (!m_BreakpointWindow)
- m_BreakpointWindow = new CBreakPointWindow(this, Parent, IDM_BREAKPOINT_WINDOW);
- Parent->DoAddPage(m_BreakpointWindow, iNbAffiliation[IDM_BREAKPOINT_WINDOW - IDM_LOG_WINDOW],
- Parent->bFloatWindow[IDM_BREAKPOINT_WINDOW - IDM_LOG_WINDOW]);
- }
- else // Close
- {
- Parent->DoRemovePage(m_BreakpointWindow, false);
- m_BreakpointWindow = nullptr;
- }
-}
+ // Includes range check inside the get call
+ wxASSERT_MSG(!GetUntypedPanel(id), "Panel must not already exist");
-void CCodeWindow::ToggleMemoryWindow(bool bShow)
-{
- GetMenuBar()->FindItem(IDM_MEMORY_WINDOW)->Check(bShow);
- if (bShow)
+ wxPanel* panel = nullptr;
+ switch (id)
{
- if (!m_MemoryWindow)
- m_MemoryWindow = new CMemoryWindow(this, Parent, IDM_MEMORY_WINDOW);
- Parent->DoAddPage(m_MemoryWindow, iNbAffiliation[IDM_MEMORY_WINDOW - IDM_LOG_WINDOW],
- Parent->bFloatWindow[IDM_MEMORY_WINDOW - IDM_LOG_WINDOW]);
- }
- else // Close
- {
- Parent->DoRemovePage(m_MemoryWindow, false);
- m_MemoryWindow = nullptr;
+ // case IDM_LOG_WINDOW: // These exist separately in CFrame.
+ // case IDM_LOG_CONFIG_WINDOW:
+ case IDM_REGISTER_WINDOW:
+ panel = new CRegisterWindow(Parent, IDM_REGISTER_WINDOW);
+ break;
+ case IDM_WATCH_WINDOW:
+ panel = new CWatchWindow(Parent, IDM_WATCH_WINDOW);
+ break;
+ case IDM_BREAKPOINT_WINDOW:
+ panel = new CBreakPointWindow(this, Parent, IDM_BREAKPOINT_WINDOW);
+ break;
+ case IDM_MEMORY_WINDOW:
+ panel = new CMemoryWindow(Parent, IDM_MEMORY_WINDOW);
+ break;
+ case IDM_JIT_WINDOW:
+ panel = new CJitWindow(Parent, IDM_JIT_WINDOW);
+ break;
+ case IDM_SOUND_WINDOW:
+ panel = new DSPDebuggerLLE(Parent, IDM_SOUND_WINDOW);
+ break;
+ case IDM_VIDEO_WINDOW:
+ panel = new GFXDebuggerPanel(Parent, IDM_VIDEO_WINDOW);
+ break;
+ case IDM_CODE_WINDOW:
+ panel = this;
+ break;
+ default:
+ wxTrap();
+ break;
}
-}
-void CCodeWindow::ToggleJitWindow(bool bShow)
-{
- GetMenuBar()->FindItem(IDM_JIT_WINDOW)->Check(bShow);
- if (bShow)
- {
- if (!m_JitWindow)
- m_JitWindow = new CJitWindow(Parent, IDM_JIT_WINDOW);
- Parent->DoAddPage(m_JitWindow, iNbAffiliation[IDM_JIT_WINDOW - IDM_LOG_WINDOW],
- Parent->bFloatWindow[IDM_JIT_WINDOW - IDM_LOG_WINDOW]);
- }
- else // Close
- {
- Parent->DoRemovePage(m_JitWindow, false);
- m_JitWindow = nullptr;
- }
+ m_sibling_panels[id - IDM_DEBUG_WINDOW_LIST_START] = panel;
+ return panel;
}
-void CCodeWindow::ToggleSoundWindow(bool bShow)
+void CCodeWindow::OpenPages()
{
- GetMenuBar()->FindItem(IDM_SOUND_WINDOW)->Check(bShow);
- if (bShow)
- {
- if (!m_SoundWindow)
- m_SoundWindow = new DSPDebuggerLLE(Parent, IDM_SOUND_WINDOW);
- Parent->DoAddPage(m_SoundWindow, iNbAffiliation[IDM_SOUND_WINDOW - IDM_LOG_WINDOW],
- Parent->bFloatWindow[IDM_SOUND_WINDOW - IDM_LOG_WINDOW]);
- }
- else // Close
- {
- Parent->DoRemovePage(m_SoundWindow, false);
- m_SoundWindow = nullptr;
- }
-}
+ // This is forced, and should always be placed as the first tab in the notebook.
+ TogglePanel(IDM_CODE_WINDOW, true);
-void CCodeWindow::ToggleVideoWindow(bool bShow)
-{
- GetMenuBar()->FindItem(IDM_VIDEO_WINDOW)->Check(bShow);
- if (bShow)
- {
- if (!m_VideoWindow)
- m_VideoWindow = new GFXDebuggerPanel(Parent, IDM_VIDEO_WINDOW);
- Parent->DoAddPage(m_VideoWindow, iNbAffiliation[IDM_VIDEO_WINDOW - IDM_LOG_WINDOW],
- Parent->bFloatWindow[IDM_VIDEO_WINDOW - IDM_LOG_WINDOW]);
- }
- else // Close
+ // These panels are managed separately by CFrame
+ if (bShowOnStart[IDM_LOG_WINDOW - IDM_DEBUG_WINDOW_LIST_START])
+ Parent->ToggleLogWindow(true);
+ if (bShowOnStart[IDM_LOG_CONFIG_WINDOW - IDM_DEBUG_WINDOW_LIST_START])
+ Parent->ToggleLogConfigWindow(true);
+
+ // Iterate normal panels that don't have weird rules.
+ for (int i = IDM_REGISTER_WINDOW; i < IDM_CODE_WINDOW; ++i)
{
- Parent->DoRemovePage(m_VideoWindow, false);
- m_VideoWindow = nullptr;
+ if (bShowOnStart[i - IDM_DEBUG_WINDOW_LIST_START])
+ TogglePanel(i, true);
}
}