diff options
| author | Seth ProductEngine <slitovchuk@productengine.com> | 2012-06-13 21:21:19 +0300 | 
|---|---|---|
| committer | Seth ProductEngine <slitovchuk@productengine.com> | 2012-06-13 21:21:19 +0300 | 
| commit | 569146f27c7350ca2245f1fa7bc4cb9c16a428ea (patch) | |
| tree | 7debcfad84518aa66a78b0f3967e0aacc4e84fc1 | |
| parent | b50349ab8490c9b48e9cf89b8de186b528d90e60 (diff) | |
CHUI-120 WIP Modified chat participants drag and drop not to use LLClipboard.
| -rw-r--r-- | indra/newview/llavatarlistitem.cpp | 1 | ||||
| -rw-r--r-- | indra/newview/llimfloater.cpp | 8 | ||||
| -rw-r--r-- | indra/newview/llimfloater.h | 2 | ||||
| -rw-r--r-- | indra/newview/lltooldraganddrop.cpp | 97 | 
4 files changed, 73 insertions, 35 deletions
| diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 7ba63bc4a2..7b5229b5e6 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -31,7 +31,6 @@  #include "llavatarlistitem.h"  #include "llbutton.h" -#include "llclipboard.h"  #include "llfloaterreg.h"  #include "lltextutil.h" diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 3458e740e7..7c6de01c96 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -1004,7 +1004,7 @@ BOOL LLIMFloater::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,  {  	if (cargo_type == DAD_PERSON)  	{ -		if (dropPerson(static_cast<LLInventoryObject*>(cargo_data), drop)) +		if (dropPerson(static_cast<LLUUID*>(cargo_data), drop))  		{  			*accept = ACCEPT_YES_MULTI;  		} @@ -1016,13 +1016,13 @@ BOOL LLIMFloater::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,  	return TRUE;  } -bool LLIMFloater::dropPerson(LLInventoryObject* item, bool drop) +bool LLIMFloater::dropPerson(LLUUID* person_id, bool drop)  { -	bool res = item && item->getUUID().notNull(); +	bool res = person_id && person_id->notNull();  	if(res)  	{  		uuid_vec_t ids; -		ids.push_back(item->getUUID()); +		ids.push_back(*person_id);  		res = canAddSelectedToChat(ids);  		if(res && drop) diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index b02f779637..d74b13b88d 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -138,7 +138,7 @@ private:  	// For display name lookups for IM window titles  	void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); -	bool dropPerson(LLInventoryObject* item, bool drop); +	bool dropPerson(LLUUID* person_id, bool drop);  	BOOL isInviteAllowed() const;  	BOOL inviteToSession(const uuid_vec_t& agent_ids); diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 296ded6831..86708b46d5 100644 --- 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); +				}  			}  		} @@ -2495,7 +2527,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. @@ -2527,10 +2565,11 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory(  			item = (LLViewerInventoryItem*)preview->getDragItem();  		}  	} -	else if(mSource == SOURCE_VIEWER || mSource == SOURCE_PEOPLE) +	else if(mSource == SOURCE_VIEWER)  	{  		item = (LLViewerInventoryItem*)gToolBarView->getDragItem();  	} +  	if(item) return item;  	if(cat) return cat;  	return NULL; | 
