Skip to content
Snippets Groups Projects
Commit 0fa1e2b9 authored by AlexanderP ProductEngine's avatar AlexanderP ProductEngine
Browse files

CHUI-230, CHUI-232, CHUI-261 Forced resize of a conversation's floater in the...

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
parent 4cb1e766
No related branches found
No related tags found
No related merge requests found
...@@ -1175,7 +1175,6 @@ void LLFloater::setMinimized(BOOL minimize) ...@@ -1175,7 +1175,6 @@ void LLFloater::setMinimized(BOOL minimize)
{ {
// minimized flag should be turned on before release focus // minimized flag should be turned on before release focus
mMinimized = TRUE; mMinimized = TRUE;
mExpandedRect = getRect(); mExpandedRect = getRect();
// If the floater has been dragged while minimized in the // If the floater has been dragged while minimized in the
...@@ -1248,7 +1247,6 @@ void LLFloater::setMinimized(BOOL minimize) ...@@ -1248,7 +1247,6 @@ void LLFloater::setMinimized(BOOL minimize)
} }
setOrigin( mExpandedRect.mLeft, mExpandedRect.mBottom ); setOrigin( mExpandedRect.mLeft, mExpandedRect.mBottom );
if (mButtonsEnabled[BUTTON_RESTORE]) if (mButtonsEnabled[BUTTON_RESTORE])
{ {
mButtonsEnabled[BUTTON_MINIMIZE] = TRUE; mButtonsEnabled[BUTTON_MINIMIZE] = TRUE;
...@@ -1284,7 +1282,6 @@ void LLFloater::setMinimized(BOOL minimize) ...@@ -1284,7 +1282,6 @@ void LLFloater::setMinimized(BOOL minimize)
// Reshape *after* setting mMinimized // Reshape *after* setting mMinimized
reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE ); reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE );
applyPositioning(NULL, false);
} }
make_ui_sound("UISndWindowClose"); make_ui_sound("UISndWindowClose");
...@@ -1658,10 +1655,12 @@ void LLFloater::onClickTearOff(LLFloater* self) ...@@ -1658,10 +1655,12 @@ void LLFloater::onClickTearOff(LLFloater* self)
gFloaterView->addChild(self); gFloaterView->addChild(self);
self->openFloater(self->getKey()); self->openFloater(self->getKey());
if (self->mSaveRect && !self->mRectControl.empty())
// only force position for floaters that don't have that data saved
if (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()); 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); self->setRect(new_rect);
} }
...@@ -1675,6 +1674,10 @@ void LLFloater::onClickTearOff(LLFloater* self) ...@@ -1675,6 +1674,10 @@ void LLFloater::onClickTearOff(LLFloater* self)
LLMultiFloater* new_host = (LLMultiFloater*)self->mLastHostHandle.get(); LLMultiFloater* new_host = (LLMultiFloater*)self->mLastHostHandle.get();
if (new_host) if (new_host)
{ {
if (self->mSaveRect)
{
self->storeRectControl();
}
self->setMinimized(FALSE); // to reenable minimize button if it was minimized self->setMinimized(FALSE); // to reenable minimize button if it was minimized
new_host->showFloater(self); new_host->showFloater(self);
// make sure host is visible // make sure host is visible
...@@ -1709,6 +1712,18 @@ void LLFloater::onClickHelp( LLFloater* self ) ...@@ -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 // static
LLFloater* LLFloater::getClosableFloaterFromFocus() LLFloater* LLFloater::getClosableFloaterFromFocus()
{ {
...@@ -2940,28 +2955,22 @@ void LLFloaterView::popVisibleAll(const skip_list_t& skip_list) ...@@ -2940,28 +2955,22 @@ void LLFloaterView::popVisibleAll(const skip_list_t& skip_list)
void LLFloater::setInstanceName(const std::string& name) void LLFloater::setInstanceName(const std::string& name)
{ {
if (name == mInstanceName) if (name != mInstanceName)
return;
llassert_always(mInstanceName.empty());
mInstanceName = name;
if (!mInstanceName.empty())
{ {
std::string ctrl_name = getControlName(mInstanceName, mKey); llassert_always(mInstanceName.empty());
mInstanceName = name;
// save_rect and save_visibility only apply to registered floaters if (!mInstanceName.empty())
if (mSaveRect)
{
mRectControl = LLFloaterReg::declareRectControl(ctrl_name);
mPosXControl = LLFloaterReg::declarePosXControl(ctrl_name);
mPosYControl = LLFloaterReg::declarePosYControl(ctrl_name);
}
if (!mVisibilityControl.empty())
{ {
mVisibilityControl = LLFloaterReg::declareVisibilityControl(ctrl_name); std::string ctrl_name = getControlName(mInstanceName, mKey);
} initRectControl();
if(!mDocStateControl.empty()) if (!mVisibilityControl.empty())
{ {
mDocStateControl = LLFloaterReg::declareDockStateControl(ctrl_name); mVisibilityControl = LLFloaterReg::declareVisibilityControl(ctrl_name);
}
if(!mDocStateControl.empty())
{
mDocStateControl = LLFloaterReg::declareDockStateControl(ctrl_name);
}
} }
} }
} }
......
...@@ -358,6 +358,7 @@ class LLFloater : public LLPanel, public LLInstanceTracker<LLFloater> ...@@ -358,6 +358,7 @@ class LLFloater : public LLPanel, public LLInstanceTracker<LLFloater>
void stackWith(LLFloater& other); void stackWith(LLFloater& other);
virtual void initRectControl();
virtual bool applyRectControl(); virtual bool applyRectControl();
bool applyDockState(); bool applyDockState();
void applyPositioning(LLFloater* other, bool on_open); void applyPositioning(LLFloater* other, bool on_open);
......
...@@ -188,11 +188,13 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater, ...@@ -188,11 +188,13 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater,
floater_data.mHeight = floaterp->getRect().getHeight(); floater_data.mHeight = floaterp->getRect().getHeight();
floater_data.mCanMinimize = floaterp->isMinimizeable(); floater_data.mCanMinimize = floaterp->isMinimizeable();
floater_data.mCanResize = floaterp->isResizable(); floater_data.mCanResize = floaterp->isResizable();
floater_data.mSaveRect = floaterp->mSaveRect;
// remove minimize and close buttons // remove minimize and close buttons
floaterp->setCanMinimize(FALSE); floaterp->setCanMinimize(FALSE);
floaterp->setCanResize(FALSE); floaterp->setCanResize(FALSE);
floaterp->setCanDrag(FALSE); floaterp->setCanDrag(FALSE);
floaterp->mSaveRect = FALSE;
floaterp->storeRectControl(); floaterp->storeRectControl();
// avoid double rendering of floater background (makes it more opaque) // avoid double rendering of floater background (makes it more opaque)
floaterp->setBackgroundVisible(FALSE); floaterp->setBackgroundVisible(FALSE);
...@@ -291,6 +293,7 @@ void LLMultiFloater::removeFloater(LLFloater* floaterp) ...@@ -291,6 +293,7 @@ void LLMultiFloater::removeFloater(LLFloater* floaterp)
{ {
LLFloaterData& floater_data = found_data_it->second; LLFloaterData& floater_data = found_data_it->second;
floaterp->setCanMinimize(floater_data.mCanMinimize); floaterp->setCanMinimize(floater_data.mCanMinimize);
floaterp->mSaveRect = floater_data.mSaveRect;
if (!floater_data.mCanResize) if (!floater_data.mCanResize)
{ {
// restore original size // restore original size
......
...@@ -79,10 +79,11 @@ class LLMultiFloater : public LLFloater ...@@ -79,10 +79,11 @@ class LLMultiFloater : public LLFloater
protected: protected:
struct LLFloaterData struct LLFloaterData
{ {
S32 mWidth; S32 mWidth;
S32 mHeight; S32 mHeight;
BOOL mCanMinimize; BOOL mCanMinimize;
BOOL mCanResize; BOOL mCanResize;
BOOL mSaveRect;
}; };
LLTabContainer* mTabContainer; LLTabContainer* mTabContainer;
......
...@@ -103,15 +103,15 @@ BOOL LLIMConversation::postBuild() ...@@ -103,15 +103,15 @@ BOOL LLIMConversation::postBuild()
mInputEditorTopPad = mChatHistory->getRect().mBottom - mInputEditor->getRect().mTop; mInputEditorTopPad = mChatHistory->getRect().mBottom - mInputEditor->getRect().mTop;
if (!isTornOff()) setOpenPositioning(LLFloaterEnums::POSITIONING_RELATIVE);
{
setOpenPositioning(LLFloaterEnums::POSITIONING_RELATIVE);
}
buildParticipantList(); buildParticipantList();
updateHeaderAndToolbar(); updateHeaderAndToolbar();
mSaveRect = isTornOff();
initRectControl();
if (isChatMultiTab()) if (isChatMultiTab())
{ {
if (mIsNearbyChat) if (mIsNearbyChat)
...@@ -364,12 +364,14 @@ void LLIMConversation::onSlide(LLIMConversation* self) ...@@ -364,12 +364,14 @@ void LLIMConversation::onSlide(LLIMConversation* self)
void LLIMConversation::onOpen(const LLSD& key) void LLIMConversation::onOpen(const LLSD& key)
{ {
LLIMFloaterContainer* host_floater = dynamic_cast<LLIMFloaterContainer*>(getHost()); 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 // Show the messages pane when opening a floater hosted in the Conversations
host_floater->collapseMessagesPane(false); host_floater->collapseMessagesPane(false);
} }
setTornOff(!is_hosted);
updateHeaderAndToolbar(); updateHeaderAndToolbar();
} }
...@@ -389,6 +391,9 @@ void LLIMConversation::onClose(bool app_quitting) ...@@ -389,6 +391,9 @@ void LLIMConversation::onClose(bool app_quitting)
void LLIMConversation::onTearOffClicked() void LLIMConversation::onTearOffClicked()
{ {
setFollows(isTornOff()? FOLLOWS_ALL : FOLLOWS_NONE);
mSaveRect = isTornOff();
initRectControl();
LLFloater::onClickTearOff(this); LLFloater::onClickTearOff(this);
updateHeaderAndToolbar(); updateHeaderAndToolbar();
} }
......
...@@ -174,6 +174,11 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, ...@@ -174,6 +174,11 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp,
mSessions[session_id] = floaterp; mSessions[session_id] = floaterp;
floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, session_id)); 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); mTabContainer->setTabImage(floaterp, icon);
} }
......
...@@ -150,8 +150,6 @@ BOOL LLNearbyChat::postBuild() ...@@ -150,8 +150,6 @@ BOOL LLNearbyChat::postBuild()
// Register for font change notifications // Register for font change notifications
LLViewerChat::setFontChangedCallback(boost::bind(&LLNearbyChat::onChatFontChange, this, _1)); LLViewerChat::setFontChangedCallback(boost::bind(&LLNearbyChat::onChatFontChange, this, _1));
enableResizeCtrls(true, true, false);
// title must be defined BEFORE call addConversationListItem() because // title must be defined BEFORE call addConversationListItem() because
// it is used for show the item's name in the conversations list // it is used for show the item's name in the conversations list
setTitle(getString("NearbyChatTitle")); setTitle(getString("NearbyChatTitle"));
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
can_resize="true" can_resize="true"
can_tear_off="false" can_tear_off="false"
min_width="250" min_width="250"
min_height="190"> min_height="190"
positioning="relative">
<floater.string <floater.string
name="NearbyChatTitle" name="NearbyChatTitle"
value="Nearby Chat"/> value="Nearby Chat"/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment