aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llchatbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llchatbar.cpp')
-rw-r--r--linden/indra/newview/llchatbar.cpp81
1 files changed, 40 insertions, 41 deletions
diff --git a/linden/indra/newview/llchatbar.cpp b/linden/indra/newview/llchatbar.cpp
index f5aba70..3a6c8cf 100644
--- a/linden/indra/newview/llchatbar.cpp
+++ b/linden/indra/newview/llchatbar.cpp
@@ -96,7 +96,7 @@ private:
96// 96//
97 97
98LLChatBar::LLChatBar() 98LLChatBar::LLChatBar()
99: LLPanel("", LLRect(), BORDER_NO), 99: LLPanel(LLStringUtil::null, LLRect(), BORDER_NO),
100 mInputEditor(NULL), 100 mInputEditor(NULL),
101 mGestureLabelTimer(), 101 mGestureLabelTimer(),
102 mLastSpecialChatChannel(0), 102 mLastSpecialChatChannel(0),
@@ -220,9 +220,9 @@ void LLChatBar::refreshGestures()
220 if (mGestureCombo && gestures) 220 if (mGestureCombo && gestures)
221 { 221 {
222 //store current selection so we can maintain it 222 //store current selection so we can maintain it
223 LLString cur_gesture = mGestureCombo->getValue().asString(); 223 std::string cur_gesture = mGestureCombo->getValue().asString();
224 gestures->selectFirstItem(); 224 gestures->selectFirstItem();
225 LLString label = mGestureCombo->getValue().asString();; 225 std::string label = mGestureCombo->getValue().asString();;
226 // clear 226 // clear
227 gestures->clearRows(); 227 gestures->clearRows();
228 228
@@ -241,14 +241,14 @@ void LLChatBar::refreshGestures()
241 } 241 }
242 } 242 }
243 243
244 // ad unique gestures 244 // add unique gestures
245 std::map <std::string, BOOL>::iterator it2; 245 std::map <std::string, BOOL>::iterator it2;
246 for (it2 = unique.begin(); it2 != unique.end(); ++it2) 246 for (it2 = unique.begin(); it2 != unique.end(); ++it2)
247 { 247 {
248 gestures->addSimpleElement((*it2).first); 248 gestures->addSimpleElement((*it2).first);
249 } 249 }
250 250
251 gestures->sortByColumn(0, TRUE); 251 gestures->sortByColumn(LLStringUtil::null, TRUE);
252 // Insert label after sorting 252 // Insert label after sorting
253 gestures->addSimpleElement(label, ADD_TOP); 253 gestures->addSimpleElement(label, ADD_TOP);
254 254
@@ -299,9 +299,9 @@ BOOL LLChatBar::inputEditorHasFocus()
299 return mInputEditor && mInputEditor->hasFocus(); 299 return mInputEditor && mInputEditor->hasFocus();
300} 300}
301 301
302LLString LLChatBar::getCurrentChat() 302std::string LLChatBar::getCurrentChat()
303{ 303{
304 return mInputEditor ? mInputEditor->getText() : LLString::null; 304 return mInputEditor ? mInputEditor->getText() : LLStringUtil::null;
305} 305}
306 306
307void LLChatBar::setGestureCombo(LLComboBox* combo) 307void LLChatBar::setGestureCombo(LLComboBox* combo)
@@ -344,12 +344,12 @@ LLWString LLChatBar::stripChannelNumber(const LLWString &mesg, S32* channel)
344 S32 pos = 0; 344 S32 pos = 0;
345 345
346 // Copy the channel number into a string 346 // Copy the channel number into a string
347 llwchar channel_string[64]; 347 LLWString channel_string;
348 llwchar c; 348 llwchar c;
349 do 349 do
350 { 350 {
351 c = mesg[pos+1]; 351 c = mesg[pos+1];
352 channel_string[pos] = c; 352 channel_string.push_back(c);
353 pos++; 353 pos++;
354 } 354 }
355 while(c && pos < 64 && LLStringOps::isDigit(c)); 355 while(c && pos < 64 && LLStringOps::isDigit(c));
@@ -362,7 +362,6 @@ LLWString LLChatBar::stripChannelNumber(const LLWString &mesg, S32* channel)
362 c = mesg[pos+1]; 362 c = mesg[pos+1];
363 pos++; 363 pos++;
364 } 364 }
365
366 365
367 mLastSpecialChatChannel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10); 366 mLastSpecialChatChannel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10);
368 *channel = mLastSpecialChatChannel; 367 *channel = mLastSpecialChatChannel;
@@ -379,41 +378,41 @@ LLWString LLChatBar::stripChannelNumber(const LLWString &mesg, S32* channel)
379 378
380void LLChatBar::sendChat( EChatType type ) 379void LLChatBar::sendChat( EChatType type )
381{ 380{
382 LLWString text; 381 if (mInputEditor)
383 if (mInputEditor) text = mInputEditor->getWText();
384 LLWString::trim(text);
385 LLWString::replaceChar(text,182,'\n'); // Convert paragraph symbols back into newlines.
386
387 if (!text.empty())
388 { 382 {
389 // store sent line in history, duplicates will get filtered 383 LLWString text = mInputEditor->getConvertedText();
390 if (mInputEditor) mInputEditor->updateHistory(); 384 if (!text.empty())
391 // Check if this is destined for another channel
392 S32 channel = 0;
393 stripChannelNumber(text, &channel);
394
395 std::string utf8text = wstring_to_utf8str(text);
396 // Try to trigger a gesture, if not chat to a script.
397 std::string utf8_revised_text;
398 if (0 == channel)
399 {
400 // discard returned "found" boolean
401 gGestureManager.triggerAndReviseString(utf8text, &utf8_revised_text);
402 }
403 else
404 { 385 {
405 utf8_revised_text = utf8text; 386 // store sent line in history, duplicates will get filtered
406 } 387 if (mInputEditor) mInputEditor->updateHistory();
388 // Check if this is destined for another channel
389 S32 channel = 0;
390 stripChannelNumber(text, &channel);
391
392 std::string utf8text = wstring_to_utf8str(text);
393 // Try to trigger a gesture, if not chat to a script.
394 std::string utf8_revised_text;
395 if (0 == channel)
396 {
397 // discard returned "found" boolean
398 gGestureManager.triggerAndReviseString(utf8text, &utf8_revised_text);
399 }
400 else
401 {
402 utf8_revised_text = utf8text;
403 }
407 404
408 utf8_revised_text = utf8str_trim(utf8_revised_text); 405 utf8_revised_text = utf8str_trim(utf8_revised_text);
409 406
410 if (!utf8_revised_text.empty()) 407 if (!utf8_revised_text.empty())
411 { 408 {
412 // Chat with animation 409 // Chat with animation
413 sendChatFromViewer(utf8_revised_text, type, TRUE); 410 sendChatFromViewer(utf8_revised_text, type, TRUE);
411 }
414 } 412 }
415 } 413 }
416 childSetValue("Chat Editor", LLString::null); 414
415 childSetValue("Chat Editor", LLStringUtil::null);
417 416
418 gAgent.stopTyping(); 417 gAgent.stopTyping();
419 418
@@ -478,7 +477,7 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata )
478 477
479 // Can't trim the end, because that will cause autocompletion 478 // Can't trim the end, because that will cause autocompletion
480 // to eat trailing spaces that might be part of a gesture. 479 // to eat trailing spaces that might be part of a gesture.
481 LLWString::trimHead(raw_text); 480 LLWStringUtil::trimHead(raw_text);
482 481
483 S32 length = raw_text.length(); 482 S32 length = raw_text.length();
484 483
@@ -499,7 +498,7 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata )
499 { 498 {
500 // the selection will already be deleted, but we need to trim 499 // the selection will already be deleted, but we need to trim
501 // off the character before 500 // off the character before
502 LLString new_text = raw_text.substr(0, length-1); 501 std::string new_text = raw_text.substr(0, length-1);
503 self->mInputEditor->setText( new_text ); 502 self->mInputEditor->setText( new_text );
504 self->mInputEditor->setCursorToEnd(); 503 self->mInputEditor->setCursorToEnd();
505 length = length - 1; 504 length = length - 1;