diff options
author | Ira Rice <irarice@gmail.com> | 2009-01-15 11:06:32 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-01-15 11:06:32 -0700 |
commit | 10a9dbacd9334caede10f1b21d42cdf7e1efcd03 (patch) | |
tree | def2baead68de5a9ccc842e25b3cdcfe9a638c9b /src/gui | |
parent | e7f4e78f76972ca3882b9d2763ae9cab31675d3a (diff) | |
download | mana-10a9dbacd9334caede10f1b21d42cdf7e1efcd03.tar.gz mana-10a9dbacd9334caede10f1b21d42cdf7e1efcd03.tar.bz2 mana-10a9dbacd9334caede10f1b21d42cdf7e1efcd03.tar.xz mana-10a9dbacd9334caede10f1b21d42cdf7e1efcd03.zip |
Style cleanups throughout most of the code. Splitting function type from
the function names should no longer be around.
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui')
34 files changed, 245 insertions, 531 deletions
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp index 8be32ebb..7621b856 100644 --- a/src/gui/browserbox.cpp +++ b/src/gui/browserbox.cpp @@ -210,8 +210,7 @@ struct MouseOverLink int mX, mY; }; -void -BrowserBox::mousePressed(gcn::MouseEvent &event) +void BrowserBox::mousePressed(gcn::MouseEvent &event) { LinkIterator i = find_if(mLinks.begin(), mLinks.end(), MouseOverLink(event.getX(), event.getY())); @@ -221,8 +220,7 @@ BrowserBox::mousePressed(gcn::MouseEvent &event) } } -void -BrowserBox::mouseMoved(gcn::MouseEvent &event) +void BrowserBox::mouseMoved(gcn::MouseEvent &event) { LinkIterator i = find_if(mLinks.begin(), mLinks.end(), MouseOverLink(event.getX(), event.getY())); @@ -230,8 +228,7 @@ BrowserBox::mouseMoved(gcn::MouseEvent &event) mSelectedLink = (i != mLinks.end()) ? (i - mLinks.begin()) : -1; } -void -BrowserBox::draw(gcn::Graphics *graphics) +void BrowserBox::draw(gcn::Graphics *graphics) { if (mOpaque) { diff --git a/src/gui/button.cpp b/src/gui/button.cpp index 40ecd1b7..9653242c 100644 --- a/src/gui/button.cpp +++ b/src/gui/button.cpp @@ -122,8 +122,7 @@ Button::~Button() } } -void -Button::draw(gcn::Graphics *graphics) +void Button::draw(gcn::Graphics *graphics) { int mode; diff --git a/src/gui/buttonbox.cpp b/src/gui/buttonbox.cpp index 903d971d..d29f3c58 100644 --- a/src/gui/buttonbox.cpp +++ b/src/gui/buttonbox.cpp @@ -34,8 +34,7 @@ ButtonBox::ButtonBox(const std::string &title, const std::string &buttonTxt, add(button); } -void -ButtonBox::action(const gcn::ActionEvent &event) +void ButtonBox::action(const gcn::ActionEvent &event) { if (event.getId() == "activate") { diff --git a/src/gui/buttonbox.h b/src/gui/buttonbox.h index edde4aa4..1741f7ba 100644 --- a/src/gui/buttonbox.h +++ b/src/gui/buttonbox.h @@ -60,8 +60,7 @@ class ButtonBox : public Window, public gcn::ActionListener * * @param event is the event that is generated */ - void - action(const gcn::ActionEvent &event); + void action(const gcn::ActionEvent &event); private: diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index 08fcd2b2..750c6d6f 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -308,8 +308,7 @@ CharCreateDialog::~CharCreateDialog() charServerHandler.setCharCreateDialog(0); } -void -CharCreateDialog::action(const gcn::ActionEvent &event) +void CharCreateDialog::action(const gcn::ActionEvent &event) { int numberOfColors = ColorDB::size(); if (event.getId() == "create") { @@ -340,22 +339,19 @@ CharCreateDialog::action(const gcn::ActionEvent &event) } } -std::string -CharCreateDialog::getName() +std::string CharCreateDialog::getName() { std::string name = mNameField->getText(); trim(name); return name; } -void -CharCreateDialog::unlock() +void CharCreateDialog::unlock() { mCreateButton->setEnabled(true); } -void -CharCreateDialog::attemptCharCreate() +void CharCreateDialog::attemptCharCreate() { // Send character infos MessageOut outMsg(mNetwork); diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp index ff401332..d5452532 100644 --- a/src/gui/char_server.cpp +++ b/src/gui/char_server.cpp @@ -98,8 +98,7 @@ ServerSelectDialog::~ServerSelectDialog() delete mServerListModel; } -void -ServerSelectDialog::action(const gcn::ActionEvent &event) +void ServerSelectDialog::action(const gcn::ActionEvent &event) { if (event.getId() == "ok") { mOkButton->setEnabled(false); @@ -114,14 +113,12 @@ ServerSelectDialog::action(const gcn::ActionEvent &event) } } -int -ServerListModel::getNumberOfElements() +int ServerListModel::getNumberOfElements() { return n_server; } -std::string -ServerListModel::getElementAt(int i) +std::string ServerListModel::getElementAt(int i) { const SERVER_INFO *si = server_info[i]; return si->name + " (" + toString(si->online_users) + ")"; diff --git a/src/gui/chat.h b/src/gui/chat.h index 437dc115..9e137499 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -107,149 +107,142 @@ struct CHATSKILL * \ingroup Interface */ class ChatWindow : public Window, public gcn::ActionListener, - public gcn::KeyListener + public gcn::KeyListener { public: - /** - * Constructor. - */ - ChatWindow(Network *network); - - /** - * Destructor: used to write back values to the config file - */ - ~ChatWindow(); - - /** - * Logic (updates components' size) - */ - void logic(); - - /** - * Adds a line of text to our message list. Parameters: - * - * @param line Text message. - * @parem own Type of message (usually the owner-type). - */ - void chatLog(std::string line, int own, bool ignoreRecord = false); - - /** - * Calls original chat_log() after processing the packet. - */ - void chatLog(CHATSKILL); - - /** - * Performs action. - */ - void action(const gcn::ActionEvent &event); - - /** - * Request focus for typing chat message. - */ - void requestChatFocus(); - - /** - * Checks whether ChatWindow is Focused or not. - */ - bool isInputFocused(); - - /** - * Determines whether to send a command or an ordinary message, then - * contructs packets & sends them. - * - * @param nick The character's name to display in front. - * @param msg The message text which is to be send. - * - * NOTE: - * The nickname is required by the server, if not specified - * the message may not be sent unless a command was intended - * which requires another packet to be constructed! you can - * achieve this by putting a slash ("/") infront of the - * message followed by the command name and the message. - * of course all slash-commands need implemented handler- - * routines. ;-) - * remember, a line starting with "@" is not a command that needs - * to be parsed rather is sent using the normal chat-packet. - * - * EXAMPLE: - * // for an global announcement /- command - * chatlog.chat_send("", "/announce Hello to all logged in users!"); - * // for simple message by a user /- message - * chatlog.chat_send("Zaeiru", "Hello to all users on the screen!"); - */ - void - chatSend(const std::string &nick, std::string msg); - - /** Called when key is pressed */ - void - keyPressed(gcn::KeyEvent &event); - - /** Called to set current text */ - void - setInputText(std::string input_str); - - /** Override to reset mTmpVisible */ - void - setVisible(bool visible); + /** + * Constructor. + */ + ChatWindow(Network *network); + + /** + * Destructor: used to write back values to the config file + */ + ~ChatWindow(); + + /** + * Logic (updates components' size) + */ + void logic(); + + /** + * Adds a line of text to our message list. Parameters: + * + * @param line Text message. + * @parem own Type of message (usually the owner-type). + */ + void chatLog(std::string line, int own, bool ignoreRecord = false); + + /** + * Calls original chat_log() after processing the packet. + */ + void chatLog(CHATSKILL); + + /** + * Performs action. + */ + void action(const gcn::ActionEvent &event); + + /** + * Request focus for typing chat message. + */ + void requestChatFocus(); + + /** + * Checks whether ChatWindow is Focused or not. + */ + bool isInputFocused(); + + /** + * Determines whether to send a command or an ordinary message, then + * contructs packets & sends them. + * + * @param nick The character's name to display in front. + * @param msg The message text which is to be send. + * + * NOTE: + * The nickname is required by the server, if not specified + * the message may not be sent unless a command was intended + * which requires another packet to be constructed! you can + * achieve this by putting a slash ("/") infront of the + * message followed by the command name and the message. + * of course all slash-commands need implemented handler- + * routines. ;-) + * remember, a line starting with "@" is not a command that needs + * to be parsed rather is sent using the normal chat-packet. + * + * EXAMPLE: + * // for an global announcement /- command + * chatlog.chat_send("", "/announce Hello to all logged in users!"); + * // for simple message by a user /- message + * chatlog.chat_send("Zaeiru", "Hello to all users on the screen!"); + */ + void chatSend(const std::string &nick, std::string msg); + + /** Called when key is pressed */ + void keyPressed(gcn::KeyEvent &event); + + /** Called to set current text */ + void setInputText(std::string input_str); + + /** Override to reset mTmpVisible */ + void setVisible(bool visible); /** - * Scrolls the chat window - * - * @param amount direction and amount to scroll. Negative numbers scroll - * up, positive numbers scroll down. The absolute amount indicates the - * amount of 1/8ths of chat window real estate that should be scrolled. - */ - void - scroll(int amount); - - /** - * party implements the partying chat commands - * - * @param command is the party command to perform - * @param msg is the remainder of the message - */ - void - party(const std::string &command, const std::string &msg); - - /** - * help implements the /help command - * - * @param msg1 is the command that the player needs help on - * @param msg2 is the sub-command relating to the command - */ - void - help(const std::string &msg1, const std::string &msg2); + * Scrolls the chat window + * + * @param amount direction and amount to scroll. Negative numbers scroll + * up, positive numbers scroll down. The absolute amount indicates the + * amount of 1/8ths of chat window real estate that should be scrolled. + */ + void scroll(int amount); + + /** + * party implements the partying chat commands + * + * @param command is the party command to perform + * @param msg is the remainder of the message + */ + void party(const std::string &command, const std::string &msg); + + /** + * help implements the /help command + * + * @param msg1 is the command that the player needs help on + * @param msg2 is the sub-command relating to the command + */ + void help(const std::string &msg1, const std::string &msg2); private: - Network *mNetwork; - bool mTmpVisible; - - /** One item in the chat log */ - struct CHATLOG - { - std::string nick; - std::string text; - int own; - }; - - /** Constructs failed messages for actions */ - std::string const_msg(CHATSKILL); - - gcn::TextField *mChatInput; /**< Input box for typing chat messages */ - BrowserBox *mTextOutput; /**< Text box for displaying chat history */ - ScrollArea *mScrollArea; /**< Scroll area around text output */ - - typedef std::list<std::string> History; - typedef History::iterator HistoryIterator; - History mHistory; /**< Command history */ - HistoryIterator mCurHist; /**< History iterator */ - Recorder *mRecorder; /**< Recording class */ - char mPartyPrefix; /**< Messages beginning with the prefix are sent to - the party */ - bool mReturnToggles; /**< Marks whether <Return> toggles the chat log - or not */ - Party *mParty; + Network *mNetwork; + bool mTmpVisible; + + /** One item in the chat log */ + struct CHATLOG + { + std::string nick; + std::string text; + int own; + }; + + /** Constructs failed messages for actions */ + std::string const_msg(CHATSKILL); + + gcn::TextField *mChatInput; /**< Input box for typing chat messages */ + BrowserBox *mTextOutput; /**< Text box for displaying chat history */ + ScrollArea *mScrollArea; /**< Scroll area around text output */ + + typedef std::list<std::string> History; + typedef History::iterator HistoryIterator; + History mHistory; /**< Command history */ + HistoryIterator mCurHist; /**< History iterator */ + Recorder *mRecorder; /**< Recording class */ + char mPartyPrefix; /**< Messages beginning with the prefix are sent to + the party */ + bool mReturnToggles; /**< Marks whether <Return> toggles the chat log + or not */ + Party *mParty; }; extern ChatWindow *chatWindow; diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index 7fc63096..63f4762a 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -67,8 +67,7 @@ DebugWindow::DebugWindow(): add(mParticleCountLabel); } -void -DebugWindow::logic() +void DebugWindow::logic() { // Get the current mouse position int mouseX, mouseY; diff --git a/src/gui/emotecontainer.h b/src/gui/emotecontainer.h index f5922a9c..2a115f0b 100644 --- a/src/gui/emotecontainer.h +++ b/src/gui/emotecontainer.h @@ -33,15 +33,13 @@ #include "../resources/imageset.h" class Image; -class Inventory; -class Emote; namespace gcn { class SelectionListener; } /** - * An item container. Used to show items in inventory and trade dialog. + * An emote container. Used to show emotes in inventory and trade dialog. * * \ingroup GUI */ @@ -61,7 +59,7 @@ class EmoteContainer : public gcn::Widget, virtual ~EmoteContainer(); /** - * Draws the items. + * Draws the emotes. */ void draw(gcn::Graphics *graphics); @@ -76,12 +74,12 @@ class EmoteContainer : public gcn::Widget, void mousePressed(gcn::MouseEvent &event); /** - * Returns the selected item. + * Returns the selected emote. */ int getSelectedEmote(); /** - * Sets selected item to NULL. + * Sets selected emote to NULL. */ void selectNone(); @@ -106,12 +104,12 @@ class EmoteContainer : public gcn::Widget, private: /** - * Sets the currently selected item. Invalid (e.g., negative) indices set `no item'. + * Sets the currently selected emote. Invalid (e.g., negative) indices set `no emotr'. */ void setSelectedEmoteIndex(int index); /** - * Find the current item index by the most recently used item ID + * Find the current emote index by the most recently used emote ID */ void refindSelectedEmote(void); diff --git a/src/gui/emotewindow.h b/src/gui/emotewindow.h index a382e37d..dbe4efd7 100644 --- a/src/gui/emotewindow.h +++ b/src/gui/emotewindow.h @@ -67,7 +67,6 @@ class EmoteWindow : public Window, gcn::ActionListener, void widgetResized(const gcn::Event &event); private: - EmoteContainer *mEmotes; gcn::Button *mUseButton; diff --git a/src/gui/inttextbox.cpp b/src/gui/inttextbox.cpp index df8cf24e..4cb885c3 100644 --- a/src/gui/inttextbox.cpp +++ b/src/gui/inttextbox.cpp @@ -29,8 +29,7 @@ IntTextBox::IntTextBox(int i): { } -void -IntTextBox::keyPressed(gcn::KeyEvent &event) +void IntTextBox::keyPressed(gcn::KeyEvent &event) { const gcn::Key &key = event.getKey(); diff --git a/src/gui/inttextbox.h b/src/gui/inttextbox.h index 9c6e8bf4..d134fcd7 100644 --- a/src/gui/inttextbox.h +++ b/src/gui/inttextbox.h @@ -55,8 +55,7 @@ class IntTextBox : public TextField /** * Responds to key presses. */ - void - keyPressed(gcn::KeyEvent &event); + void keyPressed(gcn::KeyEvent &event); private: int mMin; /**< Minimum value */ diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp deleted file mode 100644 index 055cbe44..00000000 --- a/src/gui/itempopup.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * The Legend of Mazzeroth - * Copyright (C) 2008, The Legend of Mazzeroth Development Team - * - * This file is part of The Legend of Mazzeroth based on original code - * from The Mana World. - * - * The Legend of Mazzeroth is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Legend of Mazzeroth is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Legend of Mazzeroth; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <guichan/widgets/label.hpp> - -#include "gui.h" -#include "itempopup.h" - -#include "widgets/layout.h" - -#include "../resources/image.h" -#include "../resources/iteminfo.h" -#include "../resources/resourcemanager.h" -#include "../utils/gettext.h" -#include "../utils/strprintf.h" - -ItemPopup::ItemPopup() -{ - - setResizable(false); - setTitleBarHeight(0); - - // Item Name - mItemName = new gcn::Label("Label"); - mItemName->setFont(gui->getFont()); - mItemName->setPosition(2, 2); - mItemName->setWidth(getWidth() - 4); - - // Item Description - mItemDesc = new TextBox(); - mItemDesc->setEditable(false); - mItemDescScroll = new ScrollArea(mItemDesc); - - mItemDescScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); - mItemDescScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); - mItemDescScroll->setDimension(gcn::Rectangle(0, 0, 196, 14)); - mItemDescScroll->setOpaque(false); - mItemDescScroll->setPosition(2, 15); - - // Item Effect - mItemEffect = new TextBox(); - mItemEffect->setEditable(false); - mItemEffectScroll = new ScrollArea(mItemEffect); - - mItemEffectScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); - mItemEffectScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); - mItemEffectScroll->setDimension(gcn::Rectangle(0, 0, 196, 14)); - mItemEffectScroll->setOpaque(false); - mItemEffectScroll->setPosition(2, 35); - - add(mItemName); - add(mItemDescScroll); - add(mItemEffectScroll); - - setLocationRelativeTo(getParent()); - - // LEEOR / TODO: This causes an exception error. - //moveToBottom(getParent()); - - mItemDesc->setTextWrapped( "" ); - mItemEffect->setTextWrapped( "" ); -} - -void ItemPopup::setItem(Item *item) -{ - - ItemInfo const *info = item ? &item->getInfo() : NULL; - - mItemName->setCaption(info->getName()); - mItemDesc->setTextWrapped( info->getDescription() ); - mItemEffect->setTextWrapped( info->getEffect() ); - - int numRowsDesc = mItemDesc->getNumberOfRows(); - int numRowsEffect = mItemEffect->getNumberOfRows(); - - if(info->getEffect() == "") - { - setContentSize(200, (numRowsDesc * 14) + 30); - } else { - setContentSize(200, (numRowsDesc * 14) + (numRowsEffect*14) + 30); - } - - mItemDescScroll->setDimension(gcn::Rectangle(2, 0, 196, numRowsDesc * 14)); - - mItemEffectScroll->setDimension(gcn::Rectangle(2, 0, 196, numRowsEffect * 14)); - - mItemDescScroll->setPosition(2, 20); - mItemEffectScroll->setPosition(2, (numRowsDesc * 15) + 25); -} - -unsigned int ItemPopup::getNumRows() -{ - return mItemDesc->getNumberOfRows(), mItemEffect->getNumberOfRows(); -} diff --git a/src/gui/itempopup.h b/src/gui/itempopup.h deleted file mode 100644 index 0082ec2c..00000000 --- a/src/gui/itempopup.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -* - * The Legend of Mazzeroth - * Copyright (C) 2008, The Legend of Mazzeroth Development Team - * - * This file is part of The Legend of Mazzeroth based on original code - * from The Mana World. - * - * The Legend of Mazzeroth is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Legend of Mazzeroth is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Legend of Mazzeroth; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _LOM_ITEMPOPUP_H__ -#define _LOM_ITEMPOPUP_H__ - -#include "scrollarea.h" -#include "textbox.h" -#include "window.h" - -#include "../item.h" - -class ItemPopup : public Window - { - public: - - ItemPopup(); - - void setItem(Item *item); - unsigned int getNumRows(); - - private: - gcn::Label *mItemName; - TextBox *mItemDesc; - TextBox *mItemEffect; - ScrollArea *mItemDescScroll; - ScrollArea *mItemEffectScroll; - - }; - -#endif diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp index 4dca66a0..7e28e1f5 100644 --- a/src/gui/listbox.cpp +++ b/src/gui/listbox.cpp @@ -57,8 +57,7 @@ void ListBox::draw(gcn::Graphics *graphics) } } -void -ListBox::mouseDragged(gcn::MouseEvent &event) +void ListBox::mouseDragged(gcn::MouseEvent &event) { // Pretend mouse is pressed continuously while dragged. Causes list // selection to be updated as is default in many GUIs. diff --git a/src/gui/login.cpp b/src/gui/login.cpp index 18976b46..bba69754 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -188,8 +188,7 @@ bool LoginDialog::canSubmit() state == LOGIN_STATE; } -bool -LoginDialog::isUShort(const std::string &str) +bool LoginDialog::isUShort(const std::string &str) { if (str == "") { @@ -212,8 +211,7 @@ LoginDialog::isUShort(const std::string &str) return true; } -unsigned short -LoginDialog::getUShort(const std::string &str) +unsigned short LoginDialog::getUShort(const std::string &str) { unsigned long l = 0; for (std::string::const_iterator strPtr = str.begin(), strEnd = str.end(); @@ -228,9 +226,8 @@ LoginDialog::getUShort(const std::string &str) * LoginDialog::DropDownList */ -void -LoginDialog::DropDownList::saveEntry(const std::string &server, - const std::string &port, int &saved) +void LoginDialog::DropDownList::saveEntry(const std::string &server, + const std::string &port, int &saved) { if (saved < MAX_SERVER_LIST_SIZE && server != "") { @@ -272,9 +269,8 @@ LoginDialog::DropDownList::DropDownList(std::string prefix, } } -void -LoginDialog::DropDownList::save(const std::string &server, - const std::string &port) +void LoginDialog::DropDownList::save(const std::string &server, + const std::string &port) { int position = 0; saveEntry(server, port, position); @@ -292,14 +288,12 @@ LoginDialog::DropDownList::save(const std::string &server, } } -int -LoginDialog::DropDownList::getNumberOfElements() +int LoginDialog::DropDownList::getNumberOfElements() { return mServers.size(); } -std::string -LoginDialog::DropDownList::getElementAt(int i) +std::string LoginDialog::DropDownList::getElementAt(int i) { if (i < 0 || i >= getNumberOfElements()) { @@ -308,8 +302,7 @@ LoginDialog::DropDownList::getElementAt(int i) return getServerAt(i) + ":" + getPortAt(i); } -std::string -LoginDialog::DropDownList::getServerAt(int i) +std::string LoginDialog::DropDownList::getServerAt(int i) { if (i < 0 || i >= getNumberOfElements()) { @@ -318,9 +311,7 @@ LoginDialog::DropDownList::getServerAt(int i) return mServers.at(i); } - -std::string -LoginDialog::DropDownList::getPortAt(int i) +std::string LoginDialog::DropDownList::getPortAt(int i) { if (i < 0 || i >= getNumberOfElements()) { diff --git a/src/gui/login.h b/src/gui/login.h index 3b911424..d1d75ebc 100644 --- a/src/gui/login.h +++ b/src/gui/login.h @@ -74,8 +74,7 @@ class LoginDialog : public Window, public gcn::ActionListener, * Returns whether submit can be enabled. This is true in the login * state, when all necessary fields have some text. */ - bool - canSubmit(); + bool canSubmit(); /** * Function to decide whether string is an unsigned short or not @@ -84,8 +83,7 @@ class LoginDialog : public Window, public gcn::ActionListener, * * @return true is str is an unsigned short, false otherwise */ - static bool - isUShort(const std::string &str); + static bool isUShort(const std::string &str); /** * Converts string to an unsigned short (undefined if invalid) @@ -94,8 +92,7 @@ class LoginDialog : public Window, public gcn::ActionListener, * * @return the value str represents */ - static unsigned short - getUShort(const std::string &str); + static unsigned short getUShort(const std::string &str); DropDown *mServerDropDown; gcn::TextField *mUserField; diff --git a/src/gui/passwordfield.h b/src/gui/passwordfield.h index 9aa6ab49..e31b1779 100644 --- a/src/gui/passwordfield.h +++ b/src/gui/passwordfield.h @@ -31,7 +31,8 @@ * * \ingroup GUI */ -class PasswordField : public TextField { +class PasswordField : public TextField +{ public: /** * Constructor, initializes the password field with the given string. diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp index e5227e5a..92722417 100644 --- a/src/gui/playerbox.cpp +++ b/src/gui/playerbox.cpp @@ -76,8 +76,7 @@ PlayerBox::~PlayerBox() } } -void -PlayerBox::draw(gcn::Graphics *graphics) +void PlayerBox::draw(gcn::Graphics *graphics) { if (mPlayer) { @@ -90,8 +89,7 @@ PlayerBox::draw(gcn::Graphics *graphics) } } -void -PlayerBox::drawFrame(gcn::Graphics *graphics) +void PlayerBox::drawFrame(gcn::Graphics *graphics) { int w, h, bs; bs = getFrameSize(); diff --git a/src/gui/playerbox.h b/src/gui/playerbox.h index 7aec87bf..3ccb5fad 100644 --- a/src/gui/playerbox.h +++ b/src/gui/playerbox.h @@ -53,8 +53,7 @@ class PlayerBox : public gcn::ScrollArea * player to <code>NULL</code> causes the box not to draw any * character. */ - void - setPlayer(const Player *player) { mPlayer = player; } + void setPlayer(const Player *player) { mPlayer = player; } /** * Draws the scroll area. diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp index 708a2991..b4117c80 100644 --- a/src/gui/progressbar.cpp +++ b/src/gui/progressbar.cpp @@ -88,8 +88,7 @@ void ProgressBar::logic() if (mBlueToGo < mBlue) mBlue--; } -void -ProgressBar::draw(gcn::Graphics *graphics) +void ProgressBar::draw(gcn::Graphics *graphics) { static_cast<Graphics*>(graphics)-> drawImageRect(0, 0, getWidth(), getHeight(), mBorder); @@ -104,16 +103,14 @@ ProgressBar::draw(gcn::Graphics *graphics) } } -void -ProgressBar::setProgress(float progress) +void ProgressBar::setProgress(float progress) { if (progress < 0.0f) mProgress = 0.0; else if (progress > 1.0f) mProgress = 1.0; else mProgress = progress; } -void -ProgressBar::setColor(Uint8 red, Uint8 green, Uint8 blue) +void ProgressBar::setColor(Uint8 red, Uint8 green, Uint8 blue) { mRedToGo = red; mGreenToGo = green; diff --git a/src/gui/progressbar.h b/src/gui/progressbar.h index a20c901f..d2ace66c 100644 --- a/src/gui/progressbar.h +++ b/src/gui/progressbar.h @@ -52,50 +52,42 @@ class ProgressBar : public gcn::Widget { /** * Performs progress bar logic (fading colors) */ - void - logic(); + void logic(); /** * Draws the progress bar. */ - void - draw(gcn::Graphics *graphics); + void draw(gcn::Graphics *graphics); /** * Sets the current progress. */ - void - setProgress(float progress); + void setProgress(float progress); /** * Returns the current progress. */ - float - getProgress() { return mProgress; } + float getProgress() { return mProgress; } /** * Change the filling of the progress bar. */ - void - setColor(Uint8, Uint8 green, Uint8 blue); + void setColor(Uint8, Uint8 green, Uint8 blue); /** * Get The red value of color */ - Uint8 - getRed() { return mRed; } + Uint8 getRed() { return mRed; } /** * Get The red value of color */ - Uint8 - getGreen() { return mGreen; } + Uint8 getGreen() { return mGreen; } /** * Get The red value of color */ - Uint8 - getBlue() { return mBlue; } + Uint8 getBlue() { return mBlue; } private: float mProgress; diff --git a/src/gui/register.cpp b/src/gui/register.cpp index 5d687425..568ec5ff 100644 --- a/src/gui/register.cpp +++ b/src/gui/register.cpp @@ -43,14 +43,12 @@ #include "../utils/gettext.h" #include "../utils/strprintf.h" -void -WrongDataNoticeListener::setTarget(gcn::TextField *textField) +void WrongDataNoticeListener::setTarget(gcn::TextField *textField) { mTarget = textField; } -void -WrongDataNoticeListener::action(const gcn::ActionEvent &event) +void WrongDataNoticeListener::action(const gcn::ActionEvent &event) { if (event.getId() == "ok") { @@ -173,8 +171,7 @@ RegisterDialog::~RegisterDialog() delete mWrongDataNoticeListener; } -void -RegisterDialog::action(const gcn::ActionEvent &event) +void RegisterDialog::action(const gcn::ActionEvent &event) { if (event.getId() == "cancel") { @@ -263,14 +260,12 @@ RegisterDialog::action(const gcn::ActionEvent &event) } } -void -RegisterDialog::keyPressed(gcn::KeyEvent &keyEvent) +void RegisterDialog::keyPressed(gcn::KeyEvent &keyEvent) { mRegisterButton->setEnabled(canSubmit()); } -bool -RegisterDialog::canSubmit() +bool RegisterDialog::canSubmit() { return !mUserField->getText().empty() && !mPasswordField->getText().empty() && @@ -280,8 +275,7 @@ RegisterDialog::canSubmit() state == REGISTER_STATE; } -bool -RegisterDialog::isUShort(const std::string &str) +bool RegisterDialog::isUShort(const std::string &str) { if (str == "") { @@ -304,8 +298,7 @@ RegisterDialog::isUShort(const std::string &str) return true; } -unsigned short -RegisterDialog::getUShort(const std::string &str) +unsigned short RegisterDialog::getUShort(const std::string &str) { unsigned long l = 0; for (std::string::const_iterator strPtr = str.begin(), strEnd = str.end(); diff --git a/src/gui/register.h b/src/gui/register.h index 87a11bb9..4c1d9f88 100644 --- a/src/gui/register.h +++ b/src/gui/register.h @@ -84,8 +84,7 @@ class RegisterDialog : public Window, public gcn::ActionListener, * Returns whether submit can be enabled. This is true in the register * state, when all necessary fields have some text. */ - bool - canSubmit(); + bool canSubmit(); /** * Function to decide whether string is an unsigned short or not @@ -94,8 +93,7 @@ class RegisterDialog : public Window, public gcn::ActionListener, * * @return true if str is an unsigned short, false otherwise */ - static bool - isUShort(const std::string &str); + static bool isUShort(const std::string &str); /** * Converts string to an unsigned short (undefined if invalid) @@ -104,8 +102,7 @@ class RegisterDialog : public Window, public gcn::ActionListener, * * @return the value str represents */ - static unsigned short - getUShort(const std::string &str); + static unsigned short getUShort(const std::string &str); gcn::TextField *mUserField; gcn::TextField *mPasswordField; diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h index dfc3da38..370a2d2e 100644 --- a/src/gui/setup_video.h +++ b/src/gui/setup_video.h @@ -42,8 +42,7 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, void action(const gcn::ActionEvent &event); /** Called when key is pressed */ - void - keyPressed(gcn::KeyEvent &event); + void keyPressed(gcn::KeyEvent &event); private: bool mFullScreenEnabled; @@ -86,12 +85,10 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, gcn::Slider *mParticleDetailSlider; gcn::Label *mParticleDetailField; - void - updateSliders(bool originalValues); + void updateSliders(bool originalValues); - int - updateSlider(gcn::Slider *slider, gcn::TextField *field, - const std::string &configName); + int updateSlider(gcn::Slider *slider, gcn::TextField *field, + const std::string &configName); }; #endif diff --git a/src/gui/status.h b/src/gui/status.h index eb4171c9..aa20d094 100644 --- a/src/gui/status.h +++ b/src/gui/status.h @@ -33,7 +33,6 @@ class LocalPlayer; class ProgressBar; - /** * The player status dialog. * diff --git a/src/gui/table.cpp b/src/gui/table.cpp index e4d7812e..264d9864 100644 --- a/src/gui/table.cpp +++ b/src/gui/table.cpp @@ -63,8 +63,7 @@ GuiTableActionListener::~GuiTableActionListener(void) } } -void -GuiTableActionListener::action(const gcn::ActionEvent& actionEvent) +void GuiTableActionListener::action(const gcn::ActionEvent& actionEvent) { mTable->setSelected(mRow, mColumn); mTable->distributeActionEvent(); @@ -88,14 +87,12 @@ GuiTable::~GuiTable(void) delete mModel; } -TableModel * -GuiTable::getModel(void) const +TableModel* GuiTable::getModel(void) const { return mModel; } -void -GuiTable::setModel(TableModel *new_model) +void GuiTable::setModel(TableModel *new_model) { if (mModel) { uninstallActionListeners(); @@ -112,9 +109,7 @@ GuiTable::setModel(TableModel *new_model) } } - -void -GuiTable::recomputeDimensions(void) +void GuiTable::recomputeDimensions(void) { int rows_nr = mModel->getRows(); int columns_nr = mModel->getColumns(); @@ -136,33 +131,28 @@ GuiTable::recomputeDimensions(void) setHeight(height); } -void -GuiTable::setSelected(int row, int column) +void GuiTable::setSelected(int row, int column) { mSelectedColumn = column; mSelectedRow = row; } -int -GuiTable::getSelectedRow(void) +int GuiTable::getSelectedRow(void) { return mSelectedRow; } -int -GuiTable::getSelectedColumn(void) +int GuiTable::getSelectedColumn(void) { return mSelectedColumn; } -void -GuiTable::setLinewiseSelection(bool linewise) +void GuiTable::setLinewiseSelection(bool linewise) { mLinewiseMode = linewise; } -int -GuiTable::getRowHeight(void) +int GuiTable::getRowHeight(void) { if (mModel) return mModel->getRowHeight() + 1; // border @@ -170,8 +160,7 @@ GuiTable::getRowHeight(void) return 0; } -int -GuiTable::getColumnWidth(int i) +int GuiTable::getColumnWidth(int i) { if (mModel) return mModel->getColumnWidth(i) + 1; // border @@ -179,16 +168,14 @@ GuiTable::getColumnWidth(int i) return 0; } -void -GuiTable::uninstallActionListeners(void) +void GuiTable::uninstallActionListeners(void) { for (std::vector<GuiTableActionListener *>::const_iterator it = action_listeners.begin(); it != action_listeners.end(); it++) delete *it; action_listeners.clear(); } -void -GuiTable::installActionListeners(void) +void GuiTable::installActionListeners(void) { if (!mModel) return; @@ -207,8 +194,7 @@ GuiTable::installActionListeners(void) } // -- widget ops -void -GuiTable::draw(gcn::Graphics* graphics) +void GuiTable::draw(gcn::Graphics* graphics) { graphics->setColor(getBackgroundColor()); graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight())); @@ -282,42 +268,35 @@ GuiTable::draw(gcn::Graphics* graphics) } } -void -GuiTable::logic(void) +void GuiTable::logic(void) { } -void -GuiTable::moveToTop(gcn::Widget *widget) +void GuiTable::moveToTop(gcn::Widget *widget) { gcn::Widget::moveToTop(widget); this->mTopWidget = widget; } -void -GuiTable::moveToBottom(gcn::Widget *widget) +void GuiTable::moveToBottom(gcn::Widget *widget) { gcn::Widget::moveToBottom(widget); if (widget == this->mTopWidget) this->mTopWidget = NULL; } -gcn::Rectangle -GuiTable::getChildrenArea(void) +gcn::Rectangle GuiTable::getChildrenArea(void) { return gcn::Rectangle(0, 0, getWidth(), getHeight()); } // -- KeyListener notifications -void -GuiTable::keyPressed(gcn::KeyEvent& keyEvent) +void GuiTable::keyPressed(gcn::KeyEvent& keyEvent) { } - // -- MouseListener notifications -void -GuiTable::mousePressed(gcn::MouseEvent& mouseEvent) +void GuiTable::mousePressed(gcn::MouseEvent& mouseEvent) { if (mouseEvent.getButton() == gcn::MouseEvent::LEFT) { int row = getRowForY(mouseEvent.getY()); @@ -332,24 +311,20 @@ GuiTable::mousePressed(gcn::MouseEvent& mouseEvent) } } -void -GuiTable::mouseWheelMovedUp(gcn::MouseEvent& mouseEvent) +void GuiTable::mouseWheelMovedUp(gcn::MouseEvent& mouseEvent) { } -void -GuiTable::mouseWheelMovedDown(gcn::MouseEvent& mouseEvent) +void GuiTable::mouseWheelMovedDown(gcn::MouseEvent& mouseEvent) { } -void -GuiTable::mouseDragged(gcn::MouseEvent& mouseEvent) +void GuiTable::mouseDragged(gcn::MouseEvent& mouseEvent) { } // -- TableModelListener notifications -void -GuiTable::modelUpdated(bool completed) +void GuiTable::modelUpdated(bool completed) { if (completed) { recomputeDimensions(); @@ -360,8 +335,7 @@ GuiTable::modelUpdated(bool completed) } } -gcn::Widget * -GuiTable::getWidgetAt(int x, int y) +gcn::Widget* GuiTable::getWidgetAt(int x, int y) { int row = getRowForY(y); int column = getColumnForX(x); @@ -381,8 +355,7 @@ GuiTable::getWidgetAt(int x, int y) return NULL; } -int -GuiTable::getRowForY(int y) +int GuiTable::getRowForY(int y) { int row = y / getRowHeight(); @@ -393,8 +366,7 @@ GuiTable::getRowForY(int y) return row; } -int -GuiTable::getColumnForX(int x) +int GuiTable::getColumnForX(int x) { int column; int delta = 0; @@ -412,9 +384,7 @@ GuiTable::getColumnForX(int x) return column; } - -void -GuiTable::_setFocusHandler(gcn::FocusHandler* focusHandler) +void GuiTable::_setFocusHandler(gcn::FocusHandler* focusHandler) { gcn::Widget::_setFocusHandler(focusHandler); diff --git a/src/gui/table_model.cpp b/src/gui/table_model.cpp index e1afef96..9911eec3 100644 --- a/src/gui/table_model.cpp +++ b/src/gui/table_model.cpp @@ -25,27 +25,23 @@ #include "table_model.h" -void -TableModel::installListener(TableModelListener *listener) +void TableModel::installListener(TableModelListener *listener) { listeners.insert(listener); } -void -TableModel::removeListener(TableModelListener *listener) +void TableModel::removeListener(TableModelListener *listener) { listeners.erase(listener); } -void -TableModel::signalBeforeUpdate(void) +void TableModel::signalBeforeUpdate(void) { for (std::set<TableModelListener *>::const_iterator it = listeners.begin(); it != listeners.end(); it++) (*it)->modelUpdated(false); } -void -TableModel::signalAfterUpdate(void) +void TableModel::signalAfterUpdate(void) { for (std::set<TableModelListener *>::const_iterator it = listeners.begin(); it != listeners.end(); it++) (*it)->modelUpdated(true); @@ -72,16 +68,14 @@ StaticTableModel::~StaticTableModel(void) delete *it; } -void -StaticTableModel::resize(void) +void StaticTableModel::resize(void) { mRows = getRows(); mColumns = getColumns(); mTableModel.resize(mRows * mColumns, NULL); } -void -StaticTableModel::set(int row, int column, gcn::Widget *widget) +void StaticTableModel::set(int row, int column, gcn::Widget *widget) { if (row >= mRows || row < 0 || column >= mColumns || column < 0) @@ -106,14 +100,12 @@ StaticTableModel::set(int row, int column, gcn::Widget *widget) signalAfterUpdate(); } -gcn::Widget * -StaticTableModel::getElementAt(int row, int column) +gcn::Widget* StaticTableModel::getElementAt(int row, int column) { return mTableModel[WIDGET_AT(row, column)]; } -void -StaticTableModel::fixColumnWidth(int column, int width) +void StaticTableModel::fixColumnWidth(int column, int width) { if (width < 0 || column < 0 || column >= mColumns) @@ -122,8 +114,7 @@ StaticTableModel::fixColumnWidth(int column, int width) mWidths[column] = -width; // Negate to tag as fixed } -void -StaticTableModel::fixRowHeight(int height) +void StaticTableModel::fixRowHeight(int height) { if (height < 0) return; @@ -131,14 +122,12 @@ StaticTableModel::fixRowHeight(int height) mHeight = -height; } -int -StaticTableModel::getRowHeight(void) +int StaticTableModel::getRowHeight(void) { return abs(mHeight); } -int -StaticTableModel::getColumnWidth(int column) +int StaticTableModel::getColumnWidth(int column) { if (column < 0 || column >= mColumns) return 0; @@ -146,14 +135,12 @@ StaticTableModel::getColumnWidth(int column) return abs(mWidths[column]); } -int -StaticTableModel::getRows(void) +int StaticTableModel::getRows(void) { return mRows; } -int -StaticTableModel::getColumns(void) +int StaticTableModel::getColumns(void) { return mColumns; } diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp index 7f9abd3a..248afcbf 100644 --- a/src/gui/truetypefont.cpp +++ b/src/gui/truetypefont.cpp @@ -17,16 +17,14 @@ * You should have received a copy of the GNU General Public License * along with The Mana World; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id$ */ -#include "truetypefont.h" - #include <list> #include <guichan/exception.hpp> +#include "truetypefont.h" + #include "../graphics.h" #include "../resources/image.h" @@ -77,7 +75,6 @@ class TextChunk gcn::Color color; }; - // Word surfaces cache static std::list<TextChunk> cache; typedef std::list<TextChunk>::iterator CacheIterator; @@ -114,8 +111,8 @@ TrueTypeFont::~TrueTypeFont() } void TrueTypeFont::drawString(gcn::Graphics *graphics, - const std::string &text, - int x, int y) + const std::string &text, + int x, int y) { if (text.empty()) { diff --git a/src/gui/truetypefont.h b/src/gui/truetypefont.h index 7a4ee9ac..67c39e6a 100644 --- a/src/gui/truetypefont.h +++ b/src/gui/truetypefont.h @@ -17,8 +17,6 @@ * You should have received a copy of the GNU General Public License * along with The Mana World; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id$ */ #ifndef _TMW_TRUETYPEFONT_H diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index fab048fc..9311b59b 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -69,8 +69,7 @@ static unsigned long fadler32(FILE *file) /** * Load the given file into a vector of strings. */ -std::vector<std::string> -loadTextFile(const std::string &fileName) +std::vector<std::string> loadTextFile(const std::string &fileName) { std::vector<std::string> lines; std::ifstream fin(fileName.c_str()); @@ -242,8 +241,7 @@ int UpdaterWindow::updateProgress(void *ptr, return 0; } -size_t -UpdaterWindow::memoryWrite(void *ptr, size_t size, size_t nmemb, FILE *stream) +size_t UpdaterWindow::memoryWrite(void *ptr, size_t size, size_t nmemb, FILE *stream) { UpdaterWindow *uw = reinterpret_cast<UpdaterWindow *>(stream); size_t totalMem = size * nmemb; diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 5bb29987..5fcb7dc9 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -46,8 +46,6 @@ extern volatile int tick_time; -extern volatile int tick_time; - Viewport::Viewport(): mMap(0), mPixelViewX(0.0f), diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp index 87527f0a..6009d5f5 100644 --- a/src/gui/widgets/resizegrip.cpp +++ b/src/gui/widgets/resizegrip.cpp @@ -56,8 +56,7 @@ ResizeGrip::~ResizeGrip() } } -void -ResizeGrip::draw(gcn::Graphics *graphics) +void ResizeGrip::draw(gcn::Graphics *graphics) { static_cast<Graphics*>(graphics)->drawImage(gripImage, 0, 0); } diff --git a/src/gui/window.h b/src/gui/window.h index 89cc75a5..d864290c 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -157,8 +157,7 @@ class Window : public gcn::Window, gcn::WidgetListener * * @return The parent window or <code>NULL</code> if there is none. */ - Window* - getParentWindow() { return mParent; } + Window* getParentWindow() { return mParent; } /** * Schedule this window for deletion. It will be deleted at the start @@ -198,14 +197,12 @@ class Window : public gcn::Window, gcn::WidgetListener /** * Sets the name of the window. This is not the window title. */ - void - setWindowName(const std::string &name) { mWindowName = name; } + void setWindowName(const std::string &name) { mWindowName = name; } /** * Returns the name of the window. This is not the window title. */ - const std::string& - getWindowName() { return mWindowName; } + const std::string& getWindowName() { return mWindowName; } /** * Reads the position (and the size for resizable windows) in the |