From 559c19e9f4aa22ab37cbc4af29ea1dae28dd42a4 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Sun, 10 Aug 2008 18:26:14 +0000 Subject: Bugfix: Inverse layout reflowing. Bugfix: Glitches with several layouts when using Aspect Ratio Correction. svn-id: r33764 --- engines/scumm/dialogs.cpp | 33 ++++++++++++++++----------------- gui/ThemeEval.cpp | 10 ++++++++-- gui/ThemeEval.h | 2 +- gui/ThemeRenderer.cpp | 8 ++++---- gui/themes/scummodern.stx | 27 ++++++++++++++++++++++++++- gui/themes/scummodern.zip | Bin 30075 -> 109834 bytes 6 files changed, 55 insertions(+), 25 deletions(-) diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp index bdb7118f56..559ad6e69e 100644 --- a/engines/scumm/dialogs.cpp +++ b/engines/scumm/dialogs.cpp @@ -318,7 +318,7 @@ void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 da } void SaveLoadChooser::reflowLayout() { - if (g_gui.evaluator()->getVar("scummsaveload_extinfo.visible") == 1) { + if (g_gui.xmlEval()->getVar("ScummSaveLoad.ExtInfo.Visible", 1) == 1) { int16 x, y; uint16 w, h; @@ -644,16 +644,16 @@ enum { }; HelpDialog::HelpDialog(const GameSettings &game) - : ScummDialog("scummhelp"), _game(game) { - _title = new StaticTextWidget(this, "scummhelp_title", ""); + : ScummDialog("ScummHelp"), _game(game) { + _title = new StaticTextWidget(this, "ScummHelp.Title", ""); _page = 1; _numPages = ScummHelp::numPages(_game.id); - _prevButton = new GUI::ButtonWidget(this, "scummhelp_prev", "Previous", kPrevCmd, 'P'); - _nextButton = new GUI::ButtonWidget(this, "scummhelp_next", "Next", kNextCmd, 'N'); - new GUI::ButtonWidget(this, "scummhelp_close", "Close", kCloseCmd, 'C'); + _prevButton = new GUI::ButtonWidget(this, "ScummHelp.Prev", "Previous", kPrevCmd, 'P'); + _nextButton = new GUI::ButtonWidget(this, "ScummHelp.Next", "Next", kNextCmd, 'N'); + new GUI::ButtonWidget(this, "ScummHelp.Close", "Close", kCloseCmd, 'C'); _prevButton->clearFlags(WIDGET_ENABLED); // Dummy entries @@ -670,19 +670,18 @@ void HelpDialog::reflowLayout() { _drawingHints &= ~GUI::THEME_HINT_SPECIAL_COLOR; int lineHeight = g_gui.getFontHeight(); - - int keyX = g_gui.evaluator()->getVar("scummhelp_key.x"); - int keyYoff = g_gui.evaluator()->getVar("scummhelp_key.yoffset"); - int keyW = g_gui.evaluator()->getVar("scummhelp_key.w"); - int keyH = g_gui.evaluator()->getVar("scummhelp_key.h"); - int dscX = g_gui.evaluator()->getVar("scummhelp_dsc.x"); - int dscYoff = g_gui.evaluator()->getVar("scummhelp_dsc.yoffset"); - int dscW = g_gui.evaluator()->getVar("scummhelp_dsc.w"); - int dscH = g_gui.evaluator()->getVar("scummhelp_dsc.h"); + int16 x, y; + uint16 w, h; + + g_gui.xmlEval()->getWidgetData("ScummHelp.HelpText", x, y, w, h); + + int keyW = w * 20 / 100; + int dscX = x + keyW; + int dscW = w * 80 / 100; for (int i = 0; i < HELP_NUM_LINES; i++) { - _key[i]->resize(keyX, keyYoff + lineHeight * (i + 2), keyW, keyH); - _dsc[i]->resize(dscX, dscYoff + lineHeight * (i + 2), dscW, dscH); + _key[i]->resize(x, y + lineHeight * i, keyW, lineHeight + 2); + _dsc[i]->resize(dscX, y + lineHeight * i, dscW, lineHeight + 2); } displayKeyBindings(); diff --git a/gui/ThemeEval.cpp b/gui/ThemeEval.cpp index ec866cc626..ab9e726b75 100644 --- a/gui/ThemeEval.cpp +++ b/gui/ThemeEval.cpp @@ -124,8 +124,11 @@ void ThemeLayoutVertical::reflowLayout() { if (autoWidget != -1 && autoWidget != (int)i) { _children[autoWidget]->setHeight(_children[autoWidget]->getHeight() - (_children[i]->getHeight() + _spacing)); - for (int j = autoWidget - 1; j >= 0; --j) + + if (_reverse) for (int j = autoWidget - 1; j >= 0; --j) _children[j]->setY(-(_children[i]->getHeight() + _spacing)); + else + _children[i]->setY(-2 * (_children[i]->getHeight() + _spacing)); } else { _h += _children[i]->getHeight() + _spacing; } @@ -172,8 +175,11 @@ void ThemeLayoutHorizontal::reflowLayout() { if (autoWidget != -1 && autoWidget != (int)i) { _children[autoWidget]->setWidth(_children[autoWidget]->getWidth() - (_children[i]->getWidth() + _spacing)); - for (int j = autoWidget - 1; j >= 0; --j) + + if (_reverse) for (int j = autoWidget - 1; j >= 0; --j) _children[j]->setX(-(_children[i]->getWidth() + _spacing)); + else + _children[i]->setX(-2 * (_children[i]->getWidth() + _spacing)); } else { _w += _children[i]->getWidth() + _spacing; } diff --git a/gui/ThemeEval.h b/gui/ThemeEval.h index eecd2db3ee..aaab4cb2bf 100644 --- a/gui/ThemeEval.h +++ b/gui/ThemeEval.h @@ -377,7 +377,7 @@ public: } void debugDraw(Graphics::Surface *screen, const Graphics::Font *font) { - _layouts["Dialog.Browser"]->debugDraw(screen, font); + _layouts["Dialog.Launcher"]->debugDraw(screen, font); // _layouts["Dialog.GameOptions_Graphics"]->debugDraw(screen, font); } diff --git a/gui/ThemeRenderer.cpp b/gui/ThemeRenderer.cpp index 73043063a5..1c3a1af8cf 100644 --- a/gui/ThemeRenderer.cpp +++ b/gui/ThemeRenderer.cpp @@ -866,11 +866,11 @@ void ThemeRenderer::updateScreen() { _textQueue.clear(); } - renderDirtyScreen(); +// renderDirtyScreen(); - // _vectorRenderer->fillSurface(); - // themeEval()->debugDraw(_screen, _font); - // _vectorRenderer->copyWholeFrame(_system); + _vectorRenderer->fillSurface(); + themeEval()->debugDraw(_screen, _font); + _vectorRenderer->copyWholeFrame(_system); } void ThemeRenderer::renderDirtyScreen() { diff --git a/gui/themes/scummodern.stx b/gui/themes/scummodern.stx index 965008a6e8..d3df1865ca 100644 --- a/gui/themes/scummodern.stx +++ b/gui/themes/scummodern.stx @@ -483,6 +483,8 @@ + + - + + + + + + + + + + + + + + \ No newline at end of file diff --git a/gui/themes/scummodern.zip b/gui/themes/scummodern.zip index 2a6f268eb9..e9280529f1 100644 Binary files a/gui/themes/scummodern.zip and b/gui/themes/scummodern.zip differ -- cgit v1.2.3