From edc8de3400acbbae60930a9c1d4f946df5b2e68f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 2 Mar 2014 17:09:28 +0300 Subject: In chat add key Ctrl+b for insert bold/normal font size. --- src/gui/windows/chatwindow.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/gui/windows') 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(Input::KEY_GUI_CTRL))) + { + if (actionId == static_cast(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); } -- cgit v1.2.3-70-g09d2