diff options
-rw-r--r-- | engines/dialogs.cpp | 43 | ||||
-rw-r--r-- | engines/dialogs.h | 3 | ||||
-rw-r--r-- | gui/ThemeModern.cpp | 10 | ||||
-rw-r--r-- | gui/ThemeModern.h | 21 | ||||
-rw-r--r-- | gui/theme.h | 3 | ||||
-rw-r--r-- | gui/themes/modern.ini | 25 | ||||
-rw-r--r-- | gui/themes/modern.zip | bin | 42693 -> 54028 bytes |
7 files changed, 94 insertions, 11 deletions
diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp index 3d93a0da23..7c5963544c 100644 --- a/engines/dialogs.cpp +++ b/engines/dialogs.cpp @@ -35,6 +35,7 @@ #include "gui/eval.h" #include "gui/newgui.h" #include "gui/ListWidget.h" +#include "gui/theme.h" #include "engines/dialogs.h" #include "engines/engine.h" @@ -77,7 +78,18 @@ enum { MainMenuDialog::MainMenuDialog(Engine *engine) : GlobalDialog("globalmain"), _engine(engine) { +#ifndef DISABLE_FANCY_THEMES + _logo = 0; + if (g_gui.evaluator()->getVar("global_logo.visible") == 1 && g_gui.theme()->supportsImages()) { + _logo = new GUI::GraphicsWidget(this, "global_logo"); + _logo->useThemeTransparency(true); + _logo->setGfx(g_gui.theme()->getImageSurface(GUI::Theme::kImageLogoSmall)); + } else { + new StaticTextWidget(this, "global_title", "ScummVM"); + } +#else new StaticTextWidget(this, "global_title", "ScummVM"); +#endif new StaticTextWidget(this, "global_version", gScummVMVersionDate); @@ -136,6 +148,37 @@ void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat } } +void MainMenuDialog::reflowLayout() { +#ifndef DISABLE_FANCY_THEMES + if (g_gui.evaluator()->getVar("global_logo.visible") == 1 && g_gui.theme()->supportsImages()) { + if (!_logo) + _logo = new GUI::GraphicsWidget(this, "global_logo"); + _logo->useThemeTransparency(true); + _logo->setGfx(g_gui.theme()->getImageSurface(GUI::Theme::kImageLogoSmall)); + + GUI::StaticTextWidget *title = (StaticTextWidget *)findWidget("global_title"); + if (title) { + removeWidget(title); + title->setNext(0); + delete title; + } + } else { + GUI::StaticTextWidget *title = (StaticTextWidget *)findWidget("global_title"); + if (!title) + new StaticTextWidget(this, "global_title", "ScummVM"); + + if (_logo) { + removeWidget(_logo); + _logo->setNext(0); + delete _logo; + _logo = 0; + } + } +#endif + + Dialog::reflowLayout(); +} + enum { kOKCmd = 'ok ' }; diff --git a/engines/dialogs.h b/engines/dialogs.h index 61c06006cb..66ea13b8f1 100644 --- a/engines/dialogs.h +++ b/engines/dialogs.h @@ -49,9 +49,12 @@ public: virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); + virtual void reflowLayout(); + protected: Engine *_engine; + GUI::GraphicsWidget *_logo; GUI::ButtonWidget *_rtlButton; GUI::Dialog *_aboutDialog; GUI::Dialog *_optionsDialog; diff --git a/gui/ThemeModern.cpp b/gui/ThemeModern.cpp index 177171b40c..f6752f433c 100644 --- a/gui/ThemeModern.cpp +++ b/gui/ThemeModern.cpp @@ -1159,6 +1159,15 @@ OverlayColor ThemeModern::getColor(State state) { return _colors[kColorStateEnabled]; } +const Graphics::Surface *ThemeModern::getImageSurface(const kThemeImages n) const { + if (n == kImageLogo) + return _images[kThemeLogo]; + else if (n == kImageLogoSmall) + return _images[kThemeLogoSmall]; + else + return 0; +} + void ThemeModern::resetupGuiRenderer() { if (_lastUsedBitMask == gBitFormat || !_initOk) { // ok same format no need to reload @@ -1334,6 +1343,7 @@ void ThemeModern::processExtraValues() { _imageHandles[kWidgetArrow] = _evaluator->getStringVar("pix_widget_arrow"); _imageHandles[kThemeLogo] = _evaluator->getStringVar("pix_theme_logo"); + _imageHandles[kThemeLogoSmall] = _evaluator->getStringVar("pix_theme_logo_small"); _imageHandles[kGUICursor] = _evaluator->getStringVar("pix_cursor_image"); diff --git a/gui/ThemeModern.h b/gui/ThemeModern.h index a3cb71510c..d64d18242e 100644 --- a/gui/ThemeModern.h +++ b/gui/ThemeModern.h @@ -82,7 +82,7 @@ public: int getTabPadding() const; bool supportsImages() const { return true; } - const Graphics::Surface *getImageSurface(const kThemeImages n) const { return n == kImageLogo ? _images[kThemeLogo] : 0; } + const Graphics::Surface *getImageSurface(const kThemeImages n) const; private: void colorFade(const Common::Rect &r, OverlayColor start, OverlayColor end, uint factor = 1); void drawRect(const Common::Rect &r, const Graphics::Surface *corner, const Graphics::Surface *top, @@ -193,18 +193,19 @@ private: kWidgetSmallBkgd = 38, kThemeLogo = 39, + kThemeLogoSmall = 40, - kPopUpWidgetBkgdCorner = 40, - kPopUpWidgetBkgdTop = 41, - kPopUpWidgetBkgdLeft = 42, - kPopUpWidgetBkgd = 43, + kPopUpWidgetBkgdCorner = 41, + kPopUpWidgetBkgdTop = 42, + kPopUpWidgetBkgdLeft = 43, + kPopUpWidgetBkgd = 44, - kEditTextBkgdCorner = 44, - kEditTextBkgdTop = 45, - kEditTextBkgdLeft = 46, - kEditTextBkgd = 47, + kEditTextBkgdCorner = 45, + kEditTextBkgdTop = 46, + kEditTextBkgdLeft = 47, + kEditTextBkgd = 48, - kGUICursor = 48, + kGUICursor = 49, kImageHandlesMax }; diff --git a/gui/theme.h b/gui/theme.h index 3201eefca0..8e17dd0572 100644 --- a/gui/theme.h +++ b/gui/theme.h @@ -356,7 +356,8 @@ public: //! Special image ids for images used in the GUI enum kThemeImages { - kImageLogo = 0 //! ScummVM Logo used in the launcher + kImageLogo = 0, //! ScummVM Logo used in the launcher + kImageLogoSmall //! ScummVM logo used in the GMM }; /** diff --git a/gui/themes/modern.ini b/gui/themes/modern.ini index 8dbe7331f8..787dde0faa 100644 --- a/gui/themes/modern.ini +++ b/gui/themes/modern.ini @@ -67,6 +67,7 @@ pix_edittext_bkgd_left="button_bkgd_left.bmp" pix_edittext_bkgd_bkgd="button_bkgd.bmp" pix_theme_logo="logo.bmp" +pix_theme_logo_small="logo_small.bmp" pix_cursor_image="cursor.bmp" @@ -260,6 +261,30 @@ launcher_quit_button=prev.x (prev.y2 + space1) prev.w prev.h use=scummmain +#### Global Main Menu Dialog +# note that globalmain size depends on overall height +hBorder=10 +gmW=(scummmainButtonWidth + (2 * scummmainHOffset) + 80) +global_logo=((gmW - 142) / 2) 25 142 40 +global_logo.visible=true +global_version=hBorder (prev.y + prev.h) (gmW - 2 * hBorder) kLineHeight +global_version.align=kTextAlignCenter +gmY=((scummmainVSpace * 7)+ scummmainVAddOff) +globalmain_resume=globalmainHOffset gmY scummmainButtonWidth scummmainButtonHeight +gmY=(gmY + scummmainButtonHeight + scummmainVAddOff) +gmY=(gmY + scummmainVSpace) +globalmain_options=prev.x gmY prev.w prev.h +gmY=(gmY + scummmainButtonHeight + scummmainVAddOff) +globalmain_about=prev.x gmY prev.w prev.h +gmY=(gmY + scummmainButtonHeight + scummmainVAddOff) +gmY=(gmY + scummmainVSpace) +globalmain_rtl=prev.x gmY prev.w prev.h +gmY=(gmY + scummmainButtonHeight + scummmainVAddOff) +globalmain_quit=prev.x gmY prev.w prev.h +gmY=(gmY + scummmainButtonHeight + scummmainVAddOff) +gmH=(gmY + scummmainVSpace) +globalmain=((w - gmW) / 2) ((h - gmH) / 2) gmW gmH + ### global options globaloptions=insetX insetY insetW insetH set_parent=globaloptions diff --git a/gui/themes/modern.zip b/gui/themes/modern.zip Binary files differindex 739c6d23ac..9a9624a9e5 100644 --- a/gui/themes/modern.zip +++ b/gui/themes/modern.zip |