From 2fa65c7921b06a1064660337e1d9c595e1cef69c Mon Sep 17 00:00:00 2001 From: stephena Date: Sat, 2 Jul 2005 18:34:54 +0000 Subject: [PATCH] Added infrastructure for the DataGridWidget to track state changes, by making use of the Debugger::ramChanged() method. Still TODO is actually 'draw' those changes. Cleaned up Array typedefs, placing them in the Array class. Also removed StringArray typedef, since there's already a StringList class that does exactly the same thing. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@594 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/debugger/DebuggerParser.hxx | 9 +++------ stella/src/gui/Array.hxx | 5 ++++- stella/src/gui/CpuWidget.cxx | 10 +++++++--- stella/src/gui/DataGridWidget.cxx | 9 +++++++-- stella/src/gui/DataGridWidget.hxx | 6 ++++-- stella/src/gui/RamWidget.cxx | 9 ++++++--- stella/src/gui/ToggleBitWidget.cxx | 4 ++-- stella/src/gui/ToggleBitWidget.hxx | 8 +++----- 8 files changed, 36 insertions(+), 24 deletions(-) diff --git a/stella/src/debugger/DebuggerParser.hxx b/stella/src/debugger/DebuggerParser.hxx index 51bb8c211..66e04663a 100644 --- a/stella/src/debugger/DebuggerParser.hxx +++ b/stella/src/debugger/DebuggerParser.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: DebuggerParser.hxx,v 1.25 2005-07-02 15:31:30 urchlay Exp $ +// $Id: DebuggerParser.hxx,v 1.26 2005-07-02 18:34:53 stephena Exp $ //============================================================================ #ifndef DEBUGGER_PARSER_HXX @@ -33,9 +33,6 @@ typedef enum { kBASE_DEFAULT } BaseFormat; -typedef GUI::Array IntArray; -typedef GUI::Array StringArray; - class DebuggerParser { public: @@ -85,11 +82,11 @@ class DebuggerParser string commandResult; IntArray args; - StringArray argStrings; + StringList argStrings; int argCount; BaseFormat defaultBase; - StringArray watches; + StringList watches; static Command commands[]; string completions; diff --git a/stella/src/gui/Array.hxx b/stella/src/gui/Array.hxx index e8606e54d..f21417999 100644 --- a/stella/src/gui/Array.hxx +++ b/stella/src/gui/Array.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: Array.hxx,v 1.5 2005-06-16 00:55:59 stephena Exp $ +// $Id: Array.hxx,v 1.6 2005-07-02 18:34:54 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -192,4 +192,7 @@ class Array } // Namespace GUI +typedef GUI::Array IntArray; +typedef GUI::Array BoolArray; + #endif diff --git a/stella/src/gui/CpuWidget.cxx b/stella/src/gui/CpuWidget.cxx index e76246c6e..6f53f79a0 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.6 2005-06-24 17:46:11 stephena Exp $ +// $Id: CpuWidget.cxx,v 1.7 2005-07-02 18:34:54 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -222,6 +222,7 @@ void CpuWidget::fillGrid() { AddrList alist; ValueList vlist; + BoolArray changed; // We push the enumerated items as addresses, and deal with the real // address in the callback (handleCommand) @@ -239,10 +240,13 @@ void CpuWidget::fillGrid() vlist.push_back(dbg.getX()); vlist.push_back(dbg.getY()); - myCpuGrid->setList(alist, vlist); + // FIXME - show how registers have changed + for(int i = 0; i < 6; ++i) + changed.push_back(false); + myCpuGrid->setList(alist, vlist, changed); // Update the PS register booleans - BoolList b; + BoolArray b; int ps = dbg.getPS(); for(int i = 0; i < 8; ++i) { diff --git a/stella/src/gui/DataGridWidget.cxx b/stella/src/gui/DataGridWidget.cxx index fe4e0a91b..ac6384673 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.4 2005-06-23 14:33:11 stephena Exp $ +// $Id: DataGridWidget.cxx,v 1.5 2005-07-02 18:34:54 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -64,15 +64,18 @@ DataGridWidget::~DataGridWidget() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void DataGridWidget::setList(const AddrList& alist, const ValueList& vlist) +void DataGridWidget::setList(const AddrList& alist, const ValueList& vlist, + const BoolArray& changed) { _addrList.clear(); _valueList.clear(); _addrStringList.clear(); _valueStringList.clear(); + _changedList.clear(); _addrList = alist; _valueList = vlist; + _changedList = changed; int size = _addrList.size(); // assume vlist is the same size assert(size == _rows * _cols); @@ -99,6 +102,7 @@ void DataGridWidget::setSelectedValue(int value) _valueStringList[_selectedItem] = _editString; _valueList[_selectedItem] = value; + _changedList[_selectedItem] = true; sendCommand(kDGItemDataChangedCmd, _selectedItem); } @@ -343,6 +347,7 @@ 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; diff --git a/stella/src/gui/DataGridWidget.hxx b/stella/src/gui/DataGridWidget.hxx index 383930ab0..f4a54dd27 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.2 2005-06-22 18:30:43 stephena Exp $ +// $Id: DataGridWidget.hxx,v 1.3 2005-07-02 18:34:54 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -50,7 +50,8 @@ class DataGridWidget : public EditableWidget, public CommandSender int colchars, int range, BaseFormat format = kBASE_DEFAULT); virtual ~DataGridWidget(); - void setList(const AddrList& alist, const ValueList& vlist); + void setList(const AddrList& alist, const ValueList& vlist, + const BoolArray& changedlist); void setSelectedValue(int value); int getSelectedAddr() const { return _addrList[_selectedItem]; } @@ -96,6 +97,7 @@ class DataGridWidget : public EditableWidget, public CommandSender ValueList _valueList; StringList _addrStringList; StringList _valueStringList; + BoolArray _changedList; bool _editMode; int _selectedItem; diff --git a/stella/src/gui/RamWidget.cxx b/stella/src/gui/RamWidget.cxx index ced2c9b1c..9bf95b2b6 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.9 2005-06-23 14:33:11 stephena Exp $ +// $Id: RamWidget.cxx,v 1.10 2005-07-02 18:34:54 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -231,12 +231,15 @@ 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(instance()->debugger().readRAM(i)); + vlist.push_back(dbg.readRAM(i)); + changed.push_back(dbg.ramChanged(i)); } - myRamGrid->setList(alist, vlist); + myRamGrid->setList(alist, vlist, changed); } diff --git a/stella/src/gui/ToggleBitWidget.cxx b/stella/src/gui/ToggleBitWidget.cxx index b3e358e99..4b2799712 100644 --- a/stella/src/gui/ToggleBitWidget.cxx +++ b/stella/src/gui/ToggleBitWidget.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: ToggleBitWidget.cxx,v 1.1 2005-06-24 11:04:59 stephena Exp $ +// $Id: ToggleBitWidget.cxx,v 1.2 2005-07-02 18:34:54 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -68,7 +68,7 @@ void ToggleBitWidget::setList(const StringList& off, const StringList& on) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void ToggleBitWidget::setState(const BoolList& state) +void ToggleBitWidget::setState(const BoolArray& state) { _stateList.clear(); _stateList = state; diff --git a/stella/src/gui/ToggleBitWidget.hxx b/stella/src/gui/ToggleBitWidget.hxx index 4bed69cce..b359a2815 100644 --- a/stella/src/gui/ToggleBitWidget.hxx +++ b/stella/src/gui/ToggleBitWidget.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: ToggleBitWidget.hxx,v 1.1 2005-06-24 11:05:00 stephena Exp $ +// $Id: ToggleBitWidget.hxx,v 1.2 2005-07-02 18:34:54 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -29,8 +29,6 @@ #include "StringList.hxx" #include "Array.hxx" -typedef GUI::Array BoolList; - // Some special commands enum { kTBItemDataChangedCmd = 'TBch', @@ -46,7 +44,7 @@ class ToggleBitWidget : public Widget, public CommandSender virtual ~ToggleBitWidget(); void setList(const StringList& off, const StringList& on); - void setState(const BoolList& state); + void setState(const BoolArray& state); bool getSelectedState() const { return _stateList[_selectedItem]; } @@ -73,7 +71,7 @@ class ToggleBitWidget : public Widget, public CommandSender StringList _offList; StringList _onList; - BoolList _stateList; + BoolArray _stateList; }; #endif