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.cpp43
1 files changed, 39 insertions, 4 deletions
diff --git a/linden/indra/newview/llchatbar.cpp b/linden/indra/newview/llchatbar.cpp
index eb1da05..1b1284d 100644
--- a/linden/indra/newview/llchatbar.cpp
+++ b/linden/indra/newview/llchatbar.cpp
@@ -53,6 +53,7 @@
53#include "llkeyboard.h" 53#include "llkeyboard.h"
54#include "lllineeditor.h" 54#include "lllineeditor.h"
55#include "llstatusbar.h" 55#include "llstatusbar.h"
56#include "llspinctrl.h"
56#include "lltextbox.h" 57#include "lltextbox.h"
57#include "lluiconstants.h" 58#include "lluiconstants.h"
58#include "llviewergesture.h" // for triggering gestures 59#include "llviewergesture.h" // for triggering gestures
@@ -101,6 +102,7 @@ private:
101 102
102LLChatBar::LLChatBar() 103LLChatBar::LLChatBar()
103: LLPanel(LLStringUtil::null, LLRect(), BORDER_NO), 104: LLPanel(LLStringUtil::null, LLRect(), BORDER_NO),
105 mChannelControl(FALSE),
104 mInputEditor(NULL), 106 mInputEditor(NULL),
105 mGestureLabelTimer(), 107 mGestureLabelTimer(),
106 mLastSpecialChatChannel(0), 108 mLastSpecialChatChannel(0),
@@ -154,6 +156,8 @@ BOOL LLChatBar::postBuild()
154 mInputEditor->setEnableLineHistory(TRUE); 156 mInputEditor->setEnableLineHistory(TRUE);
155 } 157 }
156 158
159 toggleChannelControl();
160
157 mIsBuilt = TRUE; 161 mIsBuilt = TRUE;
158 162
159 return TRUE; 163 return TRUE;
@@ -213,6 +217,7 @@ void LLChatBar::refresh()
213 217
214 childSetValue("History", LLFloaterChat::instanceVisible(LLSD())); 218 childSetValue("History", LLFloaterChat::instanceVisible(LLSD()));
215 219
220 childSetValue("channel_control",( 1.f * ((S32)(getChild<LLSpinCtrl>("channel_control")->get()))) );
216 childSetEnabled("Say", mInputEditor->getText().size() > 0); 221 childSetEnabled("Say", mInputEditor->getText().size() > 0);
217 childSetEnabled("Shout", mInputEditor->getText().size() > 0); 222 childSetEnabled("Shout", mInputEditor->getText().size() > 0);
218 223
@@ -373,8 +378,11 @@ LLWString LLChatBar::stripChannelNumber(const LLWString &mesg, S32* channel)
373 } 378 }
374 else 379 else
375 { 380 {
376 // This is normal chat. 381 if (!mChannelControl)
377 *channel = 0; 382 {
383 // This is normal chat.
384 *channel = 0;
385 }
378 return mesg; 386 return mesg;
379 } 387 }
380} 388}
@@ -390,7 +398,8 @@ void LLChatBar::sendChat( EChatType type )
390 // store sent line in history, duplicates will get filtered 398 // store sent line in history, duplicates will get filtered
391 if (mInputEditor) mInputEditor->updateHistory(); 399 if (mInputEditor) mInputEditor->updateHistory();
392 // Check if this is destined for another channel 400 // Check if this is destined for another channel
393 S32 channel = 0; 401 S32 channel = mChannelControl ? (S32)(getChild<LLSpinCtrl>("channel_control")->get()) : 0;
402
394 stripChannelNumber(text, &channel); 403 stripChannelNumber(text, &channel);
395 404
396 std::string utf8text = wstring_to_utf8str(text); 405 std::string utf8text = wstring_to_utf8str(text);
@@ -428,6 +437,31 @@ void LLChatBar::sendChat( EChatType type )
428 } 437 }
429} 438}
430 439
440void LLChatBar::toggleChannelControl()
441{
442 LLRect input_rect = mInputEditor->getRect();
443 S32 chan_width = getChild<LLSpinCtrl>("channel_control")->getRect().getWidth();
444 BOOL visible = gSavedSettings.getBOOL("ChatChannelSelect");
445 BOOL control = getChild<LLSpinCtrl>("channel_control")->getVisible();
446
447 if (visible && !control)
448 {
449 input_rect.setLeftTopAndSize(input_rect.mLeft+chan_width, input_rect.mTop,
450 input_rect.getWidth()-chan_width, input_rect.getHeight());
451 }
452 else if (!visible && control)
453 {
454 input_rect.setLeftTopAndSize(input_rect.mLeft-chan_width, input_rect.mTop,
455 input_rect.getWidth()+chan_width, input_rect.getHeight());
456
457 }
458 mInputEditor->setRect(input_rect);
459
460 childSetVisible("channel_control", visible);
461 childSetEnabled("channel_control", visible);
462 mChannelControl = visible;
463}
464
431 465
432//----------------------------------------------------------------------- 466//-----------------------------------------------------------------------
433// Static functions 467// Static functions
@@ -581,7 +615,8 @@ void LLChatBar::sendChatFromViewer(const std::string &utf8text, EChatType type,
581void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate) 615void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate)
582{ 616{
583 // Look for "/20 foo" channel chats. 617 // Look for "/20 foo" channel chats.
584 S32 channel = 0; 618 S32 channel = mChannelControl ? (S32)(getChild<LLSpinCtrl>("channel_control")->get()) : 0;
619 //S32 channel = (S32)(getChild<LLSpinCtrl>("ChatChannel")->get());
585 LLWString out_text = stripChannelNumber(wtext, &channel); 620 LLWString out_text = stripChannelNumber(wtext, &channel);
586 std::string utf8_out_text = wstring_to_utf8str(out_text); 621 std::string utf8_out_text = wstring_to_utf8str(out_text);
587 std::string utf8_text = wstring_to_utf8str(wtext); 622 std::string utf8_text = wstring_to_utf8str(wtext);