summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-06-06 23:44:23 +0300
committerAndrei Karas <akaras@inbox.ru>2011-06-06 23:44:23 +0300
commit0c3770d8aec1b56ad704e88d6e6d510ddc4af9a1 (patch)
tree4a54dc866fa7b0479e6a187ffcc60761d98abddb
parenta89170d63eabaec5f2b63ecb9df95c982ac044a1 (diff)
downloadplus-0c3770d8aec1b56ad704e88d6e6d510ddc4af9a1.tar.gz
plus-0c3770d8aec1b56ad704e88d6e6d510ddc4af9a1.tar.bz2
plus-0c3770d8aec1b56ad704e88d6e6d510ddc4af9a1.tar.xz
plus-0c3770d8aec1b56ad704e88d6e6d510ddc4af9a1.zip
Extend quick move items from inventory to storage and back.
Add new key for quick actions "modifier key".
-rw-r--r--src/gui/inventorywindow.cpp54
-rw-r--r--src/gui/popupmenu.cpp19
-rw-r--r--src/inventory.h12
-rw-r--r--src/keyboardconfig.cpp67
-rw-r--r--src/keyboardconfig.h4
5 files changed, 104 insertions, 52 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 056afee92..132f9cb87 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -307,19 +307,22 @@ void InventoryWindow::action(const gcn::ActionEvent &event)
{
if (isStorageActive())
{
- Item *item = mItems->getSelectedItem();
-
- if (!item)
- return;
-
Net::getInventoryHandler()->moveItem(Inventory::INVENTORY,
item->getInvIndex(), item->getQuantity(),
Inventory::STORAGE);
}
else
{
- ItemAmountWindow::showWindow(ItemAmountWindow::ItemDrop,
- this, item);
+ if (keyboard.isKeyActive(keyboard.KEY_MOD))
+ {
+ Net::getInventoryHandler()->dropItem(
+ item, item->getQuantity());
+ }
+ else
+ {
+ ItemAmountWindow::showWindow(ItemAmountWindow::ItemDrop,
+ this, item);
+ }
}
}
else if (event.getId() == "split")
@@ -348,7 +351,9 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
{
Window::mouseClicked(event);
- if (event.getButton() == gcn::MouseEvent::RIGHT)
+ bool mod = (isStorageActive() && keyboard.isKeyActive(keyboard.KEY_MOD));
+
+ if (!mod && event.getButton() == gcn::MouseEvent::RIGHT)
{
Item *item = mItems->getSelectedItem();
@@ -365,9 +370,10 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
viewport->showPopup(this, mx, my, item, isMainInventory());
}
- if (event.getButton() == gcn::MouseEvent::LEFT)
+ if (event.getButton() == gcn::MouseEvent::LEFT
+ || event.getButton() == gcn::MouseEvent::RIGHT)
{
- if (isStorageActive() && keyboard.isKeyActive(keyboard.KEY_EMOTE))
+ if (mod)
{
Item *item = mItems->getSelectedItem();
@@ -376,15 +382,31 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
if (mInventory->isMainInventory())
{
- Net::getInventoryHandler()->moveItem(Inventory::INVENTORY,
- item->getInvIndex(), item->getQuantity(),
- Inventory::STORAGE);
+ if (event.getButton() == gcn::MouseEvent::RIGHT)
+ {
+ ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd,
+ inventoryWindow, item);
+ }
+ else
+ {
+ Net::getInventoryHandler()->moveItem(Inventory::INVENTORY,
+ item->getInvIndex(), item->getQuantity(),
+ Inventory::STORAGE);
+ }
}
else
{
- Net::getInventoryHandler()->moveItem(Inventory::STORAGE,
- item->getInvIndex(), item->getQuantity(),
- Inventory::INVENTORY);
+ if (event.getButton() == gcn::MouseEvent::RIGHT)
+ {
+ ItemAmountWindow::showWindow(ItemAmountWindow::StoreRemove,
+ inventoryWindow, item);
+ }
+ else
+ {
+ Net::getInventoryHandler()->moveItem(Inventory::STORAGE,
+ item->getInvIndex(), item->getQuantity(),
+ Inventory::INVENTORY);
+ }
}
}
}
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 8497b2924..766e968ad 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -967,6 +967,10 @@ void PopupMenu::handleLink(const std::string &link,
ItemAmountWindow::showWindow(ItemAmountWindow::ItemDrop,
inventoryWindow, mItem);
}
+ else if (link == "drop all" && mItem)
+ {
+ Net::getInventoryHandler()->dropItem(mItem, mItem->getQuantity());
+ }
else if (link == "store" && mItem)
{
ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd,
@@ -1539,9 +1543,14 @@ void PopupMenu::showPopup(Window *parent, int x, int y, Item *item,
mBrowserBox->addRow(strprintf("@@use|%s@@", _("Use")));
if (cnt > 1)
+ {
mBrowserBox->addRow(strprintf("@@drop|%s@@", _("Drop...")));
+ mBrowserBox->addRow(strprintf("@@drop all|%s@@", _("Drop all")));
+ }
else
+ {
mBrowserBox->addRow(strprintf("@@drop|%s@@", _("Drop")));
+ }
if (Net::getInventoryHandler()->canSplit(item))
mBrowserBox->addRow(strprintf("@@split|%s@@", _("Split")));
@@ -1631,9 +1640,14 @@ void PopupMenu::showItemPopup(int x, int y, Item *item)
}
if (item->getQuantity() > 1)
+ {
mBrowserBox->addRow(strprintf("@@drop|%s@@", _("Drop...")));
+ mBrowserBox->addRow(strprintf("@@drop all|%s@@", _("Drop all")));
+ }
else
+ {
mBrowserBox->addRow(strprintf("@@drop|%s@@", _("Drop")));
+ }
if (Net::getInventoryHandler()->canSplit(item))
mBrowserBox->addRow(strprintf("@@split|%s@@", _("Split")));
@@ -1669,9 +1683,14 @@ void PopupMenu::showDropPopup(int x, int y, Item *item)
mBrowserBox->addRow(strprintf("@@use|%s@@", _("Use")));
if (item->getQuantity() > 1)
+ {
mBrowserBox->addRow(strprintf("@@drop|%s@@", _("Drop...")));
+ mBrowserBox->addRow(strprintf("@@drop all|%s@@", _("Drop all")));
+ }
else
+ {
mBrowserBox->addRow(strprintf("@@drop|%s@@", _("Drop")));
+ }
if (Net::getInventoryHandler()->canSplit(item))
mBrowserBox->addRow(strprintf("@@split|%s@@", _("Split")));
diff --git a/src/inventory.h b/src/inventory.h
index ffc2897ca..f94568739 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -33,13 +33,15 @@ class Item;
class InventoryListener
{
-public:
- virtual ~InventoryListener() {}
+ public:
+ virtual ~InventoryListener()
+ { }
- virtual void slotsChanged(Inventory* inventory) = 0;
+ virtual void slotsChanged(Inventory* inventory) = 0;
-protected:
- InventoryListener() {}
+ protected:
+ InventoryListener()
+ { }
};
class Inventory
diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp
index 1ad6fb582..6ca3f65c5 100644
--- a/src/keyboardconfig.cpp
+++ b/src/keyboardconfig.cpp
@@ -70,7 +70,7 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = {
{"keyChangePickupType", SDLK_o, N_("Change Pickup Type"),
KeyboardConfig::GRP_DEFAULT},
{"keyHideWindows", SDLK_h, N_("Hide Windows"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyBeingSit", SDLK_s, N_("Sit"), KeyboardConfig::GRP_DEFAULT},
{"keyScreenshot", SDLK_p, N_("Screenshot"), KeyboardConfig::GRP_DEFAULT},
{"keyTrade", SDLK_r, N_("Enable/Disable Trading"),
@@ -119,45 +119,50 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = {
strprintf(N_("Item Shortcut %d"), 19), KeyboardConfig::GRP_DEFAULT},
{"keyShortcut20", KeyboardConfig::KEY_NO_VALUE,
strprintf(N_("Item Shortcut %d"), 20), KeyboardConfig::GRP_DEFAULT},
- {"keyWindowHelp", SDLK_F1, N_("Help Window"), KeyboardConfig::GRP_DEFAULT},
+ {"keyWindowHelp", SDLK_F1, N_("Help Window"), KeyboardConfig::GRP_DEFAULT
+ | KeyboardConfig::GRP_GUI},
{"keyWindowStatus", SDLK_F2, N_("Status Window"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyWindowInventory", SDLK_F3, N_("Inventory Window"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyWindowEquipment", SDLK_F4, N_("Equipment Window"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyWindowSkill", SDLK_F5, N_("Skill Window"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyWindowMinimap", SDLK_F6, N_("Minimap Window"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyWindowChat", SDLK_F7, N_("Chat Window"), KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
+ {"keyWindowChat", SDLK_F7, N_("Chat Window"), KeyboardConfig::GRP_DEFAULT
+ | KeyboardConfig::GRP_GUI},
{"keyWindowShortcut", SDLK_F8, N_("Item Shortcut Window"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyWindowSetup", SDLK_F9, N_("Setup Window"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyWindowDebug", SDLK_F10, N_("Debug Window"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyWindowSocial", SDLK_F11, N_("Social Window"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyWindowEmoteBar", SDLK_F12, N_("Emote Shortcut Window"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyWindowOutfit", SDLK_BACKQUOTE, N_("Outfits Window"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyWindowShop", -1, N_("Shop Window"), KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
+ {"keyWindowShop", -1, N_("Shop Window"), KeyboardConfig::GRP_DEFAULT
+ | KeyboardConfig::GRP_GUI},
{"keyWindowDrop", SDLK_w, N_("Quick drop Window"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyWindowKills", SDLK_e, N_("Kill Stats Window"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyWindowSpells", SDLK_j, N_("Commands Window"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyWindowBotChecker", SDLK_LEFTBRACKET, N_("Bot Checker Window"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyWindowOnline", KeyboardConfig::KEY_NO_VALUE,
- _("Who Is Online Window"), KeyboardConfig::GRP_DEFAULT},
+ _("Who Is Online Window"), KeyboardConfig::GRP_DEFAULT
+ | KeyboardConfig::GRP_GUI},
{"keySocialPrevTab", KeyboardConfig::KEY_NO_VALUE,
- _("Previous Social Tab"), KeyboardConfig::GRP_DEFAULT},
+ _("Previous Social Tab"), KeyboardConfig::GRP_DEFAULT
+ | KeyboardConfig::GRP_GUI},
{"keySocialNextTab", KeyboardConfig::KEY_NO_VALUE, N_("Next Social Tab"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyEmoteShortcut1", SDLK_1, strprintf(N_("Emote Shortcut %d"), 1),
KeyboardConfig::GRP_EMOTION},
{"keyEmoteShortcut2", SDLK_2, strprintf(N_("Emote Shortcut %d"), 2),
@@ -257,16 +262,16 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = {
KeyboardConfig::GRP_DEFAULT},
{"keyCopyEquipedOutfit", SDLK_RIGHTBRACKET, N_("Copy equipped to Outfit"),
KeyboardConfig::GRP_DEFAULT},
- {"keyChat", SDLK_RETURN, N_("Toggle Chat"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_CHAT},
+ {"keyChat", SDLK_RETURN, N_("Toggle Chat"), KeyboardConfig::GRP_DEFAULT
+ | KeyboardConfig::GRP_CHAT},
{"keyChatScrollUp", SDLK_PAGEUP, N_("Scroll Chat Up"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyChatScrollDown", SDLK_PAGEDOWN, N_("Scroll Chat Down"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyChatPrevTab", SDLK_KP7, N_("Previous Chat Tab"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyChatNextTab", SDLK_KP9, N_("Next Chat Tab"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyChatPrevHistory", SDLK_KP7, N_("Previous chat line"),
KeyboardConfig::GRP_CHAT},
{"keyChatNextHistory", SDLK_KP9, N_("Next chat line"),
@@ -275,7 +280,8 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = {
KeyboardConfig::GRP_CHAT},
{"keyDeActivateChat", SDLK_ESCAPE, N_("Deactivate Chat Input"),
KeyboardConfig::GRP_CHAT},
- {"keyOK", SDLK_SPACE, N_("Select OK"), KeyboardConfig::GRP_DEFAULT},
+ {"keyOK", SDLK_SPACE, N_("Select OK"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
{"keyQuit", SDLK_ESCAPE, N_("Quit"), KeyboardConfig::GRP_DEFAULT},
{"keyIgnoreInput1", SDLK_LSUPER, N_("Ignore input 1"),
KeyboardConfig::GRP_DEFAULT},
@@ -324,7 +330,8 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = {
{"keyRightClick", SDLK_TAB, N_("Emulate right click from keyboard"),
KeyboardConfig::GRP_DEFAULT},
{"keyCameraMode", SDLK_KP_PLUS, N_("Toggle camera mode"),
- KeyboardConfig::GRP_DEFAULT}
+ KeyboardConfig::GRP_DEFAULT},
+ {"keyMod", SDLK_LSHIFT, N_("Modifier key"), KeyboardConfig::GRP_GUI}
};
void KeyboardConfig::init()
diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h
index f8fc1081b..d6a7f47b2 100644
--- a/src/keyboardconfig.h
+++ b/src/keyboardconfig.h
@@ -306,6 +306,7 @@ class KeyboardConfig
KEY_AWAY,
KEY_RIGHT_CLICK,
KEY_CAMERA,
+ KEY_MOD,
KEY_TOTAL
};
@@ -314,7 +315,8 @@ class KeyboardConfig
GRP_DEFAULT = 1, // default game key
GRP_CHAT = 2, // chat key
GRP_EMOTION = 4, // emotions key
- GRP_OUTFIT = 8 // outfit key
+ GRP_OUTFIT = 8, // outfit key
+ GRP_GUI = 16 // gui key
};
private: