summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2017-06-16 18:55:43 +0300
committerandreykproductengine <andreykproductengine@lindenlab.com>2017-06-16 18:55:43 +0300
commit75ee01277432a32178aac03ae606df6909c6c959 (patch)
tree847773a697cc84891247ab1624df4b54ab7770bb /indra/llui
parent65208b7741c1d842b5a5c6822a56cb9d34158dea (diff)
MAINT-1614 Fixed Object changed its position inworld but value in Edit tool was not changed
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llspinctrl.cpp26
-rw-r--r--indra/llui/llspinctrl.h1
2 files changed, 27 insertions, 0 deletions
diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp
index d49e216898..f6831c6d5e 100644
--- a/indra/llui/llspinctrl.cpp
+++ b/indra/llui/llspinctrl.cpp
@@ -130,6 +130,7 @@ LLSpinCtrl::LLSpinCtrl(const LLSpinCtrl::Params& p)
params.follows.flags(FOLLOWS_LEFT | FOLLOWS_BOTTOM);
mEditor = LLUICtrlFactory::create<LLLineEditor> (params);
mEditor->setFocusReceivedCallback( boost::bind(&LLSpinCtrl::onEditorGainFocus, _1, this ));
+ mEditor->setFocusLostCallback( boost::bind(&LLSpinCtrl::onEditorLostFocus, _1, this ));
if (p.allow_digits_only)
{
mEditor->setPrevalidateInput(LLTextValidate::validateNonNegativeS32NoSpace);
@@ -239,6 +240,31 @@ void LLSpinCtrl::onEditorGainFocus( LLFocusableElement* caller, void *userdata )
self->onFocusReceived();
}
+// static
+void LLSpinCtrl::onEditorLostFocus( LLFocusableElement* caller, void *userdata )
+{
+ LLSpinCtrl* self = (LLSpinCtrl*) userdata;
+ llassert( caller == self->mEditor );
+
+ self->onFocusLost();
+
+ std::string text = self->mEditor->getText();
+
+ LLLocale locale(LLLocale::USER_LOCALE);
+ F32 val = (F32)atof(text.c_str());
+
+ F32 saved_val = self->getValueF32();
+ if (saved_val != val && !self->mEditor->isDirty())
+ {
+ // Editor was focused when value update arrived, string
+ // in editor is different from one in spin control.
+ // Since editor is not dirty, it won't commit, so either
+ // attempt to commit value from editor or revert to a more
+ // recent value from spin control
+ self->updateEditor();
+ }
+}
+
void LLSpinCtrl::setValue(const LLSD& value )
{
F32 v = (F32)value.asReal();
diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h
index e34add879d..cab99c35bd 100644
--- a/indra/llui/llspinctrl.h
+++ b/indra/llui/llspinctrl.h
@@ -93,6 +93,7 @@ public:
void onEditorCommit(const LLSD& data);
static void onEditorGainFocus(LLFocusableElement* caller, void *userdata);
+ static void onEditorLostFocus(LLFocusableElement* caller, void *userdata);
static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata);
void onUpBtn(const LLSD& data);