[Scummvm-git-logs] scummvm master -> 0a3d6d80547f7bba210f35ca744c526bebbe9a83

Mataniko mataniko at gmail.com
Sat Aug 3 10:35:54 CEST 2019


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

Summary:
c91bcbfb94 GUI: Fix scrollbars
9ba3cd594d GUI: Tune ScrollContainerWidget offsets
c47b204ac3 GUI: Minor offsets fixes in Tooltip and EditTextWidget
0a3d6d8054 GUI: Fix TabWidget's < and > buttons


Commit: c91bcbfb94de77d8aa1c168e904209efb7e2618b
    https://github.com/scummvm/scummvm/commit/c91bcbfb94de77d8aa1c168e904209efb7e2618b
Author: Alexander Tkachev (alexander at tkachov.ru)
Date: 2019-08-03T04:35:48-04:00

Commit Message:
GUI: Fix scrollbars

- removed +1px in ListWidget, added in lordhoto's 2007 commit 68eb28a
(aka r29971 in svn) `Fix for bug #1670082 "GUI: Modern theme gfx glitch
in launcher".`, because it made clip this last line of scrollbar in all
themes, which doesn't look good. In 2007 theme was written in .ini,
which is not the case now. I don't see any glitches after removing this
"fix";

- fixed how scrollbar top and bottom scroll buttons are drawn in
ThemeEngine::drawScrollbar: there were these weird magic numbers, but in
reality extra space that buttons should occupy is hardcoded in
scrollbar.cpp (ScrollBarWidget) and is just +1px.

Changed paths:
    gui/ThemeEngine.cpp
    gui/widgets/list.cpp


diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 7e42bc0..598d9c2 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1030,7 +1030,7 @@ void ThemeEngine::drawScrollbar(const Common::Rect &r, int sliderY, int sliderHe
 	drawDD(kDDScrollbarBase, r);
 
 	Common::Rect r2 = r;
-	const int buttonExtra = (r.width() * 120) / 100;
+	const int buttonExtra = r.width() + 1; // scrollbar.cpp's UP_DOWN_BOX_HEIGHT
 
 	r2.bottom = r2.top + buttonExtra;
 	drawDD(scrollState == kScrollbarStateUp ? kDDScrollbarButtonHover : kDDScrollbarButtonIdle, r2,
diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp
index 6dd4ab4..74239f8 100644
--- a/gui/widgets/list.cpp
+++ b/gui/widgets/list.cpp
@@ -41,7 +41,7 @@ ListWidget::ListWidget(Dialog *boss, const String &name, const char *tooltip, ui
 	// This ensures that _entriesPerPage is properly initialized.
 	reflowLayout();
 
-	_scrollBar = new ScrollBarWidget(this, _w - _scrollBarWidth + 1, 0, _scrollBarWidth, _h);
+	_scrollBar = new ScrollBarWidget(this, _w - _scrollBarWidth, 0, _scrollBarWidth, _h);
 	_scrollBar->setTarget(this);
 
 	setFlags(WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE);
@@ -72,7 +72,7 @@ ListWidget::ListWidget(Dialog *boss, int x, int y, int w, int h, const char *too
 	// This ensures that _entriesPerPage is properly initialized.
 	reflowLayout();
 
-	_scrollBar = new ScrollBarWidget(this, _w - _scrollBarWidth + 1, 0, _scrollBarWidth, _h);
+	_scrollBar = new ScrollBarWidget(this, _w - _scrollBarWidth, 0, _scrollBarWidth, _h);
 	_scrollBar->setTarget(this);
 
 	setFlags(WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE);
@@ -658,7 +658,7 @@ void ListWidget::reflowLayout() {
 	assert(_entriesPerPage > 0);
 
 	if (_scrollBar) {
-		_scrollBar->resize(_w - _scrollBarWidth + 1, 0, _scrollBarWidth, _h);
+		_scrollBar->resize(_w - _scrollBarWidth, 0, _scrollBarWidth, _h);
 		scrollBarRecalc();
 		scrollToCurrent();
 	}


Commit: 9ba3cd594d8e365cf53c1c375401de3cc0e826e0
    https://github.com/scummvm/scummvm/commit/9ba3cd594d8e365cf53c1c375401de3cc0e826e0
Author: Alexander Tkachev (alexander at tkachov.ru)
Date: 2019-08-03T04:35:48-04:00

Commit Message:
GUI: Tune ScrollContainerWidget offsets

Well, it ain't a fix, because it's not exactly correct for any of the
themes. Yet it's the best for all of them. If I put what seems to be
correct, "modern" theme gets ruined, because it has this mystical 2px
offset in tabs/scrollcontainers.

Changed paths:
    gui/widgets/scrollcontainer.cpp


diff --git a/gui/widgets/scrollcontainer.cpp b/gui/widgets/scrollcontainer.cpp
index 5a0e408..389eed0 100644
--- a/gui/widgets/scrollcontainer.cpp
+++ b/gui/widgets/scrollcontainer.cpp
@@ -80,8 +80,8 @@ void ScrollContainerWidget::recalc() {
 	_verticalScroll->_currentPos = _scrolledY;
 	_verticalScroll->_entriesPerPage = _limitH;
 	_verticalScroll->_singleStep = kLineHeight;
-	_verticalScroll->setPos(_w - scrollbarWidth, _scrolledY+1);
-	_verticalScroll->setSize(scrollbarWidth, _limitH -2);
+	_verticalScroll->setPos(_w - scrollbarWidth, _scrolledY);
+	_verticalScroll->setSize(scrollbarWidth, _limitH-1);
 }
 
 
@@ -147,7 +147,7 @@ void ScrollContainerWidget::reflowLayout() {
 }
 
 void ScrollContainerWidget::drawWidget() {
-	g_gui.theme()->drawDialogBackground(Common::Rect(_x, _y, _x + _w, _y + getHeight() - 1), _backgroundType);
+	g_gui.theme()->drawDialogBackground(Common::Rect(_x, _y, _x + _w, _y + getHeight()), _backgroundType);
 }
 
 bool ScrollContainerWidget::containsWidget(Widget *w) const {
@@ -167,7 +167,7 @@ Widget *ScrollContainerWidget::findWidget(int x, int y) {
 
 Common::Rect ScrollContainerWidget::getClipRect() const {
 	// Make sure the clipping rect contains the scrollbar so it is properly redrawn
-	return Common::Rect(getAbsX(), getAbsY(), getAbsX() + _w, getAbsY() + getHeight());
+	return Common::Rect(getAbsX(), getAbsY(), getAbsX() + _w, getAbsY() + getHeight() - 1); // this -1 is because of container border, which might not be present actually
 }
 
 void ScrollContainerWidget::setBackgroundType(ThemeEngine::DialogBackground backgroundType) {


Commit: c47b204ac35d0bdcccef65afcfe466959a458f21
    https://github.com/scummvm/scummvm/commit/c47b204ac35d0bdcccef65afcfe466959a458f21
Author: Alexander Tkachev (alexander at tkachov.ru)
Date: 2019-08-03T04:35:48-04:00

Commit Message:
GUI: Minor offsets fixes in Tooltip and EditTextWidget

Changed paths:
    gui/Tooltip.cpp
    gui/widgets/edittext.cpp


diff --git a/gui/Tooltip.cpp b/gui/Tooltip.cpp
index 50f1027..dfa1d54 100644
--- a/gui/Tooltip.cpp
+++ b/gui/Tooltip.cpp
@@ -49,8 +49,8 @@ void Tooltip::setup(Dialog *parent, Widget *widget, int x, int y) {
 	const Graphics::Font *tooltipFont = g_gui.theme()->getFont(ThemeEngine::kFontStyleTooltip);
 
 	_wrappedLines.clear();
-	_w = tooltipFont->wordWrapText(widget->getTooltip(), _maxWidth - 4, _wrappedLines);
-	_h = (tooltipFont->getFontHeight() + 2) * _wrappedLines.size();
+	_w = tooltipFont->wordWrapText(widget->getTooltip(), _maxWidth - 4, _wrappedLines) + 4;
+	_h = (tooltipFont->getFontHeight() + 2) * _wrappedLines.size() + 4;
 
 	_x = MIN<int16>(parent->_x + x + _xdelta, g_gui.getWidth() - _w - 3);
 	_y = MIN<int16>(parent->_y + y + _ydelta, g_gui.getHeight() - _h - 3);
@@ -62,9 +62,11 @@ void Tooltip::drawDialog(DrawLayer layerToDraw) {
 
 	Dialog::drawDialog(layerToDraw);
 
+	int16 textX = _x + 3; // including 2px padding and 1px original code shift
+	int16 textY = _y + 3;
 	for (Common::StringArray::const_iterator i = _wrappedLines.begin(); i != _wrappedLines.end(); ++i, ++num) {
 		g_gui.theme()->drawText(
-			Common::Rect(_x + 1, _y + 1 + num * h, _x + 1 + _w, _y + 1 + (num + 1) * h),
+			Common::Rect(textX, textY + num * h, textX + _w, textY + (num + 1) * h),
 			*i,
 			ThemeEngine::kStateEnabled,
 			Graphics::kTextAlignLeft,
diff --git a/gui/widgets/edittext.cpp b/gui/widgets/edittext.cpp
index b73cb99..e2dcd2b 100644
--- a/gui/widgets/edittext.cpp
+++ b/gui/widgets/edittext.cpp
@@ -100,7 +100,7 @@ void EditTextWidget::drawWidget() {
 	setTextDrawableArea(r);
 
 	g_gui.theme()->drawText(
-			Common::Rect(_x + 2 + _leftPadding, _y + 2, _x + _leftPadding + getEditRect().width() + 2, _y + _h),
+			Common::Rect(_x + 2 + _leftPadding, _y + 1, _x + _leftPadding + getEditRect().width() + 2, _y + _h),
 			_editString, _state, Graphics::kTextAlignLeft, ThemeEngine::kTextInversionNone,
 			-_editScrollOffset, false, _font, ThemeEngine::kFontColorNormal, true, _textDrawableArea);
 }


Commit: 0a3d6d80547f7bba210f35ca744c526bebbe9a83
    https://github.com/scummvm/scummvm/commit/0a3d6d80547f7bba210f35ca744c526bebbe9a83
Author: Alexander Tkachev (alexander at tkachov.ru)
Date: 2019-08-03T04:35:48-04:00

Commit Message:
GUI: Fix TabWidget's < and > buttons

These were incorrectly positioned (typos in code, missing value in one
expression).

Changed paths:
    gui/widgets/tab.cpp


diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index 977aaaf..d34214b 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -62,7 +62,7 @@ void TabWidget::init() {
 	_bodyLP = g_gui.xmlEval()->getVar("Globals.TabWidget.Body.Padding.Left");
 	_bodyRP = g_gui.xmlEval()->getVar("Globals.TabWidget.Body.Padding.Right");
 
-	_butRP = g_gui.xmlEval()->getVar("Globals.TabWidget.NavButtonPadding.Right", 0);
+	_butRP = g_gui.xmlEval()->getVar("Globals.TabWidget.NavButton.Padding.Right", 0);
 	_butTP = g_gui.xmlEval()->getVar("Globals.TabWidget.NavButton.Padding.Top", 0);
 	_butW = g_gui.xmlEval()->getVar("Globals.TabWidget.NavButton.Width", 10);
 	_butH = g_gui.xmlEval()->getVar("Globals.TabWidget.NavButton.Height", 10);
@@ -258,9 +258,9 @@ void TabWidget::reflowLayout() {
 	_minTabWidth = g_gui.xmlEval()->getVar("Globals.TabWidget.Tab.Width");
 	_titleVPad = g_gui.xmlEval()->getVar("Globals.TabWidget.Tab.Padding.Top");
 
-	_butRP = g_gui.xmlEval()->getVar("Globals.TabWidget.NavButton.PaddingRight", 0);
+	_butRP = g_gui.xmlEval()->getVar("Globals.TabWidget.NavButton.Padding.Right", 0);
 	_butTP = g_gui.xmlEval()->getVar("Globals.TabWidget.NavButton.Padding.Top", 0);
-	_butW = g_gui.xmlEval()->getVar("GlobalsTabWidget.NavButton.Width", 10);
+	_butW = g_gui.xmlEval()->getVar("Globals.TabWidget.NavButton.Width", 10);
 	_butH = g_gui.xmlEval()->getVar("Globals.TabWidget.NavButton.Height", 10);
 
 	// If widgets were added or removed in the current tab, without tabs
@@ -375,7 +375,7 @@ Widget *TabWidget::findWidget(int x, int y) {
 void TabWidget::computeLastVisibleTab(bool adjustFirstIfRoom) {
 	int availableWidth = _w;
 	if (_navButtonsVisible)
-		availableWidth -= 2 + _butW * 2;
+		availableWidth -= 2 + _butW * 2 + _butRP;
 
 	_lastVisibleTab = _tabs.size() - 1;
 	for (int i = _firstVisibleTab; i < (int)_tabs.size(); ++i) {





More information about the Scummvm-git-logs mailing list