Finished CompuMate debugger ROM tab (for now at least; we need a

virtual keyboard added to the UI at some point).

Cleaned up the CheckBoxWidget API, and introduced new checkbox
'contents' that will hopefully more clearly indicate what is going
on (fully drawn square means selected, square with empty circle means
selected by not editable, etc).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2706 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2013-04-24 12:55:23 +00:00
parent 247d10fee9
commit bbba4926d4
9 changed files with 64 additions and 65 deletions

View File

@ -59,7 +59,6 @@ CheatCodeDialog::CheatCodeDialog(OSystem* osystem, DialogContainer* parent,
myCheatList =
new CheckListWidget(this, font, xpos, ypos, _w - buttonWidth - 25,
_h - 2*buttonHeight - 10);
myCheatList->setStyle(CheckListWidget::XFill);
myCheatList->setEditable(false);
wid.push_back(myCheatList);

View File

@ -20,6 +20,7 @@
#include "CartCM.hxx"
#include "RiotDebug.hxx"
#include "DataGridWidget.hxx"
#include "EditTextWidget.hxx"
#include "PopUpWidget.hxx"
#include "ToggleBitWidget.hxx"
#include "CartCMWidget.hxx"
@ -135,6 +136,14 @@ CartridgeCMWidget::CartridgeCMWidget(
myAudOut->setTarget(this);
myAudOut->setEditable(false);
// Ram state (combination of several bits in SWCHA)
ypos += myLineHeight + 8;
lwidth = font.getStringWidth("Ram State: ");
new StaticTextWidget(boss, font, xpos, ypos, lwidth,
myFontHeight, "Ram State: ", kTextAlignLeft);
myRAM = new EditTextWidget(boss, font, xpos+lwidth, ypos-1,
font.getStringWidth(" Write-only "), myLineHeight, "");
myRAM->setEditable(false);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -150,7 +159,7 @@ void CartridgeCMWidget::loadConfig()
myBank->setSelected(myCart.myCurrentBank);
RiotDebug& riot = Debugger::debugger().riotDebug();
const RiotState& state = (RiotState&) riot.getState();
const RiotState& state = (RiotState&) riot.getState();
uInt8 swcha = myCart.mySWCHA;
@ -176,9 +185,15 @@ void CartridgeCMWidget::loadConfig()
myFunc->setState(state.INPT0 & 0x80);
myShift->setState(state.INPT3 & 0x80);
// Audio in and out (used for communicating with the external cassette)
myAudIn->setState(swcha & 0x80);
myAudOut->setState(swcha & 0x40);
// RAM state (several bits from SWCHA)
const string& ram = swcha & 0x10 ? " Inactive" :
swcha & 0x20 ? " Read-only" : " Write-only";
myRAM->setEditString(ram, (swcha & 0x30) != (myOldState.swcha & 0x30));
CartDebugWidget::loadConfig();
}

View File

@ -23,6 +23,7 @@
class CartridgeCM;
class CheckboxWidget;
class DataGridWidget;
class EditTextWidget;
class PopUpWidget;
class ToggleBitWidget;
@ -56,7 +57,7 @@ class CartridgeCMWidget : public CartDebugWidget
CheckboxWidget *myAudIn, *myAudOut, *myIncrease, *myReset;
CheckboxWidget* myRow[4];
CheckboxWidget *myFunc, *myShift;
PopUpWidget* myRAM;
EditTextWidget* myRAM;
CartState myOldState;

View File

@ -95,8 +95,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& font,
t = new CheckboxWidget(boss, font, _x + 2, ypos, "", kCheckActionCmd);
t->setTarget(this);
t->setID(i);
t->drawBox(false);
t->setFill(CheckboxWidget::O);
t->setFill(CheckboxWidget::Circle);
t->setTextColor(kTextColorEm);
ypos += _fontHeight;

View File

@ -863,8 +863,9 @@ void TiaWidget::fillGrid()
myDelP0->setState(tia.vdelP0());
// NUSIZ0 (player portion)
myNusizP0->setList(0, state.size[P0], state.size[P0] != oldstate.size[P0]);
myNusizP0Text->setEditString(tia.nusizP0String());
bool nusiz0changed = state.size[P0] != oldstate.size[P0];
myNusizP0->setList(0, state.size[P0], nusiz0changed);
myNusizP0Text->setEditString(tia.nusizP0String(), nusiz0changed);
////////////////////////////
// P1 register info
@ -884,8 +885,9 @@ void TiaWidget::fillGrid()
myDelP1->setState(tia.vdelP1());
// NUSIZ1 (player portion)
myNusizP1->setList(0, state.size[P1], state.size[P1] != oldstate.size[P1]);
myNusizP1Text->setEditString(tia.nusizP1String());
bool nusiz1changed = state.size[P1] != oldstate.size[P1];
myNusizP1->setList(0, state.size[P1], nusiz1changed);
myNusizP1Text->setEditString(tia.nusizP1String(), nusiz1changed);
////////////////////////////
// M0 register info

View File

@ -40,6 +40,7 @@ CheckListWidget::CheckListWidget(GuiObject* boss, const GUI::Font& font,
for(int i = 0; i < _rows; ++i)
{
t = new CheckboxWidget(boss, font, _x + 2, ypos, "", kCheckActionCmd);
t->setTextColor(kTextColor);
t->setTarget(this);
t->setID(i);
ypos += _fontHeight;
@ -53,26 +54,6 @@ CheckListWidget::~CheckListWidget()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CheckListWidget::setStyle(CheckStyle style)
{
for(unsigned int i = 0; i < _checkList.size(); ++i)
{
if(style == XFill)
{
_checkList[i]->drawBox(true);
_checkList[i]->setFill(CheckboxWidget::X);
_checkList[i]->setTextColor(kTextColor);
}
else if(style == SolidFill)
{
_checkList[i]->drawBox(false);
_checkList[i]->setFill(CheckboxWidget::Full);
_checkList[i]->setTextColor(kTextColorEm);
}
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CheckListWidget::setList(const StringList& list, const BoolArray& state)
{

View File

@ -191,7 +191,7 @@ void TabWidget::handleMouseDown(int x, int y, int button, int clickCount)
}
// If a tab was clicked, switch to that pane
if (tabID >= 0 && tabID != _activeTab)
if (tabID >= 0)
{
setActiveTab(tabID, true);
updateActiveTab();

View File

@ -400,40 +400,40 @@ void ButtonWidget::drawWidget(bool hilite)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/* 8x8 checkbox bitmap */
static unsigned int checked_img_x[8] =
static unsigned int checked_img_active[8] =
{
0x00000000,
0x01000010,
0x00100100,
0x00011000,
0x00011000,
0x00100100,
0x01000010,
0x00000000,
0x11111111,
0x11111111,
0x11111111,
0x11111111,
0x11111111,
0x11111111,
0x11111111,
0x11111111
};
static unsigned int checked_img_o[8] =
static unsigned int checked_img_inactive[8] =
{
0x11111111,
0x11111111,
0x11100111,
0x11000011,
0x11000011,
0x11100111,
0x11111111,
0x11111111
};
static unsigned int checked_img_circle[8] =
{
0x00011000,
0x00111100,
0x01111110,
0x01111110,
0x11111111,
0x11111111,
0x01111110,
0x00111100,
0x00011000,
};
static unsigned int checked_img_full[8] =
{
0x11111111,
0x11111111,
0x11111111,
0x11111111,
0x11111111,
0x11111111,
0x11111111,
0x11111111,
0x01111110,
0x00011000
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -468,7 +468,7 @@ CheckboxWidget::CheckboxWidget(GuiObject *boss, const GUI::Font& font,
else // center text
_textY = (14 - _font.getFontHeight()) / 2;
setFill(CheckboxWidget::X);
setFill(CheckboxWidget::Normal);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -488,7 +488,7 @@ void CheckboxWidget::setEditable(bool editable)
{
_editable = editable;
if(!_editable)
setFill(CheckboxWidget::Full);
setFill(CheckboxWidget::Inactive);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -496,14 +496,17 @@ void CheckboxWidget::setFill(FillType type)
{
switch(type)
{
case CheckboxWidget::X:
_img = checked_img_x;
case CheckboxWidget::Normal:
_img = checked_img_active;
_drawBox = true;
break;
case CheckboxWidget::O:
_img = checked_img_o;
case CheckboxWidget::Inactive:
_img = checked_img_inactive;
_drawBox = true;
break;
case CheckboxWidget::Full:
_img = checked_img_full;
case CheckboxWidget::Circle:
_img = checked_img_circle;
_drawBox = false;
break;
}
}

View File

@ -244,7 +244,7 @@ class CheckboxWidget : public ButtonWidget
{
public:
enum FillType {
X, O, Full
Normal, Inactive, Circle
};
public:
@ -257,7 +257,6 @@ class CheckboxWidget : public ButtonWidget
void setEditable(bool editable);
void setFill(FillType type);
void drawBox(bool draw) { _drawBox = draw; }
void setState(bool state);
void toggleState() { setState(!_state); }