From 22fef0515f7a81327c42bac9126bc8accb2591fb Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 18 Aug 2009 00:05:35 +0000 Subject: EXT-495 IM windows don't autoscroll. Added track_bottom param to floater_im_session.xml text editor, as I believe there is an implicit reshape happening in the dialog. Also made the divider lines showing usernames for each IM suppress duplicates, more like local chat history. Reviewed with Leyla. --- indra/newview/llimpanel.cpp | 23 ++++++++++++++++------ indra/newview/llimpanel.h | 3 +++ .../skins/default/xui/en/floater_im_session.xml | 1 + 3 files changed, 21 insertions(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 46f3cb6998..1037ef0403 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -2014,6 +2014,7 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) mControlPanel(NULL), mSessionID(session_id), mLastMessageIndex(-1), + mLastFromName(), mDialog(IM_NOTHING_SPECIAL), mHistoryEditor(NULL), mInputEditor(NULL), @@ -2232,11 +2233,13 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id) void LLIMFloater::updateMessages() { - std::list messages = LLIMModel::instance().getMessages(mSessionID, mLastMessageIndex+1); if (messages.size()) { + LLUIColor divider_color = LLUIColorTable::instance().getColor("LtGray_50"); + LLUIColor chat_color = LLUIColorTable::instance().getColor("IMChatColor"); + std::ostringstream message; std::list::const_reverse_iterator iter = messages.rbegin(); std::list::const_reverse_iterator iter_end = messages.rend(); @@ -2244,12 +2247,20 @@ void LLIMFloater::updateMessages() { LLSD msg = *iter; - message << "[" << msg["time"].asString() << "] " << msg["from"].asString() << ": \n"; - mHistoryEditor->appendColoredText(message.str(), false, false, LLUIColorTable::instance().getColor("LtGray_50")); - message.str(""); + const bool prepend_newline = true; + std::string from = msg["from"].asString(); + if (mLastFromName != from) + { + message << from << " ----- " << msg["time"].asString(); + mHistoryEditor->appendColoredText(message.str(), false, + prepend_newline, divider_color); + message.str(""); + mLastFromName = from; + } - message << msg["message"].asString() << "\n"; - mHistoryEditor->appendColoredText(message.str(), false, false, LLUIColorTable::instance().getColor("IMChatColor")); + message << msg["message"].asString(); + mHistoryEditor->appendColoredText(message.str(), false, + prepend_newline, chat_color); message.str(""); mLastMessageIndex = msg["index"].asInteger(); diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h index 8650d8fa07..d35aca0e42 100644 --- a/indra/newview/llimpanel.h +++ b/indra/newview/llimpanel.h @@ -413,6 +413,9 @@ private: LLPanelChatControlPanel* mControlPanel; LLUUID mSessionID; S32 mLastMessageIndex; + // username of last user who added text to this conversation, used to + // suppress duplicate username divider bars + std::string mLastFromName; EInstantMessage mDialog; LLUUID mOtherParticipantUUID; LLViewerTextEditor* mHistoryEditor; diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index 61c98299a0..a102d64587 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -55,6 +55,7 @@ layout="topleft" max_length="2147483647" name="im_text" + track_bottom="true" width="195" word_wrap="true"> -- cgit v1.2.3