Moved RamWidget into the main debugger area. Still TODO is move the

operations buttons.  I'm probably going to make this another widget,
and have it act on either CpuWidget or RamWidget, whichever is
currently in focus.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@714 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-08-10 14:44:01 +00:00
parent 82b7f66043
commit 76df55e93e
4 changed files with 34 additions and 56 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CpuWidget.cxx,v 1.4 2005-08-10 12:23:42 stephena Exp $ // $Id: CpuWidget.cxx,v 1.5 2005-08-10 14:44:00 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -108,35 +108,6 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
// Calculate real dimensions // Calculate real dimensions
_w = lwidth + myCpuGrid->getWidth() + myPSRegister->getWidth() + 20; _w = lwidth + myCpuGrid->getWidth() + myPSRegister->getWidth() + 20;
_h = ypos + myPSRegister->getHeight() - y; _h = ypos + myPSRegister->getHeight() - y;
/*
// FIXME --------------------------
// The following will be moved to another part of the debugger dialog,
// so I won't bother fixing it here.
// And some status fields
xpos = 10; ypos += 2*lineHeight;
new StaticTextWidget(boss, xpos, ypos, 55, kLineHeight, "Current Ins:", kTextAlignLeft);
xpos += 60;
myCurrentIns = new EditTextWidget(boss, xpos, ypos-2, 300, kLineHeight, "");
myCurrentIns->setFont(font);
myCurrentIns->setEditable(false);
xpos = 10; ypos += kLineHeight + 5;
new StaticTextWidget(boss, xpos, ypos, 55, kLineHeight, "Cycle Count:", kTextAlignLeft);
xpos += 60;
myCycleCount = new EditTextWidget(boss, xpos, ypos-2, 50, kLineHeight, "");
myCycleCount->setFont(font);
myCycleCount->setEditable(false);
xpos = 10; ypos += kLineHeight + 5;
new StaticTextWidget(boss, xpos, ypos, 55, kLineHeight, "BP/Trap:", kTextAlignLeft);
xpos += 60;
myStatus = new EditTextWidget(boss, xpos, ypos-2, 100, kLineHeight, "");
myStatus->setFont(font);
myStatus->setEditable(false);
// FIXME --------------------------
*/
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: RamWidget.cxx,v 1.4 2005-08-10 12:23:42 stephena Exp $ // $Id: RamWidget.cxx,v 1.5 2005-08-10 14:44:00 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -33,20 +33,21 @@
#include "RamWidget.hxx" #include "RamWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h) RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
: Widget(boss, x, y, w, h), : Widget(boss, x, y, 16, 16),
CommandSender(boss) CommandSender(boss)
{ {
const GUI::Font& font = instance()->consoleFont(); const int fontWidth = font.getMaxCharWidth(),
int xpos = 10, ypos = 25, lwidth = 4 * font.getMaxCharWidth(); fontHeight = font.getFontHeight(),
int fontHeight = font.getFontHeight(), lineHeight = font.getLineHeight(); lineHeight = font.getLineHeight();
int fontWidth = font.getMaxCharWidth(); int xpos, ypos, lwidth;
StaticTextWidget* t; StaticTextWidget* t;
// FIXME - this contains magic numbers // FIXME - this contains magic numbers
const int vWidth = _w - kButtonWidth - 20, space = 6, buttonw = 24; const int vWidth = _w - kButtonWidth - 20, space = 6, buttonw = 24;
// Create a 16x8 grid holding byte values (16 x 8 = 128 RAM bytes) with labels // Create a 16x8 grid holding byte values (16 x 8 = 128 RAM bytes) with labels
xpos = x + 10; ypos = y + lineHeight; lwidth = 4 * fontWidth;
myRamGrid = new DataGridWidget(boss, font, xpos + lwidth, ypos, myRamGrid = new DataGridWidget(boss, font, xpos + lwidth, ypos,
16, 8, 2, 8, kBASE_16); 16, 8, 2, 8, kBASE_16);
myRamGrid->setTarget(this); myRamGrid->setTarget(this);
@ -55,7 +56,7 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
for(int row = 0; row < 8; ++row) for(int row = 0; row < 8; ++row)
{ {
t = new StaticTextWidget(boss, xpos-2, ypos + row*lineHeight + 2, t = new StaticTextWidget(boss, xpos-2, ypos + row*lineHeight + 2,
lwidth, fontHeight, lwidth-2, fontHeight,
Debugger::to_hex_8(row*16 + kRamStart) + string(":"), Debugger::to_hex_8(row*16 + kRamStart) + string(":"),
kTextAlignLeft); kTextAlignLeft);
t->setFont(font); t->setFont(font);
@ -70,7 +71,7 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
t->setFont(font); t->setFont(font);
} }
xpos = 20; ypos += 9 * lineHeight; xpos = x + 10; ypos += 9 * lineHeight;
t = new StaticTextWidget(boss, xpos, ypos, t = new StaticTextWidget(boss, xpos, ypos,
6*fontWidth, fontHeight, 6*fontWidth, fontHeight,
"Label:", kTextAlignLeft); "Label:", kTextAlignLeft);
@ -100,6 +101,7 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
myBinValue->setFont(font); myBinValue->setFont(font);
myBinValue->setEditable(false); myBinValue->setEditable(false);
/*
// Add some buttons for common actions // Add some buttons for common actions
ButtonWidget* b; ButtonWidget* b;
xpos = vWidth + 10; ypos = 20; xpos = vWidth + 10; ypos = 20;
@ -143,6 +145,11 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
ypos += 16 + space; ypos += 16 + space;
b = new ButtonWidget(boss, xpos, ypos, buttonw, 16, ">>", kDGShiftRCmd, 0); b = new ButtonWidget(boss, xpos, ypos, buttonw, 16, ">>", kDGShiftRCmd, 0);
b->setTarget(myRamGrid); b->setTarget(myRamGrid);
*/
// Calculate real dimensions
_w = lwidth + myRamGrid->getWidth();
_h = ypos + 2*lineHeight - y;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -172,8 +179,8 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
dbg.write(addr, value); dbg.write(addr, value);
myDecValue->setEditString(instance()->debugger().valueToString(value, kBASE_10)); myDecValue->setEditString(instance()->debugger().valueToString(value, kBASE_10));
myBinValue->setEditString(instance()->debugger().valueToString(value, kBASE_2)); myBinValue->setEditString(instance()->debugger().valueToString(value, kBASE_2));
myRevertButton->setEnabled(true); // myRevertButton->setEnabled(true);
myUndoButton->setEnabled(true); // myUndoButton->setEnabled(true);
break; break;
case kDGSelectionChangedCmd: case kDGSelectionChangedCmd:
@ -196,7 +203,7 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
case kUndoCmd: case kUndoCmd:
dbg.write(myUndoAddress, myUndoValue); dbg.write(myUndoAddress, myUndoValue);
myUndoButton->setEnabled(false); // myUndoButton->setEnabled(false);
fillGrid(false); fillGrid(false);
break; break;
} }
@ -235,7 +242,7 @@ void RamWidget::fillGrid(bool updateOld)
myRamGrid->setList(alist, vlist, changed); myRamGrid->setList(alist, vlist, changed);
if(updateOld) if(updateOld)
{ {
myRevertButton->setEnabled(false); // myRevertButton->setEnabled(false);
myUndoButton->setEnabled(false); // myUndoButton->setEnabled(false);
} }
} }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: RamWidget.hxx,v 1.2 2005-08-10 12:23:42 stephena Exp $ // $Id: RamWidget.hxx,v 1.3 2005-08-10 14:44:00 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -41,7 +41,7 @@ enum {
class RamWidget : public Widget, public CommandSender class RamWidget : public Widget, public CommandSender
{ {
public: public:
RamWidget(GuiObject* boss, int x, int y, int w, int h); RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y);
virtual ~RamWidget(); virtual ~RamWidget();
void handleCommand(CommandSender* sender, int cmd, int data, int id); void handleCommand(CommandSender* sender, int cmd, int data, int id);
@ -58,6 +58,7 @@ class RamWidget : public Widget, public CommandSender
EditTextWidget* myBinValue; EditTextWidget* myBinValue;
EditTextWidget* myDecValue; EditTextWidget* myDecValue;
EditTextWidget* myLabel; EditTextWidget* myLabel;
ButtonWidget *myRevertButton; ButtonWidget *myRevertButton;
ButtonWidget *myUndoButton; ButtonWidget *myUndoButton;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: DebuggerDialog.cxx,v 1.31 2005-08-10 12:23:42 stephena Exp $ // $Id: DebuggerDialog.cxx,v 1.32 2005-08-10 14:44:01 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -67,6 +67,7 @@ cerr << " ==> DebuggerDialog::loadConfig()\n";
myTiaInfo->loadConfig(); myTiaInfo->loadConfig();
myTiaOutput->loadConfig(); myTiaOutput->loadConfig();
myCpu->loadConfig(); myCpu->loadConfig();
myRam->loadConfig();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -150,21 +151,15 @@ void DebuggerDialog::addTabArea()
myTab->setParentWidget(tabID, myPrompt); myTab->setParentWidget(tabID, myPrompt);
addToFocusList(myPrompt->getFocusList(), tabID); addToFocusList(myPrompt->getFocusList(), tabID);
// The RAM tab (part of RIOT)
tabID = myTab->addTab("RAM");
RamWidget* ram = new RamWidget(myTab, 2, 2, widWidth, widHeight);
myTab->setParentWidget(tabID, ram);
addToFocusList(ram->getFocusList(), tabID);
// The input/output tab (part of RIOT)
tabID = myTab->addTab("I/O");
// The TIA tab // The TIA tab
tabID = myTab->addTab("TIA"); tabID = myTab->addTab("TIA");
TiaWidget* tia = new TiaWidget(myTab, 2, 2, widWidth, widHeight); TiaWidget* tia = new TiaWidget(myTab, 2, 2, widWidth, widHeight);
myTab->setParentWidget(tabID, tia); myTab->setParentWidget(tabID, tia);
addToFocusList(tia->getFocusList(), tabID); addToFocusList(tia->getFocusList(), tabID);
// The input/output tab (part of RIOT)
tabID = myTab->addTab("I/O");
// The Cheat tab // The Cheat tab
tabID = myTab->addTab("Cheat"); tabID = myTab->addTab("Cheat");
CheatWidget* cheat = new CheatWidget(myTab, 2, 2, widWidth, widHeight); CheatWidget* cheat = new CheatWidget(myTab, 2, 2, widWidth, widHeight);
@ -191,6 +186,10 @@ void DebuggerDialog::addRomArea()
myCpu = new CpuWidget(this, instance()->consoleFont(), xpos, ypos); myCpu = new CpuWidget(this, instance()->consoleFont(), xpos, ypos);
addToFocusList(myCpu->getFocusList()); addToFocusList(myCpu->getFocusList());
ypos += myCpu->getHeight() + 10;
myRam = new RamWidget(this, instance()->consoleFont(), xpos, ypos);
addToFocusList(myRam->getFocusList());
// Add some buttons that are always shown, no matter which tab we're in // Add some buttons that are always shown, no matter which tab we're in
// FIXME - these positions will definitely change // FIXME - these positions will definitely change
xpos = r.right - 100; ypos = r.bottom - 150; xpos = r.right - 100; ypos = r.bottom - 150;