summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/popups/popupmenu.cpp157
-rw-r--r--src/gui/popups/popupmenu.h6
-rw-r--r--src/gui/windows/inventorywindow.cpp2
3 files changed, 88 insertions, 77 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 88e83b200..365970fa4 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -1609,8 +1609,10 @@ void PopupMenu::handleLink(const std::string &link,
mY = 0;
}
-void PopupMenu::showPopup(Window *const parent, const int x, const int y,
- Item *const item, const bool isInventory)
+void PopupMenu::showPopup(Window *const parent,
+ const int x, const int y,
+ Item *const item,
+ const int type)
{
if (!item)
return;
@@ -1627,98 +1629,105 @@ void PopupMenu::showPopup(Window *const parent, const int x, const int y,
const int cnt = item->getQuantity();
const bool isProtected = PlayerInfo::isItemProtected(mItemId);
- if (isInventory)
+ switch (type)
{
- if (tradeWindow && tradeWindow->isWindowVisible() && !isProtected)
- {
- // TRANSLATORS: popup menu item
- // TRANSLATORS: add item to trade
- mBrowserBox->addRow("/addtrade 'INVINDEX'", _("Add to trade"));
- if (cnt > 1)
+ case Inventory::INVENTORY:
+ if (tradeWindow && tradeWindow->isWindowVisible() && !isProtected)
{
- if (cnt > 10)
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: add item to trade
+ mBrowserBox->addRow("/addtrade 'INVINDEX'", _("Add to trade"));
+ if (cnt > 1)
{
+ if (cnt > 10)
+ {
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: add 10 item amount to trade
+ mBrowserBox->addRow("/addtrade 'INVINDEX' 10",
+ _("Add to trade 10"));
+ }
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: add half item amount to trade
+ mBrowserBox->addRow("/addtrade 'INVINDEX' /",
+ _("Add to trade half"));
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: add all amount except one item to trade
+ mBrowserBox->addRow("/addtrade 'INVINDEX' -1",
+ _("Add to trade all-1"));
// TRANSLATORS: popup menu item
- // TRANSLATORS: add 10 item amount to trade
- mBrowserBox->addRow("/addtrade 'INVINDEX' 10",
- _("Add to trade 10"));
+ // TRANSLATORS: add all amount item to trade
+ mBrowserBox->addRow("/addtrade 'INVINDEX' all",
+ _("Add to trade all"));
}
+ mBrowserBox->addRow("##3---");
+ }
+ if (InventoryWindow::isStorageActive())
+ {
// TRANSLATORS: popup menu item
- // TRANSLATORS: add half item amount to trade
- mBrowserBox->addRow("/addtrade 'INVINDEX' /",
- _("Add to trade half"));
- // TRANSLATORS: popup menu item
- // TRANSLATORS: add all amount except one item to trade
- mBrowserBox->addRow("/addtrade 'INVINDEX' -1",
- _("Add to trade all-1"));
- // TRANSLATORS: popup menu item
- // TRANSLATORS: add all amount item to trade
- mBrowserBox->addRow("/addtrade 'INVINDEX' all",
- _("Add to trade all"));
+ // TRANSLATORS: add item to storage
+ mBrowserBox->addRow("/invtostorage 'INVINDEX'", _("Store"));
+ if (cnt > 1)
+ {
+ if (cnt > 10)
+ {
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: add 10 item amount to storage
+ mBrowserBox->addRow("/invtostorage 'INVINDEX' 10",
+ _("Store 10"));
+ }
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: add half item amount to storage
+ mBrowserBox->addRow("/invtostorage 'INVINDEX' /",
+ _("Store half"));
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: add all except one item amount to storage
+ mBrowserBox->addRow("/invtostorage 'INVINDEX' -1",
+ _("Store all-1"));
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: add all item amount to storage
+ mBrowserBox->addRow("/invtostorage 'INVINDEX' all",
+ _("Store all"));
+ }
+ mBrowserBox->addRow("##3---");
}
- mBrowserBox->addRow("##3---");
- }
- if (InventoryWindow::isStorageActive())
- {
+ addUseDrop(item, isProtected);
+ break;
+
+ case Inventory::STORAGE:
// TRANSLATORS: popup menu item
- // TRANSLATORS: add item to storage
- mBrowserBox->addRow("/invtostorage 'INVINDEX'", _("Store"));
+ // TRANSLATORS: get item from storage
+ mBrowserBox->addRow("/storagetoinv 'INVINDEX'", _("Retrieve"));
if (cnt > 1)
{
if (cnt > 10)
{
// TRANSLATORS: popup menu item
- // TRANSLATORS: add 10 item amount to storage
- mBrowserBox->addRow("/invtostorage 'INVINDEX' 10",
- _("Store 10"));
+ // TRANSLATORS: get 10 item amount from storage
+ mBrowserBox->addRow("/storagetoinv 'INVINDEX' 10",
+ _("Retrieve 10"));
}
// TRANSLATORS: popup menu item
- // TRANSLATORS: add half item amount to storage
- mBrowserBox->addRow("/invtostorage 'INVINDEX' /",
- _("Store half"));
+ // TRANSLATORS: get half item amount from storage
+ mBrowserBox->addRow("/storagetoinv 'INVINDEX' /",
+ _("Retrieve half"));
// TRANSLATORS: popup menu item
- // TRANSLATORS: add all except one item amount to storage
- mBrowserBox->addRow("/invtostorage 'INVINDEX' -1",
- _("Store all-1"));
+ // TRANSLATORS: get all except one item amount from storage
+ mBrowserBox->addRow("/storagetoinv 'INVINDEX' -1",
+ _("Retrieve all-1"));
// TRANSLATORS: popup menu item
- // TRANSLATORS: add all item amount to storage
- mBrowserBox->addRow("/invtostorage 'INVINDEX' all",
- _("Store all"));
+ // TRANSLATORS: get all item amount from storage
+ mBrowserBox->addRow("/storagetoinv 'INVINDEX' all",
+ _("Retrieve all"));
}
- mBrowserBox->addRow("##3---");
- }
+ break;
- addUseDrop(item, isProtected);
- }
- // Assume in storage for now
- else
- {
- // TRANSLATORS: popup menu item
- // TRANSLATORS: get item from storage
- mBrowserBox->addRow("/storagetoinv 'INVINDEX'", _("Retrieve"));
- if (cnt > 1)
- {
- if (cnt > 10)
- {
- // TRANSLATORS: popup menu item
- // TRANSLATORS: get 10 item amount from storage
- mBrowserBox->addRow("/storagetoinv 'INVINDEX' 10",
- _("Retrieve 10"));
- }
- // TRANSLATORS: popup menu item
- // TRANSLATORS: get half item amount from storage
- mBrowserBox->addRow("/storagetoinv 'INVINDEX' /",
- _("Retrieve half"));
- // TRANSLATORS: popup menu item
- // TRANSLATORS: get all except one item amount from storage
- mBrowserBox->addRow("/storagetoinv 'INVINDEX' -1",
- _("Retrieve all-1"));
- // TRANSLATORS: popup menu item
- // TRANSLATORS: get all item amount from storage
- mBrowserBox->addRow("/storagetoinv 'INVINDEX' all",
- _("Retrieve all"));
- }
+ case Inventory::CART:
+ case Inventory::TRADE:
+ default:
+ break;
}
+
+
addProtection();
if (config.getBoolValue("enablePickupFilter"))
{
diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h
index 875645954..5b959cdaa 100644
--- a/src/gui/popups/popupmenu.h
+++ b/src/gui/popups/popupmenu.h
@@ -86,8 +86,10 @@ class PopupMenu final : public Popup, public LinkHandler
* Shows the related popup menu when right click on the inventory
* at the specified mouse coordinates.
*/
- void showPopup(Window *const parent, const int x, const int y,
- Item *const item, const bool isInventory);
+ void showPopup(Window *const parent,
+ const int x, const int y,
+ Item *const item,
+ const int type);
void showPopup(const int x, const int y, Button *const button);
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index 944c35f24..80f9cc5fd 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -501,7 +501,7 @@ void InventoryWindow::mouseClicked(MouseEvent &event)
const int my = event.getY() + getY();
if (popupMenu)
- popupMenu->showPopup(this, mx, my, item, isMainInventory());
+ popupMenu->showPopup(this, mx, my, item, mInventory->getType());
}
if (!mInventory)