GUI: Add slider for Grid Launcher icon size
This commit is contained in:
parent
7edae880f8
commit
5ea034391b
15 changed files with 87 additions and 59 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -930,6 +930,8 @@ protected:
|
|||
void build() override;
|
||||
private:
|
||||
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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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'/>
|
||||
|
|
Binary file not shown.
|
@ -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
|
||||
|
|
Binary file not shown.
|
@ -1 +1 @@
|
|||
[SCUMMVM_STX0.9.4:ScummVM Classic Theme:No Author]
|
||||
[SCUMMVM_STX0.9.5:ScummVM Classic Theme:No Author]
|
||||
|
|
Binary file not shown.
|
@ -1,2 +1,2 @@
|
|||
[SCUMMVM_STX0.9.4:ScummVM Modern Theme:No Author]
|
||||
[SCUMMVM_STX0.9.5:ScummVM Modern Theme:No Author]
|
||||
%using ../common
|
||||
|
|
Binary file not shown.
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -42,7 +42,8 @@ enum {
|
|||
kLoadButtonCmd = 'LOAD',
|
||||
kOpenTrayCmd = 'OPTR',
|
||||
kItemClicked = 'LBX1',
|
||||
kItemDoubleClickedCmd = 'LBX2'
|
||||
kItemDoubleClickedCmd = 'LBX2',
|
||||
kItemSizeCmd = 'SIZE'
|
||||
};
|
||||
|
||||
/* GridItemInfo */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue