diff options
| -rw-r--r-- | indra/newview/lloutfitslist.cpp | 30 | ||||
| -rw-r--r-- | indra/newview/llpaneloutfitsinventory.cpp | 67 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/menu_outfit_gear.xml | 16 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/menu_outfit_tab.xml | 20 | 
4 files changed, 90 insertions, 43 deletions
| diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index bca292fa4a..03df2d2b20 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -90,17 +90,33 @@ protected:  		registrar.add("Outfit.Delete", boost::bind(deleteOutfit, selected_id));  		enable_registrar.add("Outfit.OnEnable", boost::bind(&OutfitContextMenu::onEnable, this, _2)); +		enable_registrar.add("Outfit.OnVisible", boost::bind(&OutfitContextMenu::onVisible, this, _2));  		return createFromFile("menu_outfit_tab.xml");  	} -	bool onEnable(const LLSD& data) +	bool onEnable(LLSD::String param) +	{ +		LLUUID outfit_cat_id = mUUIDs.back(); + +		if ("rename" == param) +		{ +			return get_is_category_renameable(&gInventory, outfit_cat_id); +		} + +		return true; +	} + +	bool onVisible(LLSD::String param)  	{ -		std::string param = data.asString();  		LLUUID outfit_cat_id = mUUIDs.back();  		bool is_worn = LLAppearanceMgr::instance().getBaseOutfitUUID() == outfit_cat_id; -		if ("wear_replace" == param) +		if ("edit" == param) +		{ +			return is_worn; +		} +		else if ("wear_replace" == param)  		{  			return !is_worn;  		} @@ -112,14 +128,6 @@ protected:  		{  			return is_worn;  		} -		else if ("edit" == param) -		{ -			return is_worn; -		} -		else if ("rename" == param) -		{ -			return get_is_category_renameable(&gInventory, outfit_cat_id); -		}  		else if ("delete" == param)  		{  			return LLAppearanceMgr::instance().getCanRemoveOutfit(outfit_cat_id); diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 1e1e1aaf9b..1157c40b39 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -91,6 +91,7 @@ public:  		registrar.add("Gear.Create", boost::bind(&LLOutfitListGearMenu::onCreate, this, _2));  		enable_registrar.add("Gear.OnEnable", boost::bind(&LLOutfitListGearMenu::onEnable, this, _2)); +		enable_registrar.add("Gear.OnVisible", boost::bind(&LLOutfitListGearMenu::onVisible, this, _2));  		mMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>(  			"menu_outfit_gear.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); @@ -99,6 +100,28 @@ public:  	LLMenuGL* getMenu() { return mMenu; } +	void show(LLView* spawning_view) +	{ +		if (!mMenu) return; + +		updateItemsVisibility(); +		mMenu->buildDrawLabels(); +		mMenu->updateParent(LLMenuGL::sMenuContainer); +		S32 menu_x = 0; +		S32 menu_y = spawning_view->getRect().getHeight() + mMenu->getRect().getHeight(); +		LLMenuGL::showPopup(spawning_view, mMenu, menu_x, menu_y); +	} + +	void updateItemsVisibility() +	{ +		if (!mMenu) return; + +		bool have_selection = getSelectedOutfitID().notNull(); +		mMenu->setItemVisible("sepatator1", have_selection); +		mMenu->setItemVisible("sepatator2", have_selection); +		mMenu->arrangeAndClear(); // update menu height +	} +  private:  	const LLUUID& getSelectedOutfitID()  	{ @@ -174,6 +197,26 @@ private:  			return false;  		} +		if ("rename" == param) +		{ +			return get_is_category_renameable(&gInventory, selected_outfit_id); +		} +		else if ("delete" == param) +		{ +			return LLAppearanceMgr::instance().getCanRemoveOutfit(selected_outfit_id); +		} + +		return true; +	} + +	bool onVisible(LLSD::String param) +	{ +		const LLUUID& selected_outfit_id = getSelectedOutfitID(); +		if (selected_outfit_id.isNull()) // no selection or invalid outfit selected +		{ +			return false; +		} +  		bool is_worn = LLAppearanceMgr::instance().getBaseOutfitUUID() == selected_outfit_id;  		if ("wear" == param) @@ -184,14 +227,6 @@ private:  		{  			return is_worn;  		} -		else if ("rename" == param) -		{ -			return get_is_category_renameable(&gInventory, selected_outfit_id); -		} -		else if ("delete" == param) -		{ -			return LLAppearanceMgr::instance().getCanRemoveOutfit(selected_outfit_id); -		}  		return true;  	} @@ -539,18 +574,10 @@ void LLPanelOutfitsInventory::updateListCommands()  void LLPanelOutfitsInventory::showGearMenu()  { -	LLMenuGL* menu = mGearMenu ? mGearMenu->getMenu() : NULL; -	if (menu) -	{ -		menu->buildDrawLabels(); -		menu->updateParent(LLMenuGL::sMenuContainer); -		LLView* spawning_view = getChild<LLView>("options_gear_btn"); -		S32 menu_x, menu_y; -		//show menu in co-ordinates of panel -		spawning_view->localPointToOtherView(0, spawning_view->getRect().getHeight(), &menu_x, &menu_y, this); -		menu_y += menu->getRect().getHeight(); -		LLMenuGL::showPopup(this, menu, menu_x, menu_y); -	} +	if (!mGearMenu) return; + +	LLView* spawning_view = getChild<LLView>("options_gear_btn"); +	mGearMenu->show(spawning_view);  }  void LLPanelOutfitsInventory::onTrashButtonClick() diff --git a/indra/newview/skins/default/xui/en/menu_outfit_gear.xml b/indra/newview/skins/default/xui/en/menu_outfit_gear.xml index c4e31ed180..8e7ef7f0b5 100644 --- a/indra/newview/skins/default/xui/en/menu_outfit_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_outfit_gear.xml @@ -11,6 +11,9 @@          <on_enable           function="Gear.OnEnable"           parameter="wear" /> +        <on_visible +         function="Gear.OnVisible" +         parameter="wear" />      </menu_item_call>      <menu_item_call       label="Take Off - Remove from Current Outfit" @@ -21,9 +24,12 @@          <on_enable           function="Gear.OnEnable"           parameter="take_off" /> +        <on_visible +         function="Gear.OnVisible" +         parameter="take_off" />      </menu_item_call> -            <menu_item_separator /> +            <menu_item_separator name="sepatator1" />              <!-- copied (with minor modifications) from menu_inventory_add.xml -->              <!--  *TODO: generate dynamically? -->              <menu @@ -168,7 +174,7 @@              </menu>              <!-- copied from menu_inventory_add.xml --> -    <menu_item_separator /> +    <menu_item_separator name="sepatator2" />      <menu_item_call       label="Rename Outfit"       layout="topleft" @@ -178,6 +184,9 @@          <on_enable           function="Gear.OnEnable"           parameter="rename" /> +        <on_visible +         function="Gear.OnVisible" +         parameter="rename" />      </menu_item_call>      <menu_item_call       label="Delete Outfit" @@ -188,5 +197,8 @@          <on_enable           function="Gear.OnEnable"           parameter="delete" /> +        <on_visible +         function="Gear.OnVisible" +         parameter="delete" />      </menu_item_call>  </menu> diff --git a/indra/newview/skins/default/xui/en/menu_outfit_tab.xml b/indra/newview/skins/default/xui/en/menu_outfit_tab.xml index 67559638d9..e084216a69 100644 --- a/indra/newview/skins/default/xui/en/menu_outfit_tab.xml +++ b/indra/newview/skins/default/xui/en/menu_outfit_tab.xml @@ -8,8 +8,8 @@       name="wear_replace">          <on_click           function="Outfit.WearReplace" /> -        <on_enable -         function="Outfit.OnEnable" +        <on_visible +         function="Outfit.OnVisible"           parameter="wear_replace" />      </menu_item_call>      <menu_item_call @@ -18,8 +18,8 @@       name="wear_add">          <on_click           function="Outfit.WearAdd" /> -        <on_enable -         function="Outfit.OnEnable" +        <on_visible +         function="Outfit.OnVisible"           parameter="wear_add" />      </menu_item_call>      <menu_item_call @@ -28,8 +28,8 @@       name="take_off">          <on_click           function="Outfit.TakeOff" /> -        <on_enable -         function="Outfit.OnEnable" +        <on_visible +         function="Outfit.OnVisible"           parameter="take_off" />      </menu_item_call>      <menu_item_call @@ -38,8 +38,8 @@       name="edit">          <on_click           function="Outfit.Edit" /> -        <on_enable -         function="Outfit.OnEnable" +        <on_visible +         function="Outfit.OnVisible"           parameter="edit" />      </menu_item_call>      <menu_item_separator /> @@ -59,8 +59,8 @@       name="delete">          <on_click           function="Outfit.Delete" /> -        <on_enable -         function="Outfit.OnEnable" +        <on_visible +         function="Outfit.OnVisible"           parameter="delete" />      </menu_item_call>  </context_menu> | 
