summaryrefslogtreecommitdiff
path: root/indra/newview
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
parent8740368b0bab2ff9c0bbdb31b0da240e9e927e22 (diff)
SL-9960 [EEP] Allow drag and drop inventory setting to the "Settings from Inventory" field
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpanelenvironment.cpp55
-rw-r--r--indra/newview/llpanelenvironment.h31
-rw-r--r--indra/newview/skins/default/xui/en/panel_region_environment.xml8
3 files changed, 93 insertions, 1 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;
+}
diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h
index 3ed631db41..2c070eb21f 100644
--- a/indra/newview/llpanelenvironment.h
+++ b/indra/newview/llpanelenvironment.h
@@ -41,6 +41,7 @@ class LLViewerRegion;
class LLPanelEnvironmentInfo : public LLPanel
{
+ friend class LLSettingsDropTarget;
public:
LLPanelEnvironmentInfo();
virtual ~LLPanelEnvironmentInfo();
@@ -81,6 +82,7 @@ protected:
static const std::string PNL_BUTTONS;
static const std::string PNL_DISABLED;
static const std::string TXT_DISABLED;
+ static const std::string SDT_DROP_TARGET;
static const std::string STR_LABEL_USEDEFAULT;
static const std::string STR_LABEL_USEREGION;
@@ -177,4 +179,31 @@ private:
bool mNoSelection;
bool mNoEnvironment;
};
-#endif // LL_LLPANELEXPERIENCES_H
+
+class LLSettingsDropTarget : public LLView
+{
+public:
+ struct Params : public LLInitParam::Block<Params, LLView::Params>
+ {
+ Params()
+ {
+ changeDefault(mouse_opaque, false);
+ changeDefault(follows.flags, FOLLOWS_ALL);
+ }
+ };
+ LLSettingsDropTarget(const Params&);
+ ~LLSettingsDropTarget() {};
+
+ virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg);
+ void setPanel(LLPanelEnvironmentInfo* panel) { mEnvironmentInfoPanel = panel; };
+ void setDndEnabled(bool dnd_enabled) { mDndEnabled = dnd_enabled; };
+
+protected:
+ LLPanelEnvironmentInfo* mEnvironmentInfoPanel;
+ bool mDndEnabled;
+};
+#endif // LL_LLPANELENVIRONMENT_H
diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml
index cfbe25129b..18364bbf0b 100644
--- a/indra/newview/skins/default/xui/en/panel_region_environment.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml
@@ -102,6 +102,14 @@
width="200">
Unknown
</line_editor>
+ <settings_drop_target
+ height="20"
+ top_pad="-20"
+ follows="top|left"
+ layout="topleft"
+ name="sdt_drop_target"
+ tool_tip="Drag a setting from Inventory onto this target box to select it as current evironment."
+ width="200" />
<button
name="btn_select_inventory"
follows="top|left"