mirror of https://github.com/stella-emu/stella.git
Added (fixed) tickmark intervals to SliderWidget
This commit is contained in:
parent
1c4345eff3
commit
97a0638845
|
@ -1008,11 +1008,11 @@ void FrameBuffer::VideoModeList::setZoom(uInt32 zoom)
|
|||
kScrollColor Normal scrollbar color
|
||||
kScrollColorHi Highlighted scrollbar color
|
||||
*** Slider colors ***
|
||||
kSliderColor,
|
||||
kSliderColorHi
|
||||
kSliderBGColor
|
||||
kSliderBGColorHi
|
||||
kSliderBGColorLo,
|
||||
kSliderColor Enabled slider
|
||||
kSliderColorHi Focussed slider
|
||||
kSliderBGColor Enabled slider background
|
||||
kSliderBGColorHi Focussed slider background
|
||||
kSliderBGColorLo Disabled slider background
|
||||
*** Debugger colors ***
|
||||
kDbgChangedColor Background color for changed cells
|
||||
kDbgChangedTextColor Text color for changed cells
|
||||
|
@ -1055,7 +1055,7 @@ uInt32 FrameBuffer::ourGUIColors[3][kNumColors-256] = {
|
|||
0xe1e1e1, 0xe5f1fb, 0x808080, 0x0078d7, 0x000000, 0x000000, // buttons
|
||||
0x333333, // checkbox
|
||||
0xc0c0c0, 0x808080, // scrollbar
|
||||
0x333333, 0x0078d7, 0xc0c0c0, 0x808080, 0xe1e1e1, // slider
|
||||
0x333333, 0x0078d7, 0xc0c0c0, 0xffffff, 0xc0c0c0, // slider 0xBDDEF9| 0xe1e1e1 | 0xffffff
|
||||
0xffc0c0, 0x000000, 0xe00000, 0xc00000, // debugger
|
||||
0xffffff, 0x333333, 0xf0f0f0, 0x808080, 0xc0c0c0 // other
|
||||
}
|
||||
|
|
|
@ -205,6 +205,7 @@ void DeveloperDialog::addVideoTab(const GUI::Font& font)
|
|||
myTVJitterWidget->getRight() + fontWidth * 3, ypos - 1,
|
||||
"Recovery ", 0, kTVJitterChanged);
|
||||
myTVJitterRecWidget->setMinValue(1); myTVJitterRecWidget->setMaxValue(20);
|
||||
myTVJitterRecWidget->setTickmarkInterval(5);
|
||||
wid.push_back(myTVJitterRecWidget);
|
||||
myTVJitterRecLabelWidget = new StaticTextWidget(myTab, font,
|
||||
myTVJitterRecWidget->getRight() + 4,
|
||||
|
|
|
@ -94,6 +94,7 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
|
|||
SliderWidget* s = new SliderWidget(myTab, font, xpos, ypos - 1, swidth, lineHeight,
|
||||
"TIA zoom", lwidth, 0, fontWidth * 4, "%");
|
||||
s->setMinValue(200); s->setMaxValue(500);
|
||||
s->setTickmarkInterval(3); // just for testing now; TODO: remove or redefine
|
||||
wid.push_back(s);
|
||||
ypos += lineHeight + VGAP;
|
||||
|
||||
|
|
|
@ -638,7 +638,8 @@ SliderWidget::SliderWidget(GuiObject* boss, const GUI::Font& font,
|
|||
_valueLabelGap(valueLabelGap),
|
||||
_valueLabelWidth(valueLabelWidth),
|
||||
_valueLabel(""),
|
||||
_valueUnit(valueUnit)
|
||||
_valueUnit(valueUnit),
|
||||
_numIntervals(0)
|
||||
{
|
||||
_flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE;
|
||||
_bgcolor = kDlgColor;
|
||||
|
@ -721,6 +722,13 @@ void SliderWidget::setValueUnit(const string& valueUnit)
|
|||
setDirty();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SliderWidget::setTickmarkInterval(int numIntervals)
|
||||
{
|
||||
_numIntervals = numIntervals;
|
||||
setDirty();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SliderWidget::handleMouseMoved(int x, int y)
|
||||
{
|
||||
|
@ -816,6 +824,30 @@ void SliderWidget::drawWidget(bool hilite)
|
|||
// Draw the 'bar'
|
||||
s.fillRect(x, y, p, h,
|
||||
!isEnabled() ? kColor : hilite ? kSliderColorHi : kSliderColor);
|
||||
|
||||
// Draw the 'tickmarks'
|
||||
for(int i = 1; i < _numIntervals; ++i)
|
||||
{
|
||||
int xt = x + (_w - _labelWidth - _valueLabelGap - _valueLabelWidth) * i / _numIntervals - 1;
|
||||
uInt32 color;
|
||||
|
||||
if(isEnabled())
|
||||
{
|
||||
if(xt > x + p)
|
||||
color = hilite ? kSliderColorHi : kSliderColor;
|
||||
else
|
||||
color = hilite ? kSliderBGColorHi : kSliderBGColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(xt > x + p)
|
||||
color = kColor;
|
||||
else
|
||||
color = kSliderBGColorLo;
|
||||
}
|
||||
s.vLine(xt, y + h / 2, y + h - 1, color);
|
||||
}
|
||||
|
||||
// Draw the 'handle'
|
||||
s.fillRect(x + p, y - 2, 2, h + 4,
|
||||
!isEnabled() ? kColor : hilite ? kSliderColorHi : kSliderColor);
|
||||
|
|
|
@ -328,6 +328,8 @@ class SliderWidget : public ButtonWidget
|
|||
const string& getValueLabel() const { return _valueLabel; }
|
||||
void setValueUnit(const string& valueUnit);
|
||||
|
||||
void setTickmarkInterval(int numIntervals);
|
||||
|
||||
protected:
|
||||
void handleMouseMoved(int x, int y) override;
|
||||
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
|
||||
|
@ -349,6 +351,7 @@ class SliderWidget : public ButtonWidget
|
|||
string _valueUnit;
|
||||
int _valueLabelWidth;
|
||||
int _valueLabelGap;
|
||||
int _numIntervals;
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
|
|
Loading…
Reference in New Issue