enabled FLAT_UI code, removed old code

This commit is contained in:
thrust26 2018-01-23 18:03:00 +01:00
parent 5121a73210
commit 5757eccfcf
18 changed files with 7 additions and 344 deletions

View File

@ -584,13 +584,6 @@ void DataGridWidget::drawWidget(bool hilite)
// Draw the internal grid and labels // Draw the internal grid and labels
int linewidth = _cols * _colWidth; int linewidth = _cols * _colWidth;
#ifndef FLAT_UI
for (row = 0; row <= _rows; row++)
s.hLine(_x, _y + (row * _rowHeight), _x + linewidth, kColor);
int lineheight = _rows * _rowHeight;
for (col = 0; col <= _cols; col++)
s.vLine(_x + (col * _colWidth), _y, _y + lineheight, kColor);
#else
s.frameRect(_x, _y, _w, _h, kColor); s.frameRect(_x, _y, _w, _h, kColor);
for(row = 1; row <= _rows-1; row++) for(row = 1; row <= _rows-1; row++)
s.hLine(_x+1, _y + (row * _rowHeight), _x + linewidth-1, kBGColorLo); s.hLine(_x+1, _y + (row * _rowHeight), _x + linewidth-1, kBGColorLo);
@ -598,9 +591,6 @@ void DataGridWidget::drawWidget(bool hilite)
int lineheight = _rows * _rowHeight; int lineheight = _rows * _rowHeight;
for(col = 1; col <= _cols-1; col++) for(col = 1; col <= _cols-1; col++)
s.vLine(_x + (col * _colWidth), _y+1, _y + lineheight-1, kBGColorLo); s.vLine(_x + (col * _colWidth), _y+1, _y + lineheight-1, kBGColorLo);
#endif
// Draw the list items // Draw the list items
for (row = 0; row < _rows; row++) for (row = 0; row < _rows; row++)

View File

@ -353,15 +353,9 @@ void DebuggerDialog::addTabArea()
int tabID; int tabID;
// The Prompt/console tab // The Prompt/console tab
#ifndef FLAT_UI
tabID = myTab->addTab(" Prompt ");
myPrompt = new PromptWidget(myTab, *myNFont,
2, 2, widWidth, widHeight);
#else
tabID = myTab->addTab("Prompt"); tabID = myTab->addTab("Prompt");
myPrompt = new PromptWidget(myTab, *myNFont, myPrompt = new PromptWidget(myTab, *myNFont,
2, 2, widWidth - 4, widHeight); 2, 2, widWidth - 4, widHeight);
#endif
myTab->setParentWidget(tabID, myPrompt); myTab->setParentWidget(tabID, myPrompt);
addToFocusList(myPrompt->getFocusList(), myTab, tabID); addToFocusList(myPrompt->getFocusList(), myTab, tabID);

View File

@ -242,11 +242,7 @@ void TiaZoomWidget::drawWidget(bool hilite)
FBSurface& s = dialog().surface(); FBSurface& s = dialog().surface();
s.fillRect(_x+1, _y+1, _w-2, _h-2, kBGColor); s.fillRect(_x+1, _y+1, _w-2, _h-2, kBGColor);
#ifndef FLAT_UI
s.box(_x, _y, _w, _h, kColor, kShadowColor);
#else
s.frameRect(_x, _y, _w, _h, kColor); s.frameRect(_x, _y, _w, _h, kColor);
#endif
// Draw the zoomed image // Draw the zoomed image
// This probably isn't as efficient as it can be, but it's a small area // This probably isn't as efficient as it can be, but it's a small area
@ -269,11 +265,7 @@ void TiaZoomWidget::drawWidget(bool hilite)
{ {
uInt32 idx = y*width + x; uInt32 idx = y*width + x;
uInt32 color = currentFrame[idx] | (idx > scanoffset ? 1 : 0); uInt32 color = currentFrame[idx] | (idx > scanoffset ? 1 : 0);
#ifndef FLAT_UI
s.fillRect(_x + col + 2, _y + row + 2, wzoom, hzoom, color);
#else
s.fillRect(_x + col + 1, _y + row + 1, wzoom, hzoom, color); s.fillRect(_x + col + 1, _y + row + 1, wzoom, hzoom, color);
#endif
} }
} }
} }

View File

@ -78,13 +78,6 @@ void ToggleBitWidget::drawWidget(bool hilite)
// Draw the internal grid and labels // Draw the internal grid and labels
int linewidth = _cols * _colWidth; int linewidth = _cols * _colWidth;
#ifndef FLAT_UI
for (row = 0; row <= _rows; row++)
s.hLine(_x, _y + (row * _rowHeight), _x + linewidth, kColor);
int lineheight = _rows * _rowHeight;
for (col = 0; col <= _cols; col++)
s.vLine(_x + (col * _colWidth), _y, _y + lineheight, kColor);
#else
s.frameRect(_x, _y, _w, _h, kColor); s.frameRect(_x, _y, _w, _h, kColor);
for(row = 1; row <= _rows - 1; row++) for(row = 1; row <= _rows - 1; row++)
s.hLine(_x + 1, _y + (row * _rowHeight), _x + linewidth - 1, kBGColorLo); s.hLine(_x + 1, _y + (row * _rowHeight), _x + linewidth - 1, kBGColorLo);
@ -92,7 +85,6 @@ void ToggleBitWidget::drawWidget(bool hilite)
int lineheight = _rows * _rowHeight; int lineheight = _rows * _rowHeight;
for(col = 1; col <= _cols - 1; col++) for(col = 1; col <= _cols - 1; col++)
s.vLine(_x + (col * _colWidth), _y + 1, _y + lineheight - 1, kBGColorLo); s.vLine(_x + (col * _colWidth), _y + 1, _y + lineheight - 1, kBGColorLo);
#endif
// Draw the list items // Draw the list items
for (row = 0; row < _rows; row++) for (row = 0; row < _rows; row++)

View File

@ -155,10 +155,6 @@ void TogglePixelWidget::drawWidget(bool hilite)
// Cross out the bits? // Cross out the bits?
if(_crossBits) if(_crossBits)
{ {
#ifndef FLAT_UI
for(row = 1; row < 4; ++row)
s.hLine(_x, _y + (row * lineheight / 4), _x + linewidth, kColor);
#else
for(col = 0; col < _cols; ++col) for(col = 0; col < _cols; ++col)
{ {
int x = _x + col * _colWidth; int x = _x + col * _colWidth;
@ -166,6 +162,5 @@ void TogglePixelWidget::drawWidget(bool hilite)
s.line(x + 1, _y + 1, x + _colWidth - 1, _y + lineheight - 1, kColor); s.line(x + 1, _y + 1, x + _colWidth - 1, _y + lineheight - 1, kColor);
s.line(x + _colWidth - 1, _y + 1, x + 1, _y + lineheight - 1, kColor); s.line(x + _colWidth - 1, _y + 1, x + 1, _y + lineheight - 1, kColor);
} }
#endif
} }
} }

View File

@ -270,24 +270,6 @@ void FBSurface::frameRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
case FrameStyle::Dashed: case FrameStyle::Dashed:
uInt32 i, skip, lwidth = 1; uInt32 i, skip, lwidth = 1;
#ifndef FLAT_UI
for(i = x, skip = 1; i < x+w-1; i=i+lwidth+1, ++skip)
{
if(skip % 2)
{
hLine(i, y, i + lwidth, color);
hLine(i, y + h - 1, i + lwidth, color);
}
}
for(i = y, skip = 1; i < y+h-1; i=i+lwidth+1, ++skip)
{
if(skip % 2)
{
vLine(x, i, i + lwidth, color);
vLine(x + w - 1, i, i + lwidth, color);
}
}
#else
for(i = x; i < x + w; i += 2) for(i = x; i < x + w; i += 2)
{ {
hLine(i, y, i, color); hLine(i, y, i, color);
@ -298,7 +280,6 @@ void FBSurface::frameRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
vLine(x, i, i, color); vLine(x, i, i, color);
vLine(x + w - 1, i, i, color); vLine(x + w - 1, i, i, color);
} }
#endif
break; break;
} }
} }

View File

@ -526,11 +526,7 @@ inline void FrameBuffer::drawMessage()
myMsg.surface->setDstPos(myMsg.x + myImageRect.x(), myMsg.y + myImageRect.y()); myMsg.surface->setDstPos(myMsg.x + myImageRect.x(), myMsg.y + myImageRect.y());
myMsg.surface->fillRect(1, 1, myMsg.w-2, myMsg.h-2, kBtnColor); myMsg.surface->fillRect(1, 1, myMsg.w-2, myMsg.h-2, kBtnColor);
#ifndef FLAT_UI
myMsg.surface->box(0, 0, myMsg.w, myMsg.h, kColor, kShadowColor);
#else
myMsg.surface->frameRect(0, 0, myMsg.w, myMsg.h, kColor); myMsg.surface->frameRect(0, 0, myMsg.w, myMsg.h, kColor);
#endif
myMsg.surface->drawString(font(), myMsg.text, 5, 4, myMsg.surface->drawString(font(), myMsg.text, 5, 4,
myMsg.w, myMsg.color, TextAlign::Left); myMsg.w, myMsg.color, TextAlign::Left);

View File

@ -48,14 +48,7 @@ void ColorWidget::drawWidget(bool hilite)
FBSurface& s = dialog().surface(); FBSurface& s = dialog().surface();
// Draw a thin frame around us. // Draw a thin frame around us.
#ifndef FLAT_UI
s.hLine(_x, _y, _x + _w - 1, kColor);
s.hLine(_x, _y +_h, _x + _w - 1, kShadowColor);
s.vLine(_x, _y, _y+_h, kColor);
s.vLine(_x + _w - 1, _y, _y +_h - 1, kShadowColor);
#else
s.frameRect(_x, _y, _w, _h + 1, kColor); s.frameRect(_x, _y, _w, _h + 1, kColor);
#endif
// Show the currently selected color // 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, isEnabled() ? _color : kWidColor);
@ -63,12 +56,7 @@ void ColorWidget::drawWidget(bool hilite)
// Cross out the grid? // Cross out the grid?
if(_crossGrid) if(_crossGrid)
{ {
#ifndef FLAT_UI
for(uInt32 row = 1; row < 4; ++row)
s.hLine(_x, _y + (row * _h/4), _x + _w - 2, kColor);
#else
s.line(_x + 1, _y + 1, _x + _w - 2, _y + _h - 1, kColor); s.line(_x + 1, _y + 1, _x + _w - 2, _y + _h - 1, kColor);
s.line(_x + _w - 2, _y + 1, _x + 1, _y + _h - 1, kColor); s.line(_x + _w - 2, _y + 1, _x + 1, _y + _h - 1, kColor);
#endif
} }
} }

View File

@ -60,11 +60,7 @@ void ContextMenu::addItems(const VariantList& items)
maxwidth = std::max(maxwidth, _font.getStringWidth(e.first)); maxwidth = std::max(maxwidth, _font.getStringWidth(e.first));
_x = _y = 0; _x = _y = 0;
#ifndef FLAT_UI
_w = maxwidth + 15;
#else
_w = maxwidth + 23; _w = maxwidth + 23;
#endif
_h = 1; // recalculate this in ::recalc() _h = 1; // recalculate this in ::recalc()
_scrollUpColor = _firstEntry > 0 ? kScrollColor : kColor; _scrollUpColor = _firstEntry > 0 ? kScrollColor : kColor;
@ -555,17 +551,10 @@ void ContextMenu::drawDialog()
{ {
// Draw menu border and background // Draw menu border and background
s.fillRect(_x+1, _y+1, _w-2, _h-2, kWidColor); s.fillRect(_x+1, _y+1, _w-2, _h-2, kWidColor);
#ifndef FLAT_UI
s.box(_x, _y, _w, _h, kColor, kShadowColor);
// Draw the entries, taking scroll buttons into account
int x = _x + 2, y = _y + 2, w = _w - 4;
#else
s.frameRect(_x, _y, _w, _h, kTextColor); s.frameRect(_x, _y, _w, _h, kTextColor);
// Draw the entries, taking scroll buttons into account // Draw the entries, taking scroll buttons into account
int x = _x + 1, y = _y + 1, w = _w - 2; int x = _x + 1, y = _y + 1, w = _w - 2;
#endif
// Show top scroll area // Show top scroll area
int offset = _selectedOffset; int offset = _selectedOffset;

View File

@ -276,11 +276,7 @@ void Dialog::drawDialog()
else else
s.invalidate(); s.invalidate();
if(_flags & WIDGET_BORDER) if(_flags & WIDGET_BORDER)
#ifndef FLAT_UI
s.box(_x, _y, _w, _h, kColor, kShadowColor);
#else
s.frameRect(_x, _y, _w, _h, kColor); s.frameRect(_x, _y, _w, _h, kColor);
#endif // !FLAT_UI
// Make all child widget dirty // Make all child widget dirty
Widget* w = _firstWidget; Widget* w = _firstWidget;

View File

@ -71,21 +71,10 @@ void EditTextWidget::drawWidget(bool hilite)
if(_changed) if(_changed)
s.fillRect(_x, _y, _w, _h, kDbgChangedColor); s.fillRect(_x, _y, _w, _h, kDbgChangedColor);
else if(!isEditable()) else if(!isEditable())
#ifndef FLAT_UI
s.fillRect(_x, _y, _w, _h, kBGColorHi);
#else
s.fillRect(_x, _y, _w, _h, kDlgColor); s.fillRect(_x, _y, _w, _h, kDlgColor);
#endif
// Draw a thin frame around us. // Draw a thin frame around us.
#ifndef FLAT_UI
s.hLine(_x, _y, _x + _w - 1, kColor);
s.hLine(_x, _y + _h - 1, _x +_w - 1, kShadowColor);
s.vLine(_x, _y, _y + _h - 1, kColor);
s.vLine(_x + _w - 1, _y, _y + _h - 1, kShadowColor);
#else
s.frameRect(_x, _y, _w, _h, kColor); s.frameRect(_x, _y, _w, _h, kColor);
#endif
// Draw the text // Draw the text
adjustOffset(); adjustOffset();

View File

@ -23,19 +23,7 @@
#include "DialogContainer.hxx" #include "DialogContainer.hxx"
#include "PopUpWidget.hxx" #include "PopUpWidget.hxx"
// Little up/down arrow // Little down arrow
#ifndef FLAT_UI
static uInt32 up_down_arrows[8] = {
0b00000000,
0b00001000,
0b00011100,
0b00111110,
0b00000000,
0b00111110,
0b00011100,
0b00001000,
};
#else
static uInt32 down_arrow[8] = { static uInt32 down_arrow[8] = {
0b100000001, 0b100000001,
0b110000011, 0b110000011,
@ -46,7 +34,6 @@ static uInt32 down_arrow[8] = {
0b000010000, 0b000010000,
0b000000000 0b000000000
}; };
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font, PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font,
@ -67,11 +54,7 @@ PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font,
if(!_label.empty() && _labelWidth == 0) if(!_label.empty() && _labelWidth == 0)
_labelWidth = _font.getStringWidth(_label); _labelWidth = _font.getStringWidth(_label);
#ifndef FLAT_UI
_w = w + _labelWidth + 15;
#else
_w = w + _labelWidth + 23; _w = w + _labelWidth + 23;
#endif
// vertically center the arrows and text // vertically center the arrows and text
myTextY = (_h - _font.getFontHeight()) / 2; myTextY = (_h - _font.getFontHeight()) / 2;
@ -157,7 +140,6 @@ void PopUpWidget::handleMouseWheel(int x, int y, int direction)
} }
} }
#ifdef FLAT_UI
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PopUpWidget::handleMouseEntered() void PopUpWidget::handleMouseEntered()
{ {
@ -171,7 +153,6 @@ void PopUpWidget::handleMouseLeft()
clearFlags(WIDGET_HILITED); clearFlags(WIDGET_HILITED);
setDirty(); setDirty();
} }
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PopUpWidget::handleEvent(Event::Type e) bool PopUpWidget::handleEvent(Event::Type e)
@ -221,24 +202,6 @@ void PopUpWidget::drawWidget(bool hilite)
int x = _x + _labelWidth; int x = _x + _labelWidth;
int w = _w - _labelWidth; int w = _w - _labelWidth;
#ifndef FLAT_UI
// Draw the label, if any
if(_labelWidth > 0)
s.drawString(_font, _label, _x, _y + myTextY, _labelWidth,
isEnabled() ? _textcolor : uInt32(kColor), TextAlign::Right);
// Draw a thin frame around us.
s.hLine(x, _y, x + w - 1, kColor);
s.hLine(x, _y +_h-1, x + w - 1, kShadowColor);
s.vLine(x, _y, _y+_h-1, kColor);
s.vLine(x + w - 1, _y, _y +_h - 1, kShadowColor);
// Fill the background
s.fillRect(x + 1, _y + 1, w - 2, _h - 2, _changed ? kDbgChangedColor : kWidColor);
// Draw an arrow pointing down at the right end to signal this is a dropdown/popup
s.drawBitmap(up_down_arrows, x + w - 10, _y + myArrowsY,
!isEnabled() ? kColor : hilite ? kTextColorHi : kTextColor);
#else
// Draw the label, if any // Draw the label, if any
if(_labelWidth > 0) if(_labelWidth > 0)
s.drawString(_font, _label, _x, _y + myTextY, _labelWidth, s.drawString(_font, _label, _x, _y + myTextY, _labelWidth,
@ -254,7 +217,6 @@ void PopUpWidget::drawWidget(bool hilite)
// Draw an arrow pointing down at the right end to signal this is a dropdown/popup // 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, s.drawBitmap(down_arrow, x + w - 13, _y + myArrowsY + 1,
!isEnabled() ? kColor : kTextColor, 9u, 8u); !isEnabled() ? kColor : kTextColor, 9u, 8u);
#endif
// Draw the selected entry, if any // Draw the selected entry, if any
const string& name = myMenu->getSelectedName(); const string& name = myMenu->getSelectedName();

View File

@ -64,10 +64,8 @@ class PopUpWidget : public Widget, public CommandSender
protected: protected:
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override; void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
void handleMouseWheel(int x, int y, int direction) override; void handleMouseWheel(int x, int y, int direction) override;
#ifdef FLAT_UI
void handleMouseEntered() override; void handleMouseEntered() override;
void handleMouseLeft() override; void handleMouseLeft() override;
#endif
bool handleEvent(Event::Type e) override; bool handleEvent(Event::Type e) override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override; void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
void drawWidget(bool hilite) override; void drawWidget(bool hilite) override;

View File

@ -21,63 +21,6 @@
#include "RadioButtonWidget.hxx" #include "RadioButtonWidget.hxx"
/* Radiobutton bitmaps */ /* Radiobutton bitmaps */
#ifndef FLAT_UI
static uInt32 radio_img_outercircle[14] =
{
0b00001111110000,
0b00111111111100,
0b01110000001110,
0b01100000000110,
0b11000000000011,
0b11000000000011,
0b11000000000011,
0b11000000000011,
0b11000000000011,
0b11000000000011,
0b01100000000110,
0b01110000001110,
0b00111111111100,
0b00001111110000
};
static uInt32 radio_img_innercircle[10] =
{
0b0011111100,
0b0111111110,
0b1111111111,
0b1111111111,
0b1111111111,
0b1111111111,
0b1111111111,
0b1111111111,
0b0111111110,
0b0011111100
};
static uInt32 radio_img_active[8] =
{
0b00111100,
0b01111110,
0b11111111,
0b11111111,
0b11111111,
0b11111111,
0b01111110,
0b00111100
};
static uInt32 radio_img_inactive[8] =
{
0b00111100,
0b01111110,
0b11100111,
0b11000011,
0b11000011,
0b11100111,
0b01111110,
0b00111100
};
#else
static uInt32 radio_img_outercircle[14] = static uInt32 radio_img_outercircle[14] =
{ {
0b00001111110000, 0b00001111110000,
@ -139,7 +82,6 @@ static uInt32 radio_img_inactive[10] =
0b0111111110, 0b0111111110,
0b0011111100 0b0011111100
}; };
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RadioButtonWidget::RadioButtonWidget(GuiObject* boss, const GUI::Font& font, RadioButtonWidget::RadioButtonWidget(GuiObject* boss, const GUI::Font& font,
@ -217,17 +159,6 @@ void RadioButtonWidget::drawWidget(bool hilite)
{ {
FBSurface& s = _boss->dialog().surface(); FBSurface& s = _boss->dialog().surface();
#ifndef FLAT_UI
// Draw the outer bounding circle
s.drawBitmap(radio_img_outercircle, _x, _y + _boxY, kShadowColor, 14, 14);
// Draw the inner bounding circle with enabled color
s.drawBitmap(radio_img_innercircle, _x + 2, _y + _boxY + 2, isEnabled() ? _bgcolor : kColor, 10, 10);
// draw state
if(_state)
s.drawBitmap(_img, _x + 3, _y + _boxY + 3, isEnabled() ? kCheckColor : kShadowColor);
#else
// Draw the outer bounding circle // Draw the outer bounding circle
s.drawBitmap(radio_img_outercircle, _x, _y + _boxY, hilite ? kScrollColorHi : kShadowColor, 14, 14); s.drawBitmap(radio_img_outercircle, _x, _y + _boxY, hilite ? kScrollColorHi : kShadowColor, 14, 14);
@ -240,7 +171,6 @@ void RadioButtonWidget::drawWidget(bool hilite)
s.drawBitmap(_img, _x + 2, _y + _boxY + 2, isEnabled() s.drawBitmap(_img, _x + 2, _y + _boxY + 2, isEnabled()
? hilite ? kScrollColorHi : kCheckColor ? hilite ? kScrollColorHi : kCheckColor
: kShadowColor, 10); : kShadowColor, 10);
#endif
// Finally draw the label // Finally draw the label
s.drawString(_font, _label, _x + 20, _y + _textY, _w, s.drawString(_font, _label, _x + 20, _y + _textY, _w,

View File

@ -253,29 +253,6 @@ void TabWidget::loadConfig()
updateActiveTab(); updateActiveTab();
} }
#ifndef FLAT_UI
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::box(int x, int y, int width, int height,
uInt32 colorA, uInt32 colorB, bool omitBottom)
{
//cerr << "TabWidget::box\n";
FBSurface& s = _boss->dialog().surface();
s.hLine(x + 1, y, x + width - 2, colorA);
s.hLine(x, y + 1, x + width - 1, colorA);
s.vLine(x, y + 1, y + height - (omitBottom ? 1 : 2), colorA);
s.vLine(x + 1, y, y + height - (omitBottom ? 2 : 1), colorA);
if (!omitBottom)
{
s.hLine(x + 1, y + height - 2, x + width - 1, colorB);
s.hLine(x + 1, y + height - 1, x + width - 2, colorB);
}
s.vLine(x + width - 1, y + 1, y + height - (omitBottom ? 1 : 2), colorB);
s.vLine(x + width - 2, y + 1, y + height - (omitBottom ? 2 : 1), colorB);
}
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::drawWidget(bool hilite) void TabWidget::drawWidget(bool hilite)
{ {
@ -291,25 +268,11 @@ void TabWidget::drawWidget(bool hilite)
const int left2 = right1 + _tabWidth; const int left2 = right1 + _tabWidth;
const int right2 = _x + _w - 2; const int right2 = _x + _w - 2;
#ifndef FLAT_UI
// Draw horizontal line
s.hLine(left1, _y + _tabHeight - 2, right1, kShadowColor);
s.hLine(left2, _y + _tabHeight - 2, right2, kShadowColor);
#endif
// Iterate over all tabs and draw them // Iterate over all tabs and draw them
int i, x = _x + kTabLeftOffset; int i, x = _x + kTabLeftOffset;
for (i = 0; i < int(_tabs.size()); ++i) for (i = 0; i < int(_tabs.size()); ++i)
{ {
uInt32 fontcolor = _tabs[i].enabled ? kTextColor : kColor; uInt32 fontcolor = _tabs[i].enabled ? kTextColor : kColor;
#ifndef FLAT_UI
uInt32 boxcolor = (i == _activeTab) ? kColor : kShadowColor;
int yOffset = (i == _activeTab) ? 0 : 2;
box(x, _y + yOffset, _tabWidth, _tabHeight - yOffset, boxcolor, boxcolor, (i == _activeTab));
s.drawString(_font, _tabs[i].title, x + kTabPadding,
_y + yOffset / 2 + (_tabHeight - _fontHeight - 1),
_tabWidth - 2 * kTabPadding, fontcolor, TextAlign::Center);
#else
int yOffset = (i == _activeTab) ? 0 : 1; int yOffset = (i == _activeTab) ? 0 : 1;
s.fillRect(x, _y + 1, _tabWidth, _tabHeight - 1, (i == _activeTab) s.fillRect(x, _y + 1, _tabWidth, _tabHeight - 1, (i == _activeTab)
? kDlgColor : kBGColorHi); // ? kWidColor : kDlgColor ? kDlgColor : kBGColorHi); // ? kWidColor : kDlgColor
@ -323,23 +286,13 @@ void TabWidget::drawWidget(bool hilite)
} }
else else
s.hLine(x, _y + _tabHeight, x + _tabWidth, kWidColor); s.hLine(x, _y + _tabHeight, x + _tabWidth, kWidColor);
#endif
x += _tabWidth + kTabSpacing; x += _tabWidth + kTabSpacing;
} }
#ifndef FLAT_UI
// Draw a frame around the widget area (belows the tabs)
s.hLine(left1, _y + _tabHeight - 1, right1, kColor);
s.hLine(left2, _y + _tabHeight - 1, right2, kColor);
s.hLine(_x+1, _y + _h - 2, _x + _w - 2, kShadowColor);
s.hLine(_x+1, _y + _h - 1, _x + _w - 2, kColor);
s.vLine(_x + _w - 2, _y + _tabHeight - 1, _y + _h - 2, kColor);
s.vLine(_x + _w - 1, _y + _tabHeight - 1, _y + _h - 2, kShadowColor);
#else
// fill empty right space // fill empty right space
s.hLine(x - kTabSpacing + 1, _y + _tabHeight, _x + _w - 1, kWidColor); s.hLine(x - kTabSpacing + 1, _y + _tabHeight, _x + _w - 1, kWidColor);
s.hLine(_x, _y + _h - 1, _x + _w - 1, kBGColorLo); s.hLine(_x, _y + _h - 1, _x + _w - 1, kBGColorLo);
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -90,22 +90,12 @@ class TabWidget : public Widget, public CommandSender
bool _firstTime; bool _firstTime;
enum { enum {
#ifndef FLAT_UI
kTabLeftOffset = 4,
kTabSpacing = 2,
kTabPadding = 3
#else
kTabLeftOffset = 0, kTabLeftOffset = 0,
kTabSpacing = 1, kTabSpacing = 1,
kTabPadding = 4 kTabPadding = 4
#endif
}; };
private: private:
#ifndef FLAT_UI
void box(int x, int y, int width, int height,
uInt32 colorA, uInt32 colorB, bool omitBottom);
#endif
void updateActiveTab(); void updateActiveTab();
private: private:

View File

@ -84,21 +84,13 @@ void Widget::draw()
{ {
x++; y++; w-=2; h-=2; x++; y++; w-=2; h-=2;
} }
#ifndef FLAT_UI
s.fillRect(x, y, w, h, (_flags & WIDGET_HILITED) && isEnabled() ? _bgcolorhi : _bgcolor); s.fillRect(x, y, w, h, (_flags & WIDGET_HILITED) && isEnabled() ? _bgcolorhi : _bgcolor);
#else
s.fillRect(x, y, w, h, (_flags & WIDGET_HILITED) && isEnabled() ? _bgcolorhi : _bgcolor);
#endif
} }
// Draw border // Draw border
if(hasBorder) if(hasBorder)
{ {
#ifndef FLAT_UI
s.box(_x, _y, _w, _h, kColor, kShadowColor);
#else
s.frameRect(_x, _y, _w, _h, (_flags & WIDGET_HILITED) && isEnabled() ? kScrollColorHi : kColor); s.frameRect(_x, _y, _w, _h, (_flags & WIDGET_HILITED) && isEnabled() ? kScrollColorHi : kColor);
#endif // !FLAT_UI
_x += 4; _x += 4;
_y += 4; _y += 4;
_w -= 8; _w -= 8;
@ -460,43 +452,6 @@ void ButtonWidget::drawWidget(bool hilite)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/* 8x8 checkbox bitmap */ /* 8x8 checkbox bitmap */
#ifndef FLAT_UI
static uInt32 checked_img_active[8] =
{
0b11111111,
0b11111111,
0b11111111,
0b11111111,
0b11111111,
0b11111111,
0b11111111,
0b11111111
};
static uInt32 checked_img_inactive[8] =
{
0b11111111,
0b11111111,
0b11100111,
0b11000011,
0b11000011,
0b11100111,
0b11111111,
0b11111111
};
static uInt32 checked_img_circle[8] =
{
0b00011000,
0b01111110,
0b01111110,
0b11111111,
0b11111111,
0b01111110,
0b01111110,
0b00011000
};
#else
static uInt32 checked_img_active[10] = static uInt32 checked_img_active[10] =
{ {
0b1111111111, 0b1111111111,
@ -538,7 +493,7 @@ static uInt32 checked_img_circle[10] =
0b0111111110, 0b0111111110,
0b0001111000 0b0001111000
}; };
#endif // !FLAT_UI
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CheckboxWidget::CheckboxWidget(GuiObject* boss, const GUI::Font& font, CheckboxWidget::CheckboxWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, const string& label, int x, int y, const string& label,
@ -651,16 +606,6 @@ void CheckboxWidget::drawWidget(bool hilite)
{ {
FBSurface& s = _boss->dialog().surface(); FBSurface& s = _boss->dialog().surface();
#ifndef FLAT_UI
// Draw the box
if(_drawBox)
s.box(_x, _y + _boxY, 14, 14, kColor, kShadowColor);
// Do we draw a square or cross?
s.fillRect(_x + 2, _y + _boxY + 2, 10, 10, _changed ? kDbgChangedColor
: isEnabled() ? _bgcolor : kColor);
if(_state)
s.drawBitmap(_img, _x + 3, _y + _boxY + 3, isEnabled() ? kCheckColor : kShadowColor);
#else
if(_drawBox) if(_drawBox)
s.frameRect(_x, _y + _boxY, 14, 14, hilite ? kScrollColorHi : kShadowColor); s.frameRect(_x, _y + _boxY, 14, 14, hilite ? kScrollColorHi : kShadowColor);
// Do we draw a square or cross? // Do we draw a square or cross?
@ -669,7 +614,6 @@ void CheckboxWidget::drawWidget(bool hilite)
if(_state) if(_state)
s.drawBitmap(_img, _x + 2, _y + _boxY + 2, isEnabled() ? hilite ? kScrollColorHi : kCheckColor s.drawBitmap(_img, _x + 2, _y + _boxY + 2, isEnabled() ? hilite ? kScrollColorHi : kCheckColor
: kShadowColor, 10); : kShadowColor, 10);
#endif
// Finally draw the label // Finally draw the label
s.drawString(_font, _label, _x + 20, _y + _textY, _w, s.drawString(_font, _label, _x + 20, _y + _textY, _w,
@ -809,21 +753,6 @@ void SliderWidget::drawWidget(bool hilite)
{ {
FBSurface& s = _boss->dialog().surface(); FBSurface& s = _boss->dialog().surface();
#ifndef FLAT_UI
// Draw the label, if any
if(_labelWidth > 0)
s.drawString(_font, _label, _x, _y + 2, _labelWidth,
isEnabled() ? kTextColor : kColor, TextAlign::Right);
// Draw the box
s.box(_x + _labelWidth, _y, _w - _labelWidth, _h, kColor, kShadowColor);
// Fill the box
s.fillRect(_x + _labelWidth + 2, _y + 2, _w - _labelWidth - 4, _h - 4,
!isEnabled() ? kBGColorHi : kWidColor);
// Draw the 'bar'
s.fillRect(_x + _labelWidth + 2, _y + 2, valueToPos(_value), _h - 4,
!isEnabled() ? kColor : hilite ? kSliderColorHi : kSliderColor);
#else
// Draw the label, if any // Draw the label, if any
if(_labelWidth > 0) if(_labelWidth > 0)
s.drawString(_font, _label, _x, _y + 2, _labelWidth, s.drawString(_font, _label, _x, _y + 2, _labelWidth,
@ -837,7 +766,6 @@ void SliderWidget::drawWidget(bool hilite)
// Draw the 'bar' // Draw the 'bar'
s.fillRect(_x + _labelWidth + 2, _y + 2, valueToPos(_value), _h - 4, s.fillRect(_x + _labelWidth + 2, _y + 2, valueToPos(_value), _h - 4,
!isEnabled() ? kColor : hilite ? kSliderColorHi : kSliderColor); !isEnabled() ? kColor : hilite ? kSliderColorHi : kSliderColor);
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -111,7 +111,7 @@
<AdditionalOptions>/MP /std:c++latest %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/MP /std:c++latest %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>FLAT_UI;BSPF_WINDOWS;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>BSPF_WINDOWS;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@ -142,7 +142,7 @@
<AdditionalOptions>/MP /std:c++latest %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/MP /std:c++latest %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>FLAT_UI;BSPF_WINDOWS;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>BSPF_WINDOWS;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@ -171,7 +171,7 @@
<OmitFramePointers>true</OmitFramePointers> <OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>false</WholeProgramOptimization> <WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalIncludeDirectories>..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>FLAT_UI;BSPF_WINDOWS;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>BSPF_WINDOWS;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo> <RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader> <PrecompiledHeader>
@ -204,7 +204,7 @@
<InlineFunctionExpansion>Default</InlineFunctionExpansion> <InlineFunctionExpansion>Default</InlineFunctionExpansion>
<OmitFramePointers>true</OmitFramePointers> <OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>FLAT_UI;BSPF_WINDOWS;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>BSPF_WINDOWS;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo> <RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader> <PrecompiledHeader>