From fac210075f4c68db372ae0535e332ffe9765a5d1 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Mon, 7 May 2012 22:40:56 +0300 Subject: CHUI-105 WIP Added tear-off and return behavior for IM floater. XUI changed for Converstions multifloater and IM floater. --- indra/newview/llimfloater.cpp | 46 ++++++ indra/newview/llimfloater.h | 2 + indra/newview/llimfloatercontainer.cpp | 24 ++++ indra/newview/llimfloatercontainer.h | 1 + .../skins/default/xui/en/floater_im_container.xml | 111 ++++++++++----- .../skins/default/xui/en/floater_im_session.xml | 158 +++++++++++++++++---- 6 files changed, 278 insertions(+), 64 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index f743b5e2bf..df3521ecb0 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -28,6 +28,7 @@ #include "llimfloater.h" +#include "lldraghandle.h" #include "llnotificationsutil.h" #include "llagent.h" @@ -251,6 +252,12 @@ BOOL LLIMFloater::postBuild() slide_right->setVisible(!mControlPanel->getParent()->getVisible()); slide_right->setClickedCallback(boost::bind(&LLIMFloater::onSlide, this)); + LLButton* return_btn = getChild("return_btn"); + return_btn->setCommitCallback(boost::bind(&LLFloater::onClickTearOff, this)); + + LLButton* tear_off_btn = getChild("tear_off_btn"); + tear_off_btn->setCommitCallback(boost::bind(&LLFloater::onClickTearOff, this)); + mInputEditor = getChild("chat_editor"); mInputEditor->setMaxTextLength(1023); // enable line history support for instant message bar @@ -1194,3 +1201,42 @@ void LLIMFloater::onClickCloseBtn() LLFloater::onClickCloseBtn(); } + +// virtual +void LLIMFloater::updateTitleButtons() +{ + if (!mDragHandle) + { + return; + } + + LLMultiFloater* host_floater = getHost(); + + bool is_hosted = host_floater != NULL; + if (is_hosted) ///< floater is hosted + { + for (S32 i = 0; i < BUTTON_COUNT; i++) + { + if (!mButtons[i]) + { + continue; + } + + // Hide the standard header buttons in a docked IM floater. + mButtons[i]->setVisible(false); + } + } + else ///< floater is torn off + { + LLFloater::updateTitleButtons(); + } + + // toggle floater's drag handle and title visibility + mDragHandle->setVisible(!is_hosted); + + LLButton* return_btn = getChild("return_btn"); + return_btn->setVisible(!is_hosted); + + LLButton* tear_off_btn = getChild("tear_off_btn"); + tear_off_btn->setVisible(is_hosted); +} diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index f7cd35b5eb..95aa214ff6 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -120,6 +120,8 @@ protected: /* virtual */ void onClickCloseBtn(); + /*virtual*/ void updateTitleButtons(); + private: // process focus events to set a currently active session /* virtual */ void onFocusLost(); diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index c8e48b0d42..9b5055fb98 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -56,6 +56,9 @@ BOOL LLIMFloaterContainer::postBuild() mNewMessageConnection = LLIMModel::instance().mNewMsgSignal.connect(boost::bind(&LLIMFloaterContainer::onNewMessageReceived, this, _1)); // Do not call base postBuild to not connect to mCloseSignal to not close all floaters via Close button // mTabContainer will be initialized in LLMultiFloater::addChild() + + setTabContainer(getChild("im_box_tab_container")); + return TRUE; } @@ -74,6 +77,7 @@ void LLIMFloaterContainer::onOpen(const LLSD& key) */ } +// virtual void LLIMFloaterContainer::addFloater(LLFloater* floaterp, BOOL select_added_floater, LLTabContainer::eInsertionPoint insertion_point) @@ -89,6 +93,12 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point); + LLView* floater_contents = floaterp->getChild("contents_view"); + + // we don't show the header when the floater is hosted, + // so reshape floater contents to occupy the header space + floater_contents->setShape(floaterp->getRect()); + LLUUID session_id = floaterp->getKey(); LLIconCtrl* icon = 0; @@ -116,6 +126,20 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, mTabContainer->setTabImage(floaterp, icon); } +// virtual +void LLIMFloaterContainer::removeFloater(LLFloater* floaterp) +{ + LLMultiFloater::removeFloater(floaterp); + + LLRect contents_rect = floaterp->getRect(); + + // reduce the floater contents height by header height + contents_rect.mTop -= floaterp->getHeaderHeight(); + + LLView* floater_contents = floaterp->getChild("contents_view"); + floater_contents->setShape(contents_rect); +} + void LLIMFloaterContainer::onCloseFloater(LLUUID& id) { mSessions.erase(id); diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 892ecef48d..93b91fe3cf 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -50,6 +50,7 @@ public: /*virtual*/ void addFloater(LLFloater* floaterp, BOOL select_added_floater, LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); + /*virtual*/ void removeFloater(LLFloater* floaterp); static LLFloater* getCurrentVoiceFloater(); diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml index e123de46c2..d19b36971f 100644 --- a/indra/newview/skins/default/xui/en/floater_im_container.xml +++ b/indra/newview/skins/default/xui/en/floater_im_container.xml @@ -3,47 +3,86 @@ can_close="false" can_minimize="true" can_resize="true" - height="390" + height="430" layout="topleft" + min_width="510" name="floater_im_box" help_topic="floater_im_box" save_rect="true" save_visibility="true" single_instance="true" title="CONVERSATIONS" - width="396"> - - - - - - + width="680"> + + + + + +