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
This commit is contained in:
stephena 2005-07-02 18:34:54 +00:00
parent b3479e8e9a
commit 2fa65c7921
8 changed files with 36 additions and 24 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: 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<int> IntArray;
typedef GUI::Array<string> 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;

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: 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<int> IntArray;
typedef GUI::Array<bool> BoolArray;
#endif

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.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)
{

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.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;

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.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;

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.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);
}

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: 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;

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: 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<bool> 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