summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelenvironment.cpp
diff options
context:
space:
mode:
authormaxim_productengine <mnikolenko@productengine.com>2018-10-25 18:16:34 +0300
committermaxim_productengine <mnikolenko@productengine.com>2018-10-25 18:16:34 +0300
commite9faa3cce8897af2a4303538672e2262ed39520a (patch)
tree899b8e9e273b5c8be755269bc5acd6756f4f4f8c /indra/newview/llpanelenvironment.cpp
parent8740368b0bab2ff9c0bbdb31b0da240e9e927e22 (diff)
SL-9960 [EEP] Allow drag and drop inventory setting to the "Settings from Inventory" field
Diffstat (limited to 'indra/newview/llpanelenvironment.cpp')
-rw-r--r--indra/newview/llpanelenvironment.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp
index 35a998edf6..e049fa7842 100644
--- a/indra/newview/llpanelenvironment.cpp
+++ b/indra/newview/llpanelenvironment.cpp
@@ -77,6 +77,7 @@ const std::string LLPanelEnvironmentInfo::PNL_ENVIRONMENT_ALTITUDES("pnl_environ
const std::string LLPanelEnvironmentInfo::PNL_BUTTONS("pnl_environment_buttons");
const std::string LLPanelEnvironmentInfo::PNL_DISABLED("pnl_environment_disabled");
const std::string LLPanelEnvironmentInfo::TXT_DISABLED("txt_environment_disabled");
+const std::string LLPanelEnvironmentInfo::SDT_DROP_TARGET("sdt_drop_target");
const std::string LLPanelEnvironmentInfo::STR_LABEL_USEDEFAULT("str_label_use_default");
const std::string LLPanelEnvironmentInfo::STR_LABEL_USEREGION("str_label_use_region");
@@ -112,6 +113,9 @@ const std::string alt_labels[] = {
"ground",
};
+
+static LLDefaultChildRegistry::Register<LLSettingsDropTarget> r("settings_drop_target");
+
//=========================================================================
LLPanelEnvironmentInfo::LLPanelEnvironmentInfo():
mCurrentEnvironment(),
@@ -148,6 +152,8 @@ BOOL LLPanelEnvironmentInfo::postBuild()
mChangeMonitor = LLEnvironment::instance().setEnvironmentChanged([this](LLEnvironment::EnvSelection_t env) { onEnvironmentChanged(env); });
+ getChild<LLSettingsDropTarget>(SDT_DROP_TARGET)->setPanel(this);
+
return TRUE;
}
@@ -398,6 +404,8 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled)
getChild<LLUICtrl>(BTN_APPLY)->setEnabled(enabled && (mDirtyFlag != 0));
getChild<LLUICtrl>(BTN_CANCEL)->setEnabled(enabled && (mDirtyFlag != 0));
+ getChild<LLSettingsDropTarget>(SDT_DROP_TARGET)->setDndEnabled(enabled && !is_legacy);
+
return true;
}
@@ -793,3 +801,50 @@ void LLPanelEnvironmentInfo::_onEnvironmentReceived(LLHandle<LLPanel> that_h, S3
return;
that->onEnvironmentReceived(parcel_id, envifo);
}
+
+LLSettingsDropTarget::LLSettingsDropTarget(const LLSettingsDropTarget::Params& p)
+ : LLView(p), mEnvironmentInfoPanel(NULL), mDndEnabled(false)
+{}
+
+BOOL LLSettingsDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg)
+{
+ BOOL handled = FALSE;
+
+ if (getParent() && mDndEnabled)
+ {
+ handled = TRUE;
+
+ switch (cargo_type)
+ {
+ case DAD_SETTINGS:
+ {
+ LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;
+ if (inv_item && mEnvironmentInfoPanel)
+ {
+ LLUUID item_id = inv_item->getUUID();
+ if (gInventory.getItem(item_id))
+ {
+ *accept = ACCEPT_YES_COPY_SINGLE;
+ if (drop)
+ {
+ mEnvironmentInfoPanel->onPickerCommitted(item_id);
+ }
+ }
+ }
+ else
+ {
+ *accept = ACCEPT_NO;
+ }
+ break;
+ }
+ default:
+ *accept = ACCEPT_NO;
+ break;
+ }
+ }
+ return handled;
+}