From 2cc4321166bfb6515a08fe1dd8053dae6d6840e3 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Thu, 20 Oct 2011 15:53:43 -0700
Subject: [PATCH] EXP-1423 FIX FUI resets floater contents after closing them
 (Inventory Panel), this is inconsistant for previous sidebar users and
 introduces extra difficulty in productivity of the viewer. EXP-1430 FIX
 Minimizing voice settings floater corrupts layout throughout rest of session

---
 indra/llxuixml/llxuiparser.cpp                | 89 +++++++++----------
 indra/newview/llfloaterinventory.cpp          |  9 ++
 indra/newview/llfloaterinventory.h            |  1 +
 .../default/xui/en/floater_my_inventory.xml   |  2 +-
 .../default/xui/en/floater_voice_controls.xml |  2 +
 5 files changed, 57 insertions(+), 46 deletions(-)

diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp
index d4556113eae..878f9921783 100644
--- a/indra/llxuixml/llxuiparser.cpp
+++ b/indra/llxuixml/llxuiparser.cpp
@@ -51,6 +51,14 @@ static 	LLInitParam::Parser::parser_read_func_map_t sXSDReadFuncs;
 static 	LLInitParam::Parser::parser_write_func_map_t sXSDWriteFuncs;
 static 	LLInitParam::Parser::parser_inspect_func_map_t sXSDInspectFuncs;
 
+static 	LLInitParam::Parser::parser_read_func_map_t sSimpleXUIReadFuncs;
+static 	LLInitParam::Parser::parser_write_func_map_t sSimpleXUIWriteFuncs;
+static 	LLInitParam::Parser::parser_inspect_func_map_t sSimpleXUIInspectFuncs;
+
+const char* NO_VALUE_MARKER = "no_value";
+
+const S32 LINE_NUMBER_HERE = 0;
+
 struct MaxOccur : public LLInitParam::ChoiceBlock<MaxOccur>
 {
 	Alternative<int> count;
@@ -1190,12 +1198,6 @@ struct ScopedFile
 
 	LLFILE* mFile;
 };
-static 	LLInitParam::Parser::parser_read_func_map_t sSimpleXUIReadFuncs;
-static 	LLInitParam::Parser::parser_write_func_map_t sSimpleXUIWriteFuncs;
-static 	LLInitParam::Parser::parser_inspect_func_map_t sSimpleXUIInspectFuncs;
-
-const char* NO_VALUE_MARKER = "no_value";
-
 LLSimpleXUIParser::LLSimpleXUIParser(LLSimpleXUIParser::element_start_callback_t element_cb)
 :	Parser(sSimpleXUIReadFuncs, sSimpleXUIWriteFuncs, sSimpleXUIInspectFuncs),
 	mCurReadDepth(0),
@@ -1300,6 +1302,11 @@ void LLSimpleXUIParser::characterDataHandler(void *userData, const char *s, int
 	self->characterData(s, len);
 }
 
+void LLSimpleXUIParser::characterData(const char *s, int len)
+{
+	mTextContents += std::string(s, len);
+}
+
 void LLSimpleXUIParser::startElement(const char *name, const char **atts)
 {
 	processText();
@@ -1372,6 +1379,37 @@ void LLSimpleXUIParser::startElement(const char *name, const char **atts)
 
 }
 
+void LLSimpleXUIParser::endElement(const char *name)
+{
+	bool has_text = processText();
+
+	// no text, attributes, or children
+	if (!has_text && mEmptyLeafNode.back())
+	{
+		// submit this as a valueless name (even though there might be text contents we haven't seen yet)
+		mCurAttributeValueBegin = NO_VALUE_MARKER;
+		mOutputStack.back().first->submitValue(mNameStack, *this, mParseSilently);
+	}
+
+	if (--mOutputStack.back().second == 0)
+	{
+		if (mOutputStack.empty())
+		{
+			LL_ERRS("ReadXUI") << "Parameter block output stack popped while empty." << LL_ENDL;
+		}
+		mOutputStack.pop_back();
+	}
+
+	S32 num_tokens_to_pop = mTokenSizeStack.back();
+	mTokenSizeStack.pop_back();
+	while(num_tokens_to_pop-- > 0)
+	{
+		mNameStack.pop_back();
+	}
+	mScope.pop_back();
+	mEmptyLeafNode.pop_back();
+}
+
 bool LLSimpleXUIParser::readAttributes(const char **atts)
 {
 	typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
@@ -1421,43 +1459,6 @@ bool LLSimpleXUIParser::processText()
 	return false;
 }
 
-void LLSimpleXUIParser::endElement(const char *name)
-{
-	bool has_text = processText();
-
-	// no text, attributes, or children
-	if (!has_text && mEmptyLeafNode.back())
-	{
-		// submit this as a valueless name (even though there might be text contents we haven't seen yet)
-		mCurAttributeValueBegin = NO_VALUE_MARKER;
-		mOutputStack.back().first->submitValue(mNameStack, *this, mParseSilently);
-	}
-
-	if (--mOutputStack.back().second == 0)
-	{
-		if (mOutputStack.empty())
-		{
-			LL_ERRS("ReadXUI") << "Parameter block output stack popped while empty." << LL_ENDL;
-		}
-		mOutputStack.pop_back();
-	}
-
-	S32 num_tokens_to_pop = mTokenSizeStack.back();
-	mTokenSizeStack.pop_back();
-	while(num_tokens_to_pop-- > 0)
-	{
-		mNameStack.pop_back();
-	}
-	mScope.pop_back();
-	mEmptyLeafNode.pop_back();
-}
-
-void LLSimpleXUIParser::characterData(const char *s, int len)
-{
-	mTextContents += std::string(s, len);
-}
-
-
 /*virtual*/ std::string LLSimpleXUIParser::getCurrentElementName()
 {
 	std::string full_name;
@@ -1471,8 +1472,6 @@ void LLSimpleXUIParser::characterData(const char *s, int len)
 	return full_name;
 }
 
-const S32 LINE_NUMBER_HERE = 0;
-
 void LLSimpleXUIParser::parserWarning(const std::string& message)
 {
 #ifdef LL_WINDOWS
diff --git a/indra/newview/llfloaterinventory.cpp b/indra/newview/llfloaterinventory.cpp
index df769bdd885..9b9b90e5219 100644
--- a/indra/newview/llfloaterinventory.cpp
+++ b/indra/newview/llfloaterinventory.cpp
@@ -98,3 +98,12 @@ void LLFloaterInventory::onOpen(const LLSD& key)
 {
 	//LLFirstUse::useInventory();
 }
+
+void LLFloaterInventory::onClose(bool app_quitting)
+{
+	LLFloater::onClose(app_quitting);
+	if (mKey.asInteger() > 1)
+	{
+		destroy();
+	}
+}
diff --git a/indra/newview/llfloaterinventory.h b/indra/newview/llfloaterinventory.h
index f59a015b07f..823c4903b42 100644
--- a/indra/newview/llfloaterinventory.h
+++ b/indra/newview/llfloaterinventory.h
@@ -58,6 +58,7 @@ class LLFloaterInventory : public LLFloater
 
 	// Inherited functionality
 	/*virtual*/ void onOpen(const LLSD& key);
+	/*virtual*/ void onClose(bool app_quitting);
 
 	LLInventoryPanel* getPanel();
 	LLPanelMainInventory* getMainInventoryPanel() { return mPanelMainInventory;}
diff --git a/indra/newview/skins/default/xui/en/floater_my_inventory.xml b/indra/newview/skins/default/xui/en/floater_my_inventory.xml
index 80718584e30..cd0b59dc513 100644
--- a/indra/newview/skins/default/xui/en/floater_my_inventory.xml
+++ b/indra/newview/skins/default/xui/en/floater_my_inventory.xml
@@ -10,7 +10,7 @@
  name="floater_my_inventory"
  save_rect="true"
  save_visibility="true"
- reuse_instance="false"
+ reuse_instance="true"
  title="INVENTORY"
  width="333" >
    <panel
diff --git a/indra/newview/skins/default/xui/en/floater_voice_controls.xml b/indra/newview/skins/default/xui/en/floater_voice_controls.xml
index 14a722e3be8..93a04050b64 100644
--- a/indra/newview/skins/default/xui/en/floater_voice_controls.xml
+++ b/indra/newview/skins/default/xui/en/floater_voice_controls.xml
@@ -52,6 +52,7 @@
          user_resize="false"
          auto_resize="false"
          layout="topleft"
+         min_height="20"
          height="20"
          name="my_panel">
             <avatar_icon
@@ -133,6 +134,7 @@
           height="132"
           name="callers_panel"
           user_resize="false" 
+          auto_resize="true"
           width="280">
         <avatar_list
          follows="all"
-- 
GitLab