diff options
author | bea@american.lindenlab.com <bea@american.lindenlab.com> | 2009-12-04 13:29:05 -0800 |
---|---|---|
committer | bea@american.lindenlab.com <bea@american.lindenlab.com> | 2009-12-04 13:29:05 -0800 |
commit | dab659adea63c744aa72c27935f62cce91d8ab7a (patch) | |
tree | 8bcc1d3b5ebb46e64efc4ff784e5e27844f01da0 /indra/newview/llnearbychat.cpp | |
parent | 67d051e78cb9f7d1ba670b647229ac9974fb7896 (diff) | |
parent | bef221e3aa42b92586e5783811742afdbf05cd92 (diff) |
merge
Diffstat (limited to 'indra/newview/llnearbychat.cpp')
-rw-r--r-- | indra/newview/llnearbychat.cpp | 73 |
1 files changed, 53 insertions, 20 deletions
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 8f1dec1431..3a1ae5bf46 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -54,9 +54,11 @@ #include "llstylemap.h" #include "lldraghandle.h" -#include "lltrans.h" + #include "llbottomtray.h" #include "llnearbychatbar.h" +#include "llfloaterreg.h" +#include "lltrans.h" static const S32 RESIZE_BAR_THICKNESS = 3; @@ -145,7 +147,8 @@ std::string appendTime() return timeStr; } -void LLNearbyChat::addMessage(const LLChat& chat) + +void LLNearbyChat::addMessage(const LLChat& chat,bool archive) { if (chat.mChatType == CHAT_TYPE_DEBUG_MSG) { @@ -166,18 +169,15 @@ void LLNearbyChat::addMessage(const LLChat& chat) } } + LLChat& tmp_chat = const_cast<LLChat&>(chat); + + if(tmp_chat.mTimeStr.empty()) + tmp_chat.mTimeStr = appendTime(); + bool use_plain_text_chat_history = gSavedSettings.getBOOL("PlainTextChatHistory"); if (!chat.mMuted) { - std::string message = chat.mText; - - - LLChat& tmp_chat = const_cast<LLChat&>(chat); - - if(tmp_chat.mTimeStr.empty()) - tmp_chat.mTimeStr = appendTime(); - if (chat.mChatStyle == CHAT_STYLE_IRC) { LLColor4 txt_color = LLUIColorTable::instance().getColor("White"); @@ -190,23 +190,22 @@ void LLNearbyChat::addMessage(const LLChat& chat) append_style_params.readonly_color(txt_color); append_style_params.font.name(font_name); append_style_params.font.size(font_size); - if (chat.mFromName.size() > 0) - { - append_style_params.font.style = "ITALIC"; - LLChat add_chat=chat; - add_chat.mText = chat.mFromName + " "; - mChatHistory->appendMessage(add_chat, use_plain_text_chat_history, append_style_params); - } - - message = message.substr(3); append_style_params.font.style = "ITALIC"; - mChatHistory->appendText(message, FALSE, append_style_params); + + mChatHistory->appendMessage(chat, use_plain_text_chat_history, append_style_params); } else { mChatHistory->appendMessage(chat,use_plain_text_chat_history); } } + + if(archive) + { + mMessageArchive.push_back(chat); + if(mMessageArchive.size()>200) + mMessageArchive.erase(mMessageArchive.begin()); + } } void LLNearbyChat::onNearbySpeakers() @@ -256,3 +255,37 @@ void LLNearbyChat::getAllowedRect(LLRect& rect) { rect = gViewerWindow->getWorldViewRectScaled(); } + +void LLNearbyChat::updateChatHistoryStyle() +{ + mChatHistory->clear(); + for(std::vector<LLChat>::iterator it = mMessageArchive.begin();it!=mMessageArchive.end();++it) + { + addMessage(*it,false); + } +} + +//static +void LLNearbyChat::processChatHistoryStyleUpdate(const LLSD& newvalue) +{ + LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD()); + if(nearby_chat) + nearby_chat->updateChatHistoryStyle(); +} + + +//////////////////////////////////////////////////////////////////////////////// +// +void LLNearbyChat::onFocusReceived() +{ + setBackgroundOpaque(true); + LLPanel::onFocusReceived(); +} + +//////////////////////////////////////////////////////////////////////////////// +// +void LLNearbyChat::onFocusLost() +{ + setBackgroundOpaque(false); + LLPanel::onFocusLost(); +} |