Scott Lawrence avatar Scott Lawrence committed 1415e65 Merge

pull late fixes from beta

Comments (0)

Files changed (27)

indra/llui/llmenubutton.cpp

 			llwarns << "Error loading menu_button menu" << llendl;
 		}
 	}
-
-	setMenuPosition();
 }
 
 void LLMenuButton::toggleMenu()
 	}
 	else
 	{
-	    //mMenu->needsArrange(); //so it recalculates the visible elements
-		LLMenuGL::showPopup(getParent(), mMenu, mX, mY);
+	    LLRect rect = getRect();
+		//mMenu->needsArrange(); //so it recalculates the visible elements
+		LLMenuGL::showPopup(getParent(), mMenu, rect.mLeft, rect.mBottom);
 	}
 }
 
-void LLMenuButton::setMenuPosition(EMenuPosition position /*ON_BOTTOM_LEFT*/)
-{
-	if (!mMenu)
-		return;
-
-	LLRect rect = getRect();
-
-	switch (position)
-	{
-		case ON_TOP_LEFT:
-		{
-			mX = rect.mLeft;
-			mY = rect.mTop + mMenu->getRect().getHeight();
-			break;
-		}
-		case ON_BOTTOM_LEFT:
-		{
-			mX = rect.mLeft;
-			mY = rect.mBottom;
-			break;
-		}
-	}
-}
 
 void LLMenuButton::hideMenu() 
 { 
 		setFocus(TRUE);
 	}
 
-	LLUICtrl::handleMouseDown(x, y, mask);
-
 	toggleMenu();
 	
 	if (getSoundFlags() & MOUSE_DOWN)

indra/llui/llmenubutton.h

 		Optional<std::string>	menu_filename;
 	
 		Params();
-	};
-
-	enum EMenuPosition
-	{
-		ON_TOP_LEFT,
-		ON_BOTTOM_LEFT
-	};
+	};	
 	
 	void toggleMenu();
-	void setMenuPosition(EMenuPosition position = ON_BOTTOM_LEFT);
 	/*virtual*/ void draw();
 	/*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
 	/*virtual*/ BOOL handleKeyHere(KEY key, MASK mask );
 	void hideMenu();
 	LLMenuGL* getMenu() { return mMenu; }
-	void setMenu(LLMenuGL* menu) { mMenu = menu; }
 
 protected:
 	friend class LLUICtrlFactory;
 private:
 	LLMenuGL*	mMenu;
 	bool mMenuVisibleLastFrame;
-	S32 mX, mY;
 };
 
 

indra/newview/app_settings/high_graphics.xml

 	<RenderTerrainLODFactor value="2"/>
 	<!--Default for now-->
 	<RenderTreeLODFactor value="0.5"/>
+	<!--Default for now-->
+	<RenderUseFBO value="1"/>
 	<!--Try Impostors-->
 	<RenderUseImpostors value="TRUE"/>
 	<!--Default for now-->

indra/newview/app_settings/low_graphics.xml

 	<RenderTerrainLODFactor value="1.0"/>
 	<!--Default for now-->
 	<RenderTreeLODFactor value="0.5"/>
+	<!--Default for now-->
+	<RenderUseFBO value="0"/>
 	<!--Try Impostors-->
 	<RenderUseImpostors value="TRUE"/>
 	<!--Default for now-->

indra/newview/app_settings/mid_graphics.xml

 	<RenderTerrainLODFactor value="1.0"/>
 	<!--Default for now-->
 	<RenderTreeLODFactor value="0.5"/>
+	<!--Default for now-->
+	<RenderUseFBO value="0"/>
 	<!--Try Impostors-->
 	<RenderUseImpostors value="TRUE"/>
 	<!--Default for now-->

indra/newview/app_settings/settings.xml

       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>1</integer>
     </map>
   <key>RenderUseTriStrips</key>
   <map>

indra/newview/app_settings/ultra_graphics.xml

 	<RenderTerrainLODFactor value="2.0"/>
 	<!--Default for now-->
 	<RenderTreeLODFactor value="1.0"/>
+	<!--Default for now-->
+	<RenderUseFBO value="1"/>
 	<!--Try Impostors-->
 	<RenderUseImpostors value="TRUE"/>
 	<!--Default for now-->

indra/newview/llfloaterhardwaresettings.cpp

 	  // but init them anyway
 	  mUseVBO(0),
 	  mUseAniso(0),
+	  mUseFBO(0),
 	  mFSAASamples(0),
 	  mGamma(0.0),
 	  mVideoCardMem(0),
 
 	mUseVBO = gSavedSettings.getBOOL("RenderVBOEnable");
 	mUseAniso = gSavedSettings.getBOOL("RenderAnisotropic");
+	mUseFBO = gSavedSettings.getBOOL("RenderUseFBO");
 	mFSAASamples = gSavedSettings.getU32("RenderFSAASamples");
 	mGamma = gSavedSettings.getF32("RenderGamma");
 	mVideoCardMem = gSavedSettings.getS32("TextureMemory");
 {
 	gSavedSettings.setBOOL("RenderVBOEnable", mUseVBO);
 	gSavedSettings.setBOOL("RenderAnisotropic", mUseAniso);
+	gSavedSettings.setBOOL("RenderUseFBO", mUseFBO);
 	gSavedSettings.setU32("RenderFSAASamples", mFSAASamples);
 	gSavedSettings.setF32("RenderGamma", mGamma);
 	gSavedSettings.setS32("TextureMemory", mVideoCardMem);

indra/newview/llfloaterhardwaresettings.h

 protected:
 	BOOL mUseVBO;
 	BOOL mUseAniso;
+	BOOL mUseFBO;
 	U32 mFSAASamples;
 	F32 mGamma;
 	S32 mVideoCardMem;

indra/newview/lloutfitslist.cpp

 #include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
 #include "lllistcontextmenu.h"
-#include "llmenubutton.h"
 #include "llnotificationsutil.h"
 #include "lloutfitobserver.h"
 #include "llsidetray.h"
 
 		updateItemsVisibility();
 		mMenu->buildDrawLabels();
-		mMenu->arrangeAndClear();
 		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()
 		mMenu->arrangeAndClear(); // update menu height
 	}
 
-	LLMenuGL* getMenu() { return mMenu; }
-
 private:
 	const LLUUID& getSelectedOutfitID()
 	{
 	mAccordion = getChild<LLAccordionCtrl>("outfits_accordion");
 	mAccordion->setComparator(&OUTFIT_TAB_NAME_COMPARATOR);
 
-	LLMenuButton* menu_gear_btn = getChild<LLMenuButton>("options_gear_btn");
-
-	// LLMenuButton::handleMouseDownCallback calls signal LLUICtrl::mouse_signal_t, not LLButton::commit_signal_t.
-	// That's why to set signal LLUICtrl::mouse_signal_t we need to upcast to LLUICtrl. Using static_cast instead
-	// of getChild<LLUICtrl>(...) for performance.
-	static_cast<LLUICtrl*>(menu_gear_btn)->setMouseDownCallback(boost::bind(&LLOutfitsList::showGearMenu, this, _1));
-
-	menu_gear_btn->setMenu(mGearMenu->getMenu());
-
 	return TRUE;
 }
 
 void LLOutfitsList::showGearMenu(LLView* spawning_view)
 {
 	if (!mGearMenu) return;
-
 	mGearMenu->show(spawning_view);
-
-	LLMenuButton* btn = dynamic_cast<LLMenuButton*>(spawning_view);
-	if (btn)
-	{
-		btn->setMenuPosition(LLMenuButton::ON_TOP_LEFT);
-	}
 }
 
 void LLOutfitsList::getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const

indra/newview/llpanellandmarks.cpp

 #include "llinventorymodelbackgroundfetch.h"
 #include "llinventorypanel.h"
 #include "lllandmarkactions.h"
-#include "llmenubutton.h"
 #include "llplacesinventorybridge.h"
 #include "llplacesinventorypanel.h"
 #include "llsidetray.h"
 	mMenuAdd = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_place_add_button.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 
 	mListCommands->childSetAction(ADD_BUTTON_NAME, boost::bind(&LLLandmarksPanel::showActionMenu, this, mMenuAdd, ADD_BUTTON_NAME));
-
-	getChild<LLUICtrl>("options_gear_btn")->setMouseDownCallback(boost::bind(&LLLandmarksPanel::onActionsButtonClick, this));
 }
 
 
 		menu->buildDrawLabels();
 		menu->updateParent(LLMenuGL::sMenuContainer);
 		LLView* spawning_view = getChild<LLView> (spawning_view_name);
-
-		LLMenuButton* btn = dynamic_cast <LLMenuButton*>(spawning_view);
-		if (btn)
-		{
-			btn->setMenu(menu);
-			btn->setMenuPosition(LLMenuButton::ON_TOP_LEFT);
-			return;
-		}
-
 		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);

indra/newview/llpanelmaininventory.cpp

 		mFilterEditor->setCommitCallback(boost::bind(&LLPanelMainInventory::onFilterEdit, this, _2));
 	}
 
-	mGearMenuButton = getChild<LLMenuButton>("options_gear_btn");
-
 	initListCommandsHandlers();
 
 	// *TODO:Get the cost info from the server
 
 void LLPanelMainInventory::initListCommandsHandlers()
 {
+	childSetAction("options_gear_btn", boost::bind(&LLPanelMainInventory::onGearButtonClick, this));
 	childSetAction("trash_btn", boost::bind(&LLPanelMainInventory::onTrashButtonClick, this));
 	childSetAction("add_btn", boost::bind(&LLPanelMainInventory::onAddButtonClick, this));
 
-	// LLMenuButton::handleMouseDownCallback calls signal LLUICtrl::mouse_signal_t, not LLButton::commit_signal_t.
-	// That's why to set signal LLUICtrl::mouse_signal_t we need to upcast to LLUICtrl. Using static_cast instead
-	// of getChild<LLUICtrl>(...) for performance.
-	static_cast<LLUICtrl*>(mGearMenuButton)->setMouseDownCallback(boost::bind(&LLPanelMainInventory::onGearButtonClick, this));
-
 	mTrashButton = getChild<LLDragAndDropButton>("trash_btn");
 	mTrashButton->setDragAndDropHandler(boost::bind(&LLPanelMainInventory::handleDragAndDropToTrash, this
 			,	_4 // BOOL drop
 	mCommitCallbackRegistrar.add("Inventory.GearDefault.Custom.Action", boost::bind(&LLPanelMainInventory::onCustomAction, this, _2));
 	mEnableCallbackRegistrar.add("Inventory.GearDefault.Enable", boost::bind(&LLPanelMainInventory::isActionEnabled, this, _2));
 	mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory_gear_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
-	mGearMenuButton->setMenu(mMenuGearDefault);
 	mMenuAdd = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory_add.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 
 	// Update the trash button when selected item(s) get worn or taken off.
 
 void LLPanelMainInventory::onGearButtonClick()
 {
-	mMenuGearDefault->buildDrawLabels();
-	mMenuGearDefault->updateParent(LLMenuGL::sMenuContainer);
-	mGearMenuButton->setMenuPosition(LLMenuButton::ON_TOP_LEFT);
+	showActionMenu(mMenuGearDefault,"options_gear_btn");
 }
 
 void LLPanelMainInventory::onAddButtonClick()

indra/newview/llpanelmaininventory.h

 #include "llpanel.h"
 #include "llinventoryobserver.h"
 #include "lldndbutton.h"
-#include "llmenubutton.h"
 
 #include "llfolderview.h"
 
 	LLDragAndDropButton*		mTrashButton;
 	LLMenuGL*					mMenuGearDefault;
 	LLMenuGL*					mMenuAdd;
-	LLMenuButton*				mGearMenuButton;
 
 	bool						mNeedUploadCost;
 	// List Commands                                                              //

indra/newview/llpaneloutfitedit.cpp

 	mAddWearablesPanel(NULL),
 	mFolderViewFilterCmbBox(NULL),
 	mListViewFilterCmbBox(NULL),
-	mPlusBtn(NULL),
-	mWearablesGearMenuBtn(NULL),
-	mGearMenuBtn(NULL)
+	mPlusBtn(NULL)
 {
 	mSavedFolderState = new LLSaveFolderState();
 	mSavedFolderState->setApply(FALSE);
 	childSetCommitCallback("folder_view_btn", boost::bind(&LLPanelOutfitEdit::saveListSelection, this), NULL);
 	childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::showWearablesListView, this), NULL);
 	childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::saveListSelection, this), NULL);
+	childSetCommitCallback("wearables_gear_menu_btn", boost::bind(&LLPanelOutfitEdit::onGearButtonClick, this, _1), NULL);
+	childSetCommitCallback("gear_menu_btn", boost::bind(&LLPanelOutfitEdit::onGearButtonClick, this, _1), NULL);
 	childSetCommitCallback("shop_btn_1", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL);
 	childSetCommitCallback("shop_btn_2", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL);
 
 	setVisibleCallback(boost::bind(&LLPanelOutfitEdit::onVisibilityChange, this, _2));
 
-	mWearablesGearMenuBtn = getChild<LLMenuButton>("wearables_gear_menu_btn");
-	mGearMenuBtn = getChild<LLMenuButton>("gear_menu_btn");
-
-	// LLMenuButton::handleMouseDownCallback calls signal LLUICtrl::mouse_signal_t, not LLButton::commit_signal_t.
-	// That's why to set signal LLUICtrl::mouse_signal_t we need to upcast to LLUICtrl. Using static_cast instead
-	// of getChild<LLUICtrl>(...) for performance.
-	static_cast<LLUICtrl*>(mWearablesGearMenuBtn)->setMouseDownCallback(boost::bind(&LLPanelOutfitEdit::onGearButtonClick, this, _1));
-	static_cast<LLUICtrl*>(mGearMenuBtn)->setMouseDownCallback(boost::bind(&LLPanelOutfitEdit::onGearButtonClick, this, _1));
-
 	mCOFWearables = getChild<LLCOFWearables>("cof_wearables_list");
 	mCOFWearables->setCommitCallback(boost::bind(&LLPanelOutfitEdit::filterWearablesBySelectedItem, this));
 
 void LLPanelOutfitEdit::onGearButtonClick(LLUICtrl* clicked_button)
 {
 	LLMenuGL* menu = NULL;
-	LLMenuButton* btn = NULL;
 
 	if (mAddWearablesPanel->getVisible())
 	{
 		if (!mAddWearablesGearMenu)
 		{
 			mAddWearablesGearMenu = LLAddWearablesGearMenu::create(mWearableItemsList, mInventoryItemsPanel);
-			mWearablesGearMenuBtn->setMenu(mAddWearablesGearMenu);
 		}
 
 		menu = mAddWearablesGearMenu;
-		btn = mWearablesGearMenuBtn;
 	}
 	else
 	{
 		if (!mGearMenu)
 		{
 			mGearMenu = LLPanelOutfitEditGearMenu::create();
-			mGearMenuBtn->setMenu(mGearMenu);
 		}
 
 		menu = mGearMenu;
-		btn = mGearMenuBtn;
 	}
 
-	if (!menu || !btn) return;
+	if (!menu) return;
 
+	menu->arrangeAndClear(); // update menu height
+	S32 menu_y = menu->getRect().getHeight() + clicked_button->getRect().getHeight();
 	menu->buildDrawLabels();
-	menu->arrangeAndClear();
-	btn->setMenuPosition(LLMenuButton::ON_TOP_LEFT);
+	LLMenuGL::showPopup(clicked_button, menu, 0, menu_y);
 }
 
 void LLPanelOutfitEdit::onAddMoreButtonClicked()

indra/newview/llpaneloutfitedit.h

 #include "llinventory.h"
 #include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
-#include "llmenubutton.h"
 #include "llwearableitemslist.h"
 
 class LLButton;
 	LLMenuGL*			mAddWearablesGearMenu;
 	bool				mInitialized;
 	std::auto_ptr<LLSaveOutfitComboBtn> mSaveComboBtn;
-	LLMenuButton*		mWearablesGearMenuBtn;
-	LLMenuButton*		mGearMenuBtn;
+
+
 
 };
 

indra/newview/llpanelpeople.cpp

 		mAllFriendList(NULL),
 		mNearbyList(NULL),
 		mRecentList(NULL),
-		mGroupList(NULL),
-		mNearbyGearButton(NULL),
-		mFriendsGearButton(NULL),
-		mGroupsGearButton(NULL),
-		mRecentGearButton(NULL)
+		mGroupList(NULL)
 {
 	mFriendListUpdater = new LLFriendListUpdater(boost::bind(&LLPanelPeople::updateFriendList,	this));
 	mNearbyListUpdater = new LLNearbyListUpdater(boost::bind(&LLPanelPeople::updateNearbyList,	this));
 	buttonSetAction("teleport_btn",		boost::bind(&LLPanelPeople::onTeleportButtonClicked,	this));
 	buttonSetAction("share_btn",		boost::bind(&LLPanelPeople::onShareButtonClicked,		this));
 
+	getChild<LLPanel>(NEARBY_TAB_NAME)->childSetAction("nearby_view_sort_btn",boost::bind(&LLPanelPeople::onNearbyViewSortButtonClicked,		this));
+	getChild<LLPanel>(RECENT_TAB_NAME)->childSetAction("recent_viewsort_btn",boost::bind(&LLPanelPeople::onRecentViewSortButtonClicked,			this));
+	getChild<LLPanel>(FRIENDS_TAB_NAME)->childSetAction("friends_viewsort_btn",boost::bind(&LLPanelPeople::onFriendsViewSortButtonClicked,		this));
+	getChild<LLPanel>(GROUP_TAB_NAME)->childSetAction("groups_viewsort_btn",boost::bind(&LLPanelPeople::onGroupsViewSortButtonClicked,		this));
+
 	// Must go after setting commit callback and initializing all pointers to children.
 	mTabContainer->selectTabByName(NEARBY_TAB_NAME);
 
 	enable_registrar.add("People.Recent.ViewSort.CheckItem",	boost::bind(&LLPanelPeople::onRecentViewSortMenuItemCheck,	this, _2));
 	enable_registrar.add("People.Nearby.ViewSort.CheckItem",	boost::bind(&LLPanelPeople::onNearbyViewSortMenuItemCheck,	this, _2));
 
-	mNearbyGearButton = getChild<LLMenuButton>("nearby_view_sort_btn");
-	mFriendsGearButton = getChild<LLMenuButton>("friends_viewsort_btn");
-	mGroupsGearButton = getChild<LLMenuButton>("groups_viewsort_btn");
-	mRecentGearButton = getChild<LLMenuButton>("recent_viewsort_btn");
-
-	// LLMenuButton::handleMouseDownCallback calls signal LLUICtrl::mouse_signal_t, not LLButton::commit_signal_t.
-	// That's why to set signal LLUICtrl::mouse_signal_t we need to upcast to LLUICtrl. Using static_cast instead
-	// of getChild<LLUICtrl>(...) for performance.
-	static_cast<LLUICtrl*>(mNearbyGearButton)->setMouseDownCallback(boost::bind(&LLPanelPeople::onViewSortButtonClicked, this));
-	static_cast<LLUICtrl*>(mFriendsGearButton)->setMouseDownCallback(boost::bind(&LLPanelPeople::onViewSortButtonClicked, this));
-	static_cast<LLUICtrl*>(mGroupsGearButton)->setMouseDownCallback(boost::bind(&LLPanelPeople::onViewSortButtonClicked, this));
-	static_cast<LLUICtrl*>(mRecentGearButton)->setMouseDownCallback(boost::bind(&LLPanelPeople::onViewSortButtonClicked, this));
-
 	LLMenuGL* plus_menu  = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_group_plus.xml",  gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 	mGroupPlusMenuHandle  = plus_menu->getHandle();
 
 	LLMenuGL* nearby_view_sort  = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_people_nearby_view_sort.xml",  gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 	if(nearby_view_sort)
-	{
 		mNearbyViewSortMenuHandle  = nearby_view_sort->getHandle();
-		mNearbyGearButton->setMenu(nearby_view_sort);
-	}
 
 	LLMenuGL* friend_view_sort  = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_people_friends_view_sort.xml",  gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 	if(friend_view_sort)
-	{
 		mFriendsViewSortMenuHandle  = friend_view_sort->getHandle();
-		mFriendsGearButton->setMenu(friend_view_sort);
-	}
 
 	LLMenuGL* group_view_sort  = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_people_groups_view_sort.xml",  gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 	if(group_view_sort)
-	{
 		mGroupsViewSortMenuHandle  = group_view_sort->getHandle();
-		mGroupsGearButton->setMenu(group_view_sort);
-	}
 
 	LLMenuGL* recent_view_sort  = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_people_recent_view_sort.xml",  gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 	if(recent_view_sort)
-	{
 		mRecentViewSortMenuHandle  = recent_view_sort->getHandle();
-		mRecentGearButton->setMenu(recent_view_sort);
-	}
 
 	LLVoiceClient::getInstance()->addObserver(this);
 
 void LLPanelPeople::showGroupMenu(LLMenuGL* menu)
 {
 	// Shows the menu at the top of the button bar.
+
+	// Calculate its coordinates.
+	// (assumes that groups panel is the current tab)
+	LLPanel* bottom_panel = mTabContainer->getCurrentPanel()->getChild<LLPanel>("bottom_panel"); 
+	LLPanel* parent_panel = mTabContainer->getCurrentPanel();
 	menu->arrangeAndClear();
+	S32 menu_height = menu->getRect().getHeight();
+	S32 menu_x = -2; // *HACK: compensates HPAD in showPopup()
+	S32 menu_y = bottom_panel->getRect().mTop + menu_height;
+
+	// Actually show the menu.
 	menu->buildDrawLabels();
 	menu->updateParent(LLMenuGL::sMenuContainer);
+	LLMenuGL::showPopup(parent_panel, menu, menu_x, menu_y);
 }
 
 void LLPanelPeople::setSortOrder(LLAvatarList* list, ESortOrder order, bool save)
 	// *TODO: not implemented yet
 }
 
-void LLPanelPeople::onViewSortButtonClicked()
+void LLPanelPeople::onFriendsViewSortButtonClicked()
 {
-	std::string current_panel = getActiveTabName();
+	LLMenuGL* menu = (LLMenuGL*)mFriendsViewSortMenuHandle.get();
+	if (!menu)
+		return;
+	showGroupMenu(menu);
+}
 
-    LLMenuGL* menu = NULL;
-    LLMenuButton* btn = NULL;
+void LLPanelPeople::onGroupsViewSortButtonClicked()
+{
+	LLMenuGL* menu = (LLMenuGL*)mGroupsViewSortMenuHandle.get();
+	if (!menu)
+		return;
+	showGroupMenu(menu);
+}
 
-    if (current_panel == NEARBY_TAB_NAME)
-    {
-        menu = dynamic_cast<LLMenuGL*>(mNearbyViewSortMenuHandle.get());
-        btn = mNearbyGearButton;
-    }
-    else if (current_panel == FRIENDS_TAB_NAME)
-    {
-        menu = dynamic_cast<LLMenuGL*>(mFriendsViewSortMenuHandle.get());
-        btn = mFriendsGearButton;
-    }
-    else if (current_panel == GROUP_TAB_NAME)
-    {
-        menu = dynamic_cast<LLMenuGL*>(mGroupsViewSortMenuHandle.get());
-        btn = mGroupsGearButton;
-    }
-    else if (current_panel == RECENT_TAB_NAME)
-    {
-        menu = dynamic_cast<LLMenuGL*>(mRecentViewSortMenuHandle.get());
-        btn = mRecentGearButton;
-    }
+void LLPanelPeople::onRecentViewSortButtonClicked()
+{
+	LLMenuGL* menu = (LLMenuGL*)mRecentViewSortMenuHandle.get();
+	if (!menu)
+		return;
+	showGroupMenu(menu);
+}
 
-    if (menu && btn)
-    {
-    	showGroupMenu(menu);
-    	btn->setMenuPosition(LLMenuButton::ON_TOP_LEFT);
-    }
+void LLPanelPeople::onNearbyViewSortButtonClicked()
+{
+	LLMenuGL* menu = (LLMenuGL*)mNearbyViewSortMenuHandle.get();
+	if (!menu)
+		return;
+	showGroupMenu(menu);
 }
 
 void	LLPanelPeople::onOpen(const LLSD& key)

indra/newview/llpanelpeople.h

 #include <llpanel.h>
 
 #include "llcallingcard.h" // for avatar tracker
-#include "llmenubutton.h"
 #include "llvoiceclient.h"
 
 class LLFilterEditor;
 	void					onShareButtonClicked();
 	void					onMoreButtonClicked();
 	void					onActivateButtonClicked();
-	void					onViewSortButtonClicked();
+	void					onRecentViewSortButtonClicked();
+	void					onNearbyViewSortButtonClicked();
+	void					onFriendsViewSortButtonClicked();
+	void					onGroupsViewSortButtonClicked();
 	void					onAvatarListDoubleClicked(LLUICtrl* ctrl);
 	void					onAvatarListCommitted(LLAvatarList* list);
 	void					onGroupPlusButtonClicked();
 	Updater*				mNearbyListUpdater;
 	Updater*				mRecentListUpdater;
 
-	LLMenuButton*			mNearbyGearButton;
-	LLMenuButton*			mFriendsGearButton;
-	LLMenuButton*			mGroupsGearButton;
-	LLMenuButton*			mRecentGearButton;
-
 	std::string				mFilterSubString;
 	std::string				mFilterSubStringOrig;
 };

indra/newview/llpanelteleporthistory.cpp

 		mHistoryAccordion(NULL),
 		mAccordionTabMenu(NULL),
 		mLastSelectedFlatlList(NULL),
-		mLastSelectedItemIndex(-1),
-		mMenuGearButton(NULL)
+		mLastSelectedItemIndex(-1)
 {
 	LLUICtrlFactory::getInstance()->buildPanel(this, "panel_teleport_history.xml");
 }
 		}
 	}
 
+	getChild<LLPanel>("bottom_panel")->childSetAction("gear_btn",boost::bind(&LLTeleportHistoryPanel::onGearButtonClicked, this));
+
 	LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
 
 	registrar.add("TeleportHistory.ExpandAllFolders",  boost::bind(&LLTeleportHistoryPanel::onExpandAllFolders,  this));
 	registrar.add("TeleportHistory.ClearTeleportHistory",  boost::bind(&LLTeleportHistoryPanel::onClearTeleportHistory,  this));
 	mEnableCallbackRegistrar.add("TeleportHistory.GearMenu.Enable", boost::bind(&LLTeleportHistoryPanel::isActionEnabled, this, _2));
 
-	mMenuGearButton = getChild<LLMenuButton>("gear_btn");
-
-	LLMenuGL* gear_menu  = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_teleport_history_gear.xml",  gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());;
+	LLMenuGL* gear_menu  = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_teleport_history_gear.xml",  gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 	if(gear_menu)
-	{
 		mGearMenuHandle  = gear_menu->getHandle();
-		mMenuGearButton->setMenu(gear_menu);
-	}
-
-	// LLMenuButton::handleMouseDownCallback calls signal LLUICtrl::mouse_signal_t, not LLButton::commit_signal_t.
-	// That's why to set signal LLUICtrl::mouse_signal_t we need to upcast to LLUICtrl. Using static_cast instead
-	// of getChild<LLUICtrl>(...) for performance.
-	static_cast<LLUICtrl*>(mMenuGearButton)->setMouseDownCallback(boost::bind(&LLTeleportHistoryPanel::onGearButtonClicked, this));
 
 	return TRUE;
 }
 	if (!menu)
 		return;
 
+	// Shows the menu at the top of the button bar.
+
+	// Calculate its coordinates.
+	LLPanel* bottom_panel = getChild<LLPanel>("bottom_panel");
 	menu->arrangeAndClear();
+	S32 menu_height = menu->getRect().getHeight();
+	S32 menu_x = -2; // *HACK: compensates HPAD in showPopup()
+	S32 menu_y = bottom_panel->getRect().mTop + menu_height;
+
+	// Actually show the menu.
 	menu->buildDrawLabels();
 	menu->updateParent(LLMenuGL::sMenuContainer);
-
-	// Shows the menu at the top of the button bar.
-	mMenuGearButton->setMenuPosition(LLMenuButton::ON_TOP_LEFT);
+	LLMenuGL::showPopup(this, menu, menu_x, menu_y);
 }
 
 bool LLTeleportHistoryPanel::isActionEnabled(const LLSD& userdata) const

indra/newview/llpanelteleporthistory.h

 #include "llpanelplacestab.h"
 #include "llteleporthistory.h"
 #include "llmenugl.h"
-#include "llmenubutton.h"
 
 class LLTeleportHistoryStorage;
 class LLAccordionCtrl;
 	ContextMenu mContextMenu;
 	LLContextMenu*			mAccordionTabMenu;
 	LLHandle<LLView>		mGearMenuHandle;
-	LLMenuButton*			mMenuGearButton;
 };
 
 

indra/newview/llpanelwearing.cpp

 #include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
 #include "llinventoryobserver.h"
-#include "llmenubutton.h"
 #include "llsidetray.h"
 #include "llviewermenu.h"
 #include "llwearableitemslist.h"
 	{
 		if (!mMenu) return;
 
-		mMenu->arrangeAndClear();
 		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);
 	}
 
-	LLMenuGL* getMenu() { return mMenu; }
-
 private:
 
 	void onTakeOff()
 	mCOFItemsList = getChild<LLWearableItemsList>("cof_items_list");
 	mCOFItemsList->setRightMouseDownCallback(boost::bind(&LLPanelWearing::onWearableItemsListRightClick, this, _1, _2, _3));
 
-	LLMenuButton* menu_gear_btn = getChild<LLMenuButton>("options_gear_btn");
-
-	// LLMenuButton::handleMouseDownCallback calls signal LLUICtrl::mouse_signal_t, not LLButton::commit_signal_t.
-	// That's why to set signal LLUICtrl::mouse_signal_t we need to upcast to LLUICtrl. Using static_cast instead
-	// of getChild<LLUICtrl>(...) for performance.
-	static_cast<LLUICtrl*>(menu_gear_btn)->setMouseDownCallback(boost::bind(&LLPanelWearing::showGearMenu, this, _1));
-
-	menu_gear_btn->setMenu(mGearMenu->getMenu());
-
-
 	return TRUE;
 }
 
 void LLPanelWearing::showGearMenu(LLView* spawning_view)
 {
 	if (!mGearMenu) return;
-
 	mGearMenu->show(spawning_view);
-
-	LLMenuButton* btn = dynamic_cast<LLMenuButton*>(spawning_view);
-	if (btn)
-	{
-		btn->setMenuPosition(LLMenuButton::ON_TOP_LEFT);
-	}
 }
 
 boost::signals2::connection LLPanelWearing::setSelectionChangeCallback(commit_callback_t cb)

indra/newview/skins/default/xui/en/panel_landmarks.xml

 		       layout="topleft"
 		       name="options_gear_btn_panel"
 		       width="32">
-		          <menu_button
+		          <button
 		           follows="bottom|left"
 		           tool_tip="Show additional options"
 		           height="25"

indra/newview/skins/default/xui/en/panel_main_inventory.xml

        layout="topleft"
        name="options_gear_btn_panel"
        width="32">
-          <menu_button
+          <button
            follows="bottom|left"
            tool_tip="Show additional options"
            height="25"

indra/newview/skins/default/xui/en/panel_outfit_edit.xml

      name="no_add_wearables_button_bar"
      top_pad="0"
      width="313">
-        <menu_button
+        <button
          follows="bottom|left"
          height="25"
          image_hover_unselected="Toolbar_Left_Over"
      top_delta="0"
      visible="false"
      width="313">
-        <menu_button
+        <button
          follows="bottom|left"
          height="25"
          image_hover_unselected="Toolbar_Left_Over"

indra/newview/skins/default/xui/en/panel_outfits_list.xml

 	 visible="true"
 	 name="bottom_panel"
 	 width="312">
-     <menu_button
+     <button
        follows="bottom|left"
        tool_tip="Show additional options"
        height="25"

indra/newview/skins/default/xui/en/panel_outfits_wearing.xml

      name="bottom_panel"
      top_pad="0"
      width="312">
-        <menu_button
+        <button
          follows="bottom|left"
          height="25"
          image_hover_unselected="Toolbar_Left_Over"

indra/newview/skins/default/xui/en/panel_people.xml

              name="bottom_panel"
              top_pad="0"
              width="313">
-             <menu_button
+             <button
              follows="bottom|left"
              height="25"
              image_hover_unselected="Toolbar_Left_Over"
 				       layout="topleft"
 				       name="options_gear_btn_panel"
 				       width="32">
-				          <menu_button
+				          <button
 				           follows="bottom|left"
 				           tool_tip="Show additional options"
 				           height="25"
              name="bottom_panel"
              top_pad="0"
              width="313">
-               <menu_button
+               <button
                follows="bottom|left"
                tool_tip="Options"
                height="25"
              name="bottom_panel"
              top_pad="0"
              width="313">
-               <menu_button
+               <button
                follows="bottom|left"
                tool_tip="Options"
                height="25"
                image_selected="Toolbar_Left_Selected"
                image_unselected="Toolbar_Left_Off"
                layout="topleft"
+               left="3"
                name="recent_viewsort_btn"
                top="1"
                width="31" />

indra/newview/skins/default/xui/en/panel_teleport_history.xml

      left="3"
      name="bottom_panel"
      width="313">
-        <menu_button
+        <button
          follows="bottom|left"
          tool_tip="Show additional options"
          height="25"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.