diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/saveload-dialog.cpp | 60 | ||||
-rw-r--r-- | gui/saveload-dialog.h | 19 | ||||
-rw-r--r-- | gui/saveload.cpp | 7 |
3 files changed, 66 insertions, 20 deletions
diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp index f59d67e490..3c793c9e25 100644 --- a/gui/saveload-dialog.cpp +++ b/gui/saveload-dialog.cpp @@ -32,6 +32,7 @@ namespace GUI { +#ifndef DISABLE_SAVELOADCHOOSER_GRID SaveLoadChooserType getRequestedSaveLoadDialog(const MetaEngine &metaEngine) { const Common::String &userConfig = ConfMan.get("gui_saveload_chooser", Common::ConfigManager::kApplicationDomain); if (g_gui.getWidth() >= 640 && g_gui.getHeight() >= 400 @@ -52,19 +53,30 @@ enum { kListSwitchCmd = 'LIST', kGridSwitchCmd = 'GRID' }; +#endif // !DISABLE_SAVELOADCHOOSER_GRID SaveLoadChooserDialog::SaveLoadChooserDialog(const Common::String &dialogName, const bool saveMode) : Dialog(dialogName), _metaEngine(0), _delSupport(false), _metaInfoSupport(false), - _thumbnailSupport(false), _saveDateSupport(false), _playTimeSupport(false), _saveMode(saveMode), - _listButton(0), _gridButton(0) { + _thumbnailSupport(false), _saveDateSupport(false), _playTimeSupport(false), _saveMode(saveMode) +#ifndef DISABLE_SAVELOADCHOOSER_GRID + , _listButton(0), _gridButton(0) +#endif // !DISABLE_SAVELOADCHOOSER_GRID + { +#ifndef DISABLE_SAVELOADCHOOSER_GRID addChooserButtons(); +#endif // !DISABLE_SAVELOADCHOOSER_GRID } 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), _saveMode(saveMode), - _listButton(0), _gridButton(0) { + _thumbnailSupport(false), _saveDateSupport(false), _playTimeSupport(false), _saveMode(saveMode) +#ifndef DISABLE_SAVELOADCHOOSER_GRID + , _listButton(0), _gridButton(0) +#endif // !DISABLE_SAVELOADCHOOSER_GRID + { +#ifndef DISABLE_SAVELOADCHOOSER_GRID addChooserButtons(); +#endif // !DISABLE_SAVELOADCHOOSER_GRID } void SaveLoadChooserDialog::open() { @@ -88,6 +100,7 @@ int SaveLoadChooserDialog::run(const Common::String &target, const MetaEngine *m } void SaveLoadChooserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { +#ifndef DISABLE_SAVELOADCHOOSER_GRID switch (cmd) { case kListSwitchCmd: setResult(kSwitchSaveLoadDialog); @@ -108,10 +121,29 @@ void SaveLoadChooserDialog::handleCommand(CommandSender *sender, uint32 cmd, uin default: break; } +#endif // !DISABLE_SAVELOADCHOOSER_GRID return Dialog::handleCommand(sender, cmd, data); } +void SaveLoadChooserDialog::reflowLayout() { +#ifndef DISABLE_SAVELOADCHOOSER_GRID + addChooserButtons(); + + const SaveLoadChooserType currentType = getType(); + const SaveLoadChooserType requestedType = getRequestedSaveLoadDialog(*_metaEngine); + + // Change the dialog type if there is any need for it. + if (requestedType != currentType) { + setResult(kSwitchSaveLoadDialog); + close(); + } +#endif // !DISABLE_SAVELOADCHOOSER_GRID + + Dialog::reflowLayout(); +} + +#ifndef DISABLE_SAVELOADCHOOSER_GRID void SaveLoadChooserDialog::addChooserButtons() { if (_listButton) { removeWidget(_listButton); @@ -131,21 +163,6 @@ void SaveLoadChooserDialog::addChooserButtons() { } } -void SaveLoadChooserDialog::reflowLayout() { - addChooserButtons(); - - const SaveLoadChooserType currentType = getType(); - const SaveLoadChooserType requestedType = getRequestedSaveLoadDialog(*_metaEngine); - - // Change the dialog type if there is any need for it. - if (requestedType != currentType) { - setResult(kSwitchSaveLoadDialog); - close(); - } - - Dialog::reflowLayout(); -} - ButtonWidget *SaveLoadChooserDialog::createSwitchButton(const Common::String &name, const char *desc, const char *tooltip, const char *image, uint32 cmd) { ButtonWidget *button; @@ -160,6 +177,7 @@ ButtonWidget *SaveLoadChooserDialog::createSwitchButton(const Common::String &na return button; } +#endif // !DISABLE_SAVELOADCHOOSER_GRID // SaveLoadChooserSimple implementation @@ -480,6 +498,8 @@ void SaveLoadChooserSimple::updateSaveList() { // SaveLoadChooserGrid implementation +#ifndef DISABLE_SAVELOADCHOOSER_GRID + enum { kNextCmd = 'NEXT', kPrevCmd = 'PREV', @@ -854,4 +874,6 @@ void SavenameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat } } +#endif // !DISABLE_SAVELOADCHOOSER_GRID + } // End of namespace GUI diff --git a/gui/saveload-dialog.h b/gui/saveload-dialog.h index 05c0715fe0..50b7d419b7 100644 --- a/gui/saveload-dialog.h +++ b/gui/saveload-dialog.h @@ -31,12 +31,22 @@ namespace GUI { #define kSwitchSaveLoadDialog -2 +// TODO: We might want to disable the grid based save/load chooser for more +// platforms, than those which define DISABLE_FANCY_THEMES. But those are +// probably not able to handle the grid chooser anyway, so disabling it +// for them is a good start. +#ifdef DISABLE_FANCY_THEMES +#define DISABLE_SAVELOADCHOOSER_GRID +#endif // DISABLE_FANCY_THEMES + +#ifndef DISABLE_SAVELOADCHOOSER_GRID enum SaveLoadChooserType { kSaveLoadDialogList = 0, kSaveLoadDialogGrid = 1 }; SaveLoadChooserType getRequestedSaveLoadDialog(const MetaEngine &metaEngine); +#endif // !DISABLE_SAVELOADCHOOSER_GRID class SaveLoadChooserDialog : protected Dialog { public: @@ -49,7 +59,9 @@ public: virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); +#ifndef DISABLE_SAVELOADCHOOSER_GRID virtual SaveLoadChooserType getType() const = 0; +#endif // !DISABLE_SAVELOADCHOOSER_GRID int run(const Common::String &target, const MetaEngine *metaEngine); virtual const Common::String &getResultString() const = 0; @@ -66,11 +78,13 @@ protected: bool _playTimeSupport; Common::String _target; +#ifndef DISABLE_SAVELOADCHOOSER_GRID ButtonWidget *_listButton; ButtonWidget *_gridButton; void addChooserButtons(); ButtonWidget *createSwitchButton(const Common::String &name, const char *desc, const char *tooltip, const char *image, uint32 cmd = 0); +#endif // !DISABLE_SAVELOADCHOOSER_GRID }; class SaveLoadChooserSimple : public SaveLoadChooserDialog { @@ -85,7 +99,9 @@ public: virtual void reflowLayout(); +#ifndef DISABLE_SAVELOADCHOOSER_GRID virtual SaveLoadChooserType getType() const { return kSaveLoadDialogList; } +#endif // !DISABLE_SAVELOADCHOOSER_GRID virtual void close(); private: @@ -109,6 +125,7 @@ private: void updateSelection(bool redraw); }; +#ifndef DISABLE_SAVELOADCHOOSER_GRID class EditTextWidget; @@ -186,6 +203,8 @@ private: void updateSaves(); }; +#endif // !DISABLE_SAVELOADCHOOSER_GRID + } // End of namespace GUI #endif diff --git a/gui/saveload.cpp b/gui/saveload.cpp index d6a8688ce3..c2bbcd9bec 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -40,6 +40,7 @@ SaveLoadChooser::~SaveLoadChooser() { } void SaveLoadChooser::selectChooser(const MetaEngine &engine) { +#ifndef DISABLE_SAVELOADCHOOSER_GRID const SaveLoadChooserType requestedType = getRequestedSaveLoadDialog(engine); if (!_impl || _impl->getType() != requestedType) { delete _impl; @@ -51,10 +52,13 @@ void SaveLoadChooser::selectChooser(const MetaEngine &engine) { break; case kSaveLoadDialogList: +#endif // !DISABLE_SAVELOADCHOOSER_GRID _impl = new SaveLoadChooserSimple(_title, _buttonLabel, _saveMode); +#ifndef DISABLE_SAVELOADCHOOSER_GRID break; } } +#endif // !DISABLE_SAVELOADCHOOSER_GRID } Common::String SaveLoadChooser::createDefaultSaveDescription(const int slot) const { @@ -91,10 +95,11 @@ int SaveLoadChooser::runModalWithPluginAndTarget(const EnginePlugin *plugin, con int ret; do { ret = _impl->run(target, &(**plugin)); - +#ifndef DISABLE_SAVELOADCHOOSER_GRID if (ret == kSwitchSaveLoadDialog) { selectChooser(**plugin); } +#endif // !DISABLE_SAVELOADCHOOSER_GRID } while (ret < -1); // Revert to the old active domain |