summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindra/llui/llscrolllistctrl.cpp1
-rwxr-xr-xindra/newview/llfloaterbump.cpp134
-rwxr-xr-xindra/newview/llfloaterbump.h23
-rwxr-xr-xindra/newview/skins/default/xui/en/menu_avatar_other.xml7
4 files changed, 153 insertions, 12 deletions
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 5f72ee3ac6..c59a4fb860 100755
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -1825,6 +1825,7 @@ BOOL LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
return TRUE;
}
}
+ return LLUICtrl::handleRightMouseDown(x, y, mask);
}
return FALSE;
}
diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp
index 345df2fcb3..34904cf7ed 100755
--- a/indra/newview/llfloaterbump.cpp
+++ b/indra/newview/llfloaterbump.cpp
@@ -30,10 +30,17 @@
#include "llsd.h"
#include "mean_collision_data.h"
+#include "llavataractions.h"
#include "llfloaterbump.h"
+#include "llfloaterreporter.h"
+#include "llmutelist.h"
+#include "llpanelblockedlist.h"
#include "llscrolllistctrl.h"
+#include "lltrans.h"
#include "lluictrlfactory.h"
#include "llviewermessage.h"
+#include "llviewermenu.h"
+#include "llviewerobjectlist.h"
///----------------------------------------------------------------------------
/// Class LLFloaterBump
@@ -43,6 +50,18 @@
LLFloaterBump::LLFloaterBump(const LLSD& key)
: LLFloater(key)
{
+ mCommitCallbackRegistrar.add("Avatar.SendIM", boost::bind(&LLFloaterBump::startIM, this));
+ mCommitCallbackRegistrar.add("Avatar.ReportAbuse", boost::bind(&LLFloaterBump::reportAbuse, this));
+ mCommitCallbackRegistrar.add("ShowAgentProfile", boost::bind(&LLFloaterBump::showProfile, this));
+ mCommitCallbackRegistrar.add("Avatar.InviteToGroup", boost::bind(&LLFloaterBump::inviteToGroup, this));
+ mCommitCallbackRegistrar.add("Avatar.Call", boost::bind(&LLFloaterBump::startCall, this));
+ mEnableCallbackRegistrar.add("Avatar.EnableCall", boost::bind(&LLAvatarActions::canCall));
+ mCommitCallbackRegistrar.add("Avatar.AddFriend", boost::bind(&LLFloaterBump::addFriend, this));
+ mEnableCallbackRegistrar.add("Avatar.EnableAddFriend", boost::bind(&LLFloaterBump::enableAddFriend, this));
+ mCommitCallbackRegistrar.add("Avatar.Mute", boost::bind(&LLFloaterBump::muteAvatar, this));
+ mEnableCallbackRegistrar.add("Avatar.EnableMute", boost::bind(&LLFloaterBump::enableMute, this));
+ mCommitCallbackRegistrar.add("PayObject", boost::bind(&LLFloaterBump::payAvatar, this));
+ mCommitCallbackRegistrar.add("Tools.LookAtSelection", boost::bind(&LLFloaterBump::zoomInAvatar, this));
}
@@ -51,14 +70,25 @@ LLFloaterBump::~LLFloaterBump()
{
}
+BOOL LLFloaterBump::postBuild()
+{
+ mList = getChild<LLScrollListCtrl>("bump_list");
+ mList->setAllowMultipleSelection(false);
+ mList->setRightMouseDownCallback(boost::bind(&LLFloaterBump::onScrollListRightClicked, this, _1, _2, _3));
+
+ mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>("menu_avatar_other.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ mPopupMenu->setItemVisible(std::string("Normal"), false);
+ mPopupMenu->setItemVisible(std::string("Always use impostor"), false);
+ mPopupMenu->setItemVisible(std::string("Never use impostor"), false);
+ mPopupMenu->setItemVisible(std::string("Impostor seperator"), false);
+
+ return TRUE;
+}
// virtual
void LLFloaterBump::onOpen(const LLSD& key)
{
- LLScrollListCtrl* list = getChild<LLScrollListCtrl>("bump_list");
- if (!list)
- return;
- list->deleteAllItems();
- list->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
+ mNames.clear();
+ mList->deleteAllItems();
if (gMeanCollisionList.empty())
{
@@ -66,7 +96,7 @@ void LLFloaterBump::onOpen(const LLSD& key)
LLSD row;
row["columns"][0]["value"] = none_detected;
row["columns"][0]["font"] = "SansSerifBold";
- list->addElement(row);
+ mList->addElement(row);
}
else
{
@@ -74,7 +104,7 @@ void LLFloaterBump::onOpen(const LLSD& key)
iter != gMeanCollisionList.end(); ++iter)
{
LLMeanCollisionData *mcd = *iter;
- add(list, mcd);
+ add(mList, mcd);
}
}
}
@@ -126,4 +156,94 @@ void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd)
row["columns"][0]["value"] = text;
row["columns"][0]["font"] = "SansSerifBold";
list->addElement(row);
+
+
+ mNames[mcd->mPerp] = mcd->mFullName;
+}
+
+
+void LLFloaterBump::onScrollListRightClicked(LLUICtrl* ctrl, S32 x, S32 y)
+{
+ if (!gMeanCollisionList.empty())
+ {
+ LLScrollListItem* item = mList->hitItem(x, y);
+ if (item && mPopupMenu)
+ {
+ mItemUUID = item->getUUID();
+ mPopupMenu->buildDrawLabels();
+ mPopupMenu->updateParent(LLMenuGL::sMenuContainer);
+
+ std::string mute_msg = (LLMuteList::getInstance()->isMuted(mItemUUID, mNames[mItemUUID])) ? "UnmuteAvatar" : "MuteAvatar";
+ mPopupMenu->getChild<LLUICtrl>("Avatar Mute")->setValue(LLTrans::getString(mute_msg));
+ mPopupMenu->setItemEnabled(std::string("Zoom In"), (BOOL)gObjectList.findObject(mItemUUID));
+
+ ((LLContextMenu*)mPopupMenu)->show(x, y);
+ LLMenuGL::showPopup(ctrl, mPopupMenu, x, y);
+ }
+ }
+}
+
+
+void LLFloaterBump::startIM()
+{
+ LLAvatarActions::startIM(mItemUUID);
+}
+
+void LLFloaterBump::startCall()
+{
+ LLAvatarActions::startCall(mItemUUID);
+}
+
+void LLFloaterBump::reportAbuse()
+{
+ LLFloaterReporter::showFromAvatar(mItemUUID, "av_name");
+}
+
+void LLFloaterBump::showProfile()
+{
+ LLAvatarActions::showProfile(mItemUUID);
+}
+
+void LLFloaterBump::addFriend()
+{
+ LLAvatarActions::requestFriendshipDialog(mItemUUID);
+}
+
+bool LLFloaterBump::enableAddFriend()
+{
+ return !LLAvatarActions::isFriend(mItemUUID);
+}
+
+void LLFloaterBump::muteAvatar()
+{
+ LLMute mute(mItemUUID, mNames[mItemUUID], LLMute::AGENT);
+ if (LLMuteList::getInstance()->isMuted(mute.mID))
+ {
+ LLMuteList::getInstance()->remove(mute);
+ }
+ else
+ {
+ LLMuteList::getInstance()->add(mute);
+ LLPanelBlockedList::showPanelAndSelect(mute.mID);
+ }
+}
+
+void LLFloaterBump::payAvatar()
+{
+ LLAvatarActions::pay(mItemUUID);
+}
+
+void LLFloaterBump::zoomInAvatar()
+{
+ handle_zoom_to_object(mItemUUID);
+}
+
+bool LLFloaterBump::enableMute()
+{
+ return LLAvatarActions::canBlock(mItemUUID);
+}
+
+void LLFloaterBump::inviteToGroup()
+{
+ LLAvatarActions::inviteToGroup(mItemUUID);
}
diff --git a/indra/newview/llfloaterbump.h b/indra/newview/llfloaterbump.h
index 5acab6da8c..11b7db9fee 100755
--- a/indra/newview/llfloaterbump.h
+++ b/indra/newview/llfloaterbump.h
@@ -29,6 +29,7 @@
#define LL_LLFLOATERBUMP_H
#include "llfloater.h"
+#include "llmenugl.h"
class LLMeanCollisionData;
class LLScrollListCtrl;
@@ -39,14 +40,36 @@ class LLFloaterBump
friend class LLFloaterReg;
protected:
void add(LLScrollListCtrl* list, LLMeanCollisionData *mcd);
+ void onScrollListRightClicked(LLUICtrl* ctrl, S32 x, S32 y);
public:
+ /*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key);
+ void startIM();
+ void startCall();
+ void reportAbuse();
+ void showProfile();
+ void addFriend();
+ void inviteToGroup();
+ bool enableAddFriend();
+ void muteAvatar();
+ void payAvatar();
+ void zoomInAvatar();
+ bool enableMute();
+
private:
LLFloaterBump(const LLSD& key);
virtual ~LLFloaterBump();
+
+ LLScrollListCtrl* mList;
+ LLMenuGL* mPopupMenu;
+ LLUUID mItemUUID;
+
+ typedef std::map<LLUUID, std::string> uuid_map_t;
+ uuid_map_t mNames;
+
};
#endif
diff --git a/indra/newview/skins/default/xui/en/menu_avatar_other.xml b/indra/newview/skins/default/xui/en/menu_avatar_other.xml
index 8bd013f14b..cfbbe41f95 100755
--- a/indra/newview/skins/default/xui/en/menu_avatar_other.xml
+++ b/indra/newview/skins/default/xui/en/menu_avatar_other.xml
@@ -96,14 +96,11 @@
function="Tools.LookAtSelection"
parameter="zoom" />
</menu_item_call>
- <menu_item_call
- enabled="false"
+ <menu_item_call
label="Pay"
name="Pay...">
<menu_item_call.on_click
- function="PayObject" />
- <menu_item_call.on_enable
- function="EnablePayAvatar" />
+ function="PayObject" />
</menu_item_call>
<menu_item_separator />