summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2010-12-28 13:15:07 -0800
committerMerov Linden <merov@lindenlab.com>2010-12-28 13:15:07 -0800
commitcc11129afb3e79b7034059e6a09ec698584befa6 (patch)
tree972b738dd42d8c3139d19fef8eb971fa0b48398f
parent76e70a0da6f8f1db50de6a26fb6845a3b561adea (diff)
parentf644ef0fb00aa622cb132553bc33d38f8b454ecd (diff)
STORM-682 : pull into viewer-development
-rw-r--r--indra/newview/llimfloater.cpp11
-rw-r--r--indra/newview/llimfloater.h2
-rw-r--r--indra/newview/llscreenchannel.cpp15
-rw-r--r--indra/newview/llscreenchannel.h2
-rw-r--r--indra/newview/llsidetray.cpp29
-rw-r--r--indra/newview/llsidetray.h15
-rw-r--r--indra/newview/llviewerwindow.h5
7 files changed, 45 insertions, 34 deletions
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index bdc0dfa7e2..f74ae92a7b 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -470,7 +470,7 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id)
}
//static
-bool LLIMFloater::resetAllowedRectPadding(const LLSD& newvalue)
+bool LLIMFloater::resetAllowedRectPadding()
{
//reset allowed rect right padding if "SidebarCameraMovement" option
//or sidebar state changed
@@ -482,10 +482,10 @@ void LLIMFloater::getAllowedRect(LLRect& rect)
{
if (sAllowedRectRightPadding == RECT_PADDING_NOT_INIT) //wasn't initialized
{
- gSavedSettings.getControl("SidebarCameraMovement")->getSignal()->connect(boost::bind(&LLIMFloater::resetAllowedRectPadding, _2));
+ gSavedSettings.getControl("SidebarCameraMovement")->getSignal()->connect(boost::bind(&LLIMFloater::resetAllowedRectPadding));
LLSideTray* side_bar = LLSideTray::getInstance();
- side_bar->getCollapseSignal().connect(boost::bind(&LLIMFloater::resetAllowedRectPadding, _2));
+ side_bar->setVisibleWidthChangeCallback(boost::bind(&LLIMFloater::resetAllowedRectPadding));
sAllowedRectRightPadding = RECT_PADDING_NEED_RECALC;
}
@@ -500,10 +500,7 @@ void LLIMFloater::getAllowedRect(LLRect& rect)
if (gSavedSettings.getBOOL("SidebarCameraMovement") == FALSE)
{
- LLSideTray* side_bar = LLSideTray::getInstance();
-
- if (side_bar->getVisible() && !side_bar->getCollapsed())
- sAllowedRectRightPadding += side_bar->getRect().getWidth();
+ sAllowedRectRightPadding += LLSideTray::getInstance()->getVisibleWidth();
}
}
rect.mRight -= sAllowedRectRightPadding;
diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h
index e80e45e64a..5158f6c1f7 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -156,7 +156,7 @@ private:
static void closeHiddenIMToasts();
- static bool resetAllowedRectPadding(const LLSD& newvalue);
+ static bool resetAllowedRectPadding();
//need to keep this static for performance issues
static S32 sAllowedRectRightPadding;
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp
index 80c78a50c9..e3bc67a414 100644
--- a/indra/newview/llscreenchannel.cpp
+++ b/indra/newview/llscreenchannel.cpp
@@ -83,11 +83,10 @@ bool LLScreenChannelBase::isHovering()
return mHoveredToast->isHovered();
}
-bool LLScreenChannelBase::resetPositionAndSize(const LLSD& newvalue)
+void LLScreenChannelBase::resetPositionAndSize()
{
LLRect rc = gViewerWindow->getWorldViewRectScaled();
updatePositionAndSize(rc, rc);
- return true;
}
void LLScreenChannelBase::updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect)
@@ -99,10 +98,7 @@ void LLScreenChannelBase::updatePositionAndSize(LLRect old_world_rect, LLRect ne
if (gSavedSettings.getBOOL("SidebarCameraMovement") == FALSE
&& LLSideTray::instanceCreated ())
{
- LLSideTray* side_bar = LLSideTray::getInstance();
-
- if (side_bar->getVisible() && !side_bar->getCollapsed())
- world_rect_padding += side_bar->getRect().getWidth();
+ world_rect_padding += LLSideTray::getInstance()->getVisibleWidth();
}
@@ -133,7 +129,7 @@ void LLScreenChannelBase::init(S32 channel_left, S32 channel_right)
if(LLSideTray::instanceCreated())
{
LLSideTray* side_bar = LLSideTray::getInstance();
- side_bar->getCollapseSignal().connect(boost::bind(&LLScreenChannelBase::resetPositionAndSize, this, _2));
+ side_bar->setVisibleWidthChangeCallback(boost::bind(&LLScreenChannelBase::resetPositionAndSize, this));
}
// top and bottom set by updateBottom()
@@ -214,10 +210,7 @@ void LLScreenChannel::updatePositionAndSize(LLRect old_world_rect, LLRect new_wo
if (gSavedSettings.getBOOL("SidebarCameraMovement") == FALSE
&& LLSideTray::instanceCreated ())
{
- LLSideTray* side_bar = LLSideTray::getInstance();
-
- if (side_bar->getVisible() && !side_bar->getCollapsed())
- world_rect_padding += side_bar->getRect().getWidth();
+ world_rect_padding += LLSideTray::getInstance()->getVisibleWidth();
}
diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h
index c536a21779..d207d13981 100644
--- a/indra/newview/llscreenchannel.h
+++ b/indra/newview/llscreenchannel.h
@@ -59,8 +59,8 @@ public:
// Channel's outfit-functions
// update channel's size and position in the World View
virtual void updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect);
+ void resetPositionAndSize();
- bool resetPositionAndSize(const LLSD& newvalue);
// initialization of channel's shape and position
virtual void init(S32 channel_left, S32 channel_right);
diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp
index 3bc3959e0b..aef665a35c 100644
--- a/indra/newview/llsidetray.cpp
+++ b/indra/newview/llsidetray.cpp
@@ -561,7 +561,7 @@ BOOL LLSideTray::postBuild()
{
if ((*it).channel)
{
- getCollapseSignal().connect(boost::bind(&LLScreenChannelBase::resetPositionAndSize, (*it).channel, _2));
+ setVisibleWidthChangeCallback(boost::bind(&LLScreenChannelBase::resetPositionAndSize, (*it).channel));
}
}
@@ -980,9 +980,6 @@ void LLSideTray::reflectCollapseChange()
}
gFloaterView->refresh();
-
- LLSD new_value = mCollapsed;
- mCollapseSignal(this,new_value);
}
void LLSideTray::arrange()
@@ -1262,9 +1259,29 @@ bool LLSideTray::isPanelActive(const std::string& panel_name)
void LLSideTray::updateSidetrayVisibility()
{
// set visibility of parent container based on collapsed state
- if (getParent())
+ LLView* parent = getParent();
+ if (parent)
{
- getParent()->setVisible(!mCollapsed && !gAgentCamera.cameraMouselook());
+ bool old_visibility = parent->getVisible();
+ bool new_visibility = !mCollapsed && !gAgentCamera.cameraMouselook();
+
+ if (old_visibility != new_visibility)
+ {
+ parent->setVisible(new_visibility);
+
+ // Signal change of visible width.
+ llinfos << "Visible: " << new_visibility << llendl;
+ mVisibleWidthChangeSignal(this, new_visibility);
+ }
}
}
+S32 LLSideTray::getVisibleWidth()
+{
+ return (isInVisibleChain() && !mCollapsed) ? getRect().getWidth() : 0;
+}
+
+void LLSideTray::setVisibleWidthChangeCallback(const commit_signal_t::slot_type& cb)
+{
+ mVisibleWidthChangeSignal.connect(cb);
+}
diff --git a/indra/newview/llsidetray.h b/indra/newview/llsidetray.h
index 3c572dde95..184d78845f 100644
--- a/indra/newview/llsidetray.h
+++ b/indra/newview/llsidetray.h
@@ -165,9 +165,18 @@ public:
void reshape (S32 width, S32 height, BOOL called_from_parent = TRUE);
- void updateSidetrayVisibility();
+ /**
+ * @return side tray width if it's visible and expanded, 0 otherwise.
+ *
+ * Not that width of the tab buttons is not included.
+ *
+ * @see setVisibleWidthChangeCallback()
+ */
+ S32 getVisibleWidth();
+
+ void setVisibleWidthChangeCallback(const commit_signal_t::slot_type& cb);
- commit_signal_t& getCollapseSignal() { return mCollapseSignal; }
+ void updateSidetrayVisibility();
void handleLoginComplete();
@@ -216,7 +225,7 @@ private:
tab_order_vector_t mOriginalTabOrder;
LLSideTrayTab* mActiveTab;
- commit_signal_t mCollapseSignal;
+ commit_signal_t mVisibleWidthChangeSignal;
LLButton* mCollapseButton;
bool mCollapsed;
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index b8fd944321..5eeb02b080 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -186,11 +186,6 @@ public:
/*virtual*/ std::string translateString(const char* tag,
const std::map<std::string, std::string>& args);
- // signal on bottom tray width changed
- typedef boost::function<void (void)> bottom_tray_callback_t;
- typedef boost::signals2::signal<void (void)> bottom_tray_signal_t;
- bottom_tray_signal_t mOnBottomTrayWidthChanged;
- boost::signals2::connection setOnBottomTrayWidthChanged(bottom_tray_callback_t cb) { return mOnBottomTrayWidthChanged.connect(cb); }
// signal on update of WorldView rect
typedef boost::function<void (LLRect old_world_rect, LLRect new_world_rect)> world_rect_callback_t;
typedef boost::signals2::signal<void (LLRect old_world_rect, LLRect new_world_rect)> world_rect_signal_t;