From 4a854938e1edaafcfd232a965fbb7995584a487c Mon Sep 17 00:00:00 2001 From: elektrahesse Date: Wed, 8 Sep 2010 05:03:56 +0200 Subject: Added a Extra tab in adv. preferences to enable/disable chat colors and to select the colors --- linden/indra/newview/app_settings/settings.xml | 54 ++++++++++++++++++++++ linden/indra/newview/llfloaterchat.cpp | 44 ++++++++++-------- linden/indra/newview/llprefsadvanced.cpp | 10 ++++ .../xui/en-us/panel_preferences_advanced.xml | 24 ++++++++++ 4 files changed, 112 insertions(+), 20 deletions(-) diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index db44efd..6d07ece 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -4,6 +4,60 @@ + HighlightFriendsChat + + Comment + Show chat messages from friends in a different color + Persist + 1 + Type + Boolean + Value + 1 + + FriendsChatColor + + Comment + Color of chat messages from friends + Persist + 1 + Type + Color4 + Value + + 0.699999988079 + 0.899999976158 + 0.699999988079 + 1 + + + HighlightOwnNameInChat + + Comment + Show chat messages containing your name in a different color + Persist + 1 + Type + Boolean + Value + 1 + + OwnNameChatColor + + Comment + Color of chat messages from friends + Persist + 1 + Type + Color4 + Value + + 0.8 + 1.0 + 0.8 + 1 + + AllowMUpose Comment diff --git a/linden/indra/newview/llfloaterchat.cpp b/linden/indra/newview/llfloaterchat.cpp index c89bc86..a38684a 100644 --- a/linden/indra/newview/llfloaterchat.cpp +++ b/linden/indra/newview/llfloaterchat.cpp @@ -565,30 +565,34 @@ LLColor4 get_text_color(const LLChat& chat) } else { - std::string my_name = gSavedSettings.getString("FirstName"); - std::transform(my_name.begin(), my_name.end(), my_name.begin(), tolower); - - std::string lower_chat = std::string(chat.mText); - std::transform(lower_chat.begin(), lower_chat.end(), lower_chat.begin(), tolower); - - std::string blank = " "; - - // yes yes, this sucks, will move to a nicer regexp as soon as i have time to make it lol - if (lower_chat.find(my_name + blank) == 0 || // at the beginning of the text - (lower_chat.find(my_name) == 0 && lower_chat.length() == my_name.length()) || // only my name in the text - lower_chat.find(blank + my_name + blank) != std::string::npos || // my name in the middle of the text - lower_chat.rfind(blank + my_name) == lower_chat.length() - (blank + my_name).length()) // my name at the end of the text + if (gSavedSettings.getBOOL("HighlightOwnNameInChat")) { - text_color = LLColor4::purple; + std::string my_name = gSavedSettings.getString("FirstName"); + std::transform(my_name.begin(), my_name.end(), my_name.begin(), tolower); + + std::string lower_chat = std::string(chat.mText); + std::transform(lower_chat.begin(), lower_chat.end(), lower_chat.begin(), tolower); + + std::string blank = " "; + + // yes yes, this sucks, will move to a nicer regexp as soon as i have time to make it lol + if (lower_chat.find(my_name + blank) == 0 || // at the beginning of the text + (lower_chat.find(my_name) == 0 && lower_chat.length() == my_name.length()) || // only my name in the text + lower_chat.find(blank + my_name + blank) != std::string::npos || // my name in the middle of the text + lower_chat.rfind(blank + my_name) == lower_chat.length() - (blank + my_name).length()) // my name at the end of the text + { + text_color = gSavedSettings.getColor4("OwnNameChatColor"); + break; + } } - else if (is_agent_friend(chat.mFromID)) - { - text_color = LLColor4::yellow; - } - else + + if (gSavedSettings.getBOOL("HighlightFriendsChat") && is_agent_friend(chat.mFromID)) { - text_color = gSavedSettings.getColor4("AgentChatColor"); + text_color = gSavedSettings.getColor4("FriendsChatColor"); + break; } + + text_color = gSavedSettings.getColor4("AgentChatColor"); } } } diff --git a/linden/indra/newview/llprefsadvanced.cpp b/linden/indra/newview/llprefsadvanced.cpp index de39e01..695e604 100644 --- a/linden/indra/newview/llprefsadvanced.cpp +++ b/linden/indra/newview/llprefsadvanced.cpp @@ -41,6 +41,7 @@ #include "lgghunspell_wrapper.h" #include "lggautocorrectfloater.h" #include "llcombobox.h" +#include "llcolorswatch.h" #include "lluictrlfactory.h" @@ -111,6 +112,11 @@ BOOL LLPrefsAdvanced::postBuild() initHelpBtn("EmeraldHelp_SpellCheck", "EmeraldHelp_SpellCheck"); + childSetValue("HighlightFriendsChat", gSavedSettings.getBOOL("HighlightFriendsChat")); + getChild("FriendsChatColor")->set(gSavedSettings.getColor4("FriendsChatColor")); + childSetValue("HighlightOwnNameInChat", gSavedSettings.getBOOL("HighlightOwnNameInChat")); + getChild("OwnNameChatColor")->set(gSavedSettings.getColor4("OwnNameChatColor")); + refresh(); return TRUE; @@ -133,6 +139,10 @@ void LLPrefsAdvanced::apply() gSavedSettings.setU32("LightShareAllowed", (U32)childGetValue("lightshare_combo").asInteger()); + gSavedSettings.setBOOL("HighlightFriendsChat", childGetValue("HighlightFriendsChat")); + gSavedSettings.setColor4("FriendsChatColor", getChild("FriendsChatColor")->get()); + gSavedSettings.setBOOL("HighlightOwnNameInChat", childGetValue("HighlightOwnNameInChat")); + gSavedSettings.setColor4("OwnNameChatColor", getChild("OwnNameChatColor")->get()); // Need to force a rebake when ClothingLayerProtection toggled for it take effect -- MC if (gSavedSettings.getBOOL("ShowMyClientTagToOthers") != (BOOL)childGetValue("client_name_tag_broadcast_check")) diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml index 857d1f1..65d118d 100644 --- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml +++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml @@ -172,5 +172,29 @@