diff options
author | AlexanderP ProductEngine <apaschenko@productengine.com> | 2012-08-02 18:43:44 +0300 |
---|---|---|
committer | AlexanderP ProductEngine <apaschenko@productengine.com> | 2012-08-02 18:43:44 +0300 |
commit | 0fa1e2b9ae41bb06e5c7db90900d4f469f44b8d3 (patch) | |
tree | bcd164e4fb52275d6f1106eed1ae3a782643e5e1 /indra | |
parent | 4cb1e766fcfcaba702c2638f4c7daa9dd17bcbd8 (diff) |
CHUI-230, CHUI-232, CHUI-261 Forced resize of a conversation's floater in the IM-container; support of the rectControls for IM-conversations; fixed LLFloater and LLMultiFloater for the correct hosting of floaters with mSaveRect
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llui/llfloater.cpp | 61 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 1 | ||||
-rw-r--r-- | indra/llui/llmultifloater.cpp | 3 | ||||
-rw-r--r-- | indra/llui/llmultifloater.h | 9 | ||||
-rw-r--r-- | indra/newview/llimconversation.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llnearbychat.cpp | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_im_session.xml | 3 |
8 files changed, 61 insertions, 38 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index a1c902d562..8145d6d347 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1175,7 +1175,6 @@ void LLFloater::setMinimized(BOOL minimize) { // minimized flag should be turned on before release focus mMinimized = TRUE; - mExpandedRect = getRect(); // If the floater has been dragged while minimized in the @@ -1248,7 +1247,6 @@ void LLFloater::setMinimized(BOOL minimize) } setOrigin( mExpandedRect.mLeft, mExpandedRect.mBottom ); - if (mButtonsEnabled[BUTTON_RESTORE]) { mButtonsEnabled[BUTTON_MINIMIZE] = TRUE; @@ -1284,7 +1282,6 @@ void LLFloater::setMinimized(BOOL minimize) // Reshape *after* setting mMinimized reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE ); - applyPositioning(NULL, false); } make_ui_sound("UISndWindowClose"); @@ -1658,10 +1655,12 @@ void LLFloater::onClickTearOff(LLFloater* self) gFloaterView->addChild(self); self->openFloater(self->getKey()); - - // only force position for floaters that don't have that data saved - if (self->mRectControl.empty()) + if (self->mSaveRect && !self->mRectControl.empty()) { + self->applyRectControl(); + } + else + { // only force position for floaters that don't have that data saved new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - floater_header_size - 5, self->getRect().getWidth(), self->getRect().getHeight()); self->setRect(new_rect); } @@ -1675,6 +1674,10 @@ void LLFloater::onClickTearOff(LLFloater* self) LLMultiFloater* new_host = (LLMultiFloater*)self->mLastHostHandle.get(); if (new_host) { + if (self->mSaveRect) + { + self->storeRectControl(); + } self->setMinimized(FALSE); // to reenable minimize button if it was minimized new_host->showFloater(self); // make sure host is visible @@ -1709,6 +1712,18 @@ void LLFloater::onClickHelp( LLFloater* self ) } } +void LLFloater::initRectControl() +{ + // save_rect and save_visibility only apply to registered floaters + if (mSaveRect) + { + std::string ctrl_name = getControlName(mInstanceName, mKey); + mRectControl = LLFloaterReg::declareRectControl(ctrl_name); + mPosXControl = LLFloaterReg::declarePosXControl(ctrl_name); + mPosYControl = LLFloaterReg::declarePosYControl(ctrl_name); + } +} + // static LLFloater* LLFloater::getClosableFloaterFromFocus() { @@ -2940,28 +2955,22 @@ void LLFloaterView::popVisibleAll(const skip_list_t& skip_list) void LLFloater::setInstanceName(const std::string& name) { - if (name == mInstanceName) - return; - llassert_always(mInstanceName.empty()); - mInstanceName = name; - if (!mInstanceName.empty()) + if (name != mInstanceName) { - std::string ctrl_name = getControlName(mInstanceName, mKey); - - // save_rect and save_visibility only apply to registered floaters - if (mSaveRect) - { - mRectControl = LLFloaterReg::declareRectControl(ctrl_name); - mPosXControl = LLFloaterReg::declarePosXControl(ctrl_name); - mPosYControl = LLFloaterReg::declarePosYControl(ctrl_name); - } - if (!mVisibilityControl.empty()) + llassert_always(mInstanceName.empty()); + mInstanceName = name; + if (!mInstanceName.empty()) { - mVisibilityControl = LLFloaterReg::declareVisibilityControl(ctrl_name); - } - if(!mDocStateControl.empty()) - { - mDocStateControl = LLFloaterReg::declareDockStateControl(ctrl_name); + std::string ctrl_name = getControlName(mInstanceName, mKey); + initRectControl(); + if (!mVisibilityControl.empty()) + { + mVisibilityControl = LLFloaterReg::declareVisibilityControl(ctrl_name); + } + if(!mDocStateControl.empty()) + { + mDocStateControl = LLFloaterReg::declareDockStateControl(ctrl_name); + } } } } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 5be6e6d922..a1cac64a4a 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -358,6 +358,7 @@ protected: void stackWith(LLFloater& other); + virtual void initRectControl(); virtual bool applyRectControl(); bool applyDockState(); void applyPositioning(LLFloater* other, bool on_open); diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp index e80799b16d..02ff64dbc6 100644 --- a/indra/llui/llmultifloater.cpp +++ b/indra/llui/llmultifloater.cpp @@ -188,11 +188,13 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater, floater_data.mHeight = floaterp->getRect().getHeight(); floater_data.mCanMinimize = floaterp->isMinimizeable(); floater_data.mCanResize = floaterp->isResizable(); + floater_data.mSaveRect = floaterp->mSaveRect; // remove minimize and close buttons floaterp->setCanMinimize(FALSE); floaterp->setCanResize(FALSE); floaterp->setCanDrag(FALSE); + floaterp->mSaveRect = FALSE; floaterp->storeRectControl(); // avoid double rendering of floater background (makes it more opaque) floaterp->setBackgroundVisible(FALSE); @@ -291,6 +293,7 @@ void LLMultiFloater::removeFloater(LLFloater* floaterp) { LLFloaterData& floater_data = found_data_it->second; floaterp->setCanMinimize(floater_data.mCanMinimize); + floaterp->mSaveRect = floater_data.mSaveRect; if (!floater_data.mCanResize) { // restore original size diff --git a/indra/llui/llmultifloater.h b/indra/llui/llmultifloater.h index 44514a6246..d992212650 100644 --- a/indra/llui/llmultifloater.h +++ b/indra/llui/llmultifloater.h @@ -79,10 +79,11 @@ public: protected: struct LLFloaterData { - S32 mWidth; - S32 mHeight; - BOOL mCanMinimize; - BOOL mCanResize; + S32 mWidth; + S32 mHeight; + BOOL mCanMinimize; + BOOL mCanResize; + BOOL mSaveRect; }; LLTabContainer* mTabContainer; diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index 3e23d75d28..b56f30312a 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -103,15 +103,15 @@ BOOL LLIMConversation::postBuild() mInputEditorTopPad = mChatHistory->getRect().mBottom - mInputEditor->getRect().mTop; - if (!isTornOff()) - { - setOpenPositioning(LLFloaterEnums::POSITIONING_RELATIVE); - } + setOpenPositioning(LLFloaterEnums::POSITIONING_RELATIVE); buildParticipantList(); updateHeaderAndToolbar(); + mSaveRect = isTornOff(); + initRectControl(); + if (isChatMultiTab()) { if (mIsNearbyChat) @@ -364,12 +364,14 @@ void LLIMConversation::onSlide(LLIMConversation* self) void LLIMConversation::onOpen(const LLSD& key) { LLIMFloaterContainer* host_floater = dynamic_cast<LLIMFloaterContainer*>(getHost()); - if (host_floater) + bool is_hosted = !!host_floater; + if (is_hosted) { // Show the messages pane when opening a floater hosted in the Conversations host_floater->collapseMessagesPane(false); } + setTornOff(!is_hosted); updateHeaderAndToolbar(); } @@ -389,6 +391,9 @@ void LLIMConversation::onClose(bool app_quitting) void LLIMConversation::onTearOffClicked() { + setFollows(isTornOff()? FOLLOWS_ALL : FOLLOWS_NONE); + mSaveRect = isTornOff(); + initRectControl(); LLFloater::onClickTearOff(this); updateHeaderAndToolbar(); } diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index cc094fcaa1..d618e7491a 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -174,6 +174,11 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, mSessions[session_id] = floaterp; floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, session_id)); } + + // forced resize of the floater + LLRect wrapper_rect = this->mTabContainer->getLocalRect(); + floaterp->setRect(wrapper_rect); + mTabContainer->setTabImage(floaterp, icon); } diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index b628697bbc..8f0e6b4c83 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -150,8 +150,6 @@ BOOL LLNearbyChat::postBuild() // Register for font change notifications LLViewerChat::setFontChangedCallback(boost::bind(&LLNearbyChat::onChatFontChange, this, _1)); - enableResizeCtrls(true, true, false); - // title must be defined BEFORE call addConversationListItem() because // it is used for show the item's name in the conversations list setTitle(getString("NearbyChatTitle")); 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 09c1510004..675967035f 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -15,7 +15,8 @@ can_resize="true" can_tear_off="false" min_width="250" - min_height="190"> + min_height="190" + positioning="relative"> <floater.string name="NearbyChatTitle" value="Nearby Chat"/> |