summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-04-12 18:39:00 +0300
committerAndrei Karas <akaras@inbox.ru>2013-04-12 18:39:00 +0300
commit351821c1f18f9285be58df0a05339936311f6490 (patch)
tree47a60cad4f61f63c5ac2faf98dcae24760d7fe11 /src/gui/widgets
parente50632a83a3c679cffd372656277a304d5d853f8 (diff)
downloadManaVerse-351821c1f18f9285be58df0a05339936311f6490.tar.gz
ManaVerse-351821c1f18f9285be58df0a05339936311f6490.tar.bz2
ManaVerse-351821c1f18f9285be58df0a05339936311f6490.tar.xz
ManaVerse-351821c1f18f9285be58df0a05339936311f6490.zip
first part of style fixed after cpplint checks.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/browserbox.cpp25
-rw-r--r--src/gui/widgets/button.cpp10
-rw-r--r--src/gui/widgets/chattab.cpp5
-rw-r--r--src/gui/widgets/dropdown.cpp4
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp1
-rw-r--r--src/gui/widgets/guitable.cpp34
-rw-r--r--src/gui/widgets/inttextfield.cpp2
-rw-r--r--src/gui/widgets/itemcontainer.cpp2
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp2
-rw-r--r--src/gui/widgets/progressbar.cpp15
-rw-r--r--src/gui/widgets/scrollarea.cpp2
-rw-r--r--src/gui/widgets/setupitem.cpp1
-rw-r--r--src/gui/widgets/shopitems.cpp2
-rw-r--r--src/gui/widgets/tab.cpp10
-rw-r--r--src/gui/widgets/tablemodel.cpp4
-rw-r--r--src/gui/widgets/textbox.cpp5
-rw-r--r--src/gui/widgets/textfield.cpp20
-rw-r--r--src/gui/widgets/window.cpp3
18 files changed, 62 insertions, 85 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index a946f352e..4ac0a3632 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -214,7 +214,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop)
mTextRowLinksCount.push_back(linksCount);
}
- //discard older rows when a row limit has been set
+ // discard older rows when a row limit has been set
if (mMaxRows > 0 && !mTextRows.empty())
{
while (mTextRows.size() > mMaxRows)
@@ -281,7 +281,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop)
if ((x + nextWordWidth + 10)
> static_cast<unsigned>(getWidth()))
{
- x = mNewLinePadding; // Ident in new line
+ x = mNewLinePadding; // Ident in new line
y += 1;
j ++;
}
@@ -290,7 +290,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop)
else if ((x + 2 * hyphenWidth)
> static_cast<unsigned>(getWidth()))
{
- x = mNewLinePadding; // Ident in new line
+ x = mNewLinePadding; // Ident in new line
y += 1;
}
}
@@ -401,8 +401,7 @@ void BrowserBox::draw(gcn::Graphics *graphics)
mLinks[mSelectedLink].x1,
mLinks[mSelectedLink].y1,
mLinks[mSelectedLink].x2 - mLinks[mSelectedLink].x1,
- mLinks[mSelectedLink].y2 - mLinks[mSelectedLink].y1
- ));
+ mLinks[mSelectedLink].y2 - mLinks[mSelectedLink].y1));
}
if ((mHighMode & UNDERLINE))
@@ -573,7 +572,6 @@ int BrowserBox::calcHeight()
}
else
{
-
switch (c)
{
case '1':
@@ -670,14 +668,14 @@ int BrowserBox::calcHeight()
{
forced = true;
end = row.size();
- x += hyphenWidth; // Account for the wrap-notifier
+ x += hyphenWidth; // Account for the wrap-notifier
continue;
}
// Skip to the start of the current character
while ((row[end] & 192) == 128)
end--;
- end--; // And then to the last byte of the previous one
+ end--; // And then to the last byte of the previous one
part = row.substr(start, end - start + 1);
if (bold)
@@ -689,14 +687,14 @@ int BrowserBox::calcHeight()
if (forced)
{
- x -= hyphenWidth; // Remove the wrap-notifier accounting
+ x -= hyphenWidth; // Remove the wrap-notifier accounting
mLineParts.push_back(LinePart(wWidth - hyphenWidth,
y, selColor[0], selColor[1], hyphen, bold));
- end++; // Skip to the next character
+ end++; // Skip to the next character
}
else
{
- end += 2; // Skip to after the space
+ end += 2; // Skip to after the space
}
wrapped = true;
@@ -747,13 +745,10 @@ std::string BrowserBox::getTextAtPos(const int x, const int y) const
getAbsolutePosition(textX, textY);
if (x < textX || y < textY)
- return ""; // mouse position ourside of correct widget (outside of tab)
+ return "";
-// textX = x - textX;
textY = y - textY;
-
std::string str;
-
int lastY = 0;
FOR_EACH (LinePartCIter, i, mLineParts)
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 02e05a643..ec0215206 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -42,11 +42,11 @@ float Button::mAlpha = 1.0;
enum
{
- BUTTON_STANDARD = 0, // 0
- BUTTON_HIGHLIGHTED, // 1
- BUTTON_PRESSED, // 2
- BUTTON_DISABLED, // 3
- BUTTON_COUNT // 4 - Must be last.
+ BUTTON_STANDARD = 0, // 0
+ BUTTON_HIGHLIGHTED, // 1
+ BUTTON_PRESSED, // 2
+ BUTTON_DISABLED, // 3
+ BUTTON_COUNT // 4 - Must be last.
};
static std::string const data[BUTTON_COUNT] =
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index fc3e4e69f..b4eef0352 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -155,7 +155,7 @@ void ChatTab::chatLog(std::string line, Own own,
{
tmp.nick = strprintf(_("Global announcement from %s:"),
tmp.nick.c_str()).append(" ");
- lineColor = "##1"; // Equiv. to BrowserBox::RED
+ lineColor = "##1"; // Equiv. to BrowserBox::RED
}
break;
case BY_PLAYER:
@@ -175,7 +175,7 @@ void ChatTab::chatLog(std::string line, Own own,
case BY_CHANNEL:
tmp.nick.clear();
// TODO: Use a predefined color
- lineColor = "##2"; // Equiv. to BrowserBox::GREEN
+ lineColor = "##2"; // Equiv. to BrowserBox::GREEN
break;
case ACT_WHISPER:
tmp.nick = strprintf(_("%s whispers: %s"), tmp.nick.c_str(), "");
@@ -260,7 +260,6 @@ void ChatTab::chatLog(std::string line, Own own,
addRow(line);
mScrollArea->setVerticalScrollAmount(
mScrollArea->getVerticalMaxScroll());
-
}
else
{
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index daec2e7fa..31a41307c 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -517,7 +517,7 @@ gcn::Rectangle DropDown::getChildrenArea()
if (mDroppedDown)
{
// Calculate the children area (with the one pixel border in mind)
- return gcn::Rectangle(1, mFoldedUpHeight + 1,
+ return gcn::Rectangle(1, mFoldedUpHeight + 1,
getWidth() - 2, getHeight() - mFoldedUpHeight - 2);
}
@@ -549,7 +549,7 @@ void DropDown::removeSelectionListener(SelectionListener* listener)
void DropDown::distributeValueChangedEvent()
{
for (SelectionListenerIterator iter = mSelectionListeners.begin();
- iter != mSelectionListeners.end();
+ iter != mSelectionListeners.end();
++iter)
{
gcn::SelectionEvent event(this);
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index d5b853552..8be6a4197 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -68,7 +68,6 @@ EmoteShortcutContainer::EmoteShortcutContainer():
mEmoteImg.push_back(sprite);
}
-// mMaxItems = EmoteDB::getLast() < MAX_ITEMS ? EmoteDB::getLast() : MAX_ITEMS;
mMaxItems = MAX_ITEMS;
if (mBackgroundImg)
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index 42f9c9350..5a53a27b4 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -193,7 +193,7 @@ void GuiTable::setLinewiseSelection(const bool linewise)
int GuiTable::getRowHeight() const
{
if (mModel)
- return mModel->getRowHeight() + 1; // border
+ return mModel->getRowHeight() + 1; // border
else
return 0;
}
@@ -201,7 +201,7 @@ int GuiTable::getRowHeight() const
int GuiTable::getColumnWidth(int i) const
{
if (mModel)
- return mModel->getColumnWidth(i) + 1; // border
+ return mModel->getColumnWidth(i) + 1; // border
else
return 0;
}
@@ -287,7 +287,7 @@ void GuiTable::installActionListeners()
}
}
- _setFocusHandler(_getFocusHandler()); // propagate focus handler to widgets
+ _setFocusHandler(_getFocusHandler());
}
// -- widget ops
@@ -307,20 +307,21 @@ void GuiTable::draw(gcn::Graphics* graphics)
graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight()));
}
- // First, determine how many rows we need to draw, and where we should start.
+ // First, determine how many rows we need to draw,
+ // and where we should start.
int first_row = -(getY() / getRowHeight());
if (first_row < 0)
first_row = 0;
- unsigned rows_nr = 1 + (getHeight() / getRowHeight()); // May overestimate
- // by one.
+ unsigned rows_nr = 1 + (getHeight() / getRowHeight()); // May overestimate
+ // by one.
unsigned max_rows_nr;
if (mModel->getRows() < first_row)
max_rows_nr = 0;
else
- max_rows_nr = mModel->getRows() - first_row; // clip if neccessary:
+ max_rows_nr = mModel->getRows() - first_row; // clip if neccessary:
if (max_rows_nr < rows_nr)
rows_nr = max_rows_nr;
@@ -512,7 +513,6 @@ void GuiTable::mouseDragged(gcn::MouseEvent& mouseEvent)
setSelectedColumn(getColumnForX(x));
}
-// -- TableModelListener notifications
void GuiTable::modelUpdated(bool completed)
{
if (completed)
@@ -521,8 +521,8 @@ void GuiTable::modelUpdated(bool completed)
installActionListeners();
}
else
- { // before the update?
- mTopWidget = nullptr; // No longer valid in general
+ { // before the update?
+ mTopWidget = nullptr; // No longer valid in general
uninstallActionListeners();
}
}
@@ -541,7 +541,7 @@ gcn::Widget *GuiTable::getWidgetAt(int x, int y)
if (w && w->isFocusable())
return w;
else
- return nullptr; // Grab the event locally
+ return nullptr; // Grab the event locally
}
else
return nullptr;
@@ -549,15 +549,15 @@ gcn::Widget *GuiTable::getWidgetAt(int x, int y)
int GuiTable::getRowForY(int y) const
{
- int row = -1;
+ int row = -1;
- if (getRowHeight() > 0)
+ if (getRowHeight() > 0)
row = y / getRowHeight();
- if (!mModel || row < 0 || row >= mModel->getRows())
- return -1;
- else
- return row;
+ if (!mModel || row < 0 || row >= mModel->getRows())
+ return -1;
+ else
+ return row;
}
int GuiTable::getColumnForX(int x) const
diff --git a/src/gui/widgets/inttextfield.cpp b/src/gui/widgets/inttextfield.cpp
index 236fdaf43..be8b2e310 100644
--- a/src/gui/widgets/inttextfield.cpp
+++ b/src/gui/widgets/inttextfield.cpp
@@ -27,8 +27,6 @@
#include "gui/sdlinput.h"
-//#include "utils/stringutils.h"
-
#include "debug.h"
IntTextField::IntTextField(const Widget2 *const widget, const int def,
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index a6a594c46..50ab7dfca 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -276,7 +276,7 @@ void ItemContainer::draw(gcn::Graphics *graphics)
g->drawImage(mSelImg, itemX, itemY);
}
}
- image->setAlpha(1.0f); // ensure the image if fully drawn...
+ image->setAlpha(1.0f); // ensure the image if fully drawn...
g->drawImage(image, itemX + mPaddingItemX,
itemY + mPaddingItemY);
}
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index e2999c8ad..5a7eb3462 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -77,7 +77,7 @@ void ItemLinkHandler::handleLink(const std::string &link,
{
ConfirmDialog *const confirmDlg = new ConfirmDialog(
_("Open url"), url, false, true);
- confirmDlg->addActionListener(&listener);
+ confirmDlg->addActionListener(&listener);
}
else if (button == gcn::MouseInput::RIGHT)
{
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp
index ce5c9c01e..de5543680 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -127,20 +127,7 @@ void ProgressBar::updateAlpha()
{
const float alpha = std::max(Client::getGuiAlpha(),
Theme::instance()->getMinimumOpacity());
-
- if (mAlpha != alpha)
- {
- mAlpha = alpha;
-/*
- ImageRect &rect = mSkin->getBorder();
- for (int i = 0; i < 9; i++)
- {
- if (rect.grid[i])
- rect.grid[i]->setAlpha(mAlpha);
- }
-*/
- }
-
+ mAlpha = alpha;
}
void ProgressBar::draw(gcn::Graphics *graphics)
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index b143f5c21..69b1f6d8e 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -809,7 +809,7 @@ void ScrollArea::mouseDragged(gcn::MouseEvent &event)
{
const gcn::Rectangle barDim = getHorizontalBarDimension();
- const int pos = event.getX() - barDim.x
+ const int pos = event.getX() - barDim.x
- mHorizontalMarkerDragOffset;
const int length = getHorizontalMarkerDimension().width;
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index 54e1102a6..e44ec74a7 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -87,7 +87,6 @@ SetupItem::SetupItem(std::string text, std::string description,
SetupItem::~SetupItem()
{
-
}
Configuration *SetupItem::getConfig() const
diff --git a/src/gui/widgets/shopitems.cpp b/src/gui/widgets/shopitems.cpp
index 22049e944..74cb6a716 100644
--- a/src/gui/widgets/shopitems.cpp
+++ b/src/gui/widgets/shopitems.cpp
@@ -73,7 +73,7 @@ void ShopItems::addItem2(const int inventoryIndex, const int id,
if (item)
{
- item->addDuplicate (inventoryIndex, quantity);
+ item->addDuplicate(inventoryIndex, quantity);
}
else
{
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index 29b2e70c4..ae7d426a8 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -38,11 +38,11 @@ float Tab::mAlpha = 1.0;
enum
{
- TAB_STANDARD = 0, // 0
- TAB_HIGHLIGHTED, // 1
- TAB_SELECTED, // 2
- TAB_UNUSED, // 3
- TAB_COUNT // 4 - Must be last.
+ TAB_STANDARD = 0, // 0
+ TAB_HIGHLIGHTED, // 1
+ TAB_SELECTED, // 2
+ TAB_UNUSED, // 3
+ TAB_COUNT // 4 - Must be last.
};
static std::string const data[TAB_COUNT] =
diff --git a/src/gui/widgets/tablemodel.cpp b/src/gui/widgets/tablemodel.cpp
index 294759a77..543c50ebd 100644
--- a/src/gui/widgets/tablemodel.cpp
+++ b/src/gui/widgets/tablemodel.cpp
@@ -127,7 +127,7 @@ void StaticTableModel::fixColumnWidth(const int column, const int width)
if (width < 0 || column < 0 || column >= mColumns)
return;
- mWidths[column] = -width; // Negate to tag as fixed
+ mWidths[column] = -width; // Negate to tag as fixed
}
void StaticTableModel::fixRowHeight(const int height)
@@ -145,7 +145,7 @@ int StaticTableModel::getRowHeight() const
int StaticTableModel::getColumnWidth(int column) const
{
- if (column < 0 || column >= mColumns)
+ if (column < 0 || column >= mColumns)
return 0;
return abs(mWidths[column]);
diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp
index dec73768e..b0281e9bd 100644
--- a/src/gui/widgets/textbox.cpp
+++ b/src/gui/widgets/textbox.cpp
@@ -53,7 +53,8 @@ void TextBox::setTextWrapped(const std::string &text, const int minDimension)
if (getParent())
getParent()->logic();
- // Take the supplied minimum dimension as a starting point and try to beat it
+ // Take the supplied minimum dimension as a starting
+ // point and try to beat it
mMinWidth = minDimension;
std::stringstream wrappedStream;
@@ -104,7 +105,7 @@ void TextBox::setTextWrapped(const std::string &text, const int minDimension)
xpos = width;
wrappedStream << word;
}
- else if (xpos != 0 && xpos + getFont()->getWidth(" ") + width <=
+ else if (xpos != 0 && xpos + getFont()->getWidth(" ") + width <=
mMinWidth)
{
xpos += getFont()->getWidth(" ") + width;
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index e4568d391..23cedfde9 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -37,7 +37,7 @@
#include <guichan/font.hpp>
-#undef DELETE //Win32 compatibility hack
+#undef DELETE // Win32 compatibility hack
#include "debug.h"
@@ -250,7 +250,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent)
bool consumed(false);
switch (val)
{
- case 2: // Ctrl+b
+ case 2: // Ctrl+b
{
while (mCaretPosition > 0)
{
@@ -262,7 +262,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent)
break;
}
- case 6: // Ctrl+f
+ case 6: // Ctrl+f
{
const unsigned sz = static_cast<unsigned>(mText.size());
while (mCaretPosition < sz)
@@ -278,7 +278,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent)
break;
}
- case 4: // Ctrl+d
+ case 4: // Ctrl+d
{
unsigned sz = static_cast<unsigned>(mText.size());
while (mCaretPosition < sz)
@@ -295,22 +295,22 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent)
break;
}
- case 8: // Ctrl+h
+ case 8: // Ctrl+h
deleteCharLeft(mText, &mCaretPosition);
consumed = true;
break;
- case 5: // Ctrl+e
+ case 5: // Ctrl+e
mCaretPosition = static_cast<int>(mText.size());
consumed = true;
break;
- case 11: // Ctrl+k
+ case 11: // Ctrl+k
mText = mText.substr(0, mCaretPosition);
consumed = true;
break;
- case 21: // Ctrl+u
+ case 21: // Ctrl+u
if (mCaretPosition > 0)
{
mText = mText.substr(mCaretPosition);
@@ -324,7 +324,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent)
consumed = true;
break;
- case 22: // Control code 22, SYNCHRONOUS IDLE, sent on Ctrl+v
+ case 22: // Control code 22, SYNCHRONOUS IDLE, sent on Ctrl+v
// hack to prevent paste key sticking
if (mLastEventPaste && mLastEventPaste > cur_time)
break;
@@ -333,7 +333,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent)
consumed = true;
break;
- case 23: // Ctrl+w
+ case 23: // Ctrl+w
while (mCaretPosition > 0)
{
deleteCharLeft(mText, &mCaretPosition);
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 926821f18..4d16937e2 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -241,7 +241,6 @@ void Window::draw(gcn::Graphics *graphics)
if (mGrip)
g->calcTile(mVertexes, mGrip, mGripRect.x, mGripRect.y);
-
}
else
{
@@ -562,7 +561,7 @@ void Window::setVisible(bool visible)
void Window::setVisible(bool visible, bool forceSticky)
{
if (visible == isWindowVisible())
- return; // Nothing to do
+ return;
// Check if the window is off screen...
if (visible)