summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dyukov <adyukov@productengine.com>2010-08-09 15:14:45 +0300
committerAndrew Dyukov <adyukov@productengine.com>2010-08-09 15:14:45 +0300
commit55c887225f230822f5ffcd1b1a01a87d17653bd7 (patch)
treef23c6a2e3e5044cd6ef1a7b326d003dba2cf3dc0
parent76922597c219f27c5372a8a92e26e77338eb2dc2 (diff)
EXT-8010 ADDITIONAL FIX Fixed problems with avatar links underlining.
There were two problems: 1. Underlining broke when avatar's first and second name were on different lines. 2. There was no underline on hover for avatar miniinspector links in plaintext IM. - First problem was caused by calling LLOnHoverChangeableTextSegment::draw() for the same segment twice- for first and second name that were on different lines, while handleHover() was called only once. So handleHover() was called -> text was underlined -> first part of segment was drawn underlined -> its draw set style back to normal -> second part of segment was drawn without underlining. Fixed this by setting style back to normal only when drawing the last part of the segment. - Second problem was caused by unusual way of appending link to text in chat history. Changed it so that LLTextBase::appendText() now receives link not inside style params, but directly. Also added "/inspect" ending to check in LLUrlEntryAgent::underlineOnHoverOnly(). Reviewed by Richard Nelson at https://codereview.productengine.com/secondlife/r/833/ --HG-- branch : product-engine
-rw-r--r--indra/llui/lltextbase.cpp5
-rw-r--r--indra/llui/llurlentry.cpp2
-rw-r--r--indra/newview/llchathistory.cpp5
-rw-r--r--indra/newview/llstylemap.cpp12
4 files changed, 10 insertions, 14 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index cde08c7b19..3792f18c97 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -2723,7 +2723,10 @@ LLOnHoverChangeableTextSegment::LLOnHoverChangeableTextSegment( LLStyleConstSP s
F32 LLOnHoverChangeableTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect)
{
F32 result = LLNormalTextSegment::draw(start, end, selection_start, selection_end, draw_rect);
- mStyle = mNormalStyle;
+ if (end == mEnd - mStart)
+ {
+ mStyle = mNormalStyle;
+ }
return result;
}
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index 17d211fb36..bf7b25910f 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -366,7 +366,7 @@ std::string LLUrlEntryAgent::getTooltip(const std::string &string) const
bool LLUrlEntryAgent::underlineOnHoverOnly(const std::string &string) const
{
std::string url = getUrl(string);
- return LLStringUtil::endsWith(url, "/about");
+ return LLStringUtil::endsWith(url, "/about") || LLStringUtil::endsWith(url, "/inspect");
}
std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 7c33923f04..7204e6c39c 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -699,8 +699,9 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
{
LLStyle::Params link_params(style_params);
link_params.overwriteFrom(LLStyleMap::instance().lookupAgent(chat.mFromID));
- // Convert the name to a hotlink and add to message.
- mEditor->appendText(chat.mFromName + delimiter, false, link_params);
+ // Add link to avatar's inspector and delimiter to message.
+ mEditor->appendText(link_params.link_href, false, style_params);
+ mEditor->appendText(delimiter, false, style_params);
}
else
{
diff --git a/indra/newview/llstylemap.cpp b/indra/newview/llstylemap.cpp
index 8fab3bb361..b3d7dddde8 100644
--- a/indra/newview/llstylemap.cpp
+++ b/indra/newview/llstylemap.cpp
@@ -46,20 +46,12 @@ const LLStyle::Params &LLStyleMap::lookupAgent(const LLUUID &source)
if (mMap.find(source) == mMap.end())
{
LLStyle::Params style_params;
- if (source != LLUUID::null && source != gAgent.getID() )
+ if (source != LLUUID::null)
{
style_params.color.control = "HTMLLinkColor";
style_params.readonly_color.control = "HTMLLinkColor";
- style_params.link_href =
- LLSLURL("agent", source, "inspect").getSLURLString();
+ style_params.link_href = LLSLURL("agent", source, "inspect").getSLURLString();
}
- else
- {
- // Make the resident's own name white and don't make the name clickable.
- style_params.color = LLColor4::white;
- style_params.readonly_color = LLColor4::white;
- }
-
mMap[source] = style_params;
}
return mMap[source];