mirror of https://github.com/stella-emu/stella.git
A few UI improvements:
Some messages now use a smaller font, so the UI doesn't look quite so monotonous. SliderWidgets suppport the mouse scroll wheel to change values. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2097 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
764e598536
commit
5a89e78fe2
|
@ -165,6 +165,7 @@ OSystem::~OSystem()
|
|||
delete myCommandMenu;
|
||||
delete myLauncher;
|
||||
delete myFont;
|
||||
delete myInfoFont;
|
||||
delete mySmallFont;
|
||||
delete myConsoleFont;
|
||||
delete myLauncherFont;
|
||||
|
@ -224,18 +225,22 @@ bool OSystem::create()
|
|||
////////////////////////////////////////////////////////////////////
|
||||
bool smallScreen = myDesktopWidth < 640 || myDesktopHeight < 480;
|
||||
|
||||
// The console font is always the same size (for now at least)
|
||||
myConsoleFont = new GUI::Font(GUI::consoleDesc);
|
||||
|
||||
// This font is used in a variety of situations when a really small
|
||||
// font is needed; we let the specific widget/dialog decide when to
|
||||
// use it
|
||||
mySmallFont = new GUI::Font(GUI::stellaDesc);
|
||||
|
||||
// The console font is always the same size (for now at least)
|
||||
myConsoleFont = new GUI::Font(GUI::consoleDesc);
|
||||
|
||||
// The general font used in all UI elements
|
||||
// This is determined by the size of the framebuffer
|
||||
myFont = new GUI::Font(smallScreen ? GUI::stellaDesc : GUI::stellaMediumDesc);
|
||||
|
||||
// The info font used in all UI elements
|
||||
// This is determined by the size of the framebuffer
|
||||
myInfoFont = new GUI::Font(smallScreen ? GUI::stellaDesc : GUI::consoleDesc);
|
||||
|
||||
// The font used by the ROM launcher
|
||||
// Normally, this is configurable by the user, except in the case of
|
||||
// very small screens
|
||||
|
|
|
@ -183,13 +183,6 @@ class OSystem
|
|||
inline CheatManager& cheat() const { return *myCheatManager; }
|
||||
#endif
|
||||
|
||||
/**
|
||||
Get the small font object of the system
|
||||
|
||||
@return The font reference
|
||||
*/
|
||||
inline const GUI::Font& smallFont() const { return *mySmallFont; }
|
||||
|
||||
/**
|
||||
Get the font object of the system
|
||||
|
||||
|
@ -197,6 +190,20 @@ class OSystem
|
|||
*/
|
||||
inline const GUI::Font& font() const { return *myFont; }
|
||||
|
||||
/**
|
||||
Get the info font object of the system
|
||||
|
||||
@return The font reference
|
||||
*/
|
||||
inline const GUI::Font& infoFont() const { return *myInfoFont; }
|
||||
|
||||
/**
|
||||
Get the small font object of the system
|
||||
|
||||
@return The font reference
|
||||
*/
|
||||
inline const GUI::Font& smallFont() const { return *mySmallFont; }
|
||||
|
||||
/**
|
||||
Get the launcher font object of the system
|
||||
|
||||
|
@ -545,12 +552,15 @@ class OSystem
|
|||
string myFeatures;
|
||||
string myBuildInfo;
|
||||
|
||||
// The font object to use when space is very limited
|
||||
GUI::Font* mySmallFont;
|
||||
|
||||
// The font object to use for the normal in-game GUI
|
||||
GUI::Font* myFont;
|
||||
|
||||
// The info font object to use for the normal in-game GUI
|
||||
GUI::Font* myInfoFont;
|
||||
|
||||
// The font object to use when space is very limited
|
||||
GUI::Font* mySmallFont;
|
||||
|
||||
// The font object to use for the ROM launcher
|
||||
GUI::Font* myLauncherFont;
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ GameInfoDialog::GameInfoDialog(
|
|||
myPropertiesLoaded(false),
|
||||
myDefaultsSelected(false)
|
||||
{
|
||||
const GUI::Font& ifont = instance().infoFont();
|
||||
const int lineHeight = font.getLineHeight(),
|
||||
fontWidth = font.getMaxCharWidth(),
|
||||
fontHeight = font.getFontHeight(),
|
||||
|
@ -66,7 +67,7 @@ GameInfoDialog::GameInfoDialog(
|
|||
// The tab widget
|
||||
xpos = 2; ypos = vBorder;
|
||||
myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos,
|
||||
_h - buttonHeight - 2*fontHeight - 20);
|
||||
_h - buttonHeight - fontHeight - ifont.getLineHeight() - 20);
|
||||
addTabWidget(myTab);
|
||||
addFocusWidget(myTab);
|
||||
|
||||
|
@ -351,8 +352,8 @@ GameInfoDialog::GameInfoDialog(
|
|||
myTab->setActiveTab(0);
|
||||
|
||||
// Add message concerning usage
|
||||
lwidth = font.getStringWidth("(*) Changes to properties require a ROM reload");
|
||||
new StaticTextWidget(this, font, 10, _h - buttonHeight - fontHeight - 20,
|
||||
lwidth = ifont.getStringWidth("(*) Changes to properties require a ROM reload");
|
||||
new StaticTextWidget(this, ifont, 10, _h - buttonHeight - fontHeight - 20,
|
||||
lwidth, fontHeight,
|
||||
"(*) Changes to properties require a ROM reload",
|
||||
kTextAlignLeft);
|
||||
|
|
|
@ -41,6 +41,7 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
|
|||
const GUI::Font& font)
|
||||
: Dialog(osystem, parent, 0, 0, 0, 0)
|
||||
{
|
||||
const GUI::Font& ifont = instance().infoFont();
|
||||
const int lineHeight = font.getLineHeight(),
|
||||
fontWidth = font.getMaxCharWidth(),
|
||||
fontHeight = font.getFontHeight(),
|
||||
|
@ -53,7 +54,7 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
|
|||
StringMap items;
|
||||
|
||||
// Set real dimensions
|
||||
_w = 42 * fontWidth + 10;
|
||||
_w = 37 * fontWidth + 10;
|
||||
_h = 9 * (lineHeight + 4) + 10;
|
||||
|
||||
// The tab widget
|
||||
|
@ -138,8 +139,8 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
|
|||
|
||||
// Add message concerning usage
|
||||
xpos = vBorder; ypos += 1*(lineHeight + 4);
|
||||
lwidth = font.getStringWidth("(*) Changes require application restart");
|
||||
new StaticTextWidget(myTab, font, xpos, ypos, lwidth, fontHeight,
|
||||
lwidth = ifont.getStringWidth("(*) Changes require application restart");
|
||||
new StaticTextWidget(myTab, ifont, xpos, ypos, BSPF_min(lwidth, _w-20), fontHeight,
|
||||
"(*) Changes require application restart",
|
||||
kTextAlignLeft);
|
||||
|
||||
|
@ -198,12 +199,6 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
|
|||
myDebuggerHeightLabel->clearFlags(WIDGET_ENABLED);
|
||||
}
|
||||
|
||||
// Add message concerning usage
|
||||
xpos = vBorder; ypos += 2*(lineHeight + 4);
|
||||
lwidth = font.getStringWidth("(*) Changes require ROM reload");
|
||||
new StaticTextWidget(myTab, font, xpos, ypos, lwidth, fontHeight,
|
||||
"(*) Changes require ROM reload", kTextAlignLeft);
|
||||
|
||||
// Add items for tab 1
|
||||
addToFocusList(wid, tabID);
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
|
||||
// Set real dimensions
|
||||
_w = BSPF_min(52 * fontWidth + 10, max_w);
|
||||
_h = BSPF_min(15 * (lineHeight + 4) + 10, max_h);
|
||||
_h = BSPF_min(14 * (lineHeight + 4) + 10, max_h);
|
||||
|
||||
// The tab widget
|
||||
xpos = ypos = 5;
|
||||
|
@ -171,8 +171,9 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
myFrameRateLabel->setFlags(WIDGET_CLEARBG);
|
||||
|
||||
// Add message concerning usage
|
||||
ypos = myTab->getHeight() - 5 - 2*fontHeight - 10;
|
||||
new StaticTextWidget(myTab, font, 10, ypos,
|
||||
const GUI::Font& infofont = instance().infoFont();
|
||||
ypos = myTab->getHeight() - 5 - fontHeight - infofont.getFontHeight()- 10;
|
||||
new StaticTextWidget(myTab, infofont, 10, ypos,
|
||||
font.getStringWidth("(*) Requires application restart"), fontHeight,
|
||||
"(*) Requires application restart", kTextAlignLeft);
|
||||
|
||||
|
|
|
@ -610,6 +610,18 @@ void SliderWidget::handleMouseUp(int x, int y, int button, int clickCount)
|
|||
_isDragging = false;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SliderWidget::handleMouseWheel(int x, int y, int direction)
|
||||
{
|
||||
if(isEnabled())
|
||||
{
|
||||
if(direction < 0)
|
||||
handleEvent(Event::UIUp);
|
||||
else if(direction > 0)
|
||||
handleEvent(Event::UIDown);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SliderWidget::handleEvent(Event::Type e)
|
||||
{
|
||||
|
|
|
@ -295,6 +295,7 @@ class SliderWidget : public ButtonWidget
|
|||
virtual void handleMouseMoved(int x, int y, int button);
|
||||
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
||||
virtual void handleMouseUp(int x, int y, int button, int clickCount);
|
||||
virtual void handleMouseWheel(int x, int y, int direction);
|
||||
virtual bool handleEvent(Event::Type event);
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in New Issue