summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/chat.cpp14
-rw-r--r--src/gui/equipmentwindow.h12
-rw-r--r--src/gui/itemcontainer.cpp11
-rw-r--r--src/gui/itemcontainer.h6
-rw-r--r--src/gui/itempopup.h6
-rw-r--r--src/gui/itemshortcutcontainer.cpp1
-rw-r--r--src/gui/login.cpp7
-rw-r--r--src/gui/ministatus.cpp35
-rw-r--r--src/gui/ministatus.h13
-rw-r--r--src/gui/popupmenu.cpp67
-rw-r--r--src/gui/popupmenu.h4
-rw-r--r--src/gui/setup_keyboard.cpp2
-rw-r--r--src/gui/setup_players.cpp26
-rw-r--r--src/gui/setup_video.cpp4
-rw-r--r--src/gui/skill.cpp18
-rw-r--r--src/gui/skill.h2
-rw-r--r--src/gui/table.cpp36
-rw-r--r--src/gui/table.h62
-rw-r--r--src/gui/table_model.cpp16
-rw-r--r--src/gui/table_model.h35
-rw-r--r--src/gui/textfield.cpp2
-rw-r--r--src/gui/truetypefont.cpp7
-rw-r--r--src/gui/truetypefont.h6
-rw-r--r--src/gui/viewport.cpp6
-rw-r--r--src/gui/window.cpp1
-rw-r--r--src/gui/window.h6
26 files changed, 237 insertions, 168 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 1a3cb2a4..c9c3e9bc 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -149,13 +149,15 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord)
case BY_GM:
if (tmp.nick.empty())
{
- tmp.nick = std::string(_("Global announcement: "));
+ tmp.nick = std::string(_("Global announcement:"));
+ tmp.nick += " ";
lineColor = "##G";
}
else
{
- tmp.nick = strprintf(_("Global announcement from %s: "),
+ tmp.nick = strprintf(_("Global announcement from %s:"),
tmp.nick.c_str());
+ tmp.nick += " ";
lineColor = "##1"; // Equiv. to BrowserBox::RED
}
break;
@@ -178,7 +180,8 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord)
lineColor = "##P";
break;
case ACT_WHISPER:
- tmp.nick += CAT_WHISPER;
+ tmp.nick = strprintf(_("%s whispers:"), tmp.nick.c_str());
+ tmp.nick += " ";
lineColor = "##W";
break;
case ACT_IS:
@@ -240,7 +243,7 @@ void ChatWindow::chatLog(CHATSKILL act)
chatLog(const_msg(act), BY_SERVER);
}
-void ChatWindow::action(const gcn::ActionEvent & event)
+void ChatWindow::action(const gcn::ActionEvent &event)
{
if (event.getId() == "chatinput")
{
@@ -708,9 +711,8 @@ void ChatWindow::scroll(int amount)
mTextOutput->showPart(scr);
}
-void ChatWindow::keyPressed(gcn::KeyEvent & event)
+void ChatWindow::keyPressed(gcn::KeyEvent &event)
{
-
if (event.getKey().getValue() == Key::DOWN &&
mCurHist != mHistory.end())
{
diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h
index 8e9b22eb..0b3aede0 100644
--- a/src/gui/equipmentwindow.h
+++ b/src/gui/equipmentwindow.h
@@ -1,26 +1,26 @@
/*
* The Mana World
- * Copyright 2004 The Mana World Development Team
+ * Copyright (C) 2004 The Mana World Development Team
*
* This file is part of The Mana World.
*
- * The Mana World is free software; you can redistribute it and/or modify
+ * This program 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 Mana World is distributed in the hope that it will be useful,
+ * This program 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
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef EQUIPMENT_WINDOW_H
-#define EQUIPMENT_WINDOW_H
+#ifndef EQUIPMENTWINDOW_H
+#define EQUIPMENTWINDOW_H
#include <guichan/actionlistener.hpp>
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp
index ab3da9f6..e3ecdd4e 100644
--- a/src/gui/itemcontainer.cpp
+++ b/src/gui/itemcontainer.cpp
@@ -19,13 +19,14 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <SDL_mouse.h>
+#include "itemcontainer.h"
+
+#include "itempopup.h"
#include <guichan/mouseinput.hpp>
#include <guichan/selectionlistener.hpp>
-#include "itemcontainer.h"
-#include "itempopup.h"
+#include <SDL_mouse.h>
#include "../graphics.h"
#include "../inventory.h"
@@ -123,7 +124,7 @@ void ItemContainer::draw(gcn::Graphics *graphics)
}
// Draw item caption
- graphics->setColor(0x000000);
+ graphics->setColor(gcn::Color(0, 0, 0));
graphics->drawText(
(item->isEquipped() ? "Eq." : toString(item->getQuantity())),
itemX + gridWidth / 2,
@@ -170,7 +171,6 @@ void ItemContainer::refindSelectedItem()
{
if (mSelectedItemIndex != NO_ITEM)
{
-
if (mInventory->getItem(mSelectedItemIndex) &&
mInventory->getItem(mSelectedItemIndex)->getId() == mLastSelectedItemId)
return; // we're already fine
@@ -203,6 +203,7 @@ void ItemContainer::setSelectedItemIndex(int index)
newSelectedItemIndex = NO_ITEM;
else
newSelectedItemIndex = index;
+
if (mSelectedItemIndex != newSelectedItemIndex)
{
mSelectedItemIndex = newSelectedItemIndex;
diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h
index 5513faa7..1fa76343 100644
--- a/src/gui/itemcontainer.h
+++ b/src/gui/itemcontainer.h
@@ -120,17 +120,17 @@ class ItemContainer : public gcn::Widget,
/**
* Find the current item index by the most recently used item ID
*/
- void refindSelectedItem(void);
+ void refindSelectedItem();
/**
* Determine and set the height of the container.
*/
- void recalculateHeight(void);
+ void recalculateHeight();
/**
* Sends out selection events to the list of selection listeners.
*/
- void distributeValueChangedEvent(void);
+ void distributeValueChangedEvent();
/**
* Gets the slot index based on the cursor position.
diff --git a/src/gui/itempopup.h b/src/gui/itempopup.h
index 0c729231..b6120af8 100644
--- a/src/gui/itempopup.h
+++ b/src/gui/itempopup.h
@@ -5,18 +5,18 @@
*
* This file is part of The Mana World.
*
- * The Mana World is free software; you can redistribute it and/or modify
+ * This program 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 Mana World is distributed in the hope that it will be useful,
+ * This program 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
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
diff --git a/src/gui/itemshortcutcontainer.cpp b/src/gui/itemshortcutcontainer.cpp
index 83d8c9fb..3735afe2 100644
--- a/src/gui/itemshortcutcontainer.cpp
+++ b/src/gui/itemshortcutcontainer.cpp
@@ -82,6 +82,7 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics)
{
Graphics *g = static_cast<Graphics*>(graphics);
+ graphics->setColor(gcn::Color(0, 0, 0));
graphics->setFont(getFont());
for (int i = 0; i < mMaxItems; i++)
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index 84e10e97..8de2867c 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -54,9 +54,8 @@ LoginDialog::LoginDialog(LoginData *loginData):
gcn::Label *portLabel = new gcn::Label(_("Port:"));
gcn::Label *dropdownLabel = new gcn::Label(_("Recent:"));
std::vector<std::string> dfltServer;
- dfltServer.push_back("www.aethyra.org");
- dfltServer.push_back("www.aethyra.org");
- dfltServer.push_back("209.168.213.109");
+ dfltServer.push_back("server.themanaworld.org");
+ dfltServer.push_back("server.themanaworld.org");
std::vector<std::string> dfltPort;
dfltPort.push_back("21001");
dfltPort.push_back("22001");
@@ -74,7 +73,7 @@ LoginDialog::LoginDialog(LoginData *loginData):
mServerScrollArea,
mServerListBox);
- mKeepCheck = new CheckBox(_("Keep"), mLoginData->remember);
+ mKeepCheck = new CheckBox(_("Remember Username"), mLoginData->remember);
mOkButton = new Button(_("OK"), "ok", this);
mCancelButton = new Button(_("Cancel"), "cancel", this);
mRegisterButton = new Button(_("Register"), "register", this);
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index 4c22e63d..915db961 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -55,6 +55,24 @@ MiniStatusWindow::MiniStatusWindow():
loadWindowState();
}
+void MiniStatusWindow::setIcon(int index, AnimatedSprite *sprite)
+{
+ if (index >= (int) mIcons.size())
+ mIcons.resize(index + 1, NULL);
+
+ if (mIcons[index])
+ delete mIcons[index];
+
+ mIcons[index] = sprite;
+}
+
+void MiniStatusWindow::eraseIcon(int index)
+{
+ mIcons.erase(mIcons.begin() + index);
+}
+
+extern volatile int tick_time;
+
void MiniStatusWindow::update()
{
// HP Bar coloration
@@ -102,6 +120,11 @@ void MiniStatusWindow::update()
*/
mXpBar->setText(updatedText.str());
+
+ for (unsigned int i = 0; i < mIcons.size(); i++)
+ if (mIcons[i])
+ mIcons[i]->update(tick_time * 10);
+
}
void MiniStatusWindow::draw(gcn::Graphics *graphics)
@@ -109,3 +132,15 @@ void MiniStatusWindow::draw(gcn::Graphics *graphics)
update();
drawChildren(graphics);
}
+
+void MiniStatusWindow::drawIcons(Graphics *graphics)
+{
+ // Draw icons
+ int icon_x = mXpBar->getX() + mXpBar->getWidth() + 4;
+ for (unsigned int i = 0; i < mIcons.size(); i++) {
+ if (mIcons[i]) {
+ mIcons[i]->draw(graphics, icon_x, 3);
+ icon_x += 2 + mIcons[i]->getWidth();
+ }
+ }
+}
diff --git a/src/gui/ministatus.h b/src/gui/ministatus.h
index d2bcef1c..c6a36a98 100644
--- a/src/gui/ministatus.h
+++ b/src/gui/ministatus.h
@@ -23,10 +23,12 @@
#define MINISTATUS_H
#include <iosfwd>
+#include <vector>
#include "window.h"
#include "../guichanfwd.h"
+#include "../animatedsprite.h"
class ProgressBar;
@@ -48,6 +50,15 @@ class MiniStatusWindow : public Window
*/
void draw(gcn::Graphics *graphics);
+ /**
+ * Sets one of the icons.
+ */
+ void setIcon(int index, AnimatedSprite *sprite);
+
+ void eraseIcon(int index);
+
+ void drawIcons(Graphics *graphics);
+
private:
/**
* Updates this dialog with values from player_node.
@@ -60,6 +71,8 @@ class MiniStatusWindow : public Window
ProgressBar *mHpBar;
ProgressBar *mMpBar;
ProgressBar *mXpBar;
+
+ std::vector<AnimatedSprite *> mIcons;
};
#endif
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index bf7c803a..9b0c2370 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -32,6 +32,7 @@
#include "windowcontainer.h"
#include "../being.h"
+#include "../beingmanager.h"
#include "../floor_item.h"
#include "../item.h"
#include "../localplayer.h"
@@ -51,7 +52,7 @@ extern std::string tradePartnerName;
PopupMenu::PopupMenu():
Window(),
- mBeing(NULL),
+ mBeingId(0),
mFloorItem(NULL),
mItem(NULL)
{
@@ -69,16 +70,16 @@ PopupMenu::PopupMenu():
void PopupMenu::showPopup(int x, int y, Being *being)
{
- mBeing = being;
+ mBeingId = being->getId();
mBrowserBox->clearRows();
- switch (mBeing->getType())
+ switch (being->getType())
{
case Being::PLAYER:
{
// Players can be traded with. Later also attack, follow and
// add as buddy will be options in this menu.
- const std::string &name = mBeing->getName();
+ const std::string &name = being->getName();
mBrowserBox->addRow(_("@@trade|Trade With ") + name + "@@");
mBrowserBox->addRow(_("@@attack|Attack ") + name + "@@");
@@ -148,58 +149,60 @@ void PopupMenu::showPopup(int x, int y, FloorItem *floorItem)
void PopupMenu::handleLink(const std::string& link)
{
+ Being *being = beingManager->findBeing(mBeingId);
+
// Talk To action
if (link == "talk" &&
- mBeing != NULL &&
- mBeing->getType() == Being::NPC &&
+ being != NULL &&
+ being->getType() == Being::NPC &&
current_npc == 0)
{
- dynamic_cast<NPC*>(mBeing)->talk();
+ dynamic_cast<NPC*>(being)->talk();
}
// Trade action
else if (link == "trade" &&
- mBeing != NULL &&
- mBeing->getType() == Being::PLAYER)
+ being != NULL &&
+ being->getType() == Being::PLAYER)
{
- player_node->trade(mBeing);
- tradePartnerName = mBeing->getName();
+ player_node->trade(being);
+ tradePartnerName = being->getName();
}
// Attack action
else if (link == "attack" &&
- mBeing != NULL &&
- mBeing->getType() == Being::PLAYER)
+ being != NULL &&
+ being->getType() == Being::PLAYER)
{
- player_node->attack(mBeing, true);
+ player_node->attack(being, true);
}
else if (link == "unignore" &&
- mBeing != NULL &&
- mBeing->getType() == Being::PLAYER)
+ being != NULL &&
+ being->getType() == Being::PLAYER)
{
- player_relations.setRelation(mBeing->getName(), PlayerRelation::NEUTRAL);
+ player_relations.setRelation(being->getName(), PlayerRelation::NEUTRAL);
}
else if (link == "ignore" &&
- mBeing != NULL &&
- mBeing->getType() == Being::PLAYER)
+ being != NULL &&
+ being->getType() == Being::PLAYER)
{
- player_relations.setRelation(mBeing->getName(), PlayerRelation::IGNORED);
+ player_relations.setRelation(being->getName(), PlayerRelation::IGNORED);
}
else if (link == "disregard" &&
- mBeing != NULL &&
- mBeing->getType() == Being::PLAYER)
+ being != NULL &&
+ being->getType() == Being::PLAYER)
{
- player_relations.setRelation(mBeing->getName(), PlayerRelation::DISREGARDED);
+ player_relations.setRelation(being->getName(), PlayerRelation::DISREGARDED);
}
else if (link == "friend" &&
- mBeing != NULL &&
- mBeing->getType() == Being::PLAYER)
+ being != NULL &&
+ being->getType() == Being::PLAYER)
{
- player_relations.setRelation(mBeing->getName(), PlayerRelation::FRIEND);
+ player_relations.setRelation(being->getName(), PlayerRelation::FRIEND);
}
/*
@@ -210,12 +213,12 @@ void PopupMenu::handleLink(const std::string& link)
/*
// Add Buddy action
- else if ((link == "buddy") && mBeing != NULL && mBeing->isPlayer())
+ else if ((link == "buddy") && being != NULL && being->isPlayer())
{
if (!buddyWindow->isVisible())
buddyWindow->setVisible(true);
- buddyWindow->addBuddy(mBeing->getName());
+ buddyWindow->addBuddy(being->getName());
}*/
// Pick Up Floor Item action
@@ -259,12 +262,12 @@ void PopupMenu::handleLink(const std::string& link)
new ItemAmountWindow(AMOUNT_ITEM_DROP, inventoryWindow, mItem);
}
else if (link == "party-invite" &&
- mBeing != NULL &&
- mBeing->getType() == Being::PLAYER)
+ being != NULL &&
+ being->getType() == Being::PLAYER)
{
MessageOut outMsg(player_node->getNetwork());
outMsg.writeInt16(CMSG_PARTY_INVITE);
- outMsg.writeInt32(mBeing->getId());
+ outMsg.writeInt32(being->getId());
}
// Unknown actions
@@ -275,7 +278,7 @@ void PopupMenu::handleLink(const std::string& link)
setVisible(false);
- mBeing = NULL;
+ mBeingId = 0;
mFloorItem = NULL;
mItem = NULL;
}
diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h
index 715a9bb5..2694abd8 100644
--- a/src/gui/popupmenu.h
+++ b/src/gui/popupmenu.h
@@ -22,6 +22,8 @@
#ifndef POPUP_MENU_H
#define POPUP_MENU_H
+#include <SDL.h> // for Uint32
+
#include "linkhandler.h"
#include "window.h"
@@ -66,7 +68,7 @@ class PopupMenu : public Window, public LinkHandler
private:
BrowserBox* mBrowserBox;
- Being* mBeing;
+ Uint32 mBeingId;
FloorItem* mFloorItem;
Item *mItem;
diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp
index 7ff2ea7f..c6b6869a 100644
--- a/src/gui/setup_keyboard.cpp
+++ b/src/gui/setup_keyboard.cpp
@@ -32,6 +32,8 @@
#include "widgets/layouthelper.h"
+#include "widgets/layouthelper.h"
+
#include "../configuration.h"
#include "../keyboardconfig.h"
diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp
index a4582b48..9a7fb441 100644
--- a/src/gui/setup_players.cpp
+++ b/src/gui/setup_players.cpp
@@ -65,9 +65,9 @@ static const char *RELATION_NAMES[PlayerRelation::RELATIONS_NR] = {
class PlayerRelationListModel : public gcn::ListModel
{
public:
- virtual ~PlayerRelationListModel(void) { }
+ virtual ~PlayerRelationListModel() { }
- virtual int getNumberOfElements(void)
+ virtual int getNumberOfElements()
{
return PlayerRelation::RELATIONS_NR;
}
@@ -83,30 +83,30 @@ public:
class PlayerTableModel : public TableModel
{
public:
- PlayerTableModel(void) :
+ PlayerTableModel() :
mPlayers(NULL)
{
playerRelationsUpdated();
}
- virtual ~PlayerTableModel(void)
+ virtual ~PlayerTableModel()
{
freeWidgets();
if (mPlayers)
delete mPlayers;
}
- virtual int getRows(void)
+ virtual int getRows()
{
return mPlayers->size();
}
- virtual int getColumns(void)
+ virtual int getColumns()
{
return COLUMNS_NR;
}
- virtual int getRowHeight(void)
+ virtual int getRowHeight()
{
return ROW_HEIGHT;
}
@@ -119,7 +119,7 @@ public:
return RELATION_CHOICE_COLUMN_WIDTH;
}
- virtual void playerRelationsUpdated(void)
+ virtual void playerRelationsUpdated()
{
signalBeforeUpdate();
@@ -158,7 +158,7 @@ public:
return mWidgets[WIDGET_AT(row, column)];
}
- virtual void freeWidgets(void)
+ virtual void freeWidgets()
{
if (mPlayers)
delete mPlayers;
@@ -187,9 +187,9 @@ protected:
class IgnoreChoicesListModel : public gcn::ListModel
{
public:
- virtual ~IgnoreChoicesListModel(void) { }
+ virtual ~IgnoreChoicesListModel() { }
- virtual int getNumberOfElements(void)
+ virtual int getNumberOfElements()
{
return player_relations.getPlayerIgnoreStrategies()->size();
}
@@ -231,7 +231,7 @@ Setup_Players::Setup_Players():
mPlayerTitleTable->setDimension(gcn::Rectangle(10, 10, table_width, 10));
mPlayerTitleTable->setBackgroundColor(gcn::Color(0xbf, 0xbf, 0xbf));
- for (int i = 0; i < COLUMNS_NR; i++)
+ for (int i = 0; i < COLUMNS_NR; i++)
{
mPlayerTableTitleModel->set(0, i,
new gcn::Label(gettext(table_titles[i])));
@@ -282,7 +282,7 @@ Setup_Players::Setup_Players():
setDimension(gcn::Rectangle(0, 0, 290, 250));
}
-Setup_Players::~Setup_Players(void)
+Setup_Players::~Setup_Players()
{
player_relations.removeListener(this);
}
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 2ba8b6e8..2381ab41 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -289,7 +289,7 @@ void Setup_Video::apply()
* See http://libsdl.org/cgi/docwiki.cgi/SDL_SetVideoMode
*/
-#ifdef WIN32
+#if defined(WIN32) || defined(__APPLE__)
// checks for opengl usage
if (!(config.getValue("opengl", 0) == 1))
{
@@ -307,7 +307,7 @@ void Setup_Video::apply()
logger->error(error.str());
}
}
-#ifdef WIN32
+#if defined(WIN32) || defined(__APPLE__)
} else {
new OkDialog(_("Switching to full screen"),
_("Restart needed for changes to take effect."));
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp
index 9d23cc3c..304719b6 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -19,8 +19,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <algorithm>
-
#include <guichan/widgets/label.hpp>
#include "button.h"
@@ -47,7 +45,7 @@ struct SkillInfo {
std::vector<SkillInfo> skill_db;
-static void initSkillinfo(void);
+static void initSkillinfo();
class SkillGuiTableModel : public StaticTableModel
{
@@ -73,14 +71,17 @@ public:
return 35;
}
- virtual int getRowHeight(void)
+ virtual int getRowHeight()
{
return 12;
}
- virtual void update(void)
+ virtual void update()
{
- static const SkillInfo fakeSkillInfo = { _("???"), false };
+ static const SkillInfo fakeSkillInfo = {
+ _("Mystery Skill"),
+ false
+ };
mEntriesNr = mDialog->getSkills().size();
resize();
@@ -112,7 +113,6 @@ public:
}
}
-
private:
SkillDialog *mDialog;
int mEntriesNr;
@@ -250,11 +250,11 @@ void SkillDialog::setSkill(int id, int lvl, int mp)
void SkillDialog::cleanList()
{
- for_each(mSkillList.begin(), mSkillList.end(), make_dtor(mSkillList));
+ delete_all(mSkillList);
mSkillList.clear();
}
-static void initSkillinfo(void)
+static void initSkillinfo()
{
SkillInfo emptySkillInfo = { "", false };
diff --git a/src/gui/skill.h b/src/gui/skill.h
index 955666d9..582892f0 100644
--- a/src/gui/skill.h
+++ b/src/gui/skill.h
@@ -70,7 +70,7 @@ class SkillDialog : public Window, public gcn::ActionListener
void setSkill(int id, int lv, int sp);
void cleanList();
- const std::vector<SKILL*>& getSkills(void) const { return mSkillList; }
+ const std::vector<SKILL*>& getSkills() const { return mSkillList; }
private:
GuiTable mTable;//gcn::ListBox *mSkillListBox;
diff --git a/src/gui/table.cpp b/src/gui/table.cpp
index c4265097..7e855523 100644
--- a/src/gui/table.cpp
+++ b/src/gui/table.cpp
@@ -31,7 +31,7 @@ class GuiTableActionListener : public gcn::ActionListener
public:
GuiTableActionListener(GuiTable *_table, gcn::Widget *_widget, int _row, int _column);
- virtual ~GuiTableActionListener(void);
+ virtual ~GuiTableActionListener();
virtual void action(const gcn::ActionEvent& actionEvent);
@@ -55,7 +55,7 @@ GuiTableActionListener::GuiTableActionListener(GuiTable *table, gcn::Widget *wid
}
}
-GuiTableActionListener::~GuiTableActionListener(void)
+GuiTableActionListener::~GuiTableActionListener()
{
if (mWidget) {
mWidget->removeActionListener(this);
@@ -82,12 +82,12 @@ GuiTable::GuiTable(TableModel *initial_model) :
addKeyListener(this);
}
-GuiTable::~GuiTable(void)
+GuiTable::~GuiTable()
{
delete mModel;
}
-TableModel* GuiTable::getModel(void) const
+TableModel *GuiTable::getModel() const
{
return mModel;
}
@@ -109,7 +109,7 @@ void GuiTable::setModel(TableModel *new_model)
}
}
-void GuiTable::recomputeDimensions(void)
+void GuiTable::recomputeDimensions()
{
int rows_nr = mModel->getRows();
int columns_nr = mModel->getColumns();
@@ -137,12 +137,12 @@ void GuiTable::setSelected(int row, int column)
mSelectedRow = row;
}
-int GuiTable::getSelectedRow(void)
+int GuiTable::getSelectedRow()
{
return mSelectedRow;
}
-int GuiTable::getSelectedColumn(void)
+int GuiTable::getSelectedColumn()
{
return mSelectedColumn;
}
@@ -152,7 +152,7 @@ void GuiTable::setLinewiseSelection(bool linewise)
mLinewiseMode = linewise;
}
-int GuiTable::getRowHeight(void)
+int GuiTable::getRowHeight()
{
if (mModel)
return mModel->getRowHeight() + 1; // border
@@ -168,14 +168,14 @@ int GuiTable::getColumnWidth(int i)
return 0;
}
-void GuiTable::uninstallActionListeners(void)
+void GuiTable::uninstallActionListeners()
{
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()
{
if (!mModel)
return;
@@ -213,7 +213,7 @@ void GuiTable::draw(gcn::Graphics* graphics)
int max_rows_nr = mModel->getRows() - first_row; // clip if neccessary:
if (max_rows_nr < rows_nr)
rows_nr = max_rows_nr;
-
+
// Now determine the first and last column
// Take the easy way out; these are usually bounded and all visible.
int first_column = 0;
@@ -268,7 +268,7 @@ void GuiTable::draw(gcn::Graphics* graphics)
}
}
-void GuiTable::logic(void)
+void GuiTable::logic()
{
}
@@ -285,7 +285,7 @@ void GuiTable::moveToBottom(gcn::Widget *widget)
this->mTopWidget = NULL;
}
-gcn::Rectangle GuiTable::getChildrenArea(void)
+gcn::Rectangle GuiTable::getChildrenArea()
{
return gcn::Rectangle(0, 0, getWidth(), getHeight());
}
@@ -318,7 +318,7 @@ void GuiTable::mouseWheelMovedUp(gcn::MouseEvent& mouseEvent)
void GuiTable::mouseWheelMovedDown(gcn::MouseEvent& mouseEvent)
{
}
-
+
void GuiTable::mouseDragged(gcn::MouseEvent& mouseEvent)
{
}
@@ -335,7 +335,7 @@ void 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);
@@ -388,11 +388,13 @@ void GuiTable::_setFocusHandler(gcn::FocusHandler* focusHandler)
{
gcn::Widget::_setFocusHandler(focusHandler);
- if (mModel)
- for (int r = 0; r < mModel->getRows(); ++r)
+ if (mModel) {
+ for (int r = 0; r < mModel->getRows(); ++r) {
for (int c = 0; c < mModel->getColumns(); ++c) {
gcn::Widget *w = mModel->getElementAt(r, c);
if (w)
w->_setFocusHandler(focusHandler);
}
+ }
+ }
}
diff --git a/src/gui/table.h b/src/gui/table.h
index e3fd8cf6..9dde8900 100644
--- a/src/gui/table.h
+++ b/src/gui/table.h
@@ -37,8 +37,9 @@
class GuiTableActionListener;
/**
- * A table, with rows and columns made out of sub-widgets. Largely inspired by (and can be thought of as a generalisation of)
- * the guichan listbox implementation.
+ * A table, with rows and columns made out of sub-widgets. Largely inspired by
+ * (and can be thought of as a generalisation of) the guichan listbox
+ * implementation.
*
* Normally you want this within a ScrollArea.
*
@@ -49,41 +50,43 @@ class GuiTable : public gcn::Widget,
public gcn::KeyListener,
public TableModelListener
{
- friend class GuiTableActionListener; // so that the action listener can call distributeActionEvent
+ // so that the action listener can call distributeActionEvent
+ friend class GuiTableActionListener;
+
public:
GuiTable(TableModel * initial_model = NULL);
- virtual ~GuiTable(void);
+ virtual ~GuiTable();
/**
* Retrieves the active table model
*/
- TableModel *getModel(void) const;
+ TableModel *getModel() const;
/**
* Sets the table model
*
- * Note that actions issued by widgets returned from the model will update the table
- * selection, but only AFTER any event handlers installed within the widget have been
- *triggered. To be notified after such an update, add an action listener to the table
- * instead.
+ * Note that actions issued by widgets returned from the model will update
+ * the table selection, but only AFTER any event handlers installed within
+ * the widget have been triggered. To be notified after such an update,
+ * add an action listener to the table instead.
*/
void setModel(TableModel *m);
void setSelected(int row, int column);
- int getSelectedRow(void);
+ int getSelectedRow();
- int getSelectedColumn(void);
+ int getSelectedColumn();
- gcn::Rectangle getChildrenArea(void);
+ gcn::Rectangle getChildrenArea();
/**
- * Toggle whether to use linewise selection mode, in which the table selects an entire
- * line at a time, rather than a single cell.
+ * Toggle whether to use linewise selection mode, in which the table
+ * selects an entire line at a time, rather than a single cell.
*
- * Note that column information is tracked even in linewise selection mode; this mode
- * therefore only affects visualisation.
+ * Note that column information is tracked even in linewise selection
+ * mode; this mode therefore only affects visualisation.
*
* Disabled by default.
*
@@ -94,7 +97,7 @@ public:
// Inherited from Widget
virtual void draw(gcn::Graphics* graphics);
- virtual void logic(void);
+ virtual void logic();
virtual gcn::Widget *getWidgetAt(int x, int y);
@@ -114,25 +117,25 @@ public:
virtual void mouseWheelMovedUp(gcn::MouseEvent& mouseEvent);
virtual void mouseWheelMovedDown(gcn::MouseEvent& mouseEvent);
-
+
virtual void mouseDragged(gcn::MouseEvent& mouseEvent);
// Constraints inherited from TableModelListener
virtual void modelUpdated(bool);
protected:
+ /** Frees all action listeners on inner widgets. */
+ virtual void uninstallActionListeners();
+ /** Installs all action listeners on inner widgets. */
+ virtual void installActionListeners();
- virtual void uninstallActionListeners(void); // frees all action listeners on inner widgets
- virtual void installActionListeners(void); // installs all action listeners on inner widgets
-
- virtual int getRowHeight(void);
+ virtual int getRowHeight();
virtual int getColumnWidth(int i);
-
-private:
+private:
int getRowForY(int y); // -1 on error
int getColumnForX(int x); // -1 on error
- void recomputeDimensions(void);
+ void recomputeDimensions();
bool mLinewiseMode;
TableModel *mModel;
@@ -140,11 +143,14 @@ private:
int mSelectedRow;
int mSelectedColumn;
- int mPopFramesNr; // Number of frames to skip upwards when drawing the selected widget
+ /** Number of frames to skip upwards when drawing the selected widget. */
+ int mPopFramesNr;
- gcn::Widget *mTopWidget; // If someone moves a fresh widget to the top, we must display it
+ /** If someone moves a fresh widget to the top, we must display it. */
+ gcn::Widget *mTopWidget;
- std::vector<GuiTableActionListener *> action_listeners; // Vector for compactness; used as a list in practice.
+ /** Vector for compactness; used as a list in practice. */
+ std::vector<GuiTableActionListener *> action_listeners;
};
diff --git a/src/gui/table_model.cpp b/src/gui/table_model.cpp
index 0b31369f..e69ee808 100644
--- a/src/gui/table_model.cpp
+++ b/src/gui/table_model.cpp
@@ -38,13 +38,13 @@ void TableModel::removeListener(TableModelListener *listener)
listeners.erase(listener);
}
-void TableModel::signalBeforeUpdate(void)
+void TableModel::signalBeforeUpdate()
{
for (std::set<TableModelListener *>::const_iterator it = listeners.begin(); it != listeners.end(); it++)
(*it)->modelUpdated(false);
}
-void TableModel::signalAfterUpdate(void)
+void TableModel::signalAfterUpdate()
{
for (std::set<TableModelListener *>::const_iterator it = listeners.begin(); it != listeners.end(); it++)
(*it)->modelUpdated(true);
@@ -66,12 +66,12 @@ StaticTableModel::StaticTableModel(int row, int column,
mWidths.resize(column, 1);
}
-StaticTableModel::~StaticTableModel(void)
+StaticTableModel::~StaticTableModel()
{
delete_all(mTableModel);
}
-void StaticTableModel::resize(void)
+void StaticTableModel::resize()
{
mRows = getRows();
mColumns = getColumns();
@@ -103,7 +103,7 @@ void 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)];
}
@@ -125,7 +125,7 @@ void StaticTableModel::fixRowHeight(int height)
mHeight = -height;
}
-int StaticTableModel::getRowHeight(void)
+int StaticTableModel::getRowHeight()
{
return abs(mHeight);
}
@@ -138,12 +138,12 @@ int StaticTableModel::getColumnWidth(int column)
return abs(mWidths[column]);
}
-int StaticTableModel::getRows(void)
+int StaticTableModel::getRows()
{
return mRows;
}
-int StaticTableModel::getColumns(void)
+int StaticTableModel::getColumns()
{
return mColumns;
}
diff --git a/src/gui/table_model.h b/src/gui/table_model.h
index 1c36ca46..03b69dba 100644
--- a/src/gui/table_model.h
+++ b/src/gui/table_model.h
@@ -34,8 +34,9 @@ class TableModelListener
{
public:
/**
- * Must be invoked by the TableModel whenever a global change is about to occur or
- * has occurred (e.g., when a row or column is being removed or added).
+ * Must be invoked by the TableModel whenever a global change is about to
+ * occur or has occurred (e.g., when a row or column is being removed or
+ * added).
*
* This method is triggered twice, once before and once after the update.
*
@@ -50,22 +51,22 @@ public:
class TableModel
{
public:
- virtual ~TableModel(void) { }
+ virtual ~TableModel() { }
/**
* Determines the number of rows (lines) in the table
*/
- virtual int getRows(void) = 0;
+ virtual int getRows() = 0;
/**
* Determines the number of columns in each row
*/
- virtual int getColumns(void) = 0;
+ virtual int getColumns() = 0;
/**
* Determines the height for each row
*/
- virtual int getRowHeight(void) = 0;
+ virtual int getRowHeight() = 0;
/**
* Determines the width of each individual column
@@ -85,12 +86,12 @@ protected:
/**
* Tells all listeners that the table is about to see an update
*/
- virtual void signalBeforeUpdate(void);
+ virtual void signalBeforeUpdate();
/**
* Tells all listeners that the table has seen an update
*/
- virtual void signalAfterUpdate(void);
+ virtual void signalAfterUpdate();
private:
std::set<TableModelListener *> listeners;
@@ -102,7 +103,7 @@ class StaticTableModel : public TableModel
public:
StaticTableModel(int width, int height, gcn::Color background = 0xffffff,
bool opacity = true);
- virtual ~StaticTableModel(void);
+ virtual ~StaticTableModel();
/**
* Inserts a widget into the table model.
@@ -112,7 +113,8 @@ public:
virtual void set(int row, int column, gcn::Widget *widget);
/**
- * Fixes the column width for a given column; this overrides dynamic width inference.
+ * Fixes the column width for a given column; this overrides dynamic width
+ * inference.
*
* Semantics are undefined for width 0.
*/
@@ -128,7 +130,7 @@ public:
/**
* Resizes the table model
*/
- virtual void resize(void);
+ virtual void resize();
/**
* Sets the table to be opaque, that is sets the table
@@ -146,15 +148,14 @@ public:
*/
virtual bool isOpaque() const;
- virtual int getRows(void);
- virtual int getColumns(void);
- virtual int getRowHeight(void);
- virtual int getWidth(void);
- virtual int getHeight(void);
+ virtual int getRows();
+ virtual int getColumns();
+ virtual int getRowHeight();
+ virtual int getWidth();
+ virtual int getHeight();
virtual int getColumnWidth(int index);
virtual gcn::Widget *getElementAt(int row, int column);
-
protected:
int mRows, mColumns;
int mHeight;
diff --git a/src/gui/textfield.cpp b/src/gui/textfield.cpp
index 3ecf5c82..3369195d 100644
--- a/src/gui/textfield.cpp
+++ b/src/gui/textfield.cpp
@@ -23,8 +23,6 @@
#include <guichan/font.hpp>
-#include <guichan/sdl/sdlinput.hpp>
-
#include "sdlinput.h"
#include "textfield.h"
diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp
index 6e8efeff..66855b77 100644
--- a/src/gui/truetypefont.cpp
+++ b/src/gui/truetypefont.cpp
@@ -45,8 +45,7 @@ class TextChunk
bool operator==(const TextChunk &chunk) const
{
- return (
- chunk.text == text && chunk.color == color);
+ return (chunk.text == text && chunk.color == color);
}
void generate(TTF_Font *font)
@@ -81,7 +80,7 @@ typedef std::list<TextChunk>::iterator CacheIterator;
static int fontCounter;
-TrueTypeFont::TrueTypeFont(const std::string& filename, int size)
+TrueTypeFont::TrueTypeFont(const std::string &filename, int size)
{
if (fontCounter == 0 && TTF_Init() == -1)
{
@@ -162,7 +161,7 @@ void TrueTypeFont::drawString(gcn::Graphics *graphics,
g->drawImage(cache.front().img, x, y);
}
-int TrueTypeFont::getWidth(const std::string& text) const
+int TrueTypeFont::getWidth(const std::string &text) const
{
int w, h;
TTF_SizeUTF8(mFont, text.c_str(), &w, &h);
diff --git a/src/gui/truetypefont.h b/src/gui/truetypefont.h
index 288be49a..6f0671a2 100644
--- a/src/gui/truetypefont.h
+++ b/src/gui/truetypefont.h
@@ -46,7 +46,7 @@ class TrueTypeFont : public gcn::Font
* @param filename Font filename.
* @param size Font size.
*/
- TrueTypeFont(const std::string& filename, int size);
+ TrueTypeFont(const std::string &filename, int size);
/**
* Destructor.
@@ -60,7 +60,9 @@ class TrueTypeFont : public gcn::Font
/**
* @see Font::drawString
*/
- void drawString(gcn::Graphics* graphics, const std::string& text, int x, int y);
+ void drawString(gcn::Graphics *graphics,
+ const std::string &text,
+ int x, int y);
private:
TTF_Font *mFont;
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index f258aba8..326a7189 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -22,6 +22,7 @@
#include <cassert>
#include "gui.h"
+#include "ministatus.h"
#include "popupmenu.h"
#include "viewport.h"
@@ -80,6 +81,8 @@ void Viewport::setMap(Map *map)
mMap = map;
}
+extern MiniStatusWindow *miniStatusWindow;
+
void Viewport::draw(gcn::Graphics *gcnGraphics)
{
static int lastTick = tick_time;
@@ -217,6 +220,9 @@ void Viewport::draw(gcn::Graphics *gcnGraphics)
(*i)->drawEmotion(graphics, -(int) mPixelViewX, -(int) mPixelViewY);
}
+ if (miniStatusWindow)
+ miniStatusWindow->drawIcons(graphics);
+
// Draw contained widgets
WindowContainer::draw(gcnGraphics);
}
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index dba65143..e0e88b31 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -726,4 +726,3 @@ void Window::reflowLayout(int w, int h)
mLayout = NULL;
setContentSize(w, h);
}
-
diff --git a/src/gui/window.h b/src/gui/window.h
index 501ad160..deaf984c 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -30,7 +30,6 @@
#include "../guichanfwd.h"
class ConfigListener;
-class GCContainer;
class ContainerPlacer;
class Image;
class ImageRect;
@@ -177,7 +176,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
@@ -222,7 +221,7 @@ class Window : public gcn::Window, gcn::WidgetListener
/**
* 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
@@ -300,7 +299,6 @@ class Window : public gcn::Window, gcn::WidgetListener
void setGuiAlpha();
- GCContainer *mChrome; /**< Contained container */
ResizeGrip *mGrip; /**< Resize grip */
Window *mParent; /**< The parent window */
Layout *mLayout; /**< Layout handler */