aboutsummaryrefslogtreecommitdiff
path: root/gui/options.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/options.cpp')
-rw-r--r--gui/options.cpp74
1 files changed, 50 insertions, 24 deletions
diff --git a/gui/options.cpp b/gui/options.cpp
index dfa30d1e3e..6747195a1b 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -30,6 +30,8 @@
#include "common/fs.h"
#include "common/config-manager.h"
+#include "common/gui_options.h"
+#include "common/rendermode.h"
#include "common/system.h"
#include "common/textconsole.h"
#include "common/translation.h"
@@ -79,7 +81,7 @@ static const char *outputRateLabels[] = { _s("<default>"), _s("8 kHz"), _s("11kH
static const int outputRateValues[] = { 0, 8000, 11025, 22050, 44100, 48000, -1 };
OptionsDialog::OptionsDialog(const Common::String &domain, int x, int y, int w, int h)
- : Dialog(x, y, w, h), _domain(domain), _graphicsTabId(-1), _tabWidget(0) {
+ : Dialog(x, y, w, h), _domain(domain), _graphicsTabId(-1), _midiTabId(-1), _pathsTabId(-1), _tabWidget(0) {
init();
}
@@ -191,9 +193,9 @@ void OptionsDialog::open() {
int sel = 0;
for (int i = 0; p->code; ++p, ++i) {
if (renderMode == p->id)
- sel = i + 2;
+ sel = p->id;
}
- _renderModePopUp->setSelected(sel);
+ _renderModePopUp->setSelectedTag(sel);
}
#ifdef SMALL_SCREEN_DEVICE
@@ -748,13 +750,18 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr
}
// RenderMode popup
+ const Common::String allFlags = Common::allRenderModesGUIOs();
+ bool renderingTypeDefined = (strpbrk(_guioptions.c_str(), allFlags.c_str()) != NULL);
+
_renderModePopUpDesc = new StaticTextWidget(boss, prefix + "grRenderPopupDesc", _("Render mode:"), _("Special dithering modes supported by some games"));
_renderModePopUp = new PopUpWidget(boss, prefix + "grRenderPopup", _("Special dithering modes supported by some games"));
_renderModePopUp->appendEntry(_("<default>"), Common::kRenderDefault);
_renderModePopUp->appendEntry("");
const Common::RenderModeDescription *rm = Common::g_renderModes;
for (; rm->code; ++rm) {
- _renderModePopUp->appendEntry(_c(rm->description, context), rm->id);
+ Common::String renderGuiOption = Common::renderMode2GUIO(rm->id);
+ if ((_domain == Common::ConfigManager::kApplicationDomain) || (_domain != Common::ConfigManager::kApplicationDomain && !renderingTypeDefined) || (_guioptions.contains(renderGuiOption)))
+ _renderModePopUp->appendEntry(_c(rm->description, context), rm->id);
}
// Fullscreen checkbox
@@ -1003,7 +1010,7 @@ bool OptionsDialog::loadMusicDeviceSetting(PopUpWidget *popup, Common::String se
for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) {
if (setting.empty() ? (preferredType == d->getMusicType()) : (drv == d->getCompleteId())) {
popup->setSelectedTag(d->getHandle());
- return popup->getSelected() == -1 ? false : true;
+ return popup->getSelected() != -1;
}
}
}
@@ -1033,22 +1040,6 @@ void OptionsDialog::saveMusicDeviceSetting(PopUpWidget *popup, Common::String se
ConfMan.removeKey(setting, _domain);
}
-ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd) {
- ButtonWidget *button;
-
-#ifndef DISABLE_FANCY_THEMES
- if (g_gui.xmlEval()->getVar("Globals.ShowSearchPic") == 1 && g_gui.theme()->supportsImages()) {
- button = new PicButtonWidget(boss, name, _("Clear value"), cmd);
- ((PicButtonWidget *)button)->useThemeTransparency(true);
- ((PicButtonWidget *)button)->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageEraser));
- } else
-#endif
- button = new ButtonWidget(boss, name, "C", _("Clear value"), cmd);
-
- return button;
-}
-
-
int OptionsDialog::getSubtitleMode(bool subtitles, bool speech_mute) {
if (_guioptions.contains(GUIO_NOSUBTITLES))
return kSubtitlesSpeech; // Speech only
@@ -1106,7 +1097,7 @@ GlobalOptionsDialog::GlobalOptionsDialog()
//
// 3) The MIDI tab
//
- tab->addTab(_("MIDI"));
+ _midiTabId = tab->addTab(_("MIDI"));
addMIDIControls(tab, "GlobalOptions_MIDI.");
//
@@ -1119,9 +1110,9 @@ GlobalOptionsDialog::GlobalOptionsDialog()
// 5) The Paths tab
//
if (g_system->getOverlayWidth() > 320)
- tab->addTab(_("Paths"));
+ _pathsTabId = tab->addTab(_("Paths"));
else
- tab->addTab(_c("Paths", "lowres"));
+ _pathsTabId = tab->addTab(_c("Paths", "lowres"));
#if !( defined(__DC__) || defined(__GP32__) )
// These two buttons have to be extra wide, or the text will be
@@ -1480,4 +1471,39 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
}
}
+void GlobalOptionsDialog::reflowLayout() {
+ int activeTab = _tabWidget->getActiveTab();
+
+ if (_midiTabId != -1) {
+ _tabWidget->setActiveTab(_midiTabId);
+
+ _tabWidget->removeWidget(_soundFontClearButton);
+ _soundFontClearButton->setNext(0);
+ delete _soundFontClearButton;
+ _soundFontClearButton = addClearButton(_tabWidget, "GlobalOptions_MIDI.mcFontClearButton", kClearSoundFontCmd);
+ }
+
+ if (_pathsTabId != -1) {
+ _tabWidget->setActiveTab(_pathsTabId);
+
+ _tabWidget->removeWidget(_savePathClearButton);
+ _savePathClearButton->setNext(0);
+ delete _savePathClearButton;
+ _savePathClearButton = addClearButton(_tabWidget, "GlobalOptions_Paths.SavePathClearButton", kSavePathClearCmd);
+
+ _tabWidget->removeWidget(_themePathClearButton);
+ _themePathClearButton->setNext(0);
+ delete _themePathClearButton;
+ _themePathClearButton = addClearButton(_tabWidget, "GlobalOptions_Paths.ThemePathClearButton", kThemePathClearCmd);
+
+ _tabWidget->removeWidget(_extraPathClearButton);
+ _extraPathClearButton->setNext(0);
+ delete _extraPathClearButton;
+ _extraPathClearButton = addClearButton(_tabWidget, "GlobalOptions_Paths.ExtraPathClearButton", kExtraPathClearCmd);
+ }
+
+ _tabWidget->setActiveTab(activeTab);
+ OptionsDialog::reflowLayout();
+}
+
} // End of namespace GUI