From fb96262c47d9eb022f9291637c6a9ebaec833dca Mon Sep 17 00:00:00 2001
From: Todd Stinson <stinson@lindenlab.com>
Date: Wed, 15 Feb 2012 11:51:49 -0800
Subject: PATH-284: Stubbing functionality for the walkability heatmap
 drop-down.

---
 indra/newview/llfloaterpathfindingconsole.cpp      | 111 ++++++++++++++++++++-
 indra/newview/llfloaterpathfindingconsole.h        |  23 ++++-
 .../default/xui/en/floater_pathfinding_console.xml |  20 +++-
 3 files changed, 145 insertions(+), 9 deletions(-)

diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp
index eccea867c7..728efc52a4 100644
--- a/indra/newview/llfloaterpathfindingconsole.cpp
+++ b/indra/newview/llfloaterpathfindingconsole.cpp
@@ -39,6 +39,7 @@
 #include "lllineeditor.h"
 #include "lltextbase.h"
 #include "lltabcontainer.h"
+#include "llcombobox.h"
 #include "llnavmeshstation.h"
 #include "llfloaterreg.h"
 #include "llviewerregion.h"
@@ -47,6 +48,12 @@
 
 #include "LLPathingLib.h"
 
+#define XUI_RENDER_HEATMAP_NONE 0
+#define XUI_RENDER_HEATMAP_A 1
+#define XUI_RENDER_HEATMAP_B 2
+#define XUI_RENDER_HEATMAP_C 3
+#define XUI_RENDER_HEATMAP_D 4
+
 #define XUI_CHARACTER_TYPE_A 1
 #define XUI_CHARACTER_TYPE_B 2
 #define XUI_CHARACTER_TYPE_C 3
@@ -70,6 +77,10 @@ BOOL LLFloaterPathfindingConsole::postBuild()
 	mShowNavMeshCheckBox = findChild<LLCheckBoxCtrl>("show_navmesh");
 	llassert(mShowNavMeshCheckBox != NULL);
 
+	mShowNavMeshWalkabilityComboBox = findChild<LLComboBox>("show_heatmap_mode");
+	llassert(mShowNavMeshWalkabilityComboBox != NULL);
+	mShowNavMeshWalkabilityComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWalkabilitySet, this));
+
 	mShowWalkablesCheckBox = findChild<LLCheckBoxCtrl>("show_walkables");
 	llassert(mShowWalkablesCheckBox != NULL);
 
@@ -142,8 +153,8 @@ BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, E
 BOOL LLFloaterPathfindingConsole::isGeneratePathMode(MASK mask, EClickType clicktype, BOOL down) const
 {
 	return (getVisible() && (mEditTestTabContainer->getCurrentPanelIndex() == 1) &&
-		(clicktype == LLMouseHandler::CLICK_LEFT) && down && 
-		(((mask & MASK_CONTROL) && !(mask & (~MASK_CONTROL))) ||
+		(clicktype == LLMouseHandler::CLICK_LEFT) && down && 
+		(((mask & MASK_CONTROL) && !(mask & (~MASK_CONTROL))) ||
 		((mask & MASK_SHIFT) && !(mask & (~MASK_SHIFT)))));
 }
 
@@ -226,6 +237,66 @@ void LLFloaterPathfindingConsole::setRenderWorld(BOOL pIsRenderWorld)
 	mShowWorldCheckBox->set(pIsRenderWorld);
 }
 
+LLFloaterPathfindingConsole::ERenderHeatmapType LLFloaterPathfindingConsole::getRenderHeatmapType() const
+{
+	ERenderHeatmapType renderHeatmapType;
+
+	switch (mShowNavMeshWalkabilityComboBox->getValue().asInteger())
+	{
+	case XUI_RENDER_HEATMAP_NONE :
+		renderHeatmapType = kRenderHeatmapNone;
+		break;
+	case XUI_RENDER_HEATMAP_A :
+		renderHeatmapType = kRenderHeatmapA;
+		break;
+	case XUI_RENDER_HEATMAP_B :
+		renderHeatmapType = kRenderHeatmapB;
+		break;
+	case XUI_RENDER_HEATMAP_C :
+		renderHeatmapType = kRenderHeatmapC;
+		break;
+	case XUI_RENDER_HEATMAP_D :
+		renderHeatmapType = kRenderHeatmapD;
+		break;
+	default :
+		renderHeatmapType = kRenderHeatmapNone;
+		llassert(0);
+		break;
+	}
+
+	return renderHeatmapType;
+}
+
+void LLFloaterPathfindingConsole::setRenderHeatmapType(ERenderHeatmapType pRenderHeatmapType)
+{
+	LLSD comboBoxValue;
+
+	switch (pRenderHeatmapType)
+	{
+	case kRenderHeatmapNone :
+		comboBoxValue = XUI_RENDER_HEATMAP_NONE;
+		break;
+	case kRenderHeatmapA :
+		comboBoxValue = XUI_RENDER_HEATMAP_A;
+		break;
+	case kRenderHeatmapB :
+		comboBoxValue = XUI_RENDER_HEATMAP_B;
+		break;
+	case kRenderHeatmapC :
+		comboBoxValue = XUI_RENDER_HEATMAP_C;
+		break;
+	case kRenderHeatmapD :
+		comboBoxValue = XUI_RENDER_HEATMAP_D;
+		break;
+	default :
+		comboBoxValue = XUI_RENDER_HEATMAP_NONE;
+		llassert(0);
+		break;
+	}
+
+	return mShowNavMeshWalkabilityComboBox->setValue(comboBoxValue);
+}
+
 F32 LLFloaterPathfindingConsole::getCharacterWidth() const
 {
 	return mCharacterWidthSlider->getValueF32();
@@ -312,6 +383,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed)
 	: LLFloater(pSeed),
 	mSelfHandle(),
 	mShowNavMeshCheckBox(NULL),
+	mShowNavMeshWalkabilityComboBox(NULL),
 	mShowWalkablesCheckBox(NULL),
 	mShowStaticObstaclesCheckBox(NULL),
 	mShowMaterialVolumesCheckBox(NULL),
@@ -408,6 +480,41 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey)
 	}		
 }
 
+void LLFloaterPathfindingConsole::onShowWalkabilitySet()
+{
+	switch (getRenderHeatmapType())
+	{
+	case kRenderHeatmapNone :
+		llwarns << "functionality has not yet been implemented to toggle '"
+			<< mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapNone"
+			<< llendl;
+		break;
+	case kRenderHeatmapA :
+		llwarns << "functionality has not yet been implemented to toggle '"
+			<< mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapA"
+			<< llendl;
+		break;
+	case kRenderHeatmapB :
+		llwarns << "functionality has not yet been implemented to toggle '"
+			<< mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapB"
+			<< llendl;
+		break;
+	case kRenderHeatmapC :
+		llwarns << "functionality has not yet been implemented to toggle '"
+			<< mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapC"
+			<< llendl;
+		break;
+	case kRenderHeatmapD :
+		llwarns << "functionality has not yet been implemented to toggle '"
+			<< mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapD"
+			<< llendl;
+		break;
+	default :
+		llassert(0);
+		break;
+	}
+}
+
 void LLFloaterPathfindingConsole::onShowWorldToggle()
 {
 	BOOL checkBoxValue = mShowWorldCheckBox->get();
diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h
index 8f4b7d625e..726bf36636 100644
--- a/indra/newview/llfloaterpathfindingconsole.h
+++ b/indra/newview/llfloaterpathfindingconsole.h
@@ -40,6 +40,7 @@ class LLLineEditor;
 class LLTextBase;
 class LLCheckBoxCtrl;
 class LLTabContainer;
+class LLComboBox;
 
 class LLFloaterPathfindingConsole
 :	public LLFloater
@@ -47,6 +48,15 @@ class LLFloaterPathfindingConsole
 	friend class LLFloaterReg;
 
 public:
+	typedef enum
+	{
+		kRenderHeatmapNone,
+		kRenderHeatmapA,
+		kRenderHeatmapB,
+		kRenderHeatmapC,
+		kRenderHeatmapD
+	} ERenderHeatmapType;
+
 	typedef enum
 	{
 		kCharacterTypeA = 0,
@@ -82,11 +92,14 @@ public:
 	BOOL isRenderWorld() const;
 	void setRenderWorld(BOOL pIsRenderWorld);
 
-    F32                   getCharacterWidth() const;
-    void                  setCharacterWidth(F32 pCharacterWidth);
+	ERenderHeatmapType getRenderHeatmapType() const;
+	void               setRenderHeatmapType(ERenderHeatmapType pRenderHeatmapType);
+
+    F32            getCharacterWidth() const;
+    void           setCharacterWidth(F32 pCharacterWidth);
 
-    ECharacterType        getCharacterType() const;
-    void                  setCharacterType(ECharacterType pCharacterType);
+    ECharacterType getCharacterType() const;
+    void           setCharacterType(ECharacterType pCharacterType);
 
 	void setHasNavMeshReceived();
 	void setHasNoNavMesh();
@@ -101,6 +114,7 @@ private:
 
 	virtual void onOpen(const LLSD& pKey);
 
+	void onShowWalkabilitySet();
 	void onShowWorldToggle();
 	void onCharacterWidthSet();
 	void onCharacterTypeSwitch();
@@ -113,6 +127,7 @@ private:
 
 	LLRootHandle<LLFloaterPathfindingConsole> mSelfHandle;
 	LLCheckBoxCtrl                            *mShowNavMeshCheckBox;
+	LLComboBox                                *mShowNavMeshWalkabilityComboBox;
 	LLCheckBoxCtrl                            *mShowWalkablesCheckBox;
 	LLCheckBoxCtrl                            *mShowStaticObstaclesCheckBox;
 	LLCheckBoxCtrl                            *mShowMaterialVolumesCheckBox;
diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml
index 3fe3dfe963..4a41736972 100644
--- a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml
+++ b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml
@@ -2,7 +2,7 @@
 <floater
     open_positioning="cascading"
     can_tear_off="false"
-    height="320"
+    height="330"
     layout="topleft"
     name="floater_pathfinding_console"
     help_topic="floater_pathfinding_console"
@@ -43,14 +43,27 @@
       name="show_navmesh"
       top_pad="8"
       width="90" />
+  <text
+      height="13"
+      word_wrap="true"
+      use_ellipses="false"
+      type="string"
+      text_color="LabelTextColor"
+      length="1"
+      follows="left|top"
+      layout="topleft"
+      left="35"
+      width="208">
+    Show walkability heatmap:
+  </text>
   <combo_box
       height="18"
       layout="topleft"
       left="34"
       name="show_heatmap_mode"
-      width="155">
+      width="125">
     <combo_box.item
-        label="Show walkability map..."
+        label="None"
         name="show_heatmap_mode_none"
         value="0" />
     <combo_box.item
@@ -269,6 +282,7 @@
           follows="left|top"
           layout="topleft"
           left="16"
+          line_spacing.multiple="1.5"
           top_pad="23"
           height="26"
           width="190">
-- 
cgit v1.2.3