From 4129e2ef64e5c81f93009d98e50436c1b4d93016 Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Sun, 17 Aug 2014 16:11:42 +0300
Subject: Use public spell popup in spellshortcutcontainer.

---
 src/gui/widgets/spellshortcutcontainer.cpp | 22 +++++++++-------------
 src/gui/widgets/spellshortcutcontainer.h   |  1 -
 2 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index 164513d73..1ddf17981 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -46,12 +46,9 @@
 SpellShortcutContainer::SpellShortcutContainer(Widget2 *const widget,
                                                const unsigned number) :
     ShortcutContainer(widget),
-    mSpellPopup(new SpellPopup),
     mNumber(number),
     mSpellClicked(false)
 {
-    mSpellPopup->postInit();
-
     if (spellShortcut)
         mMaxItems = spellShortcut->getSpellsCount();
     else
@@ -60,7 +57,6 @@ SpellShortcutContainer::SpellShortcutContainer(Widget2 *const widget,
 
 SpellShortcutContainer::~SpellShortcutContainer()
 {
-    delete2(mSpellPopup);
 }
 
 void SpellShortcutContainer::setWidget2(const Widget2 *const widget)
@@ -273,7 +269,7 @@ void SpellShortcutContainer::mouseReleased(MouseEvent &event)
 // Show ItemTooltip
 void SpellShortcutContainer::mouseMoved(MouseEvent &event)
 {
-    if (!mSpellPopup || !spellShortcut || !spellManager)
+    if (!spellPopup || !spellShortcut || !spellManager)
         return;
 
     const int index = getIndexFromGrid(event.getX(), event.getY());
@@ -282,29 +278,29 @@ void SpellShortcutContainer::mouseMoved(MouseEvent &event)
         return;
 
     const int itemId = getItemByIndex(index);
-    mSpellPopup->setVisible(false);
+    spellPopup->setVisible(false);
     const TextCommand *const spell = spellManager->getSpell(itemId);
     if (spell && !spell->isEmpty())
     {
-        mSpellPopup->setItem(spell);
-        mSpellPopup->view(viewport->getMouseX(), viewport->getMouseY());
+        spellPopup->setItem(spell);
+        spellPopup->view(viewport->getMouseX(), viewport->getMouseY());
     }
     else
     {
-        mSpellPopup->setVisible(false);
+        spellPopup->setVisible(false);
     }
 }
 
 void SpellShortcutContainer::mouseExited(MouseEvent &event A_UNUSED)
 {
-    if (mSpellPopup)
-        mSpellPopup->setVisible(false);
+    if (spellPopup)
+        spellPopup->setVisible(false);
 }
 
 void SpellShortcutContainer::widgetHidden(const Event &event A_UNUSED)
 {
-    if (mSpellPopup)
-        mSpellPopup->setVisible(false);
+    if (spellPopup)
+        spellPopup->setVisible(false);
 }
 
 int SpellShortcutContainer::getItemByIndex(const int index) const
diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h
index ba192d4bc..939e315af 100644
--- a/src/gui/widgets/spellshortcutcontainer.h
+++ b/src/gui/widgets/spellshortcutcontainer.h
@@ -79,7 +79,6 @@ class SpellShortcutContainer final : public ShortcutContainer
         int getItemByIndex(const int index) const A_WARN_UNUSED;
 
     private:
-        SpellPopup *mSpellPopup;
         unsigned int mNumber;
         bool mSpellClicked;
 };
-- 
cgit v1.2.3-70-g09d2