GUI: Make thumbnail smaller than its background
This avoids the thumbnail to be drawn over the rounded borders
This commit is contained in:
parent
23d1fdff18
commit
a9bf813e86
8 changed files with 19 additions and 7 deletions
|
@ -77,6 +77,8 @@
|
|||
<def var = 'Grid.YSpacing' value = '15' scalable = 'no' resolution = 'x<641' />
|
||||
<def var = 'Grid.ShowTitles' value = '1' scalable = 'no' resolution = 'x<641' />
|
||||
|
||||
<def var = 'Grid.ThumbnailMargin' value = '5' scalable = 'yes' />
|
||||
|
||||
<widget name = 'OptionsLabel'
|
||||
size = '115, Globals.Line.Height'
|
||||
textalign = 'end'
|
||||
|
|
|
@ -66,6 +66,8 @@
|
|||
<def var = 'Grid.YSpacing' value = '10' scalable = 'no'/>
|
||||
<def var = 'Grid.ShowTitles' value = '0' scalable = 'no'/>
|
||||
|
||||
<def var = 'Grid.ThumbnailMargin' value = '5' scalable = 'yes' />
|
||||
|
||||
<widget name = 'OptionsLabel'
|
||||
size = '100, Globals.Line.Height'
|
||||
textalign = 'end'
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -119,7 +119,7 @@ void GridItemWidget::drawWidget() {
|
|||
r.translate(0, kLineHeight);
|
||||
}
|
||||
} else {
|
||||
g_gui.theme()->drawManagedSurface(Common::Point(_x, _y), _thumbGfx);
|
||||
g_gui.theme()->drawManagedSurface(Common::Point(_x + _grid->_thumbnailMargin, _y + _grid->_thumbnailMargin), _thumbGfx);
|
||||
}
|
||||
|
||||
// Draw Platform Icon
|
||||
|
@ -405,6 +405,7 @@ GridWidget::GridWidget(GuiObject *boss, const Common::String &name)
|
|||
_minGridYSpacing = 0;
|
||||
_isTitlesVisible = 0;
|
||||
_scrollBarWidth = 0;
|
||||
_thumbnailMargin = 0;
|
||||
|
||||
_scrollWindowPaddingX = 0;
|
||||
_scrollWindowPaddingY = 0;
|
||||
|
@ -681,6 +682,8 @@ void GridWidget::setGroupHeaderFormat(const Common::U32String &prefix, const Com
|
|||
}
|
||||
|
||||
void GridWidget::reloadThumbnails() {
|
||||
const int thumbnailWidth = MAX(_thumbnailWidth - 2 * _thumbnailMargin, 0);
|
||||
const int thumbnailHeight = MAX(_thumbnailHeight - 2 * _thumbnailMargin, 0);
|
||||
for (Common::Array<GridItemInfo *>::iterator iter = _visibleEntryList.begin(); iter != _visibleEntryList.end(); ++iter) {
|
||||
GridItemInfo *entry = *iter;
|
||||
if (entry->thumbPath.empty())
|
||||
|
@ -701,7 +704,7 @@ void GridWidget::reloadThumbnails() {
|
|||
}
|
||||
|
||||
if (surf) {
|
||||
const Graphics::ManagedSurface *scSurf(scaleGfx(surf, _thumbnailWidth, _thumbnailHeight, true));
|
||||
const Graphics::ManagedSurface *scSurf(scaleGfx(surf, thumbnailWidth, thumbnailHeight, true));
|
||||
_loadedSurfaces[entry->thumbPath] = scSurf;
|
||||
|
||||
if (path != entry->thumbPath) {
|
||||
|
@ -966,6 +969,11 @@ void GridWidget::reflowLayout() {
|
|||
Widget::reflowLayout();
|
||||
destroyItems();
|
||||
|
||||
// Recompute thumbnail size
|
||||
int oldThumbnailHeight = _thumbnailHeight;
|
||||
int oldThumbnailWidth = _thumbnailWidth;
|
||||
int oldThumbnailMargin = _thumbnailMargin;
|
||||
|
||||
_scrollWindowHeight = _h;
|
||||
_scrollWindowWidth = _w;
|
||||
|
||||
|
@ -975,15 +983,12 @@ void GridWidget::reflowLayout() {
|
|||
_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);
|
||||
_thumbnailMargin = g_gui.xmlEval()->getVar("Globals.Grid.ThumbnailMargin", 0);
|
||||
|
||||
_scrollWindowPaddingX = _minGridXSpacing;
|
||||
_scrollWindowPaddingY = _minGridYSpacing;
|
||||
_gridYSpacing = _minGridYSpacing;
|
||||
|
||||
// Recompute thumbnail size
|
||||
int oldThumbnailHeight = _thumbnailHeight;
|
||||
int oldThumbnailWidth = _thumbnailWidth;
|
||||
|
||||
int availableWidth = _scrollWindowWidth - (2 * _scrollWindowPaddingX) - _scrollBarWidth;
|
||||
_thumbnailWidth = availableWidth / _itemsPerRow - _minGridXSpacing;
|
||||
const int minimumthumbnailWidth = int(36 * g_gui.getScaleFactor() + .5f);
|
||||
|
@ -999,7 +1004,9 @@ void GridWidget::reflowLayout() {
|
|||
_extraIconWidth = _thumbnailWidth;
|
||||
_extraIconHeight = _thumbnailHeight;
|
||||
|
||||
if ((oldThumbnailHeight != _thumbnailHeight) || (oldThumbnailWidth != _thumbnailWidth)) {
|
||||
if ((oldThumbnailHeight != _thumbnailHeight) ||
|
||||
(oldThumbnailWidth != _thumbnailWidth) ||
|
||||
(oldThumbnailMargin != _thumbnailMargin)) {
|
||||
unloadSurfaces(_extraIcons);
|
||||
unloadSurfaces(_platformIcons);
|
||||
unloadSurfaces(_languageIcons);
|
||||
|
|
|
@ -157,6 +157,7 @@ public:
|
|||
int _gridItemWidth;
|
||||
int _gridXSpacing;
|
||||
int _gridYSpacing;
|
||||
int _thumbnailMargin;
|
||||
|
||||
bool _isTitlesVisible;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue