GUI: Add Stretch Mode selection in Options dialog
This commit is contained in:
parent
adacb4fcfd
commit
89f1b1c96e
13 changed files with 134 additions and 1 deletions
|
@ -218,6 +218,7 @@ void OpenGLSdlGraphicsManager::deactivateManager() {
|
||||||
bool OpenGLSdlGraphicsManager::hasFeature(OSystem::Feature f) const {
|
bool OpenGLSdlGraphicsManager::hasFeature(OSystem::Feature f) const {
|
||||||
switch (f) {
|
switch (f) {
|
||||||
case OSystem::kFeatureFullscreenMode:
|
case OSystem::kFeatureFullscreenMode:
|
||||||
|
case OSystem::kFeatureStretchMode:
|
||||||
case OSystem::kFeatureIconifyWindow:
|
case OSystem::kFeatureIconifyWindow:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -256,6 +256,7 @@ bool SurfaceSdlGraphicsManager::hasFeature(OSystem::Feature f) const {
|
||||||
(f == OSystem::kFeatureAspectRatioCorrection) ||
|
(f == OSystem::kFeatureAspectRatioCorrection) ||
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
(f == OSystem::kFeatureFilteringMode) ||
|
(f == OSystem::kFeatureFilteringMode) ||
|
||||||
|
(f == OSystem::kFeatureStretchMode) ||
|
||||||
#endif
|
#endif
|
||||||
(f == OSystem::kFeatureCursorPalette) ||
|
(f == OSystem::kFeatureCursorPalette) ||
|
||||||
(f == OSystem::kFeatureIconifyWindow);
|
(f == OSystem::kFeatureIconifyWindow);
|
||||||
|
|
|
@ -262,6 +262,11 @@ public:
|
||||||
*/
|
*/
|
||||||
kFeatureFilteringMode,
|
kFeatureFilteringMode,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicate if stretch modes are supported by the backend.
|
||||||
|
*/
|
||||||
|
kFeatureStretchMode,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether a virtual keyboard is too be shown or not.
|
* Determine whether a virtual keyboard is too be shown or not.
|
||||||
* This would mostly be implemented by backends for hand held devices,
|
* This would mostly be implemented by backends for hand held devices,
|
||||||
|
|
|
@ -329,6 +329,15 @@ void initGraphics(int width, int height, const Graphics::PixelFormat *format) {
|
||||||
dialog.runModal();
|
dialog.runModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gfxError & OSystem::kTransactionStretchModeSwitchFailed) {
|
||||||
|
Common::String message = _("Could not switch to stretch mode: '");
|
||||||
|
message += ConfMan.get("stretch_mode");
|
||||||
|
message += "'.";
|
||||||
|
|
||||||
|
GUI::MessageDialog dialog(message);
|
||||||
|
dialog.runModal();
|
||||||
|
}
|
||||||
|
|
||||||
if (gfxError & OSystem::kTransactionAspectRatioFailed) {
|
if (gfxError & OSystem::kTransactionAspectRatioFailed) {
|
||||||
GUI::MessageDialog dialog(_("Could not apply aspect ratio setting."));
|
GUI::MessageDialog dialog(_("Could not apply aspect ratio setting."));
|
||||||
dialog.runModal();
|
dialog.runModal();
|
||||||
|
|
|
@ -154,6 +154,8 @@ void OptionsDialog::init() {
|
||||||
_gfxPopUpDesc = 0;
|
_gfxPopUpDesc = 0;
|
||||||
_renderModePopUp = 0;
|
_renderModePopUp = 0;
|
||||||
_renderModePopUpDesc = 0;
|
_renderModePopUpDesc = 0;
|
||||||
|
_stretchPopUp = 0;
|
||||||
|
_stretchPopUpDesc = 0;
|
||||||
_fullscreenCheckbox = 0;
|
_fullscreenCheckbox = 0;
|
||||||
_filteringCheckbox = 0;
|
_filteringCheckbox = 0;
|
||||||
_aspectCheckbox = 0;
|
_aspectCheckbox = 0;
|
||||||
|
@ -285,6 +287,25 @@ void OptionsDialog::build() {
|
||||||
_renderModePopUp->setSelectedTag(sel);
|
_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);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef GUI_ONLY_FULLSCREEN
|
#ifdef GUI_ONLY_FULLSCREEN
|
||||||
_fullscreenCheckbox->setState(true);
|
_fullscreenCheckbox->setState(true);
|
||||||
_fullscreenCheckbox->setEnabled(false);
|
_fullscreenCheckbox->setEnabled(false);
|
||||||
|
@ -470,6 +491,23 @@ void OptionsDialog::apply() {
|
||||||
|
|
||||||
if ((int32)_renderModePopUp->getSelectedTag() >= 0)
|
if ((int32)_renderModePopUp->getSelectedTag() >= 0)
|
||||||
ConfMan.set("render_mode", Common::getRenderModeCode((Common::RenderMode)_renderModePopUp->getSelectedTag()), _domain);
|
ConfMan.set("render_mode", Common::getRenderModeCode((Common::RenderMode)_renderModePopUp->getSelectedTag()), _domain);
|
||||||
|
|
||||||
|
isSet = false;
|
||||||
|
if ((int32)_stretchPopUp->getSelectedTag() >= 0) {
|
||||||
|
const OSystem::GraphicsMode *sm = g_system->getSupportedStretchModes();
|
||||||
|
while (sm->name) {
|
||||||
|
if (sm->id == (int)_stretchPopUp->getSelectedTag()) {
|
||||||
|
if (ConfMan.get("stretch_mode", _domain) != sm->name)
|
||||||
|
graphicsModeChanged = true;
|
||||||
|
ConfMan.set("stretch_mode", sm->name, _domain);
|
||||||
|
isSet = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sm++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isSet)
|
||||||
|
ConfMan.removeKey("stretch_mode", _domain);
|
||||||
} else {
|
} else {
|
||||||
ConfMan.removeKey("fullscreen", _domain);
|
ConfMan.removeKey("fullscreen", _domain);
|
||||||
ConfMan.removeKey("filtering", _domain);
|
ConfMan.removeKey("filtering", _domain);
|
||||||
|
@ -484,6 +522,8 @@ void OptionsDialog::apply() {
|
||||||
g_system->beginGFXTransaction();
|
g_system->beginGFXTransaction();
|
||||||
g_system->setGraphicsMode(ConfMan.get("gfx_mode", _domain).c_str());
|
g_system->setGraphicsMode(ConfMan.get("gfx_mode", _domain).c_str());
|
||||||
|
|
||||||
|
if (ConfMan.hasKey("stretch_mode"))
|
||||||
|
g_system->setStretchMode(ConfMan.get("stretch_mode", _domain).c_str());
|
||||||
if (ConfMan.hasKey("aspect_ratio"))
|
if (ConfMan.hasKey("aspect_ratio"))
|
||||||
g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio", _domain));
|
g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio", _domain));
|
||||||
if (ConfMan.hasKey("fullscreen"))
|
if (ConfMan.hasKey("fullscreen"))
|
||||||
|
@ -519,7 +559,20 @@ void OptionsDialog::apply() {
|
||||||
gm++;
|
gm++;
|
||||||
}
|
}
|
||||||
message += "\n";
|
message += "\n";
|
||||||
message += _("the video mode could not be changed.");
|
message += _("the video mode could not be changed");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gfxError & OSystem::kTransactionStretchModeSwitchFailed) {
|
||||||
|
const OSystem::GraphicsMode *sm = g_system->getSupportedStretchModes();
|
||||||
|
while (sm->name) {
|
||||||
|
if (sm->id == g_system->getStretchMode()) {
|
||||||
|
ConfMan.set("stretch_mode", sm->name, _domain);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sm++;
|
||||||
|
}
|
||||||
|
message += "\n";
|
||||||
|
message += _("the stretch mode could not be changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gfxError & OSystem::kTransactionAspectRatioFailed) {
|
if (gfxError & OSystem::kTransactionAspectRatioFailed) {
|
||||||
|
@ -805,6 +858,8 @@ void OptionsDialog::setGraphicSettingsState(bool enabled) {
|
||||||
_gfxPopUp->setEnabled(enabled);
|
_gfxPopUp->setEnabled(enabled);
|
||||||
_renderModePopUpDesc->setEnabled(enabled);
|
_renderModePopUpDesc->setEnabled(enabled);
|
||||||
_renderModePopUp->setEnabled(enabled);
|
_renderModePopUp->setEnabled(enabled);
|
||||||
|
_stretchPopUpDesc->setEnabled(enabled);
|
||||||
|
_stretchPopUp->setEnabled(enabled);
|
||||||
_filteringCheckbox->setEnabled(enabled);
|
_filteringCheckbox->setEnabled(enabled);
|
||||||
#ifndef GUI_ENABLE_KEYSDIALOG
|
#ifndef GUI_ENABLE_KEYSDIALOG
|
||||||
#ifndef GUI_ONLY_FULLSCREEN
|
#ifndef GUI_ONLY_FULLSCREEN
|
||||||
|
@ -1014,6 +1069,18 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr
|
||||||
_renderModePopUp->appendEntry(_c(rm->description, context), rm->id);
|
_renderModePopUp->appendEntry(_c(rm->description, context), rm->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The Stretch mode popup
|
||||||
|
const OSystem::GraphicsMode *sm = g_system->getSupportedStretchModes();
|
||||||
|
_stretchPopUpDesc = new StaticTextWidget(boss, prefix + "grStretchModePopupDesc", _("Stretch mode:"));
|
||||||
|
_stretchPopUp = new PopUpWidget(boss, prefix + "grStretchModePopup");
|
||||||
|
|
||||||
|
_stretchPopUp->appendEntry(_("<default>"));
|
||||||
|
_stretchPopUp->appendEntry("");
|
||||||
|
while (sm->name) {
|
||||||
|
_stretchPopUp->appendEntry(_c(sm->description, context), sm->id);
|
||||||
|
sm++;
|
||||||
|
}
|
||||||
|
|
||||||
// Fullscreen checkbox
|
// Fullscreen checkbox
|
||||||
_fullscreenCheckbox = new CheckboxWidget(boss, prefix + "grFullscreenCheckbox", _("Fullscreen mode"));
|
_fullscreenCheckbox = new CheckboxWidget(boss, prefix + "grFullscreenCheckbox", _("Fullscreen mode"));
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,8 @@ private:
|
||||||
bool _enableGraphicSettings;
|
bool _enableGraphicSettings;
|
||||||
StaticTextWidget *_gfxPopUpDesc;
|
StaticTextWidget *_gfxPopUpDesc;
|
||||||
PopUpWidget *_gfxPopUp;
|
PopUpWidget *_gfxPopUp;
|
||||||
|
StaticTextWidget *_stretchPopUpDesc;
|
||||||
|
PopUpWidget *_stretchPopUp;
|
||||||
CheckboxWidget *_fullscreenCheckbox;
|
CheckboxWidget *_fullscreenCheckbox;
|
||||||
CheckboxWidget *_filteringCheckbox;
|
CheckboxWidget *_filteringCheckbox;
|
||||||
CheckboxWidget *_aspectCheckbox;
|
CheckboxWidget *_aspectCheckbox;
|
||||||
|
|
|
@ -866,6 +866,14 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
|
||||||
"type='PopUp' "
|
"type='PopUp' "
|
||||||
"/>"
|
"/>"
|
||||||
"</layout>"
|
"</layout>"
|
||||||
|
"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'>"
|
||||||
|
"<widget name='grStretchModePopupDesc' "
|
||||||
|
"type='OptionsLabel' "
|
||||||
|
"/>"
|
||||||
|
"<widget name='grStretchModePopup' "
|
||||||
|
"type='PopUp' "
|
||||||
|
"/>"
|
||||||
|
"</layout>"
|
||||||
"<widget name='grAspectCheckbox' "
|
"<widget name='grAspectCheckbox' "
|
||||||
"type='Checkbox' "
|
"type='Checkbox' "
|
||||||
"/>"
|
"/>"
|
||||||
|
@ -2447,6 +2455,14 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
|
||||||
"type='PopUp' "
|
"type='PopUp' "
|
||||||
"/>"
|
"/>"
|
||||||
"</layout>"
|
"</layout>"
|
||||||
|
"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'>"
|
||||||
|
"<widget name='grStretchModePopupDesc' "
|
||||||
|
"type='OptionsLabel' "
|
||||||
|
"/>"
|
||||||
|
"<widget name='grStretchModePopup' "
|
||||||
|
"type='PopUp' "
|
||||||
|
"/>"
|
||||||
|
"</layout>"
|
||||||
"<widget name='grAspectCheckbox' "
|
"<widget name='grAspectCheckbox' "
|
||||||
"type='Checkbox' "
|
"type='Checkbox' "
|
||||||
"/>"
|
"/>"
|
||||||
|
|
Binary file not shown.
|
@ -292,6 +292,14 @@
|
||||||
type = 'PopUp'
|
type = 'PopUp'
|
||||||
/>
|
/>
|
||||||
</layout>
|
</layout>
|
||||||
|
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
|
||||||
|
<widget name = 'grStretchModePopupDesc'
|
||||||
|
type = 'OptionsLabel'
|
||||||
|
/>
|
||||||
|
<widget name = 'grStretchModePopup'
|
||||||
|
type = 'PopUp'
|
||||||
|
/>
|
||||||
|
</layout>
|
||||||
<widget name = 'grAspectCheckbox'
|
<widget name = 'grAspectCheckbox'
|
||||||
type = 'Checkbox'
|
type = 'Checkbox'
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -289,6 +289,14 @@
|
||||||
type = 'PopUp'
|
type = 'PopUp'
|
||||||
/>
|
/>
|
||||||
</layout>
|
</layout>
|
||||||
|
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'>
|
||||||
|
<widget name = 'grStretchModePopupDesc'
|
||||||
|
type = 'OptionsLabel'
|
||||||
|
/>
|
||||||
|
<widget name = 'grStretchModePopup'
|
||||||
|
type = 'PopUp'
|
||||||
|
/>
|
||||||
|
</layout>
|
||||||
<widget name = 'grAspectCheckbox'
|
<widget name = 'grAspectCheckbox'
|
||||||
type = 'Checkbox'
|
type = 'Checkbox'
|
||||||
/>
|
/>
|
||||||
|
|
Binary file not shown.
|
@ -306,6 +306,14 @@
|
||||||
type = 'PopUp'
|
type = 'PopUp'
|
||||||
/>
|
/>
|
||||||
</layout>
|
</layout>
|
||||||
|
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
|
||||||
|
<widget name = 'grStretchModePopupDesc'
|
||||||
|
type = 'OptionsLabel'
|
||||||
|
/>
|
||||||
|
<widget name = 'grStretchModePopup'
|
||||||
|
type = 'PopUp'
|
||||||
|
/>
|
||||||
|
</layout>
|
||||||
<widget name = 'grAspectCheckbox'
|
<widget name = 'grAspectCheckbox'
|
||||||
type = 'Checkbox'
|
type = 'Checkbox'
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -287,6 +287,14 @@
|
||||||
type = 'PopUp'
|
type = 'PopUp'
|
||||||
/>
|
/>
|
||||||
</layout>
|
</layout>
|
||||||
|
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'>
|
||||||
|
<widget name = 'grStretchModePopupDesc'
|
||||||
|
type = 'OptionsLabel'
|
||||||
|
/>
|
||||||
|
<widget name = 'grStretchModePopup'
|
||||||
|
type = 'PopUp'
|
||||||
|
/>
|
||||||
|
</layout>
|
||||||
<widget name = 'grAspectCheckbox'
|
<widget name = 'grAspectCheckbox'
|
||||||
type = 'Checkbox'
|
type = 'Checkbox'
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue