summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/browserbox.cpp2
-rw-r--r--src/gui/browserbox.h2
-rw-r--r--src/gui/buy.cpp13
-rw-r--r--src/gui/buy.h3
-rw-r--r--src/gui/char_select.cpp1
-rw-r--r--src/gui/inventorywindow.cpp3
-rw-r--r--src/gui/item_amount.cpp3
-rw-r--r--src/gui/item_amount.h2
-rw-r--r--src/gui/login.cpp3
-rw-r--r--src/gui/menuwindow.cpp2
-rw-r--r--src/gui/npc_text.h2
-rw-r--r--src/gui/playerbox.cpp6
-rw-r--r--src/gui/popupmenu.cpp1
-rw-r--r--src/gui/sell.cpp4
-rw-r--r--src/gui/setup.cpp2
-rw-r--r--src/gui/setup_keyboard.cpp12
-rw-r--r--src/gui/trade.cpp2
-rw-r--r--src/gui/window.cpp14
-rw-r--r--src/gui/window.h23
19 files changed, 44 insertions, 56 deletions
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp
index b0b6f48e..03540d31 100644
--- a/src/gui/browserbox.cpp
+++ b/src/gui/browserbox.cpp
@@ -142,7 +142,7 @@ void BrowserBox::addRow(const std::string &row)
{
unsigned int y = 0;
unsigned int nextChar;
- char const *hyphen = "~";
+ const char *hyphen = "~";
int hyphenWidth = font->getWidth(hyphen);
int x = 0;
diff --git a/src/gui/browserbox.h b/src/gui/browserbox.h
index 465ff497..cb4c23ed 100644
--- a/src/gui/browserbox.h
+++ b/src/gui/browserbox.h
@@ -25,8 +25,8 @@
#include <iosfwd>
#include <vector>
-#include <guichan/widget.hpp>
#include <guichan/mouselistener.hpp>
+#include <guichan/widget.hpp>
#include "../guichanfwd.h"
#include "../main.h"
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 008c7bb9..cc2262ec 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -165,15 +165,15 @@ void BuyDialog::action(const gcn::ActionEvent &event)
Net::GameServer::Player::tradeWithNPC
(mShopItems->at(selectedItem)->getId(), mAmountItems);
- // Reset selection
- mAmountItems = 1;
- mSlider->setValue(1);
- mSlider->gcn::Slider::setScale(1, mMaxItems);
-
// Update money and adjust the max number of items that can be bought
mMaxItems -= mAmountItems;
setMoney(mMoney -
mAmountItems * mShopItems->at(selectedItem)->getPrice());
+
+ // Reset selection
+ mAmountItems = 1;
+ mSlider->setValue(1);
+ mSlider->gcn::Slider::setScale(1, mMaxItems);
}
}
@@ -187,8 +187,7 @@ void BuyDialog::valueChanged(const gcn::SelectionEvent &event)
mSlider->gcn::Slider::setScale(1, mMaxItems);
}
-void
-BuyDialog::updateButtonsAndLabels()
+void BuyDialog::updateButtonsAndLabels()
{
const int selectedItem = mShopItemList->getSelected();
int price = 0;
diff --git a/src/gui/buy.h b/src/gui/buy.h
index 24f18742..a80ffed7 100644
--- a/src/gui/buy.h
+++ b/src/gui/buy.h
@@ -92,8 +92,7 @@ class BuyDialog : public Window, public gcn::ActionListener,
/**
* Updates the state of buttons and labels.
*/
- void
- updateButtonsAndLabels();
+ void updateButtonsAndLabels();
private:
gcn::Button *mBuyButton;
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 67cb3c7b..f800c266 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -134,7 +134,6 @@ CharSelectDialog::CharSelectDialog(LockedArray<LocalPlayer*> *charInfo,
setVisible(true);
mSelectButton->requestFocus();
updatePlayerInfo();
-
}
void CharSelectDialog::action(const gcn::ActionEvent &event)
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 1765eeea..b4a96394 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -102,9 +102,8 @@ void InventoryWindow::logic()
void InventoryWindow::action(const gcn::ActionEvent &event)
{
Item *item = mItems->getItem();
- if (!item) {
+ if (!item)
return;
- }
if (event.getId() == "use")
{
diff --git a/src/gui/item_amount.cpp b/src/gui/item_amount.cpp
index c6763014..cae681d4 100644
--- a/src/gui/item_amount.cpp
+++ b/src/gui/item_amount.cpp
@@ -75,8 +75,7 @@ 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 dd1026b7..c0d2b2c0 100644
--- a/src/gui/item_amount.h
+++ b/src/gui/item_amount.h
@@ -38,7 +38,7 @@ class Item;
#define AMOUNT_ITEM_SPLIT 3
/**
- * Window used for selecting the amount of items to drop.
+ * Window used for selecting the amount of items to drop, trade or split.
*
* \ingroup Interface
*/
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index b4289984..615045b6 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -38,7 +38,8 @@
#include "../utils/gettext.h"
-LoginDialog::LoginDialog(LoginData *loginData) : Window(_("Login")), mLoginData(loginData)
+LoginDialog::LoginDialog(LoginData *loginData):
+ Window(_("Login")), mLoginData(loginData)
{
gcn::Label *userLabel = new gcn::Label(_("Name:"));
gcn::Label *passLabel = new gcn::Label(_("Password:"));
diff --git a/src/gui/menuwindow.cpp b/src/gui/menuwindow.cpp
index f74dfa41..9415188e 100644
--- a/src/gui/menuwindow.cpp
+++ b/src/gui/menuwindow.cpp
@@ -58,7 +58,7 @@ MenuWindow::MenuWindow():
setTitleBarHeight(0);
// Buttons
- static char const *buttonNames[] =
+ static const char *buttonNames[] =
{
N_("Status"),
N_("Equipment"),
diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h
index 76161f88..b6eccf95 100644
--- a/src/gui/npc_text.h
+++ b/src/gui/npc_text.h
@@ -45,7 +45,7 @@ class NpcTextDialog : public Window, public gcn::ActionListener
NpcTextDialog();
/**
- * Called when resizing the window
+ * Called when resizing the window.
*
* @param event The calling event
*/
diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp
index 0a0c8a17..6888d69a 100644
--- a/src/gui/playerbox.cpp
+++ b/src/gui/playerbox.cpp
@@ -74,8 +74,7 @@ PlayerBox::~PlayerBox()
}
}
-void
-PlayerBox::draw(gcn::Graphics *graphics)
+void PlayerBox::draw(gcn::Graphics *graphics)
{
if (mPlayer)
{
@@ -87,8 +86,7 @@ PlayerBox::draw(gcn::Graphics *graphics)
}
}
-void
-PlayerBox::drawFrame(gcn::Graphics *graphics)
+void PlayerBox::drawFrame(gcn::Graphics *graphics)
{
int w, h, bs;
bs = getFrameSize();
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 59ca0867..a430ff10 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -75,7 +75,6 @@ void PopupMenu::showPopup(int x, int y, Being *being)
// add as buddy will be options in this menu.
const std::string &name = mBeing->getName();
mBrowserBox->addRow(strprintf(_("@@trade|Trade With %s@@"), name.c_str()));
-
mBrowserBox->addRow(strprintf(_("@@attack|Attack %s@@"), name.c_str()));
//mBrowserBox->addRow("@@follow|Follow " + name + "@@");
//mBrowserBox->addRow("@@buddy|Add " + name + " to Buddy List@@");
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index 24391458..9aee4bee 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -202,8 +202,7 @@ void SellDialog::setMoney(int amount)
mShopItemList->setPlayersMoney(amount);
}
-void
-SellDialog::updateButtonsAndLabels()
+void SellDialog::updateButtonsAndLabels()
{
int selectedItem = mShopItemList->getSelected();
int income = 0;
@@ -211,7 +210,6 @@ SellDialog::updateButtonsAndLabels()
if (selectedItem > -1)
{
const ItemInfo &info = mShopItems->at(selectedItem)->getInfo();
-
mItemDescLabel->setCaption
(strprintf(_("Description: %s"), info.getDescription().c_str()));
mItemEffectLabel->setCaption
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index e062f674..59b54be0 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -53,7 +53,7 @@ Setup::Setup():
int height = 265;
setContentSize(width, height);
- static char const *buttonNames[] = {
+ static const char *buttonNames[] = {
N_("Apply"), N_("Cancel"), N_("Reset Windows"), 0
};
int x = width;
diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp
index 270f4a0e..e4d1af0c 100644
--- a/src/gui/setup_keyboard.cpp
+++ b/src/gui/setup_keyboard.cpp
@@ -32,6 +32,7 @@
#include "../configuration.h"
#include "../keyboardconfig.h"
+#include "../utils/gettext.h"
#include "../utils/tostring.h"
#include <SDL_keyboard.h>
@@ -85,13 +86,13 @@ Setup_Keyboard::Setup_Keyboard():
scrollArea->setDimension(gcn::Rectangle(10, 10, 200, 140));
add(scrollArea);
- mAssignKeyButton = new Button("Assign", "assign", this);
+ mAssignKeyButton = new Button(_("Assign"), "assign", this);
mAssignKeyButton->setPosition(165, 155);
mAssignKeyButton->addActionListener(this);
mAssignKeyButton->setEnabled(false);
add(mAssignKeyButton);
- mMakeDefaultButton = new Button("Default", "makeDefault", this);
+ mMakeDefaultButton = new Button(_("Default"), "makeDefault", this);
mMakeDefaultButton->setPosition(10, 155);
mMakeDefaultButton->addActionListener(this);
add(mMakeDefaultButton);
@@ -112,8 +113,9 @@ void Setup_Keyboard::apply()
if (keyboard.hasConflicts())
{
- new OkDialog("Key Conflict(s) Detected.",
- "Resolve them, or gameplay may result in strange behaviour.");
+ new OkDialog(_("Key Conflict(s) Detected."),
+ _("Resolve them, or gameplay may result in strange "
+ "behaviour."));
}
keyboard.setEnabled(true);
keyboard.store();
@@ -171,7 +173,7 @@ void Setup_Keyboard::newKeyCallback(int index)
void Setup_Keyboard::refreshKeys()
{
- for(int i = 0; i < keyboard.KEY_TOTAL; i++)
+ for (int i = 0; i < keyboard.KEY_TOTAL; i++)
{
refreshAssignedKey(i);
}
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 7d5051c7..0592c485 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -188,9 +188,7 @@ void TradeWindow::action(const gcn::ActionEvent &event)
if (event.getId() == "add")
{
if (!item)
- {
return;
- }
if (mMyInventory->contains(item)) {
chatWindow->chatLog("Failed adding item. You can not "
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index 582e4a67..64607243 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -31,7 +31,6 @@
#include "window.h"
#include "gui.h"
-#include "gccontainer.h"
#include "windowcontainer.h"
#include "widgets/layout.h"
@@ -87,8 +86,7 @@ Window::Window(const std::string& caption, bool modal, Window *parent):
{
logger->log("Window::Window(\"%s\")", caption.c_str());
- if (!windowContainer)
- {
+ if (!windowContainer) {
throw GCN_EXCEPTION("Window::Window(): no windowContainer set");
}
@@ -128,17 +126,15 @@ Window::Window(const std::string& caption, bool modal, Window *parent):
Window::~Window()
{
logger->log("UNLOAD: Window::~Window(\"%s\")", getCaption().c_str());
-
const std::string &name = mWindowName;
- if (!name.empty())
- {
- // Saving X, Y and Width and Height for resizables in the config
+
+ // Saving X, Y and Width and Height for resizables in the config
+ if (!name.empty()) {
config.setValue(name + "WinX", getX());
config.setValue(name + "WinY", getY());
config.setValue(name + "Visible", isVisible());
- if (mGrip)
- {
+ if (mGrip) {
config.setValue(name + "WinWidth", getWidth());
config.setValue(name + "WinHeight", getHeight());
}
diff --git a/src/gui/window.h b/src/gui/window.h
index 6f49e062..50a206f0 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -222,17 +222,6 @@ class Window : public gcn::Window, gcn::WidgetListener
*/
void resetToDefaultSize();
- enum ResizeHandles
- {
- TOP = 0x01,
- RIGHT = 0x02,
- BOTTOM = 0x04,
- LEFT = 0x08
- };
-
- /** The window container windows add themselves to. */
- static WindowContainer *windowContainer;
-
/**
* Gets the layout handler for this window.
*/
@@ -263,7 +252,19 @@ class Window : public gcn::Window, gcn::WidgetListener
*/
void loadSkin(const std::string &fileName);
+ protected:
+ /** The window container windows add themselves to. */
+ static WindowContainer *windowContainer;
+
private:
+ enum ResizeHandles
+ {
+ TOP = 0x01,
+ RIGHT = 0x02,
+ BOTTOM = 0x04,
+ LEFT = 0x08
+ };
+
/**
* Determines if the mouse is in a resize area and returns appropriate
* resize handles. Also initializes drag offset in case the resize