diff options
author | angela <angela@lindenlab.com> | 2009-11-12 21:20:18 +0800 |
---|---|---|
committer | angela <angela@lindenlab.com> | 2009-11-12 21:20:18 +0800 |
commit | 11fc2da6fa5fba0bb659dd97f8533e4529aece06 (patch) | |
tree | 8bacc0518c6556c341780d325de9c968d7abaeb3 /indra/newview/llnearbychat.cpp | |
parent | b1a81afef6395e136f26e296311ec9b57eef260e (diff) |
make color and font affecting both nearby chat and toasts
Diffstat (limited to 'indra/newview/llnearbychat.cpp')
-rw-r--r-- | indra/newview/llnearbychat.cpp | 107 |
1 files changed, 9 insertions, 98 deletions
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index ac806d7106..85db69174d 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -132,120 +132,31 @@ void LLNearbyChat::applySavedVariables() } } -LLColor4 nearbychat_get_text_color(const LLChat& chat) -{ - LLColor4 text_color; - - if(chat.mMuted) - { - text_color.setVec(0.8f, 0.8f, 0.8f, 1.f); - } - else - { - switch(chat.mSourceType) - { - case CHAT_SOURCE_SYSTEM: - text_color = LLUIColorTable::instance().getColor("SystemChatColor"); - break; - case CHAT_SOURCE_AGENT: - if (chat.mFromID.isNull()) - { - text_color = LLUIColorTable::instance().getColor("SystemChatColor"); - } - else - { - if(gAgentID == chat.mFromID) - { - text_color = LLUIColorTable::instance().getColor("UserChatColor"); - } - else - { - text_color = LLUIColorTable::instance().getColor("AgentChatColor"); - } - } - break; - case CHAT_SOURCE_OBJECT: - if (chat.mChatType == CHAT_TYPE_DEBUG_MSG) - { - text_color = LLUIColorTable::instance().getColor("ScriptErrorColor"); - } - else if ( chat.mChatType == CHAT_TYPE_OWNER ) - { - text_color = LLUIColorTable::instance().getColor("llOwnerSayChatColor"); - } - else - { - text_color = LLUIColorTable::instance().getColor("ObjectChatColor"); - } - break; - default: - text_color.setToWhite(); - } - - if (!chat.mPosAgent.isExactlyZero()) - { - LLVector3 pos_agent = gAgent.getPositionAgent(); - F32 distance = dist_vec(pos_agent, chat.mPosAgent); - if (distance > gAgent.getNearChatRadius()) - { - // diminish far-off chat - text_color.mV[VALPHA] = 0.8f; - } - } - } - - return text_color; -} - -void LLNearbyChat::add_timestamped_line(const LLChat& chat, const LLColor4& color) -{ - S32 font_size = gSavedSettings.getS32("ChatFontSize"); - - const LLFontGL* fontp = NULL; - switch(font_size) - { - case 0: - fontp = LLFontGL::getFontSansSerifSmall(); - break; - default: - case 1: - fontp = LLFontGL::getFontSansSerif(); - break; - case 2: - fontp = LLFontGL::getFontSansSerifBig(); - break; - } - - LLStyle::Params style_params; - style_params.color(color); - style_params.font(fontp); - LLUUID uuid = chat.mFromID; - std::string from = chat.mFromName; - std::string message = chat.mText; - mChatHistory->appendWidgetMessage(chat, style_params); -} - void LLNearbyChat::addMessage(const LLChat& chat) { - LLColor4 color = nearbychat_get_text_color(chat); - if (chat.mChatType == CHAT_TYPE_DEBUG_MSG) { if(gSavedSettings.getBOOL("ShowScriptErrors") == FALSE) return; if (gSavedSettings.getS32("ShowScriptErrorsLocation")== 1)// show error in window //("ScriptErrorsAsChat")) { + + LLColor4 txt_color; + + LLViewerChat::getChatColor(chat,txt_color); + LLFloaterScriptDebug::addScriptLine(chat.mText, chat.mFromName, - color, + txt_color, chat.mFromID); return; } } - // could flash the chat button in the status bar here. JC if (!chat.mMuted) - add_timestamped_line(chat, color); + { + mChatHistory->appendWidgetMessage(chat); + } } void LLNearbyChat::onNearbySpeakers() |