diff options
author | Vicent Marti | 2008-07-23 22:32:00 +0000 |
---|---|---|
committer | Vicent Marti | 2008-07-23 22:32:00 +0000 |
commit | 7f0aa32d51878f83d0af941561408b4b727a4a5e (patch) | |
tree | 3b024f8b4030245a404a2d57f2c0b70f15e7df7c | |
parent | 4135134aea6dd03dcd3c327fb7001d24dbbd4f49 (diff) | |
download | scummvm-rg350-7f0aa32d51878f83d0af941561408b4b727a4a5e.tar.gz scummvm-rg350-7f0aa32d51878f83d0af941561408b4b727a4a5e.tar.bz2 scummvm-rg350-7f0aa32d51878f83d0af941561408b4b727a4a5e.zip |
Improved text handling.
Fixed About dialog scroll-out text.
svn-id: r33257
-rw-r--r-- | graphics/VectorRenderer.cpp | 4 | ||||
-rw-r--r-- | graphics/VectorRenderer.h | 4 | ||||
-rw-r--r-- | gui/ThemeRenderer.cpp | 18 | ||||
-rw-r--r-- | gui/ThemeRenderer.h | 3 | ||||
-rw-r--r-- | gui/about.cpp | 6 |
5 files changed, 17 insertions, 18 deletions
diff --git a/graphics/VectorRenderer.cpp b/graphics/VectorRenderer.cpp index adcd299811..178f760751 100644 --- a/graphics/VectorRenderer.cpp +++ b/graphics/VectorRenderer.cpp @@ -275,7 +275,7 @@ inline uint32 fp_sqroot(uint32 x) { template <typename PixelType, typename PixelFormat> void VectorRendererSpec<PixelType, PixelFormat>:: drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, - GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV) { + GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV, int deltax) { int offset = 0; @@ -291,7 +291,7 @@ drawString(const Graphics::Font *font, const Common::String &text, const Common: break; } - font->drawString(_activeSurface, text, area.left, offset, area.width(), _fgColor, (Graphics::TextAlignment)alignH, 0, false); + font->drawString(_activeSurface, text, area.left, offset, area.width(), _fgColor, (Graphics::TextAlignment)alignH, deltax, false); } /** LINES **/ diff --git a/graphics/VectorRenderer.h b/graphics/VectorRenderer.h index 8a020ebfad..f659626bbf 100644 --- a/graphics/VectorRenderer.h +++ b/graphics/VectorRenderer.h @@ -407,7 +407,7 @@ public: */ virtual void blitSurface(Graphics::Surface *source, const Common::Rect &r) = 0; - virtual void drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV) = 0; + virtual void drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV, int deltax) = 0; virtual void disableShadows() { _disableShadows = true; } virtual void enableShadows() { _disableShadows = false; } @@ -486,7 +486,7 @@ public: void drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, GUI::Theme::TextAlign alignH, - GUI::Theme::TextAlignVertical alignV); + GUI::Theme::TextAlignVertical alignV, int deltax); /** * @see VectorRenderer::setFgColor() diff --git a/gui/ThemeRenderer.cpp b/gui/ThemeRenderer.cpp index df21769b8b..8c111741b9 100644 --- a/gui/ThemeRenderer.cpp +++ b/gui/ThemeRenderer.cpp @@ -270,10 +270,7 @@ bool ThemeRenderer::loadTheme(Common::String themeName) { for (int i = 0; i < kDrawDataMAX; ++i) { if (_widgets[i] == 0) { -#ifdef REQUIRE_ALL_DD_SETS - warning("Error when parsing custom theme '%s': Missing data assets.", themeName.c_str()); - return false; -#endif + warning("Missing data asset: '%s'", kDrawDataDefaults[i].name); } else { calcBackgroundOffset((DrawData)i); @@ -341,7 +338,7 @@ void ThemeRenderer::queueDD(DrawData type, const Common::Rect &r, uint32 dynamic } void ThemeRenderer::queueDDText(TextData type, const Common::Rect &r, const Common::String &text, bool restoreBg, - bool elipsis, TextAlign alignH, TextAlignVertical alignV) { + bool elipsis, TextAlign alignH, TextAlignVertical alignV, int deltax) { if (_texts[type] == 0) return; @@ -354,6 +351,7 @@ void ThemeRenderer::queueDDText(TextData type, const Common::Rect &r, const Comm q.alignH = alignH; q.alignV = alignV; q.restoreBg = restoreBg; + q.deltax = deltax; if (_buffering) { _textQueue.push_back(q); @@ -389,7 +387,7 @@ void ThemeRenderer::drawDDText(const DrawQueueText &q) { restoreBackground(q.area); _vectorRenderer->setFgColor(_texts[q.type]->_color.r, _texts[q.type]->_color.g, _texts[q.type]->_color.b); - _vectorRenderer->drawString(_texts[q.type]->_fontPtr, q.text, q.area, q.alignH, q.alignV); + _vectorRenderer->drawString(_texts[q.type]->_fontPtr, q.text, q.area, q.alignH, q.alignV, q.deltax); addDirtyRect(q.area); } @@ -567,21 +565,21 @@ void ThemeRenderer::drawText(const Common::Rect &r, const Common::String &str, W if (inverted) { queueDD(kDDTextSelectionBackground, r); - queueDDText(kTextDataInverted, r, str, false, useEllipsis); + queueDDText(kTextDataInverted, r, str, false, useEllipsis, align); return; } switch (state) { case kStateDisabled: - queueDDText(kTextDataDisabled, r, str, true, useEllipsis); + queueDDText(kTextDataDisabled, r, str, true, useEllipsis, align); break; case kStateHighlight: - queueDDText(kTextDataHover, r, str, true, useEllipsis); + queueDDText(kTextDataHover, r, str, true, useEllipsis, align); break; case kStateEnabled: - queueDDText(kTextDataDefault, r, str, true, useEllipsis); + queueDDText(kTextDataDefault, r, str, true, useEllipsis, align); break; } } diff --git a/gui/ThemeRenderer.h b/gui/ThemeRenderer.h index 6c4067e00f..1e3bec55b1 100644 --- a/gui/ThemeRenderer.h +++ b/gui/ThemeRenderer.h @@ -181,6 +181,7 @@ protected: GUI::Theme::TextAlignVertical alignV; bool elipsis; bool restoreBg; + int deltax; }; public: @@ -550,7 +551,7 @@ protected: */ inline void queueDD(DrawData type, const Common::Rect &r, uint32 dynamic = 0); inline void queueDDText(TextData type, const Common::Rect &r, const Common::String &text, bool restoreBg, - bool elipsis, TextAlign alignH = kTextAlignLeft, TextAlignVertical alignV = kTextAlignVTop); + bool elipsis, TextAlign alignH = kTextAlignLeft, TextAlignVertical alignV = kTextAlignVTop, int deltax = 0); /** * DEBUG: Draws a white square around the given position and writes the given next to it. diff --git a/gui/about.cpp b/gui/about.cpp index 758f3ee6a7..71bf877d21 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -203,7 +203,7 @@ void AboutDialog::close() { } void AboutDialog::drawDialog() { - g_gui.theme()->setDrawArea(Common::Rect(_x, _y, _x+_w, _y+_h)); +// g_gui.theme()->setDrawArea(Common::Rect(_x, _y, _x+_w, _y+_h)); Dialog::drawDialog(); // Draw text @@ -265,10 +265,10 @@ void AboutDialog::drawDialog() { while (*str && *str == ' ') str++; - g_gui.theme()->drawText(Common::Rect(_x + _xOff, y, _x + _w - _xOff, y + g_gui.theme()->getFontHeight()), str, state, align, false, 0, false); + if (y > _y && y + g_gui.theme()->getFontHeight() < _y + _h) + g_gui.theme()->drawText(Common::Rect(_x + _xOff, y, _x + _w - _xOff, y + g_gui.theme()->getFontHeight()), str, state, align, false, 0, false); y += _lineHeight; } - g_gui.theme()->resetDrawArea(); } void AboutDialog::handleTickle() { |