From 347562844dc2be598f39138a39eaacaff6b4e323 Mon Sep 17 00:00:00 2001
From: James Cook <james@lindenlab.com>
Date: Mon, 23 Nov 2009 14:23:51 -0800
Subject: [PATCH] Initial implementation of parcel property icons and maturity
 string on nav bar Added new LLAgentUI location format, renamed unclear old
 one Renamed ShowCoordinatesOption to NavBarShowCoordinates Extended
 LLLocationInputCtrl to show icons. Reviewed with Rick

---
 indra/newview/app_settings/settings.xml       |   2 +-
 indra/newview/llagentui.cpp                   |  19 ++-
 indra/newview/llagentui.h                     |   9 +-
 indra/newview/llglsandbox.cpp                 |   5 +-
 indra/newview/lllocationinputctrl.cpp         | 112 +++++++++++++++---
 indra/newview/lllocationinputctrl.h           |  27 ++++-
 indra/newview/llnavigationbar.cpp             |   2 +-
 indra/newview/llteleporthistory.cpp           |   4 +-
 indra/newview/llteleporthistory.h             |   3 +-
 indra/newview/lltoolmgr.cpp                   |   2 +-
 indra/newview/llviewermenu.cpp                |   4 +-
 indra/newview/llviewerparcelmgr.cpp           |  42 +++++--
 indra/newview/llviewerparcelmgr.h             |  30 +++--
 .../default/xui/en/widgets/location_input.xml |  48 +++++++-
 14 files changed, 256 insertions(+), 53 deletions(-)

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index c7279a2e333..21ccf2ac913 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -7709,7 +7709,7 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-    <key>ShowCoordinatesOption</key>
+    <key>NavBarShowCoordinates</key>
     <map>
       <key>Comment</key>
       <string>Show Coordinates in  Location Input Field</string>
diff --git a/indra/newview/llagentui.cpp b/indra/newview/llagentui.cpp
index 568ac4164ac..7404fe5bc47 100644
--- a/indra/newview/llagentui.cpp
+++ b/indra/newview/llagentui.cpp
@@ -130,6 +130,7 @@ BOOL LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt,const
 	// create a default name and description for the landmark
 	std::string parcel_name = LLViewerParcelMgr::getInstance()->getAgentParcelName();
 	std::string region_name = region->getName();
+	std::string sim_access_string = region->getSimAccessString();
 	std::string buffer;
 	if( parcel_name.empty() )
 	{
@@ -142,7 +143,13 @@ BOOL LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt,const
 		case LOCATION_FORMAT_NORMAL:
 			buffer = llformat("%s", region_name.c_str());
 			break;
-		case LOCATION_FORMAT_WITHOUT_SIM:
+		case LOCATION_FORMAT_NO_COORDS:
+			buffer = llformat("%s%s%s",
+				region_name.c_str(),
+				sim_access_string.empty() ? "" : " - ",
+				sim_access_string.c_str());
+			break;
+		case LOCATION_FORMAT_NO_MATURITY:
 		case LOCATION_FORMAT_FULL:
 			buffer = llformat("%s (%d, %d, %d)",
 				region_name.c_str(),
@@ -161,14 +168,20 @@ BOOL LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt,const
 		case LOCATION_FORMAT_NORMAL:
 			buffer = llformat("%s, %s", parcel_name.c_str(), region_name.c_str());
 			break;
-		case LOCATION_FORMAT_WITHOUT_SIM:
+		case LOCATION_FORMAT_NO_MATURITY:
 			buffer = llformat("%s, %s (%d, %d, %d)",
 				parcel_name.c_str(),
 				region_name.c_str(),
 				pos_x, pos_y, pos_z);
 			break;
+		case LOCATION_FORMAT_NO_COORDS:
+			buffer = llformat("%s, %s%s%s",
+							  parcel_name.c_str(),
+							  region_name.c_str(),
+							  sim_access_string.empty() ? "" : " - ",
+							  sim_access_string.c_str());
+				break;
 		case LOCATION_FORMAT_FULL:
-			std::string sim_access_string = region->getSimAccessString();
 			buffer = llformat("%s, %s (%d, %d, %d)%s%s",
 				parcel_name.c_str(),
 				region_name.c_str(),
diff --git a/indra/newview/llagentui.h b/indra/newview/llagentui.h
index c7aafb71e7b..3478793e38f 100644
--- a/indra/newview/llagentui.h
+++ b/indra/newview/llagentui.h
@@ -38,10 +38,11 @@ class LLAgentUI
 public:
 	enum ELocationFormat
 	{
-		LOCATION_FORMAT_NORMAL,
-		LOCATION_FORMAT_LANDMARK,
-		LOCATION_FORMAT_WITHOUT_SIM,
-		LOCATION_FORMAT_FULL,
+		LOCATION_FORMAT_NORMAL,			// Parcel
+		LOCATION_FORMAT_LANDMARK,		// Parcel, Region
+		LOCATION_FORMAT_NO_MATURITY,	// Parcel, Region (x, y, z)
+		LOCATION_FORMAT_NO_COORDS,		// Parcel, Region - Maturity
+		LOCATION_FORMAT_FULL,			// Parcel, Region (x, y, z) - Maturity
 	};
 
 	static void buildName(std::string& name);
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp
index 43fbe362d59..750a9d478fe 100644
--- a/indra/newview/llglsandbox.cpp
+++ b/indra/newview/llglsandbox.cpp
@@ -67,7 +67,10 @@
 #include "llresmgr.h"
 #include "pipeline.h"
 #include "llspatialpartition.h"
- 
+
+// Height of the yellow selection highlight posts for land
+const F32 PARCEL_POST_HEIGHT = 0.666f;
+
 BOOL LLAgent::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position)
 {
 	if(object && object->isAttachment())
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index 7e35cfa04c2..be96d7b43a0 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -157,15 +157,21 @@ LLLocationInputCtrl::Params::Params()
 	add_landmark_image_disabled("add_landmark_image_disabled"),
 	add_landmark_image_hover("add_landmark_image_hover"),
 	add_landmark_image_selected("add_landmark_image_selected"),
+	icon_hpad("icon_hpad", 0),
 	add_landmark_button("add_landmark_button"),
-	add_landmark_hpad("add_landmark_hpad", 0),
-	info_button("info_button")
+	info_button("info_button"),
+	voice_icon("voice_icon"),
+	fly_icon("fly_icon"),
+	push_icon("push_icon"),
+	build_icon("build_icon"),
+	scripts_icon("scripts_icon"),
+	damage_icon("damage_icon")
 {
 }
 
 LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p)
 :	LLComboBox(p),
-	mAddLandmarkHPad(p.add_landmark_hpad),
+	mIconHPad(p.icon_hpad),
 	mInfoBtn(NULL),
 	mLocationContextMenu(NULL),
 	mAddLandmarkBtn(NULL),
@@ -230,6 +236,32 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p)
 	mAddLandmarkBtn = LLUICtrlFactory::create<LLButton>(al_params);
 	enableAddLandmarkButton(true);
 	addChild(mAddLandmarkBtn);
+
+	// Parcel property icons
+	LLIconCtrl::Params voice_icon = p.voice_icon;
+	mParcelIcon[VOICE_ICON] = LLUICtrlFactory::create<LLIconCtrl>(voice_icon);
+	addChild(mParcelIcon[VOICE_ICON]);
+
+	LLIconCtrl::Params fly_icon = p.fly_icon;
+	mParcelIcon[FLY_ICON] = LLUICtrlFactory::create<LLIconCtrl>(fly_icon);
+	addChild(mParcelIcon[FLY_ICON]);
+
+	LLIconCtrl::Params push_icon = p.push_icon;
+	mParcelIcon[PUSH_ICON] = LLUICtrlFactory::create<LLIconCtrl>(push_icon);
+	addChild(mParcelIcon[PUSH_ICON]);
+
+	LLIconCtrl::Params build_icon = p.build_icon;
+	mParcelIcon[BUILD_ICON] = LLUICtrlFactory::create<LLIconCtrl>(build_icon);
+	addChild(mParcelIcon[BUILD_ICON]);
+
+	LLIconCtrl::Params scripts_icon = p.scripts_icon;
+	mParcelIcon[SCRIPTS_ICON] = LLUICtrlFactory::create<LLIconCtrl>(scripts_icon);
+	addChild(mParcelIcon[SCRIPTS_ICON]);
+
+	LLIconCtrl::Params damage_icon = p.damage_icon;
+	mParcelIcon[DAMAGE_ICON] = LLUICtrlFactory::create<LLIconCtrl>(damage_icon);
+	addChild(mParcelIcon[DAMAGE_ICON]);
+	// TODO: health number?
 	
 	// Register callbacks and load the location field context menu (NB: the order matters).
 	LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Navbar.Action", boost::bind(&LLLocationInputCtrl::onLocationContextMenuItemClicked, this, _2));
@@ -410,9 +442,10 @@ void LLLocationInputCtrl::onFocusLost()
 		mTextEntry->deselect();
 	}
 }
-void	LLLocationInputCtrl::draw(){
-	
-	if(!hasFocus() && gSavedSettings.getBOOL("ShowCoordinatesOption")){
+
+void LLLocationInputCtrl::draw()
+{	
+	if(!hasFocus() && gSavedSettings.getBOOL("NavBarShowCoordinates")){
 		refreshLocation();
 	}
 	LLComboBox::draw();
@@ -532,6 +565,7 @@ void LLLocationInputCtrl::onTextEditorRightClicked(S32 x, S32 y, MASK mask)
 void LLLocationInputCtrl::refresh()
 {
 	refreshLocation();			// update location string
+	refreshParcelIcons();
 	updateAddLandmarkButton();	// indicate whether current parcel has been landmarked 
 }
 
@@ -548,13 +582,57 @@ void LLLocationInputCtrl::refreshLocation()
 
 	// Update location field.
 	std::string location_name;
-	LLAgentUI::ELocationFormat format =  (gSavedSettings.getBOOL("ShowCoordinatesOption") ? 
-			LLAgentUI::LOCATION_FORMAT_WITHOUT_SIM: LLAgentUI::LOCATION_FORMAT_NORMAL);
+	LLAgentUI::ELocationFormat format =
+		(gSavedSettings.getBOOL("NavBarShowCoordinates")
+			? LLAgentUI::LOCATION_FORMAT_FULL
+			: LLAgentUI::LOCATION_FORMAT_NO_COORDS);
 
-	if (!LLAgentUI::buildLocationString(location_name, format)) location_name = "Unknown";
+	if (!LLAgentUI::buildLocationString(location_name, format)) 
+	{
+		location_name = "???";
+	}
 	setText(location_name);
 }
 
+void LLLocationInputCtrl::refreshParcelIcons()
+{
+	LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance();
+	// *TODO buy
+	//bool allow_buy      = vpm->canAgentBuyParcel( vpm->getAgentParcel(), false);
+	bool allow_voice	= vpm->allowAgentVoice();
+	bool allow_fly		= vpm->allowAgentFly();
+	bool allow_push		= vpm->allowAgentPush();
+	bool allow_build	= vpm->allowAgentBuild();
+	bool allow_scripts	= vpm->allowAgentScripts();
+	bool allow_damage	= vpm->allowAgentDamage();
+
+	// Most icons are "block this ability"
+	mParcelIcon[VOICE_ICON]->setVisible(   !allow_voice );
+	mParcelIcon[FLY_ICON]->setVisible(     !allow_fly );
+	mParcelIcon[PUSH_ICON]->setVisible(    !allow_push );
+	mParcelIcon[BUILD_ICON]->setVisible(   !allow_build );
+	mParcelIcon[SCRIPTS_ICON]->setVisible( !allow_scripts );
+	mParcelIcon[DAMAGE_ICON]->setVisible(  allow_damage );
+	// *TODO damage meter
+
+	// Slide the parcel icons rect from right to left, adjusting rectangles of
+	// visible icons.  Assumes all icon rects are the same.
+	LLRect icon_rect = mParcelIcon[0]->getRect();
+	S32 icon_width = icon_rect.getWidth();
+	icon_rect.mRight = mAddLandmarkBtn->getRect().mLeft - mIconHPad;
+	icon_rect.mLeft = icon_rect.mRight - icon_width;
+	
+	for (S32 i = 0; i < ICON_COUNT; ++i)
+	{
+		if (mParcelIcon[i]->getVisible())
+		{
+			mParcelIcon[i]->setRect( icon_rect );
+			icon_rect.translate( -icon_width - mIconHPad, 0);
+		}
+	}
+	// *TODO: health meter
+}
+
 void LLLocationInputCtrl::rebuildLocationHistory(std::string filter)
 {
 	LLLocationHistory::location_list_t filtered_items;
@@ -651,13 +729,11 @@ void LLLocationInputCtrl::updateWidgetlayout()
 	mInfoBtn->setRect(info_btn_rect);
 
 	// "Add Landmark" button
-	{
-		LLRect al_btn_rect = mAddLandmarkBtn->getRect();
-		al_btn_rect.translate(
-			hist_btn_rect.mLeft - mAddLandmarkHPad - al_btn_rect.getWidth(),
-			(rect.getHeight() - al_btn_rect.getHeight()) / 2);
-		mAddLandmarkBtn->setRect(al_btn_rect);
-	}
+	LLRect al_btn_rect = mAddLandmarkBtn->getRect();
+	al_btn_rect.translate(
+		hist_btn_rect.mLeft - mIconHPad - al_btn_rect.getWidth(),
+		(rect.getHeight() - al_btn_rect.getHeight()) / 2);
+	mAddLandmarkBtn->setRect(al_btn_rect);
 }
 
 void LLLocationInputCtrl::changeLocationPresentation()
@@ -680,7 +756,7 @@ void LLLocationInputCtrl::onLocationContextMenuItemClicked(const LLSD& userdata)
 
 	if (item == std::string("show_coordinates"))
 	{
-		gSavedSettings.setBOOL("ShowCoordinatesOption",!gSavedSettings.getBOOL("ShowCoordinatesOption"));
+		gSavedSettings.setBOOL("NavBarShowCoordinates",!gSavedSettings.getBOOL("NavBarShowCoordinates"));
 	}
 	else if (item == std::string("landmark"))
 	{
@@ -744,7 +820,7 @@ bool LLLocationInputCtrl::onLocationContextMenuItemEnabled(const LLSD& userdata)
 	}
 	else if(item == std::string("show_coordinates")){
 	
-		return gSavedSettings.getBOOL("ShowCoordinatesOption");
+		return gSavedSettings.getBOOL("NavBarShowCoordinates");
 	}
 
 	return false;
diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h
index 44dc0cb2510..fefd0f7fec6 100644
--- a/indra/newview/lllocationinputctrl.h
+++ b/indra/newview/lllocationinputctrl.h
@@ -33,7 +33,8 @@
 #ifndef LL_LLLOCATIONINPUTCTRL_H
 #define LL_LLLOCATIONINPUTCTRL_H
 
-#include <llcombobox.h>
+#include "llcombobox.h"
+#include "lliconctrl.h"		// Params
 
 class LLLandmark;
 
@@ -63,9 +64,15 @@ class LLLocationInputCtrl
 											add_landmark_image_disabled,
 											add_landmark_image_hover,
 											add_landmark_image_selected;
-		Optional<S32>						add_landmark_hpad;
+		Optional<S32>						icon_hpad;
 		Optional<LLButton::Params>			add_landmark_button,
 											info_button;
+		Optional<LLIconCtrl::Params>		voice_icon,
+											fly_icon,
+											push_icon,
+											build_icon,
+											scripts_icon,
+											damage_icon;
 		Params();
 	};
 
@@ -103,6 +110,7 @@ class LLLocationInputCtrl
 	void					enableAddLandmarkButton(bool val);
 	void					refresh();
 	void					refreshLocation();
+	void					refreshParcelIcons();
 	void					rebuildLocationHistory(std::string filter = "");
 	bool 					findTeleportItemsByTitle(const LLTeleportHistoryItem& item, const std::string& filter);
 	void					setText(const LLStringExplicit& text);
@@ -126,7 +134,20 @@ class LLLocationInputCtrl
 	LLMenuGL*				mLocationContextMenu;
 	LLButton*				mAddLandmarkBtn;
 	LLButton*				mInfoBtn;
-	S32						mAddLandmarkHPad;
+	S32						mIconHPad;
+	
+	enum EParcelIcon
+	{
+		VOICE_ICON = 0,
+		FLY_ICON,
+		PUSH_ICON,
+		BUILD_ICON,
+		SCRIPTS_ICON,
+		DAMAGE_ICON,
+		ICON_COUNT
+	};
+	LLIconCtrl*	mParcelIcon[ICON_COUNT];
+	// TODO: Health meter?
 
 	LLAddLandmarkObserver*		mAddLandmarkObserver;
 	LLRemoveLandmarkObserver*	mRemoveLandmarkObserver;
diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp
index 114d26af8aa..46d64c34163 100644
--- a/indra/newview/llnavigationbar.cpp
+++ b/indra/newview/llnavigationbar.cpp
@@ -413,7 +413,7 @@ void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos, con
 	 * At this moment gAgent.getPositionAgent() contains previous coordinates.
 	 * according to EXT-65 agent position is being reseted on each frame.  
 	 */
-		LLAgentUI::buildLocationString(location, LLAgentUI::LOCATION_FORMAT_WITHOUT_SIM,
+		LLAgentUI::buildLocationString(location, LLAgentUI::LOCATION_FORMAT_NO_MATURITY,
 					gAgent.getPosAgentFromGlobal(global_agent_pos));
 	std::string tooltip (LLSLURL::buildSLURLfromPosGlobal(gAgent.getRegion()->getName(), global_agent_pos, false));
 	
diff --git a/indra/newview/llteleporthistory.cpp b/indra/newview/llteleporthistory.cpp
index bc886d57432..cc4689062eb 100644
--- a/indra/newview/llteleporthistory.cpp
+++ b/indra/newview/llteleporthistory.cpp
@@ -52,7 +52,7 @@
 
 const std::string& LLTeleportHistoryItem::getTitle() const
 {
-	return gSavedSettings.getBOOL("ShowCoordinatesOption") ? mFullTitle : mTitle;
+	return gSavedSettings.getBOOL("NavBarShowCoordinates") ? mFullTitle : mTitle;
 }
 
 //////////////////////////////////////////////////////////////////////////////
@@ -177,7 +177,7 @@ void LLTeleportHistory::purgeItems()
 std::string LLTeleportHistory::getCurrentLocationTitle(bool full, const LLVector3& local_pos_override)
 {
 	std::string location_name;
-	LLAgentUI::ELocationFormat fmt = full ? LLAgentUI::LOCATION_FORMAT_WITHOUT_SIM : LLAgentUI::LOCATION_FORMAT_NORMAL;
+	LLAgentUI::ELocationFormat fmt = full ? LLAgentUI::LOCATION_FORMAT_NO_MATURITY : LLAgentUI::LOCATION_FORMAT_NORMAL;
 
 	if (!LLAgentUI::buildLocationString(location_name, fmt, local_pos_override)) location_name = "Unknown";
 	return location_name;
diff --git a/indra/newview/llteleporthistory.h b/indra/newview/llteleporthistory.h
index 9f5563ed0b4..a82bec7c4f4 100644
--- a/indra/newview/llteleporthistory.h
+++ b/indra/newview/llteleporthistory.h
@@ -57,7 +57,8 @@ class LLTeleportHistoryItem
 	{}
 
 	/**
-	 * @return title formatted according to the current value of the ShowCoordinatesOption setting.
+	 * @return title formatted according to the current value of the 
+	 * NavBarShowCoordinates setting.
 	 */
 	const std::string& getTitle() const;
 	
diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp
index ded83debad8..26b3bdb82e2 100644
--- a/indra/newview/lltoolmgr.cpp
+++ b/indra/newview/lltoolmgr.cpp
@@ -247,7 +247,7 @@ bool LLToolMgr::inEdit()
 
 bool LLToolMgr::canEdit()
 {
-	return LLViewerParcelMgr::getInstance()->agentCanBuild();
+	return LLViewerParcelMgr::getInstance()->allowAgentBuild();
 }
 
 void LLToolMgr::toggleBuildMode()
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index c67af994a42..ee1a469bbd9 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -2736,7 +2736,7 @@ bool enable_object_edit()
 	bool enable = false;
 	if (gAgent.inPrelude())
 	{
-		enable = LLViewerParcelMgr::getInstance()->agentCanBuild()
+		enable = LLViewerParcelMgr::getInstance()->allowAgentBuild()
 			|| LLSelectMgr::getInstance()->getSelection()->isAttachment();
 	} 
 	else if (LLSelectMgr::getInstance()->selectGetModify())
@@ -6096,7 +6096,7 @@ class LLAttachmentEnableDrop : public view_listener_t
 {
 	bool handleEvent(const LLSD& userdata)
 	{
-		BOOL can_build   = gAgent.isGodlike() || (LLViewerParcelMgr::getInstance()->agentCanBuild());
+		BOOL can_build   = gAgent.isGodlike() || (LLViewerParcelMgr::getInstance()->allowAgentBuild());
 
 		//Add an inventory observer to only allow dropping the newly attached item
 		//once it exists in your inventory.  Look at Jira 2422.
diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index aa0987aa7d1..fcaf49c8849 100644
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -650,7 +650,7 @@ LLParcel *LLViewerParcelMgr::getAgentParcel() const
 }
 
 // Return whether the agent can build on the land they are on
-bool LLViewerParcelMgr::agentCanBuild() const
+bool LLViewerParcelMgr::allowAgentBuild() const
 {
 	if (mAgentParcel)
 	{
@@ -664,19 +664,47 @@ bool LLViewerParcelMgr::agentCanBuild() const
 	}
 }
 
-BOOL LLViewerParcelMgr::agentCanTakeDamage() const
+bool LLViewerParcelMgr::allowAgentVoice() const
 {
-	return mAgentParcel->getAllowDamage();
+	LLViewerRegion* region = gAgent.getRegion();
+	return region && region->isVoiceEnabled()
+		&& mAgentParcel	&& mAgentParcel->getParcelFlagAllowVoice();
 }
 
-BOOL LLViewerParcelMgr::agentCanFly() const
+bool LLViewerParcelMgr::allowAgentFly() const
 {
-	return TRUE;
+	LLViewerRegion* region = gAgent.getRegion();
+	return region && !region->getBlockFly()
+		&& mAgentParcel && mAgentParcel->getAllowFly();
 }
 
-F32 LLViewerParcelMgr::agentDrawDistance() const
+// Can the agent be pushed around by LLPushObject?
+bool LLViewerParcelMgr::allowAgentPush() const
 {
-	return 512.f;
+	LLViewerRegion* region = gAgent.getRegion();
+	return region && !region->getRestrictPushObject()
+		&& mAgentParcel && !mAgentParcel->getRestrictPushObject();
+}
+
+bool LLViewerParcelMgr::allowAgentScripts() const
+{
+	LLViewerRegion* region = gAgent.getRegion();
+	// *NOTE: This code does not take into account group-owned parcels
+	// and the flag to allow group-owned scripted objects to run.
+	// This mirrors the traditional menu bar parcel icon code, but is not
+	// technically correct.
+	return region
+		&& !(region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS)
+		&& !(region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS)
+		&& mAgentParcel
+		&& mAgentParcel->getAllowOtherScripts();
+}
+
+bool LLViewerParcelMgr::allowAgentDamage() const
+{
+	LLViewerRegion* region = gAgent.getRegion();
+	return region && region->getAllowDamage()
+		&& mAgentParcel && mAgentParcel->getAllowDamage();
 }
 
 BOOL LLViewerParcelMgr::isOwnedAt(const LLVector3d& pos_global) const
diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h
index 1c8fe23dba1..379190789b0 100644
--- a/indra/newview/llviewerparcelmgr.h
+++ b/indra/newview/llviewerparcelmgr.h
@@ -56,9 +56,6 @@ class LLViewerRegion;
 //							  | EAST_MASK 
 //							  | WEST_MASK);
 
-const F32 PARCEL_POST_HEIGHT = 0.666f;
-//const F32 PARCEL_POST_HEIGHT = 20.f;
-
 // Specify the type of land transfer taking place
 //enum ELandTransferType
 //{
@@ -171,10 +168,29 @@ class LLViewerParcelMgr : public LLSingleton<LLViewerParcelMgr>
 
 	LLParcel*	getCollisionParcel() const;
 
-	BOOL	agentCanTakeDamage() const;
-	BOOL	agentCanFly() const;
-	F32		agentDrawDistance() const;
-	bool	agentCanBuild() const;
+	// Can this agent build on the parcel he is on?
+	// Used for parcel property icons in nav bar.
+	bool	allowAgentBuild() const;
+	
+	// Can this agent speak on the parcel he is on?
+	// Used for parcel property icons in nav bar.
+	bool	allowAgentVoice() const;
+	
+	// Can this agent start flying on this parcel?
+	// Used for parcel property icons in nav bar.
+	bool	allowAgentFly() const;
+	
+	// Can this agent be pushed by llPushObject() on this parcel?
+	// Used for parcel property icons in nav bar.
+	bool	allowAgentPush() const;
+	
+	// Can scripts written by non-parcel-owners run on the agent's current
+	// parcel?  Used for parcel property icons in nav bar.
+	bool	allowAgentScripts() const;
+	
+	// Can the agent be damaged here?
+	// Used for parcel property icons in nav bar.
+	bool	allowAgentDamage() const;
 
 	F32		getHoverParcelWidth() const		
 				{ return F32(mHoverEastNorth.mdV[VX] - mHoverWestSouth.mdV[VX]); }
diff --git a/indra/newview/skins/default/xui/en/widgets/location_input.xml b/indra/newview/skins/default/xui/en/widgets/location_input.xml
index d88bcfab1d7..1fed1c075a6 100644
--- a/indra/newview/skins/default/xui/en/widgets/location_input.xml
+++ b/indra/newview/skins/default/xui/en/widgets/location_input.xml
@@ -11,7 +11,7 @@
                 add_landmark_image_disabled="Favorite_Star_Off"
                 add_landmark_image_hover="Favorite_Star_Over"
                 add_landmark_image_selected="Favorite_Star_Press"
-                add_landmark_hpad="2"
+                icon_hpad="2"
                 allow_text_entry="true"
                 list_position="below"
       	        show_text_as_tentative="false"
@@ -38,7 +38,51 @@
                           scale_image="false"
 			  top="19"
 			  left="-3" />
-  <combo_button name="Location History"
+  <voice_icon
+    name="voice_icon"
+    width="22"
+    height="18"
+	top="21"
+    image_name="parcel_lght_VoiceNo"
+    />
+  <fly_icon
+    name="fly_icon"
+    width="22"
+    height="18"
+	top="21"
+    image_name="parcel_lght_FlyNo"
+    />
+  <push_icon
+    name="push_icon"
+    width="22"
+    height="18"
+	top="21"
+    image_name="parcel_lght_PushNo"
+    />
+  <build_icon
+    name="build_icon"
+    width="22"
+    height="18"
+	top="21"
+    image_name="parcel_lght_BuildNo"
+    />
+  <scripts_icon
+    name="scripts_icon"
+    width="22"
+    height="18"
+	top="21"
+    image_name="parcel_lght_ScriptsNo"
+    />
+  <!-- NOTE: Placeholder icon, there is no dark grayscale version -->
+  <damage_icon
+    name="damage_icon"
+    width="22"
+    height="18"
+	top="21"
+    image_name="parcel_lght_Damage"
+    />
+
+    <combo_button name="Location History"
                           label=""
                           pad_right="0"/>
   <combo_list bg_writeable_color="MenuDefaultBgColor" page_lines="10"
-- 
GitLab