[Scummvm-cvs-logs] SF.net SVN: scummvm:[43555] scummvm/trunk/gui

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Thu Aug 20 12:04:21 CEST 2009


Revision: 43555
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43555&view=rev
Author:   lordhoto
Date:     2009-08-20 10:04:21 +0000 (Thu, 20 Aug 2009)

Log Message:
-----------
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".

Modified Paths:
--------------
    scummvm/trunk/gui/ListWidget.cpp
    scummvm/trunk/gui/ListWidget.h
    scummvm/trunk/gui/saveload.cpp

Modified: scummvm/trunk/gui/ListWidget.cpp
===================================================================
--- scummvm/trunk/gui/ListWidget.cpp	2009-08-20 09:24:22 UTC (rev 43554)
+++ scummvm/trunk/gui/ListWidget.cpp	2009-08-20 10:04:21 UTC (rev 43555)
@@ -64,6 +64,7 @@
 	_editable = true;
 
 	_quickSelect = true;
+	_editColor = ThemeEngine::kFontColorNormal;
 }
 
 ListWidget::ListWidget(GuiObject *boss, int x, int y, int w, int h, uint32 cmd)
@@ -141,6 +142,16 @@
 	}
 }
 
+ThemeEngine::FontColor ListWidget::getSelectionColor() const {
+	if (_listColors.empty())
+		return ThemeEngine::kFontColorNormal;
+
+	if (_filter.empty())
+		return _listColors[_selectedItem];
+	else
+		return _listColors[_listIndex[_selectedItem]];
+}
+
 void ListWidget::setList(const StringList &list, const ColorList *colors) {
 	if (_editMode && _caretVisible)
 		drawCaret(true);
@@ -460,6 +471,7 @@
 
 		if (_selectedItem == pos && _editMode) {
 			buffer = _editString;
+			color = _editColor;
 			adjustOffset();
 			width = _w - r.left - _hlRightPadding - _leftPadding - scrollbarW;
 			g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + width, y + fontHeight - 2), buffer, _state,
@@ -526,6 +538,14 @@
 	if (_editable && !_editMode && _selectedItem >= 0) {
 		_editMode = true;
 		setEditString(_list[_selectedItem]);
+		if (_listColors.empty()) {
+			_editColor = ThemeEngine::kFontColorNormal;
+		} else {
+			if (_filter.empty())
+				_editColor = _listColors[_selectedItem];
+			else
+				_editColor = _listColors[_listIndex[_selectedItem]];
+		}
 		draw();
 		g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
 	}

Modified: scummvm/trunk/gui/ListWidget.h
===================================================================
--- scummvm/trunk/gui/ListWidget.h	2009-08-20 09:24:22 UTC (rev 43554)
+++ scummvm/trunk/gui/ListWidget.h	2009-08-20 10:04:21 UTC (rev 43555)
@@ -84,6 +84,8 @@
 
 	uint32			_cmd;
 
+	ThemeEngine::FontColor _editColor;
+
 public:
 	ListWidget(GuiObject *boss, const String &name, uint32 cmd = 0);
 	ListWidget(GuiObject *boss, int x, int y, int w, int h, uint32 cmd = 0);
@@ -97,6 +99,7 @@
 	int getSelected() const						{ return (_filter.empty() || _selectedItem == -1) ? _selectedItem : _listIndex[_selectedItem]; }
 	void setSelected(int item);
 	const String &getSelectedString() const		{ return _list[_selectedItem]; }
+	ThemeEngine::FontColor getSelectionColor() const;
 	void setNumberingMode(NumberingMode numberingMode)	{ _numberingMode = numberingMode; }
 	bool isEditable() const						{ return _editable; }
 	void setEditable(bool editable)				{ _editable = editable; }
@@ -105,6 +108,8 @@
 	void enableQuickSelect(bool enable) 		{ _quickSelect = enable; }
 	String getQuickSelectString() const 		{ return _quickSelectStr; }
 
+	void setEditColor(ThemeEngine::FontColor color) { _editColor = color; }
+
 	void setFilter(const String &filter, bool redraw = true);
 
 	virtual void handleTickle();
@@ -119,7 +124,7 @@
 
 	virtual bool wantsFocus() { return true; }
 
-	// Made startEditMode for SCUMM's SaveLoadChooser
+	// Made startEditMode for SaveLoadChooser
 	void startEditMode();
 	void endEditMode();
 

Modified: scummvm/trunk/gui/saveload.cpp
===================================================================
--- scummvm/trunk/gui/saveload.cpp	2009-08-20 09:24:22 UTC (rev 43554)
+++ scummvm/trunk/gui/saveload.cpp	2009-08-20 10:04:21 UTC (rev 43555)
@@ -278,8 +278,15 @@
 		// 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.


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list