From c994b57fa483d09367546d27434c25a316d86fe0 Mon Sep 17 00:00:00 2001
From: Leyla Farazha <leyla@lindenlab.com>
Date: Thu, 19 Nov 2009 16:29:20 -0800
Subject: [PATCH] EXT-2490 	 Right click context menu for objects should
 include build tools EXT-2541 	 Help > Report Abuse screenshot not showing up
 EXT-2549 	 Crash on exit from mouse-look (Mini Map related) EXT-2548 
  Viewer freezes when going out of the mouselook while there are more than two
 floaters EXT-1983 	 [BSI] Trying to edit a script in a no mod object pops
 up script editor with "object out of range" reviewed by Richard

---
 indra/llui/llfloater.cpp                          |  8 ++++++--
 indra/newview/llagent.cpp                         |  6 +++++-
 indra/newview/llpanelobjectinventory.cpp          | 13 ++++++++++---
 indra/newview/llviewermenu.cpp                    | 15 ++++++++++++++-
 .../skins/default/xui/en/floater_report_abuse.xml |  2 +-
 .../skins/default/xui/en/notifications.xml        |  7 +++++++
 6 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 2a0dcaf3336..bf965e8e28e 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -2526,8 +2526,12 @@ void LLFloaterView::pushVisibleAll(BOOL visible, const skip_list_t& skip_list)
 
 void LLFloaterView::popVisibleAll(const skip_list_t& skip_list)
 {
-	for (child_list_const_iter_t child_iter = getChildList()->begin();
-		 child_iter != getChildList()->end(); ++child_iter)
+	// make a copy of the list since some floaters change their
+	// order in the childList when changing visibility.
+	child_list_t child_list_copy = *getChildList();
+
+	for (child_list_const_iter_t child_iter = child_list_copy.begin();
+		 child_iter != child_list_copy.end(); ++child_iter)
 	{
 		LLView *view = *child_iter;
 		if (skip_list.find(view) == skip_list.end())
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 7a540a45c4c..e658b9af6a2 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -2810,7 +2810,11 @@ void LLAgent::endAnimationUpdateUI()
 			LLFloaterReg::restoreVisibleInstances();
 #else // Use this for now
 			LLFloaterView::skip_list_t skip_list;
-			skip_list.insert(LLFloaterReg::findInstance("mini_map"));
+			if (LLFloaterReg::findInstance("mini_map"))
+			{
+				skip_list.insert(LLFloaterReg::findInstance("mini_map"));
+			}
+		
 			gFloaterView->popVisibleAll(skip_list);
 #endif
 			mViewsPushed = FALSE;
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index b1fbf789c69..dbe0ec3b86e 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -1158,10 +1158,17 @@ void LLTaskLSLBridge::openItem()
 	{
 		return;
 	}
-	LLLiveLSLEditor* preview = LLFloaterReg::showTypedInstance<LLLiveLSLEditor>("preview_scriptedit", LLSD(mUUID), TAKE_FOCUS_YES);
-	if (preview && (object->permModify() || gAgent.isGodlike()))
+	if (object->permModify() || gAgent.isGodlike())
 	{
-		preview->setObjectID(mPanel->getTaskUUID());
+		LLLiveLSLEditor* preview = LLFloaterReg::showTypedInstance<LLLiveLSLEditor>("preview_scriptedit", LLSD(mUUID), TAKE_FOCUS_YES);
+		if (preview)
+		{
+			preview->setObjectID(mPanel->getTaskUUID());
+		}
+	}
+	else
+	{	
+		LLNotifications::instance().add("CannotOpenScriptObjectNoMod");
 	}
 }
 
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 6a6aa1061dc..c67af994a42 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -2733,15 +2733,26 @@ bool enable_object_edit()
 	// there.  Eventually this needs to be replaced with code that only 
 	// lets you edit objects if you have permission to do so (edit perms,
 	// group edit, god).  See also lltoolbar.cpp.  JC
-	bool enable = true;
+	bool enable = false;
 	if (gAgent.inPrelude())
 	{
 		enable = LLViewerParcelMgr::getInstance()->agentCanBuild()
 			|| LLSelectMgr::getInstance()->getSelection()->isAttachment();
+	} 
+	else if (LLSelectMgr::getInstance()->selectGetModify())
+	{
+		enable = true;
 	}
+
 	return enable;
 }
 
+// mutually exclusive - show either edit option or build in menu
+bool enable_object_build()
+{
+	return !enable_object_edit();
+}
+
 class LLSelfRemoveAllAttachments : public view_listener_t
 {
 	bool handleEvent(const LLSD& userdata)
@@ -8023,6 +8034,8 @@ void initialize_menus()
 	visible.add("VisiblePayObject", boost::bind(&enable_pay_object));
 	enable.add("EnablePayAvatar", boost::bind(&enable_pay_avatar));
 	enable.add("EnableEdit", boost::bind(&enable_object_edit));
+	visible.add("VisibleBuild", boost::bind(&enable_object_build));
+	visible.add("VisibleEdit", boost::bind(&enable_object_edit));
 	visible.add("Object.VisibleEdit", boost::bind(&enable_object_edit));
 
 	view_listener_t::addMenu(new LLFloaterVisible(), "FloaterVisible");
diff --git a/indra/newview/skins/default/xui/en/floater_report_abuse.xml b/indra/newview/skins/default/xui/en/floater_report_abuse.xml
index 696233676cd..91ca3ef27ad 100644
--- a/indra/newview/skins/default/xui/en/floater_report_abuse.xml
+++ b/indra/newview/skins/default/xui/en/floater_report_abuse.xml
@@ -18,7 +18,7 @@
      height="150"
      layout="topleft"
      left="60"
-     name=""
+     name="screenshot"
      top="15"
      width="220" />
     <check_box
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 0d1ed6fc649..d955e875a7c 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -1434,6 +1434,13 @@ Not able to perform &apos;reset&apos;.
 Select objects with scripts that you have permission to modify.
   </notification>
 
+  <notification
+   icon="alertmodal.tga"
+   name="CannotOpenScriptObjectNoMod"
+   type="alertmodal">
+    Unable to open script in object without modify permissions.
+  </notification>
+
   <notification
    icon="alertmodal.tga"
    name="CannotSetRunningSelectObjectsNoScripts"
-- 
GitLab