From a8a62201ba762e98dff92cf49033e577fc34d8d4 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:45:27 -0500 Subject: Second Life viewer sources 1.19.0.0 --- linden/indra/newview/llfloaterchatterbox.cpp | 107 ++++++++++++++++++++------- 1 file changed, 80 insertions(+), 27 deletions(-) (limited to 'linden/indra/newview/llfloaterchatterbox.cpp') 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 @@ * ("GPL"), unless you have obtained a separate licensing agreement * ("Other License"), formally executed by you and Linden Lab. Terms of * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -86,9 +86,15 @@ LLFloaterMyFriends* LLFloaterMyFriends::showInstance(const LLSD& id) //static void LLFloaterMyFriends::hideInstance(const LLSD& id) { - if(instanceVisible(id)) + LLFloaterMyFriends* floaterp = LLFloaterMyFriends::getInstance(); + + if(floaterp->getHost()) { - LLFloaterChatterBox::hideInstance(LLSD()); + LLFloaterChatterBox::hideInstance(); + } + else + { + LLUISingleton::hideInstance(id); } } @@ -124,10 +130,23 @@ LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed) : mAutoResize = FALSE; gUICtrlFactory->buildFloater(this, "floater_chatterbox.xml", NULL, FALSE); - addFloater(LLFloaterMyFriends::getInstance(0), TRUE); + if (gSavedSettings.getBOOL("ContactsTornOff")) + { + LLFloaterMyFriends* floater_contacts = LLFloaterMyFriends::getInstance(0); + // add then remove to set up relationship for re-attach + addFloater(floater_contacts, FALSE); + removeFloater(floater_contacts); + // reparent to floater view + gFloaterView->addChild(floater_contacts); + } + else + { + addFloater(LLFloaterMyFriends::getInstance(0), TRUE); + } + if (gSavedSettings.getBOOL("ChatHistoryTornOff")) { - LLFloaterChat* floater_chat = LLFloaterChat::getInstance(LLSD()); + LLFloaterChat* floater_chat = LLFloaterChat::getInstance(); // add then remove to set up relationship for re-attach addFloater(floater_chat, FALSE); removeFloater(floater_chat); @@ -217,7 +236,7 @@ void LLFloaterChatterBox::draw() mActiveVoiceFloater = current_active_floater; - LLFloater::draw(); + LLMultiFloater::draw(); } void LLFloaterChatterBox::onOpen() @@ -236,10 +255,17 @@ void LLFloaterChatterBox::removeFloater(LLFloater* floaterp) if (floaterp->getName() == "chat floater") { // only my friends floater now locked - mTabContainer->lockTabs(1); + mTabContainer->lockTabs(mTabContainer->getNumLockedTabs() - 1); gSavedSettings.setBOOL("ChatHistoryTornOff", TRUE); floaterp->setCanClose(TRUE); } + else if (floaterp->getName() == "floater_my_friends") + { + // only chat floater now locked + mTabContainer->lockTabs(mTabContainer->getNumLockedTabs() - 1); + gSavedSettings.setBOOL("ContactsTornOff", TRUE); + floaterp->setCanClose(TRUE); + } LLMultiFloater::removeFloater(floaterp); } @@ -247,19 +273,43 @@ void LLFloaterChatterBox::addFloater(LLFloater* floaterp, BOOL select_added_floater, LLTabContainerCommon::eInsertionPoint insertion_point) { + S32 num_locked_tabs = mTabContainer->getNumLockedTabs(); + + // already here + if (floaterp->getHost() == this) return; + // make sure my friends and chat history both locked when re-attaching chat history if (floaterp->getName() == "chat floater") { - // select my friends tab - mTabContainer->selectFirstTab(); - // add chat history to the right of the my friends tab - //*TODO: respect select_added_floater so that we don't leave first tab selected - LLMultiFloater::addFloater(floaterp, select_added_floater, LLTabContainer::RIGHT_OF_CURRENT); + mTabContainer->unlockTabs(); + // add chat history as second tab if contact window is present, first tab otherwise + if (getChildByName("floater_my_friends", TRUE)) + { + // assuming contacts window is first tab, select it + mTabContainer->selectFirstTab(); + // and add ourselves after + LLMultiFloater::addFloater(floaterp, select_added_floater, LLTabContainer::RIGHT_OF_CURRENT); + } + else + { + LLMultiFloater::addFloater(floaterp, select_added_floater, LLTabContainer::START); + } + // make sure first two tabs are now locked - mTabContainer->lockTabs(2); + mTabContainer->lockTabs(num_locked_tabs + 1); gSavedSettings.setBOOL("ChatHistoryTornOff", FALSE); floaterp->setCanClose(FALSE); } + else if (floaterp->getName() == "floater_my_friends") + { + mTabContainer->unlockTabs(); + // add contacts window as first tab + LLMultiFloater::addFloater(floaterp, select_added_floater, LLTabContainer::START); + // make sure first two tabs are now locked + mTabContainer->lockTabs(num_locked_tabs + 1); + gSavedSettings.setBOOL("ContactsTornOff", FALSE); + floaterp->setCanClose(FALSE); + } else { LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point); @@ -276,24 +326,27 @@ void LLFloaterChatterBox::addFloater(LLFloater* floaterp, //static LLFloaterChatterBox* LLFloaterChatterBox::showInstance(const LLSD& seed) { - LLFloaterChatterBox* floater = LLUISingleton::showInstance(seed); + LLFloaterChatterBox* chatterbox_floater = LLUISingleton::showInstance(seed); // if TRUE, show tab for active voice channel, otherwise, just show last tab - if (seed.asBoolean()) + LLFloater* floater_to_show = NULL; + LLUUID session_id = seed.asUUID(); + if (session_id.notNull()) { - LLFloater* floater_to_show = getCurrentVoiceFloater(); - if (floater_to_show) - { - floater_to_show->open(); - } - else - { - // just open chatterbox if there is no active voice window - LLUISingleton::getInstance(seed)->open(); - } + floater_to_show = gIMMgr->findFloaterBySession(session_id); + } + + if (floater_to_show) + { + floater_to_show->open(); + } + else + { + // just open chatterbox to the last selected tab + chatterbox_floater->open(); } - return floater; + return chatterbox_floater; } //static -- cgit v1.1