Non-editable UI items in the debugger are now shown with a different background color.

This commit is contained in:
Stephen Anthony 2017-04-01 17:04:40 -02:30
parent 58f93c1930
commit 3e5df9c7bc
14 changed files with 51 additions and 27 deletions

View File

@ -45,7 +45,7 @@ AudioWidget::AudioWidget(GuiObject* boss, const GUI::Font& lfont,
2, 1, 2, 5, Common::Base::F_16);
myAudF->setTarget(this);
myAudF->setID(kAUDFID);
myAudF->setEditable(false);
myAudF->setEditable(false, true);
addFocusWidget(myAudF);
for(int col = 0; col < 2; ++col)
@ -65,7 +65,7 @@ AudioWidget::AudioWidget(GuiObject* boss, const GUI::Font& lfont,
2, 1, 2, 4, Common::Base::F_16);
myAudC->setTarget(this);
myAudC->setID(kAUDCID);
myAudC->setEditable(false);
myAudC->setEditable(false, true);
addFocusWidget(myAudC);
// AudV registers
@ -77,7 +77,7 @@ AudioWidget::AudioWidget(GuiObject* boss, const GUI::Font& lfont,
2, 1, 2, 4, Common::Base::F_16);
myAudV->setTarget(this);
myAudV->setID(kAUDVID);
myAudV->setEditable(false);
myAudV->setEditable(false, true);
addFocusWidget(myAudV);
}

View File

@ -54,7 +54,7 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
xpos += lwidth + myPCGrid->getWidth() + 10;
myPCLabel = new EditTextWidget(boss, nfont, xpos, ypos, (max_w - xpos + x) - 10,
fontHeight+1, "");
myPCLabel->setEditable(false);
myPCLabel->setEditable(false, true);
// Create a 1x4 grid with labels for the other CPU registers
xpos = x + lwidth; ypos += myPCGrid->getHeight() + 1;
@ -89,7 +89,7 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
{
myCpuDataSrc[i] = new EditTextWidget(boss, nfont, xpos, src_y, src_w,
fontHeight+1, "");
myCpuDataSrc[i]->setEditable(false);
myCpuDataSrc[i]->setEditable(false, true);
src_y += fontHeight+2;
}
int swidth = lfont.getStringWidth("Source Address");

View File

@ -341,7 +341,7 @@ void DebuggerDialog::addStatusArea()
myMessageBox = new EditTextWidget(this, *myLFont,
xpos, ypos, myTiaZoom->getWidth(),
myLFont->getLineHeight(), "");
myMessageBox->setEditable(false);
myMessageBox->setEditable(false, false);
myMessageBox->clearFlags(WIDGET_RETAIN_FOCUS);
myMessageBox->setTextColor(kTextColorEm);
}

View File

@ -142,7 +142,7 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
xpos += 6*myFontWidth + 5;
myLabel = new EditTextWidget(boss, nfont, xpos, ypos-2, xpos_r-xpos,
myLineHeight);
myLabel->setEditable(false);
myLabel->setEditable(false, true);
// Inputbox which will pop up when searching RAM
StringList labels = { "Search: " };

View File

@ -121,7 +121,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont,
xpos += t->getWidth() + 5;
myTimRead = new DataGridWidget(boss, nfont, xpos, ypos, 1, 4, 8, 32, Common::Base::F_16);
myTimRead->setTarget(this);
myTimRead->setEditable(false);
myTimRead->setEditable(false, true);
// Controller ports
const RiotDebug& riot = instance().debugger().riotDebug();
@ -143,7 +143,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont,
xpos += 6*fontWidth + 5;
myLeftINPT = new DataGridWidget(boss, nfont, xpos, ypos, 1, 3, 2, 8, Common::Base::F_16);
myLeftINPT->setTarget(this);
myLeftINPT->setEditable(false);
myLeftINPT->setEditable(false, true);
// TIA INPTx registers (R), right port
const char* contRightReadNames[] = { "INPT2:", "INPT3:", "INPT5:" };
@ -156,7 +156,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont,
xpos += 6*fontWidth + 5;
myRightINPT = new DataGridWidget(boss, nfont, xpos, ypos, 1, 3, 2, 8, Common::Base::F_16);
myRightINPT->setTarget(this);
myRightINPT->setEditable(false);
myRightINPT->setEditable(false, true);
// TIA INPTx VBLANK bits (D6-latch, D7-dump) (R)
xpos = col + 20; ypos += myLeftINPT->getHeight() + lineHeight;

View File

@ -47,7 +47,7 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
kTextAlignLeft);
xpos += lwidth;
myFrameCount = new EditTextWidget(boss, nfont, xpos, ypos-1, fwidth, lineHeight, "");
myFrameCount->setEditable(false);
myFrameCount->setEditable(false, true);
xpos = x; ypos += lineHeight + 5;
new StaticTextWidget(boss, lfont, xpos, ypos, lwidth, lineHeight,
@ -55,7 +55,7 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
kTextAlignLeft);
xpos += lwidth;
myFrameCycles = new EditTextWidget(boss, nfont, xpos, ypos-1, fwidth, lineHeight, "");
myFrameCycles->setEditable(false);
myFrameCycles->setEditable(false, true);
xpos = x + 20; ypos += lineHeight + 8;
myVSync = new CheckboxWidget(boss, lfont, xpos, ypos-3, "VSync", 0);
@ -73,7 +73,7 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
myScanlineCount = new EditTextWidget(boss, nfont, xpos+lwidth, ypos-1, fwidth,
lineHeight, "");
myScanlineCount->setEditable(false);
myScanlineCount->setEditable(false, true);
ypos += lineHeight + 5;
new StaticTextWidget(boss, lfont, xpos, ypos, lwidth, lineHeight,
@ -81,7 +81,7 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
myScanlineCycles = new EditTextWidget(boss, nfont, xpos+lwidth, ypos-1, fwidth,
lineHeight, "");
myScanlineCycles->setEditable(false);
myScanlineCycles->setEditable(false, true);
ypos += lineHeight + 5;
new StaticTextWidget(boss, lfont, xpos, ypos, lwidth, lineHeight,
@ -89,7 +89,7 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
myPixelPosition = new EditTextWidget(boss, nfont, xpos+lwidth, ypos-1, fwidth,
lineHeight, "");
myPixelPosition->setEditable(false);
myPixelPosition->setEditable(false, true);
ypos += lineHeight + 5;
new StaticTextWidget(boss, lfont, xpos, ypos, lwidth, lineHeight,
@ -97,7 +97,7 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
myColorClocks = new EditTextWidget(boss, nfont, xpos+lwidth, ypos-1, fwidth,
lineHeight, "");
myColorClocks->setEditable(false);
myColorClocks->setEditable(false, true);
// Calculate actual dimensions
_w = myColorClocks->getAbsX() + myColorClocks->getWidth() - x;

View File

@ -237,7 +237,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
xpos += myNusizP0->getWidth() + 5;
myNusizP0Text = new EditTextWidget(boss, nfont, xpos, ypos, 23*fontWidth,
lineHeight, "");
myNusizP0Text->setEditable(false);
myNusizP0Text->setEditable(false, true);
////////////////////////////
// P1 register info
@ -304,7 +304,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
xpos += myNusizP1->getWidth() + 5;
myNusizP1Text = new EditTextWidget(boss, nfont, xpos, ypos, 23*fontWidth,
lineHeight, "");
myNusizP1Text->setEditable(false);
myNusizP1Text->setEditable(false, true);
////////////////////////////
// M0 register info

View File

@ -101,14 +101,22 @@ void ToggleBitWidget::drawWidget(bool hilite)
else
buffer = _offList[pos];
// Highlight changes
if(_changedList[pos])
if(isEditable())
{
s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1, kDbgChangedColor);
s.drawString(_font, buffer, x, y, _colWidth, kDbgChangedTextColor);
// Highlight changes
if(_changedList[pos])
{
s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1, kDbgChangedColor);
s.drawString(_font, buffer, x, y, _colWidth, kDbgChangedTextColor);
}
else
s.drawString(_font, buffer, x, y, _colWidth, kTextColor);
}
else
{
s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1, kBGColorLo);
s.drawString(_font, buffer, x, y, _colWidth, kTextColor);
}
}
}
}

View File

@ -43,6 +43,7 @@ class ToggleWidget : public Widget, public CommandSender
int colWidth() const { return _colWidth; }
void setEditable(bool editable) { _editable = editable; }
bool isEditable() const { return _editable; }
protected:

View File

@ -885,6 +885,7 @@ void FrameBuffer::VideoModeList::setZoom(uInt32 zoom)
// Base colors
kColor Normal foreground color (non-text)
kBGColor Normal background color (non-text)
kBGColorLo Disabled background color (non-text)
kShadowColor Item is disabled
kTextColor Normal text color
kTextColorHi Highlighted text color
@ -915,7 +916,7 @@ void FrameBuffer::VideoModeList::setZoom(uInt32 zoom)
*/
uInt32 FrameBuffer::ourGUIColors[2][kNumColors-256] = {
// Standard
{ 0x686868, 0x000000, 0x404040, 0x000000, 0x62a108, 0x9f0000,
{ 0x686868, 0x000000, 0xd8d8d8, 0x404040, 0x000000, 0x62a108, 0x9f0000,
0xc9af7c, 0xf0f0cf, 0xc80000,
0xac3410, 0xd55941, 0xffffff, 0xffd652,
0xac3410,
@ -925,7 +926,7 @@ uInt32 FrameBuffer::ourGUIColors[2][kNumColors-256] = {
},
// Classic
{ 0x686868, 0x000000, 0x404040, 0x20a020, 0x00ff00, 0xc80000,
{ 0x686868, 0x000000, 0x404040, 0x404040, 0x20a020, 0x00ff00, 0xc80000,
0x000000, 0x000000, 0xc80000,
0x000000, 0x000000, 0x20a020, 0x00ff00,
0x20a020,

View File

@ -61,6 +61,7 @@ enum MessagePosition {
enum {
kColor = 256,
kBGColor,
kBGColorLo,
kShadowColor,
kTextColor,
kTextColorHi,

View File

@ -61,13 +61,19 @@ void EditableWidget::setText(const string& str, bool)
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EditableWidget::setEditable(bool editable)
void EditableWidget::setEditable(bool editable, bool hiliteBG)
{
_editable = editable;
if(_editable)
{
setFlags(WIDGET_WANTS_RAWDATA | WIDGET_RETAIN_FOCUS);
_bgcolor = kWidColor;
}
else
{
clearFlags(WIDGET_WANTS_RAWDATA | WIDGET_RETAIN_FOCUS);
_bgcolor = hiliteBG ? kBGColorLo : kWidColor;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -52,7 +52,7 @@ class EditableWidget : public Widget, public CommandSender
const string& getText() const { return _editString; }
bool isEditable() const { return _editable; }
void setEditable(bool editable);
void setEditable(bool editable, bool hiliteBG = false);
bool handleText(char text) override;
bool handleKeyDown(StellaKey key, StellaMod mod) override;

View File

@ -486,8 +486,15 @@ void CheckboxWidget::handleMouseUp(int x, int y, int button, int clickCount)
void CheckboxWidget::setEditable(bool editable)
{
_editable = editable;
if(!_editable)
if(_editable)
{
_bgcolor = kWidColor;
}
else
{
_bgcolor = kBGColorLo;
setFill(CheckboxWidget::Inactive);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -