From 59d402e664e42f187012e626a924a565b7683795 Mon Sep 17 00:00:00 2001
From: Vadim Savchuk <vsavchuk@productengine.com>
Date: Thu, 21 Jan 2010 20:12:00 +0200
Subject: [PATCH] Fixed major regression bug EXT-4503 (Clicking on parcel
 limitation icons does not give description). Although there are tooltips on
 the icons...

--HG--
branch : product-engine
---
 indra/newview/lllocationinputctrl.cpp | 52 +++++++++++++++++++++++++++
 indra/newview/lllocationinputctrl.h   | 23 ++++++------
 2 files changed, 65 insertions(+), 10 deletions(-)

diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index 404e2668060..7f49a7defb5 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -43,8 +43,11 @@
 #include "lltrans.h"
 #include "lluictrlfactory.h"
 #include "lltooltip.h"
+#include "llnotificationsutil.h"
+#include "llregionflags.h"
 
 // newview includes
+#include "llagent.h"
 #include "llinventoryobserver.h"
 #include "lllandmarkactions.h"
 #include "lllandmarklist.h"
@@ -56,6 +59,7 @@
 #include "lltrans.h"
 #include "llviewerinventory.h"
 #include "llviewerparcelmgr.h"
+#include "llviewerregion.h"
 #include "llviewercontrol.h"
 #include "llviewermenu.h"
 #include "llurllineeditorctrl.h"
@@ -256,36 +260,42 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p)
 	voice_icon.tool_tip = LLTrans::getString("LocationCtrlVoiceTooltip");
 	voice_icon.mouse_opaque = true;
 	mParcelIcon[VOICE_ICON] = LLUICtrlFactory::create<LLIconCtrl>(voice_icon);
+	mParcelIcon[VOICE_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, VOICE_ICON));
 	addChild(mParcelIcon[VOICE_ICON]);
 
 	LLIconCtrl::Params fly_icon = p.fly_icon;
 	fly_icon.tool_tip = LLTrans::getString("LocationCtrlFlyTooltip");
 	fly_icon.mouse_opaque = true;
 	mParcelIcon[FLY_ICON] = LLUICtrlFactory::create<LLIconCtrl>(fly_icon);
+	mParcelIcon[FLY_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, FLY_ICON));
 	addChild(mParcelIcon[FLY_ICON]);
 
 	LLIconCtrl::Params push_icon = p.push_icon;
 	push_icon.tool_tip = LLTrans::getString("LocationCtrlPushTooltip");
 	push_icon.mouse_opaque = true;
 	mParcelIcon[PUSH_ICON] = LLUICtrlFactory::create<LLIconCtrl>(push_icon);
+	mParcelIcon[PUSH_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, PUSH_ICON));
 	addChild(mParcelIcon[PUSH_ICON]);
 
 	LLIconCtrl::Params build_icon = p.build_icon;
 	build_icon.tool_tip = LLTrans::getString("LocationCtrlBuildTooltip");
 	build_icon.mouse_opaque = true;
 	mParcelIcon[BUILD_ICON] = LLUICtrlFactory::create<LLIconCtrl>(build_icon);
+	mParcelIcon[BUILD_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, BUILD_ICON));
 	addChild(mParcelIcon[BUILD_ICON]);
 
 	LLIconCtrl::Params scripts_icon = p.scripts_icon;
 	scripts_icon.tool_tip = LLTrans::getString("LocationCtrlScriptsTooltip");
 	scripts_icon.mouse_opaque = true;
 	mParcelIcon[SCRIPTS_ICON] = LLUICtrlFactory::create<LLIconCtrl>(scripts_icon);
+	mParcelIcon[SCRIPTS_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, SCRIPTS_ICON));
 	addChild(mParcelIcon[SCRIPTS_ICON]);
 
 	LLIconCtrl::Params damage_icon = p.damage_icon;
 	damage_icon.tool_tip = LLTrans::getString("LocationCtrlDamageTooltip");
 	damage_icon.mouse_opaque = true;
 	mParcelIcon[DAMAGE_ICON] = LLUICtrlFactory::create<LLIconCtrl>(damage_icon);
+	mParcelIcon[DAMAGE_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, DAMAGE_ICON));
 	addChild(mParcelIcon[DAMAGE_ICON]);
 	
 	LLTextBox::Params damage_text = p.damage_text;
@@ -918,3 +928,45 @@ bool LLLocationInputCtrl::onLocationContextMenuItemEnabled(const LLSD& userdata)
 
 	return false;
 }
+
+void LLLocationInputCtrl::onParcelIconClick(EParcelIcon icon)
+{
+	switch (icon)
+	{
+	case VOICE_ICON:
+		LLNotificationsUtil::add("NoVoice");
+		break;
+	case FLY_ICON:
+		LLNotificationsUtil::add("NoFly");
+		break;
+	case PUSH_ICON:
+		LLNotificationsUtil::add("PushRestricted");
+		break;
+	case BUILD_ICON:
+		LLNotificationsUtil::add("NoBuild");
+		break;
+	case SCRIPTS_ICON:
+	{
+		LLViewerRegion* region = gAgent.getRegion();
+		if(region && region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS)
+		{
+			LLNotificationsUtil::add("ScriptsStopped");
+		}
+		else if(region && region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS)
+		{
+			LLNotificationsUtil::add("ScriptsNotRunning");
+		}
+		else
+		{
+			LLNotificationsUtil::add("NoOutsideScripts");
+		}
+		break;
+	}
+	case DAMAGE_ICON:
+		LLNotificationsUtil::add("NotSafe");
+		break;
+	case ICON_COUNT:
+		break;
+	// no default to get compiler warning when a new icon gets added
+	}
+}
diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h
index 7959fab2de1..607ccd4da62 100644
--- a/indra/newview/lllocationinputctrl.h
+++ b/indra/newview/lllocationinputctrl.h
@@ -102,6 +102,18 @@ class LLLocationInputCtrl
 	void					handleLoginComplete();
 
 private:
+
+	enum EParcelIcon
+	{
+		VOICE_ICON = 0,
+		FLY_ICON,
+		PUSH_ICON,
+		BUILD_ICON,
+		SCRIPTS_ICON,
+		DAMAGE_ICON,
+		ICON_COUNT
+	};
+
 	friend class LLUICtrlFactory;
 	LLLocationInputCtrl(const Params&);
 	virtual ~LLLocationInputCtrl();
@@ -138,6 +150,7 @@ class LLLocationInputCtrl
 	// callbacks
 	bool					onLocationContextMenuItemEnabled(const LLSD& userdata);
 	void 					onLocationContextMenuItemClicked(const LLSD& userdata);
+	void					onParcelIconClick(EParcelIcon icon);
 
 	LLMenuGL*				mLocationContextMenu;
 	LLButton*				mAddLandmarkBtn;
@@ -146,16 +159,6 @@ class LLLocationInputCtrl
 	S32						mIconHPad;			// pad between all icons
 	S32						mAddLandmarkHPad;	// pad to left of landmark star
 	
-	enum EParcelIcon
-	{
-		VOICE_ICON = 0,
-		FLY_ICON,
-		PUSH_ICON,
-		BUILD_ICON,
-		SCRIPTS_ICON,
-		DAMAGE_ICON,
-		ICON_COUNT
-	};
 	LLIconCtrl*	mParcelIcon[ICON_COUNT];
 	LLTextBox* mDamageText;
 
-- 
GitLab