summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llaccordionctrltab.h10
-rw-r--r--indra/llui/llfloater.cpp6
-rw-r--r--indra/llui/lllayoutstack.cpp442
-rw-r--r--indra/llui/lllayoutstack.h76
-rw-r--r--indra/llui/lllineeditor.cpp4
-rw-r--r--indra/llui/llpanel.cpp17
-rw-r--r--indra/llui/llrngwriter.cpp5
-rw-r--r--indra/llui/llscrolllistctrl.cpp6
-rw-r--r--indra/llui/llsdparam.cpp35
-rw-r--r--indra/llui/llsdparam.h16
-rw-r--r--indra/llui/llui.cpp3
-rw-r--r--indra/llui/lluicolortable.cpp6
-rw-r--r--indra/llui/lluictrlfactory.cpp3
-rw-r--r--indra/llui/lluictrlfactory.h6
-rw-r--r--indra/llui/llview.cpp4
-rw-r--r--indra/llui/llview.h6
16 files changed, 278 insertions, 367 deletions
diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h
index 00fb276f19..f87534fa76 100644
--- a/indra/llui/llaccordionctrltab.h
+++ b/indra/llui/llaccordionctrltab.h
@@ -91,10 +91,10 @@ public:
Optional<bool> selection_enabled;
- Optional<S32> padding_left;
- Optional<S32> padding_right;
- Optional<S32> padding_top;
- Optional<S32> padding_bottom;
+ Optional<S32> padding_left,
+ padding_right,
+ padding_top,
+ padding_bottom;
Params();
};
@@ -176,7 +176,7 @@ public:
virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks );
- virtual bool addChild(LLView* child, S32 tab_group);
+ virtual bool addChild(LLView* child, S32 tab_group = 0 );
bool isExpanded() const { return mDisplayChildren; }
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 0cd692b4a4..e7d0950846 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -2780,7 +2780,8 @@ LLFastTimer::DeclareTimer POST_BUILD("Floater Post Build");
bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node)
{
Params params(LLUICtrlFactory::getDefaultParams<LLFloater>());
- LLXUIParser::instance().readXUI(node, params, filename); // *TODO: Error checking
+ LLXUIParser parser;
+ parser.readXUI(node, params, filename); // *TODO: Error checking
if (output_node)
{
@@ -2788,8 +2789,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str
setupParamsForExport(output_params, parent);
Params default_params(LLUICtrlFactory::getDefaultParams<LLFloater>());
output_node->setName(node->getName()->mString);
- LLXUIParser::instance().writeXUI(
- output_node, output_params, &default_params);
+ parser.writeXUI(output_node, output_params, &default_params);
}
// Default floater position to top-left corner of screen
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 4512091371..15a0369eb9 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -41,92 +41,63 @@
#include "llresizebar.h"
#include "llcriticaldamp.h"
-static LLDefaultChildRegistry::Register<LLLayoutStack> register_layout_stack("layout_stack", &LLLayoutStack::fromXML);
-
+static LLDefaultChildRegistry::Register<LLLayoutStack> register_layout_stack("layout_stack");
+static LLLayoutStack::LayoutStackRegistry::Register<LLLayoutPanel> register_layout_panel("layout_panel");
//
-// LLLayoutStack
+// LLLayoutPanel
//
-struct LLLayoutStack::LayoutPanel
+LLLayoutPanel::LLLayoutPanel(const Params& p)
+: LLPanel(p),
+ mMinDim(p.min_dim),
+ mMaxDim(p.max_dim),
+ mAutoResize(p.auto_resize),
+ mUserResize(p.user_resize),
+ mCollapsed(FALSE),
+ mCollapseAmt(0.f),
+ mVisibleAmt(1.f), // default to fully visible
+ mResizeBar(NULL)
{
- LayoutPanel(LLPanel* panelp, ELayoutOrientation orientation, S32 min_width, S32 min_height, S32 max_width, S32 max_height, BOOL auto_resize, BOOL user_resize) : mPanel(panelp),
- mMinWidth(min_width),
- mMinHeight(min_height),
- mMaxWidth(max_width),
- mMaxHeight(max_height),
- mAutoResize(auto_resize),
- mUserResize(user_resize),
- mOrientation(orientation),
- mCollapsed(FALSE),
- mCollapseAmt(0.f),
- mVisibleAmt(1.f), // default to fully visible
- mResizeBar(NULL)
+ // panels initialized as hidden should not start out partially visible
+ if (!getVisible())
{
- LLResizeBar::Side side = (orientation == HORIZONTAL) ? LLResizeBar::RIGHT : LLResizeBar::BOTTOM;
- LLRect resize_bar_rect = panelp->getRect();
-
- S32 min_dim;
- if (orientation == HORIZONTAL)
- {
- min_dim = mMinHeight;
- }
- else
- {
- min_dim = mMinWidth;
- }
- LLResizeBar::Params p;
- p.name("resize");
- p.resizing_view(mPanel);
- p.min_size(min_dim);
- p.side(side);
- p.snapping_enabled(false);
- mResizeBar = LLUICtrlFactory::create<LLResizeBar>(p);
- // panels initialized as hidden should not start out partially visible
- if (!mPanel->getVisible())
- {
- mVisibleAmt = 0.f;
- }
+ mVisibleAmt = 0.f;
}
+}
- ~LayoutPanel()
- {
- // probably not necessary, but...
- delete mResizeBar;
- mResizeBar = NULL;
- }
+void LLLayoutPanel::initFromParams(const Params& p)
+{
+ LLPanel::initFromParams(p);
+ setFollowsNone();
+}
+
+
+LLLayoutPanel::~LLLayoutPanel()
+{
+ // probably not necessary, but...
+ delete mResizeBar;
+ mResizeBar = NULL;
+}
- F32 getCollapseFactor()
+F32 LLLayoutPanel::getCollapseFactor(LLLayoutStack::ELayoutOrientation orientation)
+{
+ if (orientation == LLLayoutStack::HORIZONTAL)
{
- if (mOrientation == HORIZONTAL)
- {
- F32 collapse_amt =
- clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, (F32)mMinWidth / (F32)llmax(1, mPanel->getRect().getWidth()));
- return mVisibleAmt * collapse_amt;
- }
- else
+ F32 collapse_amt =
+ clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, (F32)mMinDim / (F32)llmax(1, getRect().getWidth()));
+ return mVisibleAmt * collapse_amt;
+ }
+ else
{
- F32 collapse_amt =
- clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, llmin(1.f, (F32)mMinHeight / (F32)llmax(1, mPanel->getRect().getHeight())));
- return mVisibleAmt * collapse_amt;
- }
+ F32 collapse_amt =
+ clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, llmin(1.f, (F32)mMinDim / (F32)llmax(1, getRect().getHeight())));
+ return mVisibleAmt * collapse_amt;
}
+}
- LLPanel* mPanel;
- S32 mMinWidth;
- S32 mMinHeight;
-
- // mMaxWidth & mMaxHeight are added to make configurable max width of the nearby chat bar. EXT-5589
- // they are not processed by LLLayoutStack but they can be if necessary
- S32 mMaxWidth;
- S32 mMaxHeight;
- BOOL mAutoResize;
- BOOL mUserResize;
- BOOL mCollapsed;
- LLResizeBar* mResizeBar;
- ELayoutOrientation mOrientation;
- F32 mVisibleAmt;
- F32 mCollapseAmt;
-};
+//
+// LLLayoutStack
+//
LLLayoutStack::Params::Params()
: orientation("orientation", std::string("vertical")),
@@ -163,18 +134,18 @@ void LLLayoutStack::draw()
for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
// clip to layout rectangle, not bounding rectangle
- LLRect clip_rect = (*panel_it)->mPanel->getRect();
+ LLRect clip_rect = (*panel_it)->getRect();
// scale clipping rectangle by visible amount
if (mOrientation == HORIZONTAL)
{
- clip_rect.mRight = clip_rect.mLeft + llround((F32)clip_rect.getWidth() * (*panel_it)->getCollapseFactor());
+ clip_rect.mRight = clip_rect.mLeft + llround((F32)clip_rect.getWidth() * (*panel_it)->getCollapseFactor(mOrientation));
}
else
{
- clip_rect.mBottom = clip_rect.mTop - llround((F32)clip_rect.getHeight() * (*panel_it)->getCollapseFactor());
+ clip_rect.mBottom = clip_rect.mTop - llround((F32)clip_rect.getHeight() * (*panel_it)->getCollapseFactor(mOrientation));
}
- LLPanel* panelp = (*panel_it)->mPanel;
+ LLPanel* panelp = (*panel_it);
LLLocalClipRect clip(clip_rect, mClip);
// only force drawing invisible children if visible amount is non-zero
@@ -185,7 +156,7 @@ void LLLayoutStack::draw()
void LLLayoutStack::removeChild(LLView* view)
{
- LayoutPanel* embedded_panelp = findEmbeddedPanel(dynamic_cast<LLPanel*>(view));
+ LLLayoutPanel* embedded_panelp = findEmbeddedPanel(dynamic_cast<LLPanel*>(view));
if (embedded_panelp)
{
@@ -206,149 +177,16 @@ BOOL LLLayoutStack::postBuild()
return TRUE;
}
-static void get_attribute_s32_and_write(LLXMLNodePtr node,
- const char* name,
- S32 *value,
- S32 default_value,
- LLXMLNodePtr output_child)
-{
- BOOL has_attr = node->getAttributeS32(name, *value);
- if (has_attr && *value != default_value && output_child)
- {
- // create an attribute child node
- LLXMLNodePtr child_attr = output_child->createChild(name, TRUE);
- child_attr->setIntValue(*value);
- }
-}
-
-static void get_attribute_bool_and_write(LLXMLNodePtr node,
- const char* name,
- BOOL *value,
- BOOL default_value,
- LLXMLNodePtr output_child)
+bool LLLayoutStack::addChild(LLView* child, S32 tab_group)
{
- BOOL has_attr = node->getAttributeBOOL(name, *value);
- if (has_attr && *value != default_value && output_child)
+ LLLayoutPanel* panelp = dynamic_cast<LLLayoutPanel*>(child);
+ if (panelp)
{
- LLXMLNodePtr child_attr = output_child->createChild(name, TRUE);
- child_attr->setBoolValue(*value);
+ mPanels.push_back(panelp);
}
+ return LLView::addChild(child, tab_group);
}
-//static
-LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node)
-{
- LLLayoutStack::Params p(LLUICtrlFactory::getDefaultParams<LLLayoutStack>());
- LLXUIParser::instance().readXUI(node, p, LLUICtrlFactory::getInstance()->getCurFileName());
- // Export must happen before setupParams() mungles rectangles and before
- // this item gets added to parent (otherwise screws up last_child_rect
- // logic). JC
- if (output_node)
- {
- Params output_params(p);
- setupParamsForExport(output_params, parent);
- LLLayoutStack::Params default_params(LLUICtrlFactory::getDefaultParams<LLLayoutStack>());
- output_node->setName(node->getName()->mString);
- LLXUIParser::instance().writeXUI(
- output_node, output_params, &default_params);
- }
-
- p.from_xui = true;
- applyXUILayout(p, parent);
- LLLayoutStack* layout_stackp = LLUICtrlFactory::create<LLLayoutStack>(p);
-
- if (parent && layout_stackp)
- {
- S32 tab_group = p.tab_group.isProvided() ? p.tab_group() : parent->getLastTabGroup();
-
- parent->addChild(layout_stackp, tab_group);
- }
-
- for (LLXMLNodePtr child_node = node->getFirstChild(); child_node.notNull(); child_node = child_node->getNextSibling())
- {
- const S32 DEFAULT_MIN_WIDTH = 0;
- const S32 DEFAULT_MIN_HEIGHT = 0;
- const S32 DEFAULT_MAX_WIDTH = S32_MAX;
- const S32 DEFAULT_MAX_HEIGHT = S32_MAX;
- const BOOL DEFAULT_AUTO_RESIZE = TRUE;
-
- S32 min_width = DEFAULT_MIN_WIDTH;
- S32 min_height = DEFAULT_MIN_HEIGHT;
- S32 max_width = DEFAULT_MAX_WIDTH;
- S32 max_height = DEFAULT_MAX_HEIGHT;
- BOOL auto_resize = DEFAULT_AUTO_RESIZE;
-
- LLXMLNodePtr output_child;
- if (output_node)
- {
- output_child = output_node->createChild("", FALSE);
- }
-
- // Layout stack allows child nodes to acquire additional attributes,
- // such as "min_width" in: <button label="Foo" min_width="100"/>
- // If these attributes exist and have non-default values, write them
- // to the output node.
- get_attribute_s32_and_write(child_node, "min_width", &min_width,
- DEFAULT_MIN_WIDTH, output_child);
- get_attribute_s32_and_write(child_node, "min_height", &min_height,
- DEFAULT_MIN_HEIGHT, output_child);
- get_attribute_s32_and_write(child_node, "max_width", &max_width,
- DEFAULT_MAX_WIDTH, output_child);
- get_attribute_s32_and_write(child_node, "max_height", &max_height,
- DEFAULT_MAX_HEIGHT, output_child);
- get_attribute_bool_and_write(child_node, "auto_resize", &auto_resize,
- DEFAULT_AUTO_RESIZE, output_child);
-
- if (child_node->hasName("layout_panel"))
- {
- BOOL user_resize = TRUE;
- get_attribute_bool_and_write(child_node, "user_resize", &user_resize,
- TRUE, output_child);
- LLPanel* panelp = (LLPanel*)LLPanel::fromXML(child_node, layout_stackp, output_child);
- if (panelp)
- {
- panelp->setFollowsNone();
- layout_stackp->addPanel(panelp, min_width, min_height, max_width, max_height, auto_resize, user_resize);
- }
- }
- else
- {
- BOOL user_resize = FALSE;
- get_attribute_bool_and_write(child_node, "user_resize", &user_resize,
- FALSE, output_child);
-
- LLPanel::Params p;
- p.mouse_opaque(false);
- LLPanel* panelp = LLUICtrlFactory::create<LLPanel>(p);
- LLView* new_child = LLUICtrlFactory::getInstance()->createFromXML(child_node, panelp, LLStringUtil::null, LLPanel::child_registry_t::instance(), output_child);
- if (new_child)
- {
- // put child in new embedded panel
- layout_stackp->addPanel(panelp, min_width, min_height, max_width, max_height, auto_resize, user_resize);
- // resize panel to contain widget and move widget to be contained in panel
- panelp->setRect(new_child->getRect());
- new_child->setOrigin(0, 0);
- }
- else
- {
- panelp->die();
- }
- }
-
- if (output_child && !output_child->mChildren && output_child->mAttributes.empty() && output_child->getValue().empty())
- {
- output_node->deleteChild(output_child);
- }
- }
-
- if (!layout_stackp->postBuild())
- {
- delete layout_stackp;
- return NULL;
- }
-
- return layout_stackp;
-}
S32 LLLayoutStack::getDefaultHeight(S32 cur_height)
{
@@ -374,34 +212,14 @@ S32 LLLayoutStack::getDefaultWidth(S32 cur_width)
return cur_width;
}
-void LLLayoutStack::addPanel(LLPanel* panel, S32 min_width, S32 min_height, S32 max_width, S32 max_height, BOOL auto_resize, BOOL user_resize, EAnimate animate, S32 index)
+void LLLayoutStack::addPanel(LLLayoutPanel* panel, EAnimate animate)
{
- // panel starts off invisible (collapsed)
- if (animate == ANIMATE)
- {
- panel->setVisible(FALSE);
- }
- LayoutPanel* embedded_panel = new LayoutPanel(panel, mOrientation, min_width, min_height, max_width, max_height, auto_resize, user_resize);
-
- mPanels.insert(mPanels.begin() + llclamp(index, 0, (S32)mPanels.size()), embedded_panel);
-
- if (panel->getParent() != this)
- {
- addChild(panel);
- }
- addChild(embedded_panel->mResizeBar);
-
- // bring all resize bars to the front so that they are clickable even over the panels
- // with a bit of overlap
- for (e_panel_list_t::iterator panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
- {
- LLResizeBar* resize_barp = (*panel_it)->mResizeBar;
- sendChildToFront(resize_barp);
- }
+ addChild(panel);
- // start expanding panel animation
+ // panel starts off invisible (collapsed)
if (animate == ANIMATE)
{
+ panel->mVisibleAmt = 0.f;
panel->setVisible(TRUE);
}
}
@@ -413,7 +231,7 @@ void LLLayoutStack::removePanel(LLPanel* panel)
void LLLayoutStack::collapsePanel(LLPanel* panel, BOOL collapsed)
{
- LayoutPanel* panel_container = findEmbeddedPanel(panel);
+ LLLayoutPanel* panel_container = findEmbeddedPanel(panel);
if (!panel_container) return;
panel_container->mCollapsed = collapsed;
@@ -421,7 +239,7 @@ void LLLayoutStack::collapsePanel(LLPanel* panel, BOOL collapsed)
void LLLayoutStack::updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize)
{
- LayoutPanel* panel = findEmbeddedPanelByName(panel_name);
+ LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name);
if (panel)
{
@@ -431,7 +249,7 @@ void LLLayoutStack::updatePanelAutoResize(const std::string& panel_name, BOOL au
void LLLayoutStack::setPanelUserResize(const std::string& panel_name, BOOL user_resize)
{
- LayoutPanel* panel = findEmbeddedPanelByName(panel_name);
+ LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name);
if (panel)
{
@@ -439,27 +257,25 @@ void LLLayoutStack::setPanelUserResize(const std::string& panel_name, BOOL user_
}
}
-bool LLLayoutStack::getPanelMinSize(const std::string& panel_name, S32* min_widthp, S32* min_heightp)
+bool LLLayoutStack::getPanelMinSize(const std::string& panel_name, S32* min_dimp)
{
- LayoutPanel* panel = findEmbeddedPanelByName(panel_name);
+ LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name);
if (panel)
{
- if (min_widthp) *min_widthp = panel->mMinWidth;
- if (min_heightp) *min_heightp = panel->mMinHeight;
+ if (min_dimp) *min_dimp = panel->mMinDim;
}
return NULL != panel;
}
-bool LLLayoutStack::getPanelMaxSize(const std::string& panel_name, S32* max_widthp, S32* max_heightp)
+bool LLLayoutStack::getPanelMaxSize(const std::string& panel_name, S32* max_dimp)
{
- LayoutPanel* panel = findEmbeddedPanelByName(panel_name);
+ LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name);
if (panel)
{
- if (max_widthp) *max_widthp = panel->mMaxWidth;
- if (max_heightp) *max_heightp = panel->mMaxHeight;
+ if (max_dimp) *max_dimp = panel->mMaxDim;
}
return NULL != panel;
@@ -471,6 +287,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
LLFastTimer ft(FTM_UPDATE_LAYOUT);
static LLUICachedControl<S32> resize_bar_overlap ("UIResizeBarOverlap", 0);
calcMinExtents();
+ createResizeBars();
// calculate current extents
S32 total_width = 0;
@@ -482,7 +299,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
e_panel_list_t::iterator panel_it;
for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
- LLPanel* panelp = (*panel_it)->mPanel;
+ LLPanel* panelp = (*panel_it);
if (panelp->getVisible())
{
if (mAnimate)
@@ -532,11 +349,11 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
if (mOrientation == HORIZONTAL)
{
// enforce minimize size constraint by default
- if (panelp->getRect().getWidth() < (*panel_it)->mMinWidth)
+ if (panelp->getRect().getWidth() < (*panel_it)->mMinDim)
{
- panelp->reshape((*panel_it)->mMinWidth, panelp->getRect().getHeight());
+ panelp->reshape((*panel_it)->mMinDim, panelp->getRect().getHeight());
}
- total_width += llround(panelp->getRect().getWidth() * (*panel_it)->getCollapseFactor());
+ total_width += llround(panelp->getRect().getWidth() * (*panel_it)->getCollapseFactor(mOrientation));
// want n-1 panel gaps for n panels
if (panel_it != mPanels.begin())
{
@@ -546,11 +363,11 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
else //VERTICAL
{
// enforce minimize size constraint by default
- if (panelp->getRect().getHeight() < (*panel_it)->mMinHeight)
+ if (panelp->getRect().getHeight() < (*panel_it)->mMinDim)
{
- panelp->reshape(panelp->getRect().getWidth(), (*panel_it)->mMinHeight);
+ panelp->reshape(panelp->getRect().getWidth(), (*panel_it)->mMinDim);
}
- total_height += llround(panelp->getRect().getHeight() * (*panel_it)->getCollapseFactor());
+ total_height += llround(panelp->getRect().getHeight() * (*panel_it)->getCollapseFactor(mOrientation));
if (panel_it != mPanels.begin())
{
total_height += mPanelSpacing;
@@ -564,7 +381,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
// panels that are not fully visible do not count towards shrink headroom
- if ((*panel_it)->getCollapseFactor() < 1.f)
+ if ((*panel_it)->getCollapseFactor(mOrientation) < 1.f)
{
continue;
}
@@ -577,11 +394,11 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
{
if (mOrientation == HORIZONTAL)
{
- shrink_headroom_total += (*panel_it)->mPanel->getRect().getWidth() - (*panel_it)->mMinWidth;
+ shrink_headroom_total += (*panel_it)->getRect().getWidth() - (*panel_it)->mMinDim;
}
else //VERTICAL
{
- shrink_headroom_total += (*panel_it)->mPanel->getRect().getHeight() - (*panel_it)->mMinHeight;
+ shrink_headroom_total += (*panel_it)->getRect().getHeight() - (*panel_it)->mMinDim;
}
}
else
@@ -589,13 +406,13 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
num_resizable_panels++;
if (mOrientation == HORIZONTAL)
{
- shrink_headroom_available += (*panel_it)->mPanel->getRect().getWidth() - (*panel_it)->mMinWidth;
- shrink_headroom_total += (*panel_it)->mPanel->getRect().getWidth() - (*panel_it)->mMinWidth;
+ shrink_headroom_available += (*panel_it)->getRect().getWidth() - (*panel_it)->mMinDim;
+ shrink_headroom_total += (*panel_it)->getRect().getWidth() - (*panel_it)->mMinDim;
}
else //VERTICAL
{
- shrink_headroom_available += (*panel_it)->mPanel->getRect().getHeight() - (*panel_it)->mMinHeight;
- shrink_headroom_total += (*panel_it)->mPanel->getRect().getHeight() - (*panel_it)->mMinHeight;
+ shrink_headroom_available += (*panel_it)->getRect().getHeight() - (*panel_it)->mMinDim;
+ shrink_headroom_total += (*panel_it)->getRect().getHeight() - (*panel_it)->mMinDim;
}
}
}
@@ -618,17 +435,25 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
- LLPanel* panelp = (*panel_it)->mPanel;
+ LLPanel* panelp = (*panel_it);
S32 cur_width = panelp->getRect().getWidth();
S32 cur_height = panelp->getRect().getHeight();
- S32 new_width = llmax((*panel_it)->mMinWidth, cur_width);
- S32 new_height = llmax((*panel_it)->mMinHeight, cur_height);
+ S32 new_width = cur_width;
+ S32 new_height = cur_height;
+ if (mOrientation == HORIZONTAL)
+ {
+ new_width = llmax((*panel_it)->mMinDim, new_width);
+ }
+ else
+ {
+ new_height = llmax((*panel_it)->mMinDim, new_height);
+ }
S32 delta_size = 0;
// if panel can automatically resize (not animating, and resize flag set)...
- if ((*panel_it)->getCollapseFactor() == 1.f
+ if ((*panel_it)->getCollapseFactor(mOrientation) == 1.f
&& (force_resize || (*panel_it)->mAutoResize)
&& !(*panel_it)->mResizeBar->hasMouseCapture())
{
@@ -639,8 +464,8 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
{
// shrink proportionally to amount over minimum
// so we can do this in one pass
- delta_size = (shrink_headroom_available > 0) ? llround((F32)pixels_to_distribute * ((F32)(cur_width - (*panel_it)->mMinWidth) / (F32)shrink_headroom_available)) : 0;
- shrink_headroom_available -= (cur_width - (*panel_it)->mMinWidth);
+ delta_size = (shrink_headroom_available > 0) ? llround((F32)pixels_to_distribute * ((F32)(cur_width - (*panel_it)->mMinDim) / (F32)shrink_headroom_available)) : 0;
+ shrink_headroom_available -= (cur_width - (*panel_it)->mMinDim);
}
else
{
@@ -649,7 +474,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
num_resizable_panels--;
}
pixels_to_distribute -= delta_size;
- new_width = llmax((*panel_it)->mMinWidth, cur_width + delta_size);
+ new_width = llmax((*panel_it)->mMinDim, cur_width + delta_size);
}
else
{
@@ -662,8 +487,8 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
{
// shrink proportionally to amount over minimum
// so we can do this in one pass
- delta_size = (shrink_headroom_available > 0) ? llround((F32)pixels_to_distribute * ((F32)(cur_height - (*panel_it)->mMinHeight) / (F32)shrink_headroom_available)) : 0;
- shrink_headroom_available -= (cur_height - (*panel_it)->mMinHeight);
+ delta_size = (shrink_headroom_available > 0) ? llround((F32)pixels_to_distribute * ((F32)(cur_height - (*panel_it)->mMinDim) / (F32)shrink_headroom_available)) : 0;
+ shrink_headroom_available -= (cur_height - (*panel_it)->mMinDim);
}
else
{
@@ -671,7 +496,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
num_resizable_panels--;
}
pixels_to_distribute -= delta_size;
- new_height = llmax((*panel_it)->mMinHeight, cur_height + delta_size);
+ new_height = llmax((*panel_it)->mMinDim, cur_height + delta_size);
}
else
{
@@ -712,11 +537,11 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
if (mOrientation == HORIZONTAL)
{
- cur_x += llround(new_width * (*panel_it)->getCollapseFactor()) + mPanelSpacing;
+ cur_x += llround(new_width * (*panel_it)->getCollapseFactor(mOrientation)) + mPanelSpacing;
}
else //VERTICAL
{
- cur_y -= llround(new_height * (*panel_it)->getCollapseFactor()) + mPanelSpacing;
+ cur_y -= llround(new_height * (*panel_it)->getCollapseFactor(mOrientation)) + mPanelSpacing;
}
}
@@ -724,19 +549,19 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
LLResizeBar* last_resize_bar = NULL;
for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
- LLPanel* panelp = (*panel_it)->mPanel;
+ LLPanel* panelp = (*panel_it);
if (mOrientation == HORIZONTAL)
{
(*panel_it)->mResizeBar->setResizeLimits(
- (*panel_it)->mMinWidth,
- (*panel_it)->mMinWidth + shrink_headroom_total);
+ (*panel_it)->mMinDim,
+ (*panel_it)->mMinDim + shrink_headroom_total);
}
else //VERTICAL
{
(*panel_it)->mResizeBar->setResizeLimits(
- (*panel_it)->mMinHeight,
- (*panel_it)->mMinHeight + shrink_headroom_total);
+ (*panel_it)->mMinDim,
+ (*panel_it)->mMinDim + shrink_headroom_total);
}
// toggle resize bars based on panel visibility, resizability, etc
@@ -772,14 +597,14 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
} // end LLLayoutStack::updateLayout
-LLLayoutStack::LayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const
+LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const
{
if (!panelp) return NULL;
e_panel_list_t::const_iterator panel_it;
for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
- if ((*panel_it)->mPanel == panelp)
+ if ((*panel_it) == panelp)
{
return *panel_it;
}
@@ -787,15 +612,15 @@ LLLayoutStack::LayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) co
return NULL;
}
-LLLayoutStack::LayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) const
+LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) const
{
- LayoutPanel* result = NULL;
+ LLLayoutPanel* result = NULL;
for (e_panel_list_t::const_iterator panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
- LayoutPanel* p = *panel_it;
+ LLLayoutPanel* p = *panel_it;
- if (p->mPanel->getName() == name)
+ if (p->getName() == name)
{
result = p;
break;
@@ -816,9 +641,7 @@ void LLLayoutStack::calcMinExtents()
{
if (mOrientation == HORIZONTAL)
{
- mMinHeight = llmax( mMinHeight,
- (*panel_it)->mMinHeight);
- mMinWidth += (*panel_it)->mMinWidth;
+ mMinWidth += (*panel_it)->mMinDim;
if (panel_it != mPanels.begin())
{
mMinWidth += mPanelSpacing;
@@ -826,9 +649,7 @@ void LLLayoutStack::calcMinExtents()
}
else //VERTICAL
{
- mMinWidth = llmax( mMinWidth,
- (*panel_it)->mMinWidth);
- mMinHeight += (*panel_it)->mMinHeight;
+ mMinHeight += (*panel_it)->mMinDim;
if (panel_it != mPanels.begin())
{
mMinHeight += mPanelSpacing;
@@ -837,6 +658,37 @@ void LLLayoutStack::calcMinExtents()
}
}
+void LLLayoutStack::createResizeBars()
+{
+ for (e_panel_list_t::iterator panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
+ {
+ LLLayoutPanel* lp = (*panel_it);
+ if (lp->mResizeBar == NULL)
+ {
+ LLResizeBar::Side side = (mOrientation == HORIZONTAL) ? LLResizeBar::RIGHT : LLResizeBar::BOTTOM;
+ LLRect resize_bar_rect = getRect();
+
+ LLResizeBar::Params resize_params;
+ resize_params.name("resize");
+ resize_params.resizing_view(lp);
+ resize_params.min_size(lp->mMinDim);
+ resize_params.side(side);
+ resize_params.snapping_enabled(false);
+ LLResizeBar* resize_bar = LLUICtrlFactory::create<LLResizeBar>(resize_params);
+ lp->mResizeBar = resize_bar;
+ LLView::addChild(resize_bar, 0);
+
+ // bring all resize bars to the front so that they are clickable even over the panels
+ // with a bit of overlap
+ for (e_panel_list_t::iterator panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
+ {
+ LLResizeBar* resize_barp = (*panel_it)->mResizeBar;
+ sendChildToFront(resize_barp);
+ }
+ }
+ }
+}
+
// update layout stack animations, etc. once per frame
// NOTE: we use this to size world view based on animating UI, *before* we draw the UI
// we might still need to call updateLayout during UI draw phase, in case UI elements
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h
index e454454fe2..9bcfa2c957 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -34,13 +34,18 @@
#ifndef LL_LLLAYOUTSTACK_H
#define LL_LLLAYOUTSTACK_H
-#include "llview.h"
+#include "llpanel.h"
class LLPanel;
+class LLLayoutPanel;
+
class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
{
public:
+ struct LayoutStackRegistry : public LLChildRegistry<LayoutStackRegistry>
+ {};
+
struct Params : public LLInitParam::Block<Params, LLView::Params>
{
Optional<std::string> orientation;
@@ -51,6 +56,8 @@ public:
Params();
};
+ typedef LayoutStackRegistry child_registry_t;
+
typedef enum e_layout_orientation
{
HORIZONTAL,
@@ -62,6 +69,7 @@ public:
/*virtual*/ void draw();
/*virtual*/ void removeChild(LLView*);
/*virtual*/ BOOL postBuild();
+ /*virtual*/ bool addChild(LLView* child, S32 tab_group = 0);
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL);
@@ -74,7 +82,7 @@ public:
ANIMATE
} EAnimate;
- void addPanel(LLPanel* panel, S32 min_width, S32 min_height, S32 max_width, S32 max_height, BOOL auto_resize, BOOL user_resize, EAnimate animate = NO_ANIMATE, S32 index = S32_MAX);
+ void addPanel(LLLayoutPanel* panel, EAnimate animate = NO_ANIMATE);
void removePanel(LLPanel* panel);
void collapsePanel(LLPanel* panel, BOOL collapsed = TRUE);
S32 getNumPanels() { return mPanels.size(); }
@@ -83,20 +91,18 @@ public:
void setPanelUserResize(const std::string& panel_name, BOOL user_resize);
/**
- * Gets minimal width and/or height of the specified by name panel.
+ * Gets minimal dimension along layout_stack axis of the specified by name panel.
*
- * If it is necessary to get only the one dimension pass NULL for another one.
* @returns true if specified by panel_name internal panel exists, false otherwise.
*/
- bool getPanelMinSize(const std::string& panel_name, S32* min_widthp, S32* min_heightp);
+ bool getPanelMinSize(const std::string& panel_name, S32* min_dimp);
/**
- * Gets maximal width and/or height of the specified by name panel.
+ * Gets maximal dimension along layout_stack axis of the specified by name panel.
*
- * If it is necessary to get only the one dimension pass NULL for another one.
* @returns true if specified by panel_name internal panel exists, false otherwise.
*/
- bool getPanelMaxSize(const std::string& panel_name, S32* max_width, S32* max_height);
+ bool getPanelMaxSize(const std::string& panel_name, S32* max_dim);
void updateLayout(BOOL force_resize = FALSE);
@@ -111,19 +117,18 @@ protected:
friend class LLUICtrlFactory;
private:
- struct LayoutPanel;
-
+ void createResizeBars();
void calcMinExtents();
S32 getDefaultHeight(S32 cur_height);
S32 getDefaultWidth(S32 cur_width);
const ELayoutOrientation mOrientation;
- typedef std::vector<LayoutPanel*> e_panel_list_t;
+ typedef std::vector<LLLayoutPanel*> e_panel_list_t;
e_panel_list_t mPanels;
- LayoutPanel* findEmbeddedPanel(LLPanel* panelp) const;
- LayoutPanel* findEmbeddedPanelByName(const std::string& name) const;
+ LLLayoutPanel* findEmbeddedPanel(LLPanel* panelp) const;
+ LLLayoutPanel* findEmbeddedPanelByName(const std::string& name) const;
S32 mMinWidth; // calculated by calcMinExtents
S32 mMinHeight; // calculated by calcMinExtents
@@ -135,4 +140,49 @@ private:
bool mClip;
}; // end class LLLayoutStack
+class LLLayoutPanel : public LLPanel
+{
+friend LLLayoutStack;
+friend class LLUICtrlFactory;
+public:
+ struct Params : public LLInitParam::Block<Params, LLPanel::Params>
+ {
+ Optional<S32> min_dim,
+ max_dim;
+ Optional<bool> user_resize,
+ auto_resize;
+
+ Params()
+ : min_dim("min_dim", 0),
+ max_dim("max_dim", 0),
+ user_resize("user_resize", true),
+ auto_resize("auto_resize", true)
+ {
+ addSynonym(min_dim, "min_width");
+ addSynonym(min_dim, "min_height");
+ addSynonym(max_dim, "max_width");
+ addSynonym(max_dim, "max_height");
+ }
+ };
+
+ ~LLLayoutPanel();
+
+ void initFromParams(const Params& p);
+protected:
+ LLLayoutPanel(const Params& p) ;
+
+
+ F32 getCollapseFactor(LLLayoutStack::ELayoutOrientation orientation);
+
+ S32 mMinDim;
+ S32 mMaxDim;
+ BOOL mAutoResize;
+ BOOL mUserResize;
+ BOOL mCollapsed;
+ class LLResizeBar* mResizeBar;
+ F32 mVisibleAmt;
+ F32 mCollapseAmt;
+};
+
+
#endif
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index c93ca1af88..e6a07b02cc 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -1277,7 +1277,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
if( mCurrentHistoryLine > mLineHistory.begin() )
{
mText.assign( *(--mCurrentHistoryLine) );
- setCursor(llmin((S32)mText.length(), getCursor()));
+ setCursorToEnd();
}
else
{
@@ -1294,7 +1294,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
if( !mLineHistory.empty() && mCurrentHistoryLine < mLineHistory.end() - 1 )
{
mText.assign( *(++mCurrentHistoryLine) );
- setCursor(llmin((S32)mText.length(), getCursor()));
+ setCursorToEnd();
}
else
{
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 51c8f6c743..4471f315c0 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -389,8 +389,7 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_
LLPanel* panelp = NULL;
- {
- LLFastTimer timer(FTM_PANEL_CONSTRUCTION);
+ { LLFastTimer _(FTM_PANEL_CONSTRUCTION);
if(!class_attr.empty())
{
@@ -512,6 +511,8 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
setXMLFilename(xml_filename);
}
+ LLXUIParser parser;
+
if (!xml_filename.empty())
{
LLUICtrlFactory::instance().pushFileName(xml_filename);
@@ -521,12 +522,11 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
{
//if we are exporting, we want to export the current xml
//not the referenced xml
- LLXUIParser::instance().readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName());
+ parser.readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName());
Params output_params(params);
setupParamsForExport(output_params, parent);
output_node->setName(node->getName()->mString);
- LLXUIParser::instance().writeXUI(
- output_node, output_params, &default_params);
+ parser.writeXUI(output_node, output_params, &default_params);
return TRUE;
}
@@ -537,7 +537,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
return FALSE;
}
- LLXUIParser::instance().readXUI(referenced_xml, params, LLUICtrlFactory::getInstance()->getCurFileName());
+ parser.readXUI(referenced_xml, params, LLUICtrlFactory::getInstance()->getCurFileName());
// add children using dimensions from referenced xml for consistent layout
setShape(params.rect);
@@ -547,15 +547,14 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
}
// ask LLUICtrlFactory for filename, since xml_filename might be empty
- LLXUIParser::instance().readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName());
+ parser.readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName());
if (output_node)
{
Params output_params(params);
setupParamsForExport(output_params, parent);
output_node->setName(node->getName()->mString);
- LLXUIParser::instance().writeXUI(
- output_node, output_params, &default_params);
+ parser.writeXUI(output_node, output_params, &default_params);
}
params.from_xui = true;
diff --git a/indra/llui/llrngwriter.cpp b/indra/llui/llrngwriter.cpp
index 7e3d4b92d3..718c10d2f8 100644
--- a/indra/llui/llrngwriter.cpp
+++ b/indra/llui/llrngwriter.cpp
@@ -36,10 +36,15 @@
#include "lluicolor.h"
#include "lluictrlfactory.h"
+static LLInitParam::Parser::parser_read_func_map_t sReadFuncs;
+static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs;
+static LLInitParam::Parser::parser_inspect_func_map_t sInspectFuncs;
+
//
// LLRNGWriter - writes Relax NG schema files based on a param block
//
LLRNGWriter::LLRNGWriter()
+: Parser(sReadFuncs, sWriteFuncs, sInspectFuncs)
{
// register various callbacks for inspecting the contents of a param block
registerInspectFunc<bool>(boost::bind(&LLRNGWriter::writeAttribute, this, "boolean", _1, _2, _3, _4));
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index d356f061f9..844278e41c 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -2568,7 +2568,8 @@ BOOL LLScrollListCtrl::canDeselect() const
void LLScrollListCtrl::addColumn(const LLSD& column, EAddPosition pos)
{
LLScrollListColumn::Params p;
- LLParamSDParser::instance().readSD(column, p);
+ LLParamSDParser parser;
+ parser.readSD(column, p);
addColumn(p, pos);
}
@@ -2759,7 +2760,8 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& element, EAddPosition
{
LLFastTimer _(FTM_ADD_SCROLLLIST_ELEMENT);
LLScrollListItem::Params item_params;
- LLParamSDParser::instance().readSD(element, item_params);
+ LLParamSDParser parser;
+ parser.readSD(element, item_params);
item_params.userdata = userdata;
return addRow(item_params, pos);
}
diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp
index 7d37127584..69976004e6 100644
--- a/indra/llui/llsdparam.cpp
+++ b/indra/llui/llsdparam.cpp
@@ -36,31 +36,40 @@
// Project includes
#include "llsdparam.h"
+static LLInitParam::Parser::parser_read_func_map_t sReadFuncs;
+static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs;
+static LLInitParam::Parser::parser_inspect_func_map_t sInspectFuncs;
+
//
// LLParamSDParser
//
LLParamSDParser::LLParamSDParser()
+: Parser(sReadFuncs, sWriteFuncs, sInspectFuncs)
{
using boost::bind;
- registerParserFuncs<S32>(readS32, bind(&LLParamSDParser::writeTypedValue<S32>, this, _1, _2));
- registerParserFuncs<U32>(readU32, bind(&LLParamSDParser::writeU32Param, this, _1, _2));
- registerParserFuncs<F32>(readF32, bind(&LLParamSDParser::writeTypedValue<F32>, this, _1, _2));
- registerParserFuncs<F64>(readF64, bind(&LLParamSDParser::writeTypedValue<F64>, this, _1, _2));
- registerParserFuncs<bool>(readBool, bind(&LLParamSDParser::writeTypedValue<F32>, this, _1, _2));
- registerParserFuncs<std::string>(readString, bind(&LLParamSDParser::writeTypedValue<std::string>, this, _1, _2));
- registerParserFuncs<LLUUID>(readUUID, bind(&LLParamSDParser::writeTypedValue<LLUUID>, this, _1, _2));
- registerParserFuncs<LLDate>(readDate, bind(&LLParamSDParser::writeTypedValue<LLDate>, this, _1, _2));
- registerParserFuncs<LLURI>(readURI, bind(&LLParamSDParser::writeTypedValue<LLURI>, this, _1, _2));
- registerParserFuncs<LLSD>(readSD, bind(&LLParamSDParser::writeTypedValue<LLSD>, this, _1, _2));
+ if (sReadFuncs.empty())
+ {
+ registerParserFuncs<S32>(readS32, &LLParamSDParser::writeTypedValue<S32>);
+ registerParserFuncs<U32>(readU32, &LLParamSDParser::writeU32Param);
+ registerParserFuncs<F32>(readF32, &LLParamSDParser::writeTypedValue<F32>);
+ registerParserFuncs<F64>(readF64, &LLParamSDParser::writeTypedValue<F64>);
+ registerParserFuncs<bool>(readBool, &LLParamSDParser::writeTypedValue<F32>);
+ registerParserFuncs<std::string>(readString, &LLParamSDParser::writeTypedValue<std::string>);
+ registerParserFuncs<LLUUID>(readUUID, &LLParamSDParser::writeTypedValue<LLUUID>);
+ registerParserFuncs<LLDate>(readDate, &LLParamSDParser::writeTypedValue<LLDate>);
+ registerParserFuncs<LLURI>(readURI, &LLParamSDParser::writeTypedValue<LLURI>);
+ registerParserFuncs<LLSD>(readSD, &LLParamSDParser::writeTypedValue<LLSD>);
+ }
}
// special case handling of U32 due to ambiguous LLSD::assign overload
-bool LLParamSDParser::writeU32Param(const void* val_ptr, const parser_t::name_stack_t& name_stack)
+bool LLParamSDParser::writeU32Param(LLParamSDParser::parser_t& parser, const void* val_ptr, const parser_t::name_stack_t& name_stack)
{
- if (!mWriteSD) return false;
+ LLParamSDParser& sdparser = static_cast<LLParamSDParser&>(parser);
+ if (!sdparser.mWriteSD) return false;
- LLSD* sd_to_write = getSDWriteNode(name_stack);
+ LLSD* sd_to_write = sdparser.getSDWriteNode(name_stack);
if (!sd_to_write) return false;
sd_to_write->assign((S32)*((const U32*)val_ptr));
diff --git a/indra/llui/llsdparam.h b/indra/llui/llsdparam.h
index d8af3c9bce..83c958d67d 100644
--- a/indra/llui/llsdparam.h
+++ b/indra/llui/llsdparam.h
@@ -37,17 +37,14 @@
#include "llinitparam.h"
class LLParamSDParser
-: public LLInitParam::Parser,
- public LLSingleton<LLParamSDParser>
+: public LLInitParam::Parser
{
LOG_CLASS(LLParamSDParser);
typedef LLInitParam::Parser parser_t;
-protected:
- LLParamSDParser();
- friend class LLSingleton<LLParamSDParser>;
public:
+ LLParamSDParser();
void readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool silent = false);
void writeSD(LLSD& sd, const LLInitParam::BaseBlock& block);
@@ -57,11 +54,12 @@ private:
void readSDValues(const LLSD& sd, LLInitParam::BaseBlock& block);
template<typename T>
- bool writeTypedValue(const void* val_ptr, const parser_t::name_stack_t& name_stack)
+ static bool writeTypedValue(Parser& parser, const void* val_ptr, const parser_t::name_stack_t& name_stack)
{
- if (!mWriteSD) return false;
+ LLParamSDParser& sdparser = static_cast<LLParamSDParser&>(parser);
+ if (!sdparser.mWriteSD) return false;
- LLSD* sd_to_write = getSDWriteNode(name_stack);
+ LLSD* sd_to_write = sdparser.getSDWriteNode(name_stack);
if (!sd_to_write) return false;
sd_to_write->assign(*((const T*)val_ptr));
@@ -70,7 +68,7 @@ private:
LLSD* getSDWriteNode(const parser_t::name_stack_t& name_stack);
- bool writeU32Param(const void* value_ptr, const parser_t::name_stack_t& name_stack);
+ static bool writeU32Param(Parser& parser, const void* value_ptr, const parser_t::name_stack_t& name_stack);
static bool readS32(Parser& parser, void* val_ptr);
static bool readU32(Parser& parser, void* val_ptr);
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 5d8b628776..85fdfbb312 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -1802,7 +1802,8 @@ void LLUI::setupPaths()
LLXMLNodePtr root;
BOOL success = LLXMLNode::parseFile(filename, root, NULL);
Paths paths;
- LLXUIParser::instance().readXUI(root, paths, filename);
+ LLXUIParser parser;
+ parser.readXUI(root, paths, filename);
sXUIPaths.clear();
diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp
index 1b64ef3abe..88140f1a49 100644
--- a/indra/llui/lluicolortable.cpp
+++ b/indra/llui/lluicolortable.cpp
@@ -243,7 +243,8 @@ void LLUIColorTable::saveUserSettings() const
}
LLXMLNodePtr output_node = new LLXMLNode("colors", false);
- LLXUIParser::instance().writeXUI(output_node, params);
+ LLXUIParser parser;
+ parser.writeXUI(output_node, params);
if(!output_node->isNull())
{
@@ -309,7 +310,8 @@ bool LLUIColorTable::loadFromFilename(const std::string& filename, string_color_
}
Params params;
- LLXUIParser::instance().readXUI(root, params, filename);
+ LLXUIParser parser;
+ parser.readXUI(root, params, filename);
if(params.validateBlock())
{
diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp
index ee700ee6eb..2a2fa21ec0 100644
--- a/indra/llui/lluictrlfactory.cpp
+++ b/indra/llui/lluictrlfactory.cpp
@@ -103,7 +103,8 @@ void LLUICtrlFactory::loadWidgetTemplate(const std::string& widget_tag, LLInitPa
if (!full_filename.empty())
{
LLUICtrlFactory::instance().pushFileName(full_filename);
- LLSimpleXUIParser::instance().readXUI(full_filename, block);
+ LLSimpleXUIParser parser;
+ parser.readXUI(full_filename, block);
LLUICtrlFactory::instance().popFileName();
}
}
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index 207f74c89a..6b5d055b78 100644
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -273,7 +273,8 @@ private:
typename T::Params params(getDefaultParams<T>());
- LLXUIParser::instance().readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName());
+ LLXUIParser parser;
+ parser.readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName());
if (output_node)
{
@@ -283,8 +284,7 @@ private:
// Export only the differences between this any default params
typename T::Params default_params(getDefaultParams<T>());
copyName(node, output_node);
- LLXUIParser::instance().writeXUI(
- output_node, output_params, &default_params);
+ parser.writeXUI(output_node, output_params, &default_params);
}
// Apply layout transformations, usually munging rect
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 3ee4a85de0..878def07ae 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -108,11 +108,7 @@ LLView::Params::Params()
left_pad("left_pad"),
left_delta("left_delta", S32_MAX),
from_xui("from_xui", false),
- user_resize("user_resize"),
- auto_resize("auto_resize"),
needs_translate("translate"),
- min_width("min_width"),
- max_width("max_width"),
xmlns("xmlns"),
xmlns_xsi("xmlns:xsi"),
xsi_schemaLocation("xsi:schemaLocation"),
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 0f796fb408..fa4f4c8ae2 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -145,11 +145,7 @@ public:
left_delta; // from last left to my left
//FIXME: get parent context involved in parsing traversal
- Ignored user_resize, // nested attribute for LLLayoutPanel
- auto_resize, // nested attribute for LLLayoutPanel
- needs_translate, // cue for translation tools
- min_width, // nested attribute for LLLayoutPanel
- max_width, // nested attribute for LLLayoutPanel
+ Ignored needs_translate, // cue for translation tools
xmlns, // xml namespace
xmlns_xsi, // xml namespace
xsi_schemaLocation, // xml schema