Fixed major bug EXT-4206 - Bottom bar spec calls for button background art on IM Chiclets.

--HG--
branch : product-engine
meow-7.2.2
Dmitry Zaporozhan 2010-01-19 12:42:33 +02:00
parent a6429a6a14
commit 862ca3fa16
10 changed files with 175 additions and 16 deletions

View File

@ -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<LLButton>(button_params);
addChild(mChicletButton);
LLIconCtrl::Params new_msg_params = p.new_message_icon;
mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(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<LLButton>(button_params);
addChild(mChicletButton);
LLIconCtrl::Params new_msg_params = p.new_message_icon;
mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(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<LLButton>(button_params);
addChild(mChicletButton);
LLIconCtrl::Params new_msg_params = p.new_message_icon;
mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(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<LLIMChiclet>(n);
if(chiclet && chiclet->getSessionId() != session_id)
{
chiclet->setToggleState(false);
}
}
// toggle specified chiclet
LLIMChiclet* chiclet = findChiclet<LLIMChiclet>(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<LLButton>(button_params);
addChild(mChicletButton);
LLIconCtrl::Params new_msg_params = p.new_message_icon;
mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(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<LLButton>(button_params);
addChild(mChicletButton);
LLIconCtrl::Params new_msg_params = p.new_message_icon;
mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(new_msg_params);
addChild(mNewMessagesIcon);

View File

@ -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<Params, LLIMChiclet::Params>
{
Optional<LLButton::Params> chiclet_button;
Optional<LLChicletAvatarIconCtrl::Params> avatar_icon;
Optional<LLChicletNotificationCounterCtrl::Params> unread_notifications;
@ -538,6 +542,8 @@ class LLAdHocChiclet : public LLIMChiclet
public:
struct Params : public LLInitParam::Block<Params, LLIMChiclet::Params>
{
Optional<LLButton::Params> chiclet_button;
Optional<LLChicletAvatarIconCtrl::Params> avatar_icon;
Optional<LLChicletNotificationCounterCtrl::Params> unread_notifications;
@ -614,6 +620,8 @@ public:
struct Params : public LLInitParam::Block<Params, LLIMChiclet::Params>
{
Optional<LLButton::Params> chiclet_button;
Optional<LLIconCtrl::Params> icon;
Optional<LLIconCtrl::Params> new_message_icon;
@ -656,6 +664,8 @@ public:
struct Params : public LLInitParam::Block<Params, LLIMChiclet::Params>
{
Optional<LLButton::Params> chiclet_button;
Optional<LLChicletInvOfferIconCtrl::Params> icon;
Optional<LLIconCtrl::Params> new_message_icon;
@ -697,6 +707,8 @@ public:
struct Params : public LLInitParam::Block<Params, LLIMChiclet::Params>
{
Optional<LLButton::Params> chiclet_button;
Optional<LLChicletGroupIconCtrl::Params> group_icon;
Optional<LLChicletNotificationCounterCtrl::Params> 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;

View File

@ -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<LLIMChiclet>(mSessionID);
if(chiclet)
{
chiclet->setToggleState(false);
}
}
}
//static

View File

@ -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<LLScriptFloater>("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<LLIMChiclet>(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;

View File

@ -174,6 +174,10 @@ protected:
*/
void onMouseDown();
/*virtual*/ void onFocusLost();
/*virtual*/ void onFocusReceived();
private:
LLToastNotifyPanel* mScriptForm;
LLUUID mObjectId;

View File

@ -4,6 +4,13 @@
name="im_adhoc_chiclet"
show_speaker="false"
width="25">
<chiclet_im_adhoc.chiclet_button
height="25"
image_selected="PushButton_Selected"
image_unselected="PushButton_Off"
name="chiclet_button"
tab_stop="false"
width="25"/>
<chiclet_im_adhoc.speaker
auto_update="true"
draw_border="false"
@ -13,11 +20,13 @@
visible="false"
width="20" />
<chiclet_im_adhoc.avatar_icon
bottom="3"
follows="left|top|bottom"
height="22"
height="19"
left="3"
mouse_opaque="true"
name="adhoc_icon"
width="22" />
width="19" />
<chiclet_im_adhoc.unread_notifications
font_halign="center"
height="25"

View File

@ -4,6 +4,13 @@
name="im_group_chiclet"
show_speaker="false"
width="25">
<chiclet_im_group.chiclet_button
height="25"
image_selected="PushButton_Selected"
image_unselected="PushButton_Off"
name="chiclet_button"
tab_stop="false"
width="25"/>
<chiclet_im_group.speaker
auto_update="true"
draw_border="false"
@ -13,13 +20,14 @@
visible="false"
width="20" />
<chiclet_im_group.group_icon
bottom="3"
default_icon="Generic_Group"
follows="left|top|bottom"
height="18"
bottom_pad="4"
mouse_opaque="true"
height="19"
left="3"
mouse_opaque="false"
name="group_icon"
width="18" />
width="19" />
<chiclet_im_group.unread_notifications
height="25"
font_halign="center"

View File

@ -4,6 +4,13 @@
name="im_p2p_chiclet"
show_speaker="false"
width="25">
<chiclet_im_p2p.chiclet_button
height="25"
image_selected="PushButton_Selected"
image_unselected="PushButton_Off"
name="chiclet_button"
tab_stop="false"
width="25"/>
<chiclet_im_p2p.speaker
auto_update="true"
draw_border="false"
@ -13,11 +20,13 @@
visible="false"
width="20"/>
<chiclet_im_p2p.avatar_icon
bottom="3"
follows="left|top|bottom"
height="22"
mouse_opaque="true"
height="19"
left="3"
mouse_opaque="false"
name="avatar_icon"
width="22" />
width="19" />
<chiclet_im_p2p.unread_notifications
height="25"
font_halign="center"

View File

@ -3,14 +3,22 @@
height="25"
name="offer_chiclet"
width="25">
<chiclet_offer.chiclet_button
height="25"
image_selected="PushButton_Selected"
image_unselected="PushButton_Off"
name="chiclet_button"
tab_stop="false"
width="25"/>
<chiclet_offer.icon
bottom="3"
default_icon="Generic_Object_Small"
follows="all"
height="20"
height="19"
left="3"
mouse_opaque="false"
name="chiclet_icon"
bottom_pad="2"
width="20" />
width="19" />
<chiclet_offer.new_message_icon
bottom="11"
height="14"

View File

@ -3,14 +3,22 @@
height="25"
name="script_chiclet"
width="25">
<chiclet_script.chiclet_button
height="25"
image_selected="PushButton_Selected"
image_unselected="PushButton_Off"
name="chiclet_button"
tab_stop="false"
width="25"/>
<chiclet_script.icon
bottom="3"
follows="all"
height="20"
height="19"
image_name="Generic_Object_Small"
left="3"
mouse_opaque="false"
name="chiclet_icon"
width="20"
bottom_pad="2" />
width="19"/>
<chiclet_script.new_message_icon
bottom="11"
height="14"