diff options
author | Dmitry Zaporozhan <dzaporozhan@productengine.com> | 2009-11-20 19:24:07 +0200 |
---|---|---|
committer | Dmitry Zaporozhan <dzaporozhan@productengine.com> | 2009-11-20 19:24:07 +0200 |
commit | d0c1593d85cd26ad822d31e21df7a1864d66541c (patch) | |
tree | 30ceb3cfc19ccb36b7bcc7f0e5a2ad3efdd38747 /indra/newview/llchiclet.cpp | |
parent | 9d64bf132e27739dedeca17a1d952655c6b52ac3 (diff) | |
parent | 0c468557b9e38ec4be201fa991499ed095a4d8c3 (diff) |
Merge
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llchiclet.cpp')
-rw-r--r-- | indra/newview/llchiclet.cpp | 115 |
1 files changed, 67 insertions, 48 deletions
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 15c4c5f95d..fd91da2de2 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -1,34 +1,34 @@ /** -* @file llchiclet.cpp -* @brief LLChiclet class implementation -* -* $LicenseInfo:firstyear=2002&license=viewergpl$ -* -* Copyright (c) 2002-2009, Linden Research, Inc. -* -* Second Life Viewer Source Code -* The source code in this file ("Source Code") is provided by Linden Lab -* to you under the terms of the GNU General Public License, version 2.0 -* ("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://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://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, -* and agree to abide by those obligations. -* -* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO -* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, -* COMPLETENESS OR PERFORMANCE. -* $/LicenseInfo$ -*/ + * @file llchiclet.cpp + * @brief LLChiclet class implementation + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("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://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://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, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ #include "llviewerprecompiledheaders.h" // must be first include #include "llchiclet.h" @@ -475,6 +475,10 @@ void LLIMP2PChiclet::onMenuItemClicked(const LLSD& user_data) { LLAvatarActions::requestFriendshipDialog(other_participant_id); } + else if("end" == level) + { + LLAvatarActions::endIM(other_participant_id); + } } ////////////////////////////////////////////////////////////////////////// @@ -769,12 +773,16 @@ void LLIMGroupChiclet::onMenuItemClicked(const LLSD& user_data) if("group chat" == level) { - LLGroupActions::startChat(group_id); + LLGroupActions::startIM(group_id); } else if("info" == level) { LLGroupActions::show(group_id); } + else if("end" == level) + { + LLGroupActions::endIM(group_id); + } } @@ -915,34 +923,45 @@ void LLChicletPanel::onCurrentVoiceChannelChanged(const LLUUID& session_id) s_previous_active_voice_session_id = session_id; } -S32 LLChicletPanel::calcChickletPanleWidth() -{ - S32 res = 0; - - for (chiclet_list_t::iterator it = mChicletList.begin(); it - != mChicletList.end(); it++) - { - res = (*it)->getRect().getWidth() + getChicletPadding(); - } - return res; -} - bool LLChicletPanel::addChiclet(LLChiclet* chiclet, S32 index) { if(mScrollArea->addChild(chiclet)) { - // chicklets should be aligned to right edge of scroll panel - S32 offset = 0; + // chiclets should be aligned to right edge of scroll panel + S32 left_shift = 0; if (!canScrollLeft()) { - offset = mScrollArea->getRect().getWidth() - - chiclet->getRect().getWidth() - calcChickletPanleWidth(); + // init left shift for the first chiclet in the list... + if (mChicletList.empty()) + { + // ...start from the right border of the scroll area for the first added chiclet + left_shift = mScrollArea->getRect().getWidth(); + } + else + { + // ... start from the left border of the first chiclet minus padding + left_shift = getChiclet(0)->getRect().mLeft - getChicletPadding(); + } + + // take into account width of the being added chiclet + left_shift -= chiclet->getRequiredRect().getWidth(); + + // if we overflow the scroll area we do not need to shift chiclets + if (left_shift < 0) + { + left_shift = 0; + } } mChicletList.insert(mChicletList.begin() + index, chiclet); - getChiclet(0)->translate(offset, 0); + // shift first chiclet to place it in correct position. + // rest ones will be placed in arrange() + if (!canScrollLeft()) + { + getChiclet(0)->translate(left_shift - getChiclet(0)->getRect().mLeft, 0); + } chiclet->setLeftButtonClickCallback(boost::bind(&LLChicletPanel::onChicletClick, this, _1, _2)); chiclet->setChicletSizeChangedCallback(boost::bind(&LLChicletPanel::onChicletSizeChanged, this, _1, index)); |