From 29ad432c8bdc3a69c7241de28e217d27b71947d6 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Thu, 19 Jan 2012 19:52:49 -0800
Subject: [PATCH] made layoutPanels have constant user_resize and auto_resize
 attributes

---
 indra/llui/lllayoutstack.cpp                  | 38 ++-----------------
 indra/llui/lllayoutstack.h                    |  8 ++--
 indra/newview/llchicletbar.cpp                |  2 -
 indra/newview/llsidepanelinventory.cpp        |  6 ---
 .../default/xui/en/panel_chiclet_bar.xml      |  1 +
 5 files changed, 7 insertions(+), 48 deletions(-)

diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 073592b6ecf..2f1c2a47c98 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -63,7 +63,7 @@ LLLayoutPanel::Params::Params()
 
 LLLayoutPanel::LLLayoutPanel(const Params& p)	
 :	LLPanel(p),
-	mExpandedMinDim(p.min_dim),
+	mExpandedMinDim(p.expanded_min_dim.isProvided() ? p.expanded_min_dim : p.min_dim),
  	mMinDim(p.min_dim), 
  	mAutoResize(p.auto_resize),
  	mUserResize(p.user_resize),
@@ -76,12 +76,6 @@ LLLayoutPanel::LLLayoutPanel(const Params& p)
 	mIgnoreReshape(false),
 	mOrientation(LLLayoutStack::HORIZONTAL)
 {
-	// Set the expanded min dim if it is provided, otherwise it gets the p.min_dim value
-	if (p.expanded_min_dim.isProvided())
-	{
-		mExpandedMinDim = p.expanded_min_dim();
-	}
-	
 	// panels initialized as hidden should not start out partially visible
 	if (!getVisible())
 	{
@@ -155,7 +149,7 @@ void LLLayoutPanel::reshape( S32 width, S32 height, BOOL called_from_parent /*=
 {
 	if (width == getRect().getWidth() && height == getRect().getHeight()) return;
 
-	if (!mIgnoreReshape && !mAutoResize)
+	if (!mIgnoreReshape && mAutoResize == false)
 	{
 		mTargetDim = (mOrientation == LLLayoutStack::HORIZONTAL) ? width : height;
 		LLLayoutStack* stackp = dynamic_cast<LLLayoutStack*>(getParent());
@@ -302,32 +296,6 @@ void LLLayoutStack::collapsePanel(LLPanel* panel, BOOL collapsed)
 	mNeedsLayout = true;
 }
 
-void LLLayoutStack::updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize)
-{
-	LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name);
-	
-	if (panel)
-	{
-		panel->mAutoResize = auto_resize;
-	}
-
-	mNeedsLayout = true;
-}
-
-void LLLayoutStack::setPanelUserResize(const std::string& panel_name, BOOL user_resize)
-{
-	LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name);
-
-	if (panel)
-	{
-		panel->mUserResize = user_resize;
-	}
-
-	mNeedsLayout = true;
-	updateFractionalSizes();
-}
-
-
 static LLFastTimer::DeclareTimer FTM_UPDATE_LAYOUT("Update LayoutStacks");
 
 void LLLayoutStack::updateLayout()
@@ -369,7 +337,7 @@ void LLLayoutStack::updateLayout()
 	{	// give space proportionally to visible auto resize panels
 		BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
 		{
-			if (panelp->mAutoResize == TRUE)
+			if (panelp->mAutoResize)
 			{
 				F32 fraction_to_distribute = (panelp->mFractionalSize * panelp->getAutoResizeFactor()) / (total_visible_fraction);
 				S32 delta = llround((F32)space_to_distribute * fraction_to_distribute);
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h
index da63593f7f7..efe93f6def1 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -88,9 +88,6 @@ class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
 	void collapsePanel(LLPanel* panel, BOOL collapsed = TRUE);
 	S32 getNumPanels() { return mPanels.size(); }
 
-	void updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize);
-	void setPanelUserResize(const std::string& panel_name, BOOL user_resize);
-	
 	void updateLayout();
 
 	S32 getPanelSpacing() const { return mPanelSpacing; }
@@ -187,10 +184,11 @@ friend class LLUICtrlFactory;
 protected:
 	LLLayoutPanel(const Params& p);
 	
+	const bool	mAutoResize;
+	const bool	mUserResize;
+
 	S32		mExpandedMinDim;
 	S32		mMinDim;
-	bool	mAutoResize;
-	bool	mUserResize;
 	bool	mCollapsed;
 	F32		mVisibleAmt;
 	F32		mCollapseAmt;
diff --git a/indra/newview/llchicletbar.cpp b/indra/newview/llchicletbar.cpp
index a32fd307f16..f1bc51fbe75 100644
--- a/indra/newview/llchicletbar.cpp
+++ b/indra/newview/llchicletbar.cpp
@@ -212,8 +212,6 @@ void LLChicletBar::reshape(S32 width, S32 height, BOOL called_from_parent)
 	{
 		// Firstly, update layout stack to ensure we deal with correct panel sizes.
 		{
-			// Set chiclet panel to be autoresized by default.
-			mToolbarStack->updatePanelAutoResize(PANEL_CHICLET_NAME, TRUE);
 			// Force the updating of layout to reset panels collapse factor.
 			mToolbarStack->updateLayout();
 		}
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp
index ccf8305c630..038b18afbdc 100644
--- a/indra/newview/llsidepanelinventory.cpp
+++ b/indra/newview/llsidepanelinventory.cpp
@@ -217,9 +217,6 @@ BOOL LLSidepanelInventory::postBuild()
 	{
 		LLLayoutStack* inv_stack = getChild<LLLayoutStack>(INVENTORY_LAYOUT_STACK_NAME);
 
-		// Disable user_resize on main inventory panel by default
-		inv_stack->setPanelUserResize(MAIN_INVENTORY_LAYOUT_PANEL_NAME, false);
-
 		// Collapse inbox panel
 		inv_stack->collapsePanel(getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME), true);
 		
@@ -368,9 +365,6 @@ void LLSidepanelInventory::onToggleInboxBtn()
 	
 	const bool inbox_expanded = inboxButton->getToggleState();
 	
-	// Enable user_resize on main inventory panel only when inbox is expanded
-	//inv_stack->setPanelUserResize(MAIN_INVENTORY_LAYOUT_PANEL_NAME, inbox_expanded);
-	
 	// Expand/collapse the indicated panel
 	inv_stack->collapsePanel(inboxPanel, !inbox_expanded);
 
diff --git a/indra/newview/skins/default/xui/en/panel_chiclet_bar.xml b/indra/newview/skins/default/xui/en/panel_chiclet_bar.xml
index 6d4008a4edf..ff0146490b9 100644
--- a/indra/newview/skins/default/xui/en/panel_chiclet_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_chiclet_bar.xml
@@ -27,6 +27,7 @@
          min_width="95"
          mouse_opaque="false"
          name="chiclet_list_panel"
+         auto_resize="true"
          top="0"
          width="189">
       <chiclet_panel
-- 
GitLab