diff options
author | Ira Rice <irarice@gmail.com> | 2009-02-04 11:46:03 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-02-04 11:46:03 -0700 |
commit | 555e68e24f2bb7d38f7ce52ce9a43198c0ccedec (patch) | |
tree | f2ceff93ed6193933165e9fbd408a1df6a8b26e1 /src/gui/skill.cpp | |
parent | 6110801764f588d0696e75645624be4869b99ee0 (diff) | |
download | mana-555e68e24f2bb7d38f7ce52ce9a43198c0ccedec.tar.gz mana-555e68e24f2bb7d38f7ce52ce9a43198c0ccedec.tar.bz2 mana-555e68e24f2bb7d38f7ce52ce9a43198c0ccedec.tar.xz mana-555e68e24f2bb7d38f7ce52ce9a43198c0ccedec.zip |
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 <irarice@gmail.com>
Diffstat (limited to 'src/gui/skill.cpp')
-rw-r--r-- | src/gui/skill.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
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 <algorithm> - #include <guichan/widgets/label.hpp> #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) { |