From 6b165ce2ade6db7d5e6cb23e039e4949dc71e617 Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Tue, 18 Dec 2012 15:09:50 +0200 Subject: CHUI-562 FIXED Gear button is added for p2p torn-off floater. --- indra/newview/llfloaterimsessiontab.cpp | 53 +++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterimsessiontab.cpp') diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index ea99a1c5bf..267dba562c 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -197,6 +197,8 @@ BOOL LLFloaterIMSessionTab::postBuild() mTearOffBtn = getChild("tear_off_btn"); mTearOffBtn->setCommitCallback(boost::bind(&LLFloaterIMSessionTab::onTearOffClicked, this)); + mGearBtn = getChild("gear_btn"); + mParticipantListPanel = getChild("speakers_list_panel"); // Add a scroller for the folder (participant) view @@ -239,11 +241,11 @@ BOOL LLFloaterIMSessionTab::postBuild() // Now ready to build the conversation and participants list buildConversationViewParticipant(); refreshConversation(); - + // Zero expiry time is set only once to allow initial update. mRefreshTimer->setTimerExpirySec(0); mRefreshTimer->start(); - + initBtns(); return result; } @@ -756,6 +758,53 @@ void LLFloaterIMSessionTab::onTearOffClicked() initRectControl(); LLFloater::onClickTearOff(this); refreshConversation(); + updateGearBtn(); +} + +void LLFloaterIMSessionTab::updateGearBtn() +{ + + bool prevVisibility = mGearBtn->getVisible(); + mGearBtn->setVisible(checkIfTornOff() && mIsP2PChat); + + + // Move buttons if Gear button changed visibility + if(prevVisibility != mGearBtn->getVisible()) + { + LLRect gear_btn_rect = mGearBtn->getRect(); + LLRect add_btn_rect = getChild("add_btn")->getRect(); + LLRect call_btn_rect = getChild("voice_call_btn")->getRect(); + S32 gap_width = call_btn_rect.mLeft - add_btn_rect.mRight; + S32 right_shift = gear_btn_rect.getWidth() + gap_width; + if(mGearBtn->getVisible()) + { + // Move buttons to the right to give space for Gear button + add_btn_rect.translate(right_shift,0); + call_btn_rect.translate(right_shift,0); + } + else + { + add_btn_rect.translate(-right_shift,0); + call_btn_rect.translate(-right_shift,0); + } + getChild("add_btn")->setRect(add_btn_rect); + getChild("voice_call_btn")->setRect(call_btn_rect); + } +} + +void LLFloaterIMSessionTab::initBtns() +{ + LLRect gear_btn_rect = mGearBtn->getRect(); + LLRect add_btn_rect = getChild("add_btn")->getRect(); + LLRect call_btn_rect = getChild("voice_call_btn")->getRect(); + S32 gap_width = call_btn_rect.mLeft - add_btn_rect.mRight; + S32 right_shift = gear_btn_rect.getWidth() + gap_width; + + add_btn_rect.translate(-right_shift,0); + call_btn_rect.translate(-right_shift,0); + + getChild("add_btn")->setRect(add_btn_rect); + getChild("voice_call_btn")->setRect(call_btn_rect); } // static -- cgit v1.2.3