From 0efddbd9ffe1e200b2af3612c8d462136e46dbb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Liru=20F=C3=A6rs?= Date: Fri, 10 Jan 2020 03:55:04 -0500 Subject: [PATCH] Add Pay to Object UI Menus --- indra/newview/lltoolpie.cpp | 2 +- indra/newview/llviewermenu.cpp | 36 ++++++++++++++----- indra/newview/llviewermenu.h | 4 +-- .../default/xui/en-us/menu_objects_list.xml | 4 +++ .../default/xui/en-us/menu_url_objectim.xml | 4 +++ 5 files changed, 38 insertions(+), 12 deletions(-) diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 9f958a9d6..0f24ca943 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -569,7 +569,7 @@ void LLToolPie::selectionPropertiesReceived() case CLICK_ACTION_PAY: if ( LLToolPie::getInstance()->mClickActionPayEnabled ) { - handle_give_money_dialog(); + handle_give_money_dialog(selected_object); } break; case CLICK_ACTION_OPEN: diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index bd00e4d9e..6fe00b513 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -6125,7 +6125,7 @@ class LLAvatarResetSkeletonAndAnimations : public view_listener_t }; -bool complete_give_money(const LLSD& notification, const LLSD& response, LLObjectSelectionHandle selection) +bool complete_give_money(const LLSD& notification, const LLSD& response, LLViewerObject* objectp) { S32 option = LLNotification::getSelectedOption(notification, response); if (option == 0) @@ -6133,8 +6133,6 @@ bool complete_give_money(const LLSD& notification, const LLSD& response, LLObjec gAgent.setDoNotDisturb(false); } - LLViewerObject* objectp = selection->getPrimaryObject(); - // Show avatar's name if paying attachment if (objectp && objectp->isAttachment()) { @@ -6161,10 +6159,10 @@ bool complete_give_money(const LLSD& notification, const LLSD& response, LLObjec return false; } -void handle_give_money_dialog() +void handle_give_money_dialog(LLViewerObject* obj) { LLNotification::Params params("BusyModePay"); - params.functor(boost::bind(complete_give_money, _1, _2, LLSelectMgr::getInstance()->getSelection())); + params.functor(boost::bind(complete_give_money, _1, _2, obj)); if (gAgent.isDoNotDisturb()) { @@ -6181,7 +6179,7 @@ class LLPayObject : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - handle_give_money_dialog(); + handle_give_money_dialog(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()); return true; } }; @@ -6196,9 +6194,8 @@ bool enable_pay_avatar() // [/RLVa:KB] } -bool enable_pay_object() +bool enable_pay_object(LLViewerObject* object) { - LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); if( object ) { LLViewerObject *parent = (LLViewerObject *)object->getParent(); @@ -6304,7 +6301,7 @@ class LLEnablePayObject : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - gMenuHolder->findControl(userdata["control"].asString())->setValue(enable_pay_avatar() || enable_pay_object()); + gMenuHolder->findControl(userdata["control"].asString())->setValue(enable_pay_avatar() || enable_pay_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject())); return true; } }; @@ -9654,6 +9651,25 @@ class ListObjectSit : public view_listener_t } }; +class ListObjectPay : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + handle_give_money_dialog(gObjectList.findObject(LFIDBearer::getActiveSelectedID())); + return true; + } +}; + +class ListObjectEnablePay : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + const auto& ids = LFIDBearer::getActiveSelectedIDs(); + gMenuHolder->findControl(userdata["control"].asString())->setValue(ids.size() == 1 && enable_pay_object(gObjectList.findObject(ids[0]))); + return true; + } +}; + class MediaCtrlCopyURL : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -10048,6 +10064,8 @@ void initialize_menus() addMenu(new ListActivate, "List.Activate"); addMenu(new ListObjectCamTo, "List.Object.CamTo"); addMenu(new ListObjectSit, "List.Object.Sit"); + addMenu(new ListObjectPay, "List.Object.Pay"); + addMenu(new ListObjectEnablePay, "List.Object.EnablePay"); add_radar_listeners(); diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index c1eb30c1e..4c0418ce2 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -133,8 +133,8 @@ void handle_toggle_flycam(); void handle_fake_away_status(void*); void handle_object_sit_or_stand(); -void handle_give_money_dialog(); -bool enable_pay_object(); +void handle_give_money_dialog(class LLViewerObject*); +bool enable_pay_object(LLViewerObject*); bool enable_buy_object(); void handle_go_to(const LLVector3d& pos); diff --git a/indra/newview/skins/default/xui/en-us/menu_objects_list.xml b/indra/newview/skins/default/xui/en-us/menu_objects_list.xml index 4f7d0a47b..7e2a943d4 100644 --- a/indra/newview/skins/default/xui/en-us/menu_objects_list.xml +++ b/indra/newview/skins/default/xui/en-us/menu_objects_list.xml @@ -20,6 +20,10 @@ + + + + diff --git a/indra/newview/skins/default/xui/en-us/menu_url_objectim.xml b/indra/newview/skins/default/xui/en-us/menu_url_objectim.xml index b8104a604..5d785ac7c 100644 --- a/indra/newview/skins/default/xui/en-us/menu_url_objectim.xml +++ b/indra/newview/skins/default/xui/en-us/menu_url_objectim.xml @@ -60,6 +60,10 @@ + + + +