diff options
author | elektrahesse | 2010-09-07 18:39:40 +0200 |
---|---|---|
committer | elektrahesse | 2010-09-07 18:39:40 +0200 |
commit | 22383f92482798cf5b5439396bdcdf1c8f9aa073 (patch) | |
tree | 538bc3c53d1d1f4245cf738d6ac045fa57dbe8d4 /linden/indra/llui/lllineeditor.cpp | |
parent | Merge branch 'weekly' of git://github.com/mccabe/imprudence into weekly (diff) | |
parent | Use solid circles instead of asterisks for password fields. (diff) | |
download | meta-impy-22383f92482798cf5b5439396bdcdf1c8f9aa073.zip meta-impy-22383f92482798cf5b5439396bdcdf1c8f9aa073.tar.gz meta-impy-22383f92482798cf5b5439396bdcdf1c8f9aa073.tar.bz2 meta-impy-22383f92482798cf5b5439396bdcdf1c8f9aa073.tar.xz |
Merge branch 'weekly' of git://github.com/mccabe/imprudence into weekly
Diffstat (limited to 'linden/indra/llui/lllineeditor.cpp')
-rw-r--r-- | linden/indra/llui/lllineeditor.cpp | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp index 5441d0a..c1d8efa 100644 --- a/linden/indra/llui/lllineeditor.cpp +++ b/linden/indra/llui/lllineeditor.cpp | |||
@@ -439,7 +439,7 @@ S32 LLLineEditor::calculateCursorFromMouse( S32 local_mouse_x ) | |||
439 | { | 439 | { |
440 | for (S32 i = 0; i < mText.length(); i++) | 440 | for (S32 i = 0; i < mText.length(); i++) |
441 | { | 441 | { |
442 | asterix_text += '*'; | 442 | asterix_text += (llwchar) 0x2022L; |
443 | } | 443 | } |
444 | wtext = asterix_text.c_str(); | 444 | wtext = asterix_text.c_str(); |
445 | } | 445 | } |
@@ -1938,7 +1938,7 @@ void LLLineEditor::draw() | |||
1938 | std::string text; | 1938 | std::string text; |
1939 | for (S32 i = 0; i < mText.length(); i++) | 1939 | for (S32 i = 0; i < mText.length(); i++) |
1940 | { | 1940 | { |
1941 | text += '*'; | 1941 | text += "\xe2\x80\xa2"; |
1942 | } | 1942 | } |
1943 | mText = text; | 1943 | mText = text; |
1944 | } | 1944 | } |
@@ -2621,28 +2621,37 @@ BOOL LLLineEditor::prevalidateASCII(const LLWString &str) | |||
2621 | 2621 | ||
2622 | BOOL LLLineEditor::evaluateFloat() | 2622 | BOOL 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 | ||
2648 | void LLLineEditor::onMouseCaptureLost() | 2657 | void LLLineEditor::onMouseCaptureLost() |