From 33ef923235aeabd07308816bb07ef790cc6c1024 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 31 Jul 2014 23:20:54 +0300 Subject: Move popup related code from viewport into popupManager. --- src/gui/windows/chatwindow.cpp | 6 +++--- src/gui/windows/equipmentwindow.cpp | 8 ++++---- src/gui/windows/inventorywindow.cpp | 6 +++--- src/gui/windows/minimap.cpp | 5 +++-- src/gui/windows/ministatuswindow.cpp | 9 +++------ src/gui/windows/npcdialog.cpp | 5 +++-- src/gui/windows/outfitwindow.cpp | 6 +++--- src/gui/windows/whoisonline.cpp | 10 +++++----- 8 files changed, 27 insertions(+), 28 deletions(-) (limited to 'src/gui/windows') diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 3bf1366f5..2cee38db7 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -43,8 +43,8 @@ #include "gui/chatconsts.h" #include "gui/focushandler.h" #include "gui/gui.h" +#include "gui/popupmanager.h" #include "gui/skin.h" -#include "gui/viewport.h" #include "gui/models/colorlistmodel.h" @@ -657,7 +657,7 @@ void ChatWindow::mousePressed(MouseEvent &event) if (event.getButton() == MouseButton::RIGHT) { - if (viewport) + if (popupManager) { Tab *const tab = mChatTabs->getSelectedTab(); if (tab) @@ -674,7 +674,7 @@ void ChatWindow::mousePressed(MouseEvent &event) { ChatTab *const cTab = dynamic_cast(tab); if (cTab) - viewport->showChatPopup(cTab); + popupManager->showChatPopup(cTab); } } } diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index 8a558236a..a760f49c8 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -32,7 +32,7 @@ #include "being/localplayer.h" #include "being/playerinfo.h" -#include "gui/viewport.h" +#include "gui/popupmanager.h" #include "gui/fonts/font.h" @@ -358,13 +358,13 @@ void EquipmentWindow::mousePressed(MouseEvent& event) */ const int mx = x + getX(); const int my = y + getY(); - if (viewport) + if (popupManager) { event.consume(); if (mForing) - viewport->showUndressPopup(mx, my, mBeing, item); + popupManager->showUndressPopup(mx, my, mBeing, item); else - viewport->showPopup(this, mx, my, item, true); + popupManager->showPopup(this, mx, my, item, true); return; } } diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index bd7a50674..5d12c95d4 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -34,7 +34,7 @@ #include "input/inputmanager.h" #include "gui/gui.h" -#include "gui/viewport.h" +#include "gui/popupmanager.h" #include "gui/fonts/font.h" @@ -467,8 +467,8 @@ void InventoryWindow::mouseClicked(MouseEvent &event) const int mx = event.getX() + getX(); const int my = event.getY() + getY(); - if (viewport) - viewport->showPopup(this, mx, my, item, isMainInventory()); + if (popupManager) + popupManager->showPopup(this, mx, my, item, isMainInventory()); } if (!mInventory) diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index f8eaddd4b..615db0d85 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -29,6 +29,7 @@ #include "being/localplayer.h" +#include "gui/popupmanager.h" #include "gui/viewport.h" #include "gui/popups/textpopup.h" @@ -442,7 +443,7 @@ void Minimap::mouseReleased(MouseEvent &event) { Window::mouseReleased(event); - if (!localPlayer || !viewport) + if (!localPlayer || !popupManager) return; if (event.getButton() == MouseButton::LEFT) @@ -458,7 +459,7 @@ void Minimap::mouseReleased(MouseEvent &event) int x = event.getX(); int y = event.getY(); screenToMap(x, y); - viewport->showMapPopup(x, y); + popupManager->showMapPopup(x, y); } } diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 61d3f4cab..6536617f3 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -30,8 +30,8 @@ #include "being/localplayer.h" #include "being/playerinfo.h" +#include "gui/popupmanager.h" #include "gui/skin.h" -#include "gui/viewport.h" #include "gui/popups/textpopup.h" @@ -443,9 +443,6 @@ void MiniStatusWindow::mouseMoved(MouseEvent &event) void MiniStatusWindow::mousePressed(MouseEvent &event) { - if (!viewport) - return; - if (event.getButton() == MouseButton::RIGHT) { const ProgressBar *const bar = dynamic_cast( @@ -453,9 +450,9 @@ void MiniStatusWindow::mousePressed(MouseEvent &event) if (!bar) return; event.consume(); - if (viewport) + if (popupManager) { - viewport->showPopup(getX() + event.getX(), + popupManager->showPopup(getX() + event.getX(), getY() + event.getY(), bar); } } diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index aab395a85..d11dca0a9 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -33,6 +33,7 @@ #include "being/being.h" #include "gui/gui.h" +#include "gui/popupmanager.h" #include "gui/viewport.h" #include "gui/fonts/font.h" @@ -947,8 +948,8 @@ void NpcDialog::mousePressed(MouseEvent &event) && event.getSource() == mTextBox) { event.consume(); - if (viewport) - viewport->showNpcDialogPopup(mNpcId); + if (popupManager) + popupManager->showNpcDialogPopup(mNpcId); } } diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp index 85522ade1..82ce553f7 100644 --- a/src/gui/windows/outfitwindow.cpp +++ b/src/gui/windows/outfitwindow.cpp @@ -33,7 +33,7 @@ #include "input/inputmanager.h" -#include "gui/viewport.h" +#include "gui/popupmanager.h" #include "gui/windows/setupwindow.h" @@ -422,9 +422,9 @@ void OutfitWindow::mousePressed(MouseEvent &event) const int index = getIndexFromGrid(event.getX(), event.getY()); if (index == -1) { - if (event.getButton() == MouseButton::RIGHT && viewport) + if (event.getButton() == MouseButton::RIGHT && popupManager) { - viewport->showOutfitsPopup(); + popupManager->showOutfitsPopup(); event.consume(); } else diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index fc4c8cbc4..f19f2662c 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -30,7 +30,7 @@ #include "settings.h" #include "gui/onlineplayer.h" -#include "gui/viewport.h" +#include "gui/popupmanager.h" #include "gui/windows/chatwindow.h" #include "gui/windows/setupwindow.h" @@ -197,7 +197,7 @@ void WhoIsOnline::handleLink(const std::string& link, MouseEvent *event) if (localPlayer && link == localPlayer->getName()) return; - if (viewport) + if (popupManager) { if (actorManager) { @@ -205,13 +205,13 @@ void WhoIsOnline::handleLink(const std::string& link, MouseEvent *event) Being *const being = actorManager->findBeingByName( text, ActorType::PLAYER); - if (being && viewport) + if (being && popupManager) { - viewport->showPopup(being); + popupManager->showPopup(being); return; } } - viewport->showPlayerPopup(link); + popupManager->showPlayerPopup(link); } } } -- cgit v1.2.3-70-g09d2