From 862ca3fa1628b0cef2e3db22f6c917a85492216f Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Tue, 19 Jan 2010 12:42:33 +0200 Subject: Fixed major bug EXT-4206 - Bottom bar spec calls for button background art on IM Chiclets. --HG-- branch : product-engine --- indra/newview/llchiclet.cpp | 57 ++++++++++++++++++++++ indra/newview/llchiclet.h | 19 +++++++- indra/newview/llimfloater.cpp | 13 +++++ indra/newview/llscriptfloater.cpp | 26 ++++++++++ indra/newview/llscriptfloater.h | 4 ++ .../default/xui/en/widgets/chiclet_im_adhoc.xml | 13 ++++- .../default/xui/en/widgets/chiclet_im_group.xml | 16 ++++-- .../default/xui/en/widgets/chiclet_im_p2p.xml | 15 ++++-- .../skins/default/xui/en/widgets/chiclet_offer.xml | 14 ++++-- .../default/xui/en/widgets/chiclet_script.xml | 14 ++++-- 10 files changed, 175 insertions(+), 16 deletions(-) diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 5cbe6f9670..f21fbbe6f5 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -453,6 +453,7 @@ LLIMChiclet::LLIMChiclet(const LLIMChiclet::Params& p) , mNewMessagesIcon(NULL) , mSpeakerCtrl(NULL) , mCounterCtrl(NULL) +, mChicletButton(NULL) { enableCounterControl(p.enable_counter); } @@ -576,6 +577,11 @@ void LLIMChiclet::onMouseDown() setCounter(0); } +void LLIMChiclet::setToggleState(bool toggle) +{ + mChicletButton->setToggleState(toggle); +} + BOOL LLIMChiclet::handleMouseDown(S32 x, S32 y, MASK mask) { onMouseDown(); @@ -634,6 +640,7 @@ LLIMChiclet::EType LLIMChiclet::getIMSessionType(const LLUUID& session_id) LLIMP2PChiclet::Params::Params() : avatar_icon("avatar_icon") +, chiclet_button("chiclet_button") , unread_notifications("unread_notifications") , speaker("speaker") , new_message_icon("new_message_icon") @@ -646,6 +653,10 @@ LLIMP2PChiclet::LLIMP2PChiclet(const Params& p) , mChicletIconCtrl(NULL) , mPopupMenu(NULL) { + LLButton::Params button_params = p.chiclet_button; + mChicletButton = LLUICtrlFactory::create(button_params); + addChild(mChicletButton); + LLIconCtrl::Params new_msg_params = p.new_message_icon; mNewMessagesIcon = LLUICtrlFactory::create(new_msg_params); addChild(mNewMessagesIcon); @@ -760,6 +771,7 @@ void LLIMP2PChiclet::onMenuItemClicked(const LLSD& user_data) LLAdHocChiclet::Params::Params() : avatar_icon("avatar_icon") +, chiclet_button("chiclet_button") , unread_notifications("unread_notifications") , speaker("speaker") , new_message_icon("new_message_icon") @@ -773,6 +785,10 @@ LLAdHocChiclet::LLAdHocChiclet(const Params& p) , mChicletIconCtrl(NULL) , mPopupMenu(NULL) { + LLButton::Params button_params = p.chiclet_button; + mChicletButton = LLUICtrlFactory::create(button_params); + addChild(mChicletButton); + LLIconCtrl::Params new_msg_params = p.new_message_icon; mNewMessagesIcon = LLUICtrlFactory::create(new_msg_params); addChild(mNewMessagesIcon); @@ -887,6 +903,7 @@ BOOL LLAdHocChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) LLIMGroupChiclet::Params::Params() : group_icon("group_icon") +, chiclet_button("chiclet_button") , unread_notifications("unread_notifications") , speaker("speaker") , new_message_icon("new_message_icon") @@ -900,6 +917,10 @@ LLIMGroupChiclet::LLIMGroupChiclet(const Params& p) , mChicletIconCtrl(NULL) , mPopupMenu(NULL) { + LLButton::Params button_params = p.chiclet_button; + mChicletButton = LLUICtrlFactory::create(button_params); + addChild(mChicletButton); + LLIconCtrl::Params new_msg_params = p.new_message_icon; mNewMessagesIcon = LLUICtrlFactory::create(new_msg_params); addChild(mNewMessagesIcon); @@ -1414,6 +1435,32 @@ S32 LLChicletPanel::notifyParent(const LLSD& info) return LLPanel::notifyParent(info); } +void LLChicletPanel::setChicletToggleState(const LLUUID& session_id, bool toggle) +{ + if(session_id.isNull()) + { + llwarns << "Null Session ID" << llendl; + } + + // toggle off all chiclets, except specified + S32 size = getChicletCount(); + for(int n = 0; n < size; ++n) + { + LLIMChiclet* chiclet = getChiclet(n); + if(chiclet && chiclet->getSessionId() != session_id) + { + chiclet->setToggleState(false); + } + } + + // toggle specified chiclet + LLIMChiclet* chiclet = findChiclet(session_id); + if(chiclet) + { + chiclet->setToggleState(toggle); + } +} + void LLChicletPanel::arrange() { if(mChicletList.empty()) @@ -1806,6 +1853,7 @@ LLChicletSpeakerCtrl::LLChicletSpeakerCtrl(const Params&p) LLScriptChiclet::Params::Params() : icon("icon") + , chiclet_button("chiclet_button") , new_message_icon("new_message_icon") { } @@ -1814,6 +1862,10 @@ LLScriptChiclet::LLScriptChiclet(const Params&p) : LLIMChiclet(p) , mChicletIconCtrl(NULL) { + LLButton::Params button_params = p.chiclet_button; + mChicletButton = LLUICtrlFactory::create(button_params); + addChild(mChicletButton); + LLIconCtrl::Params new_msg_params = p.new_message_icon; mNewMessagesIcon = LLUICtrlFactory::create(new_msg_params); addChild(mNewMessagesIcon); @@ -1862,6 +1914,7 @@ static const std::string INVENTORY_USER_OFFER ("UserGiveItem"); LLInvOfferChiclet::Params::Params() : icon("icon") + , chiclet_button("chiclet_button") , new_message_icon("new_message_icon") { } @@ -1870,6 +1923,10 @@ LLInvOfferChiclet::LLInvOfferChiclet(const Params&p) : LLIMChiclet(p) , mChicletIconCtrl(NULL) { + LLButton::Params button_params = p.chiclet_button; + mChicletButton = LLUICtrlFactory::create(button_params); + addChild(mChicletButton); + LLIconCtrl::Params new_msg_params = p.new_message_icon; mNewMessagesIcon = LLUICtrlFactory::create(new_msg_params); addChild(mNewMessagesIcon); diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index 3665e4d093..ae5b2148db 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -422,6 +422,8 @@ public: */ virtual void onMouseDown(); + virtual void setToggleState(bool toggle); + protected: LLIMChiclet(const LLIMChiclet::Params& p); @@ -438,7 +440,7 @@ protected: LLIconCtrl* mNewMessagesIcon; LLChicletNotificationCounterCtrl* mCounterCtrl; LLChicletSpeakerCtrl* mSpeakerCtrl; - + LLButton* mChicletButton; /** the id of another participant, either an avatar id or a group id*/ LLUUID mOtherParticipantId; @@ -473,6 +475,8 @@ class LLIMP2PChiclet : public LLIMChiclet public: struct Params : public LLInitParam::Block { + Optional chiclet_button; + Optional avatar_icon; Optional unread_notifications; @@ -538,6 +542,8 @@ class LLAdHocChiclet : public LLIMChiclet public: struct Params : public LLInitParam::Block { + Optional chiclet_button; + Optional avatar_icon; Optional unread_notifications; @@ -614,6 +620,8 @@ public: struct Params : public LLInitParam::Block { + Optional chiclet_button; + Optional icon; Optional new_message_icon; @@ -656,6 +664,8 @@ public: struct Params : public LLInitParam::Block { + Optional chiclet_button; + Optional icon; Optional new_message_icon; @@ -697,6 +707,8 @@ public: struct Params : public LLInitParam::Block { + Optional chiclet_button; + Optional group_icon; Optional unread_notifications; @@ -1040,6 +1052,11 @@ public: S32 notifyParent(const LLSD& info); + /** + * Toggle chiclet by session id ON and toggle OFF all other chiclets. + */ + void setChicletToggleState(const LLUUID& session_id, bool toggle); + protected: LLChicletPanel(const Params&p); friend class LLUICtrlFactory; diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index aee34eb0af..eb3f1b1d10 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -115,6 +115,8 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) void LLIMFloater::onFocusLost() { LLIMModel::getInstance()->resetActiveSessionID(); + + LLBottomTray::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, false); } void LLIMFloater::onFocusReceived() @@ -126,6 +128,8 @@ void LLIMFloater::onFocusReceived() { mInputEditor->setFocus(TRUE); } + + LLBottomTray::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, true); } // virtual @@ -490,6 +494,15 @@ void LLIMFloater::setVisible(BOOL visible) updateMessages(); mInputEditor->setFocus(TRUE); } + + if(!visible) + { + LLIMChiclet* chiclet = LLBottomTray::getInstance()->getChicletPanel()->findChiclet(mSessionID); + if(chiclet) + { + chiclet->setToggleState(false); + } + } } //static diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp index cf62d47362..0d9cf06bc3 100644 --- a/indra/newview/llscriptfloater.cpp +++ b/indra/newview/llscriptfloater.cpp @@ -72,6 +72,9 @@ LLScriptFloater::LLScriptFloater(const LLSD& key) bool LLScriptFloater::toggle(const LLUUID& object_id) { + // Force chiclet toggle on here because first onFocusReceived() will not toggle it on. + LLBottomTray::getInstance()->getChicletPanel()->setChicletToggleState(object_id, true); + LLUUID notification_id = LLScriptFloaterManager::getInstance()->findNotificationId(object_id); LLScriptFloater* floater = LLFloaterReg::findTypedInstance("script_floater", notification_id); @@ -180,6 +183,15 @@ void LLScriptFloater::setVisible(BOOL visible) LLDockableFloater::setVisible(visible); hideToastsIfNeeded(); + + if(!visible) + { + LLIMChiclet* chiclet = LLBottomTray::getInstance()->getChicletPanel()->findChiclet(getObjectId()); + if(chiclet) + { + chiclet->setToggleState(false); + } + } } void LLScriptFloater::onMouseDown() @@ -199,6 +211,20 @@ void LLScriptFloater::onMouseDown() } } +void LLScriptFloater::onFocusLost() +{ + LLBottomTray::getInstance()->getChicletPanel()->setChicletToggleState(getObjectId(), false); +} + +void LLScriptFloater::onFocusReceived() +{ + // first focus will be received before setObjectId() call - don't toggle chiclet + if(getObjectId().notNull()) + { + LLBottomTray::getInstance()->getChicletPanel()->setChicletToggleState(getObjectId(), true); + } +} + void LLScriptFloater::hideToastsIfNeeded() { using namespace LLNotificationsUI; diff --git a/indra/newview/llscriptfloater.h b/indra/newview/llscriptfloater.h index ed10dc5fe9..f86605c5d1 100644 --- a/indra/newview/llscriptfloater.h +++ b/indra/newview/llscriptfloater.h @@ -174,6 +174,10 @@ protected: */ void onMouseDown(); + /*virtual*/ void onFocusLost(); + + /*virtual*/ void onFocusReceived(); + private: LLToastNotifyPanel* mScriptForm; LLUUID mObjectId; diff --git a/indra/newview/skins/default/xui/en/widgets/chiclet_im_adhoc.xml b/indra/newview/skins/default/xui/en/widgets/chiclet_im_adhoc.xml index 693c43f141..2bec5b8a29 100644 --- a/indra/newview/skins/default/xui/en/widgets/chiclet_im_adhoc.xml +++ b/indra/newview/skins/default/xui/en/widgets/chiclet_im_adhoc.xml @@ -4,6 +4,13 @@ name="im_adhoc_chiclet" show_speaker="false" width="25"> + + width="19" /> + + width="19" /> + + width="19" /> + + width="19" /> + + width="19"/>