[Scummvm-git-logs] scummvm master -> ff93dafae53707e65f36697fe0fa524bb5273ed0
sev-
noreply at scummvm.org
Wed Apr 8 20:02:20 UTC 2026
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
07d14672fc GUI: Add a scrollbar in about dialog
75657ecf1c GUI: Add a close button in about dialog
0d08a7d6b0 GUI: Add mouse drag scrolling in about dialog
fabb473963 GUI: Close about dialog only on Esc key press
ff93dafae5 GUI: Use a rectangle to mimic a viewport in About Dialog
Commit: 07d14672fc71e8b383be46c8868ecdb4b7957092
https://github.com/scummvm/scummvm/commit/07d14672fc71e8b383be46c8868ecdb4b7957092
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-04-08T22:02:13+02:00
Commit Message:
GUI: Add a scrollbar in about dialog
Changed paths:
gui/about.cpp
gui/about.h
diff --git a/gui/about.cpp b/gui/about.cpp
index 3911ed1568a..a16ec378a21 100644
--- a/gui/about.cpp
+++ b/gui/about.cpp
@@ -31,6 +31,7 @@
#include "gui/about.h"
#include "gui/gui-manager.h"
#include "gui/ThemeEval.h"
+#include "gui/widgets/scrollbar.h"
namespace GUI {
@@ -86,9 +87,14 @@ static const char *const gpl_text[] = {
AboutDialog::AboutDialog(bool inGame)
: Dialog(10, 20, 300, 174),
- _scrollPos(0), _scrollTime(0), _willClose(false), _autoScroll(true) {
+ _scrollPos(0), _scrollTime(0), _willClose(false), _autoScroll(true), _inGame(inGame) {
+ _scrollbar = nullptr;
reflowLayout();
+}
+
+void AboutDialog::buildLines() {
+ _lines.clear();
int i;
@@ -160,9 +166,9 @@ AboutDialog::AboutDialog(bool inGame)
uint32 beginTime = g_system->getMillis(true);
#if defined(UNCACHED_PLUGINS) && defined(DYNAMIC_MODULES) && !defined(DETECTION_STATIC)
// Unload all MetaEnginesDetection if we're using uncached plugins to save extra memory.
- if (!inGame) PluginMan.unloadDetectionPlugin();
+ if (!_inGame) PluginMan.unloadDetectionPlugin();
#endif
- if (!inGame) PluginMan.loadFirstPlugin();
+ if (!_inGame) PluginMan.loadFirstPlugin();
do {
uint32 currentTime = g_system->getMillis(true);
if (currentTime - beginTime > 1500) {
@@ -174,9 +180,9 @@ AboutDialog::AboutDialog(bool inGame)
for (const auto &plugin : plugins) {
enginesDetected.push_back(plugin->getName());
}
- } while (!inGame && PluginMan.loadNextPlugin());
+ } while (!_inGame && PluginMan.loadNextPlugin());
- if (!inGame) PluginMan.loadDetectionPlugin();
+ if (!_inGame) PluginMan.loadDetectionPlugin();
for (auto &engine : enginesDetected) {
Common::String str;
@@ -184,7 +190,7 @@ AboutDialog::AboutDialog(bool inGame)
const Plugin *p = EngineMan.findDetectionPlugin(engine);
if (!p) {
- if (!inGame) warning("Cannot find plugin for %s", engine.c_str());
+ if (!_inGame) warning("Cannot find plugin for %s", engine.c_str());
continue;
}
@@ -205,6 +211,13 @@ AboutDialog::AboutDialog(bool inGame)
for (i = 0; i < ARRAYSIZE(credits); i++)
addLine(Common::U32String(credits[i], Common::kUtf8));
+
+ if (_scrollbar) {
+ _scrollbar->_numEntries = _lines.size() * _lineHeight;
+ _scrollbar->_entriesPerPage = _h;
+ _scrollbar->_singleStep = _lineHeight;
+ _scrollbar->recalc();
+ }
}
void AboutDialog::addLine(const Common::U32String &str) {
@@ -217,7 +230,8 @@ void AboutDialog::addLine(const Common::U32String &str) {
Common::U32String renderStr(strBeginItr, str.end());
Common::U32StringArray wrappedLines;
- g_gui.getFont().wordWrapText(renderStr, _w - 2 * _xOff, wrappedLines);
+ int scrollbarWidth = _scrollbar ? _scrollbar->getWidth() : 0;
+ g_gui.getFont().wordWrapText(renderStr, _w - 2 * _xOff - scrollbarWidth, wrappedLines);
for (const auto &line : wrappedLines) {
_lines.push_back(format + line);
@@ -252,6 +266,8 @@ void AboutDialog::drawDialog(DrawLayer layerToDraw) {
const int lastLine = MIN((_scrollPos + _h) / _lineHeight + 1, (uint32)_lines.size());
int y = _y + _yOff - (_scrollPos % _lineHeight);
+ int scrollbarWidth = _scrollbar ? _scrollbar->getWidth() : 0;
+
for (int line = firstLine; line < lastLine; line++) {
Common::U32String str = _lines[line];
Common::U32String::const_iterator strLineItrBegin = _lines[line].begin();
@@ -304,7 +320,7 @@ void AboutDialog::drawDialog(DrawLayer layerToDraw) {
Common::U32String renderStr(strLineItrBegin, strLineItrEnd);
if (!renderStr.empty())
- g_gui.theme()->drawText(Common::Rect(_x + _xOff, y, _x + _w - _xOff, y + g_gui.theme()->getFontHeight()),
+ g_gui.theme()->drawText(Common::Rect(_x + _xOff, y, _x + _w - _xOff - scrollbarWidth, y + g_gui.theme()->getFontHeight()),
renderStr, state, align, ThemeEngine::kTextInversionNone, 0, false,
ThemeEngine::kFontStyleBold, ThemeEngine::kFontColorNormal, true, _textDrawableArea);
y += _lineHeight;
@@ -332,6 +348,10 @@ void AboutDialog::handleTickle() {
_scrollPos = 0;
_scrollTime += kScrollStartDelay;
}
+ if (_scrollbar) {
+ _scrollbar->_currentPos = _scrollPos;
+ _scrollbar->recalc();
+ }
drawDialog(kDrawLayerForeground);
}
}
@@ -356,9 +376,23 @@ void AboutDialog::handleMouseWheel(int x, int y, int direction) {
} else if ((uint32)newScrollPos < _lines.size() * _lineHeight) {
_scrollPos = newScrollPos;
}
+
+ if (_scrollbar) {
+ _scrollbar->_currentPos = _scrollPos;
+ _scrollbar->recalc();
+ }
+
drawDialog(kDrawLayerForeground);
}
+void AboutDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
+ if (cmd == kSetPositionCmd) {
+ _scrollPos = data;
+ _autoScroll = false;
+ drawDialog(kDrawLayerForeground);
+ }
+}
+
void AboutDialog::handleKeyDown(Common::KeyState state) {
EEHandler eeHandler;
@@ -395,20 +429,30 @@ void AboutDialog::reflowLayout() {
// Heuristic to compute 'optimal' dialog width
int maxW = _w - 2*_xOff;
_w = 0;
- for (i = 0; i < ARRAYSIZE(credits); i++) {
- int tmp = g_gui.getStringWidth(credits[i]) + 5;
- if (_w < tmp && tmp <= maxW) {
- _w = tmp;
+ for (i = 0; i < ARRAYSIZE(credits); i++) {
+ int tmp = g_gui.getStringWidth(credits[i]) + 5;
+ if (_w < tmp && tmp <= maxW) {
+ _w = tmp;
+ }
}
- }
_w += 2*_xOff;
+ int scrollbarWidth = g_gui.xmlEval()->getVar("Globals.Scrollbar.Width", 16);
+ if (!_scrollbar)
+ _scrollbar = new ScrollBarWidget(this, _w - scrollbarWidth, 0, scrollbarWidth, _h);
+ else {
+ _scrollbar->setPos(_w - scrollbarWidth, 0);
+ _scrollbar->setSize(scrollbarWidth, _h);
+ }
+
// Center the dialog in the screen
_x = (screenW - _w) / 2;
_y = (screenH - _h) / 2;
// Make it fit in the safe area
screenArea.constrain(_x, _y, _w, _h);
+
+ buildLines();
}
diff --git a/gui/about.h b/gui/about.h
index 00215cb88a8..70087a5e783 100644
--- a/gui/about.h
+++ b/gui/about.h
@@ -31,6 +31,7 @@
namespace GUI {
class EEHandler;
+class ScrollBarWidget;
class AboutDialog : public Dialog {
protected:
@@ -42,8 +43,12 @@ protected:
bool _autoScroll;
int _xOff, _yOff;
+ bool _inGame;
+
+ ScrollBarWidget *_scrollbar;
void addLine(const Common::U32String &str);
+ void buildLines();
EEHandler *_eeHandler;
@@ -54,10 +59,12 @@ public:
void close() override;
void drawDialog(DrawLayer layerToDraw) override;
void handleTickle() override;
+ void handleMouseDown(int x, int y, int button, int clickCount) override;
void handleMouseUp(int x, int y, int button, int clickCount) override;
void handleMouseWheel(int x, int y, int direction) override;
void handleKeyDown(Common::KeyState state) override;
void handleKeyUp(Common::KeyState state) override;
+ void handleCommand(CommandSender *sender, uint32 cmd, uint32 data) override;
void reflowLayout() override;
};
Commit: 75657ecf1c8455286bcf5e3db3d5c8035a212be7
https://github.com/scummvm/scummvm/commit/75657ecf1c8455286bcf5e3db3d5c8035a212be7
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-04-08T22:02:13+02:00
Commit Message:
GUI: Add a close button in about dialog
Add a dedicated close button and disable closing the dialog on click anywhere
Changed paths:
gui/about.cpp
gui/about.h
diff --git a/gui/about.cpp b/gui/about.cpp
index a16ec378a21..31ea8f79d5f 100644
--- a/gui/about.cpp
+++ b/gui/about.cpp
@@ -32,6 +32,7 @@
#include "gui/gui-manager.h"
#include "gui/ThemeEval.h"
#include "gui/widgets/scrollbar.h"
+#include "gui/widget.h"
namespace GUI {
@@ -90,6 +91,7 @@ AboutDialog::AboutDialog(bool inGame)
_scrollPos(0), _scrollTime(0), _willClose(false), _autoScroll(true), _inGame(inGame) {
_scrollbar = nullptr;
+ _closeButton = nullptr;
reflowLayout();
}
@@ -214,7 +216,8 @@ void AboutDialog::buildLines() {
if (_scrollbar) {
_scrollbar->_numEntries = _lines.size() * _lineHeight;
- _scrollbar->_entriesPerPage = _h;
+ int buttonHeight = g_gui.xmlEval()->getVar("Globals.Button.Height", 24);
+ _scrollbar->_entriesPerPage = _h - buttonHeight - 8 - 3 * _yOff;
_scrollbar->_singleStep = _lineHeight;
_scrollbar->recalc();
}
@@ -255,7 +258,8 @@ void AboutDialog::close() {
void AboutDialog::drawDialog(DrawLayer layerToDraw) {
Dialog::drawDialog(layerToDraw);
- setTextDrawableArea(Common::Rect(_x, _y, _x + _w, _y + _h));
+ int buttonHeight = g_gui.xmlEval()->getVar("Globals.Button.Height", 24);
+ setTextDrawableArea(Common::Rect(_x, _y, _x + _w, _y + _h - buttonHeight - 20));
// Draw text
// TODO: Add a "fade" effect for the top/bottom text lines
@@ -263,7 +267,7 @@ void AboutDialog::drawDialog(DrawLayer layerToDraw) {
// and then simply compose that over the screen surface
// in the right way. Should be even faster...
const int firstLine = _scrollPos / _lineHeight;
- const int lastLine = MIN((_scrollPos + _h) / _lineHeight + 1, (uint32)_lines.size());
+ const int lastLine = MIN((_scrollPos + (_h - buttonHeight - 20 - _yOff)) / _lineHeight + 1, (uint32)_lines.size());
int y = _y + _yOff - (_scrollPos % _lineHeight);
int scrollbarWidth = _scrollbar ? _scrollbar->getWidth() : 0;
@@ -357,8 +361,7 @@ void AboutDialog::handleTickle() {
}
void AboutDialog::handleMouseUp(int x, int y, int button, int clickCount) {
- // Close upon any mouse click
- close();
+ Dialog::handleMouseUp(x, y, button, clickCount);
}
void AboutDialog::handleMouseWheel(int x, int y, int direction) {
@@ -390,6 +393,8 @@ void AboutDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data)
_scrollPos = data;
_autoScroll = false;
drawDialog(kDrawLayerForeground);
+ } else if (cmd == kCloseCmd) {
+ close();
}
}
@@ -426,23 +431,35 @@ void AboutDialog::reflowLayout() {
_lineHeight = g_gui.getFontHeight() + 3;
+ int scrollbarWidth = g_gui.xmlEval()->getVar("Globals.Scrollbar.Width", 15);
+ int buttonHeight = g_gui.xmlEval()->getVar("Globals.Button.Height", 24);
+ int buttonWidth = g_gui.xmlEval()->getVar("Globals.Button.Width", 80);
+
// Heuristic to compute 'optimal' dialog width
- int maxW = _w - 2*_xOff;
- _w = 0;
- for (i = 0; i < ARRAYSIZE(credits); i++) {
+ int maxW = _w - 2 * _xOff - scrollbarWidth - 10;
+ int optimalW = 0;
+ for (i = 0; i < ARRAYSIZE(credits); i++) {
int tmp = g_gui.getStringWidth(credits[i]) + 5;
- if (_w < tmp && tmp <= maxW) {
- _w = tmp;
- }
- }
- _w += 2*_xOff;
+ if (optimalW < tmp && tmp <= maxW)
+ optimalW = tmp;
+ }
+ _w = optimalW + 2 * _xOff + scrollbarWidth + 20;
+
+ // Make sure it's not wider than max width
+ _w = MIN<uint16>(_w, screenArea.width() - 2 * outerBorder);
- int scrollbarWidth = g_gui.xmlEval()->getVar("Globals.Scrollbar.Width", 16);
if (!_scrollbar)
- _scrollbar = new ScrollBarWidget(this, _w - scrollbarWidth, 0, scrollbarWidth, _h);
+ _scrollbar = new ScrollBarWidget(this, _w - scrollbarWidth - _xOff, _yOff, scrollbarWidth, _h - buttonHeight - 8 - 3 * _yOff);
+ else {
+ _scrollbar->setPos(_w - scrollbarWidth - _xOff, _yOff);
+ _scrollbar->setSize(scrollbarWidth, _h - buttonHeight - 8 - 3 * _yOff);
+ }
+
+ if (!_closeButton)
+ _closeButton = new ButtonWidget(this, _w - buttonWidth - 16 - _xOff, _h - buttonHeight - 2 * _yOff, buttonWidth, buttonHeight, _("Close"), Common::U32String(), kCloseCmd);
else {
- _scrollbar->setPos(_w - scrollbarWidth, 0);
- _scrollbar->setSize(scrollbarWidth, _h);
+ _closeButton->setPos(_w - buttonWidth - 16 - _xOff, _h - buttonHeight - 2 * _yOff);
+ _closeButton->setSize(buttonWidth, buttonHeight);
}
// Center the dialog in the screen
diff --git a/gui/about.h b/gui/about.h
index 70087a5e783..dcd62693860 100644
--- a/gui/about.h
+++ b/gui/about.h
@@ -32,6 +32,7 @@ namespace GUI {
class EEHandler;
class ScrollBarWidget;
+class ButtonWidget;
class AboutDialog : public Dialog {
protected:
@@ -46,6 +47,7 @@ protected:
bool _inGame;
ScrollBarWidget *_scrollbar;
+ ButtonWidget *_closeButton;
void addLine(const Common::U32String &str);
void buildLines();
Commit: 0d08a7d6b0c84ab0ec506de92e648ffcb7955758
https://github.com/scummvm/scummvm/commit/0d08a7d6b0c84ab0ec506de92e648ffcb7955758
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-04-08T22:02:13+02:00
Commit Message:
GUI: Add mouse drag scrolling in about dialog
Changed paths:
gui/about.cpp
gui/about.h
diff --git a/gui/about.cpp b/gui/about.cpp
index 31ea8f79d5f..1b8bd5cefaf 100644
--- a/gui/about.cpp
+++ b/gui/about.cpp
@@ -88,7 +88,8 @@ static const char *const gpl_text[] = {
AboutDialog::AboutDialog(bool inGame)
: Dialog(10, 20, 300, 174),
- _scrollPos(0), _scrollTime(0), _willClose(false), _autoScroll(true), _inGame(inGame) {
+ _scrollPos(0), _scrollTime(0), _willClose(false), _autoScroll(true), _inGame(inGame),
+ _isDragging(false), _dragLastY(0) {
_scrollbar = nullptr;
_closeButton = nullptr;
@@ -361,9 +362,48 @@ void AboutDialog::handleTickle() {
}
void AboutDialog::handleMouseUp(int x, int y, int button, int clickCount) {
+ _isDragging = false;
Dialog::handleMouseUp(x, y, button, clickCount);
}
+void AboutDialog::handleMouseDown(int x, int y, int button, int clickCount) {
+ if (button == 1 && !findWidget(x, y)) {
+ _isDragging = true;
+ _dragLastY = y;
+ }
+ Dialog::handleMouseDown(x, y, button, clickCount);
+}
+
+void AboutDialog::handleMouseMoved(int x, int y, int button) {
+ if (_isDragging) {
+ int deltaY = _dragLastY - y;
+ _dragLastY = y;
+
+ if (deltaY != 0) {
+ _autoScroll = false;
+ int buttonHeight = g_gui.xmlEval()->getVar("Globals.Button.Height", 24);
+ int visibleHeight = _scrollbar ? _scrollbar->_entriesPerPage : (_h - buttonHeight - 20 - _yOff);
+ int maxScroll = MAX(0, (int)(_lines.size() * _lineHeight) - visibleHeight);
+
+ _scrollPos += deltaY;
+
+ if (_scrollPos < 0)
+ _scrollPos = 0;
+ else if (_scrollPos > maxScroll)
+ _scrollPos = maxScroll;
+
+ if (_scrollbar) {
+ _scrollbar->_currentPos = _scrollPos;
+ _scrollbar->recalc();
+ }
+
+ drawDialog(kDrawLayerForeground);
+ }
+ }
+
+ Dialog::handleMouseMoved(x, y, button);
+}
+
void AboutDialog::handleMouseWheel(int x, int y, int direction) {
const int stepping = 5 * _lineHeight * direction;
@@ -372,13 +412,15 @@ void AboutDialog::handleMouseWheel(int x, int y, int direction) {
_autoScroll = false;
- int newScrollPos = _scrollPos + stepping;
+ int buttonHeight = g_gui.xmlEval()->getVar("Globals.Button.Height", 24);
+ int visibleHeight = _scrollbar ? _scrollbar->_entriesPerPage : (_h - buttonHeight - 20 - _yOff);
+ int maxScroll = MAX(0, (int)(_lines.size() * _lineHeight) - visibleHeight);
- if (newScrollPos < 0) {
+ _scrollPos += stepping;
+ if (_scrollPos < 0)
_scrollPos = 0;
- } else if ((uint32)newScrollPos < _lines.size() * _lineHeight) {
- _scrollPos = newScrollPos;
- }
+ else if (_scrollPos > maxScroll)
+ _scrollPos = maxScroll;
if (_scrollbar) {
_scrollbar->_currentPos = _scrollPos;
diff --git a/gui/about.h b/gui/about.h
index dcd62693860..e477a96211a 100644
--- a/gui/about.h
+++ b/gui/about.h
@@ -45,6 +45,8 @@ protected:
int _xOff, _yOff;
bool _inGame;
+ bool _isDragging;
+ int _dragLastY;
ScrollBarWidget *_scrollbar;
ButtonWidget *_closeButton;
@@ -63,6 +65,7 @@ public:
void handleTickle() override;
void handleMouseDown(int x, int y, int button, int clickCount) override;
void handleMouseUp(int x, int y, int button, int clickCount) override;
+ void handleMouseMoved(int x, int y, int button) override;
void handleMouseWheel(int x, int y, int direction) override;
void handleKeyDown(Common::KeyState state) override;
void handleKeyUp(Common::KeyState state) override;
Commit: fabb473963ed31429fe13a670a4d5d9270cce7bf
https://github.com/scummvm/scummvm/commit/fabb473963ed31429fe13a670a4d5d9270cce7bf
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-04-08T22:02:13+02:00
Commit Message:
GUI: Close about dialog only on Esc key press
Disable the dialog close on any key press except Esc
Changed paths:
gui/about.cpp
diff --git a/gui/about.cpp b/gui/about.cpp
index 1b8bd5cefaf..8f94655f516 100644
--- a/gui/about.cpp
+++ b/gui/about.cpp
@@ -448,12 +448,12 @@ void AboutDialog::handleKeyDown(Common::KeyState state) {
return;
}
- if (state.ascii)
+ if (state.keycode == Common::KEYCODE_ESCAPE)
_willClose = true;
}
void AboutDialog::handleKeyUp(Common::KeyState state) {
- if (state.ascii && _willClose)
+ if (state.keycode == Common::KEYCODE_ESCAPE && _willClose)
close();
}
Commit: ff93dafae53707e65f36697fe0fa524bb5273ed0
https://github.com/scummvm/scummvm/commit/ff93dafae53707e65f36697fe0fa524bb5273ed0
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-04-08T22:02:13+02:00
Commit Message:
GUI: Use a rectangle to mimic a viewport in About Dialog
Restrict About dialog text to a rectangle to mimic a viewport
Changed paths:
gui/about.cpp
gui/about.h
diff --git a/gui/about.cpp b/gui/about.cpp
index 8f94655f516..b7f2b9a98b2 100644
--- a/gui/about.cpp
+++ b/gui/about.cpp
@@ -234,8 +234,8 @@ void AboutDialog::addLine(const Common::U32String &str) {
Common::U32String renderStr(strBeginItr, str.end());
Common::U32StringArray wrappedLines;
- int scrollbarWidth = _scrollbar ? _scrollbar->getWidth() : 0;
- g_gui.getFont().wordWrapText(renderStr, _w - 2 * _xOff - scrollbarWidth, wrappedLines);
+ // Leave some margin inside the rectangle
+ g_gui.getFont().wordWrapText(renderStr, _textRect.width() - 2 * _xOff, wrappedLines);
for (const auto &line : wrappedLines) {
_lines.push_back(format + line);
@@ -259,8 +259,11 @@ void AboutDialog::close() {
void AboutDialog::drawDialog(DrawLayer layerToDraw) {
Dialog::drawDialog(layerToDraw);
- int buttonHeight = g_gui.xmlEval()->getVar("Globals.Button.Height", 24);
- setTextDrawableArea(Common::Rect(_x, _y, _x + _w, _y + _h - buttonHeight - 20));
+ // Draw text inside this rectangle to mimic a viewport
+ Common::Rect r = _textRect;
+ r.translate(_x, _y);
+ g_gui.theme()->drawWidgetBackground(r, ThemeEngine::kWidgetBackgroundBorder);
+ setTextDrawableArea(r);
// Draw text
// TODO: Add a "fade" effect for the top/bottom text lines
@@ -268,10 +271,8 @@ void AboutDialog::drawDialog(DrawLayer layerToDraw) {
// and then simply compose that over the screen surface
// in the right way. Should be even faster...
const int firstLine = _scrollPos / _lineHeight;
- const int lastLine = MIN((_scrollPos + (_h - buttonHeight - 20 - _yOff)) / _lineHeight + 1, (uint32)_lines.size());
- int y = _y + _yOff - (_scrollPos % _lineHeight);
-
- int scrollbarWidth = _scrollbar ? _scrollbar->getWidth() : 0;
+ const int lastLine = MIN((_scrollPos + (_textRect.height())) / _lineHeight + 1, (uint32)_lines.size());
+ int y = _y + _textRect.top - (_scrollPos % _lineHeight);
for (int line = firstLine; line < lastLine; line++) {
Common::U32String str = _lines[line];
@@ -325,9 +326,10 @@ void AboutDialog::drawDialog(DrawLayer layerToDraw) {
Common::U32String renderStr(strLineItrBegin, strLineItrEnd);
if (!renderStr.empty())
- g_gui.theme()->drawText(Common::Rect(_x + _xOff, y, _x + _w - _xOff - scrollbarWidth, y + g_gui.theme()->getFontHeight()),
- renderStr, state, align, ThemeEngine::kTextInversionNone, 0, false,
- ThemeEngine::kFontStyleBold, ThemeEngine::kFontColorNormal, true, _textDrawableArea);
+ // Center the text line within the _textRect
+ g_gui.theme()->drawText(Common::Rect(_x + _textRect.left + _xOff, y, _x + _textRect.right - _xOff, y + g_gui.theme()->getFontHeight()),
+ renderStr, state, align, ThemeEngine::kTextInversionNone, 0, false,
+ ThemeEngine::kFontStyleBold, ThemeEngine::kFontColorNormal, true, _textDrawableArea);
y += _lineHeight;
}
}
@@ -490,6 +492,9 @@ void AboutDialog::reflowLayout() {
// Make sure it's not wider than max width
_w = MIN<uint16>(_w, screenArea.width() - 2 * outerBorder);
+ // Calculate the rectangle for the text area
+ _textRect = Common::Rect(_xOff, _yOff, _w - scrollbarWidth - 3 * _xOff, _h - buttonHeight - 8 - 3 * _yOff);
+
if (!_scrollbar)
_scrollbar = new ScrollBarWidget(this, _w - scrollbarWidth - _xOff, _yOff, scrollbarWidth, _h - buttonHeight - 8 - 3 * _yOff);
else {
diff --git a/gui/about.h b/gui/about.h
index e477a96211a..253a9982b12 100644
--- a/gui/about.h
+++ b/gui/about.h
@@ -50,6 +50,7 @@ protected:
ScrollBarWidget *_scrollbar;
ButtonWidget *_closeButton;
+ Common::Rect _textRect;
void addLine(const Common::U32String &str);
void buildLines();
More information about the Scummvm-git-logs
mailing list