diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/llui/lllineeditor.cpp | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/llui/lllineeditor.cpp')
-rw-r--r-- | linden/indra/llui/lllineeditor.cpp | 142 |
1 files changed, 85 insertions, 57 deletions
diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp index a12c9d8..12d1929 100644 --- a/linden/indra/llui/lllineeditor.cpp +++ b/linden/indra/llui/lllineeditor.cpp | |||
@@ -39,7 +39,6 @@ | |||
39 | #include "llmath.h" | 39 | #include "llmath.h" |
40 | #include "llfontgl.h" | 40 | #include "llfontgl.h" |
41 | #include "llgl.h" | 41 | #include "llgl.h" |
42 | #include "sound_ids.h" | ||
43 | #include "lltimer.h" | 42 | #include "lltimer.h" |
44 | 43 | ||
45 | //#include "llclipboard.h" | 44 | //#include "llclipboard.h" |
@@ -88,8 +87,8 @@ static LLRegisterWidget<LLLineEditor> r1("line_editor"); | |||
88 | // Member functions | 87 | // Member functions |
89 | // | 88 | // |
90 | 89 | ||
91 | LLLineEditor::LLLineEditor(const LLString& name, const LLRect& rect, | 90 | LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect, |
92 | const LLString& default_text, const LLFontGL* font, | 91 | const std::string& default_text, const LLFontGL* font, |
93 | S32 max_length_bytes, | 92 | S32 max_length_bytes, |
94 | void (*commit_callback)(LLUICtrl* caller, void* user_data ), | 93 | void (*commit_callback)(LLUICtrl* caller, void* user_data ), |
95 | void (*keystroke_callback)(LLLineEditor* caller, void* user_data ), | 94 | void (*keystroke_callback)(LLLineEditor* caller, void* user_data ), |
@@ -167,7 +166,7 @@ LLLineEditor::LLLineEditor(const LLString& name, const LLRect& rect, | |||
167 | // Scalable UI somehow made these rectangles off-by-one. | 166 | // Scalable UI somehow made these rectangles off-by-one. |
168 | // I don't know why. JC | 167 | // I don't know why. JC |
169 | LLRect border_rect(0, getRect().getHeight()-1, getRect().getWidth()-1, 0); | 168 | LLRect border_rect(0, getRect().getHeight()-1, getRect().getWidth()-1, 0); |
170 | mBorder = new LLViewBorder( "line ed border", border_rect, border_bevel, border_style, mBorderThickness ); | 169 | mBorder = new LLViewBorder( std::string("line ed border"), border_rect, border_bevel, border_style, mBorderThickness ); |
171 | addChild( mBorder ); | 170 | addChild( mBorder ); |
172 | mBorder->setFollows(FOLLOWS_LEFT|FOLLOWS_RIGHT|FOLLOWS_TOP|FOLLOWS_BOTTOM); | 171 | mBorder->setFollows(FOLLOWS_LEFT|FOLLOWS_RIGHT|FOLLOWS_TOP|FOLLOWS_BOTTOM); |
173 | 172 | ||
@@ -299,7 +298,7 @@ void LLLineEditor::setText(const LLStringExplicit &new_text) | |||
299 | // also consider entire string selected when mSelectAllonFocusReceived is set on an empty, focused line editor | 298 | // also consider entire string selected when mSelectAllonFocusReceived is set on an empty, focused line editor |
300 | all_selected = all_selected || (len == 0 && hasFocus() && mSelectAllonFocusReceived); | 299 | all_selected = all_selected || (len == 0 && hasFocus() && mSelectAllonFocusReceived); |
301 | 300 | ||
302 | LLString truncated_utf8 = new_text; | 301 | std::string truncated_utf8 = new_text; |
303 | if (truncated_utf8.size() > (U32)mMaxLengthBytes) | 302 | if (truncated_utf8.size() > (U32)mMaxLengthBytes) |
304 | { | 303 | { |
305 | truncated_utf8 = utf8str_truncate(new_text, mMaxLengthBytes); | 304 | truncated_utf8 = utf8str_truncate(new_text, mMaxLengthBytes); |
@@ -960,9 +959,9 @@ void LLLineEditor::paste() | |||
960 | 959 | ||
961 | // Clean up string (replace tabs and returns and remove characters that our fonts don't support.) | 960 | // Clean up string (replace tabs and returns and remove characters that our fonts don't support.) |
962 | LLWString clean_string(paste); | 961 | LLWString clean_string(paste); |
963 | LLWString::replaceTabsWithSpaces(clean_string, 1); | 962 | LLWStringUtil::replaceTabsWithSpaces(clean_string, 1); |
964 | //clean_string = wstring_detabify(paste, 1); | 963 | //clean_string = wstring_detabify(paste, 1); |
965 | LLWString::replaceChar(clean_string, '\n', mReplaceNewlinesWithSpaces ? ' ' : 182); // 182 == paragraph character | 964 | LLWStringUtil::replaceChar(clean_string, '\n', mReplaceNewlinesWithSpaces ? ' ' : 182); // 182 == paragraph character |
966 | 965 | ||
967 | // Insert the string | 966 | // Insert the string |
968 | 967 | ||
@@ -1396,11 +1395,11 @@ void LLLineEditor::draw() | |||
1396 | { | 1395 | { |
1397 | S32 text_len = mText.length(); | 1396 | S32 text_len = mText.length(); |
1398 | 1397 | ||
1399 | LLString saved_text; | 1398 | std::string saved_text; |
1400 | if (mDrawAsterixes) | 1399 | if (mDrawAsterixes) |
1401 | { | 1400 | { |
1402 | saved_text = mText.getString(); | 1401 | saved_text = mText.getString(); |
1403 | LLString text; | 1402 | std::string text; |
1404 | for (S32 i = 0; i < mText.length(); i++) | 1403 | for (S32 i = 0; i < mText.length(); i++) |
1405 | { | 1404 | { |
1406 | text += '*'; | 1405 | text += '*'; |
@@ -1595,7 +1594,7 @@ void LLLineEditor::draw() | |||
1595 | S32 cursor_right = cursor_left + UI_LINEEDITOR_CURSOR_THICKNESS; | 1594 | S32 cursor_right = cursor_left + UI_LINEEDITOR_CURSOR_THICKNESS; |
1596 | if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode() && !hasSelection()) | 1595 | if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode() && !hasSelection()) |
1597 | { | 1596 | { |
1598 | const LLWString space(utf8str_to_wstring(LLString(" "))); | 1597 | const LLWString space(utf8str_to_wstring(std::string(" "))); |
1599 | S32 wswidth = mGLFont->getWidth(space.c_str()); | 1598 | S32 wswidth = mGLFont->getWidth(space.c_str()); |
1600 | S32 width = mGLFont->getWidth(mText.getWString().c_str(), getCursor(), 1) + 1; | 1599 | S32 width = mGLFont->getWidth(mText.getWString().c_str(), getCursor(), 1) + 1; |
1601 | cursor_right = cursor_left + llmax(wswidth, width); | 1600 | cursor_right = cursor_left + llmax(wswidth, width); |
@@ -1623,6 +1622,23 @@ void LLLineEditor::draw() | |||
1623 | } | 1622 | } |
1624 | } | 1623 | } |
1625 | 1624 | ||
1625 | //draw label if no text is provided | ||
1626 | //but we should draw it in a different color | ||
1627 | //to give indication that it is not text you typed in | ||
1628 | if (0 == mText.length() && mReadOnly) | ||
1629 | { | ||
1630 | mGLFont->render(mLabel.getWString(), 0, | ||
1631 | mMinHPixels, (F32)text_bottom, | ||
1632 | label_color, | ||
1633 | LLFontGL::LEFT, | ||
1634 | LLFontGL::BOTTOM, | ||
1635 | LLFontGL::NORMAL, | ||
1636 | S32_MAX, | ||
1637 | mMaxHPixels - llround(rendered_pixels_right), | ||
1638 | &rendered_pixels_right, FALSE); | ||
1639 | } | ||
1640 | |||
1641 | |||
1626 | // Draw children (border) | 1642 | // Draw children (border) |
1627 | //mBorder->setVisible(TRUE); | 1643 | //mBorder->setVisible(TRUE); |
1628 | mBorder->setKeyboardFocusHighlight( TRUE ); | 1644 | mBorder->setKeyboardFocusHighlight( TRUE ); |
@@ -1635,10 +1651,11 @@ void LLLineEditor::draw() | |||
1635 | // draw label if no text provided | 1651 | // draw label if no text provided |
1636 | if (0 == mText.length()) | 1652 | if (0 == mText.length()) |
1637 | { | 1653 | { |
1638 | mGLFont->render(mLabel.getWString(), 0, | 1654 | mGLFont->render(mLabel.getWString(), 0, |
1639 | mMinHPixels, (F32)text_bottom, | 1655 | mMinHPixels, (F32)text_bottom, |
1640 | label_color, | 1656 | label_color, |
1641 | LLFontGL::LEFT, LLFontGL::BOTTOM, | 1657 | LLFontGL::LEFT, |
1658 | LLFontGL::BOTTOM, | ||
1642 | LLFontGL::NORMAL, | 1659 | LLFontGL::NORMAL, |
1643 | S32_MAX, | 1660 | S32_MAX, |
1644 | mMaxHPixels - llround(rendered_pixels_right), | 1661 | mMaxHPixels - llround(rendered_pixels_right), |
@@ -1772,7 +1789,7 @@ BOOL LLLineEditor::prevalidateFloat(const LLWString &str) | |||
1772 | 1789 | ||
1773 | BOOL success = TRUE; | 1790 | BOOL success = TRUE; |
1774 | LLWString trimmed = str; | 1791 | LLWString trimmed = str; |
1775 | LLWString::trim(trimmed); | 1792 | LLWStringUtil::trim(trimmed); |
1776 | S32 len = trimmed.length(); | 1793 | S32 len = trimmed.length(); |
1777 | if( 0 < len ) | 1794 | if( 0 < len ) |
1778 | { | 1795 | { |
@@ -1804,7 +1821,7 @@ BOOL LLLineEditor::prevalidateFloat(const LLWString &str) | |||
1804 | BOOL LLLineEditor::isPartOfWord(llwchar c) { return (c == '_') || isalnum(c); } | 1821 | BOOL LLLineEditor::isPartOfWord(llwchar c) { return (c == '_') || isalnum(c); } |
1805 | 1822 | ||
1806 | // static | 1823 | // static |
1807 | BOOL LLLineEditor::postvalidateFloat(const LLString &str) | 1824 | BOOL LLLineEditor::postvalidateFloat(const std::string &str) |
1808 | { | 1825 | { |
1809 | LLLocale locale(LLLocale::USER_LOCALE); | 1826 | LLLocale locale(LLLocale::USER_LOCALE); |
1810 | 1827 | ||
@@ -1813,7 +1830,7 @@ BOOL LLLineEditor::postvalidateFloat(const LLString &str) | |||
1813 | BOOL has_digit = FALSE; | 1830 | BOOL has_digit = FALSE; |
1814 | 1831 | ||
1815 | LLWString trimmed = utf8str_to_wstring(str); | 1832 | LLWString trimmed = utf8str_to_wstring(str); |
1816 | LLWString::trim(trimmed); | 1833 | LLWStringUtil::trim(trimmed); |
1817 | S32 len = trimmed.length(); | 1834 | S32 len = trimmed.length(); |
1818 | if( 0 < len ) | 1835 | if( 0 < len ) |
1819 | { | 1836 | { |
@@ -1873,7 +1890,7 @@ BOOL LLLineEditor::prevalidateInt(const LLWString &str) | |||
1873 | 1890 | ||
1874 | BOOL success = TRUE; | 1891 | BOOL success = TRUE; |
1875 | LLWString trimmed = str; | 1892 | LLWString trimmed = str; |
1876 | LLWString::trim(trimmed); | 1893 | LLWStringUtil::trim(trimmed); |
1877 | S32 len = trimmed.length(); | 1894 | S32 len = trimmed.length(); |
1878 | if( 0 < len ) | 1895 | if( 0 < len ) |
1879 | { | 1896 | { |
@@ -1904,7 +1921,7 @@ BOOL LLLineEditor::prevalidatePositiveS32(const LLWString &str) | |||
1904 | LLLocale locale(LLLocale::USER_LOCALE); | 1921 | LLLocale locale(LLLocale::USER_LOCALE); |
1905 | 1922 | ||
1906 | LLWString trimmed = str; | 1923 | LLWString trimmed = str; |
1907 | LLWString::trim(trimmed); | 1924 | LLWStringUtil::trim(trimmed); |
1908 | S32 len = trimmed.length(); | 1925 | S32 len = trimmed.length(); |
1909 | BOOL success = TRUE; | 1926 | BOOL success = TRUE; |
1910 | if(0 < len) | 1927 | if(0 < len) |
@@ -1938,7 +1955,7 @@ BOOL LLLineEditor::prevalidateNonNegativeS32(const LLWString &str) | |||
1938 | LLLocale locale(LLLocale::USER_LOCALE); | 1955 | LLLocale locale(LLLocale::USER_LOCALE); |
1939 | 1956 | ||
1940 | LLWString trimmed = str; | 1957 | LLWString trimmed = str; |
1941 | LLWString::trim(trimmed); | 1958 | LLWStringUtil::trim(trimmed); |
1942 | S32 len = trimmed.length(); | 1959 | S32 len = trimmed.length(); |
1943 | BOOL success = TRUE; | 1960 | BOOL success = TRUE; |
1944 | if(0 < len) | 1961 | if(0 < len) |
@@ -2093,7 +2110,7 @@ LLXMLNodePtr LLLineEditor::getXML(bool save_children) const | |||
2093 | 2110 | ||
2094 | if (mBorder) | 2111 | if (mBorder) |
2095 | { | 2112 | { |
2096 | LLString bevel; | 2113 | std::string bevel; |
2097 | switch(mBorder->getBevel()) | 2114 | switch(mBorder->getBevel()) |
2098 | { | 2115 | { |
2099 | default: | 2116 | default: |
@@ -2104,7 +2121,7 @@ LLXMLNodePtr LLLineEditor::getXML(bool save_children) const | |||
2104 | } | 2121 | } |
2105 | node->createChild("bevel_style", TRUE)->setStringValue(bevel); | 2122 | node->createChild("bevel_style", TRUE)->setStringValue(bevel); |
2106 | 2123 | ||
2107 | LLString style; | 2124 | std::string style; |
2108 | switch(mBorder->getStyle()) | 2125 | switch(mBorder->getStyle()) |
2109 | { | 2126 | { |
2110 | default: | 2127 | default: |
@@ -2141,7 +2158,7 @@ LLXMLNodePtr LLLineEditor::getXML(bool save_children) const | |||
2141 | // static | 2158 | // static |
2142 | LLView* LLLineEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) | 2159 | LLView* LLLineEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) |
2143 | { | 2160 | { |
2144 | LLString name("line_editor"); | 2161 | std::string name("line_editor"); |
2145 | node->getAttributeString("name", name); | 2162 | node->getAttributeString("name", name); |
2146 | 2163 | ||
2147 | LLRect rect; | 2164 | LLRect rect; |
@@ -2152,15 +2169,15 @@ LLView* LLLineEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory | |||
2152 | 2169 | ||
2153 | LLFontGL* font = LLView::selectFont(node); | 2170 | LLFontGL* font = LLView::selectFont(node); |
2154 | 2171 | ||
2155 | LLString text = node->getTextContents().substr(0, max_text_length - 1); | 2172 | std::string text = node->getTextContents().substr(0, max_text_length - 1); |
2156 | 2173 | ||
2157 | LLViewBorder::EBevel bevel_style = LLViewBorder::BEVEL_IN; | 2174 | LLViewBorder::EBevel bevel_style = LLViewBorder::BEVEL_IN; |
2158 | LLViewBorder::getBevelFromAttribute(node, bevel_style); | 2175 | LLViewBorder::getBevelFromAttribute(node, bevel_style); |
2159 | 2176 | ||
2160 | LLViewBorder::EStyle border_style = LLViewBorder::STYLE_LINE; | 2177 | LLViewBorder::EStyle border_style = LLViewBorder::STYLE_LINE; |
2161 | LLString border_string; | 2178 | std::string border_string; |
2162 | node->getAttributeString("border_style", border_string); | 2179 | node->getAttributeString("border_style", border_string); |
2163 | LLString::toLower(border_string); | 2180 | LLStringUtil::toLower(border_string); |
2164 | 2181 | ||
2165 | if (border_string == "texture") | 2182 | if (border_string == "texture") |
2166 | { | 2183 | { |
@@ -2186,7 +2203,7 @@ LLView* LLLineEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory | |||
2186 | border_style, | 2203 | border_style, |
2187 | border_thickness); | 2204 | border_thickness); |
2188 | 2205 | ||
2189 | LLString label; | 2206 | std::string label; |
2190 | if(node->getAttributeString("label", label)) | 2207 | if(node->getAttributeString("label", label)) |
2191 | { | 2208 | { |
2192 | line_editor->setLabel(label); | 2209 | line_editor->setLabel(label); |
@@ -2216,10 +2233,10 @@ LLView* LLLineEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory | |||
2216 | line_editor->setSelectAllonFocusReceived(selectall); | 2233 | line_editor->setSelectAllonFocusReceived(selectall); |
2217 | } | 2234 | } |
2218 | 2235 | ||
2219 | LLString prevalidate; | 2236 | std::string prevalidate; |
2220 | if(node->getAttributeString("prevalidate", prevalidate)) | 2237 | if(node->getAttributeString("prevalidate", prevalidate)) |
2221 | { | 2238 | { |
2222 | LLString::toLower(prevalidate); | 2239 | LLStringUtil::toLower(prevalidate); |
2223 | 2240 | ||
2224 | if ("ascii" == prevalidate) | 2241 | if ("ascii" == prevalidate) |
2225 | { | 2242 | { |
@@ -2271,11 +2288,11 @@ void LLLineEditor::cleanupClass() | |||
2271 | } | 2288 | } |
2272 | 2289 | ||
2273 | /* static */ | 2290 | /* static */ |
2274 | LLPointer<LLUIImage> LLLineEditor::parseImage(LLString name, LLXMLNodePtr from, LLPointer<LLUIImage> def) | 2291 | LLPointer<LLUIImage> LLLineEditor::parseImage(std::string name, LLXMLNodePtr from, LLPointer<LLUIImage> def) |
2275 | { | 2292 | { |
2276 | LLString xml_name; | 2293 | std::string xml_name; |
2277 | if (from->hasAttribute(name)) from->getAttributeString(name, xml_name); | 2294 | if (from->hasAttribute(name.c_str())) from->getAttributeString(name.c_str(), xml_name); |
2278 | if (xml_name == LLString::null) return def; | 2295 | if (xml_name == LLStringUtil::null) return def; |
2279 | LLPointer<LLUIImage> image = LLUI::getUIImage(xml_name); | 2296 | LLPointer<LLUIImage> image = LLUI::getUIImage(xml_name); |
2280 | return image.isNull() ? def : image; | 2297 | return image.isNull() ? def : image; |
2281 | } | 2298 | } |
@@ -2283,7 +2300,7 @@ LLPointer<LLUIImage> LLLineEditor::parseImage(LLString name, LLXMLNodePtr from, | |||
2283 | void LLLineEditor::setColorParameters(LLXMLNodePtr node) | 2300 | void LLLineEditor::setColorParameters(LLXMLNodePtr node) |
2284 | { | 2301 | { |
2285 | // overrides default image if supplied. | 2302 | // overrides default image if supplied. |
2286 | mImage = parseImage("image", node, mImage); | 2303 | mImage = parseImage(std::string("image"), node, mImage); |
2287 | 2304 | ||
2288 | LLColor4 color; | 2305 | LLColor4 color; |
2289 | if (LLUICtrlFactory::getAttributeColor(node,"cursor_color", color)) | 2306 | if (LLUICtrlFactory::getAttributeColor(node,"cursor_color", color)) |
@@ -2316,13 +2333,13 @@ void LLLineEditor::setColorParameters(LLXMLNodePtr node) | |||
2316 | } | 2333 | } |
2317 | } | 2334 | } |
2318 | 2335 | ||
2319 | BOOL LLLineEditor::setTextArg( const LLString& key, const LLStringExplicit& text ) | 2336 | BOOL LLLineEditor::setTextArg( const std::string& key, const LLStringExplicit& text ) |
2320 | { | 2337 | { |
2321 | mText.setArg(key, text); | 2338 | mText.setArg(key, text); |
2322 | return TRUE; | 2339 | return TRUE; |
2323 | } | 2340 | } |
2324 | 2341 | ||
2325 | BOOL LLLineEditor::setLabelArg( const LLString& key, const LLStringExplicit& text ) | 2342 | BOOL LLLineEditor::setLabelArg( const std::string& key, const LLStringExplicit& text ) |
2326 | { | 2343 | { |
2327 | mLabel.setArg(key, text); | 2344 | mLabel.setArg(key, text); |
2328 | return TRUE; | 2345 | return TRUE; |
@@ -2553,28 +2570,39 @@ void LLLineEditor::setReplaceNewlinesWithSpaces(BOOL replace) | |||
2553 | mReplaceNewlinesWithSpaces = replace; | 2570 | mReplaceNewlinesWithSpaces = replace; |
2554 | } | 2571 | } |
2555 | 2572 | ||
2573 | LLWString LLLineEditor::getConvertedText() const | ||
2574 | { | ||
2575 | LLWString text = getWText(); | ||
2576 | LLWStringUtil::trim(text); | ||
2577 | if (!mReplaceNewlinesWithSpaces) | ||
2578 | { | ||
2579 | LLWStringUtil::replaceChar(text,182,'\n'); // Convert paragraph symbols back into newlines. | ||
2580 | } | ||
2581 | return text; | ||
2582 | } | ||
2583 | |||
2556 | static LLRegisterWidget<LLSearchEditor> r2("search_editor"); | 2584 | static LLRegisterWidget<LLSearchEditor> r2("search_editor"); |
2557 | 2585 | ||
2558 | 2586 | ||
2559 | LLSearchEditor::LLSearchEditor(const LLString& name, | 2587 | LLSearchEditor::LLSearchEditor(const std::string& name, |
2560 | const LLRect& rect, | 2588 | const LLRect& rect, |
2561 | S32 max_length_bytes, | 2589 | S32 max_length_bytes, |
2562 | void (*search_callback)(const LLString& search_string, void* user_data), | 2590 | void (*search_callback)(const std::string& search_string, void* user_data), |
2563 | void* userdata) | 2591 | void* userdata) |
2564 | : | 2592 | : |
2565 | LLUICtrl(name, rect, TRUE, NULL, userdata), | 2593 | LLUICtrl(name, rect, TRUE, NULL, userdata), |
2566 | mSearchCallback(search_callback) | 2594 | mSearchCallback(search_callback) |
2567 | { | 2595 | { |
2568 | LLRect search_edit_rect(0, getRect().getHeight(), getRect().getWidth(), 0); | 2596 | LLRect search_edit_rect(0, getRect().getHeight(), getRect().getWidth(), 0); |
2569 | mSearchEdit = new LLLineEditor("search edit", | 2597 | mSearchEdit = new LLLineEditor(std::string("search edit"), |
2570 | search_edit_rect, | 2598 | search_edit_rect, |
2571 | LLString::null, | 2599 | LLStringUtil::null, |
2572 | NULL, | 2600 | NULL, |
2573 | max_length_bytes, | 2601 | max_length_bytes, |
2574 | NULL, | 2602 | NULL, |
2575 | onSearchEdit, | 2603 | onSearchEdit, |
2576 | NULL, | 2604 | NULL, |
2577 | this); | 2605 | this); |
2578 | 2606 | ||
2579 | mSearchEdit->setFollowsAll(); | 2607 | mSearchEdit->setFollowsAll(); |
2580 | mSearchEdit->setSelectAllonFocusReceived(TRUE); | 2608 | mSearchEdit->setSelectAllonFocusReceived(TRUE); |
@@ -2583,15 +2611,15 @@ LLSearchEditor::LLSearchEditor(const LLString& name, | |||
2583 | 2611 | ||
2584 | S32 btn_width = rect.getHeight(); // button is square, and as tall as search editor | 2612 | S32 btn_width = rect.getHeight(); // button is square, and as tall as search editor |
2585 | LLRect clear_btn_rect(rect.getWidth() - btn_width, rect.getHeight(), rect.getWidth(), 0); | 2613 | LLRect clear_btn_rect(rect.getWidth() - btn_width, rect.getHeight(), rect.getWidth(), 0); |
2586 | mClearSearchButton = new LLButton("clear search", | 2614 | mClearSearchButton = new LLButton(std::string("clear search"), |
2587 | clear_btn_rect, | 2615 | clear_btn_rect, |
2588 | "icn_clear_lineeditor.tga", | 2616 | std::string("icn_clear_lineeditor.tga"), |
2589 | "UIImgBtnCloseInactiveUUID", | 2617 | std::string("UIImgBtnCloseInactiveUUID"), |
2590 | LLString::null, | 2618 | LLStringUtil::null, |
2591 | onClearSearch, | 2619 | onClearSearch, |
2592 | this, | 2620 | this, |
2593 | NULL, | 2621 | NULL, |
2594 | LLString::null); | 2622 | LLStringUtil::null); |
2595 | mClearSearchButton->setFollowsRight(); | 2623 | mClearSearchButton->setFollowsRight(); |
2596 | mClearSearchButton->setFollowsTop(); | 2624 | mClearSearchButton->setFollowsTop(); |
2597 | mClearSearchButton->setImageColor(LLUI::sColorsGroup->getColor("TextFgTentativeColor")); | 2625 | mClearSearchButton->setImageColor(LLUI::sColorsGroup->getColor("TextFgTentativeColor")); |
@@ -2615,13 +2643,13 @@ LLSD LLSearchEditor::getValue() const | |||
2615 | } | 2643 | } |
2616 | 2644 | ||
2617 | //virtual | 2645 | //virtual |
2618 | BOOL LLSearchEditor::setTextArg( const LLString& key, const LLStringExplicit& text ) | 2646 | BOOL LLSearchEditor::setTextArg( const std::string& key, const LLStringExplicit& text ) |
2619 | { | 2647 | { |
2620 | return mSearchEdit->setTextArg(key, text); | 2648 | return mSearchEdit->setTextArg(key, text); |
2621 | } | 2649 | } |
2622 | 2650 | ||
2623 | //virtual | 2651 | //virtual |
2624 | BOOL LLSearchEditor::setLabelArg( const LLString& key, const LLStringExplicit& text ) | 2652 | BOOL LLSearchEditor::setLabelArg( const std::string& key, const LLStringExplicit& text ) |
2625 | { | 2653 | { |
2626 | return mSearchEdit->setLabelArg(key, text); | 2654 | return mSearchEdit->setLabelArg(key, text); |
2627 | } | 2655 | } |
@@ -2658,17 +2686,17 @@ void LLSearchEditor::onClearSearch(void* user_data) | |||
2658 | { | 2686 | { |
2659 | LLSearchEditor* search_editor = (LLSearchEditor*)user_data; | 2687 | LLSearchEditor* search_editor = (LLSearchEditor*)user_data; |
2660 | 2688 | ||
2661 | search_editor->setText(LLString::null); | 2689 | search_editor->setText(LLStringUtil::null); |
2662 | if (search_editor->mSearchCallback) | 2690 | if (search_editor->mSearchCallback) |
2663 | { | 2691 | { |
2664 | search_editor->mSearchCallback(LLString::null, search_editor->mCallbackUserData); | 2692 | search_editor->mSearchCallback(LLStringUtil::null, search_editor->mCallbackUserData); |
2665 | } | 2693 | } |
2666 | } | 2694 | } |
2667 | 2695 | ||
2668 | // static | 2696 | // static |
2669 | LLView* LLSearchEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) | 2697 | LLView* LLSearchEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) |
2670 | { | 2698 | { |
2671 | LLString name("search_editor"); | 2699 | std::string name("search_editor"); |
2672 | node->getAttributeString("name", name); | 2700 | node->getAttributeString("name", name); |
2673 | 2701 | ||
2674 | LLRect rect; | 2702 | LLRect rect; |
@@ -2677,14 +2705,14 @@ LLView* LLSearchEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto | |||
2677 | S32 max_text_length = 128; | 2705 | S32 max_text_length = 128; |
2678 | node->getAttributeS32("max_length", max_text_length); | 2706 | node->getAttributeS32("max_length", max_text_length); |
2679 | 2707 | ||
2680 | LLString text = node->getValue().substr(0, max_text_length - 1); | 2708 | std::string text = node->getValue().substr(0, max_text_length - 1); |
2681 | 2709 | ||
2682 | LLSearchEditor* search_editor = new LLSearchEditor(name, | 2710 | LLSearchEditor* search_editor = new LLSearchEditor(name, |
2683 | rect, | 2711 | rect, |
2684 | max_text_length, | 2712 | max_text_length, |
2685 | NULL, NULL); | 2713 | NULL, NULL); |
2686 | 2714 | ||
2687 | LLString label; | 2715 | std::string label; |
2688 | if(node->getAttributeString("label", label)) | 2716 | if(node->getAttributeString("label", label)) |
2689 | { | 2717 | { |
2690 | search_editor->mSearchEdit->setLabel(label); | 2718 | search_editor->mSearchEdit->setLabel(label); |