diff --git a/src/debugger/gui/AudioWidget.cxx b/src/debugger/gui/AudioWidget.cxx index b22d74d1a..8d2a7315c 100644 --- a/src/debugger/gui/AudioWidget.cxx +++ b/src/debugger/gui/AudioWidget.cxx @@ -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); } diff --git a/src/debugger/gui/CpuWidget.cxx b/src/debugger/gui/CpuWidget.cxx index 01c62e4b1..65c7124de 100644 --- a/src/debugger/gui/CpuWidget.cxx +++ b/src/debugger/gui/CpuWidget.cxx @@ -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"); diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx index d3bfcd057..7c835e92e 100644 --- a/src/debugger/gui/DebuggerDialog.cxx +++ b/src/debugger/gui/DebuggerDialog.cxx @@ -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); } diff --git a/src/debugger/gui/RamWidget.cxx b/src/debugger/gui/RamWidget.cxx index 0536e9995..f578581af 100644 --- a/src/debugger/gui/RamWidget.cxx +++ b/src/debugger/gui/RamWidget.cxx @@ -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: " }; diff --git a/src/debugger/gui/RiotWidget.cxx b/src/debugger/gui/RiotWidget.cxx index 95a8be853..dc93c590b 100644 --- a/src/debugger/gui/RiotWidget.cxx +++ b/src/debugger/gui/RiotWidget.cxx @@ -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; diff --git a/src/debugger/gui/TiaInfoWidget.cxx b/src/debugger/gui/TiaInfoWidget.cxx index d4e8f57ac..c3ed6655f 100644 --- a/src/debugger/gui/TiaInfoWidget.cxx +++ b/src/debugger/gui/TiaInfoWidget.cxx @@ -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; diff --git a/src/debugger/gui/TiaWidget.cxx b/src/debugger/gui/TiaWidget.cxx index cf2974111..cd09131f1 100644 --- a/src/debugger/gui/TiaWidget.cxx +++ b/src/debugger/gui/TiaWidget.cxx @@ -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 diff --git a/src/debugger/gui/ToggleBitWidget.cxx b/src/debugger/gui/ToggleBitWidget.cxx index d4fc2bf13..3ed6ce4d6 100644 --- a/src/debugger/gui/ToggleBitWidget.cxx +++ b/src/debugger/gui/ToggleBitWidget.cxx @@ -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); + } } } } diff --git a/src/debugger/gui/ToggleWidget.hxx b/src/debugger/gui/ToggleWidget.hxx index 7b121410d..eb264972b 100644 --- a/src/debugger/gui/ToggleWidget.hxx +++ b/src/debugger/gui/ToggleWidget.hxx @@ -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: diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index 9e4884fbf..fc2a70e89 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -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, diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx index 39da7d7ab..7e055beb1 100644 --- a/src/emucore/FrameBuffer.hxx +++ b/src/emucore/FrameBuffer.hxx @@ -61,6 +61,7 @@ enum MessagePosition { enum { kColor = 256, kBGColor, + kBGColorLo, kShadowColor, kTextColor, kTextColorHi, diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx index f3217c4c0..ad3dc477e 100644 --- a/src/gui/EditableWidget.cxx +++ b/src/gui/EditableWidget.cxx @@ -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; + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/EditableWidget.hxx b/src/gui/EditableWidget.hxx index 8abf209aa..3fb35c5dd 100644 --- a/src/gui/EditableWidget.hxx +++ b/src/gui/EditableWidget.hxx @@ -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; diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx index d10c6a59b..bb9ab44a3 100644 --- a/src/gui/Widget.cxx +++ b/src/gui/Widget.cxx @@ -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); + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -