diff options
author | Max Horn | 2010-05-27 19:34:12 +0000 |
---|---|---|
committer | Max Horn | 2010-05-27 19:34:12 +0000 |
commit | a03b5a3434a274447deaa9963ca6df87ee213059 (patch) | |
tree | 79ed264fc08b8bf6ac45785a7f07ca8a051ef890 | |
parent | a32b7b38518dd662304a2645bfe4288b18522183 (diff) | |
download | scummvm-rg350-a03b5a3434a274447deaa9963ca6df87ee213059.tar.gz scummvm-rg350-a03b5a3434a274447deaa9963ca6df87ee213059.tar.bz2 scummvm-rg350-a03b5a3434a274447deaa9963ca6df87ee213059.zip |
GUI: Reduce code duplication in about dialog
svn-id: r49266
-rw-r--r-- | gui/about.cpp | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/gui/about.cpp b/gui/about.cpp index 74851caf94..6f0f0f8d4a 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -83,29 +83,6 @@ AboutDialog::AboutDialog() int i; - const int screenW = g_system->getOverlayWidth(); - const int screenH = g_system->getOverlayHeight(); - - _xOff = g_gui.xmlEval()->getVar("Globals.About.XOffset", 5); - _yOff = g_gui.xmlEval()->getVar("Globals.About.YOffset", 5); - int outerBorder = g_gui.xmlEval()->getVar("Globals.About.OuterBorder"); - - _w = screenW - 2 * outerBorder; - _h = screenH - 2 * outerBorder; - - _lineHeight = g_gui.getFontHeight() + 3; - - // 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; - } - } - _w += 2*_xOff; - for (i = 0; i < 1; i++) _lines.push_back(""); @@ -151,10 +128,6 @@ AboutDialog::AboutDialog() for (i = 0; i < ARRAYSIZE(credits); i++) addLine(credits[i]); - - // Center the dialog - _x = (screenW - _w) / 2; - _y = (screenH - _h) / 2; } void AboutDialog::addLine(const char *str) { @@ -294,6 +267,7 @@ void AboutDialog::handleKeyUp(Common::KeyState state) { void AboutDialog::reflowLayout() { Dialog::reflowLayout(); + int i; const int screenW = g_system->getOverlayWidth(); const int screenH = g_system->getOverlayHeight(); @@ -309,7 +283,7 @@ void AboutDialog::reflowLayout() { // Heuristic to compute 'optimal' dialog width int maxW = _w - 2*_xOff; _w = 0; - for (int i = 0; i < ARRAYSIZE(credits); i++) { + for (i = 0; i < ARRAYSIZE(credits); i++) { int tmp = g_gui.getStringWidth(credits[i] + 5); if (_w < tmp && tmp <= maxW) { _w = tmp; @@ -317,8 +291,7 @@ void AboutDialog::reflowLayout() { } _w += 2*_xOff; - _lineHeight = g_gui.getFontHeight() + 3; - + // Center the dialog _x = (screenW - _w) / 2; _y = (screenH - _h) / 2; } |