From a7fefcd1234a5f095a0fa5815ea1438ca6319907 Mon Sep 17 00:00:00 2001 From: stephena <stephena@8b62c5a3-ac7e-4cc8-8f21-d9a121418aba> Date: Sat, 2 Jul 2005 21:15:22 +0000 Subject: [PATCH] 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 --- stella/src/debugger/Debugger.cxx | 3 +-- stella/src/gui/CpuWidget.cxx | 7 ++----- stella/src/gui/DataGridWidget.cxx | 35 ++++++++++++++++++++----------- stella/src/gui/DataGridWidget.hxx | 5 ++--- stella/src/gui/RamWidget.cxx | 9 +++----- 5 files changed, 31 insertions(+), 28 deletions(-) diff --git a/stella/src/debugger/Debugger.cxx b/stella/src/debugger/Debugger.cxx index 7000e81e9..5fcb27687 100644 --- a/stella/src/debugger/Debugger.cxx +++ b/stella/src/debugger/Debugger.cxx @@ -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(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/CpuWidget.cxx b/stella/src/gui/CpuWidget.cxx index 6f53f79a0..d889af8c0 100644 --- a/stella/src/gui/CpuWidget.cxx +++ b/stella/src/gui/CpuWidget.cxx @@ -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; diff --git a/stella/src/gui/DataGridWidget.cxx b/stella/src/gui/DataGridWidget.cxx index ac6384673..4157bcf1b 100644 --- a/stella/src/gui/DataGridWidget.cxx +++ b/stella/src/gui/DataGridWidget.cxx @@ -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(); - _addrList = alist; + // 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); diff --git a/stella/src/gui/DataGridWidget.hxx b/stella/src/gui/DataGridWidget.hxx index f4a54dd27..d535f8629 100644 --- a/stella/src/gui/DataGridWidget.hxx +++ b/stella/src/gui/DataGridWidget.hxx @@ -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]; } diff --git a/stella/src/gui/RamWidget.cxx b/stella/src/gui/RamWidget.cxx index 9bf95b2b6..71bec8ca9 100644 --- a/stella/src/gui/RamWidget.cxx +++ b/stella/src/gui/RamWidget.cxx @@ -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); }