diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2020-04-21 13:12:05 +0300 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2020-04-21 13:12:05 +0300 |
commit | a4b1c0330a6a8e43bf4c41c5b0c836bd1dee2268 (patch) | |
tree | 6d68d3e3f665d60fa946bd24a4b324b5e63339fb /indra/newview/llviewertexteditor.cpp | |
parent | a8df6762ff88458916397b9707f6954b2714e14d (diff) | |
parent | d7f1c88c35849e56f5b352f13c16a08467d1533b (diff) |
Merge branch 'master' into DRTVWR-482
# Conflicts:
# indra/newview/app_settings/shaders/class1/objects/previewV.glsl
# indra/newview/lldynamictexture.cpp
# indra/newview/llfloatermodelpreview.cpp
Diffstat (limited to 'indra/newview/llviewertexteditor.cpp')
-rw-r--r-- | indra/newview/llviewertexteditor.cpp | 105 |
1 files changed, 65 insertions, 40 deletions
diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 0e181bf53d..e2de7ac825 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -31,6 +31,7 @@ #include "llagent.h" #include "llaudioengine.h" #include "llavataractions.h" +#include "llenvironment.h" #include "llfloaterreg.h" #include "llfloatersidepanelcontainer.h" #include "llfloaterworldmap.h" @@ -540,7 +541,9 @@ LLUIImagePtr LLEmbeddedItems::getItemImage(llwchar ext_char) const case LLAssetType::AT_ANIMATION: img_name = "Inv_Animation"; break; case LLAssetType::AT_GESTURE: img_name = "Inv_Gesture"; break; case LLAssetType::AT_MESH: img_name = "Inv_Mesh"; break; - default: img_name = "Inv_Invalid"; break; // use the Inv_Invalid icon for undefined object types (see MAINT-3981) + case LLAssetType::AT_SETTINGS: img_name = "Inv_Settings"; break; + default: img_name = "Inv_Invalid"; break; // use the Inv_Invalid icon for undefined object types (see MAINT-3981) + } return LLUI::getUIImage(img_name); @@ -852,8 +855,18 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, if (getEnabled() && acceptsTextInput()) { + bool supported = false; switch( cargo_type ) { + case DAD_SETTINGS: + { + supported = LLEnvironment::instance().isExtendedEnvironmentEnabled(); + if (!supported && tooltip_msg.empty()) + { + tooltip_msg.assign(LLTrans::getString("TooltipNotecardNotAllowedTypeDrop")); + } + break; + } case DAD_CALLINGCARD: case DAD_TEXTURE: case DAD_SOUND: @@ -867,52 +880,50 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, case DAD_GESTURE: case DAD_MESH: { - LLInventoryItem *item = (LLInventoryItem *)cargo_data; - if( item && allowsEmbeddedItems() ) + supported = true; + break; + } + + default: + supported = false; + break; + } + + LLInventoryItem *item = (LLInventoryItem *)cargo_data; + if (item && allowsEmbeddedItems() && supported) + { + U32 mask_next = item->getPermissions().getMaskNextOwner(); + if((mask_next & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) + { + if( drop ) { - U32 mask_next = item->getPermissions().getMaskNextOwner(); - if((mask_next & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) - { - if( drop ) - { - deselect(); - S32 old_cursor = mCursorPos; - setCursorAtLocalPos( x, y, TRUE ); - S32 insert_pos = mCursorPos; - setCursorPos(old_cursor); - BOOL inserted = insertEmbeddedItem( insert_pos, item ); - if( inserted && (old_cursor > mCursorPos) ) - { - setCursorPos(mCursorPos + 1); - } - - needsReflow(); - - } - *accept = ACCEPT_YES_COPY_MULTI; - } - else + deselect(); + S32 old_cursor = mCursorPos; + setCursorAtLocalPos( x, y, TRUE ); + S32 insert_pos = mCursorPos; + setCursorPos(old_cursor); + BOOL inserted = insertEmbeddedItem( insert_pos, item ); + if( inserted && (old_cursor > mCursorPos) ) { - *accept = ACCEPT_NO; - if (tooltip_msg.empty()) - { - // *TODO: Translate - tooltip_msg.assign("Only items with unrestricted\n" - "'next owner' permissions \n" - "can be attached to notecards."); - } + setCursorPos(mCursorPos + 1); } + + needsReflow(); } - else + *accept = ACCEPT_YES_COPY_MULTI; + } + else + { + *accept = ACCEPT_NO; + if (tooltip_msg.empty()) { - *accept = ACCEPT_NO; + tooltip_msg.assign(LLTrans::getString("TooltipNotecardOwnerRestrictedDrop")); } - break; } - - default: + } + else + { *accept = ACCEPT_NO; - break; } } else @@ -1112,7 +1123,9 @@ BOOL LLViewerTextEditor::openEmbeddedItem(LLPointer<LLInventoryItem> item, llwch case LLAssetType::AT_CALLINGCARD: openEmbeddedCallingcard( item, wc ); return TRUE; - + case LLAssetType::AT_SETTINGS: + openEmbeddedSetting(item, wc); + return TRUE; case LLAssetType::AT_NOTECARD: case LLAssetType::AT_LSL_TEXT: case LLAssetType::AT_CLOTHING: @@ -1187,6 +1200,18 @@ void LLViewerTextEditor::openEmbeddedCallingcard( LLInventoryItem* item, llwchar } } +void LLViewerTextEditor::openEmbeddedSetting(LLInventoryItem* item, llwchar wc) +{ + if (LLEnvironment::instance().isInventoryEnabled()) + { + showCopyToInvDialog(item, wc); + } + else + { + LLNotificationsUtil::add("NoEnvironmentSettings"); + } +} + void LLViewerTextEditor::showUnsavedAlertDialog( LLInventoryItem* item ) { LLSD payload; |