diff options
-rw-r--r-- | indra/newview/llimfloater.cpp | 70 | ||||
-rw-r--r-- | indra/newview/llimfloater.h | 5 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.cpp | 26 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.h | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_im_container.xml | 44 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_im_session.xml | 41 |
6 files changed, 111 insertions, 79 deletions
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index d02db458b4..b2a5c4a64d 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -67,6 +67,8 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) mDialog(IM_NOTHING_SPECIAL), mChatHistory(NULL), mInputEditor(NULL), + mExpandCollapseBtn(NULL), + mTearOffBtn(NULL), mSavedTitle(), mTypingStart(), mShouldSendTypingState(false), @@ -180,6 +182,17 @@ void LLIMFloater::onFocusReceived() } } +/*virtual*/ +void LLIMFloater::onOpen(const LLSD& key) +{ + LLIMFloaterContainer* host_floater = dynamic_cast<LLIMFloaterContainer*>(getHost()); + if (host_floater) + { + // Show the messages pane when opening a floater hosted in the Conversations + host_floater->toggleMessagesPane(true); + } +} + // virtual void LLIMFloater::onClose(bool app_quitting) { @@ -291,19 +304,14 @@ BOOL LLIMFloater::postBuild() mControlPanel->setSessionId(mSessionID); mControlPanel->getParent()->setVisible(gSavedSettings.getBOOL("IMShowControlPanel")); - LLButton* slide_left = getChild<LLButton>("slide_left_btn"); - slide_left->setVisible(mControlPanel->getParent()->getVisible()); - slide_left->setClickedCallback(boost::bind(&LLIMFloater::onSlide, this)); - - LLButton* slide_right = getChild<LLButton>("slide_right_btn"); - slide_right->setVisible(!mControlPanel->getParent()->getVisible()); - slide_right->setClickedCallback(boost::bind(&LLIMFloater::onSlide, this)); + getChild<LLButton>("close_btn")->setCommitCallback(boost::bind(&LLFloater::onClickClose, this)); - LLButton* return_btn = getChild<LLButton>("return_btn"); - return_btn->setCommitCallback(boost::bind(&LLFloater::onClickTearOff, this)); + mExpandCollapseBtn = getChild<LLButton>("expand_collapse_btn"); + mExpandCollapseBtn->setImageOverlay(getString(mControlPanel->getParent()->getVisible() ? "collapse_icon" : "expand_icon")); + mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMFloater::onSlide, this)); - LLButton* tear_off_btn = getChild<LLButton>("tear_off_btn"); - tear_off_btn->setCommitCallback(boost::bind(&LLFloater::onClickTearOff, this)); + mTearOffBtn = getChild<LLButton>("tear_off_btn"); + mTearOffBtn->setCommitCallback(boost::bind(&LLFloater::onClickTearOff, this)); mInputEditor = getChild<LLLineEditor>("chat_editor"); mInputEditor->setMaxTextLength(1023); @@ -427,12 +435,23 @@ void* LLIMFloater::createPanelAdHocControl(void* userdata) void LLIMFloater::onSlide() { - mControlPanel->getParent()->setVisible(!mControlPanel->getParent()->getVisible()); + LLIMFloaterContainer* host_floater = dynamic_cast<LLIMFloaterContainer*>(getHost()); + if (host_floater) + { + // Hide the messages pane if a floater is hosted in the Conversations + host_floater->toggleMessagesPane(false); + } + else ///< floater is torn off + { + bool expand = !mControlPanel->getParent()->getVisible(); - gSavedSettings.setBOOL("IMShowControlPanel", mControlPanel->getParent()->getVisible()); + // Expand/collapse the IM control panel + mControlPanel->getParent()->setVisible(expand); - getChild<LLButton>("slide_left_btn")->setVisible(mControlPanel->getParent()->getVisible()); - getChild<LLButton>("slide_right_btn")->setVisible(!mControlPanel->getParent()->getVisible()); + gSavedSettings.setBOOL("IMShowControlPanel", expand); + + mExpandCollapseBtn->setImageOverlay(getString(expand ? "collapse_icon" : "expand_icon")); + } } //static @@ -1253,14 +1272,16 @@ void LLIMFloater::onClickCloseBtn() // virtual void LLIMFloater::updateTitleButtons() { - if (!mDragHandle) + // This gets called before LLIMFloater::postBuild() while some LLIMFloater members are NULL + if ( !mDragHandle + || !mControlPanel + || !mExpandCollapseBtn + || !mTearOffBtn) { return; } - LLMultiFloater* host_floater = getHost(); - - bool is_hosted = host_floater != NULL; + bool is_hosted = getHost() != NULL; if (is_hosted) ///< floater is hosted { for (S32 i = 0; i < BUTTON_COUNT; i++) @@ -1273,18 +1294,19 @@ void LLIMFloater::updateTitleButtons() // Hide the standard header buttons in a docked IM floater. mButtons[i]->setVisible(false); } + + mExpandCollapseBtn->setImageOverlay(getString("collapse_icon")); } else ///< floater is torn off { LLFloater::updateTitleButtons(); + + bool is_expanded = mControlPanel->getParent()->getVisible(); + mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon")); } // toggle floater's drag handle and title visibility mDragHandle->setVisible(!is_hosted); - - LLButton* return_btn = getChild<LLButton>("return_btn"); - return_btn->setVisible(!is_hosted); - LLButton* tear_off_btn = getChild<LLButton>("tear_off_btn"); - tear_off_btn->setVisible(is_hosted); + mTearOffBtn->setImageOverlay(getString(is_hosted ? "tear_off_icon" : "return_icon")); } diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index ff4eaed0b9..4f161449f7 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -33,6 +33,7 @@ #include "lltransientdockablefloater.h" class LLAvatarName; +class LLButton; class LLLineEditor; class LLPanelChatControlPanel; class LLChatHistory; @@ -59,6 +60,7 @@ public: /*virtual*/ void draw(); // LLFloater overrides + /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_quitting); /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true); @@ -182,6 +184,9 @@ private: bool mSessionInitialized; LLSD mQueuedMsgsForInit; + + LLButton* mExpandCollapseBtn; + LLButton* mTearOffBtn; }; diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 9b5055fb98..c8b8cb208d 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -40,6 +40,7 @@ // LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) : LLMultiFloater(seed) + ,mMessagesPaneWidth(0) { mAutoResize = FALSE; LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, this); @@ -185,4 +186,29 @@ void LLIMFloaterContainer::setMinimized(BOOL b) } } +void LLIMFloaterContainer::toggleMessagesPane(bool expand) +{ + LLView* messages_pane = getChild<LLView>("im_box_tab_container"); + bool is_expanded = messages_pane->getVisible(); + if (is_expanded == expand) + { + return; + } + + // Store the messages pane width before collapsing it. + if (!expand) + { + LLView* conversations_pane = getChild<LLView>("conversations_pane"); + S32 horizontal_pad = messages_pane->getRect().mLeft - conversations_pane->getRect().mRight; + mMessagesPaneWidth = messages_pane->getRect().getWidth() + horizontal_pad; + } + + // Show/hide the messages pane. + messages_pane->setVisible(expand); + + S32 floater_width = getRect().getWidth(); + floater_width += (expand ? mMessagesPaneWidth : -mMessagesPaneWidth); + reshape(floater_width, getRect().getHeight()); +} + // EOF diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 93b91fe3cf..045f053b1c 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -60,12 +60,16 @@ public: virtual void setMinimized(BOOL b); + void toggleMessagesPane(bool expand); + private: typedef std::map<LLUUID,LLFloater*> avatarID_panel_map_t; avatarID_panel_map_t mSessions; boost::signals2::connection mNewMessageConnection; void onNewMessageReceived(const LLSD& data); + + S32 mMessagesPaneWidth; }; #endif // LL_LLIMFLOATERCONTAINER_H 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 d19b36971f..8a0181bae4 100644 --- a/indra/newview/skins/default/xui/en/floater_im_container.xml +++ b/indra/newview/skins/default/xui/en/floater_im_container.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <multi_floater - can_close="false" + can_close="true" can_minimize="true" can_resize="true" height="430" @@ -17,7 +17,7 @@ border="true" follows="top|bottom|left" layout="topleft" - name="conversations_list" + name="conversations_pane" opaque="true" top="0" left="5" @@ -29,7 +29,7 @@ image_hover_unselected="Toolbar_Middle_Over" image_overlay="OptionsMenu_Off" image_selected="Toolbar_Middle_Selected" - image_unselected="Toolbar_Middle_Off" + image_unselected="Toolbar_Middle_Off" layout="topleft" left="5" name="sort_btn" @@ -39,7 +39,7 @@ follows="top|left" height="25" image_hover_unselected="Toolbar_Middle_Over" - image_overlay="AddItem_Off" + image_overlay="AddItem_Off" image_selected="Toolbar_Middle_Selected" image_unselected="Toolbar_Middle_Off" layout="topleft" @@ -55,34 +55,20 @@ image_hover_unselected="Toolbar_Middle_Over" image_overlay="TabIcon_Open_Off" image_selected="Toolbar_Middle_Selected" - image_unselected="Toolbar_Middle_Off" + image_unselected="Toolbar_Middle_Off" layout="topleft" top="5" left="228" - name="slide_left_btn" + name="expand_collapse_btn" width="31" /> - <button - follows="right|top" - height="25" - image_hover_unselected="Toolbar_Middle_Over" - image_overlay="TabIcon_Close_Off" - image_selected="Toolbar_Middle_Selected" - image_unselected="Toolbar_Middle_Off" - layout="topleft" - top="5" - left_delta="0" - name="slide_right_btn" - width="31" /> - </panel> + </panel> <panel_container - follows="all" - layout="topleft" - name="im_box_tab_container" - opaque="true" - top="0" - left_pad="15" - height="430" - width="389" - min_width="290"> - </panel_container> + follows="all" + height="430" + layout="topleft" + left_pad="15" + min_width="290" + name="im_box_tab_container" + top="0" + width="389"/> </multi_floater> diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index d90947a80a..954f646bae 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -12,8 +12,21 @@ visible="false" width="394" can_resize="true" + can_tear_off="false" min_width="250" min_height="190"> + <floater.string + name="collapse_icon" + value="TabIcon_Open_Off"/> + <floater.string + name="expand_icon" + value="TabIcon_Close_Off"/> + <floater.string + name="tear_off_icon" + value="tearoffbox.tga"/> + <floater.string + name="return_icon" + value="Icon_Dock_Foreground"/> <view follows="all" layout="topleft" @@ -23,7 +36,7 @@ height="355" width="394"> <panel - follows="all" + follows="left|top|right" layout="topleft" name="toolbar_panel" top="0" @@ -95,19 +108,7 @@ layout="topleft" top="5" left_pad="5" - name="slide_left_btn" - width="31" /> - <button - follows="right|top" - height="25" - image_hover_unselected="Toolbar_Middle_Over" - image_overlay="TabIcon_Close_Off" - image_selected="Toolbar_Middle_Selected" - image_unselected="Toolbar_Middle_Off" - layout="topleft" - top="5" - left_delta="0" - name="slide_right_btn" + name="expand_collapse_btn" width="31" /> <button follows="right|top" @@ -121,18 +122,6 @@ left_pad="5" name="tear_off_btn" width="31" /> - <button - follows="right|top" - height="25" - image_hover_unselected="Toolbar_Middle_Over" - image_overlay="Icon_Dock_Foreground" - image_selected="Toolbar_Middle_Selected" - image_unselected="Toolbar_Middle_Off" - layout="topleft" - top="5" - left_delta="0" - name="return_btn" - width="31" /> </panel> <layout_stack animate="true" |