Add LLTextEditor::setLinkColor for when links need to be another color!

This fixes blue on blue in notices for the classic skin,
while it does affect other skins, it's not very noticeable.
Actually this change kinda makes links match skins better overall...
This commit is contained in:
Lirusaito
2019-01-19 06:18:44 -05:00
parent e284efa648
commit 74af7dc80e
3 changed files with 15 additions and 2 deletions

View File

@@ -274,6 +274,7 @@ LLTextEditor::LLTextEditor(
mWriteableBgColor(LLUI::sColorsGroup->getColor("TextBgWriteableColor")),
mReadOnlyBgColor(LLUI::sColorsGroup->getColor("TextBgReadOnlyColor")),
mFocusBgColor(LLUI::sColorsGroup->getColor("TextBgFocusColor")),
mLinkColor(nullptr),
mReadOnly(parse_html),
mWordWrap(FALSE),
mShowLineNumbers(FALSE),
@@ -378,6 +379,11 @@ LLTextEditor::LLTextEditor(
LLTextEditor::~LLTextEditor()
{
gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit()
if (mLinkColor)
{
delete mLinkColor;
mLinkColor = nullptr;
}
// Scrollbar is deleted by LLView
@@ -4187,7 +4193,7 @@ void LLTextEditor::appendTextImpl(const std::string &new_text, const LLStyleSP s
LLUrlMatch match;
LLStyleSP link_style(new LLStyle);
if (style) *link_style = *style;
link_style->setColor(LLUI::sConfigGroup->getColor4("HTMLLinkColor"));
link_style->setColor(mLinkColor ? *mLinkColor : LLUI::sConfigGroup->getColor4("HTMLLinkColor"));
auto append_substr = [&](const size_t& pos, const size_t& count)
{
appendAndHighlightText(text.substr(pos, count), part, style);

View File

@@ -260,6 +260,8 @@ public:
void setHandleEditKeysDirectly( BOOL b ) { mHandleEditKeysDirectly = b; }
// Use for when the link color needs to be changed to avoid looking awful
void setLinkColor(LLColor4* color) { if (mLinkColor) delete mLinkColor; mLinkColor = color; }
void setOnScrollEndCallback(void (*callback)(void*), void* userdata);
@@ -504,6 +506,7 @@ private:
// Data
//
LLKeywords mKeywords;
LLColor4* mLinkColor;
// Concrete LLTextCmd sub-classes used by the LLTextEditor base class
class LLTextCmdInsert;

View File

@@ -243,7 +243,11 @@ LLNotifyBox::LLNotifyBox(LLNotificationPtr notification)
text->setReadOnlyBgColor ( LLColor4::transparent ); // the background color of the box is manually
// rendered under the text box, therefore we want
// the actual text box to be transparent
text->setReadOnlyFgColor(gColors.getColor(mIsCaution && mIsTip ? "NotifyCautionWarnColor" : "NotifyTextColor")); //sets caution text color for tip notifications
auto text_color = gColors.getColor(mIsCaution && mIsTip ? "NotifyCautionWarnColor" : "NotifyTextColor");
text->setReadOnlyFgColor(text_color); //sets caution text color for tip notifications
if (!mIsCaution) // We could do some extra color math here to determine if bg's too close to link color, but let's just cross with the link color instead
text->setLinkColor(new LLColor4(lerp(text_color, gSavedSettings.getColor4("HTMLLinkColor"), 0.4)));
text->setTabStop(FALSE); // can't tab to it (may be a problem for scrolling via keyboard)
text->setText(message); // Now we can set the text, since colors have been set.
addChild(text);