From 4095f2eea9fc682c723c2736369817bf816b4f08 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Wed, 6 Aug 2008 13:58:07 +0000 Subject: [PATCH] Bugfix: Text selection background in list widget overlays scrollbar (finally). Bugfix: Game list missing one entry. svn-id: r33658 --- gui/ListWidget.cpp | 26 ++++++++++++++++---------- gui/ThemeEval.h | 7 ++++++- gui/ThemeRenderer.cpp | 9 ++------- gui/eval.h | 7 ++++++- gui/themes/default.inc | 2 +- gui/themes/modern.stx | 3 +++ 6 files changed, 34 insertions(+), 20 deletions(-) diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp index 80898d06c8a..dda110aa074 100644 --- a/gui/ListWidget.cpp +++ b/gui/ListWidget.cpp @@ -30,6 +30,8 @@ #include "gui/eval.h" #include "gui/newgui.h" +#include "gui/ThemeEval.h" + namespace GUI { ListWidget::ListWidget(GuiObject *boss, const String &name) @@ -374,7 +376,8 @@ void ListWidget::drawWidget() { if (_hasFocus) inverted = true; else - g_gui.theme()->drawWidgetBackground(Common::Rect(_x, y - 1, _x + _w - 1, y + fontHeight - 1), _hints, Theme::kWidgetBackgroundBorderSmall); + g_gui.theme()->drawWidgetBackground(Common::Rect(_x, y - 1, _x + _w - 1, y + fontHeight - 1), + _hints, Theme::kWidgetBackgroundBorderSmall); } Common::Rect r(getEditRect()); @@ -385,7 +388,8 @@ void ListWidget::drawWidget() { char temp[10]; sprintf(temp, "%2d. ", (pos + _numberingMode)); buffer = temp; - g_gui.theme()->drawText(Common::Rect(_x, y, _x + r.left + _leftPadding, y + fontHeight - 2), buffer, _state, Theme::kTextAlignLeft, inverted, _leftPadding); + g_gui.theme()->drawText(Common::Rect(_x, y, _x + r.left + _leftPadding, y + fontHeight - 2), + buffer, _state, Theme::kTextAlignLeft, inverted, _leftPadding); pad = 0; } @@ -395,7 +399,8 @@ void ListWidget::drawWidget() { buffer = _editString; adjustOffset(); width = _w - r.left - _hlRightPadding - _leftPadding; - g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + width, y + fontHeight-2), buffer, _state, Theme::kTextAlignLeft, inverted, pad); + g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + width, y + fontHeight-2), + buffer, _state, Theme::kTextAlignLeft, inverted, pad); } else { int maxWidth = _textWidth[i]; buffer = _list[pos]; @@ -407,7 +412,8 @@ void ListWidget::drawWidget() { width = _w - r.left - _hlRightPadding; if (width > maxWidth) maxWidth = width; - g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + maxWidth, y + fontHeight-2), buffer, _state, Theme::kTextAlignLeft, inverted, pad); + g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + maxWidth, y + fontHeight-2), + buffer, _state, Theme::kTextAlignLeft, inverted, pad); } _textWidth[i] = width; @@ -480,12 +486,12 @@ void ListWidget::abortEditMode() { void ListWidget::reflowLayout() { Widget::reflowLayout(); - _leftPadding = g_gui.evaluator()->getVar("ListWidget.leftPadding", 0); - _rightPadding = g_gui.evaluator()->getVar("ListWidget.rightPadding", 0); - _topPadding = g_gui.evaluator()->getVar("ListWidget.topPadding", 0); - _bottomPadding = g_gui.evaluator()->getVar("ListWidget.bottomPadding", 0); - _hlLeftPadding = g_gui.evaluator()->getVar("ListWidget.hlLeftPadding", 0); - _hlRightPadding = g_gui.evaluator()->getVar("ListWidget.hlRightPadding", 0); + _leftPadding = g_gui.xmlEval()->getVar("Globals.ListWidget.Padding.Left", 0); + _rightPadding = g_gui.xmlEval()->getVar("Globals.ListWidget.Padding.Right", 0); + _topPadding = g_gui.xmlEval()->getVar("Globals.ListWidget.Padding.Top", 0); + _bottomPadding = g_gui.xmlEval()->getVar("Globals.ListWidget.Padding.Bottom", 0); + _hlLeftPadding = g_gui.xmlEval()->getVar("Globals.ListWidget.hlLeftPadding", 0); + _hlRightPadding = g_gui.xmlEval()->getVar("Globals.ListWidget.hlRightPadding", 0); if (g_gui.getWidgetSize() == kBigWidgetSize) { _scrollBarWidth = kBigScrollBarWidth; diff --git a/gui/ThemeEval.h b/gui/ThemeEval.h index 77c15729eda..e55c4a55197 100644 --- a/gui/ThemeEval.h +++ b/gui/ThemeEval.h @@ -246,7 +246,12 @@ public: } int getVar(const Common::String &s, int def) { - return (_vars.contains(s)) ? _vars[s] : def; + if (_vars.contains(s)) + return _vars[s]; + + warning("Returning default value %d for '%s'", def, s.c_str()); + return def; +// return (_vars.contains(s)) ? _vars[s] : def; } void setVar(const String &name, int val) { _vars[name] = val; } diff --git a/gui/ThemeRenderer.cpp b/gui/ThemeRenderer.cpp index 474b9278452..12728457020 100644 --- a/gui/ThemeRenderer.cpp +++ b/gui/ThemeRenderer.cpp @@ -361,13 +361,8 @@ void ThemeRenderer::queueDD(DrawData type, const Common::Rect &r, uint32 dynamic } else { if (kDrawDataDefaults[type].parent != kDDNone && kDrawDataDefaults[type].parent != type) queueDD(kDrawDataDefaults[type].parent, r); - - // HACK: text selection backgrounds must be drawn before other widgets, because - // they are implemented poorly and they overlap. - if (type == kDDTextSelectionBackground) - _screenQueue.push_front(q); - else - _screenQueue.push_back(q); + + _screenQueue.push_back(q); } } else { drawDD(q, !_widgets[type]->_buffer, _widgets[type]->_buffer); diff --git a/gui/eval.h b/gui/eval.h index 47c8313903f..bd58a0e1c31 100644 --- a/gui/eval.h +++ b/gui/eval.h @@ -54,8 +54,13 @@ public: void setStringVar(const String &name, const String &val) { _strings[name] = val; } void setAlias(const Common::String &name, const String &val) { _aliases[name] = val; } - int getVar(const Common::String &s) { return getVar_(s); } + int getVar(const Common::String &s) { + warning("Old evaluator access: '%s'", s.c_str()); + return getVar_(s); + } + int getVar(const Common::String &s, int def) { + warning("Old evaluator access: '%s'", s.c_str()); int val = getVar_(s); return (val == EVAL_UNDEF_VAR) ? def : val; } diff --git a/gui/themes/default.inc b/gui/themes/default.inc index bfe1e1ec8ee..e76c504beee 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -1 +1 @@ -" " +" " diff --git a/gui/themes/modern.stx b/gui/themes/modern.stx index 431ccb0d68b..230468fddaf 100644 --- a/gui/themes/modern.stx +++ b/gui/themes/modern.stx @@ -432,6 +432,9 @@ + + +