From a8bffbe6a7137060bc6bf54da2cfd018bb777d74 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 20 Aug 2009 09:19:37 +0000 Subject: Partial implementation of feature request #2834637 "GUI: Allow greying out dummy ListWidget entries", based on a slighly modified version of my latest patch included there. svn-id: r43551 --- gui/saveload.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'gui/saveload.cpp') diff --git a/gui/saveload.cpp b/gui/saveload.cpp index ce700c181e..dc1b1b4b45 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -316,6 +316,7 @@ void SaveLoadChooser::updateSaveList() { int curSlot = 0; int saveSlot = 0; StringList saveNames; + ListWidget::ColorList colors; for (SaveStateList::const_iterator x = _saveList.begin(); x != _saveList.end(); ++x) { // Handle gaps in the list of save games saveSlot = atoi(x->save_slot().c_str()); @@ -324,6 +325,7 @@ void SaveLoadChooser::updateSaveList() { SaveStateDescriptor dummySave(curSlot, ""); _saveList.insert_at(curSlot, dummySave); saveNames.push_back(dummySave.description()); + colors.push_back(ThemeEngine::kFontColorNormal); curSlot++; } @@ -338,8 +340,12 @@ void SaveLoadChooser::updateSaveList() { Common::String description = x->description(); Common::String trimmedDescription = description; trimmedDescription.trim(); - if (trimmedDescription.empty()) + if (trimmedDescription.empty()) { description = "Untitled savestate"; + colors.push_back(ThemeEngine::kFontColorAlternate); + } else { + colors.push_back(ThemeEngine::kFontColorNormal); + } saveNames.push_back(description); curSlot++; @@ -351,9 +357,10 @@ void SaveLoadChooser::updateSaveList() { saveNames.push_back(emptyDesc); SaveStateDescriptor dummySave(i, ""); _saveList.push_back(dummySave); + colors.push_back(ThemeEngine::kFontColorNormal); } - _list->setList(saveNames); + _list->setList(saveNames, &colors); } } // End of namespace GUI -- cgit v1.2.3 From 7c77e2b03a29f8d11ff0a48e4da02ab697334f1e Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 20 Aug 2009 09:23:31 +0000 Subject: Renamed ScummSaveLoad GUI dialog config entry to SaveLoadChooser. (Also bumped theme version along with it) svn-id: r43553 --- gui/saveload.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'gui/saveload.cpp') diff --git a/gui/saveload.cpp b/gui/saveload.cpp index dc1b1b4b45..381abcdc83 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -42,15 +42,15 @@ enum { }; SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel) - : Dialog("ScummSaveLoad"), _delSupport(0), _list(0), _chooseButton(0), _deleteButton(0), _gfxWidget(0) { + : Dialog("SaveLoadChooser"), _delSupport(0), _list(0), _chooseButton(0), _deleteButton(0), _gfxWidget(0) { _delSupport = _metaInfoSupport = _thumbnailSupport = _saveDateSupport = _playTimeSupport = false; _backgroundType = ThemeEngine::kDialogBackgroundSpecial; - new StaticTextWidget(this, "ScummSaveLoad.Title", title); + new StaticTextWidget(this, "SaveLoadChooser.Title", title); // Add choice list - _list = new GUI::ListWidget(this, "ScummSaveLoad.List"); + _list = new GUI::ListWidget(this, "SaveLoadChooser.List"); _list->setNumberingMode(GUI::kListNumberingZero); setSaveMode(false); @@ -61,11 +61,11 @@ SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel) _playtime = new StaticTextWidget(this, 0, 0, 10, 10, "No playtime saved", Graphics::kTextAlignCenter); // Buttons - new GUI::ButtonWidget(this, "ScummSaveLoad.Cancel", "Cancel", kCloseCmd, 0); - _chooseButton = new GUI::ButtonWidget(this, "ScummSaveLoad.Choose", buttonLabel, kChooseCmd, 0); + new GUI::ButtonWidget(this, "SaveLoadChooser.Cancel", "Cancel", kCloseCmd, 0); + _chooseButton = new GUI::ButtonWidget(this, "SaveLoadChooser.Choose", buttonLabel, kChooseCmd, 0); _chooseButton->setEnabled(false); - _deleteButton = new GUI::ButtonWidget(this, "ScummSaveLoad.Delete", "Delete", kDelCmd, 0); + _deleteButton = new GUI::ButtonWidget(this, "SaveLoadChooser.Delete", "Delete", kDelCmd, 0); _deleteButton->setEnabled(false); _delSupport = _metaInfoSupport = _thumbnailSupport = false; @@ -172,11 +172,11 @@ void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 da } void SaveLoadChooser::reflowLayout() { - if (g_gui.xmlEval()->getVar("Globals.ScummSaveLoad.ExtInfo.Visible") == 1 && _thumbnailSupport) { + if (g_gui.xmlEval()->getVar("Globals.SaveLoadChooser.ExtInfo.Visible") == 1 && _thumbnailSupport) { int16 x, y; uint16 w, h; - if (!g_gui.xmlEval()->getWidgetData("ScummSaveLoad.Thumbnail", x, y, w, h)) + if (!g_gui.xmlEval()->getWidgetData("SaveLoadChooser.Thumbnail", x, y, w, h)) error("Error when loading position data for Save/Load Thumbnails."); int thumbW = kThumbnailWidth; -- cgit v1.2.3 From f898cd12e664af159e2d337fb8c8a0f9f976e1d9 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 20 Aug 2009 10:04:21 +0000 Subject: Implement automatic clearing of "Untitled Savestate" in edit mode of the SaveLoadChooser as requested in feature request #2834637 "GUI: Allow greying out dummy ListWidget entries". svn-id: r43555 --- gui/saveload.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gui/saveload.cpp') diff --git a/gui/saveload.cpp b/gui/saveload.cpp index 381abcdc83..058911d43f 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -278,8 +278,15 @@ void SaveLoadChooser::updateSelection(bool redraw) { // game is write protected _chooseButton->setEnabled(selItem >= 0 && !isWriteProtected); - if (startEditMode) + if (startEditMode) { _list->startEditMode(); + + if (_chooseButton->isEnabled() && _list->getSelectedString() == "Untitled savestate" && + _list->getSelectionColor() == ThemeEngine::kFontColorAlternate) { + _list->setEditString(""); + _list->setEditColor(ThemeEngine::kFontColorNormal); + } + } } else { // Disable the load button if nothing is selected, or if an empty // list item is selected. -- cgit v1.2.3