Make preventing floaters being dragged underneath the main chat bar actually work, even for Vintage and Latency skin

Ansariel 2014-01-24 22:03:50 +01:00
parent 1720e33553
commit d37f0033e5
6 changed files with 27 additions and 5 deletions

View File

@ -3203,9 +3203,9 @@ void LLFloaterView::setToolbarRect(LLToolBarEnums::EToolBarLocation tb, const LL
}
// <FS:Ansariel> Prevent floaters being dragged under main chat bar
void LLFloaterView::setMainChatbarRect(const LLRect& chatbar_rect)
void LLFloaterView::setMainChatbarRect(LLLayoutPanel* panel, const LLRect& chatbar_rect)
{
mMainChatbarRect = chatbar_rect;
panel->localRectToScreen(chatbar_rect, &mMainChatbarRect);
mMainChatbarRect.stretch(FLOATER_MIN_VISIBLE_PIXELS);
}
// </FS:Ansariel>

View File

@ -589,7 +589,7 @@ public:
void setToolbarRect(LLToolBarEnums::EToolBarLocation tb, const LLRect& toolbar_rect);
// <FS:Ansariel> Prevent floaters being dragged under main chat bar
void setMainChatbarRect(const LLRect& chatbar_rect);
void setMainChatbarRect(LLLayoutPanel* panel, const LLRect& chatbar_rect);
private:
void hiddenFloaterClosed(LLFloater* floater);

View File

@ -201,6 +201,13 @@ void LLLayoutPanel::handleReshape(const LLRect& new_rect, bool by_user)
stackp->mNeedsLayout = true;
}
LLPanel::handleReshape(new_rect, by_user);
// <FS:Ansariel> Add callback for reshaping
if (!mReshapeCallback.empty())
{
mReshapeCallback(this, new_rect);
}
// </FS:Ansariel>
}
//

View File

@ -210,6 +210,11 @@ public:
void setIgnoreReshape(bool ignore) { mIgnoreReshape = ignore; }
// <FS:Ansariel> Add callback for reshaping
typedef boost::function<void(LLLayoutPanel* panel, const LLRect& rect)> reshape_callback_t;
void setReshapeCallback(reshape_callback_t cb) { mReshapeCallback = cb; }
// </FS:Ansariel>
protected:
LLLayoutPanel(const Params& p);
@ -226,6 +231,9 @@ protected:
bool mIgnoreReshape;
LLLayoutStack::ELayoutOrientation mOrientation;
class LLResizeBar* mResizeBar;
// <FS:Ansariel> Add callback for reshaping
reshape_callback_t mReshapeCallback;
};

View File

@ -525,12 +525,10 @@ void FSNearbyChat::showDefaultChatBar(BOOL visible,const char* text) const
if(visible)
{
gFloaterView->setSnapOffsetChatBar(mDefaultChatBar->getRect().getHeight() + MAGIC_CHAT_BAR_PAD);
gFloaterView->setMainChatbarRect(mDefaultChatBar->getParent()->getRect());
}
else
{
gFloaterView->setSnapOffsetChatBar(0);
gFloaterView->setMainChatbarRect(LLRect());
}
if(!text)

View File

@ -1975,6 +1975,15 @@ void LLViewerWindow::initBase()
gFloaterView->setFloaterSnapView(main_view->getChild<LLView>("floater_snap_region")->getHandle());
gSnapshotFloaterView = main_view->getChild<LLSnapshotFloaterView>("Snapshot Floater View");
// <FS:Ansariel> Prevent floaters being dragged under main chat bar
LLLayoutPanel* chatbar_panel = dynamic_cast<LLLayoutPanel*>(gToolBarView->getChildView("default_chat_bar")->getParent());
if (chatbar_panel)
{
chatbar_panel->setReshapeCallback(boost::bind(&LLFloaterView::setMainChatbarRect, gFloaterView, _1, _2));
gFloaterView->setMainChatbarRect(chatbar_panel, chatbar_panel->getRect());
}
// </FS:Ansariel>
// optionally forward warnings to chat console/chat floater
// for qa runs and dev builds
#if !LL_RELEASE_FOR_DOWNLOAD