diff options
author | elektrahesse | 2010-09-08 05:03:56 +0200 |
---|---|---|
committer | elektrahesse | 2010-09-08 05:03:56 +0200 |
commit | 4a854938e1edaafcfd232a965fbb7995584a487c (patch) | |
tree | 3c6c5e4f3bb15a8619d27b8c6fc8b6457e045b48 | |
parent | Initial hacky release of colors in chat highlighting friend chat and when you... (diff) | |
download | meta-impy-4a854938e1edaafcfd232a965fbb7995584a487c.zip meta-impy-4a854938e1edaafcfd232a965fbb7995584a487c.tar.gz meta-impy-4a854938e1edaafcfd232a965fbb7995584a487c.tar.bz2 meta-impy-4a854938e1edaafcfd232a965fbb7995584a487c.tar.xz |
Added a Extra tab in adv. preferences to enable/disable chat colors and to select the colors
-rw-r--r-- | linden/indra/newview/app_settings/settings.xml | 54 | ||||
-rw-r--r-- | linden/indra/newview/llfloaterchat.cpp | 44 | ||||
-rw-r--r-- | linden/indra/newview/llprefsadvanced.cpp | 10 | ||||
-rw-r--r-- | linden/indra/newview/skins/default/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 @@ | |||
4 | 4 | ||
5 | <!-- Imprudence-specific settings --> | 5 | <!-- Imprudence-specific settings --> |
6 | 6 | ||
7 | <key>HighlightFriendsChat</key> | ||
8 | <map> | ||
9 | <key>Comment</key> | ||
10 | <string>Show chat messages from friends in a different color</string> | ||
11 | <key>Persist</key> | ||
12 | <integer>1</integer> | ||
13 | <key>Type</key> | ||
14 | <string>Boolean</string> | ||
15 | <key>Value</key> | ||
16 | <integer>1</integer> | ||
17 | </map> | ||
18 | <key>FriendsChatColor</key> | ||
19 | <map> | ||
20 | <key>Comment</key> | ||
21 | <string>Color of chat messages from friends</string> | ||
22 | <key>Persist</key> | ||
23 | <integer>1</integer> | ||
24 | <key>Type</key> | ||
25 | <string>Color4</string> | ||
26 | <key>Value</key> | ||
27 | <array> | ||
28 | <real>0.699999988079</real> | ||
29 | <real>0.899999976158</real> | ||
30 | <real>0.699999988079</real> | ||
31 | <real>1</real> | ||
32 | </array> | ||
33 | </map> | ||
34 | <key>HighlightOwnNameInChat</key> | ||
35 | <map> | ||
36 | <key>Comment</key> | ||
37 | <string>Show chat messages containing your name in a different color</string> | ||
38 | <key>Persist</key> | ||
39 | <integer>1</integer> | ||
40 | <key>Type</key> | ||
41 | <string>Boolean</string> | ||
42 | <key>Value</key> | ||
43 | <integer>1</integer> | ||
44 | </map> | ||
45 | <key>OwnNameChatColor</key> | ||
46 | <map> | ||
47 | <key>Comment</key> | ||
48 | <string>Color of chat messages from friends</string> | ||
49 | <key>Persist</key> | ||
50 | <integer>1</integer> | ||
51 | <key>Type</key> | ||
52 | <string>Color4</string> | ||
53 | <key>Value</key> | ||
54 | <array> | ||
55 | <real>0.8</real> | ||
56 | <real>1.0</real> | ||
57 | <real>0.8</real> | ||
58 | <real>1</real> | ||
59 | </array> | ||
60 | </map> | ||
7 | <key>AllowMUpose</key> | 61 | <key>AllowMUpose</key> |
8 | <map> | 62 | <map> |
9 | <key>Comment</key> | 63 | <key>Comment</key> |
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) | |||
565 | } | 565 | } |
566 | else | 566 | else |
567 | { | 567 | { |
568 | std::string my_name = gSavedSettings.getString("FirstName"); | 568 | if (gSavedSettings.getBOOL("HighlightOwnNameInChat")) |
569 | std::transform(my_name.begin(), my_name.end(), my_name.begin(), tolower); | ||
570 | |||
571 | std::string lower_chat = std::string(chat.mText); | ||
572 | std::transform(lower_chat.begin(), lower_chat.end(), lower_chat.begin(), tolower); | ||
573 | |||
574 | std::string blank = " "; | ||
575 | |||
576 | // yes yes, this sucks, will move to a nicer regexp as soon as i have time to make it lol | ||
577 | if (lower_chat.find(my_name + blank) == 0 || // at the beginning of the text | ||
578 | (lower_chat.find(my_name) == 0 && lower_chat.length() == my_name.length()) || // only my name in the text | ||
579 | lower_chat.find(blank + my_name + blank) != std::string::npos || // my name in the middle of the text | ||
580 | lower_chat.rfind(blank + my_name) == lower_chat.length() - (blank + my_name).length()) // my name at the end of the text | ||
581 | { | 569 | { |
582 | text_color = LLColor4::purple; | 570 | std::string my_name = gSavedSettings.getString("FirstName"); |
571 | std::transform(my_name.begin(), my_name.end(), my_name.begin(), tolower); | ||
572 | |||
573 | std::string lower_chat = std::string(chat.mText); | ||
574 | std::transform(lower_chat.begin(), lower_chat.end(), lower_chat.begin(), tolower); | ||
575 | |||
576 | std::string blank = " "; | ||
577 | |||
578 | // yes yes, this sucks, will move to a nicer regexp as soon as i have time to make it lol | ||
579 | if (lower_chat.find(my_name + blank) == 0 || // at the beginning of the text | ||
580 | (lower_chat.find(my_name) == 0 && lower_chat.length() == my_name.length()) || // only my name in the text | ||
581 | lower_chat.find(blank + my_name + blank) != std::string::npos || // my name in the middle of the text | ||
582 | lower_chat.rfind(blank + my_name) == lower_chat.length() - (blank + my_name).length()) // my name at the end of the text | ||
583 | { | ||
584 | text_color = gSavedSettings.getColor4("OwnNameChatColor"); | ||
585 | break; | ||
586 | } | ||
583 | } | 587 | } |
584 | else if (is_agent_friend(chat.mFromID)) | 588 | |
585 | { | 589 | if (gSavedSettings.getBOOL("HighlightFriendsChat") && is_agent_friend(chat.mFromID)) |
586 | text_color = LLColor4::yellow; | ||
587 | } | ||
588 | else | ||
589 | { | 590 | { |
590 | text_color = gSavedSettings.getColor4("AgentChatColor"); | 591 | text_color = gSavedSettings.getColor4("FriendsChatColor"); |
592 | break; | ||
591 | } | 593 | } |
594 | |||
595 | text_color = gSavedSettings.getColor4("AgentChatColor"); | ||
592 | } | 596 | } |
593 | } | 597 | } |
594 | } | 598 | } |
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 @@ | |||
41 | #include "lgghunspell_wrapper.h" | 41 | #include "lgghunspell_wrapper.h" |
42 | #include "lggautocorrectfloater.h" | 42 | #include "lggautocorrectfloater.h" |
43 | #include "llcombobox.h" | 43 | #include "llcombobox.h" |
44 | #include "llcolorswatch.h" | ||
44 | 45 | ||
45 | #include "lluictrlfactory.h" | 46 | #include "lluictrlfactory.h" |
46 | 47 | ||
@@ -111,6 +112,11 @@ BOOL LLPrefsAdvanced::postBuild() | |||
111 | 112 | ||
112 | initHelpBtn("EmeraldHelp_SpellCheck", "EmeraldHelp_SpellCheck"); | 113 | initHelpBtn("EmeraldHelp_SpellCheck", "EmeraldHelp_SpellCheck"); |
113 | 114 | ||
115 | childSetValue("HighlightFriendsChat", gSavedSettings.getBOOL("HighlightFriendsChat")); | ||
116 | getChild<LLColorSwatchCtrl>("FriendsChatColor")->set(gSavedSettings.getColor4("FriendsChatColor")); | ||
117 | childSetValue("HighlightOwnNameInChat", gSavedSettings.getBOOL("HighlightOwnNameInChat")); | ||
118 | getChild<LLColorSwatchCtrl>("OwnNameChatColor")->set(gSavedSettings.getColor4("OwnNameChatColor")); | ||
119 | |||
114 | refresh(); | 120 | refresh(); |
115 | 121 | ||
116 | return TRUE; | 122 | return TRUE; |
@@ -133,6 +139,10 @@ void LLPrefsAdvanced::apply() | |||
133 | gSavedSettings.setU32("LightShareAllowed", | 139 | gSavedSettings.setU32("LightShareAllowed", |
134 | (U32)childGetValue("lightshare_combo").asInteger()); | 140 | (U32)childGetValue("lightshare_combo").asInteger()); |
135 | 141 | ||
142 | gSavedSettings.setBOOL("HighlightFriendsChat", childGetValue("HighlightFriendsChat")); | ||
143 | gSavedSettings.setColor4("FriendsChatColor", getChild<LLColorSwatchCtrl>("FriendsChatColor")->get()); | ||
144 | gSavedSettings.setBOOL("HighlightOwnNameInChat", childGetValue("HighlightOwnNameInChat")); | ||
145 | gSavedSettings.setColor4("OwnNameChatColor", getChild<LLColorSwatchCtrl>("OwnNameChatColor")->get()); | ||
136 | 146 | ||
137 | // Need to force a rebake when ClothingLayerProtection toggled for it take effect -- MC | 147 | // Need to force a rebake when ClothingLayerProtection toggled for it take effect -- MC |
138 | if (gSavedSettings.getBOOL("ShowMyClientTagToOthers") != (BOOL)childGetValue("client_name_tag_broadcast_check")) | 148 | 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 @@ | |||
172 | <button name="ac_button" label="AutoCorrect Options…" halign="center" tool_tip="Modify the AutoCorrect word list and settings" left="5" | 172 | <button name="ac_button" label="AutoCorrect Options…" halign="center" tool_tip="Modify the AutoCorrect word list and settings" left="5" |
173 | bottom_delta="-64" width="180" height="20" font="SansSerifSmall" follows="left|top"/> | 173 | bottom_delta="-64" width="180" height="20" font="SansSerifSmall" follows="left|top"/> |
174 | </panel> | 174 | </panel> |
175 | |||
176 | <panel border="true" bottom="-580" follows="left|top|right|bottom" height="525" label="Extra" | ||
177 | left="1" mouse_opaque="true" name="Extra" width="418"> | ||
178 | |||
179 | <check_box bottom_delta="-30" enabled="true" follows="left|top" font="SansSerifSmall" height="16" | ||
180 | initial_value="true" label="Show chat messages from friends in a different color" left="12" | ||
181 | mouse_opaque="true" name="HighlightFriendsChat" radio_style="false" width="270"/> | ||
182 | |||
183 | <color_swatch border_color="0.45098 0.517647 0.607843 1" bottom="-90" | ||
184 | can_apply_immediately="true" color="1 1 1 1" control_name="FriendsChatColor" | ||
185 | enabled="true" follows="left|top" height="56" label="Friends" left_delta="68" | ||
186 | mouse_opaque="true" name="FriendsChatColor" width="54" /> | ||
187 | |||
188 | <check_box bottom_delta="-30" enabled="true" follows="left|top" | ||
189 | font="SansSerifSmall" height="16" initial_value="true" | ||
190 | label="Show chat messages containing your name in a different color" left="12" mouse_opaque="true" | ||
191 | name="HighlightOwnNameInChat" radio_style="false" width="217" /> | ||
192 | |||
193 | <color_swatch border_color="0.45098 0.517647 0.607843 1" bottom="-180" | ||
194 | can_apply_immediately="true" color="1 1 1 1" control_name="OwnNameChatColor" | ||
195 | enabled="true" follows="left|top" height="56" label="Own Name" left_delta="68" | ||
196 | mouse_opaque="true" name="OwnNameChatColor" width="54" /> | ||
197 | |||
198 | </panel> | ||
175 | </tab_container> | 199 | </tab_container> |
176 | </panel> | 200 | </panel> |