[Scummvm-git-logs] scummvm master -> 59a76eac6b7dfdb4a8dcf0c285090452ceb1b0d0
AndywinXp
noreply at scummvm.org
Mon Nov 3 20:10:25 UTC 2025
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
64b133a1da GUI: Add item spacing to lists
59a76eac6b GUI: Add spacing to list for all common themes
Commit: 64b133a1dafc81fa292d049bf93c6e55f04ab6b8
https://github.com/scummvm/scummvm/commit/64b133a1dafc81fa292d049bf93c6e55f04ab6b8
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-11-03T21:10:21+01:00
Commit Message:
GUI: Add item spacing to lists
This let the theme define inter item spacing.
The selection box has the same height as the item height and the text in
vertically centered.
The edition caret is vertically centered.
Changed paths:
gui/widgets/groupedlist.cpp
gui/widgets/list.cpp
gui/widgets/list.h
diff --git a/gui/widgets/groupedlist.cpp b/gui/widgets/groupedlist.cpp
index a2b33b7fddd..4e62f0528e7 100644
--- a/gui/widgets/groupedlist.cpp
+++ b/gui/widgets/groupedlist.cpp
@@ -341,9 +341,10 @@ void GroupedListWidget::drawWidget() {
ThemeEngine::kWidgetBackgroundBorder);
// Draw the list items
+ const int lineHeight = kLineHeight + _itemSpacing;
+ const int indentSpacing = g_gui.getFontHeight();
for (i = 0, pos = _currentPos; i < _entriesPerPage && pos < len; i++, pos++) {
- const int y = _y + _topPadding + kLineHeight * i;
- const int fontHeight = g_gui.getFontHeight();
+ const int y = _y + _topPadding + lineHeight * i;
ThemeEngine::TextInversionState inverted = ThemeEngine::kTextInversionNone;
#if 0
ThemeEngine::FontStyle bold = ThemeEngine::kFontStyleBold;
@@ -362,11 +363,11 @@ void GroupedListWidget::drawWidget() {
#if 0
bold = ThemeEngine::kFontStyleBold;
#endif
- r.left += fontHeight + _leftPadding;
- g_gui.theme()->drawFoldIndicator(Common::Rect(_x + _hlLeftPadding + _leftPadding, y, _x + fontHeight + _leftPadding, y + fontHeight), _groupExpanded[groupID]);
+ r.left += indentSpacing + _leftPadding;
+ g_gui.theme()->drawFoldIndicator(Common::Rect(_x + _hlLeftPadding + _leftPadding, y, _x + indentSpacing + _leftPadding, y + lineHeight), _groupExpanded[groupID]);
pad = 0;
} else if (_groupsVisible) {
- r.left += fontHeight + _leftPadding;
+ r.left += indentSpacing + _leftPadding;
r.right -= _rightPadding;
pad = 0;
}
@@ -374,12 +375,12 @@ void GroupedListWidget::drawWidget() {
// If in numbering mode & not in RTL based GUI, we first print a number prefix
if (_numberingMode != kListNumberingOff && g_gui.useRTL() == false) {
buffer = Common::String::format("%2d. ", (pos + _numberingMode));
- g_gui.theme()->drawText(Common::Rect(_x + _hlLeftPadding, y, _x + r.left + _leftPadding, y + fontHeight),
+ g_gui.theme()->drawText(Common::Rect(_x + _hlLeftPadding, y, _x + r.left + _leftPadding, y + lineHeight),
buffer, _state, _drawAlign, inverted, _leftPadding, true);
pad = 0;
}
- Common::Rect r1(_x + r.left, y, _x + r.right, y + fontHeight);
+ Common::Rect r1(_x + r.left, y, _x + r.right, y + lineHeight);
if (g_gui.useRTL()) {
if (_scrollBar->isVisible()) {
diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp
index 936e782cf58..7c9dfa4e280 100644
--- a/gui/widgets/list.cpp
+++ b/gui/widgets/list.cpp
@@ -76,6 +76,7 @@ ListWidget::ListWidget(Dialog *boss, const Common::String &name, const Common::U
_hlLeftPadding = _hlRightPadding = 0;
_leftPadding = _rightPadding = 0;
_topPadding = _bottomPadding = 0;
+ _itemSpacing = 0;
}
ListWidget::ListWidget(Dialog *boss, int x, int y, int w, int h, bool scale, const Common::U32String &tooltip, uint32 cmd)
@@ -118,6 +119,7 @@ ListWidget::ListWidget(Dialog *boss, int x, int y, int w, int h, bool scale, con
_hlLeftPadding = _hlRightPadding = 0;
_leftPadding = _rightPadding = 0;
_topPadding = _bottomPadding = 0;
+ _itemSpacing = 0;
_scrollBarWidth = 0;
}
@@ -317,7 +319,7 @@ void ListWidget::handleMouseLeft(int button) {
int ListWidget::findItem(int x, int y) const {
if (y < _topPadding) return -1;
- int item = (y - _topPadding) / kLineHeight + _currentPos;
+ int item = (y - _topPadding) / (kLineHeight + _itemSpacing) + _currentPos;
if (isItemVisible(item) && item < (int)_list.size())
return item;
else
@@ -552,9 +554,9 @@ void ListWidget::drawWidget() {
ThemeEngine::kWidgetBackgroundBorder);
// Draw the list items
+ const int lineHeight = kLineHeight + _itemSpacing;
for (i = 0, pos = _currentPos; i < _entriesPerPage && pos < len; i++, pos++) {
- const int y = _y + _topPadding + kLineHeight * i;
- const int fontHeight = g_gui.getFontHeight();
+ const int y = _y + _topPadding + lineHeight * i;
ThemeEngine::TextInversionState inverted = ThemeEngine::kTextInversionNone;
// Draw the selected item inverted, on a highlighted background.
@@ -571,12 +573,12 @@ void ListWidget::drawWidget() {
// If in numbering mode & not in RTL based GUI, we first print a number prefix
if (_numberingMode != kListNumberingOff && g_gui.useRTL() == false) {
buffer = Common::String::format("%2d. ", (pos + _numberingMode));
- g_gui.theme()->drawText(Common::Rect(_x + _hlLeftPadding, y, _x + r.left + _leftPadding, y + fontHeight),
+ g_gui.theme()->drawText(Common::Rect(_x + _hlLeftPadding, y, _x + r.left + _leftPadding, y + lineHeight),
buffer, itemState, _drawAlign, inverted, _leftPadding, true);
pad = 0;
}
- Common::Rect r1(_x + r.left, y, _x + r.right, y + fontHeight);
+ Common::Rect r1(_x + r.left, y, _x + r.right, y + lineHeight);
if (g_gui.useRTL()) {
if (_scrollBar->isVisible()) {
@@ -625,8 +627,13 @@ Common::Rect ListWidget::getEditRect() const {
if (editWidth < 0) {
editWidth = 0;
}
- Common::Rect r(_hlLeftPadding, 0, _hlLeftPadding + editWidth, g_gui.getFontHeight());
- const int offset = (_selectedItem - _currentPos) * kLineHeight + _topPadding;
+
+ const int fontHeight = g_gui.getFontHeight();
+ const int lineHeight = kLineHeight + _itemSpacing;
+
+ // Center the caret/text vertically inside the line
+ Common::Rect r(_hlLeftPadding, 0, _hlLeftPadding + editWidth, fontHeight);
+ const int offset = (_selectedItem - _currentPos) * lineHeight + _topPadding + (lineHeight - fontHeight) / 2;
r.top += offset;
r.bottom += offset;
@@ -721,6 +728,7 @@ void ListWidget::reflowLayout() {
_bottomPadding = g_gui.xmlEval()->getVar("Globals.ListWidget.Padding.Bottom", 0);
_hlLeftPadding = g_gui.xmlEval()->getVar("Globals.ListWidget.hlLeftPadding", 0);
_hlRightPadding = g_gui.xmlEval()->getVar("Globals.ListWidget.hlRightPadding", 0);
+ _itemSpacing = g_gui.xmlEval()->getVar("Globals.ListWidget.itemSpacing", 0);
_scrollBarWidth = g_gui.xmlEval()->getVar("Globals.Scrollbar.Width", 0);
@@ -729,7 +737,7 @@ void ListWidget::reflowLayout() {
// of the list.
// We do a rough rounding on the decimal places of Entries Per Page,
// to add another entry even if it goes a tad over the padding.
- frac_t entriesPerPage = intToFrac(_h - _topPadding - _bottomPadding) / kLineHeight;
+ frac_t entriesPerPage = intToFrac(_h - _topPadding - _bottomPadding) / (kLineHeight + _itemSpacing);
// Our threshold before we add another entry is 0.9375 (0xF000 with FRAC_BITS being 16).
const frac_t threshold = intToFrac(15) / 16;
diff --git a/gui/widgets/list.h b/gui/widgets/list.h
index 2e85474c4d4..f9b247e770e 100644
--- a/gui/widgets/list.h
+++ b/gui/widgets/list.h
@@ -84,6 +84,7 @@ protected:
int _rightPadding;
int _topPadding;
int _bottomPadding;
+ int _itemSpacing;
int _scrollBarWidth;
Common::U32String _filter;
Commit: 59a76eac6b7dfdb4a8dcf0c285090452ceb1b0d0
https://github.com/scummvm/scummvm/commit/59a76eac6b7dfdb4a8dcf0c285090452ceb1b0d0
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-11-03T21:10:21+01:00
Commit Message:
GUI: Add spacing to list for all common themes
This is only the case in high-res.
Low-res stays denser to display more items.
Changed paths:
gui/themes/common/highres_layout.stx
gui/themes/residualvm.zip
gui/themes/scummclassic.zip
gui/themes/scummmodern.zip
gui/themes/scummremastered.zip
diff --git a/gui/themes/common/highres_layout.stx b/gui/themes/common/highres_layout.stx
index 33a517f5952..f923f881a16 100644
--- a/gui/themes/common/highres_layout.stx
+++ b/gui/themes/common/highres_layout.stx
@@ -39,6 +39,7 @@
<def var = 'ListWidget.hlLeftPadding' value = '0'/>
<def var = 'ListWidget.hlRightPadding' value = '0'/>
+ <def var = 'ListWidget.itemSpacing' value = '2'/>
<def var = 'ShowLauncherLogo' value = '1'/>
<def var = 'ShowGlobalMenuLogo' value = '1'/>
diff --git a/gui/themes/residualvm.zip b/gui/themes/residualvm.zip
index d93940dba32..901cebadae2 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 888bbef7ef5..9172e9e3325 100644
Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index 095125cb78a..95fc4fc30a3 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 0ef528dd51c..24358c8a1f0 100644
Binary files a/gui/themes/scummremastered.zip and b/gui/themes/scummremastered.zip differ
More information about the Scummvm-git-logs
mailing list