summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-03-10 20:20:36 +0300
committerAndrei Karas <akaras@inbox.ru>2012-03-10 20:20:36 +0300
commit501f9934731114562c3659918d9d7b39625eb7b5 (patch)
treeafefc8debeff97d40141a342135da8e7ab5cb9bb /src/gui/widgets
parent307818fecbd1f258c668a1667e76e950e9d22622 (diff)
downloadmv-501f9934731114562c3659918d9d7b39625eb7b5.tar.gz
mv-501f9934731114562c3659918d9d7b39625eb7b5.tar.bz2
mv-501f9934731114562c3659918d9d7b39625eb7b5.tar.xz
mv-501f9934731114562c3659918d9d7b39625eb7b5.zip
Allow add skills to shortcuts bar (same as for magic and script commands).
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/itemcontainer.cpp2
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp29
2 files changed, 25 insertions, 6 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 669d05a66..6438f5deb 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -293,6 +293,8 @@ void ItemContainer::selectNone()
outfitWindow->setItemSelected(-1);
if (shopWindow)
shopWindow->setItemSelected(-1);
+// if (skillDialog)
+// skillDialog->setItemSelected(-1);
}
void ItemContainer::setSelectedIndex(int newIndex)
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 130d641fe..1c15ccf2b 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -37,6 +37,7 @@
#include "gui/inventorywindow.h"
#include "gui/itempopup.h"
#include "gui/palette.h"
+#include "gui/skilldialog.h"
#include "gui/spellpopup.h"
#include "gui/theme.h"
#include "gui/viewport.h"
@@ -165,7 +166,7 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics)
}
}
}
- else if (spellManager) // this is magic shortcut
+ else if (itemId < SKILL_MIN_ID && spellManager) // this is magic shortcut
{
TextCommand *spell = spellManager->getSpellByItem(itemId);
if (spell)
@@ -185,7 +186,15 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics)
itemY + mBoxHeight / 2, gcn::Graphics::LEFT);
}
}
-
+ else if (skillDialog)
+ {
+ SkillInfo *skill = skillDialog->getSkill(itemId - SKILL_MIN_ID);
+ if (skill)
+ {
+ g->drawText(skill->shortName, itemX + 2,
+ itemY + mBoxHeight / 2, gcn::Graphics::LEFT);
+ }
+ }
}
if (mItemMoved)
@@ -239,12 +248,16 @@ void ItemShortcutContainer::mouseDragged(gcn::MouseEvent &event)
itemShortcut[mNumber]->removeItem(index);
}
}
- else if (spellManager)
+ else if (itemId < SKILL_MIN_ID && spellManager)
{
TextCommand *spell = spellManager->getSpellByItem(itemId);
if (spell)
itemShortcut[mNumber]->removeItem(index);
}
+ else
+ {
+ itemShortcut[mNumber]->removeItem(index);
+ }
}
if (mItemMoved)
{
@@ -268,8 +281,8 @@ void ItemShortcutContainer::mousePressed(gcn::MouseEvent &event)
{
// Stores the selected item if theirs one.
if (itemShortcut[mNumber]->isItemSelected() &&
- (inventoryWindow && (inventoryWindow->isVisible() ||
- itemShortcut[mNumber]->getSelectedItem() >= SPELL_MIN_ID)))
+ inventoryWindow && (inventoryWindow->isVisible() ||
+ itemShortcut[mNumber]->getSelectedItem() >= SPELL_MIN_ID))
{
itemShortcut[mNumber]->setItem(index);
itemShortcut[mNumber]->setItemSelected(-1);
@@ -359,7 +372,7 @@ void ItemShortcutContainer::mouseMoved(gcn::MouseEvent &event)
mItemPopup->setVisible(false);
}
}
- else if (spellManager)
+ else if (itemId < SKILL_MIN_ID && spellManager)
{
mItemPopup->setVisible(false);
TextCommand *spell = spellManager->getSpellByItem(itemId);
@@ -373,6 +386,10 @@ void ItemShortcutContainer::mouseMoved(gcn::MouseEvent &event)
mSpellPopup->setVisible(false);
}
}
+ else if (skillDialog)
+ {
+ mItemPopup->setVisible(false);
+ }
}
// Hide ItemTooltip