From 8113e9a1682b9db48c80daac5d637dd0189d7036 Mon Sep 17 00:00:00 2001 From: Ty Lamontagne Date: Fri, 21 Jan 2022 00:53:44 -0500 Subject: [PATCH] Debugger: Fix memory search drawing and sizing Now it should be sized a little better A little funky on dpis greater than 100% (sorry wx is not easy to work with) --- pcsx2/gui/Debugger/CtrlMemSearch.cpp | 1 + pcsx2/gui/Debugger/CtrlMemSearch.h | 7 +++++++ pcsx2/gui/Debugger/DisassemblyDialog.cpp | 4 +--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pcsx2/gui/Debugger/CtrlMemSearch.cpp b/pcsx2/gui/Debugger/CtrlMemSearch.cpp index d90544966c..ccee3ab1de 100644 --- a/pcsx2/gui/Debugger/CtrlMemSearch.cpp +++ b/pcsx2/gui/Debugger/CtrlMemSearch.cpp @@ -33,6 +33,7 @@ wxDEFINE_EVENT(pxEvt_SearchFinished, wxCommandEvent); wxBEGIN_EVENT_TABLE(CtrlMemSearch, wxWindow) EVT_SET_FOCUS(CtrlMemSearch::focusEvent) EVT_KILL_FOCUS(CtrlMemSearch::focusEvent) + EVT_SIZE(CtrlMemSearch::sizeEvent) wxEND_EVENT_TABLE() enum MemoryViewMenuIdentifiers { diff --git a/pcsx2/gui/Debugger/CtrlMemSearch.h b/pcsx2/gui/Debugger/CtrlMemSearch.h index c8f3193d97..909dd2fb22 100644 --- a/pcsx2/gui/Debugger/CtrlMemSearch.h +++ b/pcsx2/gui/Debugger/CtrlMemSearch.h @@ -73,6 +73,13 @@ private: void postEvent(wxEventType type, int value); void onPopupClick(wxCommandEvent& evt); void focusEvent(wxFocusEvent& evt) { Refresh(); }; + void sizeEvent(wxSizeEvent& evt) + { + // Why in the world do I have to do this. + // Without this the window isn't redrawn during a size event + Refresh(); // Reloads the window, fixes the imporper drawing but ruins the layout + Layout(); // Fix the layout of the window + }; void onSearchFinished(wxCommandEvent& evt); void onSearchNext(wxCommandEvent& evt); void onSearchPrev(wxCommandEvent& evt); diff --git a/pcsx2/gui/Debugger/DisassemblyDialog.cpp b/pcsx2/gui/Debugger/DisassemblyDialog.cpp index b48318a33e..876a7993c7 100644 --- a/pcsx2/gui/Debugger/DisassemblyDialog.cpp +++ b/pcsx2/gui/Debugger/DisassemblyDialog.cpp @@ -116,9 +116,7 @@ CpuTabPage::CpuTabPage(wxWindow* parent, DebugInterface* _cpu) wxBoxSizer *memorySizer = new wxBoxSizer(wxHORIZONTAL); memorySizer->Add(memory, 1, wxEXPAND); - // Unfortuneately hacky, probably cause I'm bad at wxWidgets - // A max width of 360 ensures that the memory view will never be blocked by the memory search - memorySearch->SetMaxSize(wxSize(360, -1)); + memorySearch->SetMaxSize(wxSize(310 * MSW_GetDPIScale(), -1)); memorySizer->Add(memorySearch, 1, wxEXPAND); memoryPanel->SetSizer(memorySizer); memoryPanel->SetBackgroundColour(wxTransparentColor);