[Scummvm-cvs-logs] SF.net SVN: scummvm:[49266] scummvm/trunk/gui/about.cpp
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Thu May 27 21:34:13 CEST 2010
Revision: 49266
http://scummvm.svn.sourceforge.net/scummvm/?rev=49266&view=rev
Author: fingolfin
Date: 2010-05-27 19:34:12 +0000 (Thu, 27 May 2010)
Log Message:
-----------
GUI: Reduce code duplication in about dialog
Modified Paths:
--------------
scummvm/trunk/gui/about.cpp
Modified: scummvm/trunk/gui/about.cpp
===================================================================
--- scummvm/trunk/gui/about.cpp 2010-05-27 17:47:32 UTC (rev 49265)
+++ scummvm/trunk/gui/about.cpp 2010-05-27 19:34:12 UTC (rev 49266)
@@ -83,29 +83,6 @@
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 @@
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::reflowLayout() {
Dialog::reflowLayout();
+ int i;
const int screenW = g_system->getOverlayWidth();
const int screenH = g_system->getOverlayHeight();
@@ -309,7 +283,7 @@
// 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 @@
}
_w += 2*_xOff;
- _lineHeight = g_gui.getFontHeight() + 3;
-
+ // Center the dialog
_x = (screenW - _w) / 2;
_y = (screenH - _h) / 2;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list