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.cpp152
1 files changed, 41 insertions, 111 deletions
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp
index 974291a54e..80a6cc343f 100644
--- a/indra/newview/llnearbychat.cpp
+++ b/indra/newview/llnearbychat.cpp
@@ -89,8 +89,6 @@ BOOL LLNearbyChat::postBuild()
mChatHistory = getChild<LLChatHistory>("chat_history");
- setCanResize(true);
-
if(!LLDockableFloater::postBuild())
return false;
@@ -98,7 +96,7 @@ BOOL LLNearbyChat::postBuild()
{
setDockControl(new LLDockControl(
LLBottomTray::getInstance()->getNearbyChatBar(), this,
- getDockTongue(), LLDockControl::LEFT, boost::bind(&LLNearbyChat::getAllowedRect, this, _1)));
+ getDockTongue(), LLDockControl::TOP, boost::bind(&LLNearbyChat::getAllowedRect, this, _1)));
}
return true;
@@ -132,120 +130,61 @@ 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);
+ {
+ std::string message = chat.mText;
+ std::string prefix = message.substr(0, 4);
+
+ if (chat.mChatStyle == CHAT_STYLE_IRC)
+ {
+ LLColor4 txt_color = LLUIColorTable::instance().getColor("White");
+ LLViewerChat::getChatColor(chat,txt_color);
+ LLFontGL* fontp = LLViewerChat::getChatFont();
+ std::string font_name = LLFontGL::nameFromFont(fontp);
+ std::string font_size = LLFontGL::sizeFromFont(fontp);
+ LLStyle::Params append_style_params;
+ append_style_params.color(txt_color);
+ 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, false, append_style_params);
+ }
+
+ message = message.substr(3);
+ append_style_params.font.style = "ITALIC";
+ mChatHistory->appendText(message, FALSE, append_style_params);
+ }
+ else
+ {
+ mChatHistory->appendMessage(chat);
+ }
+ }
}
void LLNearbyChat::onNearbySpeakers()
@@ -276,13 +215,6 @@ void LLNearbyChat::onOpen(const LLSD& key )
}
}
-void LLNearbyChat::setDocked (bool docked, bool pop_on_undock)
-{
- LLDockableFloater::setDocked(docked, pop_on_undock);
-
- setCanResize(!docked);
-}
-
void LLNearbyChat::setRect (const LLRect &rect)
{
LLDockableFloater::setRect(rect);
@@ -290,7 +222,5 @@ void LLNearbyChat::setRect (const LLRect &rect)
void LLNearbyChat::getAllowedRect(LLRect& rect)
{
- rect = gViewerWindow->getWorldViewRect();
+ rect = gViewerWindow->getWorldViewRectScaled();
}
-
-