aboutsummaryrefslogtreecommitdiff
path: root/gui/saveload-dialog.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2012-09-26 02:45:34 +0200
committerJohannes Schickel2012-09-26 02:59:32 +0200
commitbc1743b225597715164e3d2701b2c4b5731415a4 (patch)
treeac3326bd50e9b8f1529479cca20843955881ca66 /gui/saveload-dialog.cpp
parent66fb399227acd92db3dc8d9ee193a41609cf3d39 (diff)
downloadscummvm-rg350-bc1743b225597715164e3d2701b2c4b5731415a4.tar.gz
scummvm-rg350-bc1743b225597715164e3d2701b2c4b5731415a4.tar.bz2
scummvm-rg350-bc1743b225597715164e3d2701b2c4b5731415a4.zip
GUI: Save/restore last scroll position in the list save/load dialog.
This should give a better user experience, since the user will not have to scroll back to where he was when he used the dialog last. Thanks to wjp for suggesting this.
Diffstat (limited to 'gui/saveload-dialog.cpp')
-rw-r--r--gui/saveload-dialog.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp
index 63d8d25fe0..c8f7556e66 100644
--- a/gui/saveload-dialog.cpp
+++ b/gui/saveload-dialog.cpp
@@ -422,7 +422,28 @@ void SaveLoadChooserSimple::updateSelection(bool redraw) {
}
}
+void SaveLoadChooserSimple::open() {
+ SaveLoadChooserDialog::open();
+
+ // Scroll the list to the last used entry.
+ _list->scrollTo(ConfMan.getInt("gui_saveload_last_pos"));
+}
+
void SaveLoadChooserSimple::close() {
+ // Save the current scroll position/used entry.
+ const int result = getResult();
+ if (result >= 0) {
+ ConfMan.setInt("gui_saveload_last_pos", result);
+ } else {
+ // Use the current scroll position here.
+ // TODO: This means we canceled the dialog (or switch to the grid). Do
+ // we want to save this position here? Does the user want that?
+ // TODO: Do we want to save the current scroll position or the
+ // currently selected item here? The scroll position is what the user
+ // currently sees and seems to make more sense.
+ ConfMan.setInt("gui_saveload_last_pos", _list->getCurrentScrollPos());
+ }
+
_metaEngine = 0;
_target.clear();
_saveList.clear();