summaryrefslogtreecommitdiff
path: root/src/gui/windows
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-03-02 17:09:28 +0300
committerAndrei Karas <akaras@inbox.ru>2014-03-02 17:09:28 +0300
commitedc8de3400acbbae60930a9c1d4f946df5b2e68f (patch)
treec5123ecfe12df3c543e34be058408c56822b6dc4 /src/gui/windows
parent2f8fac791e34fe3831518490ae26c752b49ec1f6 (diff)
downloadmanaplus-edc8de3400acbbae60930a9c1d4f946df5b2e68f.tar.gz
manaplus-edc8de3400acbbae60930a9c1d4f946df5b2e68f.tar.bz2
manaplus-edc8de3400acbbae60930a9c1d4f946df5b2e68f.tar.xz
manaplus-edc8de3400acbbae60930a9c1d4f946df5b2e68f.zip
In chat add key Ctrl+b for insert bold/normal font size.
Diffstat (limited to 'src/gui/windows')
-rw-r--r--src/gui/windows/chatwindow.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 51d7d6db7..71915ab08 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -227,6 +227,7 @@ ChatWindow::ChatWindow():
mChatInput->setActionEventId("chatinput");
mChatInput->addActionListener(this);
+ mChatInput->setAllowSpecialActions(false);
mColorPicker->setActionEventId(ACTION_COLOR_PICKER);
mColorPicker->addActionListener(this);
@@ -934,6 +935,25 @@ void ChatWindow::keyPressed(KeyEvent &event)
ifKey(Input::KEY_GUI_F11, "\u2618")
ifKey(Input::KEY_GUI_F12, "\u2592")
+ if (inputManager.isActionActive(static_cast<int>(Input::KEY_GUI_CTRL)))
+ {
+ if (actionId == static_cast<int>(Input::KEY_GUI_B))
+ {
+ std::string inputText = mChatInput->getTextBeforeCaret();
+ toLower(inputText);
+ const size_t idx = inputText.rfind("##b");
+ if (idx == std::string::npos
+ || mChatInput->getTextBeforeCaret().substr(idx, 3) == "##b")
+ {
+ temp = "##B";
+ }
+ else
+ {
+ temp = "##b";
+ }
+ }
+ }
+
if (!temp.empty())
addInputText(temp, false);
}