aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Crozat2018-07-01 23:57:00 +0100
committerThierry Crozat2018-07-08 16:54:51 +0100
commit89f1b1c96eaa8cbb4f4938bd6524cab6c15227c1 (patch)
treed3fb95fd998ec656b4493fc2d685045881a5f979
parentadacb4fcfd743aa3980b3e08c62578f32de2d0b3 (diff)
downloadscummvm-rg350-89f1b1c96eaa8cbb4f4938bd6524cab6c15227c1.tar.gz
scummvm-rg350-89f1b1c96eaa8cbb4f4938bd6524cab6c15227c1.tar.bz2
scummvm-rg350-89f1b1c96eaa8cbb4f4938bd6524cab6c15227c1.zip
GUI: Add Stretch Mode selection in Options dialog
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.cpp1
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp1
-rw-r--r--common/system.h5
-rw-r--r--engines/engine.cpp9
-rw-r--r--gui/options.cpp69
-rw-r--r--gui/options.h2
-rw-r--r--gui/themes/default.inc16
-rw-r--r--gui/themes/scummclassic.zipbin129144 -> 129635 bytes
-rw-r--r--gui/themes/scummclassic/classic_layout.stx8
-rw-r--r--gui/themes/scummclassic/classic_layout_lowres.stx8
-rw-r--r--gui/themes/scummmodern.zipbin1648684 -> 1649175 bytes
-rw-r--r--gui/themes/scummmodern/scummmodern_layout.stx8
-rw-r--r--gui/themes/scummmodern/scummmodern_layout_lowres.stx8
13 files changed, 134 insertions, 1 deletions
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 8dcc5582a9..ef3b25e98c 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -218,6 +218,7 @@ void OpenGLSdlGraphicsManager::deactivateManager() {
bool OpenGLSdlGraphicsManager::hasFeature(OSystem::Feature f) const {
switch (f) {
case OSystem::kFeatureFullscreenMode:
+ case OSystem::kFeatureStretchMode:
case OSystem::kFeatureIconifyWindow:
return true;
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 654dbd7c97..1ca89022ac 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -256,6 +256,7 @@ bool SurfaceSdlGraphicsManager::hasFeature(OSystem::Feature f) const {
(f == OSystem::kFeatureAspectRatioCorrection) ||
#if SDL_VERSION_ATLEAST(2, 0, 0)
(f == OSystem::kFeatureFilteringMode) ||
+ (f == OSystem::kFeatureStretchMode) ||
#endif
(f == OSystem::kFeatureCursorPalette) ||
(f == OSystem::kFeatureIconifyWindow);
diff --git a/common/system.h b/common/system.h
index 158e75c643..7caf73a8a2 100644
--- a/common/system.h
+++ b/common/system.h
@@ -263,6 +263,11 @@ public:
kFeatureFilteringMode,
/**
+ * Indicate if stretch modes are supported by the backend.
+ */
+ kFeatureStretchMode,
+
+ /**
* Determine whether a virtual keyboard is too be shown or not.
* This would mostly be implemented by backends for hand held devices,
* like PocketPC, Palms, Symbian phones like the P800, Zaurus, etc.
diff --git a/engines/engine.cpp b/engines/engine.cpp
index 99f2713b7f..77ca54ffbb 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -329,6 +329,15 @@ void initGraphics(int width, int height, const Graphics::PixelFormat *format) {
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) {
GUI::MessageDialog dialog(_("Could not apply aspect ratio setting."));
dialog.runModal();
diff --git a/gui/options.cpp b/gui/options.cpp
index 6083a2ccbf..bee161e2c9 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -154,6 +154,8 @@ void OptionsDialog::init() {
_gfxPopUpDesc = 0;
_renderModePopUp = 0;
_renderModePopUpDesc = 0;
+ _stretchPopUp = 0;
+ _stretchPopUpDesc = 0;
_fullscreenCheckbox = 0;
_filteringCheckbox = 0;
_aspectCheckbox = 0;
@@ -285,6 +287,25 @@ 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);
+ }
+
#ifdef GUI_ONLY_FULLSCREEN
_fullscreenCheckbox->setState(true);
_fullscreenCheckbox->setEnabled(false);
@@ -470,6 +491,23 @@ void OptionsDialog::apply() {
if ((int32)_renderModePopUp->getSelectedTag() >= 0)
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 {
ConfMan.removeKey("fullscreen", _domain);
ConfMan.removeKey("filtering", _domain);
@@ -484,6 +522,8 @@ void OptionsDialog::apply() {
g_system->beginGFXTransaction();
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"))
g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio", _domain));
if (ConfMan.hasKey("fullscreen"))
@@ -519,7 +559,20 @@ void OptionsDialog::apply() {
gm++;
}
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) {
@@ -805,6 +858,8 @@ void OptionsDialog::setGraphicSettingsState(bool enabled) {
_gfxPopUp->setEnabled(enabled);
_renderModePopUpDesc->setEnabled(enabled);
_renderModePopUp->setEnabled(enabled);
+ _stretchPopUpDesc->setEnabled(enabled);
+ _stretchPopUp->setEnabled(enabled);
_filteringCheckbox->setEnabled(enabled);
#ifndef GUI_ENABLE_KEYSDIALOG
#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);
}
+ // 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
_fullscreenCheckbox = new CheckboxWidget(boss, prefix + "grFullscreenCheckbox", _("Fullscreen mode"));
diff --git a/gui/options.h b/gui/options.h
index bc58d7a63e..a2dec898dd 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -138,6 +138,8 @@ private:
bool _enableGraphicSettings;
StaticTextWidget *_gfxPopUpDesc;
PopUpWidget *_gfxPopUp;
+ StaticTextWidget *_stretchPopUpDesc;
+ PopUpWidget *_stretchPopUp;
CheckboxWidget *_fullscreenCheckbox;
CheckboxWidget *_filteringCheckbox;
CheckboxWidget *_aspectCheckbox;
diff --git a/gui/themes/default.inc b/gui/themes/default.inc
index fe48acd1a0..098c8734cc 100644
--- a/gui/themes/default.inc
+++ b/gui/themes/default.inc
@@ -866,6 +866,14 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"type='PopUp' "
"/>"
"</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' "
"type='Checkbox' "
"/>"
@@ -2447,6 +2455,14 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"type='PopUp' "
"/>"
"</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' "
"type='Checkbox' "
"/>"
diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index 4f7e3ce68d..8b5b52fbfb 100644
--- a/gui/themes/scummclassic.zip
+++ b/gui/themes/scummclassic.zip
Binary files differ
diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx
index e3411dcb3e..23f8acaa26 100644
--- a/gui/themes/scummclassic/classic_layout.stx
+++ b/gui/themes/scummclassic/classic_layout.stx
@@ -292,6 +292,14 @@
type = 'PopUp'
/>
</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'
type = 'Checkbox'
/>
diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx
index 4b710b8999..ae3a6eefe3 100644
--- a/gui/themes/scummclassic/classic_layout_lowres.stx
+++ b/gui/themes/scummclassic/classic_layout_lowres.stx
@@ -289,6 +289,14 @@
type = 'PopUp'
/>
</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'
type = 'Checkbox'
/>
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index fae746b72c..de7c587e6a 100644
--- a/gui/themes/scummmodern.zip
+++ b/gui/themes/scummmodern.zip
Binary files differ
diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx
index 34b66e2274..5cf22f90b4 100644
--- a/gui/themes/scummmodern/scummmodern_layout.stx
+++ b/gui/themes/scummmodern/scummmodern_layout.stx
@@ -306,6 +306,14 @@
type = 'PopUp'
/>
</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'
type = 'Checkbox'
/>
diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
index 506a97520e..651efb4a48 100644
--- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx
+++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
@@ -287,6 +287,14 @@
type = 'PopUp'
/>
</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'
type = 'Checkbox'
/>