even more background dialog widget color adjustments

This commit is contained in:
thrust26 2018-08-06 17:14:22 +02:00
parent 0b04b130f9
commit 573d9a1e25
9 changed files with 38 additions and 29 deletions

View File

@ -593,9 +593,10 @@ void DataGridWidget::handleCommand(CommandSender* sender, int cmd,
void DataGridWidget::drawWidget(bool hilite)
{
FBSurface& s = _boss->dialog().surface();
bool onTop = _boss->dialog().isOnTop();
int row, col;
s.fillRect(_x, _y, _w, _h, hilite && isEnabled() && isEditable() ? _bgcolorhi : _bgcolor);
s.fillRect(_x, _y, _w, _h, hilite && isEnabled() && isEditable() ? _bgcolorhi : onTop ? _bgcolor : _bgcolorlo);
// Draw the internal grid and labels
int linewidth = _cols * _colWidth;
s.frameRect(_x, _y, _w, _h, hilite && isEnabled() && isEditable() ? kWidColorHi : kColor);
@ -614,7 +615,7 @@ void DataGridWidget::drawWidget(bool hilite)
int x = _x + 4 + (col * _colWidth);
int y = _y + 2 + (row * _rowHeight);
int pos = row*_cols + col;
uInt32 textColor = kTextColor;
uInt32 textColor = onTop ? kTextColor : kColor;
// Draw the selected item inverted, on a highlighted background.
if (_currentRow == row && _currentCol == col &&
@ -634,12 +635,12 @@ void DataGridWidget::drawWidget(bool hilite)
{
if(_changedList[pos])
{
s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1, kDbgChangedColor);
s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1, onTop ? kDbgChangedColor : _bgcolorlo);
if(_hiliteList[pos])
textColor = kDbgColorHi;
else
textColor = kDbgChangedTextColor;
textColor = onTop ? kDbgChangedTextColor : textColor;
}
else if(_hiliteList[pos])
textColor = kDbgColorHi;

View File

@ -45,6 +45,7 @@ PromptWidget::PromptWidget(GuiObject* boss, const GUI::Font& font,
WIDGET_WANTS_TAB | WIDGET_WANTS_RAWDATA;
_textcolor = kTextColor;
_bgcolor = kWidColor;
_bgcolorlo = kDlgColor;
_kConsoleCharWidth = font.getMaxCharWidth();
_kConsoleCharHeight = font.getFontHeight();
@ -74,6 +75,7 @@ void PromptWidget::drawWidget(bool hilite)
uInt32 fgcolor, bgcolor;
FBSurface& s = _boss->dialog().surface();
bool onTop = _boss->dialog().isOnTop();
// Draw text
int start = _scrollLine - _linesPerPage + 1;
@ -94,7 +96,7 @@ void PromptWidget::drawWidget(bool hilite)
else
fgcolor = c >> 8;
s.drawChar(_font, c & 0x7f, x, y, fgcolor);
s.drawChar(_font, c & 0x7f, x, y, onTop ? fgcolor : kColor);
x += _kConsoleCharWidth;
}
y += _kConsoleLineHeight;

View File

@ -465,8 +465,10 @@ void RomListWidget::lostFocusWidget()
void RomListWidget::drawWidget(bool hilite)
{
FBSurface& s = _boss->dialog().surface();
bool onTop = _boss->dialog().isOnTop();
const CartDebug::DisassemblyList& dlist = myDisasm->list;
int i, pos, xpos, ypos, len = int(dlist.size());
uInt32 textColor = onTop ? kTextColor : kColor;
const GUI::Rect& r = getEditRect();
const GUI::Rect& l = getLineRect();
@ -487,7 +489,7 @@ void RomListWidget::drawWidget(bool hilite)
xpos = _x + CheckboxWidget::boxSize() + 10; ypos = _y + 2;
for (i = 0, pos = _currentPos; i < _rows && pos < len; i++, pos++, ypos += _fontHeight)
{
uInt32 bytesColor = kTextColor;
uInt32 bytesColor = textColor;
// Draw checkboxes for correct lines (takes scrolling into account)
myCheckList[i]->setState(myBPState->isSet(dlist[pos].address));
@ -496,7 +498,7 @@ void RomListWidget::drawWidget(bool hilite)
// Draw highlighted item in a frame
if (_highlightedItem == pos)
s.frameRect(_x + l.x() - 3, ypos - 1, _w - l.x(), _fontHeight, kWidColorHi);
s.frameRect(_x + l.x() - 3, ypos - 1, _w - l.x(), _fontHeight, onTop ? kWidColorHi : kBGColorLo);
// Draw the selected item inverted, on a highlighted background.
if(_selectedItem == pos && _hasFocus)
@ -512,7 +514,7 @@ void RomListWidget::drawWidget(bool hilite)
// Draw labels
s.drawString(_font, dlist[pos].label, xpos, ypos, _labelWidth,
dlist[pos].hllabel ? kTextColor : kColor);
dlist[pos].hllabel ? textColor : kColor);
// Bytes are only editable if they represent code, graphics, or accessible data
// Otherwise, the disassembly should get all remaining space
@ -522,14 +524,14 @@ void RomListWidget::drawWidget(bool hilite)
{
// Draw mnemonic
s.drawString(_font, dlist[pos].disasm.substr(0, 7), xpos + _labelWidth, ypos,
7 * _fontWidth, kTextColor);
7 * _fontWidth, textColor);
// Draw operand
if (dlist[pos].disasm.length() > 8)
s.drawString(_font, dlist[pos].disasm.substr(8), xpos + _labelWidth + 7 * _fontWidth, ypos,
codeDisasmW - 7 * _fontWidth, kTextColor);
codeDisasmW - 7 * _fontWidth, textColor);
// Draw cycle count
s.drawString(_font, dlist[pos].ccount, xpos + _labelWidth + codeDisasmW, ypos,
cycleCountW, kTextColor);
cycleCountW, textColor);
}
else
{
@ -546,7 +548,7 @@ void RomListWidget::drawWidget(bool hilite)
if (_selectedItem == pos && _editMode)
{
adjustOffset();
s.drawString(_font, editString(), _x + r.x(), ypos, r.width(), kTextColor,
s.drawString(_font, editString(), _x + r.x(), ypos, r.width(), textColor,
TextAlign::Left, -_editScrollOffset, false);
drawCaret();
@ -561,7 +563,7 @@ void RomListWidget::drawWidget(bool hilite)
{
// Draw disassembly, giving it all remaining horizontal space
s.drawString(_font, dlist[pos].disasm, xpos + _labelWidth, ypos,
noTypeDisasmW, kTextColor);
noTypeDisasmW, textColor);
}
}
}

View File

@ -73,6 +73,7 @@ void ToggleBitWidget::drawWidget(bool hilite)
{
//cerr << "ToggleBitWidget::drawWidget\n";
FBSurface& s = dialog().surface();
bool onTop = _boss->dialog().isOnTop();
int row, col;
string buffer;
@ -114,11 +115,11 @@ void ToggleBitWidget::drawWidget(bool hilite)
// Highlight changes
if(_changedList[pos])
{
s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1, kDbgChangedColor);
s.drawString(_font, buffer, x, y, _colWidth, kDbgChangedTextColor);
s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1, onTop ? kDbgChangedColor : _bgcolorlo);
s.drawString(_font, buffer, x, y, _colWidth, onTop ? kDbgChangedTextColor : kColor);
}
else
s.drawString(_font, buffer, x, y, _colWidth, textColor);
s.drawString(_font, buffer, x, y, _colWidth, onTop ? textColor : kColor);
}
else
{

View File

@ -46,12 +46,13 @@ void ColorWidget::setColor(int color)
void ColorWidget::drawWidget(bool hilite)
{
FBSurface& s = dialog().surface();
bool onTop = _boss->dialog().isOnTop();
// Draw a thin frame around us.
s.frameRect(_x, _y, _w, _h + 1, kColor);
// Show the currently selected color
s.fillRect(_x+1, _y+1, _w-2, _h-1, isEnabled() ? _color : kWidColor);
s.fillRect(_x+1, _y+1, _w-2, _h-1, onTop ? isEnabled() ? _color : kWidColor : kDlgColor);
// Cross out the grid?
if(_crossGrid)

View File

@ -83,7 +83,7 @@ void EditTextWidget::drawWidget(bool hilite)
bool onTop = _boss->dialog().isOnTop();
// Highlight changes
if(_changed)
if(_changed && onTop)
s.fillRect(_x, _y, _w, _h, kDbgChangedColor);
else if(!isEditable())
s.fillRect(_x, _y, _w, _h, onTop ? kDlgColor : kBGColorLo);
@ -94,9 +94,9 @@ void EditTextWidget::drawWidget(bool hilite)
// Draw the text
adjustOffset();
s.drawString(_font, editString(), _x + 2, _y + 2, getEditRect().width(),
!_changed
? onTop ? _textcolor : kColor
: uInt32(kDbgChangedTextColor),
_changed && onTop
? uInt32(kDbgChangedTextColor)
: onTop ? _textcolor : kColor,
TextAlign::Left, -_editScrollOffset, false);
// Draw the caret

View File

@ -198,6 +198,7 @@ void PopUpWidget::drawWidget(bool hilite)
{
//cerr << "PopUpWidget::drawWidget\n";
FBSurface& s = dialog().surface();
bool onTop = _boss->dialog().isOnTop();
int x = _x + _labelWidth;
int w = _w - _labelWidth;
@ -205,23 +206,23 @@ void PopUpWidget::drawWidget(bool hilite)
// Draw the label, if any
if(_labelWidth > 0)
s.drawString(_font, _label, _x, _y + myTextY, _labelWidth,
isEnabled() ? _textcolor : uInt32(kColor), TextAlign::Left);
isEnabled() && onTop ? _textcolor : uInt32(kColor), TextAlign::Left);
// Draw a thin frame around us.
s.frameRect(x, _y, w, _h, isEnabled() && hilite ? kWidColorHi : kColor);
s.frameRect(x + w - 16, _y + 1, 15, _h - 2, isEnabled() && hilite ? kWidColorHi : kBGColorLo);
// Fill the background
s.fillRect(x + 1, _y + 1, w - 17, _h - 2, _changed ? kDbgChangedColor : kWidColor);
s.fillRect(x + w - 15, _y + 2, 13, _h - 4, isEnabled() && hilite ? kWidColor : kBGColorHi);
s.fillRect(x + 1, _y + 1, w - 17, _h - 2, onTop ? _changed ? kDbgChangedColor : kWidColor : kDlgColor);
s.fillRect(x + w - 15, _y + 2, 13, _h - 4, onTop ? isEnabled() && hilite ? kWidColor : kBGColorHi : kBGColorLo);
// Draw an arrow pointing down at the right end to signal this is a dropdown/popup
s.drawBitmap(down_arrow, x + w - 13, _y + myArrowsY + 1,
!isEnabled() ? kColor : kTextColor, 9u, 8u);
!(isEnabled() && onTop) ? kColor : kTextColor, 9u, 8u);
// Draw the selected entry, if any
const string& name = myMenu->getSelectedName();
TextAlign align = (_font.getStringWidth(name) > w-6) ?
TextAlign::Right : TextAlign::Left;
s.drawString(_font, name, x+2, _y+myTextY, w-6,
!isEnabled() ? kColor : kTextColor, align);
!(isEnabled() && onTop) ? kColor : kTextColor, align);
}

View File

@ -249,6 +249,7 @@ void ScrollBarWidget::drawWidget(bool hilite)
{
//cerr << "ScrollBarWidget::drawWidget\n";
FBSurface& s = _boss->dialog().surface();
bool onTop = _boss->dialog().isOnTop();
int bottomY = _y + _h;
bool isSinglePage = (_numEntries <= _entriesPerPage);
@ -273,7 +274,7 @@ void ScrollBarWidget::drawWidget(bool hilite)
if(!isSinglePage)
{
s.fillRect(_x + 1, _y + _sliderPos - 1, _w - 2, _sliderHeight + 2,
(hilite && _part == kSliderPart) ? kScrollColorHi : kScrollColor);
onTop ? (hilite && _part == kSliderPart) ? kScrollColorHi : kScrollColor : kColor);
}
}

View File

@ -645,8 +645,8 @@ void CheckboxWidget::drawWidget(bool hilite)
if(_drawBox)
s.frameRect(_x, _y + _boxY, 14, 14, onTop && hilite && isEnabled() && isEditable() ? kWidColorHi : kColor);
// Do we draw a square or cross?
s.fillRect(_x + 1, _y + _boxY + 1, 12, 12, _changed ? uInt32(kDbgChangedColor)
: isEnabled() ? _bgcolor : uInt32(kColor));
s.fillRect(_x + 1, _y + _boxY + 1, 12, 12, _changed ? onTop ? uInt32(kDbgChangedColor) : kDlgColor
: isEnabled() ? onTop ? _bgcolor : kDlgColor : uInt32(kColor));
if(_state)
s.drawBitmap(_img, _x + 2, _y + _boxY + 2, onTop && isEnabled() ? hilite && isEditable() ? kWidColorHi : kCheckColor
: kColor, 10);