mirror of https://github.com/stella-emu/stella.git
Fixed inconsistency in passing color data to parameters.
- Now uses 'ColorId' as the datatype; this is currently mapped to uInt32, but can change in the future if required - Eliminates needless and annoying casts in various places; all colors are now 'ColorId' type
This commit is contained in:
parent
f7d09c772d
commit
8298ad4d26
|
@ -46,7 +46,7 @@ FBSurfaceSDL2::~FBSurfaceSDL2()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurfaceSDL2::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, uInt32 color)
|
||||
void FBSurfaceSDL2::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, ColorId color)
|
||||
{
|
||||
// Fill the rectangle
|
||||
SDL_Rect tmp;
|
||||
|
|
|
@ -38,7 +38,7 @@ class FBSurfaceSDL2 : public FBSurface
|
|||
// Most of the surface drawing primitives are implemented in FBSurface;
|
||||
// the ones implemented here use SDL-specific code for extra performance
|
||||
//
|
||||
void fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, uInt32 color) override;
|
||||
void fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, ColorId color) override;
|
||||
// With hardware surfaces, it's faster to just update the entire surface
|
||||
void setDirty() override { mySurfaceIsDirty = true; }
|
||||
|
||||
|
|
|
@ -615,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 = onTop ? kTextColor : kColor;
|
||||
ColorId textColor = onTop ? kTextColor : kColor;
|
||||
|
||||
// Draw the selected item inverted, on a highlighted background.
|
||||
if (_currentRow == row && _currentCol == col &&
|
||||
|
@ -636,12 +636,12 @@ void DataGridWidget::drawWidget(bool hilite)
|
|||
if(_changedList[pos])
|
||||
{
|
||||
s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1,
|
||||
onTop ? uInt32(kDbgChangedColor) : _bgcolorlo);
|
||||
onTop ? kDbgChangedColor : _bgcolorlo);
|
||||
|
||||
if(_hiliteList[pos])
|
||||
textColor = kDbgColorHi;
|
||||
else
|
||||
textColor = onTop ? uInt32(kDbgChangedTextColor) : textColor;
|
||||
textColor = onTop ? kDbgChangedTextColor : textColor;
|
||||
}
|
||||
else if(_hiliteList[pos])
|
||||
textColor = kDbgColorHi;
|
||||
|
|
|
@ -72,7 +72,7 @@ PromptWidget::PromptWidget(GuiObject* boss, const GUI::Font& font,
|
|||
void PromptWidget::drawWidget(bool hilite)
|
||||
{
|
||||
//cerr << "PromptWidget::drawWidget\n";
|
||||
uInt32 fgcolor, bgcolor;
|
||||
ColorId fgcolor, bgcolor;
|
||||
|
||||
FBSurface& s = _boss->dialog().surface();
|
||||
bool onTop = _boss->dialog().isOnTop();
|
||||
|
@ -90,13 +90,13 @@ void PromptWidget::drawWidget(bool hilite)
|
|||
if(c & (1 << 17)) // inverse video flag
|
||||
{
|
||||
fgcolor = _bgcolor;
|
||||
bgcolor = (c & 0x1ffff) >> 8;
|
||||
bgcolor = ColorId((c & 0x1ffff) >> 8);
|
||||
s.fillRect(x, y, _kConsoleCharWidth, _kConsoleCharHeight, bgcolor);
|
||||
}
|
||||
else
|
||||
fgcolor = c >> 8;
|
||||
fgcolor = ColorId(c >> 8);
|
||||
|
||||
s.drawChar(_font, c & 0x7f, x, y, onTop ? fgcolor : uInt32(kColor));
|
||||
s.drawChar(_font, c & 0x7f, x, y, onTop ? fgcolor : kColor);
|
||||
x += _kConsoleCharWidth;
|
||||
}
|
||||
y += _kConsoleLineHeight;
|
||||
|
@ -833,13 +833,11 @@ void PromptWidget::putcharIntern(int c)
|
|||
nextLine();
|
||||
else if(c & 0x80) { // set foreground color to TIA color
|
||||
// don't print or advance cursor
|
||||
// there are only 128 TIA colors, but
|
||||
// OverlayColor contains 256 of them
|
||||
_textcolor = (c & 0x7f) << 1;
|
||||
_textcolor = ColorId((c & 0x7f) << 1);
|
||||
}
|
||||
else if(c && c < 0x1e) { // first actual character is large dash
|
||||
// More colors (the regular GUI ones)
|
||||
_textcolor = c + 0x100;
|
||||
_textcolor = ColorId(c + 0x100);
|
||||
}
|
||||
else if(c == 0x7f) { // toggle inverse video (DEL char)
|
||||
_inverse = !_inverse;
|
||||
|
|
|
@ -468,7 +468,7 @@ void RomListWidget::drawWidget(bool hilite)
|
|||
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;
|
||||
ColorId textColor = onTop ? kTextColor : kColor;
|
||||
|
||||
const GUI::Rect& r = getEditRect();
|
||||
const GUI::Rect& l = getLineRect();
|
||||
|
@ -489,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 = textColor;
|
||||
ColorId bytesColor = textColor;
|
||||
|
||||
// Draw checkboxes for correct lines (takes scrolling into account)
|
||||
myCheckList[i]->setState(myBPState->isSet(dlist[pos].address));
|
||||
|
@ -514,7 +514,7 @@ void RomListWidget::drawWidget(bool hilite)
|
|||
|
||||
// Draw labels
|
||||
s.drawString(_font, dlist[pos].label, xpos, ypos, _labelWidth,
|
||||
dlist[pos].hllabel ? textColor : uInt32(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
|
||||
|
|
|
@ -273,7 +273,7 @@ void TiaZoomWidget::drawWidget(bool hilite)
|
|||
for(x = myXOff, col = 0; x < myNumCols+myXOff; ++x, col += wzoom)
|
||||
{
|
||||
uInt32 idx = y*width + x;
|
||||
uInt32 color = currentFrame[idx] | (idx > scanoffset ? 1 : 0);
|
||||
ColorId color = ColorId(currentFrame[idx] | (idx > scanoffset ? 1 : 0));
|
||||
s.fillRect(_x + col + 1, _y + row + 1, wzoom, hzoom, color);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ void ToggleBitWidget::drawWidget(bool hilite)
|
|||
{
|
||||
for (col = 0; col < _cols; col++)
|
||||
{
|
||||
uInt32 textColor = kTextColor;
|
||||
ColorId textColor = kTextColor;
|
||||
int x = _x + 4 + (col * _colWidth);
|
||||
int y = _y + 2 + (row * _rowHeight);
|
||||
int pos = row*_cols + col;
|
||||
|
|
|
@ -28,11 +28,11 @@ class TogglePixelWidget : public ToggleWidget
|
|||
int x, int y, int cols, int rows);
|
||||
virtual ~TogglePixelWidget() = default;
|
||||
|
||||
void setColor(int color) {
|
||||
_pixelColor = (color >= 0 && color <= kNumColors) ? color : kDlgColor;
|
||||
void setColor(ColorId color) {
|
||||
_pixelColor = color <= kNumColors ? color : kDlgColor;
|
||||
}
|
||||
void setBackgroundColor(int color) {
|
||||
_backgroundColor = (color >= 0 && color <= kNumColors) ? color : kDlgColor;
|
||||
void setBackgroundColor(ColorId color) {
|
||||
_backgroundColor = color <= kNumColors ? color : kDlgColor;
|
||||
}
|
||||
void setState(const BoolArray& state);
|
||||
|
||||
|
@ -42,7 +42,7 @@ class TogglePixelWidget : public ToggleWidget
|
|||
void setCrossed(bool enable) { _crossBits = enable; }
|
||||
|
||||
private:
|
||||
int _pixelColor, _backgroundColor;
|
||||
ColorId _pixelColor, _backgroundColor;
|
||||
bool _swapBits;
|
||||
bool _crossBits;
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ void FBSurface::readPixels(uInt8* buffer, uInt32 pitch, const GUI::Rect& rect) c
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurface::pixel(uInt32 x, uInt32 y, uInt32 color)
|
||||
void FBSurface::pixel(uInt32 x, uInt32 y, ColorId color)
|
||||
{
|
||||
uInt32* buffer = myPixels + y * myPitch + x;
|
||||
|
||||
|
@ -68,7 +68,7 @@ void FBSurface::pixel(uInt32 x, uInt32 y, uInt32 color)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurface::line(uInt32 x, uInt32 y, uInt32 x2, uInt32 y2, uInt32 color)
|
||||
void FBSurface::line(uInt32 x, uInt32 y, uInt32 x2, uInt32 y2, ColorId color)
|
||||
{
|
||||
// draw line using Bresenham algorithm
|
||||
Int32 dx = (x2 - x);
|
||||
|
@ -127,7 +127,7 @@ void FBSurface::line(uInt32 x, uInt32 y, uInt32 x2, uInt32 y2, uInt32 color)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurface::hLine(uInt32 x, uInt32 y, uInt32 x2, uInt32 color)
|
||||
void FBSurface::hLine(uInt32 x, uInt32 y, uInt32 x2, ColorId color)
|
||||
{
|
||||
uInt32* buffer = myPixels + y * myPitch + x;
|
||||
while(x++ <= x2)
|
||||
|
@ -135,7 +135,7 @@ void FBSurface::hLine(uInt32 x, uInt32 y, uInt32 x2, uInt32 color)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurface::vLine(uInt32 x, uInt32 y, uInt32 y2, uInt32 color)
|
||||
void FBSurface::vLine(uInt32 x, uInt32 y, uInt32 y2, ColorId color)
|
||||
{
|
||||
uInt32* buffer = static_cast<uInt32*>(myPixels + y * myPitch + x);
|
||||
while(y++ <= y2)
|
||||
|
@ -146,7 +146,7 @@ void FBSurface::vLine(uInt32 x, uInt32 y, uInt32 y2, uInt32 color)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurface::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, uInt32 color)
|
||||
void FBSurface::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, ColorId color)
|
||||
{
|
||||
while(h--)
|
||||
hLine(x, y+h, x+w-1, color);
|
||||
|
@ -154,9 +154,9 @@ void FBSurface::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, uInt32 color)
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurface::drawChar(const GUI::Font& font, uInt8 chr,
|
||||
uInt32 tx, uInt32 ty, uInt32 color, uInt32 shadowColor)
|
||||
uInt32 tx, uInt32 ty, ColorId color, ColorId shadowColor)
|
||||
{
|
||||
if(shadowColor != 0)
|
||||
if(shadowColor != kNone)
|
||||
{
|
||||
drawChar(font, chr, tx + 1, ty + 0, shadowColor);
|
||||
drawChar(font, chr, tx + 0, ty + 1, shadowColor);
|
||||
|
@ -208,14 +208,14 @@ void FBSurface::drawChar(const GUI::Font& font, uInt8 chr,
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurface::drawBitmap(uInt32* bitmap, uInt32 tx, uInt32 ty,
|
||||
uInt32 color, uInt32 h)
|
||||
ColorId color, uInt32 h)
|
||||
{
|
||||
drawBitmap(bitmap, tx, ty, color, h, h);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurface::drawBitmap(uInt32* bitmap, uInt32 tx, uInt32 ty,
|
||||
uInt32 color, uInt32 w, uInt32 h)
|
||||
ColorId color, uInt32 w, uInt32 h)
|
||||
{
|
||||
uInt32* buffer = myPixels + ty * myPitch + tx;
|
||||
|
||||
|
@ -241,7 +241,7 @@ void FBSurface::drawPixels(uInt32* data, uInt32 tx, uInt32 ty, uInt32 numpixels)
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurface::box(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
||||
uInt32 colorA, uInt32 colorB)
|
||||
ColorId colorA, ColorId colorB)
|
||||
{
|
||||
hLine(x + 1, y, x + w - 2, colorA);
|
||||
hLine(x, y + 1, x + w - 1, colorA);
|
||||
|
@ -256,7 +256,7 @@ void FBSurface::box(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurface::frameRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
||||
uInt32 color, FrameStyle style)
|
||||
ColorId color, FrameStyle style)
|
||||
{
|
||||
switch(style)
|
||||
{
|
||||
|
@ -285,8 +285,8 @@ void FBSurface::frameRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurface::drawString(const GUI::Font& font, const string& s,
|
||||
int x, int y, int w,
|
||||
uInt32 color, TextAlign align,
|
||||
int deltax, bool useEllipsis, uInt32 shadowColor)
|
||||
ColorId color, TextAlign align,
|
||||
int deltax, bool useEllipsis, ColorId shadowColor)
|
||||
{
|
||||
const string ELLIPSIS = "\x1d"; // "..."
|
||||
const int leftX = x, rightX = x + w;
|
||||
|
|
|
@ -79,7 +79,7 @@ class FBSurface
|
|||
@param y The y coordinate
|
||||
@param color The color of the line
|
||||
*/
|
||||
virtual void pixel(uInt32 x, uInt32 y, uInt32 color);
|
||||
virtual void pixel(uInt32 x, uInt32 y, ColorId color);
|
||||
|
||||
/**
|
||||
This method should be called to draw a line.
|
||||
|
@ -90,7 +90,7 @@ class FBSurface
|
|||
@param y2 The second y coordinate
|
||||
@param color The color of the line
|
||||
*/
|
||||
virtual void line(uInt32 x, uInt32 y, uInt32 x2, uInt32 y2, uInt32 color);
|
||||
virtual void line(uInt32 x, uInt32 y, uInt32 x2, uInt32 y2, ColorId color);
|
||||
|
||||
/**
|
||||
This method should be called to draw a horizontal line.
|
||||
|
@ -100,7 +100,7 @@ class FBSurface
|
|||
@param x2 The second x coordinate
|
||||
@param color The color of the line
|
||||
*/
|
||||
virtual void hLine(uInt32 x, uInt32 y, uInt32 x2, uInt32 color);
|
||||
virtual void hLine(uInt32 x, uInt32 y, uInt32 x2, ColorId color);
|
||||
|
||||
/**
|
||||
This method should be called to draw a vertical line.
|
||||
|
@ -110,7 +110,7 @@ class FBSurface
|
|||
@param y2 The second y coordinate
|
||||
@param color The color of the line
|
||||
*/
|
||||
virtual void vLine(uInt32 x, uInt32 y, uInt32 y2, uInt32 color);
|
||||
virtual void vLine(uInt32 x, uInt32 y, uInt32 y2, ColorId color);
|
||||
|
||||
/**
|
||||
This method should be called to draw a filled rectangle.
|
||||
|
@ -122,7 +122,7 @@ class FBSurface
|
|||
@param color The fill color of the rectangle
|
||||
*/
|
||||
virtual void fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
||||
uInt32 color);
|
||||
ColorId color);
|
||||
|
||||
/**
|
||||
This method should be called to draw the specified character.
|
||||
|
@ -134,7 +134,7 @@ class FBSurface
|
|||
@param color The color of the character
|
||||
*/
|
||||
virtual void drawChar(const GUI::Font& font, uInt8 c, uInt32 x, uInt32 y,
|
||||
uInt32 color, uInt32 shadowColor = 0);
|
||||
ColorId color, ColorId shadowColor = kNone);
|
||||
|
||||
/**
|
||||
This method should be called to draw the bitmap image.
|
||||
|
@ -145,7 +145,7 @@ class FBSurface
|
|||
@param color The color of the bitmap
|
||||
@param h The height of the data image
|
||||
*/
|
||||
virtual void drawBitmap(uInt32* bitmap, uInt32 x, uInt32 y, uInt32 color,
|
||||
virtual void drawBitmap(uInt32* bitmap, uInt32 x, uInt32 y, ColorId color,
|
||||
uInt32 h = 8);
|
||||
|
||||
/**
|
||||
|
@ -158,7 +158,7 @@ class FBSurface
|
|||
@param w The width of the data image
|
||||
@param h The height of the data image
|
||||
*/
|
||||
virtual void drawBitmap(uInt32* bitmap, uInt32 x, uInt32 y, uInt32 color,
|
||||
virtual void drawBitmap(uInt32* bitmap, uInt32 x, uInt32 y, ColorId color,
|
||||
uInt32 w, uInt32 h);
|
||||
|
||||
/**
|
||||
|
@ -185,7 +185,7 @@ class FBSurface
|
|||
@param colorB Darker color for inside line.
|
||||
*/
|
||||
virtual void box(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
||||
uInt32 colorA, uInt32 colorB);
|
||||
ColorId colorA, ColorId colorB);
|
||||
|
||||
/**
|
||||
This method should be called to draw a framed rectangle with
|
||||
|
@ -199,7 +199,7 @@ class FBSurface
|
|||
@param style The 'FrameStyle' to use for the surrounding frame
|
||||
*/
|
||||
virtual void frameRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
||||
uInt32 color, FrameStyle style = FrameStyle::Solid);
|
||||
ColorId color, FrameStyle style = FrameStyle::Solid);
|
||||
|
||||
/**
|
||||
This method should be called to draw the specified string.
|
||||
|
@ -216,8 +216,8 @@ class FBSurface
|
|||
*/
|
||||
virtual void drawString(
|
||||
const GUI::Font& font, const string& s, int x, int y, int w,
|
||||
uInt32 color, TextAlign align = TextAlign::Left,
|
||||
int deltax = 0, bool useEllipsis = true, uInt32 shadowColor = 0);
|
||||
ColorId color, TextAlign align = TextAlign::Left,
|
||||
int deltax = 0, bool useEllipsis = true, ColorId shadowColor = kNone);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Note: The following methods are FBSurface-specific, and must be
|
||||
|
|
|
@ -138,7 +138,7 @@ bool FrameBuffer::initialize()
|
|||
else if(myOSystem.settings().getString("uipalette") == "light")
|
||||
palID = 2;
|
||||
|
||||
for(int i = 0, j = 256; i < kNumColors-256; ++i, ++j)
|
||||
for(uInt32 i = 0, j = 256; i < kNumColors-256; ++i, ++j)
|
||||
{
|
||||
uInt8 r = (ourGUIColors[palID][i] >> 16) & 0xff;
|
||||
uInt8 g = (ourGUIColors[palID][i] >> 8) & 0xff;
|
||||
|
@ -413,7 +413,6 @@ void FrameBuffer::showMessage(const string& message, MessagePosition position,
|
|||
void FrameBuffer::drawFrameStats(float framesPerSecond)
|
||||
{
|
||||
const ConsoleInfo& info = myOSystem.console().about();
|
||||
uInt32 color;
|
||||
int xPos = 2, yPos = 0;
|
||||
const int dy = font().getFontHeight() + 2;
|
||||
|
||||
|
@ -422,8 +421,8 @@ void FrameBuffer::drawFrameStats(float framesPerSecond)
|
|||
myStatsMsg.surface->invalidate();
|
||||
|
||||
// draw scanlines
|
||||
color = myOSystem.console().tia().frameBufferScanlinesLastFrame() != myLastScanlines ?
|
||||
uInt32(kDbgColorRed) : myStatsMsg.color;
|
||||
ColorId color = myOSystem.console().tia().frameBufferScanlinesLastFrame() != myLastScanlines ?
|
||||
kDbgColorRed : myStatsMsg.color;
|
||||
|
||||
ss
|
||||
<< myOSystem.console().tia().frameBufferScanlinesLastFrame()
|
||||
|
|
|
@ -518,13 +518,13 @@ class FrameBuffer
|
|||
int counter;
|
||||
int x, y, w, h;
|
||||
MessagePosition position;
|
||||
uInt32 color;
|
||||
ColorId color;
|
||||
shared_ptr<FBSurface> surface;
|
||||
bool enabled;
|
||||
|
||||
Message()
|
||||
: counter(-1), x(0), y(0), w(0), h(0), position(MessagePosition::BottomCenter),
|
||||
color(0), enabled(false) { }
|
||||
color(kNone), enabled(false) { }
|
||||
};
|
||||
Message myMsg;
|
||||
Message myStatsMsg;
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#ifndef FRAMEBUFFER_CONSTANTS_HXX
|
||||
#define FRAMEBUFFER_CONSTANTS_HXX
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
||||
// Return values for initialization of framebuffer window
|
||||
enum class FBInitStatus {
|
||||
Success,
|
||||
|
@ -39,47 +41,50 @@ enum class MessagePosition {
|
|||
BottomRight
|
||||
};
|
||||
|
||||
// TODO - make this 'enum class'
|
||||
// Colors indices to use for the various GUI elements
|
||||
enum {
|
||||
// Abstract away what a color actually is, so we can easily change it in
|
||||
// the future, if necessary
|
||||
using ColorId = uInt32;
|
||||
static constexpr ColorId
|
||||
kColor = 256,
|
||||
kBGColor,
|
||||
kBGColorLo,
|
||||
kBGColorHi,
|
||||
kShadowColor,
|
||||
kTextColor,
|
||||
kTextColorHi,
|
||||
kTextColorEm,
|
||||
kTextColorInv,
|
||||
kDlgColor,
|
||||
kWidColor,
|
||||
kWidColorHi,
|
||||
kWidFrameColor,
|
||||
kBtnColor,
|
||||
kBtnColorHi,
|
||||
kBtnBorderColor,
|
||||
kBtnBorderColorHi,
|
||||
kBtnTextColor,
|
||||
kBtnTextColorHi,
|
||||
kCheckColor,
|
||||
kScrollColor,
|
||||
kScrollColorHi,
|
||||
kSliderColor,
|
||||
kSliderColorHi,
|
||||
kSliderBGColor,
|
||||
kSliderBGColorHi,
|
||||
kSliderBGColorLo,
|
||||
kDbgChangedColor,
|
||||
kDbgChangedTextColor,
|
||||
kDbgColorHi,
|
||||
kDbgColorRed,
|
||||
kColorInfo,
|
||||
kColorTitleBar,
|
||||
kColorTitleText,
|
||||
kColorTitleBarLo,
|
||||
kColorTitleTextLo,
|
||||
kNumColors
|
||||
};
|
||||
kBGColor = 257,
|
||||
kBGColorLo = 258,
|
||||
kBGColorHi = 259,
|
||||
kShadowColor = 260,
|
||||
kTextColor = 261,
|
||||
kTextColorHi = 262,
|
||||
kTextColorEm = 263,
|
||||
kTextColorInv = 264,
|
||||
kDlgColor = 265,
|
||||
kWidColor = 266,
|
||||
kWidColorHi = 267,
|
||||
kWidFrameColor = 268,
|
||||
kBtnColor = 269,
|
||||
kBtnColorHi = 270,
|
||||
kBtnBorderColor = 271,
|
||||
kBtnBorderColorHi = 272,
|
||||
kBtnTextColor = 273,
|
||||
kBtnTextColorHi = 274,
|
||||
kCheckColor = 275,
|
||||
kScrollColor = 276,
|
||||
kScrollColorHi = 277,
|
||||
kSliderColor = 278,
|
||||
kSliderColorHi = 279,
|
||||
kSliderBGColor = 280,
|
||||
kSliderBGColorHi = 281,
|
||||
kSliderBGColorLo = 282,
|
||||
kDbgChangedColor = 283,
|
||||
kDbgChangedTextColor = 284,
|
||||
kDbgColorHi = 285,
|
||||
kDbgColorRed = 286,
|
||||
kColorInfo = 287,
|
||||
kColorTitleBar = 288,
|
||||
kColorTitleText = 289,
|
||||
kColorTitleBarLo = 290,
|
||||
kColorTitleTextLo = 291,
|
||||
kNumColors = 292,
|
||||
kNone = 0 // placeholder to represent default/no color
|
||||
;
|
||||
|
||||
// Text alignment modes for drawString()
|
||||
enum class TextAlign {
|
||||
|
|
|
@ -169,7 +169,7 @@ void AboutDialog::displayInfo()
|
|||
{
|
||||
const char* str = myDescStr[i].c_str();
|
||||
TextAlign align = TextAlign::Center;
|
||||
uInt32 color = kTextColor;
|
||||
ColorId color = kTextColor;
|
||||
|
||||
while (str[0] == '\\')
|
||||
{
|
||||
|
|
|
@ -112,7 +112,7 @@ void CheckListWidget::drawWidget(bool hilite)
|
|||
_checkList[i]->draw();
|
||||
|
||||
const int y = _y + 2 + _fontHeight * i + 2;
|
||||
uInt32 textColor = kTextColor;
|
||||
ColorId textColor = kTextColor;
|
||||
|
||||
GUI::Rect r(getEditRect());
|
||||
|
||||
|
@ -138,7 +138,7 @@ void CheckListWidget::drawWidget(bool hilite)
|
|||
}
|
||||
else
|
||||
s.drawString(_font, _list[pos], _x + r.left, y, r.width(),
|
||||
onTop ? textColor : uInt32(kColor));
|
||||
onTop ? textColor : kColor);
|
||||
}
|
||||
|
||||
// Only draw the caret while editing, and if it's in the current viewport
|
||||
|
|
|
@ -28,7 +28,7 @@ ColorWidget::ColorWidget(GuiObject* boss, const GUI::Font& font,
|
|||
int x, int y, int w, int h, int cmd)
|
||||
: Widget(boss, font, x, y, w, h),
|
||||
CommandSender(boss),
|
||||
_color(0),
|
||||
_color(kNone),
|
||||
_cmd(cmd),
|
||||
_crossGrid(false)
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ ColorWidget::ColorWidget(GuiObject* boss, const GUI::Font& font,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ColorWidget::setColor(int color)
|
||||
void ColorWidget::setColor(ColorId color)
|
||||
{
|
||||
_color = color;
|
||||
setDirty();
|
||||
|
|
|
@ -39,8 +39,8 @@ class ColorWidget : public Widget, public CommandSender
|
|||
int x, int y, int w, int h, int cmd = 0);
|
||||
virtual ~ColorWidget() = default;
|
||||
|
||||
void setColor(int color);
|
||||
int getColor() const { return _color; }
|
||||
void setColor(ColorId color);
|
||||
ColorId getColor() const { return _color; }
|
||||
|
||||
void setCrossed(bool enable) { _crossGrid = enable; }
|
||||
|
||||
|
@ -48,7 +48,7 @@ class ColorWidget : public Widget, public CommandSender
|
|||
void drawWidget(bool hilite) override;
|
||||
|
||||
protected:
|
||||
int _color;
|
||||
ColorId _color;
|
||||
int _cmd;
|
||||
|
||||
bool _crossGrid;
|
||||
|
|
|
@ -118,7 +118,7 @@ class ContextMenu : public Dialog, public CommandSender
|
|||
int _selectedOffset, _selectedItem;
|
||||
bool _showScroll;
|
||||
bool _isScrolling;
|
||||
uInt32 _scrollUpColor, _scrollDnColor;
|
||||
ColorId _scrollUpColor, _scrollDnColor;
|
||||
|
||||
int _cmd;
|
||||
|
||||
|
|
|
@ -1090,7 +1090,7 @@ void DeveloperDialog::handleDebugColours(int idx, int color)
|
|||
return;
|
||||
}
|
||||
|
||||
static constexpr int dbg_color[2][DEBUG_COLORS] = {
|
||||
static constexpr ColorId dbg_color[2][DEBUG_COLORS] = {
|
||||
{
|
||||
TIA::FixedColor::NTSC_RED,
|
||||
TIA::FixedColor::NTSC_ORANGE,
|
||||
|
|
|
@ -55,7 +55,7 @@ class Dialog : public GuiObject
|
|||
void close();
|
||||
|
||||
bool isVisible() const override { return _visible; }
|
||||
bool isOnTop() { return _onTop; }
|
||||
bool isOnTop() const { return _onTop; }
|
||||
|
||||
virtual void center();
|
||||
virtual void drawDialog();
|
||||
|
|
|
@ -95,8 +95,8 @@ void EditTextWidget::drawWidget(bool hilite)
|
|||
adjustOffset();
|
||||
s.drawString(_font, editString(), _x + 2, _y + 2, getEditRect().width(),
|
||||
_changed && onTop
|
||||
? uInt32(kDbgChangedTextColor)
|
||||
: onTop ? _textcolor : uInt32(kColor),
|
||||
? kDbgChangedTextColor
|
||||
: onTop ? _textcolor : kColor,
|
||||
TextAlign::Left, -_editScrollOffset, false);
|
||||
|
||||
// Draw the caret
|
||||
|
|
|
@ -206,7 +206,7 @@ void PopUpWidget::drawWidget(bool hilite)
|
|||
// Draw the label, if any
|
||||
if(_labelWidth > 0)
|
||||
s.drawString(_font, _label, _x, _y + myTextY, _labelWidth,
|
||||
isEnabled() && onTop ? _textcolor : uInt32(kColor), TextAlign::Left);
|
||||
isEnabled() && onTop ? _textcolor : kColor, TextAlign::Left);
|
||||
|
||||
// Draw a thin frame around us.
|
||||
s.frameRect(x, _y, w, _h, isEnabled() && hilite ? kWidColorHi : kColor);
|
||||
|
|
|
@ -164,7 +164,7 @@ void RadioButtonWidget::drawWidget(bool hilite)
|
|||
|
||||
// Draw the inner bounding circle with enabled color
|
||||
s.drawBitmap(radio_img_innercircle, _x + 1, _y + _boxY + 1, isEnabled()
|
||||
? _bgcolor : uInt32(kColor), 12, 12);
|
||||
? _bgcolor : kColor, 12, 12);
|
||||
|
||||
// draw state
|
||||
if(_state)
|
||||
|
|
|
@ -68,7 +68,7 @@ void StringListWidget::drawWidget(bool hilite)
|
|||
for (i = 0, pos = _currentPos; i < _rows && pos < len; i++, pos++)
|
||||
{
|
||||
const int y = _y + 2 + _fontHeight * i;
|
||||
uInt32 textColor = onTop ? kTextColor : kShadowColor;
|
||||
ColorId textColor = onTop ? kTextColor : kShadowColor;
|
||||
|
||||
// Draw the selected item inverted, on a highlighted background.
|
||||
if (onTop && _selectedItem == pos && _hilite)
|
||||
|
|
|
@ -268,7 +268,7 @@ void TabWidget::drawWidget(bool hilite)
|
|||
int i, x = _x + kTabLeftOffset;
|
||||
for (i = 0; i < int(_tabs.size()); ++i)
|
||||
{
|
||||
uInt32 fontcolor = _tabs[i].enabled && onTop? kTextColor : kColor;
|
||||
ColorId fontcolor = _tabs[i].enabled && onTop? kTextColor : kColor;
|
||||
int yOffset = (i == _activeTab) ? 0 : 1;
|
||||
s.fillRect(x, _y + 1, _tabWidth, _tabHeight - 1,
|
||||
(i == _activeTab)
|
||||
|
|
|
@ -181,7 +181,7 @@ void TimeLineWidget::drawWidget(bool hilite)
|
|||
if(idx > 1)
|
||||
{
|
||||
int xt = x + valueToPos(idx - 1);
|
||||
uInt32 color;
|
||||
ColorId color = kNone;
|
||||
|
||||
if(isEnabled())
|
||||
{
|
||||
|
|
|
@ -307,7 +307,7 @@ void Widget::setDirtyInChain(Widget* start)
|
|||
StaticTextWidget::StaticTextWidget(GuiObject* boss, const GUI::Font& font,
|
||||
int x, int y, int w, int h,
|
||||
const string& text, TextAlign align,
|
||||
uInt32 shadowColor)
|
||||
ColorId shadowColor)
|
||||
: Widget(boss, font, x, y, w, h),
|
||||
_align(align)
|
||||
{
|
||||
|
@ -326,7 +326,7 @@ StaticTextWidget::StaticTextWidget(GuiObject* boss, const GUI::Font& font,
|
|||
StaticTextWidget::StaticTextWidget(GuiObject* boss, const GUI::Font& font,
|
||||
int x, int y,
|
||||
const string& text, TextAlign align,
|
||||
uInt32 shadowColor)
|
||||
ColorId shadowColor)
|
||||
: StaticTextWidget(boss, font, x, y, font.getStringWidth(text), font.getLineHeight(),
|
||||
text, align, shadowColor)
|
||||
{
|
||||
|
@ -356,7 +356,7 @@ void StaticTextWidget::drawWidget(bool hilite)
|
|||
FBSurface& s = _boss->dialog().surface();
|
||||
bool onTop = _boss->dialog().isOnTop();
|
||||
s.drawString(_font, _label, _x, _y, _w,
|
||||
isEnabled() && onTop ? _textcolor : uInt32(kColor), _align, 0, true, _shadowcolor);
|
||||
isEnabled() && onTop ? _textcolor : kColor, _align, 0, true, _shadowcolor);
|
||||
|
||||
setDirty();
|
||||
}
|
||||
|
@ -646,8 +646,8 @@ void CheckboxWidget::drawWidget(bool hilite)
|
|||
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 ? onTop ? uInt32(kDbgChangedColor) : uInt32(kDlgColor) :
|
||||
isEnabled() ? onTop ? _bgcolor : uInt32(kDlgColor) : uInt32(kColor));
|
||||
_changed ? onTop ? kDbgChangedColor : kDlgColor :
|
||||
isEnabled() ? onTop ? _bgcolor : kDlgColor : kColor);
|
||||
if(_state)
|
||||
s.drawBitmap(_img, _x + 2, _y + _boxY + 2, onTop && isEnabled() ? hilite && isEditable() ? kWidColorHi : kCheckColor
|
||||
: kColor, 10);
|
||||
|
@ -868,7 +868,7 @@ void SliderWidget::drawWidget(bool hilite)
|
|||
for(int i = 1; i < _numIntervals; ++i)
|
||||
{
|
||||
int xt = x + (_w - _labelWidth - _valueLabelGap - _valueLabelWidth) * i / _numIntervals - 1;
|
||||
uInt32 color;
|
||||
ColorId color = kNone;
|
||||
|
||||
if(isEnabled())
|
||||
{
|
||||
|
|
|
@ -109,11 +109,11 @@ class Widget : public GuiObject
|
|||
|
||||
virtual const GUI::Font& font() const { return _font; }
|
||||
|
||||
void setTextColor(uInt32 color) { _textcolor = color; setDirty(); }
|
||||
void setTextColorHi(uInt32 color) { _textcolorhi = color; setDirty(); }
|
||||
void setBGColor(uInt32 color) { _bgcolor = color; setDirty(); }
|
||||
void setBGColorHi(uInt32 color) { _bgcolorhi = color; setDirty(); }
|
||||
void setShadowColor(uInt32 color) { _shadowcolor = color; setDirty(); }
|
||||
void setTextColor(ColorId color) { _textcolor = color; setDirty(); }
|
||||
void setTextColorHi(ColorId color) { _textcolorhi = color; setDirty(); }
|
||||
void setBGColor(ColorId color) { _bgcolor = color; setDirty(); }
|
||||
void setBGColorHi(ColorId color) { _bgcolorhi = color; setDirty(); }
|
||||
void setShadowColor(ColorId color) { _shadowcolor = color; setDirty(); }
|
||||
|
||||
virtual void loadConfig() { }
|
||||
|
||||
|
@ -140,13 +140,13 @@ class Widget : public GuiObject
|
|||
bool _hasFocus;
|
||||
int _fontWidth;
|
||||
int _fontHeight;
|
||||
uInt32 _bgcolor;
|
||||
uInt32 _bgcolorhi;
|
||||
uInt32 _bgcolorlo;
|
||||
uInt32 _textcolor;
|
||||
uInt32 _textcolorhi;
|
||||
uInt32 _textcolorlo;
|
||||
uInt32 _shadowcolor;
|
||||
ColorId _bgcolor;
|
||||
ColorId _bgcolorhi;
|
||||
ColorId _bgcolorlo;
|
||||
ColorId _textcolor;
|
||||
ColorId _textcolorhi;
|
||||
ColorId _textcolorlo;
|
||||
ColorId _shadowcolor;
|
||||
|
||||
public:
|
||||
static Widget* findWidgetInChain(Widget* start, int x, int y);
|
||||
|
@ -183,11 +183,11 @@ class StaticTextWidget : public Widget
|
|||
StaticTextWidget(GuiObject* boss, const GUI::Font& font,
|
||||
int x, int y, int w, int h,
|
||||
const string& text = "", TextAlign align = TextAlign::Left,
|
||||
uInt32 shadowColor = 0);
|
||||
ColorId shadowColor = kNone);
|
||||
StaticTextWidget(GuiObject* boss, const GUI::Font& font,
|
||||
int x, int y,
|
||||
const string& text = "", TextAlign align = TextAlign::Left,
|
||||
uInt32 shadowColor = 0);
|
||||
ColorId shadowColor = kNone);
|
||||
void setValue(int value);
|
||||
void setLabel(const string& label);
|
||||
void setAlign(TextAlign align) { _align = align; setDirty(); }
|
||||
|
@ -293,7 +293,7 @@ class CheckboxWidget : public ButtonWidget
|
|||
bool _changed;
|
||||
|
||||
uInt32* _img;
|
||||
uInt32 _fillColor;
|
||||
ColorId _fillColor;
|
||||
int _boxY;
|
||||
int _textY;
|
||||
|
||||
|
|
Loading…
Reference in New Issue