Improve notifications a bit (mainly lets you click links in notices)

Actually respect the color they're supposed to be by setting text AFTER creation
Don't double up with setEnabled, we're setting read only through the constructor
Be Mouse Opaque, handle mouse events beyond scrolling, match group notices
Don't call things more than once, that's nonsense.
This commit is contained in:
Lirusaito
2019-01-19 05:07:01 -05:00
parent 4a0b012f5b
commit e284efa648
2 changed files with 4 additions and 6 deletions

View File

@@ -183,7 +183,6 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject,
LLColor4 semi_transparent(1.0f,1.0f,1.0f,0.8f);
text->setCursor(0,0);
text->setEnabled(FALSE);
text->setWordWrap(TRUE);
//text->setTabStop(FALSE); // was interfering with copy-and-paste
text->setTabsToNextField(TRUE);

View File

@@ -234,19 +234,18 @@ LLNotifyBox::LLNotifyBox(LLNotificationPtr notification)
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.
auto text = new LLTextEditor(std::string("box"), LLRect(x, y, getRect().getWidth()-2, mIsTip ? BOTTOM : BTN_TOP+16), MAX_LENGTH, message, sFont, FALSE, true);
auto text = new LLTextEditor(std::string("box"), LLRect(x, y, getRect().getWidth()-2, mIsTip ? BOTTOM : BTN_TOP+16), MAX_LENGTH, LLStringUtil::null, sFont, FALSE, true);
text->setWordWrap(TRUE);
text->setTabStop(FALSE);
text->setMouseOpaque(FALSE);
text->setMouseOpaque(TRUE);
text->setBorderVisible(FALSE);
text->setTakesNonScrollClicks(FALSE);
text->setTakesNonScrollClicks(TRUE);
text->setHideScrollbarForShortDocs(TRUE);
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
text->setEnabled(FALSE); // makes it read-only
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);
}