aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui
diff options
context:
space:
mode:
authorMcCabe Maxsted2010-09-06 19:49:48 -0700
committerMcCabe Maxsted2010-09-06 19:49:48 -0700
commit856b7ad6a941099939039e06180c392301596897 (patch)
tree2c107e5e56f9761f5ba0973a77401feedf4137d3 /linden/indra/llui
parentAdded slider to control the number of avatar imposters (can't think of a bett... (diff)
downloadmeta-impy-856b7ad6a941099939039e06180c392301596897.zip
meta-impy-856b7ad6a941099939039e06180c392301596897.tar.gz
meta-impy-856b7ad6a941099939039e06180c392301596897.tar.bz2
meta-impy-856b7ad6a941099939039e06180c392301596897.tar.xz
Fixed regression of #295 in the 09.04 experimental
Diffstat (limited to 'linden/indra/llui')
-rw-r--r--linden/indra/llui/lllineeditor.cpp37
1 files changed, 23 insertions, 14 deletions
diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp
index 5441d0a..7d91ece 100644
--- a/linden/indra/llui/lllineeditor.cpp
+++ b/linden/indra/llui/lllineeditor.cpp
@@ -2621,28 +2621,37 @@ BOOL LLLineEditor::prevalidateASCII(const LLWString &str)
2621 2621
2622BOOL LLLineEditor::evaluateFloat() 2622BOOL LLLineEditor::evaluateFloat()
2623{ 2623{
2624 bool success; 2624 bool success = false;
2625 F32 result = 0.f;
2626 std::string expr = getText(); 2625 std::string expr = getText();
2627 LLStringUtil::toUpper(expr); 2626 LLStringUtil::toUpper(expr);
2628 2627
2629 success = LLCalc::getInstance()->evalString(expr, result); 2628 // user deleted the contents, nothing to evaluate -- MC
2630 2629 if (expr.empty())
2631 if (!success)
2632 { 2630 {
2633 // Move the cursor to near the error on failure 2631 return success;
2634 setCursor(LLCalc::getInstance()->getLastErrorPos());
2635 // *TODO: Translated error message indicating the type of error? Select error text?
2636 } 2632 }
2637 else 2633 else
2638 { 2634 {
2639 // Replace the expression with the result 2635 F32 result = 0.f;
2640 std::string result_str = llformat("%f",result); 2636 success = LLCalc::getInstance()->evalString(expr, result);
2641 setText(result_str);
2642 selectAll();
2643 }
2644 2637
2645 return success; 2638 if (!success)
2639 {
2640 // Move the cursor to near the error on failure
2641 setCursor(LLCalc::getInstance()->getLastErrorPos());
2642 // *TODO: Translated error message indicating the type of error? Select error text?
2643 }
2644 else
2645 {
2646 // Replace the expression with the result
2647 std::ostringstream result_str;
2648 result_str << result;
2649 setText(result_str.str());
2650 selectAll();
2651 }
2652
2653 return success;
2654 }
2646} 2655}
2647 2656
2648void LLLineEditor::onMouseCaptureLost() 2657void LLLineEditor::onMouseCaptureLost()