aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llchatbar.cpp
diff options
context:
space:
mode:
authorAleric Inglewood2010-10-22 03:04:49 +0200
committerAleric Inglewood2010-10-22 03:04:49 +0200
commit4e659351474096d1a7b835a69af13cbdf84257f3 (patch)
tree912cc63d3e53fef3360fbcb908d254e5253dd88e /linden/indra/newview/llchatbar.cpp
parentLindenUserDir fixes, part 2. (diff)
parentMerge branch 'weekly' of http://github.com/imprudence/imprudence into weekly (diff)
downloadmeta-impy-4e659351474096d1a7b835a69af13cbdf84257f3.zip
meta-impy-4e659351474096d1a7b835a69af13cbdf84257f3.tar.gz
meta-impy-4e659351474096d1a7b835a69af13cbdf84257f3.tar.bz2
meta-impy-4e659351474096d1a7b835a69af13cbdf84257f3.tar.xz
Merge branch 'weekly' into webkit_plugins
Conflicts: linden/indra/cmake/GStreamer.cmake linden/indra/cmake/GStreamer.cmake was deleted: we're going to try to use system libs, so any improvements that have been made in weekly have been invane. linden/indra/newview/llstartup.cpp Trivial #include collision. One include added another removed. Fixed. linden/indra/newview/lltoolpie.cpp Collision with RLV, pretty trivial. Fixed. linden/indra/newview/viewer_manifest.py Trivial White space fix collision with commenting out of gstreamer libs. Fixed.
Diffstat (limited to 'linden/indra/newview/llchatbar.cpp')
-rw-r--r--linden/indra/newview/llchatbar.cpp52
1 files changed, 22 insertions, 30 deletions
diff --git a/linden/indra/newview/llchatbar.cpp b/linden/indra/newview/llchatbar.cpp
index f3cd5b1..2f2ad16 100644
--- a/linden/indra/newview/llchatbar.cpp
+++ b/linden/indra/newview/llchatbar.cpp
@@ -88,6 +88,9 @@ void toggleChatHistory(void* user_data);
88void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel); 88void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel);
89// [/RLVa:KB] 89// [/RLVa:KB]
90 90
91// [RLVa:KB]
92#include "rlvhandler.h"
93// [/RLVa:KB]
91 94
92class LLChatBarGestureObserver : public LLGestureManagerObserver 95class LLChatBarGestureObserver : public LLGestureManagerObserver
93{ 96{
@@ -119,6 +122,8 @@ LLChatBar::LLChatBar()
119 mCompletionHolder.current_index = 0; 122 mCompletionHolder.current_index = 0;
120 mCompletionHolder.last_match = ""; 123 mCompletionHolder.last_match = "";
121 mCompletionHolder.last_txt = ""; 124 mCompletionHolder.last_txt = "";
125 mCompletionHolder.cursorPos = -1;
126 mCompletionHolder.selected = false;
122 127
123 #if !LL_RELEASE_FOR_DOWNLOAD 128 #if !LL_RELEASE_FOR_DOWNLOAD
124 childDisplayNotFound(); 129 childDisplayNotFound();
@@ -224,16 +229,17 @@ BOOL LLChatBar::handleKeyHere( KEY key, MASK mask )
224 229
225 if (!avatar_ids.empty() && !txt.empty()) 230 if (!avatar_ids.empty() && !txt.empty())
226 { 231 {
227 S32 cursorPos = mInputEditor->getCursor(); 232 if (mCompletionHolder.cursorPos == -1) // Ele: cache cursor position
233 mCompletionHolder.cursorPos = mInputEditor->getCursor();
228 234
229 if (mCompletionHolder.last_txt != mInputEditor->getText()) 235 if (mCompletionHolder.last_txt != mInputEditor->getText())
230 { 236 {
231 mCompletionHolder.last_txt = std::string(mInputEditor->getText()); 237 mCompletionHolder.last_txt = std::string(mInputEditor->getText());
232 238
233 if (cursorPos < (S32)txt.length()) 239 if (mCompletionHolder.cursorPos < (S32)txt.length())
234 { 240 {
235 mCompletionHolder.right = txt.substr(cursorPos); 241 mCompletionHolder.right = txt.substr(mCompletionHolder.cursorPos);
236 mCompletionHolder.left = txt.substr(0, cursorPos); 242 mCompletionHolder.left = txt.substr(0, mCompletionHolder.cursorPos);
237 mCompletionHolder.match = std::string(mCompletionHolder.left); 243 mCompletionHolder.match = std::string(mCompletionHolder.left);
238 } 244 }
239 else 245 else
@@ -262,24 +268,7 @@ BOOL LLChatBar::handleKeyHere( KEY key, MASK mask )
262 { 268 {
263 if (avatar_ids[i] == gAgent.getID() || avatar_ids[i].isNull()) 269 if (avatar_ids[i] == gAgent.getID() || avatar_ids[i].isNull())
264 continue; 270 continue;
265/*
266 // Grab the pos again from the objects-in-view cache... LLWorld doesn't work above 1024 meters as usual :(
267 LLVector3d real_pos = positions[i];
268 if (real_pos[2] == 0.0f)
269 {
270 LLViewerObject *av_obj = gObjectList.findObject(avatar_ids[i]);
271 if (av_obj != NULL && av_obj->isAvatar())
272 {
273 LLVOAvatar* avatarp = (LLVOAvatar*)av_obj;
274 if (avatarp != NULL)
275 real_pos = avatarp->getPositionGlobal();
276 }
277 }
278 271
279 F32 dist = F32(dist_vec(positions[i], gAgent.getPositionGlobal()));
280 if (dist > CHAT_SHOUT_RADIUS)
281 continue;
282*/
283 std::string agent_name = " "; 272 std::string agent_name = " ";
284 std::string agent_surname = " "; 273 std::string agent_surname = " ";
285 274
@@ -305,9 +294,11 @@ BOOL LLChatBar::handleKeyHere( KEY key, MASK mask )
305 std::string current_name = mCompletionHolder.names[mCompletionHolder.current_index]; 294 std::string current_name = mCompletionHolder.names[mCompletionHolder.current_index];
306 295
307 mInputEditor->setText(mCompletionHolder.left.substr(0, mCompletionHolder.left.length() - mCompletionHolder.match.length()) + current_name + mCompletionHolder.right); 296 mInputEditor->setText(mCompletionHolder.left.substr(0, mCompletionHolder.left.length() - mCompletionHolder.match.length()) + current_name + mCompletionHolder.right);
308 mInputEditor->setSelection(cursorPos, cursorPos + (current_name.length() - mCompletionHolder.match.length())); 297 mInputEditor->setCursor(mCompletionHolder.cursorPos + (current_name.length() - mCompletionHolder.match.length()));
298 mInputEditor->setSelection(mCompletionHolder.cursorPos, mCompletionHolder.cursorPos + (current_name.length() - mCompletionHolder.match.length()));
309 299
310 mCompletionHolder.current_index++; 300 mCompletionHolder.current_index++;
301 mCompletionHolder.selected = TRUE;
311 302
312 return TRUE; 303 return TRUE;
313 } 304 }
@@ -660,6 +651,9 @@ void LLChatBar::stopChat()
660void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) 651void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata )
661{ 652{
662 LLChatBar* self = (LLChatBar *)userdata; 653 LLChatBar* self = (LLChatBar *)userdata;
654 KEY key = gKeyboard->currentKey();
655
656 self->mCompletionHolder.cursorPos = -1; // Ele: reset cached cursor pos for autocompletion
663 657
664 LLWString raw_text; 658 LLWString raw_text;
665 if (self->mInputEditor) raw_text = self->mInputEditor->getWText(); 659 if (self->mInputEditor) raw_text = self->mInputEditor->getWText();
@@ -704,8 +698,6 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata )
704 } 698 }
705 */ 699 */
706 700
707 KEY key = gKeyboard->currentKey();
708
709 // Ignore "special" keys, like backspace, arrows, etc. 701 // Ignore "special" keys, like backspace, arrows, etc.
710 if (length > 1 && raw_text[0] == '/' && key < KEY_SPECIAL) 702 if (length > 1 && raw_text[0] == '/' && key < KEY_SPECIAL)
711 { 703 {
@@ -788,7 +780,7 @@ void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL
788 utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1); 780 utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1);
789 } 781 }
790 782
791// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.0b 783// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.1.1a) | Modified: RLVa-1.2.0b
792 if ( (0 == channel) && (rlv_handler_t::isEnabled()) ) 784 if ( (0 == channel) && (rlv_handler_t::isEnabled()) )
793 { 785 {
794 // Adjust the (public) chat "volume" on chat and gestures (also takes care of playing the proper animation) 786 // Adjust the (public) chat "volume" on chat and gestures (also takes care of playing the proper animation)
@@ -799,7 +791,7 @@ void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL
799 else if ( (CHAT_TYPE_WHISPER == type) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATWHISPER)) ) 791 else if ( (CHAT_TYPE_WHISPER == type) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATWHISPER)) )
800 type = CHAT_TYPE_NORMAL; 792 type = CHAT_TYPE_NORMAL;
801 793
802 animate &= !gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT); 794 animate &= !gRlvHandler.hasBehaviour( (!rlvIsEmote(utf8_text)) ? RLV_BHVR_REDIRCHAT : RLV_BHVR_REDIREMOTE );
803 } 795 }
804// [/RLVa:KB] 796// [/RLVa:KB]
805 797
@@ -843,7 +835,7 @@ void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL
843void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel) 835void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel)
844// [/RLVa:KB] 836// [/RLVa:KB]
845{ 837{
846// [RLVa:KB] - Checked: 2009-08-05 (RLVa-1.0.1e) | Modified: RLVa-1.0.1e 838// [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.1.1a) | Modified: RLVa-1.2.0a
847 // Only process chat messages (ie not CHAT_TYPE_START, CHAT_TYPE_STOP, etc) 839 // Only process chat messages (ie not CHAT_TYPE_START, CHAT_TYPE_STOP, etc)
848 if ( (rlv_handler_t::isEnabled()) && ( (CHAT_TYPE_WHISPER == type) || (CHAT_TYPE_NORMAL == type) || (CHAT_TYPE_SHOUT == type) ) ) 840 if ( (rlv_handler_t::isEnabled()) && ( (CHAT_TYPE_WHISPER == type) || (CHAT_TYPE_NORMAL == type) || (CHAT_TYPE_SHOUT == type) ) )
849 { 841 {
@@ -864,8 +856,8 @@ void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channe
864 return; 856 return;
865 } 857 }
866 858
867 // Filter public chat if sendchat restricted (and filter anything that redirchat didn't redirect) 859 // Filter public chat if sendchat restricted
868 if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHAT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT)) ) 860 if (gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHAT))
869 gRlvHandler.filterChat(utf8_out_text, true); 861 gRlvHandler.filterChat(utf8_out_text, true);
870 } 862 }
871 else 863 else
@@ -875,7 +867,7 @@ void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channe
875 return; 867 return;
876 868
877 // Don't allow chat on debug channel if @sendchat, @redirchat or @rediremote restricted (shows as public chat on viewers) 869 // Don't allow chat on debug channel if @sendchat, @redirchat or @rediremote restricted (shows as public chat on viewers)
878 if (channel >= CHAT_CHANNEL_DEBUG) 870 if (CHAT_CHANNEL_DEBUG == channel)
879 { 871 {
880 bool fIsEmote = rlvIsEmote(utf8_out_text); 872 bool fIsEmote = rlvIsEmote(utf8_out_text);
881 if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHAT)) || 873 if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHAT)) ||