aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterchat.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llfloaterchat.cpp
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llfloaterchat.cpp70
1 files changed, 49 insertions, 21 deletions
diff --git a/linden/indra/newview/llfloaterchat.cpp b/linden/indra/newview/llfloaterchat.cpp
index f9063ce..0394cd1 100644
--- a/linden/indra/newview/llfloaterchat.cpp
+++ b/linden/indra/newview/llfloaterchat.cpp
@@ -66,7 +66,7 @@
66#include "llviewermessage.h" 66#include "llviewermessage.h"
67#include "llviewerwindow.h" 67#include "llviewerwindow.h"
68#include "llviewercontrol.h" 68#include "llviewercontrol.h"
69#include "llvieweruictrlfactory.h" 69#include "lluictrlfactory.h"
70#include "llchatbar.h" 70#include "llchatbar.h"
71#include "lllogchat.h" 71#include "lllogchat.h"
72#include "lltexteditor.h" 72#include "lltexteditor.h"
@@ -81,7 +81,6 @@ extern void AddNewChatToLCD(const LLString &newLine);
81// 81//
82const F32 INSTANT_MSG_SIZE = 8.0f; 82const F32 INSTANT_MSG_SIZE = 8.0f;
83const F32 CHAT_MSG_SIZE = 8.0f; 83const F32 CHAT_MSG_SIZE = 8.0f;
84const LLColor4 INSTANT_MSG_COLOR(1, 1, 1, 1);
85const LLColor4 MUTED_MSG_COLOR(0.5f, 0.5f, 0.5f, 1.f); 84const LLColor4 MUTED_MSG_COLOR(0.5f, 0.5f, 0.5f, 1.f);
86const S32 MAX_CHATTER_COUNT = 16; 85const S32 MAX_CHATTER_COUNT = 16;
87 86
@@ -102,7 +101,7 @@ LLFloaterChat::LLFloaterChat(const LLSD& seed)
102 mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, NULL); 101 mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, NULL);
103 // do not automatically open singleton floaters (as result of getInstance()) 102 // do not automatically open singleton floaters (as result of getInstance())
104 BOOL no_open = FALSE; 103 BOOL no_open = FALSE;
105 gUICtrlFactory->buildFloater(this,"floater_chat_history.xml",&getFactoryMap(),no_open); 104 LLUICtrlFactory::getInstance()->buildFloater(this,"floater_chat_history.xml",&getFactoryMap(),no_open);
106 105
107 childSetCommitCallback("show mutes",onClickToggleShowMute,this); //show mutes 106 childSetCommitCallback("show mutes",onClickToggleShowMute,this); //show mutes
108 childSetVisible("Chat History Editor with mute",FALSE); 107 childSetVisible("Chat History Editor with mute",FALSE);
@@ -140,12 +139,12 @@ void LLFloaterChat::draw()
140 139
141BOOL LLFloaterChat::postBuild() 140BOOL LLFloaterChat::postBuild()
142{ 141{
143 mPanel = (LLPanelActiveSpeakers*)LLUICtrlFactory::getPanelByName(this, "active_speakers_panel"); 142 mPanel = (LLPanelActiveSpeakers*)getChild<LLPanel>("active_speakers_panel");
144 143
145 LLChatBar* chat_barp = getChild<LLChatBar>("chat_panel", TRUE); 144 LLChatBar* chat_barp = getChild<LLChatBar>("chat_panel", TRUE);
146 if (chat_barp) 145 if (chat_barp)
147 { 146 {
148 chat_barp->setGestureCombo(LLUICtrlFactory::getComboBoxByName(this, "Gesture")); 147 chat_barp->setGestureCombo(getChild<LLComboBox>( "Gesture"));
149 } 148 }
150 return TRUE; 149 return TRUE;
151} 150}
@@ -163,7 +162,7 @@ void LLFloaterChat::onClose(bool app_quitting)
163void LLFloaterChat::onVisibilityChange(BOOL new_visibility) 162void LLFloaterChat::onVisibilityChange(BOOL new_visibility)
164{ 163{
165 // Hide the chat overlay when our history is visible. 164 // Hide the chat overlay when our history is visible.
166 gConsole->setVisible( !new_visibility ); 165 updateConsoleVisibility();
167 166
168 // stop chat history tab from flashing when it appears 167 // stop chat history tab from flashing when it appears
169 if (new_visibility) 168 if (new_visibility)
@@ -174,6 +173,21 @@ void LLFloaterChat::onVisibilityChange(BOOL new_visibility)
174 LLFloater::onVisibilityChange(new_visibility); 173 LLFloater::onVisibilityChange(new_visibility);
175} 174}
176 175
176void LLFloaterChat::setMinimized(BOOL minimized)
177{
178 LLFloater::setMinimized(minimized);
179 updateConsoleVisibility();
180}
181
182
183void LLFloaterChat::updateConsoleVisibility()
184{
185 // determine whether we should show console due to not being visible
186 gConsole->setVisible( !isInVisibleChain() // are we not in part of UI being drawn?
187 || isMinimized() // are we minimized?
188 || (getHost() && getHost()->isMinimized() )); // are we hosted in a minimized floater?
189}
190
177void add_timestamped_line(LLViewerTextEditor* edit, const LLString& line, const LLColor4& color) 191void add_timestamped_line(LLViewerTextEditor* edit, const LLString& line, const LLColor4& color)
178{ 192{
179 bool prepend_newline = true; 193 bool prepend_newline = true;
@@ -274,7 +288,7 @@ void LLFloaterChat::onClickMute(void *data)
274{ 288{
275 LLFloaterChat* self = (LLFloaterChat*)data; 289 LLFloaterChat* self = (LLFloaterChat*)data;
276 290
277 LLComboBox* chatter_combo = LLUICtrlFactory::getComboBoxByName(self,"chatter combobox"); 291 LLComboBox* chatter_combo = self->getChild<LLComboBox>("chatter combobox");
278 292
279 const LLString& name = chatter_combo->getSimple(); 293 const LLString& name = chatter_combo->getSimple();
280 LLUUID id = chatter_combo->getCurrentID(); 294 LLUUID id = chatter_combo->getCurrentID();
@@ -283,12 +297,9 @@ void LLFloaterChat::onClickMute(void *data)
283 297
284 LLMute mute(id); 298 LLMute mute(id);
285 mute.setFromDisplayName(name); 299 mute.setFromDisplayName(name);
286 gMuteListp->add(mute); 300 LLMuteList::getInstance()->add(mute);
287 301
288 if (gFloaterMute) 302 LLFloaterMute::showInstance();
289 {
290 LLFloaterMute::showInstance();
291 }
292} 303}
293 304
294//static 305//static
@@ -298,7 +309,7 @@ void LLFloaterChat::onClickToggleShowMute(LLUICtrl* caller, void *data)
298 309
299 310
300 //LLCheckBoxCtrl* 311 //LLCheckBoxCtrl*
301 BOOL show_mute = LLUICtrlFactory::getCheckBoxByName(floater,"show mutes")->get(); 312 BOOL show_mute = floater->getChild<LLCheckBoxCtrl>("show mutes")->get();
302 LLViewerTextEditor* history_editor = floater->getChild<LLViewerTextEditor>("Chat History Editor"); 313 LLViewerTextEditor* history_editor = floater->getChild<LLViewerTextEditor>("Chat History Editor");
303 LLViewerTextEditor* history_editor_with_mute = floater->getChild<LLViewerTextEditor>("Chat History Editor with mute"); 314 LLViewerTextEditor* history_editor_with_mute = floater->getChild<LLViewerTextEditor>("Chat History Editor with mute");
304 315
@@ -351,9 +362,13 @@ void LLFloaterChat::addChat(const LLChat& chat,
351 && !local_agent) 362 && !local_agent)
352 { 363 {
353 F32 size = CHAT_MSG_SIZE; 364 F32 size = CHAT_MSG_SIZE;
354 if(from_instant_message) 365 if (chat.mSourceType == CHAT_SOURCE_SYSTEM)
366 {
367 text_color = gSavedSettings.getColor("SystemChatColor");
368 }
369 else if(from_instant_message)
355 { 370 {
356 text_color = INSTANT_MSG_COLOR; 371 text_color = gSavedSettings.getColor("IMChatColor");
357 size = INSTANT_MSG_SIZE; 372 size = INSTANT_MSG_SIZE;
358 } 373 }
359 gConsole->addLine(chat.mText, size, text_color); 374 gConsole->addLine(chat.mText, size, text_color);
@@ -434,18 +449,31 @@ void LLFloaterChat::loadHistory()
434} 449}
435 450
436//static 451//static
437void LLFloaterChat::chatFromLogFile(LLString line, void* userdata) 452void LLFloaterChat::chatFromLogFile(LLLogChat::ELogLineType type , LLString line, void* userdata)
438{ 453{
439 LLChat chat; 454 switch (type)
440 455 {
441 chat.mText = line; 456 case LLLogChat::LOG_EMPTY:
442 addChatHistory(chat, FALSE); 457 case LLLogChat::LOG_END:
458 // *TODO: nice message from XML file here
459 break;
460 case LLLogChat::LOG_LINE:
461 {
462 LLChat chat;
463 chat.mText = line;
464 addChatHistory(chat, FALSE);
465 }
466 break;
467 default:
468 // nothing
469 break;
470 }
443} 471}
444 472
445//static 473//static
446void* LLFloaterChat::createSpeakersPanel(void* data) 474void* LLFloaterChat::createSpeakersPanel(void* data)
447{ 475{
448 return new LLPanelActiveSpeakers(gLocalSpeakerMgr, TRUE); 476 return new LLPanelActiveSpeakers(LLLocalSpeakerMgr::getInstance(), TRUE);
449} 477}
450 478
451//static 479//static