diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-10-11 17:35:24 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-10-11 18:00:22 +0300 |
commit | 52c7195a8ee91f95ef134d9798a47ea313df16c8 (patch) | |
tree | ca1f32cfadce611a1820b50f5386c02cd2ce06ae /src/gui/widgets | |
parent | f1b82c1b06604c2c1eed750a6c980aa0b5355560 (diff) | |
download | plus-52c7195a8ee91f95ef134d9798a47ea313df16c8.tar.gz plus-52c7195a8ee91f95ef134d9798a47ea313df16c8.tar.bz2 plus-52c7195a8ee91f95ef134d9798a47ea313df16c8.tar.xz plus-52c7195a8ee91f95ef134d9798a47ea313df16c8.zip |
Second part of checks from Parasoft C++ Test.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/emoteshortcutcontainer.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/itemshortcutcontainer.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/scrollarea.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/shoplistbox.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/spellshortcutcontainer.cpp | 11 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_joystick.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/tabs/tab.cpp | 55 |
8 files changed, 44 insertions, 50 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 023c3298d..35c647d43 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -610,8 +610,7 @@ int BrowserBox::calcHeight() else end = idx2; - if (mUseLinksAndUserColors || - (!mUseLinksAndUserColors && (start == 0))) + if (start == 0 || mUseLinksAndUserColors) { // Check for color change in format "##x", x = [L,P,0..9] if (row.find("##", start) == start && row.size() > start + 2) diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index 6afa5fae4..8ce8fad17 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -103,9 +103,12 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics) return; BLOCK_START("EmoteShortcutContainer::draw") - mAlpha = client->getGuiAlpha(); - if (client->getGuiAlpha() != mAlpha && mBackgroundImg) - mBackgroundImg->setAlpha(mAlpha); + if (client->getGuiAlpha() != mAlpha) + { + if (mBackgroundImg) + mBackgroundImg->setAlpha(mAlpha); + mAlpha = client->getGuiAlpha(); + } Graphics *const g = static_cast<Graphics *const>(graphics); gcn::Font *const font = getFont(); diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index aeae7dd95..87ce28fe0 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -119,11 +119,11 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics) return; } - mAlpha = client->getGuiAlpha(); if (client->getGuiAlpha() != mAlpha) { if (mBackgroundImg) mBackgroundImg->setAlpha(mAlpha); + mAlpha = client->getGuiAlpha(); } Graphics *const g = static_cast<Graphics*>(graphics); diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 3d79a2a2e..b537dd2ed 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -857,7 +857,7 @@ gcn::Rectangle ScrollArea::getHorizontalBarDimension() const if (!mHBarVisible) return gcn::Rectangle(0, 0, 0, 0); - const int width = (mHBarVisible && mShowButtons) ? mScrollbarWidth : 0; + const int width = mShowButtons ? mScrollbarWidth : 0; if (mVBarVisible) { return gcn::Rectangle(width, @@ -879,7 +879,7 @@ gcn::Rectangle ScrollArea::getVerticalMarkerDimension() int length, pos; int height; - const int h2 = (mVBarVisible && mShowButtons) + const int h2 = mShowButtons ? mScrollbarWidth : mMarkerSize / 2; const gcn::Widget *content; if (!mWidgets.empty()) @@ -937,7 +937,7 @@ gcn::Rectangle ScrollArea::getHorizontalMarkerDimension() int length, pos; int width; - const int w2 = (mHBarVisible && mShowButtons) + const int w2 = mShowButtons ? mScrollbarWidth : mMarkerSize / 2; const gcn::Widget *content; if (!mWidgets.empty()) diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 263a94d95..d0ff4e746 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -192,7 +192,7 @@ void ShopListBox::setPriceCheck(const bool check) void ShopListBox::mouseMoved(gcn::MouseEvent &event) { - if (!mItemPopup) + if (!mItemPopup || !mRowHeight) return; if (!mShopItems) diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 648a493b1..6e1db9cbd 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -235,13 +235,10 @@ void SpellShortcutContainer::mouseReleased(gcn::MouseEvent &event) { const int oldIndex = dragDrop.getTag(); const int idx = mNumber * SPELL_SHORTCUT_ITEMS; - if (spellManager) - { - spellManager->swap(idx + index, idx + oldIndex); - spellManager->save(); - dragDrop.clear(); - dragDrop.deselect(); - } + spellManager->swap(idx + index, idx + oldIndex); + spellManager->save(); + dragDrop.clear(); + dragDrop.deselect(); } } else diff --git a/src/gui/widgets/tabs/setup_joystick.cpp b/src/gui/widgets/tabs/setup_joystick.cpp index 15b6959a9..571d53b6f 100644 --- a/src/gui/widgets/tabs/setup_joystick.cpp +++ b/src/gui/widgets/tabs/setup_joystick.cpp @@ -178,10 +178,8 @@ void Setup_Joystick::apply() if (!joystick) return; - config.setValue("joystickEnabled", - joystick ? joystick->isEnabled() : false); + config.setValue("joystickEnabled", joystick->isEnabled()); config.setValue("useInactiveJoystick", mUseInactiveCheckBox->isSelected()); - if (joystick) - joystick->setUseInactive(mUseInactiveCheckBox->isSelected()); + joystick->setUseInactive(mUseInactiveCheckBox->isSelected()); } diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp index 8c25e7b1d..733d030d2 100644 --- a/src/gui/widgets/tabs/tab.cpp +++ b/src/gui/widgets/tabs/tab.cpp @@ -215,47 +215,44 @@ void Tab::draw(gcn::Graphics *graphics) Graphics *const g = static_cast<Graphics*>(graphics); - if (skin) + // draw tab + if (openGLMode != RENDER_SAFE_OPENGL) { - // draw tab - if (openGLMode != RENDER_SAFE_OPENGL) + const ImageRect &rect = skin->getBorder(); + if (mRedraw || mode != mMode || g->getRedraw()) { - const ImageRect &rect = skin->getBorder(); - if (mRedraw || mode != mMode || g->getRedraw()) - { - mMode = mode; - mRedraw = false; - mVertexes->clear(); - g->calcWindow(mVertexes, 0, 0, - mDimension.width, mDimension.height, rect); - - if (mImage) - { - const Skin *const skin1 = tabImg[TAB_STANDARD]; - if (skin1) - { - const int padding = skin1->getPadding(); - g->calcTile(mVertexes, mImage, padding, padding); - } - } - } + mMode = mode; + mRedraw = false; + mVertexes->clear(); + g->calcWindow(mVertexes, 0, 0, + mDimension.width, mDimension.height, rect); - g->drawTile(mVertexes); - } - else - { - g->drawImageRect(0, 0, - mDimension.width, mDimension.height, skin->getBorder()); if (mImage) { const Skin *const skin1 = tabImg[TAB_STANDARD]; if (skin1) { const int padding = skin1->getPadding(); - g->drawImage(mImage, padding, padding); + g->calcTile(mVertexes, mImage, padding, padding); } } } + + g->drawTile(mVertexes); + } + else + { + g->drawImageRect(0, 0, + mDimension.width, mDimension.height, skin->getBorder()); + if (mImage) + { + const Skin *const skin1 = tabImg[TAB_STANDARD]; + if (skin1) + { + const int padding = skin1->getPadding(); + g->drawImage(mImage, padding, padding); + } + } } drawChildren(graphics); |