Added tracking of changes directly to the DataGridWidget. That means the

CpuWidget automatically gets this support as well.

Still TODO is revamp the loadConfig() method so that updates are only made
when absolutely necessary.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@595 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-07-02 21:15:22 +00:00
parent 2fa65c7921
commit a7fefcd123
5 changed files with 31 additions and 28 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Debugger.cxx,v 1.46 2005-07-02 18:03:09 urchlay Exp $
// $Id: Debugger.cxx,v 1.47 2005-07-02 21:15:22 stephena Exp $
//============================================================================
#include "bspf.hxx"
@ -731,7 +731,6 @@ string Debugger::disassemble(int start, int lines) {
void Debugger::nextFrame(int frames) {
saveRegs();
myOSystem->frameBuffer().advance(frames);
myBaseDialog->loadConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CpuWidget.cxx,v 1.7 2005-07-02 18:34:54 stephena Exp $
// $Id: CpuWidget.cxx,v 1.8 2005-07-02 21:15:22 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -240,10 +240,7 @@ void CpuWidget::fillGrid()
vlist.push_back(dbg.getX());
vlist.push_back(dbg.getY());
// FIXME - show how registers have changed
for(int i = 0; i < 6; ++i)
changed.push_back(false);
myCpuGrid->setList(alist, vlist, changed);
myCpuGrid->setList(alist, vlist);
// Update the PS register booleans
BoolArray b;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DataGridWidget.cxx,v 1.5 2005-07-02 18:34:54 stephena Exp $
// $Id: DataGridWidget.cxx,v 1.6 2005-07-02 21:15:22 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -64,25 +64,34 @@ DataGridWidget::~DataGridWidget()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::setList(const AddrList& alist, const ValueList& vlist,
const BoolArray& changed)
void DataGridWidget::setList(const AddrList& alist, const ValueList& vlist)
{
int size = vlist.size(); // assume the alist is the same size
assert(size == _rows * _cols);
_addrList.clear();
_valueList.clear();
_addrStringList.clear();
_valueStringList.clear();
_changedList.clear();
// Check for any value changes since last time this method was called
if(_valueList.size() == 0)
{
for(int i = 0; i < size; ++i)
_changedList.push_back(false);
}
else
{
for(int i = 0; i < size; ++i)
_changedList.push_back(_valueList[i] != vlist[i]);
}
_valueList.clear();
_addrList = alist;
_valueList = vlist;
_changedList = changed;
int size = _addrList.size(); // assume vlist is the same size
assert(size == _rows * _cols);
// An efficiency thing
string temp;
for(unsigned int i = 0; i < (unsigned int)size; ++i)
for(int i = 0; i < size; ++i)
{
temp = instance()->debugger().valueToString(_valueList[i], _base);
_valueStringList.push_back(temp);
@ -101,8 +110,8 @@ void DataGridWidget::setSelectedValue(int value)
_editString = instance()->debugger().valueToString(value, _base);
_valueStringList[_selectedItem] = _editString;
_changedList[_selectedItem] = (_valueList[_selectedItem] != value);
_valueList[_selectedItem] = value;
_changedList[_selectedItem] = true;
sendCommand(kDGItemDataChangedCmd, _selectedItem);
}
@ -347,7 +356,6 @@ void DataGridWidget::drawWidget(bool hilite)
fb.frameRect(x - 4, y - 2, _colWidth+1, kLineHeight+1, kTextColorHi);
}
//cerr << "pos " << pos << ": " << _changedList[pos] << endl;
if (_selectedItem == pos && _editMode)
{
buffer = _editString;
@ -359,6 +367,9 @@ void DataGridWidget::drawWidget(bool hilite)
}
else
{
if(_changedList[pos])
fb.fillRect(x - 3, y - 1, _colWidth-1, kLineHeight-1, kTextColorEm);
buffer = _valueStringList[pos];
deltax = 0;
fb.drawString(_font, buffer, x, y, _colWidth, kTextColor);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DataGridWidget.hxx,v 1.3 2005-07-02 18:34:54 stephena Exp $
// $Id: DataGridWidget.hxx,v 1.4 2005-07-02 21:15:22 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -50,8 +50,7 @@ class DataGridWidget : public EditableWidget, public CommandSender
int colchars, int range, BaseFormat format = kBASE_DEFAULT);
virtual ~DataGridWidget();
void setList(const AddrList& alist, const ValueList& vlist,
const BoolArray& changedlist);
void setList(const AddrList& alist, const ValueList& vlist);
void setSelectedValue(int value);
int getSelectedAddr() const { return _addrList[_selectedItem]; }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: RamWidget.cxx,v 1.10 2005-07-02 18:34:54 stephena Exp $
// $Id: RamWidget.cxx,v 1.11 2005-07-02 21:15:22 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -231,15 +231,12 @@ void RamWidget::fillGrid()
{
AddrList alist;
ValueList vlist;
BoolArray changed;
Debugger& dbg = instance()->debugger();
for(unsigned int i = 0; i < kRamSize; i++)
{
alist.push_back(kRamStart + i);
vlist.push_back(dbg.readRAM(i));
changed.push_back(dbg.ramChanged(i));
vlist.push_back(instance()->debugger().readRAM(i));
}
myRamGrid->setList(alist, vlist, changed);
myRamGrid->setList(alist, vlist);
}