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.cpp58
1 files changed, 36 insertions, 22 deletions
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 7b22f9dbdc..2769a96875 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -216,7 +216,8 @@ LLLayoutStack::Params::Params()
drag_handle_first_indent("drag_handle_first_indent", 0),
drag_handle_second_indent("drag_handle_second_indent", 0),
drag_handle_thickness("drag_handle_thickness", 5),
- drag_handle_shift("drag_handle_shift", 2)
+ drag_handle_shift("drag_handle_shift", 2),
+ drag_handle_color("drag_handle_color", LLUIColorTable::instance().getColor("ResizebarBody"))
{
addSynonym(border_size, "drag_handle_gap");
}
@@ -236,7 +237,8 @@ LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p)
mDragHandleFirstIndent(p.drag_handle_first_indent),
mDragHandleSecondIndent(p.drag_handle_second_indent),
mDragHandleThickness(p.drag_handle_thickness),
- mDragHandleShift(p.drag_handle_shift)
+ mDragHandleShift(p.drag_handle_shift),
+ mDragHandleColor(p.drag_handle_color())
{
}
@@ -393,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)
{
@@ -407,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)
{
@@ -425,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;
@@ -441,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);
@@ -523,11 +527,20 @@ void LLLayoutStack::updateLayout()
mNeedsLayout = continue_animating;
} // end LLLayoutStack::updateLayout
+void LLLayoutStack::setPanelSpacing(S32 val)
+{
+ if (mPanelSpacing != val)
+ {
+ mPanelSpacing = val;
+ mNeedsLayout = true;
+ }
+}
+
LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const
{
if (!panelp) return NULL;
- BOOST_FOREACH(LLLayoutPanel* p, mPanels)
+ for (LLLayoutPanel* p : mPanels)
{
if (p == panelp)
{
@@ -541,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)
{
@@ -555,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)
{
@@ -576,7 +589,7 @@ void LLLayoutStack::createResizeBar(LLLayoutPanel* panelp)
resize_bar_bg_panel_p.follows.flags = FOLLOWS_ALL;
resize_bar_bg_panel_p.tab_stop = false;
resize_bar_bg_panel_p.background_visible = true;
- resize_bar_bg_panel_p.bg_alpha_color = LLUIColorTable::instance().getColor("ResizebarBody");
+ resize_bar_bg_panel_p.bg_alpha_color = mDragHandleColor;
resize_bar_bg_panel_p.has_border = true;
resize_bar_bg_panel_p.border.border_thickness = 1;
resize_bar_bg_panel_p.border.highlight_light_color = LLUIColorTable::instance().getColor("ResizebarBorderLight");
@@ -658,7 +671,7 @@ void LLLayoutStack::updateFractionalSizes()
{
F32 total_resizable_dim = 0.f;
- BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+ for (LLLayoutPanel* panelp : mPanels)
{
if (panelp->mAutoResize)
{
@@ -666,7 +679,7 @@ void LLLayoutStack::updateFractionalSizes()
}
}
- BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+ for (LLLayoutPanel* panelp : mPanels)
{
if (panelp->mAutoResize)
{
@@ -687,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)
{
@@ -698,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)
{
@@ -708,7 +721,7 @@ void LLLayoutStack::normalizeFractionalSizes()
}
else
{ // renormalize
- BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+ for (LLLayoutPanel* panelp : mPanels)
{
if (panelp->mAutoResize)
{
@@ -725,7 +738,7 @@ bool LLLayoutStack::animatePanels()
//
// animate visibility
//
- BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+ for (LLLayoutPanel* panelp : mPanels)
{
if (panelp->getVisible())
{
@@ -823,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)
{
@@ -872,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)
{
@@ -963,6 +976,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect&
MIN_FRACTIONAL_SIZE,
MAX_FRACTIONAL_SIZE);
}
+ break;
default:
break;
}
@@ -979,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)
{