Fix unresolved links in caution notifications

This commit is contained in:
Liru Færs
2020-03-10 16:30:37 -04:00
parent 1c46c26e6b
commit 9b7aa959b0

View File

@@ -197,38 +197,16 @@ LLNotifyBox::LLNotifyBox(LLNotificationPtr notification)
x += HPAD + HPAD + 32;
// add a caution textbox at the top of a caution notification
if (mIsCaution && !mIsTip)
{
S32 caution_height = ((S32)sFont->getLineHeight() * 2) + VPAD;
auto caution_box = new LLTextBox(
std::string("caution_box"),
LLRect(x, y, getRect().getWidth() - 2, caution_height),
LLStringUtil::null,
sFont,
FALSE);
caution_box->setFontStyle(LLFontGL::BOLD);
caution_box->setColor(gColors.getColor("NotifyCautionWarnColor"));
caution_box->setBackgroundColor(gColors.getColor("NotifyCautionBoxColor"));
caution_box->setBorderVisible(FALSE);
caution_box->setWrappedText(notification->getMessage());
addChild(caution_box);
// adjust the vertical position of the next control so that
// it appears below the caution textbox
y = y - caution_height;
}
else
{
const S32 BTN_TOP = BOTTOM_PAD + (((mNumOptions-1+2)/3)) * (BTN_HEIGHT+VPAD);
// Tokenization on \n is handled by LLTextBox
const S32 MAX_LENGTH = 512 + 20 + DB_FIRST_NAME_BUF_SIZE + DB_LAST_NAME_BUF_SIZE + DB_INV_ITEM_NAME_BUF_SIZE; // For script dialogs: add space for title.
const auto height = mIsTip ? BOTTOM : BTN_TOP+16;
mText = new LLTextEditor(std::string("box"), LLRect(x, y, getRect().getWidth()-2, height), MAX_LENGTH, LLStringUtil::null, sFont, FALSE, true);
mText = new LLTextEditor(std::string("box"), LLRect(x, y, getRect().getWidth()-2, mIsTip ? BOTTOM : BTN_TOP+16), MAX_LENGTH, LLStringUtil::null, sFont, FALSE, true);
mText->setWordWrap(TRUE);
mText->setMouseOpaque(TRUE);
mText->setBorderVisible(FALSE);
@@ -238,12 +216,15 @@ LLNotifyBox::LLNotifyBox(LLNotificationPtr notification)
// rendered under the text box, therefore we want
// the actual text box to be transparent
auto text_color = gColors.getColor(mIsCaution && mIsTip ? "NotifyCautionWarnColor" : "NotifyTextColor");
auto text_color = gColors.getColor(mIsCaution ? "NotifyCautionWarnColor" : "NotifyTextColor");
LLStyleSP style = new LLStyle(true, text_color, LLStringUtil::null);
style->mBold = mIsCaution && !mIsTip;
mText->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
if (!mIsCaution || !mIsTip) // 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
mText->setLinkColor(new LLColor4(lerp(text_color, gSavedSettings.getColor4("HTMLLinkColor"), 0.4f)));
mText->setTabStop(FALSE); // can't tab to it (may be a problem for scrolling via keyboard)
mText->appendText(message,false,false,nullptr,!layout_script_dialog); // Now we can set the text, since colors have been set.
mText->appendText(message,false,false,style,!layout_script_dialog); // Now we can set the text, since colors have been set.
addChild(mText);
}