summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-03-02 13:42:14 +0000
committerJared Adams <jaxad0127@gmail.com>2010-03-02 13:42:14 +0000
commit0c8c8cf7ea63def0d454f30227584a5f3062c013 (patch)
tree9929ddd6c0ecaffef0d75411eeaea2f9fa7fbdfd /src/gui
parent4ff5c3b854215b1f55e70106a4c53225fc953619 (diff)
downloadmana-0c8c8cf7ea63def0d454f30227584a5f3062c013.tar.gz
mana-0c8c8cf7ea63def0d454f30227584a5f3062c013.tar.bz2
mana-0c8c8cf7ea63def0d454f30227584a5f3062c013.tar.xz
mana-0c8c8cf7ea63def0d454f30227584a5f3062c013.zip
Revert "Merge WindowContainer into Viewport and remove extra members"
This reverts commit 67e678094b9fddd21fb3c690130e772937ab2746. Conflicts: src/gui/gui.cpp src/gui/viewport.cpp
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui.cpp19
-rw-r--r--src/gui/recorder.cpp1
-rw-r--r--src/gui/skilldialog.cpp4
-rw-r--r--src/gui/specialswindow.cpp4
-rw-r--r--src/gui/statuswindow.cpp6
-rw-r--r--src/gui/viewport.cpp56
-rw-r--r--src/gui/viewport.h24
-rw-r--r--src/gui/widgets/popup.cpp23
-rw-r--r--src/gui/widgets/popup.h8
-rw-r--r--src/gui/widgets/window.cpp21
-rw-r--r--src/gui/widgets/window.h6
-rw-r--r--src/gui/widgets/windowcontainer.cpp39
-rw-r--r--src/gui/widgets/windowcontainer.h59
-rw-r--r--src/gui/windowmenu.cpp6
14 files changed, 198 insertions, 78 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index c5b77704..1e36523c 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -26,9 +26,9 @@
#include "gui/sdlinput.h"
#include "gui/skin.h"
#include "gui/truetypefont.h"
-#include "gui/viewport.h"
#include "gui/widgets/window.h"
+#include "gui/widgets/windowcontainer.h"
#include "configlistener.h"
#include "configuration.h"
@@ -92,6 +92,15 @@ Gui::Gui(Graphics *graphics):
delete mFocusHandler;
mFocusHandler = new FocusHandler;
+ // Initialize top GUI widget
+ WindowContainer *guiTop = new WindowContainer;
+ guiTop->setFocusable(true);
+ guiTop->setDimension(gcn::Rectangle(0, 0,
+ graphics->getWidth(), graphics->getHeight()));
+ guiTop->setOpaque(false);
+ Window::setWindowContainer(guiTop);
+ setTop(guiTop);
+
ResourceManager *resman = ResourceManager::getInstance();
// Set global font
@@ -124,14 +133,6 @@ Gui::Gui(Graphics *graphics):
gcn::Widget::setGlobalFont(mGuiFont);
- // Initialize top GUI widget
- Viewport *guiTop = new Viewport;
- guiTop->setFocusable(true);
- guiTop->setDimension(gcn::Rectangle(0, 0,
- graphics->getWidth(), graphics->getHeight()));
- guiTop->setOpaque(false);
- setTop(guiTop);
-
// Initialize mouse cursor and listen for changes to the option
setUseCustomCursor(config.getValue("customcursor", 1) == 1);
mConfigListener = new GuiConfigListener(this);
diff --git a/src/gui/recorder.cpp b/src/gui/recorder.cpp
index cbeb435f..257afd7f 100644
--- a/src/gui/recorder.cpp
+++ b/src/gui/recorder.cpp
@@ -27,6 +27,7 @@
#include "gui/widgets/button.h"
#include "gui/widgets/chattab.h"
#include "gui/widgets/layout.h"
+#include "gui/widgets/windowcontainer.h"
#include "utils/gettext.h"
#include "utils/stringutils.h"
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index 2c026036..d53a1867 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -26,7 +26,6 @@
#include "gui/setup.h"
#include "gui/skin.h"
-#include "gui/viewport.h"
#include "gui/widgets/button.h"
#include "gui/widgets/container.h"
@@ -37,6 +36,7 @@
#include "gui/widgets/scrollarea.h"
#include "gui/widgets/tab.h"
#include "gui/widgets/tabbedarea.h"
+#include "gui/widgets/windowcontainer.h"
#include "net/net.h"
#include "net/playerhandler.h"
@@ -188,7 +188,7 @@ SkillDialog::SkillDialog():
setCloseButton(true);
setResizable(true);
setSaveVisible(true);
- setDefaultSize(viewport->getWidth() - 280, 30, 275, 425);
+ setDefaultSize(windowContainer->getWidth() - 280, 30, 275, 425);
setupWindow->registerWindowForReset(this);
mTabs = new TabbedArea();
diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp
index 6b5d9afd..3ca0f037 100644
--- a/src/gui/specialswindow.cpp
+++ b/src/gui/specialswindow.cpp
@@ -25,7 +25,6 @@
#include "gui/setup.h"
#include "gui/skin.h"
-#include "gui/viewport.h"
#include "gui/widgets/button.h"
#include "gui/widgets/container.h"
@@ -38,6 +37,7 @@
#include "gui/widgets/tab.h"
#include "gui/widgets/tabbedarea.h"
#include "gui/widgets/flowcontainer.h"
+#include "gui/widgets/windowcontainer.h"
#include "net/net.h"
#include "net/specialhandler.h"
@@ -88,7 +88,7 @@ SpecialsWindow::SpecialsWindow():
setCloseButton(true);
setResizable(true);
setSaveVisible(true);
- setDefaultSize(viewport->getWidth() - 280, 30, 275, 425);
+ setDefaultSize(windowContainer->getWidth() - 280, 30, 275, 425);
setupWindow->registerWindowForReset(this);
mTabs = new TabbedArea();
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index 48e0ef93..7ea2cf18 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -26,7 +26,6 @@
#include "gui/ministatus.h"
#include "gui/setup.h"
-#include "gui/viewport.h"
#include "gui/widgets/button.h"
#include "gui/widgets/label.h"
@@ -34,6 +33,7 @@
#include "gui/widgets/progressbar.h"
#include "gui/widgets/scrollarea.h"
#include "gui/widgets/vertcontainer.h"
+#include "gui/widgets/windowcontainer.h"
#include "net/net.h"
#include "net/playerhandler.h"
@@ -89,8 +89,8 @@ StatusWindow::StatusWindow():
setResizable(true);
setCloseButton(true);
setSaveVisible(true);
- setDefaultSize((viewport->getWidth() - 365) / 2,
- (viewport->getHeight() - 255) / 2, 365, 275);
+ setDefaultSize((windowContainer->getWidth() - 365) / 2,
+ (windowContainer->getHeight() - 255) / 2, 365, 275);
// ----------------------
// Status Part
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index a36f91cf..73dee40b 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -43,20 +43,20 @@
#include "resources/monsterinfo.h"
#include "resources/resourcemanager.h"
-#include "utils/dtor.h"
#include "utils/stringutils.h"
extern volatile int tick_time;
-Viewport *viewport = NULL;
-
Viewport::Viewport():
mMap(0),
mMouseX(0),
mMouseY(0),
mPixelViewX(0.0f),
mPixelViewY(0.0f),
+ mTileViewX(0),
+ mTileViewY(0),
mShowDebugPath(false),
+ mVisibleNames(false),
mPlayerFollowMouse(false),
mLocalWalkTime(-1)
{
@@ -67,11 +67,11 @@ Viewport::Viewport():
mScrollRadius = (int) config.getValue("ScrollRadius", 0);
mScrollCenterOffsetX = (int) config.getValue("ScrollCenterOffsetX", 0);
mScrollCenterOffsetY = (int) config.getValue("ScrollCenterOffsetY", 0);
+ mVisibleNames = config.getValue("visiblenames", 1);
config.addListener("ScrollLaziness", this);
config.addListener("ScrollRadius", this);
-
- viewport = this;
+ config.addListener("visiblenames", this);
mPopupMenu = new PopupMenu;
mBeingPopup = new BeingPopup;
@@ -82,6 +82,8 @@ Viewport::Viewport():
Viewport::~Viewport()
{
delete mPopupMenu;
+
+ config.removeListener("visiblenames", this);
}
void Viewport::setMap(Map *map)
@@ -104,14 +106,15 @@ void Viewport::draw(gcn::Graphics *gcnGraphics)
gcnGraphics->setColor(gcn::Color(64, 64, 64));
gcnGraphics->fillRectangle(
gcn::Rectangle(0, 0, getWidth(), getHeight()));
-
- // Draw contained widgets
- Container::draw(gcnGraphics);
return;
}
Graphics *graphics = static_cast<Graphics*>(gcnGraphics);
+ // Ensure the client doesn't freak out if a feature localplayer uses
+ // is dependent on a map.
+ player_node->setMapInitialized(true);
+
// Avoid freaking out when tick_time overflows
if (tick_time < lastTick)
{
@@ -183,6 +186,9 @@ void Viewport::draw(gcn::Graphics *gcnGraphics)
mPixelViewY = viewYmax;
}
+ mTileViewX = (int) (mPixelViewX + 16) / 32;
+ mTileViewY = (int) (mPixelViewY + 16) / 32;
+
// Draw tiles and sprites
if (mMap)
{
@@ -224,22 +230,16 @@ void Viewport::draw(gcn::Graphics *gcnGraphics)
miniStatusWindow->drawIcons(graphics);
// Draw contained widgets
- Container::draw(gcnGraphics);
+ WindowContainer::draw(gcnGraphics);
}
void Viewport::logic()
{
- delete_all(mDeathList);
- mDeathList.clear();
-
- if (mMap)
- {
- // Make the player follow the mouse position
- // if the mouse is dragged elsewhere than in a window.
- _followMouse();
- }
+ WindowContainer::logic();
- gcn::Container::logic();
+ // Make the player follow the mouse position
+ // if the mouse is dragged elsewhere than in a window.
+ _followMouse();
}
void Viewport::_followMouse()
@@ -425,8 +425,8 @@ void Viewport::mouseDragged(gcn::MouseEvent &event)
if (mLocalWalkTime != player_node->getWalkTime())
{
mLocalWalkTime = player_node->getWalkTime();
- int destX = (event.getX() + mPixelViewX) / mMap->getTileWidth();
- int destY = (event.getY() + mPixelViewY) / mMap->getTileHeight();
+ int destX = event.getX() / 32 + mTileViewX;
+ int destY = event.getY() / 32 + mTileViewY;
player_node->setDestination(destX, destY);
}
}
@@ -456,6 +456,9 @@ void Viewport::optionChanged(const std::string &name)
{
mScrollLaziness = (int) config.getValue("ScrollLaziness", 32);
mScrollRadius = (int) config.getValue("ScrollRadius", 32);
+
+ if (name == "visiblenames")
+ mVisibleNames = config.getValue("visiblenames", 1);
}
void Viewport::mouseMoved(gcn::MouseEvent &event)
@@ -468,10 +471,8 @@ void Viewport::mouseMoved(gcn::MouseEvent &event)
const int y = (event.getY() + (int) mPixelViewY);
mHoverBeing = beingManager->findBeingByPixel(x, y);
- if (mHoverBeing && mHoverBeing->getType() == Being::PLAYER &&
- event.getSource() == this)
- mBeingPopup->show(getMouseX(), getMouseY(),
- static_cast<Player*>(mHoverBeing));
+ if (Player *p = dynamic_cast<Player*>(mHoverBeing))
+ mBeingPopup->show(getMouseX(), getMouseY(), p);
else
mBeingPopup->setVisible(false);
@@ -522,8 +523,3 @@ void Viewport::hideBeingPopup()
{
mBeingPopup->setVisible(false);
}
-
-void Viewport::scheduleDelete(gcn::Widget *widget)
-{
- mDeathList.push_back(widget);
-}
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index 196070f1..3fab607d 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -25,7 +25,7 @@
#include "configlistener.h"
#include "position.h"
-#include "gui/widgets/container.h"
+#include "gui/widgets/windowcontainer.h"
#include <guichan/mouselistener.hpp>
@@ -50,7 +50,7 @@ const int walkingMouseDelay = 500;
* of it such as NPC messages, which are positioned using map pixel
* coordinates.
*/
-class Viewport : public Container, public gcn::MouseListener,
+class Viewport : public WindowContainer, public gcn::MouseListener,
public ConfigListener
{
public:
@@ -157,12 +157,6 @@ class Viewport : public Container, public gcn::MouseListener,
*/
void hideBeingPopup();
- /**
- * Schedule a widget for deletion. It will be deleted at the start of
- * the next logic update.
- */
- void scheduleDelete(gcn::Widget *widget);
-
private:
/**
* Finds a path from the player to the mouse, and draws it. This is for
@@ -180,13 +174,6 @@ class Viewport : public Container, public gcn::MouseListener,
*/
void _followMouse();
- /**
- * List of widgets that are scheduled to be deleted.
- */
- typedef std::list<gcn::Widget*> Widgets;
- typedef Widgets::iterator WidgetIterator;
- Widgets mDeathList;
-
Map *mMap; /**< The current map. */
int mScrollRadius;
@@ -197,7 +184,10 @@ class Viewport : public Container, public gcn::MouseListener,
int mMouseY; /**< Current mouse position in pixels. */
float mPixelViewX; /**< Current viewpoint in pixels. */
float mPixelViewY; /**< Current viewpoint in pixels. */
+ int mTileViewX; /**< Current viewpoint in tiles. */
+ int mTileViewY; /**< Current viewpoint in tiles. */
int mShowDebugPath; /**< Show a path from player to pointer. */
+ bool mVisibleNames; /**< Show target names. */
bool mPlayerFollowMouse;
@@ -206,9 +196,9 @@ class Viewport : public Container, public gcn::MouseListener,
PopupMenu *mPopupMenu; /**< Popup menu. */
Being *mHoverBeing; /**< Being mouse is currently over. */
FloorItem *mHoverItem; /**< FloorItem mouse is currently over. */
- BeingPopup *mBeingPopup; /**< Being information popup. */
+ BeingPopup *mBeingPopup;
};
-extern Viewport *viewport; /**< The viewport. */
+extern Viewport *viewport; /**< The viewport */
#endif
diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp
index 1bfd7fd2..970b21ec 100644
--- a/src/gui/widgets/popup.cpp
+++ b/src/gui/widgets/popup.cpp
@@ -29,6 +29,8 @@
#include "gui/skin.h"
#include "gui/viewport.h"
+#include "gui/widgets/windowcontainer.h"
+
#include "resources/image.h"
#include <guichan/exception.hpp>
@@ -43,16 +45,16 @@ Popup::Popup(const std::string &name, const std::string &skin):
{
logger->log("Popup::Popup(\"%s\")", name.c_str());
- if (!viewport)
- throw GCN_EXCEPTION("Popup::Popup(): no viewport set");
+ if (!windowContainer)
+ throw GCN_EXCEPTION("Popup::Popup(): no windowContainer set");
setPadding(3);
// Loads the skin
mSkin = SkinLoader::instance()->load(skin, mDefaultSkinPath);
- // Add this window to the viewport
- viewport->add(this);
+ // Add this window to the window container
+ windowContainer->add(this);
// Popups are invisible by default
setVisible(false);
@@ -67,6 +69,11 @@ Popup::~Popup()
mSkin->instances--;
}
+void Popup::setWindowContainer(WindowContainer *wc)
+{
+ windowContainer = wc;
+}
+
void Popup::loadPopupConfiguration()
{
if (mPopupName.empty())
@@ -161,7 +168,7 @@ void Popup::setMaxHeight(int height)
void Popup::scheduleDelete()
{
- viewport->scheduleDelete(this);
+ windowContainer->scheduleDelete(this);
}
void Popup::position(int x, int y)
@@ -180,3 +187,9 @@ void Popup::position(int x, int y)
setVisible(true);
requestMoveToTop();
}
+
+void Popup::mouseMoved(gcn::MouseEvent &event)
+{
+ if (viewport)
+ viewport->hideBeingPopup();
+}
diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h
index dfa9b2fa..5c9164f6 100644
--- a/src/gui/widgets/popup.h
+++ b/src/gui/widgets/popup.h
@@ -31,6 +31,7 @@
#include <guichan/mouselistener.hpp>
class Skin;
+class WindowContainer;
/**
* A light version of the Window class. Particularly suited for popup type
@@ -64,6 +65,11 @@ class Popup : public Container, public gcn::MouseListener
~Popup();
/**
+ * Sets the window container to be used by new popups.
+ */
+ static void setWindowContainer(WindowContainer *windowContainer);
+
+ /**
* Changes the popup's skin to use the skin defined in the saved
* configuration file.
*/
@@ -90,6 +96,8 @@ class Popup : public Container, public gcn::MouseListener
*/
void setLocationRelativeTo(gcn::Widget *widget);
+ void mouseMoved(gcn::MouseEvent &event);
+
/**
* Sets the minimum width of the popup.
*/
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 4d70df84..83c918cf 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -31,6 +31,7 @@
#include "gui/widgets/layout.h"
#include "gui/widgets/resizegrip.h"
+#include "gui/widgets/windowcontainer.h"
#include "resources/image.h"
@@ -62,8 +63,8 @@ Window::Window(const std::string &caption, bool modal, Window *parent,
{
logger->log("Window::Window(\"%s\")", caption.c_str());
- if (!viewport)
- throw GCN_EXCEPTION("Window::Window(): no viewport set");
+ if (!windowContainer)
+ throw GCN_EXCEPTION("Window::Window(): no windowContainer set");
instances++;
@@ -74,8 +75,8 @@ Window::Window(const std::string &caption, bool modal, Window *parent,
// Loads the skin
mSkin = SkinLoader::instance()->load(skin, mDefaultSkinPath);
- // Add this window to the viewport
- viewport->add(this);
+ // Add this window to the window container
+ windowContainer->add(this);
if (mModal)
{
@@ -87,8 +88,6 @@ Window::Window(const std::string &caption, bool modal, Window *parent,
setVisible(false);
addWidgetListener(this);
-
- setFocusable(true);
}
Window::~Window()
@@ -109,6 +108,11 @@ Window::~Window()
mSkin->instances--;
}
+void Window::setWindowContainer(WindowContainer *wc)
+{
+ windowContainer = wc;
+}
+
void Window::draw(gcn::Graphics *graphics)
{
Graphics *g = static_cast<Graphics*>(graphics);
@@ -332,7 +336,7 @@ void Window::setVisible(bool visible, bool forceSticky)
void Window::scheduleDelete()
{
- viewport->scheduleDelete(this);
+ windowContainer->scheduleDelete(this);
}
void Window::mousePressed(gcn::MouseEvent &event)
@@ -427,6 +431,9 @@ void Window::mouseMoved(gcn::MouseEvent &event)
default:
gui->setCursorType(Gui::CURSOR_POINTER);
}
+
+ if (viewport)
+ viewport->hideBeingPopup();
}
void Window::mouseDragged(gcn::MouseEvent &event)
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index 3c458efe..b72be9d4 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -34,6 +34,7 @@ class Layout;
class LayoutCell;
class ResizeGrip;
class Skin;
+class WindowContainer;
/**
* A window. This window can be dragged around and has a title bar. Windows are
@@ -64,6 +65,11 @@ class Window : public gcn::Window, gcn::WidgetListener
~Window();
/**
+ * Sets the window container to be used by new windows.
+ */
+ static void setWindowContainer(WindowContainer *windowContainer);
+
+ /**
* Draws the window.
*/
void draw(gcn::Graphics *graphics);
diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp
new file mode 100644
index 00000000..7d5ecd37
--- /dev/null
+++ b/src/gui/widgets/windowcontainer.cpp
@@ -0,0 +1,39 @@
+/*
+ * The Mana Client
+ * Copyright (C) 2004-2009 The Mana World Development Team
+ * Copyright (C) 2009-2010 The Mana Developers
+ *
+ * This file is part of The Mana Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "gui/widgets/windowcontainer.h"
+
+#include "utils/dtor.h"
+
+WindowContainer *windowContainer = NULL;
+
+void WindowContainer::logic()
+{
+ delete_all(mDeathList);
+ mDeathList.clear();
+
+ gcn::Container::logic();
+}
+
+void WindowContainer::scheduleDelete(gcn::Widget *widget)
+{
+ mDeathList.push_back(widget);
+}
diff --git a/src/gui/widgets/windowcontainer.h b/src/gui/widgets/windowcontainer.h
new file mode 100644
index 00000000..2ec65d15
--- /dev/null
+++ b/src/gui/widgets/windowcontainer.h
@@ -0,0 +1,59 @@
+/*
+ * The Mana Client
+ * Copyright (C) 2004-2009 The Mana World Development Team
+ * Copyright (C) 2009-2010 The Mana Developers
+ *
+ * This file is part of The Mana Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef WINDOWCONTAINER_H
+#define WINDOWCONTAINER_H
+
+#include "gui/widgets/container.h"
+
+/**
+ * A window container. This container adds functionality for more convenient
+ * widget (windows in particular) destruction.
+ *
+ * \ingroup GUI
+ */
+class WindowContainer : public Container
+{
+ public:
+ /**
+ * Do GUI logic. This functions adds automatic deletion of objects that
+ * volunteered to be deleted.
+ */
+ void logic();
+
+ /**
+ * Schedule a widget for deletion. It will be deleted at the start of
+ * the next logic update.
+ */
+ void scheduleDelete(gcn::Widget *widget);
+
+ private:
+ /**
+ * List of widgets that are scheduled to be deleted.
+ */
+ typedef std::list<gcn::Widget*> Widgets;
+ typedef Widgets::iterator WidgetIterator;
+ Widgets mDeathList;
+};
+
+extern WindowContainer *windowContainer;
+
+#endif
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 1a497588..81e96fb2 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -24,10 +24,10 @@
#include "graphics.h"
#include "gui/emotepopup.h"
-#include "gui/viewport.h"
#include "gui/widgets/button.h"
#include "gui/widgets/window.h"
+#include "gui/widgets/windowcontainer.h"
#include "net/net.h"
#include "net/playerhandler.h"
@@ -103,7 +103,7 @@ void WindowMenu::action(const gcn::ActionEvent &event)
}
else
{
- viewport->scheduleDelete(mEmotePopup);
+ windowContainer->scheduleDelete(mEmotePopup);
mEmotePopup = 0;
}
}
@@ -158,7 +158,7 @@ void WindowMenu::valueChanged(const gcn::SelectionEvent &event)
if (emote)
Net::getPlayerHandler()->emote(emote);
- viewport->scheduleDelete(mEmotePopup);
+ windowContainer->scheduleDelete(mEmotePopup);
mEmotePopup = 0;
}
}