diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index 35ca04c42..1f5730288 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -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 diff --git a/src/emucore/OSystem.hxx b/src/emucore/OSystem.hxx index 11c93f5f2..857b1de79 100644 --- a/src/emucore/OSystem.hxx +++ b/src/emucore/OSystem.hxx @@ -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; diff --git a/src/gui/GameInfoDialog.cxx b/src/gui/GameInfoDialog.cxx index 8dab52e6c..46976be2a 100644 --- a/src/gui/GameInfoDialog.cxx +++ b/src/gui/GameInfoDialog.cxx @@ -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); diff --git a/src/gui/UIDialog.cxx b/src/gui/UIDialog.cxx index cb65cbfc2..aa539a83c 100644 --- a/src/gui/UIDialog.cxx +++ b/src/gui/UIDialog.cxx @@ -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); diff --git a/src/gui/VideoDialog.cxx b/src/gui/VideoDialog.cxx index d96af9886..6cb307fe2 100644 --- a/src/gui/VideoDialog.cxx +++ b/src/gui/VideoDialog.cxx @@ -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); diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx index 1ca9b7eb1..19abbf4bd 100644 --- a/src/gui/Widget.cxx +++ b/src/gui/Widget.cxx @@ -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) { diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx index b7a7999f7..a000fccc6 100644 --- a/src/gui/Widget.hxx +++ b/src/gui/Widget.hxx @@ -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: