From 485e9bb12bf5dda318ac0ccbf1d2a1cd86cf8c70 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 5 Nov 2018 01:09:30 +0300 Subject: Fix code style. --- src/gui/fonts/font.cpp | 3 ++- src/gui/gui.cpp | 6 ++++-- src/gui/sdlinput.cpp | 3 ++- src/gui/widgets/layoutarray.cpp | 5 ++++- src/gui/widgets/popup.cpp | 6 ++++-- src/gui/widgets/scrollarea.cpp | 6 ++++-- src/gui/widgets/tabs/setup_input.cpp | 3 ++- src/gui/widgets/textbox.cpp | 4 ++-- src/gui/widgets/window.cpp | 12 ++++++++---- 9 files changed, 32 insertions(+), 16 deletions(-) (limited to 'src/gui') diff --git a/src/gui/fonts/font.cpp b/src/gui/fonts/font.cpp index e7a69225b..9d09d7855 100644 --- a/src/gui/fonts/font.cpp +++ b/src/gui/fonts/font.cpp @@ -351,7 +351,8 @@ int Font::getWidth(const std::string &text) const } // if string was not drawed - int w, h; + int w; + int h; getSafeUtf8String(text, strBuf); TTF_SizeUTF8(mFont, strBuf, &w, &h); return w; diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 1f8589b50..be516ebe9 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -698,7 +698,8 @@ void Gui::handleMouseMoved(const MouseInput &mouseInput) && Widget::widgetExists(widget) && (widget != nullptr)) { - int x, y; + int x; + int y; widget->getAbsolutePosition(x, y); if (x > mouseX || y > mouseY @@ -1273,7 +1274,8 @@ Widget* Gui::getWidgetAt(const int x, const int y) const while (child != nullptr) { Widget *const swap = child; - int parentX, parentY; + int parentX; + int parentY; parent->getAbsolutePosition(parentX, parentY); child = parent->getWidgetAt(x - parentX, y - parentY); parent = swap; diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index f1da58cbc..541eb460e 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -367,7 +367,8 @@ void SDLInput::simulateMouseMove() return; mMouseMoveTime = cur_time; - int x, y; + int x; + int y; Gui::getMouseState(x, y); MouseInput mouseInput; diff --git a/src/gui/widgets/layoutarray.cpp b/src/gui/widgets/layoutarray.cpp index 46dd07085..a86d0111e 100644 --- a/src/gui/widgets/layoutarray.cpp +++ b/src/gui/widgets/layoutarray.cpp @@ -299,7 +299,10 @@ void LayoutArray::reflow(const int nx, const int ny, [CAST_SIZE(gridX)]; if ((cell != nullptr) && cell->mType != LayoutCell::NONE) { - int dx = x, dy = y, dw = 0, dh = 0; + int dx = x; + int dy = y; + int dw = 0; + int dh = 0; align(dx, dw, 0, *cell, &widths[CAST_SIZE(gridX)], szW - gridX); align(dy, dh, 1, *cell, diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index 4ae11bbd1..c676de26e 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -175,8 +175,10 @@ void Popup::setLocationRelativeTo(const Widget *const widget) if (widget == nullptr) return; - int wx, wy; - int x, y; + int wx; + int wy; + int x; + int y; widget->getAbsolutePosition(wx, wy); getAbsolutePosition(x, y); diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 52372c385..cce45deee 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -1019,7 +1019,8 @@ Rect ScrollArea::getVerticalMarkerDimension() if (!mVBarVisible) return Rect(0, 0, 0, 0); - int length, pos; + int length; + int pos; int height; const int h2 = mShowButtons ? mScrollbarWidth : mMarkerSize / 2; @@ -1076,7 +1077,8 @@ Rect ScrollArea::getHorizontalMarkerDimension() if (!mHBarVisible) return Rect(0, 0, 0, 0); - int length, pos; + int length; + int pos; int width; const int w2 = mShowButtons ? mScrollbarWidth : mMarkerSize / 2; diff --git a/src/gui/widgets/tabs/setup_input.cpp b/src/gui/widgets/tabs/setup_input.cpp index adf9245bf..49b31c5fe 100644 --- a/src/gui/widgets/tabs/setup_input.cpp +++ b/src/gui/widgets/tabs/setup_input.cpp @@ -151,7 +151,8 @@ Setup_Input::~Setup_Input() void Setup_Input::apply() { keyUnresolved(); - InputActionT key1, key2; + InputActionT key1; + InputActionT key2; if (inputManager.hasConflicts(key1, key2)) { diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 905347f89..545f52fa3 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -554,9 +554,9 @@ void TextBox::setCaretRow(const int row) unsigned int TextBox::getCaretPosition() const { - int pos = 0, row; + int pos = 0; - for (row = 0; row < mCaretRow; row++) + for (int row = 0; row < mCaretRow; row++) pos += CAST_S32(mTextRows[row].size()); return pos + mCaretColumn; diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 3df552404..f76c5fb9e 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -510,8 +510,10 @@ void Window::setLocationRelativeTo(const Widget *const widget) if (widget == nullptr) return; - int wx, wy; - int x, y; + int wx; + int wy; + int x; + int y; widget->getAbsolutePosition(wx, wy); getAbsolutePosition(x, y); @@ -527,8 +529,10 @@ void Window::setLocationHorisontallyRelativeTo(const Widget *const widget) if (widget == nullptr) return; - int wx, wy; - int x, y; + int wx; + int wy; + int x; + int y; widget->getAbsolutePosition(wx, wy); getAbsolutePosition(x, y); -- cgit v1.2.3-70-g09d2