diff options
Diffstat (limited to 'graphics/macgui/mactext.cpp')
-rw-r--r-- | graphics/macgui/mactext.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp index 4042088761..180b08175b 100644 --- a/graphics/macgui/mactext.cpp +++ b/graphics/macgui/mactext.cpp @@ -140,8 +140,6 @@ void MacText::splitString(Common::String &str) { if (text.size()) { for (uint i = 0; i < text.size(); i++) { - _text.push_back(text[i]); - _textLines[curLine].chunks[curChunk].text = text[i]; if ((text.size() > 1 || !nextChunk) && !(i == text.size() - 1 && nextChunk)) { @@ -189,12 +187,8 @@ void MacText::splitString(Common::String &str) { _textLines[curLine].chunks[curChunk].text = text[0]; - _text.push_back(text[0]); - if (text.size() > 1) { for (uint i = 1; i < text.size(); i++) { - _text.push_back(text[i]); - curLine++; _textLines.resize(curLine + 1); _textLines[curLine].chunks.push_back(_currentFormatting); @@ -304,6 +298,11 @@ int MacText::getLineHeight(int line) { return _textLines[line].height; } +void MacText::setInterLinear(int interLinear) { + _interLinear = interLinear; + recalcDims(); +} + void MacText::recalcDims() { int y = 0; _textMaxWidth = 0; @@ -315,7 +314,7 @@ void MacText::recalcDims() { _textMaxWidth = MAX(_textMaxWidth, getLineWidth(i, true)); } - _textMaxHeight = y; + _textMaxHeight = y - _interLinear; } void MacText::draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff) { @@ -331,28 +330,28 @@ void MacText::draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int } void MacText::appendText(Common::String str) { - int oldLen = _text.size(); + int oldLen = _textLines.size(); // TODO: Recalc length splitString(str); recalcDims(); - render(oldLen + 1, _text.size()); + render(oldLen + 1, _textLines.size()); } void MacText::replaceLastLine(Common::String str) { - int oldLen = MAX<int>(0, _text.size() - 1); + int oldLen = MAX<int>(0, _textLines.size() - 1); // TODO: Recalc length, adapt to _textLines - if (_text.size()) - _text.pop_back(); + if (_textLines.size()) + _textLines.pop_back(); splitString(str); recalcDims(); - render(oldLen, _text.size()); + render(oldLen, _textLines.size()); } } // End of namespace Graphics |