diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llchatbar.cpp | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/linden/indra/newview/llchatbar.cpp b/linden/indra/newview/llchatbar.cpp index 59aa572..0178420 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 |
@@ -98,6 +99,7 @@ private: | |||
98 | 99 | ||
99 | LLChatBar::LLChatBar() | 100 | LLChatBar::LLChatBar() |
100 | : LLPanel(LLStringUtil::null, LLRect(), BORDER_NO), | 101 | : LLPanel(LLStringUtil::null, LLRect(), BORDER_NO), |
102 | mChannelControl(FALSE), | ||
101 | mInputEditor(NULL), | 103 | mInputEditor(NULL), |
102 | mGestureLabelTimer(), | 104 | mGestureLabelTimer(), |
103 | mLastSpecialChatChannel(0), | 105 | mLastSpecialChatChannel(0), |
@@ -151,6 +153,8 @@ BOOL LLChatBar::postBuild() | |||
151 | mInputEditor->setEnableLineHistory(TRUE); | 153 | mInputEditor->setEnableLineHistory(TRUE); |
152 | } | 154 | } |
153 | 155 | ||
156 | toggleChannelControl(); | ||
157 | |||
154 | mIsBuilt = TRUE; | 158 | mIsBuilt = TRUE; |
155 | 159 | ||
156 | return TRUE; | 160 | return TRUE; |
@@ -210,6 +214,7 @@ void LLChatBar::refresh() | |||
210 | 214 | ||
211 | childSetValue("History", LLFloaterChat::instanceVisible(LLSD())); | 215 | childSetValue("History", LLFloaterChat::instanceVisible(LLSD())); |
212 | 216 | ||
217 | childSetValue("channel_control",( 1.f * ((S32)(getChild<LLSpinCtrl>("channel_control")->get()))) ); | ||
213 | childSetEnabled("Say", mInputEditor->getText().size() > 0); | 218 | childSetEnabled("Say", mInputEditor->getText().size() > 0); |
214 | childSetEnabled("Shout", mInputEditor->getText().size() > 0); | 219 | childSetEnabled("Shout", mInputEditor->getText().size() > 0); |
215 | 220 | ||
@@ -370,8 +375,11 @@ LLWString LLChatBar::stripChannelNumber(const LLWString &mesg, S32* channel) | |||
370 | } | 375 | } |
371 | else | 376 | else |
372 | { | 377 | { |
373 | // This is normal chat. | 378 | if (!mChannelControl) |
374 | *channel = 0; | 379 | { |
380 | // This is normal chat. | ||
381 | *channel = 0; | ||
382 | } | ||
375 | return mesg; | 383 | return mesg; |
376 | } | 384 | } |
377 | } | 385 | } |
@@ -387,7 +395,8 @@ void LLChatBar::sendChat( EChatType type ) | |||
387 | // store sent line in history, duplicates will get filtered | 395 | // store sent line in history, duplicates will get filtered |
388 | if (mInputEditor) mInputEditor->updateHistory(); | 396 | if (mInputEditor) mInputEditor->updateHistory(); |
389 | // Check if this is destined for another channel | 397 | // Check if this is destined for another channel |
390 | S32 channel = 0; | 398 | S32 channel = mChannelControl ? (S32)(getChild<LLSpinCtrl>("channel_control")->get()) : 0; |
399 | |||
391 | stripChannelNumber(text, &channel); | 400 | stripChannelNumber(text, &channel); |
392 | 401 | ||
393 | std::string utf8text = wstring_to_utf8str(text); | 402 | std::string utf8text = wstring_to_utf8str(text); |
@@ -425,6 +434,31 @@ void LLChatBar::sendChat( EChatType type ) | |||
425 | } | 434 | } |
426 | } | 435 | } |
427 | 436 | ||
437 | void LLChatBar::toggleChannelControl() | ||
438 | { | ||
439 | LLRect input_rect = mInputEditor->getRect(); | ||
440 | S32 chan_width = getChild<LLSpinCtrl>("channel_control")->getRect().getWidth(); | ||
441 | BOOL visible = gSavedSettings.getBOOL("ChatChannelSelect"); | ||
442 | BOOL control = getChild<LLSpinCtrl>("channel_control")->getVisible(); | ||
443 | |||
444 | if (visible && !control) | ||
445 | { | ||
446 | input_rect.setLeftTopAndSize(input_rect.mLeft+chan_width, input_rect.mTop, | ||
447 | input_rect.getWidth()-chan_width, input_rect.getHeight()); | ||
448 | } | ||
449 | else if (!visible && control) | ||
450 | { | ||
451 | input_rect.setLeftTopAndSize(input_rect.mLeft-chan_width, input_rect.mTop, | ||
452 | input_rect.getWidth()+chan_width, input_rect.getHeight()); | ||
453 | |||
454 | } | ||
455 | mInputEditor->setRect(input_rect); | ||
456 | |||
457 | childSetVisible("channel_control", visible); | ||
458 | childSetEnabled("channel_control", visible); | ||
459 | mChannelControl = visible; | ||
460 | } | ||
461 | |||
428 | 462 | ||
429 | //----------------------------------------------------------------------- | 463 | //----------------------------------------------------------------------- |
430 | // Static functions | 464 | // Static functions |
@@ -575,7 +609,8 @@ void LLChatBar::sendChatFromViewer(const std::string &utf8text, EChatType type, | |||
575 | void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate) | 609 | void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate) |
576 | { | 610 | { |
577 | // Look for "/20 foo" channel chats. | 611 | // Look for "/20 foo" channel chats. |
578 | S32 channel = 0; | 612 | S32 channel = mChannelControl ? (S32)(getChild<LLSpinCtrl>("channel_control")->get()) : 0; |
613 | //S32 channel = (S32)(getChild<LLSpinCtrl>("ChatChannel")->get()); | ||
579 | LLWString out_text = stripChannelNumber(wtext, &channel); | 614 | LLWString out_text = stripChannelNumber(wtext, &channel); |
580 | std::string utf8_out_text = wstring_to_utf8str(out_text); | 615 | std::string utf8_out_text = wstring_to_utf8str(out_text); |
581 | std::string utf8_text = wstring_to_utf8str(wtext); | 616 | std::string utf8_text = wstring_to_utf8str(wtext); |