From 9e777e1109035b40989ac13eb3a73323307ff151 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Sun, 4 Aug 2024 15:55:50 -0400 Subject: Fix various issues with text segments not updating UI color --- indra/llui/lltextbase.cpp | 14 +++++++------- indra/llui/lltextbase.h | 12 ++++++------ indra/newview/llchatitemscontainerctrl.cpp | 11 +++-------- indra/newview/llpanelpermissions.cpp | 2 +- indra/newview/llsidepaneliteminfo.cpp | 2 +- 5 files changed, 18 insertions(+), 23 deletions(-) diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 9e165026ac..e09fef40df 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2202,8 +2202,8 @@ static LLUIImagePtr image_from_icon_name(const std::string& icon_name) void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Params& input_params) { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; - LLStyle::Params style_params(input_params); - style_params.fillFrom(getStyleParams()); + LLStyle::Params style_params(getStyleParams()); + style_params.overwriteFrom(input_params); S32 part = (S32)LLTextParser::WHOLE; if (mParseHTML && !style_params.is_link) // Don't search for URLs inside a link segment (STORM-358). @@ -3246,8 +3246,8 @@ F32 LLTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_e bool LLTextSegment::canEdit() const { return false; } void LLTextSegment::unlinkFromDocument(LLTextBase*) {} void LLTextSegment::linkToDocument(LLTextBase*) {} -const LLColor4& LLTextSegment::getColor() const { return LLColor4::white; } -//void LLTextSegment::setColor(const LLColor4 &color) {} +const LLUIColor& LLTextSegment::getColor() const { static const LLUIColor white = LLUIColorTable::instance().getColor("White", LLColor4::white); return white; } +//void LLTextSegment::setColor(const LLUIColor &color) {} LLStyleConstSP LLTextSegment::getStyle() const {static LLStyleConstSP sp(new LLStyle()); return sp; } void LLTextSegment::setStyle(LLStyleConstSP style) {} void LLTextSegment::setToken( LLKeywordToken* token ) {} @@ -3293,7 +3293,7 @@ LLNormalTextSegment::LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 e } } -LLNormalTextSegment::LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) +LLNormalTextSegment::LLNormalTextSegment( const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) : LLTextSegment(start, end), mToken(NULL), mEditor(editor) @@ -3603,7 +3603,7 @@ LLLabelTextSegment::LLLabelTextSegment( LLStyleConstSP style, S32 start, S32 end { } -LLLabelTextSegment::LLLabelTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) +LLLabelTextSegment::LLLabelTextSegment( const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) : LLNormalTextSegment(color, start, end, editor, is_visible) { } @@ -3627,7 +3627,7 @@ LLEmojiTextSegment::LLEmojiTextSegment(LLStyleConstSP style, S32 start, S32 end, { } -LLEmojiTextSegment::LLEmojiTextSegment(const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) +LLEmojiTextSegment::LLEmojiTextSegment(const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) : LLNormalTextSegment(color, start, end, editor, is_visible) { } diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 0c8e398fc5..00cf66b134 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -84,8 +84,8 @@ public: virtual void unlinkFromDocument(class LLTextBase* editor); virtual void linkToDocument(class LLTextBase* editor); - virtual const LLColor4& getColor() const; - //virtual void setColor(const LLColor4 &color); + virtual const LLUIColor& getColor() const; + //virtual void setColor(const LLUIColor &color); virtual LLStyleConstSP getStyle() const; virtual void setStyle(LLStyleConstSP style); virtual void setToken( LLKeywordToken* token ); @@ -125,7 +125,7 @@ class LLNormalTextSegment : public LLTextSegment { public: LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor ); - LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true); + LLNormalTextSegment( const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true); virtual ~LLNormalTextSegment(); /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const; @@ -133,7 +133,7 @@ public: /*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const; /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect); /*virtual*/ bool canEdit() const { return true; } - /*virtual*/ const LLColor4& getColor() const { return mStyle->getColor(); } + /*virtual*/ const LLUIColor& getColor() const { return mStyle->getColor(); } /*virtual*/ LLStyleConstSP getStyle() const { return mStyle; } /*virtual*/ void setStyle(LLStyleConstSP style) { mStyle = style; } /*virtual*/ void setToken( LLKeywordToken* token ) { mToken = token; } @@ -170,7 +170,7 @@ class LLLabelTextSegment : public LLNormalTextSegment { public: LLLabelTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor ); - LLLabelTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true); + LLLabelTextSegment( const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true); protected: @@ -184,7 +184,7 @@ class LLEmojiTextSegment : public LLNormalTextSegment { public: LLEmojiTextSegment(LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor); - LLEmojiTextSegment(const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true); + LLEmojiTextSegment(const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true); bool canEdit() const override { return false; } bool handleToolTip(S32 x, S32 y, MASK mask) override; diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp index a5c26eff9c..f5519a8c88 100644 --- a/indra/newview/llchatitemscontainerctrl.cpp +++ b/indra/newview/llchatitemscontainerctrl.cpp @@ -222,14 +222,9 @@ void LLFloaterIMNearbyChatToastPanel::init(LLSD& notification) if (mSourceType == CHAT_SOURCE_AGENT || mSourceType == CHAT_SOURCE_OBJECT) { LLStyle::Params style_params_name; - - LLColor4 user_name_color = LLUIColorTable::instance().getColor("HTMLLinkColor"); - style_params_name.color(user_name_color); - - std::string font_name = LLFontGL::nameFromFont(messageFont); - std::string font_style_size = LLFontGL::sizeFromFont(messageFont); - style_params_name.font.name(font_name); - style_params_name.font.size(font_style_size); + style_params_name.color = LLUIColorTable::instance().getColor("HTMLLinkColor"); + style_params_name.font.name = LLFontGL::nameFromFont(messageFont); + style_params_name.font.size = LLFontGL::sizeFromFont(messageFont); style_params_name.link_href = notification["sender_slurl"].asString(); style_params_name.is_link = true; diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index aa35335ad9..0ce1f0f9d3 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -399,7 +399,7 @@ void LLPanelPermissions::refresh() // Style for creator and owner links (both group and agent) LLStyle::Params style_params; - LLColor4 link_color = LLUIColorTable::instance().getColor("HTMLLinkColor"); + LLUIColor link_color = LLUIColorTable::instance().getColor("HTMLLinkColor"); style_params.color = link_color; style_params.readonly_color = link_color; style_params.is_link = true; // link will be added later diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp index 7775e3d9f6..fccf745a74 100644 --- a/indra/newview/llsidepaneliteminfo.cpp +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -351,7 +351,7 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) // Style for creator and owner links LLStyle::Params style_params; - LLColor4 link_color = LLUIColorTable::instance().getColor("HTMLLinkColor"); + LLUIColor link_color = LLUIColorTable::instance().getColor("HTMLLinkColor"); style_params.color = link_color; style_params.readonly_color = link_color; style_params.is_link = true; // link will be added later -- cgit v1.2.3