summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-05-25 21:20:32 +0300
committerAndrei Karas <akaras@inbox.ru>2017-05-25 21:20:32 +0300
commit11bab6c211e60bfa7e50cf3de10429c1feaf9547 (patch)
tree932054e8ddf6699c333a254ddb82857fd10af0f8 /src
parent68291eca8eecf85a0b928ede37cd62d42e910d90 (diff)
downloadmanaverse-11bab6c211e60bfa7e50cf3de10429c1feaf9547.tar.gz
manaverse-11bab6c211e60bfa7e50cf3de10429c1feaf9547.tar.bz2
manaverse-11bab6c211e60bfa7e50cf3de10429c1feaf9547.tar.xz
manaverse-11bab6c211e60bfa7e50cf3de10429c1feaf9547.zip
Add chat command for copy text to clipboard.
Diffstat (limited to 'src')
-rw-r--r--src/actions/commands.cpp10
-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/input/inputactionmap.h6
6 files changed, 20 insertions, 5 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index ae50680fb..ebf4413e1 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -73,6 +73,7 @@
#include "utils/booleanoptions.h"
#include "utils/chatutils.h"
+#include "utils/copynpaste.h"
#include "utils/gmfunctions.h"
#include "utils/parameters.h"
#include "utils/process.h"
@@ -1197,6 +1198,15 @@ impHandler(npcClipboard)
return false;
}
+impHandler(clipboardCopy)
+{
+ const std::string args = event.args;
+ if (args.empty())
+ return false;
+ sendBuffer(args);
+ return true;
+}
+
impHandler(addPickup)
{
if (actorManager)
diff --git a/src/actions/commands.h b/src/actions/commands.h
index 0b6f0cf30..c323bd84a 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -96,6 +96,7 @@ namespace Actions
decHandler(skill);
decHandler(craft);
decHandler(npcClipboard);
+ decHandler(clipboardCopy);
decHandler(addPickup);
decHandler(removePickup);
decHandler(ignorePickup);
diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp
index a8e882a8c..bb467671b 100644
--- a/src/dyetool/actions/commands.cpp
+++ b/src/dyetool/actions/commands.cpp
@@ -96,6 +96,7 @@ impHandlerVoid(selectSkillLevel)
impHandlerVoid(skill)
impHandlerVoid(craft)
impHandlerVoid(npcClipboard)
+impHandlerVoid(clipboardCopy)
impHandlerVoid(addPickup)
impHandlerVoid(removePickup)
impHandlerVoid(ignorePickup)
diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h
index 94b37066b..0ffde0bd7 100644
--- a/src/enums/input/inputaction.h
+++ b/src/enums/input/inputaction.h
@@ -696,6 +696,7 @@ enumStart(InputAction)
COMMAND_SEND_MOUSE_KEY,
COMMAND_SEND_CHARS,
CLEAR_OUTFIT,
+ CLIPBOARD_COPY,
TOTAL
}
enumEnd(InputAction);
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 829a87749..1d568d0d6 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -1253,10 +1253,6 @@ void PopupMenu::handleLink(const std::string &link,
if (mTextField)
mTextField->handlePaste();
}
- else if (link == "clipboard link" && !mName.empty())
- {
- sendBuffer(mName);
- }
else if (link == "goto" && !mName.empty())
{
adminHandler->gotoName(mName);
@@ -2137,7 +2133,7 @@ void PopupMenu::showLinkPopup(const std::string &link)
mBrowserBox->addRow("/open 'NAME'", _("Open link"));
// TRANSLATORS: popup menu item
// TRANSLATORS: copy link to clipboard
- mBrowserBox->addRow("clipboard link", _("Copy to clipboard"));
+ mBrowserBox->addRow("/clipboardcopy 'NAME'", _("Copy to clipboard"));
mBrowserBox->addRow("##3---");
// TRANSLATORS: popup menu item
// TRANSLATORS: close menu
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index a21cc42c1..d3f36d21c 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -5666,6 +5666,12 @@ static const InputActionData inputActionData
"clearoutfit|outfitclear",
UseArgs_false,
Protected_true},
+ {"keyClipboardCopy",
+ defaultAction(&Actions::clipboardCopy),
+ InputCondition::INGAME,
+ "clipboardcopy|copyclipboard",
+ UseArgs_true,
+ Protected_true},
};
#undef defaultAction