diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-17 13:40:14 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-17 13:40:14 +0300 |
commit | 2cb9f5c3d47077a459fabf15800b1c45cfdacb3a (patch) | |
tree | ad6eba1142495acd31dc8a50b56988a26350f2d5 /src | |
parent | 829cd57e021ea85cffdbd3f3a7b18da835e00b7c (diff) | |
download | plus-2cb9f5c3d47077a459fabf15800b1c45cfdacb3a.tar.gz plus-2cb9f5c3d47077a459fabf15800b1c45cfdacb3a.tar.bz2 plus-2cb9f5c3d47077a459fabf15800b1c45cfdacb3a.tar.xz plus-2cb9f5c3d47077a459fabf15800b1c45cfdacb3a.zip |
Remove proxy methods used for access popup menu.
Diffstat (limited to 'src')
-rw-r--r-- | src/actionmanager.cpp | 7 | ||||
-rw-r--r-- | src/gui/popupmanager.cpp | 181 | ||||
-rw-r--r-- | src/gui/popupmanager.h | 92 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 14 | ||||
-rw-r--r-- | src/gui/widgets/avatarlistbox.cpp | 26 | ||||
-rw-r--r-- | src/gui/widgets/dropshortcutcontainer.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/itemlinkhandler.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/itemshortcutcontainer.cpp | 7 | ||||
-rw-r--r-- | src/gui/widgets/shoplistbox.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/spellshortcutcontainer.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/textfield.cpp | 12 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 8 | ||||
-rw-r--r-- | src/gui/windowmenu.cpp | 5 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 11 | ||||
-rw-r--r-- | src/gui/windows/equipmentwindow.cpp | 9 | ||||
-rw-r--r-- | src/gui/windows/inventorywindow.cpp | 5 | ||||
-rw-r--r-- | src/gui/windows/minimap.cpp | 5 | ||||
-rw-r--r-- | src/gui/windows/ministatuswindow.cpp | 6 | ||||
-rw-r--r-- | src/gui/windows/npcdialog.cpp | 10 | ||||
-rw-r--r-- | src/gui/windows/outfitwindow.cpp | 8 | ||||
-rw-r--r-- | src/gui/windows/whoisonline.cpp | 13 |
21 files changed, 133 insertions, 322 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp index 004c997f9..0c9d75b5b 100644 --- a/src/actionmanager.cpp +++ b/src/actionmanager.cpp @@ -42,6 +42,8 @@ #include "gui/sdlinput.h" #include "gui/viewport.h" +#include "gui/popups/popupmenu.h" + #include "gui/windows/skilldialog.h" #include "gui/windows/socialwindow.h" #include "gui/windows/statuswindow.h" @@ -1122,9 +1124,10 @@ impHandler0(showKeyboard) impHandler0(showWindows) { - if (popupManager) + if (popupMenu) { - popupManager->showWindowsPopup(); + popupMenu->showWindowsPopup(viewport->getMouseX(), + viewport->getMouseY()); return true; } return false; diff --git a/src/gui/popupmanager.cpp b/src/gui/popupmanager.cpp index 8f5dbdb0c..dc9bdc32f 100644 --- a/src/gui/popupmanager.cpp +++ b/src/gui/popupmanager.cpp @@ -50,187 +50,6 @@ PopupManager::~PopupManager() delete2(mTextPopup); } -void PopupManager::showPopup(Window *const parent, - const int x, const int y, - Item *const item, - const bool isInventory) -{ - popupMenu->showPopup(parent, x, y, item, isInventory); -} - -void PopupManager::showPopup(MapItem *const item) -{ - popupMenu->showPopup(viewport->getMouseX(), viewport->getMouseY(), item); -} - -void PopupManager::showPopup(Window *const parent, - Item *const item, - const bool isInventory) -{ - popupMenu->showPopup(parent, viewport->getMouseX(), viewport->getMouseY(), - item, isInventory); -} - -void PopupManager::showPopup(const int x, const int y, - const std::vector<ActorSprite*> &beings) -{ - popupMenu->showPopup(x, y, beings); -} - -void PopupManager::showPopup(const int x, const int y, - const FloorItem *const floorItem) -{ - popupMenu->showPopup(x, y, floorItem); -} - -void PopupManager::showPopup(const int x, const int y, MapItem *const mapItem) -{ - popupMenu->showPopup(x, y, mapItem); -} - -void PopupManager::showItemPopup(Item *const item) -{ - popupMenu->showItemPopup(viewport->getMouseX(), viewport->getMouseY(), - item); -} - -void PopupManager::showItemPopup(const int itemId, - const unsigned char color) -{ - popupMenu->showItemPopup(viewport->getMouseX(), viewport->getMouseY(), - itemId, color); -} - -void PopupManager::showDropPopup(Item *const item) -{ - popupMenu->showDropPopup(viewport->getMouseX(), viewport->getMouseY(), - item); -} - -void PopupManager::showOutfitsPopup(const int x, const int y) -{ - popupMenu->showOutfitsPopup(x, y); -} - -void PopupManager::showOutfitsPopup() -{ - popupMenu->showOutfitsPopup(viewport->getMouseX(), viewport->getMouseY()); -} - -void PopupManager::showSpellPopup(TextCommand *const cmd) -{ - popupMenu->showSpellPopup(viewport->getMouseX(), viewport->getMouseY(), - cmd); -} - -void PopupManager::showChatPopup(const int x, const int y, - ChatTab *const tab) -{ - popupMenu->showChatPopup(x, y, tab); -} - -void PopupManager::showChatPopup(ChatTab *const tab) -{ - popupMenu->showChatPopup(viewport->getMouseX(), viewport->getMouseY(), - tab); -} - -void PopupManager::showPopup(const int x, const int y, - const Being *const being) -{ - popupMenu->showPopup(x, y, being); -} - -void PopupManager::showPopup(const Being *const being) -{ - popupMenu->showPopup(viewport->getMouseX(), viewport->getMouseY(), being); -} - -void PopupManager::showPlayerPopup(const std::string &nick) -{ - popupMenu->showPlayerPopup(viewport->getMouseX(), viewport->getMouseY(), - nick); -} - -void PopupManager::showPopup(const int x, const int y, - Button *const button) -{ - popupMenu->showPopup(x, y, button); -} - -void PopupManager::showPopup(const int x, const int y, - const ProgressBar *const bar) -{ - popupMenu->showPopup(x, y, bar); -} - -void PopupManager::showAttackMonsterPopup(const std::string &name, - const ActorType::Type &type) -{ - popupMenu->showAttackMonsterPopup(viewport->getMouseX(), - viewport->getMouseY(), - name, - type); -} - -void PopupManager::showPickupItemPopup(const std::string &name) -{ - popupMenu->showPickupItemPopup(viewport->getMouseX(), - viewport->getMouseY(), - name); -} - -void PopupManager::showUndressPopup(const int x, const int y, - const Being *const being, - Item *const item) -{ - popupMenu->showUndressPopup(x, y, being, item); -} - -void PopupManager::showMapPopup(const int x, const int y) -{ - popupMenu->showMapPopup(viewport->getMouseX(), viewport->getMouseY(), - x, y); -} - -void PopupManager::showMapPopup(const int x1, const int y1, - const int x2, const int y2) -{ - popupMenu->showMapPopup(x1, y1, x2, y2); -} - -void PopupManager::showTextFieldPopup(TextField *const input) -{ - popupMenu->showTextFieldPopup(viewport->getMouseX(), - viewport->getMouseY(), - input); -} - -void PopupManager::showLinkPopup(const std::string &link) -{ - popupMenu->showLinkPopup(viewport->getMouseX(), - viewport->getMouseY(), - link); -} - -void PopupManager::showWindowsPopup() -{ - popupMenu->showWindowsPopup(viewport->getMouseX(), viewport->getMouseY()); -} - -void PopupManager::showNpcDialogPopup(const int npcId) -{ - popupMenu->showNpcDialogPopup(npcId, - viewport->getMouseX(), - viewport->getMouseY()); -} - -void PopupManager::showWindowPopup(Window *const window) -{ - popupMenu->showWindowPopup(window, viewport->getMouseX(), - viewport->getMouseY()); -} - void PopupManager::closePopupMenu() { if (popupMenu) diff --git a/src/gui/popupmanager.h b/src/gui/popupmanager.h index 1687b8202..ae96eac94 100644 --- a/src/gui/popupmanager.h +++ b/src/gui/popupmanager.h @@ -60,98 +60,6 @@ class PopupManager final */ ~PopupManager(); - /** - * Shows a popup for an item. - * TODO Find some way to get rid of Item here - */ - void showPopup(Window *const parent, - const int x, const int y, - Item *const item, - const bool isInventory = true); - - /** - * Shows a popup for an item. - * TODO Find some way to get rid of Item here - */ - void showPopup(Window *const parent, - Item *const item, - const bool isInventory = true); - - void showPopup(const int x, const int y, - Button *const button); - - void showPopup(const int x, const int y, - const ProgressBar *const bar); - - void showPopup(MapItem *const item); - - void showPopup(const int x, const int y, MapItem *const mapItem); - - void showItemPopup(Item *const item); - - void showItemPopup(const int itemId, - const unsigned char color = 1); - - void showDropPopup(Item *const item); - - /** - * Shows a popup for being. - */ - void showPopup(const int x, const int y, - const Being *const being); - - void showPopup(const Being *const being); - - void showPopup(const int x, const int y, - const std::vector<ActorSprite*> &beings); - - void showPopup(const int x, const int y, - const FloorItem *const floorItem); - - void showPlayerPopup(const std::string &nick); - - void showOutfitsPopup(const int x, const int y); - - void showOutfitsPopup(); - - void showSpellPopup(TextCommand *const cmd); - - void showAttackMonsterPopup(const std::string &name, - const ActorType::Type &type); - - void showPickupItemPopup(const std::string &name); - - /** - * Shows the related popup menu when right click on the chat - * at the specified mouse coordinates. - */ - void showChatPopup(const int x, const int y, - ChatTab *const tab); - - /** - * Shows the related popup menu when right click on the chat - */ - void showChatPopup(ChatTab *const tab); - - void showUndressPopup(const int x, const int y, - const Being *const being, - Item *const item); - - void showMapPopup(const int x, const int y); - - void showMapPopup(const int x1, const int y1, - const int x2, const int y2); - - void showTextFieldPopup(TextField *const input); - - void showLinkPopup(const std::string &link); - - void showWindowsPopup(); - - void showNpcDialogPopup(const int npcId); - - void showWindowPopup(Window *const window); - void showBeingPopup(const int x, const int y, Being *const b); diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 7ae46dddf..761daf41f 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -45,6 +45,8 @@ #include "gui/fonts/font.h" +#include "gui/popups/popupmenu.h" + #include "gui/windows/ministatuswindow.h" #include "debug.h" @@ -365,6 +367,8 @@ bool Viewport::openContextMenu(const MouseEvent &event) mPlayerFollowMouse = false; const int eventX = event.getX(); const int eventY = event.getY(); + if (!popupMenu) + return false; if (mHoverBeing) { validateSpeed(); @@ -375,29 +379,29 @@ bool Viewport::openContextMenu(const MouseEvent &event) const int y = mMouseY + mPixelViewY; actorManager->findBeingsByPixel(beings, x, y, true); if (beings.size() > 1) - popupManager->showPopup(eventX, eventY, beings); + popupMenu->showPopup(eventX, eventY, beings); else - popupManager->showPopup(eventX, eventY, mHoverBeing); + popupMenu->showPopup(eventX, eventY, mHoverBeing); return true; } } else if (mHoverItem) { validateSpeed(); - popupManager->showPopup(eventX, eventY, mHoverItem); + popupMenu->showPopup(eventX, eventY, mHoverItem); return true; } else if (mHoverSign) { validateSpeed(); - popupManager->showPopup(eventX, eventY, mHoverSign); + popupMenu->showPopup(eventX, eventY, mHoverSign); return true; } else if (settings.cameraMode) { if (!mMap) return false; - popupManager->showMapPopup(eventX, eventY, + popupMenu->showMapPopup(eventX, eventY, (mMouseX + mPixelViewX) / mMap->getTileWidth(), (mMouseY + mPixelViewY) / mMap->getTileHeight()); return true; diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 4968393b2..21689311a 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -34,6 +34,8 @@ #include "gui/fonts/font.h" +#include "gui/popups/popupmenu.h" + #include "gui/models/avatarlistmodel.h" #include "gui/windows/chatwindow.h" @@ -392,9 +394,17 @@ void AvatarListBox::mousePressed(MouseEvent &event) const Being *const being = actorManager->findBeingByName( avatar->getName(), ActorType::PLAYER); if (being) - popupManager->showPopup(being); + { + popupMenu->showPopup(viewport->getMouseX(), + viewport->getMouseY(), + being); + } else - popupManager->showPlayerPopup(avatar->getName()); + { + popupMenu->showPlayerPopup(viewport->getMouseX(), + viewport->getMouseY(), + avatar->getName()); + } } break; } @@ -408,7 +418,9 @@ void AvatarListBox::mousePressed(MouseEvent &event) else name = model->getAvatarAt(selected)->getName(); - popupManager->showAttackMonsterPopup(name, + popupMenu->showAttackMonsterPopup(viewport->getMouseX(), + viewport->getMouseY(), + name, static_cast<ActorType::Type>(model->getAvatarAt( selected)->getType())); break; @@ -422,7 +434,9 @@ void AvatarListBox::mousePressed(MouseEvent &event) else name = model->getAvatarAt(selected)->getName(); - popupManager->showPickupItemPopup(name); + popupMenu->showPickupItemPopup(viewport->getMouseX(), + viewport->getMouseY(), + name); break; } case MapItemType::HOME: @@ -446,7 +460,9 @@ void AvatarListBox::mousePressed(MouseEvent &event) { MapItem *const mapItem = map->findPortalXY( ava->getX(), ava->getY()); - popupManager->showPopup(mapItem); + popupMenu->showPopup(viewport->getMouseX(), + viewport->getMouseY(), + mapItem); } break; } diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index b57c98273..8fe3a8b2b 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -34,6 +34,7 @@ #include "gui/fonts/font.h" #include "gui/popups/itempopup.h" +#include "gui/popups/popupmenu.h" #include "gui/windows/inventorywindow.h" @@ -215,8 +216,12 @@ void DropShortcutContainer::mousePressed(MouseEvent &event) Item *const item = inv->findItem(dropShortcut->getItem(index), dropShortcut->getItemColor(index)); - if (popupManager) - popupManager->showDropPopup(item); + if (popupMenu) + { + popupMenu->showDropPopup(viewport->getMouseX(), + viewport->getMouseY(), + item); + } } } diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp index 2217b051f..f63991f8d 100644 --- a/src/gui/widgets/itemlinkhandler.cpp +++ b/src/gui/widgets/itemlinkhandler.cpp @@ -26,6 +26,7 @@ #include "gui/viewport.h" #include "gui/popups/itempopup.h" +#include "gui/popups/popupmenu.h" #include "gui/windows/confirmdialog.h" #include "gui/windows/helpwindow.h" @@ -79,8 +80,12 @@ void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event) } else if (button == MouseButton::RIGHT) { - if (popupManager) - popupManager->showLinkPopup(url); + if (popupMenu) + { + popupMenu->showLinkPopup(viewport->getMouseX(), + viewport->getMouseY(), + url); + } } } else if (!link.empty() && link[0] == '?') diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 2d8deeba9..84b7bc249 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -39,6 +39,7 @@ #include "gui/fonts/font.h" #include "gui/popups/itempopup.h" +#include "gui/popups/popupmenu.h" #include "gui/popups/spellpopup.h" #include "gui/windows/inventorywindow.h" @@ -334,9 +335,11 @@ void ItemShortcutContainer::mousePressed(MouseEvent &event) else if (event.getButton() == MouseButton::RIGHT) { event.consume(); - if (popupManager && selShortcut) + if (popupMenu && selShortcut && viewport) { - popupManager->showItemPopup(selShortcut->getItem(index), + popupMenu->showItemPopup(viewport->getMouseX(), + viewport->getMouseY(), + selShortcut->getItem(index), selShortcut->getItemColor(index)); } } diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 019fd3e63..8efc5241f 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -33,6 +33,7 @@ #include "gui/fonts/font.h" #include "gui/popups/itempopup.h" +#include "gui/popups/popupmenu.h" #include "gui/models/shopitems.h" @@ -234,8 +235,12 @@ void ShopListBox::mouseReleased(MouseEvent& event) return; Item *const item = mShopItems->at(mSelected); - if (popupManager) - popupManager->showItemPopup(item); + if (popupMenu && viewport) + { + popupMenu->showItemPopup(viewport->getMouseX(), + viewport->getMouseY(), + item); + } } } diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 8960725d5..164513d73 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -32,6 +32,7 @@ #include "gui/fonts/font.h" +#include "gui/popups/popupmenu.h" #include "gui/popups/spellpopup.h" #include "gui/windows/shortcutwindow.h" @@ -260,8 +261,12 @@ void SpellShortcutContainer::mouseReleased(MouseEvent &event) if (itemId >= 0) spell = spellManager->getSpell(itemId); - if (spell && popupManager) - popupManager->showSpellPopup(spell); + if (spell && popupMenu) + { + popupMenu->showSpellPopup(viewport->getMouseX(), + viewport->getMouseY(), + spell); + } } } diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index adb455432..0810b9395 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -70,14 +70,16 @@ #include "input/inputmanager.h" #include "gui/gui.h" -#include "gui/popupmanager.h" #include "gui/skin.h" +#include "gui/viewport.h" #ifdef ANDROID #include "gui/windowmanager.h" #endif #include "gui/fonts/font.h" +#include "gui/popups/popupmenu.h" + #include "resources/image.h" #include "resources/imagerect.h" @@ -703,8 +705,12 @@ void TextField::mousePressed(MouseEvent &event) event.consume(); if (event.getButton() == MouseButton::RIGHT) { - if (popupManager) - popupManager->showTextFieldPopup(this); + if (popupMenu) + { + popupMenu->showTextFieldPopup(viewport->getMouseX(), + viewport->getMouseY(), + this); + } } else if (event.getButton() == MouseButton::LEFT) { diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 2078c4cef..7a85d5352 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -80,6 +80,8 @@ #include "gui/fonts/font.h" +#include "gui/popups/popupmenu.h" + #include "gui/windows/setupwindow.h" #include "gui/widgets/containerplacer.h" @@ -764,10 +766,12 @@ void Window::mousePressed(MouseEvent &event) } else if (button == MouseButton::RIGHT) { - if (popupManager) + if (popupMenu) { event.consume(); - popupManager->showWindowPopup(this); + popupMenu->showWindowPopup(this, + viewport->getMouseX(), + viewport->getMouseY()); } } } diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index ed3905404..f998fe7b9 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -31,6 +31,7 @@ #include "gui/popupmanager.h" #include "gui/skin.h" +#include "gui/popups/popupmenu.h" #include "gui/popups/textpopup.h" #include "gui/windows/skilldialog.h" @@ -257,9 +258,9 @@ void WindowMenu::mousePressed(MouseEvent &event) Button *const btn = dynamic_cast<Button*>(event.getSource()); if (!btn) return; - if (popupManager) + if (popupMenu) { - popupManager->showPopup(getX() + event.getX(), + popupMenu->showPopup(getX() + event.getX(), getY() + event.getY(), btn); } } diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 2cee38db7..363af7284 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -45,9 +45,12 @@ #include "gui/gui.h" #include "gui/popupmanager.h" #include "gui/skin.h" +#include "gui/viewport.h" #include "gui/models/colorlistmodel.h" +#include "gui/popups/popupmenu.h" + #include "gui/windows/emotewindow.h" #include "gui/windows/setupwindow.h" #include "gui/widgets/tabbedarea.h" @@ -657,7 +660,7 @@ void ChatWindow::mousePressed(MouseEvent &event) if (event.getButton() == MouseButton::RIGHT) { - if (popupManager) + if (popupMenu) { Tab *const tab = mChatTabs->getSelectedTab(); if (tab) @@ -674,7 +677,11 @@ void ChatWindow::mousePressed(MouseEvent &event) { ChatTab *const cTab = dynamic_cast<ChatTab*>(tab); if (cTab) - popupManager->showChatPopup(cTab); + { + popupMenu->showChatPopup(viewport->getMouseX(), + viewport->getMouseY(), + cTab); + } } } } diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index a760f49c8..5600de741 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -32,10 +32,9 @@ #include "being/localplayer.h" #include "being/playerinfo.h" -#include "gui/popupmanager.h" - #include "gui/fonts/font.h" +#include "gui/popups/popupmenu.h" #include "gui/popups/itempopup.h" #include "gui/windows/setupwindow.h" @@ -358,13 +357,13 @@ void EquipmentWindow::mousePressed(MouseEvent& event) */ const int mx = x + getX(); const int my = y + getY(); - if (popupManager) + if (popupMenu) { event.consume(); if (mForing) - popupManager->showUndressPopup(mx, my, mBeing, item); + popupMenu->showUndressPopup(mx, my, mBeing, item); else - popupManager->showPopup(this, mx, my, item, true); + popupMenu->showPopup(this, mx, my, item, true); return; } } diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 5d12c95d4..d148d4d7d 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -40,6 +40,7 @@ #include "gui/models/sortlistmodelinv.h" +#include "gui/popups/popupmenu.h" #include "gui/popups/textpopup.h" #include "gui/windows/equipmentwindow.h" @@ -467,8 +468,8 @@ void InventoryWindow::mouseClicked(MouseEvent &event) const int mx = event.getX() + getX(); const int my = event.getY() + getY(); - if (popupManager) - popupManager->showPopup(this, mx, my, item, isMainInventory()); + if (popupMenu) + popupMenu->showPopup(this, mx, my, item, isMainInventory()); } if (!mInventory) diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index 615db0d85..16e18fe35 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -32,6 +32,7 @@ #include "gui/popupmanager.h" #include "gui/viewport.h" +#include "gui/popups/popupmenu.h" #include "gui/popups/textpopup.h" #include "gui/windows/setupwindow.h" @@ -459,7 +460,9 @@ void Minimap::mouseReleased(MouseEvent &event) int x = event.getX(); int y = event.getY(); screenToMap(x, y); - popupManager->showMapPopup(x, y); + popupMenu->showMapPopup(viewport->getMouseX(), + viewport->getMouseY(), + x, y); } } diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 6536617f3..ebbb90119 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -33,9 +33,9 @@ #include "gui/popupmanager.h" #include "gui/skin.h" -#include "gui/popups/textpopup.h" - +#include "gui/popups/popupmenu.h" #include "gui/popups/statuspopup.h" +#include "gui/popups/textpopup.h" #include "gui/windows/statuswindow.h" @@ -452,7 +452,7 @@ void MiniStatusWindow::mousePressed(MouseEvent &event) event.consume(); if (popupManager) { - popupManager->showPopup(getX() + event.getX(), + popupMenu->showPopup(getX() + event.getX(), getY() + event.getY(), bar); } } diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index d11dca0a9..8b7a938b0 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -38,6 +38,8 @@ #include "gui/fonts/font.h" +#include "gui/popups/popupmenu.h" + #include "gui/windows/inventorywindow.h" #include "gui/widgets/browserbox.h" @@ -948,8 +950,12 @@ void NpcDialog::mousePressed(MouseEvent &event) && event.getSource() == mTextBox) { event.consume(); - if (popupManager) - popupManager->showNpcDialogPopup(mNpcId); + if (popupMenu) + { + popupMenu->showNpcDialogPopup(mNpcId, + viewport->getMouseX(), + viewport->getMouseY()); + } } } diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp index a74967bb4..0cd35e289 100644 --- a/src/gui/windows/outfitwindow.cpp +++ b/src/gui/windows/outfitwindow.cpp @@ -34,6 +34,9 @@ #include "input/inputmanager.h" #include "gui/popupmanager.h" +#include "gui/viewport.h" + +#include "gui/popups/popupmenu.h" #include "gui/windows/setupwindow.h" @@ -421,9 +424,10 @@ void OutfitWindow::mouseDragged(MouseEvent &event) void OutfitWindow::mousePressed(MouseEvent &event) { const int index = getIndexFromGrid(event.getX(), event.getY()); - if (event.getButton() == MouseButton::RIGHT && popupManager) + if (event.getButton() == MouseButton::RIGHT && popupMenu) { - popupManager->showOutfitsPopup(); + popupMenu->showOutfitsPopup(viewport->getMouseX(), + viewport->getMouseY()); event.consume(); return; } diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index f19f2662c..c30f19b8e 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -31,6 +31,9 @@ #include "gui/onlineplayer.h" #include "gui/popupmanager.h" +#include "gui/viewport.h" + +#include "gui/popups/popupmenu.h" #include "gui/windows/chatwindow.h" #include "gui/windows/setupwindow.h" @@ -197,7 +200,7 @@ void WhoIsOnline::handleLink(const std::string& link, MouseEvent *event) if (localPlayer && link == localPlayer->getName()) return; - if (popupManager) + if (popupMenu) { if (actorManager) { @@ -207,11 +210,15 @@ void WhoIsOnline::handleLink(const std::string& link, MouseEvent *event) if (being && popupManager) { - popupManager->showPopup(being); + popupMenu->showPopup(viewport->getMouseX(), + viewport->getMouseY(), + being); return; } } - popupManager->showPlayerPopup(link); + popupMenu->showPlayerPopup(viewport->getMouseX(), + viewport->getMouseY(), + link); } } } |