From bbba4926d47e8994f41fa4468d8430ded3ea395d Mon Sep 17 00:00:00 2001 From: stephena Date: Wed, 24 Apr 2013 12:55:23 +0000 Subject: [PATCH] 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 --- src/cheat/CheatCodeDialog.cxx | 1 - src/debugger/gui/CartCMWidget.cxx | 17 +++++++- src/debugger/gui/CartCMWidget.hxx | 3 +- src/debugger/gui/RomListWidget.cxx | 3 +- src/debugger/gui/TiaWidget.cxx | 10 +++-- src/gui/CheckListWidget.cxx | 21 +-------- src/gui/TabWidget.cxx | 2 +- src/gui/Widget.cxx | 69 ++++++++++++++++-------------- src/gui/Widget.hxx | 3 +- 9 files changed, 64 insertions(+), 65 deletions(-) diff --git a/src/cheat/CheatCodeDialog.cxx b/src/cheat/CheatCodeDialog.cxx index ae79f12f8..4b38b7559 100644 --- a/src/cheat/CheatCodeDialog.cxx +++ b/src/cheat/CheatCodeDialog.cxx @@ -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); diff --git a/src/debugger/gui/CartCMWidget.cxx b/src/debugger/gui/CartCMWidget.cxx index 0416a77d8..3f7040262 100644 --- a/src/debugger/gui/CartCMWidget.cxx +++ b/src/debugger/gui/CartCMWidget.cxx @@ -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(); } diff --git a/src/debugger/gui/CartCMWidget.hxx b/src/debugger/gui/CartCMWidget.hxx index 19d2ebd6c..683c8f625 100644 --- a/src/debugger/gui/CartCMWidget.hxx +++ b/src/debugger/gui/CartCMWidget.hxx @@ -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; diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx index b461b2305..f0438ece1 100644 --- a/src/debugger/gui/RomListWidget.cxx +++ b/src/debugger/gui/RomListWidget.cxx @@ -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; diff --git a/src/debugger/gui/TiaWidget.cxx b/src/debugger/gui/TiaWidget.cxx index 96b8019a7..cc8cd1731 100644 --- a/src/debugger/gui/TiaWidget.cxx +++ b/src/debugger/gui/TiaWidget.cxx @@ -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 diff --git a/src/gui/CheckListWidget.cxx b/src/gui/CheckListWidget.cxx index f94669744..83b9bce15 100644 --- a/src/gui/CheckListWidget.cxx +++ b/src/gui/CheckListWidget.cxx @@ -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) { diff --git a/src/gui/TabWidget.cxx b/src/gui/TabWidget.cxx index c41f144ad..4befaaa60 100644 --- a/src/gui/TabWidget.cxx +++ b/src/gui/TabWidget.cxx @@ -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(); diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx index e069b9168..dd65a897d 100644 --- a/src/gui/Widget.cxx +++ b/src/gui/Widget.cxx @@ -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; } } diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx index 6afad01b8..4750fb596 100644 --- a/src/gui/Widget.hxx +++ b/src/gui/Widget.hxx @@ -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); }