summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llpanelpick.cpp20
-rw-r--r--indra/newview/llpanelpick.h5
-rw-r--r--indra/newview/lltexturectrl.cpp7
-rw-r--r--indra/newview/lltexturectrl.h3
-rw-r--r--indra/newview/skins/default/xui/en/panel_edit_pick.xml1
5 files changed, 22 insertions, 14 deletions
diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp
index e7615929c8..5ac0587550 100644
--- a/indra/newview/llpanelpick.cpp
+++ b/indra/newview/llpanelpick.cpp
@@ -448,7 +448,7 @@ BOOL LLPanelPickEdit::postBuild()
{
LLPanelPickInfo::postBuild();
- mSnapshotCtrl->setOnSelectCallback(boost::bind(&LLPanelPickEdit::onPickChanged, this, _1));
+ mSnapshotCtrl->setCommitCallback(boost::bind(&LLPanelPickEdit::onSnapshotChanged, this));
LLLineEditor* line_edit = getChild<LLLineEditor>("pick_name");
line_edit->setKeystrokeCallback(boost::bind(&LLPanelPickEdit::onPickChanged, this, _1), NULL);
@@ -537,16 +537,14 @@ void LLPanelPickEdit::sendUpdate()
}
}
+void LLPanelPickEdit::onSnapshotChanged()
+{
+ enableSaveButton(true);
+}
+
void LLPanelPickEdit::onPickChanged(LLUICtrl* ctrl)
{
- if(isDirty())
- {
- enableSaveButton(true);
- }
- else
- {
- enableSaveButton(false);
- }
+ enableSaveButton(isDirty());
}
void LLPanelPickEdit::resetData()
@@ -613,10 +611,6 @@ void LLPanelPickEdit::initTexturePickerMouseEvents()
mSnapshotCtrl->setMouseEnterCallback(boost::bind(&LLPanelPickEdit::onTexturePickerMouseEnter, this, _1));
mSnapshotCtrl->setMouseLeaveCallback(boost::bind(&LLPanelPickEdit::onTexturePickerMouseLeave, this, _1));
- // *WORKAROUND: Needed for EXT-1625: enabling save button each time when picker is opened, even if
- // texture wasn't changed (see Steve's comment).
- mSnapshotCtrl->setMouseDownCallback(boost::bind(&LLPanelPickEdit::enableSaveButton, this, true));
-
text_icon->setVisible(FALSE);
}
diff --git a/indra/newview/llpanelpick.h b/indra/newview/llpanelpick.h
index 62c3b20c0d..4f27760a8d 100644
--- a/indra/newview/llpanelpick.h
+++ b/indra/newview/llpanelpick.h
@@ -222,6 +222,11 @@ protected:
void sendUpdate();
/**
+ * Called when snapshot image changes.
+ */
+ void onSnapshotChanged();
+
+ /**
* Callback for Pick snapshot, name and description changed event.
*/
void onPickChanged(LLUICtrl* ctrl);
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index b980f65e68..9c4825763b 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -878,6 +878,7 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p)
{
setAllowNoTexture(p.allow_no_texture);
setCanApplyImmediately(p.can_apply_immediately);
+ mCommitOnSelection = !p.no_commit_on_selection;
LLTextBox::Params params(p.caption_text);
params.name(p.label);
@@ -1122,7 +1123,11 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op)
}
else
{
- onCommit();
+ // If the "no_commit_on_selection" parameter is set
+ // we commit only when user presses OK in the picker
+ // (i.e. op == TEXTURE_SELECT) or changes texture via DnD.
+ if (mCommitOnSelection || op == TEXTURE_SELECT)
+ onCommit();
}
}
}
diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h
index fb1d591e32..023329a9b2 100644
--- a/indra/newview/lltexturectrl.h
+++ b/indra/newview/lltexturectrl.h
@@ -74,6 +74,7 @@ public:
Optional<std::string> default_image_name;
Optional<bool> allow_no_texture;
Optional<bool> can_apply_immediately;
+ Optional<bool> no_commit_on_selection; // don't commit unless it's DnD or OK button press
Optional<S32> label_width;
Optional<LLUIColor> border_color;
@@ -88,6 +89,7 @@ public:
default_image_name("default_image_name"),
allow_no_texture("allow_no_texture"),
can_apply_immediately("can_apply_immediately"),
+ no_commit_on_selection("no_commit_on_selection", false),
label_width("label_width", -1),
border_color("border_color"),
multiselect_text("multiselect_text"),
@@ -204,6 +206,7 @@ private:
PermissionMask mImmediateFilterPermMask;
PermissionMask mNonImmediateFilterPermMask;
BOOL mCanApplyImmediately;
+ BOOL mCommitOnSelection;
BOOL mNeedsRawImageData;
LLViewBorder* mBorder;
BOOL mValid;
diff --git a/indra/newview/skins/default/xui/en/panel_edit_pick.xml b/indra/newview/skins/default/xui/en/panel_edit_pick.xml
index 15eff4b67c..8e39697a16 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_pick.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_pick.xml
@@ -61,6 +61,7 @@
height="197"
width="280"
layout="topleft"
+ no_commit_on_selection="true"
top="20"
left="10"
name="pick_snapshot" />