diff options
author | angela <angela@lindenlab.com> | 2009-11-17 16:34:06 +0800 |
---|---|---|
committer | angela <angela@lindenlab.com> | 2009-11-17 16:34:06 +0800 |
commit | 2217a677104ffadab8815a0886d66ac264e74792 (patch) | |
tree | 4f4f45bc490756a1a41fb09f39e1cdb50822dc4d | |
parent | ccc72757ef23fa7ffba066e5bdaf05e3f8a95cca (diff) | |
parent | 0098bf40ea73078e2164ae55a8fa2f9049d0d4e9 (diff) |
Automated merge with ssh://angela@hg.lindenlab.com/viewer/viewer-2-0/
-rw-r--r-- | indra/llrender/llfontgl.cpp | 7 | ||||
-rw-r--r-- | indra/llrender/llfontgl.h | 1 | ||||
-rw-r--r-- | indra/llui/lltextbase.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llchathistory.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llchathistory.h | 2 | ||||
-rw-r--r-- | indra/newview/llchatitemscontainerctrl.cpp | 34 | ||||
-rw-r--r-- | indra/newview/llexpandabletextbox.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llimfloater.cpp | 35 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llnearbychat.cpp | 32 | ||||
-rw-r--r-- | indra/newview/llnearbychathandler.cpp | 1 | ||||
-rw-r--r-- | indra/newview/lltoastimpanel.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llviewerchat.cpp | 17 | ||||
-rw-r--r-- | indra/newview/llviewerchat.h | 3 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 40 |
15 files changed, 165 insertions, 39 deletions
diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 793a526c26..9ba0cfc6b8 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -754,6 +754,13 @@ std::string LLFontGL::nameFromFont(const LLFontGL* fontp) return fontp->mFontDescriptor.getName(); } + +// static +std::string LLFontGL::sizeFromFont(const LLFontGL* fontp) +{ + return fontp->mFontDescriptor.getSize(); +} + // static std::string LLFontGL::nameFromHAlign(LLFontGL::HAlign align) { diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h index 5f2c86c6c1..bb7d8524e7 100644 --- a/indra/llrender/llfontgl.h +++ b/indra/llrender/llfontgl.h @@ -146,6 +146,7 @@ public: static U8 getStyleFromString(const std::string &style); static std::string nameFromFont(const LLFontGL* fontp); + static std::string sizeFromFont(const LLFontGL* fontp); static std::string nameFromHAlign(LLFontGL::HAlign align); static LLFontGL::HAlign hAlignFromName(const std::string& name); diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 7b1aaac35c..a06b7e237b 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1507,8 +1507,11 @@ void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, c link_params.color = match.getColor(); // apply font name from requested style_params std::string font_name = LLFontGL::nameFromFont(style_params.font()); - link_params.font.name.setIfNotProvided(font_name); - link_params.font.style = "UNDERLINE"; + std::string font_size = LLFontGL::sizeFromFont(style_params.font()); + link_params.font.name(font_name); + link_params.font.size(font_name); + link_params.font.style("UNDERLINE"); + link_params.link_href = match.getUrl(); // output the text before the Url diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 028bb7a384..f9c4a23f12 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -345,7 +345,7 @@ LLView* LLChatHistory::getHeader(const LLChat& chat,const LLStyle::Params& style return header; } -void LLChatHistory::appendWidgetMessage(const LLChat& chat) +void LLChatHistory::appendWidgetMessage(const LLChat& chat, const LLStyle::Params& input_append_params) { LLView* view = NULL; std::string view_text = "\n[" + formatCurrentTime() + "] "; @@ -361,12 +361,16 @@ void LLChatHistory::appendWidgetMessage(const LLChat& chat) LLColor4 txt_color = LLUIColorTable::instance().getColor("White"); LLViewerChat::getChatColor(chat,txt_color); - LLFontGL* fontp = LLViewerChat::getChatFont(); - + LLFontGL* fontp = LLViewerChat::getChatFont(); + std::string font_name = LLFontGL::nameFromFont(fontp); + std::string font_size = LLFontGL::sizeFromFont(fontp); LLStyle::Params style_params; style_params.color(txt_color); style_params.readonly_color(txt_color); - style_params.font(fontp); + style_params.font.name(font_name); + style_params.font.size(font_size); + style_params.font.style(input_append_params.font.style); + if (mLastFromName == chat.mFromName) diff --git a/indra/newview/llchathistory.h b/indra/newview/llchathistory.h index f689a225fe..c89d4b4ec6 100644 --- a/indra/newview/llchathistory.h +++ b/indra/newview/llchathistory.h @@ -109,7 +109,7 @@ class LLChatHistory : public LLTextEditor * @param time time of a message. * @param message message itself. */ - void appendWidgetMessage(const LLChat& chat); + void appendWidgetMessage(const LLChat& chat, const LLStyle::Params& input_append_params = LLStyle::Params()); private: std::string mLastFromName; diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp index d2e3247250..b1dee46d2e 100644 --- a/indra/newview/llchatitemscontainerctrl.cpp +++ b/indra/newview/llchatitemscontainerctrl.cpp @@ -160,10 +160,14 @@ void LLNearbyChatToastPanel::init(LLSD& notification) LLStyle::Params style_params; style_params.color(mTextColor); - style_params.font(mFont); - - std::string str_sender; +// style_params.font(mFont); + std::string font_name = LLFontGL::nameFromFont(mFont); + std::string font_style_size = LLFontGL::sizeFromFont(mFont); + style_params.font.name(font_name); + style_params.font.size(font_style_size); + std::string str_sender; + if(gAgentID != mFromID) str_sender = mFromName; else @@ -173,10 +177,28 @@ void LLNearbyChatToastPanel::init(LLSD& notification) caption->getChild<LLTextBox>("msg_time", false)->setText(appendTime() , style_params ); - LLChatMsgBox* msg_text = getChild<LLChatMsgBox>("msg_text", false); - msg_text->setText(mText, style_params); + + if(notification["chat_style"].asInteger()== CHAT_STYLE_IRC) + { + if (mFromName.size() > 0) + { + style_params.font.style = "ITALIC"; + + msg_text->setText(mFromName, style_params); + } + mText = mText.substr(3); + style_params.font.style = "UNDERLINE"; + msg_text->addText(mText,style_params); + } + else + { + msg_text->setText(mText, style_params); + } + + + LLUICtrl* msg_inspector = caption->getChild<LLUICtrl>("msg_inspector"); if(mSourceType != CHAT_SOURCE_AGENT) msg_inspector->setVisible(false); @@ -196,6 +218,8 @@ void LLNearbyChatToastPanel::setMessage (const LLChat& chat_msg) notification["from_id"] = chat_msg.mFromID; notification["time"] = chat_msg.mTime; notification["source"] = (S32)chat_msg.mSourceType; + notification["chat_type"] = (S32)chat_msg.mChatType; + notification["chat_style"] = (S32)chat_msg.mChatStyle; std::string r_color_name="White"; F32 r_color_alpha = 1.0f; diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp index 6d7da107ac..bd6936f05c 100644 --- a/indra/newview/llexpandabletextbox.cpp +++ b/indra/newview/llexpandabletextbox.cpp @@ -164,7 +164,7 @@ void LLExpandableTextBox::LLTextBoxEx::showExpandText() S32 last_line = visible_lines.second - 1; LLStyle::Params expander_style = getDefaultStyle(); - expander_style.font.name.setIfNotProvided(LLFontGL::nameFromFont(expander_style.font)); + expander_style.font.name(LLFontGL::nameFromFont(expander_style.font)); expander_style.font.style = "UNDERLINE"; expander_style.color = LLUIColorTable::instance().getColor("HTMLLinkColor"); LLExpanderSegment* expanderp = new LLExpanderSegment(new LLStyle(expander_style), getLineStart(last_line), getLength() + 1, mExpanderLabel, *this); diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index e3121fbc7a..2c6543d6ca 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -476,8 +476,39 @@ void LLIMFloater::updateMessages() chat.mFromID = from_id; chat.mFromName = from; chat.mText = message; - - mChatHistory->appendWidgetMessage(chat); + + //Handle IRC styled /me messages. + std::string prefix = message.substr(0, 4); + if (prefix == "/me " || prefix == "/me'") + { + + 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 (from.size() > 0) + { + append_style_params.font.style = "ITALIC"; + chat.mText = from + " "; + mChatHistory->appendWidgetMessage(chat, append_style_params); + } + + message = message.substr(3); + append_style_params.font.style = "UNDERLINE"; + mChatHistory->appendText(message, FALSE, append_style_params); + } + else + { + chat.mText = message; + mChatHistory->appendWidgetMessage(chat); + } mLastMessageIndex = msg["index"].asInteger(); } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index d7be09efa9..d18f9affe3 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -3937,7 +3937,6 @@ std::string LLObjectBridge::getLabelSuffix() const if( avatar && avatar->isWearingAttachment( mUUID ) )
{
std::string attachment_point_name = avatar->getAttachedPointName(mUUID);
- LLStringUtil::toLower(attachment_point_name);
LLStringUtil::format_map_t args;
args["[ATTACHMENT_POINT]"] = attachment_point_name.c_str();
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 029019a8dc..cae5c52378 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -155,7 +155,37 @@ void LLNearbyChat::addMessage(const LLChat& chat) if (!chat.mMuted) { - mChatHistory->appendWidgetMessage(chat); + 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->appendWidgetMessage(add_chat, append_style_params); + } + + message = message.substr(3); + append_style_params.font.style = "UNDERLINE"; + mChatHistory->appendText(message, FALSE, append_style_params); + } + else + { + mChatHistory->appendWidgetMessage(chat); + } } } diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index 458845fff3..74a75d0369 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -341,6 +341,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg) notification["time"] = chat_msg.mTime; notification["source"] = (S32)chat_msg.mSourceType; notification["chat_type"] = (S32)chat_msg.mChatType; + notification["chat_style"] = (S32)chat_msg.mChatStyle; std::string r_color_name = "White"; F32 r_color_alpha = 1.0f; diff --git a/indra/newview/lltoastimpanel.cpp b/indra/newview/lltoastimpanel.cpp index 1ea5f515b7..d2cc6d0726 100644 --- a/indra/newview/lltoastimpanel.cpp +++ b/indra/newview/lltoastimpanel.cpp @@ -51,14 +51,20 @@ LLToastIMPanel::LLToastIMPanel(LLToastIMPanel::Params &p) : LLToastPanel(p.notif mReplyBtn = getChild<LLButton>("reply"); LLStyle::Params style_params; + style_params.font.name(LLFontGL::nameFromFont(style_params.font)); + style_params.font.size(LLFontGL::sizeFromFont(style_params.font)); + style_params.font.style = "UNDERLINE"; + //Handle IRC styled /me messages. std::string prefix = p.message.substr(0, 4); if (prefix == "/me " || prefix == "/me'") { mMessage->clear(); - style_params.font.style= "ITALIC"; + + style_params.font.style ="ITALIC"; mMessage->appendText(p.from + " ", FALSE, style_params); - style_params.font.style= "UNDERLINE"; + + style_params.font.style = "UNDERLINE"; mMessage->appendText(p.message.substr(3), FALSE, style_params); } else diff --git a/indra/newview/llviewerchat.cpp b/indra/newview/llviewerchat.cpp index d65a060bbc..ccf9ce9056 100644 --- a/indra/newview/llviewerchat.cpp +++ b/indra/newview/llviewerchat.cpp @@ -201,3 +201,20 @@ S32 LLViewerChat::getChatFontSize() { return gSavedSettings.getS32("ChatFontSize"); } + + +//static +void LLViewerChat::formatChatMsg(const LLChat& chat, std::string& formated_msg) +{ + std::string tmpmsg = chat.mText; + + if(chat.mChatStyle == CHAT_STYLE_IRC) + { + formated_msg = chat.mFromName + tmpmsg.substr(3); + } + else + { + formated_msg = tmpmsg; + } + +}
\ No newline at end of file diff --git a/indra/newview/llviewerchat.h b/indra/newview/llviewerchat.h index d8840d5dd2..502d6ea7e5 100644 --- a/indra/newview/llviewerchat.h +++ b/indra/newview/llviewerchat.h @@ -45,8 +45,7 @@ public: static void getChatColor(const LLChat& chat, std::string& r_color_name, F32& r_color_alpha); static LLFontGL* getChatFont(); static S32 getChatFontSize(); - - + static void formatChatMsg(const LLChat& chat, std::string& formated_msg); }; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 0153116887..ef6a621323 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2343,14 +2343,14 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) std::string prefix = mesg.substr(0, 4); if (prefix == "/me " || prefix == "/me'") { - chat.mText = from_name; - chat.mText += mesg.substr(3); +// chat.mText = from_name; +// chat.mText += mesg.substr(3); ircstyle = TRUE; } - else - { +// else +// { chat.mText = mesg; - } +// } // Look for the start of typing so we can put "..." in the bubbles. if (CHAT_TYPE_START == chat.mChatType) @@ -2376,19 +2376,6 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) return; } - // We have a real utterance now, so can stop showing "..." and proceed. - if (chatter && chatter->isAvatar()) - { - LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE); - ((LLVOAvatar*)chatter)->stopTyping(); - - if (!is_muted && !is_busy) - { - visible_in_chat_bubble = gSavedSettings.getBOOL("UseChatBubbles"); - ((LLVOAvatar*)chatter)->addChat(chat); - } - } - // Look for IRC-style emotes if (ircstyle) { @@ -2428,6 +2415,23 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) chat.mText += mesg; } + // We have a real utterance now, so can stop showing "..." and proceed. + if (chatter && chatter->isAvatar()) + { + LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE); + ((LLVOAvatar*)chatter)->stopTyping(); + + if (!is_muted && !is_busy) + { + visible_in_chat_bubble = gSavedSettings.getBOOL("UseChatBubbles"); + std::string formated_msg = ""; + LLViewerChat::formatChatMsg(chat, formated_msg); + LLChat chat_bubble = chat; + chat_bubble.mText = formated_msg; + ((LLVOAvatar*)chatter)->addChat(chat_bubble); + } + } + if (chatter) { chat.mPosAgent = chatter->getPositionAgent(); |