From 5e5a221b0eba9dac64b81dbabfb613c19ddb7045 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 8 Oct 2006 10:57:48 +0000 Subject: - added config file support for the classic theme - added a sample config file (called 'classic.ini', which is based on Theme::_defaultConfigINI) - added check for the type of the theme config file ('modern' and 'classic' for the respective Theme classes) - bumped theme config version for the modern theme svn-id: r24199 --- gui/ThemeClassic.cpp | 96 +++++++++-- gui/ThemeNew.cpp | 181 +++---------------- gui/theme.cpp | 154 ++++++++++++++++- gui/theme.h | 32 +++- gui/themes/classic.ini | 458 +++++++++++++++++++++++++++++++++++++++++++++++++ gui/themes/modern.ini | 3 +- 6 files changed, 741 insertions(+), 183 deletions(-) create mode 100644 gui/themes/classic.ini diff --git a/gui/ThemeClassic.cpp b/gui/ThemeClassic.cpp index babb03b24d..b4353c9f28 100644 --- a/gui/ThemeClassic.cpp +++ b/gui/ThemeClassic.cpp @@ -20,19 +20,23 @@ */ #include "gui/theme.h" +#include "gui/eval.h" + +#define THEME_VERSION 1 namespace GUI { ThemeClassic::ThemeClassic(OSystem *system) : Theme() { + _stylefile = "classic"; _system = system; _initOk = false; + _font = 0; memset(&_screen, 0, sizeof(_screen)); #ifndef CT_NO_TRANSPARENCY memset(&_dialog, 0, sizeof(_dialog)); #endif _font = 0; - - // Maybe change this filename - _configFile.loadFromFile("classic.ini"); + + loadConfigFile(_stylefile); } ThemeClassic::~ThemeClassic() { @@ -45,22 +49,29 @@ bool ThemeClassic::init() { if (_screen.pixels) { _initOk = true; clearAll(); - _bgcolor = _system->RGBToColor(0, 0, 0); - _color = _system->RGBToColor(104, 104, 104); - _shadowcolor = _system->RGBToColor(64, 64, 64); - _textcolor = _system->RGBToColor(32, 160, 32); - _textcolorhi = _system->RGBToColor(0, 255, 0); + resetDrawArea(); + } + + if (isThemeLoadingRequired()) { + loadTheme(_defaultConfig); + loadTheme(_configFile, false); + + setupConfig(); + } + + _bgcolor = _system->RGBToColor(_colors[kBGColor][0], _colors[kBGColor][1], _colors[kBGColor][2]); + _color = _system->RGBToColor(_colors[kColor][0], _colors[kColor][1], _colors[kColor][2]); + _shadowcolor = _system->RGBToColor(_colors[kShadowColor][0], _colors[kShadowColor][1], _colors[kShadowColor][2]); + _textcolor = _system->RGBToColor(_colors[kTextColor][0], _colors[kTextColor][1], _colors[kTextColor][2]); + _textcolorhi = _system->RGBToColor(_colors[kTextColorHi][0], _colors[kTextColorHi][1], _colors[kTextColorHi][2]); + if (_fontName == "builtin") { if (_screen.w >= 400 && _screen.h >= 300) { _font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont); } else { _font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont); } - resetDrawArea(); } - if (isThemeLoadingRequired()) - loadTheme(_defaultConfig); - return true; } @@ -74,11 +85,6 @@ void ThemeClassic::deinit() { void ThemeClassic::refresh() { init(); - _bgcolor = _system->RGBToColor(0, 0, 0); - _color = _system->RGBToColor(104, 104, 104); - _shadowcolor = _system->RGBToColor(64, 64, 64); - _textcolor = _system->RGBToColor(32, 160, 32); - _textcolorhi = _system->RGBToColor(0, 255, 0); if (_enabled) _system->showOverlay(); } @@ -615,5 +621,61 @@ void ThemeClassic::blendScreenToDialog() { } } #endif + +void ThemeClassic::setupConfig() { + if (_configFile.hasSection("theme")) { + loadConfig(); + return; + } + + static const uint8 colors[][3] = { + { 104, 104, 104 }, + { 64, 64, 64 }, + { 0, 0, 0, }, + { 32, 160, 32 }, + { 0, 255, 0 } + }; + + memcpy(_colors, colors, sizeof(colors)); +} + +bool ThemeClassic::loadConfig() { + Common::String temp; + _configFile.getKey("version", "theme", temp); + if (atoi(temp.c_str()) != THEME_VERSION) { + // TODO: improve this detection and handle it nicer + warning("Theme config uses a different version (you have: '%s', needed is: '%d')", temp.c_str(), THEME_VERSION); + return false; + } + + temp.clear(); + _configFile.getKey("type", "theme", temp); + if (0 != temp.compareToIgnoreCase("classic")) { + warning("Theme config is not for the classic style theme"); + return false; + } + + getColorFromConfig("color", _colors[kColor][0], _colors[kColor][1], _colors[kColor][2]); + getColorFromConfig("shadowcolor", _colors[kShadowColor][0], _colors[kShadowColor][1], _colors[kShadowColor][2]); + getColorFromConfig("bgcolor", _colors[kBGColor][0], _colors[kBGColor][1], _colors[kBGColor][2]); + getColorFromConfig("textcolor", _colors[kTextColor][0], _colors[kTextColor][1], _colors[kTextColor][2]); + getColorFromConfig("textcolorhi", _colors[kTextColorHi][0], _colors[kTextColorHi][1], _colors[kTextColorHi][2]); + + temp.clear(); + temp = _evaluator->getStringVar("font"); + if (temp.empty() || temp.compareToIgnoreCase("builtin")) { + if (_fontName != "builtin") + delete _font; + _fontName = "builtin"; + } else if (temp != _fontName) { + if (_fontName != "builtin") + delete _font; + _font = loadFont(temp.c_str()); + _fontName = temp; + } + + return true; +} + } // end of namespace GUI diff --git a/gui/ThemeNew.cpp b/gui/ThemeNew.cpp index 587cf0ff59..00ddc2e7e0 100644 --- a/gui/ThemeNew.cpp +++ b/gui/ThemeNew.cpp @@ -33,8 +33,6 @@ #include "common/config-manager.h" #include "common/file.h" -#include "common/unzip.h" - #define kShadowTr0 8 #define kShadowTr1 16 #define kShadowTr2 32 @@ -43,7 +41,7 @@ #define kShadowTr4 128 #define kShadowTr5 192 -#define THEME_VERSION 17 +#define THEME_VERSION 18 using Graphics::Surface; @@ -58,7 +56,7 @@ OverlayColor calcGradient(OverlayColor start, OverlayColor end, int pos, int max #pragma mark - ThemeNew::ThemeNew(OSystem *system, const Common::String &stylefile) : Theme(), _system(system), _screen(), _initOk(false), -_lastUsedBitMask(0), _forceRedraw(false), _fonts(), _imageHandles(0), _images(0), _colors(), _cursor(0), _gradientFactors() { +_lastUsedBitMask(0), _forceRedraw(false), _imageHandles(0), _images(0), _colors(), _fonts(), _cursor(0), _gradientFactors() { _stylefile = stylefile; _initOk = false; _useCursor = false; @@ -73,51 +71,13 @@ _lastUsedBitMask(0), _forceRedraw(false), _fonts(), _imageHandles(0), _images(0) clearAll(); } - if (ConfMan.hasKey("themepath")) - Common::File::addDefaultDirectory(ConfMan.get("themepath")); - -#ifdef DATA_PATH - Common::File::addDefaultDirectoryRecursive(DATA_PATH); -#endif - - if (ConfMan.hasKey("extrapath")) - Common::File::addDefaultDirectoryRecursive(ConfMan.get("extrapath")); - - ImageMan.addArchive(stylefile + ".zip"); - - if (!_configFile.loadFromFile(stylefile + ".ini")) { -#ifdef USE_ZLIB - // Maybe find a nicer solution to this - unzFile zipFile = unzOpen((stylefile + ".zip").c_str()); - if (zipFile && unzLocateFile(zipFile, (stylefile + ".ini").c_str(), 2) == UNZ_OK) { - unz_file_info fileInfo; - unzOpenCurrentFile(zipFile); - unzGetCurrentFileInfo(zipFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0); - uint8 *buffer = new uint8[fileInfo.uncompressed_size+1]; - assert(buffer); - memset(buffer, 0, (fileInfo.uncompressed_size+1)*sizeof(uint8)); - unzReadCurrentFile(zipFile, buffer, fileInfo.uncompressed_size); - unzCloseCurrentFile(zipFile); - Common::MemoryReadStream stream(buffer, fileInfo.uncompressed_size+1); - if (!_configFile.loadFromStream(stream)) { - warning("Can not find theme config file '%s'", (stylefile + ".ini").c_str()); - unzClose(zipFile); - return; - } - delete [] buffer; - buffer = 0; - } else { - unzClose(zipFile); - warning("Can not find theme config file '%s'", (stylefile + ".ini").c_str()); - return; - } - unzClose(zipFile); -#else + if (!loadConfigFile(stylefile)) { warning("Can not find theme config file '%s'", (stylefile + ".ini").c_str()); return; -#endif } + ImageMan.addArchive(stylefile + ".zip"); + Common::String temp; _configFile.getKey("version", "theme", temp); if (atoi(temp.c_str()) != THEME_VERSION) { @@ -126,6 +86,13 @@ _lastUsedBitMask(0), _forceRedraw(false), _fonts(), _imageHandles(0), _images(0) return; } + temp.clear(); + _configFile.getKey("type", "theme", temp); + if (0 != temp.compareToIgnoreCase("modern")) { + warning("Theme config is not for the modern style theme"); + return; + } + _images = new const Graphics::Surface*[kImageHandlesMax]; assert(_images); @@ -1270,24 +1237,6 @@ void ThemeNew::setupColors() { #define FONT_NAME_FIXED_BOLD "newgui_fixed_bold" #define FONT_NAME_FIXED_ITALIC "newgui_fixed_italic" -void ThemeNew::setupFont(const String &key, const String &name, FontStyle style) { - if (_evaluator->getVar(key) == EVAL_STRING_VAR) { - _fonts[style] = FontMan.getFontByName(name); - - if (!_fonts[style]) { - Common::String temp(_evaluator->getStringVar(key)); - - _fonts[style] = loadFont(temp.c_str()); - if (!_fonts[style]) - error("Couldn't load %s font '%s'", key.c_str(), temp.c_str()); - - FontMan.assignFontToName(name, _fonts[style]); - } - } else { - _fonts[style] = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont); - } -} - void ThemeNew::setupFonts() { if (_screen.w >= 400 && _screen.h >= 270) { setupFont("fontfile_bold", FONT_NAME_BOLD, kFontStyleBold); @@ -1318,108 +1267,26 @@ void ThemeNew::deleteFonts() { FontMan.removeFontName(FONT_NAME_ITALIC); } -const Graphics::Font *ThemeNew::loadFont(const char *filename) { - const Graphics::NewFont *font = 0; - Common::String cacheFilename = genCacheFilename(filename); - Common::File fontFile; - - if (!cacheFilename.empty()) { - if (fontFile.open(cacheFilename)) - font = Graphics::NewFont::loadFromCache(fontFile); - if (font) - return font; - -#ifdef USE_ZLIB - unzFile zipFile = unzOpen((_stylefile + ".zip").c_str()); - if (zipFile && unzLocateFile(zipFile, cacheFilename.c_str(), 2) == UNZ_OK) { - unz_file_info fileInfo; - unzOpenCurrentFile(zipFile); - unzGetCurrentFileInfo(zipFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0); - uint8 *buffer = new uint8[fileInfo.uncompressed_size+1]; - assert(buffer); - memset(buffer, 0, (fileInfo.uncompressed_size+1)*sizeof(uint8)); - unzReadCurrentFile(zipFile, buffer, fileInfo.uncompressed_size); - unzCloseCurrentFile(zipFile); - Common::MemoryReadStream stream(buffer, fileInfo.uncompressed_size+1); - - font = Graphics::NewFont::loadFromCache(stream); - - delete [] buffer; - buffer = 0; - } - unzClose(zipFile); -#endif - if (font) - return font; - } - - // normal open - if (fontFile.open(filename)) { - font = Graphics::NewFont::loadFont(fontFile); - } - -#ifdef USE_ZLIB - if (!font) { - unzFile zipFile = unzOpen((_stylefile + ".zip").c_str()); - if (zipFile && unzLocateFile(zipFile, filename, 2) == UNZ_OK) { - unz_file_info fileInfo; - unzOpenCurrentFile(zipFile); - unzGetCurrentFileInfo(zipFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0); - uint8 *buffer = new uint8[fileInfo.uncompressed_size+1]; - assert(buffer); - memset(buffer, 0, (fileInfo.uncompressed_size+1)*sizeof(uint8)); - unzReadCurrentFile(zipFile, buffer, fileInfo.uncompressed_size); - unzCloseCurrentFile(zipFile); - Common::MemoryReadStream stream(buffer, fileInfo.uncompressed_size+1); - - font = Graphics::NewFont::loadFont(stream); - - delete [] buffer; - buffer = 0; - } - unzClose(zipFile); - } -#endif - - if (font) { - if (!cacheFilename.empty()) { - if (!Graphics::NewFont::cacheFontData(*font, cacheFilename)) { - warning("Couldn't create cache file for font '%s'", filename); - } - } - } +void ThemeNew::setupFont(const String &key, const String &name, FontStyle style) { + if (_evaluator->getVar(key) == EVAL_STRING_VAR) { + _fonts[style] = FontMan.getFontByName(name); - return font; -} + if (!_fonts[style]) { + Common::String temp(_evaluator->getStringVar(key)); -Common::String ThemeNew::genCacheFilename(const char *filename) { - Common::String cacheName(filename); - for (int i = cacheName.size() - 1; i >= 0; --i) { - if (cacheName[i] == '.') { - while ((uint)i < cacheName.size() - 1) { - cacheName.deleteLastChar(); - } + _fonts[style] = loadFont(temp.c_str()); + if (!_fonts[style]) + error("Couldn't load %s font '%s'", key.c_str(), temp.c_str()); - cacheName += "fcc"; - return cacheName; + FontMan.assignFontToName(name, _fonts[style]); } + } else { + _fonts[style] = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont); } - - return ""; } #pragma mark - -void ThemeNew::getColorFromConfig(const String &value, OverlayColor &color) { - const char *postfixes[] = {".r", ".g", ".b"}; - int rgb[3]; - - for (int cnt = 0; cnt < 3; cnt++) - rgb[cnt] = _evaluator->getVar(value + postfixes[cnt], 0); - - color = g_system->RGBToColor(rgb[0], rgb[1], rgb[2]); -} - void ThemeNew::processExtraValues() { static Common::String imageHandlesTable[kImageHandlesMax]; @@ -1539,8 +1406,6 @@ void ThemeNew::processExtraValues() { case kShadingLuminance: _dialogShadingCallback = &ThemeNew::calcLuminance; - // don't cache colors for the luminance effect - //createCacheTable = true; break; case kShadingDim: diff --git a/gui/theme.cpp b/gui/theme.cpp index 41403510f4..c0c4d32e05 100644 --- a/gui/theme.cpp +++ b/gui/theme.cpp @@ -22,9 +22,11 @@ #include "gui/theme.h" #include "gui/eval.h" +#include "common/unzip.h" + namespace GUI { -Theme::Theme() : _drawArea(), _configFile(), _loadedThemeX(0), _loadedThemeY(0) { +Theme::Theme() : _drawArea(), _stylefile(""), _configFile(), _loadedThemeX(0), _loadedThemeY(0) { Common::MemoryReadStream s((const byte *)_defaultConfigINI, strlen(_defaultConfigINI)); _defaultConfig.loadFromStream(s); @@ -35,4 +37,154 @@ Theme::~Theme() { delete _evaluator; } +void Theme::getColorFromConfig(const String &value, OverlayColor &color) { + const char *postfixes[] = {".r", ".g", ".b"}; + int rgb[3]; + + for (int cnt = 0; cnt < 3; cnt++) + rgb[cnt] = _evaluator->getVar(value + postfixes[cnt], 0); + + color = g_system->RGBToColor(rgb[0], rgb[1], rgb[2]); +} + +void Theme::getColorFromConfig(const String &value, uint8 &r, uint8 &g, uint8 &b) { + r = _evaluator->getVar(value + ".r", 0); + g = _evaluator->getVar(value + ".g", 0); + b = _evaluator->getVar(value + ".b", 0); +} + +const Graphics::Font *Theme::loadFont(const char *filename) { + const Graphics::NewFont *font = 0; + Common::String cacheFilename = genCacheFilename(filename); + Common::File fontFile; + + if (!cacheFilename.empty()) { + if (fontFile.open(cacheFilename)) + font = Graphics::NewFont::loadFromCache(fontFile); + if (font) + return font; + +#ifdef USE_ZLIB + unzFile zipFile = unzOpen((_stylefile + ".zip").c_str()); + if (zipFile && unzLocateFile(zipFile, cacheFilename.c_str(), 2) == UNZ_OK) { + unz_file_info fileInfo; + unzOpenCurrentFile(zipFile); + unzGetCurrentFileInfo(zipFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0); + uint8 *buffer = new uint8[fileInfo.uncompressed_size+1]; + assert(buffer); + memset(buffer, 0, (fileInfo.uncompressed_size+1)*sizeof(uint8)); + unzReadCurrentFile(zipFile, buffer, fileInfo.uncompressed_size); + unzCloseCurrentFile(zipFile); + Common::MemoryReadStream stream(buffer, fileInfo.uncompressed_size+1); + + font = Graphics::NewFont::loadFromCache(stream); + + delete [] buffer; + buffer = 0; + } + unzClose(zipFile); +#endif + if (font) + return font; + } + + // normal open + if (fontFile.open(filename)) { + font = Graphics::NewFont::loadFont(fontFile); + } + +#ifdef USE_ZLIB + if (!font) { + unzFile zipFile = unzOpen((_stylefile + ".zip").c_str()); + if (zipFile && unzLocateFile(zipFile, filename, 2) == UNZ_OK) { + unz_file_info fileInfo; + unzOpenCurrentFile(zipFile); + unzGetCurrentFileInfo(zipFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0); + uint8 *buffer = new uint8[fileInfo.uncompressed_size+1]; + assert(buffer); + memset(buffer, 0, (fileInfo.uncompressed_size+1)*sizeof(uint8)); + unzReadCurrentFile(zipFile, buffer, fileInfo.uncompressed_size); + unzCloseCurrentFile(zipFile); + Common::MemoryReadStream stream(buffer, fileInfo.uncompressed_size+1); + + font = Graphics::NewFont::loadFont(stream); + + delete [] buffer; + buffer = 0; + } + unzClose(zipFile); + } +#endif + + if (font) { + if (!cacheFilename.empty()) { + if (!Graphics::NewFont::cacheFontData(*font, cacheFilename)) { + warning("Couldn't create cache file for font '%s'", filename); + } + } + } + + return font; +} + +Common::String Theme::genCacheFilename(const char *filename) { + Common::String cacheName(filename); + for (int i = cacheName.size() - 1; i >= 0; --i) { + if (cacheName[i] == '.') { + while ((uint)i < cacheName.size() - 1) { + cacheName.deleteLastChar(); + } + + cacheName += "fcc"; + return cacheName; + } + } + + return ""; +} + +bool Theme::loadConfigFile(const String &stylefile) { + if (ConfMan.hasKey("themepath")) + Common::File::addDefaultDirectory(ConfMan.get("themepath")); + +#ifdef DATA_PATH + Common::File::addDefaultDirectoryRecursive(DATA_PATH); +#endif + + if (ConfMan.hasKey("extrapath")) + Common::File::addDefaultDirectoryRecursive(ConfMan.get("extrapath")); + + if (!_configFile.loadFromFile(stylefile + ".ini")) { +#ifdef USE_ZLIB + // Maybe find a nicer solution to this + unzFile zipFile = unzOpen((stylefile + ".zip").c_str()); + if (zipFile && unzLocateFile(zipFile, (stylefile + ".ini").c_str(), 2) == UNZ_OK) { + unz_file_info fileInfo; + unzOpenCurrentFile(zipFile); + unzGetCurrentFileInfo(zipFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0); + uint8 *buffer = new uint8[fileInfo.uncompressed_size+1]; + assert(buffer); + memset(buffer, 0, (fileInfo.uncompressed_size+1)*sizeof(uint8)); + unzReadCurrentFile(zipFile, buffer, fileInfo.uncompressed_size); + unzCloseCurrentFile(zipFile); + Common::MemoryReadStream stream(buffer, fileInfo.uncompressed_size+1); + if (!_configFile.loadFromStream(stream)) { + unzClose(zipFile); + return false; + } + delete [] buffer; + buffer = 0; + } else { + unzClose(zipFile); + return false; + } + unzClose(zipFile); +#else + return false; +#endif + } + + return true; +} + } // End of namespace GUI diff --git a/gui/theme.h b/gui/theme.h index a74fab8567..72253e5285 100644 --- a/gui/theme.h +++ b/gui/theme.h @@ -213,6 +213,15 @@ public: Eval *_evaluator; protected: + bool loadConfigFile(const String &file); + void getColorFromConfig(const String &name, OverlayColor &col); + void getColorFromConfig(const String &value, uint8 &r, uint8 &g, uint8 &b); + + const Graphics::Font *loadFont(const char *filename); + Common::String genCacheFilename(const char *filename); + + String _stylefile; + Common::Rect _drawArea; Common::ConfigFile _configFile; Common::ConfigFile _defaultConfig; @@ -294,11 +303,25 @@ private: bool _initOk; bool _enabled; + String _fontName; const Graphics::Font *_font; OverlayColor _color, _shadowcolor; OverlayColor _bgcolor; OverlayColor _textcolor; OverlayColor _textcolorhi; + + enum { + kColor = 0, + kShadowColor = 1, + kBGColor = 2, + kTextColor = 3, + kTextColorHi = 4, + kMaxColors = 5 + }; + uint8 _colors[kMaxColors][3]; + + void setupConfig(); + bool loadConfig(); }; #ifndef DISABLE_FANCY_THEMES @@ -389,8 +412,6 @@ private: Graphics::Surface _screen; Common::Rect _shadowDrawArea; - Common::String _stylefile; - bool _initOk; bool _forceRedraw; bool _enabled; @@ -407,14 +428,13 @@ private: void setupFonts(); void deleteFonts(); - const Graphics::Font *loadFont(const char *filename); - Common::String genCacheFilename(const char *filename); + + void setupFont(const String &key, const String &name, FontStyle style); + const Graphics::Font *_fonts[kFontStyleMax]; private: - void setupFont(const String &key, const String &name, FontStyle style); void processExtraValues(); - void getColorFromConfig(const String &value, OverlayColor &color); public: enum ImageHandles { diff --git a/gui/themes/classic.ini b/gui/themes/classic.ini new file mode 100644 index 0000000000..c26715343d --- /dev/null +++ b/gui/themes/classic.ini @@ -0,0 +1,458 @@ +# $URL$ +# $Id$ +[theme] +version=1 +type=classic + +[colors] +color=104 104 104 +shadowcolor=64 64 64 +bgcolor=0 0 0 +textcolor=32 160 32 +textcolorhi=0 255 0 + +[extra] +font="builtin" + +# Define our classic greenish theme here +[320xY] +def_widgetSize=kNormalWidgetSize +def_buttonWidth=kButtonWidth +def_buttonHeight=kButtonHeight +def_sliderWidth=kSliderWidth +def_sliderHeight=kSliderHeight +def_kLineHeight=12 +def_kFontHeight=10 +def_insetX=10 +def_insetY=10 +def_insetW=(w - 2 * 10) +def_insetH=(h - 30) +def_gameOptionsLabelWidth=60 +def_tabPopupsLabelW=100 +def_aboutXOff=3 +def_aboutYOff=2 +def_aboutOuterBorder=10 +def_scummmainHOffset=8 +def_scummmainVSpace=5 +def_scummmainVAddOff=2 +def_scummmainButtonWidth=90 +def_scummmainButtonHeight=16 +def_scummhelpX=5 +def_scummhelpW=(w - 2 * 5) +def_midiControlsSpacing=1 +def_vcAudioTabIndent=0 +def_vcAudioTabSpacing=2 +use=XxY + +TabWidget.tabWidth=0 +TabWidget.tabHeight=16 +TabWidget.titleVPad=2 +# Scumm Saveload dialog +scummsaveload=8 8 (w - 2 * 8) (h - 16) +set_parent=scummsaveload +scummsaveload_title=10 2 (parent.w - 2 * 10) kLineHeight +scummsaveload_list=10 18 prev.w (parent.h - 17 - buttonHeight - 8 - self.y) +scummsaveload_thumbnail=(parent.w - (kThumbnailWidth + 22)) 18 +scummsaveload_cancel=(parent.w - 2 * (buttonWidth + 10)) (parent.h - buttonHeight - 8) buttonWidth buttonHeight +scummsaveload_choose=(prev.x2 + 10) prev.y prev.w prev.h +scummsaveload_extinfo.visible=false + +# MM NES resolution +[256x240] +useAsIs=320xY + +[XxY] +def_widgetSize=kBigWidgetSize +def_buttonWidth=kBigButtonWidth +def_buttonHeight=kBigButtonHeight +def_sliderWidth=kBigSliderWidth +def_sliderHeight=kBigSliderHeight +def_kLineHeight=16 +def_kFontHeight=14 +def_insetX=10 +def_insetY=20 +def_insetW=(w - 2 * 10) +def_insetH=(h - 2 * 40) +def_gameOptionsLabelWidth=90 +def_tabPopupsLabelW=150 +def_aboutXOff=8 +def_aboutYOff=5 +def_aboutOuterBorder=80 +def_scummmainHOffset=12 +def_scummmainVSpace=7 +def_scummmainVAddOff=3 +def_scummmainButtonWidth=160 +def_scummmainButtonHeight=28 +def_scummhelpW=370 +def_scummhelpX=((w - scummhelpW) / 2) +def_midiControlsSpacing=2 +def_vcAudioTabIndent=10 +def_vcAudioTabSpacing=4 + +use=colors +use=extra + +##### Widgets config +ListWidget.leftPadding=4 +ListWidget.rightPadding=0 +ListWidget.topPadding=2 +ListWidget.bottomPadding=2 +ListWidget.hlLeftPadding=2 +ListWidget.hlRightPadding=1 +PopUpWidget.leftPadding=4 +PopUpWidget.rightPadding=0 +TabWidget.tabWidth=70 +TabWidget.tabHeight=21 +TabWidget.titleVPad=2 + +###### chooser +opHeight=(h * 7 / 10) +useWithPrefix=chooser defaultChooser_ + +##### browser +brW=((w * 7) / 8) +brH=((h * 9) / 10) +browser=((w - brW) / 2) ((h - brH) / 2) brW brH +set_parent=browser +browser_headline=10 kLineHeight (parent.w - 2 * 10) kLineHeight +browser_headline.align=kTextAlignCenter +browser_path=10 prev.y2 prev.w prev.h +browser_list=10 prev.y2 prev.w (parent.h - 3 * kLineHeight - buttonHeight - 14) +browser_up=10 (parent.h - buttonHeight - 8) buttonWidth buttonHeight +browser_cancel=(parent.w - 2 * (buttonWidth + 10)) (parent.h - buttonHeight - 8) buttonWidth buttonHeight +browser_choose=(prev.x2 + 10) prev.y prev.w prev.h + +##### launcher +hBorder=10 +launcher_version=hBorder 8 (w - 2 * hBorder) kLineHeight +launcher_version.align=kTextAlignCenter +top=(h - 8 - buttonHeight) +numButtons=4 +space=8 +butWidth=((w - 2 * hBorder - space * (numButtons - 1)) / numButtons) +launcher_quit_button=hBorder top butWidth buttonHeight +launcher_about_button=(prev.x2 + space) prev.y prev.w prev.h +launcher_options_button=(prev.x2 + space) prev.y prev.w prev.h +launcher_start_button=(prev.x2 + space) prev.y prev.w prev.h +top=(top - buttonHeight * 2) +numButtons=3 +space=10 +butWidth=((w - 2 * hBorder - space * (numButtons - 1)) / numButtons) +launcher_addGame_button=hBorder top butWidth buttonHeight +launcher_editGame_button=(prev.x2 + space) prev.y prev.w prev.h +launcher_removeGame_button=(prev.x2 + space) prev.y prev.w prev.h +launcher_list=hBorder (kLineHeight + 16) (w - 2 * hBorder) (top - kLineHeight - 20) + +### global options +globaloptions=insetX insetY insetW insetH +set_parent=globaloptions +vBorder=5 +globaloptions_tabwidget=0 vBorder parent.w (parent.h - buttonHeight - 8 - 2 * vBorder) + +# graphics tab +opYoffset=vBorder +opXoffset=0 +useWithPrefix=graphicsControls globaloptions_ + +# audio tab +opYoffset=vBorder +useWithPrefix=audioControls globaloptions_ +useWithPrefix=volumeControls globaloptions_ +useWithPrefix=subtitleControls globaloptions_ + +# MIDI tab +opYoffset=vBorder +useWithPrefix=midiControls globaloptions_ + +# paths tab +yoffset=vBorder +glOff=((buttonHeight - kLineHeight) / 2 + 2) +globaloptions_savebutton=10 yoffset (buttonWidth + 5) buttonHeight +globaloptions_savepath=(prev.x2 + 20) (yoffset + glOff) (parent.w - (prev.w + 20) - 15) kLineHeight +yoffset=(yoffset + buttonHeight + 4) +globaloptions_extrabutton=10 yoffset (buttonWidth + 5) buttonHeight +globaloptions_extrapath=(prev.x2 + 20) (yoffset + glOff) (parent.w - (prev.w + 20) - 15) kLineHeight +yoffset=(yoffset + buttonHeight + 4) +globaloptions_themebutton=10 yoffset (buttonWidth + 5) buttonHeight +globaloptions_themepath=(prev.x2 + 20) (yoffset + glOff) (parent.w - (prev.w + 20) - 15) kLineHeight +yoffset=(yoffset + buttonHeight + 4) +globaloptions_keysbutton=10 yoffset (buttonWidth + 5) buttonHeight + +globaloptions_cancel=(parent.w - 2 * (buttonWidth + 10)) (parent.h - buttonHeight - 8) buttonWidth buttonHeight +globaloptions_ok=(prev.x2 + 10) prev.y prev.w prev.h + +### game options +gameoptions=insetX insetY insetW insetH +set_parent=gameoptions +vBorder=5 +gox=5 +gow=(parent.w - 15) + +gameoptions_tabwidget=0 vBorder parent.w (parent.h - buttonHeight - 8 - 2 * vBorder) + +# game tab +opYoffset=vBorder +gameoptions_id=gox (opYoffset + 2) gameOptionsLabelWidth kLineHeight +gameoptions_id.align=kTextAlignRight +gameoptions_domain=prev.x2 (prev.y - 1) (parent.w - gameOptionsLabelWidth - 10 - gox) (prev.h + 2) +opYoffset=(opYoffset + prev.h + 5) +gameoptions_name=gox (opYoffset + 2) gameOptionsLabelWidth kLineHeight +gameoptions_name.align=kTextAlignRight +gameoptions_desc=prev.x2 (prev.y - 1) (parent.w - gameOptionsLabelWidth - 10 - gox) (prev.h + 2) +opYoffset=(opYoffset + prev.h + 7) +gameoptions_lang=gox (opYoffset - 1) gow (kLineHeight + 2) +opYoffset=(opYoffset + prev.h + 5) +gameoptions_platform=prev.x opYoffset prev.w prev.h +opYoffset=(opYoffset + prev.h + 5) + +# paths tab +opYoffset=vBorder +goOff=((buttonHeight - kLineHeight) / 2 + 2) +gameoptions_savepath=gox opYoffset (buttonWidth + 5) buttonHeight +gameoptions_savepathText=(prev.x2 + 20) (opYoffset + goOff) (parent.w - self.x - 10) kLineHeight +opYoffset=(opYoffset + buttonHeight + 4) +gameoptions_extrapath=gox opYoffset (buttonWidth + 5) buttonHeight +gameoptions_extrapathText=(prev.x2 + 20) (opYoffset + goOff) (parent.w - self.x - 10) kLineHeight +opYoffset=(opYoffset + buttonHeight + 4) +gameoptions_gamepath=gox opYoffset (buttonWidth + 5) buttonHeight +gameoptions_gamepathText=(prev.x2 + 20) (opYoffset + goOff) (parent.w - self.x - 10) kLineHeight +opYoffset=(opYoffset + buttonHeight + 4) + +# graphics tab +opYoffset=vBorder +opXoffset=gox +gameoptions_graphicsCheckbox=gox opYoffset (kFontHeight + 10 + 192) buttonHeight +opYoffset=(opYoffset + buttonHeight) +useWithPrefix=graphicsControls gameoptions_ + +# audio tab +opYoffset=vBorder +gameoptions_audioCheckbox=gox opYoffset (kFontHeight + 10 + 180) buttonHeight +opYoffset=(opYoffset + buttonHeight) +useWithPrefix=audioControls gameoptions_ +useWithPrefix=volumeControls gameoptions_ +useWithPrefix=subtitleControls gameoptions_ + +# midi tab +opYoffset=vBorder +gameoptions_midiCheckbox=gox opYoffset (kFontHeight + 10 + 174) buttonHeight +opYoffset=(opYoffset + buttonHeight) +useWithPrefix=midiControls gameoptions_ + +gameoptions_cancel=(parent.w - 2 * (buttonWidth + 10)) (parent.h - buttonHeight - 8) buttonWidth buttonHeight +gameoptions_ok=(prev.x2 + 10) prev.y prev.w prev.h + +### keys dialog +keysdialog=(w / 20) (h / 10) (w - w / 10) (h - h / 5) +set_parent=keysdialog +keysdialog_map=(parent.w - buttonWidth - 10) 20 buttonWidth buttonHeight +keysdialog_ok=prev.x (prev.y2 + 4) prev.w prev.h +keysdialog_cancel=prev.x (prev.y2 + 4) prev.w prev.h +keysdialog_list=10 10 (prev.x - 20) (parent.h - kLineHeight * 4 - self.y) +keysdialog_action=prev.x (parent.h - kLineHeight * 3) (parent.w - self.x * 2) kLineHeight +keysdialog_mapping=prev.x (prev.y + kLineHeight) prev.w prev.h + + + +##### SCUMM dialogs +scummDummyDialog=0 80 0 16 + +use=scummmain +## Engine config +# note that scummconfig size depends on overall height +# hence it is on the end of the list +opYoffset=8 +useWithPrefix=volumeControls scummconfig_ +useWithPrefix=subtitleControls scummconfig_ +opYoffset=(opYoffset + buttonHeight) +opYoffset=(opYoffset + buttonHeight + 4) +soWidth=(39 + 3 * buttonWidth) +scummconfig_keys=(soWidth - 3 * (buttonWidth + 4) + 6) opYoffset (buttonWidth - 10) buttonHeight +scummconfig_cancel=(prev.x2 + 4) prev.y (prev.w + 10) prev.h +scummconfig_ok=(prev.x2 + 4) prev.y prev.w prev.h +opYoffset=(opYoffset + buttonHeight) +scummconfig=((w - soWidth) / 2) ((h - opYoffset) / 2) soWidth (opYoffset + 8) + +## Help +scummHelpNumLines=15 +shH=(5 + (2 + scummHelpNumLines) * kFontHeight + buttonHeight + 7) +scummhelp=scummhelpX ((h - shH) / 2) scummhelpW shH +scummhelp_title=10 5 scummhelpW kFontHeight +scummhelp_key.x=10 +scummhelp_key.yoffset=5 +scummhelp_key.w=80 +scummhelp_key.h=kFontHeight +scummhelp_dsc.x=90 +scummhelp_dsc.yoffset=5 +scummhelp_dsc.w=(scummhelpW - 10 - 90) +scummhelp_dsc.h=kFontHeight +scummhelp_prev=10 (5 + kFontHeight * (scummHelpNumLines + 2) + 2) buttonWidth buttonHeight +scummhelp_next=(prev.x2 + 8) prev.y prev.w prev.h +scummhelp_close=(scummhelpW - 8 - buttonWidth) prev.y prev.w prev.h + +# Saveload dialog +scummsaveload=8 8 (w - 2 * 8) (h - 16) +set_parent=scummsaveload +scummsaveload_title=10 2 (parent.w - 2 * 10 - 180) kLineHeight +scummsaveload_title.align=kTextAlignCenter +scummsaveload_list=10 18 prev.w (parent.h - 17 - buttonHeight - 8 - self.y) +scummsaveload_thumbnail=(parent.w - (kThumbnailWidth + 18)) 22 +scummsaveload_thumbnail.hPad=4 +scummsaveload_thumbnail.vPad=4 +scummsaveload_thumbnail.fillR=0 +scummsaveload_thumbnail.fillG=0 +scummsaveload_thumbnail.fillB=0 +scummsaveload_cancel=(parent.w - 2 * (buttonWidth + 10)) (parent.h - buttonHeight - 8) buttonWidth buttonHeight +scummsaveload_choose=(prev.x2 + 10) prev.y prev.w prev.h +scummsaveload_extinfo.visible=true + +############################################ +[chooser] +chooserW=(w - 2 * 8) +chooser=((w - chooserW) / 2) ((h - opHeight) / 2) chooserW opHeight +chooser_headline=10 6 (chooserW - 2 * 10) (kLineHeight) +chooser_headline.align=kTextAlignCenter +chooser_list=10 (6 + kLineHeight + 2) prev.w (opHeight - self.y - buttonHeight - 12) +chooser_cancel=(chooserW - 2 * (buttonWidth + 10)) (opHeight - buttonHeight - 8) buttonWidth buttonHeight +chooser_ok=(prev.x2 + 10) prev.y prev.w prev.h + +[graphicsControls] +gcx=10 +gcw=(parent.w - 2 * 10) +grModePopup=(gcx - 5) (opYoffset - 1) (gcw + 5) (kLineHeight + 2) +opYoffset=(opYoffset + kLineHeight + 4) +grRenderPopup=prev.x (opYoffset - 1) prev.w prev.h +opYoffset=(opYoffset + kLineHeight + 4) +grFullscreenCheckbox=gcx opYoffset (kFontHeight + 10 + 96) buttonHeight +opYoffset=(opYoffset + buttonHeight) +grAspectCheckbox=prev.x opYoffset (kFontHeight + 10 + 180) prev.h +opYoffset=(opYoffset + buttonHeight) + +[audioControls] +aux=10 +auw=(parent.w - 2 * 10) +auMidiPopup=(aux - 5) (opYoffset - 1) (auw + 5) (kLineHeight + 2) +opYoffset=(opYoffset + buttonHeight + 4) + +[volumeControls] +vctextw=(95 + vcAudioTabIndent) +vcxoff=(opXoffset + vctextw + 15) +vcx=(opXoffset + 10) +vcMusicText=vcx (opYoffset + 2) vctextw kLineHeight +vcMusicText.align=kTextAlignRight +vcMusicSlider=vcxoff opYoffset sliderWidth sliderHeight +vcMusicLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight +opYoffset=(opYoffset + sliderHeight + vcAudioTabSpacing) +vcSfxText=vcx (opYoffset + 2) vctextw kLineHeight +vcSfxText.align=kTextAlignRight +vcSfxSlider=vcxoff opYoffset sliderWidth sliderHeight +vcSfxLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight +opYoffset=(opYoffset + sliderHeight + vcAudioTabSpacing) +vcSpeechText=vcx (opYoffset + 2) vctextw kLineHeight +vcSpeechText.align=kTextAlignRight +vcSpeechSlider=vcxoff opYoffset sliderWidth sliderHeight +vcSpeechLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight +opYoffset=(opYoffset + sliderHeight + vcAudioTabSpacing) + +[midiControls] +mcx=10 +mcFontButton=mcx opYoffset buttonWidth buttonHeight +mcFontPath=(prev.x2 + 20) (opYoffset + 3) (parent.w - (buttonWidth + 20) - 15) kLineHeight +opYoffset=(opYoffset + buttonHeight + 2 * midiControlsSpacing) +mcMixedCheckbox=mcx opYoffset (kFontHeight + 10 + 135) buttonHeight +opYoffset=(opYoffset + buttonHeight + midiControlsSpacing) +mcMt32Checkbox=mcx opYoffset (kFontHeight + 10 + 256) buttonHeight +opYoffset=(opYoffset + buttonHeight + midiControlsSpacing) +mcGSCheckbox=mcx opYoffset (kFontHeight + 10 + 142) buttonHeight +opYoffset=(opYoffset + buttonHeight + midiControlsSpacing) +mcMidiGainText=mcx (opYoffset + 2) 95 kLineHeight +mcMidiGainText.align=kTextAlignRight +mcMidiGainSlider=(prev.x2 + 10) opYoffset sliderWidth sliderHeight +mcMidiGainLabel=(prev.x2 + 10) (opYoffset + 2) 40 kLineHeight +opYoffset=(opYoffset + sliderHeight + midiControlsSpacing) + +[subtitleControls] +sbx=(opXoffset + 10) +sbYoff=(buttonHeight / 8) +sbOff=((sliderHeight - kLineHeight) / 2 + 2) +sbtextw=(100 + vcAudioTabIndent) +opYoffset=(opYoffset + sbYoff) +subToggleDesc=sbx (opYoffset + sbYoff) sbtextw buttonHeight +subToggleButton=prev.x2 (opYoffset - sbYoff) (buttonWidth + 54) buttonHeight +opYoffset=(opYoffset + buttonHeight + 6) +subSubtitleSpeedDesc=sbx (opYoffset + sbOff) sbtextw kLineHeight +subSubtitleSpeedDesc.align=kTextAlignRight +subSubtitleSpeedSlider=prev.x2 opYoffset sliderWidth sliderHeight +subSubtitleSpeedLabel=(prev.x2 + 10) (opYoffset + sbOff) 24 kLineHeight +opYoffset=(opYoffset + sliderHeight + 8) + +[scummmain] +## Main dialog +# note that scummmain size depends on overall height +smY=(scummmainVSpace + scummmainVAddOff) +scummmain_resume=scummmainHOffset smY scummmainButtonWidth scummmainButtonHeight +smY=(smY + scummmainButtonHeight + scummmainVAddOff) +smY=(smY + scummmainVSpace) +scummmain_load=prev.x smY prev.w prev.h +smY=(smY + scummmainButtonHeight + scummmainVAddOff) +scummmain_save=prev.x smY prev.w prev.h +smY=(smY + scummmainButtonHeight + scummmainVAddOff) +smY=(smY + scummmainVSpace) +scummmain_options=prev.x smY prev.w prev.h +smY=(smY + scummmainButtonHeight + scummmainVAddOff) +scummmain_about=prev.x smY prev.w prev.h +smY=(smY + scummmainButtonHeight + scummmainVAddOff) +scummmain_help=prev.x smY prev.w prev.h +smY=(smY + scummmainButtonHeight + scummmainVAddOff) +smY=(smY + scummmainVSpace) +scummmain_quit=prev.x smY prev.w prev.h +smY=(smY + scummmainButtonHeight + scummmainVAddOff) +smW=(scummmainButtonWidth + 2 * scummmainHOffset) +smH=(smY + scummmainVSpace) +scummmain=((w - smW) / 2) ((h - smH) / 2) smW smH + +# PSP GUI +[480x272] +def_buttonWidth=100 +def_buttonHeight=23 +def_insetX=20 +def_insetY=10 +def_insetW=(w - 2 * insetX) +def_insetH=(h - 13 - insetY) +def_launcherVersionX=50 +def_launcherVersionY=5 +def_volumeControlsInAudio=false +def_midiControlsSpacing=2 +def_gameOptionsOverrideVPad=10 +def_aboutXOff=3 +def_aboutYOff=2 +def_aboutOuterBorder=10 + +use=XxY + +# Override audio tab +set_parent=gameoptions +vBorder=5 + +# audio tab +opYoffset=vBorder +useWithPrefix=audioControls globaloptions_ +useWithPrefix=subtitleControls globaloptions_ + +# volume tab +opYoffset=vBorder +useWithPrefix=volumeControls globaloptions_ + +# audio tab +opYoffset=vBorder +gameoptions_audioCheckbox=gox opYoffset (kFontHeight + 10 + 180) buttonHeight +opYoffset=(opYoffset + buttonHeight + 6) +useWithPrefix=audioControls gameoptions_ +useWithPrefix=subtitleControls gameoptions_ + +# volume tab +opYoffset=vBorder +gameoptions_volumeCheckbox=gox opYoffset (kFontHeight + 10 + 190) buttonHeight +opYoffset=(opYoffset + buttonHeight + 6) +useWithPrefix=volumeControls gameoptions_ + diff --git a/gui/themes/modern.ini b/gui/themes/modern.ini index 75272093b3..43aee8d33e 100644 --- a/gui/themes/modern.ini +++ b/gui/themes/modern.ini @@ -1,7 +1,8 @@ # $URL$ # $Id$ [theme] -version=17 +version=18 +type=modern [pixmaps] pix_dialog_corner="dialog_bkgd_corner.bmp" -- cgit v1.2.3