patch #626226 with some mods of my own

svn-id: r5209
This commit is contained in:
Max Horn 2002-10-21 09:38:42 +00:00
parent 7677e42ffe
commit 46a3039f70
2 changed files with 42 additions and 18 deletions

View File

@ -318,10 +318,7 @@ SaveLoadDialog::SaveLoadDialog(NewGui *gui, Scumm *scumm)
void SaveLoadDialog::open() void SaveLoadDialog::open()
{ {
_saveMode = false; switchToLoadMode();
_saveButton->setState(false);
_loadButton->setState(true);
fillList();
ScummDialog::open(); ScummDialog::open();
} }
@ -331,28 +328,24 @@ void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
switch (cmd) { switch (cmd) {
case kSaveCmd: case kSaveCmd:
if (!_saveMode) { if (!_saveMode) {
_saveMode = true; switchToSaveMode();
_saveButton->setState(true);
_loadButton->setState(false);
fillList();
draw();
} }
break; break;
case kLoadCmd: case kLoadCmd:
if (_saveMode) { if (_saveMode) {
_saveMode = false; switchToLoadMode();
_saveButton->setState(false);
_loadButton->setState(true);
fillList();
draw();
} }
break; break;
case kListItemDoubleClickedCmd: case kListItemDoubleClickedCmd:
if (_savegameList->getSelected() >= 0 && !_savegameList->getSelectedString().isEmpty()) { if (_savegameList->getSelected() >= 0) {
if (_saveMode) { if (_saveMode) {
// Start editing the selected item, for saving if (_savegameList->getSelectedString().isEmpty()) {
_savegameList->startEditMode(); // Start editing the selected item, for saving
} else { _savegameList->startEditMode();
} else {
save();
}
} else if (!_savegameList->getSelectedString().isEmpty()) {
load(); load();
} }
} }
@ -366,6 +359,11 @@ void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
} }
} }
break; break;
case kListSelectionChangedCmd:
if (_saveMode) {
_savegameList->startEditMode();
}
break;
case kPlayCmd: case kPlayCmd:
close(); close();
break; break;
@ -415,6 +413,30 @@ void SaveLoadDialog::load()
close(); 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 - #pragma mark -

View File

@ -66,6 +66,8 @@ protected:
void fillList(); void fillList();
void save(); void save();
void load(); void load();
void switchToSaveMode();
void switchToLoadMode();
}; };