summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llbutton.cpp4
-rw-r--r--indra/llui/llbutton.h14
-rw-r--r--indra/llui/llcheckboxctrl.cpp4
-rw-r--r--indra/llui/llcheckboxctrl.h4
-rw-r--r--indra/llui/llconsole.cpp3
-rw-r--r--indra/llui/llfolderviewitem.cpp4
-rw-r--r--indra/llui/lliconctrl.h2
-rw-r--r--indra/llui/llkeywords.cpp18
-rw-r--r--indra/llui/llkeywords.h16
-rw-r--r--indra/llui/lllineeditor.h10
-rw-r--r--indra/llui/llmultisliderctrl.cpp4
-rw-r--r--indra/llui/llmultisliderctrl.h4
-rw-r--r--indra/llui/llpanel.cpp6
-rw-r--r--indra/llui/llpanel.h10
-rw-r--r--indra/llui/llscrolllistcell.cpp2
-rw-r--r--indra/llui/llsearchablecontrol.h2
-rw-r--r--indra/llui/llsliderctrl.cpp4
-rw-r--r--indra/llui/llsliderctrl.h4
-rw-r--r--indra/llui/llspinctrl.cpp2
-rw-r--r--indra/llui/llspinctrl.h4
-rw-r--r--indra/llui/llstatgraph.cpp4
-rw-r--r--indra/llui/llstyle.cpp6
-rw-r--r--indra/llui/llstyle.h18
-rw-r--r--indra/llui/lltextbase.cpp37
-rw-r--r--indra/llui/lltextbase.h16
-rw-r--r--indra/llui/lltextparser.cpp78
-rw-r--r--indra/llui/lltextparser.h5
-rw-r--r--indra/llui/lluicolortable.cpp68
-rw-r--r--indra/llui/lluicolortable.h7
-rw-r--r--indra/llui/lluictrl.cpp2
-rw-r--r--indra/llui/lluictrl.h2
-rw-r--r--indra/llui/llviewborder.cpp6
-rw-r--r--indra/llui/llviewborder.h6
33 files changed, 221 insertions, 155 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 7b612e445b..30968225a8 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -1127,12 +1127,12 @@ void LLButton::setImageSelected(LLPointer<LLUIImage> image)
mImageSelected = image;
}
-void LLButton::setImageColor(const LLColor4& c)
+void LLButton::setImageColor(const LLUIColor& c)
{
mImageColor = c;
}
-void LLButton::setColor(const LLColor4& color)
+void LLButton::setColor(const LLUIColor& color)
{
setImageColor(color);
}
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index a54a5b1a43..4ecea6d473 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -172,8 +172,8 @@ public:
virtual void onCommit();
- void setUnselectedLabelColor( const LLColor4& c ) { mUnselectedLabelColor = c; }
- void setSelectedLabelColor( const LLColor4& c ) { mSelectedLabelColor = c; }
+ void setUnselectedLabelColor( const LLUIColor& c ) { mUnselectedLabelColor = c; }
+ void setSelectedLabelColor( const LLUIColor& c ) { mSelectedLabelColor = c; }
void setUseEllipses( bool use_ellipses ) { mUseEllipses = use_ellipses; }
void setUseFontColor( bool use_font_color) { mUseFontColor = use_font_color; }
@@ -224,14 +224,14 @@ public:
const std::string getLabelSelected() const { return wstring_to_utf8str(mSelectedLabel); }
void setImageColor(const std::string& color_control);
- void setImageColor(const LLColor4& c);
- /*virtual*/ void setColor(const LLColor4& c);
+ void setImageColor(const LLUIColor& c);
+ /*virtual*/ void setColor(const LLUIColor& c);
void setImages(const std::string &image_name, const std::string &selected_name);
- void setDisabledImageColor(const LLColor4& c) { mDisabledImageColor = c; }
+ void setDisabledImageColor(const LLUIColor& c) { mDisabledImageColor = c; }
- void setDisabledSelectedLabelColor( const LLColor4& c ) { mDisabledSelectedLabelColor = c; }
+ void setDisabledSelectedLabelColor( const LLUIColor& c ) { mDisabledSelectedLabelColor = c; }
void setImageOverlay(const std::string& image_name, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white);
void setImageOverlay(const LLUUID& image_id, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white);
@@ -246,7 +246,7 @@ public:
virtual bool setLabelArg( const std::string& key, const LLStringExplicit& text );
void setLabelUnselected(const LLStringExplicit& label);
void setLabelSelected(const LLStringExplicit& label);
- void setDisabledLabelColor( const LLColor4& c ) { mDisabledLabelColor = c; }
+ void setDisabledLabelColor( const LLUIColor& c ) { mDisabledLabelColor = c; }
void setFont(const LLFontGL *font)
{ mGLFont = ( font ? font : LLFontGL::getFontSansSerif()); }
diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp
index dea262942b..fc751cfc7f 100644
--- a/indra/llui/llcheckboxctrl.cpp
+++ b/indra/llui/llcheckboxctrl.cpp
@@ -172,11 +172,11 @@ void LLCheckBoxCtrl::setEnabled(bool b)
if (b)
{
- mLabel->setColor( mTextEnabledColor.get() );
+ mLabel->setColor( mTextEnabledColor );
}
else
{
- mLabel->setColor( mTextDisabledColor.get() );
+ mLabel->setColor( mTextDisabledColor );
}
}
diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h
index fc04a8a781..135f128692 100644
--- a/indra/llui/llcheckboxctrl.h
+++ b/indra/llui/llcheckboxctrl.h
@@ -110,8 +110,8 @@ public:
void setBtnFocus() { mButton->setFocus(true); }
- void setEnabledColor( const LLColor4 &color ) { mTextEnabledColor = color; }
- void setDisabledColor( const LLColor4 &color ) { mTextDisabledColor = color; }
+ void setEnabledColor( const LLUIColor&color ) { mTextEnabledColor = color; }
+ void setDisabledColor( const LLUIColor&color ) { mTextDisabledColor = color; }
void setLabel( const LLStringExplicit& label );
std::string getLabel() const;
diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp
index 4f52f5936d..91e6f281da 100644
--- a/indra/llui/llconsole.cpp
+++ b/indra/llui/llconsole.cpp
@@ -183,7 +183,8 @@ void LLConsole::draw()
static LLCachedControl<F32> console_bg_opacity(*LLUI::getInstance()->mSettingGroups["config"], "ConsoleBackgroundOpacity", 0.7f);
F32 console_opacity = llclamp(console_bg_opacity(), 0.f, 1.f);
- static LLColor4 color = LLUIColorTable::instance().getColor("ConsoleBackground");
+ static LLUIColor console_color = LLUIColorTable::instance().getColor("ConsoleBackground");
+ LLColor4 color = console_color;
color.mV[VALPHA] *= console_opacity;
F32 line_height = (F32)mFont->getLineHeight();
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp
index 63a600b15f..e4f5664908 100644
--- a/indra/llui/llfolderviewitem.cpp
+++ b/indra/llui/llfolderviewitem.cpp
@@ -784,7 +784,7 @@ void LLFolderViewItem::drawHighlight(const bool showContent, const bool hasKeybo
const S32 FOCUS_LEFT = 1;
// Determine which background color to use for highlighting
- LLUIColor bgColor = (isFlashing() ? flashColor : selectColor);
+ const LLUIColor& bgColor = (isFlashing() ? flashColor : selectColor);
//--------------------------------------------------------------------------------//
// Draw highlight for selected items
@@ -999,7 +999,7 @@ void LLFolderViewItem::draw()
//
if (!mLabelSuffix.empty())
{
- suffix_font->render( mLabelSuffix, 0, right_x, y, isFadeItem() ? color : (LLColor4)sSuffixColor,
+ suffix_font->render( mLabelSuffix, 0, right_x, y, isFadeItem() ? color : sSuffixColor.get(),
LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
S32_MAX, S32_MAX, &right_x);
}
diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h
index aae1d1d572..29d3f0c3d4 100644
--- a/indra/llui/lliconctrl.h
+++ b/indra/llui/lliconctrl.h
@@ -79,7 +79,7 @@ public:
std::string getImageName() const;
- void setColor(const LLColor4& color) { mColor = color; }
+ void setColor(const LLUIColor& color) { mColor = color; }
void setImage(LLPointer<LLUIImage> image) { mImagep = image; }
const LLPointer<LLUIImage> getImage() { return mImagep; }
diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp
index cc567adb75..7bf43c22c1 100644
--- a/indra/llui/llkeywords.cpp
+++ b/indra/llui/llkeywords.cpp
@@ -85,7 +85,7 @@ LLKeywords::~LLKeywords()
// Add the token as described
void LLKeywords::addToken(LLKeywordToken::ETokenType type,
const std::string& key_in,
- const LLColor4& color,
+ const LLUIColor& color,
const std::string& tool_tip_in,
const std::string& delimiter_in)
{
@@ -170,7 +170,7 @@ std::string LLKeywords::getAttribute(std::string_view key)
return (it != mAttributes.end()) ? it->second : "";
}
-LLColor4 LLKeywords::getColorGroup(std::string_view key_in)
+LLUIColor LLKeywords::getColorGroup(std::string_view key_in)
{
std::string color_group = "ScriptText";
if (key_in == "functions")
@@ -263,10 +263,10 @@ void LLKeywords::processTokens()
void LLKeywords::processTokensGroup(const LLSD& tokens, std::string_view group)
{
- LLColor4 color;
- LLColor4 color_group;
- LLColor4 color_deprecated = getColorGroup("deprecated");
- LLColor4 color_god_mode = getColorGroup("god-mode");
+ LLUIColor color;
+ LLUIColor color_group;
+ LLUIColor color_deprecated = getColorGroup("deprecated");
+ LLUIColor color_god_mode = getColorGroup("god-mode");
LLKeywordToken::ETokenType token_type = LLKeywordToken::TT_UNKNOWN;
// If a new token type is added here, it must also be added to the 'addToken' method
@@ -296,7 +296,7 @@ void LLKeywords::processTokensGroup(const LLSD& tokens, std::string_view group)
}
color_group = getColorGroup(group);
- LL_DEBUGS("SyntaxLSL") << "Group: '" << group << "', using color: '" << color_group << "'" << LL_ENDL;
+ LL_DEBUGS("SyntaxLSL") << "Group: '" << group << "', using color: '" << color_group.get() << "'" << LL_ENDL;
if (tokens.isMap())
{
@@ -378,7 +378,7 @@ void LLKeywords::processTokensGroup(const LLSD& tokens, std::string_view group)
}
else if (tokens.isArray()) // Currently nothing should need this, but it's here for completeness
{
- LL_INFOS("SyntaxLSL") << "Curious, shouldn't be an array here; adding all using color " << color << LL_ENDL;
+ LL_INFOS("SyntaxLSL") << "Curious, shouldn't be an array here; adding all using color " << color.get() << LL_ENDL;
for (S32 count = 0; count < tokens.size(); ++count)
{
addToken(token_type, tokens[count], color, "");
@@ -725,7 +725,7 @@ void LLKeywords::insertSegments(const LLWString& wtext, std::vector<LLTextSegmen
insertSegment( seg_list, text_segment, text_len, style, editor);
}
-void LLKeywords::insertSegment(std::vector<LLTextSegmentPtr>& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor, LLTextEditor& editor )
+void LLKeywords::insertSegment(std::vector<LLTextSegmentPtr>& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLUIColor& defaultColor, LLTextEditor& editor )
{
LLTextSegmentPtr last = seg_list.back();
S32 new_seg_end = new_segment->getEnd();
diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h
index 6df2da7cd3..328561c92a 100644
--- a/indra/llui/llkeywords.h
+++ b/indra/llui/llkeywords.h
@@ -72,7 +72,7 @@ public:
TT_TYPE // WORD
} ETokenType;
- LLKeywordToken( ETokenType type, const LLColor4& color, const LLWString& token, const LLWString& tool_tip, const LLWString& delimiter )
+ LLKeywordToken( ETokenType type, const LLUIColor& color, const LLWString& token, const LLWString& tool_tip, const LLWString& delimiter )
:
mType( type ),
mToken( token ),
@@ -87,7 +87,7 @@ public:
bool isHead(const llwchar* s) const;
bool isTail(const llwchar* s) const;
const LLWString& getToken() const { return mToken; }
- const LLColor4& getColor() const { return mColor; }
+ const LLUIColor& getColor() const { return mColor; }
ETokenType getType() const { return mType; }
const LLWString& getToolTip() const { return mToolTip; }
const LLWString& getDelimiter() const { return mDelimiter; }
@@ -99,7 +99,7 @@ public:
private:
ETokenType mType;
LLWString mToken;
- LLColor4 mColor;
+ LLUIColor mColor;
LLWString mToolTip;
LLWString mDelimiter;
};
@@ -111,7 +111,7 @@ public:
~LLKeywords();
void clearLoaded() { mLoaded = false; }
- LLColor4 getColorGroup(std::string_view key_in);
+ LLUIColor getColorGroup(std::string_view key_in);
bool isLoaded() const { return mLoaded; }
void findSegments(std::vector<LLTextSegmentPtr> *seg_list,
@@ -124,7 +124,7 @@ public:
// Add the token as described
void addToken(LLKeywordToken::ETokenType type,
const std::string& key,
- const LLColor4& color,
+ const LLUIColor& color,
const std::string& tool_tip = LLStringUtil::null,
const std::string& delimiter = LLStringUtil::null);
@@ -153,7 +153,7 @@ public:
bool mOwner;
- LLColor4 mColor;
+ LLUIColor mColor;
};
typedef std::map<WStringMapIndex, LLKeywordToken*> word_token_map_t;
@@ -161,7 +161,7 @@ public:
keyword_iterator_t begin() const { return mWordTokenMap.begin(); }
keyword_iterator_t end() const { return mWordTokenMap.end(); }
- typedef std::map<WStringMapIndex, LLColor4> group_color_map_t;
+ typedef std::map<WStringMapIndex, LLUIColor> group_color_map_t;
typedef group_color_map_t::const_iterator color_iterator_t;
group_color_map_t mColorGroupMap;
@@ -174,7 +174,7 @@ protected:
void insertSegment(std::vector<LLTextSegmentPtr>& seg_list,
LLTextSegmentPtr new_segment,
S32 text_len,
- const LLColor4 &defaultColor,
+ const LLUIColor &defaultColor,
class LLTextEditor& editor);
void insertSegments(const LLWString& wtext,
std::vector<LLTextSegmentPtr>& seg_list,
diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h
index 1cb7cac854..cdd22413e7 100644
--- a/indra/llui/lllineeditor.h
+++ b/indra/llui/lllineeditor.h
@@ -204,7 +204,7 @@ public:
void setText(const LLStringExplicit &new_text);
const std::string& getText() const override { return mText.getString(); }
- LLWString getWText() const { return mText.getWString(); }
+ const LLWString& getWText() const { return mText.getWString(); }
LLWString getConvertedText() const; // trimmed text with paragraphs converted to newlines
S32 getLength() const { return mText.length(); }
@@ -224,12 +224,12 @@ public:
void setRevertOnEsc( bool b ) { mRevertOnEsc = b; }
void setKeystrokeOnEsc(bool b) { mKeystrokeOnEsc = b; }
- void setCursorColor(const LLColor4& c) { mCursorColor = c; }
+ void setCursorColor(const LLUIColor& c) { mCursorColor = c; }
const LLColor4& getCursorColor() const { return mCursorColor.get(); }
- void setFgColor( const LLColor4& c ) { mFgColor = c; }
- void setReadOnlyFgColor( const LLColor4& c ) { mReadOnlyFgColor = c; }
- void setTentativeFgColor(const LLColor4& c) { mTentativeFgColor = c; }
+ void setFgColor( const LLUIColor& c ) { mFgColor = c; }
+ void setReadOnlyFgColor( const LLUIColor& c ) { mReadOnlyFgColor = c; }
+ void setTentativeFgColor(const LLUIColor& c) { mTentativeFgColor = c; }
const LLColor4& getFgColor() const { return mFgColor.get(); }
const LLColor4& getReadOnlyFgColor() const { return mReadOnlyFgColor.get(); }
diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp
index 6b9a1b1c13..3235110662 100644
--- a/indra/llui/llmultisliderctrl.cpp
+++ b/indra/llui/llmultisliderctrl.cpp
@@ -440,7 +440,7 @@ void LLMultiSliderCtrl::setEnabled(bool b)
if( mLabelBox )
{
- mLabelBox->setColor( b ? mTextEnabledColor.get() : mTextDisabledColor.get() );
+ mLabelBox->setColor( b ? mTextEnabledColor : mTextDisabledColor );
}
mMultiSlider->setEnabled( b );
@@ -452,7 +452,7 @@ void LLMultiSliderCtrl::setEnabled(bool b)
if( mTextBox )
{
- mTextBox->setColor( b ? mTextEnabledColor.get() : mTextDisabledColor.get() );
+ mTextBox->setColor( b ? mTextEnabledColor : mTextDisabledColor );
}
}
diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h
index fee05c92fd..dec6cb48b9 100644
--- a/indra/llui/llmultisliderctrl.h
+++ b/indra/llui/llmultisliderctrl.h
@@ -130,8 +130,8 @@ public:
bool canAddSliders() { return mMultiSlider->canAddSliders(); }
void setLabel(const std::string& label) { if (mLabelBox) mLabelBox->setText(label); }
- void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; }
- void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; }
+ void setLabelColor(const LLUIColor& c) { mTextEnabledColor = c; }
+ void setDisabledLabelColor(const LLUIColor& c) { mTextDisabledColor = c; }
boost::signals2::connection setSliderMouseDownCallback( const commit_signal_t::slot_type& cb );
boost::signals2::connection setSliderMouseUpCallback( const commit_signal_t::slot_type& cb );
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index ab3433af98..8e96bdde80 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -490,8 +490,8 @@ void LLPanel::initFromParams(const LLPanel::Params& p)
setBackgroundVisible(p.background_visible);
setBackgroundOpaque(p.background_opaque);
- setBackgroundColor(p.bg_opaque_color().get());
- setTransparentColor(p.bg_alpha_color().get());
+ setBackgroundColor(p.bg_opaque_color);
+ setTransparentColor(p.bg_alpha_color);
mBgOpaqueImage = p.bg_opaque_image();
mBgAlphaImage = p.bg_alpha_image();
mBgOpaqueImageOverlay = p.bg_opaque_image_overlay;
@@ -693,7 +693,7 @@ void LLPanel::childSetCommitCallback(std::string_view id, boost::function<void (
}
}
-void LLPanel::childSetColor(std::string_view id, const LLColor4& color)
+void LLPanel::childSetColor(std::string_view id, const LLUIColor& color)
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index f6aa91fb30..f085c123c1 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -134,16 +134,16 @@ public:
bool hasBorder() const { return mBorder != NULL; }
void setBorderVisible( bool b );
- void setBackgroundColor( const LLColor4& color ) { mBgOpaqueColor = color; }
+ void setBackgroundColor( const LLUIColor& color ) { mBgOpaqueColor = color; }
const LLColor4& getBackgroundColor() const { return mBgOpaqueColor; }
- void setTransparentColor(const LLColor4& color) { mBgAlphaColor = color; }
+ void setTransparentColor(const LLUIColor& color) { mBgAlphaColor = color; }
const LLColor4& getTransparentColor() const { return mBgAlphaColor; }
void setBackgroundImage(LLUIImage* image) { mBgOpaqueImage = image; }
void setTransparentImage(LLUIImage* image) { mBgAlphaImage = image; }
LLPointer<LLUIImage> getBackgroundImage() const { return mBgOpaqueImage; }
LLPointer<LLUIImage> getTransparentImage() const { return mBgAlphaImage; }
- LLColor4 getBackgroundImageOverlay() { return mBgOpaqueImageOverlay; }
- LLColor4 getTransparentImageOverlay() { return mBgAlphaImageOverlay; }
+ const LLColor4& getBackgroundImageOverlay() { return mBgOpaqueImageOverlay; }
+ const LLColor4& getTransparentImageOverlay() { return mBgAlphaImageOverlay; }
void setBackgroundVisible( bool b ) { mBgVisible = b; }
bool isBackgroundVisible() const { return mBgVisible; }
void setBackgroundOpaque(bool b) { mBgOpaque = b; }
@@ -192,7 +192,7 @@ public:
// which takes a generic slot. Or use mCommitCallbackRegistrar.add() with
// a named callback and reference it in XML.
void childSetCommitCallback(std::string_view id, boost::function<void (LLUICtrl*,void*)> cb, void* data);
- void childSetColor(std::string_view id, const LLColor4& color);
+ void childSetColor(std::string_view id, const LLUIColor& color);
LLCtrlSelectionInterface* childGetSelectionInterface(std::string_view id) const;
LLCtrlListInterface* childGetListInterface(std::string_view id) const;
diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp
index 88ef4eb0c1..7ef2e54429 100644
--- a/indra/llui/llscrolllistcell.cpp
+++ b/indra/llui/llscrolllistcell.cpp
@@ -465,7 +465,7 @@ LLScrollListCheck::LLScrollListCheck(const LLScrollListCell::Params& p)
setWidth(rect.getWidth()); //check_box->getWidth();
}
- mCheckBox->setColor(p.color);
+ mCheckBox->setColor(p.color());
}
diff --git a/indra/llui/llsearchablecontrol.h b/indra/llui/llsearchablecontrol.h
index bccb4858e1..119852b763 100644
--- a/indra/llui/llsearchablecontrol.h
+++ b/indra/llui/llsearchablecontrol.h
@@ -43,7 +43,7 @@ namespace ll
virtual ~SearchableControl()
{ }
- LLColor4 getHighlightColor( ) const
+ const LLColor4& getHighlightColor( ) const
{
static LLUIColor highlight_color = LLUIColorTable::instance().getColor("SearchableControlHighlightColor", LLColor4::red);
return highlight_color.get();
diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp
index 0c3ab6bda0..66e97f093f 100644
--- a/indra/llui/llsliderctrl.cpp
+++ b/indra/llui/llsliderctrl.cpp
@@ -393,7 +393,7 @@ void LLSliderCtrl::setEnabled(bool b)
if( mLabelBox )
{
- mLabelBox->setColor( b ? mTextEnabledColor.get() : mTextDisabledColor.get() );
+ mLabelBox->setColor( b ? mTextEnabledColor : mTextDisabledColor );
}
mSlider->setEnabled( b );
@@ -405,7 +405,7 @@ void LLSliderCtrl::setEnabled(bool b)
if( mTextBox )
{
- mTextBox->setColor( b ? mTextEnabledColor.get() : mTextDisabledColor.get() );
+ mTextBox->setColor( b ? mTextEnabledColor : mTextDisabledColor );
}
}
diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h
index a55e3bf6e9..311377a61f 100644
--- a/indra/llui/llsliderctrl.h
+++ b/indra/llui/llsliderctrl.h
@@ -107,8 +107,8 @@ public:
F32 getMaxValue() const { return mSlider->getMaxValue(); }
void setLabel(const LLStringExplicit& label) { if (mLabelBox) mLabelBox->setText(label); }
- void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; }
- void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; }
+ void setLabelColor(const LLUIColor& c) { mTextEnabledColor = c; }
+ void setDisabledLabelColor(const LLUIColor& c) { mTextDisabledColor = c; }
boost::signals2::connection setSliderMouseDownCallback( const commit_signal_t::slot_type& cb );
boost::signals2::connection setSliderMouseUpCallback( const commit_signal_t::slot_type& cb );
diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp
index 7d41d80334..8cd3e6419a 100644
--- a/indra/llui/llspinctrl.cpp
+++ b/indra/llui/llspinctrl.cpp
@@ -310,7 +310,7 @@ void LLSpinCtrl::updateLabelColor()
{
if( mLabelBox )
{
- mLabelBox->setColor( getEnabled() ? mTextEnabledColor.get() : mTextDisabledColor.get() );
+ mLabelBox->setColor( getEnabled() ? mTextEnabledColor : mTextDisabledColor );
}
}
diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h
index 75f1830d80..58b38dc630 100644
--- a/indra/llui/llspinctrl.h
+++ b/indra/llui/llspinctrl.h
@@ -77,8 +77,8 @@ public:
virtual void setPrecision(S32 precision);
void setLabel(const LLStringExplicit& label);
- void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; updateLabelColor(); }
- void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; updateLabelColor();}
+ void setLabelColor(const LLUIColor& c) { mTextEnabledColor = c; updateLabelColor(); }
+ void setDisabledLabelColor(const LLUIColor& c) { mTextDisabledColor = c; updateLabelColor();}
void setAllowEdit(bool allow_edit);
virtual void onTabInto();
diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp
index 28b4d387f1..d97051247e 100644
--- a/indra/llui/llstatgraph.cpp
+++ b/indra/llui/llstatgraph.cpp
@@ -100,8 +100,8 @@ void LLStatGraph::draw()
it--;
}
- static LLColor4 default_color = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" );
- gGL.color4fv(default_color.mV);
+ static LLUIColor default_color = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" );
+ gGL.color4fv(default_color.get().mV);
gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, true);
gGL.color4fv(LLColor4::black.mV);
diff --git a/indra/llui/llstyle.cpp b/indra/llui/llstyle.cpp
index abf6e1284b..df4b0ef6a0 100644
--- a/indra/llui/llstyle.cpp
+++ b/indra/llui/llstyle.cpp
@@ -33,11 +33,12 @@
#include "llui.h"
LLStyle::Params::Params()
-: visible("visible", true),
+ : visible("visible", true),
drop_shadow("drop_shadow", LLFontGL::NO_SHADOW),
color("color", LLColor4::black),
readonly_color("readonly_color", LLColor4::black),
selected_color("selected_color", LLColor4::black),
+ alpha("alpha", 1.f),
font("font", LLFontGL::getFontMonospace()),
image("image"),
link_href("href"),
@@ -54,7 +55,8 @@ LLStyle::LLStyle(const LLStyle::Params& p)
mLink(p.link_href),
mIsLink(p.is_link.isProvided() ? p.is_link : !p.link_href().empty()),
mDropShadow(p.drop_shadow),
- mImagep(p.image())
+ mImagep(p.image()),
+ mAlpha(p.alpha)
{}
void LLStyle::setFont(const LLFontGL* font)
diff --git a/indra/llui/llstyle.h b/indra/llui/llstyle.h
index 7dbccfff87..e506895de5 100644
--- a/indra/llui/llstyle.h
+++ b/indra/llui/llstyle.h
@@ -44,6 +44,7 @@ public:
Optional<LLUIColor> color,
readonly_color,
selected_color;
+ Optional<F32> alpha;
Optional<const LLFontGL*> font;
Optional<LLUIImage*> image;
Optional<std::string> link_href;
@@ -61,6 +62,9 @@ public:
const LLUIColor& getSelectedColor() const { return mSelectedColor; }
void setSelectedColor(const LLUIColor& color) { mSelectedColor = color; }
+ F32 getAlpha() const { return mAlpha; }
+ void setAlpha(F32 alpha) { mAlpha = alpha; }
+
bool isVisible() const;
void setVisible(bool is_visible);
@@ -89,7 +93,8 @@ public:
&& mFont == rhs.mFont
&& mLink == rhs.mLink
&& mImagep == rhs.mImagep
- && mDropShadow == rhs.mDropShadow;
+ && mDropShadow == rhs.mDropShadow
+ && mAlpha == rhs.mAlpha;
}
bool operator!=(const LLStyle& rhs) const { return !(*this == rhs); }
@@ -98,18 +103,19 @@ public:
LLFontGL::ShadowType mDropShadow;
protected:
- ~LLStyle() { }
+ ~LLStyle() = default;
private:
- bool mVisible;
+ std::string mFontName;
+ std::string mLink;
LLUIColor mColor;
LLUIColor mReadOnlyColor;
LLUIColor mSelectedColor;
- std::string mFontName;
const LLFontGL* mFont;
- std::string mLink;
- bool mIsLink;
LLPointer<LLUIImage> mImagep;
+ F32 mAlpha;
+ bool mVisible;
+ bool mIsLink;
};
typedef LLPointer<LLStyle> LLStyleSP;
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 8c3b317838..0aebf7543c 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -584,9 +584,8 @@ void LLTextBase::drawCursor()
if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode() && !hasSelection() && text[mCursorPos] != '\n')
{
- LLColor4 text_color;
const LLFontGL* fontp;
- text_color = segmentp->getColor();
+ const LLColor4& text_color = segmentp->getColor();
fontp = segmentp->getStyle()->getFont();
fontp->render(text, mCursorPos, cursor_rect,
LLColor4(1.f - text_color.mV[VRED], 1.f - text_color.mV[VGREEN], 1.f - text_color.mV[VBLUE], alpha),
@@ -1368,7 +1367,7 @@ void LLTextBase::draw()
{
bg_rect.intersectWith(text_rect);
}
- LLColor4 bg_color = mReadOnly
+ const LLColor4& bg_color = mReadOnly
? mReadOnlyBgColor.get()
: hasFocus()
? mFocusBgColor.get()
@@ -1379,7 +1378,7 @@ void LLTextBase::draw()
// Draw highlighted if needed
if( ll::ui::SearchableControl::getHighlighted() )
{
- LLColor4 bg_color = ll::ui::SearchableControl::getHighlightColor();
+ const LLColor4& bg_color = ll::ui::SearchableControl::getHighlightColor();
LLRect bg_rect = mVisibleTextRect;
if( mScroller )
bg_rect.intersectWith( text_rect );
@@ -1412,14 +1411,14 @@ void LLTextBase::draw()
//virtual
-void LLTextBase::setColor( const LLColor4& c )
+void LLTextBase::setColor( const LLUIColor& c )
{
mFgColor = c;
mStyleDirty = true;
}
//virtual
-void LLTextBase::setReadOnlyColor(const LLColor4 &c)
+void LLTextBase::setReadOnlyColor(const LLUIColor &c)
{
mReadOnlyFgColor = c;
mStyleDirty = true;
@@ -2203,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).
@@ -2418,16 +2417,14 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig
{
LLStyle::Params highlight_params(style_params);
- LLSD pieces = LLTextParser::instance().parsePartialLineHighlights(new_text, highlight_params.color(), (LLTextParser::EHighlightPosition)highlight_part);
+ auto pieces = LLTextParser::instance().parsePartialLineHighlights(new_text, highlight_params.color, (LLTextParser::EHighlightPosition)highlight_part);
for (S32 i = 0; i < pieces.size(); i++)
{
- LLSD color_llsd = pieces[i]["color"];
- LLColor4 lcolor;
- lcolor.setValue(color_llsd);
- highlight_params.color = lcolor;
+ const auto& piece_pair = pieces[i];
+ highlight_params.color = piece_pair.second;
LLWString wide_text;
- wide_text = utf8str_to_wstring(pieces[i]["text"].asString());
+ wide_text = utf8str_to_wstring(piece_pair.first);
S32 cur_length = getLength();
LLStyleConstSP sp(new LLStyle(highlight_params));
@@ -3247,8 +3244,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 ) {}
@@ -3294,7 +3291,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)
@@ -3334,7 +3331,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
const LLFontGL* font = mStyle->getFont();
- LLColor4 color = (mEditor.getReadOnly() ? mStyle->getReadOnlyColor() : mStyle->getColor()) % alpha;
+ LLColor4 color = (mEditor.getReadOnly() ? mStyle->getReadOnlyColor() : mStyle->getColor()) % (alpha * mStyle->getAlpha());
if( selection_start > seg_start )
{
@@ -3604,7 +3601,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)
{
}
@@ -3628,7 +3625,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 4120d9ea32..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;
@@ -372,8 +372,8 @@ public:
// LLUICtrl interface
/*virtual*/ bool acceptsTextInput() const override { return !mReadOnly; }
- /*virtual*/ void setColor(const LLColor4& c) override;
- virtual void setReadOnlyColor(const LLColor4 &c);
+ /*virtual*/ void setColor(const LLUIColor& c) override;
+ virtual void setReadOnlyColor(const LLUIColor& c);
/*virtual*/ void onVisibilityChange(bool new_visibility) override;
/*virtual*/ void setValue(const LLSD& value) override;
diff --git a/indra/llui/lltextparser.cpp b/indra/llui/lltextparser.cpp
index 097b168106..d4ef77664e 100644
--- a/indra/llui/lltextparser.cpp
+++ b/indra/llui/lltextparser.cpp
@@ -36,6 +36,7 @@
#include "llmath.h"
#include "v4color.h"
#include "lldir.h"
+#include "lluicolor.h"
//
// Member Functions
@@ -80,14 +81,14 @@ S32 LLTextParser::findPattern(const std::string &text, LLSD highlight)
return static_cast<S32>(found);
}
-LLSD LLTextParser::parsePartialLineHighlights(const std::string &text, const LLColor4 &color, EHighlightPosition part, S32 index)
+LLTextParser::parser_out_vec_t LLTextParser::parsePartialLineHighlights(const std::string &text, const LLUIColor& color, EHighlightPosition part, S32 index)
{
loadKeywords();
//evil recursive string atomizer.
- LLSD ret_llsd, start_llsd, middle_llsd, end_llsd;
+ parser_out_vec_t ret_vec, start_vec, middle_vec, end_vec;
- for (S32 i=index;i<mHighlights.size();i++)
+ for (S32 i=index, size = (S32)mHighlights.size();i< size;i++)
{
S32 condition = mHighlights[i]["condition"];
if ((S32)mHighlights[i]["highlight"]==PART && condition!=MATCHES)
@@ -104,72 +105,69 @@ LLSD LLTextParser::parsePartialLineHighlights(const std::string &text, const LLC
EHighlightPosition newpart;
if (start==0)
{
- start_llsd[0]["text"] =text.substr(0,end);
- start_llsd[0]["color"]=mHighlights[i]["color"];
+ if (start_vec.empty())
+ {
+ start_vec.push_back(std::make_pair(text.substr(0, end), LLColor4(mHighlights[i]["color"])));
+ }
+ else
+ {
+ start_vec[0] = std::make_pair(text.substr(0, end), LLColor4(mHighlights[i]["color"]));
+ }
if (end < len)
{
if (part==END || part==WHOLE) newpart=END; else newpart=MIDDLE;
- end_llsd=parsePartialLineHighlights(text.substr( end ),color,newpart,i);
+ end_vec = parsePartialLineHighlights(text.substr( end ),color,newpart,i);
}
}
else
{
if (part==START || part==WHOLE) newpart=START; else newpart=MIDDLE;
- start_llsd=parsePartialLineHighlights(text.substr(0,start),color,newpart,i+1);
+ start_vec = parsePartialLineHighlights(text.substr(0,start),color,newpart,i+1);
if (end < len)
{
- middle_llsd[0]["text"] =text.substr(start,end);
- middle_llsd[0]["color"]=mHighlights[i]["color"];
+ if (middle_vec.empty())
+ {
+ middle_vec.push_back(std::make_pair(text.substr(start, end), LLColor4(mHighlights[i]["color"])));
+ }
+ else
+ {
+ middle_vec[0] = std::make_pair(text.substr(start, end), LLColor4(mHighlights[i]["color"]));
+ }
if (part==END || part==WHOLE) newpart=END; else newpart=MIDDLE;
- end_llsd=parsePartialLineHighlights(text.substr( (start+end) ),color,newpart,i);
+ end_vec = parsePartialLineHighlights(text.substr( (start+end) ),color,newpart,i);
}
else
{
- end_llsd[0]["text"] =text.substr(start,end);
- end_llsd[0]["color"]=mHighlights[i]["color"];
+ if (end_vec.empty())
+ {
+ end_vec.push_back(std::make_pair(text.substr(start, end), LLColor4(mHighlights[i]["color"])));
+ }
+ else
+ {
+ end_vec[0] = std::make_pair(text.substr(start, end), LLColor4(mHighlights[i]["color"]));
+ }
}
}
- S32 retcount=0;
-
- //FIXME These loops should be wrapped into a subroutine.
- for (LLSD::array_iterator iter = start_llsd.beginArray();
- iter != start_llsd.endArray();++iter)
- {
- LLSD highlight = *iter;
- ret_llsd[retcount++]=highlight;
- }
-
- for (LLSD::array_iterator iter = middle_llsd.beginArray();
- iter != middle_llsd.endArray();++iter)
- {
- LLSD highlight = *iter;
- ret_llsd[retcount++]=highlight;
- }
-
- for (LLSD::array_iterator iter = end_llsd.beginArray();
- iter != end_llsd.endArray();++iter)
- {
- LLSD highlight = *iter;
- ret_llsd[retcount++]=highlight;
- }
+ ret_vec.reserve(start_vec.size() + middle_vec.size() + end_vec.size());
+ ret_vec.insert(ret_vec.end(), start_vec.begin(), start_vec.end());
+ ret_vec.insert(ret_vec.end(), middle_vec.begin(), middle_vec.end());
+ ret_vec.insert(ret_vec.end(), end_vec.begin(), end_vec.end());
- return ret_llsd;
+ return ret_vec;
}
}
}
}
//No patterns found. Just send back what was passed in.
- ret_llsd[0]["text"] =text;
- LLSD color_sd = color.getValue();
- ret_llsd[0]["color"]=color_sd;
- return ret_llsd;
+ ret_vec.push_back(std::make_pair(text, color));
+ return ret_vec;
}
bool LLTextParser::parseFullLineHighlights(const std::string &text, LLColor4 *color)
diff --git a/indra/llui/lltextparser.h b/indra/llui/lltextparser.h
index 20fcc07e4c..c5756f9b4c 100644
--- a/indra/llui/lltextparser.h
+++ b/indra/llui/lltextparser.h
@@ -30,6 +30,7 @@
#include "llsd.h"
#include "llsingleton.h"
+#include "lluicolor.h"
class LLUUID;
class LLVector3d;
@@ -45,7 +46,9 @@ public:
typedef enum e_highlight_position { WHOLE, START, MIDDLE, END } EHighlightPosition;
typedef enum e_dialog_action { ACTION_NONE, ACTION_CLOSE, ACTION_ADD, ACTION_COPY, ACTION_UPDATE } EDialogAction;
- LLSD parsePartialLineHighlights(const std::string &text,const LLColor4 &color, EHighlightPosition part=WHOLE, S32 index=0);
+ using parser_out_vec_t = std::vector<std::pair<std::string, LLUIColor>>;
+
+ parser_out_vec_t parsePartialLineHighlights(const std::string &text,const LLUIColor &color, EHighlightPosition part=WHOLE, S32 index=0);
bool parseFullLineHighlights(const std::string &text, LLColor4 *color);
private:
diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp
index 3279926786..a792cb8103 100644
--- a/indra/llui/lluicolortable.cpp
+++ b/indra/llui/lluicolortable.cpp
@@ -198,7 +198,61 @@ LLUIColor LLUIColorTable::getColor(std::string_view name, const LLColor4& defaul
// update user color, loaded colors are parsed on initialization
void LLUIColorTable::setColor(std::string_view name, const LLColor4& color)
{
- setColor(name, color, mUserSetColors);
+ auto it = mUserSetColors.lower_bound(name);
+ if(it != mUserSetColors.end() && !(mUserSetColors.key_comp()(name, it->first)))
+ {
+ it->second = color;
+ }
+ else
+ {
+ string_color_map_t::iterator base_iter = mLoadedColors.find(name);
+ if (base_iter != mLoadedColors.end())
+ {
+ LLColor4 original_color = base_iter->second.get();
+ auto color_handle = mLoadedColors.extract(base_iter);
+ auto new_color_pair = mUserSetColors.insert(std::move(color_handle));
+ new_color_pair.position->second = color;
+ mLoadedColors.emplace(name, LLUIColor(original_color));
+ }
+ else
+ {
+ mUserSetColors.insert(it, std::make_pair(name, color));
+ }
+ }
+}
+
+bool LLUIColorTable::isDefault(std::string_view name) const
+{
+ string_color_map_t::const_iterator base_iter = mLoadedColors.find(name);
+ string_color_map_t::const_iterator user_iter = mUserSetColors.find(name);
+ if (base_iter != mLoadedColors.end())
+ {
+ if(user_iter != mUserSetColors.end())
+ return user_iter->second == base_iter->second;
+
+ return true;
+ }
+ else if (user_iter != mUserSetColors.end()) // user only color ???
+ {
+ return true;
+ }
+
+ return false;
+}
+
+void LLUIColorTable::resetToDefault(std::string_view name)
+{
+ string_color_map_t::iterator iter = mUserSetColors.find(name);
+
+ if (iter != mUserSetColors.end())
+ {
+ auto default_iter = mLoadedColors.find(name);
+
+ if (default_iter != mLoadedColors.end())
+ {
+ iter->second = default_iter->second.get();
+ }
+ }
}
bool LLUIColorTable::loadFromSettings()
@@ -223,18 +277,16 @@ void LLUIColorTable::saveUserSettings() const
{
Params params;
- for(string_color_map_t::const_iterator it = mUserSetColors.begin();
- it != mUserSetColors.end();
- ++it)
+ for (const auto& color_pair : mUserSetColors)
{
// Compare user color value with the default value, skip if equal
- string_color_map_t::const_iterator itd = mLoadedColors.find(it->first);
- if(itd != mLoadedColors.end() && itd->second == it->second)
+ string_color_map_t::const_iterator itd = mLoadedColors.find(color_pair.first);
+ if(itd != mLoadedColors.end() && itd->second == color_pair.second)
continue;
ColorEntryParams color_entry;
- color_entry.name = it->first;
- color_entry.color.value = it->second;
+ color_entry.name = color_pair.first;
+ color_entry.color.value = color_pair.second;
params.color_entries.add(color_entry);
}
diff --git a/indra/llui/lluicolortable.h b/indra/llui/lluicolortable.h
index ca1ca9eaa7..0c6286e5eb 100644
--- a/indra/llui/lluicolortable.h
+++ b/indra/llui/lluicolortable.h
@@ -83,12 +83,19 @@ public:
// returns true if color_name exists in the table
bool colorExists(std::string_view color_name) const;
+ bool isDefault(std::string_view color_name) const;
+
+ void resetToDefault(std::string_view color_name);
+
// loads colors from settings files
bool loadFromSettings();
// saves colors specified by the user to the users skin directory
void saveUserSettings() const;
+ const auto& getLoadedColors() { return mLoadedColors; }
+ const auto& getUserColors() { return mUserSetColors; }
+
private:
bool loadFromFilename(const std::string& filename, string_color_map_t& table);
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index cb86a79407..cbabb5a933 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -1023,7 +1023,7 @@ bool LLUICtrl::getTentative() const
}
// virtual
-void LLUICtrl::setColor(const LLColor4& color)
+void LLUICtrl::setColor(const LLUIColor& color)
{ }
F32 LLUICtrl::getCurrentTransparency()
diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h
index fb8fc0c5ea..8cd9950917 100644
--- a/indra/llui/lluictrl.h
+++ b/indra/llui/lluictrl.h
@@ -216,7 +216,7 @@ public:
// selected radio button, etc.). Defaults to no-op.
virtual void clear();
- virtual void setColor(const LLColor4& color);
+ virtual void setColor(const LLUIColor& color);
// Ansariel: Changed to virtual. We might want to change the transparency ourself!
virtual F32 getCurrentTransparency();
diff --git a/indra/llui/llviewborder.cpp b/indra/llui/llviewborder.cpp
index c1777c972c..d53fd6eb91 100644
--- a/indra/llui/llviewborder.cpp
+++ b/indra/llui/llviewborder.cpp
@@ -73,14 +73,14 @@ LLViewBorder::LLViewBorder(const LLViewBorder::Params& p)
mStyle(p.render_style)
{}
-void LLViewBorder::setColors( const LLColor4& shadow_dark, const LLColor4& highlight_light )
+void LLViewBorder::setColors( const LLUIColor& shadow_dark, const LLUIColor& highlight_light )
{
mShadowDark = shadow_dark;
mHighlightLight = highlight_light;
}
-void LLViewBorder::setColorsExtended( const LLColor4& shadow_light, const LLColor4& shadow_dark,
- const LLColor4& highlight_light, const LLColor4& highlight_dark )
+void LLViewBorder::setColorsExtended( const LLUIColor& shadow_light, const LLUIColor& shadow_dark,
+ const LLUIColor& highlight_light, const LLUIColor& highlight_dark )
{
mShadowDark = shadow_dark;
mShadowLight = shadow_light;
diff --git a/indra/llui/llviewborder.h b/indra/llui/llviewborder.h
index be499bb534..1f118a0d20 100644
--- a/indra/llui/llviewborder.h
+++ b/indra/llui/llviewborder.h
@@ -77,9 +77,9 @@ public:
S32 getBorderWidth() const { return mBorderWidth; }
void setBevel(EBevel bevel) { mBevel = bevel; }
EBevel getBevel() const { return mBevel; }
- void setColors( const LLColor4& shadow_dark, const LLColor4& highlight_light );
- void setColorsExtended( const LLColor4& shadow_light, const LLColor4& shadow_dark,
- const LLColor4& highlight_light, const LLColor4& highlight_dark );
+ void setColors( const LLUIColor& shadow_dark, const LLUIColor& highlight_light );
+ void setColorsExtended( const LLUIColor& shadow_light, const LLUIColor& shadow_dark,
+ const LLUIColor& highlight_light, const LLUIColor& highlight_dark );
void setTexture( const class LLUUID &image_id );
LLColor4 getHighlightLight() {return mHighlightLight.get();}