convert PBView's MSWDrawSubItem to a multiplatform and wxw 2.8.10 friendly InsertItemInReportView
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2710 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
323676a66b
commit
783164d372
|
@ -15,7 +15,6 @@
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
|
|
||||||
#include "PBView.h"
|
#include "PBView.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -24,19 +23,9 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------
|
|
||||||
// external declarations
|
// external declarations
|
||||||
extern const char* GetGRPName(unsigned int index);
|
extern const char* GetGRPName(unsigned int index);
|
||||||
|
|
||||||
// No buttons or events so far
|
|
||||||
BEGIN_EVENT_TABLE(CPBView, wxListCtrl)
|
|
||||||
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
// ---------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPBView::CPBView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
CPBView::CPBView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||||
: wxListCtrl(parent, id, pos, size, style)
|
: wxListCtrl(parent, id, pos, size, style)
|
||||||
|
@ -71,95 +60,46 @@ CPBView::CPBView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, cons
|
||||||
InsertColumn(0, wxT("run"), wxLIST_FORMAT_RIGHT, 50);
|
InsertColumn(0, wxT("run"), wxLIST_FORMAT_RIGHT, 50);
|
||||||
InsertColumn(0, wxT("Block"), wxLIST_FORMAT_CENTER, 40);
|
InsertColumn(0, wxT("Block"), wxLIST_FORMAT_CENTER, 40);
|
||||||
|
|
||||||
SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, wxT("Segoe UI")));
|
SetFont(wxFont(9, wxMODERN, wxNORMAL, wxNORMAL, false, wxT("monospace")));
|
||||||
|
|
||||||
for (int i = 0; i < 64; i++)
|
for (int i = 0; i < 64; i++)
|
||||||
{
|
{
|
||||||
|
InsertItemInReportView(i);
|
||||||
// Print values from 0 to 63
|
|
||||||
char buffer [33];
|
|
||||||
sprintf(buffer, "%02i", i);
|
|
||||||
int Item = InsertItem(0, wxString::FromAscii(buffer));
|
|
||||||
|
|
||||||
|
|
||||||
wxListItem item;
|
|
||||||
item.SetId(Item);
|
|
||||||
item.SetBackgroundColour(0xFFFFFF);
|
|
||||||
item.SetData(i);
|
|
||||||
SetItem(item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is a wx call that leads to MSWDrawSubItem
|
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPBView::Update()
|
||||||
void
|
|
||||||
CPBView::Update()
|
|
||||||
{
|
{
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO wtf does this do? why is it windows only???
|
void CPBView::InsertItemInReportView(int _Row)
|
||||||
bool CPBView::MSWDrawSubItem(wxPaintDC& rPainDC, int item, int subitem)
|
|
||||||
{
|
{
|
||||||
bool Result = false;
|
long tmp = InsertItem(_Row, wxString::Format(wxT("%02i"), _Row), 0);
|
||||||
|
SetItemData(tmp, _Row);
|
||||||
|
|
||||||
// don't change 0, it has the block values
|
wxString text;
|
||||||
if(subitem > 0)
|
|
||||||
|
// A somewhat primitive attempt to show the playing history for a certain block.
|
||||||
|
char cbuff [33];
|
||||||
|
|
||||||
|
sprintf(cbuff, "%08i", m_CachedRegs[_Row][0]); //TODO?
|
||||||
|
std::string c = cbuff;
|
||||||
|
int n[8];
|
||||||
|
|
||||||
|
for (int j = 0; j < 8; j++)
|
||||||
{
|
{
|
||||||
#ifdef __WXMSW__ // what's this? should I use that?
|
n[j] = atoi( c.substr(j, 1).c_str() );
|
||||||
const wxChar* bgColor = _T("#ffffff");
|
// 149 = dot, 160 = space
|
||||||
wxBrush bgBrush(bgColor);
|
if (n[j] == 1)
|
||||||
wxPen bgPen(bgColor);
|
n[j] = 149;
|
||||||
|
|
||||||
wxRect SubItemRect;
|
|
||||||
this->GetSubItemRect(item, subitem, SubItemRect);
|
|
||||||
rPainDC.SetBrush(bgBrush);
|
|
||||||
rPainDC.SetPen(bgPen);
|
|
||||||
rPainDC.DrawRectangle(SubItemRect);
|
|
||||||
#endif
|
|
||||||
// A somewhat primitive attempt to show the playing history for a certain block.
|
|
||||||
|
|
||||||
wxString text;
|
|
||||||
if(subitem == 1)
|
|
||||||
{
|
|
||||||
char cbuff [33];
|
|
||||||
|
|
||||||
sprintf(cbuff, "%08i", m_CachedRegs[subitem][item]);
|
|
||||||
std::string c = cbuff;
|
|
||||||
int n[8];
|
|
||||||
|
|
||||||
for (int j = 0; j < 8; j++)
|
|
||||||
{
|
|
||||||
|
|
||||||
n[j] = atoi( c.substr(j, 1).c_str());
|
|
||||||
// 149 = dot, 160 = space
|
|
||||||
if (n[j] == 1){
|
|
||||||
n[j] = 149;} else {n[j] = 160;}
|
|
||||||
}
|
|
||||||
// pretty neat huh?
|
|
||||||
text.Printf(wxT("%c%c%c%c%c%c%c%c"), n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]);
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
n[j] = 160;
|
||||||
text.Printf(wxT("0x%08x"), m_CachedRegs[subitem][item]);
|
}
|
||||||
}
|
// pretty neat huh?
|
||||||
#ifdef __WXMSW__
|
SetItem(tmp, 1, wxString::Format(wxT("%c%c%c%c%c%c%c%c"), n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]));
|
||||||
rPainDC.DrawText(text, SubItemRect.GetLeft() + 10, SubItemRect.GetTop() + 4);
|
|
||||||
#else
|
|
||||||
// May not show up pretty in !Win32
|
|
||||||
rPainDC.DrawText(text, 10, 4);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return(true);
|
for (int column = 2; column < GetColumnCount(); column++)
|
||||||
}
|
SetItem(tmp, column, wxString::Format(wxT("0x%08x"), m_CachedRegs[_Row][column]));
|
||||||
else
|
|
||||||
{
|
|
||||||
// what does this mean?
|
|
||||||
return(Result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,25 +23,23 @@
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
class CPBView
|
class CPBView : public wxListCtrl
|
||||||
: public wxListCtrl
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
CPBView(wxWindow* parent,
|
||||||
|
const wxWindowID id,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
long style);
|
||||||
|
|
||||||
CPBView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
|
void Update();
|
||||||
|
|
||||||
void Update();
|
u32 m_CachedRegs[64][92];
|
||||||
|
|
||||||
u32 m_CachedRegs[64][92];
|
private:
|
||||||
|
bool m_CachedRegHasChanged[64];
|
||||||
|
|
||||||
private:
|
void InsertItemInReportView(int _Index);
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
|
|
||||||
bool m_CachedRegHasChanged[64];
|
|
||||||
|
|
||||||
virtual bool MSWDrawSubItem(wxPaintDC& rPainDC, int item, int subitem);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue