diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-04-12 18:39:00 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-04-12 18:39:00 +0300 |
commit | 351821c1f18f9285be58df0a05339936311f6490 (patch) | |
tree | 47a60cad4f61f63c5ac2faf98dcae24760d7fe11 /src/gui | |
parent | e50632a83a3c679cffd372656277a304d5d853f8 (diff) | |
download | manaverse-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')
45 files changed, 124 insertions, 169 deletions
diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp index ec6125db4..78bc20fca 100644 --- a/src/gui/botcheckerwindow.cpp +++ b/src/gui/botcheckerwindow.cpp @@ -45,12 +45,12 @@ #include "debug.h" -const int COLUMNS_NR = 5; // name plus listbox +const int COLUMNS_NR = 5; // name plus listbox const int NAME_COLUMN = 0; const int TIME_COLUMN = 1; const int ROW_HEIGHT = 12; -// The following column widths really shouldn't be hardcoded but should +// The following column widths really shouldn't be hardcoded but should // scale with the size of the widget... excep // that, right now, the widget doesn't exactly scale either. const int NAME_COLUMN_WIDTH = 185; @@ -232,7 +232,6 @@ public: widget = new Label(this, str); mWidgets.push_back(widget); - } signalAfterUpdate(); @@ -242,7 +241,6 @@ public: { } - virtual gcn::Widget *getElementAt(const int row, const int column) const { return mWidgets[WIDGET_AT(row, column)]; diff --git a/src/gui/buydialog.cpp b/src/gui/buydialog.cpp index 06f878797..936adc2d5 100644 --- a/src/gui/buydialog.cpp +++ b/src/gui/buydialog.cpp @@ -418,7 +418,8 @@ void BuyDialog::action(const gcn::ActionEvent &event) Net::getNpcHandler()->buyItem(mNpcId, item->getId(), item->getColor(), mAmountItems); - // Update money and adjust the max number of items that can be bought + // Update money and adjust the max number of items + // that can be bought mMaxItems -= mAmountItems; setMoney(mMoney - mAmountItems * mShopItems->at(selectedItem)->getPrice()); diff --git a/src/gui/buyselldialog.cpp b/src/gui/buyselldialog.cpp index 7db437c4f..ae031fffe 100644 --- a/src/gui/buyselldialog.cpp +++ b/src/gui/buyselldialog.cpp @@ -57,7 +57,6 @@ BuySellDialog::BuySellDialog(std::string nick) : void BuySellDialog::init() { setWindowName("BuySell"); - //setupWindow->registerWindowForReset(this); setCloseButton(true); static const char *buttonNames[] = @@ -72,7 +71,7 @@ void BuySellDialog::init() { Button *const btn = new Button(this, gettext(*curBtn), *curBtn, this); if (!mBuyButton) - mBuyButton = btn; // For focus request + mBuyButton = btn; // For focus request btn->setPosition(x, y); add(btn); x += btn->getWidth() + buttonPadding; diff --git a/src/gui/changeemaildialog.cpp b/src/gui/changeemaildialog.cpp index 9b202e046..7e23b7918 100644 --- a/src/gui/changeemaildialog.cpp +++ b/src/gui/changeemaildialog.cpp @@ -114,7 +114,6 @@ void ChangeEmailDialog::action(const gcn::ActionEvent &event) } else if (eventId == "change_email") { - const std::string username = mLoginData->username.c_str(); const std::string newFirstEmail = mFirstEmailField->getText(); const std::string newSecondEmail = mSecondEmailField->getText(); diff --git a/src/gui/changepassworddialog.cpp b/src/gui/changepassworddialog.cpp index 5c4fd4ec5..bf1ebc984 100644 --- a/src/gui/changepassworddialog.cpp +++ b/src/gui/changepassworddialog.cpp @@ -55,7 +55,7 @@ ChangePasswordDialog::ChangePasswordDialog(LoginData *const data): mWrongDataNoticeListener(new WrongDataNoticeListener), mLoginData(data) { - Label *const accountLabel = new Label(this, + Label *const accountLabel = new Label(this, strprintf(_("Account: %s"), mLoginData->username.c_str())); place(0, 0, accountLabel, 3); diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index 9ff4b038e..6c5430526 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -89,7 +89,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, mMale(new RadioButton(this, _("Male"), "gender")), mFemale(new RadioButton(this, _("Female"), "gender")), mOther(new RadioButton(this, _("Other"), "gender")), - mAttributesLeft(new Label(this, + mAttributesLeft(new Label(this, strprintf(_("Please distribute %d points"), 99))), mMaxPoints(0), mUsedPoints(0), diff --git a/src/gui/confirmdialog.cpp b/src/gui/confirmdialog.cpp index 3fef0d5bc..66d7d1375 100644 --- a/src/gui/confirmdialog.cpp +++ b/src/gui/confirmdialog.cpp @@ -54,7 +54,7 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg, ignoreButton = new Button(this, _("Ignore"), "ignore", this); const int numRows = mTextBox->getNumberOfRows(); - int inWidth = yesButton->getWidth() + noButton->getWidth() + + int inWidth = yesButton->getWidth() + noButton->getWidth() + (2 * getPadding()); if (ignoreButton) diff --git a/src/gui/editserverdialog.cpp b/src/gui/editserverdialog.cpp index bdfbdd1d5..f6da1d5bc 100644 --- a/src/gui/editserverdialog.cpp +++ b/src/gui/editserverdialog.cpp @@ -89,7 +89,7 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent, mPortField->setNumeric(true); mPortField->setRange(1, 65535); - mTypeField->setSelected(0); // TmwAthena by default for now. + mTypeField->setSelected(0); // TmwAthena by default mServerAddressField->addActionListener(this); mPortField->addActionListener(this); @@ -214,7 +214,7 @@ void EditServerDialog::action(const gcn::ActionEvent &event) mServer.name = mNameField->getText(); mServer.description = mDescriptionField->getText(); mServer.hostname = mServerAddressField->getText(); - mServer.port = static_cast<short>(atoi( + mServer.port = static_cast<int16_t>(atoi( mPortField->getText().c_str())); if (mTypeField) @@ -255,7 +255,7 @@ void EditServerDialog::action(const gcn::ActionEvent &event) // Tell the server has to be saved mServer.save = true; - //Add server + // Add server mServerDialog->updateServer(mServer, mIndex); if (eventId == "connect") mServerDialog->connectToSelectedServer(); diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index af2c8f083..dd9968585 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -212,8 +212,8 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) Image *const image = item->getImage(); if (image) { - image->setAlpha(1.0f); // Ensure the image is drawn - // with maximum opacity + image->setAlpha(1.0f); // Ensure the image is drawn + // with maximum opacity g->drawImage(image, box->x + mItemPadding, box->y + mItemPadding); if (i == EQUIP_PROJECTILE_SLOT) @@ -536,19 +536,19 @@ void EquipmentWindow::fillDefault() mImageSet = Theme::getImageSetFromTheme( "equipmentbox.png", 32, 32); - addBox(0, 90, 40, 0); // torso - addBox(1, 8, 78, 1); // gloves - addBox(2, 70, 0, 2); // hat - addBox(3, 50, 253, 3); // pants - addBox(4, 90, 253, 4); // boots - addBox(5, 8, 213, 5); // FREE - addBox(6, 129, 213, 6); // wings - addBox(7, 50, 40, 5); // scarf - addBox(8, 8, 168, 7); // weapon - addBox(9, 129, 168, 8); // shield - addBox(10, 129, 78, 9); // ammo - addBox(11, 8, 123, 5); // amulet - addBox(12, 129, 123, 5); // ring + addBox(0, 90, 40, 0); // torso + addBox(1, 8, 78, 1); // gloves + addBox(2, 70, 0, 2); // hat + addBox(3, 50, 253, 3); // pants + addBox(4, 90, 253, 4); // boots + addBox(5, 8, 213, 5); // FREE + addBox(6, 129, 213, 6); // wings + addBox(7, 50, 40, 5); // scarf + addBox(8, 8, 168, 7); // weapon + addBox(9, 129, 168, 8); // shield + addBox(10, 129, 78, 9); // ammo + addBox(11, 8, 123, 5); // amulet + addBox(12, 129, 123, 5); // ring } void EquipmentWindow::addBox(const int idx, int x, int y, const int imageIndex) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index a89711137..b0b9de0a8 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -59,7 +59,7 @@ SDLFont *boldFont = nullptr; class GuiConfigListener final : public ConfigListener { public: - GuiConfigListener(Gui *const g): + explicit GuiConfigListener(Gui *const g): mGui(g) {} @@ -405,7 +405,7 @@ bool Gui::handleKeyInput2() mFocusHandler->tabNext(); } } - } // end while + } // end while BLOCK_END("Gui::handleKeyInput2") return consumed; } diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp index 3c091ce65..fb00495ce 100644 --- a/src/gui/helpwindow.cpp +++ b/src/gui/helpwindow.cpp @@ -93,7 +93,6 @@ void HelpWindow::action(const gcn::ActionEvent &event) didYouKnowWindow->requestMoveToTop(); } } - } void HelpWindow::handleLink(const std::string &link, diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index dfbe8b8b8..ae8fa5b15 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -726,23 +726,17 @@ void InventoryWindow::widgetResized(const gcn::Event &event) { if (!mCompactMode) { - //mSortDropDown->setVisible(false); mNameFilter->setVisible(false); - //mSortDropDownCell->setType(LayoutCell::NONE); mNameFilterCell->setType(LayoutCell::NONE); mFilterCell->setWidth(mFilterCell->getWidth() + 2); - //mSlotsBarCell->setWidth(mSlotsBarCell->getWidth() + 3); mCompactMode = true; } } else if (mCompactMode) { - //mSortDropDown->setVisible(true); mNameFilter->setVisible(true); - //mSortDropDownCell->setType(LayoutCell::WIDGET); mNameFilterCell->setType(LayoutCell::WIDGET); mFilterCell->setWidth(mFilterCell->getWidth() - 2); - //mSlotsBarCell->setWidth(mSlotsBarCell->getWidth() - 3); mCompactMode = false; } } diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index d9ec8c52b..e2087117d 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -62,7 +62,7 @@ Minimap::Minimap(): setDefaultSize(5, 25, 100, 100); // set this to false as the minimap window size is changed - //depending on the map size + // depending on the map size setResizable(true); setupWindow->registerWindowForReset(this); diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index 5a886c454..2de27ff6c 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -98,7 +98,6 @@ NpcDialog::NpcDialog(const int npcId) : // Basic Window Setup setWindowName("NpcText"); setResizable(true); - //setupWindow->registerWindowForReset(this); setFocusable(true); setStickyButtonLock(true); diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index b6e4598ac..9ff5e19f1 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -112,7 +112,7 @@ PopupMenu::PopupMenu(): mPlayerListener.setDialog(nullptr); mPlayerListener.setType(static_cast<int>(Being::UNKNOWN)); mScrollArea = new ScrollArea(mBrowserBox, false); - mScrollArea->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO); + mScrollArea->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO); add(mScrollArea); } @@ -1730,7 +1730,6 @@ void PopupMenu::showPopup(Window *const parent, const int x, const int y, if (Net::getInventoryHandler()->canSplit(item)) mBrowserBox->addRow("split", _("Split")); - } // Assume in storage for now // TODO: make this whole system more flexible, if needed diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp index 76937b936..1063296d4 100644 --- a/src/gui/quitdialog.cpp +++ b/src/gui/quitdialog.cpp @@ -91,8 +91,8 @@ QuitDialog::QuitDialog(QuitDialog **const pointerToMe): placeOption(placer, mSwitchCharacter); } -//#ifdef ANDROID /* +#ifdef ANDROID if (config.getBoolValue("rated") == false && config.getIntValue("gamecount") > 3) { @@ -101,8 +101,8 @@ QuitDialog::QuitDialog(QuitDialog **const pointerToMe): mOptions[mOptions.size() - 1]->setSelected(true); } else +#endif */ -//#endif { mOptions[0]->setSelected(true); } diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index bf8bd040f..add3daf31 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -60,7 +60,7 @@ #include "inputmanager.h" #include "keydata.h" -#include "mouseinput.h" +#include "mouseinput.h" #include <guichan/exception.hpp> @@ -242,8 +242,7 @@ void SDLInput::pushInput(const SDL_Event &event) default: break; - - } // end switch + } // end switch } int SDLInput::convertMouseButton(const int button) diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp index 1d076b72a..d0d9809ac 100644 --- a/src/gui/selldialog.cpp +++ b/src/gui/selldialog.cpp @@ -68,7 +68,6 @@ SellDialog::SellDialog(std::string nick): void SellDialog::init() { setWindowName("Sell"); - //setupWindow->registerWindowForReset(this); setResizable(true); setCloseButton(true); setStickyButtonLock(true); @@ -231,8 +230,8 @@ void SellDialog::action(const gcn::ActionEvent &event) mMaxItems -= mAmountItems; while (mAmountItems > 0) { - // This order is important, item->getCurrentInvIndex() would return - // the inventory index of the next Duplicate otherwise. + // This order is important, item->getCurrentInvIndex() would + // return the inventory index of the next Duplicate otherwise. int itemIndex = item->getCurrentInvIndex(); const int sellCount = item->sellCurrentDuplicate(mAmountItems); #ifdef MANASERV_SUPPORT diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 4a9960beb..29189c12b 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -324,7 +324,7 @@ ServerDialog::ServerDialog(ServerInfo *const serverInfo, loadServers(true); - mServersList->setSelected(0); // Do this after for the Delete button + mServersList->setSelected(0); // Do this after for the Delete button if (needUpdateServers()) downloadServerList(); @@ -530,7 +530,8 @@ void ServerDialog::downloadServerList() if (listFile.empty()) listFile = config.getStringValue("onlineServerList"); - // Fall back to manaplus.evolonline.org when neither branding nor config set it + // Fall back to manaplus.evolonline.org when neither branding + // nor config set it if (listFile.empty()) listFile = "http://manaplus.evolonline.org/serverlist.xml"; @@ -780,12 +781,12 @@ int ServerDialog::downloadUpdate(void *ptr, DownloadStatus status, if (progress != progress) { - progress = 0.0f; // check for NaN + progress = 0.0f; // check for NaN } else if (progress < 0.0f) { - progress = 0.0f; // no idea how this could ever happen, - // but why not check for it anyway. + progress = 0.0f; // no idea how this could ever happen, + // but why not check for it anyway. } else if (progress > 1.0f) { diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp index 77aa3b1b9..562e86e6f 100644 --- a/src/gui/setup_relations.cpp +++ b/src/gui/setup_relations.cpp @@ -40,7 +40,7 @@ #include "utils/dtor.h" #include "utils/gettext.h" -static const int COLUMNS_NR = 2; // name plus listbox +static const int COLUMNS_NR = 2; // name plus listbox static const int NAME_COLUMN = 0; static const unsigned int RELATION_CHOICE_COLUMN = 1; @@ -279,7 +279,7 @@ Setup_Relations::Setup_Relations(const Widget2 *const widget) : mIgnoreActionChoicesBox->setActionEventId(ACTION_STRATEGY); mIgnoreActionChoicesBox->addActionListener(this); - int ignore_strategy_index = 0; // safe default + int ignore_strategy_index = 0; // safe default if (player_relations.getPlayerIgnoreStrategy()) { @@ -330,7 +330,6 @@ void Setup_Relations::reset() if ((*player_relations.getPlayerIgnoreStrategies())[i] == player_relations.getPlayerIgnoreStrategy()) { - selection = static_cast<int>(i); break; } @@ -377,7 +376,6 @@ void Setup_Relations::action(const gcn::ActionEvent &event) mPlayerTableModel->updateModelInRow(row); player_relations.addListener(this); - } else if (eventId == ACTION_DELETE) { @@ -417,7 +415,7 @@ void Setup_Relations::updateAll() mPlayerTable->setModel(model); delete mPlayerTableModel; mPlayerTableModel = model; - int ignore_strategy_index = 0; // safe default + int ignore_strategy_index = 0; // safe default if (player_relations.getPlayerIgnoreStrategy()) { diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp index 0ed8065ae..bc6ca117d 100644 --- a/src/gui/shopwindow.cpp +++ b/src/gui/shopwindow.cpp @@ -265,7 +265,6 @@ void ShopWindow::action(const gcn::ActionEvent &event) this, item, sumAmount(item)); } } - } void ShopWindow::startTrade() @@ -614,7 +613,6 @@ void ShopWindow::sendMessage(const std::string &nick, Net::getChatHandler()->privateMessage(nick, data); else if (chatWindow) chatWindow->addWhisper(nick, data, BY_PLAYER); -//here was true } void ShopWindow::showList(const std::string &nick, std::string data) const diff --git a/src/gui/textcommandeditor.cpp b/src/gui/textcommandeditor.cpp index 152417ee6..076a7a7f2 100644 --- a/src/gui/textcommandeditor.cpp +++ b/src/gui/textcommandeditor.cpp @@ -199,7 +199,6 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) : keyboard.setEnabled(false); setWindowName("TextCommandEditor"); - //setCloseButton(true); setDefaultSize(w, h, ImageRect::CENTER); mAdvanced = false; diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 846bb45c4..0d2e7d16f 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -990,7 +990,7 @@ void Theme::loadColors(std::string file) if (xmlNameEqual(paletteNode, "progressbar")) { type = readProgressType(XML::getProperty(paletteNode, "id", "")); - if (type < 0) // invalid or no type given + if (type < 0) // invalid or no type given continue; mProgressColors[type] = new DyePalette(XML::getProperty( @@ -1011,11 +1011,11 @@ void Theme::loadColors(std::string file) { std::string id = XML::getProperty(node, "id", ""); type = readColorType(id); - if (type < 0) // invalid or no type given + if (type < 0) // invalid or no type given continue; temp = XML::getProperty(node, "color", ""); - if (temp.empty()) // no color set, so move on + if (temp.empty()) // no color set, so move on continue; color = readColor(temp); diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp index 48dbf1d27..a6f5b8d3e 100644 --- a/src/gui/tradewindow.cpp +++ b/src/gui/tradewindow.cpp @@ -68,7 +68,7 @@ TradeWindow::TradeWindow(): mPartnerItemContainer(new ItemContainer(this, mPartnerInventory.get())), mMoneyLabel(new Label(this, strprintf(_("You get %s"), ""))), mAddButton(new Button(this, _("Add"), "add", this)), - mOkButton(new Button(this, "", "", this)), // Will be filled in later + mOkButton(new Button(this, "", "", this)), // Will be filled in later mMoneyChangeButton(new Button(this, _("Change"), "money", this)), mMoneyField(new TextField(this)), mStatus(PROPOSING), @@ -246,11 +246,7 @@ void TradeWindow::receivedOk(const bool own) mOkOther = true; if (mOkMe && mOkOther) - { - //mOkMe = false; - //mOkOther = false; setStatus(ACCEPTING); - } } void TradeWindow::tradeItem(Item *const item, const int quantity, @@ -371,7 +367,7 @@ void TradeWindow::action(const gcn::ActionEvent &event) } else if (eventId == "money") { - if (mStatus != PREPARING) + if (mStatus != PREPARING) return; int v = atoi(mMoneyField->getText().c_str()); diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index fb102f724..7ec4c42f2 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -432,10 +432,10 @@ int UpdaterWindow::updateProgress(void *ptr, DownloadStatus status, static_cast<float>(dt); if (progress != progress) - progress = 0.0f; // check for NaN + progress = 0.0f; // check for NaN if (progress < 0.0f) - progress = 0.0f; // no idea how this could ever happen, - // but why not check for it anyway. + progress = 0.0f; // no idea how this could ever happen, + // but why not check for it anyway. if (progress > 1.0f) progress = 1.0f; @@ -565,7 +565,7 @@ void UpdaterWindow::loadLocalUpdates(const std::string &dir) for (unsigned int updateIndex = 0, sz = static_cast<unsigned int>( updateFiles.size()); updateIndex < sz; updateIndex ++) { - UpdaterWindow::addUpdateFile(resman, dir, fixPath, + UpdaterWindow::addUpdateFile(resman, dir, fixPath, updateFiles[updateIndex].name, false); } loadManaPlusUpdates(dir, resman); @@ -666,7 +666,7 @@ void UpdaterWindow::logic() mCurrentFile = xmlUpdateFile; mStoreInMemory = false; mDownloadStatus = UPDATE_LIST; - download(); // download() changes mDownloadComplete to false + download(); // download() changes mDownloadComplete to false } break; case UPDATE_PATCH: @@ -769,8 +769,8 @@ void UpdaterWindow::logic() mCurrentFile = "latest.txt"; mStoreInMemory = true; mDownloadStatus = UPDATE_PATCH; - download(); // download() changes - // mDownloadComplete to false + download(); // download() changes + // mDownloadComplete to false } } break; diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index a9011f595..e4bbc8f5c 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -150,7 +150,7 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) - midTileY + mCameraRelativeY; if (mScrollLaziness < 1) - mScrollLaziness = 1; // Avoids division by zero + mScrollLaziness = 1; // Avoids division by zero if (mEnableLazyScrolling) { diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index b280ae4f8..0c1a2998d 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -196,10 +196,10 @@ void WhoIsOnline::updateWindow(std::vector<OnlinePlayer*> &friends, std::vector<OnlinePlayer*> enemy, size_t numOnline) { - //Set window caption + // Set window caption setCaption(_("Who Is Online - ") + toString(numOnline)); - //List the online people + // List the online people std::sort(friends.begin(), friends.end(), nameCompare); std::sort(neutral.begin(), neutral.end(), nameCompare); std::sort(disregard.begin(), disregard.end(), nameCompare); @@ -298,7 +298,7 @@ void WhoIsOnline::loadList(std::vector<OnlinePlayer*> &list) case PlayerRelation::IGNORED: case PlayerRelation::ERASED: - //Ignore the ignored. + // Ignore the ignored. break; } } @@ -447,7 +447,7 @@ void WhoIsOnline::loadWebList() case PlayerRelation::IGNORED: case PlayerRelation::ERASED: - //Ignore the ignored. + // Ignore the ignored. break; } } 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) |