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)
This commit is contained in:
Ty Lamontagne 2022-01-21 00:53:44 -05:00 committed by refractionpcsx2
parent a632f3c5cb
commit 8113e9a168
3 changed files with 9 additions and 3 deletions

View File

@ -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 {

View File

@ -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);

View File

@ -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);