summaryrefslogtreecommitdiff
path: root/indra/newview/lltooldraganddrop.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lltooldraganddrop.cpp')
-rwxr-xr-x[-rw-r--r--]indra/newview/lltooldraganddrop.cpp103
1 files changed, 71 insertions, 32 deletions
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index c69999981c..e085834326 100644..100755
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -58,7 +58,6 @@
#include "llviewerwindow.h"
#include "llvoavatarself.h"
#include "llworld.h"
-#include "llclipboard.h"
// syntactic sugar
#define callMemberFunction(object,ptrToMember) ((object).*(ptrToMember))
@@ -654,33 +653,41 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
sOperationId++;
}
+ // For people drag and drop we don't need an actual inventory object,
+ // instead we need the current cargo id, which should be a person id.
+ bool is_uuid_dragged = (mSource == SOURCE_PEOPLE);
+
if (top_view)
{
handled = TRUE;
for (mCurItemIndex = 0; mCurItemIndex < (S32)mCargoIDs.size(); mCurItemIndex++)
{
- LLInventoryObject* cargo = locateInventory(item, cat);
+ S32 local_x, local_y;
+ top_view->screenPointToLocal( x, y, &local_x, &local_y );
+ EAcceptance item_acceptance = ACCEPT_NO;
+ LLInventoryObject* cargo = locateInventory(item, cat);
if (cargo)
{
- S32 local_x, local_y;
- top_view->screenPointToLocal( x, y, &local_x, &local_y );
- EAcceptance item_acceptance = ACCEPT_NO;
handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, FALSE,
mCargoTypes[mCurItemIndex],
(void*)cargo,
&item_acceptance,
mToolTipMsg);
- if (handled)
- {
- // use sort order to determine priority of acceptance
- *acceptance = (EAcceptance)llmin((U32)item_acceptance, (U32)*acceptance);
- }
}
- else
+ else if (is_uuid_dragged)
{
- return;
+ handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, FALSE,
+ mCargoTypes[mCurItemIndex],
+ (void*)&mCargoIDs[mCurItemIndex],
+ &item_acceptance,
+ mToolTipMsg);
+ }
+ if (handled)
+ {
+ // use sort order to determine priority of acceptance
+ *acceptance = (EAcceptance)llmin((U32)item_acceptance, (U32)*acceptance);
}
}
@@ -697,20 +704,27 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
for (mCurItemIndex = 0; mCurItemIndex < (S32)mCargoIDs.size(); mCurItemIndex++)
{
- LLInventoryObject* cargo = locateInventory(item, cat);
+ S32 local_x, local_y;
+ EAcceptance item_acceptance;
+ top_view->screenPointToLocal( x, y, &local_x, &local_y );
+ LLInventoryObject* cargo = locateInventory(item, cat);
if (cargo)
{
- S32 local_x, local_y;
-
- EAcceptance item_acceptance;
- top_view->screenPointToLocal( x, y, &local_x, &local_y );
handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, TRUE,
mCargoTypes[mCurItemIndex],
(void*)cargo,
&item_acceptance,
mToolTipMsg);
}
+ else if (is_uuid_dragged)
+ {
+ handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, FALSE,
+ mCargoTypes[mCurItemIndex],
+ (void*)&mCargoIDs[mCurItemIndex],
+ &item_acceptance,
+ mToolTipMsg);
+ }
}
}
if (handled)
@@ -727,17 +741,27 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
for (mCurItemIndex = 0; mCurItemIndex < (S32)mCargoIDs.size(); mCurItemIndex++)
{
+ EAcceptance item_acceptance = ACCEPT_NO;
+
LLInventoryObject* cargo = locateInventory(item, cat);
// fix for EXT-3191
- if (NULL == cargo) return;
-
- EAcceptance item_acceptance = ACCEPT_NO;
- handled = handled && root_view->handleDragAndDrop(x, y, mask, FALSE,
- mCargoTypes[mCurItemIndex],
- (void*)cargo,
- &item_acceptance,
- mToolTipMsg);
+ if (cargo)
+ {
+ handled = handled && root_view->handleDragAndDrop(x, y, mask, FALSE,
+ mCargoTypes[mCurItemIndex],
+ (void*)cargo,
+ &item_acceptance,
+ mToolTipMsg);
+ }
+ else if (is_uuid_dragged)
+ {
+ handled = handled && root_view->handleDragAndDrop(x, y, mask, FALSE,
+ mCargoTypes[mCurItemIndex],
+ (void*)&mCargoIDs[mCurItemIndex],
+ &item_acceptance,
+ mToolTipMsg);
+ }
if (handled)
{
// use sort order to determine priority of acceptance
@@ -757,17 +781,25 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
for (mCurItemIndex = 0; mCurItemIndex < (S32)mCargoIDs.size(); mCurItemIndex++)
{
- LLInventoryObject* cargo = locateInventory(item, cat);
+ EAcceptance item_acceptance;
+ LLInventoryObject* cargo = locateInventory(item, cat);
if (cargo)
{
- EAcceptance item_acceptance;
handled = handled && root_view->handleDragAndDrop(x, y, mask, TRUE,
mCargoTypes[mCurItemIndex],
(void*)cargo,
&item_acceptance,
mToolTipMsg);
}
+ else if (is_uuid_dragged)
+ {
+ handled = handled && root_view->handleDragAndDrop(x, y, mask, TRUE,
+ mCargoTypes[mCurItemIndex],
+ (void*)&mCargoIDs[mCurItemIndex],
+ &item_acceptance,
+ mToolTipMsg);
+ }
}
}
@@ -780,7 +812,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
if (!handled)
{
// Disallow drag and drop to 3D from the outbox
- const LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false, false);
+ const LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false);
if (outbox_id.notNull())
{
for (S32 item_index = 0; item_index < (S32)mCargoIDs.size(); item_index++)
@@ -1215,7 +1247,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
if (!item || !item->isFinished()) return;
//if (regionp
- // && (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX))
+ // && (regionp->getRegionFlag(REGION_FLAGS_SANDBOX)))
//{
// LLFirstUse::useSandbox();
//}
@@ -1709,7 +1741,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv(
{
if(mSource == SOURCE_LIBRARY)
{
- LLPointer<LLInventoryCallback> cb = new RezAttachmentCallback(0);
+ LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, (LLViewerJointAttachment*)0));
copy_inventory_item(
gAgent.getID(),
item->getPermissions().getOwner(),
@@ -2062,7 +2094,7 @@ EAcceptance LLToolDragAndDrop::dad3dActivateGesture(
{
// create item based on that one, and put it on if that
// was a success.
- LLPointer<LLInventoryCallback> cb = new ActivateGestureCallback();
+ LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(activate_gesture_cb);
copy_inventory_item(
gAgent.getID(),
item->getPermissions().getOwner(),
@@ -2509,7 +2541,13 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory(
{
item = NULL;
cat = NULL;
- if(mCargoIDs.empty()) return NULL;
+
+ if (mCargoIDs.empty()
+ || (mSource == SOURCE_PEOPLE)) ///< There is no inventory item for people drag and drop.
+ {
+ return NULL;
+ }
+
if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
{
// The object should be in user inventory.
@@ -2545,6 +2583,7 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory(
{
item = (LLViewerInventoryItem*)gToolBarView->getDragItem();
}
+
if(item) return item;
if(cat) return cat;
return NULL;