[Scummvm-git-logs] scummvm master -> 67a57e945d4d8109a8626937fc6c423b6fb0a1cd

sev- noreply at scummvm.org
Sun Dec 25 15:26:30 UTC 2022


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

Summary:
9728584687 GUI: Automatically extend the width of single column pop-up dialogs
67a57e945d GUI: Improve support for group selection in the launcher on small screens


Commit: 9728584687c02bee40a7744294fa0b4ed90124de
    https://github.com/scummvm/scummvm/commit/9728584687c02bee40a7744294fa0b4ed90124de
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2022-12-25T16:26:26+01:00

Commit Message:
GUI: Automatically extend the width of single column pop-up dialogs

Changed paths:
    gui/widgets/popup.cpp


diff --git a/gui/widgets/popup.cpp b/gui/widgets/popup.cpp
index e8bb10b91ef..54c4d2d7e8e 100644
--- a/gui/widgets/popup.cpp
+++ b/gui/widgets/popup.cpp
@@ -58,6 +58,15 @@ void PopUpDialog::open() {
 
 	// Calculate real popup dimensions
 	_h = _entries.size() * _lineHeight + 2;
+	_w = 0;
+
+	for (uint i = 0; i < _entries.size(); i++) {
+		int width = g_gui.getStringWidth(_entries[i]);
+
+		if (width > _w)
+			_w = width;
+	}
+
 
 	_entriesPerColumn = 1;
 
@@ -65,14 +74,13 @@ void PopUpDialog::open() {
 	// FIXME - OSystem should send out notification messages when the screen
 	// resolution changes... we could generalize CommandReceiver and CommandSender.
 
+	const int screenW = g_system->getOverlayWidth();
 	const int screenH = g_system->getOverlayHeight();
 
 	// HACK: For now, we do not do scrolling. Instead, we draw the dialog
 	// in two columns if it's too tall.
 
 	if (_h >= screenH) {
-		const int screenW = g_system->getOverlayWidth();
-
 		_twoColumns = true;
 		_entriesPerColumn = _entries.size() / 2;
 
@@ -80,15 +88,6 @@ void PopUpDialog::open() {
 			_entriesPerColumn++;
 
 		_h = _entriesPerColumn * _lineHeight + 2;
-		_w = 0;
-
-		for (uint i = 0; i < _entries.size(); i++) {
-			int width = g_gui.getStringWidth(_entries[i]);
-
-			if (width > _w)
-				_w = width;
-		}
-
 		_w = 2 * _w + 10;
 
 		if (!(_w & 1))
@@ -99,15 +98,19 @@ void PopUpDialog::open() {
 			_y = _boss->getAbsY() - (_selection - _entriesPerColumn) * _lineHeight;
 		}
 
-		if (_w >= screenW)
-			_w = screenW - 1;
-		if (_x < 0)
-			_x = 0;
-		if (_x + _w >= screenW)
-			_x = screenW - 1 - _w;
-	} else
+	} else {
 		_twoColumns = false;
 
+		_w = MAX<uint16>(_boss->getWidth(), _w + 20);
+	}
+
+	if (_w >= screenW)
+		_w = screenW - 1;
+	if (_x < 0)
+		_x = 0;
+	if (_x + _w >= screenW)
+		_x = screenW - 1 - _w;
+
 	if (_h >= screenH)
 		_h = screenH - 1;
 	if (_y < 0)
@@ -413,7 +416,7 @@ void PopUpDialog::drawMenuEntry(int entry, bool hilite) {
 		g_gui.theme()->drawText(
 			r2,
 			name, hilite ? ThemeEngine::kStateHighlight : ThemeEngine::kStateEnabled,
-			alignment, ThemeEngine::kTextInversionNone, pad
+			alignment, ThemeEngine::kTextInversionNone, pad, false
 		);
 	}
 }


Commit: 67a57e945d4d8109a8626937fc6c423b6fb0a1cd
    https://github.com/scummvm/scummvm/commit/67a57e945d4d8109a8626937fc6c423b6fb0a1cd
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2022-12-25T16:26:26+01:00

Commit Message:
GUI: Improve support for group selection in the launcher on small screens

Changed paths:
    gui/launcher.cpp
    gui/launcher.h
    gui/themes/common/lowres_layout.stx
    gui/themes/default.inc
    gui/themes/residualvm.zip
    gui/themes/scummclassic.zip
    gui/themes/scummclassic/classic_layout_lowres.stx
    gui/themes/scummmodern.zip
    gui/themes/scummremastered.zip


diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index c7a6b951398..9f06cd9942c 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -96,20 +96,20 @@ enum {
 
 const GroupingMode groupingModes[] = {
 	// I18N: Group name for the game list
-	{"none",     _sc("None", "group"),      kGroupByNone},
+	{"none",     _sc("None", "group"),         nullptr,                 kGroupByNone},
 	// I18N: Group name for the game list, grouped by the first letter of the game title
-	{"initial",  _sc("First letter", "group"), kGroupByFirstLetter},
+	{"initial",  _sc("First letter", "group"), _sc("Initial", "group"), kGroupByFirstLetter},
 	// I18N: Group name for the game list, grouped by game engine
-	{"engine",   _sc("Engine", "group"),    kGroupByEngine},
+	{"engine",   _sc("Engine", "group"),       nullptr,                 kGroupByEngine},
 	// I18N: Group name for the game list, grouped by game series
-	{"series",   _sc("Series", "group"),    kGroupBySeries},
+	{"series",   _sc("Series", "group"),       nullptr,                 kGroupBySeries},
 	// I18N: Group name for the game list, grouped by game publisher
-	{"company",  _sc("Publisher", "group"), kGroupByCompany},
+	{"company",  _sc("Publisher", "group"),    nullptr,                 kGroupByCompany},
 	// I18N: Group name for the game list, grouped by language
-	{"language", _sc("Language", "group"),  kGroupByLanguage},
+	{"language", _sc("Language", "group"),     nullptr,                 kGroupByLanguage},
 	// I18N: Group name for the game list, grouped by game platform
-	{"platform", _sc("Platform", "group"),  kGroupByPlatform},
-	{nullptr, nullptr, kGroupByNone}
+	{"platform", _sc("Platform", "group"),     nullptr,                 kGroupByPlatform},
+	{nullptr, nullptr, nullptr, kGroupByNone}
 };
 
 #pragma mark -
@@ -206,9 +206,6 @@ LauncherDialog::~LauncherDialog() {
 }
 
 void LauncherDialog::build() {
-#ifndef DISABLE_FANCY_THEMES
-	_logo = nullptr;
-
 #ifndef DISABLE_FANCY_THEMES
 	if (g_gui.xmlEval()->getVar("Globals.ShowSearchPic") == 1 && g_gui.theme()->supportsImages()) {
 		_grpChooserDesc = nullptr;
@@ -217,18 +214,26 @@ void LauncherDialog::build() {
 		_groupPic->useThemeTransparency(true);
 	} else
 #endif
-		_grpChooserDesc = new StaticTextWidget(this, Common::String(_title + ".laGroupPopupDesc"), Common::U32String(_("Group by: ")));
+		_grpChooserDesc = new StaticTextWidget(this, Common::String(_title + ".laGroupPopupDesc"), _("Group:"));
 
-	_grpChooserPopup = new PopUpWidget(this, Common::String(_title + ".laGroupPopup"), Common::U32String(_("Select a criteria to group the entries")), kSetGroupMethodCmd);
+	_grpChooserPopup = new PopUpWidget(this, Common::String(_title + ".laGroupPopup"), _("Select a criteria to group the entries"), kSetGroupMethodCmd);
 	Common::String grouping = ConfMan.get("grouping");
 	const GroupingMode *mode = groupingModes;
 	while (mode->name) {
-		_grpChooserPopup->appendEntry(_c(mode->description, "group"), mode->id);
+		if (mode->lowresDescription && g_system->getOverlayWidth() <= 320) {
+			_grpChooserPopup->appendEntry(_c(mode->lowresDescription, "group"), mode->id);
+		} else {
+			_grpChooserPopup->appendEntry(_c(mode->description, "group"), mode->id);
+		}
 		if (grouping == mode->name)
 			_groupBy = mode->id;
 		++mode;
 	}
 	_grpChooserPopup->setSelected(_groupBy);
+
+#ifndef DISABLE_FANCY_THEMES
+	_logo = nullptr;
+
 	if (g_gui.xmlEval()->getVar("Globals.ShowLauncherLogo") == 1 && g_gui.theme()->supportsImages()) {
 		_logo = new GraphicsWidget(this, _title + ".Logo");
 		_logo->useThemeTransparency(true);
@@ -236,11 +241,9 @@ void LauncherDialog::build() {
 
 		new StaticTextWidget(this, _title + ".Version", Common::U32String(gScummVMVersionDate));
 	} else
-		new StaticTextWidget(this, _title + ".Version", Common::U32String(gScummVMFullVersion));
-#else
-	// Show ScummVM version
-	new StaticTextWidget(this, _title + ".Version", Common::U32String(gScummVMFullVersion));
 #endif
+		new StaticTextWidget(this, _title + ".Version", Common::U32String(gScummVMFullVersion));
+
 	if (!g_system->hasFeature(OSystem::kFeatureNoQuit))
 		new ButtonWidget(this, _title + ".QuitButton", _("~Q~uit"), _("Quit ScummVM"), kQuitCmd);
 
@@ -793,7 +796,7 @@ void LauncherDialog::reflowLayout() {
 		}
 
 		if (!_grpChooserDesc)
-			_grpChooserDesc = new StaticTextWidget(this, _title + ".SearchDesc", _("Group by:"));
+			_grpChooserDesc = new StaticTextWidget(this, _title + ".SearchDesc", _("Group:"));
 
 		if (_groupPic) {
 			removeWidget(_groupPic);
diff --git a/gui/launcher.h b/gui/launcher.h
index df08cf33890..6fdc45fa241 100644
--- a/gui/launcher.h
+++ b/gui/launcher.h
@@ -62,6 +62,11 @@ struct GroupingMode {
 	 */
 	const char *description;
 
+	/**
+	 * A short human-readable description for the mode.
+	 */
+	const char *lowresDescription;
+
 	/**
 	 * ID of he mode.
 	 */
diff --git a/gui/themes/common/lowres_layout.stx b/gui/themes/common/lowres_layout.stx
index 8f121d1c861..972c2ccf85e 100644
--- a/gui/themes/common/lowres_layout.stx
+++ b/gui/themes/common/lowres_layout.stx
@@ -145,30 +145,30 @@
 					height = 'Globals.Line.Height'
 					textalign = 'center'
 			/>
-			<layout type = 'horizontal' spacing = '5' padding = '0, 0, 2, 2'>
+			<layout type = 'horizontal' spacing = '2' padding = '0, 0, 0, 0'>
 				<widget name = 'SearchDesc'
-						width = '50'
+						width = '45'
 						height = 'Globals.Line.Height'
 						textalign = 'end'
 				/>
 				<widget name = 'Search'
-						width = '150'
 						height = 'Globals.Line.Height'
 				/>
 				<widget name = 'SearchClearButton'
 						height = 'Globals.Line.Height'
 						width = 'Globals.Line.Height'
 				/>
+				<space size = '2' />
 				<widget name = 'laGroupPopupDesc'
-						type = 'OptionsLabel'
+						width = '40'
 						height = 'Globals.Line.Height'
 						textalign = 'end'
 				/>
 				<widget name = 'laGroupPopup'
-						width = '150'
+						width = '80'
 						type = 'PopUp'
 				/>
-				<space />
+				<space size = '2' />
 				<widget name = 'ListSwitch'
 						height = 'Globals.Button.Height'
 						width = 'Globals.Button.Height'
@@ -215,30 +215,30 @@
 					height = 'Globals.Line.Height'
 					textalign = 'center'
 			/>
-			<layout type = 'horizontal' spacing = '5' padding = '0, 0, 2, 2'>
+			<layout type = 'horizontal' spacing = '2' padding = '0, 0, 0, 0'>
 				<widget name = 'SearchDesc'
-						width = '50'
+						width = '45'
 						height = 'Globals.Line.Height'
 						textalign = 'end'
 				/>
 				<widget name = 'Search'
-						width = '150'
 						height = 'Globals.Line.Height'
 				/>
 				<widget name = 'SearchClearButton'
 						height = 'Globals.Line.Height'
 						width = 'Globals.Line.Height'
 				/>
+				<space size = '2' />
 				<widget name = 'laGroupPopupDesc'
-						type = 'OptionsLabel'
+						width = '40'
 						height = 'Globals.Line.Height'
 						textalign = 'end'
 				/>
 				<widget name = 'laGroupPopup'
-						width = '150'
+						width = '80'
 						type = 'PopUp'
 				/>
-				<space />
+				<space size = '2' />
 				<widget name = 'ListSwitch'
 						height = 'Globals.Button.Height'
 						width = 'Globals.Button.Height'
diff --git a/gui/themes/default.inc b/gui/themes/default.inc
index 7905798b0c4..f1f651f4ebb 100644
--- a/gui/themes/default.inc
+++ b/gui/themes/default.inc
@@ -3449,30 +3449,38 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "height='Globals.Line.Height' "
 "textalign='center' "
 "/>"
-"<layout type='horizontal' spacing='5' padding='0,0,0,0'>"
+"<layout type='horizontal' spacing='2' padding='0,0,0,0'>"
 "<widget name='SearchDesc' "
-"width='50' "
+"width='45' "
 "height='Globals.Line.Height' "
 "textalign='end' "
 "/>"
 "<widget name='Search' "
-"width='150' "
 "height='Globals.Line.Height' "
 "/>"
 "<widget name='SearchClearButton' "
 "height='Globals.Line.Height' "
 "width='Globals.Line.Height' "
 "/>"
+"<space size='2' />"
 "<widget name='laGroupPopupDesc' "
-"type='OptionsLabel' "
+"width='40' "
 "height='Globals.Line.Height' "
 "textalign='end' "
 "/>"
 "<widget name='laGroupPopup' "
-"width='150' "
+"width='80' "
 "type='PopUp' "
 "/>"
-"<space />"
+"<space size='2' />"
+"<widget name='ListSwitch' "
+"height='Globals.Button.Height' "
+"width='Globals.Button.Height' "
+"/>"
+"<widget name='GridSwitch' "
+"height='Globals.Button.Height' "
+"width='Globals.Button.Height' "
+"/>"
 "</layout>"
 "<widget name='GameList'/>"
 "<layout type='horizontal' padding='0,0,0,0' spacing='8'>"
diff --git a/gui/themes/residualvm.zip b/gui/themes/residualvm.zip
index 23ac149d4e1..bc706b8be97 100644
Binary files a/gui/themes/residualvm.zip and b/gui/themes/residualvm.zip differ
diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index 8ff0c7a8956..2bdbf1953be 100644
Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ
diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx
index 6a9627c4a55..5bd8d2ea5bb 100644
--- a/gui/themes/scummclassic/classic_layout_lowres.stx
+++ b/gui/themes/scummclassic/classic_layout_lowres.stx
@@ -139,30 +139,38 @@
 					height = 'Globals.Line.Height'
 					textalign = 'center'
 			/>
-			<layout type = 'horizontal' spacing = '5' padding = '0, 0, 0, 0'>
+			<layout type = 'horizontal' spacing = '2' padding = '0, 0, 0, 0'>
 				<widget name = 'SearchDesc'
-						width = '50'
+						width = '45'
 						height = 'Globals.Line.Height'
 						textalign = 'end'
 				/>
 				<widget name = 'Search'
-						width = '150'
 						height = 'Globals.Line.Height'
 				/>
 				<widget name = 'SearchClearButton'
 						height = 'Globals.Line.Height'
 						width = 'Globals.Line.Height'
 				/>
+				<space size = '2' />
 				<widget name = 'laGroupPopupDesc'
-						type = 'OptionsLabel'
+						width = '40'
 						height = 'Globals.Line.Height'
 						textalign = 'end'
 				/>
 				<widget name = 'laGroupPopup'
-						width = '150'
+						width = '80'
 						type = 'PopUp'
 				/>
-				<space />
+				<space size = '2' />
+				<widget name = 'ListSwitch'
+						height = 'Globals.Button.Height'
+						width = 'Globals.Button.Height'
+				/>
+				<widget name = 'GridSwitch'
+						height = 'Globals.Button.Height'
+						width = 'Globals.Button.Height'
+				/>
 			</layout>
 			<widget name = 'GameList'/>
 			<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '8'>
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index ef7023cab1c..75a54b7f422 100644
Binary files a/gui/themes/scummmodern.zip and b/gui/themes/scummmodern.zip differ
diff --git a/gui/themes/scummremastered.zip b/gui/themes/scummremastered.zip
index 65be13ef047..409364392e6 100644
Binary files a/gui/themes/scummremastered.zip and b/gui/themes/scummremastered.zip differ




More information about the Scummvm-git-logs mailing list