diff options
author | Johannes Schickel | 2012-06-29 15:52:56 +0200 |
---|---|---|
committer | Johannes Schickel | 2012-06-29 15:52:56 +0200 |
commit | d3e5763276826d3f469fd93077c2f1ef6ef61314 (patch) | |
tree | 26d225712e1cc85c0dec17b52730880388ec86f1 | |
parent | 7860c5bfc93055f1ebcbf037876cd2abd42818c5 (diff) | |
download | scummvm-rg350-d3e5763276826d3f469fd93077c2f1ef6ef61314.tar.gz scummvm-rg350-d3e5763276826d3f469fd93077c2f1ef6ef61314.tar.bz2 scummvm-rg350-d3e5763276826d3f469fd93077c2f1ef6ef61314.zip |
GUI: Allow the user to switch between list and thumbnail based load chooser.
-rw-r--r-- | gui/ThemeEngine.cpp | 2 | ||||
-rw-r--r-- | gui/ThemeEngine.h | 4 | ||||
-rw-r--r-- | gui/saveload-dialog.cpp | 78 | ||||
-rw-r--r-- | gui/saveload-dialog.h | 18 | ||||
-rw-r--r-- | gui/saveload.cpp | 13 | ||||
-rw-r--r-- | gui/themes/default.inc | 18 | ||||
-rw-r--r-- | gui/themes/scummclassic.zip | bin | 93390 -> 93928 bytes | |||
-rw-r--r-- | gui/themes/scummclassic/THEMERC | 2 | ||||
-rw-r--r-- | gui/themes/scummclassic/classic_layout.stx | 9 | ||||
-rw-r--r-- | gui/themes/scummclassic/classic_layout_lowres.stx | 9 | ||||
-rw-r--r-- | gui/themes/scummmodern.zip | bin | 1449870 -> 1452236 bytes | |||
-rw-r--r-- | gui/themes/scummmodern/THEMERC | 2 | ||||
-rw-r--r-- | gui/themes/scummmodern/grid.bmp | bin | 0 -> 822 bytes | |||
-rw-r--r-- | gui/themes/scummmodern/list.bmp | bin | 0 -> 822 bytes | |||
-rw-r--r-- | gui/themes/scummmodern/scummmodern_gfx.stx | 2 | ||||
-rw-r--r-- | gui/themes/scummmodern/scummmodern_layout.stx | 9 | ||||
-rw-r--r-- | gui/themes/scummmodern/scummmodern_layout_lowres.stx | 9 |
17 files changed, 163 insertions, 12 deletions
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 1bf7ad3c85..6f34e8dc70 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -48,6 +48,8 @@ const char * const ThemeEngine::kImageLogoSmall = "logo_small.bmp"; const char * const ThemeEngine::kImageSearch = "search.bmp"; const char * const ThemeEngine::kImageEraser = "eraser.bmp"; const char * const ThemeEngine::kImageDelbtn = "delbtn.bmp"; +const char * const ThemeEngine::kImageList = "list.bmp"; +const char * const ThemeEngine::kImageGrid = "grid.bmp"; struct TextDrawData { const Graphics::Font *_fontPtr; diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index 21711e2955..cd388b7f65 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -35,7 +35,7 @@ #include "graphics/pixelformat.h" -#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.13" +#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.14" class OSystem; @@ -232,6 +232,8 @@ public: static const char *const kImageSearch; ///< Search tool image used in the launcher static const char *const kImageEraser; ///< Clear input image used in the launcher static const char *const kImageDelbtn; ///< Delete characters in the predictive dialog + static const char *const kImageList; ///< List image used in save/load chooser selection + static const char *const kImageGrid; ///< Grid image used in save/load chooser selection /** * Graphics mode enumeration. diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp index 25c722eec1..45bf1c49fc 100644 --- a/gui/saveload-dialog.cpp +++ b/gui/saveload-dialog.cpp @@ -30,14 +30,23 @@ namespace GUI { -SaveLoadChooserDialog::SaveLoadChooserDialog(const Common::String &dialogName) +enum { + kListSwitchCmd = 'LIST', + kGridSwitchCmd = 'GRID' +}; + +SaveLoadChooserDialog::SaveLoadChooserDialog(const Common::String &dialogName, const bool saveMode) : Dialog(dialogName), _metaEngine(0), _delSupport(false), _metaInfoSupport(false), - _thumbnailSupport(false), _saveDateSupport(false), _playTimeSupport(false) { + _thumbnailSupport(false), _saveDateSupport(false), _playTimeSupport(false), _saveMode(saveMode), + _listButton(0), _gridButton(0) { + addChooserButtons(); } -SaveLoadChooserDialog::SaveLoadChooserDialog(int x, int y, int w, int h) +SaveLoadChooserDialog::SaveLoadChooserDialog(int x, int y, int w, int h, const bool saveMode) : Dialog(x, y, w, h), _metaEngine(0), _delSupport(false), _metaInfoSupport(false), - _thumbnailSupport(false), _saveDateSupport(false), _playTimeSupport(false) { + _thumbnailSupport(false), _saveDateSupport(false), _playTimeSupport(false), _saveMode(saveMode), + _listButton(0), _gridButton(0) { + addChooserButtons(); } void SaveLoadChooserDialog::open() { @@ -60,6 +69,63 @@ int SaveLoadChooserDialog::run(const Common::String &target, const MetaEngine *m return runIntern(); } +void SaveLoadChooserDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) { + switch (cmd) { + case kListSwitchCmd: + setResult(kSwitchToList); + close(); + break; + + case kGridSwitchCmd: + setResult(kSwitchToGrid); + close(); + break; + + default: + break; + } + + return Dialog::handleCommand(sender, cmd, data); +} + +void SaveLoadChooserDialog::addChooserButtons() { + if (_listButton) { + removeWidget(_listButton); + delete _listButton; + } + + if (_gridButton) { + removeWidget(_gridButton); + delete _gridButton; + } + + _listButton = createSwitchButton("SaveLoadChooser.ListSwitch", "L", _("List view"), ThemeEngine::kImageList, kListSwitchCmd); + _gridButton = createSwitchButton("SaveLoadChooser.GridSwitch", "G", _("Grid view"), ThemeEngine::kImageGrid, kGridSwitchCmd); + if (!_metaInfoSupport || !_thumbnailSupport || _saveMode) + _gridButton->setEnabled(false); +} + +void SaveLoadChooserDialog::reflowLayout() { + addChooserButtons(); + + Dialog::reflowLayout(); +} + +GUI::ButtonWidget *SaveLoadChooserDialog::createSwitchButton(const Common::String &name, const char *desc, const char *tooltip, const char *image, uint32 cmd) { + ButtonWidget *button; + +#ifndef DISABLE_FANCY_THEMES + if (g_gui.xmlEval()->getVar("Globals.ShowChooserPics") == 1 && g_gui.theme()->supportsImages()) { + button = new PicButtonWidget(this, name, tooltip, cmd); + ((PicButtonWidget *)button)->useThemeTransparency(true); + ((PicButtonWidget *)button)->setGfx(g_gui.theme()->getImageSurface(image)); + } else +#endif + button = new ButtonWidget(this, name, desc, tooltip, cmd); + + return button; +} + // SaveLoadChooserSimple implementation enum { @@ -68,7 +134,7 @@ enum { }; SaveLoadChooserSimple::SaveLoadChooserSimple(const String &title, const String &buttonLabel, bool saveMode) - : SaveLoadChooserDialog("SaveLoadChooser"), _list(0), _chooseButton(0), _deleteButton(0), _gfxWidget(0) { + : SaveLoadChooserDialog("SaveLoadChooser", saveMode), _list(0), _chooseButton(0), _deleteButton(0), _gfxWidget(0) { _backgroundType = ThemeEngine::kDialogBackgroundSpecial; new StaticTextWidget(this, "SaveLoadChooser.Title", title); @@ -385,7 +451,7 @@ enum { }; LoadChooserThumbnailed::LoadChooserThumbnailed(const Common::String &title) - : SaveLoadChooserDialog("SaveLoadChooser"), _lines(0), _columns(0), _entriesPerPage(0), + : SaveLoadChooserDialog("SaveLoadChooser", false), _lines(0), _columns(0), _entriesPerPage(0), _curPage(0), _buttons() { _backgroundType = ThemeEngine::kDialogBackgroundSpecial; diff --git a/gui/saveload-dialog.h b/gui/saveload-dialog.h index b80741d36a..7921f5798a 100644 --- a/gui/saveload-dialog.h +++ b/gui/saveload-dialog.h @@ -29,19 +29,27 @@ namespace GUI { +#define kSwitchToList -2 +#define kSwitchToGrid -3 + class SaveLoadChooserDialog : protected Dialog { public: - SaveLoadChooserDialog(const Common::String &dialogName); - SaveLoadChooserDialog(int x, int y, int w, int h); + SaveLoadChooserDialog(const Common::String &dialogName, const bool saveMode); + SaveLoadChooserDialog(int x, int y, int w, int h, const bool saveMode); virtual void open(); + virtual void reflowLayout(); + + virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); + int run(const Common::String &target, const MetaEngine *metaEngine); virtual const Common::String &getResultString() const = 0; protected: virtual int runIntern() = 0; + const bool _saveMode; const MetaEngine *_metaEngine; bool _delSupport; bool _metaInfoSupport; @@ -49,6 +57,12 @@ protected: bool _saveDateSupport; bool _playTimeSupport; Common::String _target; + + GUI::ButtonWidget *_listButton; + GUI::ButtonWidget *_gridButton; + + void addChooserButtons(); + GUI::ButtonWidget *createSwitchButton(const Common::String &name, const char *desc, const char *tooltip, const char *image, uint32 cmd = 0); }; class SaveLoadChooserSimple : public SaveLoadChooserDialog { diff --git a/gui/saveload.cpp b/gui/saveload.cpp index becc3f6b4f..f544f0e6a0 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -83,7 +83,18 @@ int SaveLoadChooser::runModalWithPluginAndTarget(const EnginePlugin *plugin, con String oldDomain = ConfMan.getActiveDomainName(); ConfMan.setActiveDomain(target); - int ret = _impl->run(target, &(**plugin)); + int ret; + do { + ret = _impl->run(target, &(**plugin)); + + if (ret == kSwitchToList) { + delete _impl; + _impl = new SaveLoadChooserSimple(_title, _buttonLabel, _saveMode); + } else if (ret == kSwitchToGrid) { + delete _impl; + _impl = new LoadChooserThumbnailed(_title); + } + } while (ret < -1); // Revert to the old active domain ConfMan.setActiveDomain(oldDomain); diff --git a/gui/themes/default.inc b/gui/themes/default.inc index 86d0061e1b..331289ddf7 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -619,6 +619,7 @@ "<def var='ShowLauncherLogo' value='0'/> " "<def var='ShowGlobalMenuLogo' value='0'/> " "<def var='ShowSearchPic' value='0'/> " +"<def var='ShowChooserPics' value='0'/> " "<def var='SaveLoadChooser.ExtInfo.Visible' value='0'/> " "<def var='KeyMapper.Spacing' value='5'/> " "<def var='KeyMapper.LabelWidth' value='80'/> " @@ -1362,6 +1363,14 @@ "<widget name='Title' height='Globals.Line.Height'/> " "<widget name='List' /> " "<layout type='horizontal' padding='0,0,16,0'> " +"<widget name='ListSwitch' " +"height='Globals.Line.Height' " +"width='Globals.Line.Height' " +"/> " +"<widget name='GridSwitch' " +"height='Globals.Line.Height' " +"width='Globals.Line.Height' " +"/> " "<space/> " "<widget name='Delete' " "type='Button' " @@ -1564,6 +1573,7 @@ "<def var='ShowLauncherLogo' value='0'/> " "<def var='ShowGlobalMenuLogo' value='0'/> " "<def var='ShowSearchPic' value='0'/> " +"<def var='ShowChooserPics' value='0'/> " "<def var='SaveLoadChooser.ExtInfo.Visible' value='1'/> " "<def var='KeyMapper.Spacing' value='10'/> " "<def var='KeyMapper.LabelWidth' value='100'/> " @@ -2305,6 +2315,14 @@ "/> " "</layout> " "<layout type='horizontal' padding='0,0,0,0'> " +"<widget name='ListSwitch' " +"height='Globals.Line.Height' " +"width='Globals.Line.Height' " +"/> " +"<widget name='GridSwitch' " +"height='Globals.Line.Height' " +"width='Globals.Line.Height' " +"/> " "<space/> " "<widget name='Delete' " "type='Button' " diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip Binary files differindex d126ed0774..5e23f91dce 100644 --- a/gui/themes/scummclassic.zip +++ b/gui/themes/scummclassic.zip diff --git a/gui/themes/scummclassic/THEMERC b/gui/themes/scummclassic/THEMERC index d4bed29cf8..b87adb9bd8 100644 --- a/gui/themes/scummclassic/THEMERC +++ b/gui/themes/scummclassic/THEMERC @@ -1 +1 @@ -[SCUMMVM_STX0.8.13:ScummVM Classic Theme:No Author] +[SCUMMVM_STX0.8.14:ScummVM Classic Theme:No Author] diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index 8717892995..2bb586521f 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -31,6 +31,7 @@ <def var = 'ShowLauncherLogo' value = '0'/> <def var = 'ShowGlobalMenuLogo' value = '0'/> <def var = 'ShowSearchPic' value = '0'/> + <def var = 'ShowChooserPics' value = '0'/> <def var = 'SaveLoadChooser.ExtInfo.Visible' value = '1'/> @@ -804,6 +805,14 @@ /> </layout> <layout type = 'horizontal' padding = '0, 0, 0, 0'> + <widget name = 'ListSwitch' + height = 'Globals.Line.Height' + width = 'Globals.Line.Height' + /> + <widget name = 'GridSwitch' + height = 'Globals.Line.Height' + width = 'Globals.Line.Height' + /> <space/> <widget name = 'Delete' type = 'Button' diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx index 8f5db9d364..fe39e6b2e4 100644 --- a/gui/themes/scummclassic/classic_layout_lowres.stx +++ b/gui/themes/scummclassic/classic_layout_lowres.stx @@ -32,6 +32,7 @@ <def var = 'ShowLauncherLogo' value = '0'/> <def var = 'ShowGlobalMenuLogo' value = '0'/> <def var = 'ShowSearchPic' value = '0'/> + <def var = 'ShowChooserPics' value = '0'/> <def var = 'SaveLoadChooser.ExtInfo.Visible' value = '0'/> @@ -807,6 +808,14 @@ <widget name = 'Title' height = 'Globals.Line.Height'/> <widget name = 'List' /> <layout type = 'horizontal' padding = '0, 0, 16, 0'> + <widget name = 'ListSwitch' + height = 'Globals.Line.Height' + width = 'Globals.Line.Height' + /> + <widget name = 'GridSwitch' + height = 'Globals.Line.Height' + width = 'Globals.Line.Height' + /> <space/> <widget name = 'Delete' type = 'Button' diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip Binary files differindex db116325e2..977a6960e6 100644 --- a/gui/themes/scummmodern.zip +++ b/gui/themes/scummmodern.zip diff --git a/gui/themes/scummmodern/THEMERC b/gui/themes/scummmodern/THEMERC index 60744d386f..e9a2d542c4 100644 --- a/gui/themes/scummmodern/THEMERC +++ b/gui/themes/scummmodern/THEMERC @@ -1 +1 @@ -[SCUMMVM_STX0.8.13:ScummVM Modern Theme:No Author] +[SCUMMVM_STX0.8.14:ScummVM Modern Theme:No Author] diff --git a/gui/themes/scummmodern/grid.bmp b/gui/themes/scummmodern/grid.bmp Binary files differnew file mode 100644 index 0000000000..adeb209380 --- /dev/null +++ b/gui/themes/scummmodern/grid.bmp diff --git a/gui/themes/scummmodern/list.bmp b/gui/themes/scummmodern/list.bmp Binary files differnew file mode 100644 index 0000000000..2f54a40bcd --- /dev/null +++ b/gui/themes/scummmodern/list.bmp diff --git a/gui/themes/scummmodern/scummmodern_gfx.stx b/gui/themes/scummmodern/scummmodern_gfx.stx index 037c327235..4703683bc3 100644 --- a/gui/themes/scummmodern/scummmodern_gfx.stx +++ b/gui/themes/scummmodern/scummmodern_gfx.stx @@ -101,6 +101,8 @@ <bitmap filename = 'search.bmp'/> <bitmap filename = 'eraser.bmp'/> <bitmap filename = 'delbtn.bmp'/> + <bitmap filename = 'list.bmp'/> + <bitmap filename = 'grid.bmp'/> </bitmaps> <fonts> diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx index 087a844a1b..30f8f3c323 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -38,6 +38,7 @@ <def var = 'ShowLauncherLogo' value = '1'/> <def var = 'ShowGlobalMenuLogo' value = '1'/> <def var = 'ShowSearchPic' value = '1'/> + <def var = 'ShowChooserPics' value = '1'/> <def var = 'SaveLoadChooser.ExtInfo.Visible' value = '1'/> @@ -818,6 +819,14 @@ /> </layout> <layout type = 'horizontal' padding = '0, 0, 0, 0'> + <widget name = 'ListSwitch' + height = '20' + width = '20' + /> + <widget name = 'GridSwitch' + height = '20' + width = '20' + /> <space/> <widget name = 'Delete' type = 'Button' diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx index 987fee800a..990bf2be0a 100644 --- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx +++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx @@ -30,6 +30,7 @@ <def var = 'ShowLauncherLogo' value = '0'/> <def var = 'ShowGlobalMenuLogo' value = '0'/> <def var = 'ShowSearchPic' value = '0'/> + <def var = 'ShowChooserPics' value = '0'/> <def var = 'SaveLoadChooser.ExtInfo.Visible' value = '0'/> @@ -806,6 +807,14 @@ <widget name = 'Title' height = 'Globals.Line.Height'/> <widget name = 'List' /> <layout type = 'horizontal' padding = '0, 0, 16, 0'> + <widget name = 'ListSwitch' + height = 'Globals.Line.Height' + width = 'Globals.Line.Height' + /> + <widget name = 'GridSwitch' + height = 'Globals.Line.Height' + width = 'Globals.Line.Height' + /> <space/> <widget name = 'Delete' type = 'Button' |