diff options
Diffstat (limited to 'indra/newview/llviewerchat.cpp')
-rw-r--r-- | indra/newview/llviewerchat.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/indra/newview/llviewerchat.cpp b/indra/newview/llviewerchat.cpp index 286b16bab2..e06fe7bda0 100644 --- a/indra/newview/llviewerchat.cpp +++ b/indra/newview/llviewerchat.cpp @@ -29,6 +29,8 @@ // newview includes #include "llagent.h" // gAgent +#include "llslurl.h" +#include "lluicolor.h" #include "lluicolortable.h" #include "llviewercontrol.h" // gSavedSettings #include "llviewerregion.h" @@ -36,6 +38,7 @@ #include "llinstantmessage.h" //SYSTEM_FROM // LLViewerChat +LLViewerChat::font_change_signal_t LLViewerChat::sChatFontChangedSignal; //static void LLViewerChat::getChatColor(const LLChat& chat, LLColor4& r_color) @@ -89,8 +92,9 @@ void LLViewerChat::getChatColor(const LLChat& chat, LLColor4& r_color) if (!chat.mPosAgent.isExactlyZero()) { LLVector3 pos_agent = gAgent.getPositionAgent(); - F32 distance = dist_vec(pos_agent, chat.mPosAgent); - if (distance > gAgent.getNearChatRadius()) + F32 distance_squared = dist_vec_squared(pos_agent, chat.mPosAgent); + F32 dist_near_chat = gAgent.getNearChatRadius(); + if (distance_squared > dist_near_chat * dist_near_chat) { // diminish far-off chat r_color.mV[VALPHA] = 0.8f; @@ -154,8 +158,9 @@ void LLViewerChat::getChatColor(const LLChat& chat, std::string& r_color_name, F if (!chat.mPosAgent.isExactlyZero()) { LLVector3 pos_agent = gAgent.getPositionAgent(); - F32 distance = dist_vec(pos_agent, chat.mPosAgent); - if (distance > gAgent.getNearChatRadius()) + F32 distance_squared = dist_vec_squared(pos_agent, chat.mPosAgent); + F32 dist_near_chat = gAgent.getNearChatRadius(); + if (distance_squared > dist_near_chat * dist_near_chat) { // diminish far-off chat r_color_alpha = 0.8f; @@ -256,3 +261,16 @@ std::string LLViewerChat::getObjectImSLURL(const LLChat& chat, const LLSD& args) return url; } + +//static +boost::signals2::connection LLViewerChat::setFontChangedCallback(const font_change_signal_t::slot_type& cb) +{ + return sChatFontChangedSignal.connect(cb); +} + +//static +void LLViewerChat::signalChatFontChanged() +{ + // Notify all observers that our font has changed + sChatFontChangedSignal(getChatFont()); +} |