From ef292e6a8b19160de7cf91d07f48daa68a56453e Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 19 Nov 2009 15:19:49 +0200 Subject: Fixed major bug EXT-2620 (IM Chiclet Panel goes crazy when new IM chiclets are added (chiclet scrolling appears with no need)) - refactored algotithm of caclulating position of the first chiclet in the list when adding new one. - added comments for LLChicketPanel::addChiclet() & LLChicketPanel::arrange() methods --HG-- branch : product-engine --- indra/newview/llchiclet.cpp | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) (limited to 'indra/newview/llchiclet.cpp') diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index caf6917d90..e27afc31e6 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -914,34 +914,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)); -- cgit v1.2.3 From e40c3d247f9bc909de4f41d24c2b1e3288ec9540 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 19 Nov 2009 16:03:25 +0200 Subject: No ticket. Updated comments to conform to the doxygen style --HG-- branch : product-engine --- indra/newview/llchiclet.cpp | 60 ++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'indra/newview/llchiclet.cpp') diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index e27afc31e6..cdc8eb26ed 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" -- cgit v1.2.3 From 13a6077b780117be0fa3a054426d139ca1d35df9 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Fri, 20 Nov 2009 19:17:38 +0200 Subject: Implemented normal task EXT-2081 - Object IM chiclets art needs to be hooked up to LLDialog chiclets. Implemented LLDialog(LLScriptFloater) and Script Chiclets. --HG-- branch : product-engine --- indra/newview/llchiclet.cpp | 56 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'indra/newview/llchiclet.cpp') diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index caf6917d90..15c4c5f95d 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -43,6 +43,7 @@ #include "lllocalcliprect.h" #include "llmenugl.h" #include "lloutputmonitorctrl.h" +#include "llscriptfloater.h" #include "lltextbox.h" #include "llvoiceclient.h" #include "llvoicecontrolpanel.h" @@ -1392,3 +1393,58 @@ LLChicletSpeakerCtrl::LLChicletSpeakerCtrl(const Params&p) : LLOutputMonitorCtrl(p) { } + +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + +LLScriptChiclet::Params::Params() + : avatar_icon("avatar_icon") +{ + // *TODO Vadim: Get rid of hardcoded values. + rect(CHICLET_RECT); + name("dialog_chiclet"); + + avatar_icon.name("avatar_icon"); + avatar_icon.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP | FOLLOWS_BOTTOM); + + avatar_icon.rect(CHICLET_ICON_RECT); + avatar_icon.mouse_opaque(false); +} + +LLScriptChiclet::LLScriptChiclet(const Params&p) + : LLIMChiclet(p) + , mChicletIconCtrl(NULL) +{ + mImage = LLUI::getUIImage("Generic_Object_Small"); +} + +void LLScriptChiclet::setSessionId(const LLUUID& session_id) +{ + setShowNewMessagesIcon( getSessionId() != session_id ); + + LLIMChiclet::setSessionId(session_id); + LLNotificationPtr notification = LLNotifications::getInstance()->find( + LLScriptFloaterManager::getInstance()->getNotificationId(session_id)); + if(notification) + { + setToolTip(notification->getSubstitutions()["TITLE"].asString()); + } +} + +void LLScriptChiclet::draw() +{ + mImage->draw(getLocalRect()); + LLIMChiclet::draw(); +} + +void LLScriptChiclet::onMouseDown() +{ + LLScriptFloaterManager::getInstance()->toggleScriptFloater(getSessionId()); +} + +BOOL LLScriptChiclet::handleMouseDown(S32 x, S32 y, MASK mask) +{ + onMouseDown(); + return LLChiclet::handleMouseDown(x, y, mask); +} -- cgit v1.2.3 From 9f0dbcf4c0c6c8621c377fd7f9e417aa76acd836 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Mon, 23 Nov 2009 15:50:49 +0200 Subject: Update for task EXT-2081 - Object IM chiclets art needs to be hooked up to LLDialog chiclets. Cleaned code, added comments. --HG-- branch : product-engine --- indra/newview/llchiclet.cpp | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'indra/newview/llchiclet.cpp') diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index fd91da2de2..433f70700c 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -56,6 +56,7 @@ static LLDefaultChildRegistry::Register t2("chiclet_notif static LLDefaultChildRegistry::Register t3("chiclet_im_p2p"); static LLDefaultChildRegistry::Register t4("chiclet_im_group"); static LLDefaultChildRegistry::Register t5("chiclet_im_adhoc"); +static LLDefaultChildRegistry::Register t6("chiclet_script"); static const LLRect CHICLET_RECT(0, 25, 25, 0); static const LLRect CHICLET_ICON_RECT(0, 22, 22, 0); @@ -1418,24 +1419,21 @@ LLChicletSpeakerCtrl::LLChicletSpeakerCtrl(const Params&p) ////////////////////////////////////////////////////////////////////////// LLScriptChiclet::Params::Params() - : avatar_icon("avatar_icon") + : icon("icon") { // *TODO Vadim: Get rid of hardcoded values. - rect(CHICLET_RECT); - name("dialog_chiclet"); - - avatar_icon.name("avatar_icon"); - avatar_icon.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP | FOLLOWS_BOTTOM); - - avatar_icon.rect(CHICLET_ICON_RECT); - avatar_icon.mouse_opaque(false); + rect(CHICLET_RECT); + icon.rect(CHICLET_ICON_RECT); } LLScriptChiclet::LLScriptChiclet(const Params&p) : LLIMChiclet(p) , mChicletIconCtrl(NULL) { - mImage = LLUI::getUIImage("Generic_Object_Small"); + LLIconCtrl::Params icon_params = p.icon; + mChicletIconCtrl = LLUICtrlFactory::create(icon_params); + // Let "new message" icon be on top, else it will be hidden behind chiclet icon. + addChildInBack(mChicletIconCtrl); } void LLScriptChiclet::setSessionId(const LLUUID& session_id) @@ -1443,20 +1441,14 @@ void LLScriptChiclet::setSessionId(const LLUUID& session_id) setShowNewMessagesIcon( getSessionId() != session_id ); LLIMChiclet::setSessionId(session_id); - LLNotificationPtr notification = LLNotifications::getInstance()->find( - LLScriptFloaterManager::getInstance()->getNotificationId(session_id)); + LLUUID notification_id = LLScriptFloaterManager::getInstance()->findNotificationId(session_id); + LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id); if(notification) { setToolTip(notification->getSubstitutions()["TITLE"].asString()); } } -void LLScriptChiclet::draw() -{ - mImage->draw(getLocalRect()); - LLIMChiclet::draw(); -} - void LLScriptChiclet::onMouseDown() { LLScriptFloaterManager::getInstance()->toggleScriptFloater(getSessionId()); @@ -1467,3 +1459,5 @@ BOOL LLScriptChiclet::handleMouseDown(S32 x, S32 y, MASK mask) onMouseDown(); return LLChiclet::handleMouseDown(x, y, mask); } + +// EOF -- cgit v1.2.3