Third attemp at fixing release-critical #2472185. Also fixes regression reported in #2555710.

svn-id: r36227
This commit is contained in:
Vicent Marti 2009-02-07 00:23:53 +00:00
parent 108d4cfbd0
commit 341873c9d3
4 changed files with 17 additions and 20 deletions

View File

@ -742,7 +742,7 @@ bool ThemeEngine::loadThemeXML(const Common::String &themeId) {
/**********************************************************
* Drawing Queue management
*********************************************************/
void ThemeEngine::queueDD(DrawData type, const Common::Rect &r, uint32 dynamic) {
void ThemeEngine::queueDD(DrawData type, const Common::Rect &r, uint32 dynamic, bool restore) {
if (_widgets[type] == 0)
return;
@ -761,7 +761,7 @@ void ThemeEngine::queueDD(DrawData type, const Common::Rect &r, uint32 dynamic)
_screenQueue.push_back(q);
}
} else {
q->drawSelf(!_widgets[type]->_buffer, _widgets[type]->_buffer);
q->drawSelf(!_widgets[type]->_buffer, restore || _widgets[type]->_buffer);
delete q;
}
}
@ -818,7 +818,7 @@ void ThemeEngine::drawButton(const Common::Rect &r, const Common::String &str, W
else if (state == kStateDisabled)
dd = kDDButtonDisabled;
queueDD(dd, r);
queueDD(dd, r, 0, hints & WIDGET_CLEARBG);
queueDDText(getTextData(dd), r, str, false, false, _widgets[dd]->_textAlignH, _widgets[dd]->_textAlignV);
}

View File

@ -513,7 +513,7 @@ protected:
*
* This function is called from all the Widget Drawing methods.
*/
void queueDD(DrawData type, const Common::Rect &r, uint32 dynamic = 0);
void queueDD(DrawData type, const Common::Rect &r, uint32 dynamic = 0, bool restore = false);
void queueDDText(TextData type, const Common::Rect &r, const Common::String &text, bool restoreBg,
bool elipsis, Graphics::TextAlign alignH = Graphics::kTextAlignLeft, TextAlignVertical alignV = kTextAlignVTop, int deltax = 0);
void queueBitmap(const Graphics::Surface *bitmap, const Common::Rect &r, bool alpha);

View File

@ -912,10 +912,8 @@ void LauncherDialog::updateButtons() {
? "Mass Add"
: "Add Game";
if (_addButton->getLabel() != newAddButtonLabel) {
if (_addButton->getLabel() != newAddButtonLabel)
_addButton->setLabel(newAddButtonLabel);
_addButton->draw();
}
}
void LauncherDialog::reflowLayout() {

View File

@ -198,17 +198,16 @@ void StaticTextWidget::setValue(int value) {
}
void StaticTextWidget::setLabel(const Common::String &label) {
_label = label;
// get parent's size
const uint16 w = _boss->getWidth();
const uint16 h = _boss->getHeight();
const int16 x = _boss->getAbsX();
const int16 y = _boss->getAbsY();
// restore the parent's background and redraw it again.
g_gui.theme()->restoreBackground(Common::Rect(x, y, x + w, y + h));
_boss->draw();
if (_label != label) {
_label = label;
// when changing the label, add the CLEARBG flag
// so the widget is completely redrawn, otherwise
// the new text is drawn on top of the old one.
setFlags(WIDGET_CLEARBG);
draw();
clearFlags(WIDGET_CLEARBG);
}
}
void StaticTextWidget::setAlign(Graphics::TextAlign align) {
@ -225,7 +224,7 @@ void StaticTextWidget::drawWidget() {
#pragma mark -
ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Common::String &label, uint32 cmd, uint8 hotkey)
: StaticTextWidget(boss, x, y, w, h, label, Graphics::kTextAlignCenter), CommandSender(boss),
: StaticTextWidget(boss, x, y, w, h, label, Graphics::kTextAlignCenter), CommandSender(boss),
_cmd(cmd), _hotkey(hotkey) {
setFlags(WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG);
_type = kButtonWidget;
@ -244,7 +243,7 @@ void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount) {
}
void ButtonWidget::drawWidget() {
g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), _label, _state, 0);
g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), _label, _state, getFlags());
}
#pragma mark -