[Scummvm-cvs-logs] SF.net SVN: scummvm:[52716] scummvm/trunk/gui
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Tue Sep 14 02:15:20 CEST 2010
Revision: 52716
http://scummvm.svn.sourceforge.net/scummvm/?rev=52716&view=rev
Author: lordhoto
Date: 2010-09-14 00:15:20 +0000 (Tue, 14 Sep 2010)
Log Message:
-----------
GUI: Fix caret undrawing. (Regression from r48551)
Starting with r48551 the caret undrawing caused the text selection color in
ListWidgets to be removed. It also added a slight offset to the character
next to the undrawn caret. All this is fixed now.
Modified Paths:
--------------
scummvm/trunk/gui/EditTextWidget.cpp
scummvm/trunk/gui/ListWidget.cpp
scummvm/trunk/gui/editable.cpp
scummvm/trunk/gui/editable.h
Modified: scummvm/trunk/gui/EditTextWidget.cpp
===================================================================
--- scummvm/trunk/gui/EditTextWidget.cpp 2010-09-13 23:35:55 UTC (rev 52715)
+++ scummvm/trunk/gui/EditTextWidget.cpp 2010-09-14 00:15:20 UTC (rev 52716)
@@ -88,7 +88,7 @@
}
Common::Rect EditTextWidget::getEditRect() const {
- Common::Rect r(2 + _leftPadding, 1, _w - 2 - _leftPadding - _rightPadding, _h-1);
+ Common::Rect r(2 + _leftPadding, 2, _w - 2 - _leftPadding - _rightPadding, _h-1);
return r;
}
Modified: scummvm/trunk/gui/ListWidget.cpp
===================================================================
--- scummvm/trunk/gui/ListWidget.cpp 2010-09-13 23:35:55 UTC (rev 52715)
+++ scummvm/trunk/gui/ListWidget.cpp 2010-09-14 00:15:20 UTC (rev 52716)
@@ -449,11 +449,15 @@
}
void ListWidget::receivedFocusWidget() {
+ _inversion = ThemeEngine::kTextInversionFocus;
+
// Redraw the widget so the selection color will change
draw();
}
void ListWidget::lostFocusWidget() {
+ _inversion = ThemeEngine::kTextInversion;
+
// If we lose focus, we simply forget the user changes
_editMode = false;
g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
@@ -491,12 +495,8 @@
ThemeEngine::TextInversionState inverted = ThemeEngine::kTextInversionNone;
// Draw the selected item inverted, on a highlighted background.
- if (_selectedItem == pos) {
- if (_hasFocus)
- inverted = ThemeEngine::kTextInversionFocus;
- else
- inverted = ThemeEngine::kTextInversion;
- }
+ if (_selectedItem == pos)
+ inverted = _inversion;
Common::Rect r(getEditRect());
int pad = _leftPadding;
Modified: scummvm/trunk/gui/editable.cpp
===================================================================
--- scummvm/trunk/gui/editable.cpp 2010-09-13 23:35:55 UTC (rev 52715)
+++ scummvm/trunk/gui/editable.cpp 2010-09-14 00:15:20 UTC (rev 52716)
@@ -48,6 +48,7 @@
_editScrollOffset = 0;
_font = ThemeEngine::kFontStyleBold;
+ _inversion = ThemeEngine::kTextInversionNone;
}
EditableWidget::~EditableWidget() {
@@ -237,7 +238,7 @@
Common::Rect editRect = getEditRect();
int x = editRect.left;
- int y = editRect.top + 1;
+ int y = editRect.top;
x += getCaretOffset();
@@ -253,7 +254,7 @@
if ((uint)_caretPos < _editString.size()) {
GUI::EditableWidget::String chr(_editString[_caretPos]);
int chrWidth = g_gui.getCharWidth(_editString[_caretPos], _font);
- g_gui.theme()->drawText(Common::Rect(x, y, x + chrWidth, y + editRect.height() - 2), chr, _state, Graphics::kTextAlignLeft, ThemeEngine::kTextInversionNone, 0, false, _font);
+ g_gui.theme()->drawText(Common::Rect(x, y, x + chrWidth, y + editRect.height() - 2), chr, _state, Graphics::kTextAlignLeft, _inversion, 0, false, _font);
}
}
Modified: scummvm/trunk/gui/editable.h
===================================================================
--- scummvm/trunk/gui/editable.h 2010-09-13 23:35:55 UTC (rev 52715)
+++ scummvm/trunk/gui/editable.h 2010-09-14 00:15:20 UTC (rev 52716)
@@ -54,6 +54,8 @@
ThemeEngine::FontStyle _font;
+ ThemeEngine::TextInversionState _inversion;
+
public:
EditableWidget(GuiObject *boss, int x, int y, int w, int h, const char *tooltip = 0, uint32 cmd = 0);
EditableWidget(GuiObject *boss, const String &name, const char *tooltip = 0, uint32 cmd = 0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list