GUI: Don't create a popup for the stretch mode if it's not supported
This commit is contained in:
parent
380643315e
commit
5f06b599c8
1 changed files with 60 additions and 53 deletions
|
@ -346,26 +346,6 @@ void OptionsDialog::build() {
|
|||
_renderModePopUp->setSelectedTag(sel);
|
||||
}
|
||||
|
||||
_stretchPopUp->setSelected(0);
|
||||
|
||||
if (g_system->hasFeature(OSystem::kFeatureStretchMode)) {
|
||||
if (ConfMan.hasKey("stretch_mode", _domain)) {
|
||||
const OSystem::GraphicsMode *sm = g_system->getSupportedStretchModes();
|
||||
Common::String stretchMode(ConfMan.get("stretch_mode", _domain));
|
||||
int stretchCount = 1;
|
||||
while (sm->name) {
|
||||
stretchCount++;
|
||||
if (scumm_stricmp(sm->name, stretchMode.c_str()) == 0)
|
||||
_stretchPopUp->setSelected(stretchCount);
|
||||
sm++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_stretchPopUpDesc->setVisible(false);
|
||||
_stretchPopUp->setVisible(false);
|
||||
_stretchPopUp->setEnabled(false);
|
||||
}
|
||||
|
||||
_scalerPopUp->setSelected(0);
|
||||
_scaleFactorPopUp->setSelected(0);
|
||||
|
||||
|
@ -442,6 +422,27 @@ void OptionsDialog::build() {
|
|||
}
|
||||
}
|
||||
|
||||
if (_stretchPopUp) {
|
||||
if (g_system->hasFeature(OSystem::kFeatureStretchMode)) {
|
||||
_stretchPopUp->setSelected(0);
|
||||
|
||||
if (ConfMan.hasKey("stretch_mode", _domain)) {
|
||||
const OSystem::GraphicsMode *sm = g_system->getSupportedStretchModes();
|
||||
Common::String stretchMode(ConfMan.get("stretch_mode", _domain));
|
||||
int stretchCount = 1;
|
||||
while (sm->name) {
|
||||
stretchCount++;
|
||||
if (scumm_stricmp(sm->name, stretchMode.c_str()) == 0)
|
||||
_stretchPopUp->setSelected(stretchCount);
|
||||
sm++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_stretchPopUpDesc->setVisible(false);
|
||||
_stretchPopUp->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Shader options
|
||||
if (_shader) {
|
||||
if (g_system->hasFeature(OSystem::kFeatureShaders)) {
|
||||
|
@ -650,6 +651,7 @@ void OptionsDialog::apply() {
|
|||
}
|
||||
}
|
||||
|
||||
if (g_system->hasFeature(OSystem::kFeatureStretchMode)) {
|
||||
isSet = false;
|
||||
if ((int32)_stretchPopUp->getSelectedTag() >= 0) {
|
||||
const OSystem::GraphicsMode *sm = g_system->getSupportedStretchModes();
|
||||
|
@ -673,6 +675,7 @@ void OptionsDialog::apply() {
|
|||
if (g_system->getStretchMode() != g_system->getDefaultStretchMode())
|
||||
graphicsModeChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
isSet = false;
|
||||
const PluginList &scalerPlugins = ScalerMan.getPlugins();
|
||||
|
@ -1229,9 +1232,12 @@ void OptionsDialog::setGraphicSettingsState(bool enabled) {
|
|||
_stretchPopUpDesc->setEnabled(enabled);
|
||||
_stretchPopUp->setEnabled(enabled);
|
||||
} else {
|
||||
// Happens when we switch to backend that doesn't support stretch modes
|
||||
if (_stretchPopUp) {
|
||||
_stretchPopUpDesc->setEnabled(false);
|
||||
_stretchPopUp->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (g_system->hasFeature(OSystem::kFeatureScalers)) {
|
||||
_scalerPopUpDesc->setEnabled(enabled);
|
||||
|
@ -1582,6 +1588,7 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr
|
|||
}
|
||||
|
||||
// The Stretch mode popup
|
||||
if (g_system->hasFeature(OSystem::kFeatureStretchMode)) {
|
||||
const OSystem::GraphicsMode *sm = g_system->getSupportedStretchModes();
|
||||
_stretchPopUpDesc = new StaticTextWidget(boss, prefix + "grStretchModePopupDesc", _("Stretch mode:"));
|
||||
if (ConfMan.isKeyTemporary("stretch_mode"))
|
||||
|
@ -1594,6 +1601,7 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr
|
|||
_stretchPopUp->appendEntry(_c(sm->description, context), sm->id);
|
||||
sm++;
|
||||
}
|
||||
}
|
||||
|
||||
// The Scaler popup
|
||||
const PluginList &scalerPlugins = ScalerMan.getPlugins();
|
||||
|
@ -1998,6 +2006,8 @@ void OptionsDialog::setupGraphicsTab() {
|
|||
// Fixes crash when switching from SDL Surface to OpenGL
|
||||
if (!_shader && g_system->hasFeature(OSystem::kFeatureShaders)) {
|
||||
rebuild();
|
||||
} else if (!_stretchPopUp && g_system->hasFeature(OSystem::kFeatureStretchMode)) {
|
||||
rebuild();
|
||||
}
|
||||
setGraphicSettingsState(_enableGraphicSettings);
|
||||
}
|
||||
|
@ -2008,9 +2018,6 @@ void OptionsDialog::setupGraphicsTab() {
|
|||
if (g_system->hasFeature(OSystem::kFeatureStretchMode)) {
|
||||
_stretchPopUpDesc->setVisible(true);
|
||||
_stretchPopUp->setVisible(true);
|
||||
} else {
|
||||
_stretchPopUpDesc->setVisible(false);
|
||||
_stretchPopUp->setVisible(false);
|
||||
}
|
||||
_fullscreenCheckbox->setVisible(true);
|
||||
if (g_system->hasFeature(OSystem::kFeatureFilteringMode))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue