diff options
author | Dave Parks <davep@lindenlab.com> | 2010-06-10 15:16:08 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2010-06-10 15:16:08 -0500 |
commit | aab53dc25021dfb9b0a734480233e352a82486cd (patch) | |
tree | de9c71677f9955112c0b01bf8c064404bd862f53 /indra/newview/llpanelpeoplemenus.cpp | |
parent | 1d92a950df91d7e6d3a34e925f445bc389a3fa93 (diff) | |
parent | 3ea0018dc6f94c029d7dbf13bdd5b0bc0558c8d8 (diff) |
merge
Diffstat (limited to 'indra/newview/llpanelpeoplemenus.cpp')
-rw-r--r-- | indra/newview/llpanelpeoplemenus.cpp | 72 |
1 files changed, 9 insertions, 63 deletions
diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp index 862e32cca8..93be0bda9e 100644 --- a/indra/newview/llpanelpeoplemenus.cpp +++ b/indra/newview/llpanelpeoplemenus.cpp @@ -42,6 +42,7 @@ #include "llagent.h" #include "llagentdata.h" // for gAgentID #include "llavataractions.h" +#include "llcallingcard.h" // for LLAvatarTracker #include "llviewermenu.h" // for gMenuHolder namespace LLPanelPeopleMenus @@ -49,64 +50,6 @@ namespace LLPanelPeopleMenus NearbyMenu gNearbyMenu; -//== ContextMenu ============================================================== - -ContextMenu::ContextMenu() -: mMenu(NULL) -{ -} - -ContextMenu::~ContextMenu() -{ - // do not forget delete LLContextMenu* mMenu. - // It can have registered Enable callbacks which are called from the LLMenuHolderGL::draw() - // via selected item (menu_item_call) by calling LLMenuItemCallGL::buildDrawLabel. - // we can have a crash via using callbacks of deleted instance of ContextMenu. EXT-4725 - - // menu holder deletes its menus on viewer exit, so we have no way to determine if instance - // of mMenu has already been deleted except of using LLHandle. EXT-4762. - if (!mMenuHandle.isDead()) - { - mMenu->die(); - mMenu = NULL; - } -} - -void ContextMenu::show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y) -{ - if (mMenu) - { - //preventing parent (menu holder) from deleting already "dead" context menus on exit - LLView* parent = mMenu->getParent(); - if (parent) - { - parent->removeChild(mMenu); - } - delete mMenu; - mMenu = NULL; - mUUIDs.clear(); - } - - if ( uuids.empty() ) - return; - - mUUIDs.resize(uuids.size()); - std::copy(uuids.begin(), uuids.end(), mUUIDs.begin()); - - mMenu = createMenu(); - mMenuHandle = mMenu->getHandle(); - mMenu->show(x, y); - LLMenuGL::showPopup(spawning_view, mMenu, x, y); -} - -void ContextMenu::hide() -{ - if(mMenu) - { - mMenu->hide(); - } -} - //== NearbyMenu =============================================================== LLContextMenu* NearbyMenu::createMenu() @@ -135,8 +78,7 @@ LLContextMenu* NearbyMenu::createMenu() enable_registrar.add("Avatar.CheckItem", boost::bind(&NearbyMenu::checkContextMenuItem, this, _2)); // create the context menu from the XUI - return LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>( - "menu_people_nearby.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance()); + return createFromFile("menu_people_nearby.xml"); } else { @@ -151,9 +93,7 @@ LLContextMenu* NearbyMenu::createMenu() enable_registrar.add("Avatar.EnableItem", boost::bind(&NearbyMenu::enableContextMenuItem, this, _2)); // create the context menu from the XUI - return LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu> - ("menu_people_nearby_multiselect.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance()); - + return createFromFile("menu_people_nearby_multiselect.xml"); } } @@ -175,6 +115,12 @@ bool NearbyMenu::enableContextMenuItem(const LLSD& userdata) // - there are selected people // - and there are no friends among selection yet. + //EXT-7389 - disable for more than 1 + if(mUUIDs.size() > 1) + { + return false; + } + bool result = (mUUIDs.size() > 0); uuid_vec_t::const_iterator |