[Scummvm-git-logs] scummvm branch-2-8 -> cf0c08b61431821ff6c7560806ba2ba7bcebd57b

sev- noreply at scummvm.org
Sat Jan 20 19:57:45 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
cf0c08b614 GUI: Allow manual setting of custom GUI scale values


Commit: cf0c08b61431821ff6c7560806ba2ba7bcebd57b
    https://github.com/scummvm/scummvm/commit/cf0c08b61431821ff6c7560806ba2ba7bcebd57b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-01-20T20:57:24+01:00

Commit Message:
GUI: Allow manual setting of custom GUI scale values

We keep this value and do not override it

Changed paths:
    gui/options.cpp


diff --git a/gui/options.cpp b/gui/options.cpp
index 8072c09bad0..64d5a5326a2 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -2383,13 +2383,22 @@ void GlobalOptionsDialog::build() {
 #endif
 
 	// Misc Tab
-	_guiBasePopUp->setSelected(2);
+	bool seenValue = false;
 	int value = ConfMan.getInt("gui_scale");
+
+	if (!value)
+		value = 100; // Setting default sane value
+
 	for (int i = 0; guiBaseLabels[i]; i++) {
-		if (value == guiBaseValues[i])
+		if (value == guiBaseValues[i]) {
+			seenValue = true;
 			_guiBasePopUp->setSelected(i);
+		}
 	}
 
+	if (!seenValue)
+		_guiBasePopUp->setSelected(ARRAYSIZE(guiBaseLabels) - 1);
+
 	_autosavePeriodPopUp->setSelected(1);
 	value = ConfMan.getInt("autosave_period");
 	for (int i = 0; savePeriodLabels[i]; i++) {
@@ -2538,10 +2547,24 @@ void GlobalOptionsDialog::addGUIControls(GuiObject *boss, const Common::String &
 	_guiBasePopUpDesc = new StaticTextWidget(boss, prefix + "GUIBasePopupDesc", _("GUI scale:"));
 	_guiBasePopUp = new PopUpWidget(boss, prefix + "GUIBasePopup");
 
+	bool seenValue = false;
+	int oldGuiScale = ConfMan.getInt("gui_scale");
+
+	if (!oldGuiScale)
+		oldGuiScale = 100; // Setting default sane value
+
 	for (int i = 0; guiBaseLabels[i]; i++) {
+		if (guiBaseValues[i] == oldGuiScale)
+			seenValue = true;
+
 		_guiBasePopUp->appendEntry(_(guiBaseLabels[i]), guiBaseValues[i]);
 	}
 
+	if (!seenValue) {
+		Common::U32String customText = Common::U32String::format(_("%d%% - Custom"), oldGuiScale);
+		_guiBasePopUp->appendEntry(customText, oldGuiScale);
+	}
+
 	_rendererPopUpDesc = new StaticTextWidget(boss, prefix + "RendererPopupDesc", _("GUI renderer:"));
 	_rendererPopUp = new PopUpWidget(boss, prefix + "RendererPopup");
 




More information about the Scummvm-git-logs mailing list