summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-30 22:51:23 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-30 22:51:23 +0300
commitef8ef35d28daa3ea7dd542078ac9c0d3f7a9a5e2 (patch)
treec3d7c79fca18ac387d0c90512ef3201c92da5890 /src/gui/widgets
parent22b64d16b613c1e5b26632237879b167024788ab (diff)
downloadmanaplus-ef8ef35d28daa3ea7dd542078ac9c0d3f7a9a5e2.tar.gz
manaplus-ef8ef35d28daa3ea7dd542078ac9c0d3f7a9a5e2.tar.bz2
manaplus-ef8ef35d28daa3ea7dd542078ac9c0d3f7a9a5e2.tar.xz
manaplus-ef8ef35d28daa3ea7dd542078ac9c0d3f7a9a5e2.zip
Move some variables to better scope.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/scrollarea.cpp8
-rw-r--r--src/gui/widgets/tabs/chat/whispertab.cpp4
-rw-r--r--src/gui/widgets/window.cpp3
3 files changed, 7 insertions, 8 deletions
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index 630f7e9bf..b67ea756a 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -953,7 +953,7 @@ Rect ScrollArea::getVerticalBarDimension() const
if (!mVBarVisible)
return Rect(0, 0, 0, 0);
- const int height = (mVBarVisible && mShowButtons) ? mScrollbarWidth : 0;
+ const int height = mShowButtons ? mScrollbarWidth : 0;
if (mHBarVisible)
{
return Rect(mDimension.width - mScrollbarWidth,
@@ -1122,10 +1122,10 @@ Rect ScrollArea::getDownButtonDimension() const
if (!mVBarVisible || !mShowButtons)
return Rect(0, 0, 0, 0);
- if (mVBarVisible && mHBarVisible)
+ if (mHBarVisible)
{
return Rect(mDimension.width - mScrollbarWidth,
- mDimension.height - mScrollbarWidth*2,
+ mDimension.height - mScrollbarWidth * 2,
mScrollbarWidth,
mScrollbarWidth);
}
@@ -1150,7 +1150,7 @@ Rect ScrollArea::getRightButtonDimension() const
if (!mHBarVisible || !mShowButtons)
return Rect(0, 0, 0, 0);
- if (mVBarVisible && mHBarVisible)
+ if (mVBarVisible)
{
return Rect(mDimension.width - mScrollbarWidth*2,
mDimension.height - mScrollbarWidth,
diff --git a/src/gui/widgets/tabs/chat/whispertab.cpp b/src/gui/widgets/tabs/chat/whispertab.cpp
index d8672b22d..73b73a17c 100644
--- a/src/gui/widgets/tabs/chat/whispertab.cpp
+++ b/src/gui/widgets/tabs/chat/whispertab.cpp
@@ -71,11 +71,11 @@ void WhisperTab::handleCommandStr(const std::string &msg)
const size_t pos = msg.find(' ');
const std::string type(msg, 0, pos);
- const std::string args(msg, pos == std::string::npos
- ? msg.size() : pos + 1);
if (type == "me")
{
+ const std::string args(msg, pos == std::string::npos
+ ? msg.size() : pos + 1);
std::string str = textToMe(args);
chatHandler->privateMessage(mNick, str);
if (localPlayer != nullptr)
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 9d9385f8d..b192bad35 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -642,8 +642,6 @@ void Window::setResizable(const bool r)
void Window::widgetResized(const Event &event A_UNUSED)
{
- const Rect area = getChildrenArea();
-
if (mGrip != nullptr)
{
mGripRect.x = mDimension.width - mGrip->getWidth() - mGripPadding;
@@ -652,6 +650,7 @@ void Window::widgetResized(const Event &event A_UNUSED)
if (mLayout != nullptr)
{
+ const Rect area = getChildrenArea();
int w = area.width;
int h = area.height;
mLayout->reflow(w, h);