summaryrefslogtreecommitdiff
path: root/src/gui/popups/popupmenu.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-01-24 14:43:47 +0300
committerAndrei Karas <akaras@inbox.ru>2015-01-24 14:43:47 +0300
commit972a29060fb65b058bf0aedbcaa4f563d189a9c1 (patch)
treeeed5d9a59bfe7eb65d6edcbcb443c31b3f5d702c /src/gui/popups/popupmenu.cpp
parent1cd50987bce69ada9ccea8c822ccd0ffb34cedde (diff)
downloadmv-972a29060fb65b058bf0aedbcaa4f563d189a9c1.tar.gz
mv-972a29060fb65b058bf0aedbcaa4f563d189a9c1.tar.bz2
mv-972a29060fb65b058bf0aedbcaa4f563d189a9c1.tar.xz
mv-972a29060fb65b058bf0aedbcaa4f563d189a9c1.zip
Impliment context menu support for different inventory types.
Diffstat (limited to 'src/gui/popups/popupmenu.cpp')
-rw-r--r--src/gui/popups/popupmenu.cpp157
1 files changed, 83 insertions, 74 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"))
{