summaryrefslogtreecommitdiff
path: root/indra/newview/llimfloater.cpp
diff options
context:
space:
mode:
authorYuri Chebotarev <ychebotarev@productengine.com>2010-06-04 13:57:19 +0300
committerYuri Chebotarev <ychebotarev@productengine.com>2010-06-04 13:57:19 +0300
commit9345f01d4b61f857ed540cf725c8cd0ee1b0ef24 (patch)
tree20a783017fb83fd55c161b65533d532940938826 /indra/newview/llimfloater.cpp
parent68d729dfe2c63a931c52b0f49a92bf18a270ff52 (diff)
EXT-7547 FIX update allowing padding according to sidebar state
reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/492/ --HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llimfloater.cpp')
-rw-r--r--indra/newview/llimfloater.cpp39
1 files changed, 35 insertions, 4 deletions
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 3aa9d75bc0..967f38bfd2 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -60,8 +60,14 @@
#include "llinventorymodel.h"
#include "llrootview.h"
#include "llspeakers.h"
+#include "llsidetray.h"
+static const S32 RECT_PADDING_NOT_INIT = -1;
+static const S32 RECT_PADDING_NEED_RECALC = -2;
+
+S32 LLIMFloater::sAllowedRectRightPadding = RECT_PADDING_NOT_INIT;
+
LLIMFloater::LLIMFloater(const LLUUID& session_id)
: LLTransientDockableFloater(NULL, true, session_id),
mControlPanel(NULL),
@@ -444,19 +450,44 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id)
return floater;
}
+//static
+bool LLIMFloater::resetAllowedRectPadding(const LLSD& newvalue)
+{
+ //reset allowed rect right padding if "SidebarCameraMovement" option
+ //or sidebar state changed
+ sAllowedRectRightPadding = RECT_PADDING_NEED_RECALC ;
+ return true;
+}
+
void LLIMFloater::getAllowedRect(LLRect& rect)
{
+ if (sAllowedRectRightPadding == RECT_PADDING_NOT_INIT) //wasn't initialized
+ {
+ gSavedSettings.getControl("SidebarCameraMovement")->getSignal()->connect(boost::bind(&LLIMFloater::resetAllowedRectPadding, _2));
+
+ LLSideTray* side_bar = LLSideTray::getInstance();
+ side_bar->getCollapseSignal().connect(boost::bind(&LLIMFloater::resetAllowedRectPadding, _2));
+ sAllowedRectRightPadding = RECT_PADDING_NEED_RECALC;
+ }
+
rect = gViewerWindow->getWorldViewRectScaled();
- static S32 right_padding = 0;
- if (right_padding == 0)
+ if (sAllowedRectRightPadding == RECT_PADDING_NEED_RECALC) //recalc allowed rect right padding
{
LLPanel* side_bar_tabs =
gViewerWindow->getRootView()->getChild<LLPanel> (
"side_bar_tabs");
- right_padding = side_bar_tabs->getRect().getWidth();
+ sAllowedRectRightPadding = side_bar_tabs->getRect().getWidth();
LLTransientFloaterMgr::getInstance()->addControlView(side_bar_tabs);
+
+ if (gSavedSettings.getBOOL("SidebarCameraMovement") == FALSE)
+ {
+ LLSideTray* side_bar = LLSideTray::getInstance();
+
+ if (side_bar->getVisible() && !side_bar->getCollapsed())
+ sAllowedRectRightPadding += side_bar->getRect().getWidth();
+ }
}
- rect.mRight -= right_padding;
+ rect.mRight -= sAllowedRectRightPadding;
}
void LLIMFloater::setDocked(bool docked, bool pop_on_undock)