Add linefeed input support to chat textboxes via Ctrl-Shift-Enter
parent
44858f9051
commit
adb6c935d2
|
|
@ -280,15 +280,21 @@ public:
|
|||
|
||||
void setContextMenu(LLContextMenu* new_context_menu);
|
||||
|
||||
// <FS:Ansariel> Make these protected
|
||||
void removeChar();
|
||||
void removeWord(bool prev);
|
||||
void addChar(const llwchar c);
|
||||
// </FS:Ansariel>
|
||||
|
||||
private:
|
||||
// private helper methods
|
||||
|
||||
void pasteHelper(bool is_primary);
|
||||
|
||||
void removeChar();
|
||||
// <FS> Ctrl-Backspace remove word
|
||||
void removeWord(bool prev);
|
||||
void addChar(const llwchar c);
|
||||
// <FS:Ansariel> Make these protected
|
||||
//void removeChar();
|
||||
//void addChar(const llwchar c);
|
||||
// </FS:Ansariel>
|
||||
void setCursorAtLocalPos(S32 local_mouse_x);
|
||||
S32 findPixelNearestPos(S32 cursor_offset = 0) const;
|
||||
S32 calcCursorPos(S32 mouse_x);
|
||||
|
|
|
|||
|
|
@ -413,6 +413,8 @@ public:
|
|||
virtual void setText(const LLStringExplicit &utf8str , const LLStyle::Params& input_params = LLStyle::Params()); // uses default style
|
||||
virtual std::string getText() const;
|
||||
void setMaxTextLength(S32 length) { mMaxTextByteLength = length; }
|
||||
// <FS:Ansariel> Getter for mMaxTextByteLength
|
||||
S32 getMaxTextLength() const { return mMaxTextByteLength; }
|
||||
|
||||
// wide-char versions
|
||||
void setWText(const LLWString& text);
|
||||
|
|
|
|||
|
|
@ -2450,6 +2450,18 @@ void LLTextEditor::insertText(LLWString &new_text)
|
|||
setEnabled( enabled );
|
||||
}
|
||||
|
||||
// <FS:Ansariel> Allow inserting a linefeed
|
||||
void LLTextEditor::insertLinefeed()
|
||||
{
|
||||
BOOL enabled = getEnabled();
|
||||
setEnabled( TRUE );
|
||||
|
||||
addLineBreakChar(FALSE);
|
||||
|
||||
setEnabled( enabled );
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
|
||||
void LLTextEditor::appendWidget(const LLInlineViewSegment::Params& params, const std::string& text, bool allow_undo)
|
||||
{
|
||||
// Save old state
|
||||
|
|
|
|||
|
|
@ -177,6 +177,8 @@ public:
|
|||
// inserts text at cursor
|
||||
void insertText(const std::string &text);
|
||||
void insertText(LLWString &text);
|
||||
// <FS:Ansariel> Allow inserting a linefeed
|
||||
void insertLinefeed();
|
||||
|
||||
void appendWidget(const LLInlineViewSegment::Params& params, const std::string& text, bool allow_undo);
|
||||
// Non-undoable
|
||||
|
|
|
|||
|
|
@ -1761,6 +1761,42 @@ bool FSFloaterIM::dropPerson(LLUUID* person_id, bool drop)
|
|||
return res;
|
||||
}
|
||||
|
||||
// virtual
|
||||
BOOL FSFloaterIM::handleKeyHere( KEY key, MASK mask )
|
||||
{
|
||||
BOOL handled = FALSE;
|
||||
|
||||
if (key == KEY_RETURN && mask == (MASK_SHIFT | MASK_CONTROL))
|
||||
{
|
||||
if (!gSavedSettings.getBOOL("FSUseSingleLineChatEntry"))
|
||||
{
|
||||
if ((wstring_utf8_length(mInputEditor->getWText()) + wchar_utf8_length('\n')) > mInputEditor->getMaxTextLength())
|
||||
{
|
||||
LLUI::reportBadKeystroke();
|
||||
}
|
||||
else
|
||||
{
|
||||
mInputEditor->insertLinefeed();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((wstring_utf8_length(mInputEditor->getWText()) + wchar_utf8_length(llwchar(182))) > mInputEditor->getMaxTextLength())
|
||||
{
|
||||
LLUI::reportBadKeystroke();
|
||||
}
|
||||
else
|
||||
{
|
||||
mInputEditor->insertText(LLWString(1, 182));
|
||||
}
|
||||
}
|
||||
|
||||
handled = TRUE;
|
||||
}
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
BOOL FSFloaterIM::isInviteAllowed() const
|
||||
{
|
||||
return ( (IM_SESSION_CONFERENCE_START == mDialog)
|
||||
|
|
|
|||
|
|
@ -122,6 +122,8 @@ public:
|
|||
void *cargo_data, EAcceptance *accept,
|
||||
std::string& tooltip_msg);
|
||||
|
||||
virtual BOOL handleKeyHere( KEY key, MASK mask );
|
||||
|
||||
/**
|
||||
* Returns true if chat is displayed in multi tabbed floater
|
||||
* false if chat is displayed in multiple windows
|
||||
|
|
|
|||
|
|
@ -708,8 +708,35 @@ BOOL FSFloaterNearbyChat::handleKeyHere( KEY key, MASK mask )
|
|||
sendChat(CHAT_TYPE_OOC);
|
||||
handled = TRUE;
|
||||
}
|
||||
else if (mask == (MASK_SHIFT | MASK_CONTROL))
|
||||
{
|
||||
if (!gSavedSettings.getBOOL("FSUseSingleLineChatEntry"))
|
||||
{
|
||||
if ((wstring_utf8_length(mInputEditor->getWText()) + wchar_utf8_length('\n')) > mInputEditor->getMaxTextLength())
|
||||
{
|
||||
LLUI::reportBadKeystroke();
|
||||
}
|
||||
else
|
||||
{
|
||||
mInputEditor->insertLinefeed();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((wstring_utf8_length(mInputEditor->getWText()) + wchar_utf8_length(llwchar(182))) > mInputEditor->getMaxTextLength())
|
||||
{
|
||||
LLUI::reportBadKeystroke();
|
||||
}
|
||||
else
|
||||
{
|
||||
mInputEditor->insertText(LLWString(1, 182));
|
||||
}
|
||||
}
|
||||
|
||||
handled = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -370,11 +370,11 @@ BOOL FSNearbyChatControl::handleKeyHere(KEY key, MASK mask )
|
|||
type = CHAT_TYPE_OOC;
|
||||
handled = TRUE;
|
||||
}
|
||||
else if (mask == MASK_NONE)
|
||||
else if (mask == (MASK_SHIFT | MASK_CONTROL))
|
||||
{
|
||||
// say
|
||||
type = CHAT_TYPE_NORMAL;
|
||||
handled = TRUE;
|
||||
addChar(llwchar(182));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue