diff options
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/dialogs.cpp | 58 | ||||
-rw-r--r-- | scumm/dialogs.h | 2 |
2 files changed, 42 insertions, 18 deletions
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp index 3d846c60fc..4752cbfd96 100644 --- a/scumm/dialogs.cpp +++ b/scumm/dialogs.cpp @@ -318,10 +318,7 @@ SaveLoadDialog::SaveLoadDialog(NewGui *gui, Scumm *scumm) void SaveLoadDialog::open() { - _saveMode = false; - _saveButton->setState(false); - _loadButton->setState(true); - fillList(); + switchToLoadMode(); ScummDialog::open(); } @@ -331,28 +328,24 @@ void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat switch (cmd) { case kSaveCmd: if (!_saveMode) { - _saveMode = true; - _saveButton->setState(true); - _loadButton->setState(false); - fillList(); - draw(); + switchToSaveMode(); } break; case kLoadCmd: if (_saveMode) { - _saveMode = false; - _saveButton->setState(false); - _loadButton->setState(true); - fillList(); - draw(); + switchToLoadMode(); } break; case kListItemDoubleClickedCmd: - if (_savegameList->getSelected() >= 0 && !_savegameList->getSelectedString().isEmpty()) { + if (_savegameList->getSelected() >= 0) { if (_saveMode) { - // Start editing the selected item, for saving - _savegameList->startEditMode(); - } else { + if (_savegameList->getSelectedString().isEmpty()) { + // Start editing the selected item, for saving + _savegameList->startEditMode(); + } else { + save(); + } + } else if (!_savegameList->getSelectedString().isEmpty()) { load(); } } @@ -366,6 +359,11 @@ void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat } } break; + case kListSelectionChangedCmd: + if (_saveMode) { + _savegameList->startEditMode(); + } + break; case kPlayCmd: close(); break; @@ -415,6 +413,30 @@ void SaveLoadDialog::load() close(); } +void SaveLoadDialog::switchToSaveMode() +{ + _saveMode = true; + _saveButton->setState(true); + _loadButton->setState(false); + _saveButton->clearFlags(WIDGET_ENABLED); + _loadButton->setFlags(WIDGET_ENABLED); + _savegameList->setEditable(true); + fillList(); + draw(); +} + +void SaveLoadDialog::switchToLoadMode() +{ + _saveMode = false; + _saveButton->setState(false); + _loadButton->setState(true); + _saveButton->setFlags(WIDGET_ENABLED); + _loadButton->clearFlags(WIDGET_ENABLED); + _savegameList->setEditable(false); + fillList(); + draw(); +} + #pragma mark - diff --git a/scumm/dialogs.h b/scumm/dialogs.h index 2a3dde696f..da2a3054dd 100644 --- a/scumm/dialogs.h +++ b/scumm/dialogs.h @@ -66,6 +66,8 @@ protected: void fillList(); void save(); void load(); + void switchToSaveMode(); + void switchToLoadMode(); }; |