diff options
Diffstat (limited to 'gui/dialog.cpp')
-rw-r--r-- | gui/dialog.cpp | 249 |
1 files changed, 0 insertions, 249 deletions
diff --git a/gui/dialog.cpp b/gui/dialog.cpp index e1886af83d..d9c25d15bb 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -24,13 +24,6 @@ #include "newgui.h" #include "dialog.h" #include "widget.h" -#include "ListWidget.h" -#include "config-file.h" - -#include "scumm/sound.h" -#include "sound/mididrv.h" -#include "scumm/scumm.h" -#include "scumm/imuse.h" /* * TODO list @@ -250,250 +243,8 @@ Widget *Dialog::findWidget(int x, int y) return w; } -void Dialog::addResText(int x, int y, int w, int h, int resID) -{ - // Get the string - const char *str = _gui->queryResString(resID); - if (!str) - str = "Dummy!"; - new StaticTextWidget(this, x, y, w, h, str, kTextAlignLeft); -} - void Dialog::addButton(int x, int y, int w, int h, const char *label, uint32 cmd, char hotkey) { new ButtonWidget(this, x, y, w, h, label, cmd, hotkey); } -#pragma mark - - - -enum { - kSaveCmd = 'SAVE', - kLoadCmd = 'LOAD', - kPlayCmd = 'PLAY', - kOptionsCmd = 'OPTN', - kQuitCmd = 'QUIT' -}; - -/* - * TODO - * - Maybe go back to the old way of differentiating between the save and the load mode? - * This would include that in the load mode the list is not editable. - * - Currently the savegame list is only loaded once when the dialog is created. Instead, - * it should be loaded whenever the dialog is opened. Might want to add an open() - * method to Dialog for that. - */ - -SaveLoadDialog::SaveLoadDialog(NewGui *gui, Scumm *scumm) - : Dialog (gui, 30, 20, 260, 124), _scumm(scumm) -{ - addResText(10, 7, 240, 16, 1); -// addResText(10, 7, 240, 16, 2); -// addResText(10, 7, 240, 16, 3); - - addButton(200, 20, 54, 16, RES_STRING(4), kSaveCmd, 'S'); // Save - addButton(200, 40, 54, 16, RES_STRING(5), kLoadCmd, 'L'); // Load - addButton(200, 60, 54, 16, RES_STRING(6), kPlayCmd, 'P'); // Play - addButton(200, 80, 54, 16, CUSTOM_STRING(17), kOptionsCmd, 'O'); // Options - addButton(200, 100, 54, 16, RES_STRING(8), kQuitCmd, 'Q'); // Quit - - _savegameList = new ListWidget(this, 10, 20, 180, 90); - _savegameList->setNumberingMode(kListNumberingZero); - - // Get savegame names - ScummVM::StringList l; - char name[32]; - - for (int i = 0; i <= 80; i++) { // 80 - got this value from the old GUI - _scumm->getSavegameName(i, name); - l.push_back(name); - } - - _savegameList->setList(l); -} - -void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) -{ - switch (cmd) { - case kListItemChangedCmd: - case kSaveCmd: - if (_savegameList->getSelected() >= 1 && !_savegameList->getSelectedString().isEmpty()) { - Scumm *s = _scumm; - s->_saveLoadSlot = _savegameList->getSelected(); - s->_saveLoadCompatible = false; - s->_saveLoadFlag = 1; // 1 for save, I assume (Painelf) - strcpy(s->_saveLoadName, _savegameList->getSelectedString().c_str()); - close(); - } - break; - case kListItemDoubleClickedCmd: - case kLoadCmd: - if (_savegameList->getSelected() >= 0 && !_savegameList->getSelectedString().isEmpty()) { - Scumm *s = _scumm; - s->_saveLoadSlot = _savegameList->getSelected(); - s->_saveLoadCompatible = false; - s->_saveLoadFlag = 2; // 2 for load. Magic number anyone? - close(); - } - break; - case kPlayCmd: - close(); - break; - case kOptionsCmd: - _gui->optionsDialog(); - break; - case kQuitCmd: { - _scumm->_system->quit(); - } - break; - default: - Dialog::handleCommand(sender, cmd, data); - } -} - - -#pragma mark - - -enum { - kSoundCmd = 'SOUN', - kKeysCmd = 'KEYS', - kAboutCmd = 'ABOU', - kMiscCmd = 'OPTN' -}; - -OptionsDialog::OptionsDialog(NewGui *gui) - : Dialog (gui, 50, 80, 210, 60) -{ - addButton( 10, 10, 40, 16, CUSTOM_STRING(5), kSoundCmd, 'S'); // Sound - addButton( 80, 10, 40, 16, CUSTOM_STRING(6), kKeysCmd, 'K'); // Keys - addButton(150, 10, 40, 16, CUSTOM_STRING(7), kAboutCmd, 'A'); // About - addButton( 10, 35, 40, 16, CUSTOM_STRING(18), kMiscCmd, 'M'); // Misc - addButton(150, 35, 40, 16, CUSTOM_STRING(23), kCloseCmd, 'C'); // Close dialog - FIXME -} - -void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) -{ - switch (cmd) { - case kSoundCmd: - _gui->soundDialog(); - break; - case kKeysCmd: - break; - case kAboutCmd: - _gui->aboutDialog(); - break; - case kMiscCmd: - break; - default: - Dialog::handleCommand(sender, cmd, data); - } -} - - -#pragma mark - - -AboutDialog::AboutDialog(NewGui *gui) - : Dialog (gui, 30, 20, 260, 124) -{ - addButton(110, 100, 40, 16, CUSTOM_STRING(23), kCloseCmd, 'C'); // Close dialog - FIXME - new StaticTextWidget(this, 10, 10, 240, 16, "ScummVM " SCUMMVM_VERSION " (" SCUMMVM_CVS ")", kTextAlignCenter); - new StaticTextWidget(this, 10, 30, 240, 16, "http://scummvm.sourceforge.net", kTextAlignCenter); - new StaticTextWidget(this, 10, 50, 240, 16, "All games (c) LucasArts", kTextAlignCenter); - new StaticTextWidget(this, 10, 64, 240, 16, "Except", kTextAlignCenter); - new StaticTextWidget(this, 10, 78, 240, 16, "Simon the Sorcerer (c) Adventuresoft", kTextAlignCenter); -} - -PauseDialog::PauseDialog(NewGui *gui) - : Dialog (gui, 50, 80, 220, 16) -{ - addResText(4, 4, 220, 16, 10); -} - -SoundDialog::SoundDialog(NewGui *gui, Scumm *scumm) - : Dialog (gui, 30, 20, 260, 110), _scumm(scumm) -{ - - // set up dialog - addButton(70, 90, 54, 16, "OK", kOKCmd, 'O'); // Confirm dialog - addButton(136, 90, 54, 16, "Cancel", kCancelCmd, 'C'); // Abort dialog - new StaticTextWidget(this, 20, 17, 85, 16, "Master volume:", kTextAlignRight); - new StaticTextWidget(this, 20, 37, 85, 16, "Music volume:", kTextAlignRight); - new StaticTextWidget(this, 20, 57, 85, 16, "SFX volume:", kTextAlignRight); - - masterVolumeSlider = new SliderWidget(this, 110, 13, 80, 16, "Volume1", kMasterVolumeChanged); - musicVolumeSlider = new SliderWidget(this, 110, 33, 80, 16, "Volume2", kMusicVolumeChanged); - sfxVolumeSlider = new SliderWidget(this, 110, 53, 80, 16, "Volume3", kSfxVolumeChanged); - - masterVolumeSlider->setMinValue(0); masterVolumeSlider->setMaxValue(256); - musicVolumeSlider->setMinValue(0); musicVolumeSlider->setMaxValue(256); - sfxVolumeSlider->setMinValue(0); sfxVolumeSlider->setMaxValue(256); - - masterVolumeLabel = new StaticTextWidget(this, 195, 17, 60, 16, "Volume1", kTextAlignLeft); - musicVolumeLabel = new StaticTextWidget(this, 195, 37, 60, 16, "Volume2", kTextAlignLeft); - sfxVolumeLabel = new StaticTextWidget(this, 195, 57, 60, 16, "Volume3", kTextAlignLeft); - - masterVolumeLabel->setFlags(WIDGET_CLEARBG); - musicVolumeLabel->setFlags(WIDGET_CLEARBG); - sfxVolumeLabel->setFlags(WIDGET_CLEARBG); -} - -void SoundDialog::open() -{ - Dialog::open(); - - // get current variables - _soundVolumeMaster = _scumm->_sound->_sound_volume_master; - _soundVolumeMusic = _scumm->_sound->_sound_volume_music; - _soundVolumeSfx = _scumm->_sound->_sound_volume_sfx; - - masterVolumeSlider->setValue(_soundVolumeMaster); - musicVolumeSlider->setValue(_soundVolumeMusic); - sfxVolumeSlider->setValue(_soundVolumeSfx); - - masterVolumeLabel->setValue(_soundVolumeMaster); - musicVolumeLabel->setValue(_soundVolumeMusic); - sfxVolumeLabel->setValue(_soundVolumeSfx); -} - - -void SoundDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) -{ - switch (cmd) { - case kMasterVolumeChanged: - _soundVolumeMaster = masterVolumeSlider->getValue(); - masterVolumeLabel->setValue(_soundVolumeMaster); - masterVolumeLabel->draw(); - break; - case kMusicVolumeChanged: - _soundVolumeMusic = musicVolumeSlider->getValue(); - musicVolumeLabel->setValue(_soundVolumeMusic); - musicVolumeLabel->draw(); - break; - case kSfxVolumeChanged: - _soundVolumeSfx = sfxVolumeSlider->getValue(); - sfxVolumeLabel->setValue(_soundVolumeSfx); - sfxVolumeLabel->draw(); - break; - case kOKCmd: { - // FIXME: Look at Fingolfins comments in Gui::handleSoundDialogCommand(), gui.cpp - _scumm->_sound->_sound_volume_master = _soundVolumeMaster; // Master - _scumm->_sound->_sound_volume_music = _soundVolumeMusic; // Music - _scumm->_sound->_sound_volume_sfx = _soundVolumeSfx; // SFX - - _scumm->_imuse->set_music_volume(_soundVolumeMusic); - _scumm->_imuse->set_master_volume(_soundVolumeMaster); - _scumm->_mixer->setVolume(_soundVolumeSfx); - _scumm->_mixer->setMusicVolume(_soundVolumeMusic); - - scummcfg->setInt("master_volume", _soundVolumeMaster); - scummcfg->setInt("music_volume", _soundVolumeMusic); - scummcfg->setInt("sfx_volume", _soundVolumeSfx); - scummcfg->flush(); - } - case kCancelCmd: - close(); - break; - default: - Dialog::handleCommand(sender, cmd, data); - } -} |