Feature Request: Add SinguAlwaysUnderlineLinks to always underline links

This commit is contained in:
Lirusaito
2019-04-11 03:47:49 -04:00
parent 12890af0cc
commit 7fc90d3dce
2 changed files with 21 additions and 3 deletions

View File

@@ -1592,6 +1592,11 @@ BOOL LLTextEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask)
return TRUE;
}
bool always_underline_links()
{
static const LLUICachedControl<bool> always_underline("SinguAlwaysUnderlineLinks");
return always_underline;
}
BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
{
@@ -1684,7 +1689,7 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
if (old_hover != mHoverSegment)
{
if (old_hover)
if (old_hover && !always_underline_links())
old_hover->underlineOnHover(false);
if (mHoverSegment)
mHoverSegment->underlineOnHover(true);
@@ -1699,7 +1704,7 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
void LLTextEditor::onMouseLeave(S32 x, S32 y, MASK mask)
{
if (mHoverSegment)
if (mHoverSegment && !always_underline_links())
{
mHoverSegment->underlineOnHover(false);
mHoverSegment = nullptr;
@@ -4308,7 +4313,9 @@ void LLTextEditor::appendTextImpl(const std::string &new_text, const LLStyleSP s
}
// Hack around colors looking bad on some backgrounds by allowing setting link color for this editor
if (mLinkColor) link_style->setColor(*mLinkColor);
appendAndHighlightText(link, part, link_style, true/*match.underlineOnHoverOnly()*/);
const auto always_underline(always_underline_links());
if (always_underline) link_style->mUnderline = true;
appendAndHighlightText(link, part, link_style, !always_underline/*match.underlineOnHoverOnly()*/);
};
const auto&& cb = force_replace_links ? boost::bind(&LLTextEditor::replaceUrl, this, _1, _2, _3) : LLUrlLabelCallback::slot_function_type();
while (!text.empty() && LLUrlRegistry::instance().findUrl(text, match, cb))

View File

@@ -1131,6 +1131,17 @@ Changing this setting only affects new text.</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>SinguAlwaysUnderlineLinks</key>
<map>
<key>Comment</key>
<string>Enable to always underline new links in text editors (and any you hover over after enabling this)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>SingularitySplashPagePrefix</key>
<map>
<key>Comment</key>