From dd9b1f819de025f1a6caa37cfbd4fd3394f9fa9e Mon Sep 17 00:00:00 2001 From: angela Date: Mon, 23 Nov 2009 17:33:03 +0800 Subject: EXT-2297 Functionality Loss - Ability to copy (control+c) residents name from their profile & local chat --- indra/newview/llchathistory.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llchathistory.cpp') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 4ce3b50ed5..a95234099c 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -34,6 +34,7 @@ #include "llchathistory.h" #include "llpanel.h" #include "lltextbox.h" +#include "lltexteditor.h" #include "lluictrlfactory.h" #include "llscrollcontainer.h" #include "llavatariconctrl.h" @@ -185,7 +186,7 @@ public: mSourceType = CHAT_SOURCE_SYSTEM; } - LLTextBox* userName = getChild("user_name"); + LLTextEditor* userName = getChild("user_name"); LLUIColor color = style_params.color; userName->setReadOnlyColor(color); -- cgit v1.2.3 From 9e403da7b0fd013371e73820b8aa70820f4f620b Mon Sep 17 00:00:00 2001 From: Sergey Borushevsky Date: Mon, 23 Nov 2009 20:34:06 +0200 Subject: Implemented major sub-task EXT-2517 (Add support for the viewer 1.23 chat history style (widget-less)) --HG-- branch : product-engine --- indra/newview/llchathistory.cpp | 94 ++++++++++++++++++++++++----------------- 1 file changed, 56 insertions(+), 38 deletions(-) (limited to 'indra/newview/llchathistory.cpp') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 4ce3b50ed5..422aae3c25 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -334,20 +334,14 @@ LLView* LLChatHistory::getHeader(const LLChat& chat,const LLStyle::Params& style return header; } -void LLChatHistory::appendWidgetMessage(const LLChat& chat, const LLStyle::Params& input_append_params) +void LLChatHistory::clear() { - LLView* view = NULL; - std::string view_text = "\n[" + chat.mTimeStr + "] "; - if (utf8str_trim(chat.mFromName).size() != 0 && chat.mFromName != SYSTEM_FROM) - view_text += chat.mFromName + ": "; - - - LLInlineViewSegment::Params p; - p.force_newline = true; - p.left_pad = mLeftWidgetPad; - p.right_pad = mRightWidgetPad; + mLastFromName.clear(); + LLTextEditor::clear(); +} - +void LLChatHistory::appendMessage(const LLChat& chat, const bool use_plain_text_chat_history, const LLStyle::Params& input_append_params) +{ LLColor4 txt_color = LLUIColorTable::instance().getColor("White"); LLViewerChat::getChatColor(chat,txt_color); LLFontGL* fontp = LLViewerChat::getChatFont(); @@ -360,39 +354,63 @@ void LLChatHistory::appendWidgetMessage(const LLChat& chat, const LLStyle::Param style_params.font.size(font_size); style_params.font.style(input_append_params.font.style); - + std::string header_text = "[" + chat.mTimeStr + "] "; + if (utf8str_trim(chat.mFromName).size() != 0 && chat.mFromName != SYSTEM_FROM) + header_text += chat.mFromName + ": "; - if (mLastFromName == chat.mFromName) + if (use_plain_text_chat_history) { - view = getSeparator(); - p.top_pad = mTopSeparatorPad; - p.bottom_pad = mBottomSeparatorPad; + appendText(header_text, getText().size() != 0, style_params); } else { - view = getHeader(chat,style_params); - if (getText().size() == 0) - p.top_pad = 0; + LLView* view = NULL; + LLInlineViewSegment::Params p; + p.force_newline = true; + p.left_pad = mLeftWidgetPad; + p.right_pad = mRightWidgetPad; + + if (mLastFromName == chat.mFromName) + { + view = getSeparator(); + p.top_pad = mTopSeparatorPad; + p.bottom_pad = mBottomSeparatorPad; + } else - p.top_pad = mTopHeaderPad; - p.bottom_pad = mBottomHeaderPad; - + { + view = getHeader(chat, style_params); + if (getText().size() == 0) + p.top_pad = 0; + else + p.top_pad = mTopHeaderPad; + p.bottom_pad = mBottomHeaderPad; + + } + p.view = view; + + //Prepare the rect for the view + LLRect target_rect = getDocumentView()->getRect(); + // squeeze down the widget by subtracting padding off left and right + target_rect.mLeft += mLeftWidgetPad + mHPad; + target_rect.mRight -= mRightWidgetPad; + view->reshape(target_rect.getWidth(), view->getRect().getHeight()); + view->setOrigin(target_rect.mLeft, view->getRect().mBottom); + + appendWidget(p, header_text, false); + mLastFromName = chat.mFromName; } - p.view = view; - - //Prepare the rect for the view - LLRect target_rect = getDocumentView()->getRect(); - // squeeze down the widget by subtracting padding off left and right - target_rect.mLeft += mLeftWidgetPad + mHPad; - target_rect.mRight -= mRightWidgetPad; - view->reshape(target_rect.getWidth(), view->getRect().getHeight()); - view->setOrigin(target_rect.mLeft, view->getRect().mBottom); - - appendWidget(p, view_text, false); - - //Append the text message - appendText(chat.mText, FALSE, style_params); + //Handle IRC styled /me messages. + std::string prefix = chat.mText.substr(0, 4); + if (prefix == "/me " || prefix == "/me'") + { + style_params.font.style = "ITALIC"; - mLastFromName = chat.mFromName; + if (chat.mFromName.size() > 0) + appendText(chat.mFromName + " ", TRUE, style_params); + appendText(chat.mText.substr(4), FALSE, style_params); + } + else + appendText(chat.mText, FALSE, style_params); blockUndo(); } + -- cgit v1.2.3 From cfccf4d5145274f7bfe1c88b7e51c000461226e8 Mon Sep 17 00:00:00 2001 From: angela Date: Tue, 24 Nov 2009 11:54:33 +0800 Subject: EXT-2780 allow_scroll = false in LLTextEditor will crash the viewer --- indra/newview/llchathistory.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'indra/newview/llchathistory.cpp') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index a95234099c..24fa28c6cd 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -33,12 +33,10 @@ #include "llviewerprecompiledheaders.h" #include "llchathistory.h" #include "llpanel.h" -#include "lltextbox.h" -#include "lltexteditor.h" #include "lluictrlfactory.h" #include "llscrollcontainer.h" #include "llavatariconctrl.h" - +#include "lltexteditor.h" #include "llimview.h" #include "llcallingcard.h" //for LLAvatarTracker #include "llagentdata.h" @@ -188,9 +186,8 @@ public: LLTextEditor* userName = getChild("user_name"); - LLUIColor color = style_params.color; - userName->setReadOnlyColor(color); - userName->setColor(color); + userName->setReadOnlyColor(style_params.readonly_color()); + userName->setColor(style_params.color()); if(!chat.mFromName.empty()) { @@ -204,7 +201,7 @@ public: } - LLTextBox* timeBox = getChild("time_box"); + LLUICtrl* timeBox = getChild("time_box"); timeBox->setValue(chat.mTimeStr); LLAvatarIconCtrl* icon = getChild("avatar_icon"); -- cgit v1.2.3 From d93cece450b0f3897fa472d86db837274d35643b Mon Sep 17 00:00:00 2001 From: angela Date: Tue, 24 Nov 2009 15:01:51 +0800 Subject: fix crash error for missing string RegisterDateFormat in panel_profile_user.xml --- indra/newview/llchathistory.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llchathistory.cpp') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 24fa28c6cd..1d4878dc50 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -36,7 +36,6 @@ #include "lluictrlfactory.h" #include "llscrollcontainer.h" #include "llavatariconctrl.h" -#include "lltexteditor.h" #include "llimview.h" #include "llcallingcard.h" //for LLAvatarTracker #include "llagentdata.h" -- cgit v1.2.3 From 67ef3059b5a0084c6e501ae088cedf79d97f4277 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Tue, 24 Nov 2009 13:20:31 +0200 Subject: Work on critical sub-task EXT-2615 (IM Chat History is severely broken) -- Implemented fitting of the timestamp in Chat History header panel depend on time string width --HG-- branch : product-engine --- indra/newview/llchathistory.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'indra/newview/llchathistory.cpp') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 422aae3c25..dbb8e0fef4 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -202,10 +202,8 @@ public: userName->setValue(SL); } + setTimeField(chat.mTimeStr); - LLTextBox* timeBox = getChild("time_box"); - timeBox->setValue(chat.mTimeStr); - LLAvatarIconCtrl* icon = getChild("avatar_icon"); if(mSourceType != CHAT_SOURCE_AGENT) @@ -271,7 +269,29 @@ protected: } } - +private: + void setTimeField(const std::string& time_value) + { + LLTextBox* time_box = getChild("time_box"); + + LLRect rect_before = time_box->getRect(); + time_box->setValue(time_value); + + // set necessary textbox width to fit all text + time_box->reshapeToFitText(); + LLRect rect_after = time_box->getRect(); + + // move rect to the left to correct position... + llinfos << "WWW: " << rect_before << rect_after << llendl; + S32 delta_pos_x = rect_before.getWidth() - rect_after.getWidth(); + S32 delta_pos_y = rect_before.getHeight() - rect_after.getHeight(); + time_box->translate(delta_pos_x, delta_pos_y); + + //... & change width of the name control + LLTextBox* user_name = getChild("user_name"); + const LLRect& user_rect = user_name->getRect(); + user_name->reshape(user_rect.getWidth() + delta_pos_x, user_rect.getHeight()); + } protected: LLHandle mPopupMenuHandleAvatar; -- cgit v1.2.3 From 96199e2d90eb5c8c5da04ab40b3c41ca3fd5eddc Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Tue, 24 Nov 2009 13:22:56 +0200 Subject: Remove unnecessary log message --HG-- branch : product-engine --- indra/newview/llchathistory.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llchathistory.cpp') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index dbb8e0fef4..533940943e 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -282,7 +282,6 @@ private: LLRect rect_after = time_box->getRect(); // move rect to the left to correct position... - llinfos << "WWW: " << rect_before << rect_after << llendl; S32 delta_pos_x = rect_before.getWidth() - rect_after.getWidth(); S32 delta_pos_y = rect_before.getHeight() - rect_after.getHeight(); time_box->translate(delta_pos_x, delta_pos_y); -- cgit v1.2.3