summaryrefslogtreecommitdiff
path: root/indra/newview/llnearbychat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llnearbychat.cpp')
-rw-r--r--indra/newview/llnearbychat.cpp83
1 files changed, 36 insertions, 47 deletions
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp
index cd181ce865..a81d6b4025 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"
@@ -130,6 +131,8 @@ LLNearbyChat::LLNearbyChat(const LLSD& key)
mSpeakerMgr(NULL),
mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT)
{
+ setIsChrome(TRUE);
+ mKey = LLSD();
mIsNearbyChat = true;
mSpeakerMgr = LLLocalSpeakerMgr::getInstance();
}
@@ -137,19 +140,14 @@ LLNearbyChat::LLNearbyChat(const LLSD& key)
//virtual
BOOL LLNearbyChat::postBuild()
{
- mChatBox = getChild<LLLineEditor>("chat_editor");
+ mChatBox = getChild<LLChatEntry>("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<LLOutputMonitorCtrl>("chat_zone_indicator");
@@ -189,6 +187,21 @@ BOOL LLNearbyChat::postBuild()
return LLIMConversation::postBuild();
}
+// virtual
+void LLNearbyChat::refresh()
+{
+ displaySpeakingIndicator();
+ updateCallBtnState(LLVoiceClient::getInstance()->getUserPTTState());
+
+ // *HACK: Update transparency type depending on whether our children have focus.
+ // This is needed because this floater is chrome and thus cannot accept focus, so
+ // the transparency type setting code from LLFloater::setFocus() isn't reached.
+ if (getTransparencyType() != TT_DEFAULT)
+ {
+ setTransparencyType(hasFocus() ? TT_ACTIVE : TT_INACTIVE);
+ }
+}
+
void LLNearbyChat::onNearbySpeakers()
{
LLSD param;
@@ -382,11 +395,14 @@ LLNearbyChat* LLNearbyChat::getInstance()
return LLFloaterReg::getTypedInstance<LLNearbyChat>("chat_bar");
}
-//static
-//LLNearbyChat* LLNearbyChat::findInstance()
-//{
-// return LLFloaterReg::findTypedInstance<LLNearbyChat>("chat_bar");
-//}
+void LLNearbyChat::show()
+{
+ if (isChatMultiTab())
+ {
+ openFloater(getKey());
+ }
+ setVisible(TRUE);
+}
void LLNearbyChat::showHistory()
{
@@ -397,33 +413,6 @@ void LLNearbyChat::showHistory()
storeRectControl();
}
-void LLNearbyChat::showTranslationCheckbox(BOOL show)
-{
- getChild<LLUICtrl>("translate_chat_checkbox_lp")->setVisible(show);
-}
-
-BOOL LLNearbyChat::tick()
-{
- // This check is needed until LLFloaterReg::removeInstance() is synchronized with deleting the floater
- // via LLMortician::updateClass(), to avoid calling dead instances. See LLFloater::destroy().
- if (isDead()) return false;
-
- BOOL parents_retcode = LLIMConversation::tick();
-
- displaySpeakingIndicator();
- updateCallBtnState(LLVoiceClient::getInstance()->getUserPTTState());
-
- // *HACK: Update transparency type depending on whether our children have focus.
- // This is needed because this floater is chrome and thus cannot accept focus, so
- // the transparency type setting code from LLFloater::setFocus() isn't reached.
- if (getTransparencyType() != TT_DEFAULT)
- {
- setTransparencyType(hasFocus() ? TT_ACTIVE : TT_INACTIVE);
- }
-
- return parents_retcode;
-}
-
std::string LLNearbyChat::getCurrentChat()
{
return mChatBox ? mChatBox->getText() : LLStringUtil::null;
@@ -469,7 +458,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);
@@ -523,17 +512,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
@@ -591,11 +579,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,6 +782,7 @@ void LLNearbyChat::startChat(const char* line)
if (cb )
{
+ cb->show();
cb->setVisible(TRUE);
cb->setFocus(TRUE);
cb->mChatBox->setFocus(TRUE);
@@ -804,7 +793,7 @@ void LLNearbyChat::startChat(const char* line)
cb->mChatBox->setText(line_string);
}
- cb->mChatBox->setCursorToEnd();
+ cb->mChatBox->endOfDoc();
}
}