aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/ui
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-07-26 15:59:26 +0200
committerEinar Johan Trøan Sømåen2012-07-26 15:59:26 +0200
commitef11f9d0c53cbdd9d88a99143de6f43f34d7e24d (patch)
tree8dfaee0ba16e18a8e3772dd5afc9123d5c4e78d2 /engines/wintermute/ui
parent38507fa9895620639d8733dbb4e085dfb2282a33 (diff)
downloadscummvm-rg350-ef11f9d0c53cbdd9d88a99143de6f43f34d7e24d.tar.gz
scummvm-rg350-ef11f9d0c53cbdd9d88a99143de6f43f34d7e24d.tar.bz2
scummvm-rg350-ef11f9d0c53cbdd9d88a99143de6f43f34d7e24d.zip
WINTERMUTE: Run Astyle with add-braces to break one-line statements into easier-to-read-code.
Diffstat (limited to 'engines/wintermute/ui')
-rw-r--r--engines/wintermute/ui/ui_button.cpp391
-rw-r--r--engines/wintermute/ui/ui_edit.cpp252
-rw-r--r--engines/wintermute/ui/ui_entity.cpp70
-rw-r--r--engines/wintermute/ui/ui_object.cpp143
-rw-r--r--engines/wintermute/ui/ui_text.cpp91
-rw-r--r--engines/wintermute/ui/ui_tiled_image.cpp51
-rw-r--r--engines/wintermute/ui/ui_window.cpp265
7 files changed, 892 insertions, 371 deletions
diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp
index 2c4cecdc85..706b0d3c00 100644
--- a/engines/wintermute/ui/ui_button.cpp
+++ b/engines/wintermute/ui/ui_button.cpp
@@ -77,10 +77,18 @@ UIButton::~UIButton() {
delete _backFocus;
if (!_sharedFonts) {
- if (_fontHover) _gameRef->_fontStorage->removeFont(_fontHover);
- if (_fontPress) _gameRef->_fontStorage->removeFont(_fontPress);
- if (_fontDisable) _gameRef->_fontStorage->removeFont(_fontDisable);
- if (_fontFocus) _gameRef->_fontStorage->removeFont(_fontFocus);
+ if (_fontHover) {
+ _gameRef->_fontStorage->removeFont(_fontHover);
+ }
+ if (_fontPress) {
+ _gameRef->_fontStorage->removeFont(_fontPress);
+ }
+ if (_fontDisable) {
+ _gameRef->_fontStorage->removeFont(_fontDisable);
+ }
+ if (_fontFocus) {
+ _gameRef->_fontStorage->removeFont(_fontFocus);
+ }
}
if (!_sharedImages) {
@@ -104,7 +112,9 @@ bool UIButton::loadFile(const char *filename) {
setFilename(filename);
- if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing BUTTON file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing BUTTON file '%s'", filename);
+ }
delete[] buffer;
@@ -206,7 +216,9 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
break;
case TOKEN_NAME:
@@ -318,33 +330,53 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_FONT:
- if (_font) _gameRef->_fontStorage->removeFont(_font);
+ if (_font) {
+ _gameRef->_fontStorage->removeFont(_font);
+ }
_font = _gameRef->_fontStorage->addFont((char *)params);
- if (!_font) cmd = PARSERR_GENERIC;
+ if (!_font) {
+ cmd = PARSERR_GENERIC;
+ }
break;
case TOKEN_FONT_HOVER:
- if (_fontHover) _gameRef->_fontStorage->removeFont(_fontHover);
+ if (_fontHover) {
+ _gameRef->_fontStorage->removeFont(_fontHover);
+ }
_fontHover = _gameRef->_fontStorage->addFont((char *)params);
- if (!_fontHover) cmd = PARSERR_GENERIC;
+ if (!_fontHover) {
+ cmd = PARSERR_GENERIC;
+ }
break;
case TOKEN_FONT_PRESS:
- if (_fontPress) _gameRef->_fontStorage->removeFont(_fontPress);
+ if (_fontPress) {
+ _gameRef->_fontStorage->removeFont(_fontPress);
+ }
_fontPress = _gameRef->_fontStorage->addFont((char *)params);
- if (!_fontPress) cmd = PARSERR_GENERIC;
+ if (!_fontPress) {
+ cmd = PARSERR_GENERIC;
+ }
break;
case TOKEN_FONT_DISABLE:
- if (_fontDisable) _gameRef->_fontStorage->removeFont(_fontDisable);
+ if (_fontDisable) {
+ _gameRef->_fontStorage->removeFont(_fontDisable);
+ }
_fontDisable = _gameRef->_fontStorage->addFont((char *)params);
- if (!_fontDisable) cmd = PARSERR_GENERIC;
+ if (!_fontDisable) {
+ cmd = PARSERR_GENERIC;
+ }
break;
case TOKEN_FONT_FOCUS:
- if (_fontFocus) _gameRef->_fontStorage->removeFont(_fontFocus);
+ if (_fontFocus) {
+ _gameRef->_fontStorage->removeFont(_fontFocus);
+ }
_fontFocus = _gameRef->_fontStorage->addFont((char *)params);
- if (!_fontFocus) cmd = PARSERR_GENERIC;
+ if (!_fontFocus) {
+ cmd = PARSERR_GENERIC;
+ }
break;
case TOKEN_TEXT:
@@ -353,9 +385,13 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_TEXT_ALIGN:
- if (scumm_stricmp((char *)params, "left") == 0) _align = TAL_LEFT;
- else if (scumm_stricmp((char *)params, "right") == 0) _align = TAL_RIGHT;
- else _align = TAL_CENTER;
+ if (scumm_stricmp((char *)params, "left") == 0) {
+ _align = TAL_LEFT;
+ } else if (scumm_stricmp((char *)params, "right") == 0) {
+ _align = TAL_RIGHT;
+ } else {
+ _align = TAL_CENTER;
+ }
break;
case TOKEN_X:
@@ -445,47 +481,64 @@ bool UIButton::saveAsText(BaseDynamicBuffer *buffer, int indent) {
buffer->putTextIndent(indent + 2, "\n");
- if (_back && _back->getFilename())
+ if (_back && _back->getFilename()) {
buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->getFilename());
- if (_backHover && _backHover->getFilename())
+ }
+ if (_backHover && _backHover->getFilename()) {
buffer->putTextIndent(indent + 2, "BACK_HOVER=\"%s\"\n", _backHover->getFilename());
- if (_backPress && _backPress->getFilename())
+ }
+ if (_backPress && _backPress->getFilename()) {
buffer->putTextIndent(indent + 2, "BACK_PRESS=\"%s\"\n", _backPress->getFilename());
- if (_backDisable && _backDisable->getFilename())
+ }
+ if (_backDisable && _backDisable->getFilename()) {
buffer->putTextIndent(indent + 2, "BACK_DISABLE=\"%s\"\n", _backDisable->getFilename());
- if (_backFocus && _backFocus->getFilename())
+ }
+ if (_backFocus && _backFocus->getFilename()) {
buffer->putTextIndent(indent + 2, "BACK_FOCUS=\"%s\"\n", _backFocus->getFilename());
+ }
- if (_image && _image->getFilename())
+ if (_image && _image->getFilename()) {
buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->getFilename());
- if (_imageHover && _imageHover->getFilename())
+ }
+ if (_imageHover && _imageHover->getFilename()) {
buffer->putTextIndent(indent + 2, "IMAGE_HOVER=\"%s\"\n", _imageHover->getFilename());
- if (_imagePress && _imagePress->getFilename())
+ }
+ if (_imagePress && _imagePress->getFilename()) {
buffer->putTextIndent(indent + 2, "IMAGE_PRESS=\"%s\"\n", _imagePress->getFilename());
- if (_imageDisable && _imageDisable->getFilename())
+ }
+ if (_imageDisable && _imageDisable->getFilename()) {
buffer->putTextIndent(indent + 2, "IMAGE_DISABLE=\"%s\"\n", _imageDisable->getFilename());
- if (_imageFocus && _imageFocus->getFilename())
+ }
+ if (_imageFocus && _imageFocus->getFilename()) {
buffer->putTextIndent(indent + 2, "IMAGE_FOCUS=\"%s\"\n", _imageFocus->getFilename());
+ }
- if (_font && _font->getFilename())
+ if (_font && _font->getFilename()) {
buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
- if (_fontHover && _fontHover->getFilename())
+ }
+ if (_fontHover && _fontHover->getFilename()) {
buffer->putTextIndent(indent + 2, "FONT_HOVER=\"%s\"\n", _fontHover->getFilename());
- if (_fontPress && _fontPress->getFilename())
+ }
+ if (_fontPress && _fontPress->getFilename()) {
buffer->putTextIndent(indent + 2, "FONT_PRESS=\"%s\"\n", _fontPress->getFilename());
- if (_fontDisable && _fontDisable->getFilename())
+ }
+ if (_fontDisable && _fontDisable->getFilename()) {
buffer->putTextIndent(indent + 2, "FONT_DISABLE=\"%s\"\n", _fontDisable->getFilename());
- if (_fontFocus && _fontFocus->getFilename())
+ }
+ if (_fontFocus && _fontFocus->getFilename()) {
buffer->putTextIndent(indent + 2, "FONT_FOCUS=\"%s\"\n", _fontFocus->getFilename());
+ }
- if (_cursor && _cursor->getFilename())
+ if (_cursor && _cursor->getFilename()) {
buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
+ }
buffer->putTextIndent(indent + 2, "\n");
- if (_text)
+ if (_text) {
buffer->putTextIndent(indent + 2, "TEXT=\"%s\"\n", _text);
+ }
switch (_align) {
case TAL_LEFT:
@@ -539,17 +592,25 @@ void UIButton::correctSize() {
Rect32 rect;
BaseSprite *img = NULL;
- if (_image) img = _image;
- else if (_imageDisable) img = _imageDisable;
- else if (_imageHover) img = _imageHover;
- else if (_imagePress) img = _imagePress;
- else if (_imageFocus) img = _imageFocus;
+ if (_image) {
+ img = _image;
+ } else if (_imageDisable) {
+ img = _imageDisable;
+ } else if (_imageHover) {
+ img = _imageHover;
+ } else if (_imagePress) {
+ img = _imagePress;
+ } else if (_imageFocus) {
+ img = _imageFocus;
+ }
if (_width <= 0) {
if (img) {
img->getBoundingRect(&rect, 0, 0);
_width = rect.right - rect.left;
- } else _width = 100;
+ } else {
+ _width = 100;
+ }
}
if (_height <= 0) {
@@ -561,22 +622,32 @@ void UIButton::correctSize() {
if (_text) {
int text_height;
- if (_font) text_height = _font->getTextHeight((byte *)_text, _width);
- else text_height = _gameRef->_systemFont->getTextHeight((byte *)_text, _width);
+ if (_font) {
+ text_height = _font->getTextHeight((byte *)_text, _width);
+ } else {
+ text_height = _gameRef->_systemFont->getTextHeight((byte *)_text, _width);
+ }
- if (text_height > _height) _height = text_height;
+ if (text_height > _height) {
+ _height = text_height;
+ }
}
- if (_height <= 0) _height = 100;
+ if (_height <= 0) {
+ _height = 100;
+ }
- if (_back) _back->correctSize(&_width, &_height);
+ if (_back) {
+ _back->correctSize(&_width, &_height);
+ }
}
//////////////////////////////////////////////////////////////////////////
bool UIButton::display(int offsetX, int offsetY) {
- if (!_visible)
+ if (!_visible) {
return STATUS_OK;
+ }
UITiledImage *back = NULL;
BaseSprite *image = NULL;
@@ -588,32 +659,65 @@ bool UIButton::display(int offsetX, int offsetY) {
_hover = (!_disable && _gameRef->_activeObject == this && (_gameRef->_interactive || _gameRef->_state == GAME_SEMI_FROZEN));
if ((_press && _hover && !_gameRef->_mouseLeftDown) ||
- (_oneTimePress && g_system->getMillis() - _oneTimePressTime >= 100)) press();
+ (_oneTimePress && g_system->getMillis() - _oneTimePressTime >= 100)) {
+ press();
+ }
if (_disable) {
- if (_backDisable) back = _backDisable;
- if (_imageDisable) image = _imageDisable;
- if (_text && _fontDisable) font = _fontDisable;
+ if (_backDisable) {
+ back = _backDisable;
+ }
+ if (_imageDisable) {
+ image = _imageDisable;
+ }
+ if (_text && _fontDisable) {
+ font = _fontDisable;
+ }
} else if (_press || _oneTimePress || _stayPressed) {
- if (_backPress) back = _backPress;
- if (_imagePress) image = _imagePress;
- if (_text && _fontPress) font = _fontPress;
+ if (_backPress) {
+ back = _backPress;
+ }
+ if (_imagePress) {
+ image = _imagePress;
+ }
+ if (_text && _fontPress) {
+ font = _fontPress;
+ }
} else if (_hover) {
- if (_backHover) back = _backHover;
- if (_imageHover) image = _imageHover;
- if (_text && _fontHover) font = _fontHover;
+ if (_backHover) {
+ back = _backHover;
+ }
+ if (_imageHover) {
+ image = _imageHover;
+ }
+ if (_text && _fontHover) {
+ font = _fontHover;
+ }
} else if (_canFocus && isFocused()) {
- if (_backFocus) back = _backFocus;
- if (_imageFocus) image = _imageFocus;
- if (_text && _fontFocus) font = _fontFocus;
+ if (_backFocus) {
+ back = _backFocus;
+ }
+ if (_imageFocus) {
+ image = _imageFocus;
+ }
+ if (_text && _fontFocus) {
+ font = _fontFocus;
+ }
}
- if (!back && _back) back = _back;
- if (!image && _image) image = _image;
+ if (!back && _back) {
+ back = _back;
+ }
+ if (!image && _image) {
+ image = _image;
+ }
if (_text && !font) {
- if (_font) font = _font;
- else font = _gameRef->_systemFont;
+ if (_font) {
+ font = _font;
+ } else {
+ font = _gameRef->_systemFont;
+ }
}
int imageX = offsetX + _posX;
@@ -626,23 +730,39 @@ bool UIButton::display(int offsetX, int offsetY) {
imageY += (_height - (rc.bottom - rc.top)) / 2;
}
- if (back) back->display(offsetX + _posX, offsetY + _posY, _width, _height);
+ if (back) {
+ back->display(offsetX + _posX, offsetY + _posY, _width, _height);
+ }
//if (image) image->Draw(ImageX +((_press||_oneTimePress)&&back?1:0), ImageY +((_press||_oneTimePress)&&back?1:0), NULL);
- if (image) image->draw(imageX + ((_press || _oneTimePress) && back ? 1 : 0), imageY + ((_press || _oneTimePress) && back ? 1 : 0), _pixelPerfect ? this : NULL);
+ if (image) {
+ image->draw(imageX + ((_press || _oneTimePress) && back ? 1 : 0), imageY + ((_press || _oneTimePress) && back ? 1 : 0), _pixelPerfect ? this : NULL);
+ }
if (font && _text) {
int text_offset = (_height - font->getTextHeight((byte *)_text, _width)) / 2;
font->drawText((byte *)_text, offsetX + _posX + ((_press || _oneTimePress) ? 1 : 0), offsetY + _posY + text_offset + ((_press || _oneTimePress) ? 1 : 0), _width, _align);
}
- if (!_pixelPerfect || !_image) _gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, this, NULL, offsetX + _posX, offsetY + _posY, _width, _height, 100, 100, false));
+ if (!_pixelPerfect || !_image) {
+ _gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, this, NULL, offsetX + _posX, offsetY + _posY, _width, _height, 100, 100, false));
+ }
// reset unused sprites
- if (_image && _image != image) _image->reset();
- if (_imageDisable && _imageDisable != image) _imageDisable->reset();
- if (_imageFocus && _imageFocus != image) _imageFocus->reset();
- if (_imagePress && _imagePress != image) _imagePress->reset();
- if (_imageHover && _imageHover != image) _imageHover->reset();
+ if (_image && _image != image) {
+ _image->reset();
+ }
+ if (_imageDisable && _imageDisable != image) {
+ _imageDisable->reset();
+ }
+ if (_imageFocus && _imageFocus != image) {
+ _imageFocus->reset();
+ }
+ if (_imagePress && _imagePress != image) {
+ _imagePress->reset();
+ }
+ if (_imageHover && _imageHover != image) {
+ _imageHover->reset();
+ }
_press = _hover && _gameRef->_mouseLeftDown && _gameRef->_capturedObject == this;
@@ -653,8 +773,12 @@ bool UIButton::display(int offsetX, int offsetY) {
//////////////////////////////////////////////////////////////////////////
void UIButton::press() {
applyEvent("Press");
- if (_listenerObject) _listenerObject->listen(_listenerParamObject, _listenerParamDWORD);
- if (_parentNotify && _parent) _parent->applyEvent(getName());
+ if (_listenerObject) {
+ _listenerObject->listen(_listenerParamObject, _listenerParamDWORD);
+ }
+ if (_parentNotify && _parent) {
+ _parent->applyEvent(getName());
+ }
_oneTimePress = false;
}
@@ -669,14 +793,16 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "SetDisabledFont") == 0) {
stack->correctParams(1);
- ScValue *Val = stack->pop();
+ ScValue *val = stack->pop();
- if (_fontDisable) _gameRef->_fontStorage->removeFont(_fontDisable);
- if (Val->isNULL()) {
+ if (_fontDisable) {
+ _gameRef->_fontStorage->removeFont(_fontDisable);
+ }
+ if (val->isNULL()) {
_fontDisable = NULL;
stack->pushBool(true);
} else {
- _fontDisable = _gameRef->_fontStorage->addFont(Val->getString());
+ _fontDisable = _gameRef->_fontStorage->addFont(val->getString());
stack->pushBool(_fontDisable != NULL);
}
return STATUS_OK;
@@ -689,7 +815,9 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
stack->correctParams(1);
ScValue *val = stack->pop();
- if (_fontHover) _gameRef->_fontStorage->removeFont(_fontHover);
+ if (_fontHover) {
+ _gameRef->_fontStorage->removeFont(_fontHover);
+ }
if (val->isNULL()) {
_fontHover = NULL;
stack->pushBool(true);
@@ -705,14 +833,16 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetPressedFont") == 0) {
stack->correctParams(1);
- ScValue *Val = stack->pop();
+ ScValue *val = stack->pop();
- if (_fontPress) _gameRef->_fontStorage->removeFont(_fontPress);
- if (Val->isNULL()) {
+ if (_fontPress) {
+ _gameRef->_fontStorage->removeFont(_fontPress);
+ }
+ if (val->isNULL()) {
_fontPress = NULL;
stack->pushBool(true);
} else {
- _fontPress = _gameRef->_fontStorage->addFont(Val->getString());
+ _fontPress = _gameRef->_fontStorage->addFont(val->getString());
stack->pushBool(_fontPress != NULL);
}
return STATUS_OK;
@@ -725,7 +855,9 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
stack->correctParams(1);
ScValue *val = stack->pop();
- if (_fontFocus) _gameRef->_fontStorage->removeFont(_fontFocus);
+ if (_fontFocus) {
+ _gameRef->_fontStorage->removeFont(_fontFocus);
+ }
if (val->isNULL()) {
_fontFocus = NULL;
stack->pushBool(true);
@@ -749,7 +881,9 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
delete _imageDisable;
_imageDisable = NULL;
stack->pushBool(false);
- } else stack->pushBool(true);
+ } else {
+ stack->pushBool(true);
+ }
return STATUS_OK;
}
@@ -759,8 +893,11 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetDisabledImage") == 0) {
stack->correctParams(0);
- if (!_imageDisable || !_imageDisable->getFilename()) stack->pushNULL();
- else stack->pushString(_imageDisable->getFilename());
+ if (!_imageDisable || !_imageDisable->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_imageDisable->getFilename());
+ }
return STATUS_OK;
}
@@ -770,8 +907,11 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetDisabledImageObject") == 0) {
stack->correctParams(0);
- if (!_imageDisable) stack->pushNULL();
- else stack->pushNative(_imageDisable, true);
+ if (!_imageDisable) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_imageDisable, true);
+ }
return STATUS_OK;
}
@@ -790,7 +930,9 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
delete _imageHover;
_imageHover = NULL;
stack->pushBool(false);
- } else stack->pushBool(true);
+ } else {
+ stack->pushBool(true);
+ }
return STATUS_OK;
}
@@ -800,8 +942,11 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetHoverImage") == 0) {
stack->correctParams(0);
- if (!_imageHover || !_imageHover->getFilename()) stack->pushNULL();
- else stack->pushString(_imageHover->getFilename());
+ if (!_imageHover || !_imageHover->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_imageHover->getFilename());
+ }
return STATUS_OK;
}
@@ -811,8 +956,11 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetHoverImageObject") == 0) {
stack->correctParams(0);
- if (!_imageHover) stack->pushNULL();
- else stack->pushNative(_imageHover, true);
+ if (!_imageHover) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_imageHover, true);
+ }
return STATUS_OK;
}
@@ -830,7 +978,9 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
delete _imagePress;
_imagePress = NULL;
stack->pushBool(false);
- } else stack->pushBool(true);
+ } else {
+ stack->pushBool(true);
+ }
return STATUS_OK;
}
@@ -840,8 +990,11 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetPressedImage") == 0) {
stack->correctParams(0);
- if (!_imagePress || !_imagePress->getFilename()) stack->pushNULL();
- else stack->pushString(_imagePress->getFilename());
+ if (!_imagePress || !_imagePress->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_imagePress->getFilename());
+ }
return STATUS_OK;
}
@@ -851,8 +1004,11 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetPressedImageObject") == 0) {
stack->correctParams(0);
- if (!_imagePress) stack->pushNULL();
- else stack->pushNative(_imagePress, true);
+ if (!_imagePress) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_imagePress, true);
+ }
return STATUS_OK;
}
@@ -870,7 +1026,9 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
delete _imageFocus;
_imageFocus = NULL;
stack->pushBool(false);
- } else stack->pushBool(true);
+ } else {
+ stack->pushBool(true);
+ }
return STATUS_OK;
}
@@ -880,8 +1038,11 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetFocusedImage") == 0) {
stack->correctParams(0);
- if (!_imageFocus || !_imageFocus->getFilename()) stack->pushNULL();
- else stack->pushString(_imageFocus->getFilename());
+ if (!_imageFocus || !_imageFocus->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_imageFocus->getFilename());
+ }
return STATUS_OK;
}
@@ -891,8 +1052,11 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetFocusedImageObject") == 0) {
stack->correctParams(0);
- if (!_imageFocus) stack->pushNULL();
- else stack->pushNative(_imageFocus, true);
+ if (!_imageFocus) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_imageFocus, true);
+ }
return STATUS_OK;
}
@@ -910,10 +1074,9 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
stack->pushNULL();
return STATUS_OK;
+ } else {
+ return UIObject::scCallMethod(script, stack, thisStack, name);
}
-
-
- else return UIObject::scCallMethod(script, stack, thisStack, name);
}
@@ -957,9 +1120,9 @@ ScValue *UIButton::scGetProperty(const char *name) {
else if (strcmp(name, "PixelPerfect") == 0) {
_scValue->setBool(_pixelPerfect);
return _scValue;
+ } else {
+ return UIObject::scGetProperty(name);
}
-
- else return UIObject::scGetProperty(name);
}
@@ -970,7 +1133,9 @@ bool UIButton::scSetProperty(const char *name, ScValue *value) {
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "TextAlign") == 0) {
int i = value->getInt();
- if (i < 0 || i >= NUM_TEXT_ALIGN) i = 0;
+ if (i < 0 || i >= NUM_TEXT_ALIGN) {
+ i = 0;
+ }
_align = (TTextAlign)i;
return STATUS_OK;
}
@@ -995,9 +1160,9 @@ bool UIButton::scSetProperty(const char *name, ScValue *value) {
else if (strcmp(name, "PixelPerfect") == 0) {
_pixelPerfect = value->getBool();
return STATUS_OK;
+ } else {
+ return UIObject::scSetProperty(name, value);
}
-
- else return UIObject::scSetProperty(name, value);
}
diff --git a/engines/wintermute/ui/ui_edit.cpp b/engines/wintermute/ui/ui_edit.cpp
index 988f56ae17..22d477bc31 100644
--- a/engines/wintermute/ui/ui_edit.cpp
+++ b/engines/wintermute/ui/ui_edit.cpp
@@ -81,7 +81,9 @@ UIEdit::UIEdit(BaseGame *inGame): UIObject(inGame) {
//////////////////////////////////////////////////////////////////////////
UIEdit::~UIEdit() {
if (!_sharedFonts) {
- if (_fontSelected) _gameRef->_fontStorage->removeFont(_fontSelected);
+ if (_fontSelected) {
+ _gameRef->_fontStorage->removeFont(_fontSelected);
+ }
}
delete[] _cursorChar;
@@ -101,7 +103,9 @@ bool UIEdit::loadFile(const char *filename) {
setFilename(filename);
- if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing EDIT file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing EDIT file '%s'", filename);
+ }
delete[] buffer;
@@ -175,7 +179,9 @@ bool UIEdit::loadBuffer(byte *buffer, bool complete) {
while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
break;
case TOKEN_NAME:
@@ -203,15 +209,23 @@ bool UIEdit::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_FONT:
- if (_font) _gameRef->_fontStorage->removeFont(_font);
+ if (_font) {
+ _gameRef->_fontStorage->removeFont(_font);
+ }
_font = _gameRef->_fontStorage->addFont((char *)params);
- if (!_font) cmd = PARSERR_GENERIC;
+ if (!_font) {
+ cmd = PARSERR_GENERIC;
+ }
break;
case TOKEN_FONT_SELECTED:
- if (_fontSelected) _gameRef->_fontStorage->removeFont(_fontSelected);
+ if (_fontSelected) {
+ _gameRef->_fontStorage->removeFont(_fontSelected);
+ }
_fontSelected = _gameRef->_fontStorage->addFont((char *)params);
- if (!_fontSelected) cmd = PARSERR_GENERIC;
+ if (!_fontSelected) {
+ cmd = PARSERR_GENERIC;
+ }
break;
case TOKEN_TEXT:
@@ -306,24 +320,30 @@ bool UIEdit::saveAsText(BaseDynamicBuffer *buffer, int indent) {
buffer->putTextIndent(indent + 2, "\n");
- if (_back && _back->getFilename())
+ if (_back && _back->getFilename()) {
buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->getFilename());
+ }
- if (_image && _image->getFilename())
+ if (_image && _image->getFilename()) {
buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->getFilename());
+ }
- if (_font && _font->getFilename())
+ if (_font && _font->getFilename()) {
buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
- if (_fontSelected && _fontSelected->getFilename())
+ }
+ if (_fontSelected && _fontSelected->getFilename()) {
buffer->putTextIndent(indent + 2, "FONT_SELECTED=\"%s\"\n", _fontSelected->getFilename());
+ }
- if (_cursor && _cursor->getFilename())
+ if (_cursor && _cursor->getFilename()) {
buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
+ }
buffer->putTextIndent(indent + 2, "\n");
- if (_text)
+ if (_text) {
buffer->putTextIndent(indent + 2, "TEXT=\"%s\"\n", _text);
+ }
buffer->putTextIndent(indent + 2, "\n");
@@ -363,14 +383,16 @@ bool UIEdit::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack,
if (strcmp(name, "SetSelectedFont") == 0) {
stack->correctParams(1);
- if (_fontSelected) _gameRef->_fontStorage->removeFont(_fontSelected);
+ if (_fontSelected) {
+ _gameRef->_fontStorage->removeFont(_fontSelected);
+ }
_fontSelected = _gameRef->_fontStorage->addFont(stack->pop()->getString());
stack->pushBool(_fontSelected != NULL);
return STATUS_OK;
+ } else {
+ return UIObject::scCallMethod(script, stack, thisStack, name);
}
-
- else return UIObject::scCallMethod(script, stack, thisStack, name);
}
@@ -445,9 +467,9 @@ ScValue *UIEdit::scGetProperty(const char *name) {
_scValue->setString(_text);
}
return _scValue;
+ } else {
+ return UIObject::scGetProperty(name);
}
-
- else return UIObject::scGetProperty(name);
}
@@ -459,7 +481,7 @@ bool UIEdit::scSetProperty(const char *name, ScValue *value) {
if (strcmp(name, "SelStart") == 0) {
_selStart = value->getInt();
_selStart = MAX(_selStart, 0);
- _selStart = MIN((size_t)_selStart, strlen(_text));
+ _selStart = (int)MIN((size_t)_selStart, strlen(_text));
return STATUS_OK;
}
@@ -469,7 +491,7 @@ bool UIEdit::scSetProperty(const char *name, ScValue *value) {
else if (strcmp(name, "SelEnd") == 0) {
_selEnd = value->getInt();
_selEnd = MAX(_selEnd, 0);
- _selEnd = MIN((size_t)_selEnd, strlen(_text));
+ _selEnd = (int)MIN((size_t)_selEnd, strlen(_text));
return STATUS_OK;
}
@@ -477,7 +499,7 @@ bool UIEdit::scSetProperty(const char *name, ScValue *value) {
// CursorBlinkRate
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "CursorBlinkRate") == 0) {
- _cursorBlinkRate = value->getInt();
+ _cursorBlinkRate = (uint32)value->getInt();
return STATUS_OK;
}
@@ -516,9 +538,9 @@ bool UIEdit::scSetProperty(const char *name, ScValue *value) {
setText(value->getString());
}
return STATUS_OK;
+ } else {
+ return UIObject::scSetProperty(name, value);
}
-
- else return UIObject::scSetProperty(name, value);
}
@@ -530,42 +552,58 @@ const char *UIEdit::scToString() {
//////////////////////////////////////////////////////////////////////////
void UIEdit::setCursorChar(const char *character) {
- if (!character) return;
+ if (!character) {
+ return;
+ }
delete[] _cursorChar;
_cursorChar = new char [strlen(character) + 1];
- if (_cursorChar) strcpy(_cursorChar, character);
+ if (_cursorChar) {
+ strcpy(_cursorChar, character);
+ }
}
//////////////////////////////////////////////////////////////////////////
bool UIEdit::display(int offsetX, int offsetY) {
- if (!_visible) return STATUS_OK;
+ if (!_visible) {
+ return STATUS_OK;
+ }
// hack!
TTextEncoding OrigEncoding = _gameRef->_textEncoding;
_gameRef->_textEncoding = TEXT_ANSI;
- if (_back) _back->display(offsetX + _posX, offsetY + _posY, _width, _height);
- if (_image) _image->draw(offsetX + _posX, offsetY + _posY, NULL);
+ if (_back) {
+ _back->display(offsetX + _posX, offsetY + _posY, _width, _height);
+ }
+ if (_image) {
+ _image->draw(offsetX + _posX, offsetY + _posY, NULL);
+ }
// prepare fonts
BaseFont *font;
BaseFont *sfont;
- if (_font) font = _font;
- else font = _gameRef->_systemFont;
+ if (_font) {
+ font = _font;
+ } else {
+ font = _gameRef->_systemFont;
+ }
- if (_fontSelected) sfont = _fontSelected;
- else sfont = font;
+ if (_fontSelected) {
+ sfont = _fontSelected;
+ } else {
+ sfont = font;
+ }
bool focused = isFocused();
_selStart = MAX(_selStart, 0);
_selEnd = MAX(_selEnd, 0);
- _selStart = MIN((size_t)_selStart, strlen(_text));
- _selEnd = MIN((size_t)_selEnd, strlen(_text));
+ _selStart = (int)MIN((size_t)_selStart, strlen(_text));
+ _selEnd = (int)MIN((size_t)_selEnd, strlen(_text));
//int CursorWidth = font->GetCharWidth(_cursorChar[0]);
int cursorWidth = font->getTextWidth((byte *)_cursorChar);
@@ -576,7 +614,9 @@ bool UIEdit::display(int offsetX, int offsetY) {
if (_selStart >= _selEnd) {
while (font->getTextWidth((byte *)_text + _scrollOffset, MAX(0, _selEnd - _scrollOffset)) > _width - cursorWidth - 2 * _frameWidth) {
_scrollOffset++;
- if (_scrollOffset >= (int)strlen(_text)) break;
+ if (_scrollOffset >= (int)strlen(_text)) {
+ break;
+ }
}
_scrollOffset = MIN(_scrollOffset, _selEnd);
@@ -590,7 +630,9 @@ bool UIEdit::display(int offsetX, int offsetY) {
> _width - cursorWidth - 2 * _frameWidth) {
_scrollOffset++;
- if (_scrollOffset >= (int)strlen(_text)) break;
+ if (_scrollOffset >= (int)strlen(_text)) {
+ break;
+ }
}
_scrollOffset = MIN(_scrollOffset, _selEnd);
@@ -601,9 +643,9 @@ bool UIEdit::display(int offsetX, int offsetY) {
}
- int AlignOffset = 0;
+ int alignOffset = 0;
- for (int Count = 0; Count < 2; Count++) {
+ for (int count = 0; count < 2; count++) {
// draw text
int xxx, yyy, width, height;
@@ -613,61 +655,73 @@ bool UIEdit::display(int offsetX, int offsetY) {
width = _posX + _width + offsetX - _frameWidth;
height = MAX(font->getLetterHeight(), sfont->getLetterHeight());
- if (_gameRef->_textRTL) xxx += AlignOffset;
+ if (_gameRef->_textRTL) {
+ xxx += alignOffset;
+ }
- TTextAlign Align = TAL_LEFT;
+ TTextAlign align = TAL_LEFT;
// unselected 1
if (s1 > _scrollOffset) {
- if (Count) font->drawText((byte *)_text + _scrollOffset, xxx, yyy, width - xxx, Align, height, s1 - _scrollOffset);
+ if (count) {
+ font->drawText((byte *)_text + _scrollOffset, xxx, yyy, width - xxx, align, height, s1 - _scrollOffset);
+ }
xxx += font->getTextWidth((byte *)_text + _scrollOffset, s1 - _scrollOffset);
- AlignOffset += font->getTextWidth((byte *)_text + _scrollOffset, s1 - _scrollOffset);
+ alignOffset += font->getTextWidth((byte *)_text + _scrollOffset, s1 - _scrollOffset);
}
// cursor
if (focused && curFirst) {
- if (Count) {
+ if (count) {
if (g_system->getMillis() - _lastBlinkTime >= _cursorBlinkRate) {
_lastBlinkTime = g_system->getMillis();
_cursorVisible = !_cursorVisible;
}
- if (_cursorVisible)
- font->drawText((byte *)_cursorChar, xxx, yyy, width - xxx, Align, height, 1);
+ if (_cursorVisible) {
+ font->drawText((byte *)_cursorChar, xxx, yyy, width - xxx, align, height, 1);
+ }
}
xxx += cursorWidth;
- AlignOffset += cursorWidth;
+ alignOffset += cursorWidth;
}
// selected
int s3 = MAX(s1, _scrollOffset);
if (s2 - s3 > 0) {
- if (Count) sfont->drawText((byte *)_text + s3, xxx, yyy, width - xxx, Align, height, s2 - s3);
+ if (count) {
+ sfont->drawText((byte *)_text + s3, xxx, yyy, width - xxx, align, height, s2 - s3);
+ }
xxx += sfont->getTextWidth((byte *)_text + s3, s2 - s3);
- AlignOffset += sfont->getTextWidth((byte *)_text + s3, s2 - s3);
+ alignOffset += sfont->getTextWidth((byte *)_text + s3, s2 - s3);
}
// cursor
if (focused && !curFirst) {
- if (Count) {
+ if (count) {
if (g_system->getMillis() - _lastBlinkTime >= _cursorBlinkRate) {
_lastBlinkTime = g_system->getMillis();
_cursorVisible = !_cursorVisible;
}
- if (_cursorVisible)
- font->drawText((byte *)_cursorChar, xxx, yyy, width - xxx, Align, height, 1);
+ if (_cursorVisible) {
+ font->drawText((byte *)_cursorChar, xxx, yyy, width - xxx, align, height, 1);
+ }
}
xxx += cursorWidth;
- AlignOffset += cursorWidth;
+ alignOffset += cursorWidth;
}
// unselected 2
- if (Count) font->drawText((byte *)_text + s2, xxx, yyy, width - xxx, Align, height);
- AlignOffset += font->getTextWidth((byte *)_text + s2);
+ if (count) {
+ font->drawText((byte *)_text + s2, xxx, yyy, width - xxx, align, height);
+ }
+ alignOffset += font->getTextWidth((byte *)_text + s2);
- AlignOffset = (_width - 2 * _frameWidth) - AlignOffset;
- if (AlignOffset < 0) AlignOffset = 0;
+ alignOffset = (_width - 2 * _frameWidth) - alignOffset;
+ if (alignOffset < 0) {
+ alignOffset = 0;
+ }
}
@@ -702,10 +756,17 @@ bool UIEdit::handleKeypress(Common::Event *event, bool printable) {
case Common::KEYCODE_BACKSPACE:
if (_selStart == _selEnd) {
- if (_gameRef->_textRTL) deleteChars(_selStart, _selStart + 1);
- else deleteChars(_selStart - 1, _selStart);
- } else deleteChars(_selStart, _selEnd);
- if (_selEnd >= _selStart) _selEnd -= MAX(1, _selEnd - _selStart);
+ if (_gameRef->_textRTL) {
+ deleteChars(_selStart, _selStart + 1);
+ } else {
+ deleteChars(_selStart - 1, _selStart);
+ }
+ } else {
+ deleteChars(_selStart, _selEnd);
+ }
+ if (_selEnd >= _selStart) {
+ _selEnd -= MAX(1, _selEnd - _selStart);
+ }
_selStart = _selEnd;
handled = true;
@@ -714,24 +775,32 @@ bool UIEdit::handleKeypress(Common::Event *event, bool printable) {
case Common::KEYCODE_LEFT:
case Common::KEYCODE_UP:
_selEnd--;
- if (!BaseKeyboardState::isShiftDown()) _selStart = _selEnd;
+ if (!BaseKeyboardState::isShiftDown()) {
+ _selStart = _selEnd;
+ }
handled = true;
break;
case Common::KEYCODE_RIGHT:
case Common::KEYCODE_DOWN:
_selEnd++;
- if (!BaseKeyboardState::isShiftDown()) _selStart = _selEnd;
+ if (!BaseKeyboardState::isShiftDown()) {
+ _selStart = _selEnd;
+ }
handled = true;
break;
case Common::KEYCODE_HOME:
if (_gameRef->_textRTL) {
_selEnd = strlen(_text);
- if (!BaseKeyboardState::isShiftDown()) _selStart = _selEnd;
+ if (!BaseKeyboardState::isShiftDown()) {
+ _selStart = _selEnd;
+ }
} else {
_selEnd = 0;
- if (!BaseKeyboardState::isShiftDown()) _selStart = _selEnd;
+ if (!BaseKeyboardState::isShiftDown()) {
+ _selStart = _selEnd;
+ }
}
handled = true;
break;
@@ -739,10 +808,14 @@ bool UIEdit::handleKeypress(Common::Event *event, bool printable) {
case Common::KEYCODE_END:
if (_gameRef->_textRTL) {
_selEnd = 0;
- if (!BaseKeyboardState::isShiftDown()) _selStart = _selEnd;
+ if (!BaseKeyboardState::isShiftDown()) {
+ _selStart = _selEnd;
+ }
} else {
_selEnd = strlen(_text);
- if (!BaseKeyboardState::isShiftDown()) _selStart = _selEnd;
+ if (!BaseKeyboardState::isShiftDown()) {
+ _selStart = _selEnd;
+ }
}
handled = true;
break;
@@ -752,10 +825,18 @@ bool UIEdit::handleKeypress(Common::Event *event, bool printable) {
if (_gameRef->_textRTL) {
deleteChars(_selStart - 1, _selStart);
_selEnd--;
- if (_selEnd < 0) _selEnd = 0;
- } else deleteChars(_selStart, _selStart + 1);
- } else deleteChars(_selStart, _selEnd);
- if (_selEnd > _selStart) _selEnd -= (_selEnd - _selStart);
+ if (_selEnd < 0) {
+ _selEnd = 0;
+ }
+ } else {
+ deleteChars(_selStart, _selStart + 1);
+ }
+ } else {
+ deleteChars(_selStart, _selEnd);
+ }
+ if (_selEnd > _selStart) {
+ _selEnd -= (_selEnd - _selStart);
+ }
_selStart = _selEnd;
handled = true;
@@ -765,15 +846,20 @@ bool UIEdit::handleKeypress(Common::Event *event, bool printable) {
}
return handled;
} else if (event->type == Common::EVENT_KEYDOWN && printable) {
- if (_selStart != _selEnd) deleteChars(_selStart, _selEnd);
+ if (_selStart != _selEnd) {
+ deleteChars(_selStart, _selEnd);
+ }
//WideString wstr = StringUtil::Utf8ToWide(event->kbd.ascii);
WideString wstr;
wstr += (char)event->kbd.ascii;
_selEnd += insertChars(_selEnd, (byte *)StringUtil::wideToAnsi(wstr).c_str(), 1);
- if (_gameRef->_textRTL) _selEnd = _selStart;
- else _selStart = _selEnd;
+ if (_gameRef->_textRTL) {
+ _selEnd = _selStart;
+ } else {
+ _selStart = _selEnd;
+ }
return true;
}
@@ -785,20 +871,26 @@ bool UIEdit::handleKeypress(Common::Event *event, bool printable) {
//////////////////////////////////////////////////////////////////////////
int UIEdit::deleteChars(int start, int end) {
- if (start > end) BaseUtils::swap(&start, &end);
+ if (start > end) {
+ BaseUtils::swap(&start, &end);
+ }
start = MAX(start, (int)0);
end = MIN((size_t)end, strlen(_text));
char *str = new char[strlen(_text) - (end - start) + 1];
if (str) {
- if (start > 0) memcpy(str, _text, start);
+ if (start > 0) {
+ memcpy(str, _text, start);
+ }
memcpy(str + MAX(0, start), _text + end, strlen(_text) - end + 1);
delete[] _text;
_text = str;
}
- if (_parentNotify && _parent) _parent->applyEvent(getName());
+ if (_parentNotify && _parent) {
+ _parent->applyEvent(getName());
+ }
return end - start;
}
@@ -815,7 +907,9 @@ int UIEdit::insertChars(int pos, byte *chars, int num) {
char *str = new char[strlen(_text) + num + 1];
if (str) {
- if (pos > 0) memcpy(str, _text, pos);
+ if (pos > 0) {
+ memcpy(str, _text, pos);
+ }
memcpy(str + pos + num, _text + pos, strlen(_text) - pos + 1);
memcpy(str + pos, chars, num);
@@ -823,7 +917,9 @@ int UIEdit::insertChars(int pos, byte *chars, int num) {
delete[] _text;
_text = str;
}
- if (_parentNotify && _parent) _parent->applyEvent(getName());
+ if (_parentNotify && _parent) {
+ _parent->applyEvent(getName());
+ }
return num;
}
diff --git a/engines/wintermute/ui/ui_entity.cpp b/engines/wintermute/ui/ui_entity.cpp
index 21fa3120ba..c2438b0fc6 100644
--- a/engines/wintermute/ui/ui_entity.cpp
+++ b/engines/wintermute/ui/ui_entity.cpp
@@ -49,7 +49,9 @@ UIEntity::UIEntity(BaseGame *inGame): UIObject(inGame) {
//////////////////////////////////////////////////////////////////////////
UIEntity::~UIEntity() {
- if (_entity) _gameRef->unregisterObject(_entity);
+ if (_entity) {
+ _gameRef->unregisterObject(_entity);
+ }
_entity = NULL;
}
@@ -66,7 +68,9 @@ bool UIEntity::loadFile(const char *filename) {
setFilename(filename);
- if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing ENTITY container file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing ENTITY container file '%s'", filename);
+ }
delete[] buffer;
@@ -117,7 +121,9 @@ bool UIEntity::loadBuffer(byte *buffer, bool complete) {
while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
break;
case TOKEN_NAME:
@@ -141,7 +147,9 @@ bool UIEntity::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_ENTITY:
- if (DID_FAIL(setEntity((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(setEntity((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
break;
case TOKEN_SCRIPT:
@@ -187,8 +195,9 @@ bool UIEntity::saveAsText(BaseDynamicBuffer *buffer, int indent) {
buffer->putTextIndent(indent + 2, "DISABLED=%s\n", _disable ? "TRUE" : "FALSE");
buffer->putTextIndent(indent + 2, "VISIBLE=%s\n", _visible ? "TRUE" : "FALSE");
- if (_entity && _entity->getFilename())
+ if (_entity && _entity->getFilename()) {
buffer->putTextIndent(indent + 2, "ENTITY=\"%s\"\n", _entity->getFilename());
+ }
buffer->putTextIndent(indent + 2, "\n");
@@ -208,7 +217,9 @@ bool UIEntity::saveAsText(BaseDynamicBuffer *buffer, int indent) {
//////////////////////////////////////////////////////////////////////////
bool UIEntity::setEntity(const char *filename) {
- if (_entity) _gameRef->unregisterObject(_entity);
+ if (_entity) {
+ _gameRef->unregisterObject(_entity);
+ }
_entity = new AdEntity(_gameRef);
if (!_entity || DID_FAIL(_entity->loadFile(filename))) {
delete _entity;
@@ -225,19 +236,25 @@ bool UIEntity::setEntity(const char *filename) {
//////////////////////////////////////////////////////////////////////////
bool UIEntity::display(int offsetX, int offsetY) {
- if (!_visible) return STATUS_OK;
+ if (!_visible) {
+ return STATUS_OK;
+ }
if (_entity) {
_entity->_posX = offsetX + _posX;
_entity->_posY = offsetY + _posY;
- if (_entity->_scale < 0) _entity->_zoomable = false;
+ if (_entity->_scale < 0) {
+ _entity->_zoomable = false;
+ }
_entity->_shadowable = false;
_entity->update();
bool origReg = _entity->_registrable;
- if (_entity->_registrable && _disable) _entity->_registrable = false;
+ if (_entity->_registrable && _disable) {
+ _entity->_registrable = false;
+ }
_entity->display();
_entity->_registrable = origReg;
@@ -257,8 +274,11 @@ bool UIEntity::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
if (strcmp(name, "GetEntity") == 0) {
stack->correctParams(0);
- if (_entity) stack->pushNative(_entity, true);
- else stack->pushNULL();
+ if (_entity) {
+ stack->pushNative(_entity, true);
+ } else {
+ stack->pushNULL();
+ }
return STATUS_OK;
}
@@ -271,15 +291,16 @@ bool UIEntity::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
const char *filename = stack->pop()->getString();
- if (DID_SUCCEED(setEntity(filename)))
+ if (DID_SUCCEED(setEntity(filename))) {
stack->pushBool(true);
- else
+ } else {
stack->pushBool(false);
+ }
return STATUS_OK;
+ } else {
+ return UIObject::scCallMethod(script, stack, thisStack, name);
}
-
- else return UIObject::scCallMethod(script, stack, thisStack, name);
}
@@ -299,12 +320,15 @@ ScValue *UIEntity::scGetProperty(const char *name) {
// Freezable
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Freezable") == 0) {
- if (_entity) _scValue->setBool(_entity->_freezable);
- else _scValue->setBool(false);
+ if (_entity) {
+ _scValue->setBool(_entity->_freezable);
+ } else {
+ _scValue->setBool(false);
+ }
return _scValue;
+ } else {
+ return UIObject::scGetProperty(name);
}
-
- else return UIObject::scGetProperty(name);
}
@@ -314,9 +338,13 @@ bool UIEntity::scSetProperty(const char *name, ScValue *value) {
// Freezable
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Freezable") == 0) {
- if (_entity) _entity->makeFreezable(value->getBool());
+ if (_entity) {
+ _entity->makeFreezable(value->getBool());
+ }
return STATUS_OK;
- } else return UIObject::scSetProperty(name, value);
+ } else {
+ return UIObject::scSetProperty(name, value);
+ }
}
diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp
index ed58079ad2..e44bb0f741 100644
--- a/engines/wintermute/ui/ui_object.cpp
+++ b/engines/wintermute/ui/ui_object.cpp
@@ -71,14 +71,24 @@ UIObject::UIObject(BaseGame *inGame): BaseObject(inGame) {
//////////////////////////////////////////////////////////////////////////
UIObject::~UIObject() {
- if (!_gameRef->_loadInProgress) SystemClassRegistry::getInstance()->enumInstances(BaseGame::invalidateValues, "ScValue", (void *)this);
+ if (!_gameRef->_loadInProgress) {
+ SystemClassRegistry::getInstance()->enumInstances(BaseGame::invalidateValues, "ScValue", (void *)this);
+ }
- if (_back) delete _back;
- if (_font && !_sharedFonts) _gameRef->_fontStorage->removeFont(_font);
+ if (_back) {
+ delete _back;
+ }
+ if (_font && !_sharedFonts) {
+ _gameRef->_fontStorage->removeFont(_font);
+ }
- if (_image && !_sharedImages) delete _image;
+ if (_image && !_sharedImages) {
+ delete _image;
+ }
- if (_text) delete[] _text;
+ if (_text) {
+ delete[] _text;
+ }
_focusedWidget = NULL; // ref only
}
@@ -86,12 +96,16 @@ UIObject::~UIObject() {
//////////////////////////////////////////////////////////////////////////
void UIObject::setText(const char *text) {
- if (_text) delete[] _text;
+ if (_text) {
+ delete[] _text;
+ }
_text = new char [strlen(text) + 1];
if (_text) {
strcpy(_text, text);
for (int i = 0; i < strlen(_text); i++) {
- if (_text[i] == '|') _text[i] = '\n';
+ if (_text[i] == '|') {
+ _text[i] = '\n';
+ }
}
}
}
@@ -119,7 +133,9 @@ void UIObject::correctSize() {
if (_image) {
_image->getBoundingRect(&rect, 0, 0);
_width = rect.right - rect.left;
- } else _width = 100;
+ } else {
+ _width = 100;
+ }
}
if (_height <= 0) {
@@ -129,7 +145,9 @@ void UIObject::correctSize() {
}
}
- if (_back) _back->correctSize(&_width, &_height);
+ if (_back) {
+ _back->correctSize(&_width, &_height);
+ }
}
@@ -143,14 +161,16 @@ bool UIObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "SetFont") == 0) {
stack->correctParams(1);
- ScValue *Val = stack->pop();
+ ScValue *val = stack->pop();
- if (_font) _gameRef->_fontStorage->removeFont(_font);
- if (Val->isNULL()) {
+ if (_font) {
+ _gameRef->_fontStorage->removeFont(_font);
+ }
+ if (val->isNULL()) {
_font = NULL;
stack->pushBool(true);
} else {
- _font = _gameRef->_fontStorage->addFont(Val->getString());
+ _font = _gameRef->_fontStorage->addFont(val->getString());
stack->pushBool(_font != NULL);
}
return STATUS_OK;
@@ -177,7 +197,9 @@ bool UIObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
delete _image;
_image = NULL;
stack->pushBool(false);
- } else stack->pushBool(true);
+ } else {
+ stack->pushBool(true);
+ }
return STATUS_OK;
}
@@ -187,8 +209,11 @@ bool UIObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetImage") == 0) {
stack->correctParams(0);
- if (!_image || !_image->getFilename()) stack->pushNULL();
- else stack->pushString(_image->getFilename());
+ if (!_image || !_image->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_image->getFilename());
+ }
return STATUS_OK;
}
@@ -198,8 +223,11 @@ bool UIObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetImageObject") == 0) {
stack->correctParams(0);
- if (!_image) stack->pushNULL();
- else stack->pushNative(_image, true);
+ if (!_image) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_image, true);
+ }
return STATUS_OK;
}
@@ -251,8 +279,12 @@ bool UIObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
bool done = false;
for (int j = 0; j < win->_widgets.getSize(); j++) {
if (win->_widgets[j] == this) {
- if (strcmp(name, "MoveAfter") == 0) i++;
- if (j >= i) j++;
+ if (strcmp(name, "MoveAfter") == 0) {
+ i++;
+ }
+ if (j >= i) {
+ j++;
+ }
win->_widgets.insertAt(i, this);
win->_widgets.removeAt(j);
@@ -262,10 +294,16 @@ bool UIObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
break;
}
}
- if (!done) stack->pushBool(false);
- } else stack->pushBool(false);
+ if (!done) {
+ stack->pushBool(false);
+ }
+ } else {
+ stack->pushBool(false);
+ }
- } else stack->pushBool(false);
+ } else {
+ stack->pushBool(false);
+ }
return STATUS_OK;
}
@@ -286,7 +324,9 @@ bool UIObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
}
}
stack->pushBool(true);
- } else stack->pushBool(false);
+ } else {
+ stack->pushBool(false);
+ }
return STATUS_OK;
}
@@ -307,12 +347,14 @@ bool UIObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
}
}
stack->pushBool(true);
- } else stack->pushBool(false);
+ } else {
+ stack->pushBool(false);
+ }
return STATUS_OK;
+ } else {
+ return BaseObject::scCallMethod(script, stack, thisStack, name);
}
-
- else return BaseObject::scCallMethod(script, stack, thisStack, name);
}
@@ -402,18 +444,22 @@ ScValue *UIObject::scGetProperty(const char *name) {
for (int i = 0; i < win->_widgets.getSize(); i++) {
if (win->_widgets[i] == this) {
if (strcmp(name, "NextSibling") == 0) {
- if (i < win->_widgets.getSize() - 1) _scValue->setNative(win->_widgets[i + 1], true);
+ if (i < win->_widgets.getSize() - 1) {
+ _scValue->setNative(win->_widgets[i + 1], true);
+ }
} else {
- if (i > 0) _scValue->setNative(win->_widgets[i - 1], true);
+ if (i > 0) {
+ _scValue->setNative(win->_widgets[i - 1], true);
+ }
}
break;
}
}
}
return _scValue;
+ } else {
+ return BaseObject::scGetProperty(name);
}
-
- else return BaseObject::scGetProperty(name);
}
@@ -473,9 +519,9 @@ bool UIObject::scSetProperty(const char *name, ScValue *value) {
else if (strcmp(name, "Text") == 0) {
setText(value->getString());
return STATUS_OK;
+ } else {
+ return BaseObject::scSetProperty(name, value);
}
-
- else return BaseObject::scSetProperty(name, value);
}
@@ -487,13 +533,20 @@ const char *UIObject::scToString() {
//////////////////////////////////////////////////////////////////////////
bool UIObject::isFocused() {
- if (!_gameRef->_focusedWindow) return false;
- if (_gameRef->_focusedWindow == this) return true;
+ if (!_gameRef->_focusedWindow) {
+ return false;
+ }
+ if (_gameRef->_focusedWindow == this) {
+ return true;
+ }
UIObject *obj = _gameRef->_focusedWindow;
while (obj) {
- if (obj == this) return true;
- else obj = obj->_focusedWidget;
+ if (obj == this) {
+ return true;
+ } else {
+ obj = obj->_focusedWidget;
+ }
}
return false;
}
@@ -524,9 +577,13 @@ bool UIObject::focus() {
obj = this;
while (obj) {
if (obj->_parent) {
- if (!obj->_disable && obj->_canFocus) obj->_parent->_focusedWidget = obj;
+ if (!obj->_disable && obj->_canFocus) {
+ obj->_parent->_focusedWidget = obj;
+ }
} else {
- if (obj->_type == UI_WINDOW) _gameRef->focusWindow((UIWindow *)obj);
+ if (obj->_type == UI_WINDOW) {
+ _gameRef->focusWindow((UIWindow *)obj);
+ }
}
obj = obj->_parent;
@@ -547,8 +604,12 @@ bool UIObject::getTotalOffset(int *offsetX, int *offsetY) {
obj = obj->_parent;
}
- if (offsetX) *offsetX = offX;
- if (offsetY) *offsetY = offY;
+ if (offsetX) {
+ *offsetX = offX;
+ }
+ if (offsetY) {
+ *offsetY = offY;
+ }
return STATUS_OK;
}
diff --git a/engines/wintermute/ui/ui_text.cpp b/engines/wintermute/ui/ui_text.cpp
index 6d838b8d37..25fef4fd93 100644
--- a/engines/wintermute/ui/ui_text.cpp
+++ b/engines/wintermute/ui/ui_text.cpp
@@ -62,14 +62,22 @@ UIText::~UIText() {
//////////////////////////////////////////////////////////////////////////
bool UIText::display(int offsetX, int offsetY) {
- if (!_visible) return STATUS_OK;
+ if (!_visible) {
+ return STATUS_OK;
+ }
BaseFont *font = _font;
- if (!font) font = _gameRef->_systemFont;
+ if (!font) {
+ font = _gameRef->_systemFont;
+ }
- if (_back) _back->display(offsetX + _posX, offsetY + _posY, _width, _height);
- if (_image) _image->draw(offsetX + _posX, offsetY + _posY, NULL);
+ if (_back) {
+ _back->display(offsetX + _posX, offsetY + _posY, _width, _height);
+ }
+ if (_image) {
+ _image->draw(offsetX + _posX, offsetY + _posY, NULL);
+ }
if (font && _text) {
int textOffset;
@@ -105,7 +113,9 @@ bool UIText::loadFile(const char *filename) {
setFilename(filename);
- if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing STATIC file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing STATIC file '%s'", filename);
+ }
delete[] buffer;
@@ -175,7 +185,9 @@ bool UIText::loadBuffer(byte *buffer, bool complete) {
while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
break;
case TOKEN_NAME:
@@ -207,9 +219,13 @@ bool UIText::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_FONT:
- if (_font) _gameRef->_fontStorage->removeFont(_font);
+ if (_font) {
+ _gameRef->_fontStorage->removeFont(_font);
+ }
_font = _gameRef->_fontStorage->addFont((char *)params);
- if (!_font) cmd = PARSERR_GENERIC;
+ if (!_font) {
+ cmd = PARSERR_GENERIC;
+ }
break;
case TOKEN_TEXT:
@@ -218,15 +234,23 @@ bool UIText::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_TEXT_ALIGN:
- if (scumm_stricmp((char *)params, "left") == 0) _textAlign = TAL_LEFT;
- else if (scumm_stricmp((char *)params, "right") == 0) _textAlign = TAL_RIGHT;
- else _textAlign = TAL_CENTER;
+ if (scumm_stricmp((char *)params, "left") == 0) {
+ _textAlign = TAL_LEFT;
+ } else if (scumm_stricmp((char *)params, "right") == 0) {
+ _textAlign = TAL_RIGHT;
+ } else {
+ _textAlign = TAL_CENTER;
+ }
break;
case TOKEN_VERTICAL_ALIGN:
- if (scumm_stricmp((char *)params, "top") == 0) _verticalAlign = VAL_TOP;
- else if (scumm_stricmp((char *)params, "bottom") == 0) _verticalAlign = VAL_BOTTOM;
- else _verticalAlign = VAL_CENTER;
+ if (scumm_stricmp((char *)params, "top") == 0) {
+ _verticalAlign = VAL_TOP;
+ } else if (scumm_stricmp((char *)params, "bottom") == 0) {
+ _verticalAlign = VAL_BOTTOM;
+ } else {
+ _verticalAlign = VAL_CENTER;
+ }
break;
case TOKEN_X:
@@ -300,20 +324,25 @@ bool UIText::saveAsText(BaseDynamicBuffer *buffer, int indent) {
buffer->putTextIndent(indent + 2, "\n");
- if (_back && _back->getFilename())
+ if (_back && _back->getFilename()) {
buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->getFilename());
+ }
- if (_image && _image->getFilename())
+ if (_image && _image->getFilename()) {
buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->getFilename());
+ }
- if (_font && _font->getFilename())
+ if (_font && _font->getFilename()) {
buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
+ }
- if (_cursor && _cursor->getFilename())
+ if (_cursor && _cursor->getFilename()) {
buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
+ }
- if (_text)
+ if (_text) {
buffer->putTextIndent(indent + 2, "TEXT=\"%s\"\n", _text);
+ }
switch (_textAlign) {
case TAL_LEFT:
@@ -390,12 +419,14 @@ bool UIText::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack,
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "HeightToFit") == 0) {
stack->correctParams(0);
- if (_font && _text) _height = _font->getTextHeight((byte *)_text, _width);
+ if (_font && _text) {
+ _height = _font->getTextHeight((byte *)_text, _width);
+ }
stack->pushNULL();
return STATUS_OK;
+ } else {
+ return UIObject::scCallMethod(script, stack, thisStack, name);
}
-
- else return UIObject::scCallMethod(script, stack, thisStack, name);
}
@@ -425,9 +456,9 @@ ScValue *UIText::scGetProperty(const char *name) {
else if (strcmp(name, "VerticalAlign") == 0) {
_scValue->setInt(_verticalAlign);
return _scValue;
+ } else {
+ return UIObject::scGetProperty(name);
}
-
- else return UIObject::scGetProperty(name);
}
@@ -438,7 +469,9 @@ bool UIText::scSetProperty(const char *name, ScValue *value) {
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "TextAlign") == 0) {
int i = value->getInt();
- if (i < 0 || i >= NUM_TEXT_ALIGN) i = 0;
+ if (i < 0 || i >= NUM_TEXT_ALIGN) {
+ i = 0;
+ }
_textAlign = (TTextAlign)i;
return STATUS_OK;
}
@@ -448,12 +481,14 @@ bool UIText::scSetProperty(const char *name, ScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "VerticalAlign") == 0) {
int i = value->getInt();
- if (i < 0 || i >= NUM_VERTICAL_ALIGN) i = 0;
+ if (i < 0 || i >= NUM_VERTICAL_ALIGN) {
+ i = 0;
+ }
_verticalAlign = (TVerticalAlign)i;
return STATUS_OK;
+ } else {
+ return UIObject::scSetProperty(name, value);
}
-
- else return UIObject::scSetProperty(name, value);
}
diff --git a/engines/wintermute/ui/ui_tiled_image.cpp b/engines/wintermute/ui/ui_tiled_image.cpp
index e0b2a75ee4..c11361de8d 100644
--- a/engines/wintermute/ui/ui_tiled_image.cpp
+++ b/engines/wintermute/ui/ui_tiled_image.cpp
@@ -64,7 +64,9 @@ UITiledImage::~UITiledImage() {
//////////////////////////////////////////////////////////////////////////
bool UITiledImage::display(int x, int y, int width, int height) {
- if (!_image) return STATUS_FAILED;
+ if (!_image) {
+ return STATUS_FAILED;
+ }
int tileWidth = _middleMiddle.right - _middleMiddle.left;
int tileHeight = _middleMiddle.bottom - _middleMiddle.top;
@@ -129,7 +131,9 @@ bool UITiledImage::loadFile(const char *filename) {
setFilename(filename);
- if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing TILED_IMAGE file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing TILED_IMAGE file '%s'", filename);
+ }
delete[] buffer;
@@ -193,7 +197,9 @@ bool UITiledImage::loadBuffer(byte *buffer, bool complete) {
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
break;
case TOKEN_IMAGE:
@@ -288,17 +294,35 @@ bool UITiledImage::loadBuffer(byte *buffer, bool complete) {
int width = _image->_surface->getWidth() / 3;
int height = _image->_surface->getHeight() / 3;
- if (BasePlatform::isRectEmpty(&_upLeft)) BasePlatform::setRect(&_upLeft, 0, 0, width, height);
- if (BasePlatform::isRectEmpty(&_upMiddle)) BasePlatform::setRect(&_upMiddle, width, 0, 2 * width, height);
- if (BasePlatform::isRectEmpty(&_upRight)) BasePlatform::setRect(&_upRight, 2 * width, 0, 3 * width, height);
+ if (BasePlatform::isRectEmpty(&_upLeft)) {
+ BasePlatform::setRect(&_upLeft, 0, 0, width, height);
+ }
+ if (BasePlatform::isRectEmpty(&_upMiddle)) {
+ BasePlatform::setRect(&_upMiddle, width, 0, 2 * width, height);
+ }
+ if (BasePlatform::isRectEmpty(&_upRight)) {
+ BasePlatform::setRect(&_upRight, 2 * width, 0, 3 * width, height);
+ }
- if (BasePlatform::isRectEmpty(&_middleLeft)) BasePlatform::setRect(&_middleLeft, 0, height, width, 2 * height);
- if (BasePlatform::isRectEmpty(&_middleMiddle)) BasePlatform::setRect(&_middleMiddle, width, height, 2 * width, 2 * height);
- if (BasePlatform::isRectEmpty(&_middleRight)) BasePlatform::setRect(&_middleRight, 2 * width, height, 3 * width, 2 * height);
+ if (BasePlatform::isRectEmpty(&_middleLeft)) {
+ BasePlatform::setRect(&_middleLeft, 0, height, width, 2 * height);
+ }
+ if (BasePlatform::isRectEmpty(&_middleMiddle)) {
+ BasePlatform::setRect(&_middleMiddle, width, height, 2 * width, 2 * height);
+ }
+ if (BasePlatform::isRectEmpty(&_middleRight)) {
+ BasePlatform::setRect(&_middleRight, 2 * width, height, 3 * width, 2 * height);
+ }
- if (BasePlatform::isRectEmpty(&_downLeft)) BasePlatform::setRect(&_downLeft, 0, 2 * height, width, 3 * height);
- if (BasePlatform::isRectEmpty(&_downMiddle)) BasePlatform::setRect(&_downMiddle, width, 2 * height, 2 * width, 3 * height);
- if (BasePlatform::isRectEmpty(&_downRight)) BasePlatform::setRect(&_downRight, 2 * width, 2 * height, 3 * width, 3 * height);
+ if (BasePlatform::isRectEmpty(&_downLeft)) {
+ BasePlatform::setRect(&_downLeft, 0, 2 * height, width, 3 * height);
+ }
+ if (BasePlatform::isRectEmpty(&_downMiddle)) {
+ BasePlatform::setRect(&_downMiddle, width, 2 * height, 2 * width, 3 * height);
+ }
+ if (BasePlatform::isRectEmpty(&_downRight)) {
+ BasePlatform::setRect(&_downRight, 2 * width, 2 * height, 3 * width, 3 * height);
+ }
}
return STATUS_OK;
@@ -309,8 +333,9 @@ bool UITiledImage::saveAsText(BaseDynamicBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "TILED_IMAGE\n");
buffer->putTextIndent(indent, "{\n");
- if (_image && _image->_surfaceFilename)
+ if (_image && _image->_surfaceFilename) {
buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->_surfaceFilename);
+ }
int h1, h2, h3;
int v1, v2, v3;
diff --git a/engines/wintermute/ui/ui_window.cpp b/engines/wintermute/ui/ui_window.cpp
index b14c832397..f221405f15 100644
--- a/engines/wintermute/ui/ui_window.cpp
+++ b/engines/wintermute/ui/ui_window.cpp
@@ -103,10 +103,16 @@ void UIWindow::cleanup() {
_viewport = NULL;
delete _backInactive;
- if (!_sharedFonts && _fontInactive) _gameRef->_fontStorage->removeFont(_fontInactive);
- if (!_sharedImages && _imageInactive) delete _imageInactive;
+ if (!_sharedFonts && _fontInactive) {
+ _gameRef->_fontStorage->removeFont(_fontInactive);
+ }
+ if (!_sharedImages && _imageInactive) {
+ delete _imageInactive;
+ }
- for (int i = 0; i < _widgets.getSize(); i++) delete _widgets[i];
+ for (int i = 0; i < _widgets.getSize(); i++) {
+ delete _widgets[i];
+ }
_widgets.removeAll();
}
@@ -115,7 +121,9 @@ void UIWindow::cleanup() {
bool UIWindow::display(int offsetX, int offsetY) {
// go exclusive
if (_mode == WINDOW_EXCLUSIVE || _mode == WINDOW_SYSTEM_EXCLUSIVE) {
- if (!_shieldWindow) _shieldWindow = new UIWindow(_gameRef);
+ if (!_shieldWindow) {
+ _shieldWindow = new UIWindow(_gameRef);
+ }
if (_shieldWindow) {
_shieldWindow->_posX = _shieldWindow->_posY = 0;
_shieldWindow->_width = _gameRef->_renderer->_width;
@@ -139,8 +147,9 @@ bool UIWindow::display(int offsetX, int offsetY) {
}
}
- if (!_visible)
+ if (!_visible) {
return STATUS_OK;
+ }
if (_fadeBackground) {
Graphics::PixelFormat format = _gameRef->_renderer->getPixelFormat();
@@ -166,7 +175,9 @@ bool UIWindow::display(int offsetX, int offsetY) {
bool popViewport = false;
if (_clipContents) {
- if (!_viewport) _viewport = new BaseViewport(_gameRef);
+ if (!_viewport) {
+ _viewport = new BaseViewport(_gameRef);
+ }
if (_viewport) {
_viewport->setRect(_posX + offsetX, _posY + offsetY, _posX + _width + offsetX, _posY + _height + offsetY);
_gameRef->pushViewport(_viewport);
@@ -180,34 +191,46 @@ bool UIWindow::display(int offsetX, int offsetY) {
BaseFont *font = _font;
if (!isFocused()) {
- if (_backInactive) back = _backInactive;
- if (_imageInactive) image = _imageInactive;
- if (_fontInactive) font = _fontInactive;
+ if (_backInactive) {
+ back = _backInactive;
+ }
+ if (_imageInactive) {
+ image = _imageInactive;
+ }
+ if (_fontInactive) {
+ font = _fontInactive;
+ }
}
- if (_alphaColor != 0)
+ if (_alphaColor != 0) {
_gameRef->_renderer->_forceAlphaColor = _alphaColor;
- if (back)
+ }
+ if (back) {
back->display(_posX + offsetX, _posY + offsetY, _width, _height);
- if (image)
+ }
+ if (image) {
image->draw(_posX + offsetX, _posY + offsetY, _transparent ? NULL : this);
+ }
if (!BasePlatform::isRectEmpty(&_titleRect) && font && _text) {
font->drawText((byte *)_text, _posX + offsetX + _titleRect.left, _posY + offsetY + _titleRect.top, _titleRect.right - _titleRect.left, _titleAlign, _titleRect.bottom - _titleRect.top);
}
- if (!_transparent && !image)
+ if (!_transparent && !image) {
_gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, this, NULL, _posX + offsetX, _posY + offsetY, _width, _height, 100, 100, false));
+ }
for (int i = 0; i < _widgets.getSize(); i++) {
_widgets[i]->display(_posX + offsetX, _posY + offsetY);
}
- if (_alphaColor != 0)
+ if (_alphaColor != 0) {
_gameRef->_renderer->_forceAlphaColor = 0;
+ }
- if (popViewport)
+ if (popViewport) {
_gameRef->popViewport();
+ }
return STATUS_OK;
}
@@ -225,7 +248,9 @@ bool UIWindow::loadFile(const char *filename) {
setFilename(filename);
- if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing WINDOW file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) {
+ _gameRef->LOG(0, "Error parsing WINDOW file '%s'", filename);
+ }
delete[] buffer;
@@ -330,7 +355,9 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) {
while (cmd >= PARSERR_TOKENNOTFOUND && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) >= PARSERR_TOKENNOTFOUND) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) {
+ cmd = PARSERR_GENERIC;
+ }
break;
case TOKEN_NAME:
@@ -382,15 +409,23 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_FONT:
- if (_font) _gameRef->_fontStorage->removeFont(_font);
+ if (_font) {
+ _gameRef->_fontStorage->removeFont(_font);
+ }
_font = _gameRef->_fontStorage->addFont((char *)params);
- if (!_font) cmd = PARSERR_GENERIC;
+ if (!_font) {
+ cmd = PARSERR_GENERIC;
+ }
break;
case TOKEN_FONT_INACTIVE:
- if (_fontInactive) _gameRef->_fontStorage->removeFont(_fontInactive);
+ if (_fontInactive) {
+ _gameRef->_fontStorage->removeFont(_fontInactive);
+ }
_fontInactive = _gameRef->_fontStorage->addFont((char *)params);
- if (!_fontInactive) cmd = PARSERR_GENERIC;
+ if (!_fontInactive) {
+ cmd = PARSERR_GENERIC;
+ }
break;
case TOKEN_TITLE:
@@ -399,9 +434,13 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_TITLE_ALIGN:
- if (scumm_stricmp((char *)params, "left") == 0) _titleAlign = TAL_LEFT;
- else if (scumm_stricmp((char *)params, "right") == 0) _titleAlign = TAL_RIGHT;
- else _titleAlign = TAL_CENTER;
+ if (scumm_stricmp((char *)params, "left") == 0) {
+ _titleAlign = TAL_LEFT;
+ } else if (scumm_stricmp((char *)params, "right") == 0) {
+ _titleAlign = TAL_RIGHT;
+ } else {
+ _titleAlign = TAL_CENTER;
+ }
break;
case TOKEN_TITLE_RECT:
@@ -572,8 +611,9 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) {
}
_alphaColor = BYTETORGBA(ar, ag, ab, alpha);
- if (_fadeBackground)
+ if (_fadeBackground) {
_fadeColor = BYTETORGBA(fadeR, fadeG, fadeB, fadeA);
+ }
_focusedWidget = NULL;
@@ -590,28 +630,36 @@ bool UIWindow::saveAsText(BaseDynamicBuffer *buffer, int indent) {
buffer->putTextIndent(indent + 2, "\n");
- if (_back && _back->getFilename())
+ if (_back && _back->getFilename()) {
buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->getFilename());
- if (_backInactive && _backInactive->getFilename())
+ }
+ if (_backInactive && _backInactive->getFilename()) {
buffer->putTextIndent(indent + 2, "BACK_INACTIVE=\"%s\"\n", _backInactive->getFilename());
+ }
- if (_image && _image->getFilename())
+ if (_image && _image->getFilename()) {
buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->getFilename());
- if (_imageInactive && _imageInactive->getFilename())
+ }
+ if (_imageInactive && _imageInactive->getFilename()) {
buffer->putTextIndent(indent + 2, "IMAGE_INACTIVE=\"%s\"\n", _imageInactive->getFilename());
+ }
- if (_font && _font->getFilename())
+ if (_font && _font->getFilename()) {
buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
- if (_fontInactive && _fontInactive->getFilename())
+ }
+ if (_fontInactive && _fontInactive->getFilename()) {
buffer->putTextIndent(indent + 2, "FONT_INACTIVE=\"%s\"\n", _fontInactive->getFilename());
+ }
- if (_cursor && _cursor->getFilename())
+ if (_cursor && _cursor->getFilename()) {
buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
+ }
buffer->putTextIndent(indent + 2, "\n");
- if (_text)
+ if (_text) {
buffer->putTextIndent(indent + 2, "TITLE=\"%s\"\n", _text);
+ }
switch (_titleAlign) {
case TAL_LEFT:
@@ -675,8 +723,9 @@ bool UIWindow::saveAsText(BaseDynamicBuffer *buffer, int indent) {
BaseClass::saveAsText(buffer, indent + 2);
// controls
- for (int i = 0; i < _widgets.getSize(); i++)
+ for (int i = 0; i < _widgets.getSize(); i++) {
_widgets[i]->saveAsText(buffer, indent + 2);
+ }
buffer->putTextIndent(indent, "}\n");
@@ -686,7 +735,9 @@ bool UIWindow::saveAsText(BaseDynamicBuffer *buffer, int indent) {
//////////////////////////////////////////////////////////////////////////
bool UIWindow::enableWidget(const char *name, bool Enable) {
for (int i = 0; i < _widgets.getSize(); i++) {
- if (scumm_stricmp(_widgets[i]->getName(), name) == 0) _widgets[i]->_disable = !Enable;
+ if (scumm_stricmp(_widgets[i]->getName(), name) == 0) {
+ _widgets[i]->_disable = !Enable;
+ }
}
return STATUS_OK;
}
@@ -695,7 +746,9 @@ bool UIWindow::enableWidget(const char *name, bool Enable) {
//////////////////////////////////////////////////////////////////////////
bool UIWindow::showWidget(const char *name, bool Visible) {
for (int i = 0; i < _widgets.getSize(); i++) {
- if (scumm_stricmp(_widgets[i]->getName(), name) == 0) _widgets[i]->_visible = Visible;
+ if (scumm_stricmp(_widgets[i]->getName(), name) == 0) {
+ _widgets[i]->_visible = Visible;
+ }
}
return STATUS_OK;
}
@@ -713,8 +766,11 @@ bool UIWindow::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
ScValue *val = stack->pop();
if (val->getType() == VAL_INT) {
int widget = val->getInt();
- if (widget < 0 || widget >= _widgets.getSize()) stack->pushNULL();
- else stack->pushNative(_widgets[widget], true);
+ if (widget < 0 || widget >= _widgets.getSize()) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_widgets[widget], true);
+ }
} else {
for (int i = 0; i < _widgets.getSize(); i++) {
if (scumm_stricmp(_widgets[i]->getName(), val->getString()) == 0) {
@@ -734,7 +790,9 @@ bool UIWindow::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
else if (strcmp(name, "SetInactiveFont") == 0) {
stack->correctParams(1);
- if (_fontInactive) _gameRef->_fontStorage->removeFont(_fontInactive);
+ if (_fontInactive) {
+ _gameRef->_fontStorage->removeFont(_fontInactive);
+ }
_fontInactive = _gameRef->_fontStorage->addFont(stack->pop()->getString());
stack->pushBool(_fontInactive != NULL);
@@ -754,7 +812,9 @@ bool UIWindow::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
delete _imageInactive;
_imageInactive = NULL;
stack->pushBool(false);
- } else stack->pushBool(true);
+ } else {
+ stack->pushBool(true);
+ }
return STATUS_OK;
}
@@ -764,8 +824,11 @@ bool UIWindow::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetInactiveImage") == 0) {
stack->correctParams(0);
- if (!_imageInactive || !_imageInactive->getFilename()) stack->pushNULL();
- else stack->pushString(_imageInactive->getFilename());
+ if (!_imageInactive || !_imageInactive->getFilename()) {
+ stack->pushNULL();
+ } else {
+ stack->pushString(_imageInactive->getFilename());
+ }
return STATUS_OK;
}
@@ -775,8 +838,11 @@ bool UIWindow::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetInactiveImageObject") == 0) {
stack->correctParams(0);
- if (!_imageInactive) stack->pushNULL();
- else stack->pushNative(_imageInactive, true);
+ if (!_imageInactive) {
+ stack->pushNULL();
+ } else {
+ stack->pushNative(_imageInactive, true);
+ }
return STATUS_OK;
}
@@ -834,7 +900,9 @@ bool UIWindow::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
cleanup();
if (!val->isNULL()) {
stack->pushBool(DID_SUCCEED(loadFile(val->getString())));
- } else stack->pushBool(true);
+ } else {
+ stack->pushBool(true);
+ }
return STATUS_OK;
}
@@ -847,7 +915,9 @@ bool UIWindow::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
ScValue *val = stack->pop();
UIButton *btn = new UIButton(_gameRef);
- if (!val->isNULL()) btn->setName(val->getString());
+ if (!val->isNULL()) {
+ btn->setName(val->getString());
+ }
stack->pushNative(btn, true);
btn->_parent = this;
@@ -864,7 +934,9 @@ bool UIWindow::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
ScValue *val = stack->pop();
UIText *sta = new UIText(_gameRef);
- if (!val->isNULL()) sta->setName(val->getString());
+ if (!val->isNULL()) {
+ sta->setName(val->getString());
+ }
stack->pushNative(sta, true);
sta->_parent = this;
@@ -881,7 +953,9 @@ bool UIWindow::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
ScValue *val = stack->pop();
UIEdit *edi = new UIEdit(_gameRef);
- if (!val->isNULL()) edi->setName(val->getString());
+ if (!val->isNULL()) {
+ edi->setName(val->getString());
+ }
stack->pushNative(edi, true);
edi->_parent = this;
@@ -898,7 +972,9 @@ bool UIWindow::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
ScValue *val = stack->pop();
UIWindow *win = new UIWindow(_gameRef);
- if (!val->isNULL()) win->setName(val->getString());
+ if (!val->isNULL()) {
+ win->setName(val->getString());
+ }
stack->pushNative(win, true);
win->_parent = this;
@@ -919,14 +995,20 @@ bool UIWindow::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
if (_widgets[i] == obj) {
delete _widgets[i];
_widgets.removeAt(i);
- if (val->getType() == VAL_VARIABLE_REF) val->setNULL();
+ if (val->getType() == VAL_VARIABLE_REF) {
+ val->setNULL();
+ }
}
}
stack->pushNULL();
return STATUS_OK;
- } else if DID_SUCCEED(_gameRef->windowScriptMethodHook(this, script, stack, name)) return STATUS_OK;
+ } else if DID_SUCCEED(_gameRef->windowScriptMethodHook(this, script, stack, name)) {
+ return STATUS_OK;
+ }
- else return UIObject::scCallMethod(script, stack, thisStack, name);
+ else {
+ return UIObject::scCallMethod(script, stack, thisStack, name);
+ }
}
@@ -1012,9 +1094,9 @@ ScValue *UIWindow::scGetProperty(const char *name) {
else if (strcmp(name, "FadeColor") == 0) {
_scValue->setInt((int)_fadeColor);
return _scValue;
+ } else {
+ return UIObject::scGetProperty(name);
}
-
- else return UIObject::scGetProperty(name);
}
@@ -1081,9 +1163,9 @@ bool UIWindow::scSetProperty(const char *name, ScValue *value) {
// Exclusive
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Exclusive") == 0) {
- if (value->getBool())
+ if (value->getBool()) {
goExclusive();
- else {
+ } else {
close();
_visible = true;
}
@@ -1094,16 +1176,16 @@ bool UIWindow::scSetProperty(const char *name, ScValue *value) {
// SystemExclusive
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SystemExclusive") == 0) {
- if (value->getBool())
+ if (value->getBool()) {
goSystemExclusive();
- else {
+ } else {
close();
_visible = true;
}
return STATUS_OK;
+ } else {
+ return UIObject::scSetProperty(name, value);
}
-
- else return UIObject::scSetProperty(name, value);
}
@@ -1119,8 +1201,11 @@ bool UIWindow::handleKeypress(Common::Event *event, bool printable) {
if (event->type == Common::EVENT_KEYDOWN && event->kbd.keycode == Common::KEYCODE_TAB) {
return DID_SUCCEED(moveFocus(!BaseKeyboardState::isShiftDown()));
} else {
- if (_focusedWidget) return _focusedWidget->handleKeypress(event, printable);
- else return false;
+ if (_focusedWidget) {
+ return _focusedWidget->handleKeypress(event, printable);
+ } else {
+ return false;
+ }
}
return false;
}
@@ -1128,8 +1213,11 @@ bool UIWindow::handleKeypress(Common::Event *event, bool printable) {
//////////////////////////////////////////////////////////////////////////
bool UIWindow::handleMouseWheel(int Delta) {
- if (_focusedWidget) return _focusedWidget->handleMouseWheel(Delta);
- else return false;
+ if (_focusedWidget) {
+ return _focusedWidget->handleMouseWheel(Delta);
+ } else {
+ return false;
+ }
}
@@ -1204,11 +1292,16 @@ bool UIWindow::moveFocus(bool forward) {
break;
}
}
- if (!found) _focusedWidget = NULL;
+ if (!found) {
+ _focusedWidget = NULL;
+ }
if (!_focusedWidget) {
- if (_widgets.getSize() > 0) i = 0;
- else return STATUS_OK;
+ if (_widgets.getSize() > 0) {
+ i = 0;
+ } else {
+ return STATUS_OK;
+ }
}
int numTries = 0;
@@ -1223,10 +1316,14 @@ bool UIWindow::moveFocus(bool forward) {
if (forward) {
i++;
- if (i >= _widgets.getSize()) i = 0;
+ if (i >= _widgets.getSize()) {
+ i = 0;
+ }
} else {
i--;
- if (i < 0) i = _widgets.getSize() - 1;
+ if (i < 0) {
+ i = _widgets.getSize() - 1;
+ }
}
numTries++;
}
@@ -1237,7 +1334,9 @@ bool UIWindow::moveFocus(bool forward) {
//////////////////////////////////////////////////////////////////////////
bool UIWindow::goExclusive() {
- if (_mode == WINDOW_EXCLUSIVE) return STATUS_OK;
+ if (_mode == WINDOW_EXCLUSIVE) {
+ return STATUS_OK;
+ }
if (_mode == WINDOW_NORMAL) {
_ready = false;
@@ -1246,13 +1345,17 @@ bool UIWindow::goExclusive() {
_disable = false;
_gameRef->focusWindow(this);
return STATUS_OK;
- } else return STATUS_FAILED;
+ } else {
+ return STATUS_FAILED;
+ }
}
//////////////////////////////////////////////////////////////////////////
bool UIWindow::goSystemExclusive() {
- if (_mode == WINDOW_SYSTEM_EXCLUSIVE) return STATUS_OK;
+ if (_mode == WINDOW_SYSTEM_EXCLUSIVE) {
+ return STATUS_OK;
+ }
makeFreezable(false);
@@ -1287,8 +1390,11 @@ bool UIWindow::listen(BaseScriptHolder *param1, uint32 param2) {
switch (obj->_type) {
case UI_BUTTON:
- if (scumm_stricmp(obj->getName(), "close") == 0) close();
- else return BaseObject::listen(param1, param2);
+ if (scumm_stricmp(obj->getName(), "close") == 0) {
+ close();
+ } else {
+ return BaseObject::listen(param1, param2);
+ }
break;
default:
return BaseObject::listen(param1, param2);
@@ -1300,8 +1406,9 @@ bool UIWindow::listen(BaseScriptHolder *param1, uint32 param2) {
//////////////////////////////////////////////////////////////////////////
void UIWindow::makeFreezable(bool freezable) {
- for (int i = 0; i < _widgets.getSize(); i++)
+ for (int i = 0; i < _widgets.getSize(); i++) {
_widgets[i]->makeFreezable(freezable);
+ }
BaseObject::makeFreezable(freezable);
}
@@ -1311,7 +1418,9 @@ void UIWindow::makeFreezable(bool freezable) {
bool UIWindow::getWindowObjects(BaseArray<UIObject *, UIObject *> &objects, bool interactiveOnly) {
for (int i = 0; i < _widgets.getSize(); i++) {
UIObject *control = _widgets[i];
- if (control->_disable && interactiveOnly) continue;
+ if (control->_disable && interactiveOnly) {
+ continue;
+ }
switch (control->_type) {
case UI_WINDOW:
@@ -1324,7 +1433,9 @@ bool UIWindow::getWindowObjects(BaseArray<UIObject *, UIObject *> &objects, bool
break;
default:
- if (!interactiveOnly) objects.add(control);
+ if (!interactiveOnly) {
+ objects.add(control);
+ }
}
}
return STATUS_OK;