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
This commit is contained in:
Glenn Rice 2011-02-24 05:05:25 +00:00
parent 1eaad0966c
commit 2f14598687
12 changed files with 117 additions and 214 deletions

View File

@ -28,8 +28,8 @@ static bool AlertEnabled = true;
std::string DefaultStringTranslator(const char* text); std::string DefaultStringTranslator(const char* text);
static StringTranslator str_translator = DefaultStringTranslator; static StringTranslator str_translator = DefaultStringTranslator;
/* Select which of these functions that are used for message boxes. If // 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 */ // wxWidgets is enabled we will use wxMsgAlert() that is defined in Main.cpp
void RegisterMsgAlertHandler(MsgAlertHandler handler) void RegisterMsgAlertHandler(MsgAlertHandler handler)
{ {
msg_handler = handler; msg_handler = handler;
@ -47,8 +47,8 @@ void SetEnableAlert(bool enable)
AlertEnabled = enable; AlertEnabled = enable;
} }
/* This is the first stop for gui alerts where the log is updated and the // This is the first stop for gui alerts where the log is updated and the
correct windows is shown */ // correct window is shown
bool MsgAlert(bool yes_no, int Style, const char* format, ...) bool MsgAlert(bool yes_no, int Style, const char* format, ...)
{ {
// Read message and write it to the log // Read message and write it to the log
@ -93,7 +93,7 @@ bool MsgAlert(bool yes_no, int Style, const char* format, ...)
return true; 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) bool DefaultMsgHandler(const char* caption, const char* text, bool yes_no, int Style)
{ {
#ifdef _WIN32 #ifdef _WIN32

View File

@ -46,7 +46,6 @@ enum
IDM_ADDFUNCTION, IDM_ADDFUNCTION,
}; };
BEGIN_EVENT_TABLE(CCodeView, wxControl) BEGIN_EVENT_TABLE(CCodeView, wxControl)
EVT_ERASE_BACKGROUND(CCodeView::OnErase) EVT_ERASE_BACKGROUND(CCodeView::OnErase)
EVT_PAINT(CCodeView::OnPaint) EVT_PAINT(CCodeView::OnPaint)
@ -56,13 +55,17 @@ BEGIN_EVENT_TABLE(CCodeView, wxControl)
EVT_RIGHT_DOWN(CCodeView::OnMouseDown) EVT_RIGHT_DOWN(CCodeView::OnMouseDown)
EVT_RIGHT_UP(CCodeView::OnMouseUpR) EVT_RIGHT_UP(CCodeView::OnMouseUpR)
EVT_MENU(-1, CCodeView::OnPopupMenu) EVT_MENU(-1, CCodeView::OnPopupMenu)
EVT_SIZE(CCodeView::OnResize)
END_EVENT_TABLE() END_EVENT_TABLE()
CCodeView::CCodeView(DebugInterface* debuginterface, SymbolDB *symboldb, wxWindow* parent, wxWindowID Id, const wxSize& Size) CCodeView::CCodeView(DebugInterface* debuginterface, SymbolDB *symboldb,
: wxControl(parent, Id, wxDefaultPosition, Size), wxWindow* parent, wxWindowID Id)
: wxControl(parent, Id),
debugger(debuginterface), debugger(debuginterface),
symbol_db(symboldb), symbol_db(symboldb),
plain(false), plain(false),
curAddress(debuginterface->getPC()),
align(debuginterface->getInstructionSize(0)),
rowHeight(13), rowHeight(13),
selection(0), selection(0),
oldSelection(0), oldSelection(0),
@ -73,31 +76,16 @@ CCodeView::CCodeView(DebugInterface* debuginterface, SymbolDB *symboldb, wxWindo
lx(-1), lx(-1),
ly(-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) int CCodeView::YToAddress(int y)
{ {
wxRect rc = GetClientRect(); wxRect rc = GetClientRect();
int ydiff = y - rc.height / 2 - rowHeight / 2; int ydiff = y - rc.height / 2 - rowHeight / 2;
ydiff = (int)(floorf((float)ydiff / (float)rowHeight)) + 1; ydiff = (int)(floorf((float)ydiff / (float)rowHeight)) + 1;
return(curAddress + ydiff * align); return curAddress + ydiff * align;
} }
void CCodeView::OnMouseDown(wxMouseEvent& event) void CCodeView::OnMouseDown(wxMouseEvent& event)
{ {
int x = event.m_x; int x = event.m_x;
@ -112,50 +100,39 @@ void CCodeView::OnMouseDown(wxMouseEvent& event)
selecting = true; selecting = true;
if (!oldselecting || (selection != oldSelection)) if (!oldselecting || (selection != oldSelection))
{ Refresh();
redraw();
}
} }
else else
{
ToggleBreakpoint(YToAddress(y)); ToggleBreakpoint(YToAddress(y));
}
event.Skip(true); event.Skip(true);
} }
void CCodeView::ToggleBreakpoint(u32 address) void CCodeView::ToggleBreakpoint(u32 address)
{ {
debugger->toggleBreakpoint(address); debugger->toggleBreakpoint(address);
redraw(); Refresh();
Host_UpdateBreakPointView(); Host_UpdateBreakPointView();
} }
void CCodeView::OnMouseMove(wxMouseEvent& event) void CCodeView::OnMouseMove(wxMouseEvent& event)
{ {
wxRect rc = GetClientRect(); 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;
{ Refresh();
curAddress -= align;
redraw();
}
else if (event.m_y > rc.height)
{
curAddress += align;
redraw();
}
else
{
OnMouseDown(event);
}
} }
else if (event.m_y > rc.height)
{
curAddress += align;
Refresh();
}
else
OnMouseDown(event);
} }
event.Skip(true); event.Skip(true);
@ -175,8 +152,7 @@ void CCodeView::OnMouseUpL(wxMouseEvent& event)
{ {
curAddress = YToAddress(event.m_y); curAddress = YToAddress(event.m_y);
selecting = false; selecting = false;
//ReleaseCapture(); Refresh();
redraw();
} }
RaiseEvent(); RaiseEvent();
event.Skip(true); event.Skip(true);
@ -223,7 +199,7 @@ void CCodeView::InsertBlrNop(int Blr)
else else
debugger->insertBLR(selection, 0x60000000); debugger->insertBLR(selection, 0x60000000);
} }
redraw(); Refresh();
} }
void CCodeView::OnPopupMenu(wxCommandEvent& event) void CCodeView::OnPopupMenu(wxCommandEvent& event)
@ -244,12 +220,12 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
break; break;
case IDM_COPYCODE: case IDM_COPYCODE:
{ {
char disasm[256]; char disasm[256];
debugger->disasm(selection, 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? wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(disasm)));
} }
break; break;
case IDM_COPYHEX: case IDM_COPYHEX:
{ {
@ -263,13 +239,15 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
case IDM_COPYFUNCTION: case IDM_COPYFUNCTION:
{ {
Symbol *symbol = symbol_db->GetSymbolFromAddr(selection); Symbol *symbol = symbol_db->GetSymbolFromAddr(selection);
if (symbol) { if (symbol)
{
std::string text; std::string text;
text = text + symbol->name + "\r\n"; text = text + symbol->name + "\r\n";
// we got a function // we got a function
u32 start = symbol->address; u32 start = symbol->address;
u32 end = start + symbol->size; u32 end = start + symbol->size;
for (u32 addr = start; addr != end; addr += 4) { for (u32 addr = start; addr != end; addr += 4)
{
char disasm[256]; char disasm[256];
debugger->disasm(addr, disasm, 256); debugger->disasm(addr, disasm, 256);
text = text + StringFromFormat("%08x: ", addr) + disasm + "\r\n"; text = text + StringFromFormat("%08x: ", addr) + disasm + "\r\n";
@ -283,17 +261,17 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
case IDM_RUNTOHERE: case IDM_RUNTOHERE:
debugger->setBreakpoint(selection); debugger->setBreakpoint(selection);
debugger->runToBreakpoint(); debugger->runToBreakpoint();
redraw(); Refresh();
break; break;
// Insert blr or restore old value // Insert blr or restore old value
case IDM_INSERTBLR: case IDM_INSERTBLR:
InsertBlrNop(0); InsertBlrNop(0);
redraw(); Refresh();
break; break;
case IDM_INSERTNOP: case IDM_INSERTNOP:
InsertBlrNop(1); InsertBlrNop(1);
redraw(); Refresh();
break; break;
case IDM_JITRESULTS: case IDM_JITRESULTS:
@ -310,21 +288,22 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
break; break;
case IDM_ADDFUNCTION: case IDM_ADDFUNCTION:
{
symbol_db->AddFunction(selection); symbol_db->AddFunction(selection);
Host_NotifyMapLoaded(); Host_NotifyMapLoaded();
}
break; break;
case IDM_RENAMESYMBOL: case IDM_RENAMESYMBOL:
{ {
Symbol *symbol = symbol_db->GetSymbolFromAddr(selection); Symbol *symbol = symbol_db->GetSymbolFromAddr(selection);
if (symbol) { if (symbol)
wxTextEntryDialog input_symbol(this, wxString::FromAscii("Rename symbol:"), wxGetTextFromUserPromptStr, {
wxString::FromAscii(symbol->name.c_str())); wxTextEntryDialog input_symbol(this, wxString::FromAscii("Rename symbol:"),
if (input_symbol.ShowModal() == wxID_OK) { wxGetTextFromUserPromptStr,
wxString::FromAscii(symbol->name.c_str()));
if (input_symbol.ShowModal() == wxID_OK)
{
symbol->name = input_symbol.GetValue().mb_str(); symbol->name = input_symbol.GetValue().mb_str();
redraw(); // Redraw to show the renamed symbol Refresh(); // Redraw to show the renamed symbol
} }
Host_NotifyMapLoaded(); Host_NotifyMapLoaded();
} }
@ -332,9 +311,6 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
break; break;
case IDM_PATCHALERT: case IDM_PATCHALERT:
{
}
break; break;
} }
@ -344,14 +320,14 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
event.Skip(true); event.Skip(true);
} }
void CCodeView::OnMouseUpR(wxMouseEvent& event) void CCodeView::OnMouseUpR(wxMouseEvent& event)
{ {
bool isSymbol = symbol_db->GetSymbolFromAddr(selection) != 0; bool isSymbol = symbol_db->GetSymbolFromAddr(selection) != 0;
// popup menu // popup menu
wxMenu* menu = new wxMenu; wxMenu* menu = new wxMenu;
//menu->Append(IDM_GOTOINMEMVIEW, "&Goto in mem view"); //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(); menu->AppendSeparator();
#if wxUSE_CLIPBOARD #if wxUSE_CLIPBOARD
menu->Append(IDM_COPYADDRESS, wxString::FromAscii("Copy &address")); menu->Append(IDM_COPYADDRESS, wxString::FromAscii("Copy &address"));
@ -372,11 +348,9 @@ void CCodeView::OnMouseUpR(wxMouseEvent& event)
event.Skip(true); event.Skip(true);
} }
void CCodeView::OnErase(wxEraseEvent& event) void CCodeView::OnErase(wxEraseEvent& event)
{} {}
void CCodeView::OnPaint(wxPaintEvent& event) void CCodeView::OnPaint(wxPaintEvent& event)
{ {
// -------------------------------------------------------------------- // --------------------------------------------------------------------
@ -397,10 +371,8 @@ void CCodeView::OnPaint(wxPaintEvent& event)
// TODO: Add any drawing code here... // TODO: Add any drawing code here...
int width = rc.width; int width = rc.width;
int numRows = (rc.height / rowHeight) / 2 + 2; int numRows = (rc.height / rowHeight) / 2 + 2;
//numRows=(numRows&(~1)) + 1;
// ------------ // ------------
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Colors and brushes // Colors and brushes
// ------------------------- // -------------------------
@ -425,7 +397,6 @@ void CCodeView::OnPaint(wxPaintEvent& event)
dc.DrawRectangle(0, 0, rc.width, 5); dc.DrawRectangle(0, 0, rc.width, 5);
// ------------ // ------------
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Walk through all visible rows // Walk through all visible rows
// ------------------------- // -------------------------
@ -455,7 +426,8 @@ void CCodeView::OnPaint(wxPaintEvent& event)
dc.DrawRectangle(16, rowY1, width, rowY2 - rowY1 + 1); dc.DrawRectangle(16, rowY1, width, rowY2 - rowY1 + 1);
dc.SetBrush(currentBrush); dc.SetBrush(currentBrush);
if (!plain) { if (!plain)
{
dc.SetTextForeground(_T("#600000")); // the address text is dark red dc.SetTextForeground(_T("#600000")); // the address text is dark red
dc.DrawText(temp, 17, rowY1); dc.DrawText(temp, 17, rowY1);
dc.SetTextForeground(_T("#000000")); dc.SetTextForeground(_T("#000000"));
@ -546,7 +518,6 @@ void CCodeView::OnPaint(wxPaintEvent& event)
} // end of for } // end of for
// ------------ // ------------
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Colors and brushes // Colors and brushes
// ------------------------- // -------------------------
@ -584,7 +555,6 @@ void CCodeView::OnPaint(wxPaintEvent& event)
// ------------ // ------------
} }
void CCodeView::_LineTo(wxPaintDC &dc, int x, int y) void CCodeView::_LineTo(wxPaintDC &dc, int x, int y)
{ {
dc.DrawLine(lx, ly, x, y); dc.DrawLine(lx, ly, x, y);
@ -592,3 +562,8 @@ void CCodeView::_LineTo(wxPaintDC &dc, int x, int y)
ly = y; ly = y;
} }
void CCodeView::OnResize(wxSizeEvent& event)
{
Refresh();
event.Skip();
}

View File

@ -35,8 +35,8 @@ class SymbolDB;
class CCodeView : public wxControl class CCodeView : public wxControl
{ {
public: public:
CCodeView(DebugInterface* debuginterface, SymbolDB *symbol_db, wxWindow* parent, wxWindowID Id = -1, const wxSize& Size = wxDefaultSize); CCodeView(DebugInterface* debuginterface, SymbolDB *symbol_db,
wxSize DoGetBestSize() const; wxWindow* parent, wxWindowID Id = wxID_ANY);
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
void OnErase(wxEraseEvent& event); void OnErase(wxEraseEvent& event);
void OnMouseDown(wxMouseEvent& event); void OnMouseDown(wxMouseEvent& event);
@ -60,10 +60,11 @@ public:
{ {
curAddress = addr; curAddress = addr;
selection = addr; selection = addr;
redraw(); Refresh();
} }
void SetPlain() { void SetPlain()
{
plain = true; plain = true;
} }
@ -72,8 +73,7 @@ private:
int YToAddress(int y); int YToAddress(int y);
u32 AddrToBranch(u32 addr); u32 AddrToBranch(u32 addr);
void OnResize(wxSizeEvent& event);
void redraw() {Refresh();}
DebugInterface* debugger; DebugInterface* debugger;
SymbolDB* symbol_db; SymbolDB* symbol_db;

View File

@ -411,9 +411,7 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
SetSizer(sizerBig); SetSizer(sizerBig);
sizerLeft->SetSizeHints(this);
sizerLeft->Fit(this); sizerLeft->Fit(this);
sizerBig->SetSizeHints(this);
sizerBig->Fit(this); sizerBig->Fit(this);
sync_event.Init(); sync_event.Init();

View File

@ -76,7 +76,6 @@ DSPDebuggerLLE::DSPDebuggerLLE(wxWindow* parent, wxWindowID id)
m_CodeView->SetPlain(); m_CodeView->SetPlain();
code_sizer->Add(m_CodeView, 1, wxALL | wxEXPAND); code_sizer->Add(m_CodeView, 1, wxALL | wxEXPAND);
code_panel->SetSizer(code_sizer); code_panel->SetSizer(code_sizer);
code_sizer->SetSizeHints(code_panel);
m_MainNotebook->AddPage(code_panel, wxT("Disasm"), true); m_MainNotebook->AddPage(code_panel, wxT("Disasm"), true);
wxPanel *mem_panel = new wxPanel(m_MainNotebook, wxID_ANY); 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); m_MemView = new CMemoryView(&debug_interface, mem_panel);
mem_sizer->Add(m_MemView, 1, wxALL | wxEXPAND); mem_sizer->Add(m_MemView, 1, wxALL | wxEXPAND);
mem_panel->SetSizer(mem_sizer); mem_panel->SetSizer(mem_sizer);
mem_sizer->SetSizeHints(mem_panel);
m_MainNotebook->AddPage(mem_panel, wxT("Mem")); m_MainNotebook->AddPage(mem_panel, wxT("Mem"));
m_Regs = new DSPRegisterView(this, ID_DSP_REGS); m_Regs = new DSPRegisterView(this, ID_DSP_REGS);

View File

@ -87,9 +87,7 @@ CJitWindow::CJitWindow(wxWindow* parent, wxWindowID id, const wxPoint& pos,
SetSizer(sizerBig); SetSizer(sizerBig);
sizerSplit->SetSizeHints(this);
sizerSplit->Fit(this); sizerSplit->Fit(this);
sizerBig->SetSizeHints(this);
sizerBig->Fit(this); sizerBig->Fit(this);
} }

View File

@ -25,7 +25,6 @@
#include <wx/event.h> #include <wx/event.h>
#include <wx/clipbrd.h> #include <wx/clipbrd.h>
enum enum
{ {
IDM_GOTOINMEMVIEW = 12000, IDM_GOTOINMEMVIEW = 12000,
@ -40,54 +39,38 @@ enum
IDM_VIEWASHEX, IDM_VIEWASHEX,
}; };
BEGIN_EVENT_TABLE(CMemoryView, wxControl) BEGIN_EVENT_TABLE(CMemoryView, wxControl)
EVT_ERASE_BACKGROUND(CMemoryView::OnErase) EVT_PAINT(CMemoryView::OnPaint)
EVT_PAINT(CMemoryView::OnPaint) EVT_LEFT_DOWN(CMemoryView::OnMouseDownL)
EVT_LEFT_DOWN(CMemoryView::OnMouseDownL) EVT_LEFT_UP(CMemoryView::OnMouseUpL)
EVT_LEFT_UP(CMemoryView::OnMouseUpL) EVT_MOTION(CMemoryView::OnMouseMove)
EVT_MOTION(CMemoryView::OnMouseMove) EVT_RIGHT_DOWN(CMemoryView::OnMouseDownR)
EVT_RIGHT_DOWN(CMemoryView::OnMouseDownR) EVT_MENU(-1, CMemoryView::OnPopupMenu)
EVT_MENU(-1, CMemoryView::OnPopupMenu) EVT_SIZE(CMemoryView::OnResize)
END_EVENT_TABLE() END_EVENT_TABLE()
CMemoryView::CMemoryView(DebugInterface* debuginterface, wxWindow* parent, wxWindowID Id, const wxSize& Size) CMemoryView::CMemoryView(DebugInterface* debuginterface, wxWindow* parent)
: wxControl(parent, Id, wxDefaultPosition, Size), : wxControl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize)
debugger(debuginterface), , curAddress(debuginterface->getPC())
rowHeight(13), , debugger(debuginterface)
selection(0), , align(debuginterface->getInstructionSize(0))
oldSelection(0), , rowHeight(13)
selectionChanged(false), , selection(0)
selecting(false), , oldSelection(0)
hasFocus(false), , selecting(false)
showHex(false), , memory(0)
memory(0), , viewAsType(VIEWAS_FP)
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) int CMemoryView::YToAddress(int y)
{ {
wxRect rc = GetClientRect(); wxRect rc = GetClientRect();
int ydiff = y - rc.height / 2 - rowHeight / 2; int ydiff = y - rc.height / 2 - rowHeight / 2;
ydiff = (int)(floorf((float)ydiff / (float)rowHeight)) + 1; ydiff = (int)(floorf((float)ydiff / (float)rowHeight)) + 1;
return(curAddress + ydiff * align); return curAddress + ydiff * align;
} }
void CMemoryView::OnMouseDownL(wxMouseEvent& event) void CMemoryView::OnMouseDownL(wxMouseEvent& event)
{ {
int x = event.m_x; int x = event.m_x;
@ -97,70 +80,58 @@ void CMemoryView::OnMouseDownL(wxMouseEvent& event)
{ {
oldSelection = selection; oldSelection = selection;
selection = YToAddress(y); selection = YToAddress(y);
// SetCapture(wnd);
bool oldselecting = selecting; bool oldselecting = selecting;
selecting = true; selecting = true;
if (!oldselecting || (selection != oldSelection)) if (!oldselecting || (selection != oldSelection))
{ Refresh();
redraw();
}
} }
else else
{ {
debugger->toggleMemCheck(YToAddress(y)); debugger->toggleMemCheck(YToAddress(y));
redraw(); Refresh();
Host_UpdateBreakPointView(); Host_UpdateBreakPointView();
} }
event.Skip(true); event.Skip(true);
} }
void CMemoryView::OnMouseMove(wxMouseEvent& event) void CMemoryView::OnMouseMove(wxMouseEvent& event)
{ {
wxRect rc = GetClientRect(); 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;
{ Refresh();
curAddress -= align;
redraw();
}
else if (event.m_y > rc.height)
{
curAddress += align;
redraw();
}
else
{
OnMouseDownL(event);
}
} }
else if (event.m_y > rc.height)
{
curAddress += align;
Refresh();
}
else
OnMouseDownL(event);
} }
event.Skip(true); event.Skip(true);
} }
void CMemoryView::OnMouseUpL(wxMouseEvent& event) void CMemoryView::OnMouseUpL(wxMouseEvent& event)
{ {
if (event.m_x > 16) if (event.m_x > 16)
{ {
curAddress = YToAddress(event.m_y); curAddress = YToAddress(event.m_y);
selecting = false; selecting = false;
//ReleaseCapture(); Refresh();
redraw();
} }
event.Skip(true); event.Skip(true);
} }
void CMemoryView::OnPopupMenu(wxCommandEvent& event) void CMemoryView::OnPopupMenu(wxCommandEvent& event)
{ {
#if wxUSE_CLIPBOARD #if wxUSE_CLIPBOARD
@ -171,9 +142,7 @@ void CMemoryView::OnPopupMenu(wxCommandEvent& event)
{ {
#if wxUSE_CLIPBOARD #if wxUSE_CLIPBOARD
case IDM_COPYADDRESS: case IDM_COPYADDRESS:
{ wxTheClipboard->SetData(new wxTextDataObject(wxString::Format(_T("%08x"), selection)));
wxTheClipboard->SetData(new wxTextDataObject(wxString::Format(_T("%08x"), selection)));
}
break; break;
case IDM_COPYHEX: case IDM_COPYHEX:
@ -187,21 +156,21 @@ void CMemoryView::OnPopupMenu(wxCommandEvent& event)
case IDM_TOGGLEMEMORY: case IDM_TOGGLEMEMORY:
memory ^= 1; memory ^= 1;
redraw(); Refresh();
break; break;
case IDM_VIEWASFP: case IDM_VIEWASFP:
viewAsType = VIEWAS_FP; viewAsType = VIEWAS_FP;
redraw(); Refresh();
break; break;
case IDM_VIEWASASCII: case IDM_VIEWASASCII:
viewAsType = VIEWAS_ASCII; viewAsType = VIEWAS_ASCII;
redraw(); Refresh();
break; break;
case IDM_VIEWASHEX: case IDM_VIEWASHEX:
viewAsType = VIEWAS_HEX; viewAsType = VIEWAS_HEX;
redraw(); Refresh();
break; break;
} }
@ -211,7 +180,6 @@ void CMemoryView::OnPopupMenu(wxCommandEvent& event)
event.Skip(true); event.Skip(true);
} }
void CMemoryView::OnMouseDownR(wxMouseEvent& event) void CMemoryView::OnMouseDownR(wxMouseEvent& event)
{ {
// popup menu // popup menu
@ -223,25 +191,15 @@ void CMemoryView::OnMouseDownR(wxMouseEvent& event)
#endif #endif
menu->Append(IDM_TOGGLEMEMORY, wxString::FromAscii("Toggle &memory")); menu->Append(IDM_TOGGLEMEMORY, wxString::FromAscii("Toggle &memory"));
wxMenu* viewAsSubMenu = new wxMenu; wxMenu* viewAsSubMenu = new wxMenu;
viewAsSubMenu->Append(IDM_VIEWASFP, wxString::FromAscii("FP value")); viewAsSubMenu->Append(IDM_VIEWASFP, wxString::FromAscii("FP value"));
viewAsSubMenu->Append(IDM_VIEWASASCII, wxString::FromAscii("ASCII")); viewAsSubMenu->Append(IDM_VIEWASASCII, wxString::FromAscii("ASCII"));
viewAsSubMenu->Append(IDM_VIEWASHEX, wxString::FromAscii("Hex")); viewAsSubMenu->Append(IDM_VIEWASHEX, wxString::FromAscii("Hex"));
menu->AppendSubMenu(viewAsSubMenu, wxString::FromAscii("View As:")); menu->AppendSubMenu(viewAsSubMenu, wxString::FromAscii("View As:"));
PopupMenu(menu); PopupMenu(menu);
//event.Skip(true);
} }
void CMemoryView::OnErase(wxEraseEvent& event)
{}
void CMemoryView::OnPaint(wxPaintEvent& event) void CMemoryView::OnPaint(wxPaintEvent& event)
{ {
wxPaintDC dc(this); wxPaintDC dc(this);
@ -254,10 +212,8 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
dc.SetFont(hFont); dc.SetFont(hFont);
} }
else else
{
dc.SetFont(DebuggerFont); dc.SetFont(DebuggerFont);
}
//wxFont tempFont(Lucida Console);
int fontSize = viewAsType == VIEWAS_HEX ? hFont.GetPointSize() : DebuggerFont.GetPointSize(); int fontSize = viewAsType == VIEWAS_HEX ? hFont.GetPointSize() : DebuggerFont.GetPointSize();
int textPlacement = 77; int textPlacement = 77;
struct branch struct branch
@ -268,7 +224,6 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
// TODO: Add any drawing code here... // TODO: Add any drawing code here...
int width = rc.width; int width = rc.width;
int numRows = (rc.height / rowHeight) / 2 + 2; int numRows = (rc.height / rowHeight) / 2 + 2;
//numRows=(numRows&(~1)) + 1;
dc.SetBackgroundMode(wxTRANSPARENT); dc.SetBackgroundMode(wxTRANSPARENT);
const wxChar* bgColor = _T("#ffffff"); const wxChar* bgColor = _T("#ffffff");
wxPen nullPen(bgColor); wxPen nullPen(bgColor);
@ -304,22 +259,14 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
dc.DrawRectangle(0, rowY1, 16, rowY2); dc.DrawRectangle(0, rowY1, 16, rowY2);
if (selecting && (address == selection)) if (selecting && (address == selection))
{
dc.SetPen(selPen); dc.SetPen(selPen);
}
else else
{
dc.SetPen(row == 0 ? currentPen : nullPen); dc.SetPen(row == 0 ? currentPen : nullPen);
}
if (address == debugger->getPC()) if (address == debugger->getPC())
{
dc.SetBrush(pcBrush); dc.SetBrush(pcBrush);
}
else else
{
dc.SetBrush(rowBrush); dc.SetBrush(rowBrush);
}
dc.DrawRectangle(16, rowY1, width, rowY2 - 1); dc.DrawRectangle(16, rowY1, width, rowY2 - 1);
dc.SetBrush(currentBrush); dc.SetBrush(currentBrush);
@ -403,28 +350,21 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
curAddress += 32; curAddress += 32;
} }
else else
{
sprintf(dis, "INVALID VIEWAS TYPE"); sprintf(dis, "INVALID VIEWAS TYPE");
}
char desc[256] = ""; char desc[256] = "";
if (viewAsType != VIEWAS_HEX) if (viewAsType != VIEWAS_HEX)
{
dc.DrawText(wxString::FromAscii(dis), textPlacement + fontSize*(8 + 8), rowY1); dc.DrawText(wxString::FromAscii(dis), textPlacement + fontSize*(8 + 8), rowY1);
} else { else
dc.DrawText(wxString::FromAscii(dis), textPlacement + 8+16, rowY1); dc.DrawText(wxString::FromAscii(dis), textPlacement + 8+16, rowY1);
}
if (desc[0] == 0) if (desc[0] == 0)
{
strcpy(desc, debugger->getDescription(address).c_str()); strcpy(desc, debugger->getDescription(address).c_str());
}
dc.SetTextForeground(_T("#0000FF")); dc.SetTextForeground(_T("#0000FF"));
if (strlen(desc)) if (strlen(desc))
{
dc.DrawText(wxString::FromAscii(desc), 17+fontSize*((8+8+8+30)*2), rowY1); dc.DrawText(wxString::FromAscii(desc), 17+fontSize*((8+8+8+30)*2), rowY1);
}
// Show blue memory check dot // Show blue memory check dot
if (debugger->isMemCheck(address)) if (debugger->isMemCheck(address))
@ -437,3 +377,9 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
dc.SetPen(currentPen); dc.SetPen(currentPen);
} }
void CMemoryView::OnResize(wxSizeEvent& event)
{
Refresh();
event.Skip();
}

View File

@ -25,10 +25,8 @@
class CMemoryView : public wxControl class CMemoryView : public wxControl
{ {
public: public:
CMemoryView(DebugInterface* debuginterface, wxWindow* parent, wxWindowID Id = -1, const wxSize& Size = wxDefaultSize); CMemoryView(DebugInterface* debuginterface, wxWindow* parent);
wxSize DoGetBestSize() const;
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
void OnErase(wxEraseEvent& event);
void OnMouseDownL(wxMouseEvent& event); void OnMouseDownL(wxMouseEvent& event);
void OnMouseMove(wxMouseEvent& event); void OnMouseMove(wxMouseEvent& event);
void OnMouseUpL(wxMouseEvent& event); void OnMouseUpL(wxMouseEvent& event);
@ -41,27 +39,23 @@ public:
void Center(u32 addr) void Center(u32 addr)
{ {
curAddress = addr; curAddress = addr;
redraw(); Refresh();
} }
int dataType; // u8,u16,u32 int dataType; // u8,u16,u32
int curAddress; // Will be accessed by parent int curAddress; // Will be accessed by parent
private: private:
int YToAddress(int y); int YToAddress(int y);
void redraw() {Refresh();} void OnResize(wxSizeEvent& event);
DebugInterface* debugger; DebugInterface* debugger;
int align; int align;
int rowHeight; int rowHeight;
u32 selection; u32 selection;
u32 oldSelection; u32 oldSelection;
bool selectionChanged;
bool selecting; bool selecting;
bool hasFocus;
bool showHex;
int memory; int memory;
@ -77,4 +71,4 @@ private:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
#endif /*MEMORYVIEW_H_*/ #endif // MEMORYVIEW_H_

View File

@ -83,7 +83,7 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id,
//symbols = new wxListBox(this, IDM_SYMBOLLIST, wxDefaultPosition, //symbols = new wxListBox(this, IDM_SYMBOLLIST, wxDefaultPosition,
// wxSize(20, 100), 0, NULL, wxLB_SORT); // wxSize(20, 100), 0, NULL, wxLB_SORT);
//sizerLeft->Add(symbols, 1, wxEXPAND); //sizerLeft->Add(symbols, 1, wxEXPAND);
memview = new CMemoryView(di, this, wxID_ANY); memview = new CMemoryView(di, this);
memview->dataType = 0; memview->dataType = 0;
//sizerBig->Add(sizerLeft, 1, wxEXPAND); //sizerBig->Add(sizerLeft, 1, wxEXPAND);
sizerBig->Add(memview, 20, wxEXPAND); sizerBig->Add(memview, 20, wxEXPAND);
@ -113,11 +113,8 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id,
chkHex->SetValue(1); //Set defaults chkHex->SetValue(1); //Set defaults
chk8->SetValue(1); chk8->SetValue(1);
//sizerLeft->SetSizeHints(this);
//sizerLeft->Fit(this); //sizerLeft->Fit(this);
sizerRight->SetSizeHints(this);
sizerRight->Fit(this); sizerRight->Fit(this);
sizerBig->SetSizeHints(this);
sizerBig->Fit(this); sizerBig->Fit(this);
} }

View File

@ -42,7 +42,6 @@ void CRegisterWindow::CreateGUIControls()
m_GPRGridView = new CRegisterView(this, ID_GPR); m_GPRGridView = new CRegisterView(this, ID_GPR);
sGrid->Add(m_GPRGridView, 1, wxGROW); sGrid->Add(m_GPRGridView, 1, wxGROW);
SetSizer(sGrid); SetSizer(sGrid);
sGrid->SetSizeHints(this);
NotifyUpdate(); NotifyUpdate();
} }
@ -50,7 +49,5 @@ void CRegisterWindow::CreateGUIControls()
void CRegisterWindow::NotifyUpdate() void CRegisterWindow::NotifyUpdate()
{ {
if (m_GPRGridView != NULL) if (m_GPRGridView != NULL)
{
m_GPRGridView->Update(); m_GPRGridView->Update();
}
} }

View File

@ -15,7 +15,7 @@ const wxString& ConnectedWiimotesString()
WiimoteConfigPage::WiimoteConfigPage(wxWindow* const parent, const int index) WiimoteConfigPage::WiimoteConfigPage(wxWindow* const parent, const int index)
: wxNotebookPage(parent, -1, wxDefaultPosition, wxDefaultSize) : 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 // input source
const wxString src_choices[] = { _("None"), 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. // This needs to be changed now in order for refresh to work right.
// Revert if the dialog is canceled. // 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() 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 // Disconnect first, otherwise the new source doesn't seem to work
CFrame::ConnectWiimote(m_index, false); CFrame::ConnectWiimote(m_index, false);

View File

@ -28,7 +28,7 @@ public:
private: private:
const int m_index; const int m_index;
unsigned int orig_source, end_source; unsigned int orig_source;
}; };
class WiimoteConfigDiag : public wxDialog class WiimoteConfigDiag : public wxDialog