From 74af7dc80ea05e89370391f90e4a30b2bfbe6bde Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Sat, 19 Jan 2019 06:18:44 -0500 Subject: [PATCH] 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... --- indra/llui/lltexteditor.cpp | 8 +++++++- indra/llui/lltexteditor.h | 3 +++ indra/newview/llnotify.cpp | 6 +++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 6dd73e665..3c085e536 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -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); diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 6e6bce7ee..66ed4ab39 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -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; diff --git a/indra/newview/llnotify.cpp b/indra/newview/llnotify.cpp index 3556f4a63..93e8b1663 100644 --- a/indra/newview/llnotify.cpp +++ b/indra/newview/llnotify.cpp @@ -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);