diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-02-15 18:29:15 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-02-15 18:29:15 +0100 |
commit | 83bbc5cc3afeea0f0b248cd755e1011f4760a298 (patch) | |
tree | 1207131c234ad7c5ae6a5849d1d5d53de45b1b0b /src/gui/setup_players.cpp | |
parent | 7b3b60f86c545e0c5b6b8cb1ab7b1cbbf22d5e02 (diff) | |
parent | 38708de52f00689088eda29f9b6ee257ce7038ad (diff) | |
download | mana-83bbc5cc3afeea0f0b248cd755e1011f4760a298.tar.gz mana-83bbc5cc3afeea0f0b248cd755e1011f4760a298.tar.bz2 mana-83bbc5cc3afeea0f0b248cd755e1011f4760a298.tar.xz mana-83bbc5cc3afeea0f0b248cd755e1011f4760a298.zip |
Merge commit 'aethyra/master'
Conflicts:
CMakeLists.txt
configure.ac
data/help/header.txt
packaging/windows/setup.nsi
po/POTFILES.in
src/being.cpp
src/being.h
src/game.cpp
src/gui/color.cpp
src/gui/color.h
src/gui/equipmentwindow.h
src/gui/popupmenu.cpp
src/gui/recorder.cpp
src/gui/setup_colors.h
src/gui/setup_keyboard.cpp
src/gui/setup_keyboard.h
src/gui/skill.cpp
src/gui/speechbubble.cpp
src/gui/speechbubble.h
src/gui/table.cpp
src/keyboardconfig.cpp
src/keyboardconfig.h
src/localplayer.cpp
src/main.cpp
src/main.h
src/map.cpp
src/resources/colordb.cpp
src/resources/colordb.h
src/resources/emotedb.cpp
src/resources/emotedb.h
src/text.cpp
src/text.h
src/tmw.rc
src/winver.h
Diffstat (limited to 'src/gui/setup_players.cpp')
-rw-r--r-- | src/gui/setup_players.cpp | 57 |
1 files changed, 35 insertions, 22 deletions
diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp index d25117de..44b52b54 100644 --- a/src/gui/setup_players.cpp +++ b/src/gui/setup_players.cpp @@ -1,6 +1,6 @@ /* * The Mana World - * Copyright (C) 2004 The Mana World Development Team + * Copyright (C) 2008 The Mana World Development Team * * This file is part of The Mana World. * @@ -47,17 +47,19 @@ #define ROW_HEIGHT 12 // The following column widths really shouldn't be hardcoded but should scale with the size of the widget... except // that, right now, the widget doesn't exactly scale either. -#define NAME_COLUMN_WIDTH 195 +#define NAME_COLUMN_WIDTH 230 #define RELATION_CHOICE_COLUMN_WIDTH 80 #define WIDGET_AT(row, column) (((row) * COLUMNS_NR) + column) -static const char *table_titles[COLUMNS_NR] = { +static const char *table_titles[COLUMNS_NR] = +{ N_("Name"), N_("Relation") }; -static const char *RELATION_NAMES[PlayerRelation::RELATIONS_NR] = { +static const char *RELATION_NAMES[PlayerRelation::RELATIONS_NR] = +{ N_("Neutral"), N_("Friend"), N_("Disregarded"), @@ -153,9 +155,10 @@ public: virtual void updateModelInRow(int row) { gcn::DropDown *choicebox = dynamic_cast<gcn::DropDown *>( - getElementAt(row, RELATION_CHOICE_COLUMN)); + getElementAt(row, RELATION_CHOICE_COLUMN)); player_relations.setRelation(getPlayerAt(row), - static_cast<PlayerRelation::relation>(choicebox->getSelected())); + static_cast<PlayerRelation::relation>( + choicebox->getSelected())); } @@ -170,7 +173,9 @@ public: delete mPlayers; mPlayers = NULL; - for (std::vector<gcn::Widget *>::const_iterator it = mWidgets.begin(); it != mWidgets.end(); it++) { + for (std::vector<gcn::Widget *>::const_iterator it = mWidgets.begin(); + it != mWidgets.end(); it++) + { delete *it; } @@ -202,9 +207,9 @@ public: virtual std::string getElementAt(int i) { - if (i >= getNumberOfElements()) { + if (i >= getNumberOfElements()) return _("???"); - } + return (*player_relations.getPlayerIgnoreStrategies())[i]->mDescription; } }; @@ -230,11 +235,9 @@ Setup_Players::Setup_Players(): setOpaque(false); mPlayerTable->setOpaque(false); - int table_width = NAME_COLUMN_WIDTH + RELATION_CHOICE_COLUMN_WIDTH; mPlayerTableTitleModel->fixColumnWidth(NAME_COLUMN, NAME_COLUMN_WIDTH); mPlayerTableTitleModel->fixColumnWidth(RELATION_CHOICE_COLUMN, RELATION_CHOICE_COLUMN_WIDTH); - mPlayerTitleTable->setDimension(gcn::Rectangle(10, 10, table_width - 1, 10)); mPlayerTitleTable->setBackgroundColor(gcn::Color(0xbf, 0xbf, 0xbf)); gcn::ListModel *ignoreChoices = new IgnoreChoicesListModel(); @@ -256,7 +259,6 @@ Setup_Players::Setup_Players(): gcn::Label *ignore_action_label = new gcn::Label(_("When ignoring:")); - mIgnoreActionChoicesBox->setDimension(gcn::Rectangle(80, 132, 120, 12)); mIgnoreActionChoicesBox->setActionEventId(ACTION_STRATEGY); mIgnoreActionChoicesBox->addActionListener(this); @@ -289,7 +291,7 @@ Setup_Players::Setup_Players(): player_relations.addListener(this); - setDimension(gcn::Rectangle(0, 0, 290, 250)); + setDimension(gcn::Rectangle(0, 0, 325, 280)); } Setup_Players::~Setup_Players() @@ -304,9 +306,12 @@ void Setup_Players::reset() // current selection. We could use an index into the table of config // options in player_relations instead of strategies to sidestep this. int selection = 0; - for (unsigned int i = 0; i < player_relations.getPlayerIgnoreStrategies()->size(); ++i) + for (unsigned int i = 0; + i < player_relations.getPlayerIgnoreStrategies()->size(); + ++i) if ((*player_relations.getPlayerIgnoreStrategies())[i] == - player_relations.getPlayerIgnoreStrategy()) { + player_relations.getPlayerIgnoreStrategy()) + { selection = i; break; @@ -320,11 +325,14 @@ void Setup_Players::apply() player_relations.setPersistIgnores(mPersistIgnores->isSelected()); player_relations.store(); - unsigned int old_default_relations = - player_relations.getDefault() & ~(PlayerRelation::TRADE | PlayerRelation::WHISPER); + unsigned int old_default_relations = player_relations.getDefault() & + ~(PlayerRelation::TRADE | + PlayerRelation::WHISPER); player_relations.setDefault(old_default_relations - | (mDefaultTrading->isSelected()? PlayerRelation::TRADE : 0) - | (mDefaultWhisper->isSelected()? PlayerRelation::WHISPER : 0)); + | (mDefaultTrading->isSelected() ? + PlayerRelation::TRADE : 0) + | (mDefaultWhisper->isSelected() ? + PlayerRelation::WHISPER : 0)); } void Setup_Players::cancel() @@ -333,7 +341,8 @@ void Setup_Players::cancel() void Setup_Players::action(const gcn::ActionEvent &event) { - if (event.getId() == ACTION_TABLE) { + if (event.getId() == ACTION_TABLE) + { // temporarily eliminate ourselves: we are fully aware of this change, // so there is no need for asynchronous updates. (In fact, thouse // might destroy the widet that triggered them, which would be rather @@ -346,7 +355,9 @@ void Setup_Players::action(const gcn::ActionEvent &event) player_relations.addListener(this); - } else if (event.getId() == ACTION_DELETE) { + } + else if (event.getId() == ACTION_DELETE) + { int player_index = mPlayerTable->getSelectedRow(); if (player_index < 0) @@ -356,7 +367,9 @@ void Setup_Players::action(const gcn::ActionEvent &event) player_relations.removePlayer(name); - } else if (event.getId() == ACTION_STRATEGY) { + } + else if (event.getId() == ACTION_STRATEGY) + { PlayerIgnoreStrategy *s = (*player_relations.getPlayerIgnoreStrategies())[ mIgnoreActionChoicesBox->getSelected()]; |