some more focus highlighting added

made most sliders wider by default
This commit is contained in:
thrust26 2018-01-25 17:00:41 +01:00
parent 920b051f02
commit 4c39fa3c68
17 changed files with 136 additions and 89 deletions

View File

@ -50,8 +50,7 @@ DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
_opsWidget(nullptr), _opsWidget(nullptr),
_scrollBar(nullptr) _scrollBar(nullptr)
{ {
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | _flags = WIDGET_ENABLED | WIDGET_RETAIN_FOCUS | WIDGET_WANTS_RAWDATA;
WIDGET_WANTS_RAWDATA;
_editMode = false; _editMode = false;
// The item is selected, thus _bgcolor is used to draw the caret and // The item is selected, thus _bgcolor is used to draw the caret and
@ -250,6 +249,20 @@ void DataGridWidget::setRange(int lower, int upper)
_upperBound = std::min(1 << _bits, upper); _upperBound = std::min(1 << _bits, upper);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::handleMouseEntered()
{
setFlags(WIDGET_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::handleMouseLeft()
{
clearFlags(WIDGET_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount) void DataGridWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
{ {
@ -582,9 +595,10 @@ void DataGridWidget::drawWidget(bool hilite)
FBSurface& s = _boss->dialog().surface(); FBSurface& s = _boss->dialog().surface();
int row, col; int row, col;
s.fillRect(_x, _y, _w, _h, hilite && isEnabled() && isEditable() ? _bgcolorhi : _bgcolor);
// Draw the internal grid and labels // Draw the internal grid and labels
int linewidth = _cols * _colWidth; int linewidth = _cols * _colWidth;
s.frameRect(_x, _y, _w, _h, kColor); s.frameRect(_x, _y, _w, _h, hilite && isEnabled() && isEditable() ? kWidColorHi : 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);

View File

@ -100,6 +100,8 @@ class DataGridWidget : public EditableWidget
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override; void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
void handleMouseUp(int x, int y, MouseButton b, int clickCount) override; void handleMouseUp(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;
void handleMouseEntered() override;
void handleMouseLeft() override;
bool handleText(char text) override; bool handleText(char text) override;
bool handleKeyDown(StellaKey key, StellaMod mod) override; bool handleKeyDown(StellaKey key, StellaMod mod) override;
bool handleKeyUp(StellaKey key, StellaMod mod) override; bool handleKeyUp(StellaKey key, StellaMod mod) override;

View File

@ -32,15 +32,14 @@ PaddleWidget::PaddleWidget(GuiObject* boss, const GUI::Font& font,
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Paddles)"); int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Paddles)");
new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, new StaticTextWidget(boss, font, xpos, ypos+2, lwidth,
fontHeight, label, TextAlign::Left); fontHeight, label);
ypos += lineHeight + 20; ypos += lineHeight + 20;
const string& p0string = leftport ? "P0 pot " : "P2 pot "; const string& p0string = leftport ? "P0 pot " : "P2 pot ";
const string& p1string = leftport ? "P1 pot " : "P3 pot "; const string& p1string = leftport ? "P1 pot " : "P3 pot ";
lwidth = font.getStringWidth("P3 pot: ");
myP0Resistance = myP0Resistance =
new SliderWidget(boss, font, xpos, ypos, 10*fontWidth, lineHeight, new SliderWidget(boss, font, xpos, ypos,
p0string, lwidth, kP0Changed); p0string, 0, kP0Changed);
myP0Resistance->setMinValue(0); myP0Resistance->setMinValue(0);
myP0Resistance->setMaxValue(uInt32(Paddles::MAX_RESISTANCE)); myP0Resistance->setMaxValue(uInt32(Paddles::MAX_RESISTANCE));
myP0Resistance->setStepValue(uInt32(Paddles::MAX_RESISTANCE/100)); myP0Resistance->setStepValue(uInt32(Paddles::MAX_RESISTANCE/100));
@ -53,8 +52,8 @@ PaddleWidget::PaddleWidget(GuiObject* boss, const GUI::Font& font,
xpos = x; ypos += 2*lineHeight; xpos = x; ypos += 2*lineHeight;
myP1Resistance = myP1Resistance =
new SliderWidget(boss, font, xpos, ypos, 10*fontWidth, lineHeight, new SliderWidget(boss, font, xpos, ypos,
p1string, lwidth, kP1Changed); p1string, 0, kP1Changed);
myP1Resistance->setMinValue(0); myP1Resistance->setMinValue(0);
myP1Resistance->setMaxValue(uInt32(Paddles::MAX_RESISTANCE)); myP1Resistance->setMaxValue(uInt32(Paddles::MAX_RESISTANCE));
myP1Resistance->setStepValue(uInt32(Paddles::MAX_RESISTANCE/100)); myP1Resistance->setStepValue(uInt32(Paddles::MAX_RESISTANCE/100));

View File

@ -76,9 +76,10 @@ void ToggleBitWidget::drawWidget(bool hilite)
int row, col; int row, col;
string buffer; string buffer;
s.frameRect(_x, _y, _w, _h, hilite && isEnabled() && isEditable() ? kWidColorHi : kColor);
// Draw the internal grid and labels // Draw the internal grid and labels
int linewidth = _cols * _colWidth; int linewidth = _cols * _colWidth;
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);

View File

@ -123,12 +123,14 @@ void TogglePixelWidget::drawWidget(bool hilite)
FBSurface& s = dialog().surface(); FBSurface& s = dialog().surface();
int row, col; int row, col;
s.frameRect(_x, _y, _w, _h, hilite && isEnabled() && isEditable() ? kWidColorHi : kColor);
// Draw the internal grid and labels // Draw the internal grid and labels
int linewidth = _cols * _colWidth; int linewidth = _cols * _colWidth;
for (row = 0; row <= _rows; row++) for (row = 1; row <= _rows - 1; row++)
s.hLine(_x, _y + (row * _rowHeight), _x + linewidth, kColor); s.hLine(_x, _y + (row * _rowHeight), _x + linewidth, kColor);
int lineheight = _rows * _rowHeight; int lineheight = _rows * _rowHeight;
for (col = 0; col <= _cols; col++) for (col = 1; col <= _cols - 1; col++)
s.vLine(_x + (col * _colWidth), _y, _y + lineheight, kColor); s.vLine(_x + (col * _colWidth), _y, _y + lineheight, kColor);
// Draw the pixels // Draw the pixels

View File

@ -40,6 +40,20 @@ ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font,
WIDGET_WANTS_RAWDATA; WIDGET_WANTS_RAWDATA;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ToggleWidget::handleMouseEntered()
{
setFlags(WIDGET_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ToggleWidget::handleMouseLeft()
{
clearFlags(WIDGET_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ToggleWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount) void ToggleWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
{ {

View File

@ -68,6 +68,8 @@ class ToggleWidget : public Widget, public CommandSender
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override; void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
void handleMouseUp(int x, int y, MouseButton b, int clickCount) override; void handleMouseUp(int x, int y, MouseButton b, int clickCount) override;
void handleMouseEntered() override;
void handleMouseLeft() override;
bool handleKeyDown(StellaKey key, StellaMod mod) override; bool handleKeyDown(StellaKey key, StellaMod mod) override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override; void handleCommand(CommandSender* sender, int cmd, int data, int id) override;

View File

@ -989,7 +989,7 @@ void FrameBuffer::VideoModeList::setZoom(uInt32 zoom)
kTextColor Normal text color kTextColor Normal text color
kTextColorHi Highlighted text color kTextColorHi Highlighted text color
kTextColorEm Emphasized text color kTextColorEm Emphasized text color
kTextColorSel Color for selected text kTextColorInv Color for selected text
*** UI elements (dialog and widgets) *** *** UI elements (dialog and widgets) ***
kDlgColor Dialog background kDlgColor Dialog background
kWidColor Widget background kWidColor Widget background
@ -1022,37 +1022,37 @@ void FrameBuffer::VideoModeList::setZoom(uInt32 zoom)
*/ */
uInt32 FrameBuffer::ourGUIColors[3][kNumColors-256] = { uInt32 FrameBuffer::ourGUIColors[3][kNumColors-256] = {
// Standard // Standard
{ 0x686868, 0x000000, 0xa38c61, 0xdccfa5, 0x404040, // base { 0x686868, 0x000000, 0xa38c61, 0xdccfa5, 0x404040, // base
0x000000, 0x62a108, 0x9f0000, 0x000000, // text 0x000000, 0xac3410, 0x9f0000, 0xf0f0cf, // text
0xc9af7c, 0xf0f0cf, 0xd55941, 0xc80000, // UI elements 0xc9af7c, 0xf0f0cf, 0xd55941, 0xc80000, // UI elements
0xac3410, 0xd55941, 0x686868, 0xdccfa5, 0xffffff, 0xf0f0cf/*0xffd652*/, // buttons 0xac3410, 0xd55941, 0x686868, 0xdccfa5, 0xf0f0cf, 0xf0f0cf, // buttons
0xac3410, // checkbox 0xac3410, // checkbox
0xac3410, 0xd55941, // scrollbar 0xac3410, 0xd55941, // scrollbar
0xac3410, 0xd55941, // slider 0xac3410, 0xd55941, // slider
0xc80000, 0x00ff00, 0xc8c8ff, 0xc80000, // debugger 0xc80000, 0x00ff00, 0xc8c8ff, 0xc80000, // debugger
0xffffff, 0xac3410, 0xffffff // other 0xffffff, 0xac3410, 0xf0f0cf // other
}, },
// Classic // Classic
{ 0x686868, 0x000000, 0x404040, 0x404040, 0x404040, // base { 0x686868, 0x000000, 0x404040, 0x404040, 0x404040, // base
0x20a020, 0x00ff00, 0xc80000, 0x20a020, // text 0x20a020, 0x00ff00, 0xc80000, 0x20a020, // text
0x000000, 0x000000, 0x00ff00, 0xc80000, // UI elements 0x000000, 0x000000, 0x00ff00, 0xc80000, // UI elements
0x000000, 0x000000, 0x686868, 0x00ff00, 0x20a020, 0x00ff00, // buttons 0x000000, 0x000000, 0x686868, 0x00ff00, 0x20a020, 0x00ff00, // buttons
0x20a020, // checkbox 0x20a020, // checkbox
0x20a020, 0x00ff00, // scrollbar 0x20a020, 0x00ff00, // scrollbar
0x20a020, 0x00ff00, // slider 0x20a020, 0x00ff00, // slider
0xc80000, 0x00ff00, 0xc8c8ff, 0xc80000, // debugger 0xc80000, 0x00ff00, 0xc8c8ff, 0xc80000, // debugger
0x20a020, 0x20a020, 0x000000 // other 0x20a020, 0x20a020, 0x000000 // other
}, },
// Light // Light
{ {
0x808080, 0x000000, 0xc0c0c0, 0xe1e1e1, 0x333333, // base 0x808080, 0x000000, 0xc0c0c0, 0xe1e1e1, 0x333333, // base
0x000000, 0x0078d7, 0x0078d7, 0xffffff, // text 0x000000, 0x0078d7, 0x0078d7, 0xffffff, // text
0xf0f0f0, 0xffffff, 0x0078d7, 0x0f0f0f, // UI elements 0xf0f0f0, 0xffffff, 0x0078d7, 0x0f0f0f, // UI elements
0xe1e1e1, 0xe5f1fb, 0x808080, 0x0078d7, 0x000000, 0x000000, // buttons 0xe1e1e1, 0xe5f1fb, 0x808080, 0x0078d7, 0x000000, 0x000000, // buttons
0x333333, // checkbox 0x333333, // checkbox
0xc0c0c0, 0x808080, // scrollbar 0xc0c0c0, 0x808080, // scrollbar
0x333333, 0x0078d7, // slider 0x333333, 0x0078d7, // slider
0xffc0c0, 0x000000, 0xe00000, 0xc00000, // debugger 0xffc0c0, 0x000000, 0xe00000, 0xc00000, // debugger
0xffffff, 0x808080, 0xffffff // other 0xffffff, 0x808080, 0xffffff // other
} }
}; };

View File

@ -66,7 +66,7 @@ AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent,
xpos += INDENT; xpos += INDENT;
// Volume // Volume
myVolumeSlider = new SliderWidget(this, font, xpos, ypos, 8*fontWidth, lineHeight, myVolumeSlider = new SliderWidget(this, font, xpos, ypos,
"Volume ", lwidth, kVolumeChanged); "Volume ", lwidth, kVolumeChanged);
myVolumeSlider->setMinValue(1); myVolumeSlider->setMaxValue(100); myVolumeSlider->setMinValue(1); myVolumeSlider->setMaxValue(100);
wid.push_back(myVolumeSlider); wid.push_back(myVolumeSlider);

View File

@ -203,8 +203,7 @@ void DeveloperDialog::addVideoTab(const GUI::Font& font)
wid.push_back(myTVJitterWidget); wid.push_back(myTVJitterWidget);
myTVJitterRecWidget = new SliderWidget(myTab, font, myTVJitterRecWidget = new SliderWidget(myTab, font,
myTVJitterWidget->getRight() + fontWidth * 3, ypos - 1, myTVJitterWidget->getRight() + fontWidth * 3, ypos - 1,
8 * fontWidth, lineHeight, "Recovery ", "Recovery ", 0, kTVJitterChanged);
font.getStringWidth("Recovery "), kTVJitterChanged);
myTVJitterRecWidget->setMinValue(1); myTVJitterRecWidget->setMaxValue(20); myTVJitterRecWidget->setMinValue(1); myTVJitterRecWidget->setMaxValue(20);
wid.push_back(myTVJitterRecWidget); wid.push_back(myTVJitterRecWidget);
myTVJitterRecLabelWidget = new StaticTextWidget(myTab, font, myTVJitterRecLabelWidget = new StaticTextWidget(myTab, font,
@ -334,8 +333,7 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
wid.push_back(myTimeMachineWidget); wid.push_back(myTimeMachineWidget);
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
int sWidth = font.getMaxCharWidth() * 8; myStateSizeWidget = new SliderWidget(myTab, font, HBORDER + INDENT * 2, ypos - 1,
myStateSizeWidget = new SliderWidget(myTab, font, HBORDER + INDENT * 2, ypos - 1, sWidth, lineHeight,
"Buffer size (*) ", 0, kSizeChanged); "Buffer size (*) ", 0, kSizeChanged);
myStateSizeWidget->setMinValue(20); myStateSizeWidget->setMinValue(20);
myStateSizeWidget->setMaxValue(1000); myStateSizeWidget->setMaxValue(1000);
@ -345,7 +343,7 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
myStateSizeWidget->getTop() + 2, "100 "); myStateSizeWidget->getTop() + 2, "100 ");
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
myUncompressedWidget = new SliderWidget(myTab, font, HBORDER + INDENT * 2, ypos - 1, sWidth, lineHeight, myUncompressedWidget = new SliderWidget(myTab, font, HBORDER + INDENT * 2, ypos - 1,
"Uncompressed size ", 0, kUncompressedChanged); "Uncompressed size ", 0, kUncompressedChanged);
myUncompressedWidget->setMinValue(0); myUncompressedWidget->setMinValue(0);
myUncompressedWidget->setMaxValue(1000); myUncompressedWidget->setMaxValue(1000);
@ -426,10 +424,8 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font)
ypos += lineHeight + VGAP * 4; ypos += lineHeight + VGAP * 4;
pwidth = font.getMaxCharWidth() * 8;
// Debugger width and height // Debugger width and height
myDebuggerWidthSlider = new SliderWidget(myTab, font, xpos, ypos-1, pwidth, myDebuggerWidthSlider = new SliderWidget(myTab, font, xpos, ypos-1, "Debugger width (*) ",
lineHeight, "Debugger width (*) ",
0, kDWidthChanged); 0, kDWidthChanged);
myDebuggerWidthSlider->setMinValue(DebuggerDialog::kSmallFontMinW); myDebuggerWidthSlider->setMinValue(DebuggerDialog::kSmallFontMinW);
myDebuggerWidthSlider->setMaxValue(ds.w); myDebuggerWidthSlider->setMaxValue(ds.w);
@ -441,8 +437,7 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font)
ypos + 1, 4 * fontWidth, fontHeight, "", TextAlign::Left); ypos + 1, 4 * fontWidth, fontHeight, "", TextAlign::Left);
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
myDebuggerHeightSlider = new SliderWidget(myTab, font, xpos, ypos-1, pwidth, myDebuggerHeightSlider = new SliderWidget(myTab, font, xpos, ypos-1, "Debugger height (*) ",
lineHeight, "Debugger height (*) ",
0, kDHeightChanged); 0, kDHeightChanged);
myDebuggerHeightSlider->setMinValue(DebuggerDialog::kSmallFontMinH); myDebuggerHeightSlider->setMinValue(DebuggerDialog::kSmallFontMinH);
myDebuggerHeightSlider->setMaxValue(ds.h); myDebuggerHeightSlider->setMaxValue(ds.h);
@ -456,6 +451,7 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font)
ypos += lineHeight + VGAP * 4; ypos += lineHeight + VGAP * 4;
myGhostReadsTrapWidget = new CheckboxWidget(myTab, font, HBORDER, ypos + 1, myGhostReadsTrapWidget = new CheckboxWidget(myTab, font, HBORDER, ypos + 1,
"Trap on 'ghost' reads", kGhostReads); "Trap on 'ghost' reads", kGhostReads);
wid.push_back(myGhostReadsTrapWidget);
// Add message concerning usage // Add message concerning usage
const GUI::Font& infofont = instance().frameBuffer().infoFont(); const GUI::Font& infofont = instance().frameBuffer().infoFont();
@ -478,8 +474,6 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font)
myDebuggerHeightLabel->clearFlags(WIDGET_ENABLED); myDebuggerHeightLabel->clearFlags(WIDGET_ENABLED);
} }
// Add items for tab 1
addToFocusList(wid, myTab, tabID);
#else #else
new StaticTextWidget(myTab, font, 0, 20, _w - 20, font.getFontHeight(), new StaticTextWidget(myTab, font, 0, 20, _w - 20, font.getFontHeight(),
"Debugger support not included", TextAlign::Center); "Debugger support not included", TextAlign::Center);

View File

@ -54,7 +54,6 @@ void EditTextWidget::handleMouseLeft()
setDirty(); setDirty();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EditTextWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount) void EditTextWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
{ {

View File

@ -232,6 +232,7 @@ GameInfoDialog::GameInfoDialog(
myEraseEEPROMLabel = new StaticTextWidget(myTab, font, hSpace, ypos, "AtariVox/SaveKey "); myEraseEEPROMLabel = new StaticTextWidget(myTab, font, hSpace, ypos, "AtariVox/SaveKey ");
myEraseEEPROMButton = new ButtonWidget(myTab, font, myEraseEEPROMLabel->getRight(), ypos - 4, myEraseEEPROMButton = new ButtonWidget(myTab, font, myEraseEEPROMLabel->getRight(), ypos - 4,
"Erase EEPROM", kEEButtonPressed); "Erase EEPROM", kEEButtonPressed);
wid.push_back(myEraseEEPROMButton);
myEraseEEPROMInfo = new StaticTextWidget(myTab, ifont, myEraseEEPROMButton->getRight() + 4, myEraseEEPROMLabel->getTop() + 3, myEraseEEPROMInfo = new StaticTextWidget(myTab, ifont, myEraseEEPROMButton->getRight() + 4, myEraseEEPROMLabel->getTop() + 3,
"(for this game only)"); "(for this game only)");
@ -274,7 +275,7 @@ GameInfoDialog::GameInfoDialog(
xpos = hSpace; ypos += lineHeight + vGap; xpos = hSpace; ypos += lineHeight + vGap;
lwidth = font.getStringWidth("Mouse axis range "); lwidth = font.getStringWidth("Mouse axis range ");
myMouseRange = new SliderWidget(myTab, font, hSpace, ypos, 8*fontWidth, lineHeight, myMouseRange = new SliderWidget(myTab, font, hSpace, ypos,
"Mouse axis range ", lwidth, kMRangeChanged); "Mouse axis range ", lwidth, kMRangeChanged);
myMouseRange->setMinValue(1); myMouseRange->setMaxValue(100); myMouseRange->setMinValue(1); myMouseRange->setMaxValue(100);
wid.push_back(myMouseRange); wid.push_back(myMouseRange);
@ -308,7 +309,7 @@ GameInfoDialog::GameInfoDialog(
ypos += lineHeight + vGap; ypos += lineHeight + vGap;
t = new StaticTextWidget(myTab, font, hSpace, ypos+1, "YStart ", TextAlign::Left); t = new StaticTextWidget(myTab, font, hSpace, ypos+1, "YStart ", TextAlign::Left);
myYStart = new SliderWidget(myTab, font, t->getRight(), ypos, 8*fontWidth, lineHeight, myYStart = new SliderWidget(myTab, font, t->getRight(), ypos,
"", 0, kYStartChanged); "", 0, kYStartChanged);
myYStart->setMinValue(TIAConstants::minYStart-1); myYStart->setMinValue(TIAConstants::minYStart-1);
myYStart->setMaxValue(TIAConstants::maxYStart); myYStart->setMaxValue(TIAConstants::maxYStart);
@ -318,7 +319,7 @@ GameInfoDialog::GameInfoDialog(
ypos += lineHeight + vGap; ypos += lineHeight + vGap;
t = new StaticTextWidget(myTab, font, hSpace, ypos+1, "Height ", TextAlign::Left); t = new StaticTextWidget(myTab, font, hSpace, ypos+1, "Height ", TextAlign::Left);
myHeight = new SliderWidget(myTab, font, t->getRight(), ypos, 8*fontWidth, lineHeight, myHeight = new SliderWidget(myTab, font, t->getRight(), ypos,
"", 0, kHeightChanged); "", 0, kHeightChanged);
myHeight->setMinValue(TIAConstants::minViewableHeight-1); myHeight->setMinValue(TIAConstants::minViewableHeight-1);
myHeight->setMaxValue(TIAConstants::maxViewableHeight); myHeight->setMaxValue(TIAConstants::maxViewableHeight);
@ -328,14 +329,12 @@ GameInfoDialog::GameInfoDialog(
// Phosphor // Phosphor
ypos += lineHeight + vGap*4; ypos += lineHeight + vGap*4;
myPhosphor = new CheckboxWidget(myTab, font, hSpace, ypos+1, "Use Phosphor", kPhosphorChanged); myPhosphor = new CheckboxWidget(myTab, font, hSpace, ypos+1, "TV Phosphor", kPhosphorChanged);
wid.push_back(myPhosphor); wid.push_back(myPhosphor);
myPPBlend = new SliderWidget(myTab, font, myPPBlend = new SliderWidget(myTab, font,
myPhosphor->getRight() + 16, myPhosphor->getTop()-2, myPhosphor->getRight() + fontWidth * 3, myPhosphor->getTop()-2,
8*fontWidth, lineHeight, "Blend ", "Blend ", 0, kPPBlendChanged);
font.getStringWidth("Blend "),
kPPBlendChanged);
myPPBlend->setMinValue(0); myPPBlend->setMaxValue(100); myPPBlend->setMinValue(0); myPPBlend->setMaxValue(100);
wid.push_back(myPPBlend); wid.push_back(myPPBlend);

View File

@ -154,45 +154,41 @@ void InputDialog::addDevicePortTab(const GUI::Font& font)
// Add joystick deadzone setting // Add joystick deadzone setting
ypos += lineHeight + VGAP*3; ypos += lineHeight + VGAP*3;
myDeadzone = new SliderWidget(myTab, font, HBORDER, ypos, pwidth, lineHeight, myDeadzone = new SliderWidget(myTab, font, HBORDER, ypos,
"Joystick deadzone size ", lwidth, kDeadzoneChanged); "Joystick deadzone size ", lwidth, kDeadzoneChanged);
myDeadzone->setMinValue(0); myDeadzone->setMaxValue(29); myDeadzone->setMinValue(0); myDeadzone->setMaxValue(29);
xpos = HBORDER + myDeadzone->getWidth() + 5; xpos = HBORDER + myDeadzone->getWidth() + 5;
myDeadzoneLabel = new StaticTextWidget(myTab, font, xpos, ypos+1, 5*fontWidth, myDeadzoneLabel = new StaticTextWidget(myTab, font, xpos, ypos+1, 5*fontWidth, lineHeight, "");
lineHeight, "", TextAlign::Left);
wid.push_back(myDeadzone); wid.push_back(myDeadzone);
// Add paddle speed (digital emulation) // Add paddle speed (digital emulation)
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
myDPaddleSpeed = new SliderWidget(myTab, font, HBORDER, ypos, pwidth, lineHeight, myDPaddleSpeed = new SliderWidget(myTab, font, HBORDER, ypos,
"Digital paddle sensitivity ", "Digital paddle sensitivity ",
lwidth, kDPSpeedChanged); lwidth, kDPSpeedChanged);
myDPaddleSpeed->setMinValue(1); myDPaddleSpeed->setMaxValue(20); myDPaddleSpeed->setMinValue(1); myDPaddleSpeed->setMaxValue(20);
xpos = HBORDER + myDPaddleSpeed->getWidth() + 5; xpos = HBORDER + myDPaddleSpeed->getWidth() + 5;
myDPaddleLabel = new StaticTextWidget(myTab, font, xpos, ypos+1, 24, lineHeight, myDPaddleLabel = new StaticTextWidget(myTab, font, xpos, ypos+1, 24, lineHeight, "");
"", TextAlign::Left);
wid.push_back(myDPaddleSpeed); wid.push_back(myDPaddleSpeed);
// Add paddle speed (mouse emulation) // Add paddle speed (mouse emulation)
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
myMPaddleSpeed = new SliderWidget(myTab, font, HBORDER, ypos, pwidth, lineHeight, myMPaddleSpeed = new SliderWidget(myTab, font, HBORDER, ypos,
"Mouse paddle sensitivity ", "Mouse paddle sensitivity ",
lwidth, kMPSpeedChanged); lwidth, kMPSpeedChanged);
myMPaddleSpeed->setMinValue(1); myMPaddleSpeed->setMaxValue(20); myMPaddleSpeed->setMinValue(1); myMPaddleSpeed->setMaxValue(20);
xpos = HBORDER + myMPaddleSpeed->getWidth() + 5; xpos = HBORDER + myMPaddleSpeed->getWidth() + 5;
myMPaddleLabel = new StaticTextWidget(myTab, font, xpos, ypos+1, 24, lineHeight, myMPaddleLabel = new StaticTextWidget(myTab, font, xpos, ypos+1, 24, lineHeight, "");
"", TextAlign::Left);
wid.push_back(myMPaddleSpeed); wid.push_back(myMPaddleSpeed);
// Add trackball speed // Add trackball speed
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
myTrackBallSpeed = new SliderWidget(myTab, font, HBORDER, ypos, pwidth, lineHeight, myTrackBallSpeed = new SliderWidget(myTab, font, HBORDER, ypos,
"Trackball sensitivity ", "Trackball sensitivity ",
lwidth, kTBSpeedChanged); lwidth, kTBSpeedChanged);
myTrackBallSpeed->setMinValue(1); myTrackBallSpeed->setMaxValue(20); myTrackBallSpeed->setMinValue(1); myTrackBallSpeed->setMaxValue(20);
xpos = HBORDER + myTrackBallSpeed->getWidth() + 5; xpos = HBORDER + myTrackBallSpeed->getWidth() + 5;
myTrackBallLabel = new StaticTextWidget(myTab, font, xpos, ypos+1, 24, lineHeight, myTrackBallLabel = new StaticTextWidget(myTab, font, xpos, ypos+1, 24, lineHeight, "");
"", TextAlign::Left);
wid.push_back(myTrackBallSpeed); wid.push_back(myTrackBallSpeed);
// Add 'allow all 4 directions' for joystick // Add 'allow all 4 directions' for joystick
@ -235,6 +231,7 @@ void InputDialog::addDevicePortTab(const GUI::Font& font)
myEraseEEPROMButton = new ButtonWidget(myTab, font, _w - HBORDER - 4 - fwidth, ypos, myEraseEEPROMButton = new ButtonWidget(myTab, font, _w - HBORDER - 4 - fwidth, ypos,
fwidth, lineHeight+4, fwidth, lineHeight+4,
"Erase EEPROM", kEEButtonPressed); "Erase EEPROM", kEEButtonPressed);
wid.push_back(myEraseEEPROMButton);
// Add AtariVox serial port // Add AtariVox serial port
ypos += lineHeight + VGAP*2; ypos += lineHeight + VGAP*2;

View File

@ -67,8 +67,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
lwidth = font.getStringWidth("Exit to Launcher "); lwidth = font.getStringWidth("Exit to Launcher ");
// Launcher width and height // Launcher width and height
myLauncherWidthSlider = new SliderWidget(myTab, font, xpos, ypos, pwidth, myLauncherWidthSlider = new SliderWidget(myTab, font, xpos, ypos, "Launcher Width ",
lineHeight, "Launcher Width ",
lwidth, kLWidthChanged); lwidth, kLWidthChanged);
myLauncherWidthSlider->setMinValue(FrameBuffer::kFBMinW); myLauncherWidthSlider->setMinValue(FrameBuffer::kFBMinW);
myLauncherWidthSlider->setMaxValue(ds.w); myLauncherWidthSlider->setMaxValue(ds.w);
@ -77,11 +76,10 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
myLauncherWidthLabel = myLauncherWidthLabel =
new StaticTextWidget(myTab, font, new StaticTextWidget(myTab, font,
xpos + myLauncherWidthSlider->getWidth() + 4, xpos + myLauncherWidthSlider->getWidth() + 4,
ypos + 1, 4*fontWidth, fontHeight, "", TextAlign::Left); ypos + 1, 4*fontWidth, fontHeight, "");
ypos += lineHeight + 4; ypos += lineHeight + 4;
myLauncherHeightSlider = new SliderWidget(myTab, font, xpos, ypos, pwidth, myLauncherHeightSlider = new SliderWidget(myTab, font, xpos, ypos, "Launcher Height ",
lineHeight, "Launcher Height ",
lwidth, kLHeightChanged); lwidth, kLHeightChanged);
myLauncherHeightSlider->setMinValue(FrameBuffer::kFBMinH); myLauncherHeightSlider->setMinValue(FrameBuffer::kFBMinH);
myLauncherHeightSlider->setMaxValue(ds.h); myLauncherHeightSlider->setMaxValue(ds.h);

View File

@ -49,7 +49,7 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
int xpos, ypos, tabID; int xpos, ypos, tabID;
int lwidth = font.getStringWidth("NTSC Aspect "), int lwidth = font.getStringWidth("NTSC Aspect "),
pwidth = font.getStringWidth("XXXXxXXXX"), pwidth = font.getStringWidth("XXXXxXXXX"),
swidth = 69; swidth = font.getMaxCharWidth() * 9 - 3;
WidgetArray wid; WidgetArray wid;
VariantList items; VariantList items;
@ -111,36 +111,36 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
// Aspect ratio (NTSC mode) // Aspect ratio (NTSC mode)
myNAspectRatio = myNAspectRatio =
new SliderWidget(myTab, font, xpos, ypos-1, pwidth, lineHeight, new SliderWidget(myTab, font, xpos, ypos-1,
"NTSC Aspect ", lwidth, kNAspectRatioChanged); "NTSC Aspect ", lwidth, kNAspectRatioChanged);
myNAspectRatio->setMinValue(80); myNAspectRatio->setMaxValue(120); myNAspectRatio->setMinValue(80); myNAspectRatio->setMaxValue(120);
wid.push_back(myNAspectRatio); wid.push_back(myNAspectRatio);
myNAspectRatioLabel = myNAspectRatioLabel =
new StaticTextWidget(myTab, font, xpos + myNAspectRatio->getWidth() + 4, new StaticTextWidget(myTab, font, xpos + myNAspectRatio->getWidth() + 4,
ypos + 1, fontWidth * 3, fontHeight, "", TextAlign::Left); ypos + 1, fontWidth * 3, fontHeight, "");
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
// Aspect ratio (PAL mode) // Aspect ratio (PAL mode)
myPAspectRatio = myPAspectRatio =
new SliderWidget(myTab, font, xpos, ypos-1, pwidth, lineHeight, new SliderWidget(myTab, font, xpos, ypos-1,
"PAL Aspect ", lwidth, kPAspectRatioChanged); "PAL Aspect ", lwidth, kPAspectRatioChanged);
myPAspectRatio->setMinValue(80); myPAspectRatio->setMaxValue(120); myPAspectRatio->setMinValue(80); myPAspectRatio->setMaxValue(120);
wid.push_back(myPAspectRatio); wid.push_back(myPAspectRatio);
myPAspectRatioLabel = myPAspectRatioLabel =
new StaticTextWidget(myTab, font, xpos + myPAspectRatio->getWidth() + 4, new StaticTextWidget(myTab, font, xpos + myPAspectRatio->getWidth() + 4,
ypos + 1, fontWidth * 3, fontHeight, "", TextAlign::Left); ypos + 1, fontWidth * 3, fontHeight, "");
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
// Framerate // Framerate
myFrameRate = myFrameRate =
new SliderWidget(myTab, font, xpos, ypos-1, pwidth, lineHeight, new SliderWidget(myTab, font, xpos, ypos-1,
"Framerate ", lwidth, kFrameRateChanged); "Framerate ", lwidth, kFrameRateChanged);
myFrameRate->setMinValue(0); myFrameRate->setMaxValue(900); myFrameRate->setMinValue(0); myFrameRate->setMaxValue(900);
myFrameRate->setStepValue(10); myFrameRate->setStepValue(10);
wid.push_back(myFrameRate); wid.push_back(myFrameRate);
myFrameRateLabel = myFrameRateLabel =
new StaticTextWidget(myTab, font, xpos + myFrameRate->getWidth() + 4, new StaticTextWidget(myTab, font, xpos + myFrameRate->getWidth() + 4,
ypos + 1, fontWidth * 4, fontHeight, "", TextAlign::Left); ypos + 1, fontWidth * 4, fontHeight, "");
// Add message concerning usage // Add message concerning usage
const GUI::Font& infofont = instance().frameBuffer().infoFont(); const GUI::Font& infofont = instance().frameBuffer().infoFont();
@ -150,7 +150,7 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
"(*) Requires application restart", TextAlign::Left); "(*) Requires application restart", TextAlign::Left);
// Move over to the next column // Move over to the next column
xpos += myNAspectRatio->getWidth() + myNAspectRatioLabel->getWidth() + 30; xpos += myFrameRate->getWidth() + 4 + myFrameRateLabel->getWidth() + 28;
ypos = VBORDER; ypos = VBORDER;
// Fullscreen // Fullscreen
@ -248,7 +248,7 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
CREATE_CUSTOM_SLIDERS(Fringe, "Fringing "); CREATE_CUSTOM_SLIDERS(Fringe, "Fringing ");
CREATE_CUSTOM_SLIDERS(Bleed, "Bleeding "); CREATE_CUSTOM_SLIDERS(Bleed, "Bleeding ");
xpos += myTVContrast->getWidth() + myTVContrastLabel->getWidth() + 36; xpos += myTVContrast->getWidth() + 4 + myTVContrastLabel->getWidth() + 28;
ypos = VBORDER; ypos = VBORDER;
lwidth = font.getStringWidth("Intensity "); lwidth = font.getStringWidth("Intensity ");
@ -261,6 +261,7 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
myTVPhosphor = new PopUpWidget(myTab, font, xpos, ypos, myTVPhosphor = new PopUpWidget(myTab, font, xpos, ypos,
font.getStringWidth("Per-ROM"), lineHeight, items, font.getStringWidth("Per-ROM"), lineHeight, items,
"TV Phosphor ", font.getStringWidth("TV Phosphor ")); "TV Phosphor ", font.getStringWidth("TV Phosphor "));
wid.push_back(myTVPhosphor);
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
// TV Phosphor default level // TV Phosphor default level

View File

@ -21,7 +21,6 @@
#include "bspf.hxx" #include "bspf.hxx"
#include "Command.hxx" #include "Command.hxx"
#include "Dialog.hxx" #include "Dialog.hxx"
#include "Font.hxx"
#include "FBSurface.hxx" #include "FBSurface.hxx"
#include "GuiObject.hxx" #include "GuiObject.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
@ -645,6 +644,28 @@ SliderWidget::SliderWidget(GuiObject* boss, const GUI::Font& font,
_w = w + _labelWidth; _w = w + _labelWidth;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SliderWidget::SliderWidget(GuiObject* boss, const GUI::Font& font,
int x, int y,
const string& label, int labelWidth, int cmd)
: ButtonWidget(boss, font, x, y, font.getMaxCharWidth() * 10, font.getLineHeight(), label, cmd),
_value(0),
_stepValue(1),
_valueMin(0),
_valueMax(100),
_isDragging(false),
_labelWidth(labelWidth)
{
_flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE;
_bgcolor = kDlgColor;
_bgcolorhi = kDlgColor;
if(!_label.empty() && _labelWidth == 0)
_labelWidth = _font.getStringWidth(_label);
_w = _font.getMaxCharWidth() * 10 + _labelWidth;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SliderWidget::setValue(int value) void SliderWidget::setValue(int value)
{ {

View File

@ -32,6 +32,7 @@ namespace GUI {
#include "bspf.hxx" #include "bspf.hxx"
#include "Event.hxx" #include "Event.hxx"
#include "GuiObject.hxx" #include "GuiObject.hxx"
#include "Font.hxx"
enum { enum {
WIDGET_ENABLED = 1 << 0, WIDGET_ENABLED = 1 << 0,
@ -307,6 +308,9 @@ class SliderWidget : public ButtonWidget
SliderWidget(GuiObject* boss, const GUI::Font& font, SliderWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, const string& label = "", int x, int y, int w, int h, const string& label = "",
int labelWidth = 0, int cmd = 0); int labelWidth = 0, int cmd = 0);
SliderWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, const string& label = "",
int labelWidth = 0, int cmd = 0);
void setValue(int value); void setValue(int value);
int getValue() const { return _value; } int getValue() const { return _value; }