More banging at name SLURL underlining on hover in chat history

master
Ansariel 2020-08-20 00:32:27 +02:00
parent 6719815ea5
commit 5f309fdcf7
4 changed files with 41 additions and 23 deletions

View File

@ -33,7 +33,7 @@
#include "llui.h"
LLStyle::Params::Params()
: visible("visible", true),
: visible("visible", true),
drop_shadow("drop_shadow", LLFontGL::NO_SHADOW),
color("color", LLColor4::black),
readonly_color("readonly_color", LLColor4::black),
@ -44,7 +44,7 @@ LLStyle::Params::Params()
is_link("is_link"),
// <FS:Ansariel> Don't highlight URLs on hover if font style contains underline
use_default_link_style("use_default_link_style", true),
is_chat_header("is_chat_header", false)
can_underline_on_hover("can_underline_on_hover", true)
// </FS:Ansariel>
{}

View File

@ -50,7 +50,7 @@ public:
Optional<bool> is_link;
// <FS:Ansariel> Don't highlight URLs on hover if font style contains underline
Optional<bool> use_default_link_style;
Optional<bool> is_chat_header;
Optional<bool> can_underline_on_hover;
// </FS:Ansariel>
Params();
};

View File

@ -2260,15 +2260,7 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para
//link_params.overwriteFrom(match.getStyle());
if (input_params.use_default_link_style)
{
LLUIColor color(link_params.color());
LLUIColor readonly_color(link_params.readonly_color());
bool is_chat_header = link_params.is_chat_header();
link_params.overwriteFrom(match.getStyle());
if (is_chat_header)
{
link_params.color = color;
link_params.readonly_color = readonly_color;
}
}
// </FS:Ansariel>
@ -2309,7 +2301,7 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para
// <FS:CR> FIRE-11437 - Don't supress font style for chat history name links
//appendAndHighlightTextImpl(match.getLabel(), part, link_params, match.underlineOnHoverOnly());
appendAndHighlightTextImpl(match.getLabel(), part, link_params,
input_params.use_default_link_style ? match.underlineOnHoverOnly() : false);
input_params.can_underline_on_hover ? match.underlineOnHoverOnly() : false);
// </FS:CR>
bool tooltip_required = !match.getTooltip().empty();
@ -2330,7 +2322,7 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para
static LLUIColor query_part_color = LLUIColorTable::getInstance()->getColor("UriQueryPartColor", LLColor4::grey);
link_params.color = query_part_color;
link_params.readonly_color = query_part_color;
appendAndHighlightTextImpl(label, part, link_params, input_params.use_default_link_style ? match.underlineOnHoverOnly() : false);
appendAndHighlightTextImpl(label, part, link_params, input_params.can_underline_on_hover ? match.underlineOnHoverOnly() : false);
// </FS:Ansariel>
// set the tooltip for the query part of url
@ -2506,7 +2498,16 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig
LLTextSegmentPtr segmentp;
if (underline_on_hover_only || mSkipLinkUnderline)
{
highlight_params.font.style("NORMAL");
// <FS:Ansariel> Only reset underline font style
//highlight_params.font.style("NORMAL");
std::string normal_font_style(highlight_params.font.style());
LLStringUtil::replaceString(normal_font_style, "UNDERLINE", "");
if (normal_font_style.empty())
{
normal_font_style = "NORMAL";
}
highlight_params.font.style(normal_font_style);
// </FS:Ansariel>
LLStyleConstSP normal_sp(new LLStyle(highlight_params));
segmentp = new LLOnHoverChangeableTextSegment(sp, normal_sp, cur_length, cur_length + wide_text.size(), *this);
}

View File

@ -1255,12 +1255,14 @@ void FSChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
LLStyle::Params name_params(body_message_params);
name_params.color(name_color);
name_params.readonly_color(name_color);
name_params.is_chat_header(true);
std::string name_font_style_postfix = use_plain_text_chat_history ? "UNDERLINE" : "";
name_params.font.style = name_font_style_postfix; // This will be used when hovering the name (LLTextBase::appendAndHighlightTextImpl() will filter it out)
std::string delimiter_style = "NORMAL";
// FS:LO FIRE-2899 - Faded text for IMs in nearby chat
F32 FSIMChatHistoryFade = gSavedSettings.getF32("FSIMChatHistoryFade");
if(FSIMChatHistoryFade > 1.0f)
if (FSIMChatHistoryFade > 1.0f)
{
FSIMChatHistoryFade = 1.0f;
gSavedSettings.setF32("FSIMChatHistoryFade",FSIMChatHistoryFade);
@ -1291,22 +1293,24 @@ void FSChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
delimiter = LLStringUtil::null;
// italics for emotes -Zi
if(gSavedSettings.getBOOL("EmotesUseItalic"))
if (gSavedSettings.getBOOL("EmotesUseItalic"))
{
body_message_params.font.style = "ITALIC";
name_params.font.style = "ITALIC";
name_params.font.style = "ITALIC" + name_font_style_postfix;
}
}
if (chat.mChatType == CHAT_TYPE_WHISPER && gSavedSettings.getBOOL("FSEmphasizeShoutWhisper"))
{
body_message_params.font.style = "ITALIC";
name_params.font.style = "ITALIC";
name_params.font.style = "ITALIC" + name_font_style_postfix;
delimiter_style = "ITALIC";
}
else if(chat.mChatType == CHAT_TYPE_SHOUT && gSavedSettings.getBOOL("FSEmphasizeShoutWhisper"))
{
body_message_params.font.style = "BOLD";
name_params.font.style = "BOLD";
name_params.font.style = "BOLD" + name_font_style_postfix;
delimiter_style = "BOLD";
}
bool message_from_log = chat.mChatStyle == CHAT_STYLE_HISTORY;
@ -1326,11 +1330,23 @@ void FSChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
U32 moderator_body_style_value = gSavedSettings.getU32("FSModTextStyle");
std::string moderator_name_style = applyModeratorStyle(moderator_name_style_value);
std::string moderator_body_style = applyModeratorStyle(moderator_body_style_value);
std::string moderator_timestamp_style = moderator_name_style;
if (chat.mChatStyle == CHAT_STYLE_MODERATOR)
{
moderator_style_active = true;
delimiter_style = moderator_name_style;
if (moderator_name_style_value < UNDERLINE)
{
// Need to add "UNDERLINE" here because we want to underline the name on hover
moderator_name_style += name_font_style_postfix;
}
else
{
// Always contains underline - don't show it on hover only
name_params.can_underline_on_hover = false;
}
name_params.font.style(moderator_name_style);
body_message_params.font.style(moderator_body_style);
@ -1339,6 +1355,7 @@ void FSChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
if ( (ITALIC & moderator_name_style_value) != ITALIC )//HG: if ITALIC isn't one of the styles... add it
{
moderator_name_style += "ITALIC";
moderator_timestamp_style += "ITALIC";
name_params.font.style(moderator_name_style);
}
if ( (ITALIC & moderator_body_style_value) != ITALIC )
@ -1374,7 +1391,7 @@ void FSChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
//<FS:HG> FS-1734 seperate name and text styles for moderator
if ( moderator_style_active )
{
timestamp_style.font.style(moderator_name_style);
timestamp_style.font.style(moderator_timestamp_style);
}
//</FS:HG> FS-1734 seperate name and text styles for moderator
appendText("[" + chat.mTimeStr + "] ", prependNewLineState, timestamp_style);
@ -1447,7 +1464,7 @@ void FSChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
}
}
name_params.use_default_link_style = (!moderator_style_active || moderator_name_style_value == 0);
name_params.use_default_link_style = false;
name_params.link_href = LLSLURL("agent", chat.mFromID, "inspect").getSLURLString();
if (from_me && gSavedSettings.getBOOL("FSChatHistoryShowYou"))
@ -1465,7 +1482,7 @@ void FSChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
if (delimiter.length() > 0 && delimiter[0] == ':')
{
LLStyle::Params delimiter_params(body_message_params);
delimiter_params.font.style = name_params.font.style;
delimiter_params.font.style = delimiter_style;
appendText(":", prependNewLineState, delimiter_params);
prependNewLineState = false;