[Scummvm-git-logs] scummvm master -> 4869bf078012a7a2f7bd27c5af8dd8d20d844251
sev-
noreply at scummvm.org
Sun Mar 26 12:21:03 UTC 2023
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
b639b65599 MM: MM1: Add missing override keyword
4869bf0780 GUI: Added close button to the TextViewer dialog
Commit: b639b6559992c904de909d37b5ad76c39268d272
https://github.com/scummvm/scummvm/commit/b639b6559992c904de909d37b5ad76c39268d272
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-03-26T14:20:52+02:00
Commit Message:
MM: MM1: Add missing override keyword
Changed paths:
engines/mm/mm1/views_enh/combat.h
diff --git a/engines/mm/mm1/views_enh/combat.h b/engines/mm/mm1/views_enh/combat.h
index d5bf35e5ddb..4dde4ebe1ab 100644
--- a/engines/mm/mm1/views_enh/combat.h
+++ b/engines/mm/mm1/views_enh/combat.h
@@ -58,7 +58,7 @@ private:
void writeCastOption();
void writeShootOption();
- void clearSurface();
+ void clearSurface() override;
void clearBottom();
void clearArea(const Common::Rect &r);
void resetBottom();
Commit: 4869bf078012a7a2f7bd27c5af8dd8d20d844251
https://github.com/scummvm/scummvm/commit/4869bf078012a7a2f7bd27c5af8dd8d20d844251
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-03-26T14:20:52+02:00
Commit Message:
GUI: Added close button to the TextViewer dialog
Changed paths:
gui/textviewer.cpp
gui/textviewer.h
po/POTFILES
diff --git a/gui/textviewer.cpp b/gui/textviewer.cpp
index c3a7b386c1b..30e54c17a98 100644
--- a/gui/textviewer.cpp
+++ b/gui/textviewer.cpp
@@ -21,6 +21,7 @@
#include "common/file.h"
#include "common/tokenizer.h"
+#include "common/translation.h"
#include "graphics/font.h"
#include "graphics/fontman.h"
@@ -45,10 +46,12 @@ TextViewerDialog::TextViewerDialog(Common::String fname)
_lineHeight = _font->getFontHeight() + 2;
// Add scrollbar
- _scrollbarWidth = g_gui.xmlEval()->getVar("Globals.Scrollbar.Width", 0);
- _scrollBar = new ScrollBarWidget(this, _w - _scrollbarWidth - 1, 0, _scrollbarWidth, _h);
+ _scrollBar = new ScrollBarWidget(this, 0, 0, 1, 1);
_scrollBar->setTarget(this);
+ // I18N: Close dialog button
+ _closeButton = new ButtonWidget(this, 0, 0, 1, 1, _("Close"), Common::U32String(), kCloseCmd);
+
_currentPos = 0;
_scrollLine = _linesPerPage - 1;
@@ -107,12 +110,25 @@ void TextViewerDialog::reflowLayout() {
_padX = _w * kPadX;
_padY = _h * kPadY;
+ int16 bW = g_gui.xmlEval()->getVar("Globals.Button.Width", 0);
+ int16 bH = g_gui.xmlEval()->getVar("Globals.Button.Height", 0);
+ int16 padR = g_gui.xmlEval()->getVar("Globals.Padding.Right", 5);
+ int16 padB = g_gui.xmlEval()->getVar("Globals.Padding.Bottom", 5);
+ int16 scrollbarWidth = g_gui.xmlEval()->getVar("Globals.Scrollbar.Width", 0);
+
+ int16 buttonOffset = bH + padB;
+
+ _closeButton->setPos(_w - bW - padR, _h - buttonOffset);
+ _closeButton->setSize(bW, bH);
+
// Calculate depending values
- _lineWidth = (_w - _scrollbarWidth - _padX * 2) / _charWidth;
- _linesPerPage = (_h - _padY * 2) / _lineHeight;
+ _lineWidth = (_w - scrollbarWidth - _padX * 2) / _charWidth;
+ _linesPerPage = (_h - _padY * 2 - buttonOffset) / _lineHeight;
- _scrollBar->setPos(_w - _scrollbarWidth - 1, 0);
- _scrollBar->setSize(_scrollbarWidth, _h);
+ warning("Lines: %d", _linesPerPage);
+
+ _scrollBar->setPos(_w - scrollbarWidth - 1, 0);
+ _scrollBar->setSize(scrollbarWidth, _h - buttonOffset);
}
void TextViewerDialog::open() {
@@ -167,6 +183,9 @@ void TextViewerDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 d
drawDialog(kDrawLayerForeground);
break;
+ case kCloseCmd:
+ close();
+ break;
default:
return;
}
diff --git a/gui/textviewer.h b/gui/textviewer.h
index d12acee8099..250c1a82e1b 100644
--- a/gui/textviewer.h
+++ b/gui/textviewer.h
@@ -42,7 +42,6 @@ private:
int _currentPos;
int _scrollLine;
- int _scrollbarWidth;
int _charWidth;
int _lineHeight;
int _padX, _padY;
@@ -50,6 +49,7 @@ private:
Common::StringArray _linesArray;
ScrollBarWidget *_scrollBar;
+ ButtonWidget *_closeButton;
Common::String _fname;
const Graphics::Font *_font = nullptr;
diff --git a/po/POTFILES b/po/POTFILES
index 34db0183512..94916e3d883 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -19,6 +19,7 @@ gui/recorderdialog.cpp
gui/remotebrowser.cpp
gui/saveload-dialog.cpp
gui/shaderbrowser-dialog.cpp
+gui/textviewer.cpp
gui/themebrowser.cpp
gui/ThemeEngine.cpp
gui/unknown-game-dialog.cpp
More information about the Scummvm-git-logs
mailing list