aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterchatterbox.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:27 -0500
committerJacek Antonelli2008-08-15 23:45:27 -0500
commita8a62201ba762e98dff92cf49033e577fc34d8d4 (patch)
tree11f8513c5cdc222f2fac0c93eb724c089803c200 /linden/indra/newview/llfloaterchatterbox.cpp
parentSecond Life viewer sources 1.18.6.4-RC (diff)
downloadmeta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.zip
meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.gz
meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.bz2
meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.xz
Second Life viewer sources 1.19.0.0
Diffstat (limited to 'linden/indra/newview/llfloaterchatterbox.cpp')
-rw-r--r--linden/indra/newview/llfloaterchatterbox.cpp107
1 files changed, 80 insertions, 27 deletions
diff --git a/linden/indra/newview/llfloaterchatterbox.cpp b/linden/indra/newview/llfloaterchatterbox.cpp
index 41acc02..2d6eeb3 100644
--- a/linden/indra/newview/llfloaterchatterbox.cpp
+++ b/linden/indra/newview/llfloaterchatterbox.cpp
@@ -14,12 +14,12 @@
14 * ("GPL"), unless you have obtained a separate licensing agreement 14 * ("GPL"), unless you have obtained a separate licensing agreement
15 * ("Other License"), formally executed by you and Linden Lab. Terms of 15 * ("Other License"), formally executed by you and Linden Lab. Terms of
16 * the GPL can be found in doc/GPL-license.txt in this distribution, or 16 * the GPL can be found in doc/GPL-license.txt in this distribution, or
17 * online at http://secondlife.com/developers/opensource/gplv2 17 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
18 * 18 *
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlife.com/developers/opensource/flossexception 22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 23 *
24 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -86,9 +86,15 @@ LLFloaterMyFriends* LLFloaterMyFriends::showInstance(const LLSD& id)
86//static 86//static
87void LLFloaterMyFriends::hideInstance(const LLSD& id) 87void LLFloaterMyFriends::hideInstance(const LLSD& id)
88{ 88{
89 if(instanceVisible(id)) 89 LLFloaterMyFriends* floaterp = LLFloaterMyFriends::getInstance();
90
91 if(floaterp->getHost())
90 { 92 {
91 LLFloaterChatterBox::hideInstance(LLSD()); 93 LLFloaterChatterBox::hideInstance();
94 }
95 else
96 {
97 LLUISingleton<LLFloaterMyFriends>::hideInstance(id);
92 } 98 }
93} 99}
94 100
@@ -124,10 +130,23 @@ LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed) :
124 mAutoResize = FALSE; 130 mAutoResize = FALSE;
125 131
126 gUICtrlFactory->buildFloater(this, "floater_chatterbox.xml", NULL, FALSE); 132 gUICtrlFactory->buildFloater(this, "floater_chatterbox.xml", NULL, FALSE);
127 addFloater(LLFloaterMyFriends::getInstance(0), TRUE); 133 if (gSavedSettings.getBOOL("ContactsTornOff"))
134 {
135 LLFloaterMyFriends* floater_contacts = LLFloaterMyFriends::getInstance(0);
136 // add then remove to set up relationship for re-attach
137 addFloater(floater_contacts, FALSE);
138 removeFloater(floater_contacts);
139 // reparent to floater view
140 gFloaterView->addChild(floater_contacts);
141 }
142 else
143 {
144 addFloater(LLFloaterMyFriends::getInstance(0), TRUE);
145 }
146
128 if (gSavedSettings.getBOOL("ChatHistoryTornOff")) 147 if (gSavedSettings.getBOOL("ChatHistoryTornOff"))
129 { 148 {
130 LLFloaterChat* floater_chat = LLFloaterChat::getInstance(LLSD()); 149 LLFloaterChat* floater_chat = LLFloaterChat::getInstance();
131 // add then remove to set up relationship for re-attach 150 // add then remove to set up relationship for re-attach
132 addFloater(floater_chat, FALSE); 151 addFloater(floater_chat, FALSE);
133 removeFloater(floater_chat); 152 removeFloater(floater_chat);
@@ -217,7 +236,7 @@ void LLFloaterChatterBox::draw()
217 236
218 mActiveVoiceFloater = current_active_floater; 237 mActiveVoiceFloater = current_active_floater;
219 238
220 LLFloater::draw(); 239 LLMultiFloater::draw();
221} 240}
222 241
223void LLFloaterChatterBox::onOpen() 242void LLFloaterChatterBox::onOpen()
@@ -236,10 +255,17 @@ void LLFloaterChatterBox::removeFloater(LLFloater* floaterp)
236 if (floaterp->getName() == "chat floater") 255 if (floaterp->getName() == "chat floater")
237 { 256 {
238 // only my friends floater now locked 257 // only my friends floater now locked
239 mTabContainer->lockTabs(1); 258 mTabContainer->lockTabs(mTabContainer->getNumLockedTabs() - 1);
240 gSavedSettings.setBOOL("ChatHistoryTornOff", TRUE); 259 gSavedSettings.setBOOL("ChatHistoryTornOff", TRUE);
241 floaterp->setCanClose(TRUE); 260 floaterp->setCanClose(TRUE);
242 } 261 }
262 else if (floaterp->getName() == "floater_my_friends")
263 {
264 // only chat floater now locked
265 mTabContainer->lockTabs(mTabContainer->getNumLockedTabs() - 1);
266 gSavedSettings.setBOOL("ContactsTornOff", TRUE);
267 floaterp->setCanClose(TRUE);
268 }
243 LLMultiFloater::removeFloater(floaterp); 269 LLMultiFloater::removeFloater(floaterp);
244} 270}
245 271
@@ -247,19 +273,43 @@ void LLFloaterChatterBox::addFloater(LLFloater* floaterp,
247 BOOL select_added_floater, 273 BOOL select_added_floater,
248 LLTabContainerCommon::eInsertionPoint insertion_point) 274 LLTabContainerCommon::eInsertionPoint insertion_point)
249{ 275{
276 S32 num_locked_tabs = mTabContainer->getNumLockedTabs();
277
278 // already here
279 if (floaterp->getHost() == this) return;
280
250 // make sure my friends and chat history both locked when re-attaching chat history 281 // make sure my friends and chat history both locked when re-attaching chat history
251 if (floaterp->getName() == "chat floater") 282 if (floaterp->getName() == "chat floater")
252 { 283 {
253 // select my friends tab 284 mTabContainer->unlockTabs();
254 mTabContainer->selectFirstTab(); 285 // add chat history as second tab if contact window is present, first tab otherwise
255 // add chat history to the right of the my friends tab 286 if (getChildByName("floater_my_friends", TRUE))
256 //*TODO: respect select_added_floater so that we don't leave first tab selected 287 {
257 LLMultiFloater::addFloater(floaterp, select_added_floater, LLTabContainer::RIGHT_OF_CURRENT); 288 // assuming contacts window is first tab, select it
289 mTabContainer->selectFirstTab();
290 // and add ourselves after
291 LLMultiFloater::addFloater(floaterp, select_added_floater, LLTabContainer::RIGHT_OF_CURRENT);
292 }
293 else
294 {
295 LLMultiFloater::addFloater(floaterp, select_added_floater, LLTabContainer::START);
296 }
297
258 // make sure first two tabs are now locked 298 // make sure first two tabs are now locked
259 mTabContainer->lockTabs(2); 299 mTabContainer->lockTabs(num_locked_tabs + 1);
260 gSavedSettings.setBOOL("ChatHistoryTornOff", FALSE); 300 gSavedSettings.setBOOL("ChatHistoryTornOff", FALSE);
261 floaterp->setCanClose(FALSE); 301 floaterp->setCanClose(FALSE);
262 } 302 }
303 else if (floaterp->getName() == "floater_my_friends")
304 {
305 mTabContainer->unlockTabs();
306 // add contacts window as first tab
307 LLMultiFloater::addFloater(floaterp, select_added_floater, LLTabContainer::START);
308 // make sure first two tabs are now locked
309 mTabContainer->lockTabs(num_locked_tabs + 1);
310 gSavedSettings.setBOOL("ContactsTornOff", FALSE);
311 floaterp->setCanClose(FALSE);
312 }
263 else 313 else
264 { 314 {
265 LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point); 315 LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point);
@@ -276,24 +326,27 @@ void LLFloaterChatterBox::addFloater(LLFloater* floaterp,
276//static 326//static
277LLFloaterChatterBox* LLFloaterChatterBox::showInstance(const LLSD& seed) 327LLFloaterChatterBox* LLFloaterChatterBox::showInstance(const LLSD& seed)
278{ 328{
279 LLFloaterChatterBox* floater = LLUISingleton<LLFloaterChatterBox>::showInstance(seed); 329 LLFloaterChatterBox* chatterbox_floater = LLUISingleton<LLFloaterChatterBox>::showInstance(seed);
280 330
281 // if TRUE, show tab for active voice channel, otherwise, just show last tab 331 // if TRUE, show tab for active voice channel, otherwise, just show last tab
282 if (seed.asBoolean()) 332 LLFloater* floater_to_show = NULL;
333 LLUUID session_id = seed.asUUID();
334 if (session_id.notNull())
283 { 335 {
284 LLFloater* floater_to_show = getCurrentVoiceFloater(); 336 floater_to_show = gIMMgr->findFloaterBySession(session_id);
285 if (floater_to_show) 337 }
286 { 338
287 floater_to_show->open(); 339 if (floater_to_show)
288 } 340 {
289 else 341 floater_to_show->open();
290 { 342 }
291 // just open chatterbox if there is no active voice window 343 else
292 LLUISingleton<LLFloaterChatterBox>::getInstance(seed)->open(); 344 {
293 } 345 // just open chatterbox to the last selected tab
346 chatterbox_floater->open();
294 } 347 }
295 348
296 return floater; 349 return chatterbox_floater;
297} 350}
298 351
299//static 352//static