diff options
author | Adrian Frühwirth | 2018-04-30 15:01:45 +0200 |
---|---|---|
committer | Adrian Frühwirth | 2018-04-30 15:01:45 +0200 |
commit | 706bfc671bbd21e9da311c8e47a61c368601ca96 (patch) | |
tree | 9acc1e25ff9cea58786b38bafd7ccd551f38297a | |
parent | 82757deadd58f8f7ab262573f908b6bfacd9bec2 (diff) | |
download | scummvm-rg350-706bfc671bbd21e9da311c8e47a61c368601ca96.tar.gz scummvm-rg350-706bfc671bbd21e9da311c8e47a61c368601ca96.tar.bz2 scummvm-rg350-706bfc671bbd21e9da311c8e47a61c368601ca96.zip |
Revert "ENGINES: Use ScrollContainerWidget in unknown game dialog"
This reverts commit cf529f311f0be1332f6286b95741160e85651441.
-rw-r--r-- | engines/unknown-game-dialog.cpp | 31 | ||||
-rw-r--r-- | engines/unknown-game-dialog.h | 7 |
2 files changed, 8 insertions, 30 deletions
diff --git a/engines/unknown-game-dialog.cpp b/engines/unknown-game-dialog.cpp index c0673f4a03..f737eb1c67 100644 --- a/engines/unknown-game-dialog.cpp +++ b/engines/unknown-game-dialog.cpp @@ -27,14 +27,12 @@ #include "gui/message.h" #include "gui/ThemeEval.h" #include "gui/widgets/popup.h" -#include "gui/widgets/scrollcontainer.h" #include "engines/unknown-game-dialog.h" enum { kCopyToClipboard = 'cpcl', kOpenBugtrackerURL = 'ourl', - kClose = 'clse', - kScrollContainerReflow = 'SCRf' + kClose = 'clse' }; UnknownGameDialog::UnknownGameDialog(const Common::String &reportData, const Common::String &reportTranslated, const Common::String &bugtrackerAffectedEngine) @@ -65,16 +63,11 @@ UnknownGameDialog::UnknownGameDialog(const Common::String &reportData, const Com int buttonHeight = g_gui.xmlEval()->getVar("Globals.Button.Height", 0); //Calculate the size the dialog needs - // We use a ScrollContainer to display the text, with a 2 * 8 pixels margin to the dialog border, - // the scrollbar, and 2 * 10 margin for the text in the container. - // We also keep 2 * 10 pixels between the screen border and the dialog. - int scrollbarWidth = g_gui.xmlEval()->getVar("Globals.Scrollbar.Width", 0); Common::Array<Common::String> lines; - int maxlineWidth = g_gui.getFont().wordWrapText(_reportTranslated, screenW - 2 * 20 - 16 - scrollbarWidth, lines); - + int maxlineWidth = g_gui.getFont().wordWrapText(_reportTranslated, screenW - 2 * 20, lines); int lineCount = lines.size() + 1; - _h = MIN(screenH - 20, lineCount * kLineHeight + kLineHeight + buttonHeight + 24); + _h = 3 * kLineHeight + lineCount * kLineHeight; // Buttons int closeButtonWidth = MAX(buttonWidth, g_gui.getFont().getStringWidth(_("Close")) + 10); @@ -86,7 +79,7 @@ UnknownGameDialog::UnknownGameDialog(const Common::String &reportData, const Com if (g_system->hasFeature(OSystem::kFeatureOpenUrl)) totalButtonWidth += 10 + openBugtrackerURLButtonWidth; - _w = MAX(MAX(maxlineWidth, 0) + 16 + scrollbarWidth, totalButtonWidth) + 20; + _w = MAX(MAX(maxlineWidth, 0), totalButtonWidth) + 20; int buttonPos = _w - closeButtonWidth - 10; new GUI::ButtonWidget(this, buttonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, _("Close"), 0, kClose); @@ -118,14 +111,10 @@ UnknownGameDialog::UnknownGameDialog(const Common::String &reportData, const Com #endif // Each line is represented by one static text item. - // Use a ScrollContainer for the report in case we have a lot of lines. - int containerHeight = _h - kLineHeight - buttonHeight - 8; - GUI::ScrollContainerWidget *container = new GUI::ScrollContainerWidget(this, 8, 8, _w - 16, containerHeight, kScrollContainerReflow); - container->setTarget(this); - uint y = 8; - for (uint i = 0; i < lines.size() ; i++) { - GUI::StaticTextWidget *widget = new GUI::StaticTextWidget(container, 10, y, _w - 36 - scrollbarWidth, kLineHeight, lines[i], Graphics::kTextAlignLeft); - _textWidgets.push_back(widget); + // TODO: Use a ScrollContainer widget instead of truncated text. + uint y = 10; + for (uint i = 0; i < lines.size(); i++) { + new GUI::StaticTextWidget(this, 10, y, _w, kLineHeight, lines[i], Graphics::kTextAlignLeft); y += kLineHeight; } } @@ -163,9 +152,5 @@ void UnknownGameDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, ui case kOpenBugtrackerURL: g_system->openUrl(generateBugtrackerURL()); break; - case kScrollContainerReflow: - for (uint i = 0; i < _textWidgets.size() ; i++) - _textWidgets[i]->setVisible(true); - break; } } diff --git a/engines/unknown-game-dialog.h b/engines/unknown-game-dialog.h index a527339211..51adf27996 100644 --- a/engines/unknown-game-dialog.h +++ b/engines/unknown-game-dialog.h @@ -21,11 +21,6 @@ */ #include "gui/dialog.h" -#include "common/array.h" - -namespace GUI { - class StaticTextWidget; -} class UnknownGameDialog : public GUI::Dialog { public: @@ -39,6 +34,4 @@ private: Common::String _reportTranslated; Common::String _bugtrackerGameData; Common::String _bugtrackerAffectedEngine; - - Common::Array<GUI::StaticTextWidget*> _textWidgets; }; |