mirror of https://github.com/PCSX2/pcsx2.git
debugger:linux: Fix wx2.8 compilation
Bind doesn't work on wx2.8. Replace with event tables and Connect. wxString::Format also requires the format string to be L"something". const char* requires an explicit conversion to wxString. The show 128/64/32 bit menu column stuff doesn't have a direct wx2.8 replacement so just omit it - I'm not sure it's useful functionality anyway.
This commit is contained in:
parent
ccb261a8a3
commit
aff1467ea3
|
@ -19,6 +19,16 @@
|
||||||
#include "DebugEvents.h"
|
#include "DebugEvents.h"
|
||||||
#include "AppConfig.h"
|
#include "AppConfig.h"
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(CtrlRegisterList, wxWindow)
|
||||||
|
EVT_PAINT(CtrlRegisterList::paintEvent)
|
||||||
|
EVT_GRID_LABEL_LEFT_CLICK(CtrlRegisterList::gridEvent)
|
||||||
|
EVT_GRID_LABEL_RIGHT_CLICK(CtrlRegisterList::gridEvent)
|
||||||
|
EVT_GRID_CELL_LEFT_CLICK(CtrlRegisterList::gridEvent)
|
||||||
|
EVT_GRID_CELL_RIGHT_CLICK(CtrlRegisterList::gridEvent)
|
||||||
|
EVT_KEY_DOWN(CtrlRegisterList::keydownEvent)
|
||||||
|
EVT_BOOKCTRL_PAGE_CHANGED(-1, CtrlRegisterList::categoryChangedEvent)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
enum DisassemblyMenuIdentifiers
|
enum DisassemblyMenuIdentifiers
|
||||||
{
|
{
|
||||||
ID_REGISTERLIST_DISPLAY32 = 1,
|
ID_REGISTERLIST_DISPLAY32 = 1,
|
||||||
|
@ -45,12 +55,20 @@ CtrlRegisterList::CtrlRegisterList(wxWindow* parent, DebugInterface* _cpu) :
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
wxFont font = wxFont(wxSize(charWidth, rowHeight), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
|
wxFont font = wxFont(wxSize(charWidth, rowHeight), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
|
||||||
false, L"Lucida Console");
|
false, L"Lucida Console");
|
||||||
|
wxFont labelFont = font.Bold();
|
||||||
#else
|
#else
|
||||||
wxFont font = wxFont(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, L"Lucida Console");
|
wxFont font = wxFont(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, L"Lucida Console");
|
||||||
font.SetPixelSize(wxSize(charWidth, rowHeight));
|
font.SetPixelSize(wxSize(charWidth, rowHeight));
|
||||||
|
wxFont labelFont = font;
|
||||||
|
labelFont.SetWeight(wxFONTWEIGHT_BOLD);
|
||||||
|
#endif
|
||||||
|
registerCategories = new wxNotebook(this, wxID_ANY);
|
||||||
|
// 'c' and 'C', much time wasted.
|
||||||
|
#if wxMAJOR_VERSION >= 3
|
||||||
|
registerCategories->Connect(wxEVT_BOOKCTRL_PAGE_CHANGED, wxBookCtrlEventHandler(CtrlRegisterList::categoryChangedEvent), nullptr, this);
|
||||||
|
#else
|
||||||
|
registerCategories->Connect(wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED, wxBookctrlEventHandler(CtrlRegisterList::categoryChangedEvent), nullptr, this);
|
||||||
#endif
|
#endif
|
||||||
registerCategories = new wxNotebook(this, -1);
|
|
||||||
registerCategories->Bind(wxEVT_BOOKCTRL_PAGE_CHANGED, &CtrlRegisterList::categoryChangedEvent, this);
|
|
||||||
for (int cat = 0; cat < cpu->getRegisterCategoryCount(); cat++)
|
for (int cat = 0; cat < cpu->getRegisterCategoryCount(); cat++)
|
||||||
{
|
{
|
||||||
int numRegs = cpu->getRegisterCount(cat);
|
int numRegs = cpu->getRegisterCount(cat);
|
||||||
|
@ -60,7 +78,7 @@ CtrlRegisterList::CtrlRegisterList(wxWindow* parent, DebugInterface* _cpu) :
|
||||||
wxGrid* regGrid = new wxGrid(registerCategories, -1);
|
wxGrid* regGrid = new wxGrid(registerCategories, -1);
|
||||||
|
|
||||||
registerGrids.push_back(regGrid);
|
registerGrids.push_back(regGrid);
|
||||||
registerCategories->AddPage(regGrid, cpu->getRegisterCategoryName(cat));
|
registerCategories->AddPage(regGrid, wxString(cpu->getRegisterCategoryName(cat), wxConvUTF8));
|
||||||
|
|
||||||
DebugInterface::RegisterType type = cpu->getRegisterType(cat);
|
DebugInterface::RegisterType type = cpu->getRegisterType(cat);
|
||||||
int registerBits = cpu->getRegisterSize(cat);
|
int registerBits = cpu->getRegisterSize(cat);
|
||||||
|
@ -72,29 +90,29 @@ CtrlRegisterList::CtrlRegisterList(wxWindow* parent, DebugInterface* _cpu) :
|
||||||
numCols = registerBits / 32;
|
numCols = registerBits / 32;
|
||||||
regGrid->CreateGrid(numRegs, numCols);
|
regGrid->CreateGrid(numRegs, numCols);
|
||||||
for (int row = 0; row < numRegs; row++)
|
for (int row = 0; row < numRegs; row++)
|
||||||
regGrid->SetRowLabelValue(row, cpu->getRegisterName(cat, row));
|
regGrid->SetRowLabelValue(row, wxString(cpu->getRegisterName(cat, row), wxConvUTF8));
|
||||||
for (int col = 0; col < numCols; col++)
|
for (int col = 0; col < numCols; col++)
|
||||||
regGrid->SetColLabelValue(col, wxsFormat("%d-%d", 32 * (numCols - col) - 1, 32 * (numCols - col - 1)));
|
regGrid->SetColLabelValue(col, wxsFormat(L"%d-%d", 32 * (numCols - col) - 1, 32 * (numCols - col - 1)));
|
||||||
break;
|
break;
|
||||||
case DebugInterface::SPECIAL:
|
case DebugInterface::SPECIAL:
|
||||||
regGrid->CreateGrid(numRegs, 1);
|
regGrid->CreateGrid(numRegs, 1);
|
||||||
for (int row = 0; row < numRegs; row++)
|
for (int row = 0; row < numRegs; row++)
|
||||||
regGrid->SetRowLabelValue(row, cpu->getRegisterName(cat, row));
|
regGrid->SetRowLabelValue(row, wxString(cpu->getRegisterName(cat, row), wxConvUTF8));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
regGrid->EnableEditing(false);
|
regGrid->EnableEditing(false);
|
||||||
regGrid->SetDefaultCellFont(font);
|
regGrid->SetDefaultCellFont(font);
|
||||||
regGrid->SetLabelFont(font.Bold());
|
regGrid->SetLabelFont(labelFont);
|
||||||
regGrid->DisableDragGridSize();
|
regGrid->DisableDragGridSize();
|
||||||
regGrid->DisableDragRowSize();
|
regGrid->DisableDragRowSize();
|
||||||
regGrid->DisableDragColSize();
|
regGrid->DisableDragColSize();
|
||||||
regGrid->Bind(wxEVT_PAINT, &CtrlRegisterList::paintEvent, this);
|
regGrid->Connect(wxEVT_PAINT, wxPaintEventHandler(CtrlRegisterList::paintEvent), nullptr, this);
|
||||||
regGrid->Bind(wxEVT_GRID_LABEL_LEFT_CLICK, &CtrlRegisterList::gridEvent, this);
|
regGrid->Connect(wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler(CtrlRegisterList::gridEvent), nullptr, this);
|
||||||
regGrid->Bind(wxEVT_GRID_LABEL_RIGHT_CLICK, &CtrlRegisterList::gridEvent, this);
|
regGrid->Connect(wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEventHandler(CtrlRegisterList::gridEvent), nullptr, this);
|
||||||
regGrid->Bind(wxEVT_GRID_CELL_RIGHT_CLICK, &CtrlRegisterList::gridEvent, this);
|
regGrid->Connect(wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler(CtrlRegisterList::gridEvent), nullptr, this);
|
||||||
regGrid->Bind(wxEVT_GRID_CELL_LEFT_CLICK, &CtrlRegisterList::gridEvent, this);
|
regGrid->Connect(wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler(CtrlRegisterList::gridEvent), nullptr, this);
|
||||||
regGrid->Bind(wxEVT_KEY_DOWN, &CtrlRegisterList::keydownEvent, this);
|
regGrid->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(CtrlRegisterList::keydownEvent), nullptr, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int cat = 0; cat < cpu->getRegisterCategoryCount(); cat++)
|
for (int cat = 0; cat < cpu->getRegisterCategoryCount(); cat++)
|
||||||
|
@ -134,7 +152,7 @@ void CtrlRegisterList::updateValues(int cat)
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case DebugInterface::NORMAL:
|
case DebugInterface::NORMAL:
|
||||||
cellValue = wxsFormat("%08X", value._u32[numCols - col - 1]);
|
cellValue = wxsFormat(L"%08X", value._u32[numCols - col - 1]);
|
||||||
textColor = changed.changed[numCols - col - 1] ? colorChanged : colorUnchanged;
|
textColor = changed.changed[numCols - col - 1] ? colorChanged : colorUnchanged;
|
||||||
break;
|
break;
|
||||||
case DebugInterface::SPECIAL:
|
case DebugInterface::SPECIAL:
|
||||||
|
@ -161,6 +179,7 @@ void CtrlRegisterList::updateSize(int cat)
|
||||||
int regBits = cpu->getRegisterSize(cat);
|
int regBits = cpu->getRegisterSize(cat);
|
||||||
int numCols = regGrid->GetNumberCols();
|
int numCols = regGrid->GetNumberCols();
|
||||||
|
|
||||||
|
#if wxMAJOR_VERSION >= 3
|
||||||
int shownCols = 0;
|
int shownCols = 0;
|
||||||
while (shownCols < numCols && regGrid->IsColShown(shownCols)) shownCols++;
|
while (shownCols < numCols && regGrid->IsColShown(shownCols)) shownCols++;
|
||||||
if (shownCols > maxBits / 32)
|
if (shownCols > maxBits / 32)
|
||||||
|
@ -173,6 +192,7 @@ void CtrlRegisterList::updateSize(int cat)
|
||||||
regGrid->ShowCol(numCols - col - 1); // Big-endian representation so flip order
|
regGrid->ShowCol(numCols - col - 1); // Big-endian representation so flip order
|
||||||
else
|
else
|
||||||
regGrid->HideCol(numCols - col - 1); // Big-endian representation so flip order
|
regGrid->HideCol(numCols - col - 1); // Big-endian representation so flip order
|
||||||
|
#endif
|
||||||
|
|
||||||
regGrid->AutoSize();
|
regGrid->AutoSize();
|
||||||
wxSize pageSize = regGrid->GetSize();
|
wxSize pageSize = regGrid->GetSize();
|
||||||
|
@ -307,13 +327,13 @@ void CtrlRegisterList::changeValue(RegisterChangeMode mode, int cat, int reg)
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case LOWER64:
|
case LOWER64:
|
||||||
oldStr = wxsFormat("0x%016llX", oldValue._u64[0]);
|
oldStr = wxsFormat(L"0x%016llX", oldValue._u64[0]);
|
||||||
break;
|
break;
|
||||||
case UPPER64:
|
case UPPER64:
|
||||||
oldStr = wxsFormat("0x%016llX", oldValue._u64[1]);
|
oldStr = wxsFormat(L"0x%016llX", oldValue._u64[1]);
|
||||||
break;
|
break;
|
||||||
case CHANGE32:
|
case CHANGE32:
|
||||||
oldStr = wxsFormat("0x%08X", oldValue._u64[0]);
|
oldStr = wxsFormat(L"0x%08X", oldValue._u64[0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,11 +447,14 @@ void CtrlRegisterList::gridEvent(wxGridEvent& evt)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.Bind(wxEVT_COMMAND_MENU_SELECTED, &CtrlRegisterList::onPopupClick, this);
|
menu.Connect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(CtrlRegisterList::onPopupClick), nullptr, this);
|
||||||
PopupMenu(&menu, evt.GetPosition());
|
PopupMenu(&menu, evt.GetPosition());
|
||||||
}
|
|
||||||
needsValueUpdating = true;
|
needsValueUpdating = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
evt.Skip();
|
evt.Skip();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CtrlRegisterList::categoryChangedEvent(wxBookCtrlEvent& evt)
|
void CtrlRegisterList::categoryChangedEvent(wxBookCtrlEvent& evt)
|
||||||
|
@ -441,7 +464,7 @@ void CtrlRegisterList::categoryChangedEvent(wxBookCtrlEvent& evt)
|
||||||
evt.Skip();
|
evt.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CtrlRegisterList::keydownEvent(wxEvent& evt)
|
void CtrlRegisterList::keydownEvent(wxKeyEvent& evt)
|
||||||
{
|
{
|
||||||
needsValueUpdating = true;
|
needsValueUpdating = true;
|
||||||
evt.Skip();
|
evt.Skip();
|
||||||
|
|
|
@ -30,7 +30,8 @@ public:
|
||||||
void onPopupClick(wxCommandEvent& evt);
|
void onPopupClick(wxCommandEvent& evt);
|
||||||
void gridEvent(wxGridEvent& evt);
|
void gridEvent(wxGridEvent& evt);
|
||||||
void categoryChangedEvent(wxBookCtrlEvent& evt);
|
void categoryChangedEvent(wxBookCtrlEvent& evt);
|
||||||
void keydownEvent(wxEvent& evt);
|
void keydownEvent(wxKeyEvent& evt);
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
private:
|
private:
|
||||||
enum RegisterChangeMode { LOWER64, UPPER64, CHANGE32 };
|
enum RegisterChangeMode { LOWER64, UPPER64, CHANGE32 };
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue