aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2003-11-28 21:56:14 +0000
committerMax Horn2003-11-28 21:56:14 +0000
commit54aa33310d1dbd9f04e2ede970d8e17200798000 (patch)
treef0759afc13ec3d4d569fe2c2272dd748a665b843 /scumm
parent8a6b0e2e1837711d06e0ed66913f340d8d923bb3 (diff)
downloadscummvm-rg350-54aa33310d1dbd9f04e2ede970d8e17200798000.tar.gz
scummvm-rg350-54aa33310d1dbd9f04e2ede970d8e17200798000.tar.bz2
scummvm-rg350-54aa33310d1dbd9f04e2ede970d8e17200798000.zip
reuse SaveLoadChooser in main dialog -> this means the SaveLoadChooser remembers the scroll position -> improved user experience
svn-id: r11415
Diffstat (limited to 'scumm')
-rw-r--r--scumm/dialogs.cpp20
-rw-r--r--scumm/dialogs.h4
2 files changed, 16 insertions, 8 deletions
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp
index 6390d1774f..a121fcbaf3 100644
--- a/scumm/dialogs.cpp
+++ b/scumm/dialogs.cpp
@@ -198,14 +198,14 @@ protected:
bool _saveMode;
public:
- SaveLoadChooser(const String &title, const StringList& list, const String &buttonLabel, bool saveMode);
+ SaveLoadChooser(const String &title, const String &buttonLabel, bool saveMode);
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
const String &getResultString() const;
};
-SaveLoadChooser::SaveLoadChooser(const String &title, const StringList& list, const String &buttonLabel, bool saveMode)
- : ChooserDialog(title, list, buttonLabel, 182), _saveMode(saveMode) {
+SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel, bool saveMode)
+ : ChooserDialog(title, buttonLabel, 182), _saveMode(saveMode) {
_list->setEditable(saveMode);
_list->setNumberingMode(saveMode ? kListNumberingOne : kListNumberingZero);
@@ -303,6 +303,8 @@ MainMenuDialog::MainMenuDialog(ScummEngine *scumm)
#ifndef DISABLE_HELP
_helpDialog = new HelpDialog(scumm);
#endif
+ _saveDialog = new SaveLoadChooser("Save game:", "Save", true);
+ _loadDialog = new SaveLoadChooser("Load game:", "Load", false);
}
MainMenuDialog::~MainMenuDialog() {
@@ -310,6 +312,8 @@ MainMenuDialog::~MainMenuDialog() {
#ifndef DISABLE_HELP
delete _helpDialog;
#endif
+ delete _saveDialog;
+ delete _loadDialog;
}
void MainMenuDialog::open() {
@@ -361,10 +365,10 @@ void MainMenuDialog::close() {
void MainMenuDialog::save() {
int idx;
- SaveLoadChooser dialog("Save game:", generateSavegameList(_scumm, true), "Save", true);
- idx = dialog.runModal();
+ _saveDialog->setList(generateSavegameList(_scumm, true));
+ idx = _saveDialog->runModal();
if (idx >= 0) {
- const String &result = dialog.getResultString();
+ const String &result = _saveDialog->getResultString();
char buffer[20];
const char *str;
if (result.isEmpty()) {
@@ -380,8 +384,8 @@ void MainMenuDialog::save() {
void MainMenuDialog::load() {
int idx;
- SaveLoadChooser dialog("Load game:", generateSavegameList(_scumm, false), "Load", false);
- idx = dialog.runModal();
+ _loadDialog->setList(generateSavegameList(_scumm, false));
+ idx = _loadDialog->runModal();
if (idx >= 0) {
_scumm->requestLoad(idx);
close();
diff --git a/scumm/dialogs.h b/scumm/dialogs.h
index 7d9f7ff9fe..789d8ff121 100644
--- a/scumm/dialogs.h
+++ b/scumm/dialogs.h
@@ -54,6 +54,8 @@ protected:
const String queryResString(int stringno);
};
+class SaveLoadChooser;
+
class MainMenuDialog : public ScummDialog {
public:
MainMenuDialog(ScummEngine *scumm);
@@ -67,6 +69,8 @@ protected:
#ifndef DISABLE_HELP
GUI::Dialog *_helpDialog;
#endif
+ SaveLoadChooser *_saveDialog;
+ SaveLoadChooser *_loadDialog;
void save();
void load();