summaryrefslogtreecommitdiff
path: root/indra/llui/lllayoutstack.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/lllayoutstack.cpp')
-rw-r--r--indra/llui/lllayoutstack.cpp41
1 files changed, 22 insertions, 19 deletions
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 7e4e828a88..2769a96875 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -395,8 +395,7 @@ void LLLayoutStack::updateLayout()
: getRect().getHeight();
// first, assign minimum dimensions
- LLLayoutPanel* panelp = NULL;
- BOOST_FOREACH(panelp, mPanels)
+ for (LLLayoutPanel* panelp : mPanels)
{
if (panelp->mAutoResize)
{
@@ -409,12 +408,15 @@ void LLLayoutStack::updateLayout()
llassert(total_visible_fraction < 1.05f);
// don't need spacing after last panel
- space_to_distribute += panelp ? ll_round((F32)mPanelSpacing * panelp->getVisibleAmount()) : 0;
+ if (!mPanels.empty())
+ {
+ space_to_distribute += ll_round(F32(mPanelSpacing) * mPanels.back()->getVisibleAmount());
+ }
S32 remaining_space = space_to_distribute;
if (space_to_distribute > 0 && total_visible_fraction > 0.f)
{ // give space proportionally to visible auto resize panels
- BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+ for (LLLayoutPanel* panelp : mPanels)
{
if (panelp->mAutoResize)
{
@@ -427,7 +429,7 @@ void LLLayoutStack::updateLayout()
}
// distribute any left over pixels to non-collapsed, visible panels
- BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+ for (LLLayoutPanel* panelp : mPanels)
{
if (remaining_space == 0) break;
@@ -443,7 +445,7 @@ void LLLayoutStack::updateLayout()
F32 cur_pos = (mOrientation == HORIZONTAL) ? 0.f : (F32)getRect().getHeight();
- BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+ for (LLLayoutPanel* panelp : mPanels)
{
F32 panel_dim = llmax(panelp->getExpandedMinDim(), panelp->mTargetDim);
@@ -538,7 +540,7 @@ LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const
{
if (!panelp) return NULL;
- BOOST_FOREACH(LLLayoutPanel* p, mPanels)
+ for (LLLayoutPanel* p : mPanels)
{
if (p == panelp)
{
@@ -552,7 +554,7 @@ LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) c
{
LLLayoutPanel* result = NULL;
- BOOST_FOREACH(LLLayoutPanel* p, mPanels)
+ for (LLLayoutPanel* p : mPanels)
{
if (p->getName() == name)
{
@@ -566,7 +568,7 @@ LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) c
void LLLayoutStack::createResizeBar(LLLayoutPanel* panelp)
{
- BOOST_FOREACH(LLLayoutPanel* lp, mPanels)
+ for (LLLayoutPanel* lp : mPanels)
{
if (lp->mResizeBar == NULL)
{
@@ -669,7 +671,7 @@ void LLLayoutStack::updateFractionalSizes()
{
F32 total_resizable_dim = 0.f;
- BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+ for (LLLayoutPanel* panelp : mPanels)
{
if (panelp->mAutoResize)
{
@@ -677,7 +679,7 @@ void LLLayoutStack::updateFractionalSizes()
}
}
- BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+ for (LLLayoutPanel* panelp : mPanels)
{
if (panelp->mAutoResize)
{
@@ -698,7 +700,7 @@ void LLLayoutStack::normalizeFractionalSizes()
S32 num_auto_resize_panels = 0;
F32 total_fractional_size = 0.f;
- BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+ for (LLLayoutPanel* panelp : mPanels)
{
if (panelp->mAutoResize)
{
@@ -709,7 +711,7 @@ void LLLayoutStack::normalizeFractionalSizes()
if (total_fractional_size == 0.f)
{ // equal distribution
- BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+ for (LLLayoutPanel* panelp : mPanels)
{
if (panelp->mAutoResize)
{
@@ -719,7 +721,7 @@ void LLLayoutStack::normalizeFractionalSizes()
}
else
{ // renormalize
- BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+ for (LLLayoutPanel* panelp : mPanels)
{
if (panelp->mAutoResize)
{
@@ -736,7 +738,7 @@ bool LLLayoutStack::animatePanels()
//
// animate visibility
//
- BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+ for (LLLayoutPanel* panelp : mPanels)
{
if (panelp->getVisible())
{
@@ -834,7 +836,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect&
LLLayoutPanel* other_resize_panel = NULL;
LLLayoutPanel* following_panel = NULL;
- BOOST_REVERSE_FOREACH(LLLayoutPanel* panelp, mPanels)
+ BOOST_REVERSE_FOREACH(LLLayoutPanel* panelp, mPanels) // Should replace this when C++20 reverse view adaptor becomes available...
{
if (panelp->mAutoResize)
{
@@ -883,7 +885,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect&
AFTER_RESIZED_PANEL
} which_panel = BEFORE_RESIZED_PANEL;
- BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+ for (LLLayoutPanel* panelp : mPanels)
{
if (!panelp->getVisible() || panelp->mCollapsed)
{
@@ -974,6 +976,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect&
MIN_FRACTIONAL_SIZE,
MAX_FRACTIONAL_SIZE);
}
+ break;
default:
break;
}
@@ -990,8 +993,8 @@ void LLLayoutStack::reshape(S32 width, S32 height, BOOL called_from_parent)
void LLLayoutStack::updateResizeBarLimits()
{
- LLLayoutPanel* previous_visible_panelp = NULL;
- BOOST_REVERSE_FOREACH(LLLayoutPanel* visible_panelp, mPanels)
+ LLLayoutPanel* previous_visible_panelp{ nullptr };
+ BOOST_REVERSE_FOREACH(LLLayoutPanel* visible_panelp, mPanels) // Should replace this when C++20 reverse view adaptor becomes available...
{
if (!visible_panelp->getVisible() || visible_panelp->mCollapsed)
{