diff options
-rw-r--r-- | gui/saveload-dialog.cpp | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp index 8d59a6318a..2702cbe31b 100644 --- a/gui/saveload-dialog.cpp +++ b/gui/saveload-dialog.cpp @@ -463,13 +463,14 @@ void SaveLoadChooserSimple::handleCommand(CommandSender *sender, uint32 cmd, uin } void SaveLoadChooserSimple::reflowLayout() { - if (g_gui.xmlEval()->getVar("Globals.SaveLoadChooser.ExtInfo.Visible") == 1 && _thumbnailSupport) { + if (g_gui.xmlEval()->getVar("Globals.SaveLoadChooser.ExtInfo.Visible") == 1 && (_thumbnailSupport || _saveDateSupport || _playTimeSupport)) { int16 x, y; uint16 w, h; if (!g_gui.xmlEval()->getWidgetData("SaveLoadChooser.Thumbnail", x, y, w, h)) error("Error when loading position data for Save/Load Thumbnails"); + // Even if there is no thumbnail support, getWidgetData() will provide default thumbnail values int thumbW = kThumbnailWidth; int thumbH = kThumbnailHeight2; int thumbX = x + (w >> 1) - (thumbW >> 1); @@ -483,28 +484,40 @@ void SaveLoadChooserSimple::reflowLayout() { if (textLines > 0) textLines++; // add a line of padding at the bottom - _container->resize(x, y, w, h + (kLineHeight * textLines)); - _gfxWidget->resize(thumbX, thumbY, thumbW, thumbH); + if (_thumbnailSupport) { + _gfxWidget->resize(thumbX, thumbY, thumbW, thumbH); + _gfxWidget->setVisible(true); + } else { + // choose sensible values for displaying playtime and date/time when a thumbnail is not being used + thumbH = 0; + thumbY = y; + h = kLineHeight; + _gfxWidget->setVisible(false); + } int height = thumbY + thumbH + kLineHeight; if (_saveDateSupport) { - _date->resize(thumbX, height, kThumbnailWidth, kLineHeight); + _date->resize(thumbX, height, thumbW, kLineHeight); height += kLineHeight; - _time->resize(thumbX, height, kThumbnailWidth, kLineHeight); + _time->resize(thumbX, height, thumbW, kLineHeight); height += kLineHeight; + _date->setVisible(_saveDateSupport); + _time->setVisible(_saveDateSupport); + } else { + _date->setVisible(false); + _time->setVisible(false); } - if (_playTimeSupport) - _playtime->resize(thumbX, height, kThumbnailWidth, kLineHeight); + if (_playTimeSupport) { + _playtime->resize(thumbX, height, thumbW, kLineHeight); + _playtime->setVisible(_playTimeSupport); + } else { + _playtime->setVisible(false); + } + _container->resize(x, y, w, h + (kLineHeight * textLines)); _container->setVisible(true); - _gfxWidget->setVisible(true); - - _date->setVisible(_saveDateSupport); - _time->setVisible(_saveDateSupport); - - _playtime->setVisible(_playTimeSupport); updateSelection(false); } else { |