From fd1b7eea67273df41bde0b6af2df4b3cb8b302de Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sun, 23 May 2010 15:17:19 -0700 Subject: Fixed #295: spinners in the build tools aren't updating after their contents are deleted --- linden/indra/llui/lllineeditor.cpp | 38 +++++++++++++++++++++++--------------- linden/indra/llui/llspinctrl.cpp | 5 +++++ 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp index c574814..21f0800 100644 --- a/linden/indra/llui/lllineeditor.cpp +++ b/linden/indra/llui/lllineeditor.cpp @@ -2164,28 +2164,36 @@ BOOL LLLineEditor::prevalidateASCII(const LLWString &str) BOOL LLLineEditor::evaluateFloat() { - bool success; - F32 result = 0.f; + bool success = false; std::string expr = getText(); - success = LLCalc::getInstance()->evalString(expr, result); - - if (!success) + // user deleted the contents, nothing to evaluate -- MC + if (expr.empty()) { - // Move the cursor to near the error on failure - setCursor(LLCalc::getInstance()->getLastErrorPos()); - // *TODO: Translated error message indicating the type of error? Select error text? + return success; } else { - // Replace the expression with the result - std::ostringstream result_str; - result_str << result; - setText(result_str.str()); - selectAll(); - } + F32 result = 0.f; + success = LLCalc::getInstance()->evalString(expr, result); - return success; + if (!success) + { + // Move the cursor to near the error on failure + setCursor(LLCalc::getInstance()->getLastErrorPos()); + // *TODO: Translated error message indicating the type of error? Select error text? + } + else + { + // Replace the expression with the result + std::ostringstream result_str; + result_str << result; + setText(result_str.str()); + selectAll(); + } + + return success; + } } void LLLineEditor::onMouseCaptureLost() diff --git a/linden/indra/llui/llspinctrl.cpp b/linden/indra/llui/llspinctrl.cpp index 760fbfd..7eccaca 100644 --- a/linden/indra/llui/llspinctrl.cpp +++ b/linden/indra/llui/llspinctrl.cpp @@ -325,6 +325,11 @@ void LLSpinCtrl::onEditorCommit( LLUICtrl* caller, void *userdata ) success = TRUE; } } + else + { + // We want to update the editor in case it fails while blanking -- MC + success = TRUE; + } if( success ) { -- cgit v1.1