From 18f1895bf2abceadba292672eb80a384f0142c73 Mon Sep 17 00:00:00 2001
From: Leyla Farazha <leyla@lindenlab.com>
Date: Sat, 10 Oct 2009 00:43:39 +0000
Subject: [PATCH] EXT-1400 New 'name popup' lets you do things (IM, TP etc) to
 your own avatar EXT-1021 Update code to use new Inventory Icon art files in
 floater_invetory.xml EXT-176 Open and closed state for art for folders in
 list view in side panel

---
 indra/newview/llfloaterinventory.cpp          |   3 +-
 indra/newview/llfolderviewitem.cpp            |  14 +-
 indra/newview/llfolderviewitem.h              |   2 +
 indra/newview/llinspectavatar.cpp             |   5 +
 indra/newview/llinventorybridge.cpp           | 135 ++++--------------
 indra/newview/llnearbychat.cpp                |   4 +-
 indra/newview/llviewermenu.cpp                |  14 +-
 indra/newview/llviewertexteditor.cpp          |  57 ++------
 .../skins/default/xui/en/inspect_avatar.xml   |  13 ++
 .../default/xui/en/menu_inspect_self_gear.xml |  53 +++++++
 10 files changed, 137 insertions(+), 163 deletions(-)
 create mode 100644 indra/newview/skins/default/xui/en/menu_inspect_self_gear.xml

diff --git a/indra/newview/llfloaterinventory.cpp b/indra/newview/llfloaterinventory.cpp
index 116286329c..d9cd929606 100644
--- a/indra/newview/llfloaterinventory.cpp
+++ b/indra/newview/llfloaterinventory.cpp
@@ -1491,7 +1491,8 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id)
 			{
 				LLFolderViewFolder::Params p;
 				p.name = new_listener->getDisplayName();
-				p.icon = new_listener->getIcon();
+				p.icon = LLUI::getUIImage("Inv_FolderClosed");
+				p.icon_open = LLUI::getUIImage("Inv_FolderOpen");
 				p.root = mFolders;
 				p.listener = new_listener;
 				LLFolderViewFolder* folderp = LLUICtrlFactory::create<LLFolderViewFolder>(p);
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index ee5fba5ace..0d432bd398 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -125,6 +125,8 @@ LLFolderViewItem::LLFolderViewItem(LLFolderViewItem::Params p)
 	mLabel(p.name),
 	mRoot(p.root),
 	mCreationDate(p.creation_date),
+	mIcon(p.icon),
+	mIconOpen(p.icon_open),
 	mListener(p.listener),
 	mArrowImage(p.folder_arrow_image),
 	mBoxImage(p.selection_image)
@@ -893,11 +895,15 @@ void LLFolderViewItem::draw()
 		mDragAndDropTarget = FALSE;
 	}
 
-
-	if(mIcon)
-	{
-		mIcon->draw(mIndentation + ARROW_SIZE + TEXT_PAD, getRect().getHeight() - mIcon->getHeight());
+	// First case is used for open folders
+	if (!mIconOpen.isNull() && (llabs(mControlLabelRotation) > 80))
+ 	{
+		mIconOpen->draw(mIndentation + ARROW_SIZE + TEXT_PAD, getRect().getHeight() - mIcon->getHeight());
 	}
+	else if(mIcon)
+	{
+ 		mIcon->draw(mIndentation + ARROW_SIZE + TEXT_PAD, getRect().getHeight() - mIcon->getHeight());
+ 	}
 
 	if (!mLabel.empty())
 	{
diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h
index e9aab560c8..09c97662d9 100644
--- a/indra/newview/llfolderviewitem.h
+++ b/indra/newview/llfolderviewitem.h
@@ -96,6 +96,7 @@ public:
 	struct Params : public LLInitParam::Block<Params, LLView::Params>
 	{
 		Optional<LLUIImage*>					icon;
+		Optional<LLUIImage*>					icon_open;  // used for folders
 		Optional<LLFolderView*>					root;
 		Optional<LLFolderViewEventListener*>	listener;
 
@@ -143,6 +144,7 @@ protected:
 	std::string					mLabelSuffix;
 	LLUIImagePtr				mIcon;
 	std::string					mStatusText;
+	LLUIImagePtr				mIconOpen;
 	BOOL						mHasVisibleChildren;
 	S32							mIndentation;
 	S32							mNumDescendantsSelected;
diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp
index 947e5d80da..261d0836a0 100644
--- a/indra/newview/llinspectavatar.cpp
+++ b/indra/newview/llinspectavatar.cpp
@@ -276,6 +276,11 @@ void LLInspectAvatar::onOpen(const LLSD& data)
 	mAvatarID = data["avatar_id"];
 	mPartnerID = LLUUID::null;
 
+	BOOL self = mAvatarID == gAgent.getID();
+	
+	getChild<LLUICtrl>("gear_self_btn")->setVisible(self);
+	getChild<LLUICtrl>("gear_btn")->setVisible(!self);
+	
 	// Position the inspector relative to the mouse cursor
 	// Similar to how tooltips are positioned
 	// See LLToolTipMgr::createToolTip
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index e5cf8ccf66..f2329c2ef5 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -120,38 +120,38 @@ bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& respon
 
 std::string ICON_NAME[ICON_NAME_COUNT] =
 {
-	"inv_item_texture.tga",
-	"inv_item_sound.tga",
-	"inv_item_callingcard_online.tga",
-	"inv_item_callingcard_offline.tga",
-	"inv_item_landmark.tga",
-	"inv_item_landmark_visited.tga",
-	"inv_item_script.tga",
-	"inv_item_clothing.tga",
-	"inv_item_object.tga",
-	"inv_item_object_multi.tga",
-	"inv_item_notecard.tga",
-	"inv_item_skin.tga",
-	"inv_item_snapshot.tga",
-
-	"inv_item_shape.tga",
-	"inv_item_skin.tga",
-	"inv_item_hair.tga",
-	"inv_item_eyes.tga",
-	"inv_item_shirt.tga",
-	"inv_item_pants.tga",
-	"inv_item_shoes.tga",
-	"inv_item_socks.tga",
-	"inv_item_jacket.tga",
-	"inv_item_gloves.tga",
-	"inv_item_undershirt.tga",
-	"inv_item_underpants.tga",
-	"inv_item_skirt.tga",
+	"Inv_Texture",
+	"Inv_Sound",
+	"Inv_CallingCard",
+	"Inv_CallingCard",
+	"Inv_Landmark",
+	"Inv_Landmark",
+	"Inv_Script",
+	"Inv_Clothing",
+	"Inv_Object",
+	"Inv_Object",
+	"Inv_Notecard",
+	"Inv_Skin",
+	"Inv_Snapshot",
+
+	"Inv_BodyShape",
+	"Inv_Skin",
+	"Inv_Hair",
+	"Inv_Eye",
+	"Inv_Shirt",
+	"Inv_Pants",
+	"Inv_Shoe",
+	"Inv_Socks",
+	"Inv_Jacket",
+	"Inv_Gloves",
+	"Inv_Undershirt",
+	"Inv_Underpants",
+	"Inv_Skirt",
 	"inv_item_alpha.tga",
 	"inv_item_tattoo.tga",
 
-	"inv_item_animation.tga",
-	"inv_item_gesture.tga",
+	"Inv_Animation",
+	"Inv_Gesture",
 
 	"inv_item_linkitem.tga",
 	"inv_item_linkfolder.tga"
@@ -2099,81 +2099,8 @@ LLUIImagePtr LLFolderBridge::getIcon() const
 
 LLUIImagePtr LLFolderBridge::getIcon(LLAssetType::EType preferred_type)
 {
-	if (preferred_type >= LLAssetType::AT_FOLDER_ENSEMBLE_START &&
-		preferred_type <= LLAssetType::AT_FOLDER_ENSEMBLE_END)
-	{
-		LLUIImage* icon = LLUI::getUIImage(LLFolderType::lookupIconName(preferred_type));
-		if (icon)
-			return icon;
-	}
-	
-	const char* control = NULL;
-	switch(preferred_type)
-	{
-		case LLAssetType::AT_TEXTURE:
-			control = "inv_folder_texture.tga";
-			break;
-		case LLAssetType::AT_SOUND:
-			control = "inv_folder_sound.tga";
-			break;
-		case LLAssetType::AT_CALLINGCARD:
-			control = "inv_folder_callingcard.tga";
-			break;
-		case LLAssetType::AT_LANDMARK:
-			control = "inv_folder_landmark.tga";
-			break;
-		case LLAssetType::AT_SCRIPT:
-		case LLAssetType::AT_LSL_TEXT:
-			control = "inv_folder_script.tga";
-			break;
-		case LLAssetType::AT_OBJECT:
-			control = "inv_folder_object.tga";
-			break;
-		case LLAssetType::AT_NOTECARD:
-			control = "inv_folder_notecard.tga";
-			break;
-		case LLAssetType::AT_CATEGORY:
-			control = "inv_folder_plain_closed.tga";
-			break;
-		case LLAssetType::AT_CLOTHING:
-			control = "inv_folder_clothing.tga";
-			break;
-		case LLAssetType::AT_BODYPART:
-			control = "inv_folder_bodypart.tga";
-			break;
-		case LLAssetType::AT_TRASH:
-			control = "inv_folder_trash.tga";
-			break;
-		case LLAssetType::AT_SNAPSHOT_CATEGORY:
-			control = "inv_folder_snapshot.tga";
-			break;
-		case LLAssetType::AT_LOST_AND_FOUND:
-			control = "inv_folder_lostandfound.tga";
-			break;
-		case LLAssetType::AT_ANIMATION:
-			control = "inv_folder_animation.tga";
-			break;
-		case LLAssetType::AT_GESTURE:
-			control = "inv_folder_gesture.tga";
-			break;
-		case LLAssetType::AT_FAVORITE:
-			//TODO - need icon
-			control = "inv_folder_plain_closed.tga";
-			break;
-		case LLAssetType::AT_OUTFIT:
-			control = "inv_folder_outfit.tga";
-			break;
-		case LLAssetType::AT_CURRENT_OUTFIT:
-			control = "inv_folder_current_outfit.tga";
-			break;
-		case LLAssetType::AT_MY_OUTFITS:
-			control = "inv_folder_my_outfits.tga";
-			break;
-		default:
-			control = "inv_folder_plain_closed.tga";
-			break;
-	}
-	return LLUI::getUIImage(control);
+	// we only have one folder image now
+	return LLUI::getUIImage("Inv_FolderClosed");
 }
 
 BOOL LLFolderBridge::renameItem(const std::string& new_name)
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp
index cc5f37b903..91862112a0 100644
--- a/indra/newview/llnearbychat.cpp
+++ b/indra/newview/llnearbychat.cpp
@@ -430,7 +430,7 @@ void	LLNearbyChat::pinn_panel()
 	mEChatTearofState = CHAT_PINNED;
 	LLIconCtrl* tearoff_btn = mChatCaptionPanel->getChild<LLIconCtrl>("tearoff_btn",false);
 	
-	tearoff_btn->setValue("inv_item_landmark_visited.tga");
+	tearoff_btn->setValue("Inv_Landmark");
 
 	const LLRect& parent_rect = gViewerWindow->getRootView()->getRect();
 	
@@ -451,7 +451,7 @@ void	LLNearbyChat::float_panel()
 	mEChatTearofState = CHAT_UNPINNED;
 	LLIconCtrl* tearoff_btn = mChatCaptionPanel->getChild<LLIconCtrl>("tearoff_btn", false);
 	
-	tearoff_btn->setValue("inv_item_landmark.tga");
+	tearoff_btn->setValue("Inv_Landmark");
 	mResizeBar[LLResizeBar::BOTTOM]->setVisible(true);
 	mResizeBar[LLResizeBar::LEFT]->setVisible(true);
 	mResizeBar[LLResizeBar::RIGHT]->setVisible(true);
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 3e7e5f77bb..a81d26cb7b 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -3453,14 +3453,11 @@ class LLSelfStandUp : public view_listener_t
 	}
 };
 
-class LLSelfEnableStandUp : public view_listener_t
+bool enable_standup_self()
 {
-	bool handleEvent(const LLSD& userdata)
-	{
-		bool new_value = gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting();
-		return new_value;
-	}
-};
+	bool new_value = gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting();
+	return new_value;
+}
 
 class LLSelfFriends : public view_listener_t
 {
@@ -7952,7 +7949,8 @@ void initialize_menus()
 	view_listener_t::addMenu(new LLSelfStandUp(), "Self.StandUp");
 	view_listener_t::addMenu(new LLSelfRemoveAllAttachments(), "Self.RemoveAllAttachments");
 
-	view_listener_t::addMenu(new LLSelfEnableStandUp(), "Self.EnableStandUp");
+	visible.add("Self.VisibleStandUp", boost::bind(&enable_standup_self));
+	enable.add("Self.EnableStandUp", boost::bind(&enable_standup_self));
 	view_listener_t::addMenu(new LLSelfEnableRemoveAllAttachments(), "Self.EnableRemoveAllAttachments");
 
 	// we don't use boost::bind directly to delay side tray construction
diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp
index b853bcb46e..0ce1ecc6ee 100644
--- a/indra/newview/llviewertexteditor.cpp
+++ b/indra/newview/llviewertexteditor.cpp
@@ -459,57 +459,26 @@ LLUIImagePtr LLEmbeddedItems::getItemImage(llwchar ext_char) const
 			case LLAssetType::AT_TEXTURE:
 				if(item->getInventoryType() == LLInventoryType::IT_SNAPSHOT)
 				{
-					img_name = "inv_item_snapshot.tga";
+					img_name = "Inv_Snapshot";
 				}
 				else
 				{
-					img_name = "inv_item_texture.tga";
+					img_name = "Inv_Texture";
 				}
 
 				break;
-			case LLAssetType::AT_SOUND:			img_name = "inv_item_sound.tga";	break;
-			case LLAssetType::AT_LANDMARK:		
-				if (item->getFlags() & LLInventoryItem::II_FLAGS_LANDMARK_VISITED)
-				{
-					img_name = "inv_item_landmark_visited.tga";	
-				}
-				else
-				{
-					img_name = "inv_item_landmark.tga";	
-				}
-				break;
-			case LLAssetType::AT_CALLINGCARD:
-			{
-				BOOL online;
-				online = LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID());				
-				if (online)
-				{
-					img_name = "inv_item_callingcard_online.tga"; break;
-				}
-				else
-				{
-					img_name = "inv_item_callingcard_offline.tga"; break;
-				}
-				break;
-			}
-			case LLAssetType::AT_CLOTHING:		img_name = "inv_item_clothing.tga";	break;
-			case LLAssetType::AT_OBJECT:			
-				if (item->getFlags() & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS)
-				{
-					img_name = "inv_item_object_multi.tga";	
-				}
-				else
-				{
-					img_name = "inv_item_object.tga";	
-				}
-				break;
-			case LLAssetType::AT_NOTECARD:		img_name = "inv_item_notecard.tga";	break;
-			case LLAssetType::AT_LSL_TEXT:		img_name = "inv_item_script.tga";	break;
-			case LLAssetType::AT_BODYPART:		img_name = "inv_item_skin.tga";	break;
-			case LLAssetType::AT_ANIMATION:		img_name = "inv_item_animation.tga";break;
-			case LLAssetType::AT_GESTURE:			img_name = "inv_item_gesture.tga";	break;
+			case LLAssetType::AT_SOUND:			img_name = "Inv_Sound";	break;
+			case LLAssetType::AT_CLOTHING:		img_name = "Inv_Clothing";	break;
+			case LLAssetType::AT_OBJECT:		img_name = "Inv_Object"; break;
+			case LLAssetType::AT_CALLINGCARD:	img_name = "Inv_CallingCard"; break;
+			case LLAssetType::AT_LANDMARK:		img_name = "Inv_Landmark"; break;
+			case LLAssetType::AT_NOTECARD:		img_name = "Inv_Notecard";	break;
+			case LLAssetType::AT_LSL_TEXT:		img_name = "Inv_Script";	break;
+			case LLAssetType::AT_BODYPART:		img_name = "Inv_Skin";	break;
+			case LLAssetType::AT_ANIMATION:		img_name = "Inv_Animation";break;
+			case LLAssetType::AT_GESTURE:			img_name = "Inv_Gesture";	break;
 				//TODO need img_name
-			case LLAssetType::AT_FAVORITE:		img_name = "inv_item_landmark.tga";	 break;
+			case LLAssetType::AT_FAVORITE:		img_name = "Inv_Landmark";	 break;
 			default: llassert(0); 
 		}
 
diff --git a/indra/newview/skins/default/xui/en/inspect_avatar.xml b/indra/newview/skins/default/xui/en/inspect_avatar.xml
index 1af07c35be..a934e541da 100644
--- a/indra/newview/skins/default/xui/en/inspect_avatar.xml
+++ b/indra/newview/skins/default/xui/en/inspect_avatar.xml
@@ -148,4 +148,17 @@
      right="-10"
      top="249"
      width="18" />
+  <menu_button
+     visible="false" 
+     follows="top|left"
+     height="18"
+     image_disabled="OptionsMenu_Disabled"
+     image_selected="OptionsMenu_Press"
+     image_unselected="OptionsMenu_Off"
+     menu_filename="menu_inspect_self_gear.xml"
+     name="gear_self_btn"
+     picture_style="true"
+     right="-10"
+     top="249"
+     width="18" />
 </floater>
diff --git a/indra/newview/skins/default/xui/en/menu_inspect_self_gear.xml b/indra/newview/skins/default/xui/en/menu_inspect_self_gear.xml
new file mode 100644
index 0000000000..240822e5ca
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/menu_inspect_self_gear.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu
+         create_jump_keys="true"
+         layout="topleft"
+         mouse_opaque="false"
+         visible="false"
+         name="Gear Menu">
+  <menu_item_call
+   label="Stand Up"
+   layout="topleft"
+   enabled="true"
+   name="stand_up">
+    <menu_item_call.on_click
+     function="Self.StandUp"
+     parameter="" />
+    <menu_item_call.on_visible
+     function="Self.VisibleStandUp" />
+  </menu_item_call>
+  <menu_item_call
+   label="My Appearance"
+   layout="topleft"
+   name="my_appearance">
+    <menu_item_call.on_click
+     function="ShowFloater"
+     parameter="appearance" />
+    <menu_item_call.on_enable
+     function="Edit.EnableCustomizeAvatar" />
+  </menu_item_call>
+  <menu_item_call
+   label="My Profile"
+   layout="topleft"
+   enabled="true" 
+   name="my_profile">
+    <menu_item_call.on_click
+     function="ShowAgentProfile"
+     parameter="agent" />
+  </menu_item_call>
+  <menu_item_call
+   label="My Friends"
+   layout="topleft"
+   name="my_friends">
+    <menu_item_call.on_click
+     function="Self.Friends"
+     parameter="" />
+  </menu_item_call>
+  <menu_item_call
+   label="My Groups"
+   layout="topleft"
+   name="my_groups">
+    <menu_item_call.on_click
+     function="Self.Groups" />
+  </menu_item_call>
+</menu>
\ No newline at end of file
-- 
GitLab