mirror of https://github.com/stella-emu/stella.git
The debugger CPU area is now font-sensitive.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2799 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
29167a2e87
commit
7b79b0a971
|
@ -32,7 +32,7 @@
|
||||||
#include "CpuWidget.hxx"
|
#include "CpuWidget.hxx"
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
|
CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int max_w)
|
||||||
: Widget(boss, font, x, y, 16, 16),
|
: Widget(boss, font, x, y, 16, 16),
|
||||||
CommandSender(boss)
|
CommandSender(boss)
|
||||||
{
|
{
|
||||||
|
@ -53,8 +53,8 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
|
||||||
|
|
||||||
// Create a read-only textbox containing the current PC label
|
// Create a read-only textbox containing the current PC label
|
||||||
xpos += lwidth + myPCGrid->getWidth() + 10;
|
xpos += lwidth + myPCGrid->getWidth() + 10;
|
||||||
myPCLabel = new EditTextWidget(boss, font, xpos, ypos-1, fontWidth*25,
|
myPCLabel = new EditTextWidget(boss, font, xpos, ypos, (max_w - xpos + x) - 10,
|
||||||
lineHeight, "");
|
fontHeight+1, "");
|
||||||
myPCLabel->setEditable(false);
|
myPCLabel->setEditable(false);
|
||||||
|
|
||||||
// Create a 1x4 grid with labels for the other CPU registers
|
// Create a 1x4 grid with labels for the other CPU registers
|
||||||
|
@ -75,15 +75,23 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
|
||||||
new DataGridWidget(boss, font, xpos, ypos, 1, 4, 8, 8, Common::Base::F_2);
|
new DataGridWidget(boss, font, xpos, ypos, 1, 4, 8, 8, Common::Base::F_2);
|
||||||
myCpuGridBinValue->setEditable(false);
|
myCpuGridBinValue->setEditable(false);
|
||||||
|
|
||||||
// Create a label and 1x3 grid showing the source of data for A/X/Y registers
|
// Calculate real dimensions (_y will be calculated at the end)
|
||||||
|
_w = lwidth + myPCGrid->getWidth() + myPCLabel->getWidth() + 20;
|
||||||
|
|
||||||
|
// Create labels showing the source of data for SP/A/X/Y registers
|
||||||
xpos += myCpuGridBinValue->getWidth() + 20;
|
xpos += myCpuGridBinValue->getWidth() + 20;
|
||||||
myCpuDataSrcGrid =
|
int src_y = ypos, src_w = (max_w - xpos + x) - 10;
|
||||||
new DataGridWidget(boss, font, xpos, ypos, 1, 4, 4, 16, Common::Base::F_16);
|
for(int i = 0; i < 4; ++i)
|
||||||
myCpuDataSrcGrid->setEditable(false);
|
{
|
||||||
new StaticTextWidget(boss, font, xpos-font.getMaxCharWidth(),
|
myCpuDataSrc[i] = new EditTextWidget(boss, font, xpos, src_y, src_w,
|
||||||
ypos+myCpuDataSrcGrid->getHeight() + 4,
|
fontHeight+1, "");
|
||||||
font.getStringWidth("Src Addr"), fontHeight, "Src Addr",
|
myCpuDataSrc[i]->setEditable(false);
|
||||||
kTextAlignLeft);
|
src_y += fontHeight+2;
|
||||||
|
}
|
||||||
|
int swidth = font.getStringWidth("Source Address");
|
||||||
|
new StaticTextWidget(boss, font, xpos, src_y + 4, src_w,
|
||||||
|
fontHeight, swidth <= src_w ? "Source Address" : "Source Addr",
|
||||||
|
kTextAlignCenter);
|
||||||
|
|
||||||
// Add labels for other CPU registers
|
// Add labels for other CPU registers
|
||||||
xpos = x;
|
xpos = x;
|
||||||
|
@ -115,8 +123,6 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
|
||||||
}
|
}
|
||||||
myPSRegister->setList(off, on);
|
myPSRegister->setList(off, on);
|
||||||
|
|
||||||
// Calculate real dimensions
|
|
||||||
_w = lwidth + myPCGrid->getWidth() + myPCLabel->getWidth() + 20;
|
|
||||||
_h = ypos + myPSRegister->getHeight() - y;
|
_h = ypos + myPSRegister->getHeight() - y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,22 +281,16 @@ void CpuWidget::loadConfig()
|
||||||
myCpuGridDecValue->setList(alist, vlist, changed);
|
myCpuGridDecValue->setList(alist, vlist, changed);
|
||||||
myCpuGridBinValue->setList(alist, vlist, changed);
|
myCpuGridBinValue->setList(alist, vlist, changed);
|
||||||
|
|
||||||
// Update the data sources for the A/X/Y registers
|
// Update the data sources for the SP/A/X/Y registers
|
||||||
alist.clear(); vlist.clear(); changed.clear();
|
// TODO - change this to use actual labels
|
||||||
alist.push_back(0);
|
myCpuDataSrc[0]->setText(Common::Base::toString(state.srcS),
|
||||||
alist.push_back(0);
|
state.srcS != oldstate.srcS);
|
||||||
alist.push_back(0);
|
myCpuDataSrc[1]->setText(Common::Base::toString(state.srcA),
|
||||||
|
state.srcA != oldstate.srcA);
|
||||||
vlist.push_back(state.srcS);
|
myCpuDataSrc[2]->setText(Common::Base::toString(state.srcX),
|
||||||
vlist.push_back(state.srcA);
|
state.srcX != oldstate.srcX);
|
||||||
vlist.push_back(state.srcX);
|
myCpuDataSrc[3]->setText(Common::Base::toString(state.srcY),
|
||||||
vlist.push_back(state.srcY);
|
state.srcY != oldstate.srcY);
|
||||||
|
|
||||||
changed.push_back(state.srcS != oldstate.srcS);
|
|
||||||
changed.push_back(state.srcA != oldstate.srcA);
|
|
||||||
changed.push_back(state.srcX != oldstate.srcX);
|
|
||||||
changed.push_back(state.srcY != oldstate.srcY);
|
|
||||||
myCpuDataSrcGrid->setList(alist, vlist, changed);
|
|
||||||
|
|
||||||
// Update the PS register booleans
|
// Update the PS register booleans
|
||||||
changed.clear();
|
changed.clear();
|
||||||
|
|
|
@ -33,7 +33,7 @@ class ToggleBitWidget;
|
||||||
class CpuWidget : public Widget, public CommandSender
|
class CpuWidget : public Widget, public CommandSender
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y);
|
CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int max_w);
|
||||||
virtual ~CpuWidget();
|
virtual ~CpuWidget();
|
||||||
|
|
||||||
void setOpsWidget(DataGridOpsWidget* w);
|
void setOpsWidget(DataGridOpsWidget* w);
|
||||||
|
@ -72,7 +72,7 @@ class CpuWidget : public Widget, public CommandSender
|
||||||
DataGridWidget* myCpuGrid;
|
DataGridWidget* myCpuGrid;
|
||||||
DataGridWidget* myCpuGridDecValue;
|
DataGridWidget* myCpuGridDecValue;
|
||||||
DataGridWidget* myCpuGridBinValue;
|
DataGridWidget* myCpuGridBinValue;
|
||||||
DataGridWidget* myCpuDataSrcGrid;
|
EditTextWidget* myCpuDataSrc[4];
|
||||||
ToggleBitWidget* myPSRegister;
|
ToggleBitWidget* myPSRegister;
|
||||||
EditTextWidget* myPCLabel;
|
EditTextWidget* myPCLabel;
|
||||||
};
|
};
|
||||||
|
|
|
@ -312,20 +312,6 @@ void DebuggerDialog::addRomArea()
|
||||||
const GUI::Rect& r = getRomBounds();
|
const GUI::Rect& r = getRomBounds();
|
||||||
const int vBorder = 4;
|
const int vBorder = 4;
|
||||||
|
|
||||||
int xpos, ypos;
|
|
||||||
|
|
||||||
xpos = r.left + 10; ypos = 10;
|
|
||||||
myCpu = new CpuWidget(this, *myFont, xpos, ypos);
|
|
||||||
addToFocusList(myCpu->getFocusList());
|
|
||||||
|
|
||||||
xpos = r.left + 10; ypos += myCpu->getHeight() + 10;
|
|
||||||
myRam = new RamWidget(this, *myFont, xpos, ypos);
|
|
||||||
addToFocusList(myRam->getFocusList());
|
|
||||||
|
|
||||||
xpos = r.left + 10 + myCpu->getWidth() + 5;
|
|
||||||
DataGridOpsWidget* ops = new DataGridOpsWidget(this, *myFont,
|
|
||||||
xpos, 20);
|
|
||||||
|
|
||||||
int bwidth = myFont->getStringWidth("Frame +1 "),
|
int bwidth = myFont->getStringWidth("Frame +1 "),
|
||||||
bheight = myFont->getLineHeight() + 2;
|
bheight = myFont->getLineHeight() + 2;
|
||||||
int buttonX = r.right - bwidth - 5, buttonY = r.top + 5;
|
int buttonX = r.right - bwidth - 5, buttonY = r.top + 5;
|
||||||
|
@ -353,6 +339,20 @@ void DebuggerDialog::addRomArea()
|
||||||
bwidth, bheight, "<", kDDRewindCmd);
|
bwidth, bheight, "<", kDDRewindCmd);
|
||||||
myRewindButton->clearFlags(WIDGET_ENABLED);
|
myRewindButton->clearFlags(WIDGET_ENABLED);
|
||||||
|
|
||||||
|
int xpos = buttonX - 8*myFont->getMaxCharWidth() - 20, ypos = 20;
|
||||||
|
DataGridOpsWidget* ops = new DataGridOpsWidget(this, *myFont, xpos, ypos);
|
||||||
|
|
||||||
|
int max_w = xpos - r.left - 10;
|
||||||
|
xpos = r.left + 10; ypos = 10;
|
||||||
|
myCpu = new CpuWidget(this, *myFont, xpos, ypos, max_w);
|
||||||
|
addToFocusList(myCpu->getFocusList());
|
||||||
|
|
||||||
|
xpos = r.left + 10; ypos += myCpu->getHeight() + 10;
|
||||||
|
myRam = new RamWidget(this, *myFont, xpos, ypos);
|
||||||
|
addToFocusList(myRam->getFocusList());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Add the DataGridOpsWidget to any widgets which contain a
|
// Add the DataGridOpsWidget to any widgets which contain a
|
||||||
// DataGridWidget which we want controlled
|
// DataGridWidget which we want controlled
|
||||||
myCpu->setOpsWidget(ops);
|
myCpu->setOpsWidget(ops);
|
||||||
|
|
Loading…
Reference in New Issue