From d0bf3079d78df386bbac8676ee3e3264323e7e24 Mon Sep 17 00:00:00 2001
From: leyla_linden <none@none>
Date: Wed, 9 Feb 2011 10:53:38 -0800
Subject: SH-840 Convert resource cost physics cost to prim count

---
 indra/newview/llfloatertools.cpp                   | 154 +++++++++++++--------
 .../newview/skins/default/xui/en/floater_tools.xml |  29 +++-
 2 files changed, 128 insertions(+), 55 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp
index f5e3d160fc..a404aa0b1c 100644
--- a/indra/newview/llfloatertools.cpp
+++ b/indra/newview/llfloatertools.cpp
@@ -414,62 +414,96 @@ void LLFloaterTools::refresh()
 	// Refresh object and prim count labels
 	LLLocale locale(LLLocale::USER_LOCALE);
 
-	// Get the number of objects selected
-	std::string root_object_count_string;
-	std::string object_count_string;
-
-	LLResMgr::getInstance()->getIntegerString(
-		root_object_count_string,
-		LLSelectMgr::getInstance()->getSelection()->getRootObjectCount());
-	LLResMgr::getInstance()->getIntegerString(
-		object_count_string,
-		LLSelectMgr::getInstance()->getSelection()->getObjectCount());
-
-	F32 obj_cost =
-		LLSelectMgr::getInstance()->getSelection()->getSelectedObjectCost();
-	F32 link_cost =
-		LLSelectMgr::getInstance()->getSelection()->getSelectedLinksetCost();
-	F32 obj_physics_cost =
-		LLSelectMgr::getInstance()->getSelection()->getSelectedPhysicsCost();
-	F32 link_physics_cost =
-		LLSelectMgr::getInstance()->getSelection()->getSelectedLinksetPhysicsCost();
-
-	// Update the text for the counts
-	childSetTextArg(
-		"linked_set_count",
-		"[COUNT]",
-		root_object_count_string);
-	childSetTextArg("object_count", "[COUNT]", object_count_string);
-
-	// Update the text for the resource costs
-	childSetTextArg("linked_set_cost","[COST]",llformat("%.1f", link_cost));
-	childSetTextArg("object_cost", "[COST]", llformat("%.1f", obj_cost));
-	childSetTextArg("linked_set_cost","[PHYSICS]",llformat("%.1f", link_physics_cost));
-	childSetTextArg("object_cost", "[PHYSICS]", llformat("%.1f", obj_physics_cost));
-
-	// Display rendering cost if needed
-	if (sShowObjectCost)
-	{
-		std::string prim_cost_string;
-  		LLResMgr::getInstance()->getIntegerString(prim_cost_string, calcRenderCost());
-		getChild<LLUICtrl>("RenderingCost")->setTextArg("[COUNT]", prim_cost_string);
+	if ((gAgent.getRegion() && gAgent.getRegion()->getCapability("GetMesh").empty()) || !gSavedSettings.getBOOL("MeshEnabled"))
+	{		
+		std::string obj_count_string;
+		LLResMgr::getInstance()->getIntegerString(obj_count_string, LLSelectMgr::getInstance()->getSelection()->getRootObjectCount());
+		getChild<LLUICtrl>("obj_count")->setTextArg("[COUNT]", obj_count_string);	
+		std::string prim_count_string;
+		LLResMgr::getInstance()->getIntegerString(prim_count_string, LLSelectMgr::getInstance()->getSelection()->getObjectCount());
+		getChild<LLUICtrl>("prim_count")->setTextArg("[COUNT]", prim_count_string);
+
+		// calculate selection rendering cost
+		if (sShowObjectCost)
+		{
+			std::string prim_cost_string;
+			LLResMgr::getInstance()->getIntegerString(prim_cost_string, calcRenderCost());
+			getChild<LLUICtrl>("RenderingCost")->setTextArg("[COUNT]", prim_cost_string);
+		}
+		
+		getChildView("linked_set_count")->setVisible(false);
+		getChildView("linked_set_cost")->setVisible(false);
+		getChildView("object_count")->setVisible(false);
+		getChildView("object_cost")->setVisible(false);
+		getChildView("obj_count")->setVisible(true);
+		getChildView("prim_count")->setVisible(true);
+
+		// disable the object and prim counts if nothing selected
+		bool have_selection = ! LLSelectMgr::getInstance()->getSelection()->isEmpty();
+		getChildView("obj_count")->setEnabled(have_selection);
+		getChildView("prim_count")->setEnabled(have_selection);
+		getChildView("RenderingCost")->setEnabled(have_selection && sShowObjectCost);
 	}
+	else
+	{
+		// Get the number of objects selected
+		std::string root_object_count_string;
+		std::string object_count_string;
+
+		LLResMgr::getInstance()->getIntegerString(
+			root_object_count_string,
+			LLSelectMgr::getInstance()->getSelection()->getRootObjectCount());
+		LLResMgr::getInstance()->getIntegerString(
+			object_count_string,
+			LLSelectMgr::getInstance()->getSelection()->getObjectCount());
+
+		F32 obj_cost =
+			LLSelectMgr::getInstance()->getSelection()->getSelectedObjectCost();
+		F32 link_cost =
+			LLSelectMgr::getInstance()->getSelection()->getSelectedLinksetCost();
+		F32 obj_physics_cost =
+			LLSelectMgr::getInstance()->getSelection()->getSelectedPhysicsCost();
+		F32 link_physics_cost =
+			LLSelectMgr::getInstance()->getSelection()->getSelectedLinksetPhysicsCost();
+
+		// Update the text for the counts
+		childSetTextArg(
+			"linked_set_count",
+			"[COUNT]",
+			root_object_count_string);
+		childSetTextArg("object_count", "[COUNT]", object_count_string);
+
+		// Update the text for the resource costs
+		childSetTextArg("linked_set_cost","[COST]",llformat("%.1f", link_cost));
+		childSetTextArg("object_cost", "[COST]", llformat("%.1f", obj_cost));
+		childSetTextArg("linked_set_cost","[PHYSICS]",llformat("%.1f", link_physics_cost));
+		childSetTextArg("object_cost", "[PHYSICS]", llformat("%.1f", obj_physics_cost));
+
+		// Display rendering cost if needed
+		if (sShowObjectCost)
+		{
+			std::string prim_cost_string;
+			LLResMgr::getInstance()->getIntegerString(prim_cost_string, calcRenderCost());
+			getChild<LLUICtrl>("RenderingCost")->setTextArg("[COUNT]", prim_cost_string);
+		}
 
 
-	// disable the object and prim counts if nothing selected
-	bool have_selection = ! LLSelectMgr::getInstance()->getSelection()->isEmpty();
-	childSetEnabled("linked_set_count", have_selection);
-	childSetEnabled("object_count", have_selection);
-	childSetEnabled("linked_set_cost", have_selection);
-	childSetEnabled("object_cost", have_selection);
-
-	bool enable_mesh = gSavedSettings.getBOOL("MeshEnabled") && 
-					   !gAgent.getRegion()->getCapability("GetMesh").empty();
+		// disable the object and prim counts if nothing selected
+		bool have_selection = ! LLSelectMgr::getInstance()->getSelection()->isEmpty();
+		childSetEnabled("linked_set_count", have_selection);
+		childSetEnabled("object_count", have_selection);
+		childSetEnabled("linked_set_cost", have_selection);
+		childSetEnabled("object_cost", have_selection);
+		getChildView("RenderingCost")->setEnabled(have_selection && sShowObjectCost);
+
+		getChildView("linked_set_count")->setVisible(true);
+		getChildView("linked_set_cost")->setVisible(true);
+		getChildView("object_count")->setVisible(true);
+		getChildView("object_cost")->setVisible(true);
+		getChildView("obj_count")->setVisible(false);
+		getChildView("prim_count")->setVisible(false);
+	}
 
-	getChildView("linked_set_count")->setVisible(enable_mesh);
-	getChildView("linked_set_cost")->setVisible(enable_mesh);
-	getChildView("object_count")->setVisible(enable_mesh);
-	getChildView("object_cost")->setVisible(enable_mesh);
 
 	// Refresh child tabs
 	mPanelPermissions->refresh();
@@ -753,8 +787,20 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
 		getChildView("Strength:")->setVisible( land_visible);
 	}
 
-	getChildView("obj_count")->setVisible( !land_visible);
-	getChildView("prim_count")->setVisible( !land_visible);
+	if (gAgent.getRegion()->getCapability("GetMesh").empty())
+	{
+		getChildView("obj_count")->setVisible( !land_visible);
+		getChildView("prim_count")->setVisible( !land_visible);
+		getChildView("RenderingCost")->setVisible( !land_visible && sShowObjectCost);
+	}
+	else
+	{
+		getChildView("linked_set_count")->setVisible( !land_visible);
+		getChildView("linked_set_cost")->setVisible( !land_visible);
+		getChildView("object_count")->setVisible( !land_visible);
+		getChildView("object_cost")->setVisible( !land_visible);
+		getChildView("RenderingCost")->setVisible( !land_visible && sShowObjectCost);
+	}
 	mTab->setVisible(!land_visible);
 	mPanelLandInfo->setVisible(land_visible);
 }
diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml
index cce833b1ea..53cc808e70 100644
--- a/indra/newview/skins/default/xui/en/floater_tools.xml
+++ b/indra/newview/skins/default/xui/en/floater_tools.xml
@@ -722,6 +722,33 @@
 	  <button.commit_callback
 	     function="BuildTool.applyToSelection"/>
     </button>
+	<text
+	 text_color="LtGray_50"
+	  type="string"
+	  length="1"
+	  height="10"
+	  follows="left|top"
+	  halign="right"
+	  layout="topleft"
+	  right="-10"
+	  name="obj_count"
+	  top_pad="5"
+	  width="143">
+		Objects: [COUNT]
+	</text>
+	<text
+    text_color="LtGray_50"
+     type="string"
+     length="1"
+	height="10" 
+     follows="left|top"
+     halign="right"
+     layout="topleft"
+     right="-10"
+     name="prim_count"
+     width="143">
+		Prims: [COUNT]
+	</text>
     <text
     text_color="LtGray_50"
      type="string"
@@ -732,7 +759,7 @@
      layout="topleft"
      right="-100"
      name="linked_set_count"
-     top_pad="5"
+     top="144"
      width="80">
         Linked Sets: [COUNT]
     </text>
-- 
cgit v1.2.3