summaryrefslogtreecommitdiff
path: root/Source/Core/DebuggerWX/Src/RegisterView.cpp
diff options
context:
space:
mode:
authornakeee <nakeee@gmail.com>2008-09-22 06:50:27 +0000
committernakeee <nakeee@gmail.com>2008-09-22 06:50:27 +0000
commit3a130d4263573042d184c51eeb7e08e62e83cf72 (patch)
tree223798702dfc658d99f9388d1120cee5453e34cf /Source/Core/DebuggerWX/Src/RegisterView.cpp
parent1ecfba66927c862ae504c31fcc52d0bccef1f0ee (diff)
change src to Src
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@604 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/DebuggerWX/Src/RegisterView.cpp')
-rw-r--r--Source/Core/DebuggerWX/Src/RegisterView.cpp140
1 files changed, 140 insertions, 0 deletions
diff --git a/Source/Core/DebuggerWX/Src/RegisterView.cpp b/Source/Core/DebuggerWX/Src/RegisterView.cpp
new file mode 100644
index 0000000000..9c2996bf81
--- /dev/null
+++ b/Source/Core/DebuggerWX/Src/RegisterView.cpp
@@ -0,0 +1,140 @@
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#include "Debugger.h"
+#include "RegisterView.h"
+#include "PowerPC/PowerPC.h"
+
+extern const char* GetGRPName(unsigned int index);
+
+
+BEGIN_EVENT_TABLE(CRegisterView, wxListCtrl)
+
+END_EVENT_TABLE()
+
+CRegisterView::CRegisterView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
+ : wxListCtrl(parent, id, pos, size, style)
+{
+ InsertColumn(1, wxT("Reg 16-31"), wxLIST_FORMAT_LEFT, 100);
+ InsertColumn(0, wxT("Value"), wxLIST_FORMAT_CENTER, 80);
+ InsertColumn(0, wxT("Reg 0-15"), wxLIST_FORMAT_LEFT, 100);
+ InsertColumn(0, wxT("Value"), wxLIST_FORMAT_CENTER, 80);
+
+ SetFont(wxFont(9, wxSWISS, wxNORMAL, wxNORMAL, false, wxT("Segoe UI")));
+
+ for (int i = 0; i < 16; i++)
+ {
+ // 0-15
+ int Item = InsertItem(0, wxString::FromAscii(GetGRPName(i)));
+
+ // 16-31
+ SetItem(Item, 2, wxString::FromAscii(GetGRPName(16 + i)));
+
+ // just for easy sort
+
+ wxListItem item;
+ item.SetId(Item);
+ item.SetBackgroundColour(0xFFFFFF);
+ item.SetData(i);
+ SetItem(item);
+ }
+
+ Refresh();
+}
+
+
+void
+CRegisterView::Update()
+{
+ for (size_t i = 0; i < 16; i++)
+ {
+ // 0-15
+ if (m_CachedRegs[i] != GPR(i))
+ {
+ m_CachedRegHasChanged[i] = true;
+ }
+ else
+ {
+ m_CachedRegHasChanged[i] = false;
+ }
+
+ m_CachedRegs[i] = GPR(i);
+
+ // 16-31
+ if (m_CachedRegs[16 + i] != GPR(16 + i))
+ {
+ m_CachedRegHasChanged[16 + i] = true;
+ }
+ else
+ {
+ m_CachedRegHasChanged[16 + i] = false;
+ }
+
+ m_CachedRegs[16 + i] = GPR(16 + i);
+ }
+
+ Refresh();
+}
+
+
+bool
+CRegisterView::MSWDrawSubItem(wxPaintDC& rPainDC, int item, int subitem)
+{
+ bool Result = false;
+
+#ifdef __WXMSW__
+ switch (subitem)
+ {
+ case 1:
+ case 3:
+ {
+ int Register = (subitem == 1) ? item : item + 16;
+
+ const wxChar* bgColor = _T("#ffffff");
+ wxBrush bgBrush(bgColor);
+ wxPen bgPen(bgColor);
+
+ wxRect SubItemRect;
+ this->GetSubItemRect(item, subitem, SubItemRect);
+ rPainDC.SetBrush(bgBrush);
+ rPainDC.SetPen(bgPen);
+ rPainDC.DrawRectangle(SubItemRect);
+
+ if (m_CachedRegHasChanged[Register])
+ {
+ rPainDC.SetTextForeground(_T("#FF0000"));
+ }
+ else
+ {
+ rPainDC.SetTextForeground(_T("#000000"));
+ }
+
+ wxString text;
+ text.Printf(wxT("0x%08x"), m_CachedRegs[Register]);
+ rPainDC.DrawText(text, SubItemRect.GetLeft() + 10, SubItemRect.GetTop() + 4);
+ return(true);
+ }
+ break;
+ }
+
+ //
+#endif
+
+ return(Result);
+}
+
+