From 6bb554fc3661d3b8b1284db96bb7c7b0934df621 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Fri, 22 Jun 2012 16:54:42 +0300 Subject: CHUI-160 FIXED (Text entered in local chat text field scrolls up and becomes only partially visible after hitting return) - Replaced LLLineEditor with LLChatEntry in nearby chat - Moved reshape method from LLIMFloater to the base LLIMConversation so that vertical reshaping work properly for both LLNearbyChat and LLIMFloater --- indra/newview/llnearbychat.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'indra/newview/llnearbychat.cpp') diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 1b2d9b6801..29ab4384cb 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -30,6 +30,7 @@ #include "lliconctrl.h" #include "llappviewer.h" +#include "llchatentry.h" #include "llfloaterreg.h" #include "lltrans.h" #include "llimfloatercontainer.h" @@ -138,19 +139,14 @@ LLNearbyChat::LLNearbyChat(const LLSD& key) //virtual BOOL LLNearbyChat::postBuild() { - mChatBox = getChild("chat_editor"); + mChatBox = getChild("chat_editor"); mChatBox->setCommitCallback(boost::bind(&LLNearbyChat::onChatBoxCommit, this)); - mChatBox->setKeystrokeCallback(&onChatBoxKeystroke, this); + mChatBox->setKeystrokeCallback(boost::bind(&onChatBoxKeystroke, _1, this)); mChatBox->setFocusLostCallback(boost::bind(&onChatBoxFocusLost, _1, this)); mChatBox->setFocusReceivedCallback(boost::bind(&LLNearbyChat::onChatBoxFocusReceived, this)); - mChatBox->setIgnoreArrowKeys( FALSE ); mChatBox->setCommitOnFocusLost( FALSE ); - mChatBox->setRevertOnEsc( FALSE ); - mChatBox->setIgnoreTab(TRUE); mChatBox->setPassDelete(TRUE); - mChatBox->setReplaceNewlinesWithSpaces(FALSE); - mChatBox->setEnableLineHistory(TRUE); mChatBox->setFont(LLViewerChat::getChatFont()); // mOutputMonitor = getChild("chat_zone_indicator"); @@ -459,7 +455,7 @@ BOOL LLNearbyChat::matchChatTypeTrigger(const std::string& in_str, std::string* return string_was_found; } -void LLNearbyChat::onChatBoxKeystroke(LLLineEditor* caller, void* userdata) +void LLNearbyChat::onChatBoxKeystroke(LLTextEditor* caller, void* userdata) { LLFirstUse::otherAvatarChatFirst(false); @@ -513,17 +509,16 @@ void LLNearbyChat::onChatBoxKeystroke(LLLineEditor* caller, void* userdata) { std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size()); self->mChatBox->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part - S32 outlength = self->mChatBox->getLength(); // in characters // Select to end of line, starting from the character // after the last one the user typed. - self->mChatBox->setSelection(length, outlength); + self->mChatBox->selectNext(rest_of_match, false); } else if (matchChatTypeTrigger(utf8_trigger, &utf8_out_str)) { std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size()); self->mChatBox->setText(utf8_trigger + rest_of_match + " "); // keep original capitalization for user-entered part - self->mChatBox->setCursorToEnd(); + self->mChatBox->endOfDoc(); } //llinfos << "GESTUREDEBUG " << trigger @@ -581,11 +576,11 @@ void LLNearbyChat::sendChat( EChatType type ) { if (mChatBox) { - LLWString text = mChatBox->getConvertedText(); + LLWString text = mChatBox->getWText(); + LLWStringUtil::trim(text); + LLWStringUtil::replaceChar(text,182,'\n'); // Convert paragraph symbols back into newlines. if (!text.empty()) { - // store sent line in history, duplicates will get filtered - mChatBox->updateHistory(); // Check if this is destined for another channel S32 channel = 0; stripChannelNumber(text, &channel); @@ -794,7 +789,7 @@ void LLNearbyChat::startChat(const char* line) cb->mChatBox->setText(line_string); } - cb->mChatBox->setCursorToEnd(); + cb->mChatBox->endOfDoc(); } } -- cgit v1.2.3