FIRE-8602 - When focused on a chat history and starting to type, focus will move to the next line editor found and typing will resume there.

master
ziree 2012-12-14 16:54:04 +01:00
parent b05cc8e6d5
commit 347d50324b
2 changed files with 54 additions and 0 deletions

View File

@ -64,6 +64,12 @@
// llviewernetwork.h : SJ: Needed to find the grid we are running on
#include "llviewernetwork.h"
// <FS_Zi> FIRE-8602: Typing in chat history focuses chat input line
#include "llfocusmgr.h"
#include "llkeyboard.h"
#include "lllineeditor.h"
// </FS:Zi>
static LLDefaultChildRegistry::Register<LLChatHistory> r("chat_history");
const static std::string NEW_LINE(rawstr_to_utf8("\n"));
@ -735,6 +741,7 @@ LLChatHistory::LLChatHistory(const LLChatHistory::Params& p)
mBottomSeparatorPad(p.bottom_separator_pad),
mTopHeaderPad(p.top_header_pad),
mBottomHeaderPad(p.bottom_header_pad),
mChatInputLine(NULL), // <FS_Zi> FIRE-8602: Typing in chat history focuses chat input line
mIsLastMessageFromLog(false)
{
// <FS:Zi> FIRE-8600: TAB out of chat history
@ -1501,3 +1508,41 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
// LLUICtrl::draw();
// }
// </FS:Zi>
// <FS_Zi> FIRE-8602: Typing in chat history focuses chat input line
BOOL LLChatHistory::handleUnicodeCharHere(llwchar uni_char)
{
// do not change focus when the CTRL key is used to make copy/select all etc. possible
if(gKeyboard->currentMask(false) & MASK_CONTROL)
{
// instead, let the base class handle things
return LLTextEditor::handleUnicodeCharHere(uni_char);
}
// we don't know which is our chat input line yet
if(!mChatInputLine)
{
// get our focus root
LLUICtrl* focusRoot=findRootMostFocusRoot();
if(focusRoot)
{
// focus on the next item that is a text input control
focusRoot->focusNextItem(true);
// remember the control's pointer if it really is a LLLineEditor
mChatInputLine=dynamic_cast<LLLineEditor*>(gFocusMgr.getKeyboardFocus());
}
}
// do we know our chat input line now?
if(mChatInputLine)
{
// we do, so focus on it
mChatInputLine->setFocus(true);
// and let it handle the keystroke
return mChatInputLine->handleUnicodeCharHere(uni_char);
}
// we don't know what to do, so let our base class handle the keystroke
return LLTextEditor::handleUnicodeCharHere(uni_char);
}
// </FS:Zi>

View File

@ -32,6 +32,8 @@
#include "llviewerchat.h"
#include "llavatarname.h"
class LLLineEditor; // <FS_Zi> FIRE-8602: Typing in chat history focuses chat input line
//Chat log widget allowing addition of a message as a widget
// class LLChatHistory : public LLUICtrl // <FS:Zi> FIRE-8600: TAB out of chat history
class LLChatHistory : public LLTextEditor // <FS:Zi> FIRE-8600: TAB out of chat history
@ -152,5 +154,12 @@ class LLChatHistory : public LLTextEditor // <FS:Zi> FIRE-8600: TAB out of chat
// typedef std::set<std::string> unread_chat_source_t;
// unread_chat_source_t mUnreadChatSources;
// </FS:Zi>
// <FS_Zi> FIRE-8602: Typing in chat history focuses chat input line
public:
virtual BOOL handleUnicodeCharHere(llwchar uni_char);
LLLineEditor* mChatInputLine;
// </FS:Zi>
};
#endif /* LLCHATHISTORY_H_ */