From dd99e2a6b5054927bba83d44a7a03bc365c28a77 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 12 Jan 2009 02:17:03 -0700 Subject: Applied Aimee's patch for doing simple math in the build editor --- linden/indra/llui/llspinctrl.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'linden/indra/llui/llspinctrl.cpp') diff --git a/linden/indra/llui/llspinctrl.cpp b/linden/indra/llui/llspinctrl.cpp index a106af4..b12d095 100644 --- a/linden/indra/llui/llspinctrl.cpp +++ b/linden/indra/llui/llspinctrl.cpp @@ -49,7 +49,7 @@ #include "llfocusmgr.h" #include "llresmgr.h" -const U32 MAX_STRING_LENGTH = 32; +const U32 MAX_STRING_LENGTH = 255; static LLRegisterWidget r2("spinner"); @@ -123,7 +123,7 @@ LLSpinCtrl::LLSpinCtrl( const std::string& name, const LLRect& rect, const std:: mEditor = new LLLineEditor( std::string("SpinCtrl Editor"), editor_rect, LLStringUtil::null, font, MAX_STRING_LENGTH, &LLSpinCtrl::onEditorCommit, NULL, NULL, this, - &LLLineEditor::prevalidateFloat ); + &LLLineEditor::prevalidateASCII ); mEditor->setFollowsLeft(); mEditor->setFollowsBottom(); mEditor->setFocusReceivedCallback( &LLSpinCtrl::onEditorGainFocus, this ); @@ -132,6 +132,7 @@ LLSpinCtrl::LLSpinCtrl( const std::string& name, const LLRect& rect, const std:: // it's easier to understand //mEditor->setSelectAllonFocusReceived(TRUE); mEditor->setIgnoreTab(TRUE); + mEditor->setSelectAllonCommit(FALSE); addChild(mEditor); updateEditor(); @@ -292,9 +293,10 @@ void LLSpinCtrl::onEditorCommit( LLUICtrl* caller, void *userdata ) LLSpinCtrl* self = (LLSpinCtrl*) userdata; llassert( caller == self->mEditor ); - std::string text = self->mEditor->getText(); - if( LLLineEditor::postvalidateFloat( text ) ) + if( self->mEditor->evaluateFloat() ) { + std::string text = self->mEditor->getText(); + LLLocale locale(LLLocale::USER_LOCALE); F32 val = (F32) atof(text.c_str()); @@ -322,9 +324,12 @@ void LLSpinCtrl::onEditorCommit( LLUICtrl* caller, void *userdata ) success = TRUE; } } - self->updateEditor(); - if( !success ) + if( success ) + { + self->updateEditor(); + } + else { self->reportInvalidData(); } -- cgit v1.1