[Scummvm-git-logs] scummvm branch-2-6 -> 4881b8fdec6782584f8a5a26add8d0982f8fb58f
criezy
noreply at scummvm.org
Sun Jun 12 21:19:36 UTC 2022
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:
4881b8fdec GUI: Add slider for Grid Launcher icon size
Commit: 4881b8fdec6782584f8a5a26add8d0982f8fb58f
https://github.com/scummvm/scummvm/commit/4881b8fdec6782584f8a5a26add8d0982f8fb58f
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-06-12T22:15:18+01:00
Commit Message:
GUI: Add slider for Grid Launcher icon size
Changed paths:
base/commandLine.cpp
gui/ThemeEngine.h
gui/launcher.cpp
gui/themes/common/highres_layout.stx
gui/themes/common/lowres_layout.stx
gui/themes/residualvm.zip
gui/themes/residualvm/THEMERC
gui/themes/scummclassic.zip
gui/themes/scummclassic/THEMERC
gui/themes/scummmodern.zip
gui/themes/scummmodern/THEMERC
gui/themes/scummremastered.zip
gui/themes/scummremastered/THEMERC
gui/widgets/grid.cpp
gui/widgets/grid.h
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 8bff9e3642d..8297b4f3202 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -350,6 +350,7 @@ void registerDefaults() {
ConfMan.registerDefault("gui_browser_native", true);
ConfMan.registerDefault("gui_return_to_launcher_at_exit", false);
ConfMan.registerDefault("gui_launcher_chooser", "list");
+ ConfMan.registerDefault("grid_items_per_row", 4);
// Specify threshold for scanning directories in the launcher
// If number of game entries in scummvm.ini exceeds the specified
// number, then skip scanning. -1 = scan always
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 9f1ca7ceb04..0c0b5fdaa95 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -36,7 +36,7 @@
#include "graphics/pixelformat.h"
-#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.9.4"
+#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.9.5"
class OSystem;
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 68971ab7862..5b3b0231772 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -929,7 +929,9 @@ protected:
int getSelected() override;
void build() override;
private:
- GridWidget *_grid;
+ GridWidget *_grid;
+ SliderWidget *_gridItemSizeSlider;
+ StaticTextWidget *_gridItemSizeLabel;
};
#endif // !DISABLE_LAUNCHERDISPLAY_GRID
@@ -1303,7 +1305,7 @@ void LauncherSimple::updateButtons() {
#ifndef DISABLE_LAUNCHERDISPLAY_GRID
LauncherGrid::LauncherGrid(const Common::String &title, LauncherChooser *chooser)
: LauncherDialog(title, chooser),
- _grid(nullptr) {
+ _grid(nullptr), _gridItemSizeSlider(nullptr), _gridItemSizeLabel(nullptr) {
build();
}
@@ -1468,6 +1470,13 @@ void LauncherGrid::handleCommand(CommandSender *sender, uint32 cmd, uint32 data)
}
break;
}
+ case kItemSizeCmd:
+ _gridItemSizeLabel->setValue(_gridItemSizeSlider->getValue());
+ _gridItemSizeLabel->markAsDirty();
+ ConfMan.setInt("grid_items_per_row", _gridItemSizeSlider->getValue());
+ ConfMan.flushToDisk();
+ reflowLayout();
+ break;
default:
LauncherDialog::handleCommand(sender, cmd, data);
}
@@ -1584,6 +1593,14 @@ int LauncherGrid::getSelected() { return _grid->getSelected(); }
void LauncherGrid::build() {
LauncherDialog::build();
+ new StaticTextWidget(this, "LauncherGrid.GridItemsPerRowDesc", _("Icons per row:"));
+ _gridItemSizeSlider = new SliderWidget(this, "LauncherGrid.GridItemsPerRow", Common::U32String(), kItemSizeCmd);
+ _gridItemSizeSlider->setMinValue(1);
+ _gridItemSizeSlider->setMaxValue(12);
+ _gridItemSizeSlider->setValue(ConfMan.getInt("grid_items_per_row"));
+ _gridItemSizeLabel = new StaticTextWidget(this, "LauncherGrid.GridItemsPerRowLabel", Common::U32String(" "), Common::U32String(), ThemeEngine::kFontStyleBold, Common::UNK_LANG, false);
+ _gridItemSizeLabel->setValue(ConfMan.getInt("grid_items_per_row"));
+
// Add list with game titles
_grid = new GridWidget(this, "LauncherGrid.IconArea");
// Populate the list
diff --git a/gui/themes/common/highres_layout.stx b/gui/themes/common/highres_layout.stx
index 2dc82752fd5..a248caae5ab 100644
--- a/gui/themes/common/highres_layout.stx
+++ b/gui/themes/common/highres_layout.stx
@@ -69,22 +69,10 @@
<def var = 'Radiobutton.Spacing' value = '15' scalable = 'yes'/>
<def var = 'GridSupported' value = '1'/>
- <def var = 'GridItemThumbnail.Width' value = '192' scalable = 'no' resolution = 'x>640' />
- <def var = 'GridItemThumbnail.Height' value = '192' scalable = 'no' resolution = 'x>640' />
- <def var = 'Grid.FlagIcon.Width' value = '50' scalable = 'no' resolution = 'x>640' />
- <def var = 'Grid.FlagIcon.Height' value = '25' scalable = 'no' resolution = 'x>640' />
- <def var = 'Grid.PlatformIcon.Width' value = '32' scalable = 'no' resolution = 'x>640' />
- <def var = 'Grid.PlatformIcon.Height' value = '32' scalable = 'no' resolution = 'x>640' />
<def var = 'Grid.XSpacing' value = '40' scalable = 'no' resolution = 'x>640' />
<def var = 'Grid.YSpacing' value = '30' scalable = 'no' resolution = 'x>640' />
<def var = 'Grid.ShowTitles' value = '1' scalable = 'no' resolution = 'x>640' />
- <def var = 'GridItemThumbnail.Width' value = '96' scalable = 'no' resolution = 'x<641' />
- <def var = 'GridItemThumbnail.Height' value = '96' scalable = 'no' resolution = 'x<641' />
- <def var = 'Grid.FlagIcon.Width' value = '25' scalable = 'no' resolution = 'x<641' />
- <def var = 'Grid.FlagIcon.Height' value = '12' scalable = 'no' resolution = 'x<641' />
- <def var = 'Grid.PlatformIcon.Width' value = '16' scalable = 'no' resolution = 'x<641' />
- <def var = 'Grid.PlatformIcon.Height' value = '16' scalable = 'no' resolution = 'x<641' />
<def var = 'Grid.XSpacing' value = '20' scalable = 'no' resolution = 'x<641' />
<def var = 'Grid.YSpacing' value = '15' scalable = 'no' resolution = 'x<641' />
<def var = 'Grid.ShowTitles' value = '1' scalable = 'no' resolution = 'x<641' />
@@ -321,6 +309,16 @@
height = 'Globals.Button.Height'
width = 'Globals.Button.Height'
/>
+ <widget name = 'GridItemsPerRowDesc'
+ type = 'OptionsLabel'
+ />
+ <widget name = 'GridItemsPerRow'
+ type = 'Slider'
+ rtl = 'no'
+ />
+ <widget name = 'GridItemsPerRowLabel'
+ type = 'SmallLabel'
+ />
<space />
</layout>
</layout>
diff --git a/gui/themes/common/lowres_layout.stx b/gui/themes/common/lowres_layout.stx
index dcbeb1a13ad..30ef493da46 100644
--- a/gui/themes/common/lowres_layout.stx
+++ b/gui/themes/common/lowres_layout.stx
@@ -62,12 +62,6 @@
<def var = 'Radiobutton.Spacing' value = '5' scalable = 'yes'/>
<def var = 'GridSupported' value = '0'/>
- <def var = 'GridItemThumbnail.Width' value = '128' scalable = 'no'/>
- <def var = 'GridItemThumbnail.Height' value = '128' scalable = 'no'/>
- <def var = 'Grid.FlagIcon.Width' value = '30' scalable = 'no'/>
- <def var = 'Grid.FlagIcon.Height' value = '15' scalable = 'no'/>
- <def var = 'Grid.PlatformIcon.Width' value = '24' scalable = 'no'/>
- <def var = 'Grid.PlatformIcon.Height' value = '24' scalable = 'no'/>
<def var = 'Grid.XSpacing' value = '20' scalable = 'no'/>
<def var = 'Grid.YSpacing' value = '10' scalable = 'no'/>
<def var = 'Grid.ShowTitles' value = '0' scalable = 'no'/>
@@ -253,6 +247,15 @@
height = 'Globals.Button.Height'
width = 'Globals.Button.Height'
/>
+ <widget name = 'GridItemsPerRowDesc'
+ type = 'OptionsLabel'
+ />
+ <widget name = 'GridItemsPerRow'
+ type = 'Slider'
+ />
+ <widget name = 'GridItemsPerRowLabel'
+ type = 'SmallLabel'
+ />
</layout>
<widget name = 'GameList'/>
<widget name = 'IconArea'/>
diff --git a/gui/themes/residualvm.zip b/gui/themes/residualvm.zip
index 3a8b6ba96ca..235ca3ebd03 100644
Binary files a/gui/themes/residualvm.zip and b/gui/themes/residualvm.zip differ
diff --git a/gui/themes/residualvm/THEMERC b/gui/themes/residualvm/THEMERC
index 3842eefb196..9c388365431 100644
--- a/gui/themes/residualvm/THEMERC
+++ b/gui/themes/residualvm/THEMERC
@@ -1,3 +1,3 @@
-[SCUMMVM_STX0.9.4:ResidualVM Modern Theme Remastered:No Author]
+[SCUMMVM_STX0.9.5:ResidualVM Modern Theme Remastered:No Author]
%using ../common
%using ../common-svg
diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index 80929ba7d56..5b7b1a36847 100644
Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ
diff --git a/gui/themes/scummclassic/THEMERC b/gui/themes/scummclassic/THEMERC
index c545cbc4104..b7aea1159d2 100644
--- a/gui/themes/scummclassic/THEMERC
+++ b/gui/themes/scummclassic/THEMERC
@@ -1 +1 @@
-[SCUMMVM_STX0.9.4:ScummVM Classic Theme:No Author]
+[SCUMMVM_STX0.9.5:ScummVM Classic Theme:No Author]
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index 3ecde3259ff..25dc08628c0 100644
Binary files a/gui/themes/scummmodern.zip and b/gui/themes/scummmodern.zip differ
diff --git a/gui/themes/scummmodern/THEMERC b/gui/themes/scummmodern/THEMERC
index 7e0e3c44c23..416407635ea 100644
--- a/gui/themes/scummmodern/THEMERC
+++ b/gui/themes/scummmodern/THEMERC
@@ -1,2 +1,2 @@
-[SCUMMVM_STX0.9.4:ScummVM Modern Theme:No Author]
+[SCUMMVM_STX0.9.5:ScummVM Modern Theme:No Author]
%using ../common
diff --git a/gui/themes/scummremastered.zip b/gui/themes/scummremastered.zip
index fef8d26ade5..182155d9b61 100644
Binary files a/gui/themes/scummremastered.zip and b/gui/themes/scummremastered.zip differ
diff --git a/gui/themes/scummremastered/THEMERC b/gui/themes/scummremastered/THEMERC
index 1abe11905c8..2edcb044c90 100644
--- a/gui/themes/scummremastered/THEMERC
+++ b/gui/themes/scummremastered/THEMERC
@@ -1,3 +1,3 @@
-[SCUMMVM_STX0.9.4:ScummVM Modern Theme Remastered:No Author]
+[SCUMMVM_STX0.9.5:ScummVM Modern Theme Remastered:No Author]
%using ../common
%using ../common-svg
diff --git a/gui/widgets/grid.cpp b/gui/widgets/grid.cpp
index 9f3462087c4..dc8e1165629 100644
--- a/gui/widgets/grid.cpp
+++ b/gui/widgets/grid.cpp
@@ -334,22 +334,20 @@ Graphics::ManagedSurface *loadSurfaceFromFile(const Common::String &name, int re
GridWidget::GridWidget(GuiObject *boss, const Common::String &name)
: ContainerWidget(boss, name), CommandSender(boss) {
- _thumbnailHeight = int(g_gui.xmlEval()->getVar("Globals.GridItemThumbnail.Height") * g_gui.getScaleFactor() + .5f);
- _thumbnailWidth = int(g_gui.xmlEval()->getVar("Globals.GridItemThumbnail.Width") * g_gui.getScaleFactor() + .5f);
- _flagIconHeight = int(g_gui.xmlEval()->getVar("Globals.Grid.FlagIcon.Height") * g_gui.getScaleFactor() + .5f);
- _flagIconWidth = int(g_gui.xmlEval()->getVar("Globals.Grid.FlagIcon.Width") * g_gui.getScaleFactor() + .5f);
- _platformIconHeight = int(g_gui.xmlEval()->getVar("Globals.Grid.PlatformIcon.Height") * g_gui.getScaleFactor() + .5f);
- _platformIconWidth = int(g_gui.xmlEval()->getVar("Globals.Grid.PlatformIcon.Width") * g_gui.getScaleFactor() + .5f);
- _minGridXSpacing = int(g_gui.xmlEval()->getVar("Globals.Grid.XSpacing") * g_gui.getScaleFactor() + .5f);
- _minGridYSpacing = int(g_gui.xmlEval()->getVar("Globals.Grid.YSpacing") * g_gui.getScaleFactor() + .5f);
- _isTitlesVisible = g_gui.xmlEval()->getVar("Globals.Grid.ShowTitles");
- _scrollBarWidth = g_gui.xmlEval()->getVar("Globals.Scrollbar.Width", 0);
- _scrollWindowPaddingX = _minGridXSpacing;
- _scrollWindowPaddingY = _minGridYSpacing;
+ _thumbnailHeight = 0;
+ _thumbnailWidth = 0;
+ _flagIconHeight = 0;
+ _flagIconWidth = 0;
+ _platformIconHeight = 0;
+ _platformIconWidth = 0;
+ _minGridXSpacing = 0;
+ _minGridYSpacing = 0;
+ _isTitlesVisible = 0;
+ _scrollBarWidth = 0;
- loadPlatformIcons();
- loadFlagIcons();
+ _scrollWindowPaddingX = 0;
+ _scrollWindowPaddingY = 0;
_scrollBar = new ScrollBarWidget(this, _w - _scrollBarWidth, _y, _scrollBarWidth, _y + _h);
_scrollBar->setTarget(this);
@@ -368,8 +366,8 @@ GridWidget::GridWidget(GuiObject *boss, const Common::String &name)
_gridXSpacing = 0;
_gridHeaderHeight = kLineHeight;
_gridHeaderWidth = 0;
- _gridItemHeight = _thumbnailHeight + (2 * kLineHeight * _isTitlesVisible);
- _gridItemWidth = _thumbnailWidth;
+ _gridItemHeight = 0;
+ _gridItemWidth = 0;
_trayHeight = kLineHeight * 3;
_selectedEntry = nullptr;
@@ -623,7 +621,7 @@ void GridWidget::reloadThumbnails() {
}
if (surf) {
- const Graphics::ManagedSurface *scSurf(scaleGfx(surf, _thumbnailWidth, 512, true));
+ const Graphics::ManagedSurface *scSurf(scaleGfx(surf, _thumbnailWidth, _thumbnailHeight, true));
_loadedSurfaces[entry->thumbPath] = scSurf;
if (surf != scSurf) {
surf->free();
@@ -860,35 +858,45 @@ void GridWidget::reflowLayout() {
_scrollWindowHeight = _h;
_scrollWindowWidth = _w;
+ _itemsPerRow = ConfMan.getInt("grid_items_per_row");
+
+ _minGridXSpacing = int(g_gui.xmlEval()->getVar("Globals.Grid.XSpacing") * g_gui.getScaleFactor() + .5f);
+ _minGridYSpacing = int(g_gui.xmlEval()->getVar("Globals.Grid.YSpacing") * g_gui.getScaleFactor() + .5f);
+ _isTitlesVisible = g_gui.xmlEval()->getVar("Globals.Grid.ShowTitles");
+ _scrollBarWidth = g_gui.xmlEval()->getVar("Globals.Scrollbar.Width", 0);
+
+ _scrollWindowPaddingX = _minGridXSpacing;
+ _scrollWindowPaddingY = _minGridYSpacing;
+ _gridYSpacing = _minGridYSpacing;
+
+ // Recompute thumbnail size
int oldThumbnailHeight = _thumbnailHeight;
int oldThumbnailWidth = _thumbnailWidth;
- _thumbnailHeight = int(g_gui.xmlEval()->getVar("Globals.GridItemThumbnail.Height") * g_gui.getScaleFactor() + .5f);
- _thumbnailWidth = int(g_gui.xmlEval()->getVar("Globals.GridItemThumbnail.Width") * g_gui.getScaleFactor() + .5f);
- _flagIconHeight = int(g_gui.xmlEval()->getVar("Globals.Grid.FlagIcon.Height") * g_gui.getScaleFactor() + .5f);
- _flagIconWidth = int(g_gui.xmlEval()->getVar("Globals.Grid.FlagIcon.Width") * g_gui.getScaleFactor() + .5f);
- _platformIconHeight = int(g_gui.xmlEval()->getVar("Globals.Grid.PlatformIcon.Height") * g_gui.getScaleFactor() + .5f);
- _platformIconWidth = int(g_gui.xmlEval()->getVar("Globals.Grid.PlatformIcon.Width") * g_gui.getScaleFactor() + .5f);
+
+ int availableWidth = _scrollWindowWidth - (2 * _scrollWindowPaddingX) - _scrollBarWidth;
+ _thumbnailWidth = availableWidth / _itemsPerRow - _minGridXSpacing;
+ const int minimumthumbnailWidth = int(36 * g_gui.getScaleFactor() + .5f);
+ if (_thumbnailWidth < minimumthumbnailWidth) {
+ _thumbnailWidth = minimumthumbnailWidth;
+ _itemsPerRow = MAX((availableWidth / (_thumbnailWidth + _minGridXSpacing)), 1);
+ }
+
+ _thumbnailHeight = _thumbnailWidth;
+ _flagIconWidth = _thumbnailWidth / 4;
+ _flagIconHeight = _flagIconWidth / 2;
+ _platformIconHeight = _platformIconWidth = _thumbnailWidth / 6;
+
if ((oldThumbnailHeight != _thumbnailHeight) || (oldThumbnailWidth != _thumbnailWidth)) {
unloadSurfaces(_loadedSurfaces);
reloadThumbnails();
loadFlagIcons();
loadPlatformIcons();
}
- _minGridXSpacing = int(g_gui.xmlEval()->getVar("Globals.Grid.XSpacing") * g_gui.getScaleFactor() + .5f);
- _minGridYSpacing = int(g_gui.xmlEval()->getVar("Globals.Grid.YSpacing") * g_gui.getScaleFactor() + .5f);
- _scrollWindowPaddingX = _minGridXSpacing;
- _scrollWindowPaddingY = _minGridYSpacing;
- _gridYSpacing = _minGridYSpacing;
-
- _isTitlesVisible = g_gui.xmlEval()->getVar("Globals.Grid.ShowTitles");
-
- _scrollBarWidth = g_gui.xmlEval()->getVar("Globals.Scrollbar.Width", 0);
_trayHeight = kLineHeight * 3;
_gridItemHeight = _thumbnailHeight + (2 * kLineHeight * _isTitlesVisible);
_gridItemWidth = _thumbnailWidth;
- _itemsPerRow = MAX(((_scrollWindowWidth - (2 * _scrollWindowPaddingX) - _scrollBarWidth) / (_gridItemWidth + _minGridXSpacing)), 1);
_gridXSpacing = MAX(((_scrollWindowWidth - _scrollBarWidth - (2 * _scrollWindowPaddingX)) - (_itemsPerRow * _gridItemWidth)) / (_itemsPerRow + 1), _minGridXSpacing);
calcEntrySizes();
diff --git a/gui/widgets/grid.h b/gui/widgets/grid.h
index 01cfed28783..f91ff3f52a2 100644
--- a/gui/widgets/grid.h
+++ b/gui/widgets/grid.h
@@ -42,7 +42,8 @@ enum {
kLoadButtonCmd = 'LOAD',
kOpenTrayCmd = 'OPTR',
kItemClicked = 'LBX1',
- kItemDoubleClickedCmd = 'LBX2'
+ kItemDoubleClickedCmd = 'LBX2',
+ kItemSizeCmd = 'SIZE'
};
/* GridItemInfo */
More information about the Scummvm-git-logs
mailing list