diff options
author | James Cook <james@lindenlab.com> | 2010-02-11 10:09:23 -0800 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2010-02-11 10:09:23 -0800 |
commit | 9dd7924b19651abf393f7b0dee632904a6b8e52a (patch) | |
tree | b22f8ca3ecdf4ec8e5288102912dccdd7289f51f /indra/newview/llchathistory.cpp | |
parent | 301f250c1cd77711c0234d8ed4089453712f834e (diff) | |
parent | 39fe664b97b946daf7984b946fede6f04ae731c4 (diff) |
Merge
Diffstat (limited to 'indra/newview/llchathistory.cpp')
-rw-r--r-- | indra/newview/llchathistory.cpp | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 855d109784..6004c9f309 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -66,6 +66,8 @@ static LLDefaultChildRegistry::Register<LLChatHistory> r("chat_history"); const static std::string NEW_LINE(rawstr_to_utf8("\n")); +const static U32 LENGTH_OF_TIME_STR = std::string("12:00").length(); + // support for secondlife:///app/objectim/{UUID}/ SLapps class LLObjectIMHandler : public LLCommandHandler { @@ -116,7 +118,7 @@ public: //*TODO remake it using mouse enter/leave and static LLHandle<LLIconCtrl> to add/remove as a child BOOL handleToolTip(S32 x, S32 y, MASK mask) { - LLViewerTextEditor* name = getChild<LLViewerTextEditor>("user_name"); + LLTextBase* name = getChild<LLTextBase>("user_name"); if (name && name->parentPointInView(x, y) && mAvatarID.notNull() && SYSTEM_FROM != mFrom) { @@ -257,7 +259,7 @@ public: mSourceType = CHAT_SOURCE_SYSTEM; } - LLTextEditor* userName = getChild<LLTextEditor>("user_name"); + LLTextBox* userName = getChild<LLTextBox>("user_name"); userName->setReadOnlyColor(style_params.readonly_color()); userName->setColor(style_params.color()); @@ -284,7 +286,12 @@ public: if(!chat.mFromID.isNull()) { + if(mSourceType != CHAT_SOURCE_AGENT) + icon->setValue(LLSD("OBJECT_Icon")); + else icon->setValue(chat.mFromID); + + } else if (userName->getValue().asString()==LLTrans::getString("SECOND_LIFE")) { @@ -295,7 +302,7 @@ public: /*virtual*/ void draw() { - LLTextEditor* user_name = getChild<LLTextEditor>("user_name"); + LLTextBox* user_name = getChild<LLTextBox>("user_name"); LLTextBox* time_box = getChild<LLTextBox>("time_box"); LLRect user_name_rect = user_name->getRect(); @@ -437,6 +444,7 @@ LLChatHistory::LLChatHistory(const LLChatHistory::Params& p) editor_params.rect = getLocalRect(); editor_params.follows.flags = FOLLOWS_ALL; editor_params.enabled = false; // read only + editor_params.show_context_menu = "true"; mEditor = LLUICtrlFactory::create<LLTextEditor>(editor_params, this); } @@ -531,6 +539,7 @@ void LLChatHistory::clear() void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LLStyle::Params& input_append_params) { bool use_plain_text_chat_history = args["use_plain_text_chat_history"].asBoolean(); + if (!mEditor->scrolledToEnd() && chat.mFromID != gAgent.getID() && !chat.mFromName.empty()) { mUnreadChatSources.insert(chat.mFromName); @@ -578,9 +587,16 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL bool irc_me = prefix == "/me " || prefix == "/me'"; // Delimiter after a name in header copy/past and in plain text mode - std::string delimiter = (chat.mChatType != CHAT_TYPE_SHOUT && chat.mChatType != CHAT_TYPE_WHISPER) - ? ": " - : " "; + std::string delimiter = ": "; + std::string shout = LLTrans::getString("shout"); + std::string whisper = LLTrans::getString("whisper"); + if (chat.mChatType == CHAT_TYPE_SHOUT || + chat.mChatType == CHAT_TYPE_WHISPER || + chat.mText.compare(0, shout.length(), shout) == 0 || + chat.mText.compare(0, whisper.length(), whisper) == 0) + { + delimiter = " "; + } // Don't add any delimiter after name in irc styled messages if (irc_me || chat.mChatStyle == CHAT_STYLE_IRC) @@ -589,6 +605,14 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL style_params.font.style = "ITALIC"; } + //*HACK we graying out chat history by graying out messages that contains full date in a time string + bool message_from_log = chat.mTimeStr.length() > LENGTH_OF_TIME_STR; + if (message_from_log) + { + style_params.color(LLColor4::grey); + style_params.readonly_color(LLColor4::grey); + } + if (use_plain_text_chat_history) { mEditor->appendText("[" + chat.mTimeStr + "] ", mEditor->getText().size() != 0, style_params); @@ -624,10 +648,10 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL mEditor->appendText("<nolink>" + chat.mFromName + "</nolink>" + delimiter, false, link_params); } - else if ( chat.mFromName != SYSTEM_FROM && chat.mFromID.notNull() ) + else if ( chat.mFromName != SYSTEM_FROM && chat.mFromID.notNull() && !message_from_log) { LLStyle::Params link_params(style_params); - link_params.fillFrom(LLStyleMap::instance().lookupAgent(chat.mFromID)); + link_params.overwriteFrom(LLStyleMap::instance().lookupAgent(chat.mFromID)); // Convert the name to a hotlink and add to message. mEditor->appendText(chat.mFromName + delimiter, false, link_params); } |