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.cpp61
1 files changed, 40 insertions, 21 deletions
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 6db9f64a97..1c59938f90 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -86,10 +86,6 @@ void LLLayoutPanel::initFromParams(const Params& p)
LLLayoutPanel::~LLLayoutPanel()
{
- // probably not necessary, but...
- delete mResizeBar;
- mResizeBar = NULL;
-
gFocusMgr.removeKeyboardFocusWithoutCallback(this);
}
@@ -131,7 +127,7 @@ void LLLayoutPanel::setTargetDim(S32 value)
S32 LLLayoutPanel::getVisibleDim() const
{
- F32 min_dim = getRelevantMinDim();
+ F32 min_dim = (F32)getRelevantMinDim();
return ll_round(mVisibleAmt
* (min_dim
+ (((F32)mTargetDim - min_dim) * (1.f - mCollapseAmt))));
@@ -209,7 +205,7 @@ LLLayoutStack::Params::Params()
open_time_constant("open_time_constant", 0.02f),
close_time_constant("close_time_constant", 0.03f),
resize_bar_overlap("resize_bar_overlap", 1),
- border_size("border_size", LLCachedControl<S32>(*LLUI::getInstance()->mSettingGroups["config"], "UIResizeBarHeight", 0)),
+ border_size("border_size", LLUI::getInstance()->mSettingGroups["config"]->getS32("UIResizeBarHeight")),
show_drag_handle("show_drag_handle", false),
drag_handle_first_indent("drag_handle_first_indent", 0),
drag_handle_second_indent("drag_handle_second_indent", 0),
@@ -242,11 +238,9 @@ LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p)
LLLayoutStack::~LLLayoutStack()
{
- e_panel_list_t panels = mPanels; // copy list of panel pointers
- mPanels.clear(); // clear so that removeChild() calls don't cause trouble
- std::for_each(panels.begin(), panels.end(), DeletePointer());
}
+// virtual
void LLLayoutStack::draw()
{
updateLayout();
@@ -284,8 +278,14 @@ void LLLayoutStack::draw()
}
}
+// virtual
void LLLayoutStack::deleteAllChildren()
{
+ for (LLLayoutPanel* p : mPanels)
+ {
+ p->mResizeBar = nullptr;
+ }
+
mPanels.clear();
LLView::deleteAllChildren();
@@ -295,29 +295,47 @@ void LLLayoutStack::deleteAllChildren()
mNeedsLayout = true;
}
+// virtual
void LLLayoutStack::removeChild(LLView* view)
{
- LLLayoutPanel* embedded_panelp = findEmbeddedPanel(dynamic_cast<LLPanel*>(view));
-
- if (embedded_panelp)
+ if (LLLayoutPanel* embedded_panelp = dynamic_cast<LLLayoutPanel*>(view))
{
- mPanels.erase(std::find(mPanels.begin(), mPanels.end(), embedded_panelp));
- LLView::removeChild(view);
- updateFractionalSizes();
- mNeedsLayout = true;
+ auto it = std::find(mPanels.begin(), mPanels.end(), embedded_panelp);
+ if (it != mPanels.end())
+ {
+ mPanels.erase(it);
+ }
+ if (embedded_panelp->mResizeBar)
+ {
+ LLView::removeChild(embedded_panelp->mResizeBar);
+ embedded_panelp->mResizeBar = nullptr;
+ }
}
- else
+ else if (LLResizeBar* resize_bar = dynamic_cast<LLResizeBar*>(view))
{
- LLView::removeChild(view);
+ for (LLLayoutPanel* p : mPanels)
+ {
+ if (p->mResizeBar == resize_bar)
+ {
+ p->mResizeBar = nullptr;
+ }
+ }
}
+
+ LLView::removeChild(view);
+
+ updateFractionalSizes();
+ mNeedsLayout = true;
}
+// virtual
bool LLLayoutStack::postBuild()
{
updateLayout();
return true;
}
+// virtual
bool LLLayoutStack::addChild(LLView* child, S32 tab_group)
{
LLLayoutPanel* panelp = dynamic_cast<LLLayoutPanel*>(child);
@@ -445,7 +463,7 @@ void LLLayoutStack::updateLayout()
for (LLLayoutPanel* panelp : mPanels)
{
- F32 panel_dim = llmax(panelp->getExpandedMinDim(), panelp->mTargetDim);
+ F32 panel_dim = (F32)llmax(panelp->getExpandedMinDim(), panelp->mTargetDim);
LLRect panel_rect;
if (mOrientation == HORIZONTAL)
@@ -465,7 +483,7 @@ void LLLayoutStack::updateLayout()
LLRect resize_bar_rect(panel_rect);
F32 panel_spacing = (F32)mPanelSpacing * panelp->getVisibleAmount();
- F32 panel_visible_dim = panelp->getVisibleDim();
+ F32 panel_visible_dim = (F32)panelp->getVisibleDim();
S32 panel_spacing_round = (S32)(ll_round(panel_spacing));
if (mOrientation == HORIZONTAL)
@@ -548,7 +566,7 @@ LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const
return NULL;
}
-LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) const
+LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(std::string_view name) const
{
LLLayoutPanel* result = NULL;
@@ -983,6 +1001,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect&
//normalizeFractionalSizes();
}
+// virtual
void LLLayoutStack::reshape(S32 width, S32 height, bool called_from_parent)
{
mNeedsLayout = true;