From 2f14598687a1ccf5668e3ff3a9486175011b7cd4 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Thu, 24 Feb 2011 05:05:25 +0000 Subject: [PATCH] Clean up the debugger gui a bit. In general do not call SetSizeHints on a window unless it is a top level window. It isn't supposed to do anything for non top level windows, but it causes glitches on linux. Removing these calls does not affect the end result on windows. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7233 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/MsgHandler.cpp | 10 +- .../Core/DolphinWX/Src/Debugger/CodeView.cpp | 125 ++++++--------- Source/Core/DolphinWX/Src/Debugger/CodeView.h | 12 +- .../DolphinWX/Src/Debugger/CodeWindow.cpp | 2 - .../DolphinWX/Src/Debugger/DSPDebugWindow.cpp | 2 - .../Core/DolphinWX/Src/Debugger/JitWindow.cpp | 2 - .../DolphinWX/Src/Debugger/MemoryView.cpp | 148 ++++++------------ .../Core/DolphinWX/Src/Debugger/MemoryView.h | 14 +- .../DolphinWX/Src/Debugger/MemoryWindow.cpp | 5 +- .../DolphinWX/Src/Debugger/RegisterWindow.cpp | 3 - .../Core/DolphinWX/Src/WiimoteConfigDiag.cpp | 6 +- Source/Core/DolphinWX/Src/WiimoteConfigDiag.h | 2 +- 12 files changed, 117 insertions(+), 214 deletions(-) diff --git a/Source/Core/Common/Src/MsgHandler.cpp b/Source/Core/Common/Src/MsgHandler.cpp index 57f8fd83fc..9f980fedd2 100644 --- a/Source/Core/Common/Src/MsgHandler.cpp +++ b/Source/Core/Common/Src/MsgHandler.cpp @@ -28,8 +28,8 @@ static bool AlertEnabled = true; std::string DefaultStringTranslator(const char* text); static StringTranslator str_translator = DefaultStringTranslator; -/* Select which of these functions that are used for message boxes. If - wxWidgets is enabled we will use wxMsgAlert() that is defined in Main.cpp */ +// Select which of these functions that are used for message boxes. If +// wxWidgets is enabled we will use wxMsgAlert() that is defined in Main.cpp void RegisterMsgAlertHandler(MsgAlertHandler handler) { msg_handler = handler; @@ -47,8 +47,8 @@ void SetEnableAlert(bool enable) AlertEnabled = enable; } -/* This is the first stop for gui alerts where the log is updated and the - correct windows is shown */ +// This is the first stop for gui alerts where the log is updated and the +// correct window is shown bool MsgAlert(bool yes_no, int Style, const char* format, ...) { // Read message and write it to the log @@ -93,7 +93,7 @@ bool MsgAlert(bool yes_no, int Style, const char* format, ...) return true; } -// Default non library depended panic alert +// Default non library dependent panic alert bool DefaultMsgHandler(const char* caption, const char* text, bool yes_no, int Style) { #ifdef _WIN32 diff --git a/Source/Core/DolphinWX/Src/Debugger/CodeView.cpp b/Source/Core/DolphinWX/Src/Debugger/CodeView.cpp index 739e435b5d..9ca684d155 100644 --- a/Source/Core/DolphinWX/Src/Debugger/CodeView.cpp +++ b/Source/Core/DolphinWX/Src/Debugger/CodeView.cpp @@ -46,7 +46,6 @@ enum IDM_ADDFUNCTION, }; - BEGIN_EVENT_TABLE(CCodeView, wxControl) EVT_ERASE_BACKGROUND(CCodeView::OnErase) EVT_PAINT(CCodeView::OnPaint) @@ -56,13 +55,17 @@ BEGIN_EVENT_TABLE(CCodeView, wxControl) EVT_RIGHT_DOWN(CCodeView::OnMouseDown) EVT_RIGHT_UP(CCodeView::OnMouseUpR) EVT_MENU(-1, CCodeView::OnPopupMenu) + EVT_SIZE(CCodeView::OnResize) END_EVENT_TABLE() -CCodeView::CCodeView(DebugInterface* debuginterface, SymbolDB *symboldb, wxWindow* parent, wxWindowID Id, const wxSize& Size) - : wxControl(parent, Id, wxDefaultPosition, Size), +CCodeView::CCodeView(DebugInterface* debuginterface, SymbolDB *symboldb, + wxWindow* parent, wxWindowID Id) + : wxControl(parent, Id), debugger(debuginterface), symbol_db(symboldb), plain(false), + curAddress(debuginterface->getPC()), + align(debuginterface->getInstructionSize(0)), rowHeight(13), selection(0), oldSelection(0), @@ -73,31 +76,16 @@ CCodeView::CCodeView(DebugInterface* debuginterface, SymbolDB *symboldb, wxWindo lx(-1), ly(-1) { - rowHeight = 13; - align = debuginterface->getInstructionSize(0); - curAddress = debuginterface->getPC(); - selection = 0; } - -wxSize CCodeView::DoGetBestSize() const -{ - wxSize bestSize; - bestSize.x = 400; - bestSize.y = 800; - return(bestSize); -} - - int CCodeView::YToAddress(int y) { wxRect rc = GetClientRect(); int ydiff = y - rc.height / 2 - rowHeight / 2; ydiff = (int)(floorf((float)ydiff / (float)rowHeight)) + 1; - return(curAddress + ydiff * align); + return curAddress + ydiff * align; } - void CCodeView::OnMouseDown(wxMouseEvent& event) { int x = event.m_x; @@ -112,50 +100,39 @@ void CCodeView::OnMouseDown(wxMouseEvent& event) selecting = true; if (!oldselecting || (selection != oldSelection)) - { - redraw(); - } + Refresh(); } else - { ToggleBreakpoint(YToAddress(y)); - } event.Skip(true); } - void CCodeView::ToggleBreakpoint(u32 address) { debugger->toggleBreakpoint(address); - redraw(); + Refresh(); Host_UpdateBreakPointView(); } - void CCodeView::OnMouseMove(wxMouseEvent& event) { wxRect rc = GetClientRect(); - if (event.m_leftDown) + if (event.m_leftDown && event.m_x > 16) { - if (event.m_x > 16) + if (event.m_y < 0) { - if (event.m_y < 0) - { - curAddress -= align; - redraw(); - } - else if (event.m_y > rc.height) - { - curAddress += align; - redraw(); - } - else - { - OnMouseDown(event); - } + curAddress -= align; + Refresh(); } + else if (event.m_y > rc.height) + { + curAddress += align; + Refresh(); + } + else + OnMouseDown(event); } event.Skip(true); @@ -175,8 +152,7 @@ void CCodeView::OnMouseUpL(wxMouseEvent& event) { curAddress = YToAddress(event.m_y); selecting = false; - //ReleaseCapture(); - redraw(); + Refresh(); } RaiseEvent(); event.Skip(true); @@ -223,7 +199,7 @@ void CCodeView::InsertBlrNop(int Blr) else debugger->insertBLR(selection, 0x60000000); } - redraw(); + Refresh(); } void CCodeView::OnPopupMenu(wxCommandEvent& event) @@ -244,12 +220,12 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event) break; case IDM_COPYCODE: - { + { char disasm[256]; debugger->disasm(selection, disasm, 256); - wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(disasm))); //Have to manually convert from char* to wxString, don't have to in Windows? - } - break; + wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(disasm))); + } + break; case IDM_COPYHEX: { @@ -263,13 +239,15 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event) case IDM_COPYFUNCTION: { Symbol *symbol = symbol_db->GetSymbolFromAddr(selection); - if (symbol) { + if (symbol) + { std::string text; text = text + symbol->name + "\r\n"; // we got a function u32 start = symbol->address; u32 end = start + symbol->size; - for (u32 addr = start; addr != end; addr += 4) { + for (u32 addr = start; addr != end; addr += 4) + { char disasm[256]; debugger->disasm(addr, disasm, 256); text = text + StringFromFormat("%08x: ", addr) + disasm + "\r\n"; @@ -283,17 +261,17 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event) case IDM_RUNTOHERE: debugger->setBreakpoint(selection); debugger->runToBreakpoint(); - redraw(); + Refresh(); break; // Insert blr or restore old value case IDM_INSERTBLR: InsertBlrNop(0); - redraw(); + Refresh(); break; case IDM_INSERTNOP: InsertBlrNop(1); - redraw(); + Refresh(); break; case IDM_JITRESULTS: @@ -310,21 +288,22 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event) break; case IDM_ADDFUNCTION: - { symbol_db->AddFunction(selection); Host_NotifyMapLoaded(); - } break; case IDM_RENAMESYMBOL: { Symbol *symbol = symbol_db->GetSymbolFromAddr(selection); - if (symbol) { - wxTextEntryDialog input_symbol(this, wxString::FromAscii("Rename symbol:"), wxGetTextFromUserPromptStr, - wxString::FromAscii(symbol->name.c_str())); - if (input_symbol.ShowModal() == wxID_OK) { + if (symbol) + { + wxTextEntryDialog input_symbol(this, wxString::FromAscii("Rename symbol:"), + wxGetTextFromUserPromptStr, + wxString::FromAscii(symbol->name.c_str())); + if (input_symbol.ShowModal() == wxID_OK) + { symbol->name = input_symbol.GetValue().mb_str(); - redraw(); // Redraw to show the renamed symbol + Refresh(); // Redraw to show the renamed symbol } Host_NotifyMapLoaded(); } @@ -332,9 +311,6 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event) break; case IDM_PATCHALERT: - { - - } break; } @@ -344,14 +320,14 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event) event.Skip(true); } - void CCodeView::OnMouseUpR(wxMouseEvent& event) { bool isSymbol = symbol_db->GetSymbolFromAddr(selection) != 0; // popup menu wxMenu* menu = new wxMenu; //menu->Append(IDM_GOTOINMEMVIEW, "&Goto in mem view"); - menu->Append(IDM_FOLLOWBRANCH, wxString::FromAscii("&Follow branch"))->Enable(AddrToBranch(selection) ? true : false); + menu->Append(IDM_FOLLOWBRANCH, + wxString::FromAscii("&Follow branch"))->Enable(AddrToBranch(selection) ? true : false); menu->AppendSeparator(); #if wxUSE_CLIPBOARD menu->Append(IDM_COPYADDRESS, wxString::FromAscii("Copy &address")); @@ -372,11 +348,9 @@ void CCodeView::OnMouseUpR(wxMouseEvent& event) event.Skip(true); } - void CCodeView::OnErase(wxEraseEvent& event) {} - void CCodeView::OnPaint(wxPaintEvent& event) { // -------------------------------------------------------------------- @@ -397,10 +371,8 @@ void CCodeView::OnPaint(wxPaintEvent& event) // TODO: Add any drawing code here... int width = rc.width; int numRows = (rc.height / rowHeight) / 2 + 2; - //numRows=(numRows&(~1)) + 1; // ------------ - // -------------------------------------------------------------------- // Colors and brushes // ------------------------- @@ -425,7 +397,6 @@ void CCodeView::OnPaint(wxPaintEvent& event) dc.DrawRectangle(0, 0, rc.width, 5); // ------------ - // -------------------------------------------------------------------- // Walk through all visible rows // ------------------------- @@ -455,7 +426,8 @@ void CCodeView::OnPaint(wxPaintEvent& event) dc.DrawRectangle(16, rowY1, width, rowY2 - rowY1 + 1); dc.SetBrush(currentBrush); - if (!plain) { + if (!plain) + { dc.SetTextForeground(_T("#600000")); // the address text is dark red dc.DrawText(temp, 17, rowY1); dc.SetTextForeground(_T("#000000")); @@ -546,7 +518,6 @@ void CCodeView::OnPaint(wxPaintEvent& event) } // end of for // ------------ - // -------------------------------------------------------------------- // Colors and brushes // ------------------------- @@ -584,7 +555,6 @@ void CCodeView::OnPaint(wxPaintEvent& event) // ------------ } - void CCodeView::_LineTo(wxPaintDC &dc, int x, int y) { dc.DrawLine(lx, ly, x, y); @@ -592,3 +562,8 @@ void CCodeView::_LineTo(wxPaintDC &dc, int x, int y) ly = y; } +void CCodeView::OnResize(wxSizeEvent& event) +{ + Refresh(); + event.Skip(); +} diff --git a/Source/Core/DolphinWX/Src/Debugger/CodeView.h b/Source/Core/DolphinWX/Src/Debugger/CodeView.h index 407648900a..a7da24f424 100644 --- a/Source/Core/DolphinWX/Src/Debugger/CodeView.h +++ b/Source/Core/DolphinWX/Src/Debugger/CodeView.h @@ -35,8 +35,8 @@ class SymbolDB; class CCodeView : public wxControl { public: - CCodeView(DebugInterface* debuginterface, SymbolDB *symbol_db, wxWindow* parent, wxWindowID Id = -1, const wxSize& Size = wxDefaultSize); - wxSize DoGetBestSize() const; + CCodeView(DebugInterface* debuginterface, SymbolDB *symbol_db, + wxWindow* parent, wxWindowID Id = wxID_ANY); void OnPaint(wxPaintEvent& event); void OnErase(wxEraseEvent& event); void OnMouseDown(wxMouseEvent& event); @@ -60,10 +60,11 @@ public: { curAddress = addr; selection = addr; - redraw(); + Refresh(); } - void SetPlain() { + void SetPlain() + { plain = true; } @@ -72,8 +73,7 @@ private: int YToAddress(int y); u32 AddrToBranch(u32 addr); - - void redraw() {Refresh();} + void OnResize(wxSizeEvent& event); DebugInterface* debugger; SymbolDB* symbol_db; diff --git a/Source/Core/DolphinWX/Src/Debugger/CodeWindow.cpp b/Source/Core/DolphinWX/Src/Debugger/CodeWindow.cpp index 2e65cbc06a..ca8f5f7598 100644 --- a/Source/Core/DolphinWX/Src/Debugger/CodeWindow.cpp +++ b/Source/Core/DolphinWX/Src/Debugger/CodeWindow.cpp @@ -411,9 +411,7 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart SetSizer(sizerBig); - sizerLeft->SetSizeHints(this); sizerLeft->Fit(this); - sizerBig->SetSizeHints(this); sizerBig->Fit(this); sync_event.Init(); diff --git a/Source/Core/DolphinWX/Src/Debugger/DSPDebugWindow.cpp b/Source/Core/DolphinWX/Src/Debugger/DSPDebugWindow.cpp index 118adf360a..cec986ad90 100644 --- a/Source/Core/DolphinWX/Src/Debugger/DSPDebugWindow.cpp +++ b/Source/Core/DolphinWX/Src/Debugger/DSPDebugWindow.cpp @@ -76,7 +76,6 @@ DSPDebuggerLLE::DSPDebuggerLLE(wxWindow* parent, wxWindowID id) m_CodeView->SetPlain(); code_sizer->Add(m_CodeView, 1, wxALL | wxEXPAND); code_panel->SetSizer(code_sizer); - code_sizer->SetSizeHints(code_panel); m_MainNotebook->AddPage(code_panel, wxT("Disasm"), true); wxPanel *mem_panel = new wxPanel(m_MainNotebook, wxID_ANY); @@ -85,7 +84,6 @@ DSPDebuggerLLE::DSPDebuggerLLE(wxWindow* parent, wxWindowID id) m_MemView = new CMemoryView(&debug_interface, mem_panel); mem_sizer->Add(m_MemView, 1, wxALL | wxEXPAND); mem_panel->SetSizer(mem_sizer); - mem_sizer->SetSizeHints(mem_panel); m_MainNotebook->AddPage(mem_panel, wxT("Mem")); m_Regs = new DSPRegisterView(this, ID_DSP_REGS); diff --git a/Source/Core/DolphinWX/Src/Debugger/JitWindow.cpp b/Source/Core/DolphinWX/Src/Debugger/JitWindow.cpp index eaf5b0c1fb..49d3512982 100644 --- a/Source/Core/DolphinWX/Src/Debugger/JitWindow.cpp +++ b/Source/Core/DolphinWX/Src/Debugger/JitWindow.cpp @@ -87,9 +87,7 @@ CJitWindow::CJitWindow(wxWindow* parent, wxWindowID id, const wxPoint& pos, SetSizer(sizerBig); - sizerSplit->SetSizeHints(this); sizerSplit->Fit(this); - sizerBig->SetSizeHints(this); sizerBig->Fit(this); } diff --git a/Source/Core/DolphinWX/Src/Debugger/MemoryView.cpp b/Source/Core/DolphinWX/Src/Debugger/MemoryView.cpp index 307e356d03..b9f615e3ea 100644 --- a/Source/Core/DolphinWX/Src/Debugger/MemoryView.cpp +++ b/Source/Core/DolphinWX/Src/Debugger/MemoryView.cpp @@ -25,7 +25,6 @@ #include #include - enum { IDM_GOTOINMEMVIEW = 12000, @@ -40,54 +39,38 @@ enum IDM_VIEWASHEX, }; - BEGIN_EVENT_TABLE(CMemoryView, wxControl) -EVT_ERASE_BACKGROUND(CMemoryView::OnErase) -EVT_PAINT(CMemoryView::OnPaint) -EVT_LEFT_DOWN(CMemoryView::OnMouseDownL) -EVT_LEFT_UP(CMemoryView::OnMouseUpL) -EVT_MOTION(CMemoryView::OnMouseMove) -EVT_RIGHT_DOWN(CMemoryView::OnMouseDownR) -EVT_MENU(-1, CMemoryView::OnPopupMenu) + EVT_PAINT(CMemoryView::OnPaint) + EVT_LEFT_DOWN(CMemoryView::OnMouseDownL) + EVT_LEFT_UP(CMemoryView::OnMouseUpL) + EVT_MOTION(CMemoryView::OnMouseMove) + EVT_RIGHT_DOWN(CMemoryView::OnMouseDownR) + EVT_MENU(-1, CMemoryView::OnPopupMenu) + EVT_SIZE(CMemoryView::OnResize) END_EVENT_TABLE() -CMemoryView::CMemoryView(DebugInterface* debuginterface, wxWindow* parent, wxWindowID Id, const wxSize& Size) - : wxControl(parent, Id, wxDefaultPosition, Size), - debugger(debuginterface), - rowHeight(13), - selection(0), - oldSelection(0), - selectionChanged(false), - selecting(false), - hasFocus(false), - showHex(false), - memory(0), - viewAsType(VIEWAS_FP) +CMemoryView::CMemoryView(DebugInterface* debuginterface, wxWindow* parent) + : wxControl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize) + , curAddress(debuginterface->getPC()) + , debugger(debuginterface) + , align(debuginterface->getInstructionSize(0)) + , rowHeight(13) + , selection(0) + , oldSelection(0) + , selecting(false) + , memory(0) + , viewAsType(VIEWAS_FP) { - rowHeight = 13; - align = debuginterface->getInstructionSize(0); - curAddress = debuginterface->getPC(); } - -wxSize CMemoryView::DoGetBestSize() const -{ - wxSize bestSize; - bestSize.x = 300; - bestSize.y = 300; - return(bestSize); -} - - int CMemoryView::YToAddress(int y) { wxRect rc = GetClientRect(); int ydiff = y - rc.height / 2 - rowHeight / 2; ydiff = (int)(floorf((float)ydiff / (float)rowHeight)) + 1; - return(curAddress + ydiff * align); + return curAddress + ydiff * align; } - void CMemoryView::OnMouseDownL(wxMouseEvent& event) { int x = event.m_x; @@ -97,70 +80,58 @@ void CMemoryView::OnMouseDownL(wxMouseEvent& event) { oldSelection = selection; selection = YToAddress(y); - // SetCapture(wnd); bool oldselecting = selecting; selecting = true; if (!oldselecting || (selection != oldSelection)) - { - redraw(); - } + Refresh(); } else { debugger->toggleMemCheck(YToAddress(y)); - redraw(); + Refresh(); Host_UpdateBreakPointView(); } event.Skip(true); } - void CMemoryView::OnMouseMove(wxMouseEvent& event) { wxRect rc = GetClientRect(); - if (event.m_leftDown) + if (event.m_leftDown && event.m_x > 16) { - if (event.m_x > 16) + if (event.m_y < 0) { - if (event.m_y < 0) - { - curAddress -= align; - redraw(); - } - else if (event.m_y > rc.height) - { - curAddress += align; - redraw(); - } - else - { - OnMouseDownL(event); - } + curAddress -= align; + Refresh(); } + else if (event.m_y > rc.height) + { + curAddress += align; + Refresh(); + } + else + OnMouseDownL(event); } event.Skip(true); } - void CMemoryView::OnMouseUpL(wxMouseEvent& event) { if (event.m_x > 16) { curAddress = YToAddress(event.m_y); selecting = false; - //ReleaseCapture(); - redraw(); + Refresh(); } event.Skip(true); } - void CMemoryView::OnPopupMenu(wxCommandEvent& event) { #if wxUSE_CLIPBOARD @@ -171,9 +142,7 @@ void CMemoryView::OnPopupMenu(wxCommandEvent& event) { #if wxUSE_CLIPBOARD case IDM_COPYADDRESS: - { - wxTheClipboard->SetData(new wxTextDataObject(wxString::Format(_T("%08x"), selection))); - } + wxTheClipboard->SetData(new wxTextDataObject(wxString::Format(_T("%08x"), selection))); break; case IDM_COPYHEX: @@ -187,21 +156,21 @@ void CMemoryView::OnPopupMenu(wxCommandEvent& event) case IDM_TOGGLEMEMORY: memory ^= 1; - redraw(); + Refresh(); break; case IDM_VIEWASFP: viewAsType = VIEWAS_FP; - redraw(); + Refresh(); break; case IDM_VIEWASASCII: viewAsType = VIEWAS_ASCII; - redraw(); + Refresh(); break; case IDM_VIEWASHEX: viewAsType = VIEWAS_HEX; - redraw(); + Refresh(); break; } @@ -211,7 +180,6 @@ void CMemoryView::OnPopupMenu(wxCommandEvent& event) event.Skip(true); } - void CMemoryView::OnMouseDownR(wxMouseEvent& event) { // popup menu @@ -223,25 +191,15 @@ void CMemoryView::OnMouseDownR(wxMouseEvent& event) #endif menu->Append(IDM_TOGGLEMEMORY, wxString::FromAscii("Toggle &memory")); - - wxMenu* viewAsSubMenu = new wxMenu; viewAsSubMenu->Append(IDM_VIEWASFP, wxString::FromAscii("FP value")); viewAsSubMenu->Append(IDM_VIEWASASCII, wxString::FromAscii("ASCII")); viewAsSubMenu->Append(IDM_VIEWASHEX, wxString::FromAscii("Hex")); menu->AppendSubMenu(viewAsSubMenu, wxString::FromAscii("View As:")); - PopupMenu(menu); - - //event.Skip(true); } - -void CMemoryView::OnErase(wxEraseEvent& event) -{} - - void CMemoryView::OnPaint(wxPaintEvent& event) { wxPaintDC dc(this); @@ -254,10 +212,8 @@ void CMemoryView::OnPaint(wxPaintEvent& event) dc.SetFont(hFont); } else - { dc.SetFont(DebuggerFont); - } - //wxFont tempFont(Lucida Console); + int fontSize = viewAsType == VIEWAS_HEX ? hFont.GetPointSize() : DebuggerFont.GetPointSize(); int textPlacement = 77; struct branch @@ -268,7 +224,6 @@ void CMemoryView::OnPaint(wxPaintEvent& event) // TODO: Add any drawing code here... int width = rc.width; int numRows = (rc.height / rowHeight) / 2 + 2; - //numRows=(numRows&(~1)) + 1; dc.SetBackgroundMode(wxTRANSPARENT); const wxChar* bgColor = _T("#ffffff"); wxPen nullPen(bgColor); @@ -304,22 +259,14 @@ void CMemoryView::OnPaint(wxPaintEvent& event) dc.DrawRectangle(0, rowY1, 16, rowY2); if (selecting && (address == selection)) - { dc.SetPen(selPen); - } else - { dc.SetPen(row == 0 ? currentPen : nullPen); - } if (address == debugger->getPC()) - { dc.SetBrush(pcBrush); - } else - { dc.SetBrush(rowBrush); - } dc.DrawRectangle(16, rowY1, width, rowY2 - 1); dc.SetBrush(currentBrush); @@ -403,28 +350,21 @@ void CMemoryView::OnPaint(wxPaintEvent& event) curAddress += 32; } else - { sprintf(dis, "INVALID VIEWAS TYPE"); - } char desc[256] = ""; if (viewAsType != VIEWAS_HEX) - { dc.DrawText(wxString::FromAscii(dis), textPlacement + fontSize*(8 + 8), rowY1); - } else { + else dc.DrawText(wxString::FromAscii(dis), textPlacement + 8+16, rowY1); - } + if (desc[0] == 0) - { strcpy(desc, debugger->getDescription(address).c_str()); - } dc.SetTextForeground(_T("#0000FF")); if (strlen(desc)) - { dc.DrawText(wxString::FromAscii(desc), 17+fontSize*((8+8+8+30)*2), rowY1); - } // Show blue memory check dot if (debugger->isMemCheck(address)) @@ -437,3 +377,9 @@ void CMemoryView::OnPaint(wxPaintEvent& event) dc.SetPen(currentPen); } + +void CMemoryView::OnResize(wxSizeEvent& event) +{ + Refresh(); + event.Skip(); +} diff --git a/Source/Core/DolphinWX/Src/Debugger/MemoryView.h b/Source/Core/DolphinWX/Src/Debugger/MemoryView.h index 178091c3b3..b1f4289316 100644 --- a/Source/Core/DolphinWX/Src/Debugger/MemoryView.h +++ b/Source/Core/DolphinWX/Src/Debugger/MemoryView.h @@ -25,10 +25,8 @@ class CMemoryView : public wxControl { public: - CMemoryView(DebugInterface* debuginterface, wxWindow* parent, wxWindowID Id = -1, const wxSize& Size = wxDefaultSize); - wxSize DoGetBestSize() const; + CMemoryView(DebugInterface* debuginterface, wxWindow* parent); void OnPaint(wxPaintEvent& event); - void OnErase(wxEraseEvent& event); void OnMouseDownL(wxMouseEvent& event); void OnMouseMove(wxMouseEvent& event); void OnMouseUpL(wxMouseEvent& event); @@ -41,27 +39,23 @@ public: void Center(u32 addr) { curAddress = addr; - redraw(); + Refresh(); } int dataType; // u8,u16,u32 int curAddress; // Will be accessed by parent private: int YToAddress(int y); - void redraw() {Refresh();} + void OnResize(wxSizeEvent& event); DebugInterface* debugger; - int align; int rowHeight; u32 selection; u32 oldSelection; - bool selectionChanged; bool selecting; - bool hasFocus; - bool showHex; int memory; @@ -77,4 +71,4 @@ private: DECLARE_EVENT_TABLE() }; -#endif /*MEMORYVIEW_H_*/ +#endif // MEMORYVIEW_H_ diff --git a/Source/Core/DolphinWX/Src/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Src/Debugger/MemoryWindow.cpp index 26ec093208..fc5803c3d6 100644 --- a/Source/Core/DolphinWX/Src/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Src/Debugger/MemoryWindow.cpp @@ -83,7 +83,7 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id, //symbols = new wxListBox(this, IDM_SYMBOLLIST, wxDefaultPosition, // wxSize(20, 100), 0, NULL, wxLB_SORT); //sizerLeft->Add(symbols, 1, wxEXPAND); - memview = new CMemoryView(di, this, wxID_ANY); + memview = new CMemoryView(di, this); memview->dataType = 0; //sizerBig->Add(sizerLeft, 1, wxEXPAND); sizerBig->Add(memview, 20, wxEXPAND); @@ -113,11 +113,8 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id, chkHex->SetValue(1); //Set defaults chk8->SetValue(1); - //sizerLeft->SetSizeHints(this); //sizerLeft->Fit(this); - sizerRight->SetSizeHints(this); sizerRight->Fit(this); - sizerBig->SetSizeHints(this); sizerBig->Fit(this); } diff --git a/Source/Core/DolphinWX/Src/Debugger/RegisterWindow.cpp b/Source/Core/DolphinWX/Src/Debugger/RegisterWindow.cpp index b067740c84..b770e78344 100644 --- a/Source/Core/DolphinWX/Src/Debugger/RegisterWindow.cpp +++ b/Source/Core/DolphinWX/Src/Debugger/RegisterWindow.cpp @@ -42,7 +42,6 @@ void CRegisterWindow::CreateGUIControls() m_GPRGridView = new CRegisterView(this, ID_GPR); sGrid->Add(m_GPRGridView, 1, wxGROW); SetSizer(sGrid); - sGrid->SetSizeHints(this); NotifyUpdate(); } @@ -50,7 +49,5 @@ void CRegisterWindow::CreateGUIControls() void CRegisterWindow::NotifyUpdate() { if (m_GPRGridView != NULL) - { m_GPRGridView->Update(); - } } diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp index 6e9520c19e..5bfad33e73 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp @@ -15,7 +15,7 @@ const wxString& ConnectedWiimotesString() WiimoteConfigPage::WiimoteConfigPage(wxWindow* const parent, const int index) : wxNotebookPage(parent, -1, wxDefaultPosition, wxDefaultSize) - , m_index(index), orig_source(g_wiimote_sources[index]), end_source(g_wiimote_sources[index]) + , m_index(index), orig_source(g_wiimote_sources[index]) { // input source const wxString src_choices[] = { _("None"), @@ -132,12 +132,12 @@ void WiimoteConfigPage::SelectSource(wxCommandEvent& event) { // This needs to be changed now in order for refresh to work right. // Revert if the dialog is canceled. - g_wiimote_sources[m_index] = end_source = event.GetInt(); + g_wiimote_sources[m_index] = event.GetInt(); } void WiimoteConfigPage::UpdateWiimoteStatus() { - if (orig_source != end_source) + if (orig_source != g_wiimote_sources[m_index]) { // Disconnect first, otherwise the new source doesn't seem to work CFrame::ConnectWiimote(m_index, false); diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h index c1eba800c2..1f151865e7 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h @@ -28,7 +28,7 @@ public: private: const int m_index; - unsigned int orig_source, end_source; + unsigned int orig_source; }; class WiimoteConfigDiag : public wxDialog