From 51725b3898df96aa5819d86d1e8e7c71b47304f2 Mon Sep 17 00:00:00 2001
From: Paul ProductEngine <pguslisty@productengine.com>
Date: Wed, 12 Sep 2012 14:09:13 +0300
Subject: CHUI-335 FIXED (Alpha text allowed in page spinner in chat history
 viewer)

- Added XML parameter "allow_digits_only" to spinner control widget, which disables/enables ability to input alpha text.
- Disabled ability to enter alpha text in page spinner in chat history viewer
---
 indra/llui/llspinctrl.cpp                                           | 5 +++++
 indra/llui/llspinctrl.h                                             | 1 +
 indra/newview/skins/default/xui/en/floater_conversation_preview.xml | 1 +
 3 files changed, 7 insertions(+)

diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp
index 934879cdfd..8a728df2e7 100644
--- a/indra/llui/llspinctrl.cpp
+++ b/indra/llui/llspinctrl.cpp
@@ -52,6 +52,7 @@ LLSpinCtrl::Params::Params()
 :	label_width("label_width"),
 	decimal_digits("decimal_digits"),
 	allow_text_entry("allow_text_entry", true),
+	allow_digits_only("allow_digits_only", false),
 	label_wrap("label_wrap", false),
 	text_enabled_color("text_enabled_color"),
 	text_disabled_color("text_disabled_color"),
@@ -129,6 +130,10 @@ 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 ));
+	if (p.allow_digits_only)
+	{
+		mEditor->setPrevalidateInput(LLTextValidate::validateNonNegativeS32NoSpace);
+	}
 	//RN: this seems to be a BAD IDEA, as it makes the editor behavior different when it has focus
 	// than when it doesn't.  Instead, if you always have to double click to select all the text, 
 	// it's easier to understand
diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h
index 87814f838e..e34add879d 100644
--- a/indra/llui/llspinctrl.h
+++ b/indra/llui/llspinctrl.h
@@ -44,6 +44,7 @@ public:
 		Optional<S32> label_width;
 		Optional<U32> decimal_digits;
 		Optional<bool> allow_text_entry;
+		Optional<bool> allow_digits_only;
 		Optional<bool> label_wrap;
 
 		Optional<LLUIColor> text_enabled_color;
diff --git a/indra/newview/skins/default/xui/en/floater_conversation_preview.xml b/indra/newview/skins/default/xui/en/floater_conversation_preview.xml
index 825a88e4e1..0e5af67f68 100644
--- a/indra/newview/skins/default/xui/en/floater_conversation_preview.xml
+++ b/indra/newview/skins/default/xui/en/floater_conversation_preview.xml
@@ -39,6 +39,7 @@
      width="35">
     </text>
     <spinner
+     allow_digits_only="true"
      decimal_digits="0"
      follows="bottom|right"
      height="23"
-- 
cgit v1.2.3