diff options
author | Adam Moss <moss@lindenlab.com> | 2009-05-22 09:58:47 +0000 |
---|---|---|
committer | Adam Moss <moss@lindenlab.com> | 2009-05-22 09:58:47 +0000 |
commit | 9dfe0ca9a0228c4fa75c8a3e51840696cc6b4960 (patch) | |
tree | 3136e0a32cdcb1d55a4c3a5a67791ca128d947a5 /indra/newview/llviewertexteditor.cpp | |
parent | 93cf3d89e51835dd2f61c32b16191ab724528055 (diff) |
svn merge -r121194:121210
svn+ssh://svn.lindenlab.com/svn/linden/branches/viewer/viewer-1.23.onetwo-merge-1
QAR-1531 viewer 1.23rc1+1.23rc2 merge to trunk
Diffstat (limited to 'indra/newview/llviewertexteditor.cpp')
-rw-r--r-- | indra/newview/llviewertexteditor.cpp | 62 |
1 files changed, 39 insertions, 23 deletions
diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 728509e39c..d64700b523 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -569,6 +569,7 @@ LLViewerTextEditor::LLViewerTextEditor(const std::string& name, const LLFontGL* font, BOOL allow_embedded_items) : LLTextEditor(name, rect, max_length, default_text, font, allow_embedded_items), + mDragItemChar(0), mDragItemSaved(FALSE), mInventoryCallback(new LLEmbeddedNotecardOpener) { @@ -694,6 +695,7 @@ BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) if (item_at_pos) { mDragItem = item_at_pos; + mDragItemChar = wc; mDragItemSaved = LLEmbeddedItems::getEmbeddedItemSaved(wc); gFocusMgr.setMouseCapture( this ); mMouseDownX = x; @@ -907,8 +909,9 @@ BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) { if(mDragItemSaved) { - openEmbeddedItem(mDragItem); - }else + openEmbeddedItem(mDragItem, mDragItemChar); + } + else { showUnsavedAlertDialog(mDragItem); } @@ -1060,7 +1063,15 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, std::string& tooltip_msg) { BOOL handled = FALSE; - + + LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); + if (LLToolDragAndDrop::SOURCE_NOTECARD == source) + { + // We currently do not handle dragging items from one notecard to another + // since items in a notecard must be in Inventory to be verified. See DEV-2891. + return FALSE; + } + if (mTakesNonScrollClicks) { if (getEnabled() && acceptsTextInput()) @@ -1096,7 +1107,7 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, case DAD_GESTURE: { LLInventoryItem *item = (LLInventoryItem *)cargo_data; - if( allowsEmbeddedItems() ) + if( item && allowsEmbeddedItems() ) { U32 mask_next = item->getPermissions().getMaskNextOwner(); if((mask_next & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) @@ -1302,13 +1313,14 @@ BOOL LLViewerTextEditor::openEmbeddedItemAtPos(S32 pos) { if( pos < getLength()) { - LLInventoryItem* item = LLEmbeddedItems::getEmbeddedItem( getWChar(pos) ); + llwchar wc = getWChar(pos); + LLInventoryItem* item = LLEmbeddedItems::getEmbeddedItem( wc ); if( item ) { - BOOL saved = LLEmbeddedItems::getEmbeddedItemSaved( getWChar(pos) ); + BOOL saved = LLEmbeddedItems::getEmbeddedItemSaved( wc ); if (saved) { - return openEmbeddedItem(item); + return openEmbeddedItem(item, wc); } else { @@ -1320,25 +1332,25 @@ BOOL LLViewerTextEditor::openEmbeddedItemAtPos(S32 pos) } -BOOL LLViewerTextEditor::openEmbeddedItem(LLInventoryItem* item) +BOOL LLViewerTextEditor::openEmbeddedItem(LLInventoryItem* item, llwchar wc) { switch( item->getType() ) { case LLAssetType::AT_TEXTURE: - openEmbeddedTexture( item ); + openEmbeddedTexture( item, wc ); return TRUE; case LLAssetType::AT_SOUND: - openEmbeddedSound( item ); + openEmbeddedSound( item, wc ); return TRUE; case LLAssetType::AT_NOTECARD: - openEmbeddedNotecard( item ); + openEmbeddedNotecard( item, wc ); return TRUE; case LLAssetType::AT_LANDMARK: - openEmbeddedLandmark( item ); + openEmbeddedLandmark( item, wc ); return TRUE; case LLAssetType::AT_LSL_TEXT: @@ -1347,7 +1359,7 @@ BOOL LLViewerTextEditor::openEmbeddedItem(LLInventoryItem* item) case LLAssetType::AT_BODYPART: case LLAssetType::AT_ANIMATION: case LLAssetType::AT_GESTURE: - showCopyToInvDialog( item ); + showCopyToInvDialog( item, wc ); return TRUE; default: return FALSE; @@ -1356,7 +1368,7 @@ BOOL LLViewerTextEditor::openEmbeddedItem(LLInventoryItem* item) } -void LLViewerTextEditor::openEmbeddedTexture( LLInventoryItem* item ) +void LLViewerTextEditor::openEmbeddedTexture( LLInventoryItem* item, llwchar wc ) { // See if we can bring an existing preview to the front // *NOTE: Just for embedded Texture , we should use getAssetUUID(), @@ -1384,7 +1396,7 @@ void LLViewerTextEditor::openEmbeddedTexture( LLInventoryItem* item ) } } -void LLViewerTextEditor::openEmbeddedSound( LLInventoryItem* item ) +void LLViewerTextEditor::openEmbeddedSound( LLInventoryItem* item, llwchar wc ) { // Play sound locally LLVector3d lpos_global = gAgent.getPositionGlobal(); @@ -1393,18 +1405,18 @@ void LLViewerTextEditor::openEmbeddedSound( LLInventoryItem* item ) { gAudiop->triggerSound(item->getAssetUUID(), gAgentID, SOUND_GAIN, LLAudioEngine::AUDIO_TYPE_UI, lpos_global); } - showCopyToInvDialog( item ); + showCopyToInvDialog( item, wc ); } -void LLViewerTextEditor::openEmbeddedLandmark( LLInventoryItem* item ) +void LLViewerTextEditor::openEmbeddedLandmark( LLInventoryItem* item, llwchar wc ) { std::string title = std::string(" ") + LLLandmarkBridge::prefix() + item->getName(); open_landmark((LLViewerInventoryItem*)item, title, FALSE, item->getUUID(), TRUE); } -void LLViewerTextEditor::openEmbeddedNotecard( LLInventoryItem* item ) +void LLViewerTextEditor::openEmbeddedNotecard( LLInventoryItem* item, llwchar wc ) { copyInventory(item, gInventoryCallbacks.registerCB(mInventoryCallback)); } @@ -1432,11 +1444,12 @@ bool LLViewerTextEditor::onNotecardDialog(const LLSD& notification, const LLSD& -void LLViewerTextEditor::showCopyToInvDialog( LLInventoryItem* item ) +void LLViewerTextEditor::showCopyToInvDialog( LLInventoryItem* item, llwchar wc ) { LLSD payload; - payload["item_id"] = item->getUUID(); - payload["notecard_id"] = mNotecardInventoryID; + LLUUID item_id = item->getUUID(); + payload["item_id"] = item_id; + payload["item_wc"] = LLSD::Integer(wc); LLNotifications::instance().add( "ConfirmItemCopy", LLSD(), payload, boost::bind(&LLViewerTextEditor::onCopyToInvDialog, this, _1, _2)); } @@ -1446,8 +1459,11 @@ bool LLViewerTextEditor::onCopyToInvDialog(const LLSD& notification, const LLSD& S32 option = LLNotification::getSelectedOption(notification, response); if( 0 == option ) { - LLInventoryItem* itemp = gInventory.getItem(notification["payload"]["item_id"].asUUID()); - copyInventory(itemp); + LLUUID item_id = notification["payload"]["item_id"].asUUID(); + llwchar wc = llwchar(notification["payload"]["item_wc"].asInteger()); + LLInventoryItem* itemp = LLEmbeddedItems::getEmbeddedItem(wc); + if (itemp) + copyInventory(itemp); } return false; } |