diff options
author | Ira Rice <irarice@gmail.com> | 2008-10-12 06:39:34 +0000 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2008-10-12 06:39:34 +0000 |
commit | 9f5f8e5c6579f3ecc7a6c245e063d5f2d96c62ff (patch) | |
tree | 5d6ff477702930af474e2e49f860b47c7f8505fb /src/gui/textbox.cpp | |
parent | d5736cdc5700994520a53fdd560fd7ea946f6e63 (diff) | |
download | mana-client-9f5f8e5c6579f3ecc7a6c245e063d5f2d96c62ff.tar.gz mana-client-9f5f8e5c6579f3ecc7a6c245e063d5f2d96c62ff.tar.bz2 mana-client-9f5f8e5c6579f3ecc7a6c245e063d5f2d96c62ff.tar.xz mana-client-9f5f8e5c6579f3ecc7a6c245e063d5f2d96c62ff.zip |
This commit contains three things: one, after looking over how TMW was
handling the effects through the level up system, I determined that it
wasn't bad, so I pulled it from TMW's SVN. Two, I edited the web page
css so that it better matches the forum. And three, I patched text
wrapping so that it'll fix up its display size based on all previous
lines, except for the last line. That fix will come later, but for now,
it'll be seen as a special case. While you'd like to think that just
resending the string and starting the function over again would fix it,
you'd be wrong. So it won't be patched until I think of a better way to
handle that case.
Diffstat (limited to 'src/gui/textbox.cpp')
-rw-r--r-- | src/gui/textbox.cpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/src/gui/textbox.cpp b/src/gui/textbox.cpp index 1a689ad5..f2d9b6ee 100644 --- a/src/gui/textbox.cpp +++ b/src/gui/textbox.cpp @@ -92,13 +92,31 @@ void TextBox::setTextWrapped(const std::string &text) if (xpos > minWidth) { minWidth = xpos; - if (minWidth > mMinWidth) - { - mMinWidth = minWidth; - } + } + // The window wasn't big enough. Resize it and try again. + if (minWidth > mMinWidth) + { + mMinWidth = minWidth; + // This is a reaaaly ugly hack for getting the string stream + // to clear itself. Don't mess with the spacer in the stream + // reset, as well as removing the break. These are all there + // because there are several compilers that I have tried + // that do not properly reset the string stream. + // You have been warned! + wrappedStream.str(" "); + spacePos = 0; + lastNewlinePos = 0; + newlinePos = text.find("\n", lastNewlinePos); + line = text.substr(lastNewlinePos, newlinePos - + lastNewlinePos); + width = 0; + break; + } + else + { + wrappedStream << "\n" << word; } xpos = width; - wrappedStream << "\n" << word; } lastSpacePos = spacePos + 1; } @@ -116,9 +134,10 @@ void TextBox::setTextWrapped(const std::string &text) { minWidth = xpos; } + mMinWidth = minWidth; if (minWidth > mMinWidth) { - mMinWidth = minWidth; + setTextWrapped(text); } gcn::TextBox::setText(wrappedStream.str()); |