diff options
author | Stephen Kennedy | 2008-09-26 21:53:08 +0000 |
---|---|---|
committer | Stephen Kennedy | 2008-09-26 21:53:08 +0000 |
commit | a7bb113e83c88fad3a23d408caa99f918fdb610a (patch) | |
tree | 698dd9d85abaa6a20957bfb9c0e006e9dd1dc8b3 /gui | |
parent | 11c0a3bdedcdf5eb2618b9db67b559663fb93320 (diff) | |
parent | c1385076cbc57f1a4a52946a46b3ea06ecf37f37 (diff) | |
download | scummvm-rg350-a7bb113e83c88fad3a23d408caa99f918fdb610a.tar.gz scummvm-rg350-a7bb113e83c88fad3a23d408caa99f918fdb610a.tar.bz2 scummvm-rg350-a7bb113e83c88fad3a23d408caa99f918fdb610a.zip |
Merged revisions 33452-33453,33455-33459,33463-33464,33466-33471,33473-33474,33478,33490,33492,33495-33496,33509-33512,33518-33519,33522-33527,33529-33530,33537,33541,33544,33546,33550,33552-33554,33556,33558,33561-33562,33565,33568,33570,33574,33576,33578-33581,33584-33587,33590,33596,33604-33611,33614-33615,33617-33618,33620-33621,33623,33626-33627,33632-33633,33635,33637,33639-33640,33642-33645,33648,33654-33655,33664,33667-33670,33673-33674,33678,33682,33686-33691,33693,33696,33698,33700,33703,33708,33710,33712-33714,33716,33719,33721-33723,33725-33727,33729-33730,33733,33736,33742,33754,33756,33758,33761,33763,33766,33777,33781-33788,33790,33792-33793,33795,33797,33805,33807-33812,33815-33817,33819,33822,33826,33829,33837,33839,33844,33847,33858-33861,33864,33871-33873,33875,33877-33879,33886,33889-33892,33894,33896,33900,33902-33903,33919,33928,33930,33932-33936,33938-33940,33942-33943,33948,33950,33953,33967,33973,33976,33978,33980,33985,33991,33993,33999-34000,34006,34009,34011,34013,34015,34019,34021-34023,34025,34027-34028,34030,34032-34034,34036,34038-34039,34041,34046-34048,34050-34055,34057,34059-34065,34067,34072,34074,34076,34078-34081,34084,34086-34087,34089-34090,34093,34096-34102,34104,34107,34113,34116,34119,34122,34124,34126,34128,34131-34132,34135,34138,34141,34144,34146,34149,34152-34154,34156-34157,34160,34163-34164,34169,34173,34179-34194,34196-34198,34200-34201,34205-34206,34208-34217,34219-34225,34227-34228,34234-34237,34239-34249,34251-34279,34281-34284,34286-34288,34290-34320,34323-34324,34326,34328-34329,34332,34334,34336,34338-34340,34343-34353,34356-34357,34359-34371,34373,34375,34378,34381-34382,34384-34385,34389-34391,34393-34394,34396-34397,34399-34405,34407-34409,34411,34413,34415,34417-34420,34423-34426,34428-34438,34440-34454,34456-34458,34460,34462-34469,34472,34474,34479-34481,34483-34498,34501-34505,34508,34511-34518,34520-34524,34526-34563,34566-34569,34571-34590,34592,34595-34599,34602-34603,34605,34613-34615,34617,34619-34624,34627-34628,34630-34639,34642-34649 via svnmerge from
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk
svn-id: r34654
Diffstat (limited to 'gui')
-rw-r--r-- | gui/ThemeModern.cpp | 12 | ||||
-rw-r--r-- | gui/ThemeModern.h | 21 | ||||
-rw-r--r-- | gui/about.cpp | 2 | ||||
-rw-r--r-- | gui/browser.cpp | 13 | ||||
-rw-r--r-- | gui/browser.h | 10 | ||||
-rw-r--r-- | gui/credits.h | 31 | ||||
-rw-r--r-- | gui/launcher.cpp | 356 | ||||
-rw-r--r-- | gui/launcher.h | 10 | ||||
-rw-r--r-- | gui/massadd.cpp | 10 | ||||
-rw-r--r-- | gui/massadd.h | 4 | ||||
-rw-r--r-- | gui/newgui.cpp | 10 | ||||
-rw-r--r-- | gui/options.cpp | 10 | ||||
-rw-r--r-- | gui/theme-config.cpp | 33 | ||||
-rw-r--r-- | gui/theme.cpp | 105 | ||||
-rw-r--r-- | gui/theme.h | 6 | ||||
-rw-r--r-- | gui/themebrowser.cpp | 10 | ||||
-rw-r--r-- | gui/themebrowser.h | 2 | ||||
-rw-r--r-- | gui/themes/classic080.ini | 7 | ||||
-rw-r--r-- | gui/themes/modern.ini | 29 | ||||
-rw-r--r-- | gui/themes/modern.zip | bin | 42693 -> 54022 bytes | |||
-rw-r--r-- | gui/widget.cpp | 3 |
21 files changed, 528 insertions, 156 deletions
diff --git a/gui/ThemeModern.cpp b/gui/ThemeModern.cpp index 177171b40c..fa8c29e616 100644 --- a/gui/ThemeModern.cpp +++ b/gui/ThemeModern.cpp @@ -120,7 +120,7 @@ ThemeModern::~ThemeModern() { for (int i = 0; i < kImageHandlesMax; ++i) { ImageMan.unregisterSurface(_imageHandles[i]); } - ImageMan.remArchive(_stylefile + ".zip"); + ImageMan.removeArchive(_stylefile + ".zip"); } bool ThemeModern::init() { @@ -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/about.cpp b/gui/about.cpp index 758f3ee6a7..99469b9ae4 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -57,7 +57,7 @@ enum { static const char *copyright_text[] = { "\\C""", -"\\C""Copyright (C) 2002-2007 The ScummVM project", +"\\C""Copyright (C) 2001-2008 The ScummVM project", "\\C""http://www.scummvm.org", "\\C""", "\\C""ScummVM is the legal property of its developers, whose names are too numerous to list here. Please refer to the COPYRIGHT file distributed with this binary.", diff --git a/gui/browser.cpp b/gui/browser.cpp index 41d3d15bb6..978187c17e 100644 --- a/gui/browser.cpp +++ b/gui/browser.cpp @@ -107,7 +107,7 @@ int BrowserDialog::runModal() { err = FSRefMakePath(&ref, (UInt8*)buf, sizeof(buf)-1); assert(err == noErr); - _choice = FilesystemNode(buf); + _choice = Common::FilesystemNode(buf); choiceMade = true; } @@ -160,9 +160,9 @@ BrowserDialog::BrowserDialog(const char *title, bool dirBrowser) void BrowserDialog::open() { if (ConfMan.hasKey("browser_lastpath")) - _node = FilesystemNode(ConfMan.get("browser_lastpath")); + _node = Common::FilesystemNode(ConfMan.get("browser_lastpath")); if (!_node.isDirectory()) - _node = FilesystemNode("."); + _node = Common::FilesystemNode("."); // Alway refresh file list updateListing(); @@ -227,8 +227,9 @@ void BrowserDialog::updateListing() { ConfMan.set("browser_lastpath", _node.getPath()); // Read in the data from the file system - FilesystemNode::ListMode listMode = _isDirBrowser ? FilesystemNode::kListDirectoriesOnly - : FilesystemNode::kListAll; + Common::FilesystemNode::ListMode listMode = + _isDirBrowser ? Common::FilesystemNode::kListDirectoriesOnly + : Common::FilesystemNode::kListAll; if (!_node.getChildren(_nodeContent, listMode)) { _nodeContent.clear(); } else { @@ -237,7 +238,7 @@ void BrowserDialog::updateListing() { // Populate the ListWidget Common::StringList list; - for (FSList::iterator i = _nodeContent.begin(); i != _nodeContent.end(); ++i) { + for (Common::FSList::iterator i = _nodeContent.begin(); i != _nodeContent.end(); ++i) { if (!_isDirBrowser && i->isDirectory()) list.push_back(i->getDisplayName() + "/"); else diff --git a/gui/browser.h b/gui/browser.h index d330e32269..c8bdec26a2 100644 --- a/gui/browser.h +++ b/gui/browser.h @@ -39,8 +39,6 @@ class ListWidget; class StaticTextWidget; class BrowserDialog : public Dialog { - typedef Common::String String; - typedef Common::StringList StringList; public: BrowserDialog(const char *title, bool dirBrowser); @@ -52,7 +50,7 @@ public: virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); #endif - const FilesystemNode &getResult() { return _choice; } + const Common::FilesystemNode &getResult() { return _choice; } protected: #ifdef MACOSX @@ -60,10 +58,10 @@ protected: #else ListWidget *_fileList; StaticTextWidget *_currentPath; - FilesystemNode _node; - FSList _nodeContent; + Common::FilesystemNode _node; + Common::FSList _nodeContent; #endif - FilesystemNode _choice; + Common::FilesystemNode _choice; bool _isDirBrowser; #ifndef MACOSX diff --git a/gui/credits.h b/gui/credits.h index 1afec250a6..c04a99ddbd 100644 --- a/gui/credits.h +++ b/gui/credits.h @@ -7,6 +7,12 @@ static const char *credits[] = { "\\C\\c0""Max Horn", "\\C\\c0""Eugene Sandulenko", "\\C\\c0""", +"\\C\\c1""Retired Project Leaders", +"\\C\\c0""Vincent Hamm", +"\\C\\c2""ScummVM co-founder, Original Cruise/CinE author", +"\\C\\c0""Ludvig Strigeus", +"\\C\\c2""Original ScummVM and SimonVM author", +"\\C\\c0""", "\\C\\c1""Engine Teams", "\\C\\c1""SCUMM", "\\C\\c0""Torbj\366rn Andersson", @@ -138,7 +144,6 @@ static const char *credits[] = { "\\C\\c0""Kostas Nakos", "\\C\\c0""", "\\C\\c1""PlayStation 2", -"\\C\\c0""Robert G\366ffringmann", "\\C\\c0""Max Lingua", "\\C\\c0""", "\\C\\c1""PSP (PlayStation Portable)", @@ -169,11 +174,13 @@ static const char *credits[] = { "\\C\\c0""", "\\C\\c1""Miscellaneous", "\\C\\c0""David Corrales-Lopez", -"\\C\\c2""Filesystem access improvements", +"\\C\\c2""Filesystem access improvements (GSoC 2007 task)", "\\C\\c0""Jerome Fisher", "\\C\\c2""MT-32 emulator", "\\C\\c0""Jochen Hoenicke", "\\C\\c2""Speaker & PCjr sound support, Adlib work", +"\\C\\c0""Chris Page", +"\\C\\c2""Return to launcher, savestate improvements, leak fixes, ... (GSoC 2008 task)", "\\C\\c0""Robin Watts", "\\C\\c2""ARM assembly routines for nice speedups on several ports; improvements to the sound mixer", "\\C\\c0""", @@ -197,20 +204,22 @@ static const char *credits[] = { "\\C\\c2""Help with GUI implementation", "\\C\\c0""Jamieson Christian", "\\C\\c2""iMUSE, MIDI, all things musical", +"\\C\\c0""Hans-J\366rg Frieden", +"\\C\\c2""Former AmigaOS 4 packager", +"\\C\\c0""Robert G\366ffringmann", +"\\C\\c2""Original PS2 porter", "\\C\\c0""R\374diger Hanke", "\\C\\c2""Port: MorphOS", -"\\C\\c0""Vincent Hamm", -"\\C\\c2""ScummVM co-founder, Original Cruise/CinE author", "\\C\\c0""Felix Jakschitsch", "\\C\\c2""Zak256 reverse engineering", "\\C\\c0""Mutwin Kraus", "\\C\\c2""Original MacOS porter", "\\C\\c0""Peter Moraliyski", "\\C\\c2""Port: GP32", +"\\C\\c0""Juha Niemim\344ki", +"\\C\\c2""Formaer AmigaOS 4 packager", "\\C\\c0""Jeremy Newman", "\\C\\c2""Former webmaster", -"\\C\\c0""Ludvig Strigeus", -"\\C\\c2""Original ScummVM and SimonVM author", "\\C\\c0""Lionel Ulmer", "\\C\\c2""Port: X11", "\\C\\c0""Won Star", @@ -221,9 +230,7 @@ static const char *credits[] = { "\\C\\c0""", "\\C\\c1""Packages", "\\C\\c1""AmigaOS 4", -"\\C\\c0""Hans-J\366rg Frieden", "\\C\\c0""Hubert Maier", -"\\C\\c0""Juha Niemim\344ki", "\\C\\c0""", "\\C\\c1""Atari/FreeMiNT", "\\C\\c0""Keith Scroggins", @@ -290,6 +297,8 @@ static const char *credits[] = { "\\C\\c2""PSP port contributions", "\\C\\c0""Thierry Crozat", "\\C\\c2""Support for Broken Sword 1 Macintosh version", +"\\C\\c0""Martin Doucha", +"\\C\\c2""CinE engine objectification", "\\C\\c0""Thomas Fach-Pedersen", "\\C\\c2""ProTracker module player", "\\C\\c0""Benjamin Haisch", @@ -338,10 +347,14 @@ static const char *credits[] = { "\\C\\c2""For the original MT-32 emulator", "\\C\\c0""Kevin Carnes", "\\C\\c2""For Scumm16, the basis of ScummVM's older gfx codecs", +"\\C\\c0""Curt Coder", +"\\C\\c2""For the original TrollVM (preAGI) code", "\\C\\c0""Patrick Combet", "\\C\\c2""For the original Gobliiins ADL player", "\\C\\c0""Ivan Dubrov", "\\C\\c2""For contributing the initial version of the Gobliiins engine", +"\\C\\c0""Till Kresslein", +"\\C\\c2""For design of modern ScummVM GUI", "\\C\\c0""Jezar", "\\C\\c2""For his freeverb filter implementation", "\\C\\c0""Jim Leiterman", @@ -354,6 +367,8 @@ static const char *credits[] = { "\\C\\c2""For ScummRev, and much obscure code/documentation", "\\C\\c0""Tristan", "\\C\\c2""For additional work on the original MT-32 emulator", +"\\C\\c0""James Woodcock", +"\\C\\c2""Soundtrack enhancements", "\\C\\c0""Tony Warriner and everyone at Revolution Software Ltd. for sharing with us the source of some of their brilliant games, allowing us to release Beneath a Steel Sky as freeware... and generally being supportive above and beyond the call of duty.", "\\C\\c0""", "\\C\\c0""John Passfield and Steve Stamatiadis for sharing the source of their classic title, Flight of the Amazon Queen and also being incredibly supportive.", diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 34c4ebf474..e9f718f4f0 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -29,6 +29,7 @@ #include "common/events.h" #include "common/fs.h" #include "common/util.h" +#include "common/savefile.h" #include "common/system.h" #include "gui/about.h" @@ -45,6 +46,7 @@ #include "gui/TabWidget.h" #include "gui/PopUpWidget.h" #include "graphics/cursorman.h" +#include "graphics/scaler.h" #include "sound/mididrv.h" @@ -61,7 +63,10 @@ enum { kAddGameCmd = 'ADDG', kEditGameCmd = 'EDTG', kRemoveGameCmd = 'REMG', + kLoadGameCmd = 'LOAD', kQuitCmd = 'QUIT', + kChooseCmd = 'CHOS', + kDelCmd = 'DEL ', kCmdGlobalGraphicsOverride = 'OGFX', @@ -390,7 +395,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat if (browser.runModal() > 0) { // User made this choice... - FilesystemNode file(browser.getResult()); + Common::FilesystemNode file(browser.getResult()); _soundFont->setLabel(file.getPath()); if (!file.getPath().empty() && (file.getPath() != "None")) @@ -408,7 +413,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat BrowserDialog browser("Select directory with game data", true); if (browser.runModal() > 0) { // User made his choice... - FilesystemNode dir(browser.getResult()); + Common::FilesystemNode dir(browser.getResult()); // TODO: Verify the game can be found in the new directory... Best // done with optional specific gameid to pluginmgr detectgames? @@ -426,7 +431,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat BrowserDialog browser("Select additional game directory", true); if (browser.runModal() > 0) { // User made his choice... - FilesystemNode dir(browser.getResult()); + Common::FilesystemNode dir(browser.getResult()); _extraPathWidget->setLabel(dir.getPath()); draw(); } @@ -438,7 +443,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat BrowserDialog browser("Select directory for saved games", true); if (browser.runModal() > 0) { // User made his choice... - FilesystemNode dir(browser.getResult()); + Common::FilesystemNode dir(browser.getResult()); _savePathWidget->setLabel(dir.getPath()); draw(); } @@ -450,7 +455,10 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat // Write back changes made to config object String newDomain(_domainWidget->getEditString()); if (newDomain != _domain) { - if (newDomain.empty() || ConfMan.hasGameDomain(newDomain)) { + if (newDomain.empty() + || newDomain.hasPrefix("_") + || newDomain == ConfigManager::kApplicationDomain + || ConfMan.hasGameDomain(newDomain)) { MessageDialog alert("This game ID is already taken. Please choose another one."); alert.runModal(); return; @@ -465,6 +473,293 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat } } +class SaveLoadChooser : public GUI::Dialog { + typedef Common::String String; + typedef Common::StringList StringList; +protected: + GUI::ListWidget *_list; + GUI::ButtonWidget *_chooseButton; + GUI::ButtonWidget *_deleteButton; + GUI::GraphicsWidget *_gfxWidget; + GUI::ContainerWidget *_container; + GUI::StaticTextWidget *_date; + GUI::StaticTextWidget *_time; + GUI::StaticTextWidget *_playtime; + + const EnginePlugin *_plugin; + bool _delSupport; + bool _metaInfoSupport; + bool _thumbnailSupport; + bool _saveDateSupport; + bool _playTimeSupport; + String _target; + SaveStateList _saveList; + + uint8 _fillR, _fillG, _fillB; + + void updateSaveList(); + void updateSelection(bool redraw); +public: + SaveLoadChooser(const String &title, const String &buttonLabel); + ~SaveLoadChooser(); + + virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); + void setList(const StringList& list); + int runModal(const EnginePlugin *plugin, const String &target); + + virtual void reflowLayout(); + + virtual void close(); +}; + +SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel) + : Dialog("scummsaveload"), _delSupport(0), _list(0), _chooseButton(0), _deleteButton(0), _gfxWidget(0) { + _delSupport = _metaInfoSupport = _thumbnailSupport = _saveDateSupport = _playTimeSupport = false; + + _drawingHints |= GUI::THEME_HINT_SPECIAL_COLOR; + + new StaticTextWidget(this, "scummsaveload_title", title); + + // Add choice list + _list = new GUI::ListWidget(this, "scummsaveload_list"); + _list->setNumberingMode(GUI::kListNumberingOff); + + _gfxWidget = new GUI::GraphicsWidget(this, 0, 0, 10, 10); + + _date = new StaticTextWidget(this, 0, 0, 10, 10, "No date saved", kTextAlignCenter); + _time = new StaticTextWidget(this, 0, 0, 10, 10, "No time saved", kTextAlignCenter); + _playtime = new StaticTextWidget(this, 0, 0, 10, 10, "No playtime saved", kTextAlignCenter); + + // Buttons + new GUI::ButtonWidget(this, "scummsaveload_cancel", "Cancel", kCloseCmd, 0); + _chooseButton = new GUI::ButtonWidget(this, "scummsaveload_choose", buttonLabel, kChooseCmd, 0); + _chooseButton->setEnabled(false); + + _deleteButton = new GUI::ButtonWidget(this, "scummsaveload_delete", "Delete", kDelCmd, 0); + _deleteButton->setEnabled(false); + + _delSupport = _metaInfoSupport = _thumbnailSupport = false; + + _container = new GUI::ContainerWidget(this, 0, 0, 10, 10); + _container->setHints(GUI::THEME_HINT_USE_SHADOW); +} + +SaveLoadChooser::~SaveLoadChooser() { +} + +int SaveLoadChooser::runModal(const EnginePlugin *plugin, const String &target) { + if (_gfxWidget) + _gfxWidget->setGfx(0); + + _plugin = plugin; + _target = target; + _delSupport = (*_plugin)->hasFeature(MetaEngine::kSupportsDeleteSave); + _metaInfoSupport = (*_plugin)->hasFeature(MetaEngine::kSupportsMetaInfos); + _thumbnailSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSupportsThumbnails); + _saveDateSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSupportsSaveDate); + _playTimeSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSupportsSavePlayTime); + reflowLayout(); + updateSaveList(); + + int ret = Dialog::runModal(); + return ret; +} + +void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { + int selItem = _list->getSelected(); + + switch (cmd) { + case GUI::kListItemActivatedCmd: + case GUI::kListItemDoubleClickedCmd: + if (selItem >= 0) { + if (!_list->getSelectedString().empty()) { + _list->endEditMode(); + setResult(atoi(_saveList[selItem].save_slot().c_str())); + close(); + } + } + break; + case kChooseCmd: + setResult(atoi(_saveList[selItem].save_slot().c_str())); + close(); + break; + case GUI::kListSelectionChangedCmd: { + updateSelection(true); + } break; + case kDelCmd: + if (selItem >= 0 && _delSupport) { + MessageDialog alert("Do you really want to delete this savegame?", + "Delete", "Cancel"); + if (alert.runModal() == GUI::kMessageOK) { + (*_plugin)->removeSaveState(_target.c_str(), atoi(_saveList[selItem].save_slot().c_str())); + + setResult(-1); + _list->setSelected(-1); + + updateSaveList(); + updateSelection(true); + } + } + break; + case kCloseCmd: + setResult(-1); + default: + Dialog::handleCommand(sender, cmd, data); + } +} + +void SaveLoadChooser::reflowLayout() { + if (g_gui.evaluator()->getVar("scummsaveload_extinfo.visible") == 1 && _thumbnailSupport) { + int thumbX = g_gui.evaluator()->getVar("scummsaveload_thumbnail.x"); + int thumbY = g_gui.evaluator()->getVar("scummsaveload_thumbnail.y"); + int hPad = g_gui.evaluator()->getVar("scummsaveload_thumbnail.hPad"); + int vPad = g_gui.evaluator()->getVar("scummsaveload_thumbnail.vPad"); + int thumbH = ((g_system->getHeight() % 200 && g_system->getHeight() != 350) ? kThumbnailHeight2 : kThumbnailHeight1); + + int textLines = 0; + if (_saveDateSupport) + textLines += 2; + if (_playTimeSupport) + textLines += 1; + + if (textLines) + ++textLines; + + _container->resize(thumbX - hPad, thumbY - vPad, kThumbnailWidth + hPad * 2, thumbH + vPad * 2 + kLineHeight * textLines); + + // Add the thumbnail display + _gfxWidget->resize(thumbX, thumbY, kThumbnailWidth, thumbH); + + int height = thumbY + thumbH + kLineHeight; + + if (_saveDateSupport) { + _date->resize(thumbX, height, kThumbnailWidth, kLineHeight); + height += kLineHeight; + _time->resize(thumbX, height, kThumbnailWidth, kLineHeight); + height += kLineHeight; + } + + if (_playTimeSupport) + _playtime->resize(thumbX, height, kThumbnailWidth, kLineHeight); + + _container->clearFlags(GUI::WIDGET_INVISIBLE); + _gfxWidget->clearFlags(GUI::WIDGET_INVISIBLE); + + if (_saveDateSupport) { + _date->clearFlags(GUI::WIDGET_INVISIBLE); + _time->clearFlags(GUI::WIDGET_INVISIBLE); + } else { + _date->setFlags(GUI::WIDGET_INVISIBLE); + _time->setFlags(GUI::WIDGET_INVISIBLE); + } + + if (_playTimeSupport) + _playtime->clearFlags(GUI::WIDGET_INVISIBLE); + else + _playtime->setFlags(GUI::WIDGET_INVISIBLE); + + _fillR = g_gui.evaluator()->getVar("scummsaveload_thumbnail.fillR"); + _fillG = g_gui.evaluator()->getVar("scummsaveload_thumbnail.fillG"); + _fillB = g_gui.evaluator()->getVar("scummsaveload_thumbnail.fillB"); + updateSelection(false); + } else { + _container->setFlags(GUI::WIDGET_INVISIBLE); + _gfxWidget->setFlags(GUI::WIDGET_INVISIBLE); + _date->setFlags(GUI::WIDGET_INVISIBLE); + _time->setFlags(GUI::WIDGET_INVISIBLE); + _playtime->setFlags(GUI::WIDGET_INVISIBLE); + } + + Dialog::reflowLayout(); +} + +void SaveLoadChooser::updateSelection(bool redraw) { + int selItem = _list->getSelected(); + + bool isDeletable = _delSupport; + + if (selItem >= 0 && !_list->getSelectedString().empty() && _metaInfoSupport) { + SaveStateDescriptor desc = (*_plugin)->querySaveMetaInfos(_target.c_str(), atoi(_saveList[selItem].save_slot().c_str())); + + isDeletable = desc.getBool("is_deletable") && _delSupport; + + if (_thumbnailSupport) { + const Graphics::Surface *thumb = desc.getThumbnail(); + if (thumb) { + _gfxWidget->setGfx(thumb); + _gfxWidget->useAlpha(256); + } else { + _gfxWidget->setGfx(-1, -1, _fillR, _fillG, _fillB); + } + } + + if (_saveDateSupport) { + Common::String date = "Date: "; + if (desc.contains("save_date")) + date += desc.getVal("save_date"); + else + date = "No date saved"; + + Common::String time = "Time: "; + if (desc.contains("save_time")) + time += desc.getVal("save_time"); + else + time = "No time saved"; + + _date->setLabel(date); + _time->setLabel(time); + } + + if (_playTimeSupport) { + Common::String time = "Playtime: "; + if (desc.contains("play_time")) + time += desc.getVal("play_time"); + else + time = "No playtime saved"; + + _playtime->setLabel(time); + } + } + + + // Disable these buttons if nothing is selected, or if an empty + // list item is selected. + _chooseButton->setEnabled(selItem >= 0 && (!_list->getSelectedString().empty())); + // Delete will always be disabled if the engine doesn't support it. + _deleteButton->setEnabled(isDeletable && (selItem >= 0) && (!_list->getSelectedString().empty())); + + if (redraw) { + _gfxWidget->draw(); + _date->draw(); + _time->draw(); + _playtime->draw(); + _chooseButton->draw(); + _deleteButton->draw(); + } +} + +void SaveLoadChooser::close() { + _plugin = 0; + _target.clear(); + _saveList.clear(); + _list->setList(StringList()); + + Dialog::close(); +} + +void SaveLoadChooser::updateSaveList() { + _saveList = (*_plugin)->listSaves(_target.c_str()); + + StringList saveNames; + for (SaveStateList::const_iterator x = _saveList.begin(); x != _saveList.end(); ++x) { + Common::String description = x->save_slot(); + description += ". "; + description += x->description(); + + saveNames.push_back(description); + } + _list->setList(saveNames); +} #pragma mark - @@ -499,6 +794,9 @@ LauncherDialog::LauncherDialog() _startButton = new ButtonWidget(this, "launcher_start_button", "Start", kStartCmd, 'S'); + _loadButton = + new ButtonWidget(this, "launcher_loadGame_button", "Load", kLoadGameCmd, 'L'); + // Above the lowest button rows: two more buttons (directly below the list box) _addButton = new ButtonWidget(this, "launcher_addGame_button", "Add Game...", kAddGameCmd, 'A'); @@ -526,6 +824,9 @@ LauncherDialog::LauncherDialog() // Create file browser dialog _browser = new BrowserDialog("Select directory with game data", true); + + // Create Load dialog + _loadDialog = new SaveLoadChooser("Load game:", "Load"); } void LauncherDialog::selectGame(const String &name) { @@ -543,6 +844,7 @@ void LauncherDialog::selectGame(const String &name) { LauncherDialog::~LauncherDialog() { delete _browser; + delete _loadDialog; } void LauncherDialog::open() { @@ -651,9 +953,9 @@ void LauncherDialog::addGame() { if (_browser->runModal() > 0) { // User made his choice... - FilesystemNode dir(_browser->getResult()); - FSList files; - if (!dir.getChildren(files, FilesystemNode::kListAll)) { + Common::FilesystemNode dir(_browser->getResult()); + Common::FSList files; + if (!dir.getChildren(files, Common::FilesystemNode::kListAll)) { error("browser returned a node that is not a directory: '%s'", dir.getPath().c_str()); } @@ -792,6 +1094,37 @@ void LauncherDialog::editGame(int item) { } } +void LauncherDialog::loadGame(int item) { + String gameId = ConfMan.get("gameid", _domains[item]); + if (gameId.empty()) + gameId = _domains[item]; + + const EnginePlugin *plugin = 0; + EngineMan.findGame(gameId, &plugin); + + String target = _domains[item]; + target.toLowercase(); + + if (plugin) { + if ((*plugin)->hasFeature(MetaEngine::kSupportsListSaves) && + (*plugin)->hasFeature(MetaEngine::kSupportsDirectLoad)) { + int slot = _loadDialog->runModal(plugin, target); + if (slot >= 0) { + ConfMan.setActiveDomain(_domains[item]); + ConfMan.setInt("save_slot", slot, Common::ConfigManager::kTransientDomain); + close(); + } + } else { + MessageDialog dialog + ("This game does not support loading games from the launcher.", "OK"); + dialog.runModal(); + } + } else { + MessageDialog dialog("ScummVM could not find any engine capable of running the selected game!", "OK"); + dialog.runModal(); + } +} + void LauncherDialog::handleKeyDown(Common::KeyState state) { Dialog::handleKeyDown(state); updateButtons(); @@ -815,6 +1148,9 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat case kEditGameCmd: editGame(item); break; + case kLoadGameCmd: + loadGame(item); + break; case kOptionsCmd: { GlobalOptionsDialog options; options.runModal(); @@ -863,6 +1199,10 @@ void LauncherDialog::updateButtons() { _removeButton->setEnabled(enable); _removeButton->draw(); } + if (enable != _loadButton->isEnabled()) { + _loadButton->setEnabled(enable); + _loadButton->draw(); + } // Update the label of the "Add" button depending on whether shift is pressed or not int modifiers = g_system->getEventManager()->getModifierState(); diff --git a/gui/launcher.h b/gui/launcher.h index a9d09bf109..1b2b0a354e 100644 --- a/gui/launcher.h +++ b/gui/launcher.h @@ -26,7 +26,7 @@ #define LAUNCHER_DIALOG_H #include "gui/dialog.h" -#include "base/game.h" +#include "engines/game.h" #include "common/str.h" namespace GUI { @@ -34,11 +34,10 @@ namespace GUI { class BrowserDialog; class ListWidget; class GraphicsWidget; - +class SaveLoadChooser; Common::String addGameToConf(const GameDescriptor &result); - class LauncherDialog : public Dialog { typedef Common::String String; typedef Common::StringList StringList; @@ -55,6 +54,7 @@ protected: ListWidget *_list; ButtonWidget *_addButton; Widget *_startButton; + Widget *_loadButton; Widget *_editButton; Widget *_removeButton; #ifndef DISABLE_FANCY_THEMES @@ -62,6 +62,7 @@ protected: #endif StringList _domains; BrowserDialog *_browser; + SaveLoadChooser *_loadDialog; virtual void reflowLayout(); @@ -73,7 +74,8 @@ protected: virtual void addGame(); void removeGame(int item); void editGame(int item); - + void loadGame(int item); + void selectGame(const String &name); }; diff --git a/gui/massadd.cpp b/gui/massadd.cpp index 6842466ad9..c34c190776 100644 --- a/gui/massadd.cpp +++ b/gui/massadd.cpp @@ -58,7 +58,7 @@ enum { -MassAddDialog::MassAddDialog(const FilesystemNode &startDir) +MassAddDialog::MassAddDialog(const Common::FilesystemNode &startDir) : Dialog("massadddialog"), _dirsScanned(0), _okButton(0), @@ -156,10 +156,10 @@ void MassAddDialog::handleTickle() { // Perform a breadth-first scan of the filesystem. while (!_scanStack.empty() && (g_system->getMillis() - t) < kMaxScanTime) { - FilesystemNode dir = _scanStack.pop(); + Common::FilesystemNode dir = _scanStack.pop(); - FSList files; - if (!dir.getChildren(files, FilesystemNode::kListAll)) { + Common::FSList files; + if (!dir.getChildren(files, Common::FilesystemNode::kListAll)) { error("browser returned a node that is not a directory: '%s'", dir.getPath().c_str()); } @@ -206,7 +206,7 @@ void MassAddDialog::handleTickle() { // Recurse into all subdirs - for (FSList::const_iterator file = files.begin(); file != files.end(); ++file) { + for (Common::FSList::const_iterator file = files.begin(); file != files.end(); ++file) { if (file->isDirectory()) { _scanStack.push(*file); } diff --git a/gui/massadd.h b/gui/massadd.h index e0eff75c64..733559cf37 100644 --- a/gui/massadd.h +++ b/gui/massadd.h @@ -38,14 +38,14 @@ class StaticTextWidget; class MassAddDialog : public Dialog { public: - MassAddDialog(const FilesystemNode &startDir); + MassAddDialog(const Common::FilesystemNode &startDir); //void open(); void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); void handleTickle(); private: - Common::Stack<FilesystemNode> _scanStack; + Common::Stack<Common::FilesystemNode> _scanStack; GameList _games; /** diff --git a/gui/newgui.cpp b/gui/newgui.cpp index 6c42d8e9b2..4afc59367b 100644 --- a/gui/newgui.cpp +++ b/gui/newgui.cpp @@ -26,6 +26,7 @@ #include "common/events.h" #include "common/system.h" #include "common/util.h" +#include "engines/engine.h" #include "graphics/cursorman.h" #include "gui/newgui.h" #include "gui/dialog.h" @@ -73,9 +74,9 @@ void GuiObject::reflowLayout() { error("Widget <%s> has x + w > %d (%d)", _name.c_str(), g_system->getOverlayWidth(), _x + _w); if (_y < 0) error("Widget <%s> has y < 0", _name.c_str()); - if (_y >= g_system->getOverlayWidth()) + if (_y >= g_system->getOverlayHeight()) error("Widget <%s> has y > %d", _name.c_str(), g_system->getOverlayHeight()); - if (_y + _h > g_system->getOverlayWidth()) + if (_y + _h > g_system->getOverlayHeight()) error("Widget <%s> has y + h > %d (%d)", _name.c_str(), g_system->getOverlayHeight(), _y + _h); } } @@ -256,7 +257,7 @@ void NewGui::runLoop() { Common::Event event; while (eventMan->pollEvent(event)) { - if (activeDialog != getTopDialog() && event.type != Common::EVENT_QUIT && event.type != Common::EVENT_SCREEN_CHANGED) + if (activeDialog != getTopDialog() && event.type != Common::EVENT_SCREEN_CHANGED) continue; Common::Point mouse(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y); @@ -314,7 +315,8 @@ void NewGui::runLoop() { activeDialog->handleMouseWheel(mouse.x, mouse.y, 1); break; case Common::EVENT_QUIT: - _system->quit(); + if (!g_engine) + _system->quit(); return; case Common::EVENT_SCREEN_CHANGED: screenChange(); diff --git a/gui/options.cpp b/gui/options.cpp index d6f5306ce2..335d4bc3d0 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -835,7 +835,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 BrowserDialog browser("Select directory for savegames", true); if (browser.runModal() > 0) { // User made his choice... - FilesystemNode dir(browser.getResult()); + Common::FilesystemNode dir(browser.getResult()); if (dir.isWritable()) { _savePath->setLabel(dir.getPath()); } else { @@ -851,7 +851,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 BrowserDialog browser("Select directory for GUI themes", true); if (browser.runModal() > 0) { // User made his choice... - FilesystemNode dir(browser.getResult()); + Common::FilesystemNode dir(browser.getResult()); _themePath->setLabel(dir.getPath()); draw(); } @@ -861,7 +861,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 BrowserDialog browser("Select directory for extra files", true); if (browser.runModal() > 0) { // User made his choice... - FilesystemNode dir(browser.getResult()); + Common::FilesystemNode dir(browser.getResult()); _extraPath->setLabel(dir.getPath()); draw(); } @@ -872,7 +872,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 BrowserDialog browser("Select directory for plugins", true); if (browser.runModal() > 0) { // User made his choice... - FilesystemNode dir(browser.getResult()); + Common::FilesystemNode dir(browser.getResult()); _pluginsPath->setLabel(dir.getPath()); draw(); } @@ -883,7 +883,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 BrowserDialog browser("Select SoundFont", false); if (browser.runModal() > 0) { // User made his choice... - FilesystemNode file(browser.getResult()); + Common::FilesystemNode file(browser.getResult()); _soundFont->setLabel(file.getPath()); if (!file.getPath().empty() && (file.getPath() != "None")) diff --git a/gui/theme-config.cpp b/gui/theme-config.cpp index acb5660db8..81e0a5c1d7 100644 --- a/gui/theme-config.cpp +++ b/gui/theme-config.cpp @@ -95,6 +95,7 @@ const char *Theme::_defaultConfigINI = "scummsaveload_thumbnail=(parent.w - (kThumbnailWidth + 22)) 18\n" "scummsaveload_cancel=(parent.w - 2 * (buttonWidth + 10)) (parent.h - buttonHeight - 8) buttonWidth buttonHeight\n" "scummsaveload_choose=(prev.x2 + 10) prev.y prev.w prev.h\n" +"scummsaveload_delete=prev.x2 prev.y prev.w prev.h\n" "scummsaveload_extinfo.visible=false\n" "\n" "# MM NES resolution\n" @@ -118,6 +119,7 @@ const char *Theme::_defaultConfigINI = "def_aboutXOff=8\n" "def_aboutYOff=5\n" "def_aboutOuterBorder=80\n" +"def_globalmainHOffset=52\n" "def_scummmainHOffset=12\n" "def_scummmainVSpace=7\n" "def_scummmainVAddOff=3\n" @@ -171,10 +173,11 @@ const char *Theme::_defaultConfigINI = "launcher_options_button=(prev.x2 + space) prev.y prev.w prev.h\n" "launcher_start_button=(prev.x2 + space) prev.y prev.w prev.h\n" "top=(top - buttonHeight * 2)\n" -"numButtons=3\n" +"numButtons=4\n" "space=10\n" "butWidth=((w - 2 * hBorder - space * (numButtons - 1)) / numButtons)\n" -"launcher_addGame_button=hBorder top butWidth buttonHeight\n" +"launcher_loadGame_button=hBorder top butWidth buttonHeight\n" +"launcher_addGame_button=(prev.x2 + space) prev.y prev.w prev.h\n" "launcher_editGame_button=(prev.x2 + space) prev.y prev.w prev.h\n" "launcher_removeGame_button=(prev.x2 + space) prev.y prev.w prev.h\n" "launcher_list=hBorder (kLineHeight + 16) (w - 2 * hBorder) (top - kLineHeight - 20)\n" @@ -371,6 +374,7 @@ const char *Theme::_defaultConfigINI = "scummsaveload_thumbnail.fillB=0\n" "scummsaveload_cancel=(parent.w - 2 * (buttonWidth + 10)) (parent.h - buttonHeight - 8) buttonWidth buttonHeight\n" "scummsaveload_choose=(prev.x2 + 10) prev.y prev.w prev.h\n" +"scummsaveload_delete=prev.x (prev.y - 30) prev.w prev.h\n" "scummsaveload_extinfo.visible=true\n" "\n" "# Keymapper remap dialog\n" @@ -490,6 +494,31 @@ const char *Theme::_defaultConfigINI = "smH=(smY + scummmainVSpace)\n" "scummmain=((w - smW) / 2) ((h - smH) / 2) smW smH\n" "\n" +"#### Global Main Menu Dialog" +"[globalmain]\n" +"# note that globalmain size depends on overall height\n" +"hBorder=10\n" +"gmW=(scummmainButtonWidth + (2 * scummmainHOffset) + 80)\n" +"global_title=hBorder 8 (gmW - 2 * hBorder) kLineHeight\n" +"global_title.align=kTextAlignCenter\n" +"global_version=hBorder 25 (gmW - 2 * hBorder) kLineHeight\n" +"global_version.align=kTextAlignCenter\n" +"gmY=((scummmainVSpace * 7)+ scummmainVAddOff)\n" +"globalmain_resume=globalmainHOffset gmY scummmainButtonWidth scummmainButtonHeight\n" +"gmY=(gmY + scummmainButtonHeight + scummmainVAddOff)\n" +"gmY=(gmY + scummmainVSpace)\n" +"globalmain_options=prev.x gmY prev.w prev.h\n" +"gmY=(gmY + scummmainButtonHeight + scummmainVAddOff)\n" +"globalmain_about=prev.x gmY prev.w prev.h\n" +"gmY=(gmY + scummmainButtonHeight + scummmainVAddOff)\n" +"gmY=(gmY + scummmainVSpace)\n" +"globalmain_rtl=prev.x gmY prev.w prev.h\n" +"gmY=(gmY + scummmainButtonHeight + scummmainVAddOff)\n" +"globalmain_quit=prev.x gmY prev.w prev.h\n" +"gmY=(gmY + scummmainButtonHeight + scummmainVAddOff)\n" +"gmH=(gmY + scummmainVSpace)\n" +"globalmain=((w - gmW) / 2) ((h - gmH) / 2) gmW gmH\n" +"\n" "# PSP GUI\n" "[480x272]\n" "def_buttonWidth=100\n" diff --git a/gui/theme.cpp b/gui/theme.cpp index c8501c4f91..8928d2f467 100644 --- a/gui/theme.cpp +++ b/gui/theme.cpp @@ -24,7 +24,9 @@ #include "gui/theme.h" #include "gui/eval.h" +#include "common/file.h" +#include "common/archive.h" #include "common/unzip.h" namespace GUI { @@ -68,24 +70,11 @@ const Graphics::Font *Theme::loadFont(const char *filename) { 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; + Common::ZipArchive zipArchive(_stylefile + ".zip"); + if (zipArchive.hasFile(cacheFilename)) { + Common::FilePtr stream(zipArchive.openFile(cacheFilename)); + font = Graphics::NewFont::loadFromCache(*stream.get()); } - unzClose(zipFile); #endif if (font) return font; @@ -98,24 +87,11 @@ const Graphics::Font *Theme::loadFont(const char *filename) { #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; + Common::ZipArchive zipArchive(_stylefile + ".zip"); + if (zipArchive.hasFile(filename)) { + Common::FilePtr stream(zipArchive.openFile(filename)); + font = Graphics::NewFont::loadFont(*stream.get()); } - unzClose(zipFile); } #endif @@ -157,37 +133,20 @@ bool Theme::loadConfigFile(const Common::String &stylefile) { if (ConfMan.hasKey("extrapath")) Common::File::addDefaultDirectoryRecursive(ConfMan.get("extrapath")); - if (!_configFile.loadFromFile(stylefile + ".ini")) { + if (_configFile.loadFromFile(stylefile + ".ini")) + return true; + #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 + // Maybe find a nicer solution to this + Common::ZipArchive zipArchive(stylefile + ".zip"); + if (zipArchive.hasFile(stylefile + ".ini")) { + Common::FilePtr stream(zipArchive.openFile(stylefile + ".ini")); + if (_configFile.loadFromStream(*stream.get())) + return true; } +#endif - return true; + return false; } bool Theme::themeConfigUseable(const Common::String &stylefile, const Common::String &style, Common::String *cStyle, Common::ConfigFile *cfg) { @@ -209,30 +168,16 @@ bool Theme::themeConfigUseable(const Common::String &stylefile, const Common::St if (!file.open(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) { + Common::ZipArchive zipArchive(stylefile + ".zip"); + if (zipArchive.hasFile(stylefile + ".ini")) { if (!style.empty() || cStyle || cfg) { - 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 (!cfg->loadFromStream(stream)) { - unzClose(zipFile); + Common::FilePtr stream(zipArchive.openFile(stylefile + ".ini")); + if (!cfg->loadFromStream(*stream.get())) return false; - } - delete[] buffer; - buffer = 0; } } else { - unzClose(zipFile); return false; } - unzClose(zipFile); #else return false; #endif diff --git a/gui/theme.h b/gui/theme.h index 4f61609fbd..c5a412e286 100644 --- a/gui/theme.h +++ b/gui/theme.h @@ -28,13 +28,12 @@ #include "common/system.h" #include "common/rect.h" #include "common/str.h" -#include "common/file.h" #include "common/config-file.h" #include "graphics/surface.h" #include "graphics/fontman.h" -#define THEME_VERSION 23 +#define THEME_VERSION 24 namespace GUI { @@ -357,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/themebrowser.cpp b/gui/themebrowser.cpp index 98e6df8565..bf718d5e4a 100644 --- a/gui/themebrowser.cpp +++ b/gui/themebrowser.cpp @@ -141,16 +141,16 @@ void ThemeBrowser::addDir(ThList &list, const Common::String &dir, int level) { if (level < 0) return; - FilesystemNode node(dir); + Common::FilesystemNode node(dir); if (!node.exists() || !node.isReadable()) return; - FSList fslist; - if (!node.getChildren(fslist, FilesystemNode::kListAll)) + Common::FSList fslist; + if (!node.getChildren(fslist, Common::FilesystemNode::kListAll)) return; - for (FSList::const_iterator i = fslist.begin(); i != fslist.end(); ++i) { + for (Common::FSList::const_iterator i = fslist.begin(); i != fslist.end(); ++i) { if (i->isDirectory()) { addDir(list, i->getPath(), level-1); } else { @@ -171,7 +171,7 @@ void ThemeBrowser::addDir(ThList &list, const Common::String &dir, int level) { } } -bool ThemeBrowser::isTheme(const FilesystemNode &node, Entry &out) { +bool ThemeBrowser::isTheme(const Common::FilesystemNode &node, Entry &out) { Common::ConfigFile cfg; Common::String type; diff --git a/gui/themebrowser.h b/gui/themebrowser.h index 9351648d24..e16a329c0e 100644 --- a/gui/themebrowser.h +++ b/gui/themebrowser.h @@ -58,7 +58,7 @@ private: void updateListing(); void addDir(ThList &list, const Common::String &dir, int level = 4); - bool isTheme(const FilesystemNode &node, Entry &out); + bool isTheme(const Common::FilesystemNode &node, Entry &out); }; } // end of namespace GUI diff --git a/gui/themes/classic080.ini b/gui/themes/classic080.ini index b5c911bada..4138e24536 100644 --- a/gui/themes/classic080.ini +++ b/gui/themes/classic080.ini @@ -1,7 +1,7 @@ # $URL$ # $Id$ [theme] -version=23 +version=24 type=classic name=Classic (ScummVM 0.8.0) @@ -82,13 +82,14 @@ hBorder=10 launcher_version=hBorder 8 (w - 2 * hBorder) kLineHeight launcher_version.align=kTextAlignCenter top=(h - 8 - buttonHeight) -numButtons=4 +numButtons=3 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 +launcher_loadGame_button=(prev.x2 + space) prev.y prev.w prev.h top=(top - buttonHeight * 2) numButtons=3 space=10 @@ -289,6 +290,7 @@ 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_delete=prev.x (prev.y - 30) prev.w prev.h scummsaveload_extinfo.visible=true ############################################ @@ -441,6 +443,7 @@ 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_delete=prev.x (prev.y - 30) prev.w prev.h scummsaveload_extinfo.visible=false # MM NES resolution diff --git a/gui/themes/modern.ini b/gui/themes/modern.ini index 87ef0bcbb9..e1712c5608 100644 --- a/gui/themes/modern.ini +++ b/gui/themes/modern.ini @@ -1,7 +1,7 @@ # $URL$ # $Id$ [theme] -version=23 +version=24 type=modern name=Modern Style @@ -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" @@ -250,6 +251,7 @@ space1=20 space2=5 launcher_list=insetX insetY insetW insetH launcher_start_button=(prev.x2 + 17) prev.y buttonWidth buttonHeight +launcher_loadGame_button=prev.x (prev.y2 + space2) prev.w prev.h launcher_addGame_button=prev.x (prev.y2 + space1) prev.w prev.h launcher_editGame_button=prev.x (prev.y2 + space2) prev.w prev.h launcher_removeGame_button=prev.x (prev.y2 + space2) prev.w prev.h @@ -259,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) scummmainVSpace 142 40 +global_logo.visible=true +global_version=hBorder (prev.y + prev.h) (gmW - 2 * hBorder) kLineHeight +global_version.align=kTextAlignCenter +gmY=(prev.y + prev.h + 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 @@ -456,6 +482,7 @@ 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_delete=prev.x (prev.y - 30) prev.w prev.h scummsaveload_extinfo.visible=true ############################################ diff --git a/gui/themes/modern.zip b/gui/themes/modern.zip Binary files differindex 739c6d23ac..329e3a2c1b 100644 --- a/gui/themes/modern.zip +++ b/gui/themes/modern.zip diff --git a/gui/widget.cpp b/gui/widget.cpp index e9afc30301..31f76eac6f 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -363,8 +363,7 @@ void GraphicsWidget::setGfx(const Graphics::Surface *gfx) { return; // TODO: add conversion to OverlayColor - _gfx.create(gfx->w, gfx->h, gfx->bytesPerPixel); - memcpy(_gfx.pixels, gfx->pixels, gfx->h * gfx->pitch); + _gfx.copyFrom(*gfx); } void GraphicsWidget::setGfx(int w, int h, int r, int g, int b) { |