Skip to content

Commit

Permalink
Non-editable UI items in the debugger are now shown with a different …
Browse files Browse the repository at this point in the history
…background color.
  • Loading branch information
sa666666 committed Apr 1, 2017
1 parent 58f93c1 commit 3e5df9c
Show file tree
Hide file tree
Showing 14 changed files with 51 additions and 27 deletions.
6 changes: 3 additions & 3 deletions src/debugger/gui/AudioWidget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions src/debugger/gui/CpuWidget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/debugger/gui/DebuggerDialog.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/debugger/gui/RamWidget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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: " };
Expand Down
6 changes: 3 additions & 3 deletions src/debugger/gui/RiotWidget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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:" };
Expand All @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions src/debugger/gui/TiaInfoWidget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ 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,
longstr ? "Frame Cycle:" : "F. Cycle:",
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);
Expand All @@ -73,31 +73,31 @@ 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,
longstr ? "Scan Cycle:" : "S. Cycle:", kTextAlignLeft);

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,
"Pixel Pos:", kTextAlignLeft);

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,
longstr ? "Color Clock:" : "Color Clk:", kTextAlignLeft);

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;
Expand Down
4 changes: 2 additions & 2 deletions src/debugger/gui/TiaWidget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 12 additions & 4 deletions src/debugger/gui/ToggleBitWidget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}
1 change: 1 addition & 0 deletions src/debugger/gui/ToggleWidget.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
5 changes: 3 additions & 2 deletions src/emucore/FrameBuffer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/emucore/FrameBuffer.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ enum MessagePosition {
enum {
kColor = 256,
kBGColor,
kBGColorLo,
kShadowColor,
kTextColor,
kTextColorHi,
Expand Down
8 changes: 7 additions & 1 deletion src/gui/EditableWidget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down
2 changes: 1 addition & 1 deletion src/gui/EditableWidget.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 8 additions & 1 deletion src/gui/Widget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down

0 comments on commit 3e5df9c

Please sign in to comment.