From 555e68e24f2bb7d38f7ce52ce9a43198c0ccedec Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Wed, 4 Feb 2009 11:46:03 -0700 Subject: Went through the gui folder and revised the include statements to not include anything not needed by that specific widget or window. This appears to have cleaned up system performance a bit on my current setup, where it went from idling on 45% in game with opengl down to 30% now. Also moved iptostring to the tostring header, as importing all of network.h is a little overkill to use that function, and it goes along with the basic functions that are in that header file anyways. TODO: find out a way to get rid of warnings when a class doesn't use this function. Signed-off-by: Ira Rice --- src/CMakeLists.txt | 1 - src/Makefile.am | 1 - src/extensions.h | 34 ------------------------------- src/gui/browserbox.h | 5 +---- src/gui/button.cpp | 12 +++++------ src/gui/button.h | 4 ---- src/gui/buy.h | 6 +++--- src/gui/buysell.h | 2 -- src/gui/char_select.cpp | 1 + src/gui/char_select.h | 9 +++------ src/gui/char_server.cpp | 17 +++++++--------- src/gui/char_server.h | 2 -- src/gui/chat.cpp | 43 +++++++++++++++++----------------------- src/gui/chat.h | 3 --- src/gui/chatinput.h | 2 -- src/gui/checkbox.h | 7 ++----- src/gui/colour.cpp | 2 -- src/gui/colour.h | 3 --- src/gui/confirm_dialog.cpp | 3 +++ src/gui/confirm_dialog.h | 9 ++++----- src/gui/connection.cpp | 7 ++++--- src/gui/debugwindow.cpp | 1 - src/gui/debugwindow.h | 4 ---- src/gui/emotecontainer.h | 2 -- src/gui/emoteshortcutcontainer.h | 4 ---- src/gui/emotewindow.cpp | 5 ----- src/gui/emotewindow.h | 2 -- src/gui/focushandler.h | 2 -- src/gui/gccontainer.h | 2 -- src/gui/gui.cpp | 25 +++++++++++++---------- src/gui/help.h | 2 -- src/gui/inttextfield.h | 2 -- src/gui/inventorywindow.cpp | 1 - src/gui/inventorywindow.h | 1 - src/gui/item_amount.cpp | 3 ++- src/gui/item_amount.h | 4 ---- src/gui/itemcontainer.cpp | 1 - src/gui/itemcontainer.h | 2 -- src/gui/itemlinkhandler.cpp | 6 +++--- src/gui/itempopup.cpp | 8 ++------ src/gui/itempopup.h | 7 +++---- src/gui/itemshortcutcontainer.h | 2 -- src/gui/listbox.cpp | 3 +-- src/gui/listbox.h | 2 -- src/gui/login.cpp | 1 + src/gui/login.h | 1 - src/gui/menuwindow.h | 2 -- src/gui/minimap.h | 2 -- src/gui/ministatus.h | 4 ---- src/gui/npc_text.cpp | 4 +--- src/gui/npc_text.h | 3 +-- src/gui/npcintegerdialog.cpp | 11 +++------- src/gui/npcintegerdialog.h | 5 ----- src/gui/npclistdialog.cpp | 2 ++ src/gui/npclistdialog.h | 5 ----- src/gui/npcstringdialog.cpp | 7 +------ src/gui/npcstringdialog.h | 5 ----- src/gui/ok_dialog.cpp | 7 +++++-- src/gui/ok_dialog.h | 6 ++---- src/gui/passwordfield.cpp | 2 -- src/gui/passwordfield.h | 4 ++-- src/gui/playerbox.cpp | 2 -- src/gui/playerbox.h | 2 -- src/gui/popupmenu.cpp | 4 ---- src/gui/progressbar.cpp | 4 ++-- src/gui/progressbar.h | 5 ++--- src/gui/radiobutton.h | 5 ++--- src/gui/recorder.cpp | 1 - src/gui/recorder.h | 2 -- src/gui/register.cpp | 8 ++------ src/gui/register.h | 4 +--- src/gui/scrollarea.cpp | 2 -- src/gui/scrollarea.h | 2 -- src/gui/sell.cpp | 8 +------- src/gui/sell.h | 4 ++-- src/gui/setup.cpp | 3 --- src/gui/setup_audio.h | 2 -- src/gui/setup_colours.cpp | 2 -- src/gui/setup_colours.h | 2 +- src/gui/setup_joystick.h | 2 -- src/gui/setup_keyboard.h | 1 - src/gui/setup_players.cpp | 4 +++- src/gui/setup_players.h | 11 +++++----- src/gui/setup_video.h | 2 -- src/gui/shop.h | 3 +-- src/gui/shoplistbox.cpp | 4 +--- src/gui/shoplistbox.h | 3 +-- src/gui/shortcutcontainer.cpp | 7 ------- src/gui/shortcutcontainer.h | 8 +++----- src/gui/shortcutwindow.cpp | 2 +- src/gui/shortcutwindow.h | 4 +--- src/gui/skill.cpp | 28 ++++++++++++-------------- src/gui/skill.h | 8 ++------ src/gui/slider.h | 2 -- src/gui/speechbubble.cpp | 13 ++---------- src/gui/speechbubble.h | 9 +++++---- src/gui/status.h | 4 ---- src/gui/table.cpp | 2 -- src/gui/table.h | 4 ---- src/gui/table_model.cpp | 3 --- src/gui/table_model.h | 5 ----- src/gui/textbox.cpp | 1 - src/gui/textbox.h | 5 ++--- src/gui/textfield.cpp | 4 ---- src/gui/textfield.h | 2 -- src/gui/trade.cpp | 2 -- src/gui/updatewindow.cpp | 6 +++--- src/gui/updatewindow.h | 2 -- src/gui/viewport.cpp | 5 ----- src/gui/viewport.h | 2 -- src/gui/widgets/dropdown.cpp | 2 ++ src/gui/widgets/dropdown.h | 7 ------- src/gui/widgets/resizegrip.h | 2 -- src/gui/widgets/tab.cpp | 2 -- src/gui/window.cpp | 2 -- src/gui/windowcontainer.h | 5 ++--- src/main.cpp | 1 + src/net/charserverhandler.cpp | 3 ++- src/net/loginhandler.cpp | 3 ++- src/net/network.cpp | 14 +------------ src/net/network.h | 3 --- src/utils/tostring.h | 15 ++++++++++++++ 122 files changed, 177 insertions(+), 437 deletions(-) delete mode 100644 src/extensions.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8cd062c9..86deec0c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -323,7 +323,6 @@ SET(SRCS engine.h equipment.cpp equipment.h - extensions.h floor_item.cpp floor_item.h flooritemmanager.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 3aeecc02..c6a9a9c4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -272,7 +272,6 @@ aethyra_SOURCES = gui/widgets/dropdown.cpp \ engine.h \ equipment.cpp \ equipment.h \ - extensions.h \ floor_item.cpp \ floor_item.h \ flooritemmanager.cpp \ diff --git a/src/extensions.h b/src/extensions.h deleted file mode 100644 index 5b95afc8..00000000 --- a/src/extensions.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Aethyra - * Copyright 2008 Lloyd Bryant - * - * This file is part of the Aethyra project. - * - * Aethyra 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. - * - * Aethyra 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 Mana World; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef _EXTENSIONS_ -#define _EXTENSIONS_ - -struct EXTENSIONS -{ - bool aethyra_inventory; - bool aethyra_spells; - bool aethyra_misc; -}; - -extern struct EXTENSIONS extensions; -#endif diff --git a/src/gui/browserbox.h b/src/gui/browserbox.h index 4bdf224b..15c2ab89 100644 --- a/src/gui/browserbox.h +++ b/src/gui/browserbox.h @@ -22,15 +22,12 @@ #ifndef BROWSERBOX_H #define BROWSERBOX_H -#include +#include #include #include #include -#include "../guichanfwd.h" -#include "../main.h" - class LinkHandler; struct BROWSER_LINK { diff --git a/src/gui/button.cpp b/src/gui/button.cpp index d578202e..2e6bed0a 100644 --- a/src/gui/button.cpp +++ b/src/gui/button.cpp @@ -19,6 +19,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + +#include +#include +#include + #include "button.h" #include "../configuration.h" @@ -29,12 +35,6 @@ #include "../utils/dtor.h" -#include -#include -#include - -#include - int Button::mInstances = 0; float Button::mAlpha = config.getValue("guialpha", 0.8); diff --git a/src/gui/button.h b/src/gui/button.h index 1faf2455..abaf5c43 100644 --- a/src/gui/button.h +++ b/src/gui/button.h @@ -22,12 +22,8 @@ #ifndef BUTTON_H #define BUTTON_H -#include - #include -#include "../guichanfwd.h" - class ImageRect; /** diff --git a/src/gui/buy.h b/src/gui/buy.h index 423918ce..0f1cfede 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -25,9 +25,9 @@ #include #include -#include "window.h" +#include -#include "../guichanfwd.h" +#include "window.h" class Network; class ShopItems; @@ -40,7 +40,7 @@ class ListBox; * \ingroup Interface */ class BuyDialog : public Window, public gcn::ActionListener, - gcn::SelectionListener + public gcn::SelectionListener { public: /** diff --git a/src/gui/buysell.h b/src/gui/buysell.h index 60a6398d..e3cdc52a 100644 --- a/src/gui/buysell.h +++ b/src/gui/buysell.h @@ -26,8 +26,6 @@ #include "window.h" -#include "../guichanfwd.h" - /** * A dialog to choose between buying or selling at a shop. * diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index e556dfa0..4433b646 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -22,6 +22,7 @@ #include #include + #include #include "button.h" diff --git a/src/gui/char_select.h b/src/gui/char_select.h index 5d4ecfa8..23de061d 100644 --- a/src/gui/char_select.h +++ b/src/gui/char_select.h @@ -26,9 +26,8 @@ #include "window.h" -#include "../guichanfwd.h" -#include "../lockedarray.h" #include "../being.h" +#include "../lockedarray.h" class LocalPlayer; class Network; @@ -109,14 +108,12 @@ class CharCreateDialog : public Window, public gcn::ActionListener */ ~CharCreateDialog(); - void - action(const gcn::ActionEvent &event); + void action(const gcn::ActionEvent &event); /** * Unlocks the dialog, enabling the create character button again. */ - void - unlock(); + void unlock(); private: /** diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp index 2e823b60..bc096379 100644 --- a/src/gui/char_server.cpp +++ b/src/gui/char_server.cpp @@ -28,10 +28,7 @@ #include "../main.h" #include "../serverinfo.h" -#include "../net/network.h" // TODO this is just for iptostring, move that? - #include "../utils/gettext.h" -#include "../utils/strprintf.h" #include "../utils/tostring.h" extern SERVER_INFO **server_info; @@ -39,7 +36,8 @@ extern SERVER_INFO **server_info; /** * The list model for the server list. */ -class ServerListModel : public gcn::ListModel { +class ServerListModel : public gcn::ListModel +{ public: virtual ~ServerListModel() {}; @@ -80,13 +78,12 @@ ServerSelectDialog::ServerSelectDialog(LoginData *loginData, int nextState): add(mOkButton); add(mCancelButton); - if (n_server == 0) { + if (n_server == 0) // Disable Ok button mOkButton->setEnabled(false); - } else { + else // Select first server mServerList->setSelected(1); - } setLocationRelativeTo(getParent()); setVisible(true); @@ -100,7 +97,8 @@ ServerSelectDialog::~ServerSelectDialog() void ServerSelectDialog::action(const gcn::ActionEvent &event) { - if (event.getId() == "ok") { + if (event.getId() == "ok") + { mOkButton->setEnabled(false); const SERVER_INFO *si = server_info[mServerList->getSelected()]; mLoginData->hostname = iptostring(si->address); @@ -108,9 +106,8 @@ void ServerSelectDialog::action(const gcn::ActionEvent &event) mLoginData->updateHost = si->updateHost; state = mNextState; } - else if (event.getId() == "cancel") { + else if (event.getId() == "cancel") state = LOGIN_STATE; - } } int ServerListModel::getNumberOfElements() diff --git a/src/gui/char_server.h b/src/gui/char_server.h index 9419c92d..49a5b47b 100644 --- a/src/gui/char_server.h +++ b/src/gui/char_server.h @@ -27,8 +27,6 @@ #include "window.h" -#include "../guichanfwd.h" - class LoginData; class ServerListModel; diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 36e33160..a58600a8 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -20,7 +20,6 @@ */ #include -#include #include @@ -37,7 +36,6 @@ #include "../beingmanager.h" #include "../configuration.h" -#include "../extensions.h" #include "../game.h" #include "../localplayer.h" #include "../party.h" @@ -538,32 +536,27 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) * This will eventually be replaced by a GUI, so * we don't need to get too sophisticated */ - if (extensions.aethyra_spells) + MessageOut outMsg(mNetwork); + if (msg == "heal") { - MessageOut outMsg(mNetwork); - if (msg == "heal") - { - outMsg.writeInt16(0x03f3); - outMsg.writeInt16(0x01); - outMsg.writeInt32(0); - outMsg.writeInt8(0); - outMsg.writeInt8(0); - outMsg.writeString("", 24); - } - else if (msg == "gather") - { - outMsg.writeInt16(0x03f3); - outMsg.writeInt16(0x02); - outMsg.writeInt32(0); - outMsg.writeInt8(0); - outMsg.writeInt8(0); - outMsg.writeString("", 24); - } - else - chatLog(_("No such spell!"), BY_SERVER); + outMsg.writeInt16(0x03f3); + outMsg.writeInt16(0x01); + outMsg.writeInt32(0); + outMsg.writeInt8(0); + outMsg.writeInt8(0); + outMsg.writeString("", 24); + } + else if (msg == "gather") + { + outMsg.writeInt16(0x03f3); + outMsg.writeInt16(0x02); + outMsg.writeInt32(0); + outMsg.writeInt8(0); + outMsg.writeInt8(0); + outMsg.writeString("", 24); } else - chatLog(_("The current server doesn't support spells"), BY_SERVER); + chatLog(_("No such spell!"), BY_SERVER); } else if (command == "present") { diff --git a/src/gui/chat.h b/src/gui/chat.h index 176fccb7..872c0041 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -22,7 +22,6 @@ #ifndef CHAT_H #define CHAT_H -#include #include #include @@ -31,8 +30,6 @@ #include "window.h" -#include "../guichanfwd.h" - class BrowserBox; class Network; class Recorder; diff --git a/src/gui/chatinput.h b/src/gui/chatinput.h index d98e120b..a4a50502 100644 --- a/src/gui/chatinput.h +++ b/src/gui/chatinput.h @@ -26,8 +26,6 @@ #include "textfield.h" -#include "../guichanfwd.h" - /** * The chat input hides when it loses focus. It is also invisible by default. */ diff --git a/src/gui/checkbox.h b/src/gui/checkbox.h index 2e52fd0a..20adb43c 100644 --- a/src/gui/checkbox.h +++ b/src/gui/checkbox.h @@ -22,12 +22,8 @@ #ifndef CHECKBOX_H #define CHECKBOX_H -#include - #include -#include "../guichanfwd.h" - class Image; /** @@ -35,7 +31,8 @@ class Image; * * \ingroup GUI */ -class CheckBox : public gcn::CheckBox { +class CheckBox : public gcn::CheckBox +{ public: /** * Constructor. diff --git a/src/gui/colour.cpp b/src/gui/colour.cpp index 075e9861..58d9d1c6 100644 --- a/src/gui/colour.cpp +++ b/src/gui/colour.cpp @@ -19,8 +19,6 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include - #include "colour.h" #include "../configuration.h" diff --git a/src/gui/colour.h b/src/gui/colour.h index 1e8ba3db..1648e1e8 100644 --- a/src/gui/colour.h +++ b/src/gui/colour.h @@ -22,14 +22,11 @@ #ifndef _COLOUR_H #define _COLOUR_H -#include #include #include #include -#include "../guichanfwd.h" - class Colour : public gcn::ListModel { public: diff --git a/src/gui/confirm_dialog.cpp b/src/gui/confirm_dialog.cpp index 643d5d7a..8bb9c578 100644 --- a/src/gui/confirm_dialog.cpp +++ b/src/gui/confirm_dialog.cpp @@ -21,7 +21,10 @@ #include +#include "button.h" #include "confirm_dialog.h" +#include "scrollarea.h" +#include "textbox.h" #include "../utils/gettext.h" diff --git a/src/gui/confirm_dialog.h b/src/gui/confirm_dialog.h index fb8290c8..3fa2b90d 100644 --- a/src/gui/confirm_dialog.h +++ b/src/gui/confirm_dialog.h @@ -24,19 +24,18 @@ #include -#include "button.h" -#include "scrollarea.h" -#include "textbox.h" #include "window.h" -#include "../guichanfwd.h" +class ScrollArea; +class TextBox; /** * An option dialog. * * \ingroup GUI */ -class ConfirmDialog : public Window, public gcn::ActionListener { +class ConfirmDialog : public Window, public gcn::ActionListener +{ public: /** * Constructor. diff --git a/src/gui/connection.cpp b/src/gui/connection.cpp index 15d85bbc..a69698e9 100644 --- a/src/gui/connection.cpp +++ b/src/gui/connection.cpp @@ -31,7 +31,8 @@ #include "../utils/gettext.h" -namespace { +namespace +{ struct ConnectionActionListener : public gcn::ActionListener { void action(const gcn::ActionEvent &event) { state = EXIT_STATE; } @@ -62,10 +63,10 @@ ConnectionDialog::ConnectionDialog(): void ConnectionDialog::logic() { mProgress += 0.005f; + if (mProgress > 1.0f) - { mProgress = 0.0f; - } + mProgressBar->setProgress(mProgress); Window::logic(); } diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index 223b7fbd..055d9963 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -23,7 +23,6 @@ #include -#include "button.h" #include "debugwindow.h" #include "gui.h" #include "viewport.h" diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h index 00119d15..e089de27 100644 --- a/src/gui/debugwindow.h +++ b/src/gui/debugwindow.h @@ -22,14 +22,10 @@ #ifndef DEBUGWINDOW_H #define DEBUGWINDOW_H -#include - #include #include "window.h" -#include "../guichanfwd.h" - /** * The debug window. * diff --git a/src/gui/emotecontainer.h b/src/gui/emotecontainer.h index 8e52a206..5a2b8c2e 100644 --- a/src/gui/emotecontainer.h +++ b/src/gui/emotecontainer.h @@ -29,8 +29,6 @@ #include #include -#include "../guichanfwd.h" - class AnimatedSprite; class Image; diff --git a/src/gui/emoteshortcutcontainer.h b/src/gui/emoteshortcutcontainer.h index cffaee6f..e8d87b60 100644 --- a/src/gui/emoteshortcutcontainer.h +++ b/src/gui/emoteshortcutcontainer.h @@ -24,12 +24,8 @@ #include -#include - #include "shortcutcontainer.h" -#include "../guichanfwd.h" - class AnimatedSprite; class Image; diff --git a/src/gui/emotewindow.cpp b/src/gui/emotewindow.cpp index b4e9c735..3fa96a6d 100644 --- a/src/gui/emotewindow.cpp +++ b/src/gui/emotewindow.cpp @@ -19,16 +19,11 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - -#include - #include "button.h" #include "gui.h" #include "emotewindow.h" #include "emotecontainer.h" #include "scrollarea.h" -#include "textbox.h" #include "widgets/layout.h" diff --git a/src/gui/emotewindow.h b/src/gui/emotewindow.h index 8e36e5ce..c642ff6f 100644 --- a/src/gui/emotewindow.h +++ b/src/gui/emotewindow.h @@ -27,8 +27,6 @@ #include "window.h" -#include "../guichanfwd.h" - class EmoteContainer; class TextBox; diff --git a/src/gui/focushandler.h b/src/gui/focushandler.h index 124b5472..b0639bd8 100644 --- a/src/gui/focushandler.h +++ b/src/gui/focushandler.h @@ -26,8 +26,6 @@ #include -#include "../guichanfwd.h" - /** * The focus handler. This focus handler does exactly the same as the Guichan * focus handler, but keeps a stack of modal widgets to be able to handle diff --git a/src/gui/gccontainer.h b/src/gui/gccontainer.h index 0a573645..da584a42 100644 --- a/src/gui/gccontainer.h +++ b/src/gui/gccontainer.h @@ -26,8 +26,6 @@ #include -#include "../guichanfwd.h" - /** * A garbage collecting container. Childs added to this container are * automatically deleted when the container is deleted. diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 642e916b..7779a503 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -63,7 +63,8 @@ class GuiConfigListener : public ConfigListener void optionChanged(const std::string &name) { - if (name == "customcursor") { + if (name == "customcursor") + { bool bCustomCursor = config.getValue("customcursor", 1) == 1; mGui->setUseCustomCursor(bCustomCursor); } @@ -107,7 +108,8 @@ Gui::Gui(Graphics *graphics): // Set global font std::string path = resman->getPath("fonts/dejavusans.ttf"); - try { + try + { const int fontSize = config.getValue("fontSize", 11); mGuiFont = new TrueTypeFont(path, fontSize); } @@ -119,7 +121,8 @@ Gui::Gui(Graphics *graphics): // Set bold font path = resman->getPath("fonts/dejavusans-bold.ttf"); - try { + try + { const int fontSize = config.getValue("fontSize", 11); boldFont = new TrueTypeFont(path, fontSize); } @@ -132,7 +135,8 @@ Gui::Gui(Graphics *graphics): gcn::Widget::setGlobalFont(mGuiFont); // Load hits' colourful fonts - try { + try + { hitRedFont = new gcn::ImageFont("graphics/gui/hits_red.png", "0123456789crit! "); hitBlueFont = new gcn::ImageFont("graphics/gui/hits_blue.png", @@ -182,12 +186,13 @@ Gui::~Gui() void Gui::logic() { // Fade out mouse cursor after extended inactivity - if (mMouseInactivityTimer < 100 * 15) { + if (mMouseInactivityTimer < 100 * 15) + { ++mMouseInactivityTimer; mMouseCursorAlpha = std::min(1.0f, mMouseCursorAlpha + 0.05f); - } else { - mMouseCursorAlpha = std::max(0.0f, mMouseCursorAlpha - 0.005f); } + else + mMouseCursorAlpha = std::max(0.0f, mMouseCursorAlpha - 0.005f); gcn::Gui::logic(); } @@ -232,9 +237,8 @@ void Gui::setUseCustomCursor(bool customCursor) mMouseCursors = resman->getImageSet("graphics/gui/mouse.png", 40, 40); - if (!mMouseCursors) { + if (!mMouseCursors) logger->error("Unable to load mouse cursors."); - } } else { @@ -242,7 +246,8 @@ void Gui::setUseCustomCursor(bool customCursor) SDL_ShowCursor(SDL_ENABLE); // Unload the mouse cursor - if (mMouseCursors) { + if (mMouseCursors) + { mMouseCursors->decRef(); mMouseCursors = NULL; } diff --git a/src/gui/help.h b/src/gui/help.h index 2ba74c0a..98e3aa67 100644 --- a/src/gui/help.h +++ b/src/gui/help.h @@ -27,8 +27,6 @@ #include "linkhandler.h" #include "window.h" -#include "../guichanfwd.h" - class BrowserBox; /** diff --git a/src/gui/inttextfield.h b/src/gui/inttextfield.h index 2a913ef6..add78084 100644 --- a/src/gui/inttextfield.h +++ b/src/gui/inttextfield.h @@ -24,8 +24,6 @@ #include "textfield.h" -#include "../guichanfwd.h" - /** * TextBox which only accepts numbers as input. */ diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index d7cd7ccd..246219f4 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -33,7 +33,6 @@ #include "itemcontainer.h" #include "progressbar.h" #include "scrollarea.h" -#include "textbox.h" #include "viewport.h" #include "widgets/layout.h" diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index 2c19ce26..2694e90b 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -27,7 +27,6 @@ #include "window.h" -#include "../guichanfwd.h" #include "../localplayer.h" class Item; diff --git a/src/gui/item_amount.cpp b/src/gui/item_amount.cpp index d8682c95..92be3d6e 100644 --- a/src/gui/item_amount.cpp +++ b/src/gui/item_amount.cpp @@ -70,7 +70,8 @@ ItemAmountWindow::ItemAmountWindow(int usage, Window *parent, Item *item): resetAmount(); - switch (usage) { + switch (usage) + { case AMOUNT_TRADE_ADD: setCaption(_("Select amount of items to trade.")); okButton->setActionEventId("AddTrade"); diff --git a/src/gui/item_amount.h b/src/gui/item_amount.h index d8eedadb..618d7d51 100644 --- a/src/gui/item_amount.h +++ b/src/gui/item_amount.h @@ -22,14 +22,10 @@ #ifndef ITEM_AMOUNT_WINDOW_H #define ITEM_AMOUNT_WINDOW_H -#include - #include #include "window.h" -#include "../guichanfwd.h" - class IntTextField; class Item; diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index caae3dca..e655d3fc 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -35,7 +35,6 @@ #include "../log.h" #include "../resources/image.h" -#include "../resources/iteminfo.h" #include "../resources/resourcemanager.h" #include "../utils/tostring.h" diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h index 5513faa7..f027de19 100644 --- a/src/gui/itemcontainer.h +++ b/src/gui/itemcontainer.h @@ -28,8 +28,6 @@ #include #include -#include "../guichanfwd.h" - class Image; class Inventory; class Item; diff --git a/src/gui/itemlinkhandler.cpp b/src/gui/itemlinkhandler.cpp index 34c12a0c..97c0b94f 100644 --- a/src/gui/itemlinkhandler.cpp +++ b/src/gui/itemlinkhandler.cpp @@ -19,6 +19,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include +#include + #include #include "itemlinkhandler.h" @@ -27,9 +30,6 @@ #include "../resources/iteminfo.h" #include "../resources/itemdb.h" -#include -#include - ItemLinkHandler::ItemLinkHandler() { mItemPopup = new ItemPopup; diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index 80edd354..39a5ecf1 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -26,16 +26,15 @@ #include "gui.h" #include "itempopup.h" +#include "scrollarea.h" +#include "textbox.h" #include "windowcontainer.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" #include "../utils/tostring.h" ItemPopup::ItemPopup(): @@ -89,9 +88,6 @@ ItemPopup::ItemPopup(): add(mItemWeightScroll); setLocationRelativeTo(getParent()); - - // LEEOR / TODO: This causes an exception error. - //moveToBottom(getParent()); } void ItemPopup::setItem(const ItemInfo &item) diff --git a/src/gui/itempopup.h b/src/gui/itempopup.h index 3c8f575d..d9d37264 100644 --- a/src/gui/itempopup.h +++ b/src/gui/itempopup.h @@ -23,12 +23,11 @@ #ifndef ITEMPOPUP_H__ #define ITEMPOPUP_H__ -#include "scrollarea.h" -#include "textbox.h" #include "window.h" -#include "../guichanfwd.h" -#include "../item.h" +class ItemInfo; +class ScrollArea; +class TextBox; class ItemPopup : public Window { diff --git a/src/gui/itemshortcutcontainer.h b/src/gui/itemshortcutcontainer.h index d6a04d7b..22d94ec2 100644 --- a/src/gui/itemshortcutcontainer.h +++ b/src/gui/itemshortcutcontainer.h @@ -26,8 +26,6 @@ #include "shortcutcontainer.h" -#include "../guichanfwd.h" - class Image; class Item; class ItemPopup; diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp index 643d234e..e56ddeeb 100644 --- a/src/gui/listbox.cpp +++ b/src/gui/listbox.cpp @@ -62,8 +62,7 @@ void ListBox::draw(gcn::Graphics *graphics) // Draw the list elements graphics->setColor(gcn::Color(0, 0, 0, 255)); - for (int i = 0, y = 0; - i < mListModel->getNumberOfElements(); + for (int i = 0, y = 0; i < mListModel->getNumberOfElements(); ++i, y += fontHeight) { graphics->drawText(mListModel->getElementAt(i), 1, y); diff --git a/src/gui/listbox.h b/src/gui/listbox.h index 15f7afb4..12fcb955 100644 --- a/src/gui/listbox.h +++ b/src/gui/listbox.h @@ -24,8 +24,6 @@ #include -#include "../guichanfwd.h" - class SelectionListener; /** diff --git a/src/gui/login.cpp b/src/gui/login.cpp index 408456ef..2e9ca57e 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -26,6 +26,7 @@ #include "button.h" #include "checkbox.h" +#include "listbox.h" #include "login.h" #include "ok_dialog.h" #include "passwordfield.h" diff --git a/src/gui/login.h b/src/gui/login.h index b85e5ae1..70f30d5c 100644 --- a/src/gui/login.h +++ b/src/gui/login.h @@ -22,7 +22,6 @@ #ifndef LOGIN_H #define LOGIN_H -#include #include #include diff --git a/src/gui/menuwindow.h b/src/gui/menuwindow.h index 9b784c35..9bb54e29 100644 --- a/src/gui/menuwindow.h +++ b/src/gui/menuwindow.h @@ -24,8 +24,6 @@ #include "window.h" -#include "../guichanfwd.h" - /** * The Button Menu. * diff --git a/src/gui/minimap.h b/src/gui/minimap.h index b4574ad5..3ce0aacd 100644 --- a/src/gui/minimap.h +++ b/src/gui/minimap.h @@ -24,8 +24,6 @@ #include "window.h" -#include "../guichanfwd.h" - class Image; /** diff --git a/src/gui/ministatus.h b/src/gui/ministatus.h index d2bcef1c..832475f1 100644 --- a/src/gui/ministatus.h +++ b/src/gui/ministatus.h @@ -22,12 +22,8 @@ #ifndef MINISTATUS_H #define MINISTATUS_H -#include - #include "window.h" -#include "../guichanfwd.h" - class ProgressBar; /** diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp index 1e29b793..b4313b70 100644 --- a/src/gui/npc_text.cpp +++ b/src/gui/npc_text.cpp @@ -19,10 +19,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - -#include "npc_text.h" #include "button.h" +#include "npc_text.h" #include "scrollarea.h" #include "textbox.h" diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h index 4e0d33aa..a07aa04f 100644 --- a/src/gui/npc_text.h +++ b/src/gui/npc_text.h @@ -22,11 +22,10 @@ #ifndef NPC_TEXT_H #define NPC_TEXT_H -#include +#include #include -#include "scrollarea.h" #include "window.h" class TextBox; diff --git a/src/gui/npcintegerdialog.cpp b/src/gui/npcintegerdialog.cpp index 65a1a7f1..4444e04b 100644 --- a/src/gui/npcintegerdialog.cpp +++ b/src/gui/npcintegerdialog.cpp @@ -19,20 +19,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "npcintegerdialog.h" - -#include -#include - #include "button.h" #include "inttextfield.h" +#include "npcintegerdialog.h" + +#include "widgets/layout.h" #include "../npc.h" #include "../utils/gettext.h" -#include "../utils/tostring.h" - -#include "widgets/layout.h" NpcIntegerDialog::NpcIntegerDialog(): Window(_("NPC Number Request")) diff --git a/src/gui/npcintegerdialog.h b/src/gui/npcintegerdialog.h index 983c46fe..b9ce70be 100644 --- a/src/gui/npcintegerdialog.h +++ b/src/gui/npcintegerdialog.h @@ -22,16 +22,11 @@ #ifndef GUI_NPCINTEGERDIALOG_H #define GUI_NPCINTEGERDIALOG_H -#include -#include - #include #include #include "window.h" -#include "../guichanfwd.h" - class IntTextField; /** diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp index bb815680..e6406422 100644 --- a/src/gui/npclistdialog.cpp +++ b/src/gui/npclistdialog.cpp @@ -21,8 +21,10 @@ #include +#include "button.h" #include "listbox.h" #include "npclistdialog.h" +#include "scrollarea.h" #include "widgets/layout.h" diff --git a/src/gui/npclistdialog.h b/src/gui/npclistdialog.h index ffeced3d..30167a5e 100644 --- a/src/gui/npclistdialog.h +++ b/src/gui/npclistdialog.h @@ -22,18 +22,13 @@ #ifndef GUI_NPCLISTDIALOG_H #define GUI_NPCLISTDIALOG_H -#include #include #include #include -#include "button.h" -#include "scrollarea.h" #include "window.h" -#include "../guichanfwd.h" - /** * The npc list dialog. * diff --git a/src/gui/npcstringdialog.cpp b/src/gui/npcstringdialog.cpp index ccb3c411..468326d6 100644 --- a/src/gui/npcstringdialog.cpp +++ b/src/gui/npcstringdialog.cpp @@ -19,18 +19,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "npcstringdialog.h" - -#include -#include - #include "button.h" +#include "npcstringdialog.h" #include "textfield.h" #include "../npc.h" #include "../utils/gettext.h" -#include "../utils/tostring.h" #include "widgets/layout.h" diff --git a/src/gui/npcstringdialog.h b/src/gui/npcstringdialog.h index 5aea2de0..aa39764d 100644 --- a/src/gui/npcstringdialog.h +++ b/src/gui/npcstringdialog.h @@ -22,16 +22,11 @@ #ifndef GUI_NPCSTRINGDIALOG_H #define GUI_NPCSTRINGDIALOG_H -#include -#include - #include #include #include "window.h" -#include "../guichanfwd.h" - /** * The npc integer input dialog. * diff --git a/src/gui/ok_dialog.cpp b/src/gui/ok_dialog.cpp index 7f63b152..0d1f658f 100644 --- a/src/gui/ok_dialog.cpp +++ b/src/gui/ok_dialog.cpp @@ -19,10 +19,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "ok_dialog.h" - #include +#include "button.h" +#include "ok_dialog.h" +#include "scrollarea.h" +#include "textbox.h" + #include "../utils/gettext.h" OkDialog::OkDialog(const std::string &title, const std::string &msg, diff --git a/src/gui/ok_dialog.h b/src/gui/ok_dialog.h index 78b3d44f..3a438513 100644 --- a/src/gui/ok_dialog.h +++ b/src/gui/ok_dialog.h @@ -24,12 +24,10 @@ #include -#include "button.h" -#include "scrollarea.h" -#include "textbox.h" #include "window.h" -#include "../guichanfwd.h" +class ScrollArea; +class TextBox; /** * An 'Ok' button dialog. diff --git a/src/gui/passwordfield.cpp b/src/gui/passwordfield.cpp index 09b6abda..345ee1c3 100644 --- a/src/gui/passwordfield.cpp +++ b/src/gui/passwordfield.cpp @@ -21,8 +21,6 @@ #include "passwordfield.h" -#include - PasswordField::PasswordField(const std::string& text): TextField(text) { diff --git a/src/gui/passwordfield.h b/src/gui/passwordfield.h index e01bedbd..89293b05 100644 --- a/src/gui/passwordfield.h +++ b/src/gui/passwordfield.h @@ -22,9 +22,9 @@ #ifndef PASSWORDFIELD_H #define PASSWORDFIELD_H -#include "textfield.h" +#include -#include "../guichanfwd.h" +#include "textfield.h" /** * A password field. diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp index 20ed17f8..60003fb5 100644 --- a/src/gui/playerbox.cpp +++ b/src/gui/playerbox.cpp @@ -19,8 +19,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - #include "playerbox.h" #include "../animatedsprite.h" diff --git a/src/gui/playerbox.h b/src/gui/playerbox.h index 70c41644..7c08defd 100644 --- a/src/gui/playerbox.h +++ b/src/gui/playerbox.h @@ -24,8 +24,6 @@ #include -#include "../guichanfwd.h" - class ImageRect; class Player; diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index bf7c803a..cf6a7188 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -20,9 +20,6 @@ */ #include -#include - -#include #include "browserbox.h" #include "chat.h" @@ -42,7 +39,6 @@ #include "../net/protocol.h" #include "../resources/itemdb.h" -#include "../resources/iteminfo.h" #include "../utils/gettext.h" #include "../utils/strprintf.h" diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp index a1b847c8..867477e0 100644 --- a/src/gui/progressbar.cpp +++ b/src/gui/progressbar.cpp @@ -19,6 +19,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "gui.h" #include "progressbar.h" @@ -28,8 +30,6 @@ #include "../resources/image.h" #include "../resources/resourcemanager.h" -#include - ImageRect ProgressBar::mBorder; int ProgressBar::mInstances = 0; float ProgressBar::mAlpha = config.getValue("guialpha", 0.8); diff --git a/src/gui/progressbar.h b/src/gui/progressbar.h index dd9cc896..2c1b22da 100644 --- a/src/gui/progressbar.h +++ b/src/gui/progressbar.h @@ -22,12 +22,11 @@ #ifndef PROGRESSBAR_H #define PROGRESSBAR_H +#include + #include #include -#include - -#include "../guichanfwd.h" class ImageRect; diff --git a/src/gui/radiobutton.h b/src/gui/radiobutton.h index 6ead9da0..3d952b3f 100644 --- a/src/gui/radiobutton.h +++ b/src/gui/radiobutton.h @@ -24,14 +24,13 @@ #include -#include "../guichanfwd.h" - class Image; /* * Guichan based RadioButton with custom look */ -class RadioButton : public gcn::RadioButton { +class RadioButton : public gcn::RadioButton +{ public: /* * Constructor. diff --git a/src/gui/recorder.cpp b/src/gui/recorder.cpp index 9db1df2a..1e7d8e13 100644 --- a/src/gui/recorder.cpp +++ b/src/gui/recorder.cpp @@ -28,7 +28,6 @@ #include "widgets/layout.h" -#include "../utils/gettext.h" #include "../utils/trim.h" Recorder::Recorder(ChatWindow *chat, const std::string &title, diff --git a/src/gui/recorder.h b/src/gui/recorder.h index 420c4a2b..707f08ab 100644 --- a/src/gui/recorder.h +++ b/src/gui/recorder.h @@ -29,8 +29,6 @@ #include "window.h" -#include "../guichanfwd.h" - #include "../utils/gettext.h" class ChatWindow; diff --git a/src/gui/register.cpp b/src/gui/register.cpp index 9c337d9e..cbf87e5b 100644 --- a/src/gui/register.cpp +++ b/src/gui/register.cpp @@ -19,15 +19,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include - #include -#include "../main.h" #include "../configuration.h" #include "../log.h" #include "../logindata.h" +#include "../main.h" #include "button.h" #include "checkbox.h" @@ -38,12 +35,11 @@ #include "register.h" #include "textfield.h" -#include "../utils/tostring.h" - #include "widgets/layout.h" #include "../utils/gettext.h" #include "../utils/strprintf.h" +#include "../utils/tostring.h" /** * Listener used while dealing with wrong data. It is used to direct the focus diff --git a/src/gui/register.h b/src/gui/register.h index 4b95a07b..e58ac9db 100644 --- a/src/gui/register.h +++ b/src/gui/register.h @@ -22,15 +22,13 @@ #ifndef REGISTER_H #define REGISTER_H -#include +#include #include #include #include "window.h" -#include "../guichanfwd.h" - class LoginData; class OkDialog; class WrongDataNoticeListener; diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp index a892f2d0..e69b681c 100644 --- a/src/gui/scrollarea.cpp +++ b/src/gui/scrollarea.cpp @@ -19,8 +19,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - #include "scrollarea.h" #include "../configuration.h" diff --git a/src/gui/scrollarea.h b/src/gui/scrollarea.h index 4324deff..ccc1e178 100644 --- a/src/gui/scrollarea.h +++ b/src/gui/scrollarea.h @@ -24,8 +24,6 @@ #include -#include "../guichanfwd.h" - class Image; class ImageRect; diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index 7976e32e..e4be7921 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -19,30 +19,24 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - #include #include "button.h" -#include "shoplistbox.h" #include "scrollarea.h" #include "sell.h" #include "shop.h" +#include "shoplistbox.h" #include "slider.h" #include "widgets/layout.h" -#include "../item.h" #include "../npc.h" #include "../net/messageout.h" #include "../net/protocol.h" -#include "../resources/iteminfo.h" - #include "../utils/gettext.h" #include "../utils/strprintf.h" -#include "../utils/tostring.h" SellDialog::SellDialog(Network *network): Window(_("Sell")), diff --git a/src/gui/sell.h b/src/gui/sell.h index 8e639a3d..c11a7b7c 100644 --- a/src/gui/sell.h +++ b/src/gui/sell.h @@ -25,9 +25,9 @@ #include #include -#include "window.h" +#include -#include "../guichanfwd.h" +#include "window.h" class Item; class Network; diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index d18f365c..19575cfb 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -19,9 +19,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include - #include "button.h" #include "setup.h" #include "setup_audio.h" diff --git a/src/gui/setup_audio.h b/src/gui/setup_audio.h index 2f5cd736..9e951895 100644 --- a/src/gui/setup_audio.h +++ b/src/gui/setup_audio.h @@ -26,8 +26,6 @@ #include "setuptab.h" -#include "../guichanfwd.h" - class Setup_Audio : public SetupTab, public gcn::ActionListener { public: diff --git a/src/gui/setup_colours.cpp b/src/gui/setup_colours.cpp index 95e6fff0..07ec9086 100644 --- a/src/gui/setup_colours.cpp +++ b/src/gui/setup_colours.cpp @@ -19,8 +19,6 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include - #include #include #include diff --git a/src/gui/setup_colours.h b/src/gui/setup_colours.h index 628efb43..f7984dd5 100644 --- a/src/gui/setup_colours.h +++ b/src/gui/setup_colours.h @@ -23,9 +23,9 @@ #define _SETUP_COLOURS_H #include -#include #include + #include #include diff --git a/src/gui/setup_joystick.h b/src/gui/setup_joystick.h index 2dc56439..eba8a2cc 100644 --- a/src/gui/setup_joystick.h +++ b/src/gui/setup_joystick.h @@ -26,8 +26,6 @@ #include "setuptab.h" -#include "../guichanfwd.h" - class Setup_Joystick : public SetupTab, public gcn::ActionListener { public: diff --git a/src/gui/setup_keyboard.h b/src/gui/setup_keyboard.h index d4966053..082fa84d 100644 --- a/src/gui/setup_keyboard.h +++ b/src/gui/setup_keyboard.h @@ -26,7 +26,6 @@ #include -#include "button.h" #include "setuptab.h" #include "../guichanfwd.h" diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp index 932acee7..7e76055a 100644 --- a/src/gui/setup_players.cpp +++ b/src/gui/setup_players.cpp @@ -19,6 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include @@ -27,14 +28,15 @@ #include "checkbox.h" #include "listbox.h" #include "ok_dialog.h" +#include "scrollarea.h" #include "setup_players.h" +#include "table.h" #include "widgets/dropdown.h" #include "widgets/layouthelper.h" #include "../configuration.h" #include "../log.h" -#include "../player_relations.h" #include "../utils/gettext.h" diff --git a/src/gui/setup_players.h b/src/gui/setup_players.h index 22c8a9b6..393fc6aa 100644 --- a/src/gui/setup_players.h +++ b/src/gui/setup_players.h @@ -24,17 +24,16 @@ #include -#include "button.h" -#include "scrollarea.h" #include "setuptab.h" -#include "table.h" -#include "../guichanfwd.h" #include "../player_relations.h" +class GuiTable; class PlayerTableModel; +class StaticTableModel; -class Setup_Players : public SetupTab, public gcn::ActionListener, public PlayerRelationsListener +class Setup_Players : public SetupTab, + public gcn::ActionListener, public PlayerRelationsListener { public: Setup_Players(); @@ -60,7 +59,7 @@ private: gcn::CheckBox *mDefaultTrading; gcn::CheckBox *mDefaultWhisper; - Button *mDeleteButton; + gcn::Button *mDeleteButton; gcn::DropDown *mIgnoreActionChoicesBox; }; diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h index d863fb64..303b5bfc 100644 --- a/src/gui/setup_video.h +++ b/src/gui/setup_video.h @@ -27,8 +27,6 @@ #include "setuptab.h" -#include "../guichanfwd.h" - class Setup_Video : public SetupTab, public gcn::ActionListener, public gcn::KeyListener { diff --git a/src/gui/shop.h b/src/gui/shop.h index 22b649d0..e0db4c59 100644 --- a/src/gui/shop.h +++ b/src/gui/shop.h @@ -27,10 +27,9 @@ #include -#include "../guichanfwd.h" #include "../shopitem.h" -#include "../resources/image.h" +class ShopItem; class ShopItems : public gcn::ListModel { diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp index 3d17fd55..ba636112 100644 --- a/src/gui/shoplistbox.cpp +++ b/src/gui/shoplistbox.cpp @@ -19,14 +19,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include -#include #include -#include #include "colour.h" +#include "shop.h" #include "shoplistbox.h" #include "../configuration.h" diff --git a/src/gui/shoplistbox.h b/src/gui/shoplistbox.h index 12413585..cde4786e 100644 --- a/src/gui/shoplistbox.h +++ b/src/gui/shoplistbox.h @@ -23,9 +23,8 @@ #define SHOPLISTBOX_H #include "listbox.h" -#include "shop.h" -#include "../guichanfwd.h" +class ShopItems; /** * A list box, meant to be used inside a scroll area. Same as the Guichan list diff --git a/src/gui/shortcutcontainer.cpp b/src/gui/shortcutcontainer.cpp index 62b2d382..eae24785 100644 --- a/src/gui/shortcutcontainer.cpp +++ b/src/gui/shortcutcontainer.cpp @@ -22,15 +22,8 @@ #include "shortcutcontainer.h" #include "../configuration.h" -#include "../graphics.h" -#include "../inventory.h" -#include "../item.h" -#include "../itemshortcut.h" -#include "../keyboardconfig.h" -#include "../localplayer.h" #include "../resources/image.h" -#include "../resources/resourcemanager.h" #include "../utils/tostring.h" diff --git a/src/gui/shortcutcontainer.h b/src/gui/shortcutcontainer.h index b2d0cc78..f5f06163 100644 --- a/src/gui/shortcutcontainer.h +++ b/src/gui/shortcutcontainer.h @@ -26,12 +26,10 @@ #include #include -#include "../guichanfwd.h" - class Image; /** - * An item shortcut container. Used to quickly use items. + * A generic shortcut container. * * \ingroup GUI */ @@ -41,7 +39,7 @@ class ShortcutContainer : public gcn::Widget, { public: /** - * Constructor. Initializes the graphic. + * Constructor. Initializes the shortcut container. */ ShortcutContainer(); @@ -51,7 +49,7 @@ class ShortcutContainer : public gcn::Widget, ~ShortcutContainer(){} /** - * Draws the items. + * Draws the shortcuts */ virtual void draw(gcn::Graphics *graphics) = 0; diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp index 3a7cf0e0..91b33b72 100644 --- a/src/gui/shortcutwindow.cpp +++ b/src/gui/shortcutwindow.cpp @@ -19,9 +19,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "scrollarea.h" #include "shortcutcontainer.h" #include "shortcutwindow.h" -#include "scrollarea.h" #include "../configuration.h" diff --git a/src/gui/shortcutwindow.h b/src/gui/shortcutwindow.h index 0168669e..2711ced5 100644 --- a/src/gui/shortcutwindow.h +++ b/src/gui/shortcutwindow.h @@ -24,10 +24,8 @@ #include "window.h" -#include "../guichanfwd.h" - -class ShortcutContainer; class ScrollArea; +class ShortcutContainer; /** * A window around the ItemShortcutContainer. diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index 732aaa12..4587e75a 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -19,13 +19,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - #include #include "button.h" #include "listbox.h" +#include "scrollarea.h" #include "skill.h" +#include "table.h" #include "windowcontainer.h" #include "widgets/layout.h" @@ -124,9 +124,11 @@ SkillDialog::SkillDialog(): { initSkillinfo(); mTableModel = new SkillGuiTableModel(this); - mTable.setModel(mTableModel); - mTable.setOpaque(false); - mTable.setLinewiseSelection(true); + mTable = new GuiTable(mTableModel); + mTable->setOpaque(false); + mTable->setLinewiseSelection(true); + mTable->setActionEventId("skill"); + mTable->addActionListener(this); setWindowName(_("Skills")); setCloseButton(true); @@ -135,14 +137,12 @@ SkillDialog::SkillDialog(): setMinHeight(50 + mTableModel->getHeight()); setMinWidth(200); - ScrollArea *skillScrollArea = new ScrollArea(&mTable); + ScrollArea *skillScrollArea = new ScrollArea(mTable); mPointsLabel = new gcn::Label(strprintf(_("Skill points: %d"), 0)); mIncButton = new Button(_("Up"), _("inc"), this); mUseButton = new Button(_("Use"), _("use"), this); mUseButton->setEnabled(false); - mTable.setActionEventId("skill"); - skillScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); place(0, 0, skillScrollArea, 5).setPadding(3); @@ -153,14 +153,13 @@ SkillDialog::SkillDialog(): Layout &layout = getLayout(); layout.setRowHeight(0, Layout::AUTO_SET); - mTable.addActionListener(this); - setLocationRelativeTo(getParent()); loadWindowState(); } SkillDialog::~SkillDialog() { + delete mTable; } void SkillDialog::action(const gcn::ActionEvent &event) @@ -168,15 +167,14 @@ void SkillDialog::action(const gcn::ActionEvent &event) if (event.getId() == "inc") { // Increment skill - int selectedSkill = mTable.getSelectedRow(); + int selectedSkill = mTable->getSelectedRow(); if (selectedSkill >= 0) player_node->raiseSkill(mSkillList[selectedSkill]->id); } else if (event.getId() == "skill") { - mIncButton->setEnabled( - mTable.getSelectedRow() > -1 && - player_node->mSkillPoint > 0); + mIncButton->setEnabled(mTable->getSelectedRow() > -1 && + player_node->mSkillPoint > 0); } else if (event.getId() == "close") setVisible(false); @@ -187,7 +185,7 @@ void SkillDialog::update() mPointsLabel->setCaption(strprintf(_("Skill points: %d"), player_node->mSkillPoint)); - int selectedSkill = mTable.getSelectedRow(); + int selectedSkill = mTable->getSelectedRow(); if (selectedSkill >= 0) { diff --git a/src/gui/skill.h b/src/gui/skill.h index 45cfd059..91c2b640 100644 --- a/src/gui/skill.h +++ b/src/gui/skill.h @@ -25,19 +25,15 @@ #include #include -#include -#include "scrollarea.h" -#include "table.h" #include "window.h" -#include "../guichanfwd.h" - struct SKILL { short id; /**< Index into "skill_db" array */ short lv, sp; }; +class GuiTable; class SkillGuiTableModel; /** @@ -72,7 +68,7 @@ class SkillDialog : public Window, public gcn::ActionListener const std::vector& getSkills(void) const { return mSkillList; } private: - GuiTable mTable;//gcn::ListBox *mSkillListBox; + GuiTable *mTable; ScrollArea *skillScrollArea; SkillGuiTableModel *mTableModel; gcn::Label *mPointsLabel; diff --git a/src/gui/slider.h b/src/gui/slider.h index 12004f55..56ea334a 100644 --- a/src/gui/slider.h +++ b/src/gui/slider.h @@ -24,8 +24,6 @@ #include -#include "../guichanfwd.h" - class Image; /** diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp index 7eedce1c..8e3fe3c7 100644 --- a/src/gui/speechbubble.cpp +++ b/src/gui/speechbubble.cpp @@ -25,19 +25,15 @@ #include #include "gui.h" +#include "scrollarea.h" #include "speechbubble.h" - -#include "../resources/image.h" -#include "../resources/resourcemanager.h" +#include "textbox.h" #include "../utils/gettext.h" -// TODO: Fix windows so that they can each load their own skins without the -// other windows overriding another window's skin. SpeechBubble::SpeechBubble(): Window(_("Speech"), false, NULL, "graphics/gui/speechbubble.xml") { - // Height == Top Graphic (14px) + 1 Row of Text (15px) + Bottom Graphic (17px) setContentSize(140, 46); setShowTitle(false); setTitleBarHeight(0); @@ -62,9 +58,6 @@ SpeechBubble::SpeechBubble(): add(mSpeechArea); setLocationRelativeTo(getParent()); - - // LEEOR / TODO: This causes an exception error. - //moveToBottom(getParent()); } void SpeechBubble::setCaption(const std::string &name, const gcn::Color &color) @@ -83,8 +76,6 @@ void SpeechBubble::setText(std::string mText) if (numRows > 2) { - // 15 == height of each line of text (based on font heights) - // 14 == speechbubble Top + Bottom graphic pixel heights setContentSize(mSpeechBox->getMinWidth() + fontHeight, (numRows * fontHeight) + 6); mSpeechArea->setDimension(gcn::Rectangle(4, fontHeight + 3, diff --git a/src/gui/speechbubble.h b/src/gui/speechbubble.h index 23733813..323e5cbb 100644 --- a/src/gui/speechbubble.h +++ b/src/gui/speechbubble.h @@ -20,13 +20,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _LOM_SPEECHBUBBLE_H__ -#define _LOM_SPEECHBUBBLE_H__ +#ifndef SPEECHBUBBLE_H__ +#define SPEECHBUBBLE_H__ -#include "scrollarea.h" -#include "textbox.h" #include "window.h" +class ScrollArea; +class TextBox; + class SpeechBubble : public Window { public: diff --git a/src/gui/status.h b/src/gui/status.h index 1e1c4e98..00a48f4e 100644 --- a/src/gui/status.h +++ b/src/gui/status.h @@ -22,14 +22,10 @@ #ifndef STATUS_H #define STATUS_H -#include - #include #include "window.h" -#include "../guichanfwd.h" - class LocalPlayer; class ProgressBar; diff --git a/src/gui/table.cpp b/src/gui/table.cpp index bccdc900..9a5c0591 100644 --- a/src/gui/table.cpp +++ b/src/gui/table.cpp @@ -19,8 +19,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - #include #include diff --git a/src/gui/table.h b/src/gui/table.h index bdb41e90..d63b1fb9 100644 --- a/src/gui/table.h +++ b/src/gui/table.h @@ -24,16 +24,12 @@ #include -#include #include #include -#include #include #include "table_model.h" -#include "../guichanfwd.h" - class GuiTableActionListener; /** diff --git a/src/gui/table_model.cpp b/src/gui/table_model.cpp index 5ee7e9ab..19e780f3 100644 --- a/src/gui/table_model.cpp +++ b/src/gui/table_model.cpp @@ -19,9 +19,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - -#include #include #include "table_model.h" diff --git a/src/gui/table_model.h b/src/gui/table_model.h index a2a93887..1d966e8b 100644 --- a/src/gui/table_model.h +++ b/src/gui/table_model.h @@ -25,11 +25,6 @@ #include #include -#include -#include - -#include "../guichanfwd.h" - class TableModelListener { public: diff --git a/src/gui/textbox.cpp b/src/gui/textbox.cpp index e7986244..2a86d549 100644 --- a/src/gui/textbox.cpp +++ b/src/gui/textbox.cpp @@ -21,7 +21,6 @@ #include -#include #include #include "textbox.h" diff --git a/src/gui/textbox.h b/src/gui/textbox.h index 84dd6268..10a81fc0 100644 --- a/src/gui/textbox.h +++ b/src/gui/textbox.h @@ -24,8 +24,6 @@ #include -#include "../guichanfwd.h" - /** * A text box, meant to be used inside a scroll area. Same as the Guichan text * box except this one doesn't have a background or border, instead completely @@ -33,7 +31,8 @@ * * \ingroup GUI */ -class TextBox : public gcn::TextBox { +class TextBox : public gcn::TextBox +{ public: /** * Constructor. diff --git a/src/gui/textfield.cpp b/src/gui/textfield.cpp index 7e5004cc..99a95a2e 100644 --- a/src/gui/textfield.cpp +++ b/src/gui/textfield.cpp @@ -19,12 +19,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - #include -#include - #include "sdlinput.h" #include "textfield.h" diff --git a/src/gui/textfield.h b/src/gui/textfield.h index 11a58824..73824615 100644 --- a/src/gui/textfield.h +++ b/src/gui/textfield.h @@ -24,8 +24,6 @@ #include -#include "../guichanfwd.h" - class ImageRect; class TextField; diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index c89e55a2..f901be5e 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -41,8 +41,6 @@ #include "../net/messageout.h" #include "../net/protocol.h" -#include "../resources/iteminfo.h" - #include "../utils/gettext.h" #include "../utils/strprintf.h" #include "../utils/tostring.h" diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index 67e05bbd..1f62bd2d 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -26,6 +26,9 @@ #include +// Curl should be included after Guichan to avoid Windows redefinitions +#include + #include "browserbox.h" #include "button.h" #include "progressbar.h" @@ -34,9 +37,6 @@ #include "widgets/layout.h" -// Curl should be included after Guichan to avoid Windows redefinitions -#include - #include "../configuration.h" #include "../log.h" #include "../main.h" diff --git a/src/gui/updatewindow.h b/src/gui/updatewindow.h index 6450ece2..4ada3c3a 100644 --- a/src/gui/updatewindow.h +++ b/src/gui/updatewindow.h @@ -29,8 +29,6 @@ #include "window.h" -#include "../guichanfwd.h" - #include "../utils/mutex.h" class BrowserBox; diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index f258aba8..11a0004b 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -19,8 +19,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - #include "gui.h" #include "popupmenu.h" #include "viewport.h" @@ -36,9 +34,6 @@ #include "../npc.h" #include "../textmanager.h" -#include "../resources/animation.h" -#include "../resources/image.h" -#include "../resources/imageset.h" #include "../resources/monsterinfo.h" #include "../resources/resourcemanager.h" diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 5ed40166..e352f765 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -26,9 +26,7 @@ #include "windowcontainer.h" -#include "../being.h" #include "../configlistener.h" -#include "../guichanfwd.h" class Map; class FloorItem; diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index ac5cbaa2..31d35cb0 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -24,6 +24,8 @@ #include "dropdown.h" #include "../colour.h" +#include "../listbox.h" +#include "../scrollarea.h" #include "../../configuration.h" #include "../../graphics.h" diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index bff8bd1e..e5919dc7 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -22,15 +22,8 @@ #ifndef DROPDOWN_H #define DROPDOWN_H -#include - #include -#include "../listbox.h" -#include "../scrollarea.h" - -#include "../../guichanfwd.h" - class Image; class ImageRect; diff --git a/src/gui/widgets/resizegrip.h b/src/gui/widgets/resizegrip.h index 198954f6..620c133f 100644 --- a/src/gui/widgets/resizegrip.h +++ b/src/gui/widgets/resizegrip.h @@ -24,8 +24,6 @@ #include -#include "../../guichanfwd.h" - class Image; /** diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index 5465b431..22e952e7 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -19,8 +19,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - #include #include "tab.h" diff --git a/src/gui/window.cpp b/src/gui/window.cpp index 35d47082..36828194 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -28,7 +28,6 @@ #include #include "gui.h" -#include "gccontainer.h" #include "window.h" #include "windowcontainer.h" @@ -37,7 +36,6 @@ #include "../configlistener.h" #include "../configuration.h" -#include "../graphics.h" #include "../log.h" #include "../resources/image.h" diff --git a/src/gui/windowcontainer.h b/src/gui/windowcontainer.h index a3e80223..62704d1b 100644 --- a/src/gui/windowcontainer.h +++ b/src/gui/windowcontainer.h @@ -24,15 +24,14 @@ #include -#include "../guichanfwd.h" - /** * A window container. This container adds functionality for more convenient * widget (windows in particular) destruction. * * \ingroup GUI */ -class WindowContainer : public gcn::Container { +class WindowContainer : public gcn::Container +{ public: /** * Do GUI logic. This functions adds automatic deletion of objects that diff --git a/src/main.cpp b/src/main.cpp index b933742a..65b61de2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -54,6 +54,7 @@ #include "serverinfo.h" #include "sound.h" +#include "gui/button.h" #include "gui/char_server.h" #include "gui/char_select.h" #include "gui/colour.h" diff --git a/src/net/charserverhandler.cpp b/src/net/charserverhandler.cpp index b91a506a..bd3685f3 100644 --- a/src/net/charserverhandler.cpp +++ b/src/net/charserverhandler.cpp @@ -21,7 +21,6 @@ #include "charserverhandler.h" #include "messagein.h" -#include "network.h" #include "protocol.h" #include "../extensions.h" @@ -34,6 +33,8 @@ #include "../gui/char_select.h" #include "../gui/ok_dialog.h" +#include "../utils/tostring.h" + /* * Yeah, this is a global. Get over it. */ diff --git a/src/net/loginhandler.cpp b/src/net/loginhandler.cpp index db601214..6ad410ec 100644 --- a/src/net/loginhandler.cpp +++ b/src/net/loginhandler.cpp @@ -21,7 +21,6 @@ #include "loginhandler.h" #include "messagein.h" -#include "network.h" #include "protocol.h" #include "../log.h" @@ -29,6 +28,8 @@ #include "../main.h" #include "../serverinfo.h" +#include "../utils/tostring.h" + extern SERVER_INFO **server_info; LoginHandler::LoginHandler() diff --git a/src/net/network.cpp b/src/net/network.cpp index 941995c9..059da779 100644 --- a/src/net/network.cpp +++ b/src/net/network.cpp @@ -26,6 +26,7 @@ #include "network.h" #include "../log.h" +#include "../utils/tostring.h" /** Warning: buffers and other variables are shared, so there can be only one connection active at a time */ @@ -418,19 +419,6 @@ void Network::receive() SDLNet_FreeSocketSet(set); } -char *iptostring(int address) -{ - static char asciiIP[16]; - - sprintf(asciiIP, "%i.%i.%i.%i", - (unsigned char)(address), - (unsigned char)(address >> 8), - (unsigned char)(address >> 16), - (unsigned char)(address >> 24)); - - return asciiIP; -} - void Network::setError(const std::string& error) { logger->log("Network error: %s", error.c_str()); diff --git a/src/net/network.h b/src/net/network.h index c035f55c..02fe7538 100644 --- a/src/net/network.h +++ b/src/net/network.h @@ -115,7 +115,4 @@ class Network MessageHandlers mMessageHandlers; }; -/** Convert an address from int format to string */ -char *iptostring(int address); - #endif diff --git a/src/utils/tostring.h b/src/utils/tostring.h index 5ac1d3aa..eb86f99e 100644 --- a/src/utils/tostring.h +++ b/src/utils/tostring.h @@ -32,4 +32,19 @@ std::string toString(const T &arg) return ss.str(); } +// TODO: Is there a good way to suppress warnings from classes which don't use +// this function? +static char *iptostring(int address) +{ + static char asciiIP[16]; + + sprintf(asciiIP, "%i.%i.%i.%i", + (unsigned char)(address), + (unsigned char)(address >> 8), + (unsigned char)(address >> 16), + (unsigned char)(address >> 24)); + + return asciiIP; +} + #endif -- cgit v1.2.3-60-g2f50