From 64d83571c9596900f32d0af63c2dd9968badb82f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 24 Feb 2010 23:40:46 -0600 Subject: Merge ? --- indra/llui/lllayoutstack.cpp | 38 +++++++++++++++++++++++++++++++++----- indra/llui/lllayoutstack.h | 10 +++++++++- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index dc79550eb4..4512091371 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -49,9 +49,11 @@ static LLDefaultChildRegistry::Register register_layout_stack("la // struct LLLayoutStack::LayoutPanel { - LayoutPanel(LLPanel* panelp, ELayoutOrientation orientation, S32 min_width, S32 min_height, BOOL auto_resize, BOOL user_resize) : mPanel(panelp), + 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), @@ -112,6 +114,11 @@ struct LLLayoutStack::LayoutPanel 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; @@ -261,10 +268,14 @@ LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr o { 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; @@ -281,6 +292,10 @@ LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr o 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); @@ -293,7 +308,7 @@ LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr o if (panelp) { panelp->setFollowsNone(); - layout_stackp->addPanel(panelp, min_width, min_height, auto_resize, user_resize); + layout_stackp->addPanel(panelp, min_width, min_height, max_width, max_height, auto_resize, user_resize); } } else @@ -309,7 +324,7 @@ LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr o if (new_child) { // put child in new embedded panel - layout_stackp->addPanel(panelp, min_width, min_height, auto_resize, user_resize); + 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); @@ -359,14 +374,14 @@ S32 LLLayoutStack::getDefaultWidth(S32 cur_width) return cur_width; } -void LLLayoutStack::addPanel(LLPanel* panel, S32 min_width, S32 min_height, BOOL auto_resize, BOOL user_resize, EAnimate animate, S32 index) +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) { // panel starts off invisible (collapsed) if (animate == ANIMATE) { panel->setVisible(FALSE); } - LayoutPanel* embedded_panel = new LayoutPanel(panel, mOrientation, min_width, min_height, auto_resize, user_resize); + 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); @@ -437,6 +452,19 @@ bool LLLayoutStack::getPanelMinSize(const std::string& panel_name, S32* min_widt return NULL != panel; } +bool LLLayoutStack::getPanelMaxSize(const std::string& panel_name, S32* max_widthp, S32* max_heightp) +{ + LayoutPanel* panel = findEmbeddedPanelByName(panel_name); + + if (panel) + { + if (max_widthp) *max_widthp = panel->mMaxWidth; + if (max_heightp) *max_heightp = panel->mMaxHeight; + } + + return NULL != panel; +} + static LLFastTimer::DeclareTimer FTM_UPDATE_LAYOUT("Update LayoutStacks"); void LLLayoutStack::updateLayout(BOOL force_resize) { diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index c4f10038f8..e454454fe2 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -74,7 +74,7 @@ public: ANIMATE } EAnimate; - void addPanel(LLPanel* panel, S32 min_width, S32 min_height, BOOL auto_resize, BOOL user_resize, EAnimate animate = NO_ANIMATE, S32 index = S32_MAX); + 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 removePanel(LLPanel* panel); void collapsePanel(LLPanel* panel, BOOL collapsed = TRUE); S32 getNumPanels() { return mPanels.size(); } @@ -89,6 +89,14 @@ public: * @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); + + /** + * Gets maximal width and/or height 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); void updateLayout(BOOL force_resize = FALSE); -- cgit v1.2.3