[Scummvm-git-logs] scummvm master -> cf1c0926174a3e4f732ed609d6ed1a49981bcf16
bgK
bastien.bouclet at gmail.com
Sun Jan 12 11:30:41 UTC 2020
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0aa3d6deb0 GUI: Ignore the padding of imported layouts
f7770f821d GUI: Don't draw the checkbox widget text when there is not enough room
cf1c092617 GUI: Prevent layouts from giving negative dimensions to widgets
Commit: 0aa3d6deb051eb4987a16daa5733f27d92087637
https://github.com/scummvm/scummvm/commit/0aa3d6deb051eb4987a16daa5733f27d92087637
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2020-01-12T12:29:37+01:00
Commit Message:
GUI: Ignore the padding of imported layouts
Fixes the widgets in the volume tab in the edit game dialog having
inconsistent spacing with the other tabs.
Changed paths:
gui/ThemeLayout.cpp
diff --git a/gui/ThemeLayout.cpp b/gui/ThemeLayout.cpp
index 618ecdc..dd69708 100644
--- a/gui/ThemeLayout.cpp
+++ b/gui/ThemeLayout.cpp
@@ -48,7 +48,16 @@ void ThemeLayout::importLayout(ThemeLayout *layout) {
for (uint i = 0; i < layout->_children.size(); ++i)
_children.push_back(layout->_children[i]->makeClone(this));
} else {
- _children.push_back(layout->makeClone(this));
+ ThemeLayout *clone = layout->makeClone(this);
+
+ // When importing a layout into a layout of the same type, the children
+ // of the imported layout are copied over, ignoring the padding of the
+ // imported layout. Here when importing a layout of a different type
+ // into a layout we explicitly ignore the padding so the appearance
+ // is the same in both cases.
+ clone->setPadding(0, 0, 0, 0);
+
+ _children.push_back(clone);
}
}
Commit: f7770f821da588cfe00808eb2f5efad490093d07
https://github.com/scummvm/scummvm/commit/f7770f821da588cfe00808eb2f5efad490093d07
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2020-01-12T12:29:37+01:00
Commit Message:
GUI: Don't draw the checkbox widget text when there is not enough room
Fixes a crash in the edit game dialog volume tab with the Greek
translation.
Changed paths:
gui/ThemeEngine.cpp
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 9f28547..06abdcd 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1001,8 +1001,10 @@ void ThemeEngine::drawCheckbox(const Common::Rect &r, const Common::String &str,
r2.left = r2.right + checkBoxSize;
r2.right = r.right;
- drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[kDDCheckboxDefault]->_textAlignH,
- _widgets[dd]->_textAlignV);
+ if (r2.right > r2.left) {
+ drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[kDDCheckboxDefault]->_textAlignH,
+ _widgets[dd]->_textAlignV);
+ }
}
void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state) {
Commit: cf1c0926174a3e4f732ed609d6ed1a49981bcf16
https://github.com/scummvm/scummvm/commit/cf1c0926174a3e4f732ed609d6ed1a49981bcf16
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2020-01-12T12:29:37+01:00
Commit Message:
GUI: Prevent layouts from giving negative dimensions to widgets
When there is not enough room to layout the widgets, dimensions are now
clipped to zero intead of going negative.
Changed paths:
gui/ThemeLayout.cpp
diff --git a/gui/ThemeLayout.cpp b/gui/ThemeLayout.cpp
index dd69708..fa432bd 100644
--- a/gui/ThemeLayout.cpp
+++ b/gui/ThemeLayout.cpp
@@ -272,8 +272,10 @@ void ThemeLayoutStacked::reflowLayoutVertical(Widget *widgetChain) {
_children[i]->reflowLayout(widgetChain);
- if (_children[i]->getWidth() == -1)
- _children[i]->setWidth((_w == -1 ? getParentWidth() : _w) - _padding.left - _padding.right);
+ if (_children[i]->getWidth() == -1) {
+ int16 width = (_w == -1 ? getParentWidth() : _w) - _padding.left - _padding.right;
+ _children[i]->setWidth(MAX<int16>(width, 0));
+ }
if (_children[i]->getHeight() == -1) {
assert(rescount < ARRAYSIZE(resize));
@@ -333,6 +335,7 @@ void ThemeLayoutStacked::reflowLayoutVertical(Widget *widgetChain) {
// then distributing this equally over all items which need auto-resizing.
if (rescount) {
int newh = (getParentHeight() - _h - _padding.bottom) / rescount;
+ if (newh < 0) newh = 0; // In case there is no room left, avoid giving a negative height to widgets
for (int i = 0; i < rescount; ++i) {
// Set the height of the item.
@@ -360,8 +363,10 @@ void ThemeLayoutStacked::reflowLayoutHorizontal(Widget *widgetChain) {
_children[i]->reflowLayout(widgetChain);
- if (_children[i]->getHeight() == -1)
- _children[i]->setHeight((_h == -1 ? getParentHeight() : _h) - _padding.top - _padding.bottom);
+ if (_children[i]->getHeight() == -1) {
+ int16 height = (_h == -1 ? getParentHeight() : _h) - _padding.top - _padding.bottom;
+ _children[i]->setHeight(MAX<int16>(height, 0));
+ }
if (_children[i]->getWidth() == -1) {
assert(rescount < ARRAYSIZE(resize));
@@ -421,6 +426,7 @@ void ThemeLayoutStacked::reflowLayoutHorizontal(Widget *widgetChain) {
// then distributing this equally over all items which need auto-resizing.
if (rescount) {
int neww = (getParentWidth() - _w - _padding.right) / rescount;
+ if (neww < 0) neww = 0; // In case there is no room left, avoid giving a negative width to widgets
for (int i = 0; i < rescount; ++i) {
// Set the width of the item.
More information about the Scummvm-git-logs
mailing list