summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-27 17:46:28 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-27 17:46:28 +0300
commitc34858a4c7889483a8775c65c9bd1f357bca2572 (patch)
tree65f7d0492116d15bcb719800c86903e8d52e9311
parente1233ab2508be02b0bd59c90f42b1c3406b60564 (diff)
downloadmv-c34858a4c7889483a8775c65c9bd1f357bca2572.tar.gz
mv-c34858a4c7889483a8775c65c9bd1f357bca2572.tar.bz2
mv-c34858a4c7889483a8775c65c9bd1f357bca2572.tar.xz
mv-c34858a4c7889483a8775c65c9bd1f357bca2572.zip
Remove copy to clipboard action in npc dialog popup.
-rw-r--r--src/actions/commands.cpp21
-rw-r--r--src/actions/commands.h1
-rw-r--r--src/dyetool/actions/commands.cpp1
-rw-r--r--src/enums/input/inputaction.h1
-rw-r--r--src/gui/popups/popupmenu.cpp6
-rw-r--r--src/gui/windows/npcdialog.cpp15
-rw-r--r--src/gui/windows/npcdialog.h3
-rw-r--r--src/input/inputactionmap.h6
8 files changed, 35 insertions, 19 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index 84011b3ec..114144477 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -38,6 +38,8 @@
#ifdef EATHENA_SUPPORT
#include "gui/shortcut/emoteshortcut.h"
+
+#include "gui/windows/npcdialog.h"
#endif
#include "gui/windows/chatwindow.h"
@@ -57,6 +59,7 @@
#include "net/homunculushandler.h"
#include "net/mailhandler.h"
#include "net/net.h"
+#include "net/npchandler.h"
#endif
#include "net/partyhandler.h"
#include "net/serverfeatures.h"
@@ -1133,4 +1136,22 @@ impHandler(craft)
return true;
}
+impHandler(npcClipboard)
+{
+ int x = 0;
+ int y = 0;
+
+ if (npcHandler)
+ {
+ NpcDialog *const dialog = npcHandler->getCurrentNpcDialog();
+
+ if (dialog && parse2Int(event.args, x, y))
+ {
+ dialog->copyToClipboard(x, y);
+ return true;
+ }
+ }
+ return false;
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index d901683b1..451f84285 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -93,6 +93,7 @@ namespace Actions
decHandler(selectSkillLevel);
decHandler(skill);
decHandler(craft);
+ decHandler(npcClipboard);
} // namespace Actions
#undef decHandler
diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp
index 44ff371d6..1f12d4777 100644
--- a/src/dyetool/actions/commands.cpp
+++ b/src/dyetool/actions/commands.cpp
@@ -93,5 +93,6 @@ impHandlerVoid(slide)
impHandlerVoid(selectSkillLevel)
impHandlerVoid(skill)
impHandlerVoid(craft)
+impHandlerVoid(npcClipboard);
} // namespace Actions
diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h
index 150c6282d..e06572a2b 100644
--- a/src/enums/input/inputaction.h
+++ b/src/enums/input/inputaction.h
@@ -618,6 +618,7 @@ enumStart(InputAction)
CRAFT_9,
CRAFT,
CHAT_CLIPBOARD,
+ NPC_CLIPBOARD,
TOTAL
}
enumEnd(InputAction);
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 9cc00b06d..d79a2f92d 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -1134,10 +1134,6 @@ void PopupMenu::handleLink(const std::string &link,
inputManager.executeChatCommand(InputAction::ENABLE_AWAY,
std::string(), mTab);
}
- else if (link == "npc clipboard" && mBeingId != BeingId_zero)
- {
- NpcDialog::copyToClipboard(mBeingId, mX, mY);
- }
else if (link == "remove pickup" && !mNick.empty())
{
if (actorManager)
@@ -2275,7 +2271,7 @@ void PopupMenu::showNpcDialogPopup(const BeingId npcId,
mBrowserBox->clearRows();
// TRANSLATORS: popup menu item
// TRANSLATORS: copy npc text to clipboard
- mBrowserBox->addRow("npc clipboard", _("Copy to clipboard"));
+ mBrowserBox->addRow("/npcclipboard 'X' 'Y'", _("Copy to clipboard"));
mBrowserBox->addRow("##3---");
// TRANSLATORS: popup menu item
// TRANSLATORS: close menu
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index 862c6bfcd..60c8f06d6 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -1241,19 +1241,10 @@ void NpcDialog::mousePressed(MouseEvent &event)
}
}
-void NpcDialog::copyToClipboard(const BeingId npcId,
- const int x, const int y)
+void NpcDialog::copyToClipboard(const int x, const int y) const
{
- NpcDialogs::iterator it = mNpcDialogs.find(npcId);
- if (it != mNpcDialogs.end())
- {
- const BrowserBox *const text = (*it).second->mTextBox;
- if (!text)
- return;
-
- std::string str = text->getTextAtPos(x, y);
- sendBuffer(str);
- }
+ std::string str = mTextBox->getTextAtPos(x, y);
+ sendBuffer(str);
}
void NpcDialog::setSkin(const std::string &skin)
diff --git a/src/gui/windows/npcdialog.h b/src/gui/windows/npcdialog.h
index 524ae7bd8..fa3e52097 100644
--- a/src/gui/windows/npcdialog.h
+++ b/src/gui/windows/npcdialog.h
@@ -250,8 +250,7 @@ class NpcDialog final : public Window,
NpcInputState getInputState()
{ return mInputState; }
- static void copyToClipboard(const BeingId npcId,
- const int x, const int y);
+ void copyToClipboard(const int x, const int y) const;
static NpcDialogs mNpcDialogs;
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 21060b74f..0f47fe638 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -5197,6 +5197,12 @@ static const InputActionData inputActionData
"chatclipboard",
UseArgs_true,
Protected_true},
+ {"keyNpcClipboard",
+ defaultAction(&Actions::npcClipboard),
+ InputCondition::INGAME,
+ "npcclipboard",
+ UseArgs_true,
+ Protected_true},
};
#undef defaultAction