diff options
Diffstat (limited to 'indra/newview')
36 files changed, 713 insertions, 127 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 4c5deb4974..8df9c41219 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -286,6 +286,7 @@ set(viewer_SOURCE_FILES llfloaterscriptlimits.cpp llfloatersearch.cpp llfloatersellland.cpp + llfloatersettingscolor.cpp llfloatersettingsdebug.cpp llfloatersidepanelcontainer.cpp llfloatersnapshot.cpp @@ -954,6 +955,7 @@ set(viewer_HEADER_FILES llfloaterscriptlimits.h llfloatersearch.h llfloatersellland.h + llfloatersettingscolor.h llfloatersettingsdebug.h llfloatersidepanelcontainer.h llfloatersnapshot.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9e5d3f09bd..eb053ebaa0 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -15773,6 +15773,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>ColorSettingsHideDefault</key> + <map> + <key>Comment</key> + <string>Show non-default settings only in Color Settings list</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>DebugSettingsHideDefault</key> <map> <key>Comment</key> diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 2b02aabc31..a48e22bc73 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -693,7 +693,7 @@ public: mNeedsTimeBox = false; user_name->setValue(mFrom); updateMinUserNameWidth(); - LLColor4 sep_color = LLUIColorTable::instance().getColor("ChatTeleportSeparatorColor"); + LLUIColor sep_color = LLUIColorTable::instance().getColor("ChatTeleportSeparatorColor"); setTransparentColor(sep_color); mTimeBoxTextBox->setVisible(false); } @@ -739,7 +739,7 @@ public: std::string username = chat.mFromName.substr(username_start + 2); username = username.substr(0, username.length() - 1); LLStyle::Params style_params_name; - LLColor4 userNameColor = LLUIColorTable::instance().getColor("EmphasisColor"); + LLUIColor userNameColor = LLUIColorTable::instance().getColor("EmphasisColor"); style_params_name.color(userNameColor); style_params_name.font.name("SansSerifSmall"); style_params_name.font.style("NORMAL"); @@ -1037,7 +1037,7 @@ private: !av_name.isDisplayNameDefault()) { LLStyle::Params style_params_name; - LLColor4 userNameColor = LLUIColorTable::instance().getColor("EmphasisColor"); + LLUIColor userNameColor = LLUIColorTable::instance().getColor("EmphasisColor"); style_params_name.color(userNameColor); style_params_name.font.name("SansSerifSmall"); style_params_name.font.style("NORMAL"); @@ -1239,10 +1239,11 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL mMoreChatPanel->reshape(mMoreChatPanel->getRect().getWidth(), height); } - LLColor4 txt_color = LLUIColorTable::instance().getColor("White"); - LLColor4 name_color(txt_color); + F32 alpha = 1.f; + LLUIColor txt_color = LLUIColorTable::instance().getColor("White"); + LLUIColor name_color(txt_color); + LLViewerChat::getChatColor(chat, txt_color, alpha); - LLViewerChat::getChatColor(chat,txt_color); LLFontGL* fontp = LLViewerChat::getChatFont(); std::string font_name = LLFontGL::nameFromFont(fontp); std::string font_size = LLFontGL::sizeFromFont(fontp); @@ -1250,6 +1251,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL LLStyle::Params body_message_params; body_message_params.color(txt_color); body_message_params.readonly_color(txt_color); + body_message_params.alpha(alpha); body_message_params.font.name(font_name); body_message_params.font.size(font_size); body_message_params.font.style(input_append_params.font.style); @@ -1317,7 +1319,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL { if (!message_from_log) { - LLColor4 timestamp_color = LLUIColorTable::instance().getColor("ChatTimestampColor"); + LLUIColor timestamp_color = LLUIColorTable::instance().getColor("ChatTimestampColor"); timestamp_style.color(timestamp_color); timestamp_style.readonly_color(timestamp_color); } @@ -1344,7 +1346,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL // set the link for the object name to be the objectim SLapp // (don't let object names with hyperlinks override our objectim Url) LLStyle::Params link_params(body_message_params); - LLColor4 link_color = LLUIColorTable::instance().getColor("HTMLLinkColor"); + LLUIColor link_color = LLUIColorTable::instance().getColor("HTMLLinkColor"); link_params.color = link_color; link_params.readonly_color = link_color; link_params.is_link = true; diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp index a5c26eff9c..550dfeb802 100644 --- a/indra/newview/llchatitemscontainerctrl.cpp +++ b/indra/newview/llchatitemscontainerctrl.cpp @@ -134,8 +134,8 @@ void LLFloaterIMNearbyChatToastPanel::addMessage(LLSD& notification) std::string color_name = notification["text_color"].asString(); - LLColor4 textColor = LLUIColorTable::instance().getColor(color_name); - textColor.mV[VALPHA] = (F32)notification["color_alpha"].asReal(); + LLUIColor textColor = LLUIColorTable::instance().getColor(color_name); + F32 textAlpha = (F32)notification["color_alpha"].asReal(); S32 font_size = notification["font_size"].asInteger(); @@ -152,6 +152,7 @@ void LLFloaterIMNearbyChatToastPanel::addMessage(LLSD& notification) { LLStyle::Params style_params; style_params.color(textColor); + style_params.alpha(textAlpha); std::string font_name = LLFontGL::nameFromFont(messageFont); std::string font_style_size = LLFontGL::sizeFromFont(messageFont); style_params.font.name(font_name); @@ -190,8 +191,8 @@ void LLFloaterIMNearbyChatToastPanel::init(LLSD& notification) std::string color_name = notification["text_color"].asString(); - LLColor4 textColor = LLUIColorTable::instance().getColor(color_name); - textColor.mV[VALPHA] = (F32)notification["color_alpha"].asReal(); + LLUIColor textColor = LLUIColorTable::instance().getColor(color_name); + F32 textAlpha = (F32)notification["color_alpha"].asReal(); S32 font_size = notification["font_size"].asInteger(); @@ -222,14 +223,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; @@ -274,6 +270,7 @@ void LLFloaterIMNearbyChatToastPanel::init(LLSD& notification) { LLStyle::Params style_params; style_params.color(textColor); + style_params.alpha(textAlpha); std::string font_name = LLFontGL::nameFromFont(messageFont); std::string font_style_size = LLFontGL::sizeFromFont(messageFont); style_params.font.name(font_name); diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index eac1ee2a3c..cb2370f413 100644 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -652,6 +652,7 @@ void LLConversationViewParticipant::draw() static LLUIColor sFlashBgColor = LLUIColorTable::instance().getColor("MenuItemFlashBgColor", DEFAULT_WHITE); static LLUIColor sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE); static LLUIColor sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE); + static LLUIColor sFriendColor = LLUIColorTable::instance().getColor("ConversationFriendColor"); const bool show_context = (getRoot() ? getRoot()->getShowSelectionContext() : false); @@ -661,23 +662,23 @@ void LLConversationViewParticipant::draw() F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad; F32 text_left = (F32)getLabelXPos(); - LLColor4 color; + LLUIColor* color; LLLocalSpeakerMgr *speakerMgr = LLLocalSpeakerMgr::getInstance(); if (speakerMgr && speakerMgr->isSpeakerToBeRemoved(mUUID)) { - color = sFgDisabledColor; + color = &sFgDisabledColor; } else { if (LLAvatarActions::isFriend(mUUID)) { - color = LLUIColorTable::instance().getColor("ConversationFriendColor"); + color = &sFriendColor; } else { - color = mIsSelected ? sHighlightFgColor : sFgColor; + color = mIsSelected ? &sHighlightFgColor : &sFgColor; } } @@ -688,7 +689,7 @@ void LLConversationViewParticipant::draw() } drawHighlight(show_context, mIsSelected, sHighlightBgColor, sFlashBgColor, sFocusOutlineColor, sMouseOverColor); - drawLabel(font, text_left, y, color, right_x); + drawLabel(font, text_left, y, color->get(), right_x); LLView::draw(); } diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index 603f54fb49..cd45093856 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -110,12 +110,6 @@ LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, bool show // create user interface for this picker createUI (); - - if (!mCanApplyImmediately) - { - mApplyImmediateCheck->setEnabled(false); - mApplyImmediateCheck->set(false); - } } LLFloaterColorPicker::~LLFloaterColorPicker() @@ -226,6 +220,12 @@ bool LLFloaterColorPicker::postBuild() mApplyImmediateCheck->set(gSavedSettings.getBOOL("ApplyColorImmediately")); mApplyImmediateCheck->setCommitCallback(onImmediateCheck, this); + if (!mCanApplyImmediately) + { + mApplyImmediateCheck->setEnabled(false); + mApplyImmediateCheck->set(false); + } + childSetCommitCallback("rspin", onTextCommit, (void*)this ); childSetCommitCallback("gspin", onTextCommit, (void*)this ); childSetCommitCallback("bspin", onTextCommit, (void*)this ); diff --git a/indra/newview/llfloateremojipicker.cpp b/indra/newview/llfloateremojipicker.cpp index 50f71c9c0b..cc13e5d059 100644 --- a/indra/newview/llfloateremojipicker.cpp +++ b/indra/newview/llfloateremojipicker.cpp @@ -203,8 +203,7 @@ public: F32 centerY = 0.5f * clientHeight; drawIcon(centerX, centerY - 1, iconWidth); - static LLColor4 defaultColor(0.75f, 0.75f, 0.75f, 1.0f); - static LLUIColor textColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", defaultColor); + static LLUIColor textColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", LLColor4(0.75f, 0.75f, 0.75f, 1.0f)); S32 max_pixels = clientWidth - iconWidth; drawName((F32)iconWidth, centerY, max_pixels, textColor.get()); } @@ -704,8 +703,7 @@ void LLFloaterEmojiPicker::fillEmojis(bool fromResize) LLPanel::Params icon_params; LLRect icon_rect(0, icon_size, icon_size, 0); - static LLColor4 default_color(0.75f, 0.75f, 0.75f, 1.0f); - LLColor4 bg_color = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", default_color); + static LLUIColor bg_color = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", LLColor4(0.75f, 0.75f, 0.75f, 1.0f)); if (!mSelectedGroupIndex) { diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index 5cf02d1ec0..a614299e03 100644 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -535,14 +535,13 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg, if (gSavedSettings.getS32("ShowScriptErrorsLocation") == 1)// show error in window //("ScriptErrorsAsChat")) { - - LLColor4 txt_color; - - LLViewerChat::getChatColor(chat_msg,txt_color); + LLUIColor txt_color; + F32 alpha = 1.f; + LLViewerChat::getChatColor(chat_msg, txt_color, alpha); LLFloaterScriptDebug::addScriptLine(chat_msg.mText, chat_msg.mFromName, - txt_color, + txt_color % alpha, chat_msg.mFromID); return; } diff --git a/indra/newview/llfloaterscriptedprefs.cpp b/indra/newview/llfloaterscriptedprefs.cpp index a38c4b51f2..fa31cd72c1 100644 --- a/indra/newview/llfloaterscriptedprefs.cpp +++ b/indra/newview/llfloaterscriptedprefs.cpp @@ -54,8 +54,6 @@ bool LLFloaterScriptEdPrefs::postBuild() void LLFloaterScriptEdPrefs::applyUIColor(LLUICtrl* ctrl, const LLSD& param) { LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue())); - mEditor->initKeywords(); - mEditor->loadKeywords(); } void LLFloaterScriptEdPrefs::getUIColor(LLUICtrl* ctrl, const LLSD& param) diff --git a/indra/newview/llfloatersettingscolor.cpp b/indra/newview/llfloatersettingscolor.cpp new file mode 100644 index 0000000000..d9c382a1dc --- /dev/null +++ b/indra/newview/llfloatersettingscolor.cpp @@ -0,0 +1,334 @@ +/** +* @file llfloatersettingscolor.cpp +* @brief Implementation of LLFloaterSettingsColor +* @author Rye Cogtail<rye@alchemyviewer.org> +* +* $LicenseInfo:firstyear=2024&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2024, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" + +#include "llfloatersettingscolor.h" + +#include "llfloater.h" +#include "llfiltereditor.h" +#include "lluictrlfactory.h" +#include "llcombobox.h" +#include "llspinctrl.h" +#include "llcolorswatch.h" +#include "llviewercontrol.h" +#include "lltexteditor.h" + + +LLFloaterSettingsColor::LLFloaterSettingsColor(const LLSD& key) +: LLFloater(key), + mSettingList(NULL) +{ + mCommitCallbackRegistrar.add("CommitSettings", boost::bind(&LLFloaterSettingsColor::onCommitSettings, this)); + mCommitCallbackRegistrar.add("ClickDefault", boost::bind(&LLFloaterSettingsColor::onClickDefault, this)); +} + +LLFloaterSettingsColor::~LLFloaterSettingsColor() +{} + +bool LLFloaterSettingsColor::postBuild() +{ + enableResizeCtrls(true, false, true); + + mAlphaSpinner = getChild<LLSpinCtrl>("alpha_spinner"); + mColorSwatch = getChild<LLColorSwatchCtrl>("color_swatch"); + + mDefaultButton = getChild<LLUICtrl>("default_btn"); + mSettingNameText = getChild<LLTextBox>("color_name_txt"); + + getChild<LLFilterEditor>("filter_input")->setCommitCallback(boost::bind(&LLFloaterSettingsColor::setSearchFilter, this, _2)); + + mSettingList = getChild<LLScrollListCtrl>("setting_list"); + mSettingList->setCommitOnSelectionChange(true); + mSettingList->setCommitCallback(boost::bind(&LLFloaterSettingsColor::onSettingSelect, this)); + + updateList(); + + gSavedSettings.getControl("ColorSettingsHideDefault")->getCommitSignal()->connect(boost::bind(&LLFloaterSettingsColor::updateList, this, false)); + + return LLFloater::postBuild(); +} + +void LLFloaterSettingsColor::draw() +{ + LLScrollListItem* first_selected = mSettingList->getFirstSelected(); + if (first_selected) + { + if(auto cell = first_selected->getColumn(1)) + { + updateControl(cell->getValue().asString()); + } + } + + LLFloater::draw(); +} + +void LLFloaterSettingsColor::onCommitSettings() +{ + LLScrollListItem* first_selected = mSettingList->getFirstSelected(); + if (!first_selected) + { + return; + } + auto cell = first_selected->getColumn(1); + + if (!cell) + { + return; + } + + auto color_name = cell->getValue().asString(); + if (color_name.empty()) + { + return; + } + + LLColor4 col4; + LLColor3 col3; + col3.setValue(mColorSwatch->getValue()); + col4 = LLColor4(col3, (F32)mAlphaSpinner->getValue().asReal()); + LLUIColorTable::instance().setColor(color_name, col4); + + updateDefaultColumn(color_name); +} + +// static +void LLFloaterSettingsColor::onClickDefault() +{ + LLScrollListItem* first_selected = mSettingList->getFirstSelected(); + if (first_selected) + { + auto cell = first_selected->getColumn(1); + if (cell) + { + auto name = cell->getValue().asString(); + LLUIColorTable::instance().resetToDefault(name); + updateDefaultColumn(name); + updateControl(name); + } + } +} + +// we've switched controls, or doing per-frame update, so update spinners, etc. +void LLFloaterSettingsColor::updateControl(const std::string& color_name) +{ + hideUIControls(); + + if (!isSettingHidden(color_name)) + { + mDefaultButton->setVisible(true); + mSettingNameText->setVisible(true); + mSettingNameText->setText(color_name); + mSettingNameText->setToolTip(color_name); + + LLColor4 clr = LLUIColorTable::instance().getColor(color_name); + mColorSwatch->setVisible(true); + // only set if changed so color picker doesn't update + if (clr != LLColor4(mColorSwatch->getValue())) + { + mColorSwatch->setOriginal(clr); + } + mAlphaSpinner->setVisible(true); + mAlphaSpinner->setLabel(std::string("Alpha")); + if (!mAlphaSpinner->hasFocus()) + { + mAlphaSpinner->setPrecision(3); + mAlphaSpinner->setMinValue(0.0); + mAlphaSpinner->setMaxValue(1.f); + mAlphaSpinner->setValue(clr.mV[VALPHA]); + } + } + +} + +void LLFloaterSettingsColor::updateList(bool skip_selection) +{ + std::string last_selected; + LLScrollListItem* item = mSettingList->getFirstSelected(); + if (item) + { + LLScrollListCell* cell = item->getColumn(1); + if (cell) + { + last_selected = cell->getValue().asString(); + } + } + + mSettingList->deleteAllItems(); + + const auto& base_colors = LLUIColorTable::instance().getLoadedColors(); + for (const auto& pair : base_colors) + { + const auto& name = pair.first; + if (matchesSearchFilter(name) && !isSettingHidden(name)) + { + LLSD row; + + row["columns"][0]["column"] = "changed_color"; + row["columns"][0]["value"] = LLUIColorTable::instance().isDefault(name) ? "" : "*"; + + row["columns"][1]["column"] = "color"; + row["columns"][1]["value"] = name; + + LLScrollListItem* item = mSettingList->addElement(row, ADD_BOTTOM, nullptr); + if (!mSearchFilter.empty() && (last_selected == name) && !skip_selection) + { + std::string lower_name(name); + LLStringUtil::toLower(lower_name); + if (LLStringUtil::startsWith(lower_name, mSearchFilter)) + { + item->setSelected(true); + } + } + } + } + + for (const auto& pair : LLUIColorTable::instance().getUserColors()) + { + const auto& name = pair.first; + if (base_colors.find(name) == base_colors.end() && matchesSearchFilter(name) && !isSettingHidden(name)) + { + LLSD row; + + row["columns"][0]["column"] = "changed_color"; + row["columns"][0]["value"] = LLUIColorTable::instance().isDefault(name) ? "" : "*"; + + row["columns"][1]["column"] = "color"; + row["columns"][1]["value"] = name; + + LLScrollListItem* item = mSettingList->addElement(row, ADD_BOTTOM, nullptr); + if (!mSearchFilter.empty() && (last_selected == name) && !skip_selection) + { + std::string lower_name(name); + LLStringUtil::toLower(lower_name); + if (LLStringUtil::startsWith(lower_name, mSearchFilter)) + { + item->setSelected(true); + } + } + } + } + + mSettingList->updateSort(); + + if (!mSettingList->isEmpty()) + { + if (mSettingList->hasSelectedItem()) + { + mSettingList->scrollToShowSelected(); + } + else if (!mSettingList->hasSelectedItem() && !mSearchFilter.empty() && !skip_selection) + { + if (!mSettingList->selectItemByPrefix(mSearchFilter, false, 1)) + { + mSettingList->selectFirstItem(); + } + mSettingList->scrollToShowSelected(); + } + } + else + { + LLSD row; + + row["columns"][0]["column"] = "changed_color"; + row["columns"][0]["value"] = ""; + row["columns"][1]["column"] = "color"; + row["columns"][1]["value"] = "No matching colors."; + + mSettingList->addElement(row); + hideUIControls(); + } +} + +void LLFloaterSettingsColor::onSettingSelect() +{ + LLScrollListItem* first_selected = mSettingList->getFirstSelected(); + if (first_selected) + { + auto cell = first_selected->getColumn(1); + if (cell) + { + updateControl(cell->getValue().asString()); + } + } +} + +void LLFloaterSettingsColor::setSearchFilter(const std::string& filter) +{ + if(mSearchFilter == filter) + return; + mSearchFilter = filter; + LLStringUtil::toLower(mSearchFilter); + updateList(); +} + +bool LLFloaterSettingsColor::matchesSearchFilter(std::string setting_name) +{ + // If the search filter is empty, everything passes. + if (mSearchFilter.empty()) return true; + + LLStringUtil::toLower(setting_name); + std::string::size_type match_name = setting_name.find(mSearchFilter); + + return (std::string::npos != match_name); +} + +bool LLFloaterSettingsColor::isSettingHidden(const std::string& color_name) +{ + static LLCachedControl<bool> hide_default(gSavedSettings, "ColorSettingsHideDefault", false); + return hide_default && LLUIColorTable::instance().isDefault(color_name); +} + +void LLFloaterSettingsColor::updateDefaultColumn(const std::string& color_name) +{ + if (isSettingHidden(color_name)) + { + hideUIControls(); + updateList(true); + return; + } + + LLScrollListItem* item = mSettingList->getFirstSelected(); + if (item) + { + LLScrollListCell* cell = item->getColumn(0); + if (cell) + { + std::string is_default = LLUIColorTable::instance().isDefault(color_name) ? "" : "*"; + cell->setValue(is_default); + } + } +} + +void LLFloaterSettingsColor::hideUIControls() +{ + mColorSwatch->setVisible(false); + mAlphaSpinner->setVisible(false); + mDefaultButton->setVisible(false); + mSettingNameText->setVisible(false); +} + diff --git a/indra/newview/llfloatersettingscolor.h b/indra/newview/llfloatersettingscolor.h new file mode 100644 index 0000000000..42eb85cd60 --- /dev/null +++ b/indra/newview/llfloatersettingscolor.h @@ -0,0 +1,81 @@ +/** +* @file llfloatersettingscolor.h +* @brief Header file for LLFloaterSettingsColor +* @author Rye Cogtail<rye@alchemyviewer.org> +* +* $LicenseInfo:firstyear=2024&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2024, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#ifndef LLFLOATERCOLORSETTINGS_H +#define LLFLOATERCOLORSETTINGS_H + +#include "llcontrol.h" +#include "llfloater.h" + +class LLColorSwatchCtrl; +class LLScrollListCtrl; +class LLSpinCtrl; +class LLTextBox; + +class LLFloaterSettingsColor final +: public LLFloater +{ + friend class LLFloaterReg; + +public: + + bool postBuild() override; + void draw() override; + + void updateControl(const std::string& color_name); + + void onCommitSettings(); + void onClickDefault(); + + bool matchesSearchFilter(std::string setting_name); + bool isSettingHidden(const std::string& color_name); + +private: + LLFloaterSettingsColor(const LLSD& key); + virtual ~LLFloaterSettingsColor(); + + void updateList(bool skip_selection = false); + void onSettingSelect(); + void setSearchFilter(const std::string& filter); + + void updateDefaultColumn(const std::string& color_name); + void hideUIControls(); + + LLScrollListCtrl* mSettingList; + +protected: + LLUICtrl* mDefaultButton = nullptr; + LLTextBox* mSettingNameText = nullptr; + + LLSpinCtrl* mAlphaSpinner = nullptr; + LLColorSwatchCtrl* mColorSwatch = nullptr; + + std::string mSearchFilter; +}; + +#endif //LLFLOATERCOLORSETTINGS_H + diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp index 4011a857e5..205089c662 100644 --- a/indra/newview/llhudnametag.cpp +++ b/indra/newview/llhudnametag.cpp @@ -279,8 +279,10 @@ void LLHUDNameTag::renderText(bool for_select) mOffsetY = lltrunc(mHeight * ((mVertAlignment == ALIGN_VERT_CENTER) ? 0.5f : 1.f)); // *TODO: make this a per-text setting - LLColor4 bg_color = LLUIColorTable::instance().getColor("NameTagBackground"); - bg_color.setAlpha(gSavedSettings.getF32("ChatBubbleOpacity") * alpha_factor); + static LLCachedControl<F32> bubble_opacity(gSavedSettings, "ChatBubbleOpacity"); + static LLUIColor nametag_bg_color = LLUIColorTable::instance().getColor("NameTagBackground"); + LLColor4 bg_color = nametag_bg_color; + bg_color.setAlpha(bubble_opacity * alpha_factor); // scale screen size of borders down //RN: for now, text on hud objects is never occluded @@ -340,8 +342,7 @@ void LLHUDNameTag::renderText(bool for_select) x_offset = -0.5f * mWidth + (HORIZONTAL_PADDING / 2.f); } - LLColor4 label_color(0.f, 0.f, 0.f, 1.f); - label_color.mV[VALPHA] = alpha_factor; + LLColor4 label_color(0.f, 0.f, 0.f, alpha_factor); hud_render_text(segment_iter->getText(), render_position, *fontp, segment_iter->mStyle, LLFontGL::NO_SHADOW, x_offset, y_offset, label_color, false); } } diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 35bcf65db6..fd0d8b696f 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -138,8 +138,10 @@ void LLHUDText::renderText() mOffsetY = lltrunc(mHeight * ((mVertAlignment == ALIGN_VERT_CENTER) ? 0.5f : 1.f)); // *TODO: make this a per-text setting - LLColor4 bg_color = LLUIColorTable::instance().getColor("ObjectBubbleColor"); - bg_color.setAlpha(gSavedSettings.getF32("ChatBubbleOpacity") * alpha_factor); + static LLCachedControl<F32> bubble_opacity(gSavedSettings, "ChatBubbleOpacity"); + static LLUIColor nametag_bg_color = LLUIColorTable::instance().getColor("ObjectBubbleColor"); + LLColor4 bg_color = nametag_bg_color; + bg_color.setAlpha(bubble_opacity * alpha_factor); const S32 border_height = 16; const S32 border_width = 16; diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 2ca122c955..9e6cf7ac73 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -2881,11 +2881,13 @@ void LLInventoryGalleryItem::draw() LLPanel::draw(); // Draw border - LLUIColor border_color = LLUIColorTable::instance().getColor(mSelected ? "MenuItemHighlightBgColor" : "TextFgTentativeColor", LLColor4::white); + static LLUIColor menu_highlighted_color = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", LLColor4::white);; + static LLUIColor text_fg_tentative_color = LLUIColorTable::instance().getColor("TextFgTentativeColor", LLColor4::white);; + const LLColor4& border_color = mSelected ? menu_highlighted_color : text_fg_tentative_color; LLRect border = mThumbnailCtrl->getRect(); border.mRight = border.mRight + 1; border.mTop = border.mTop + 1; - gl_rect_2d(border, border_color.get(), false); + gl_rect_2d(border, border_color, false); } } diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index 0c82db1011..0d617753c8 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -594,9 +594,9 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string LLColor4 LLManip::setupSnapGuideRenderPass(S32 pass) { - static LLColor4 grid_color_fg = LLUIColorTable::instance().getColor("GridlineColor"); - static LLColor4 grid_color_bg = LLUIColorTable::instance().getColor("GridlineBGColor"); - static LLColor4 grid_color_shadow = LLUIColorTable::instance().getColor("GridlineShadowColor"); + static LLUIColor grid_color_fg = LLUIColorTable::instance().getColor("GridlineColor"); + static LLUIColor grid_color_bg = LLUIColorTable::instance().getColor("GridlineBGColor"); + static LLUIColor grid_color_shadow = LLUIColorTable::instance().getColor("GridlineShadowColor"); LLColor4 line_color; F32 line_alpha = gSavedSettings.getF32("GridOpacity"); diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index f889a4439e..d7df9ceadc 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -1020,8 +1020,8 @@ void LLOutfitGalleryItem::setOutfitWorn(bool value) LLStringUtil::format_map_t worn_string_args; std::string worn_string = getString("worn_string", worn_string_args); LLUIColor text_color = LLUIColorTable::instance().getColor("White", LLColor4::white); - mOutfitWornText->setReadOnlyColor(text_color.get()); - mOutfitNameText->setReadOnlyColor(text_color.get()); + mOutfitWornText->setReadOnlyColor(text_color); + mOutfitNameText->setReadOnlyColor(text_color); mOutfitWornText->setFont(value ? LLFontGL::getFontSansSerifBold() : LLFontGL::getFontSansSerifSmall()); mOutfitNameText->setFont(value ? LLFontGL::getFontSansSerifBold() : LLFontGL::getFontSansSerifSmall()); mOutfitWornText->setValue(value ? worn_string : ""); 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/llscripteditor.cpp b/indra/newview/llscripteditor.cpp index 6f23477415..59cf3ac02b 100644 --- a/indra/newview/llscripteditor.cpp +++ b/indra/newview/llscripteditor.cpp @@ -122,7 +122,7 @@ void LLScriptEditor::drawLineNumbers() const LLWString ltext = utf8str_to_wstring(llformat("%d", line.mLineNum )); bool is_cur_line = cursor_line == line.mLineNum; const U8 style = is_cur_line ? LLFontGL::BOLD : LLFontGL::NORMAL; - const LLColor4 fg_color = is_cur_line ? mCursorColor : mReadOnlyFgColor; + const LLColor4& fg_color = is_cur_line ? mCursorColor : mReadOnlyFgColor; getScriptFont()->render( ltext, // string to draw 0, // begin offset diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index fcd1c84ba4..342048252f 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -128,12 +128,12 @@ F32 LLSelectMgr::sHighlightAlpha = 0.f; F32 LLSelectMgr::sHighlightAlphaTest = 0.f; F32 LLSelectMgr::sHighlightUAnim = 0.f; F32 LLSelectMgr::sHighlightVAnim = 0.f; -LLColor4 LLSelectMgr::sSilhouetteParentColor; -LLColor4 LLSelectMgr::sSilhouetteChildColor; -LLColor4 LLSelectMgr::sHighlightInspectColor; -LLColor4 LLSelectMgr::sHighlightParentColor; -LLColor4 LLSelectMgr::sHighlightChildColor; -LLColor4 LLSelectMgr::sContextSilhouetteColor; +LLUIColor LLSelectMgr::sSilhouetteParentColor; +LLUIColor LLSelectMgr::sSilhouetteChildColor; +LLUIColor LLSelectMgr::sHighlightInspectColor; +LLUIColor LLSelectMgr::sHighlightParentColor; +LLUIColor LLSelectMgr::sHighlightChildColor; +LLUIColor LLSelectMgr::sContextSilhouetteColor; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // struct LLDeRezInfo @@ -6437,8 +6437,10 @@ void LLSelectMgr::renderSilhouettes(bool for_hud) bool wireframe_selection = (gFloaterTools && gFloaterTools->getVisible()) || LLSelectMgr::sRenderHiddenSelections; F32 fogCfx = (F32)llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal() - gAgentCamera.getCameraPositionGlobal()).magVec() / (LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec() * 4), 0.0, 1.0); - static LLColor4 sParentColor = LLColor4(sSilhouetteParentColor[VRED], sSilhouetteParentColor[VGREEN], sSilhouetteParentColor[VBLUE], LLSelectMgr::sHighlightAlpha); - static LLColor4 sChildColor = LLColor4(sSilhouetteChildColor[VRED], sSilhouetteChildColor[VGREEN], sSilhouetteChildColor[VBLUE], LLSelectMgr::sHighlightAlpha); + LLColor4 sParentColor = sSilhouetteParentColor; + sParentColor.mV[VALPHA] = LLSelectMgr::sHighlightAlpha; + LLColor4 sChildColor = sSilhouetteChildColor; + sChildColor.mV[VALPHA] = LLSelectMgr::sHighlightAlpha; auto renderMeshSelection_f = [fogCfx, wireframe_selection](LLSelectNode* node, LLViewerObject* objectp, LLColor4 hlColor) { @@ -8006,12 +8008,9 @@ S32 LLObjectSelection::getSelectedObjectRenderCost() cost += object->getRenderCost(textures); computed_objects.insert(object->getID()); - const_child_list_t children = object->getChildren(); - for (const_child_list_t::const_iterator child_iter = children.begin(); - child_iter != children.end(); - ++child_iter) + const const_child_list_t& children = object->getChildren(); + for (LLViewerObject* child_obj : children) { - LLViewerObject* child_obj = *child_iter; LLVOVolume *child = dynamic_cast<LLVOVolume*>( child_obj ); if (child) { diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 355e28595b..2764b0179c 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -44,6 +44,7 @@ #include "llcontrol.h" #include "llviewerobject.h" // LLObjectSelection::getSelectedTEValue template #include "llmaterial.h" +#include "lluicolor.h" #include <deque> #include <boost/iterator/filter_iterator.hpp> @@ -450,12 +451,12 @@ public: static F32 sHighlightAlphaTest; static F32 sHighlightUAnim; static F32 sHighlightVAnim; - static LLColor4 sSilhouetteParentColor; - static LLColor4 sSilhouetteChildColor; - static LLColor4 sHighlightParentColor; - static LLColor4 sHighlightChildColor; - static LLColor4 sHighlightInspectColor; - static LLColor4 sContextSilhouetteColor; + static LLUIColor sSilhouetteParentColor; + static LLUIColor sSilhouetteChildColor; + static LLUIColor sHighlightParentColor; + static LLUIColor sHighlightChildColor; + static LLUIColor sHighlightInspectColor; + static LLUIColor sContextSilhouetteColor; LLCachedControl<bool> mHideSelectedObjects; LLCachedControl<bool> mRenderHighlightSelections; 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 diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 81002139be..7480a18d9f 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -368,8 +368,8 @@ void LLSpeakerMgr::update(bool resort_ok) return; } - LLColor4 speaking_color = LLUIColorTable::instance().getColor("SpeakingColor"); - LLColor4 overdriven_color = LLUIColorTable::instance().getColor("OverdrivenColor"); + static const LLUIColor speaking_color = LLUIColorTable::instance().getColor("SpeakingColor"); + static const LLUIColor overdriven_color = LLUIColorTable::instance().getColor("OverdrivenColor"); if(resort_ok) // only allow list changes when user is not interacting with it { diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 5180b1808c..0063e0b7fd 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -566,7 +566,7 @@ void LLToolBarView::draw() // Draw drop zones if drop of a tool is active if (isToolDragged()) { - LLColor4 drop_color = LLUIColorTable::instance().getColor( "ToolbarDropZoneColor" ); + static const LLUIColor drop_color = LLUIColorTable::instance().getColor( "ToolbarDropZoneColor" ); for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++) { diff --git a/indra/newview/llviewerchat.cpp b/indra/newview/llviewerchat.cpp index 597cf3c98c..8b01c4ef88 100644 --- a/indra/newview/llviewerchat.cpp +++ b/indra/newview/llviewerchat.cpp @@ -41,7 +41,7 @@ LLViewerChat::font_change_signal_t LLViewerChat::sChatFontChangedSignal; //static -void LLViewerChat::getChatColor(const LLChat& chat, LLColor4& r_color) +void LLViewerChat::getChatColor(const LLChat& chat, LLUIColor& r_color, F32& r_color_alpha) { if(chat.mMuted) { @@ -90,7 +90,7 @@ void LLViewerChat::getChatColor(const LLChat& chat, LLColor4& r_color) } break; default: - r_color.setToWhite(); + r_color = LLUIColorTable::instance().getColor("White"); } if (!chat.mPosAgent.isExactlyZero()) @@ -101,7 +101,11 @@ void LLViewerChat::getChatColor(const LLChat& chat, LLColor4& r_color) if (distance_squared > dist_near_chat * dist_near_chat) { // diminish far-off chat - r_color.mV[VALPHA] = 0.8f; + r_color_alpha = 0.8f; + } + else + { + r_color_alpha = 1.0f; } } } diff --git a/indra/newview/llviewerchat.h b/indra/newview/llviewerchat.h index a84d7dbc5d..6138358caf 100644 --- a/indra/newview/llviewerchat.h +++ b/indra/newview/llviewerchat.h @@ -29,15 +29,14 @@ #include "llchat.h" #include "llfontgl.h" -#include "v4color.h" - +#include "lluicolor.h" class LLViewerChat { public: typedef boost::signals2::signal<void (LLFontGL*)> font_change_signal_t; - static void getChatColor(const LLChat& chat, LLColor4& r_color); + static void getChatColor(const LLChat& chat, LLUIColor& r_color, F32& r_color_alpha); static void getChatColor(const LLChat& chat, std::string& r_color_name, F32& r_color_alpha); static LLFontGL* getChatFont(); static S32 getChatFontSize(); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index c97a512a57..9bdd246129 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -134,6 +134,7 @@ #include "llfloaterscriptlimits.h" #include "llfloatersearch.h" #include "llfloatersellland.h" +#include "llfloatersettingscolor.h" #include "llfloatersettingsdebug.h" #include "llfloatersidepanelcontainer.h" #include "llfloatersnapshot.h" @@ -486,6 +487,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("script_limits", "floater_script_limits.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptLimits>); LLFloaterReg::add("my_scripts", "floater_my_scripts.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMyScripts>); LLFloaterReg::add("sell_land", "floater_sell_land.xml", &LLFloaterSellLand::buildFloater); + LLFloaterReg::add("settings_color", "floater_settings_color.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSettingsColor>); LLFloaterReg::add("settings_debug", "floater_settings_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSettingsDebug>); LLFloaterReg::add("sound_devices", "floater_sound_devices.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSoundDevices>); LLFloaterReg::add("stats", "floater_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloater>); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 0c8dd6dff9..e3b92598f7 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -536,9 +536,7 @@ void init_menus() /// /// set up the colors /// - LLColor4 color; - - LLColor4 context_menu_color = LLUIColorTable::instance().getColor("MenuPopupBgColor"); + LLUIColor context_menu_color = LLUIColorTable::instance().getColor("MenuPopupBgColor"); gMenuAvatarSelf->setBackgroundColor( context_menu_color ); gMenuAvatarOther->setBackgroundColor( context_menu_color ); @@ -548,7 +546,7 @@ void init_menus() gMenuLand->setBackgroundColor( context_menu_color ); - color = LLUIColorTable::instance().getColor( "MenuPopupBgColor" ); + LLUIColor color = LLUIColorTable::instance().getColor( "MenuPopupBgColor" ); gPopupMenuView->setBackgroundColor( color ); // If we are not in production, use a different color to make it apparent. diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index cda8c99594..ae64ee7b92 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1715,15 +1715,15 @@ void LLViewerObjectList::clearAllMapObjectsInRegion(LLViewerRegion* regionp) void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap) { - LLColor4 above_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnAboveWater" ); - LLColor4 below_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnBelowWater" ); - LLColor4 you_own_above_water_color = + static const LLUIColor above_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnAboveWater" ); + static const LLUIColor below_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnBelowWater" ); + static const LLUIColor you_own_above_water_color = LLUIColorTable::instance().getColor( "NetMapYouOwnAboveWater" ); - LLColor4 you_own_below_water_color = + static const LLUIColor you_own_below_water_color = LLUIColorTable::instance().getColor( "NetMapYouOwnBelowWater" ); - LLColor4 group_own_above_water_color = + static const LLUIColor group_own_above_water_color = LLUIColorTable::instance().getColor( "NetMapGroupOwnAboveWater" ); - LLColor4 group_own_below_water_color = + static const LLUIColor group_own_below_water_color = LLUIColorTable::instance().getColor( "NetMapGroupOwnBelowWater" ); F32 max_radius = gSavedSettings.getF32("MiniMapPrimMaxRadius"); @@ -1753,7 +1753,7 @@ void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap) // See DEV-17370 and DEV-29869/SNOW-79 for details. approx_radius = llmin(approx_radius, max_radius); - LLColor4U color = above_water_color; + LLColor4U color = above_water_color.get(); if( objectp->permYouOwner() ) { const F32 MIN_RADIUS_FOR_OWNED_OBJECTS = 2.f; @@ -1766,29 +1766,29 @@ void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap) { if ( objectp->permGroupOwner() ) { - color = group_own_above_water_color; + color = group_own_above_water_color.get(); } else { - color = you_own_above_water_color; + color = you_own_above_water_color.get(); } } else { if ( objectp->permGroupOwner() ) { - color = group_own_below_water_color; + color = group_own_below_water_color.get(); } else { - color = you_own_below_water_color; + color = you_own_below_water_color.get(); } } } else if( pos.mdV[VZ] < water_height ) { - color = below_water_color; + color = below_water_color.get(); } netmap.renderScaledPointGlobal( diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 58b8a5b677..2e9b5de72b 100755 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -53,6 +53,14 @@ static const U8 OVERLAY_IMG_COMPONENTS = 4; static const F32 LINE_WIDTH = 0.0625f; +bool LLViewerParcelOverlay::sColorSetInitialized = false; +LLUIColor LLViewerParcelOverlay::sAvailColor; +LLUIColor LLViewerParcelOverlay::sOwnedColor; +LLUIColor LLViewerParcelOverlay::sGroupColor; +LLUIColor LLViewerParcelOverlay::sSelfColor; +LLUIColor LLViewerParcelOverlay::sForSaleColor; +LLUIColor LLViewerParcelOverlay::sAuctionColor; + LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_width_meters) : mRegion( region ), mParcelGridsPerEdge( S32( region_width_meters / PARCEL_GRID_STEP_METERS ) ), @@ -60,6 +68,17 @@ LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_ mTimeSinceLastUpdate(), mOverlayTextureIdx(-1) { + if (!sColorSetInitialized) + { + sColorSetInitialized = true; + sAvailColor = LLUIColorTable::instance().getColor("PropertyColorAvail").get(); + sOwnedColor = LLUIColorTable::instance().getColor("PropertyColorOther").get(); + sGroupColor = LLUIColorTable::instance().getColor("PropertyColorGroup").get(); + sSelfColor = LLUIColorTable::instance().getColor("PropertyColorSelf").get(); + sForSaleColor = LLUIColorTable::instance().getColor("PropertyColorForSale").get(); + sAuctionColor = LLUIColorTable::instance().getColor("PropertyColorAuction").get(); + } + // Create a texture to hold color information. // 4 components // Use mipmaps = false, clamped, NEAREST filter, for sharp edges @@ -321,12 +340,12 @@ void LLViewerParcelOverlay::updateOverlayTexture() mOverlayTextureIdx = 0; } - const LLColor4U avail = LLUIColorTable::instance().getColor("PropertyColorAvail").get(); - const LLColor4U owned = LLUIColorTable::instance().getColor("PropertyColorOther").get(); - const LLColor4U group = LLUIColorTable::instance().getColor("PropertyColorGroup").get(); - const LLColor4U self = LLUIColorTable::instance().getColor("PropertyColorSelf").get(); - const LLColor4U for_sale = LLUIColorTable::instance().getColor("PropertyColorForSale").get(); - const LLColor4U auction = LLUIColorTable::instance().getColor("PropertyColorAuction").get(); + const LLColor4U avail = sAvailColor.get(); + const LLColor4U owned = sOwnedColor.get(); + const LLColor4U group = sGroupColor.get(); + const LLColor4U self = sSelfColor.get(); + const LLColor4U for_sale = sForSaleColor.get(); + const LLColor4U auction = sAuctionColor.get(); // Create the base texture. U8 *raw = mImageRaw->getData(); @@ -339,7 +358,7 @@ void LLViewerParcelOverlay::updateOverlayTexture() { U8 ownership = mOwnership[i]; - F32 r,g,b,a; + U8 r,g,b,a; // Color stored in low three bits switch( ownership & 0x7 ) @@ -433,11 +452,11 @@ void LLViewerParcelOverlay::updatePropertyLines() return; LLColor4U colors[PARCEL_COLOR_MASK + 1]; - colors[PARCEL_SELF] = LLUIColorTable::instance().getColor("PropertyColorSelf").get(); - colors[PARCEL_OWNED] = LLUIColorTable::instance().getColor("PropertyColorOther").get(); - colors[PARCEL_GROUP] = LLUIColorTable::instance().getColor("PropertyColorGroup").get(); - colors[PARCEL_FOR_SALE] = LLUIColorTable::instance().getColor("PropertyColorForSale").get(); - colors[PARCEL_AUCTION] = LLUIColorTable::instance().getColor("PropertyColorAuction").get(); + colors[PARCEL_SELF] = sSelfColor.get(); + colors[PARCEL_OWNED] = sOwnedColor.get(); + colors[PARCEL_GROUP] = sGroupColor.get(); + colors[PARCEL_FOR_SALE] = sForSaleColor.get(); + colors[PARCEL_AUCTION] = sAuctionColor.get(); mEdges.clear(); diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h index d78005e376..03ae464cb8 100644 --- a/indra/newview/llviewerparceloverlay.h +++ b/indra/newview/llviewerparceloverlay.h @@ -35,6 +35,7 @@ #include "lluuid.h" #include "llviewertexture.h" #include "llgl.h" +#include "lluicolor.h" class LLViewerRegion; class LLVector3; @@ -123,6 +124,14 @@ private: }; std::vector<Edge> mEdges; + + static bool sColorSetInitialized; + static LLUIColor sAvailColor; + static LLUIColor sOwnedColor; + static LLUIColor sGroupColor; + static LLUIColor sSelfColor; + static LLUIColor sForSaleColor; + static LLUIColor sAuctionColor; }; #endif diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 15902e8a87..14228b469f 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -222,15 +222,9 @@ public: image_rect.mTop = image_rect.mBottom + mImage->getHeight(); mImage->draw(LLRect((S32)image_rect.mLeft, (S32)image_rect.mTop, (S32)image_rect.mRight, (S32)image_rect.mBottom)); - LLColor4 color; - if (mEditor.getReadOnly()) - { - color = LLUIColorTable::instance().getColor("TextEmbeddedItemReadOnlyColor"); - } - else - { - color = LLUIColorTable::instance().getColor("TextEmbeddedItemColor"); - } + static const LLUIColor embedded_item_readonly_col = LLUIColorTable::instance().getColor("TextEmbeddedItemReadOnlyColor"); + static const LLUIColor embedded_item_col = LLUIColorTable::instance().getColor("TextEmbeddedItemColor"); + const LLColor4& color = mEditor.getReadOnly() ? embedded_item_readonly_col : embedded_item_col; F32 right_x; mStyle->getFont()->render(mLabel, 0, image_rect.mRight + EMBEDDED_ITEM_LABEL_PADDING, draw_rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::UNDERLINE, LLFontGL::NO_SHADOW, static_cast<S32>(mLabel.length()), S32_MAX, &right_x); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index f6de8377f3..417cece8eb 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2190,7 +2190,7 @@ void LLViewerWindow::initWorldUI() gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP | FOLLOWS_RIGHT); gStatusBar->setShape(status_bar_container->getLocalRect()); // sync bg color with menu bar - gStatusBar->setBackgroundColor(gMenuBarView->getBackgroundColor().get()); + gStatusBar->setBackgroundColor(gMenuBarView->getBackgroundColor()); // add InBack so that gStatusBar won't be drawn over menu status_bar_container->addChildInBack(gStatusBar, 2/*tab order, after menu*/); status_bar_container->setVisible(true); @@ -2199,7 +2199,7 @@ void LLViewerWindow::initWorldUI() LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container"); navbar->setShape(nav_bar_container->getLocalRect()); - navbar->setBackgroundColor(gMenuBarView->getBackgroundColor().get()); + navbar->setBackgroundColor(gMenuBarView->getBackgroundColor()); nav_bar_container->addChild(navbar); nav_bar_container->setVisible(true); } @@ -2583,7 +2583,7 @@ void LLViewerWindow::setNormalControlsVisible( bool visible ) void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid) { LLSD args; - LLColor4 new_bg_color; + LLUIColor new_bg_color; // god more important than project, proj more important than grid if ( god_mode ) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 83df39d606..d5a8ee6cf8 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3531,7 +3531,9 @@ void LLVOAvatar::idleUpdateNameTagText(bool new_name) std::deque<LLChat>::iterator chat_iter = mChats.begin(); mNameText->clearString(); - LLColor4 new_chat = LLUIColorTable::instance().getColor( isSelf() ? "UserChatColor" : "AgentChatColor" ); + static const LLUIColor user_chat_color = LLUIColorTable::instance().getColor("UserChatColor"); + static const LLUIColor agent_chat_color = LLUIColorTable::instance().getColor("AgentChatColor"); + const LLColor4& new_chat = isSelf() ? user_chat_color : agent_chat_color; LLColor4 normal_chat = lerp(new_chat, LLColor4(0.8f, 0.8f, 0.8f, 1.f), 0.7f); LLColor4 old_chat = lerp(normal_chat, LLColor4(0.6f, 0.6f, 0.6f, 1.f), 0.7f); if (mTyping && mChats.size() >= MAX_BUBBLE_CHAT_UTTERANCES) diff --git a/indra/newview/skins/default/xui/en/floater_settings_color.xml b/indra/newview/skins/default/xui/en/floater_settings_color.xml new file mode 100644 index 0000000000..0722677f1d --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_settings_color.xml @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<floater + legacy_header_height="18" + can_minimize="false" + height="360" + min_height="367" + layout="topleft" + name="settings_color" + help_topic="settings_color" + title="COLOR SETTINGS" + reuse_instance="true" + can_resize="true" + min_width="550" + width="570"> + <filter_editor + follows="left|top|right" + height="23" + layout="topleft" + left="10" + right="-10" + label="Enter search text" + max_length_chars="300" + name="filter_input" + text_pad_left="10" + top="30" /> + <scroll_list + column_padding="0" + draw_heading="true" + draw_stripes="false" + heading_height="23" + height="266" + layout="topleft" + search_column="1" + sort_column="1" + left="10" + follows="left|top|bottom" + name="setting_list" + top_pad="2" + width="300"> + <scroll_list.columns + name="changed_color" + relative_width="0.05" /> + <scroll_list.columns + label="Color" + name="color" /> + </scroll_list> + <text + type="string" + length="1" + follows="left|top" + height="16" + layout="topleft" + name="color_name_txt" + font="SansSerifSmallBold" + top_delta="8" + left_pad="10" + visible="true" + use_ellipses="true" + text_color="White" + width="240"> + Color name + </text> + <color_swatch + top_pad="0" + left_delta="0" + follows="top|left" + can_apply_immediately="true" + height="180" + name="color_swatch" + visible="true" + layout="topleft" + width="240"> + <color_swatch.commit_callback + function="CommitSettings" /> + </color_swatch> + <spinner + height="20" + label="Alpha" + layout="topleft" + follows="top|left" + left_delta="0" + min_val="0" + max_val="1" + decimal_digits="3" + name="alpha_spinner" + top_pad="5" + visible="true" + width="120"> + <spinner.commit_callback + function="CommitSettings" /> + </spinner> + <button + height="22" + label="Reset to default" + follows="left|top" + layout="topleft" + left_delta="0" + name="default_btn" + visible="true" + top_pad="15" + width="150"> + <button.commit_callback + function="ClickDefault" /> + </button> + <check_box + control_name="ColorSettingsHideDefault" + height="16" + initial_value="true" + label="Show changed colors only" + layout="topleft" + top_pad="10" + left="10" + follows="left|bottom" + name="hide_default" + width="330"> + </check_box> +</floater>
\ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/menu_login.xml b/indra/newview/skins/default/xui/en/menu_login.xml index a71cbde21b..1d1b81e31a 100644 --- a/indra/newview/skins/default/xui/en/menu_login.xml +++ b/indra/newview/skins/default/xui/en/menu_login.xml @@ -149,6 +149,13 @@ function="Advanced.ShowDebugSettings" parameter="all" /> </menu_item_call> + <menu_item_call + label="Show Color settings" + name="Color Settings"> + <menu_item_call.on_click + function="Floater.Toggle" + parameter="settings_color" /> + </menu_item_call> <menu_item_separator /> <menu_item_call label="XUI Preview Tool" diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 941f0c6bb7..f7b10a376e 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3830,6 +3830,13 @@ function="World.EnvPreset" name="XUI" tear_off="true"> <menu_item_call + label="Show Color settings" + name="Color Settings"> + <menu_item_call.on_click + function="Floater.Toggle" + parameter="settings_color" /> + </menu_item_call> + <menu_item_call label="Reload Color Settings" name="Reload Color Settings"> <menu_item_call.on_click |