aboutsummaryrefslogtreecommitdiff
path: root/gui/about.cpp
diff options
context:
space:
mode:
authorThierry Crozat2013-02-04 13:16:38 +0000
committerThierry Crozat2013-02-04 13:17:18 +0000
commita1c3a8c542082ad67f07f226a5647d79c499f5a5 (patch)
tree8a2a10dfcd3986ad4403aa23e109d00e1b3a3f3d /gui/about.cpp
parent091f2e9df835cb688db456570862a327e04be748 (diff)
downloadscummvm-rg350-a1c3a8c542082ad67f07f226a5647d79c499f5a5.tar.gz
scummvm-rg350-a1c3a8c542082ad67f07f226a5647d79c499f5a5.tar.bz2
scummvm-rg350-a1c3a8c542082ad67f07f226a5647d79c499f5a5.zip
CREDITS: Fix display of credits with non ISO-8859-1 charsets
The credits.pl script now prints both the ASCII and ISO-8859-1 strings in the credits.dat file when they are different. The About dialog then chooses either one or the other depending on the current charset used. This fixes bug #3539986
Diffstat (limited to 'gui/about.cpp')
-rw-r--r--gui/about.cpp41
1 files changed, 30 insertions, 11 deletions
diff --git a/gui/about.cpp b/gui/about.cpp
index e2b7064279..088971f273 100644
--- a/gui/about.cpp
+++ b/gui/about.cpp
@@ -37,14 +37,16 @@ enum {
kScrollMillisPerPixel = 60
};
-// The following commands can be put at the start of a line (all subject to change):
-// \C, \L, \R -- set center/left/right alignment
-// \c0 - \c4 -- set a custom color:
-// 0 normal text (green)
-// 1 highlighted text (light green)
-// 2 light border (light gray)
-// 3 dark border (dark gray)
-// 4 background (black)
+// Every Line should start with a letter followed by a digit. Currently those can be
+// (all subject to change)
+// Letter:
+// C, L, R -- set center/left/right alignment
+// A -- ASCII text to replace the next (latin1) line
+// Digit:
+// 0 - 2 -- set a custom color:
+// 0 normal text
+// 1 highlighted text
+// 2 disabled text
// TODO: Maybe add a tab/indent feature; that is, make it possible to specify
// an amount by which that line shall be indented (the indent of course would have
// to be considered while performing any word wrapping, too).
@@ -137,9 +139,26 @@ void AboutDialog::addLine(const char *str) {
} else {
Common::String format(str, 2);
str += 2;
-
+
+ static Common::String asciiStr;
+ if (format[0] == 'A') {
+ bool useAscii = false;
+#ifdef USE_TRANSLATION
+ // We could use TransMan.getCurrentCharset() but rather than compare strings
+ // it is easier to use TransMan.getCharsetMapping() (non null in case of non
+ // ISO-8859-1 mapping)
+ useAscii = (TransMan.getCharsetMapping() != NULL);
+#endif
+ if (useAscii)
+ asciiStr = str;
+ return;
+ }
StringArray wrappedLines;
- g_gui.getFont().wordWrapText(str, _w - 2 * _xOff, wrappedLines);
+ if (!asciiStr.empty()) {
+ g_gui.getFont().wordWrapText(asciiStr, _w - 2 * _xOff, wrappedLines);
+ asciiStr.clear();
+ } else
+ g_gui.getFont().wordWrapText(str, _w - 2 * _xOff, wrappedLines);
for (StringArray::const_iterator i = wrappedLines.begin(); i != wrappedLines.end(); ++i) {
_lines.push_back(format + *i);
@@ -285,7 +304,7 @@ void AboutDialog::reflowLayout() {
int maxW = _w - 2*_xOff;
_w = 0;
for (i = 0; i < ARRAYSIZE(credits); i++) {
- int tmp = g_gui.getStringWidth(credits[i] + 5);
+ int tmp = g_gui.getStringWidth(credits[i]) + 5;
if (_w < tmp && tmp <= maxW) {
_w = tmp;
}