diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 33d710cb0..b9a3b73ca 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -293,6 +293,8 @@ LLTextEditor::LLTextEditor( mMouseDownY(0), mLastSelectionX(-1), mLastSelectionY(-1), + mParseHTML(parse_html), + mParseHighlights(false), mLastContextMenuX(-1), mLastContextMenuY(-1), mReflowNeeded(FALSE), @@ -343,7 +345,6 @@ LLTextEditor::LLTextEditor( mBorder = new LLViewBorder(std::string("text ed border"), LLRect(0, getRect().getHeight(), getRect().getWidth(), 0), LLViewBorder::BEVEL_IN, LLViewBorder::STYLE_LINE, UI_TEXTEDITOR_BORDER); addChild(mBorder); - mParseHTML = parse_html; appendText(default_text, FALSE, FALSE); resetDirty(); // Update saved text state @@ -741,7 +742,7 @@ LLMenuGL* LLTextEditor::createUrlContextMenu(S32 x, S32 y, const std::string &in return menu; } -void LLTextEditor::setText(const LLStringExplicit &utf8str) +void LLTextEditor::setText(const LLStringExplicit &utf8str, bool force_replace_links) { // clear out the existing text and segments mWText.clear(); @@ -756,7 +757,7 @@ void LLTextEditor::setText(const LLStringExplicit &utf8str) //LLStringUtil::removeCRLF(text); // appendText modifies mCursorPos... - appendText(utf8str, false, false); + appendText(utf8str, false, false, nullptr, force_replace_links); // ...so move cursor to top after appending text setCursorPos(0); @@ -766,9 +767,9 @@ void LLTextEditor::setText(const LLStringExplicit &utf8str) mTextIsUpToDate = true; } -void LLTextEditor::setWText(const LLWString& text) +void LLTextEditor::setWText(const LLWString& text, bool force_replace_links) { - setText(wstring_to_utf8str(text)); + setText(wstring_to_utf8str(text), force_replace_links); } // virtual @@ -4552,39 +4553,27 @@ void LLTextEditor::appendAndHighlightTextImpl(const std::string& new_text, S32 h // This is where we appendHighlightedText // If LindenUserDir is empty then we didn't login yet. // In that case we can't instantiate LLTextParser, which is initialized per user. - if (mParseHighlights && !gDirUtilp->getLindenUserDir(true).empty()) + LLTextParser* highlight = mParseHighlights && stylep && !gDirUtilp->getLindenUserDir(true).empty() ? LLTextParser::getInstance() : nullptr; + if (highlight) { - LLTextParser* highlight = LLTextParser::getInstance(); - - if (highlight && stylep) + const LLSD pieces = highlight->parsePartialLineHighlights(new_text, stylep->getColor(), (LLTextParser::EHighlightPosition)highlight_part); + auto cur_length = getLength(); + for (auto i = pieces.beginArray(), end = pieces.endArray(); i < end; ++i) { - LLStyleSP highlight_params(new LLStyle(*stylep)); - LLSD pieces = highlight->parsePartialLineHighlights(new_text, highlight_params->getColor(), (LLTextParser::EHighlightPosition)highlight_part); - for (S32 i=0;isetColor(lcolor); + const auto& piece = *i; + LLWString wide_text = utf8str_to_wstring(piece["text"].asString()); - LLWString wide_text; - wide_text = utf8str_to_wstring(pieces[i]["text"].asString()); - - S32 cur_length = getLength(); - insertStringNoUndo(cur_length, wide_text); - LLStyleSP sp(new LLStyle(*highlight_params)); - LLTextSegmentPtr segmentp; - segmentp = new LLTextSegment(sp, cur_length, cur_length + wide_text.size()); - if (underline_on_hover) segmentp->setUnderlineOnHover(true); - mSegments.push_back(segmentp); - } - return; + insertStringNoUndo(cur_length, wide_text); + LLStyleSP sp(new LLStyle(*stylep)); + sp->setColor(piece["color"]); + LLTextSegmentPtr segmentp = new LLTextSegment(sp, cur_length, cur_length += wide_text.size()); + if (underline_on_hover) segmentp->setUnderlineOnHover(true); + mSegments.push_back(segmentp); } } - //else + else { - LLWString wide_text; - wide_text = utf8str_to_wstring(new_text); + LLWString wide_text = utf8str_to_wstring(new_text); auto length = getLength(); auto insert_len = length + insertStringNoUndo(length, utf8str_to_wstring(new_text)); diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 0d92803b4..c8a67fdbd 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -276,8 +276,8 @@ public: LLMenuGL* createUrlContextMenu(S32 x, S32 y, const std::string &url); // create a popup context menu for the given Url // Non-undoable - void setText(const LLStringExplicit &utf8str); - void setWText(const LLWString &wtext); + void setText(const LLStringExplicit &utf8str, bool force_replace_links = true); + void setWText(const LLWString &wtext, bool force_replace_links = true); // Returns byte length limit S32 getMaxLength() const { return mMaxTextByteLength; } diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 9f5aa1b5f..064fee823 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -715,7 +715,7 @@ void LLPanelLandGeneral::refresh() ); mEditName->setText( parcel->getName() ); - mEditDesc->setText( parcel->getDesc() ); + mEditDesc->setText( parcel->getDesc(), false ); BOOL for_sale = parcel->getForSale(); @@ -3070,7 +3070,7 @@ void LLPanelLandCovenant::updateCovenantText(const std::string &string) { LLViewerTextEditor* editor = self->getChild("covenant_editor"); editor->setHandleEditKeysDirectly(TRUE); - editor->setText(string); + editor->setText(string, false); } } diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 119910950..9b24c620f 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -2776,7 +2776,7 @@ void LLPanelEstateCovenant::updateCovenantText(const std::string& string, const LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant(); if( panelp ) { - panelp->mEditor->setText(string); + panelp->mEditor->setText(string, false); panelp->setCovenantID(asset_id); } } @@ -2823,7 +2823,7 @@ void LLPanelEstateCovenant::setOwnerName(const std::string& name) void LLPanelEstateCovenant::setCovenantTextEditor(const std::string& text) { - mEditor->setText(text); + mEditor->setText(text, false); } // key = "estateupdateinfo" diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 98a3621df..5871d47bd 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -290,7 +290,7 @@ void LLPanelAvatarFirstLife::processProperties(void* data, EAvatarProcessorType if (pAvatarData && (mAvatarID == pAvatarData->avatar_id) && (pAvatarData->avatar_id != LLUUID::null)) { // Teens don't get these - getChildView("about")->setValue(pAvatarData->fl_about_text); + getChild("about")->setText(pAvatarData->fl_about_text, false); getChild("img")->setImageAssetID(pAvatarData->fl_image_id); } } @@ -1493,7 +1493,7 @@ void LLPanelAvatar::processProperties(void* data, EAvatarProcessorType type) timeStructToFormattedString(&t, gSavedSettings.getString("ShortDateFormat"), born_on); }*/ setOnlineStatus(pAvatarData->flags & AVATAR_ONLINE ? ONLINE_STATUS_YES : ONLINE_STATUS_NO); - childSetValue("about", pAvatarData->about_text); + getChild("about")->setText(pAvatarData->about_text, false); } } else if (type == APT_NOTES) diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 8aec5a381..786088cc0 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -354,7 +354,7 @@ void LLPanelClassifiedInfo::processProperties(void* data, EAvatarProcessorType t // Update UI controls mNameEditor->setText(c_info->name); - mDescEditor->setText(c_info->description); + mDescEditor->setText(c_info->description, false); mSnapshotCtrl->setImageAssetID(c_info->snapshot_id); mLocationEditor->setText(location_text); mLocationChanged = false; diff --git a/indra/newview/llpanelevent.cpp b/indra/newview/llpanelevent.cpp index 21efbafd9..66644c803 100644 --- a/indra/newview/llpanelevent.cpp +++ b/indra/newview/llpanelevent.cpp @@ -151,7 +151,7 @@ void LLPanelEvent::processEventInfoReply(LLMessageSystem *msg, void **) self->mTBName->setText(self->mEventInfo.mName); self->mTBCategory->setText(self->mEventInfo.mCategoryStr); self->mTBDate->setText(self->mEventInfo.mTimeStr); - self->mTBDesc->setText(self->mEventInfo.mDesc); + self->mTBDesc->setText(self->mEventInfo.mDesc, false); self->mTBDuration->setText(llformat("%d:%.2d", self->mEventInfo.mDuration / 60, self->mEventInfo.mDuration % 60)); diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index c09f96dcf..192177cc1 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -761,7 +761,7 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) if (mEditCharter) { - mEditCharter->setText(gdatap->mCharter); + mEditCharter->setText(gdatap->mCharter, false); mEditCharter->resetDirty(); } } diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp index 0498e7e49..862a89dd4 100644 --- a/indra/newview/llpanelgroupnotices.cpp +++ b/indra/newview/llpanelgroupnotices.cpp @@ -529,12 +529,7 @@ void LLPanelGroupNotices::showNotice(const std::string& subject, arrangeNoticeView(VIEW_PAST_NOTICE); if(mViewSubject) mViewSubject->setText(subject); - if (mViewMessage) { - // We need to prune the highlights, and clear() is not doing it... - mViewMessage->removeTextFromEnd(mViewMessage->getMaxLength()); - // Now we append the new text (setText() won't highlight URLs) - mViewMessage->appendColoredText(message, false, false, mViewMessage->getReadOnlyFgColor()); - } + if (mViewMessage) mViewMessage->setText(message, false); if (mInventoryOffer) { diff --git a/indra/newview/llpanelgroupvoting.cpp b/indra/newview/llpanelgroupvoting.cpp index 09a28efea..b58f15721 100644 --- a/indra/newview/llpanelgroupvoting.cpp +++ b/indra/newview/llpanelgroupvoting.cpp @@ -307,7 +307,7 @@ void LLPanelGroupVoting::impl::setEnableVoteProposal() if ( proposal_cell ) { //proposal text - mProposalText->setText(proposal_cell->getValue().asString()); + mProposalText->setText(proposal_cell->getValue().asString(), false); } else { // Something's wrong... should have some text @@ -556,7 +556,7 @@ void LLPanelGroupVoting::impl::setEnableHistoryItem() const LLScrollListCell *cell = item->getColumn(5); if (cell) { - mVoteHistoryText->setText(cell->getValue().asString()); + mVoteHistoryText->setText(cell->getValue().asString(), false); } else { // Something's wrong... diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp index 899210edb..ba1384797 100644 --- a/indra/newview/llpanelpick.cpp +++ b/indra/newview/llpanelpick.cpp @@ -199,7 +199,7 @@ void LLPanelPick::processProperties(void* data, EAvatarProcessorType type) // Update UI controls mNameEditor->setText(pick_info->name); - mDescEditor->setText(pick_info->desc); + mDescEditor->setText(pick_info->desc, false); mSnapshotCtrl->setImageAssetID(pick_info->snapshot_id); mLocationEditor->setText(location_text); } diff --git a/indra/newview/llpanelplace.cpp b/indra/newview/llpanelplace.cpp index 9dc433463..00f7bc4d1 100644 --- a/indra/newview/llpanelplace.cpp +++ b/indra/newview/llpanelplace.cpp @@ -125,7 +125,7 @@ BOOL LLPanelPlace::postBuild() void LLPanelPlace::displayItemInfo(const LLInventoryItem* pItem) { mNameEditor->setText(pItem->getName()); - mDescEditor->setText(pItem->getDescription()); + mDescEditor->setText(pItem->getDescription(), false); } // Use this for search directory clicks, because we are totally @@ -248,7 +248,7 @@ void LLPanelPlace::processParcelInfo(const LLParcelData& parcel_data) if( !parcel_data.desc.empty() && mDescEditor && mDescEditor->getText().empty()) { - mDescEditor->setText(parcel_data.desc); + mDescEditor->setText(parcel_data.desc, false); } std::string info_text; diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index 1bfa37c84..2f7415bdd 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -405,7 +405,7 @@ void LLPreviewNotecard::onLoadComplete(LLVFS *vfs, else { // Version 0 (just text, doesn't include version number) - previewEditor->setText(LLStringExplicit(buffer)); + previewEditor->setText(LLStringExplicit(buffer), false); } previewEditor->makePristine(); diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 4a8698189..ffc4e35f3 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -500,8 +500,8 @@ class WindowsManifest(ViewerManifest): else: self.path("vivoxsdk.dll") self.path("ortp.dll") - self.path("libsndfile-1.dll") - self.path("vivoxoal.dll") + #self.path("libsndfile-1.dll") + #self.path("vivoxoal.dll") # Security if(self.address_size == 64):